firelizzard18 / firmware-mod-kit

Automatically exported from code.google.com/p/firmware-mod-kit
0 stars 1 forks source link

extract_firmware DIR-600 error #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

Hi, 

When I run 

sudo ./extract_firmware.sh dir600b-revb-ddwrt-webflash.bin ./work/ 

have error: 
=========== 
Firmware Mod Kit (extract) v0.62 beta, (c)2008 Jeremy Collake 
http://www.bitsum.com 
Checking for updates ... 
! WARNING: Could not check for update. No connectivity or server down? 
LINUX system detected. Compatibility ok. 
Testing file system of ./work/ ... 
Building tools ... 
Build seems successful. 
Preparing working directory ... 
Removing any previous files ... 
Creating directories ... 
Extracting firmware 
Attempting raw linux style firmware package (i.e. TEW-632BRP) ... 
Extracting dir600b-revb-ddwrt-webflash.bin to ./work/ ... 
Can't find a SQUASHFS superblock on ./work//image_parts/squashfs-3-lzma.img 
Error: filesystem not extracted properly. 
firmware image format not compatible?

Original issue reported on code.google.com by leixu...@gmail.com on 21 Apr 2010 at 10:03

GoogleCodeExporter commented 8 years ago
The DIR600 DD-WRT image has both a TRX header and a uImage header, which I 
think confuses the extract_firmware.sh script. Looking at the extract.log file, 
you should see something like:

 untrx 0.54 beta - (c)2006-2010 Jeremy Collake
 Opening dir600b-revb-ddwrt-webflash.bin
 read 3661852 bytes
  Writing test/image_parts/segment1
    size 3661824 from offset 28 ...
  Done!

In other words, the untrx tool saw a TRX header and assumed the file system 
immediately followed the TRX header at offset 28, when in fact the file system 
is located at offset 868380.

A temporary fix is to comment out the untrx call in the extract_firmware.sh 
script, forcing the splitter3 tool to be invoked instead, which will properly 
locate and extract the SquashFS file system. 

In the extract_firmware.sh file, comment out lines 111, 112, and 122. The file 
should then look like:

110                echo " Extracting firmware"
111                #"src/untrx" "$1" "$2/image_parts" >> extract.log 2>&1       

112                #if [ $? != 0 ]; then
113                        echo "! untrx failed, trying splitter3";
114                        "src/splitter3" "$1" "$2/image_parts" >> extract.log 
2>&1
115                        if [ $? != 0 ]; then
116                                echo " Not recognized by splitter3";
117                                # exit 1
118                        else
119                                touch "$2/.linux_raw_type3"
120                                touch "$2/.squashfs3_lzma_fs"
121                        fi
122                #fi

Re-run extract_firmware.sh and it should work.

Original comment by heffne...@gmail.com on 8 Aug 2011 at 2:31

GoogleCodeExporter commented 8 years ago
The firmware is properly extracted with the extract-ng.sh script (requires 
binwalk).

Original comment by heffne...@gmail.com on 30 Aug 2011 at 12:15

GoogleCodeExporter commented 8 years ago
This issue still exists with me on the ng script.
A temporary workaround was to modify line 62 to this:

$BINWALK -f "$BINLOG" -d -x invalid -y squashfs "$IMG"

Original comment by seth.sk...@gmail.com on 16 Nov 2011 at 1:34