aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/uboot-mediatek/Makefile
diff options
context:
space:
mode:
authorFurong Xu <xfr@outlook.com>2022-12-22 10:40:50 +0800
committerDaniel Golle <daniel@makrotopia.org>2022-12-29 03:04:42 +0000
commit1613e3340b829ea9aa6da954bf0ff98214b71751 (patch)
treec8a12da460b5850eef7a4e126c1e0e0c9eaade52 /package/boot/uboot-mediatek/Makefile
parent8bac5dc18a139e13338956e83d8dc4948824a82f (diff)
downloadupstream-1613e3340b829ea9aa6da954bf0ff98214b71751.tar.gz
upstream-1613e3340b829ea9aa6da954bf0ff98214b71751.tar.bz2
upstream-1613e3340b829ea9aa6da954bf0ff98214b71751.zip
uboot-mediatek: add support for Xiaomi Redmi Router AX6000
U-Boot flash instructions: 0. OpenWrt U-Boot does not support stock layout, it comes with recovery boot support, automatic tftp recovery and never blocks UART. A new flash layout is introduced, we call it OpenWrt U-Boot layout, stock flash layout and the old OpenWrt layout are not supported. During the whole flash procedure, please do not reboot or power off unless requested explicitly, or you will break your device. 1. Your device should already running OpenWrt. If not, follow the instructions to flash OpenWrt: https://github.com/openwrt/openwrt/pull/11115 2. Backup BL2 Nvram Bdata Factory and FIP in case you break something or in case you want to go back to stock firmware one day. cat /dev/mtdblock0 > /tmp/BL2.bin cat /dev/mtdblock1 > /tmp/Nvram.bin cat /dev/mtdblock2 > /tmp/Bdata.bin cat /dev/mtdblock3 > /tmp/Factory.bin cat /dev/mtdblock4 > /tmp/FIP.bin And save all whose bin files to somewhere safe. Then backup your configurations, since ubiformat for entire mtd device is required to create new ubootenv volume for OpenWrt U-Boot. 3. Run the following cmd to boot into an initramfs with the new OpenWrt U-Boot layout that expand ubi partion to the end of flash: ubiformat /dev/mtd7 -y -f /tmp/ax6000-ubootmod-initramfs-factory.ubi 4. After boot into initramfs, check mtd partion info. The ubi partion should be mtd5 root@OpenWrt:~# cat /proc/mtd dev: size erasesize name mtd0: 00100000 00020000 BL2 mtd1: 00040000 00020000 Nvram mtd2: 00040000 00020000 Bdata mtd3: 00200000 00020000 Factory mtd4: 00200000 00020000 FIP mtd5: 07a80000 00020000 ubi 5. Load kmod-mtd-rw to temporarily make the bootloader partions writable. The kmod-mtd-rw is from the feeds, it is not packed in initramfs-factory by default. To install kmod-mtd-rw via opkg: opkg update && opkg install kmod-mtd-rw Or, download kmod-mtd-rw.ipk from OpenWrt server and install it manually e.g: https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/kmods/ Select your OpenWrt release version and kernel version accordingly. Load kmod-mtd-rw: insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1 6. Run the following cmd to clean all pending crash dumps in pstore, or OpenWrt U-Boot may boot into NAND recovery or tftp recovery. rm -f /sys/fs/pstore/* 7. Format ubi and create new ubootenv volume: ubidetach -p /dev/mtd5; ubiformat /dev/mtd5 -y; ubiattach -p /dev/mtd5 ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB 8. This is optional. Skip this if you do not want to have NAND recovery boot feature offered by OpenWrt U-Boot. Don't worry, you always have automatic tftp recovery feature enabled. ubimkvol /dev/ubi0 -n 2 -N recovery -s 10MiB ubiupdatevol /dev/ubi0_2 /tmp/ax6000-ubootmod-initramfs-recovery.itb 9. Now, flash new U-Boot. Bye-bye ugly stock U-Boot. mtd write /tmp/ax6000-ubootmod-preloader.bin BL2 mtd write /tmp/ax6000-ubootmod-bl31-uboot.fip FIP 10. Flash the squashfs-sysupgrade.bin as usual: sysupgrade -n /tmp/ax6000-ubootmod-squashfs-sysupgrade.itb Enjoy! Signed-off-by: Furong Xu <xfr@outlook.com>
Diffstat (limited to 'package/boot/uboot-mediatek/Makefile')
-rw-r--r--package/boot/uboot-mediatek/Makefile13
1 files changed, 13 insertions, 0 deletions
diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile
index 9d823ec698..866f6fa51a 100644
--- a/package/boot/uboot-mediatek/Makefile
+++ b/package/boot/uboot-mediatek/Makefile
@@ -236,6 +236,18 @@ define U-Boot/mt7986_bananapi_bpi-r3-nor
FIP_COMPRESS:=1
endef
+define U-Boot/mt7986_xiaomi_redmi-router-ax6000
+ NAME:=Xiaomi Redmi AX6000
+ BUILD_SUBTARGET:=filogic
+ BUILD_DEVICES:=xiaomi_redmi-router-ax6000-ubootmod
+ UBOOT_CONFIG:=mt7986_xiaomi_redmi-ax6000
+ UBOOT_IMAGE:=u-boot.fip
+ BL2_BOOTDEV:=spim-nand
+ BL2_SOC:=mt7986
+ BL2_DDRTYPE:=ddr4
+ DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr4
+endef
+
UBOOT_TARGETS := \
mt7620_mt7530_rfb \
mt7620_rfb \
@@ -256,6 +268,7 @@ UBOOT_TARGETS := \
mt7986_bananapi_bpi-r3-sdmmc \
mt7986_bananapi_bpi-r3-snand \
mt7986_bananapi_bpi-r3-nor \
+ mt7986_xiaomi_redmi-router-ax6000 \
mt7986_rfb
ifdef CONFIG_TARGET_mediatek