summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@igalia.com>2017-08-23 21:48:58 +0200
committerAndy Wingo <wingo@igalia.com>2017-08-23 22:23:19 +0200
commit045ebb3e58d74c75f39ce47380045d3cd00359c3 (patch)
tree2e2b805a7764bd7049bddb417c9d6ccf9ce83653
parentba015ce9c04e2cd8e686add647109b514c3fa244 (diff)
downloadguix-045ebb3e58d74c75f39ce47380045d3cd00359c3.tar.gz
gnu: bootloader: Deprecate "device" field in favor of "target".
* gnu/bootloader.scm (<bootloader-configuration>): Deprecate "device" field in
favor of "target" field.  This is mostly a renaming but also a generalization
to support UEFI targets being paths to a mounted partition instead of a device
name.
* gnu/system/examples/bare-bones.tmpl:
* gnu/system/examples/desktop.tmpl:
* gnu/system/examples/lightweight-desktop.tmpl:
* gnu/system/examples/vm-image.tmpl:
* gnu/system/install.scm:
* gnu/tests.scm:
* gnu/tests/install.scm:
* gnu/tests/nfs.scm:
* tests/system.scm: Adapt all invocations of bootloader-configuration.
* guix/scripts/system.scm (perform-action): Rename device argument to
bootloader-target.
(process-action): Adapt caller.
* doc/guix.texi (Proceeding with the Installation):
* doc/guix.texi (Bootloader Configuration): Update documentation.
-rw-r--r--doc/guix.texi26
-rw-r--r--gnu/bootloader.scm13
-rw-r--r--gnu/system/examples/bare-bones.tmpl2
-rw-r--r--gnu/system/examples/desktop.tmpl2
-rw-r--r--gnu/system/examples/lightweight-desktop.tmpl2
-rw-r--r--gnu/system/examples/vm-image.tmpl2
-rw-r--r--gnu/system/install.scm3
-rw-r--r--gnu/tests.scm2
-rw-r--r--gnu/tests/install.scm14
-rw-r--r--gnu/tests/nfs.scm2
-rw-r--r--guix/scripts/system.scm23
-rw-r--r--tests/system.scm4
12 files changed, 57 insertions, 38 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 77435d897b..954ff90ff7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7964,9 +7964,13 @@ in particular:
 
 @itemize
 @item
-Make sure the @code{grub-configuration} form refers to the device you
-want to install GRUB on.  You also need to specify the @code{grub-efi}
-package if you wish to use native UEFI boot.
+Make sure the @code{grub-configuration} form refers to the target you
+want to install GRUB on.  It should mention @code{grub-bootloader} if
+you are installing GRUB in the legacy way, or @code{grub-efi-bootloader}
+for newer UEFI systems.  For legacy systems, the @code{target} field
+names a device, like @code{/dev/sda}; for UEFI systems it names a path
+to a mounted EFI partition, like @code{/boot/efi}, and do make sure the
+path is actually mounted.
 
 @item
 Be sure that your partition labels match the value of their respective
@@ -17192,11 +17196,15 @@ The bootloader to use, as a @code{bootloader} object. For now
 Available bootloaders are described in @code{(gnu bootloader @dots{})}
 modules.
 
-@item @code{device}
-This is a string denoting the boot device.  It must be a device name
-understood by the bootloader @command{installer} command, such as
-@code{/dev/sda} or @code{(hd0)} (for GRUB, @pxref{Invoking grub-install,,, grub,
-GNU GRUB Manual}).
+@item @code{target}
+This is a string denoting the target onto which to install the
+bootloader.  The exact interpretation depends on the bootloader in
+question; for @code{grub-bootloader}, for example, it should be a device
+name understood by the bootloader @command{installer} command, such as
+@code{/dev/sda} or @code{(hd0)} (for GRUB, @pxref{Invoking
+grub-install,,, grub, GNU GRUB Manual}).  For
+@code{grub-efi-bootloader}, it should be the path to a mounted EFI file
+system.
 
 @item @code{menu-entries} (default: @code{()})
 A possibly empty list of @code{menu-entry} objects (see below), denoting
@@ -17448,7 +17456,7 @@ files, packages, and so on.  It also creates other essential files
 needed for the system to operate correctly---e.g., the @file{/etc},
 @file{/var}, and @file{/run} directories, and the @file{/bin/sh} file.
 
-This command also installs bootloader on the device specified in
+This command also installs bootloader on the target specified in
 @file{my-os-config}, unless the @option{--no-bootloader} option was
 passed.
 
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index e080b04568..122e350874 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -43,7 +43,7 @@
             bootloader-configuration
             bootloader-configuration?
             bootloader-configuration-bootloader
-            bootloader-configuration-device
+            bootloader-configuration-target
             bootloader-configuration-menu-entries
             bootloader-configuration-default-entry
             bootloader-configuration-timeout
@@ -107,6 +107,8 @@
   (bootloader                      bootloader-configuration-bootloader)    ; <bootloader>
   (device                          bootloader-configuration-device         ; string
                                    (default #f))
+  (target                          %bootloader-configuration-target         ; string
+                                   (default #f))
   (menu-entries                    bootloader-configuration-menu-entries   ; list of <boot-parameters>
                                    (default '()))
   (default-entry                   bootloader-configuration-default-entry  ; integer
@@ -126,6 +128,15 @@
   (additional-configuration        bootloader-configuration-additional-configuration ; record
                                    (default #f)))
 
+(define (bootloader-configuration-target config)
+  (or (%bootloader-configuration-target config)
+      (let ((device (bootloader-configuration-device config)))
+        (when device
+          (issue-deprecation-warning
+           "The 'device' field of bootloader configurations is deprecated."
+           "Use 'target' instead."))
+        device)))
+
 
 ;;;
 ;;; Bootloaders.
diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare-bones.tmpl
index a10ee6e7fe..459d241885 100644
--- a/gnu/system/examples/bare-bones.tmpl
+++ b/gnu/system/examples/bare-bones.tmpl
@@ -14,7 +14,7 @@
   ;; the label of the target root file system.
   (bootloader (bootloader-configuration
                 (bootloader grub-bootloader)
-                (device "/dev/sdX")))
+                (target "/dev/sdX")))
   (file-systems (cons (file-system
                         (device "my-root")
                         (title 'label)
diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl
index 3cfbd9add6..2131d1f18f 100644
--- a/gnu/system/examples/desktop.tmpl
+++ b/gnu/system/examples/desktop.tmpl
@@ -15,7 +15,7 @@
   ;; is the label of the target root file system.
   (bootloader (bootloader-configuration
                 (bootloader grub-bootloader)
-                (device "/dev/sdX")))
+                (target "/dev/sdX")))
 
   ;; Specify a mapped device for the encrypted root partition.
   ;; The UUID is that returned by 'cryptsetup luksUUID'.
diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl
index 127ceb4dc5..fb7cfebf6d 100644
--- a/gnu/system/examples/lightweight-desktop.tmpl
+++ b/gnu/system/examples/lightweight-desktop.tmpl
@@ -15,7 +15,7 @@
   ;; Partition mounted on /boot/efi.
   (bootloader (bootloader-configuration
                 (bootloader grub-efi-bootloader)
-                (device "/boot/efi")))
+                (target "/boot/efi")))
 
   ;; Assume the target root file system is labelled "my-root".
   (file-systems (cons* (file-system
diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl
index 57ac71c535..056b439c5f 100644
--- a/gnu/system/examples/vm-image.tmpl
+++ b/gnu/system/examples/vm-image.tmpl
@@ -26,7 +26,7 @@ partprobe, and then 2) resizing the filesystem with resize2fs.\n"))
 
   ;; 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/sda")
+  (bootloader (grub-configuration (target "/dev/sda")
                                   (terminal-outputs '(console))))
   (file-systems (cons (file-system
                         (device "my-root")
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index 6837385daf..7f6ffe9582 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -299,8 +299,7 @@ Use Alt-F2 for documentation.
     (host-name "gnu")
     (timezone "Europe/Paris")
     (locale "en_US.utf8")
-    (bootloader (grub-configuration
-                 (device "/dev/sda")))
+    (bootloader (grub-configuration (target "/dev/sda")))
     (file-systems
      ;; Note: the disk image build code overrides this root file system with
      ;; the appropriate one.
diff --git a/gnu/tests.scm b/gnu/tests.scm
index 2886a982f4..97b9cc5107 100644
--- a/gnu/tests.scm
+++ b/gnu/tests.scm
@@ -206,7 +206,7 @@ the system under test."
     (timezone "Europe/Berlin")
     (locale "en_US.UTF-8")
 
-    (bootloader (grub-configuration (device "/dev/sdX")))
+    (bootloader (grub-configuration (target "/dev/sdX")))
     (file-systems (cons (file-system
                           (device "my-root")
                           (title 'label)
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 22e4181ab1..866bf885ce 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -59,7 +59,7 @@
     (timezone "Europe/Paris")
     (locale "en_US.UTF-8")
 
-    (bootloader (grub-configuration (device "/dev/vdb")))
+    (bootloader (grub-configuration (target "/dev/vdb")))
     (kernel-arguments '("console=ttyS0"))
     (file-systems (cons (file-system
                           (device "my-root")
@@ -98,7 +98,7 @@
 
     (bootloader (bootloader-configuration
                  (bootloader extlinux-bootloader-gpt)
-                 (device "/dev/vdb")))
+                 (target "/dev/vdb")))
     (kernel-arguments '("console=ttyS0"))
     (file-systems (cons (file-system
                           (device "my-root")
@@ -326,7 +326,7 @@ per %test-installed-os, this test is expensive in terms of CPU and storage.")
     (timezone "Europe/Paris")
     (locale "en_US.utf8")
 
-    (bootloader (grub-configuration (device "/dev/vdb")))
+    (bootloader (grub-configuration (target "/dev/vdb")))
     (kernel-arguments '("console=ttyS0"))
     (file-systems (cons* (file-system
                            (device "my-root")
@@ -384,7 +384,7 @@ partition.  In particular, home directories must be correctly created (see
     (timezone "Europe/Paris")
     (locale "en_US.UTF-8")
 
-    (bootloader (grub-configuration (device "/dev/vdb")))
+    (bootloader (grub-configuration (target "/dev/vdb")))
     (kernel-arguments '("console=ttyS0"))
     (file-systems (cons* (file-system
                            (device "root-fs")
@@ -460,7 +460,7 @@ where /gnu lives on a separate partition.")
     (timezone "Europe/Paris")
     (locale "en_US.utf8")
 
-    (bootloader (grub-configuration (device "/dev/vdb")))
+    (bootloader (grub-configuration (target "/dev/vdb")))
     (kernel-arguments '("console=ttyS0"))
     (initrd (lambda (file-systems . rest)
               ;; Add a kernel module for RAID-0 (aka. "stripe").
@@ -543,7 +543,7 @@ by 'mdadm'.")
     (timezone "Europe/Paris")
     (locale "en_US.UTF-8")
 
-    (bootloader (grub-configuration (device "/dev/vdb")))
+    (bootloader (grub-configuration (target "/dev/vdb")))
 
     ;; Note: Do not pass "console=ttyS0" so we can use our passphrase prompt
     ;; detection logic in 'enter-luks-passphrase'.
@@ -670,7 +670,7 @@ build (current-guix) and then store a couple of full system images.")
     (timezone "Europe/Paris")
     (locale "en_US.UTF-8")
 
-    (bootloader (grub-configuration (device "/dev/vdb")))
+    (bootloader (grub-configuration (target "/dev/vdb")))
     (kernel-arguments '("console=ttyS0"))
     (file-systems (cons (file-system
                           (device "my-root")
diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm
index 2e666b2c08..889f578d01 100644
--- a/gnu/tests/nfs.scm
+++ b/gnu/tests/nfs.scm
@@ -41,7 +41,7 @@
     (timezone "Europe/Berlin")
     (locale "en_US.UTF-8")
 
-    (bootloader (grub-configuration (device "/dev/sdX")))
+    (bootloader (grub-configuration (target "/dev/sdX")))
     (file-systems %base-file-systems)
     (users %base-user-accounts)
     (packages (cons*
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 44d2c8f20c..8793c40925 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -612,17 +612,16 @@ and TARGET arguments."
 (define* (perform-action action os
                          #:key install-bootloader?
                          dry-run? derivations-only?
-                         use-substitutes? device target
+                         use-substitutes? bootloader-target target
                          image-size file-system-type full-boot?
                          (mappings '())
                          (gc-root #f))
   "Perform ACTION for OS.  INSTALL-BOOTLOADER? specifies whether to install
-bootloader; DEVICE is the target devices for bootloader; TARGET is the target
-root directory; IMAGE-SIZE is the size of the image to be built, for the
-'vm-image' and 'disk-image' actions.
-The root filesystem is created as a FILE-SYSTEM-TYPE filesystem.
-FULL-BOOT? is used for the 'vm' action;
-it determines whether to boot directly to the kernel or to the bootloader.
+bootloader; BOOTLOADER-TAGET is the target for the bootloader; TARGET is the
+target root directory; IMAGE-SIZE is the size of the image to be built, for
+the 'vm-image' and 'disk-image' actions.  The root filesystem is created as a
+FILE-SYSTEM-TYPE filesystem.  FULL-BOOT? is used for the 'vm' action; it
+determines whether to boot directly to the kernel or to the bootloader.
 
 When DERIVATIONS-ONLY? is true, print the derivation file name(s) without
 building anything.
@@ -662,7 +661,7 @@ output when building a system derivation, such as a disk image."
               (target    (or target "/")))
           (bootloader-installer-derivation installer
                                            bootloader-package
-                                           device target)))
+                                           bootloader-target target)))
 
        ;; For 'init' and 'reconfigure', always build BOOTCFG, even if
        ;; --no-bootloader is passed, because we then use it as a GC root.
@@ -895,8 +894,9 @@ resulting from command-line parsing."
          (target      (match args
                         ((first second) second)
                         (_ #f)))
-         (device      (and bootloader?
-                           (bootloader-configuration-device
+         (bootloader-target
+                      (and bootloader?
+                           (bootloader-configuration-target
                             (operating-system-bootloader os)))))
 
     (with-store store
@@ -929,7 +929,8 @@ resulting from command-line parsing."
                                                       (_ #f))
                                                     opts)
                              #:install-bootloader? bootloader?
-                             #:target target #:device device
+                             #:target target
+                             #:bootloader-target bootloader-target
                              #:gc-root (assoc-ref opts 'gc-root)))))
         #:system system))))
 
diff --git a/tests/system.scm b/tests/system.scm
index ca34409be9..a661544a5f 100644
--- a/tests/system.scm
+++ b/tests/system.scm
@@ -36,7 +36,7 @@
     (host-name "komputilo")
     (timezone "Europe/Berlin")
     (locale "en_US.utf8")
-    (bootloader (grub-configuration (device "/dev/sdX")))
+    (bootloader (grub-configuration (target "/dev/sdX")))
     (file-systems (cons %root-fs %base-file-systems))
 
     (users %base-user-accounts)))
@@ -51,7 +51,7 @@
     (host-name "komputilo")
     (timezone "Europe/Berlin")
     (locale "en_US.utf8")
-    (bootloader (grub-configuration (device "/dev/sdX")))
+    (bootloader (grub-configuration (target "/dev/sdX")))
     (mapped-devices (list %luks-device))
     (file-systems (cons (file-system
                           (inherit %root-fs)