Skip to content

Commit

Permalink
base-files: upgrade: add case to export_bootdevice
Browse files Browse the repository at this point in the history
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.

Fixes commit 2e5a0b8 ("mvebu: sysupgrade: sdcard: keep user added ...")

Signed-off-by: Klaus Kudielka <klaus.kudielka@gmail.com>
  • Loading branch information
kkudielka authored and ynezz committed Oct 9, 2019
1 parent e0ce80d commit 3a4f587
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion package/base-files/files/lib/upgrade/common.sh
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3a4f587

Please sign in to comment.