Browse Source

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.
gn-latest-20200428
Andy Wingo 4 years ago
parent
commit
045ebb3e58
No known key found for this signature in database GPG Key ID: A8803732E4436885
  1. 26
      doc/guix.texi
  2. 13
      gnu/bootloader.scm
  3. 2
      gnu/system/examples/bare-bones.tmpl
  4. 2
      gnu/system/examples/desktop.tmpl
  5. 2
      gnu/system/examples/lightweight-desktop.tmpl
  6. 2
      gnu/system/examples/vm-image.tmpl
  7. 3
      gnu/system/install.scm
  8. 2
      gnu/tests.scm
  9. 14
      gnu/tests/install.scm
  10. 2
      gnu/tests/nfs.scm
  11. 23
      guix/scripts/system.scm
  12. 4
      tests/system.scm

26
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.

13
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.

2
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)

2
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'.

2
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

2
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")

3
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.

2
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)

14
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")

2
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*

23
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))))

4
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)

Loading…
Cancel
Save