openwrt/package/boot/uboot-mediatek/patches
Furong Xu 1613e3340b 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>
2022-12-29 03:04:42 +00:00
..
000-mtk-20-configs-mt7622-enable-environment-for-mt7622_rfb.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
002-0001-arm-mediatek-add-support-for-MediaTek-MT7986-SoC.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0002-arm-mediatek-add-support-for-MediaTek-MT7981-SoC.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0003-board-mediatek-add-MT7986-reference-boards.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
002-0004-board-mediatek-add-MT7981-reference-boards.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
002-0005-mmc-mediatek-add-support-for-MediaTek-MT7891-MT7986-.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0006-net-mediatek-use-a-struct-to-cover-variations-of-all.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0007-net-mediatek-stop-using-bitfileds-for-DMA-descriptor.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0008-net-mediatek-add-support-for-PDMA-v2.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0009-net-mediatek-add-support-for-MediaTek-MT7981-MT7986.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0010-serial-mtk-add-support-for-using-dynamic-baud-clock-.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0011-arm-dts-mt7622-force-high-speed-mode-for-uart.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0012-pwm-mtk-add-support-for-MediaTek-MT7986-SoC.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0013-pwm-mtk-add-support-for-MediaTek-MT7981-SoC.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0014-timer-mtk-add-support-for-MediaTek-MT7981-MT7986-SoC.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0015-watchdog-mediatek-add-support-for-MediaTek-MT7986-So.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0016-spi-add-support-for-MediaTek-spi-mem-controller.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
002-0017-i2c-add-support-for-MediaTek-I2C-interface.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
002-0018-arm-dts-mt7622-add-i2c-support.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0019-dt-bindings-pinctrl-mediatek-add-a-header-for-common.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0020-pinctrl-mediatek-add-pinctrl-driver-for-MT7981-SoC.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0021-pinctrl-mediatek-add-pinctrl-driver-for-MT7986-SoC.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0022-clk-mediatek-add-CLK_BYPASS_XTAL-flag-to-allow-bypas.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0023-clk-mediatek-add-support-to-configure-clock-driver-p.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0024-clk-mediatek-add-infrasys-clock-mux-support.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0025-clk-mediatek-add-CLK_XTAL-support-for-clock-driver.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0026-clk-mediatek-add-clock-driver-support-for-MediaTek-M.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0027-clk-mediatek-add-clock-driver-support-for-MediaTek-M.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0028-cpu-add-basic-cpu-driver-for-MediaTek-ARM-chips.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
002-0029-tools-mtk_image-split-gfh-header-verification-into-a.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0030-tools-mtk_image-split-the-code-of-generating-NAND-he.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0031-tools-mtk_image-add-support-for-nand-headers-used-by.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
002-0032-MAINTAINERS-update-maintainer-for-MediaTek-ARM-platf.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
050-mt7622-enable-pstore.patch
051-mt7986-enable-pstore.patch uboot-mediatek: mt7986: support PSTORE/ramoops 2022-08-28 20:33:15 +01:00
100-00-clk-remove-log_ret-from-clk_get_rate.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-01-board-mediatek-add-more-network-configurations.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-02-drivers-mtd-add-support-for-MediaTek-SPI-NAND-flash-.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-03-mtd-mtk-snand-add-support-for-SPL.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-04-env-add-support-for-generic-MTD-device.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-05-mtd-add-a-new-mtd-device-type-for-NMBM.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-06-mtd-add-core-facility-code-of-NMBM.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-07-mtd-nmbm-add-support-for-mtd.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-08-common-board_r-add-support-to-initialize-NMBM-after-.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-09-cmd-add-nmbm-command.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-10-cmd-mtd-add-markbad-subcommand-for-NMBM-testing.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-11-env-add-support-for-NMBM-upper-MTD-layer.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-12-mtd-mtk-snand-add-NMBM-support-for-SPL.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-13-cmd-add-a-new-command-for-NAND-flash-debugging.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-14-mtd-spi-nor-add-support-to-read-flash-unique-ID.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-15-cmd-sf-add-support-to-read-flash-unique-ID.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-16-cmd-bootmenu-add-ability-to-select-item-by-shortkey.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-17-common-spl-spl_nand-enable-CONFIG_SYS_NAND_U_BOOT_OF.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-18-board-mt7629-add-support-for-booting-from-SPI-NAND.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
100-19-board-mt7622-use-new-spi-nand-driver.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-20-board-mt7981-add-reference-board-using-new-spi-nand-.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-21-mtd-spi-nor-add-more-flash-ids.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-22-mtd-spi-nand-backport-from-upstream-kernel.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-23-mmc-mtk-sd-add-support-to-display-verbose-error-log.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-24-cmd-ubi-make-volume-find-create-remove-APIs-public.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-25-cmd-ubi-allow-creating-volume-with-all-free-spaces.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-26-env-ubi-add-support-to-create-environment-volume-if-.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
100-27-mtd-ubi-add-support-for-UBI-end-of-filesystem-marker.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
100-29-board-mediatek-wire-up-NMBM-support.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
110-no-kwbimage.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
120-use-xz-instead-of-lzma.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
130-fix-mkimage-host-build.patch
200-cmd-add-imsz-and-imszb.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
211-cmd-bootmenu-custom-title.patch uboot-mediatek: additions from MTK SDK 2022-08-28 20:33:15 +01:00
220-cmd-env-readmem.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
230-cmd-add-pstore-check.patch
260-add-missing-type-u64.patch
280-image-fdt-save-name-of-FIT-configuration-in-chosen-node.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
300-force-pylibfdt-build.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
301-mt7622-generic-reset-button-ignore-env.patch uboot-mediatek: replace patches with updated versions 2022-08-31 14:02:45 +01:00
302-mt7623-generic-reset-button-ignore-env.patch uboot-mediatek: reorder patches 2022-07-30 19:03:54 +02:00
303-mt7986-generic-reset-button-ignore-env.patch uboot-mediatek: mt7986: add generic reset button support 2022-08-28 20:33:15 +01:00
400-update-bpir2-defconfig.patch uboot-mediatek: optimize MMC erase 2022-11-17 01:55:55 +00:00
401-update-u7623-defconfig.patch uboot-mediatek: optimize MMC erase 2022-11-17 01:55:55 +00:00
402-update-bananapi-bpi-r64-device-tree.patch uboot-mediatek: backport pinctrl fix to avoid error message 2022-08-11 17:11:48 +02:00
403-add-bananapi_bpi-r64-snand.patch
404-add-bananapi_bpi-r64_defconfigs.patch uboot-mediatek: optimize MMC erase 2022-11-17 01:55:55 +00:00
405-dts-mt7623n-bpi-r2-fix-leds.patch
410-add-linksys-e8450.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
412-add-ubnt-unifi-6-lr.patch uboot-mediatek: update to U-Boot 2022.10 2022-10-18 20:08:35 +01:00
420-add-support-for-RAVPower-RP-WD009.patch uboot-ramips: add support for MT7621, merge into uboot-mediatek 2022-07-11 21:27:24 +01:00
430-add-bpi-r3.patch uboot-mediatek: bpi-r3: raise CONFIG_LMB_MAX_REGIONS to 64 2022-11-29 19:44:43 +00:00
431-add-xiaomi_redmi-ax6000.patch uboot-mediatek: add support for Xiaomi Redmi Router AX6000 2022-12-29 03:04:42 +00:00
500-board-mt7623-fix-mmc-detect.patch