[openwrt/openwrt] mediatek: mt7622: convert unifi6lr-v{1,2,3}-ubootmod to fitblk

LEDE Commits lede-commits at lists.infradead.org
Thu Feb 15 11:35:17 PST 2024


dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/41c053141e678b670d0bc67edf2bb1166c3d7f0a

commit 41c053141e678b670d0bc67edf2bb1166c3d7f0a
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Mon Jan 22 00:56:47 2024 +0000

    mediatek: mt7622: convert unifi6lr-v{1,2,3}-ubootmod to fitblk
    
    No bootloader changes needed in this case, smooth transition.
    
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 package/boot/uboot-envtools/files/mediatek_mt7622                | 6 ++++--
 target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v1-ubootmod.dts | 7 ++++++-
 target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v2-ubootmod.dts | 7 ++++++-
 target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3-ubootmod.dts | 7 ++++++-
 target/linux/mediatek/image/mt7622.mk                            | 6 +++---
 target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh  | 9 ++++++++-
 6 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/package/boot/uboot-envtools/files/mediatek_mt7622 b/package/boot/uboot-envtools/files/mediatek_mt7622
index 732f7d5a0e..b4b1698d3f 100644
--- a/package/boot/uboot-envtools/files/mediatek_mt7622
+++ b/package/boot/uboot-envtools/files/mediatek_mt7622
@@ -52,8 +52,10 @@ buffalo,wsr-2533dhp2)
 ruijie,rg-ew3200gx-pro)
 	ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x20000" "0x20000"
 	;;
-ubnt,unifi-6-lr-ubootmod)
-	ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x1000"
+ubnt,unifi-6-lr-v1-ubootmod|\
+ubnt,unifi-6-lr-v2-ubootmod|\
+ubnt,unifi-6-lr-v3-ubootmod)
+	ubootenv_add_uci_config "/dev/mtd$(find_mtd_index "u-boot-env")" "0x0" "0x4000" "0x1000"
 	;;
 xiaomi,redmi-router-ax6s)
 	ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x40000"
diff --git a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v1-ubootmod.dts b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v1-ubootmod.dts
index 7a7a8a8159..5f62ed1a45 100644
--- a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v1-ubootmod.dts
+++ b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v1-ubootmod.dts
@@ -5,6 +5,11 @@
 / {
 	model = "Ubiquiti UniFi 6 LR v1 (U-Boot mod)";
 	compatible = "ubnt,unifi-6-lr-v1-ubootmod", "mediatek,mt7622";
+
+	chosen {
+		rootdisk = <&rootdisk>;
+		bootargs = "earlycon=uart8250,mmio32,0x11002000 swiotlb=512 console=ttyS0,115200n8 root=/dev/fit0";
+	};
 };
 
 &nor_partitions {
@@ -54,7 +59,7 @@
 		reg = <0x120000 0xee0000>;
 	};
 
-	partition at 1000000 {
+	rootdisk: partition at 1000000 {
 		compatible = "denx,fit";
 		label = "firmware";
 		reg = <0x1000000 0x3000000>;
diff --git a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v2-ubootmod.dts b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v2-ubootmod.dts
index 3a37d1d500..96effb8aab 100644
--- a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v2-ubootmod.dts
+++ b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v2-ubootmod.dts
@@ -5,6 +5,11 @@
 / {
 	model = "Ubiquiti UniFi 6 LR v2 (U-Boot mod)";
 	compatible = "ubnt,unifi-6-lr-v2-ubootmod", "mediatek,mt7622";
+
+	chosen {
+		rootdisk = <&rootdisk>;
+		bootargs = "earlycon=uart8250,mmio32,0x11002000 swiotlb=512 console=ttyS0,115200n8 root=/dev/fit0";
+	};
 };
 
 &nor_partitions {
@@ -54,7 +59,7 @@
 		reg = <0x120000 0xee0000>;
 	};
 
-	partition at 1000000 {
+	rootdisk: partition at 1000000 {
 		compatible = "denx,fit";
 		label = "firmware";
 		reg = <0x1000000 0x3000000>;
diff --git a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3-ubootmod.dts b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3-ubootmod.dts
index e91aaa63f5..ec98dd262c 100644
--- a/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3-ubootmod.dts
+++ b/target/linux/mediatek/dts/mt7622-ubnt-unifi-6-lr-v3-ubootmod.dts
@@ -5,6 +5,11 @@
 / {
 	model = "Ubiquiti UniFi 6 LR v3 (U-Boot mod)";
 	compatible = "ubnt,unifi-6-lr-v3-ubootmod", "mediatek,mt7622";
+
+	chosen {
+		rootdisk = <&rootdisk>;
+		bootargs = "earlycon=uart8250,mmio32,0x11002000 swiotlb=512 console=ttyS0,115200n8 root=/dev/fit0";
+	};
 };
 
 &nor_partitions {
@@ -54,7 +59,7 @@
 		reg = <0x120000 0xee0000>;
 	};
 
-	partition at 1000000 {
+	rootdisk: partition at 1000000 {
 		compatible = "denx,fit";
 		label = "firmware";
 		reg = <0x1000000 0x3000000>;
diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk
index 0d631c1996..dd86c167de 100644
--- a/target/linux/mediatek/image/mt7622.mk
+++ b/target/linux/mediatek/image/mt7622.mk
@@ -375,7 +375,7 @@ define Device/ubnt_unifi-6-lr-v1-ubootmod
   DEVICE_VARIANT := v1 U-Boot mod
   DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v1-ubootmod
   DEVICE_DTS_DIR := ../dts
-  DEVICE_PACKAGES := kmod-mt7915-firmware kmod-leds-ubnt-ledbar
+  DEVICE_PACKAGES := fitblk kmod-mt7915-firmware kmod-leds-ubnt-ledbar
   KERNEL := kernel-bin | lzma
   KERNEL_INITRAMFS_SUFFIX := -recovery.itb
   KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
@@ -405,7 +405,7 @@ define Device/ubnt_unifi-6-lr-v2-ubootmod
   DEVICE_VARIANT := v2 U-Boot mod
   DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v2-ubootmod
   DEVICE_DTS_DIR := ../dts
-  DEVICE_PACKAGES := kmod-mt7915-firmware
+  DEVICE_PACKAGES := fitblk kmod-mt7915-firmware
   KERNEL := kernel-bin | lzma
   KERNEL_INITRAMFS_SUFFIX := -recovery.itb
   KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
@@ -434,7 +434,7 @@ define Device/ubnt_unifi-6-lr-v3-ubootmod
   DEVICE_VARIANT := v3 U-Boot mod
   DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v3-ubootmod
   DEVICE_DTS_DIR := ../dts
-  DEVICE_PACKAGES := kmod-mt7915-firmware
+  DEVICE_PACKAGES := fitblk kmod-mt7915-firmware
   KERNEL := kernel-bin | lzma
   KERNEL_INITRAMFS_SUFFIX := -recovery.itb
   KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
index 5836e1aa3e..6417eb1a3a 100755
--- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
@@ -21,7 +21,10 @@ platform_do_upgrade() {
 	local file_type=$(identify $1)
 
 	case "$board" in
-	bananapi,bpi-r64)
+	bananapi,bpi-r64|\
+	ubnt,unifi-6-lr-v1-ubootmod|\
+	ubnt,unifi-6-lr-v2-ubootmod|\
+	ubnt,unifi-6-lr-v3-ubootmod)
 		[ -e /dev/fit0 ] && fitblk /dev/fit0
 		[ -e /dev/fitrw ] && fitblk /dev/fitrw
 		bootdev="$(platform_get_bootdev)"
@@ -30,6 +33,10 @@ platform_do_upgrade() {
 			EMMC_KERN_DEV="/dev/$bootdev"
 			emmc_do_upgrade "$1"
 			;;
+		mtdblock*)
+			PART_NAME="/dev/mtd${bootdev:8}"
+			default_do_upgrade "$1"
+			;;
 		ubiblock*)
 			CI_KERNPART="fit"
 			nand_do_upgrade "$1"




More information about the lede-commits mailing list