commit 2e99acb2e6f0ab8867b8e6b5879923f556faf9db
parent 90b1f2153676761a907a12fd904ba608d77a7508
Author: torter <koubbamohamedrayan@gmail.com>
Date: Sun, 29 Nov 2026 13:08:56 +0000
disk: a dos label on BIOS, so a whole-disk install needs no BIOS boot partition
Diffstat:
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/tools/chamesle-disk b/tools/chamesle-disk
@@ -1,8 +1,8 @@
#!/bin/sh
# chamesle-disk [-t ext4|btrfs|zfs] [-y] DISK: erases a disk and sets it up for Chamesle. the boot partition becomes vfat,
# the root partition ext4, btrfs (subvolumes @ and @home) or a ZFS pool (the default), all mounted under /mnt with a
-# fstab written. you lay out the partitions in cfdisk; -y skips the questions and takes the whole disk:
-# a BIOS boot partition, 512M for /boot and the rest for the root.
+# fstab written. you lay out the partitions in cfdisk; -y skips the questions and takes the whole disk: a gpt label on
+# UEFI (BIOS boot, 512M EFI /boot, the rest root), a dos label on BIOS (bootable 512M /boot, the rest root, no BIOS boot part).
# chamesle-disk /dev/nvme0n1
# chamesle-disk -t btrfs -y /dev/sda
die() { echo "chamesle-disk: $*" >&2; exit 1; }
@@ -37,15 +37,26 @@ part() { case $disk in *[0-9]) echo "${disk}p$1";; *) echo "$disk$1";; esac; }
if [ -n "$yes" ]; then
wipefs -aq "$disk"
- sfdisk -q "$disk" <<P || die "sfdisk failed"
+ if [ -d /sys/firmware/efi ]; then
+ # UEFI: gpt with a BIOS boot partition (so it boots by BIOS too), the EFI system partition and the root
+ sfdisk -q "$disk" <<P || die "sfdisk failed"
label: gpt
size=1M, type=21686148-6449-6E6F-744E-656564454649
size=512M, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B
type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
P
+ boot=$(part 2) root=$(part 3)
+ else
+ # BIOS: a dos label wants no BIOS boot partition and limine goes straight on the MBR
+ sfdisk -q "$disk" <<P || die "sfdisk failed"
+label: dos
+size=512M, type=c, bootable
+type=83
+P
+ boot=$(part 1) root=$(part 2)
+ fi
command -v udevadm >/dev/null && udevadm settle
sleep 1
- boot=$(part 2) root=$(part 3)
[ -b "$boot" ] && [ -b "$root" ] || die "the new partitions $boot and $root are not there"
else
lsblk "$disk"