Skip to content

jbootimage: add image tool for the Zyxel LTE3301 - #81

Open
ddimension wants to merge 1 commit into
openwrt:masterfrom
ddimension:jbootimage
Open

ddimension wants to merge 1 commit into
openwrt:masterfrom
ddimension:jbootimage

Conversation

@ddimension

Copy link
Copy Markdown

The Zyxel LTE3301-M209/Q222 ships with the AMIT "jboot" loader, whose recovery
web UI only accepts images in its own record format ("ZXL6"). jbootimage
builds such an image from a U-Boot binary and an OpenWrt kernel+rootfs, so a
device can be migrated from the vendor loader to mainline U-Boot through the
vendor recovery itself.

The 80-byte record header is the same AUH structure mkdlinkfw already builds,
so the checksum and the field layout are reused from mkdlinkfw-lib. Specific
to the Zyxel variant are the header scramble the recovery loader expects
(mkdlinkfw leaves the D-Link "derange" field at 0, i.e. unscrambled) and the
migration layout: a raw U-Boot record targeting flash offset 0 plus raw
kernel/rootfs records at the firmware offset, with the U-Boot record written
last so an aborted upload leaves the device recoverable.

jbootimage -u <u-boot> -c <kernel+rootfs> -s <kernel size> \
           -f <fmid> -O <firmware offset> -o <out>

This is used by the Zyxel LTE3301-M209/Q222 support for ramips, which I will
submit to openwrt/openwrt once this is merged.

Tested: the generated image is accepted by the vendor recovery of both an
LTE3301-M209 and an LTE3301-Q222 (CAS 8000) and installs U-Boot, kernel and
rootfs; the device boots OpenWrt afterwards.

The Zyxel LTE3301-M209/Q222 ships with the AMIT "jboot" loader, whose
recovery web UI only accepts images in its own record format ("ZXL6").
jbootimage builds such an image from a U-Boot binary and an OpenWrt
kernel+rootfs, so a device can be migrated from the vendor loader to
mainline U-Boot through the vendor recovery itself.

The 80-byte record header is the same AUH structure mkdlinkfw already
builds, so the checksum and the field layout are reused from
mkdlinkfw-lib. Two things are specific to the Zyxel variant: the header
scramble the recovery loader expects (mkdlinkfw leaves the D-Link
"derange" field at 0, i.e. unscrambled), and the migration layout - a
raw U-Boot record targeting flash offset 0 plus raw kernel/rootfs
records at the firmware offset, with the U-Boot record written last so
an aborted upload leaves the device recoverable.

Usage:

  jbootimage -u <u-boot> -c <kernel+rootfs> -s <kernel size> \
             -f <fmid> -O <firmware offset> -o <out>

Assisted-By: Claude <[email protected]>
Signed-off-by: André Valentin <[email protected]>
ddimension pushed a commit to ddimension/openwrt that referenced this pull request Nov 7, 2026
Not for upstream. u-boot-install.bin of the Zyxel LTE3301-M209/Q222 is
built by jbootimage, which is still under review in firmware-utils
(openwrt/firmware-utils#81, commit 745a32a). This patch carries that
commit unchanged so the CI image leg builds; drop it once
tools/firmware-utils is bumped past the merge.

Signed-off-by: André Valentin <[email protected]>
ddimension pushed a commit to ddimension/openwrt-repo that referenced this pull request Nov 7, 2026
config.lte3301 adds lldpd to the LTE3301-M209/Q222 leg: the devices sit
in the test network without a console, and LLDP still reports one to the
switch when its LAN address no longer matches after an upgrade.

The fork branch lte3301 was reset to the PR state (switch under DSA)
plus openwrt/openwrt#24724 and the jbootimage tool from
openwrt/firmware-utils#81; the README says which commit is which.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ddimension pushed a commit to ddimension/openwrt that referenced this pull request Nov 7, 2026
Not for upstream. u-boot-install.bin of the Zyxel LTE3301-M209/Q222 is
built by jbootimage, which is still under review in firmware-utils
(openwrt/firmware-utils#81, commit 745a32a). This patch carries that
commit unchanged so the CI image leg builds; drop it once
tools/firmware-utils is bumped past the merge.

Signed-off-by: André Valentin <[email protected]>
@ddimension

Copy link
Copy Markdown
Author

A gentle reminder on this one: openwrt/openwrt#25670 (Zyxel LTE3301-M209/Q222) depends on it, because its u-boot-install.bin recipe uses jbootimage to migrate a device off the vendor jboot loader through the vendor's own recovery UI. That PR is otherwise done and hardware-tested, and stays a draft only until this one is in.

@dangowrt, could you or another maintainer take a look? I'm happy to change anything.

@ddimension

Copy link
Copy Markdown
Author

@jonasjelonek, since you have been merging in firmware-utils lately: could you take a look at this one? It adds a single new tool (src/jbootimage.c) plus its line in CMakeLists.txt and changes nothing else; it still merges cleanly on master. openwrt/openwrt#25670 (Zyxel LTE3301-M209/Q222) is done and hardware-tested and only waits on this for its u-boot-install.bin.

ddimension pushed a commit to ddimension/openwrt that referenced this pull request Nov 20, 2026
Not for upstream. u-boot-install.bin of the Zyxel LTE3301-M209/Q222 is
built by jbootimage, which is still under review in firmware-utils
(openwrt/firmware-utils#81, commit 745a32a). This patch carries that
commit unchanged so the CI image leg builds; drop it once
tools/firmware-utils is bumped past the merge.

Signed-off-by: André Valentin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants