aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2024-02-24 03:00:27 +0000
committerDaniel Golle <daniel@makrotopia.org>2024-02-24 03:02:35 +0000
commit6368ed1ae5b628898b33273c8950f7b7575e4414 (patch)
tree45696ee55fb1b536e810dfcf6665e78a12371ce7 /target
parent9b6427e9083fc2baeb67fca977f621d0c93fd6f2 (diff)
mediatek: mt7623: phase out uImage.FIT partition parser
Use the new fitblk driver on the BananaPi R2 as well as UniElec U7623. Introduce boot device selection for fitblk's /chosen/rootdisk handle, similar to how it is already done on MT7622, MT7986 and MT7988. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target')
-rw-r--r--target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dts22
-rw-r--r--target/linux/mediatek/image/mt7623.mk2
-rwxr-xr-xtarget/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh23
-rw-r--r--target/linux/mediatek/mt7623/config-6.13
-rw-r--r--target/linux/mediatek/patches-6.1/164-dts-mt7623-bpi-r2-rootdisk-for-fitblk.patch53
5 files changed, 98 insertions, 5 deletions
diff --git a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dts b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dts
index bcd81ba6da..75ee0723ec 100644
--- a/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dts
+++ b/target/linux/mediatek/dts/mt7623a-unielec-u7623-02.dts
@@ -9,4 +9,26 @@
/ {
model = "UniElec U7623-02 eMMC";
compatible = "unielec,u7623-02", "mediatek,mt7623";
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ bootargs = "earlycon=uart8250,mmio32,0x11004000 root=/dev/fit0";
+ rootdisk = <&emmc_rootdisk>;
+ };
+};
+
+&mmc0 {
+ card@0 {
+ compatible = "mmc-card";
+ reg = <0>;
+
+ block {
+ compatible = "block-device";
+ partitions {
+ emmc_rootdisk: block-partition-env {
+ partno = <3>;
+ };
+ };
+ };
+ };
};
diff --git a/target/linux/mediatek/image/mt7623.mk b/target/linux/mediatek/image/mt7623.mk
index 2c4402da66..24663551e0 100644
--- a/target/linux/mediatek/image/mt7623.mk
+++ b/target/linux/mediatek/image/mt7623.mk
@@ -116,6 +116,8 @@ endif
gzip
ARTIFACTS := u-boot.bin preloader.bin sdcard.img.gz
SUPPORTED_DEVICES := bananapi,bpi-r2
+ DEVICE_COMPAT_VERSION := 1.1
+ DEVICE_COMPAT_MESSAGE := Bootloader update required for switch to fitblk
endef
TARGET_DEVICES += bananapi_bpi-r2
diff --git a/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh
index 5d12b6989e..98f76ff49f 100755
--- a/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh
@@ -1,5 +1,20 @@
REQUIRE_IMAGE_METADATA=1
+platform_get_bootdev() {
+ local rootdisk="$(cat /sys/firmware/devicetree/base/chosen/rootdisk)"
+ local handle bootdev
+ for handle in /sys/class/block/*/of_node/phandle /sys/class/block/*/device/of_node/phandle; do
+ [ ! -e "$handle" ] && continue
+ if [ "$rootdisk" = "$(cat $handle)" ]; then
+ bootdev="${handle%/of_node/phandle}"
+ bootdev="${bootdev%/device}"
+ bootdev="${bootdev#/sys/class/block/}"
+ echo "$bootdev"
+ break
+ fi
+ done
+}
+
# Legacy full system upgrade including preloader for MediaTek SoCs on eMMC or SD
legacy_mtk_mmc_full_upgrade() {
local diskdev partdev diff oldrecovery
@@ -83,10 +98,10 @@ platform_do_upgrade() {
case "$board" in
bananapi,bpi-r2|\
unielec,u7623-02)
- export_bootdevice
- export_partdevice fitpart 3
- [ "$fitpart" ] || return 1
- EMMC_KERN_DEV="/dev/$fitpart"
+ [ -e /dev/fit0 ] && fitblk /dev/fit0
+ [ -e /dev/fitrw ] && fitblk /dev/fitrw
+ bootdev="$(platform_get_bootdev)"
+ EMMC_KERN_DEV="/dev/$bootdev"
emmc_do_upgrade "$1"
;;
unielec,u7623-02-emmc-512m)
diff --git a/target/linux/mediatek/mt7623/config-6.1 b/target/linux/mediatek/mt7623/config-6.1
index 765f14fe90..a083809e34 100644
--- a/target/linux/mediatek/mt7623/config-6.1
+++ b/target/linux/mediatek/mt7623/config-6.1
@@ -214,7 +214,7 @@ CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_FOPS=y
CONFIG_FB_SYS_IMAGEBLIT=y
-CONFIG_FIT_PARTITION=y
+# CONFIG_FIT_PARTITION is not set
CONFIG_FIXED_PHY=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_FONT_8x16=y
@@ -563,6 +563,7 @@ CONFIG_TREE_SRCU=y
# CONFIG_UACCE is not set
CONFIG_UBIFS_FS=y
CONFIG_UEVENT_HELPER_PATH=""
+CONFIG_UIMAGE_FIT_BLK=y
CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
CONFIG_UNINLINE_SPIN_UNLOCK=y
CONFIG_UNWINDER_ARM=y
diff --git a/target/linux/mediatek/patches-6.1/164-dts-mt7623-bpi-r2-rootdisk-for-fitblk.patch b/target/linux/mediatek/patches-6.1/164-dts-mt7623-bpi-r2-rootdisk-for-fitblk.patch
new file mode 100644
index 0000000000..06d54ec462
--- /dev/null
+++ b/target/linux/mediatek/patches-6.1/164-dts-mt7623-bpi-r2-rootdisk-for-fitblk.patch
@@ -0,0 +1,53 @@
+--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
++++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
+@@ -27,6 +27,8 @@
+ chosen {
+ stdout-path = "serial2:115200n8";
+ bootargs = "earlycon=uart8250,mmio32,0x11004000 console=ttyS2,115200n8 console=tty1";
++ rootdisk-emmc = <&emmc_rootdisk>;
++ rootdisk-sd = <&sd_rootdisk>;
+ };
+
+ connector {
+@@ -315,6 +317,20 @@
+ vmmc-supply = <&reg_3p3v>;
+ vqmmc-supply = <&reg_1p8v>;
+ non-removable;
++
++ card@0 {
++ compatible = "mmc-card";
++ reg = <0>;
++
++ block {
++ compatible = "block-device";
++ partitions {
++ emmc_rootdisk: block-partition-fit {
++ partno = <3>;
++ };
++ };
++ };
++ };
+ };
+
+ &mmc1 {
+@@ -328,6 +344,20 @@
+ cd-gpios = <&pio 261 GPIO_ACTIVE_LOW>;
+ vmmc-supply = <&reg_3p3v>;
+ vqmmc-supply = <&reg_3p3v>;
++
++ card@0 {
++ compatible = "mmc-card";
++ reg = <0>;
++
++ block {
++ compatible = "block-device";
++ partitions {
++ sd_rootdisk: block-partition-fit {
++ partno = <3>;
++ };
++ };
++ };
++ };
+ };
+
+ &mt6323_leds {