OpenWrt Forum Archive

Topic: How to extract openwrt firmware ?

The content of this topic has been archived on 24 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have a backup of openwrt firmware, the backup is done via

cat /dev/mtd5 > /tmp/backup.bin

And I want to see the files in it on my linux computer without having to restore the firmware to a router. I have tried firmware mod kit https://github.com/openwrt-stuff/firmware-mod-kit and extracted the firmware with

./extract-firmware.sh backup.bin

but instead of extracting the firmware it gave me 3 files:

header.img
footer.img
rootfs.img

With the file command it gave me the following result:
https://s15.postimg.org/qrmikcvln/Screenshot_-_110617_-_12_58_29.png
How do I extract the firmware ?

Hey there.

You could just mount it somewhere.
http://madduck.net/blog/2006.10.20:loop … isk-image/


Since there's only one partition dumped and no boot sector, maybe that's what you want to do:

mount -o loop backup.bin /mnt

Regards,
Stephan.

(Last edited by golialive on 11 Jun 2017, 11:01)

golialive wrote:

Hey there.

You could just mount it somewhere.
http://madduck.net/blog/2006.10.20:loop … isk-image/


Since there's only one partition dumped and no boot sector, maybe that's what you want to do:

mount -o loop backup.bin /mnt

Regards,
Stephan.

I can't

me@me-VirtualBox:~$ sudo mount -o loop openwrt/firmware-mod-kit/backup.bin /mnt/openwrt/
mount: you must specify the filesystem type
me@me-VirtualBox:~$ file openwrt/firmware-mod-kit/backup.bin 
openwrt/firmware-mod-kit/backup.bin: dBase IV DBT of Wrt.DBF, blocks size 1852141647, next free block index 1, 1st item "m"
me@me-VirtualBox:~$

You would pull the filesystem out with firmware mod kit then loop-mount that file.  You may need to explicitly specify the file system type.  Check /proc/filesystems on your PC to be sure squashfs (the rootfs) and jffs2 (the overlay rootfs_data) are supported.

(Last edited by mk24 on 11 Jun 2017, 15:59)

The discussion might have continued from here.