Subject: Re: [bug#27529] [PATCH] bootloader: Use <menu-entry> for the bootloader side.

From: Danny Milosavljevic <[email-masked]>
Date: Sun, 2 Jul 2017 20:26:56 +0200

Hi Ludo,

On Sun, 02 Jul 2017 16:59:55 +0200
[email-masked] (Ludovic Courtès) wrote:

> Danny Milosavljevic <[email-masked]> skribis:
> 
> > * gnu/bootloader.scm (menu-entry-device-mount-point): New variable.  Export it.
> > (<menu-entry>: New field "device".
> > * gnu/bootloader/grub.scm (grub-confgiuration-file): Handle <menu-entry>
> > entries.
> > * gnu/bootloader/extlinux.scm (extlinux-configuration-file): Handle
> > <menu-entry> entries.
> > * gnu/system.scm (menu->entry->boot-parameters): Delete variable.
> > (boot-parameters->menu-entry): New variable.  Export it.
> > (operating-system-bootcfg): Make OLD-ENTRIES a list of <menu-entry>.
> > * guix/script/system.scm (reinstall-bootloader):  Fix bootcfg usage.
> > ---
> >  gnu/bootloader.scm          |  3 +++
> >  gnu/bootloader/extlinux.scm | 19 +++++++++----------
> >  gnu/bootloader/grub.scm     | 27 ++++++++++++---------------
> >  gnu/system.scm              | 29 ++++++++++++++---------------
> >  guix/scripts/system.scm     | 10 +++++-----
> >  5 files changed, 43 insertions(+), 45 deletions(-)  
> 
> Could you explain the rationale?
> 
> IIRC there was the idea that implementations of the bootloader API
> should use <boot-parameters>, and that <menu-entry> would be used only
> in the user-facing APIs (it had even disappeared with the initial
> thing.)

Yeah, it's preparation for chainloading support (non-Linux OSes etc).  I don't feel strongly one way or another but I think those chainloading entries would actually be menu entries and not really boot-parameters as in Guix-can-use-them-for-anything.

What this does is use boot-parameters for stuff which Guix needs for itself, and menu entries (which could be a poem by Goethe as much as Guix cares) for the rest.  *Some* boot-parameters will end up as menu entries, but not all (for example think of chainloading: There would only be a menu-entry for chainloading, but both a boot-parameter and a (generated) menu-entry for the Guix Linux kernel).

There would be no way to get from a <menu-entry> to a <boot-parameter> because it could as well make no sense to do that.

In short, the bootloader would always and only get menu-entries, but the remainder of Guix would only use them as support under wobbly chairs or something :)

On the other hand, boot-parameters are things which Guix needs and manages.

If we want that (or want it again - it was that way before), this patch would be a way to do it.  If not, I'm fine with it as well.  It just bothered me a bit even when the (otherwise great) multi bootloader support went in that it used boot-parameters as some kind of menu-entry substitute.  In the beginning, <menu-entry> was grub-private, so that was the only way to get the multi bootloader support to work.  But now the <menu-entry> is public.  Then why not use it for what it is?