unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Marius Bakke <mbakke@fastmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 6/6] gnu: Add grub-efi.
Date: Fri, 16 Dec 2016 18:33:20 +0100	[thread overview]
Message-ID: <87y3zfrd7j.fsf@kirby.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <871sx73ink.fsf@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 3234 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Hi Marius,
>
> Marius Bakke <mbakke@fastmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>>>>> From 940c03c7dcddec019e27f6eb1470aeab4db57799 Mon Sep 17 00:00:00 2001
>>>>>> From: Marius Bakke <mbakke@fastmail.com>
>>>>>> Date: Thu, 20 Oct 2016 17:26:52 +0100
>>>>>> Subject: [PATCH] gnu: Add grub-efi.
>>>>>>
>>>>>> * gnu/packages/grub.scm (grub-efi): New variable.
>>>>>
>>>>> [...]
>>>>>
>>>>>> +    (name "grub-efi")
>>>>>> +    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
>>>>>
>>>>> Please use a literal string for ‘synopsis’; use of ‘string-append’ like
>>>>> this prevents i18n.
>>>>>
>>>>>> +     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
>>>>>
>>>>> It would be good to investigate, especially if the tests pass in the
>>>>> ‘grub’ package.
>>>>>
>>>>> Also, what’s the rationale for making ‘grub-efi’ separate instead of
>>>>> incorporating the changes in ‘grub’ proper?  Are there issues around the
>>>>> portability of ‘efibootmgr’, or an increased closure size?
>>>>
>>>> This is a good point. The only difference with "--with-platform=efi" is
>>>> that another directory is created in place of the i386-pc directory. It
>>>> is perfectly possible to build multiple platforms and copying the
>>>> platform-specific stuff to $out/lib -- grub will pick the correct
>>>> platform at runtime. This is what the Gentoo ebuild does.
>>>
>>> Are you saying that a GRUB compiled with UEFI support will no longer
>>> work out-of-the-box on non-UEFI machines, unless platform-specific stuff
>>> is moved like you suggest?
>>
>> Ha, no, it was just a long-winded and intoxicated way of saying what you
>> proposed should work fine. :)
>
> It turns out I have an immediate need ;-), so I pushed this as commit
> 3eee16130d858ae96510ec1c7d38d31290de2699.  Let me know if that doesn’t
> seem right!

I think you need to compile with '--with-platform=efi' as well. Check
/gnu/store/...grub-.../lib/grub. I still use a custom 'grub-efi'
expression (attached, needs adaption to 3eee16). Otherwise grub won't
have the required install files, even if it could detect the platform.

Relatedly, I think the way to build a 'multi-grub' is to have one
expression for each supported grub platform, and then consolidate
out/lib/grub from each.

> Now there are things I didn’t quite get.  Apparently you’re supposed to
> have a /boot/efi as a vfat partition, and ‘grub-install’ is supposed to
> detect it and install the EFI stuff, or so I thought (info "(grub)
> Installing GRUB using grub-install").
>
> However, ‘grub-install’ still seems to be installing for “i386-pc”
> instead of EFI.
>
> What am I missing?

IIRC grub-install will detect and install for the running mode (pc, efi,
etc). So in a classic chicken-and-egg situation, you need to be booted
with UEFI mode for grub to select the correct installation platform!

I worked around this by installing grub from a UEFI live CD, copy and
adapt the grub.cfg from an existing (BIOS) GuixSD installation, then
coerce the GuixSD system to use EFI from that point..


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-grub-efi.patch --]
[-- Type: text/x-patch, Size: 1686 bytes --]

From 1ca87a51f55f0b05f89eed707c1485b94f3d7d16 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Thu, 20 Oct 2016 17:26:52 +0100
Subject: [PATCH] gnu: Add grub-efi.

* gnu/packages/grub.scm (grub-efi): New variable.
---
 gnu/packages/grub.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm
index ef7395e95..1cb835695 100644
--- a/gnu/packages/grub.scm
+++ b/gnu/packages/grub.scm
@@ -164,3 +164,26 @@ on the same computer; upon booting the computer, the user is presented with a
 menu to select one of the installed operating systems.")
     (license gpl3+)
     (properties '((cpe-name . "grub2")))))
+
+(define-public grub-efi
+  (package
+    (inherit grub)
+    (name "grub-efi")
+    (synopsis (string-append (package-synopsis grub) " (UEFI version)"))
+    (inputs
+     `(("efibootmgr" ,efibootmgr)
+       ,@(package-inputs grub)))
+    (arguments
+     `(#:tests? #f ; FIXME: 40 failures, 24 skipped, 17 passed.
+       ,@(substitute-keyword-arguments (package-arguments grub)
+           ((#:configure-flags flags) `(cons* "--with-platform=efi"
+                                              ,flags))
+           ((#:phases phases)
+            `(modify-phases ,phases
+               (add-after 'patch-stuff 'use-absolute-efibootmgr-path
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (substitute* "grub-core/osdep/unix/platform.c"
+                     (("efibootmgr")
+                      (string-append (assoc-ref inputs "efibootmgr")
+                                     "/sbin/efibootmgr")))
+                   #t)))))))))
-- 
2.11.0


  parent reply	other threads:[~2016-12-16 17:33 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-05 12:55 Initial vfat support Marius Bakke
2016-11-05 12:55 ` [PATCH 1/6] gnu: Add fatfsck-static Marius Bakke
2016-11-05 16:01   ` Hartmut Goebel
2016-11-05 16:11     ` Marius Bakke
2016-11-06 21:42   ` Ludovic Courtès
2016-11-05 12:55 ` [PATCH 2/6] linux-initrd: Support FAT filesystems Marius Bakke
2016-11-06 21:44   ` Ludovic Courtès
2016-11-05 12:55 ` [PATCH 3/6] file-systems: Suppress fsck status completion bar Marius Bakke
2016-11-06 21:47   ` Ludovic Courtès
2016-11-07  0:00     ` Marius Bakke
2016-11-07  8:59       ` Ludovic Courtès
2016-11-07  9:29         ` Marius Bakke
2016-11-07 10:15           ` Danny Milosavljevic
2016-12-17  9:40             ` Marius Bakke
2016-12-18 10:57               ` Ludovic Courtès
2016-11-05 12:55 ` [PATCH 4/6] gnu: Add efivar Marius Bakke
2016-11-06 21:51   ` Ludovic Courtès
2016-11-05 12:55 ` [PATCH 5/6] gnu: Add efibootmgr Marius Bakke
2016-11-06 21:52   ` Ludovic Courtès
2016-11-05 12:55 ` [PATCH 6/6] gnu: Add grub-efi Marius Bakke
2016-11-05 18:58   ` Leo Famulari
2016-11-05 19:38     ` Marius Bakke
2016-11-06 22:00       ` Ludovic Courtès
2016-11-07  0:19         ` Marius Bakke
2016-11-07  9:00           ` Ludovic Courtès
2016-11-07  9:23             ` Marius Bakke
2016-12-16 17:09               ` Ludovic Courtès
2016-12-16 17:16                 ` Danny Milosavljevic
2016-12-16 17:33                 ` Marius Bakke [this message]
2016-12-18 10:54                   ` Ludovic Courtès
2016-12-18 14:36                     ` Marius Bakke
2016-12-19 10:48                       ` Ludovic Courtès
2016-12-19 15:49                         ` Marius Bakke
2016-12-19 21:16                           ` Ludovic Courtès
2016-12-19 22:48                             ` Marius Bakke
2016-12-20 13:53                               ` Ludovic Courtès
2016-12-20 14:42                                 ` Marius Bakke
2016-12-20 16:53                                   ` Ludovic Courtès
2016-12-20 18:43                                     ` Marius Bakke
2016-12-21  9:12                                       ` Ludovic Courtès
2016-12-21 18:55                                         ` Danny Milosavljevic
2017-01-03 16:06                                 ` Ludovic Courtès
2017-01-03 16:16                                   ` Chris Marusich
2017-01-04 22:18                                     ` Ludovic Courtès
2016-12-17  9:38                 ` Marius Bakke
2016-12-17 10:15                   ` Marius Bakke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y3zfrd7j.fsf@kirby.i-did-not-set--mail-host-address--so-tickle-me \
    --to=mbakke@fastmail.com \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).