buildkernel icon indicating copy to clipboard operation
buildkernel copied to clipboard

Support MBR disks as boot devices

Open reanimus opened this issue 7 years ago • 4 comments

As it stands, the configuration for buildkernel is completely oriented toward devices that use GPT disks. This is fine (mostly), but it's caused issues for me as I use a USB key as a boot device, but also wish to use it as a data drive. Unfortunately, Windows doesn't seem to support GPT USB disks with EFI system partitions on them (as it seems to cause some weird funkiness where it tries to treat it as a single-partition disk but chooses the ESP as the partition it shows). As such, I can't use a disk with a proper EFI system partition and a separate data partition.

My solution to this is to initialize the disk as an MBR disk, create a FAT32 partition on it, and simply place the EFI directory/files/keyfile on it. It's not perfect (there's no separate partition where the boot stuff is stored separately), but it works enough for me to use the drive as both a boot key and a data drive. My EFI seems to accept these disks (and I've found most EFI implementations are fairly forgiving of MBR boot disks)

However, in order to do this with buildkernel, I've gone in and implemented a kludge. Since MBR disks have no partition UUID, you can't provide one for buildkernel to use. As a workaround, I changed PARTUUIDDEVDIR to point to /dev/disk/by-uuid/ rather than /dev/disk/by-partuuid. This uses the filesystem UUID, which both the LUKS partition and the boot key have. I also disable the lowercase fixing for the boot partition, as FAT32 UUIDs are uppercase.

Would it be possible to have more formal support for filesystem UUIDs? This kludge is a bit of an annoyance to go in and add and I also feel it would be useful for others in a similar situation.

reanimus avatar Jan 22 '17 02:01 reanimus