aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/sunxi
diff options
context:
space:
mode:
authorKlaus Kudielka <klaus.kudielka@gmail.com>2019-05-08 20:40:50 +0200
committerChristian Lamparter <chunkeey@gmail.com>2019-05-11 16:37:11 +0200
commitad62247800a10654ab7a3d94ea9c6b43a834f301 (patch)
treeb70b1d866bb558d5fd6e550408f81d1a935981c7 /target/linux/sunxi
parent6411eac5da19359c45fdd9543725369ba9526384 (diff)
downloadupstream-ad62247800a10654ab7a3d94ea9c6b43a834f301.tar.gz
upstream-ad62247800a10654ab7a3d94ea9c6b43a834f301.tar.bz2
upstream-ad62247800a10654ab7a3d94ea9c6b43a834f301.zip
base-files: improve lib/upgrade/common.sh
Recently, upgrade device autodetection has been added to the mvebu target. This exposes some shortcomings of the generic export_bootdevice function, e.g. on the Turris Omnia: export_bootdevice silently reports the root partition to be the boot device. This makes the sysupgrade process fail at several places. Fix this by clearly distinguishing between /proc/cmdline arguments which specify the boot disk, and those which specify the root partition. Only in the latter case, strip off the partition, and do it consistently. root=PARTUUID=<pseudo PARTUUID for MBR> (any partition) and root=/dev/* (any partition) are accepted. The root of the problem is that the *existing* export_bootdevice in /lib/upgrade/common.sh behaves differently, if the kernel is booted with root=/dev/..., or if it is booted with root=PARTUUID=... In the former case, it reports back major/minor of the root partition, in the latter case it reports back major/minor of the complete boot disk. Targets, which boot with root=/dev/... *and* use export_bootdevice / export_partdevice, have added workarounds to this behaviour, by specifying *negative* increments to the export_partdevice function. Consequently, those targets have to be adapted to use positive increments, otherwise they are broken by the change to export_bootdevice. Fixes: 4e8345ff68 ("mvebu: base-files: autodetect upgrade device") Signed-off-by: Klaus Kudielka <klaus.kudielka@gmail.com> Tested-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
Diffstat (limited to 'target/linux/sunxi')
-rw-r--r--target/linux/sunxi/base-files/lib/preinit/79_move_config2
-rw-r--r--target/linux/sunxi/base-files/lib/upgrade/platform.sh7
2 files changed, 4 insertions, 5 deletions
diff --git a/target/linux/sunxi/base-files/lib/preinit/79_move_config b/target/linux/sunxi/base-files/lib/preinit/79_move_config
index c112588689..83171b3ba9 100644
--- a/target/linux/sunxi/base-files/lib/preinit/79_move_config
+++ b/target/linux/sunxi/base-files/lib/preinit/79_move_config
@@ -6,7 +6,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 -t vfat -o rw,noatime "/dev/$partdev" /mnt; then
if [ -f /mnt/sysupgrade.tgz ]; then
mv -f /mnt/sysupgrade.tgz /
diff --git a/target/linux/sunxi/base-files/lib/upgrade/platform.sh b/target/linux/sunxi/base-files/lib/upgrade/platform.sh
index 88ef4790e9..abe910b154 100644
--- a/target/linux/sunxi/base-files/lib/upgrade/platform.sh
+++ b/target/linux/sunxi/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,7 +28,7 @@ platform_check_image() {
platform_copy_config() {
local partdev
- if export_partdevice partdev -1; then
+ if export_partdevice partdev 1; then
mount -t vfat -o rw,noatime "/dev/$partdev" /mnt
cp -af "$CONF_TAR" /mnt/
umount /mnt
@@ -38,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
}
@@ -74,7 +74,6 @@ platform_do_upgrade() {
get_image "$@" | dd of="$diskdev" bs=1024 skip=8 seek=8 count=1016 conv=fsync
#iterate over each partition from the image and write it to the boot disk
while read part start size; do
- 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