aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-07-22 19:27:48 +0200
committerSven Gothel <[email protected]>2021-07-22 19:27:48 +0200
commit1da3d26c5b6033c60a5292bc7753126c991cacc1 (patch)
tree9cdecbdc8248a38a2aee4a0ab73c591f6ac70f55
parent3109247b830f11a214dad8fcec5c0a50cc7f5525 (diff)
make_bootable_image: Mutable images require UUID in fstab and kernel cmdline for raspi
Hence also fix BOOT_FSTYPE on fstab for mutable images (remount ro -> rw).
-rw-r--r--scripts/qcow2_handling31
-rwxr-xr-xstage2/01-sys-tweaks/01-run.sh4
-rw-r--r--stage2/01-sys-tweaks/files/fstab-rootfs_rw3
3 files changed, 23 insertions, 15 deletions
diff --git a/scripts/qcow2_handling b/scripts/qcow2_handling
index 770d074..e996e8f 100644
--- a/scripts/qcow2_handling
+++ b/scripts/qcow2_handling
@@ -394,7 +394,21 @@ function make_bootable_image() {
exit 1
fi
- if false ; then
+ if [ "${ROOTFS_RO}" = "1" ] ; then
+ echo "Setup hard devicenames"
+ BOOT_DEV_NAME="\/dev\/mmcblk0p1"
+ echo "Boot: $BOOT_DEV_NAME"
+ ROOT_DEV_NAME="\/dev\/mmcblk0p2"
+ echo "Root1: $ROOT_DEV_NAME"
+
+ echo "Set hard device names in fstab (rootfs ro -> /boot uncommented)"
+ sed -i "s/BOOTDEV/${BOOT_DEV_NAME}/" "${MOUNTROOT}/etc/fstab"
+ sed -i "s/ROOTDEV/${ROOT_DEV_NAME}/" "${MOUNTROOT}/etc/fstab"
+ if [ "${TARGET_RASPI}" = "1" ]; then
+ echo "Set rootfs ro hard device name in cmdline, required"
+ sed -i "s/ROOTDEV/${ROOT_DEV_NAME}/" "${MOUNTROOT}/boot/sys_${TARGET_ARCH}_000/cmdline.txt"
+ fi
+ else
echo "Setup PARTUUIDs"
BOOT_PARTUUID="${IMGID}-01"
echo "Boot: $BOOT_PARTUUID"
@@ -402,26 +416,13 @@ function make_bootable_image() {
echo "Root1: $ROOT_PARTUUID"
if [ ! -z "$BOOT_PARTUUID" ] && [ ! -z "$ROOT_PARTUUID" ]; then
- echo "Set UUIDs to make it bootable"
+ echo "Set UUIDs to make it bootable, required."
sed -i "s/BOOTDEV/PARTUUID=${BOOT_PARTUUID}/" "${MOUNTROOT}/etc/fstab"
sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${MOUNTROOT}/etc/fstab"
if [ "${TARGET_RASPI}" = "1" ]; then
sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${MOUNTROOT}/boot/sys_${TARGET_ARCH}_000/cmdline.txt"
fi
fi
- else
- echo "Setup hard devicenames"
- BOOT_DEV_NAME="\/dev\/mmcblk0p1"
- echo "Boot: $BOOT_DEV_NAME"
- ROOT_DEV_NAME="\/dev\/mmcblk0p2"
- echo "Root1: $ROOT_DEV_NAME"
-
- echo "Set hard device names to make it bootable"
- sed -i "s/BOOTDEV/${BOOT_DEV_NAME}/" "${MOUNTROOT}/etc/fstab"
- sed -i "s/ROOTDEV/${ROOT_DEV_NAME}/" "${MOUNTROOT}/etc/fstab"
- if [ "${TARGET_RASPI}" = "1" ]; then
- sed -i "s/ROOTDEV/${ROOT_DEV_NAME}/" "${MOUNTROOT}/boot/sys_${TARGET_ARCH}_000/cmdline.txt"
- fi
fi
echo "Umount image ${EXPORT_IMAGE}"
diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh
index 7caf1e7..5749f8e 100755
--- a/stage2/01-sys-tweaks/01-run.sh
+++ b/stage2/01-sys-tweaks/01-run.sh
@@ -2,6 +2,8 @@
if [ "${ROOTFS_RO}" = "1" ] ; then
install -v -m 644 files/fstab-rootfs_ro "${ROOTFS_DIR}/etc/fstab"
+else
+ install -v -m 644 files/fstab-rootfs_rw "${ROOTFS_DIR}/etc/fstab"
fi
install -m 644 files/overlay_mount.service "${ROOTFS_DIR}/lib/systemd/system/"
install -m 755 files/overlay_mount "${ROOTFS_DIR}/etc/init.d/"
@@ -54,6 +56,8 @@ on_chroot << EOF
# without having a live mapping in /etc/fstab.
systemctl disable systemd-remount-fs
systemctl mask systemd-remount-fs
+ else
+ sed -i "s/vfat/${BOOT_FSTYPE}/g" /etc/fstab
fi
systemctl disable rsync
diff --git a/stage2/01-sys-tweaks/files/fstab-rootfs_rw b/stage2/01-sys-tweaks/files/fstab-rootfs_rw
new file mode 100644
index 0000000..5a4df6b
--- /dev/null
+++ b/stage2/01-sys-tweaks/files/fstab-rootfs_rw
@@ -0,0 +1,3 @@
+proc /proc proc defaults 0 0
+BOOTDEV /boot vfat defaults 0 2
+ROOTDEV / ext4 defaults,noatime,errors=remount-ro 0 0