aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware-utils/Makefile
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2021-04-19 13:00:55 +0200
committerPetr Štetiar <ynezz@true.cz>2021-06-10 17:09:35 +0200
commitdd6f02a3f4b70c82b45e1156cbe1edc833f683b4 (patch)
treefb6dabbac78155d799b26ae51f69c8d4aba6a87c /tools/firmware-utils/Makefile
parentec8fe0a189bc6af9ebf51017512d4e5536421675 (diff)
downloadupstream-dd6f02a3f4b70c82b45e1156cbe1edc833f683b4.tar.gz
upstream-dd6f02a3f4b70c82b45e1156cbe1edc833f683b4.tar.bz2
upstream-dd6f02a3f4b70c82b45e1156cbe1edc833f683b4.zip
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> Tested-by: Bjørn Mork <bjorn@mork.no> (cherry picked from commit 48cad07a55246317d66fee4ced25cb62a2bae3d3)
Diffstat (limited to 'tools/firmware-utils/Makefile')
-rw-r--r--tools/firmware-utils/Makefile1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 28f8f0555a..cec8398a27 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -97,6 +97,7 @@ define Host/Compile
$(call cc,wrt400n cyg_crc32)
$(call cc,xorimage)
$(call cc,zyimage,-Wall)
+ $(call cc,zytrx,-Wall)
$(call cc,zyxbcm)
endef