From 4e810fa151e32f27d5438b5d8425bb81820016fb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mateusz=20Jo=C5=84czyk?= Date: Fri, 20 Mar 2026 23:37:44 +0100 Subject: [PATCH] ramips: mt7621: build .trx image for ASUS RT-AX53U MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Link: https://github.com/openwrt/openwrt/pull/23647 Signed-off-by: Robert Marko --- target/linux/ramips/image/Makefile | 8 ++++++++ target/linux/ramips/image/mt7621.mk | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 4d7f65320c0..3491d3d7429 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -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)))),) \ diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 347ab0eab3d..94e05180ad9 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -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 -- 2.47.3