mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-26 19:06:34 +00:00
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:
parent
78538cef9c
commit
157bdd49bb
1 changed files with 7 additions and 0 deletions
|
|
@ -80,6 +80,11 @@ printf '%s\n' "${BF_RAUC_COMPATIBILITY:-betterframe-rpi5-aarch64}" > "$WORK/mnt-
|
||||||
umount "$WORK/mnt-root"
|
umount "$WORK/mnt-root"
|
||||||
losetup -d "$ROOTFS_LOOP"
|
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=...
|
# Build two bootfs copies with slot-specific cmdline.txt root=LABEL=...
|
||||||
echo "==> Building BF_BOOT_A + BF_BOOT_B bootfs copies"
|
echo "==> Building BF_BOOT_A + BF_BOOT_B bootfs copies"
|
||||||
cp "$WORK/bootfs.vfat" "$WORK/bootfs_A.vfat"
|
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
|
sed -i 's|root=PARTUUID=[^ ]*|root=LABEL=BF_ROOT_A|' "$WORK/mnt-ba/cmdline.txt" 2>/dev/null || true
|
||||||
umount "$WORK/mnt-ba"
|
umount "$WORK/mnt-ba"
|
||||||
losetup -d "$BOOT_A_LOOP"
|
losetup -d "$BOOT_A_LOOP"
|
||||||
|
fatlabel "$WORK/bootfs_A.vfat" BF_BOOT_A
|
||||||
|
|
||||||
cp "$WORK/bootfs.vfat" "$WORK/bootfs_B.vfat"
|
cp "$WORK/bootfs.vfat" "$WORK/bootfs_B.vfat"
|
||||||
BOOT_B_LOOP="$(losetup -f --show "$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
|
sed -i 's|root=PARTUUID=[^ ]*|root=LABEL=BF_ROOT_B|' "$WORK/mnt-bb/cmdline.txt" 2>/dev/null || true
|
||||||
umount "$WORK/mnt-bb"
|
umount "$WORK/mnt-bb"
|
||||||
losetup -d "$BOOT_B_LOOP"
|
losetup -d "$BOOT_B_LOOP"
|
||||||
|
fatlabel "$WORK/bootfs_B.vfat" BF_BOOT_B
|
||||||
|
|
||||||
# Layout the new A/B image. GPT, 6 partitions.
|
# Layout the new A/B image. GPT, 6 partitions.
|
||||||
SELECTOR_MB=8
|
SELECTOR_MB=8
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue