fix(repartition): label rootfs ext4 + bootfs FAT before dd into image

Kernel dropped to initramfs because root=LABEL=BF_ROOT_A in cmdline.txt
but the ext4 filesystem had no label set (pi-gen's default is unlabeled).
dd copies raw bytes — any label must be set on the standalone file BEFORE
writing into the output image.

Add e2label BF_ROOT_A on rootfs.ext4 + fatlabel BF_BOOT_A / BF_BOOT_B
on each bootfs copy after patching cmdline.txt but before dd.
This commit is contained in:
Mitchell R 2026-05-21 15:10:22 +02:00
parent 78538cef9c
commit 157bdd49bb
No known key found for this signature in database

View file

@ -80,6 +80,11 @@ printf '%s\n' "${BF_RAUC_COMPATIBILITY:-betterframe-rpi5-aarch64}" > "$WORK/mnt-
umount "$WORK/mnt-root"
losetup -d "$ROOTFS_LOOP"
# Set ext4 filesystem label BEFORE dd into the output image. cmdline.txt
# uses root=LABEL=BF_ROOT_A so the kernel needs this label to find root.
echo "==> Labeling rootfs.ext4 as BF_ROOT_A"
e2label "$WORK/rootfs.ext4" BF_ROOT_A
# Build two bootfs copies with slot-specific cmdline.txt root=LABEL=...
echo "==> Building BF_BOOT_A + BF_BOOT_B bootfs copies"
cp "$WORK/bootfs.vfat" "$WORK/bootfs_A.vfat"
@ -89,6 +94,7 @@ mount "$BOOT_A_LOOP" "$WORK/mnt-ba"
sed -i 's|root=PARTUUID=[^ ]*|root=LABEL=BF_ROOT_A|' "$WORK/mnt-ba/cmdline.txt" 2>/dev/null || true
umount "$WORK/mnt-ba"
losetup -d "$BOOT_A_LOOP"
fatlabel "$WORK/bootfs_A.vfat" BF_BOOT_A
cp "$WORK/bootfs.vfat" "$WORK/bootfs_B.vfat"
BOOT_B_LOOP="$(losetup -f --show "$WORK/bootfs_B.vfat")"
@ -97,6 +103,7 @@ mount "$BOOT_B_LOOP" "$WORK/mnt-bb"
sed -i 's|root=PARTUUID=[^ ]*|root=LABEL=BF_ROOT_B|' "$WORK/mnt-bb/cmdline.txt" 2>/dev/null || true
umount "$WORK/mnt-bb"
losetup -d "$BOOT_B_LOOP"
fatlabel "$WORK/bootfs_B.vfat" BF_BOOT_B
# Layout the new A/B image. GPT, 6 partitions.
SELECTOR_MB=8