2017-05-15 20:24:18 +00:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
|
|
|
|
;;; Copyright © 2017 David Craven <david@craven.ch>
|
2022-08-29 20:24:24 +00:00
|
|
|
|
;;; Copyright © 2017, 2020, 2022 Mathieu Othacehe <othacehe@gnu.org>
|
2017-05-15 20:24:18 +00:00
|
|
|
|
;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
|
2021-08-30 12:22:35 +00:00
|
|
|
|
;;; Copyright © 2019, 2021 Ludovic Courtès <ludo@gnu.org>
|
2020-05-26 14:54:18 +00:00
|
|
|
|
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
2022-08-21 08:41:15 +00:00
|
|
|
|
;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
|
2022-08-28 08:04:46 +00:00
|
|
|
|
;;; Copyright © 2022 Reza Alizadeh Majd <r.majd@pantherx.org>
|
2017-05-15 20:24:18 +00:00
|
|
|
|
;;;
|
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
|
;;; your option) any later version.
|
|
|
|
|
;;;
|
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
|
;;;
|
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
(define-module (gnu bootloader)
|
2022-08-21 08:41:15 +00:00
|
|
|
|
#:use-module (gnu system file-systems)
|
|
|
|
|
#:use-module (gnu system uuid)
|
2017-05-15 20:24:18 +00:00
|
|
|
|
#:use-module (guix discovery)
|
2020-10-25 16:59:19 +00:00
|
|
|
|
#:use-module (guix gexp)
|
|
|
|
|
#:use-module (guix profiles)
|
2017-05-15 20:24:18 +00:00
|
|
|
|
#:use-module (guix records)
|
2021-08-30 12:22:35 +00:00
|
|
|
|
#:use-module (guix deprecation)
|
|
|
|
|
#:use-module ((guix ui) #:select (warn-about-load-error))
|
|
|
|
|
#:use-module (guix diagnostics)
|
|
|
|
|
#:use-module (guix i18n)
|
2017-05-15 20:24:18 +00:00
|
|
|
|
#:use-module (srfi srfi-1)
|
2022-09-04 17:25:42 +00:00
|
|
|
|
#:use-module (srfi srfi-34)
|
|
|
|
|
#:use-module (srfi srfi-35)
|
2019-08-28 21:27:20 +00:00
|
|
|
|
#:use-module (ice-9 match)
|
2017-05-29 12:24:20 +00:00
|
|
|
|
#:export (menu-entry
|
|
|
|
|
menu-entry?
|
|
|
|
|
menu-entry-label
|
|
|
|
|
menu-entry-device
|
|
|
|
|
menu-entry-linux
|
|
|
|
|
menu-entry-linux-arguments
|
|
|
|
|
menu-entry-initrd
|
2017-06-29 10:42:59 +00:00
|
|
|
|
menu-entry-device-mount-point
|
2020-05-26 14:54:18 +00:00
|
|
|
|
menu-entry-multiboot-kernel
|
|
|
|
|
menu-entry-multiboot-arguments
|
|
|
|
|
menu-entry-multiboot-modules
|
2022-09-04 17:25:38 +00:00
|
|
|
|
menu-entry-chain-loader
|
2017-05-29 12:24:20 +00:00
|
|
|
|
|
2019-08-28 21:27:20 +00:00
|
|
|
|
menu-entry->sexp
|
|
|
|
|
sexp->menu-entry
|
|
|
|
|
|
2017-05-29 12:24:20 +00:00
|
|
|
|
bootloader
|
2017-05-15 20:24:18 +00:00
|
|
|
|
bootloader?
|
|
|
|
|
bootloader-name
|
|
|
|
|
bootloader-package
|
|
|
|
|
bootloader-installer
|
2020-05-23 17:09:14 +00:00
|
|
|
|
bootloader-disk-image-installer
|
2017-05-15 20:24:18 +00:00
|
|
|
|
bootloader-configuration-file
|
|
|
|
|
bootloader-configuration-file-generator
|
|
|
|
|
|
|
|
|
|
bootloader-configuration
|
|
|
|
|
bootloader-configuration?
|
|
|
|
|
bootloader-configuration-bootloader
|
2021-08-06 20:33:02 +00:00
|
|
|
|
bootloader-configuration-target ;deprecated
|
|
|
|
|
bootloader-configuration-targets
|
2017-05-15 20:24:18 +00:00
|
|
|
|
bootloader-configuration-menu-entries
|
|
|
|
|
bootloader-configuration-default-entry
|
|
|
|
|
bootloader-configuration-timeout
|
2019-03-17 21:37:53 +00:00
|
|
|
|
bootloader-configuration-keyboard-layout
|
2017-05-15 20:24:18 +00:00
|
|
|
|
bootloader-configuration-theme
|
|
|
|
|
bootloader-configuration-terminal-outputs
|
|
|
|
|
bootloader-configuration-terminal-inputs
|
|
|
|
|
bootloader-configuration-serial-unit
|
|
|
|
|
bootloader-configuration-serial-speed
|
2022-08-28 08:04:46 +00:00
|
|
|
|
bootloader-configuration-device-tree-support?
|
2017-05-15 20:24:18 +00:00
|
|
|
|
|
|
|
|
|
%bootloaders
|
2020-10-25 16:59:19 +00:00
|
|
|
|
lookup-bootloader-by-name
|
|
|
|
|
|
|
|
|
|
efi-bootloader-chain))
|
2017-05-15 20:24:18 +00:00
|
|
|
|
|
2017-05-29 12:24:20 +00:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Menu-entry record.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define-record-type* <menu-entry>
|
|
|
|
|
menu-entry make-menu-entry
|
|
|
|
|
menu-entry?
|
|
|
|
|
(label menu-entry-label)
|
|
|
|
|
(device menu-entry-device ; file system uuid, label, or #f
|
|
|
|
|
(default #f))
|
2017-06-29 10:42:59 +00:00
|
|
|
|
(device-mount-point menu-entry-device-mount-point
|
|
|
|
|
(default #f))
|
2020-05-26 14:54:18 +00:00
|
|
|
|
(linux menu-entry-linux
|
|
|
|
|
(default #f))
|
2017-05-29 12:24:20 +00:00
|
|
|
|
(linux-arguments menu-entry-linux-arguments
|
|
|
|
|
(default '())) ; list of string-valued gexps
|
2020-05-26 14:54:18 +00:00
|
|
|
|
(initrd menu-entry-initrd ; file name of the initrd as a gexp
|
|
|
|
|
(default #f))
|
|
|
|
|
(multiboot-kernel menu-entry-multiboot-kernel
|
|
|
|
|
(default #f))
|
|
|
|
|
(multiboot-arguments menu-entry-multiboot-arguments
|
|
|
|
|
(default '())) ; list of string-valued gexps
|
|
|
|
|
(multiboot-modules menu-entry-multiboot-modules
|
2022-09-04 17:25:38 +00:00
|
|
|
|
(default '())) ; list of multiboot commands, where
|
2020-05-26 14:54:18 +00:00
|
|
|
|
; a command is a list of <string>
|
2022-09-04 17:25:38 +00:00
|
|
|
|
(chain-loader menu-entry-chain-loader
|
|
|
|
|
(default #f))) ; string, path of efi file
|
2017-05-29 12:24:20 +00:00
|
|
|
|
|
2022-09-04 17:25:42 +00:00
|
|
|
|
(define (report-menu-entry-error menu-entry)
|
|
|
|
|
(raise
|
|
|
|
|
(condition
|
|
|
|
|
(&message
|
|
|
|
|
(message
|
|
|
|
|
(format #f (G_ "invalid menu-entry: ~a") menu-entry)))
|
|
|
|
|
(&fix-hint
|
|
|
|
|
(hint
|
|
|
|
|
(G_ "Please chose only one of:
|
|
|
|
|
@enumerate
|
|
|
|
|
@item direct boot by specifying fields @code{linux},
|
|
|
|
|
@code{linux-arguments} and @code{linux-modules},
|
|
|
|
|
@item multiboot by specifying fields @code{multiboot-kernel},
|
|
|
|
|
@code{multiboot-arguments} and @code{multiboot-modules},
|
|
|
|
|
@item chain-loader by specifying field @code{chain-loader}.
|
|
|
|
|
@end enumerate"))))))
|
|
|
|
|
|
2019-08-28 21:27:20 +00:00
|
|
|
|
(define (menu-entry->sexp entry)
|
|
|
|
|
"Return ENTRY serialized as an sexp."
|
2022-08-21 08:41:15 +00:00
|
|
|
|
(define (device->sexp device)
|
|
|
|
|
(match device
|
|
|
|
|
((? uuid? uuid)
|
|
|
|
|
`(uuid ,(uuid-type uuid) ,(uuid->string uuid)))
|
|
|
|
|
((? file-system-label? label)
|
|
|
|
|
`(label ,(file-system-label->string label)))
|
|
|
|
|
(_ device)))
|
2019-08-28 21:27:20 +00:00
|
|
|
|
(match entry
|
2022-09-04 17:25:38 +00:00
|
|
|
|
(($ <menu-entry> label device mount-point
|
|
|
|
|
(? identity linux) linux-arguments (? identity initrd)
|
|
|
|
|
#f () () #f)
|
2019-08-28 21:27:20 +00:00
|
|
|
|
`(menu-entry (version 0)
|
|
|
|
|
(label ,label)
|
2022-08-21 08:41:15 +00:00
|
|
|
|
(device ,(device->sexp device))
|
2019-08-28 21:27:20 +00:00
|
|
|
|
(device-mount-point ,mount-point)
|
|
|
|
|
(linux ,linux)
|
|
|
|
|
(linux-arguments ,linux-arguments)
|
2020-05-26 14:54:18 +00:00
|
|
|
|
(initrd ,initrd)))
|
|
|
|
|
(($ <menu-entry> label device mount-point #f () #f
|
2022-09-04 17:25:38 +00:00
|
|
|
|
(? identity multiboot-kernel) multiboot-arguments
|
|
|
|
|
multiboot-modules #f)
|
2020-05-26 14:54:18 +00:00
|
|
|
|
`(menu-entry (version 0)
|
|
|
|
|
(label ,label)
|
2022-08-21 08:41:15 +00:00
|
|
|
|
(device ,(device->sexp device))
|
2020-05-26 14:54:18 +00:00
|
|
|
|
(device-mount-point ,mount-point)
|
|
|
|
|
(multiboot-kernel ,multiboot-kernel)
|
|
|
|
|
(multiboot-arguments ,multiboot-arguments)
|
2022-09-04 17:25:38 +00:00
|
|
|
|
(multiboot-modules ,multiboot-modules)))
|
|
|
|
|
(($ <menu-entry> label device mount-point #f () #f #f () ()
|
|
|
|
|
(? identity chain-loader))
|
|
|
|
|
`(menu-entry (version 0)
|
|
|
|
|
(label ,label)
|
|
|
|
|
(device ,(device->sexp device))
|
|
|
|
|
(device-mount-point ,mount-point)
|
2022-09-04 17:25:42 +00:00
|
|
|
|
(chain-loader ,chain-loader)))
|
|
|
|
|
(_ (report-menu-entry-error entry))))
|
2019-08-28 21:27:20 +00:00
|
|
|
|
|
|
|
|
|
(define (sexp->menu-entry sexp)
|
|
|
|
|
"Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry>
|
|
|
|
|
record."
|
2022-08-21 08:41:15 +00:00
|
|
|
|
(define (sexp->device device-sexp)
|
|
|
|
|
(match device-sexp
|
|
|
|
|
(('uuid type uuid-string)
|
|
|
|
|
(uuid uuid-string type))
|
|
|
|
|
(('label label)
|
|
|
|
|
(file-system-label label))
|
|
|
|
|
(_ device-sexp)))
|
2019-08-28 21:27:20 +00:00
|
|
|
|
(match sexp
|
|
|
|
|
(('menu-entry ('version 0)
|
|
|
|
|
('label label) ('device device)
|
|
|
|
|
('device-mount-point mount-point)
|
|
|
|
|
('linux linux) ('linux-arguments linux-arguments)
|
|
|
|
|
('initrd initrd) _ ...)
|
|
|
|
|
(menu-entry
|
|
|
|
|
(label label)
|
2022-08-21 08:41:15 +00:00
|
|
|
|
(device (sexp->device device))
|
2019-08-28 21:27:20 +00:00
|
|
|
|
(device-mount-point mount-point)
|
|
|
|
|
(linux linux)
|
|
|
|
|
(linux-arguments linux-arguments)
|
2020-05-26 14:54:18 +00:00
|
|
|
|
(initrd initrd)))
|
|
|
|
|
(('menu-entry ('version 0)
|
|
|
|
|
('label label) ('device device)
|
|
|
|
|
('device-mount-point mount-point)
|
|
|
|
|
('multiboot-kernel multiboot-kernel)
|
|
|
|
|
('multiboot-arguments multiboot-arguments)
|
|
|
|
|
('multiboot-modules multiboot-modules) _ ...)
|
|
|
|
|
(menu-entry
|
|
|
|
|
(label label)
|
2022-08-21 08:41:15 +00:00
|
|
|
|
(device (sexp->device device))
|
2020-05-26 14:54:18 +00:00
|
|
|
|
(device-mount-point mount-point)
|
|
|
|
|
(multiboot-kernel multiboot-kernel)
|
|
|
|
|
(multiboot-arguments multiboot-arguments)
|
2022-09-04 17:25:38 +00:00
|
|
|
|
(multiboot-modules multiboot-modules)))
|
|
|
|
|
(('menu-entry ('version 0)
|
|
|
|
|
('label label) ('device device)
|
|
|
|
|
('device-mount-point mount-point)
|
|
|
|
|
('chain-loader chain-loader) _ ...)
|
|
|
|
|
(menu-entry
|
|
|
|
|
(label label)
|
|
|
|
|
(device (sexp->device device))
|
|
|
|
|
(device-mount-point mount-point)
|
|
|
|
|
(chain-loader chain-loader)))))
|
2019-08-28 21:27:20 +00:00
|
|
|
|
|
2017-05-15 20:24:18 +00:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Bootloader record.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
;; The <bootloader> record contains fields expressing how the bootloader
|
|
|
|
|
;; should be installed. Every bootloader in gnu/bootloader/ directory
|
|
|
|
|
;; has to be described by this record.
|
|
|
|
|
|
|
|
|
|
(define-record-type* <bootloader>
|
|
|
|
|
bootloader make-bootloader
|
|
|
|
|
bootloader?
|
|
|
|
|
(name bootloader-name)
|
|
|
|
|
(package bootloader-package)
|
|
|
|
|
(installer bootloader-installer)
|
2020-05-23 17:09:14 +00:00
|
|
|
|
(disk-image-installer bootloader-disk-image-installer
|
|
|
|
|
(default #f))
|
2017-05-15 20:24:18 +00:00
|
|
|
|
(configuration-file bootloader-configuration-file)
|
|
|
|
|
(configuration-file-generator bootloader-configuration-file-generator))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Bootloader configuration record.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
;; The <bootloader-configuration> record contains bootloader independant
|
|
|
|
|
;; configuration used to fill bootloader configuration file.
|
|
|
|
|
|
2021-11-17 14:43:48 +00:00
|
|
|
|
(define-with-syntax-properties (warn-target-field-deprecation
|
|
|
|
|
(value properties))
|
|
|
|
|
(when value
|
|
|
|
|
(warning (source-properties->location properties)
|
|
|
|
|
(G_ "the 'target' field is deprecated, please use 'targets' \
|
|
|
|
|
instead~%")))
|
|
|
|
|
value)
|
2021-08-30 12:22:35 +00:00
|
|
|
|
|
2017-05-15 20:24:18 +00:00
|
|
|
|
(define-record-type* <bootloader-configuration>
|
|
|
|
|
bootloader-configuration make-bootloader-configuration
|
|
|
|
|
bootloader-configuration?
|
2022-08-29 20:24:24 +00:00
|
|
|
|
(bootloader
|
|
|
|
|
bootloader-configuration-bootloader) ;<bootloader>
|
|
|
|
|
(targets %bootloader-configuration-targets
|
|
|
|
|
(default #f)) ;list of strings
|
|
|
|
|
(target %bootloader-configuration-target ;deprecated
|
|
|
|
|
(default #f)
|
|
|
|
|
(sanitize warn-target-field-deprecation))
|
|
|
|
|
(menu-entries bootloader-configuration-menu-entries
|
|
|
|
|
(default '())) ;list of <menu-entry>
|
|
|
|
|
(default-entry bootloader-configuration-default-entry
|
|
|
|
|
(default 0)) ;integer
|
|
|
|
|
(timeout bootloader-configuration-timeout
|
|
|
|
|
(default 5)) ;seconds as integer
|
|
|
|
|
(keyboard-layout bootloader-configuration-keyboard-layout
|
|
|
|
|
(default #f)) ;<keyboard-layout> | #f
|
|
|
|
|
(theme bootloader-configuration-theme
|
|
|
|
|
(default #f)) ;bootloader-specific theme
|
|
|
|
|
(terminal-outputs bootloader-configuration-terminal-outputs
|
|
|
|
|
(default '(gfxterm))) ;list of symbols
|
|
|
|
|
(terminal-inputs bootloader-configuration-terminal-inputs
|
|
|
|
|
(default '())) ;list of symbols
|
|
|
|
|
(serial-unit bootloader-configuration-serial-unit
|
|
|
|
|
(default #f)) ;integer | #f
|
|
|
|
|
(serial-speed bootloader-configuration-serial-speed
|
|
|
|
|
(default #f)) ;integer | #f
|
|
|
|
|
(device-tree-support? bootloader-configuration-device-tree-support?
|
|
|
|
|
(default #t))) ;boolean
|
2017-05-15 20:24:18 +00:00
|
|
|
|
|
2021-08-30 12:22:35 +00:00
|
|
|
|
(define-deprecated (bootloader-configuration-target config)
|
|
|
|
|
bootloader-configuration-targets
|
2021-08-06 20:33:02 +00:00
|
|
|
|
(%bootloader-configuration-target config))
|
|
|
|
|
|
|
|
|
|
(define (bootloader-configuration-targets config)
|
|
|
|
|
(or (%bootloader-configuration-targets config)
|
|
|
|
|
;; TODO: Remove after the deprecated 'target' field is removed.
|
2021-08-30 12:22:35 +00:00
|
|
|
|
(list (%bootloader-configuration-target config))
|
2021-08-06 20:33:02 +00:00
|
|
|
|
;; XXX: At least the GRUB installer (see (gnu bootloader grub)) has this
|
|
|
|
|
;; peculiar behavior of installing fonts and GRUB modules when DEVICE is #f,
|
|
|
|
|
;; hence the default value of '(#f) rather than '().
|
|
|
|
|
(list #f)))
|
|
|
|
|
|
2017-05-15 20:24:18 +00:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Bootloaders.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define (bootloader-modules)
|
|
|
|
|
"Return the list of bootloader modules."
|
|
|
|
|
(all-modules (map (lambda (entry)
|
|
|
|
|
`(,entry . "gnu/bootloader"))
|
2018-03-26 21:42:59 +00:00
|
|
|
|
%load-path)
|
|
|
|
|
#:warn warn-about-load-error))
|
2017-05-15 20:24:18 +00:00
|
|
|
|
|
|
|
|
|
(define %bootloaders
|
|
|
|
|
;; The list of publically-known bootloaders.
|
|
|
|
|
(delay (fold-module-public-variables (lambda (obj result)
|
|
|
|
|
(if (bootloader? obj)
|
|
|
|
|
(cons obj result)
|
|
|
|
|
result))
|
|
|
|
|
'()
|
|
|
|
|
(bootloader-modules))))
|
|
|
|
|
|
|
|
|
|
(define (lookup-bootloader-by-name name)
|
|
|
|
|
"Return the bootloader called NAME."
|
|
|
|
|
(or (find (lambda (bootloader)
|
|
|
|
|
(eq? name (bootloader-name bootloader)))
|
|
|
|
|
(force %bootloaders))
|
|
|
|
|
(leave (G_ "~a: no such bootloader~%") name)))
|
2020-10-25 16:59:19 +00:00
|
|
|
|
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
(define (efi-bootloader-profile packages files hooks)
|
|
|
|
|
"Creates a profile from the lists of PACKAGES and FILES from the store.
|
|
|
|
|
This profile is meant to be used by the bootloader-installer.
|
2020-10-25 16:59:19 +00:00
|
|
|
|
|
|
|
|
|
FILES is a list of file or directory names from the store, which will be
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
symlinked into the profile. If a directory name ends with '/', then the
|
|
|
|
|
directory content instead of the directory itself will be symlinked into the
|
|
|
|
|
profile.
|
2020-10-25 16:59:19 +00:00
|
|
|
|
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
FILES may contain file like objects produced by procedures like plain-file,
|
2020-11-07 21:15:53 +00:00
|
|
|
|
local-file, etc., or package contents produced with file-append.
|
|
|
|
|
|
|
|
|
|
HOOKS lists additional hook functions to modify the profile."
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
(define (efi-bootloader-profile-hook manifest)
|
2020-10-25 16:59:19 +00:00
|
|
|
|
(define build
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
(with-imported-modules '((guix build utils))
|
2020-10-25 16:59:19 +00:00
|
|
|
|
#~(begin
|
|
|
|
|
(use-modules ((guix build utils)
|
|
|
|
|
#:select (mkdir-p strip-store-file-name))
|
|
|
|
|
((ice-9 ftw)
|
|
|
|
|
#:select (scandir))
|
|
|
|
|
((srfi srfi-1)
|
|
|
|
|
#:select (append-map every remove))
|
|
|
|
|
((srfi srfi-26)
|
|
|
|
|
#:select (cut)))
|
|
|
|
|
(define (symlink-to file directory transform)
|
|
|
|
|
"Creates a symlink to FILE named (TRANSFORM FILE) in DIRECTORY."
|
|
|
|
|
(symlink file (string-append directory "/" (transform file))))
|
|
|
|
|
(define (directory-content directory)
|
|
|
|
|
"Creates a list of absolute path names inside DIRECTORY."
|
|
|
|
|
(map (lambda (name)
|
|
|
|
|
(string-append directory name))
|
|
|
|
|
(or (scandir directory (lambda (name)
|
|
|
|
|
(not (member name '("." "..")))))
|
|
|
|
|
'())))
|
|
|
|
|
(define name-ends-with-/? (cut string-suffix? "/" <>))
|
|
|
|
|
(define (name-is-store-entry? name)
|
|
|
|
|
"Return #t if NAME is a direct store entry and nothing inside."
|
|
|
|
|
(not (string-index (strip-store-file-name name) #\/)))
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
(let* ((files '#$files)
|
2020-10-25 16:59:19 +00:00
|
|
|
|
(directories (filter name-ends-with-/? files))
|
|
|
|
|
(names-from-directories
|
|
|
|
|
(append-map (lambda (directory)
|
|
|
|
|
(directory-content directory))
|
|
|
|
|
directories))
|
|
|
|
|
(names (append names-from-directories
|
|
|
|
|
(remove name-ends-with-/? files))))
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
(mkdir-p #$output)
|
2020-10-25 16:59:19 +00:00
|
|
|
|
(if (every file-exists? names)
|
|
|
|
|
(begin
|
|
|
|
|
(for-each (lambda (name)
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
(symlink-to name #$output
|
2020-10-25 16:59:19 +00:00
|
|
|
|
(if (name-is-store-entry? name)
|
|
|
|
|
strip-store-file-name
|
|
|
|
|
basename)))
|
|
|
|
|
names)
|
|
|
|
|
#t)
|
|
|
|
|
#f)))))
|
|
|
|
|
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
(gexp->derivation "efi-bootloader-profile"
|
2020-10-25 16:59:19 +00:00
|
|
|
|
build
|
|
|
|
|
#:local-build? #t
|
|
|
|
|
#:substitutable? #f
|
|
|
|
|
#:properties
|
|
|
|
|
`((type . profile-hook)
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
(hook . efi-bootloader-profile-hook))))
|
2020-10-25 16:59:19 +00:00
|
|
|
|
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
(profile (content (packages->manifest packages))
|
|
|
|
|
(name "efi-bootloader-profile")
|
|
|
|
|
(hooks (cons efi-bootloader-profile-hook hooks))
|
2020-10-25 16:59:19 +00:00
|
|
|
|
(locales? #f)
|
|
|
|
|
(allow-collisions? #f)
|
|
|
|
|
(relative-symlinks? #f)))
|
|
|
|
|
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
(define* (efi-bootloader-chain final-bootloader
|
2020-10-25 16:59:19 +00:00
|
|
|
|
#:key
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
(packages '())
|
|
|
|
|
(files '())
|
2020-11-07 21:15:53 +00:00
|
|
|
|
(hooks '())
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
installer
|
|
|
|
|
disk-image-installer)
|
|
|
|
|
"Define a chain of bootloaders with the FINAL-BOOTLOADER, optional PACKAGES,
|
|
|
|
|
and optional directories and files from the store given in the list of FILES.
|
2020-10-25 16:59:19 +00:00
|
|
|
|
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
The package of the FINAL-BOOTLOADER and all PACKAGES and FILES will be placed
|
|
|
|
|
in an efi-bootloader-profile, which will be passed to the INSTALLER.
|
|
|
|
|
|
|
|
|
|
FILES may contain file-like objects produced by procedures like plain-file,
|
|
|
|
|
local-file, etc., or package contents produced with file-append.
|
2020-10-25 16:59:19 +00:00
|
|
|
|
|
|
|
|
|
If a directory name in FILES ends with '/', then the directory content instead
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
of the directory itself will be symlinked into the efi-bootloader-profile.
|
2020-10-25 16:59:19 +00:00
|
|
|
|
|
2020-11-07 21:15:53 +00:00
|
|
|
|
The procedures in the HOOKS list can be used to further modify the bootloader
|
|
|
|
|
profile. It is possible to pass a single function instead of a list.
|
2020-10-25 16:59:19 +00:00
|
|
|
|
|
gnu: bootloader: Rework chaining, add grub-efi-netboot-removable-bootloader.
This rework allows to use an (efi-bootloader-chain) like this, which is able
to boot over network or local storage, depending on whether the bootloader
target has support for symbolic links:
(operating-system
(bootloader
(bootloader-configuration
(bootloader
(efi-bootloader-chain
grub-efi-netboot-removable-bootloader
#:packages (list my-firmware-package
my-u-boot-package)
#:files (list (plain-file "config.txt"
"kernel=u-boot.bin"))
#:hooks my-special-bootloader-profile-manipulator))
(targets '("/booti/efi"))
…))
…)
* doc/guix.texi (Bootloader Configuration): Describe the new
‘grub-efi-netboot-removable-bootloader’. Mention the file names used and that
the UEFI Boot Manager is not modified. Advise to disable write-access over
TFTP.
* gnu/bootloader.scm (efi-bootloader-profile): Allow a list of packages and
collect everything directly in the profile, avoiding a separate collection
directory. Renamed the profile from "bootloader-profile" to
"efi-bootloader-profile".
[bootloader-collection]: Rename to...
[efi-bootloader-profile-hook]: ... this and remove unused modules. Do not
create the now extraneous collection directory.
(efi-bootloader-chain): Add PACKAGES and DISK-IMAGE-INSTALLER arguments.
Remove handling of the collection directory, now only calling the given
installer procedure.
* gnu/bootloader/grub.scm (make-grub-efi-netboot-installer): New helper.
(make-grub-configuration): New helper based on (grub-configuration-file). Add
a GRUB argument, fix indentation, remove previous code retrieving GRUB from
CONFIG.
(grub-configuration-file): Make use of make-grub-configuration.
(grub-efi-configuration-file): New procedure.
(grub-cfg): New variable to replace "/boot/grub/grub.cfg".
(install-grub-efi-netboot): Remove, splitting logic to...
(make-grub-efi-netboot-installer): ... this new helper procedure, as well as
to make-grub-efi-netboot, added below.
(grub-bootloader): Adjust to use the GRUB-CFG.
(grub-efi-bootloader): Likewise. Removed inheritance and declare all fields
explicitly.
(make-grub-efi-netboot-bootloader): New procedure.
(grub-efi-netboot-bootloader): Use it.
(grub-efi-netboot-removable-bootloader): New variable.
* gnu/packages/bootloaders.scm (make-grub-efi-netboot): New procedure.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-12-01 00:59:09 +00:00
|
|
|
|
If the INSTALLER argument is used, then this gexp procedure will be called to
|
|
|
|
|
install the efi-bootloader-profile. Otherwise the installer of the
|
|
|
|
|
FINAL-BOOTLOADER will be called.
|
|
|
|
|
|
|
|
|
|
If the DISK-IMAGE-INSTALLER is used, then this gexp procedure will be called
|
|
|
|
|
to install the efi-bootloader-profile into a disk image. Otherwise the
|
|
|
|
|
disk-image-installer of the FINAL-BOOTLOADER will be called."
|
|
|
|
|
(bootloader
|
|
|
|
|
(inherit final-bootloader)
|
|
|
|
|
(name "efi-bootloader-chain")
|
|
|
|
|
(package
|
|
|
|
|
(efi-bootloader-profile (cons (bootloader-package final-bootloader)
|
|
|
|
|
packages)
|
|
|
|
|
files
|
|
|
|
|
(if (list? hooks)
|
|
|
|
|
hooks
|
|
|
|
|
(list hooks))))
|
|
|
|
|
(installer
|
|
|
|
|
(or installer
|
|
|
|
|
(bootloader-installer final-bootloader)))
|
|
|
|
|
(disk-image-installer
|
|
|
|
|
(or disk-image-installer
|
|
|
|
|
(bootloader-disk-image-installer final-bootloader)))))
|