Asus TUF AX4200 support

Yes

The changes in the repository are so ridiculous that there is no point in even creating a diff-file.

  1. change file {repo}/scripts/mkits.sh
if [ -n "${INITRD}" ]; then
	INITRD_NODE="
		initrd${REFERENCE_CHAR}$INITRDNUM {
			description = \"${ARCH_UPPER} OpenWrt ${DEVICE} initrd\";
			${COMPATIBLE_PROP}
			data = /incbin/(\"${INITRD}\");
			type = \"ramdisk\";
			load = <0x5f000000>;   <==== new line with load addr for initrd
			arch = \"${ARCH}\";
			os = \"linux\";
			hash${REFERENCE_CHAR}1 {
				algo = \"crc32\";
			};
			hash${REFERENCE_CHAR}2 {
				algo = \"${HASH}\";
			};
		};
"
  1. change file {repo}/target/linux/mediatek/dts/mt7986a-asus-tuf-ax4200.dts
	chosen {
		stdout-path = "serial0:115200n8";
		bootargs-override = "ubi.mtd=UBI_DEV  root=/dev/ram0  rw  initrd=0x5f000000,8M";
	};
  1. change file {repo}/target/linux/mediatek/image/filogic.mk
define Device/asus_tuf-ax4200
  DEVICE_VENDOR := ASUS
  DEVICE_MODEL := TUF-AX4200
  DEVICE_DTS := mt7986a-asus-tuf-ax4200
  DEVICE_DTS_DIR := ../dts
# DEVICE_DTS_LOADADDR := 0x47000000
  DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware
  IMAGES := sysupgrade.bin
  KERNEL := kernel-bin | lzma | \
        fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
# KERNEL_INITRAMFS := kernel-bin | lzma | \
#       fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
  KERNEL_INITRAMFS := kernel-bin | lzma | \
        fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | uImage none
  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += asus_tuf-ax4200
  1. After making changes to the files, you need to run the build and wait for initramfs image to appear.
    From the resulting bin image, you need to use the mkasustrx utility to obtain the trx image:
mkasustrx.exe -n TUF-AX4200 -i openwrt-mediatek-filogic-asus_tuf-ax4200-initramfs-kernel.bin -o openwrt-mediatek-filogic-asus_tuf-ax4200-initramfs-kernel.trx
A More Correct Way

It is necessary to add support for the mkasustrx utility to the building scripts and change filogic.mk :

  KERNEL_INITRAMFS := kernel-bin | lzma | \
        fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | \
        uImage none | mkasustrx -n $$(DEVICE_MODEL) 

All the assembly changes described above are a terrible hack!

The correct solution is to integrate initrd into the kernel image. I don't know how to build OpenWRT initramfs images this way. But it seems that the kernel parameter CONFIG_INITRAMFS_SOURCE is responsible for this.

The mkits script has grown too many options, but this does look like something which probably should be supported somehow. E.g similar to how the DTB load address was added. Ref

No need to do this. You just need to convince the most important maintainers that you need to make it possible to build a second kernel, which will contain the initrd image.

Some things for this are already in the scripts:

OK. This is done by pull requests, not discussions.

Hmmmm. My 4 pull requests have been hanging unclosed for 1...2 years....

2 Likes

I can only see 3, and they're all waiting for you to implement requested changes
https://github.com/openwrt/openwrt/pulls?q=is%3Apr+is%3Aopen+remittor

But whatever. Maybe your method works better than mine.

Thank You very much, It worked very good.
I had working openwrt in 3 minutes without nedd of opening housing. Simply GREAT !!!

3 Likes

good job :wink: i will try for see :slight_smile:

for install via oem and we are OpenWrt ? what is the first file ?

asus mk

This is a utility for creating an trx-image compatible with AsusWRT installer.

1 Like

ok it's just a bonus that you've added since you've already created the image below, then all I have to do is upgrade the firmware right?

1: I install your image via the software update
2: I update via sysupgrade?

1 Like

Yes, thats it from asus firmware trx file then log in into luci and make sysupgrade with asus 4200 23.05 sysupgrade image

1 Like

is there a point in setting on hardware flow offload ? is this feature implemented in this soc?

ok thanks for response

yes

you can see software accelleration in network--> firewall

but i do'nt need me

1 Like

any idea if the initram file posted above will work the same for ASUS TUF-AX5400?

i receve my router tommorow i will test again big thanks for your work :slight_smile:

juste a question a flash is like usually router just connect to lan 1 and go :stuck_out_tongue:

Isn’t that router built on a Broadcom SoC (comparing to Mediatek)?

1 Like

Hi, probably no because of platform "Broadcom BCM6750 1.5Ghz Triple-Core with 512MB RAM". But this solution should be common for TUF ax4200 and TUF ax6000.

1 Like

I updated the trx-image, which is located at the link provided.
Now creating this image is fully automated.
To get this trx-image, just run the following commands:

git clone https://github.com/openwrt-xiaomi/builder -b v23 openwrt-v23
cd openwrt-v23

./xcreate.sh -v xq-23.05.0
cd xq-23.05.0

./xupdate.sh -f

./xmake.sh -f -t tuf_ax4200_initramfs

After the build is completed, in the ./xq-23.05.0/bin/targets/mediatek/filogic directory should appear file openwrt-mediatek-filogic-asus_tuf-ax4200-initramfs.trx

File changes

New image tool mkasustrx for creating Asus trx-image:
https://github.com/openwrt-xiaomi/firmware-utils/commit/1d44ff4c26d79c5755ddf5107a83f5bf202f4cae

Downloading and compile new image tool mkasustrx:
https://github.com/openwrt-xiaomi/openwrt/commit/f282f8ef3e5e688884a5f62429a46ddafb9b933f

Using new image tool mkasustrx:
https://github.com/openwrt-xiaomi/openwrt/commit/61d5891f8c7d1d6ddbf9675d3d84edfd368eefca

Forced change of the main options responsible for assembling images:
https://github.com/openwrt-xiaomi/builder/commit/975cc0efb3dea0f551cdc82ce819fd74a0d6045f#diff-c5024fd0171059d662ead280421311d0a4a825381fcec2f2bc58baaa40d21198R61-R65

.

Feature separate_ramdisk

The method of building images that I described cannot be added to the official OpenWRT repository, because there, for mtk/filogic devices, they completely abandoned the integration of initramfs into the kernel:
https://github.com/openwrt/openwrt/blob/eacc885816fb46bf4054b0c3dd2cd1513322ad09/target/linux/mediatek/Makefile#L9
Feature separate_ramdisk blocks the ability to insert initrams into the kernel!

1 Like

what is the rapport between writed
asus new image
below and this files

i have my asus in one hour i will test

thanks