]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ramips: mt7621: build .trx image for ASUS RT-AX53U 23647/head
authorMateusz Jończyk <mat.jonczyk@o2.pl>
Fri, 20 Mar 2026 22:37:44 +0000 (23:37 +0100)
committerRobert Marko <robimarko@gmail.com>
Thu, 4 Jun 2026 20:45:42 +0000 (22:45 +0200)
Build an initramfs-factory.trx image suitable for flashing directly via
the vendor firmware WebGUI, without using TFTP or SSH.

To use:
1. Flash the initramfs-factory.trx file with the vendor firmware
   administrative interface.
2. Wait until the router restarts, login to OpenWRT via LuCI (or SSH)
   and upgrade firmware using the sysupgrade-squashfs.bin image file.

It is necessary to use TRX version 2, which has a kernel size limit of
16MB (TRX version 3 is rejected by vendor firmware). To avoid stopping
the whole build when the input file turns out larger, check in the
Build/asus-trx macro if check-size removed the input file and don't
error out in this case.

Note: It should be possible to prepare an image to flash the router in
one step, but this will be more complicated, because vendor firmware and
OpenWRT use a slightly different partition layout.

Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Link: https://github.com/openwrt/openwrt/pull/23647
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ramips/image/Makefile
target/linux/ramips/image/mt7621.mk

index 4d7f65320c09bcc2e6f6c5656bea09f1ba95cfe6..3491d3d742913f0dc6c2c39f6fcba8df2bdc9137 100644 (file)
@@ -29,6 +29,14 @@ LOADER_FLASH_START := $(ldrflashstart-y)
 
 KERNEL_DTB = kernel-bin | append-dtb | lzma
 
+define Build/asus-trx
+       # don't stop the whole build if check-size removed the input file
+       [ ! -e $@ ] || { \
+               $(STAGING_DIR_HOST)/bin/asusuimage $(wordlist 1,$(words $(1)),$(1)) -i $@ -o $@.new; \
+               mv $@.new $@; \
+       }
+endef
+
 define Build/jcg-header
        $(STAGING_DIR_HOST)/bin/jcgimage -v $(1) \
                $(if $(JCG_MAXSIZE), -m $$(($(call exp_units,$(JCG_MAXSIZE)))),) \
index 347ab0eab3dc8123e041ebf06736fdf4ad750f26..94e05180ad94c1a56fe69c4a2d9c463183f25923 100644 (file)
@@ -481,6 +481,13 @@ define Device/asus_rt-ax53u
   IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
        check-size
   DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 kmod-usb-ledtrig-usbport
+ifeq ($(IB),)
+ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
+  ARTIFACTS := initramfs-factory.trx
+  ARTIFACT/initramfs-factory.trx := append-image-stage initramfs-kernel.bin | \
+       check-size 16m | asus-trx -v 2 -n $$(DEVICE_MODEL) -b 386 -e 19999
+endif
+endif
 endef
 TARGET_DEVICES += asus_rt-ax53u