From ee6b2fee3ae8bc4cf838c149411a009f81a0b451 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Wed, 19 Aug 2020 12:10:43 +0800 Subject: [PATCH] Revert 'treewide: adjust sysupgrade script' --- .../layerscape/base-files/lib/upgrade/platform.sh | 11 +++-------- target/linux/mvebu/base-files/lib/upgrade/sdcard.sh | 11 +++-------- .../armv8/base-files/lib/preinit/79_move_config | 2 +- .../rockchip/armv8/base-files/lib/upgrade/platform.sh | 11 +++-------- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh index d091a65dea..4ce5605612 100644 --- a/target/linux/layerscape/base-files/lib/upgrade/platform.sh +++ b/target/linux/layerscape/base-files/lib/upgrade/platform.sh @@ -11,7 +11,7 @@ REQUIRE_IMAGE_METADATA=1 platform_check_image_sdboot() { local diskdev partdev diff - export_bootdevice && export_partdevice diskdev -2 || { + export_bootdevice && export_partdevice diskdev 0 || { echo "Unable to determine upgrade device" return 1 } @@ -38,7 +38,7 @@ platform_check_image_sdboot() { platform_do_upgrade_sdboot() { local diskdev partdev diff - export_bootdevice && export_partdevice diskdev -2 || { + export_bootdevice && export_partdevice diskdev 0 || { echo "Unable to determine upgrade device" return 1 } @@ -77,10 +77,6 @@ platform_do_upgrade_sdboot() { # iterate over each partition from the image and write it to the boot disk while read part start size; do - # root is /dev/sd[a|b]2 and not /dev/sd[a|b] this causes some problem - # one of which is this offset, I'm not sure what's the best fix, so - # here's a WA. - let part=$((part - 2)) if export_partdevice partdev $part; then echo "Writing image to /dev/$partdev..." dd if="$1" of="/dev/$partdev" bs=512 skip="$start" count="$size" > /dev/null 2>&1 @@ -111,8 +107,7 @@ platform_do_upgrade_traverse_nandubi() { platform_copy_config() { local partdev parttype=ext4 - # Same as above /dev/sd[a|b]2 is root, so /boot is -1 - if export_partdevice partdev -1; then + if export_partdevice partdev 1; then mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt cp -af "$CONF_TAR" "/mnt/$CONF_TAR" umount /mnt diff --git a/target/linux/mvebu/base-files/lib/upgrade/sdcard.sh b/target/linux/mvebu/base-files/lib/upgrade/sdcard.sh index 66a448f8b9..5ca5e71fe7 100644 --- a/target/linux/mvebu/base-files/lib/upgrade/sdcard.sh +++ b/target/linux/mvebu/base-files/lib/upgrade/sdcard.sh @@ -14,7 +14,7 @@ platform_check_image_sdcard() { return 1 } - export_bootdevice && export_partdevice diskdev -2 || { + export_bootdevice && export_partdevice diskdev 0 || { echo "Unable to determine upgrade device" return 1 } @@ -42,7 +42,7 @@ platform_do_upgrade_sdcard() { local board=$(board_name) local diskdev partdev diff - export_bootdevice && export_partdevice diskdev -2 || { + export_bootdevice && export_partdevice diskdev 0 || { echo "Unable to determine upgrade device" return 1 } @@ -75,10 +75,6 @@ platform_do_upgrade_sdcard() { get_image "$@" | dd of="$diskdev" bs=512 skip=1 seek=1 count=2048 conv=fsync #iterate over each partition from the image and write it to the boot disk while read part start size; do - # root is /dev/sd[a|b]2 and not /dev/sd[a|b] this causes some problem - # one of which is this offset, I'm not sure what's the best fix, so - # here's a WA. - let part=$((part - 2)) if export_partdevice partdev $part; then echo "Writing image to /dev/$partdev..." get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync @@ -107,8 +103,7 @@ platform_do_upgrade_sdcard() { platform_copy_config_sdcard() { local partdev - # Same as above /dev/sd[a|b]2 is root, so /boot is -1 - if export_partdevice partdev -1; then + if export_partdevice partdev 1; then mkdir -p /boot [ -f /boot/kernel.img ] || mount -o rw,noatime /dev/$partdev /boot cp -af "$CONF_TAR" /boot/ diff --git a/target/linux/rockchip/armv8/base-files/lib/preinit/79_move_config b/target/linux/rockchip/armv8/base-files/lib/preinit/79_move_config index db764486fd..14d9281d4a 100644 --- a/target/linux/rockchip/armv8/base-files/lib/preinit/79_move_config +++ b/target/linux/rockchip/armv8/base-files/lib/preinit/79_move_config @@ -3,7 +3,7 @@ move_config() { . /lib/upgrade/common.sh - if export_bootdevice && export_partdevice partdev -1; then + if export_bootdevice && export_partdevice partdev 1; then if mount -o rw,noatime "/dev/$partdev" /mnt; then if [ -f "/mnt/$CONF_TAR" ]; then mv -f "/mnt/$CONF_TAR" / diff --git a/target/linux/rockchip/armv8/base-files/lib/upgrade/platform.sh b/target/linux/rockchip/armv8/base-files/lib/upgrade/platform.sh index 812579e720..a1d1e04ae7 100644 --- a/target/linux/rockchip/armv8/base-files/lib/upgrade/platform.sh +++ b/target/linux/rockchip/armv8/base-files/lib/upgrade/platform.sh @@ -1,7 +1,7 @@ platform_check_image() { local diskdev partdev diff - export_bootdevice && export_partdevice diskdev -2 || { + export_bootdevice && export_partdevice diskdev 0 || { echo "Unable to determine upgrade device" return 1 } @@ -28,8 +28,7 @@ platform_check_image() { platform_copy_config() { local partdev - # Same as above /dev/sd[a|b]2 is root, so /boot is -1 - if export_partdevice partdev -1; then + if export_partdevice partdev 1; then mount -o rw,noatime "/dev/$partdev" /mnt cp -af "$CONF_TAR" "/mnt/$CONF_TAR" umount /mnt @@ -39,7 +38,7 @@ platform_copy_config() { platform_do_upgrade() { local diskdev partdev diff - export_bootdevice && export_partdevice diskdev -2 || { + export_bootdevice && export_partdevice diskdev 0 || { echo "Unable to determine upgrade device" return 1 } @@ -73,10 +72,6 @@ platform_do_upgrade() { #iterate over each partition from the image and write it to the boot disk while read part start size; do - # root is /dev/sd[a|b]2 and not /dev/sd[a|b] this causes some problem - # one of which is this offset, I'm not sure what's the best fix, so - # here's a WA. - let part=$((part - 2)) if export_partdevice partdev $part; then echo "Writing image to /dev/$partdev..." get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync