chunghuihuang / firmware-mod-kit

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

build-ng.sh ended with an error of firmware size comparison #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. used extract-ng.sh to extract a dd-wrt firmware successfully.
2. created a new dir "rootfs/usr/local/bin" in the working directory, and then 
copied several shell script files in it.
3. finally, when I used build-ng.sh to rebuild the working directory, I got an 
error output as follows.

What is the expected output? What do you see instead?

ERROR: New firmware image will be larger than original image! This is not 
supported.
        Original file size: 12754972
        Current file size:  12832796
Quitting...

What version of the product are you using? On what operating system?

The version of Mod Kit is as follows.
Firmware Mod Kit (build-ng) 0.71 beta, (c)2011 Craig Heffner, Jeremy Collake

The OS is ubuntu 10.4 64bit

Please provide any additional information below.

a. The dd-wrt firmware image is at 
http://www.dd-wrt.com/routerdb/de/download/Buffalo/WZR-HP-G300NH/-/wzr-hp-g300nh
-dd-wrt-webupgrade-MULTI.bin/3778
b. I had also tried to modify "build-ng.sh" to ingore the file size comparison. 
It seemed that my script could build firmware image OK, however, the new image 
file brick my wireless router.
c. In fact, I had ever done almost the same operation with 
"extract_firmware.sh" and "build_firmware.sh" without any problems. 
Unfortunately, these two scripts don't work for the above dd-wrt firmware image.

Original issue reported on code.google.com by f5st...@gmail.com on 8 Oct 2011 at 8:25

GoogleCodeExporter commented 9 years ago
Yes, there's a reason build-ng refuses to build firmware images larger than the 
original: it could very well end up bricking the device.

The issue here is not specific to the build-ng script, but to the compression 
level used by mksquashfs. We use the same squashfs tools that dd-wrt makes 
available via their code repository, so if dd-wrt can compress the file system 
better than we can, it could very well be that they are using a different 
version of mksquashfs than is available via their code repository.

Here's a question: can you re-build the firmware successfully without any 
modifications? 

Probably the only thing you can do here is to minimize the size of the squashfs 
file system; if you can get rid of any files in there to make the file system 
smaller, that will help, but BE CAREFUL! Deleting the wrong things can brick 
your device.

Original comment by heffne...@gmail.com on 8 Oct 2011 at 11:52

GoogleCodeExporter commented 9 years ago
OK, just tried this myself and without any modifications to the firmware image 
it re-builds fine and build-ng reports that there are 0 free bytes available in 
the firmware image. So if you want to add something to the file system, you're 
probably going to have to remove other things.

Question though, if you're just adding some shell scripts to the firmware 
image, can't you just drop them in the JFFS2 partition without having to modify 
the firmware update file?

Original comment by heffne...@gmail.com on 9 Oct 2011 at 12:54

GoogleCodeExporter commented 9 years ago
Closing as invalid; all tools are working as intended.

Original comment by heffne...@gmail.com on 9 Oct 2011 at 2:53

GoogleCodeExporter commented 9 years ago
Thanks for your comments. I also tried to rebuildi other dd-wrt firmwares for 
netgear and tp-link, and met no any problems. It seems that only buffalo 
firmwares have such issue. I hope someone can show how to customize buffalo 
fireware. 

My current solution is to choose Netgear as the testbed.

Original comment by f5st...@gmail.com on 10 Oct 2011 at 2:43

GoogleCodeExporter commented 9 years ago
Well, you can modify the Buffalo firmware, just remove things that you don't 
want/need and then you can add your scripts.

Original comment by heffne...@gmail.com on 10 Oct 2011 at 8:29