diff options
Diffstat (limited to 'target/linux/mediatek/mt7623/base-files/lib')
-rw-r--r-- | target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config | 3 | ||||
-rwxr-xr-x | target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh | 50 |
2 files changed, 25 insertions, 28 deletions
diff --git a/target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config b/target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config index f47894c0fd..9dfb06bd81 100644 --- a/target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config +++ b/target/linux/mediatek/mt7623/base-files/lib/preinit/79_move_config @@ -6,9 +6,6 @@ move_config() { local partdev partnum case $(board_name) in - bananapi,bpi-r2) - partnum=2 - ;; unielec,u7623-02-emmc-512m) if grep -q root=/dev/mmcblk0p2 /proc/cmdline; then partnum=1; 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 d3da22d496..4564bc61dd 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,6 @@ REQUIRE_IMAGE_METADATA=1 +RAMFS_COPY_BIN='blockdev' # Full system upgrade including preloader for MediaTek SoCs on eMMC or SD mtk_mmc_full_upgrade() { @@ -83,7 +84,18 @@ platform_do_upgrade() { case "$board" in bananapi,bpi-r2) - mtk_mmc_full_upgrade "$1" + export_bootdevice + export_partdevice rootdev 0 + export_partdevice fitpart 3 + [ "$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 ;; unielec,u7623-02-emmc-512m) @@ -126,32 +138,10 @@ platform_check_image() { case "$board" in bananapi,bpi-r2) - [ "$magic" != "53444d4d" ] && { + [ "$magic" != "d00dfeed" ] && { echo "Invalid image type." return 1 } - export_bootdevice && export_partdevice diskdev 0 || { - echo "Unable to determine upgrade device" - return 1 - } - - get_partitions "/dev/$diskdev" bootdisk - - #extract the boot sector from the image - get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b 2>/dev/null - - get_partitions /tmp/image.bs image - - #compare tables - diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" - - rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image - - if [ -n "$diff" ]; then - echo "Partition layout has changed. Full image will be written." - ask_bool 0 "Abort" && exit 1 - return 0 - fi ;; unielec,u7623-02-emmc-512m) # Can always upgrade to the new-style full image @@ -180,9 +170,19 @@ platform_check_image() { return 0 } +platform_copy_config_mmc() { + [ -e "$UPGRADE_BACKUP" ] || return + local datapart=$(cat /tmp/sysupgrade.datapart) + [ "$datapart" ] || echo "no rootfs_data partition, cannot keep configuration." >&2 + dd if="$UPGRADE_BACKUP" of=/dev/$datapart + sync +} + platform_copy_config() { case "$(board_name)" in - bananapi,bpi-r2|\ + bananapi,bpi-r2) + platform_copy_config_mmc + ;; unielec,u7623-02-emmc-512m) # platform_do_upgrade() will have set $recoverydev if [ -n "$recoverydev" ]; then |