aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKlaus Kudielka <klaus.kudielka@gmail.com>2019-07-28 15:54:21 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2019-08-16 22:53:06 +0200
commit4b5df88f1cd3cf8bbe51558fff943af9dcce00ff (patch)
tree3f8c08e79f47b51ee51f46469e68017da7a180e9
parent812bad9b13ecefadfd238696e4f5cec7a9dc763d (diff)
downloadupstream-4b5df88f1cd3cf8bbe51558fff943af9dcce00ff.tar.gz
upstream-4b5df88f1cd3cf8bbe51558fff943af9dcce00ff.tar.bz2
upstream-4b5df88f1cd3cf8bbe51558fff943af9dcce00ff.zip
mvebu: sysupgrade: sdcard: fix platform_do_upgrade_sdcard
Unconditionally execute the final case statement, even if the disk layout changed. This is necessary, to keep the original Turris Omnia flash instructions working: The disk layout WILL change, when switching from TurrisOS to OpenWRT. Without updating the uboot environment at the same time, the user would end up with an unbootable system. Fixes commit 2e5a0b81ec ("mvebu: sysupgrade: sdcard: keep user added ...") Signed-off-by: Klaus Kudielka <klaus.kudielka@gmail.com>
-rw-r--r--target/linux/mvebu/base-files/lib/upgrade/sdcard.sh34
1 files changed, 16 insertions, 18 deletions
diff --git a/target/linux/mvebu/base-files/lib/upgrade/sdcard.sh b/target/linux/mvebu/base-files/lib/upgrade/sdcard.sh
index 43fc2504fc..5ca5e71fe7 100644
--- a/target/linux/mvebu/base-files/lib/upgrade/sdcard.sh
+++ b/target/linux/mvebu/base-files/lib/upgrade/sdcard.sh
@@ -70,26 +70,24 @@ platform_do_upgrade_sdcard() {
# will be missing if it overlaps with the old partition 2
partx -d - "/dev/$diskdev"
partx -a - "/dev/$diskdev"
-
- return 0
+ else
+ #write uboot image
+ 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
+ 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
+ else
+ echo "Unable to find partition $part device, skipped."
+ fi
+ done < /tmp/partmap.image
+
+ #copy partition uuid
+ echo "Writing new UUID to /dev/$diskdev..."
+ get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
fi
- #write uboot image
- 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
- 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
- else
- echo "Unable to find partition $part device, skipped."
- fi
- done < /tmp/partmap.image
-
- #copy partition uuid
- echo "Writing new UUID to /dev/$diskdev..."
- get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
-
case "$board" in
cznic,turris-omnia)
fw_setenv openwrt_bootargs 'earlyprintk console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=auto rootwait'