For the past month I’ve been working with Jeremy Collake on updating the firmware-mod-kit. This has resulted in lots of bug fixes and the creation of two new scripts for deconstructing and re-building firmware images:
The NG scripts have been designed as more flexible and generic replacements for the current extract_firmware.sh / build_firmware.sh scripts, and provide many improved features including:
- The use of binwalk (now included with the firmware-mod-kit) to locate and extract file systems
- Automatic identification and extraction of firmware footers, such as those used by the TEW-632BRP
- Automatic identification of the correct SquashFS version and compression to use
- Support for identifying and patching multiple headers inside a single firmware image.
Usage is simple. To extract a firmware image, run:
$ ./extract-ng.sh firmware.bin
The extracted file system will be saved to fmk/rootfs. After modifying the root file system, the new firmware image can be re-built by running:
Additionally, several new tools have been added to the kit, including:
- New un/squashfs utilites
- New uncramfs utilities
- crcalc, a tool to update uImage and TRX checksums
The extract-ng.sh and build-ng.sh tools currently support TRX and uImage firmware headers and SquashFS file systems, and should work with most firmware images that use these components. However, they are still in beta testing and should be considered less stable than the older extract_firmware.sh and build_firmware.sh tools.
As always, tread with caution and use at your own risk!