nec-usbatermfw: add tool for NEC "USB ATERM" format
authorINAGAKI Hiroshi <musashino.open@gmail.com>
Wed, 8 May 2024 13:36:05 +0000 (22:36 +0900)
committerINAGAKI Hiroshi <musashino.open@gmail.com>
Sun, 4 Aug 2024 13:39:57 +0000 (22:39 +0900)
commit26c7f054b5fe8408d64ca7b06372b303cf888245
tree2dfc1edfa3bd5aed3a66556da727d4087393c8ae
parentf35781fcd2c3c914247fdb941dc6682af5b98982
nec-usbatermfw: add tool for NEC "USB ATERM" format

Add a tool for NEC Aterm devices using "USB ATERM" format.
This format is mainly used on the devices based on NetBSD, such as
WR8750N, WG600HP and WG1400HP.

A workaround in write_blockheader() is needed to resolve an unknown bug
when generating an image if built with gcc 9.4.0
(Ubuntu 9.4.0-1ubuntu1~20.04.2) and cmake.

example:

index 1 and 4 are fixed data and checksum of them shouldn't be changed

- with the workaround

  nec-usbatermfw \
        openwrt-ath79-tiny-nec_wr9500n-initramfs-factory.bin.new \
        -t H033 \
        -f 0x0003 -d loader-nec_wr9500n.bin \
        -d openwrt-ath79-tiny-nec_wr9500n-initramfs-factory.bin
          Flags   Total Len.      Load Addr       Entry Point     Checksum
  1:      0x0000, 0x0000003e,     0x00000000,     0x00000000,     0x00001988
  2:      0x0003, 0x00000a14,     0x80040000,     0x80040000,     0x00001526
  3:      0x0002, 0x0054df20,     0x80040000,     0x80040000,     0x0000c41f
  4:      0x0001, 0x00000018,     0x00000000,     0x00000000,     0x0000cfff

- without the workaround

  nec-usbatermfw \
        openwrt-ath79-tiny-nec_wr9500n-initramfs-factory.bin.new \
        -t H033 \
        -f 0x0003 -d loader-nec_wr9500n.bin \
        -d openwrt-ath79-tiny-nec_wr9500n-initramfs-factory.bin
          Flags   Total Len.      Load Addr       Entry Point     Checksum
  1:      0x0000, 0x0000003e,     0x00000000,     0x00000000,     0x00001988
  2:      0x0003, 0x00000a14,     0x80040000,     0x80040000,     0x00009528
  3:      0x0002, 0x0054df20,     0x80040000,     0x80040000,     0x00004422
  4:      0x0001, 0x00000018,     0x00000000,     0x00000000,     0x00005002

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
CMakeLists.txt
src/nec-usbatermfw.c [new file with mode: 0644]