From 157bdd49bbc5c1d1d9b46567f041158fe303ec0a Mon Sep 17 00:00:00 2001 From: Mitchell R Date: Thu, 21 May 2026 15:10:22 +0200 Subject: [PATCH] fix(repartition): label rootfs ext4 + bootfs FAT before dd into image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- deploy/rauc/repartition-image.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deploy/rauc/repartition-image.sh b/deploy/rauc/repartition-image.sh index 545a5f2..2fe631d 100755 --- a/deploy/rauc/repartition-image.sh +++ b/deploy/rauc/repartition-image.sh @@ -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