Subject: [bug#27705] [PATCH 3/4] gnu: grub-efi: Add grub.

From: Danny Milosavljevic <[email-masked]>
Date: Wed, 19 Jul 2017 22:48:59 +0200

Hi Marius,

On Mon, 17 Jul 2017 23:26:06 +0200
Marius Bakke <[email-masked]> wrote:

>However... The 'grub-hybrid' approach seems okay to me (although
>building grub-efi again is unnecessary :)). 

No, it's not unnecessary.  When you do not use this approach (for example when you create a new package which has "grub" and "grub-efi" as input) then the resulting executables (for example grub-efi's grub-mkrescue) will not find the platform support files - because the search path for multiple platforms is being hardcoded at build time.

Doesn't work:

+(define-public grub-hybrid
+  (package
+    (name "grub-hybrid")
+    (version (package-version grub-efi))
+    (inputs
+     `(("grub-efi" ,grub-efi) ; keep as first (preferred) entry
+       ("grub" ,grub)))
+    (build-system trivial-build-system)
+    (arguments
+     '(#:modules ((guix build union))
+       #:builder (begin
+                   (use-modules (ice-9 match)
+                                (guix build union))
+                   (match %build-inputs
+                     (((names . directories) ...)
+                      ;; Take "lib/grub/i386-pc" from grub, the remainder
+                      ;; from grub-efi.
+                      (union-build (assoc-ref %outputs "out")
+                                   directories))))))
+    (home-page "https://www.gnu.org/software/grub/")
+    (synopsis "GRand Unified Boot loader (Hybrid version)")
+    (description "This version of GRUB tries the @code{grub-efi} and
+then the traditional @code{grub}.")))
+

> FWIW Gentoo has taken the 'hybrid' approach for many years (building
> once for each target platform and consolidating out/lib/grub). But it
> would be good to know whether this configuration is supported upstream.

I'm using it for grub-mkrescue and, there, it's definitely supported in the sense of there's explicit case analysis in the source code for it and also big structures to enable this kind of using multiple platforms.

For other uses I don't know.