Danny Milosavljevic <dan...@scratchpost.org> skribis: > so far I came up with the patch to Guix below for the actual bootloader > selection.
Nice! > Some places are still broken. Search for "FIXME" below. > > For example I need a way to find out what the bootloader config file is > supposed to be called in the new routine 'install-bootloader . It will get > (derivation->output-path bootloader-configuration-file) as argument. Given > it, can I still find out whether the filename is "grub.cfg" or > "extlinux.conf"? Is that safe enough? [...] > +(define* (install-u-boot extlinux.conf device mount-point) > + "Install U-Boot with EXTLINUX.CONF on DEVICE, which is assumed to be > mounted on > +MOUNT-POINT. FIXME is that correct?" > + (install-bootloader-config extlinux.conf > + (string-append mount-point > + "/extlinux.conf")) > + (unless (zero? (system* "u-boot-install" > + (string-append "--boot-directory=" mount-point) > + device)) > + (error "failed to install U-Boot"))) Really, installing U-Boot is as simple as this? If it is, that’s perfect. :-) > -(define* (operating-system-grub.cfg os #:optional (old-entries '())) > - "Return the GRUB configuration file for OS. Use OLD-ENTRIES to populate > the > +(define (bootloader-configuration-device bootloader-configuration) > + (match bootloader-configuration > + (($ <grub-configuration> config) > + (grub-configuration-device config)) > + (($ <u-boot-configuration> config) > + (u-boot-configuration-device config)))) Very good, this is where the bootloader selection should occur. It seems to me that it’s enough to find out whether to call ‘install-grub’ or ‘install-u-boot’, no? I would write it as: (match bootloader-configuration ((? grub-configuration? config) (grub-configuration-device config)) ((? u-boot-configuration? config) (u-boot-configuration-device config))) which does the same thing but allows us to avoid exporting <grub-configuration> and <u-boot-configuration> (better to keep them private so that external code doesn’t rely on the structure layout.) I see three separate things here: 1. Replacing “grub” by “bootloader” in the API (cosmetic change); 2. Adding the build-side code to install U-Boot; 3. Adding the host-side code to handle <u-boot-configuration> and do the right thing. To facilitate review, could you separate these three things? Also, not critical, but could you send patches as ‘text/x-patch’ MIME attachments so that my email client can perform color highlighting? :-) I’m happy to see fast progress on this, thank you! Ludo’.