openwrt/tools
Bjørn Mork 48cad07a55 firmware-utils: zytrx: Add util for ZyXEL specific header
The ZyXEL NR7101 prepend an additional header to U-Boot images. This
header use the TRX magic 0x30524448 (HDR0), but is incompatible with
TRX images.

This code is reverse-engineered based on matching 32 bit numbers
found in the header with lengths and different checksum
calculations of the vendor images found on the device.  The result
was matched against the validation output produced by the
bootloader to name the associated header fields.

Example bootloader validation output:

 Zyxel TRX Image 1 --> Found!  Header Checksum OK
 ============ZyXEL header information==================
         chipId             : MT7621A
         boardId            : NR7101
         modelId            : 07 01 00 01
         kernel_len         : (14177560)
         kernelChksum       : (0x8DD31F69)
         swVersionInt       : 1.00(ABUV.0)D1
         swVersionExt       : 1.00(ABUV.0)D1

 Zyxel TRX Image 2 --> Found!  Header Checksum OK
 ============ZyXEL header information==================
         chipId             : MT7621A
         boardId            : NR7101
         modelId            : 07 01 00 01
         kernel_len         : (14176660)
         kernelChksum       : (0x951A7637)
         swVersionInt       : 1.00(ABUV.0)D0
         swVersionExt       : 1.00(ABUV.0)D0

 =================================================
 Check image validation:
 Image1 Header Magic Number --> OK
 Image2 Header Magic Number --> OK
 Image1 Header Checksum --> OK
 Image2 Header Checksum --> OK
 Image1 Data Checksum --> OK
 Image2 Data Checksum --> OK
 Image1 Stable Flag --> Stable
 Image1 Try Counter --> 0
 Image1: OK
 Image2: OK

The coverage and algorithm for the kernelChksum field is unknown.
This field is not validated by the bootloader or the OEM firmware
upgrade tool. It is therefore set to a static value for now.

The swVersion fields contain free form string values.  The OEM firmware
use ZyXEL structured version numbers as shown above.  The strings are
not interpreted or validated on boot, so they can be repurposed for
anything we want the bootloader to display to the user.  But the OEM
web GUI fails to flash images with freeform strings.

The purpose of the other strings in the header is not known.  The
values appear to be static.  We assume they are fixed for now, until
we have other examples.  One of these strings is the platform name,
which is taken as an input parameter for support other members of
the device family.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-05-09 09:15:44 +02:00
..
autoconf
autoconf-archive tools: add autoconf-archive 2020-05-20 15:37:16 +02:00
automake
b43-tools
bc tools/bc: use autoreconf to fix build failure on macOS with recent Xcode versions 2020-11-14 14:48:30 +01:00
bison tools/bison: update to 3.7.4 2020-11-21 18:49:08 +01:00
cbootimage treewide: update email address of Tomasz Maciej Nowak 2020-11-24 15:39:07 +01:00
cbootimage-configs treewide: update email address of Tomasz Maciej Nowak 2020-11-24 15:39:07 +01:00
ccache ccache: update to 4.2.1 2021-04-23 20:57:33 +02:00
cmake tools/cmake: always use non-ccache CC and CXX variables 2021-01-06 21:44:56 -10:00
coreutils tools/coreutils: update to 8.32 2020-08-30 22:21:34 +02:00
cpio tools: add cpio 2021-02-28 00:09:09 +00:00
dosfstools
e2fsprogs tools/e2fsprogs: fix build under macos 2020-04-10 11:52:00 +01:00
elftosb
expat tools/expat: update to 2.2.10 2020-11-21 18:48:39 +01:00
fakeroot download: add mirror alias for Debian 2021-02-26 20:41:00 +01:00
findutils tools/findutils: Update to 4.7.0 2020-04-09 22:08:38 +02:00
firmware-utils firmware-utils: zytrx: Add util for ZyXEL specific header 2021-05-09 09:15:44 +02:00
flex
flock tools/flock: add PKG_{VERSION,RELEASE} 2020-07-23 11:30:22 +02:00
genext2fs
gengetopt
gmp tools/gmp: update to 6.2.1 2020-11-21 18:49:17 +01:00
include
isl
kernel2minor
libressl ccache: update to 4.1 2020-12-31 10:03:21 +01:00
libtool
lzma treewide: unify OpenWrt hosted source via @OPENWRT 2021-02-05 12:00:24 -10:00
lzma-old treewide: unify OpenWrt hosted source via @OPENWRT 2021-02-05 12:00:24 -10:00
m4
make-ext4fs
missing-macros treewide: remove empty default cases 2020-09-17 12:46:19 +02:00
mkimage tools: mkimage: add patches for 64-bit MediaTek BootROM 2021-03-11 16:24:20 +00:00
mklibs download: add mirror alias for Debian 2021-02-26 20:41:00 +01:00
mm-macros tools/mm-macros: Update to 1.0.0 2020-04-09 22:09:21 +02:00
mpc tools/mpc: update to 1.2.1 2020-11-21 18:49:27 +01:00
mpfr tools/mpfr: update to 4.1.0 2020-08-23 19:40:32 +02:00
mtd-utils tools: mtd-utils: Update to version 2.1.2 2020-08-26 23:29:35 +02:00
mtools tools/mtools: Update to 4.0.24 2020-04-09 22:09:04 +02:00
padjffs2 tools: drop PKG_VERSION for purely local packages 2020-07-23 10:54:33 +02:00
patch
patch-image rb532: drop target 2020-09-02 16:29:22 +02:00
patchelf tools/patchelf: bump to use latest master 2021-02-15 07:12:51 +01:00
pkgconf ccache: update to 4.1 2020-12-31 10:03:21 +01:00
quilt
sdimage
sed
sparse tools/sparse: update to version 0.6.3 2021-03-19 00:59:22 +01:00
squashfs squashfs: Fix compile with GCC 10 2020-05-24 14:38:40 +02:00
squashfskit4 tools/squashfskit4: fix build on non-linux systems 2020-09-01 17:01:56 +02:00
sstrip tools/sstrip: update to latest version 2020-11-26 12:44:25 -10:00
tar
xxd tools/xxd: fix source URL 2021-03-01 16:39:17 +00:00
xz tools/xz: Update to 5.2.5 2020-04-09 22:09:13 +02:00
zip
zlib
zstd tools/zstd: compile with cmake 2021-01-30 18:14:50 -10:00
Makefile tools/libelf: remove unneeded host library 2021-03-13 22:20:02 +00:00