Subject: Re: bug#26815: [PATCH v4 3/3] vm: Add UEFI loader to disk images.

From: Marius Bakke <[email-masked]>
Date: Thu, 18 May 2017 19:34:42 +0200

Marius Bakke <[email-masked]> writes:

>> Once we’re done with that, we’ll have to update one of the
>> ‘operating-system’ declaration examples to show UEFI configuration, and
>> to update the doc to explain the installation process for UEFI.
>
> I'll get on that.

Here is a start on UEFI documentation update. Not sure if it's okay to
hijack the lightweight desktop template, or if it's better to have an
example closer to the (GRUB Configuration) section.

From 9db5b8acb017b8f283d36d09835f947879be4e30 Mon Sep 17 00:00:00 2001
From: Marius Bakke <[email-masked]>
Date: Thu, 18 May 2017 19:24:36 +0200
Subject: [PATCH] doc: Update GRUB EFI instructions.

* doc/guix.texi (USB Stick Installation): Mention UEFI.
(Preparing for Installation): Add note about EFI System Partition.
(Proceeding with the Installation): Mention the GRUB-EFI package.
(GRUB Configuration): Likewise.
(Using the Configuration System): Hijack lightweight desktop to include UEFI.
* gnu/system/examples/lightweight-desktop.tmpl: Adjust native EFI configuration.
---
 doc/guix.texi                                | 19 ++++++++++++++-----
 gnu/system/examples/lightweight-desktop.tmpl | 25 ++++++++++++++++---------
 2 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 72741e034..fb67ea50d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7322,8 +7322,8 @@ Access to @file{/dev/sdX} usually requires root privileges.
 @end enumerate
 
 Once this is done, you should be able to reboot the system and boot from
-the USB stick.  The latter usually requires you to get in the BIOS' boot
-menu, where you can choose to boot from the USB stick.
+the USB stick.  The latter usually requires you to get in the BIOS' or
+UEFI boot menu, where you can choose to boot from the USB stick.
 
 @xref{Installing GuixSD in a VM}, if, instead, you would like to install
 GuixSD in a virtual machine (VM).
@@ -7477,6 +7477,14 @@ install BIOS-based GRUB (which is the default), make sure a BIOS Boot
 Partition is available (@pxref{BIOS installation,,, grub, GNU GRUB
 manual}).
 
+If you instead wish to use EFI-based grub, a FAT32 EFI System Partition
+is required.  This partition should be mounted at @file{/boot/efi} and
+must have the @dfn{esp} flag set.  E.g. for @command{parted}:
+
+@example
+parted /dev/sda set 1 esp on
+@end example
+
 Once you are done partitioning the target hard disk drive, you have to
 create a file system on the relevant partition(s)@footnote{Currently
 GuixSD only supports ext4 and btrfs file systems.  In particular, code
@@ -7590,7 +7598,8 @@ in particular:
 @itemize
 @item
 Make sure the @code{grub-configuration} form refers to the device you
-want to install GRUB on.
+want to install GRUB on.  You also need to specify the @code{grub-efi}
+package if you wish to use native UEFI boot.
 
 @item
 Be sure that your partition labels match the value of their respective
@@ -7879,7 +7888,7 @@ management, power management, and more, would look like this:
 @include os-config-desktop.texi
 @end lisp
 
-A graphical environment with a choice of lightweight window managers
+A graphical UEFI system with a choice of lightweight window managers
 instead of full-blown desktop environments would look like this:
 
 @lisp
@@ -15277,7 +15286,7 @@ The number of seconds to wait for keyboard input before booting.  Set to
 The @code{grub-theme} object describing the theme to use.
 
 @item @code{grub} (default: @code{grub})
-The GRUB package to use.
+The GRUB package to use.  Currently either @code{grub} or @code{grub-efi}.
 
 @item @code{terminal-outputs} (default: @code{'gfxterm})
 The output terminals used for the GRUB boot menu, as a list of symbols.
diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl
index 389ec8574..ad92ad163 100644
--- a/gnu/system/examples/lightweight-desktop.tmpl
+++ b/gnu/system/examples/lightweight-desktop.tmpl
@@ -4,7 +4,7 @@
 
 (use-modules (gnu) (gnu system nss))
 (use-service-modules desktop)
-(use-package-modules wm ratpoison certs suckless)
+(use-package-modules bootloaders wm ratpoison certs suckless)
 
 (operating-system
   (host-name "antelope")
@@ -13,14 +13,21 @@
 
   ;; Assuming /dev/sdX is the target hard disk, and "my-root"
   ;; is the label of the target root file system.
-  (bootloader (grub-configuration (device "/dev/sdX")))
-
-  (file-systems (cons (file-system
-                        (device "my-root")
-                        (title 'label)
-                        (mount-point "/")
-                        (type "ext4"))
-                      %base-file-systems))
+  (bootloader (grub-configuration (grub grub-efi)
+                                  (device "/dev/sdX")))
+
+  (file-systems (cons* (file-system
+                         (device "my-root")
+                         (title 'label)
+                         (mount-point "/")
+                         (type "ext4"))
+                       (file-system
+                         ;; Specify partition here since FAT
+                         ;; labels are currently unsupported.
+                         (device "/dev/sdX1")
+                         (mount-point "/boot/efi")
+                         (type "vfat"))
+                       %base-file-systems))
 
   (users (cons (user-account
                 (name "alice")
-- 
2.13.0