mediatek: BananaPi BPi-R3 bootloader update
* Switch to all-UBI layout on SPI-NAND * use fitblk driver instead of uImage.FIT partition parser * adapt sysupgrade * bump COMPAT_VERSION Remove BROKEN mark now that all needed changes are done. Boards running images generated before this commit will require full reflash of the bootloader, re-install from SD card is the easiest way to achieve that. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
8afce4893b
commit
61137a8895
5 changed files with 145 additions and 29 deletions
|
@ -6,7 +6,7 @@ board_config_update
|
||||||
|
|
||||||
case "$(board_name)" in
|
case "$(board_name)" in
|
||||||
bananapi,bpi-r3)
|
bananapi,bpi-r3)
|
||||||
ucidef_set_compat_version "1.1"
|
ucidef_set_compat_version "1.2"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
case "$(board_name)" in
|
case "$(board_name)" in
|
||||||
bananapi,bpi-r3)
|
bananapi,bpi-r3)
|
||||||
uci set system.@system[0].compat_version="1.1"
|
uci set system.@system[0].compat_version="1.2"
|
||||||
uci commit system
|
uci commit system
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -95,26 +95,7 @@ platform_do_upgrade() {
|
||||||
CI_KERNPART="linux"
|
CI_KERNPART="linux"
|
||||||
nand_do_upgrade "$1"
|
nand_do_upgrade "$1"
|
||||||
;;
|
;;
|
||||||
bananapi,bpi-r3)
|
bananapi,bpi-r3|\
|
||||||
local rootdev="$(cmdline_get_var root)"
|
|
||||||
rootdev="${rootdev##*/}"
|
|
||||||
rootdev="${rootdev%p[0-9]*}"
|
|
||||||
case "$rootdev" in
|
|
||||||
mmc*)
|
|
||||||
CI_ROOTDEV="$rootdev"
|
|
||||||
CI_KERNPART="production"
|
|
||||||
emmc_do_upgrade "$1"
|
|
||||||
;;
|
|
||||||
mtdblock*)
|
|
||||||
PART_NAME="fit"
|
|
||||||
default_do_upgrade "$1"
|
|
||||||
;;
|
|
||||||
ubiblock*)
|
|
||||||
CI_KERNPART="fit"
|
|
||||||
nand_do_upgrade "$1"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
bananapi,bpi-r4)
|
bananapi,bpi-r4)
|
||||||
[ -e /dev/fit0 ] && fitblk /dev/fit0
|
[ -e /dev/fit0 ] && fitblk /dev/fit0
|
||||||
[ -e /dev/fitrw ] && fitblk /dev/fitrw
|
[ -e /dev/fitrw ] && fitblk /dev/fitrw
|
||||||
|
@ -124,6 +105,10 @@ platform_do_upgrade() {
|
||||||
EMMC_KERN_DEV="/dev/$bootdev"
|
EMMC_KERN_DEV="/dev/$bootdev"
|
||||||
emmc_do_upgrade "$1"
|
emmc_do_upgrade "$1"
|
||||||
;;
|
;;
|
||||||
|
mtdblock*)
|
||||||
|
PART_NAME="/dev/mtd${bootdev:8}"
|
||||||
|
default_do_upgrade "$1"
|
||||||
|
;;
|
||||||
ubiblock*)
|
ubiblock*)
|
||||||
CI_KERNPART="fit"
|
CI_KERNPART="fit"
|
||||||
nand_do_upgrade "$1"
|
nand_do_upgrade "$1"
|
||||||
|
@ -225,7 +210,6 @@ platform_check_image() {
|
||||||
|
|
||||||
platform_copy_config() {
|
platform_copy_config() {
|
||||||
case "$(board_name)" in
|
case "$(board_name)" in
|
||||||
bananapi,bpi-r3|\
|
|
||||||
cmcc,rax3000m)
|
cmcc,rax3000m)
|
||||||
case "$(cmdline_get_var root)" in
|
case "$(cmdline_get_var root)" in
|
||||||
/dev/mmc*)
|
/dev/mmc*)
|
||||||
|
@ -233,6 +217,7 @@ platform_copy_config() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
bananapi,bpi-r3|\
|
||||||
bananapi,bpi-r4)
|
bananapi,bpi-r4)
|
||||||
case "$(platform_get_bootdev)" in
|
case "$(platform_get_bootdev)" in
|
||||||
mmcblk*)
|
mmcblk*)
|
||||||
|
|
|
@ -218,7 +218,6 @@ endef
|
||||||
TARGET_DEVICES += asus_tuf-ax6000
|
TARGET_DEVICES += asus_tuf-ax6000
|
||||||
|
|
||||||
define Device/bananapi_bpi-r3
|
define Device/bananapi_bpi-r3
|
||||||
BROKEN := 1
|
|
||||||
DEVICE_VENDOR := Bananapi
|
DEVICE_VENDOR := Bananapi
|
||||||
DEVICE_MODEL := BPi-R3
|
DEVICE_MODEL := BPi-R3
|
||||||
DEVICE_DTS := mt7986a-bananapi-bpi-r3
|
DEVICE_DTS := mt7986a-bananapi-bpi-r3
|
||||||
|
@ -228,7 +227,8 @@ define Device/bananapi_bpi-r3
|
||||||
mt7986a-bananapi-bpi-r3-respeaker-2mics
|
mt7986a-bananapi-bpi-r3-respeaker-2mics
|
||||||
DEVICE_DTS_DIR := $(DTS_DIR)/
|
DEVICE_DTS_DIR := $(DTS_DIR)/
|
||||||
DEVICE_DTS_LOADADDR := 0x43f00000
|
DEVICE_DTS_LOADADDR := 0x43f00000
|
||||||
DEVICE_PACKAGES := kmod-hwmon-pwmfan kmod-i2c-gpio kmod-mt7986-firmware kmod-sfp kmod-usb3 e2fsprogs f2fsck mkf2fs mt7986-wo-firmware
|
DEVICE_PACKAGES := fitblk kmod-hwmon-pwmfan kmod-i2c-gpio kmod-mt7986-firmware kmod-sfp kmod-usb3 \
|
||||||
|
e2fsprogs f2fsck mkf2fs mt7986-wo-firmware
|
||||||
IMAGES := sysupgrade.itb
|
IMAGES := sysupgrade.itb
|
||||||
KERNEL_LOADADDR := 0x44000000
|
KERNEL_LOADADDR := 0x44000000
|
||||||
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
||||||
|
@ -241,7 +241,7 @@ define Device/bananapi_bpi-r3
|
||||||
ARTIFACT/emmc-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-emmc
|
ARTIFACT/emmc-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-emmc
|
||||||
ARTIFACT/nor-preloader.bin := mt7986-bl2 nor-ddr4
|
ARTIFACT/nor-preloader.bin := mt7986-bl2 nor-ddr4
|
||||||
ARTIFACT/nor-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-nor
|
ARTIFACT/nor-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-nor
|
||||||
ARTIFACT/snand-preloader.bin := mt7986-bl2 spim-nand-ddr4
|
ARTIFACT/snand-preloader.bin := mt7986-bl2 spim-nand-ubi-ddr4
|
||||||
ARTIFACT/snand-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-snand
|
ARTIFACT/snand-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-snand
|
||||||
ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\
|
ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\
|
||||||
pad-to 17k | mt7986-bl2 sdmmc-ddr4 |\
|
pad-to 17k | mt7986-bl2 sdmmc-ddr4 |\
|
||||||
|
@ -249,7 +249,7 @@ define Device/bananapi_bpi-r3
|
||||||
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\
|
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\
|
||||||
pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 44m |\
|
pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 44m |\
|
||||||
) \
|
) \
|
||||||
pad-to 44M | mt7986-bl2 spim-nand-ddr4 |\
|
pad-to 44M | mt7986-bl2 spim-nand-ubi-ddr4 |\
|
||||||
pad-to 45M | mt7986-bl31-uboot bananapi_bpi-r3-snand |\
|
pad-to 45M | mt7986-bl31-uboot bananapi_bpi-r3-snand |\
|
||||||
pad-to 49M | mt7986-bl2 nor-ddr4 |\
|
pad-to 49M | mt7986-bl2 nor-ddr4 |\
|
||||||
pad-to 50M | mt7986-bl31-uboot bananapi_bpi-r3-nor |\
|
pad-to 50M | mt7986-bl31-uboot bananapi_bpi-r3-nor |\
|
||||||
|
@ -268,8 +268,8 @@ endif
|
||||||
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
||||||
IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | pad-rootfs | append-metadata
|
IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | pad-rootfs | append-metadata
|
||||||
DEVICE_DTC_FLAGS := --pad 4096
|
DEVICE_DTC_FLAGS := --pad 4096
|
||||||
DEVICE_COMPAT_VERSION := 1.1
|
DEVICE_COMPAT_VERSION := 1.2
|
||||||
DEVICE_COMPAT_MESSAGE := Device tree overlay mechanism needs bootloader update
|
DEVICE_COMPAT_MESSAGE := SPI-NAND flash layout changes require bootloader update
|
||||||
endef
|
endef
|
||||||
TARGET_DEVICES += bananapi_bpi-r3
|
TARGET_DEVICES += bananapi_bpi-r3
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,131 @@
|
||||||
|
--- a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-emmc.dtso
|
||||||
|
+++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-emmc.dtso
|
||||||
|
@@ -23,7 +23,27 @@
|
||||||
|
no-sd;
|
||||||
|
no-sdio;
|
||||||
|
status = "okay";
|
||||||
|
+
|
||||||
|
+ card@0 {
|
||||||
|
+ compatible = "mmc-card";
|
||||||
|
+ reg = <0>;
|
||||||
|
+
|
||||||
|
+ block {
|
||||||
|
+ compatible = "block-device";
|
||||||
|
+ partitions {
|
||||||
|
+ emmc_rootdisk: block-partition-production {
|
||||||
|
+ partname = "production";
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
-};
|
||||||
|
|
||||||
|
+ fragment@1 {
|
||||||
|
+ target-path = "/chosen";
|
||||||
|
+ __overlay__ {
|
||||||
|
+ rootdisk-emmc = <&emmc_rootdisk>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
--- a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso
|
||||||
|
+++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nand.dtso
|
||||||
|
@@ -29,27 +29,30 @@
|
||||||
|
|
||||||
|
partition@0 {
|
||||||
|
label = "bl2";
|
||||||
|
- reg = <0x0 0x100000>;
|
||||||
|
+ reg = <0x0 0x200000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
- partition@100000 {
|
||||||
|
- label = "reserved";
|
||||||
|
- reg = <0x100000 0x280000>;
|
||||||
|
- };
|
||||||
|
-
|
||||||
|
- partition@380000 {
|
||||||
|
- label = "fip";
|
||||||
|
- reg = <0x380000 0x200000>;
|
||||||
|
- read-only;
|
||||||
|
- };
|
||||||
|
-
|
||||||
|
- partition@580000 {
|
||||||
|
+ partition@200000 {
|
||||||
|
label = "ubi";
|
||||||
|
- reg = <0x580000 0x7a80000>;
|
||||||
|
+ reg = <0x200000 0x7e00000>;
|
||||||
|
+ compatible = "linux,ubi";
|
||||||
|
+
|
||||||
|
+ volumes {
|
||||||
|
+ nand_rootdisk: ubi-volume-fit {
|
||||||
|
+ volname = "fit";
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+ fragment@1 {
|
||||||
|
+ target-path = "/chosen";
|
||||||
|
+ __overlay__ {
|
||||||
|
+ rootdisk-spim-nand = <&nand_rootdisk>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
--- a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nor.dtso
|
||||||
|
+++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-nor.dtso
|
||||||
|
@@ -52,7 +52,7 @@
|
||||||
|
reg = <0x180000 0xa80000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
- partition@c00000 {
|
||||||
|
+ nor_rootdisk: partition@c00000 {
|
||||||
|
label = "fit";
|
||||||
|
reg = <0xc00000 0x1400000>;
|
||||||
|
compatible = "denx,fit";
|
||||||
|
@@ -61,4 +61,11 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+ fragment@1 {
|
||||||
|
+ target-path = "/chosen";
|
||||||
|
+ __overlay__ {
|
||||||
|
+ rootdisk-nor = <&nor_rootdisk>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
--- a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sd.dtso
|
||||||
|
+++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sd.dtso
|
||||||
|
@@ -17,6 +17,27 @@
|
||||||
|
max-frequency = <52000000>;
|
||||||
|
cap-sd-highspeed;
|
||||||
|
status = "okay";
|
||||||
|
+
|
||||||
|
+ card@0 {
|
||||||
|
+ compatible = "mmc-card";
|
||||||
|
+ reg = <0>;
|
||||||
|
+
|
||||||
|
+ block {
|
||||||
|
+ compatible = "block-device";
|
||||||
|
+ partitions {
|
||||||
|
+ sd_rootdisk: block-partition-production {
|
||||||
|
+ partname = "production";
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ fragment@1 {
|
||||||
|
+ target-path = "/chosen";
|
||||||
|
+ __overlay__ {
|
||||||
|
+ rootdisk-sd = <&sd_rootdisk>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
Loading…
Reference in a new issue