secopsbot / firmware-mod-kit

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

Need support for DD-WRT v24 preSP2 #78

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. ./extract-ng.sh
2. nothing
3. ./build_firmware.sh

What is the expected output? What do you see instead?
The image is builded ok, but it fails to flash through the web-interface on the 
same version of DD-WRT.

What version of the product are you using? On what operating system?
DD-WRT r19519-r20119, FMK r360.
Please provide any additional information below.

Original issue reported on code.google.com by m...@abatapa.ru on 23 Nov 2012 at 6:10

GoogleCodeExporter commented 8 years ago
I assume DD-WRT changed their webui package and/or firmware image yet again as 
to break compatibility with the FMK, quite intentionally. From a legal 
stand-point, I believe support can only be added if he continued to use 
modification of GPL'd F/OSS tools (afaik) to create his webui. If he didn't, 
then we get into grey territory. From a consumer stand-point, you should at the 
very least be mindful of this not being a F/OSS project anymore, at least not 
in the true or full sense of the word, in my opinion.

Original comment by jeremy.collake@gmail.com on 23 Nov 2012 at 6:38

GoogleCodeExporter commented 8 years ago
'this' being DD-WRT of course

Original comment by jeremy.collake@gmail.com on 23 Nov 2012 at 6:40

GoogleCodeExporter commented 8 years ago

However, the source code available under the GPL?

Original comment by m...@abatapa.ru on 23 Nov 2012 at 6:58

GoogleCodeExporter commented 8 years ago
DD-WRT's source code GPL.. well, being a derivative work you would think, and 
it always has been from top to bottom to the best of my knowledge. But, is it? 
Can you download and compile it? To date, I've not known anyone able to. 
Supposedly it is possible, but many developers have given up after addressing 
countless build problems and potentially huge missing components (e.g. the 
precious web ui, I am not sure if its presence is there, and if it is there 
somewhere, it is likely in its post-compiled/encrypted form). Ironically, as I 
allude to above, the tool he has used in the past to encrypt/decrypt his web UI 
is again a GPL derivative work, afaik. Thus, his modifications to it should be 
required to be published, but I'm not sure on this, and am no lawyer. He may 
well publish such if asked. In general, you get the idea, this F/OSS project 
has gone commercial and, seemingly at least to me, taken a lot of steps to 
protect itself from clones, forks, etc.. that normally come with a F/OSS 
project. That is fine and dandy if the code is 100% your own, but when you get 
into derivative works, that violates some licenses, in some cases, though I am 
not making any accusation or claim here. That's about as carefully as I can 
word things while being polite, thorough, and defensive.

Original comment by jeremy.collake@gmail.com on 23 Nov 2012 at 8:15

GoogleCodeExporter commented 8 years ago
And I think the evidence is the now several changes made specifically to break 
compatibility with this simple Firmware Mod Kit... Nothing new though, that has 
happened for years.

Original comment by jeremy.collake@gmail.com on 23 Nov 2012 at 8:17

GoogleCodeExporter commented 8 years ago
Though this is all assuming the issue is not just your own ... which I assume 
it isn't. You can test this by simply using an older revision of DD-WRT v24 SP2 
(same version number that has existed for years).

Original comment by jeremy.collake@gmail.com on 23 Nov 2012 at 8:18

GoogleCodeExporter commented 8 years ago

Difficult English for me. :)
But the essence I understood, and I agree with you. How easy is it to compile 
OpenWRT, and how many problems with DD-WRT...
I was just hoping that changes in the method of compressing images/GUI 
insignificant, and they will appear in your project.
Suffer with the Assembly of 12GB of source code, to change, sometimes, a couple 
of lines...

Original comment by m...@abatapa.ru on 23 Nov 2012 at 8:22

GoogleCodeExporter commented 8 years ago
> You can test this by simply using an older revision of DD-WRT v24 SP2

I tested on different images from here:
ftp://www.dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/2012/
(requires version starting with r19327 to support the RT-N13UB1 (for Zyxel 
Keenetic).

Original comment by m...@abatapa.ru on 23 Nov 2012 at 8:25

GoogleCodeExporter commented 8 years ago
What are the results of the tests? Did older images work? If not, then despite 
my rant, it may be an issue of compatibility with that target device.

Original comment by jeremy.collake@gmail.com on 23 Nov 2012 at 8:32

GoogleCodeExporter commented 8 years ago
Hmmm... Sorry, I guess my statement of support for SP2 sounds wrong, the 
problem is with the way Asus-RTN13UB1.
With D-Link DIR-615(D) revision 19519 
(ftp://www.dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/2012/07-20-12-r19519/dli
nk-dir615d/)  disassembled and assembled successfully. But not work with Asus 
RT-N13UB1 image (testing with Zyxel Keenetic, some hardware, do not have the 
possibility to check the original RTN13UB1) - 'write /tmp/??? linux' exit with 
error, 'Upgrade failed.' in WebUI.
asustrx code? The resulting size is correct, the modified firmware successfully 
unpacked again.

Original comment by m...@abatapa.ru on 23 Nov 2012 at 10:04

GoogleCodeExporter commented 8 years ago
Did you happen to solve this issue?

I have a similar issue.  I used the latest firmware-mod-kit on RT-N13UB1 fw 
images as follows:
1. ./extract-ng.sh
nothing
2. ./build-ng.sh

When I attempt to flush the new image into the dd-wrt device using web 
interface I get the "Upgrade failed." error message with no additional details.
I have also tried flushing the image using the tftp, and the device seem just 
to hung.

Any ideas where I can find more information on how to fix this?

Original comment by vlaser...@gmail.com on 3 Jan 2013 at 4:12

GoogleCodeExporter commented 8 years ago
I have also attempted to deconstruct and build DD-WRT v 20453 for the Asus 
RT-N13U (not B1), formware can be found here: 
ftp://www.dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/2013/01-01-2013-r20453/As
us-RTN13U/

extract-ng appears to work for the .bin, but even with no modifications it 
builds to a size greater than the original.  If I use the -min flag I can get 
it to build but then the firmware is incorrect, and bricks my device (brought 
back to life via asus restore utility ofc).

extract_firmware on the trx does not work, as it cannot identify the 
filesystem.  I get a segfault which I traced back to unsquashfs.

I'm a little perturbed to hear that brainslayer might be intentionally mucking 
with things to break compatibility with fmk.  Can't see the logic behind that.

In any case, if there is a possible resolution to modifying these latest DD-WRT 
firmwares please let us know.  The latest build is the first that will fit on 
this router in over a year.

Original comment by Russell....@gmail.com on 6 Jan 2013 at 5:57

GoogleCodeExporter commented 8 years ago
Did a test of extracting/building/extracting and got some interesting results.  
Notably, the first extraction grabbed a 16-byte footer while the second found a 
32-byte footer.

[root@CentOSvbox trunk]# ./extract-ng.sh Asus-RTN13U-webflash_latest.bin 
Firmware Mod Kit (build-ng) 0.78 beta, (c)2011-2012 Craig Heffner, Jeremy 
Collake
http://www.bitsum.com

Scanning firmware...

DECIMAL     HEX         DESCRIPTION
--------------------------------------------------------------------------------
-----------------------
0           0x4         (null)
0           0x4         (null)
0           0x4         (null)

Extracting 983068 bytes of trx header image at offset 0
Extracting squashfs file system at offset 983068
Extracting 16 byte footer from offset 3776524
Extracting squashfs files...
Firmware extraction successful!
Firmware parts can be found in 'fmk/*'
[root@CentOSvbox trunk]# ./build-ng.sh 
Firmware Mod Kit (build-ng) 0.78 beta, (c)2012 Craig Heffner, Jeremy Collake
http://www.bitsum.com

Building new squashfs file system...
Creating little endian 3.0 filesystem on fmk/new-filesystem.squashfs, block 
size 131072.
use method [pb:2 lc:0 lp:2 fb:-1] (len 51611)
use method [pb:2 lc:0 lp:2 fb:-1] (len 58027)
use method [pb:2 lc:0 lp:2 fb:-1] (len 51232)
use method [pb:0 lc:3 lp:0 fb:-1] (len 22052)
use method [pb:0 lc:2 lp:0 fb:-1] (len 1601)
use method [pb:0 lc:2 lp:0 fb:-1] (len 13779)
use method [pb:0 lc:3 lp:0 fb:-1] (len 17109)
use method [pb:0 lc:2 lp:0 fb:-1] (len 14295)
use method [pb:0 lc:3 lp:0 fb:-1] (len 31248)
use method [pb:0 lc:0 lp:0 fb:-1] (len 57216)
use method [pb:0 lc:2 lp:0 fb:-1] (len 32244)
use method [pb:0 lc:2 lp:0 fb:-1] (len 33625)
use method [pb:0 lc:3 lp:0 fb:-1] (len 35731)
use method [pb:0 lc:3 lp:0 fb:-1] (len 34576)
use method [pb:0 lc:3 lp:0 fb:-1] (len 35607)
use method [pb:0 lc:3 lp:0 fb:-1] (len 32566)
use method [pb:0 lc:3 lp:0 fb:-1] (len 33463)
use method [pb:0 lc:2 lp:0 fb:-1] (len 30421)
use method [pb:0 lc:3 lp:0 fb:-1] (len 35470)
use method [pb:0 lc:3 lp:0 fb:-1] (len 43585)
use method [pb:0 lc:0 lp:0 fb:-1] (len 5422)
use method [pb:2 lc:0 lp:2 fb:-1] (len 41526)
use method [pb:2 lc:0 lp:2 fb:-1] (len 47114)
use method [pb:2 lc:0 lp:2 fb:-1] (len 34161)
use method [pb:2 lc:3 lp:0 fb:-1] (len 44941)
use method [pb:2 lc:0 lp:2 fb:-1] (len 33051)
use method [pb:2 lc:0 lp:2 fb:-1] (len 26778)
use method [pb:2 lc:0 lp:2 fb:-1] (len 36868)
use method [pb:2 lc:0 lp:2 fb:-1] (len 47579)
use method [pb:2 lc:0 lp:2 fb:-1] (len 39682)
use method [pb:2 lc:0 lp:2 fb:-1] (len 44724)
use method [pb:2 lc:3 lp:0 fb:-1] (len 42035)
use method [pb:2 lc:1 lp:2 fb:-1] (len 23119)
use method [pb:2 lc:0 lp:2 fb:-1] (len 44410)
use method [pb:2 lc:0 lp:2 fb:-1] (len 44513)
use method [pb:2 lc:0 lp:2 fb:-1] (len 30416)
use method [pb:2 lc:0 lp:2 fb:-1] (len 29688)
use method [pb:2 lc:0 lp:2 fb:-1] (len 29979)
use method [pb:2 lc:0 lp:2 fb:-1] (len 45589)
use method [pb:2 lc:0 lp:2 fb:-1] (len 3668)
use method [pb:2 lc:0 lp:2 fb:-1] (len 26585)
use method [pb:2 lc:0 lp:2 fb:-1] (len 27476)
use method [pb:2 lc:2 lp:0 fb:-1] (len 21483)
use method [pb:2 lc:0 lp:2 fb:-1] (len 30197)
use method [pb:2 lc:0 lp:2 fb:-1] (len 29233)
use method [pb:2 lc:0 lp:2 fb:-1] (len 35517)
use method [pb:2 lc:0 lp:2 fb:-1] (len 31910)
use method [pb:2 lc:2 lp:0 fb:-1] (len 2380)
use method [pb:0 lc:3 lp:0 fb:-1] (len 4367)
use method [pb:1 lc:2 lp:0 fb:-1] (len 35499)
use method [pb:2 lc:1 lp:2 fb:-1] (len 1987)
use method [pb:2 lc:0 lp:2 fb:-1] (len 38984)
use method [pb:1 lc:2 lp:0 fb:-1] (len 4757)
use method [pb:2 lc:2 lp:0 fb:-1] (len 37920)
use method [pb:2 lc:0 lp:2 fb:-1] (len 34301)
use method [pb:2 lc:0 lp:0 fb:-1] (len 22126)
use method [pb:2 lc:0 lp:2 fb:-1] (len 35365)
use method [pb:2 lc:0 lp:2 fb:-1] (len 50421)
use method [pb:2 lc:0 lp:2 fb:-1] (len 50290)
use method [pb:1 lc:0 lp:1 fb:-1] (len 15234)
use method [pb:2 lc:2 lp:0 fb:-1] (len 27220)
use method [pb:2 lc:0 lp:2 fb:-1] (len 38866)
use method [pb:2 lc:0 lp:2 fb:-1] (len 29513)
use method [pb:2 lc:0 lp:2 fb:-1] (len 49307)
use method [pb:2 lc:0 lp:2 fb:-1] (len 41116)
use method [pb:2 lc:0 lp:2 fb:-1] (len 44243)
use method [pb:2 lc:0 lp:2 fb:-1] (len 48032)
use method [pb:2 lc:0 lp:1 fb:-1] (len 4382)
use method [pb:2 lc:0 lp:2 fb:-1] (len 42596)
use method [pb:2 lc:0 lp:2 fb:-1] (len 27518)
use method [pb:2 lc:0 lp:2 fb:-1] (len 37651)
use method [pb:2 lc:0 lp:2 fb:-1] (len 43430)
use method [pb:2 lc:0 lp:2 fb:-1] (len 49313)
use method [pb:2 lc:0 lp:2 fb:-1] (len 30275)
use method [pb:2 lc:0 lp:2 fb:-1] (len 46383)
use method [pb:2 lc:0 lp:2 fb:-1] (len 47491)
use method [pb:1 lc:2 lp:0 fb:-1] (len 25109)
use method [pb:2 lc:0 lp:1 fb:-1] (len 39169)
use method [pb:2 lc:0 lp:2 fb:-1] (len 39935)
use method [pb:2 lc:0 lp:0 fb:-1] (len 13318)
use method [pb:2 lc:0 lp:2 fb:-1] (len 29499)
use method [pb:2 lc:0 lp:2 fb:-1] (len 50462)
use method [pb:2 lc:0 lp:2 fb:-1] (len 18759)
use method [pb:2 lc:0 lp:2 fb:-1] (len 40715)
use method [pb:2 lc:0 lp:2 fb:-1] (len 29276)
use method [pb:0 lc:0 lp:0 fb:-1] (len 1294)
use method [pb:0 lc:2 lp:0 fb:-1] (len 2210)
use method [pb:2 lc:0 lp:2 fb:-1] (len 188)

Little endian filesystem, data block size 131072, compressed data, compressed 
metadata, compressed fragments
Filesystem size 2729.02 Kbytes (2.67 Mbytes)
    30.69% of uncompressed filesystem size (8892.40 Kbytes)
Inode table size 4900 bytes (4.79 Kbytes)
    22.09% of uncompressed inode table size (22177 bytes)
Directory table size 6589 bytes (6.43 Kbytes)
    58.13% of uncompressed directory table size (11335 bytes)
Number of duplicate files found 0
Number of inodes 718
Number of files 469
Number of fragments 28
Number of symbolic links  175
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 74
Number of uids 1
    root (0)
Number of gids 0
3776540 3780636 16
ERROR: New firmware image will be larger than original image!
       Building firmware images larger than the original can brick your device!
       Try re-running with the -min option, or remove any unnecessary files from the file system.
       Refusing to create new firmware image.

       Original file size: 3776540
       Current file size:  3780636

       Quitting...
[root@CentOSvbox trunk]# ./build-ng.sh -min
Firmware Mod Kit (build-ng) 0.78 beta, (c)2012 Craig Heffner, Jeremy Collake
http://www.bitsum.com

Building new squashfs file system...
Creating little endian 3.0 filesystem on fmk/new-filesystem.squashfs, block 
size 1048576.
use method [pb:0 lc:0 lp:0 fb:-1] (len 1584)
use method [pb:0 lc:3 lp:0 fb:-1] (len 216215)
use method [pb:0 lc:2 lp:0 fb:-1] (len 211645)
use method [pb:2 lc:0 lp:2 fb:-1] (len 336267)
use method [pb:2 lc:1 lp:2 fb:-1] (len 288759)
use method [pb:2 lc:0 lp:2 fb:-1] (len 272262)
use method [pb:0 lc:3 lp:0 fb:-1] (len 4374)
use method [pb:0 lc:0 lp:2 fb:-1] (len 1896)
use method [pb:2 lc:0 lp:2 fb:-1] (len 257717)
use method [pb:2 lc:0 lp:2 fb:-1] (len 298710)
use method [pb:2 lc:0 lp:2 fb:-1] (len 282124)
use method [pb:2 lc:0 lp:2 fb:-1] (len 339201)
use method [pb:2 lc:0 lp:2 fb:-1] (len 93875)
use method [pb:0 lc:2 lp:0 fb:-1] (len 1168)
use method [pb:0 lc:2 lp:0 fb:-1] (len 2208)
use method [pb:2 lc:0 lp:2 fb:-1] (len 76)

Little endian filesystem, data block size 1048576, compressed data, compressed 
metadata, compressed fragments
Filesystem size 2547.16 Kbytes (2.49 Mbytes)
    28.64% of uncompressed filesystem size (8892.19 Kbytes)
Inode table size 4666 bytes (4.56 Kbytes)
    21.24% of uncompressed inode table size (21969 bytes)
Directory table size 6594 bytes (6.44 Kbytes)
    58.17% of uncompressed directory table size (11335 bytes)
Number of duplicate files found 0
Number of inodes 718
Number of files 469
Number of fragments 8
Number of symbolic links  175
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 74
Number of uids 1
    root (0)
Number of gids 0
3776540 3592220 16
Remaining free bytes in firmware image: 184304
Processing 2 header(s) from fmk/new-firmware.bin...
Processing header at offset 0...checksum(s) updated OK.
Processing header at offset 28...checksum(s) updated OK.
CRC(s) updated successfully.
Finished! New firmware image has been saved to: fmk/new-firmware.bin
[root@CentOSvbox trunk]# mv fmk/new-firmware.bin ./rebuild_with_min.bin
[root@CentOSvbox trunk]# mv fmk/ fmk_orig
[root@CentOSvbox trunk]# ./extract-ng.sh rebuild_with_min.bin 
Firmware Mod Kit (build-ng) 0.78 beta, (c)2011-2012 Craig Heffner, Jeremy 
Collake
http://www.bitsum.com

Scanning firmware...

DECIMAL     HEX         DESCRIPTION
--------------------------------------------------------------------------------
-----------------------
0           0x4         (null)
0           0x4         (null)
0           0x4         (null)

Extracting 983068 bytes of trx header image at offset 0
Extracting squashfs file system at offset 983068
Extracting 32 byte footer from offset 3776508
Extracting squashfs files...
Firmware extraction successful!
Firmware parts can be found in 'fmk/*

Original comment by Russell....@gmail.com on 6 Jan 2013 at 6:16

GoogleCodeExporter commented 8 years ago
Attempted to use extract_firmware/build_firmware on the trx of the firmware for 
a different version of my router (B1, available here: 
ftp://dd-wrt.com/others/eko/BrainSlayer-V24-preSP2/2013/01-01-2013-r20453/Asus-R
TN13UB1/asus-to-ddwrt.trx)

extract_firmware.sh did *appear* to work on the B1 firmware, but when 
rebuilding I noticed this warning:

Utilizing lzma damn small variant ...
 WARNING: Support for these recently added, not fully tested... be careful.
          Please report to jeremy.collake@gmail.com success or failure.

So, consider this me reporting the issue to you ;)  The build completes but 
ends with firmwares created that are all 1k in size.

Original comment by Russell....@gmail.com on 8 Jan 2013 at 2:04

GoogleCodeExporter commented 8 years ago
Using extract_firmware.sh, with the RT-N13U v1 firmware reference previously, I 
see a seg fault:

...
 Build seems successful.
 Preparing working directory ...
 Removing any previous files ...
 Creating directories ...
 Extracting firmware
! untrx failed, trying splitter3
 Attempting squashfs 3.0 lzma ...
 Trying 'damn small' variant - used by DD-WRT v24 ...
./extract_firmware.sh: line 190: 16022 Segmentation fault      (core dumped) 
"src/squashfs-3.0-lzma-damn-small-variant/unsquashfs-lzma" -dest "$2/rootfs" 
"$2/image_parts/squashfs-lzma-image-3_0" 2> /dev/null >> extract.log
 Error: filesystem not extracted properly.
  firmware image format not compatible?

Original comment by Russell....@gmail.com on 8 Jan 2013 at 2:13

GoogleCodeExporter commented 8 years ago
The build completes but ends with firmwares created that are all 1k in size.....

me too!

Original comment by xuewei...@gmail.com on 26 Mar 2013 at 4:31

GoogleCodeExporter commented 8 years ago
Support may vary depending on the target device, but generally speaking, all 
should work. The FMK has improved the last month. Retry, if problems, submit a 
new issue with a specific link to the firmware you are playing with.

Original comment by jeremy.collake@gmail.com on 13 Apr 2013 at 3:45