|
@@ -70,26 +70,24 @@ platform_do_upgrade_sdcard() {
|
|
|
# will be missing if it overlaps with the old partition 2
|
|
# will be missing if it overlaps with the old partition 2
|
|
|
partx -d - "/dev/$diskdev"
|
|
partx -d - "/dev/$diskdev"
|
|
|
partx -a - "/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
|
|
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
|
|
case "$board" in
|
|
|
cznic,turris-omnia)
|
|
cznic,turris-omnia)
|
|
|
fw_setenv openwrt_bootargs 'earlyprintk console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=auto rootwait'
|
|
fw_setenv openwrt_bootargs 'earlyprintk console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=auto rootwait'
|