thantaicon / firmware-mod-kit

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

Extracted firmware and then tried to rebuild it and it became larger, probably because it didnt use lzma for recompress. #138

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I extracted a firmware for a VDSL modem.  The modem is SmartRG SR505N.  

Here is output:

-----------------------------------

./extract-firmware.sh smart.bin 

Firmware Mod Kit (extract) 0.99, (c)2011-2013 Craig Heffner, Jeremy Collake

Preparing tools ...
Scanning firmware...

Scan Time:     2014-09-10 09:00:39
Target File:   /root/fmk/smart.bin
MD5 Checksum:  e4b1daea297f6955d4f578d80a520c5f
Signatures:    285

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             Broadcom 96345 firmware header, header size: 256, 
firmware version: "68", board id: "63168MBV_17AZZ", ~CRC32 header checksum: 
0x35883F5B, ~CRC32 data checksum: 0x3C11AA1A
256           0x100           Squashfs filesystem, little endian, non-standard 
signature,  version 4.0, compression:gzip, size: 6010146 bytes,  828 inodes, 
blocksize: 65536 bytes, created: Thu Jan  2 15:53:03 2014
6013196       0x5BC10C        LZMA compressed data, properties: 0x6D, 
dictionary size: 4194304 bytes, uncompressed size: 3552512 bytes

Extracting 256 bytes of broadcom header image at offset 0
Extracting squashfs file system at offset 256
Extracting 2880 byte footer from offset 7202176
Extracting squashfs files...
Firmware extraction successful!
Firmware parts can be found in '/root/fmk/fmk/*'

---------------------------------------------------------------

./build-firmware.sh 
Firmware Mod Kit (build) 0.99, (c)2011-2013 Craig Heffner, Jeremy Collake

Preparing tools ...
Building new squashfs file system... (this may take several minutes!)
Squahfs block size is 64 Kb
./src/others/squashfs-4.2/mksquashfs /root/fmk/fmk/rootfs 
/root/fmk/fmk/new-filesystem.squashfs  -b 65536  -all-root
Parallel mksquashfs: Using 1 processor
Creating 4.0 filesystem on /root/fmk/fmk/new-filesystem.squashfs, block size 
65536.
[===============================================================================
================/] 739/739 100%
Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 65536
    compressed data, compressed metadata, compressed fragments, compressed xattrs
    duplicates are removed
Filesystem size 7440.07 Kbytes (7.27 Mbytes)
    35.56% of uncompressed filesystem size (20924.42 Kbytes)
Inode table size 8221 bytes (8.03 Kbytes)
    30.73% of uncompressed inode table size (26756 bytes)
Directory table size 8086 bytes (7.90 Kbytes)
    53.84% of uncompressed directory table size (15018 bytes)
Number of duplicate files found 0
Number of inodes 828
Number of files 493
Number of fragments 72
Number of symbolic links  108
Number of device nodes 176
Number of fifo nodes 1
Number of socket nodes 0
Number of directories 50
Number of ids (unique uids + gids) 1
Number of uids 1
    root (0)
Number of gids 1
    root (0)
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.
       REFUSING to create new firmware image.

       Original file size: 7205056
       Current file size:  7622912 (plus footer of 2880 bytes)

       Quitting...

Then I ran binwalk on the build firmware:

binwalk fmk/new-firmware.bin 

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             Broadcom 96345 firmware header, header size: 256, 
firmware version: "68", board id: "63168MBV_17AZZ", ~CRC32 header checksum: 
0x35883F5B, ~CRC32 data checksum: 0x3C11AA1A
256           0x100           Squashfs filesystem, little endian, version 4.0, 
compression:gzip, size: 7618636 bytes,  828 inodes, blocksize: 65536 bytes, 
created: Wed Sep 10 09:01:20 2014

Original issue reported on code.google.com by r...@cs.velcom.ca on 10 Sep 2014 at 4:03

GoogleCodeExporter commented 8 years ago
Sorry here is additional information:

uname -a
Linux rob-virtual-machine 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

binwalk smart.bin 

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             Broadcom 96345 firmware header, header size: 256, 
firmware version: "68", board id: "63168MBV_17AZZ", ~CRC32 header checksum: 
0x35883F5B, ~CRC32 data checksum: 0x3C11AA1A
256           0x100           Squashfs filesystem, little endian, non-standard 
signature,  version 4.0, compression:gzip, size: 6010146 bytes,  828 inodes, 
blocksize: 65536 bytes, created: Thu Jan  2 15:53:03 2014
6013196       0x5BC10C        LZMA compressed data, properties: 0x6D, 
dictionary size: 4194304 bytes, uncompressed size: 3552512 bytes

Original comment by r...@cs.velcom.ca on 10 Sep 2014 at 4:04