move /boot to container partition

master
BodgeMaster 2023-06-28 22:59:09 +02:00
parent b95b8ce634
commit ce69477581
3 changed files with 14 additions and 25 deletions

View File

@ -93,7 +93,6 @@ fi
# new GPT
# 2M BIOS GRUB
# 268M ESP
# 1G boot
# everything else one big partition
echo "g
n
@ -107,10 +106,6 @@ n
n
+1G
n
t
1
@ -120,18 +115,13 @@ t
1
t
3
136
t
4
20
w" | fdisk --wipe always --wipe-partitions always "/dev/$TARGET_DISK"
TARGET_PART_BIOS="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '2p')"
TARGET_PART_EFI="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '3p')"
TARGET_PART_BOOT="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '4p')"
TARGET_PART_BIG="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '5p')"
TARGET_PART_BIG="$(lsblk --raw --noheadings --output PATH "/dev/$TARGET_DISK" | sed -n '4p')"
mkfs.vfat -F32 -n "EFIBOOT" "$TARGET_PART_EFI"
mkfs.f2fs -f -l "boot" "$TARGET_PART_BOOT"
mkfs.f2fs -f -l "container" "$TARGET_PART_BIG"
mkdir -p /mnt/target
@ -148,12 +138,13 @@ mkdir /mnt/target/dev
mount --rbind /dev /mnt/target/dev
# actual storage
mkdir /mnt/target/boot
mount "$TARGET_PART_BOOT" /mnt/target/boot
mkdir /mnt/target/boot/efi
mount "$TARGET_PART_EFI" /mnt/target/boot/efi
mkdir -p /mnt/target/run/void-usb/container
mount "$TARGET_PART_BIG" /mnt/target/run/void-usb/container
mkdir /mnt/target/boot
mkdir /mnt/target/run/void-usb/container/boot
mount --bind /mnt/target/run/void-usb/container/boot /mnt/target/boot
mkdir /mnt/target/boot/efi
mount "$TARGET_PART_EFI" /mnt/target/boot/efi
mkdir /mnt/target/home
mkdir /mnt/target/run/void-usb/container/home
mount --bind /mnt/target/run/void-usb/container/home /mnt/target/home
@ -199,8 +190,6 @@ echo "%wheel ALL=(ALL:ALL) ALL" > /mnt/target/etc/sudoers.d/wheel_as_sudo_group.
mkdir -p /mnt/target/opt/void-usb
chmod 755 /mnt/target/opt/void-usb
echo "UUID=$(blkid --output value --match-tag UUID $TARGET_PART_BIG)" > /mnt/target/opt/void-usb/container
echo '# Void USB dracut configuration
hostonly="no"
@ -230,8 +219,8 @@ echo "# See fstab(5).
# /run/void-usb/container, /run/void-usb/overlay, and / are mounted by scripts in initramfs
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_BOOT) /boot f2fs defaults,nodev,nosuid 0 2
UUID=$(blkid --output value --match-tag UUID $TARGET_PART_EFI) /boot/efi vfat defaults,fmask=0077,dmask=0077 0 2
/run/void-usb/container/boot /boot none bind 0 0
/run/void-usb/container/home /home none bind 0 0
tmpfs /tmp tmpfs size=512m 0 0
" > /mnt/target/etc/fstab

View File

@ -9,7 +9,6 @@ do not rely on the RTC
- use ntp to get time
- only fall back to using rtc if offline
- do not set the RTC
move /boot to /run/void-usb/container instead of its own partition
show user-friendly status instead of scrolling output from all sorts of tools
shutdown squashfs updater cant get user input!?
make our own or extract (if feasible) kb selection and time zone selection to hijack them for our purposes

View File

@ -4,7 +4,8 @@ OS_NAME="Void Linux USB"
GRUB_PREFIX="/boot/efi/LOADER/grub"
CFG_CUSTOM_BEFORE="custom_before.cfg"
CFG_CUSTOM_AFTER="custom_after.cfg"
LINUX_CMDLINE="root=/dev/loop0 ro void-usb-container=$(cat /opt/void-usb/container)"
CONTAINER_UUID="$(blkid --output value --match-tag UUID "$(grep " /run/void-usb/container " /proc/mounts | sed -e 's/ .*//')")"
LINUX_CMDLINE="root=/dev/loop0 ro void-usb-container=$CONTAINER_UUID"
DEFAULT_LINUX=/boot/vmlinu?
if [ ! -f "$DEFAULT_LINUX" ]; then
@ -48,9 +49,9 @@ function make_menuentry {
echo "
menuentry 'Linux $LINUX_VERSION' {
echo 'Loading $LINUX...'
linux /$LINUX $LINUX_CMDLINE
linux /boot/$LINUX $LINUX_CMDLINE
echo 'Loading initial ramdisk...'
initrd /$INITRAMFS
initrd /boot/$INITRAMFS
}" >> "$GRUB_PREFIX/grub.cfg"
}
@ -64,7 +65,7 @@ echo "# This file is auto-generated by $0.
# $GRUB_PREFIX/$CFG_CUSTOM_BEFORE or
# $GRUB_PREFIX/$CFG_CUSTOM_AFTER
search --fs-uuid --set=root $(blkid --output value --match-tag UUID "$(grep " /boot " /proc/mounts | sed -e 's/ .*//')")
search --fs-uuid --set=root $CONTAINER_UUID
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
@ -79,9 +80,9 @@ fi
menuentry '$OS_NAME' {
echo 'Loading Linux...'
linux /$DEFAULT_LINUX $LINUX_CMDLINE
linux /boot/$DEFAULT_LINUX $LINUX_CMDLINE
echo 'Loading initial ramdisk...'
initrd /$DEFAULT_INITRAMFS
initrd /boot/$DEFAULT_INITRAMFS
}
submenu 'Choose kernel version...' {" > "$GRUB_PREFIX/grub.cfg"