aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils/src/mksercommfw.c
Commit message (Collapse)AuthorAgeFilesLines
* firmware-utils: mksercommfw: overhaul image creationMathias Kresin2019-01-151-271/+110
| | | | | | | | | | | | | | | | | | | | Move the zip compression into a build recipe. Pad the image using the existing build recipes as well to remove duplicate functionality Change the code to append header and footer in two steps. Allow to use a fixed filename as the netgear update image does. Use a fixed timestamp within the zip archive to make the images reproducible. Due to the changes we are now compatible to the gnu89 c standard used by default on the buildbots and we don't need to force a more recent standard anymore. Beside all changes, the footer still looks wrong in compare to the netgear update image. Signed-off-by: Mathias Kresin <dev@kresin.me>
* tools: firmware-utils: mksercommfw build on DarwinKevin Darbyshire-Bryant2018-11-091-2/+21
| | | | | | | | | asm/byteorder.h & hence __cpu_to_be32() doesn't exist on Darwin Shamelessly copy some byte swap functions from oseama.c Acked-by: Koen Vandeputte <koen.vandeputte@ncentric.com> Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
* ramips: fix netgear r6120 factory image generationKoen Vandeputte2018-11-081-169/+317
| | | | | | | | | | | | | | | | | | | | | | | as indicated in commit c5bf408ed6bd "(ramips: fix image generation for mt76x8") more rework was needed to fix the other issues. Building on another machine, but using the same arch, showed the application failing again for different reasons. Fix this by completely rewriting the application, fixing following found issues: - buffer overflows, resulting in stack corruption - flaws in memory requirement calculations (too small, too large) - memory leaks - missing bounds checking on string handling - non-reproducable images, by using unitilized memory in checksum calculation - missing error handling, resulting in succes on specific image errors - endianness errors when building on BE machines - various minor build warnings - documentation did not match the code actions (header item locations) - allowing input to be decimal, hex or octal now Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* ramips: fix image generation for mt76x8Koen Vandeputte2018-11-061-1/+1
| | | | | | | | | | | | | | | | | | | | | Buildbot fails to generate images for targets also generating a Sercomm binary with following error: Opening file: /mnt/ramdisk/koen/firmware/builds/owrt_mt76x8/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/tmp/openwrt-ramips-mt76x8-netgear_r6120-squashfs-factory.img.rootfs.zip Filesize: 3648606 . mksercommfw: malloc.c:2427: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed. Makefile:287: recipe for target '/mnt/ramdisk/koen/firmware/builds/owrt_mt76x8/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/tmp/openwrt-ramips-mt76x8-netgear_r6120-squashfs-factory.img' failed Debugging using valgrind shows stack corruption due to a buffer overflow. The author of the generator assumes the filename ends with "root", while it should be "rootfs". Fix this by accounting for the 2 missing characters which solves the build issues. More work is required to cleanup this source, which will be done later on. Reported-by: Hannu Nyman <hannu.nyman@iki.fi> Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* firmware-utils/mksercommfw: fix build with clang/macOSRyan Mounce2018-08-141-1/+1
| | | | | | | | fixes error: non-void function 'main' should return a value Fixes: FS#1770 Signed-off-by: Ryan Mounce <ryan@mounce.com.au>
* firmware-utils/mksercommfw: fix musl buildAndy Walsh2018-08-131-0/+1
| | | | | | * add missing <sys/types.h> for musl Signed-off-by: Andy Walsh <andy.walsh44+github@gmail.com>
* firmware-utils: add sercomm/netgear toolLudwig Thomeczek2018-08-131-0/+254
This adds a tool to generate a firmware file accepted by Netgear or sercomm devices. They use a zip-packed rootfs with header and a custom checksum. The generated Image can be flashed via the nmrpflash tool or the webinterface of the router. Signed-off-by: Ludwig Thomeczek <ledesrc@wxorx.net>