[PATCH v2 3/4] mediatek: mt7622: add ubi support for bananapi bpi-r64
Daniel Golle
daniel at makrotopia.org
Sat Apr 10 19:01:36 BST 2021
On Sat, Apr 10, 2021 at 08:16:07PM +0300, Oskari Lemmela wrote:
> Default to nand upgrade if root device is not mmc block device.
> Change default uboot environment same way.
>
> Signed-off-by: Oskari Lemmela <oskari at lemmela.net>
> ---
> package/boot/uboot-envtools/files/mediatek | 14 ++++++--
> .../mt7622/base-files/lib/upgrade/platform.sh | 34 +++++++++++++------
Please split this into two commits, one covering uboot-envtools only
and one another one covering the changes in target/linux/mediatek.
Apart from that looks very good now.
> 2 files changed, 34 insertions(+), 14 deletions(-)
>
> diff --git a/package/boot/uboot-envtools/files/mediatek b/package/boot/uboot-envtools/files/mediatek
> index e1304ddffd..f2992c66ca 100644
> --- a/package/boot/uboot-envtools/files/mediatek
> +++ b/package/boot/uboot-envtools/files/mediatek
> @@ -21,9 +21,17 @@ bananapi,bpi-r64)
> . /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"
> + ;;
> + *)
> + 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..cdae06e630 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
> + ;;
> + *)
> + 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
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list