uvol: pad the MBR disk signature when matching root=

get_bootdev() identifies the boot disk for a root=PARTUUID=xxxxxxxx-NN
command line by reading the four-byte signature at offset 440 of each
block device, but renders it with %x per byte, so a byte below 0x10 comes
out as a single digit and the string is too short to ever match. A disk
whose signature is cf0a3161 yields "cfa3161", get_bootdev() returns null,
and every backend's init fails: uvol then reports no backend at all and
no volume can be created on a perfectly good volume group.

Pad each byte to two digits, as the GPT branch of the same function
already does.

Fixes: 6350c7bc63 ("uvol: replace with re-write in ucode")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle committed 2026-09-28 23:46:00 +01:00
1 parent 8f9ad5085e
commit 75438c8934
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=uvol
PKG_VERSION:=1.2
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
PKG_LICENSE:=GPL-2.0-or-later
+1 -1
View File
@@ -95,7 +95,7 @@ let get_bootdev = function(void) {
bdf.seek(440);
let bduuid = bdf.read(4);
bdf.close();
if (uuidarg == sprintf("%x%x%x%x", ord(bduuid, 3), ord(bduuid, 2), ord(bduuid, 1), ord(bduuid, 0))) {
if (uuidarg == sprintf("%02x%02x%02x%02x", ord(bduuid, 3), ord(bduuid, 2), ord(bduuid, 1), ord(bduuid, 0))) {
uevent = sprintf("/sys/class/block/%s/uevent", bd);
break;
}