diff options
author | Klaus Kudielka <klaus.kudielka@gmail.com> | 2019-08-17 15:52:01 +0200 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2020-01-05 16:41:35 +0100 |
commit | 3140d380422e3b6416b5dbdc951f90b006a4eaac (patch) | |
tree | e6763ba02d10d05741a951bee69edfabc62e37ea /package/base-files/files | |
parent | 3c110320398b0a19566b36f83643f33b40d4b5eb (diff) | |
download | upstream-3140d380422e3b6416b5dbdc951f90b006a4eaac.tar.gz upstream-3140d380422e3b6416b5dbdc951f90b006a4eaac.tar.bz2 upstream-3140d380422e3b6416b5dbdc951f90b006a4eaac.zip |
base-files: upgrade: add case to export_bootdevice
The factory uboot of the Turris Omnia boots with "root=b301", and we
instruct new users to sysupgrade from there (e.g. method 1, step 7).
Currently, this will fail with "Unable to determine upgrade device".
Add a new case to export_bootdevice, which parses the hex argument.
Ref: https://github.com/openwrt/openwrt/pull/2340#issuecomment-561317688
Fixes: 2e5a0b81ec29 ("mvebu: sysupgrade: sdcard: keep user added partitons")
Reviewed-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Klaus Kudielka <klaus.kudielka@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
(cherry picked from commit 3a4f587c465a0531b820ca1a3e90eb05c4927b68)
Diffstat (limited to 'package/base-files/files')
-rw-r--r-- | package/base-files/files/lib/upgrade/common.sh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 0d3162d4fc..a986cc0b5c 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -103,7 +103,7 @@ get_magic_long() { } export_bootdevice() { - local cmdline bootdisk rootpart uuid blockdev uevent line + local cmdline bootdisk rootpart uuid blockdev uevent line class local MAJOR MINOR DEVNAME DEVTYPE if read cmdline < /proc/cmdline; then @@ -139,6 +139,18 @@ export_bootdevice() { /dev/*) uevent="/sys/class/block/${rootpart##*/}/../uevent" ;; + 0x[a-f0-9][a-f0-9][a-f0-9] | 0x[a-f0-9][a-f0-9][a-f0-9][a-f0-9] | \ + [a-f0-9][a-f0-9][a-f0-9] | [a-f0-9][a-f0-9][a-f0-9][a-f0-9]) + rootpart=0x${rootpart#0x} + for class in /sys/class/block/*; do + while read line; do + export -n "$line" + done < "$class/uevent" + if [ $((rootpart/256)) = $MAJOR -a $((rootpart%256)) = $MINOR ]; then + uevent="$class/../uevent" + fi + done + ;; esac if [ -e "$uevent" ]; then |