BuildSystem: Make root partition UUID fixed

This allows specifying root as UUID which makes booting nicer experience
on real hardware
This commit is contained in:
Bananymous 2024-11-21 17:59:38 +02:00
parent 8054f6c618
commit 96a5ba0ed3
5 changed files with 25 additions and 14 deletions

View File

@ -33,3 +33,5 @@ if [[ -z $BANAN_BOOTLOADER ]]; then
fi
export BANAN_CMAKE=$BANAN_TOOLCHAIN_PREFIX/bin/cmake
export BANAN_ROOT_PART_UUID='9C87D2AF-566A-4517-971A-57BA86EEA88D'

View File

@ -46,6 +46,15 @@ else
mkpart root ext2 2M 100%
fi
fdisk "$BANAN_DISK_IMAGE_PATH" >/dev/null << EOF
x
u
2
$BANAN_ROOT_PART_UUID
r
w
EOF
# create loop device
LOOP_DEV=$(sudo losetup --show -fP "$BANAN_DISK_IMAGE_PATH" || exit 1 )
PARTITION1=${LOOP_DEV}p1

View File

@ -44,7 +44,7 @@ install_grub_legacy() {
--boot-directory="$MOUNT_DIR/boot" \
$LOOP_DEV
sudo mkdir -p "$MOUNT_DIR/boot/grub"
sudo cp "$BANAN_TOOLCHAIN_DIR/grub-legacy-boot.cfg" "$MOUNT_DIR/boot/grub/grub.cfg"
sed "s/<ROOT>/UUID=$BANAN_ROOT_PART_UUID/" "$BANAN_TOOLCHAIN_DIR/grub-legacy-boot.cfg" | sudo tee "$MOUNT_DIR/boot/grub/grub.cfg" >/dev/null
sudo umount "$MOUNT_DIR"
}
@ -57,7 +57,7 @@ install_grub_uefi() {
sudo mount $PARTITION2 "$MOUNT_DIR"
sudo mkdir -p "$MOUNT_DIR/boot/grub"
sudo cp "$BANAN_TOOLCHAIN_DIR/grub-uefi.cfg" "$MOUNT_DIR/boot/grub/grub.cfg"
sed "s/<ROOT>/UUID=$BANAN_ROOT_PART_UUID/" "$BANAN_TOOLCHAIN_DIR/grub-uefi.cfg" | sudo tee "$MOUNT_DIR/boot/grub/grub.cfg" >/dev/null
sudo umount "$MOUNT_DIR"
}

View File

@ -1,23 +1,23 @@
menuentry "banan-os" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2
multiboot2 /boot/banan-os.kernel root=<ROOT>
}
menuentry "banan-os (no serial)" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2 noserial
multiboot2 /boot/banan-os.kernel root=<ROOT> noserial
}
menuentry "banan-os (only serial)" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2 console=ttyS0
multiboot2 /boot/banan-os.kernel root=<ROOT> console=ttyS0
}
menuentry "banan-os (no apic)" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2 noapic
multiboot2 /boot/banan-os.kernel root=<ROOT> noapic
}
menuentry "banan-os (no apic, no serial)" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2 noapic noserial
multiboot2 /boot/banan-os.kernel root=<ROOT> noapic noserial
}
menuentry "banan-os (no apic, only serial)" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2 noapic console=ttyS0
multiboot2 /boot/banan-os.kernel root=<ROOT> noapic console=ttyS0
}

View File

@ -4,25 +4,25 @@ set root=(hd0,gpt2)
insmod all_video
menuentry "banan-os" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2
multiboot2 /boot/banan-os.kernel root=<ROOT>
}
menuentry "banan-os (no serial)" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2 noserial
multiboot2 /boot/banan-os.kernel root=<ROOT> noserial
}
menuentry "banan-os (only serial)" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2 console=ttyS0
multiboot2 /boot/banan-os.kernel root=<ROOT> console=ttyS0
}
menuentry "banan-os (no apic)" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2 noapic
multiboot2 /boot/banan-os.kernel root=<ROOT> noapic
}
menuentry "banan-os (no apic, no serial)" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2 noapic noserial
multiboot2 /boot/banan-os.kernel root=<ROOT> noapic noserial
}
menuentry "banan-os (no apic, only serial)" {
multiboot2 /boot/banan-os.kernel root=/dev/sda2 noapic console=ttyS0
multiboot2 /boot/banan-os.kernel root=<ROOT> noapic console=ttyS0
}