open-power / petitboot

GNU General Public License v2.0
205 stars 56 forks source link

BootLoader Spec Support #83

Open hanetzer opened 3 years ago

hanetzer commented 3 years ago

https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/

Just an idea. Basically this, and you can have multiple files.

# /boot/loader/entries/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf
title      Fedora 19 (Rawhide)
version    3.8.0-2.fc19.x86_64
machine-id 6a9857a393724b7a981ebb5b8495b9ea
options    root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2
linux      /6a9857a393724b7a981ebb5b8495b9ea/3.8.0-2.fc19.x86_64/linux
initrd     /6a9857a393724b7a981ebb5b8495b9ea/3.8.0-2.fc19.x86_64/initrd
klauskiwi commented 3 years ago

Looks like it's very very close to our 'native' configuration in Petitboot:

name Fedora 19 (Rawhide)
image /6a9857a393724b7a981ebb5b8495b9ea/3.8.0-2.fc19.x86_64/linux
args root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2
initrd /6a9857a393724b7a981ebb5b8495b9ea/3.8.0-2.fc19.x86_64/initrd

We don't have machine-id or version - but apparently we're not required to do anything special about them as well, so we might as well ignore them for a first version of this feature.

So looks like we could simply duplicate the native parser and call it 'freedesktop' or something similar, changing name for title and args for options and making sure we can ignore machine-id and version for now.

Do you want to take a stab at providing patches for this?

hanetzer commented 3 years ago

Well, its not just one file, more of a drop in dir. You can have, for example:

/boot/efi/loader/entries/aeeef620aa484bb490a0638814a92548-0-rescue.conf
/boot/efi/loader/entries/aeeef620aa484bb490a0638814a92548-5.10.14-200.fc33.x86_64.conf
/boot/efi/loader/entries/aeeef620aa484bb490a0638814a92548-5.10.15-200.fc33.x86_64.conf
/boot/efi/loader/entries/aeeef620aa484bb490a0638814a92548-5.10.16-200.fc33.x86_64.conf

All on one machine. I could give it a go, sure. I'm not familiar with bison/etc but it can't be that hard.

sammj commented 3 years ago

There is already some initial support for BootloaderSpec files in https://github.com/open-power/petitboot/blob/master/discover/grub2/blscfg.c, although the intent is mainly being referenced by GRUB. That could be a good start to make the support more generic.