[PATCH 3/4] mediatek: mt7622: add ubi support for bananapi bpi-r64

Oskari Lemmela oskari at lemmela.net
Mon Apr 5 18:53:16 BST 2021


Signed-off-by: Oskari Lemmela <oskari at lemmela.net>
---
 package/boot/uboot-envtools/files/mediatek    | 14 ++++++--
 .../mt7622/base-files/lib/upgrade/platform.sh | 34 +++++++++++++------
 2 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/package/boot/uboot-envtools/files/mediatek b/package/boot/uboot-envtools/files/mediatek
index 50269c9500..85d7db206d 100644
--- a/package/boot/uboot-envtools/files/mediatek
+++ b/package/boot/uboot-envtools/files/mediatek
@@ -21,9 +21,17 @@ case "$board" in
 	. /lib/upgrade/common.sh
 	export_bootdevice
 	export_partdevice rootdev 0
-	local envdev=/dev/$(get_partition_by_name $rootdev ubootenv)
-	ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
-	ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
+	case "$rootdev" in
+	mmc*)
+		local envdev=/dev/$(get_partition_by_name $rootdev ubootenv)
+		ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1"
+		ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1"
+		;;
+	ubi*)
+		ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1"
+		ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1"
+		;;
+	esac
 	;;
 buffalo,wsr-2533dhp2)
 	ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x1000" "0x20000"
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 2c1460650f..3a36f8ae1f 100755
--- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
@@ -10,16 +10,24 @@ platform_do_upgrade() {
 	bananapi,bpi-r64)
 		export_bootdevice
 		export_partdevice rootdev 0
-		local fitpart=$(get_partition_by_name $rootdev "production")
-		[ "$fitpart" ] || return 1
-		dd if=/dev/zero of=/dev/$fitpart bs=4096 count=1 2>/dev/null
-		blockdev --rereadpt /dev/$rootdev
-		get_image "$1" | dd of=/dev/$fitpart
-		blockdev --rereadpt /dev/$rootdev
-		local datapart=$(get_partition_by_name $rootdev "rootfs_data")
-		[ "$datapart" ] || return 0
-		dd if=/dev/zero of=/dev/$datapart bs=4096 count=1 2>/dev/null
-		echo $datapart > /tmp/sysupgrade.datapart
+		case "$rootdev" in
+		mmc*)
+			local fitpart=$(get_partition_by_name $rootdev "production")
+			[ "$fitpart" ] || return 1
+			dd if=/dev/zero of=/dev/$fitpart bs=4096 count=1 2>/dev/null
+			blockdev --rereadpt /dev/$rootdev
+			get_image "$1" | dd of=/dev/$fitpart
+			blockdev --rereadpt /dev/$rootdev
+			local datapart=$(get_partition_by_name $rootdev "rootfs_data")
+			[ "$datapart" ] || return 0
+			dd if=/dev/zero of=/dev/$datapart bs=4096 count=1 2>/dev/null
+			echo $datapart > /tmp/sysupgrade.datapart
+			;;
+		ubi*)
+			CI_KERNPART="fit"
+			nand_do_upgrade "$1"
+			;;
+		esac
 		;;
 	buffalo,wsr-2533dhp2)
 		local magic="$(get_magic_long "$1")"
@@ -87,7 +95,11 @@ platform_copy_config_mmc() {
 platform_copy_config() {
 	case "$(board_name)" in
 	bananapi,bpi-r64)
-		platform_copy_config_mmc
+		export_bootdevice
+		export_partdevice rootdev 0
+		if echo $rootdev | grep -q mmc; then
+			platform_copy_config_mmc
+		fi
 		;;
 	esac
 }
-- 
2.25.1




More information about the openwrt-devel mailing list