[PATCH 00/15] Rewrite bootloader subsystem.

  • Open
  • quality assurance status badge
Details
6 participants
  • amano.kenji
  • Herman Rimm
  • Lilah Tascheter
  • Marek Pa?nikowski
  • Sergey Trofimov
  • Tomas Volf
Owner
unassigned
Submitted by
Lilah Tascheter
Severity
normal
Blocked by
L
L
Lilah Tascheter wrote on 4 Aug 05:50 +0200
(address . guix-patches@gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
cover.1722741997.git.lilah@lunabee.space
Months in the making! Requires patchset #69343 "Simplify bootloader data
structures and procedures", to be regarded less of a blocker and more of a
conjoined patchset.

This is a massive rewrite to the entire way Guix handles bootloaders. Guix
currently ad-hocs non-GRUB support on top of a layer that was designed for GRUB
and nothing else. Big features enabled by this patchset include:

* Multiple separate bootloaders! This takes over the previous multi-target
functionality used in RAID systems, as well as the previous abuse of the GRUB
bootloader on Raspberry Pis when trying to chainload GRUB through EFI provided
by U-Boot.
* Multiple distinct bootloader targets! Some bootloaders need more than just a
single target, such as p-boot, which requires both a data target and a
configuration partition.
* Proper disk image support! Now every bootloader will be able to be dynamically
installed to disk images, without any special support.
* Support for bootloaders without configuration-file semantics! The install
process is now much more generalized and no longer assumes bootloaders have a
configuration file to be installed to a static, unchangable location.
* Proper rollback support! No longer just guesses at a bootloader-configuration
when doing rollbacks, which prevented significant configuration from being
done.
* The ability to specify either no bootloader or a bootloader without any
targets, for situations in which it doesn't make sense (eg qemu images and
disk images, respectively).
* A more robust target system allowing any bootloader to be able to transform
the user-specified target into a mount path, device-relative path, device
file, label, or uuid.

In addition, these changes allow the uki-efi-bootloader to be added, providing
secure boot support and the ability to boot Guix from EFI without another
bootloader intermediary.

This should make adding new types of bootloaders way easier in the future as
well. Especially EFI bootloaders, since the entire EFI install process is now
abstracted away, so specific bootloaders don't have to worry about setting
efivars or the limited ESP space.



The big thing is that this definately needs to be tested. We support lots of
bootloaders for lots of hardware and I definately do not possess any of it.
Please test this and send back the results for me to revise any bugs. I've made
sure as many tests as I could run work, and that GRUB and uefi-uki-bootloader
work both in regular systems and disk images.

Lilah Tascheter (15):
guix: scripts: Rewrite reinstall-bootloader to use provenance data.
gnu: Add bootloader target infastructure.
guix: scripts: Remove unused code.
gnu: Core bootloader changes.
gnu: system: Remove useless boot parameters.
gnu: bootloader: Add raspberry pi bootloader.
gnu: system: Fix bootloader crypto device recognition.
gnu: packages: Add pesign.
gnu: packages: Add ukify.
gnu: packages: Add systemd-stub.
gnu: bootloaders: Add uki-efi-bootloader.
gnu: system: Update examples.
doc: Update bootloader documentation.
gnu: tests: Update tests to new targets system.
teams: Add bootloading team.

doc/guix.texi | 458 +++---
etc/teams.scm | 10 +
gnu/bootloader.scm | 644 ++++++---
gnu/bootloader/depthcharge.scm | 153 +-
gnu/bootloader/extlinux.scm | 149 +-
gnu/bootloader/grub.scm | 1279 +++++++----------
gnu/bootloader/u-boot.scm | 505 +++----
gnu/bootloader/uki.scm | 96 ++
gnu/build/bootloader.scm | 157 +-
gnu/build/image.scm | 40 +-
gnu/build/install.scm | 16 +-
gnu/image.scm | 3 +
gnu/installer/parted.scm | 12 +-
gnu/local.mk | 1 +
gnu/machine/ssh.scm | 71 +-
gnu/packages/bootloaders.scm | 277 ++--
gnu/packages/efi.scm | 47 +
gnu/packages/raspberry-pi.scm | 18 -
gnu/services/virtualization.scm | 11 +-
gnu/system.scm | 61 +-
gnu/system/boot.scm | 16 +-
gnu/system/examples/asus-c201.tmpl | 6 +-
gnu/system/examples/bare-bones.tmpl | 7 +-
gnu/system/examples/bare-hurd.tmpl | 4 +-
gnu/system/examples/beaglebone-black.tmpl | 6 +-
gnu/system/examples/desktop.tmpl | 4 +-
gnu/system/examples/docker-image.tmpl | 6 +-
gnu/system/examples/lightweight-desktop.tmpl | 4 +-
gnu/system/examples/plasma.tmpl | 4 +-
.../examples/raspberry-pi-64-nfs-root.tmpl | 23 +-
gnu/system/examples/raspberry-pi-64.tmpl | 18 +-
gnu/system/examples/vm-image.tmpl | 5 +-
gnu/system/hurd.scm | 4 +-
gnu/system/image.scm | 162 ++-
gnu/system/images/hurd.scm | 4 +-
gnu/system/images/novena.scm | 3 +-
.../images/orangepi-r1-plus-lts-rk3328.scm | 3 +-
gnu/system/images/pine64.scm | 3 +-
gnu/system/images/pinebook-pro.scm | 3 +-
gnu/system/images/rock64.scm | 3 +-
gnu/system/images/unmatched.scm | 3 +-
gnu/system/images/visionfive2.scm | 3 +-
gnu/system/images/wsl2.scm | 14 +-
gnu/system/install.scm | 43 +-
gnu/system/vm.scm | 11 -
gnu/tests.scm | 4 +-
gnu/tests/ganeti.scm | 4 +-
gnu/tests/image.scm | 4 +-
gnu/tests/install.scm | 80 +-
gnu/tests/nfs.scm | 4 +-
gnu/tests/reconfigure.scm | 86 +-
gnu/tests/telephony.scm | 4 +-
gnu/tests/vnc.scm | 4 +-
guix/scripts/system.scm | 161 +--
guix/scripts/system/reconfigure.scm | 159 +-
guix/ui.scm | 8 +
tests/boot-parameters.scm | 16 +-
57 files changed, 2371 insertions(+), 2533 deletions(-)
create mode 100644 gnu/bootloader/uki.scm


base-commit: 7d781027c78bdea5fdb3f1c9c9ec432b9606d2b5
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 01/15] guix: scripts: Rewrite reinstall-bootloader to use provenance data.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
6d8a2015a9e54642e3ecf0f7d1d95300496cbbde.1722741997.git.lilah@lunabee.space
The current implementation is broken anyway. Multiple bootloaders share
a name (including both versions of extlinux) and
bootloader-configuration data is significant to bootloader installation.
It shouldn't be just faked.

Rely on the provenance service instead, which while not always present,
should be for the vast majority of systems.

* guix/scripts/system.scm (reinstall-bootloader): Rename to...
(install-bootloader-from-provenance): ...this, and rewrite to extract
bootloader-configuration data from system provenance.

(switch-to-system-generation, process-command): Use
install-bootloader-from-provenance.

Change-Id: I5713a43ad4f9f32a129d980db06d70de16b03f27
---
guix/scripts/system.scm | 75 ++++++++++++++---------------------------
1 file changed, 25 insertions(+), 50 deletions(-)

Toggle diff (107 lines)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 0f7d864e06..bb7b5d37bf 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -88,6 +88,7 @@ (define-module (guix scripts system)
#:use-module (srfi srfi-37)
#:use-module (ice-9 format)
#:use-module (ice-9 match)
+ #:use-module (ice-9 receive)
#:use-module (rnrs bytevectors)
#:export (guix-system
read-operating-system
@@ -377,60 +378,33 @@ (define (switch-to-system-generation store spec)
(activate (string-append generation "/activate")))
(if number
(begin
- (reinstall-bootloader store number)
+ (install-bootloader-from-provenance store number)
(switch-to-generation* %system-profile number)
(unless-file-not-found (primitive-load activate)))
(leave (G_ "cannot switch to system generation '~a'~%") spec))))
-(define* (system-bootloader-name #:optional (system %system-profile))
- "Return the bootloader name stored in SYSTEM's \"parameters\" file."
- (let ((params (unless-file-not-found
- (read-boot-parameters-file system))))
- (boot-parameters-bootloader-name params)))
-
-(define (reinstall-bootloader store number)
- "Re-install bootloader for existing system profile generation NUMBER.
-STORE is an open connection to the store."
+(define (install-bootloader-from-provenance store number)
+ "Re-install an old bootloader using provenance data for system profile
+generation NUMBER with store STORE."
(let* ((generation (generation-file-name %system-profile number))
- ;; Detect the bootloader used in %system-profile.
- (bootloader (lookup-bootloader-by-name (system-bootloader-name)))
-
- ;; Use the detected bootloader with default configuration.
- ;; It will be enough to allow the system to boot.
- (bootloader-config (bootloader-configuration
- (bootloader bootloader)))
-
- ;; Make the specified system generation the default entry.
- (chosen-alternative (generation->boot-alternative
- %system-profile number))
- (params (boot-alternative-parameters chosen-alternative))
- (locale (boot-parameters-locale params))
- (store-crypto-devices (boot-parameters-store-crypto-devices params))
- (store-directory-prefix
- (boot-parameters-store-directory-prefix params))
- (old-generations
- (delv number (reverse (generation-numbers %system-profile))))
- (previous-boot-alternatives (profile->boot-alternatives
- %system-profile old-generations))
- (entries (list (boot-parameters->menu-entry params)))
- (old-entries (map boot-parameters->menu-entry
- (map boot-alternative-parameters
- previous-boot-alternatives))))
- (run-with-store store
- (mlet* %store-monad
- ((bootcfg (lower-object
- ((bootloader-configuration-file-generator bootloader)
- bootloader-config entries
- #:locale locale
- #:store-crypto-devices store-crypto-devices
- #:store-directory-prefix store-directory-prefix
- #:old-entries old-entries)))
- (drvs -> (list bootcfg)))
- (mbegin %store-monad
- (built-derivations drvs)
- ;; Only install bootloader configuration file.
- (install-bootloader local-eval bootloader-config bootcfg
- #:run-installer? #f))))))
+ (os (receive (_ os) (system-provenance generation)
+ (and=> os read-operating-system)))
+ (bootloader-config (operating-system-bootloader os))
+ (bootloader (bootloader-configuration-bootloader bootloader-config))
+ (numbers (delv number (reverse (generation-numbers %system-profile))))
+ (old (profile->boot-alternatives %system-profile numbers)))
+ (if os
+ (run-with-store store
+ (mlet* %store-monad
+ ((bootcfg (lower-object (operating-system-bootcfg os old)))
+ (drvs -> (list bootcfg)))
+ (mbegin %store-monad
+ (built-derivations drvs)
+ ;; Only install bootloader configuration file.
+ (install-bootloader local-eval bootloader-config bootcfg
+ #:run-installer? #f))))
+ (leave (G_ "cannot rollback to provenanceless generation '~a'~%")
+ number))))
;;;
@@ -1416,7 +1390,8 @@ (define (process-command command args opts)
(x (leave (G_ "wrong number of arguments~%"))))))
(with-store* store
(delete-matching-generations store %system-profile pattern)
- (reinstall-bootloader store (generation-number %system-profile)))))
+ (install-bootloader-from-provenance store
+ (generation-number %system-profile)))))
((switch-generation)
(let ((pattern (match args
((pattern) pattern)
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 02/15] gnu: Add bootloader target infastructure.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
f21ff71c8ceb6735b88bbd0683adad59f704a1de.1722741997.git.lilah@lunabee.space
* gnu/bootloader.scm (bootloader-target): New record.

(&target-error): New condition.

(pathcat, get-target-of-type, parent-of, unfold-pathcat, target-base?,
type-major?, ensure, ensure-target-types, ensure-majors, gbegin):
New procedures.

(define-literal, with-targets, :path, :devpath, :device,
:fs, :label, :uuid): New macros.

(bootloader-modules): Prevent mutual imports.

* guix/ui.scm (call-with-error-handling)[target-error?]:
Handle target-errors.

Change-Id: I3f07c9096dd8b91c04449b6360b3b7d21640da14
---
gnu/bootloader.scm | 212 ++++++++++++++++++++++++++++++++++++++++++++-
guix/ui.scm | 8 ++
2 files changed, 217 insertions(+), 3 deletions(-)

Toggle diff (277 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index f32e90e79d..3ddc112cc6 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -31,10 +31,11 @@ (define-module (gnu bootloader)
#:use-module (guix profiles)
#:use-module (guix records)
#:use-module (guix deprecation)
- #:use-module ((guix ui) #:select (warn-about-load-error))
#:use-module (guix diagnostics)
#:use-module (guix i18n)
+ #:use-module (guix modules)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (ice-9 match)
@@ -63,6 +64,26 @@ (define-module (gnu bootloader)
bootloader-configuration-file
bootloader-configuration-file-generator
+ <bootloader-target>
+ bootloader-target
+ bootloader-target?
+ bootloader-target-type
+ bootloader-target-expected?
+ bootloader-target-path
+ bootloader-target-offset
+ bootloader-target-device
+ bootloader-target-file-system
+ bootloader-target-label
+ bootloader-target-uuid
+
+ target-error?
+ target-error-type
+ target-error-targets
+
+ gbegin
+ :path :devpath :device :fs :label :uuid
+ with-targets
+
bootloader-configuration
bootloader-configuration?
bootloader-configuration-bootloader
@@ -236,6 +257,191 @@ (define-record-type* <bootloader>
(configuration-file bootloader-configuration-file)
(configuration-file-generator bootloader-configuration-file-generator))
+
+;;;
+;;; Bootloader target record.
+;;;
+
+;; <bootloader-target> represents different kinds of targets in a normalized form.
+
+(define-record-type* <bootloader-target>
+ bootloader-target make-bootloader-target bootloader-target?
+ (type bootloader-target-type) ; symbol
+ (expected? bootloader-target-expected? (default #f)) ; bool
+
+ (path bootloader-target-path (default #f)) ; string|#f
+ (offset bootloader-target-offset (thunked) ; symbol|#f
+ (default (and (bootloader-target-path this-record)
+ (not (eq? (bootloader-target-type this-record) 'root))
+ 'root)))
+ (device bootloader-target-device (default #f)) ; string|#f
+ (file-system bootloader-target-file-system (default #f)) ; string|#f
+ (label bootloader-target-label (default #f)) ; string|#f
+ (uuid bootloader-target-uuid (default #f))) ; uuid|#f
+
+(define-condition-type &target-error &error target-error?
+ (type target-error-type)
+ (targets target-error-targets))
+
+(define (pathcat p1 p2)
+ (string-append (string-trim-right p1 #\/) "/" (string-trim p2 #\/)))
+
+(define* (get-target-of-type type targets #:optional (require? #f))
+ "Finds a target in TARGETS of type TYPE, optionally providing an error when
+not found if REQUIRE? is provided."
+ (let* ((pred (lambda (target) (eq? type (bootloader-target-type target))))
+ (candidates (filter pred targets))
+ (ret (if (pair? candidates) (car candidates) #f)))
+ (if (and require? (not ret))
+ (raise (condition
+ (&message (message (G_ "required, but not provided")))
+ (&target-error (type type) (targets targets))))
+ ret)))
+
+(define (parent-of target targets)
+ (and=> (bootloader-target-offset target)
+ (cut get-target-of-type <> targets #t)))
+
+(define (unfold-pathcat target targets)
+ (let ((quit (lambda (t) (not (and=> t bootloader-target-path)))))
+ (reduce pathcat #f
+ (unfold quit bootloader-target-path (cut parent-of <> targets) target))))
+
+(define (target-base? t)
+ (or (not t) (match-record t <bootloader-target>
+ (expected? offset device label uuid)
+ (or device label uuid (not offset) expected?))))
+
+(define (type-major? target) (memq target '(root esp disk)))
+
+(define (ensure types targets end)
+ (let* ((used-in (cute unfold end identity (cut parent-of <> targets) <>))
+ (cons-in (lambda (t) (cons t (used-in t))))
+ (ensure (map (cut get-target-of-type <> targets #t) types)))
+ (filter ->bool (apply append (map cons-in ensure)))))
+
+(define* (ensure-target-types types targets #:optional (base? #f))
+ "Ensures all TYPES are provided in TARGETS. Returns #t iff every ensured
+target and its requirements are fully provided. Errors out when a required TYPE
+isn't provided. When BASE?, only ensure path requirements up to a device."
+ (not (any bootloader-target-expected?
+ (ensure types targets (if base? target-base? not)))))
+
+(define (ensure-majors types targets)
+ "Errors out when a required TYPE isn't provided, or when use of multiple major
+targets is detected."
+ (let* ((all (map bootloader-target-type (ensure types targets target-base?)))
+ (majors (delete-duplicates (filter type-major? all) eq?)))
+ (if (< (length majors) 2) #t
+ (raise (condition (&message (message (G_ "multiple major targets used")))
+ (&target-error (type majors) (targets targets)))))))
+
+
+
+(define (gbegin . gex)
+ "Sequence provided g-expressions."
+ (case (length gex) ((0) #f) ((1) (car gex)) (else #~(begin #$@gex))))
+
+;; syntax matching on free literals breaks easily, so bind them
+(define-syntax-rule (define-literal id) (define-syntax id (syntax-rules ())))
+(define-literal :path)
+(define-literal :devpath)
+(define-literal :device)
+(define-literal :fs)
+(define-literal :label)
+(define-literal :uuid)
+
+(define-syntax with-targets
+ (cut syntax-case <> ()
+ ((_ targets-expr block ...)
+ (let* ((genvars (compose generate-temporaries iota))
+ (targets (car (genvars 1)))
+
+ (path? (cut syntax-case <> (:path) ((_ :path) #t) (_ #f)))
+ (qualified? (cut syntax-case <> (=>)
+ ((_ => spec ...) (any path? #'(spec ...)))
+ (_ #f)))
+
+ (resolve
+ (lambda (in target base)
+ (with-syntax ((target target) (base base) (targets targets))
+ (syntax-case in
+ (:path :devpath :device :fs :label :uuid)
+ ((name _) (not (identifier? #'name))
+ #`(_ (syntax-error "binds must be to identifiers" #,in)))
+ ((name :device) #'(name (bootloader-target-device base)))
+ ((name :label) #'(name (bootloader-target-label base)))
+ ((name :uuid) #'(name (bootloader-target-uuid base)))
+ ((name :fs) #'(name (bootloader-target-file-system base)))
+ ((name :path) #'(name (unfold-pathcat target targets)))
+ ((name :devpath)
+ #'(name (pathcat "/" (bootloader-target-path target))))
+ (_ #`(_ (syntax-error "invalid binding spec" #,in)))))))
+ (binds
+ (lambda (spec)
+ (syntax-case spec (=>)
+ ((type => binds ...)
+ (with-syntax (((target base) (genvars 2)) (targets targets))
+ (append
+ #`((get (lambda (t) (get-target-of-type t targets #t)))
+ (target (get type))
+ (base (if (target-base? target) target
+ (get (bootloader-target-offset target)))))
+ (map (cut resolve <> #'target #'base) #'(binds ...)))))
+ (_ #f))))
+
+ (blocks
+ (cut syntax-case <> ()
+ ((spec ... expr)
+ (let* ((specs #'(spec ...))
+ (lets (apply append (filter-map binds specs)))
+ (type (cut syntax-case <> (=>)
+ ((t => _ ...) #'t) (t #'t))))
+ (receive (full part) (partition qualified? specs)
+ #`(and (ensure-majors (list #,@(map type specs)) #,targets)
+ (ensure-target-types (list #,@(map type part))
+ #,targets #t)
+ (ensure-target-types (list #,@(map type full))
+ #,targets #f)
+ (let* #,lets expr)))))
+ (bad #'(syntax-error "malformed block" bad)))))
+ "Using the list TARGETS, evaluate and sequence each BLOCK to produce a
+gexp. BLOCK is a set of SPECs followed by an EXPR (evaluating to a gexp). Each
+SPEC denotes a type of target to guard EXPR on their existance and
+full-qualification. This procedure is linear in regards to BLOCKs.
+
+SPEC may be of the following forms:
+@itemize
+@item 'TYPE Requires TYPE to be fully present or promised. Errors otherwise.
+@item ('TYPE => (VAR COMPONENT) ...): As type, but also binds variables. TYPE's
+ COMPONENT is bound to the variable VAR as described below.
+@end itemize
+
+Available COMPONENTs are:
+@itemize
+@item :path (fully-qualified)
+@item :devpath (relative from device)
+@item :device (auto-detected from uuid and label if not user-provided)
+@item :fs
+@item :label
+@item :uuid
+@end itemize
+
+Note that installers may be called multiple times with different targets being
+fully-qualified. To ensure that targets aren't installed multiple times, make sure
+that each BLOCK ensures at least one major target, either directly or indirectly.
+Corrolarily, at most one major target should be ensured per BLOCK, under the same
+conditions. Major targets originate from disk image handling, and are currently:
+@itemize
+@item disk
+@item root
+@item esp
+@end itemize"
+ #`(let ((#,targets targets-expr))
+ (apply gbegin (filter ->bool
+ (list #,@(map blocks #'(block ...))))))))
+ (bad #'(syntax-error "must provide targets" bad))))
+
;;;
;;; Bootloader configuration record.
@@ -305,10 +511,10 @@ (define (bootloader-configuration-targets config)
(define (bootloader-modules)
"Return the list of bootloader modules."
+ ;; don't provide #:warn to prevent mutual imports
(all-modules (map (lambda (entry)
`(,entry . "gnu/bootloader"))
- %load-path)
- #:warn warn-about-load-error))
+ %load-path)))
(define %bootloaders
;; The list of publically-known bootloaders.
diff --git a/guix/ui.scm b/guix/ui.scm
index 9db6f6e9d7..1c9300c9eb 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -36,6 +36,8 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix ui)
+ #:use-module ((gnu bootloader)
+ #:select (target-error? target-error-type target-error-targets))
#:use-module (guix i18n)
#:use-module (guix colors)
#:use-module (guix diagnostics)
@@ -857,6 +859,12 @@ (define (call-with-error-handling thunk)
(invoke-error-stop-signal c)
(cons (invoke-error-program c)
(invoke-error-arguments c))))
+ ((target-error? c)
+ (leave (G_ "bootloader-target '~a'~@[: ~a~] ~
+ among the following targets:~%~{~y~}")
+ (target-error-type c)
+ (and (message-condition? c) (condition-message c))
+ (target-error-targets c)))
((formatted-message? c)
(apply report-error
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 03/15] guix: scripts: Remove unused code.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
a70ac840abad3539f6d542341598d50172f7a0b1.1722741997.git.lilah@lunabee.space
* guix/scripts/system.scm (bootloader-installer-script): Delete.

Change-Id: Ic1e0a523c814e4f1bf44b2721f5658f00066b0ab
---
guix/scripts/system.scm | 22 ----------------------
1 file changed, 22 deletions(-)

Toggle diff (35 lines)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index bb7b5d37bf..344bb74151 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -731,28 +731,6 @@ (define (maybe-suggest-running-guix-pull)
(warning (G_ "Consider running 'guix pull' before 'reconfigure'.~%"))
(warning (G_ "Failing to do that may downgrade your system!~%"))))
-(define (bootloader-installer-script installer
- bootloader device target)
- "Return a file calling INSTALLER gexp with given BOOTLOADER, DEVICE
-and TARGET arguments."
- (scheme-file "bootloader-installer"
- (with-imported-modules '((gnu build bootloader)
- (guix build utils))
- #~(begin
- (use-modules (gnu build bootloader)
- (guix build utils)
- (ice-9 binary-ports)
- (srfi srfi-34)
- (srfi srfi-35))
-
- (guard (c ((message-condition? c) ;XXX: i18n
- (format (current-error-port) "error: ~a~%"
- (condition-message c))
- (exit 1)))
- (#$installer #$bootloader #$device #$target)
- (info (G_ "bootloader successfully installed on '~a'~%")
- #$device))))))
-
(define (local-eval exp)
"Evaluate EXP, a G-Expression, in-place."
(mlet* %store-monad ((lowered (lower-gexp exp))
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 05/15] gnu: system: Remove useless boot parameters.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
74d8f8ec6ba3b49562bb339dd736f3ddb10f9400.1722741997.git.lilah@lunabee.space
* gnu/system.scm (operating-system-boot-parameters,
operating-system-boot-parameters-file): Delete
bootloader-menu-entries.

* gnu/system/boot.scm (boot-parameters)[bootloader-menu-entries]: Delete
fields.
(read-boot-parameters): Don't read bootloader-menu-entries.

* tests/boot-parameters.scm (%grub-boot-parameters,
test-read-boot-parameters, test-read-boot-parameters): Don't include
bootloader-menu-entries.
("read, bootloader-menu-entries, default value"): Delete test.

Change-Id: I46d9cff4604dbfcf654b0820fdb77e72aecffbb4
---
gnu/system.scm | 7 -------
gnu/system/boot.scm | 8 --------
tests/boot-parameters.scm | 14 ++------------
3 files changed, 2 insertions(+), 27 deletions(-)

Toggle diff (120 lines)
diff --git a/gnu/system.scm b/gnu/system.scm
index a345b52d55..66c1a80733 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1304,8 +1304,6 @@ (define* (operating-system-boot-parameters os root-device
(initrd initrd)
(multiboot-modules multiboot-modules)
(bootloader-name bootloader-name)
- (bootloader-menu-entries
- (bootloader-configuration-menu-entries (operating-system-bootloader os)))
(locale locale)
(store-device (ensure-not-/dev (file-system-device store)))
(store-directory-prefix (btrfs-store-subvolume-file-name file-systems))
@@ -1347,11 +1345,6 @@ (define* (operating-system-boot-parameters-file os)
#$(boot-parameters-multiboot-modules params)))
#~())
(bootloader-name #$(boot-parameters-bootloader-name params))
- (bootloader-menu-entries
- #$(map menu-entry->sexp
- (or (and=> (operating-system-bootloader os)
- bootloader-configuration-menu-entries)
- '())))
(locale #$(boot-parameters-locale params))
(store
(device
diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm
index 2b5302ce5f..4d89827ced 100644
--- a/gnu/system/boot.scm
+++ b/gnu/system/boot.scm
@@ -54,7 +54,6 @@ (define-module (gnu system boot)
boot-parameters-label
boot-parameters-root-device
boot-parameters-bootloader-name
- boot-parameters-bootloader-menu-entries
boot-parameters-store-crypto-devices
boot-parameters-store-device
boot-parameters-store-directory-prefix
@@ -113,8 +112,6 @@ (define-record-type* <boot-parameters>
;; partition.
(root-device boot-parameters-root-device)
(bootloader-name boot-parameters-bootloader-name)
- (bootloader-menu-entries ;list of <menu-entry>
- boot-parameters-bootloader-menu-entries)
(store-device boot-parameters-store-device)
(store-mount-point boot-parameters-store-mount-point)
(store-directory-prefix boot-parameters-store-directory-prefix)
@@ -176,11 +173,6 @@ (define (read-boot-parameters port)
((_ args) (list args))
(#f 'grub))) ; for compatibility reasons.
- (bootloader-menu-entries
- (match (assq 'bootloader-menu-entries rest)
- ((_ entries) (map sexp->menu-entry entries))
- (#f '())))
-
;; In the past, we would store the directory name of linux instead of
;; the absolute file name of its image. Detect that and correct it.
(kernel (if (string=? kernel (direct-store-path kernel))
diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm
index 2e7976aa6c..f214de360d 100644
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -64,7 +64,6 @@ (define %root-path "/")
(define %grub-boot-parameters
(boot-parameters
(bootloader-name 'grub)
- (bootloader-menu-entries '())
(root-device %default-root-device)
(label %default-label)
(kernel %default-kernel)
@@ -107,7 +106,6 @@ (define* (test-read-boot-parameters
#:key
(version %boot-parameters-version)
(bootloader-name 'grub)
- (bootloader-menu-entries '())
(label %default-label)
(root-device (quote-uuid %default-root-device))
(kernel %default-kernel)
@@ -127,7 +125,7 @@ (define* (test-read-boot-parameters
(cond ((eq? 'false val) (format #false fmt #false))
(val (format #false fmt val))
(else "")))
- (format #false "(boot-parameters~a~a~a~a~a~a~a~a~a~a)"
+ (format #false "(boot-parameters~a~a~a~a~a~a~a~a~a)"
(sexp-or-nothing " (version ~S)" version)
(sexp-or-nothing " (label ~S)" label)
(sexp-or-nothing " (root-device ~S)" root-device)
@@ -145,9 +143,7 @@ (define* (test-read-boot-parameters
store-crypto-devices))
"")
(sexp-or-nothing " (locale ~S)" locale)
- (sexp-or-nothing " (bootloader-name ~a)" bootloader-name)
- (sexp-or-nothing " (bootloader-menu-entries ~S)"
- bootloader-menu-entries)))
+ (sexp-or-nothing " (bootloader-name ~a)" bootloader-name)))
(let ((str (generate-boot-parameters)))
(call-with-input-string str read-boot-parameters)))
@@ -170,7 +166,6 @@ (define* (test-read-boot-parameters
(test-assert "read, construction, optional fields"
(and (test-read-boot-parameters #:bootloader-name #false)
- (test-read-boot-parameters #:bootloader-menu-entries #false)
(test-read-boot-parameters #:kernel-arguments #false)
(test-read-boot-parameters #:with-store #false)
(test-read-boot-parameters #:store-device #false)
@@ -223,11 +218,6 @@ (define* (test-read-boot-parameters
(boot-parameters-bootloader-name
(test-read-boot-parameters #:bootloader-name #false)))
-(test-eq "read, bootloader-menu-entries, default value"
- '()
- (boot-parameters-bootloader-menu-entries
- (test-read-boot-parameters #:bootloader-menu-entries #false)))
-
(test-eq "read, kernel-arguments, default value"
'()
(boot-parameters-kernel-arguments
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 04/15] gnu: Core bootloader changes.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
72fc11d9e6fe8b32a2afccd684371bacbb5a24b8.1722741997.git.lilah@lunabee.space
Sorry this is a massive commit. It's kinda impossible to split it without
either completely breaking basic functionality or making a buggy shim
layer that's written just to be immediately removed.

But, anyway, this is the real body of the bootloader subsystem update.
One of my favorite new things possible with this is easy generation of
disk images using arbitrary bootloaders, including ones that require one
or more data/install partitions (such as p-boot or depthcharge)!

* gnu/bootloader.scm (menu-entry): Add device-subvol field.
(menu-entry->sexp, sexp->menu-entry): Support device-subvol.
(normalize-file, warn-update-targets, target-overrides, normalize,
bootloader-configuration->gexp, bootloader-configurations->gexps,
efi-arch, install-efi):
New procedures.
(bootloader): Rewrite record.
(bootloader-configuration)[target]: Remove deprecated field.
[targets]: Include sanitizer and allow multiple bootloaders.
[terminal-outputs, terminal-inputs]: Don't assume grub.
[efi-removable?, 32bit?]: New fields.
(warn-target-field-deprecation): Delete deprecation warning.
(%bootloaders): Delete variable.
(bootloader-configuration-target, bootloader-configuration-targets,
lookup-bootloader-by-name, bootloader-modules, efi-bootloader-profile,
efi-bootloader-chain): Delete procedures.

* gnu/bootloader/depthcharge.scm, gnu/bootloader/extlinux.scm,
gnu/bootloader/grub.scm, gnu/bootloader/u-boot.scm: Rewrite entirely.

* gnu/build/bootloader.scm (parse-bootnums): New variable.
(atomic-copy, in-temporary-directory, efi-bootnums): New procedures.
(install-efi-loader): Delete procedure.
(install-efi): Rewrite to support installation of any efi bootloader.

* gnu/build/image.scm (initialize-efi32-partition: Deprecate.
(initialize-efi-partitition): Only create EFI directory.
(initialize-root-partition): Don't install bootloader here.
(make-iso9660-image): Pull in grub.dir instead of a bootcfg.

* gnu/build/install.scm (install-boot-config): Delete procedure.

* gnu/image.scm (partition)[target]: New field in order to support
dynamic provision of image partitions as bootloader targets.

* gnu/installer/parted.scm (bootloader-configuration),
gnu/machine/ssh.scm (deploy-managed-host) (roll-back-managed-host):
Use new bootloader system.

* gnu/packages/bootloaders.scm (make-grub-efi-netboot): Delete
procedure.

* gnu/packages/raspberry-pi.scm (grub-efi-bootloader-chain-raspi-64):
Delete procedure. Can be recreated with a raspberry pi bootloader
combined with grub-efi.

* gnu/system.scm (convert-bootloader-field): New procedure.
(operating-system)[bootloader]: Use above sanitizer and support
multiple bootloaders.
(operating-system-bootcfg): Rename to...
(operating-system-bootmeta): ...this. Rewrite to return relavent
information instead of calling the config procedure directly.
(operating-system-boot-parameters): Support multiple bootloaders.

* gnu/system/boot.scm (read-boot-parameters): Support multiple
bootloaders.
(boot-parameters->menu-entry): Support device-subvol.
(boot-alternative->menu-entry): New procedure.

* gnu/system/image.scm (root-partition, esp-partition): Use target field.
(esp32-partition, efi32-disk-partition, efi32-raw-image-type): Deprecate.
(root-partition-index): Delete procedure.
(system-disk-image, system-iso9960-image): Support new bootloader system.
(system-disk-image)[targets]: New subprocedure.

* gnu/system/images/hurd.scm (hurd-barebones-os)[bootloader],
gnu/system/images/novena.scm (novena-barebones-os)[bootloader],
gnu/system/images/orangepi-r1-plus-lts-rk3328.scm
(orangepi-r1-plus-lts-rk3328-barebones-os)[bootloader],
gnu/system/images/pine64.scm (pine64-barebones-os)[bootloader],
gnu/system/images/pinebook-pro.scm
(pinebook-pro-barebones-os)[bootloader],
gnu/system/images/rock64.scm (rock64-barebones-os)[bootloader],
gnu/system/images/unmatched.scm (unmatched-barebones-os)[bootloader],
gnu/system/images/visionfive2.scm
(visionfive2-barebones-os)[bootloader]: Use new target format.

* gnu/system/images/wsl2.scm (dummy-bootloader): Delete variable.
(wsl-os)[bootloader]: Don't provide field.

* gnu/system/install.scm (installation-os)[bootloader]: Use new format.
(os-with-u-boot): Delete procedure.
(embedded-installation-os)[bootloader]: Use new format.
(beaglebone-black-installation-os, a20-olinuxino-lime-installation-os,
a20-olinuxino-lime2-emmc-installation-os,
a20-olinuxino-micro-installation-os, bananapi-m2-ultra-installation-os,
firefly-rk3399-installation-os, mx6cuboxi-installation-os,
novena-installation-os, nintendo-nes-classic-edition-installation-os,
orangepi-r1-plus-lts-rk3328-installation-os, pine64-plus-installation-os,
pinebook-installation-os, rock64-installation-os,
rockpro64-installation-os, rk3399-puma-installation-os,
wandboard-installation-os): Don't guess block device.

* gnu/system/vm.scm (virtualized-operating-system): Don't provide
bootloader.

* gnu/tests/install.scm (%minimal-extlinux-os)[bootloader]: Use proper
extlinux variable.
(%btrfs-raid10-root-os): Use multiple bootloaders.

* gnu/tests/reconfigure.scm (%test-install-bootloader): Delete variable.
(run-install-bootloader-test): Delete procedure.

* guix/scripts/system.scm (install, install-bootloader-from-provenance,
perform-action): Support multiple bootloaders and work with new
bootloader system instead of bootcfgs.
(display-system-generation): Support multiple bootloaders.

* guix/scripts/system/reconfigure.scm (install-bootloader-program):
Rewrite to simply insert each bootloader's installer in the gexp
directly, instead of copying bootcfgs.
(install-bootloader): Work with new bootloader system. Just in case,
add install-bootloader.scm to the gc roots too.

Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739
---
gnu/bootloader.scm | 424 +++---
gnu/bootloader/depthcharge.scm | 153 +-
gnu/bootloader/extlinux.scm | 149 +-
gnu/bootloader/grub.scm | 1279 +++++++----------
gnu/bootloader/u-boot.scm | 439 ++----
gnu/build/bootloader.scm | 157 +-
gnu/build/image.scm | 40 +-
gnu/build/install.scm | 16 +-
gnu/image.scm | 3 +
gnu/installer/parted.scm | 12 +-
gnu/machine/ssh.scm | 71 +-
gnu/packages/bootloaders.scm | 86 --
gnu/packages/raspberry-pi.scm | 18 -
gnu/system.scm | 45 +-
gnu/system/boot.scm | 8 +-
gnu/system/image.scm | 162 ++-
gnu/system/images/hurd.scm | 4 +-
gnu/system/images/novena.scm | 3 +-
.../images/orangepi-r1-plus-lts-rk3328.scm | 3 +-
gnu/system/images/pine64.scm | 3 +-
gnu/system/images/pinebook-pro.scm | 3 +-
gnu/system/images/rock64.scm | 3 +-
gnu/system/images/unmatched.scm | 3 +-
gnu/system/images/visionfive2.scm | 3 +-
gnu/system/images/wsl2.scm | 14 +-
gnu/system/install.scm | 43 +-
gnu/system/vm.scm | 11 -
gnu/tests/install.scm | 10 +-
gnu/tests/reconfigure.scm | 86 +-
guix/scripts/system.scm | 88 +-
guix/scripts/system/reconfigure.scm | 159 +-
31 files changed, 1410 insertions(+), 2088 deletions(-)

Toggle diff (299 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 3ddc112cc6..2bb13437dc 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
;;; Copyright © 2022 Reza Alizadeh Majd <r.majd@pantherx.org>
;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
+;;; Copyright © 2024 Lilah Tascheter <lilah@lunabee.space>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -24,45 +25,52 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu bootloader)
+ #:autoload (gnu build file-systems)
+ (read-partition-label read-partition-uuid
+ find-partition-by-label find-partition-by-uuid)
+ #:use-module (gnu packages linux)
#:use-module (gnu system file-systems)
#:use-module (gnu system uuid)
- #:use-module (guix discovery)
- #:use-module (guix gexp)
- #:use-module (guix profiles)
- #:use-module (guix records)
+ #:autoload (guix build syscalls)
+ (mounts mount-source mount-point mount-type)
#:use-module (guix deprecation)
#:use-module (guix diagnostics)
+ #:use-module (guix gexp)
#:use-module (guix i18n)
#:use-module (guix modules)
+ #:use-module (guix profiles)
+ #:use-module (guix records)
+ #:use-module (guix utils)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (ice-9 match)
- #:export (menu-entry
+ #:use-module (ice-9 receive)
+ #:export (<menu-entry>
+ menu-entry
menu-entry?
menu-entry-label
menu-entry-device
+ menu-entry-device-mount-point
+ menu-entry-device-subvol
menu-entry-linux
menu-entry-linux-arguments
menu-entry-initrd
- menu-entry-device-mount-point
menu-entry-multiboot-kernel
menu-entry-multiboot-arguments
menu-entry-multiboot-modules
menu-entry-chain-loader
+ normalize-file
menu-entry->sexp
sexp->menu-entry
bootloader
bootloader?
bootloader-name
- bootloader-package
+ bootloader-default-targets
bootloader-installer
- bootloader-disk-image-installer
- bootloader-configuration-file
- bootloader-configuration-file-generator
<bootloader-target>
bootloader-target
@@ -84,13 +92,15 @@ (define-module (gnu bootloader)
:path :devpath :device :fs :label :uuid
with-targets
+ <bootloader-configuration>
bootloader-configuration
bootloader-configuration?
bootloader-configuration-bootloader
- bootloader-configuration-target ;deprecated
bootloader-configuration-targets
bootloader-configuration-menu-entries
bootloader-configuration-default-entry
+ bootloader-configuration-efi-removable?
+ bootloader-configuration-32bit?
bootloader-configuration-timeout
bootloader-configuration-keyboard-layout
bootloader-configuration-theme
@@ -101,10 +111,11 @@ (define-module (gnu bootloader)
bootloader-configuration-device-tree-support?
bootloader-configuration-extra-initrd
- %bootloaders
- lookup-bootloader-by-name
+ bootloader-configuration->gexp
+ bootloader-configurations->gexp
- efi-bootloader-chain))
+ efi-arch
+ install-efi))
;;;
@@ -119,6 +130,8 @@ (define-record-type* <menu-entry>
(default #f))
(device-mount-point menu-entry-device-mount-point
(default #f))
+ (device-subvol menu-entry-device-subvol
+ (default #f))
(linux menu-entry-linux
(default #f))
(linux-arguments menu-entry-linux-arguments
@@ -135,6 +148,18 @@ (define-record-type* <menu-entry>
(chain-loader menu-entry-chain-loader
(default #f))) ; string, path of efi file
+(define (normalize-file entry val)
+ "Normalize a file VAL stored in a menu entry into one suitable for a
+bootloader. Realizes device-mount-point and device-subvol."
+ (match-record entry <menu-entry> (device-mount-point device-subvol)
+ #~(let* ((rel (lambda (s) (substring s (if (string-prefix? "/" s) 1 0))))
+ (file (rel #$val))
+ (subvol (and=> #$device-subvol rel))
+ (mount (and=> #$device-mount-point rel)))
+ (string-append (if subvol (string-append "/" subvol "/") "/")
+ (if (and mount (string-prefix? mount file))
+ (substring file (string-length mount)) file)))))
+
(define (report-menu-entry-error menu-entry)
(raise
(condition
@@ -162,7 +187,7 @@ (define (menu-entry->sexp entry)
`(label ,(file-system-label->string label)))
(_ device)))
(match entry
- (($ <menu-entry> label device mount-point
+ (($ <menu-entry> label device mount-point subvol
(? identity linux) linux-arguments (? identity initrd)
#f () () #f)
`(menu-entry (version 0)
@@ -171,8 +196,9 @@ (define (menu-entry->sexp entry)
(device-mount-point ,mount-point)
(linux ,linux)
(linux-arguments ,linux-arguments)
- (initrd ,initrd)))
- (($ <menu-entry> label device mount-point #f () #f
+ (initrd ,initrd)
+ (device-subvol ,subvol)))
+ (($ <menu-entry> label device mount-point subvol #f () #f
(? identity multiboot-kernel) multiboot-arguments
multiboot-modules #f)
`(menu-entry (version 0)
@@ -181,19 +207,23 @@ (define (menu-entry->sexp entry)
(device-mount-point ,mount-point)
(multiboot-kernel ,multiboot-kernel)
(multiboot-arguments ,multiboot-arguments)
- (multiboot-modules ,multiboot-modules)))
- (($ <menu-entry> label device mount-point #f () #f #f () ()
+ (multiboot-modules ,multiboot-modules)
+ (device-subvol ,subvol)))
+ (($ <menu-entry> label device mount-point subvol #f () #f #f () ()
(? identity chain-loader))
`(menu-entry (version 0)
(label ,label)
(device ,(device->sexp device))
(device-mount-point ,mount-point)
- (chain-loader ,chain-loader)))
+ (chain-loader ,chain-loader)
+ (device-subvol ,subvol)))
(_ (report-menu-entry-error entry))))
(define (sexp->menu-entry sexp)
"Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry>
record."
+ ;; XXX: rely on shadowing to support the match ors below
+ (define subvol #f)
(define (sexp->device device-sexp)
(match device-sexp
(('uuid type uuid-string)
@@ -206,35 +236,41 @@ (define (sexp->menu-entry sexp)
('label label) ('device device)
('device-mount-point mount-point)
('linux linux) ('linux-arguments linux-arguments)
- ('initrd initrd) _ ...)
+ ('initrd initrd)
+ (or ('device-subvol subvol _ ...) (_ ...)))
(menu-entry
(label label)
(device (sexp->device device))
(device-mount-point mount-point)
+ (device-subvol subvol)
(linux linux)
(linux-arguments linux-arguments)
(initrd initrd)))
(('menu-entry ('version 0)
('label label) ('device device)
- ('device-mount-point mount-point)
+ ('device-mount-point mount-point) ('device-subvol subvol)
('multiboot-kernel multiboot-kernel)
('multiboot-arguments multiboot-arguments)
- ('multiboot-modules multiboot-modules) _ ...)
+ ('multiboot-modules multiboot-modules)
+ (or ('device-subvol subvol _ ...) (_ ...)))
(menu-entry
(label label)
(device (sexp->device device))
(device-mount-point mount-point)
+ (device-subvol subvol)
(multiboot-kernel multiboot-kernel)
(multiboot-arguments multiboot-arguments)
(multiboot-modules multiboot-modules)))
(('menu-entry ('version 0)
('label label) ('device device)
- ('device-mount-point mount-point)
- ('chain-loader chain-loader) _ ...)
+ ('device-mount-point mount-point) ('device-subvol subvol)
+ ('chain-loader chain-loader)
+ (or ('device-subvol subvol _ ...) (_ ...)))
(menu-entry
(label label)
(device (sexp->device device))
(device-mount-point mount-point)
+ (device-subvol subvol)
(chain-loader chain-loader)))))
@@ -247,15 +283,10 @@ (define (sexp->menu-entry sexp)
;; has to be described by this record.
(define-record-type* <bootloader>
- bootloader make-bootloader
- bootloader?
- (name bootloader-name)
- (package bootloader-package)
- (installer bootloader-installer)
- (disk-image-installer bootloader-disk-image-installer
- (default #f))
- (configuration-file bootloader-configuration-file)
- (configuration-file-generator bootloader-configuration-file-generator))
+ bootloader make-bootloader bootloader?
+ (name bootloader-name)
+ (default-targets bootloader-default-targets (default '()))
+ (installer bootloader-installer))
;;;
@@ -450,28 +481,48 @@ (define-syntax with-targets
;; The <bootloader-configuration> record contains bootloader independant
;; configuration used to fill bootloader configuration file.
-(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)
+(define-with-syntax-properties (warn-update-targets (value properties))
+ (let ((loc (source-properties->location properties)))
+ (define update
+ (match-lambda
+ ((? bootloader-target? target) (cons #f target))
+ ((? string? s) (cons #t (if (string-prefix? "/dev" s)
+ (bootloader-target
+ (type 'disk)
+ (device s))
+ (bootloader-target
+ (type 'esp)
+ (offset 'root)
+ (path s)))))
+ (x (error loc (G_ "invalid target '~a'~%") x))))
+
+ (let* ((updated (map update (if (list? value) value (list value))))
+ (targets (map cdr updated))
+ (types (map bootloader-target-type targets)))
+ ;; XXX: should this be an error?
+ (when (any car updated)
+ (warning loc (G_ "the 'targets' field should now contain \
+<bootloader-target> records. inferring a best guess (this might break!)...~%")))
+ (when (not (eqv? (length types) (length (delete-duplicates types))))
+ (error loc (G_ "the 'targets' field may not contain duplicates~%")))
+ targets)))
(define-record-type* <bootloader-configuration>
bootloader-configuration make-bootloader-configuration
bootloader-configuration?
(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))
+ bootloader-configuration-bootloader) ;<bootloader>
+ (targets boo
This message was truncated. Download the full message here.
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 07/15] gnu: system: Fix bootloader crypto device recognition.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
5e2268ba496538cd8cb619f4e1e03f94ae17f980.1722741997.git.lilah@lunabee.space
* gnu/system.scm (operating-system-bootloader-crypto-devices): Check for
luks-device-mapping-with-options in addition to luks-device-mapping.

Change-Id: Iafc9afe608640b97083c4d559c9240846330472a
---
gnu/system.scm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

Toggle diff (22 lines)
diff --git a/gnu/system.scm b/gnu/system.scm
index 66c1a80733..8926e1b065 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -400,10 +400,11 @@ (define operating-system-bootloader-crypto-devices
(mlambdaq (os) ;to avoid duplicated output
"Return the sources of the LUKS mapped devices specified by UUID."
;; XXX: Device ordering is important, we trust the returned one.
- (let* ((luks-devices (filter (lambda (m)
- (eq? luks-device-mapping
- (mapped-device-type m)))
- (operating-system-boot-mapped-devices os)))
+ (let* ((luks? (lambda (m) (let ((t (mapped-device-type m)))
+ (or (eq? luks-device-mapping t)
+ (eq? luks-device-mapping-with-options t)))))
+ (luks-devices (filter luks?
+ (operating-system-boot-mapped-devices os)))
(uuid-crypto-devices non-uuid-crypto-devices
(partition (compose uuid? mapped-device-source)
luks-devices)))
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 08/15] gnu: packages: Add pesign.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
043696a5b83f37396efe0c49a8fa7e0e2b0ce108.1722741997.git.lilah@lunabee.space
* gnu/packages/efi.scm (pesign): New variable.

Change-Id: I00fcc679d9514c85d508183b9ec7e121e0a814db
---
gnu/packages/efi.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)

Toggle diff (69 lines)
diff --git a/gnu/packages/efi.scm b/gnu/packages/efi.scm
index 499745eba1..417b70d91b 100644
--- a/gnu/packages/efi.scm
+++ b/gnu/packages/efi.scm
@@ -24,8 +24,10 @@ (define-module (gnu packages efi)
#:use-module (gnu packages bash)
#:use-module (gnu packages linux)
#:use-module (gnu packages man)
+ #:use-module (gnu packages nss)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages popt)
#:use-module (gnu packages tls)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
@@ -153,6 +155,51 @@ (define-public sbsigntools
(home-page "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/")
(license license:gpl3+)))
+(define-public pesign
+ (package
+ (name "pesign")
+ (version "116")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/rhboot/pesign")
+ (commit version)))
+ (snippet #~(substitute* "Make.defaults"
+ (("pkg-config-ccldflags") "pkg-config-ldflags")))
+ (modules '((guix build utils)))
+ (sha256
+ (base32
+ "0fnqfiivj46bha4hsnwiqy8vq8b4i3w2dig0h9h2k4j7yq7r5qvj"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list #:tests? #f
+ #:modules '((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 match))
+ #:phases #~(modify-phases %standard-phases (delete 'configure))
+ #:make-flags
+ (let ((system (%current-system)) (target (%current-target-system)))
+ (define (arch s) (match (string-split s #\-)
+ (("i386" _ ...) "ia32")
+ (("i486" _ ...) "ia32")
+ (("i586" _ ...) "ia32")
+ (("i686" _ ...) "ia32")
+ ((x _ ...) x)))
+ #~(list "prefix=/" "libdir=/lib/"
+ (string-append "DESTDIR=" #$output)
+ (string-append "HOSTARCH=" #$(arch system))
+ (string-append "ARCH=" #$(arch (or target system)))
+ (string-append "CROSS_COMPILE="
+ #$@(if target (list target "-gcc") '()))))))
+ (inputs (list efivar nspr nss popt `(,util-linux "lib")))
+ (native-inputs (list mandoc pkg-config))
+ (synopsis "PE-COFF binary signing tools")
+ (description "Supports EFI keygen and subsequent signing of PE-COFF
+binaries. Contains the tools authvar, efikeygen, pesigcheck, pesign,
+pesign-client, and pesum.")
+ (home-page "https://github.com/rhboot/pesign")
+ (license license:gpl2+)))
+
(define-public efitools
(package
(name "efitools")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 06/15] gnu: bootloader: Add raspberry pi bootloader.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
4ed60642fab89bd040f19b1cb9717738f043741d.1722741997.git.lilah@lunabee.space
Less adding and more making it an actual bootloader rather than some
weirdly specified packages.

* gnu/bootloader/u-boot.scm (rpi-config, install-rpi): New procedures.
(define-u-bootloader-rpi): New macro.
(u-boot-rpi-2-bootloader, u-boot-rpi-3-bootloader,
u-boot-rpi-4-bootloader, u-boot-rpi-bootloader): New variables.

* gnu/packages/bootloaders.scm (make-u-boot-bin-package): Delete
procedure.
(%u-boot-rpi-efi-description, %u-boot-rpi-efi-description-32-bit,
u-boot-rpi-2-efi, u-boot-rpi-3-32b-efi, u-boot-rpi-4-32b-efi,
u-boot-rpi-arm64-efi, u-boot-rpi-2-bin, u-boot-rpi-3_32b-bin,
u-boot-rpi-4_32b-bin, u-boot-rpi-arm64-bin, u-boot-rpi-2-efi-bin,
u-boot-rpi-3-32b-efi-bin, u-boot-rpi-4-32b-efi-bin,
u-boot-rpi-arm64-efi-bin): Delete variables.

Change-Id: I5139a0b00ec89189e8e7c84e06a7a3b7240259cd
---
gnu/bootloader/u-boot.scm | 66 ++++++++++++++++++++++++-
gnu/packages/bootloaders.scm | 94 +++---------------------------------
2 files changed, 71 insertions(+), 89 deletions(-)

Toggle diff (219 lines)
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 7d3e202f8c..e8dfe9b3a2 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -28,7 +28,10 @@ (define-module (gnu bootloader u-boot)
#:use-module (gnu bootloader)
#:use-module (gnu bootloader extlinux)
#:use-module (gnu packages bootloaders)
+ #:use-module (gnu packages raspberry-pi)
+ #:use-module (gnu system boot)
#:use-module (guix gexp)
+ #:use-module (guix utils)
#:export (u-boot-a20-olinuxino-lime-bootloader
u-boot-a20-olinuxino-lime2-bootloader
u-boot-a20-olinuxino-micro-bootloader
@@ -51,7 +54,11 @@ (define-module (gnu bootloader u-boot)
u-boot-qemu-riscv64-bootloader
u-boot-starfive-visionfive2-bootloader
u-boot-ts7970-q-2g-1000mhz-c-bootloader
- u-boot-wandboard-bootloader))
+ u-boot-wandboard-bootloader
+ u-boot-rpi-2-bootloader
+ u-boot-rpi-3-bootloader
+ u-boot-rpi-4-bootloader
+ u-boot-rpi-bootloader))
(define (make-install-u-boot firmware installers)
(lambda* (#:key bootloader-config #:allow-other-keys . args)
@@ -222,3 +229,60 @@ (define-u-bootloader-copy u-boot-ts7970-q-2g-1000mhz-c-bootloader
(define-u-bootloader-copy u-boot-qemu-riscv64-bootloader
u-boot-qemu-riscv64 "u-boot.bin")
+
+
+;;;
+;;; RasPi bootloader definitions.
+;;;
+
+(define (rpi-config 32?)
+ ;; allows a user-specified custom.txt
+ (plain-file "config.txt"
+ (format #f
+ "arm_64bit=~a~%enable_uart=1~%kernel=u-boot.bin~%include custom.txt~%"
+ (if (or 32? (not (target-64bit?))) "0" "1"))))
+
+(define (install-rpi u-boot-32 u-boot-64)
+ (lambda* (#:key bootloader-config #:allow-other-keys . args)
+ (with-targets (bootloader-configuration-targets bootloader-config)
+ ('install (apply install-extlinux-config args))
+ (('firmware => (firmware :path))
+ (let* ((32? (bootloader-configuration-32bit? bootloader-config))
+ (use-32? (or 32? (not (target-64bit?)) (not u-boot-64))))
+ #~(begin
+ (atomic-copy #$(file-append (if use-32? u-boot-32 u-boot-64)
+ "/libexec/u-boot.bin")
+ (string-append #$firmware "/u-boot.bin"))
+ (atomic-copy #$(rpi-config use-32?)
+ (string-append #$firmware "/config.txt"))))))))
+
+(define-syntax-rule (define-u-bootloader-rpi def-name u-boot-32 u-boot-64)
+ (define def-name
+ (bootloader (name 'u-boot)
+ (default-targets
+ (list (bootloader-target (type 'install)
+ (offset 'firmware)
+ (path "extlinux"))
+ (bootloader-target (type 'firmware)
+ (offset 'root)
+ (path "boot"))))
+ (installer (install-rpi u-boot-32 u-boot-64)))))
+
+
+;; These neither install firmware nor device-tree files for the Raspberry Pi.
+;; They just assume them to be existing in 'install in the same way that some
+;; UEFI firmware with ACPI data is usually assumed to be existing on PCs.
+;; They can be used with either extlinux or as UEFI firmware (alongside, eg,
+;; GRUB).
+(define-u-bootloader-rpi u-boot-rpi-2-bootloader
+ u-boot-rpi-2 #f)
+
+(define-u-bootloader-rpi u-boot-rpi-3-bootloader
+ u-boot-rpi-3-32b u-boot-rpi-arm64)
+
+(define-u-bootloader-rpi u-boot-rpi-4-bootloader
+ u-boot-rpi-4-32b u-boot-rpi-arm64)
+
+;; Usable for any 64-bit raspberry pi.
+(define-u-bootloader-rpi u-boot-rpi-bootloader
+ #f u-boot-rpi-arm64)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 12f918a123..e78602379d 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1409,40 +1409,8 @@ (define-public u-boot-pinebook-pro-rk3399
(modify-inputs (package-inputs base)
(append arm-trusted-firmware-rk3399))))))
-(define*-public (make-u-boot-bin-package u-boot-package
- #:key
- (u-boot-bin "u-boot.bin"))
- "Return a package with a single U-BOOT-BIN file from the U-BOOT-PACKAGE.
-The package name will be that of the U-BOOT package suffixed with \"-bin\"."
- (package
- (name (string-append (package-name u-boot-package) "-bin"))
- (version (package-version u-boot-package))
- (source #f)
- (build-system trivial-build-system)
- (arguments
- (list
- #:builder
- (with-imported-modules '((guix build utils))
- #~(begin
- (use-modules (guix build utils))
- (mkdir #$output)
- (symlink (search-input-file %build-inputs
- (string-append "libexec/" #$u-boot-bin))
- (string-append #$output "/" #$u-boot-bin))))))
- (inputs (list u-boot-package))
- (home-page (package-home-page u-boot-package))
- (synopsis (package-synopsis u-boot-package))
- (description (string-append
- (package-description u-boot-package)
- "\n\n"
- (format #f
- "This package only contains the file ~a."
- u-boot-bin)))
- (license (package-license u-boot-package))))
-
-(define-public %u-boot-rpi-efi-configs
- '("CONFIG_OF_EMBED"
- "CONFIG_OF_BOARD=y"))
+;; get dtbs from firmware to support dtoverlays
+(define-public %u-boot-rpi-configs '("CONFIG_OF_EMBED" "CONFIG_OF_BOARD=y"))
(define %u-boot-rpi-description-32-bit
"This is a 32-bit build of U-Boot.")
@@ -1451,76 +1419,26 @@ (define %u-boot-rpi-description-64-bit
"This is a common 64-bit build of U-Boot for all 64-bit capable Raspberry Pi
variants.")
-(define %u-boot-rpi-efi-description
- "It allows network booting and uses the device-tree from the firmware,
-allowing the usage of overlays. It can act as an EFI firmware for the
-grub-efi-netboot-removable-bootloader.")
-
-(define %u-boot-rpi-efi-description-32-bit
- (string-append %u-boot-rpi-efi-description " "
- %u-boot-rpi-description-32-bit))
-
(define-public u-boot-rpi-2
(make-u-boot-package "rpi_2" "arm-linux-gnueabihf"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-3-32b
(make-u-boot-package "rpi_3_32b" "arm-linux-gnueabihf"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-4-32b
(make-u-boot-package "rpi_4_32b" "arm-linux-gnueabihf"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-arm64
(make-u-boot-package "rpi_arm64" "aarch64-linux-gnu"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-64-bit))
-(define-public u-boot-rpi-2-efi
- (make-u-boot-package "rpi_2" "arm-linux-gnueabihf"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description %u-boot-rpi-efi-description-32-bit))
-
-(define-public u-boot-rpi-3-32b-efi
- (make-u-boot-package "rpi_3_32b" "arm-linux-gnueabihf"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description %u-boot-rpi-efi-description-32-bit))
-
-(define-public u-boot-rpi-4-32b-efi
- (make-u-boot-package "rpi_4_32b" "arm-linux-gnueabihf"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description %u-boot-rpi-efi-description-32-bit))
-
-(define-public u-boot-rpi-arm64-efi
- (make-u-boot-package "rpi_arm64""aarch64-linux-gnu"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description (string-append
- %u-boot-rpi-efi-description " "
- %u-boot-rpi-description-64-bit)))
-
-(define-public u-boot-rpi-2-bin (make-u-boot-bin-package u-boot-rpi-2))
-
-(define-public u-boot-rpi-3_32b-bin (make-u-boot-bin-package u-boot-rpi-3-32b))
-
-(define-public u-boot-rpi-4_32b-bin (make-u-boot-bin-package u-boot-rpi-4-32b))
-
-(define-public u-boot-rpi-arm64-bin (make-u-boot-bin-package u-boot-rpi-arm64))
-
-(define-public u-boot-rpi-2-efi-bin (make-u-boot-bin-package u-boot-rpi-2-efi))
-
-(define-public u-boot-rpi-3-32b-efi-bin
- (make-u-boot-bin-package u-boot-rpi-3-32b-efi))
-
-(define-public u-boot-rpi-4-32b-efi-bin
- (make-u-boot-bin-package u-boot-rpi-4-32b-efi))
-
-(define-public u-boot-rpi-arm64-efi-bin
- (make-u-boot-bin-package u-boot-rpi-arm64-efi))
-
(define u-boot-ts-mx6
;; There is no release; use the latest commit of the
;; 'imx_v2015.04_3.14.52_1.1.0_ga' branch.
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 10/15] gnu: packages: Add systemd-stub.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
618b4d4f364fbc2450df50380cbf457c5ac1e3aa.1722741997.git.lilah@lunabee.space
* gnu/bootloader.scm (%efi-supported-systems, lazy-efibootmgr): New variable.
(install-efi): Use lazy-efibootmgr.
* gnu/packages/bootloaders.scm (systemd-stub): New variable.

Change-Id: I974bad9ff7a52f736286d05de53f7c5ccb60b9d6
---
gnu/bootloader.scm | 13 +++++++++--
gnu/packages/bootloaders.scm | 43 ++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 2 deletions(-)

Toggle diff (120 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 2bb13437dc..27b0c51342 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -28,7 +28,6 @@ (define-module (gnu bootloader)
#:autoload (gnu build file-systems)
(read-partition-label read-partition-uuid
find-partition-by-label find-partition-by-uuid)
- #:use-module (gnu packages linux)
#:use-module (gnu system file-systems)
#:use-module (gnu system uuid)
#:autoload (guix build syscalls)
@@ -114,6 +113,7 @@ (define-module (gnu bootloader)
bootloader-configuration->gexp
bootloader-configurations->gexp
+ %efi-supported-systems
efi-arch
install-efi))
@@ -633,6 +633,11 @@ (define (bootloader-configurations->gexp bootloader-configs . rest)
;;; EFI shit
;;;
+;; systems currently supported by efi-arch. should be used for packages relying
+;; on it.
+(define %efi-supported-systems
+ '("i686-linux" "x86_64-linux" "armhf-linux" "aarch64-linux" "riscv64-linux"))
+
(define* (efi-arch #:key (target (or (%current-target-system) (%current-system)))
(32? #f))
"Returns the UEFI architecture name for the current target, in lowercase."
@@ -644,6 +649,10 @@ (define* (efi-arch #:key (target (or (%current-target-system) (%current-system))
(else (raise (formatted-message (G_ "no UEFI standard arch for ~a!")
target)))))
+(define (lazy-efibootmgr)
+ "Lazy-loaded efibootmgr package, in order to prevent circular refs."
+ (module-ref (resolve-interface '(gnu packages linux)) 'efibootmgr))
+
(define (install-efi bootloader-config plan)
"Returns a gexp installing PLAN to the ESP, as denoted by the 'vendir target.
PLAN is a gexp of a list of '(BUILDER DEST-BASENAME . LABEL) triples, that
@@ -666,5 +675,5 @@ (define (install-efi bootloader-config plan)
;; normal install when not doing a removable config
(with-targets targets
(('vendir => (vendir :path) (loader :devpath) (disk :device))
- #~(install-efi #+(file-append efibootmgr "/sbin/efibootmgr")
+ #~(install-efi #+(file-append (lazy-efibootmgr) "/sbin/efibootmgr")
#$vendir #$loader #$disk #$plan))))))
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 04bb1b06f0..2bc04059d2 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -38,6 +38,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages bootloaders)
+ #:use-module (gnu bootloader)
#:use-module (gnu packages)
#:use-module (gnu packages assembly)
#:use-module (gnu packages base)
@@ -54,6 +55,7 @@ (define-module (gnu packages bootloaders)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gettext)
+ #:use-module (gnu packages gperf)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages man)
@@ -592,6 +594,47 @@ (define systemd-source
(base32
"1qdyw9g3jgvsbc1aryr11gpc3075w5pg00mqv4pyf3hwixxkwaq6"))))
+(define-public systemd-stub
+ (package
+ (name "systemd-stub")
+ (version systemd-version)
+ (source systemd-source)
+ (build-system meson-build-system)
+ (arguments
+ (list #:configure-flags
+ #~(list "-Dmode=release" "-Defi=true" "-Dsbat-distro=guix"
+ "-Dsbat-distro-generation=1" ; package revision!
+ "-Dsbat-distro-summary=Guix System"
+ "-Dsbat-distro-url=https://guix.gnu.org"
+ #$(string-append "-Dsbat-distro-pkgname="
+ (package-name this-package))
+ #$(string-append "-Dsbat-distro-version="
+ (package-version this-package)))
+ #:phases
+ ;; TODO: 32bit support
+ (let* ((stub (string-append
+ "src/boot/efi/linux" (efi-arch) ".efi.stub")))
+ #~(modify-phases %standard-phases
+ (replace 'build
+ (lambda* (#:key parallel-build? #:allow-other-keys)
+ (invoke "ninja" #$stub
+ "-j" (if parallel-build?
+ (number->string (parallel-job-count)) "1"))))
+ (replace 'install
+ (lambda _
+ (let ((libexec (string-append #$output "/libexec")))
+ (install-file #$stub libexec))))
+ (delete 'check)))))
+ (supported-systems %efi-supported-systems)
+ (inputs (list libcap python-pyelftools `(,util-linux "lib")))
+ (native-inputs (list gperf pkg-config python-3 python-jinja2))
+ (home-page "https://systemd.io/")
+ (synopsis "Unified kernel image UEFI stub")
+ (description "Simple UEFI boot stub that loads a conjoined kernel image and
+supporting data to their proper locations, before chainloading to the kernel.
+Supports measured and/or verified boot environments.")
+ (license license:lgpl2.1+)))
+
(define-public ukify
(package
(name "ukify")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 09/15] gnu: packages: Add ukify.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
29e267f07ccb57193cfc622f2710d2fadfbcedfd.1722741997.git.lilah@lunabee.space
* gnu/packages/bootloaders.scm
(systemd-version,systemd-source,ukify): New variables.

Change-Id: Icde59b7266529c8002331ff0375e0a35af3a2add
---
gnu/packages/bootloaders.scm | 54 ++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)

Toggle diff (93 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index e78602379d..04bb1b06f0 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -20,6 +20,7 @@
;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2023 Herman Rimm <herman@rimm.ee>
;;; Copyright © 2024 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2024 Lilah Tascheter <lilah@lunabee.space>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -47,6 +48,7 @@ (define-module (gnu packages bootloaders)
#:use-module (gnu packages compression)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages disk)
+ #:use-module (gnu packages efi)
#:use-module (gnu packages firmware)
#:use-module (gnu packages flex)
#:use-module (gnu packages fontutils)
@@ -73,11 +75,13 @@ (define-module (gnu packages bootloaders)
#:use-module (gnu packages valgrind)
#:use-module (gnu packages virtualization)
#:use-module (gnu packages xorg)
+ #:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (guix build-system gnu)
#:use-module (guix build-system meson)
#:use-module (guix build-system pyproject)
+ #:use-module (guix build-system python)
#:use-module (guix build-system trivial)
#:use-module (guix download)
#:use-module (guix gexp)
@@ -573,6 +577,56 @@ (define-public syslinux
;; Also contains:
license:expat license:isc license:zlib)))))
+(define systemd-version "255")
+(define systemd-source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/systemd/systemd")
+ (commit (string-append "v" systemd-version))))
+ (file-name (git-file-name "systemd" systemd-version))
+ (snippet #~(substitute* "src/ukify/ukify.py" ; remove after python 3.11
+ (("datetime\\.UTC") "datetime.timezone.utc")))
+ (modules '((guix build utils)))
+ (sha256
+ (base32
+ "1qdyw9g3jgvsbc1aryr11gpc3075w5pg00mqv4pyf3hwixxkwaq6"))))
+
+(define-public ukify
+ (package
+ (name "ukify")
+ (version systemd-version)
+ (source systemd-source)
+ (build-system python-build-system)
+ (arguments
+ (list #:phases
+ #~(modify-phases %standard-phases
+ (replace 'build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (define (get-tool tool)
+ (search-input-file inputs (string-append "bin/" tool)))
+
+ (substitute* "src/ukify/ukify.py" ; hardcode tool paths
+ (("(find_tool\\(')(readelf|sbsign|pesign)'," _ ctx tool)
+ (string-append ctx (get-tool tool) "',"))
+ (("('name': ')(sbverify|pesign)'," _ ctx tool)
+ (string-append ctx (get-tool tool) "',")))))
+ (delete 'check)
+ (replace 'install
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((bin (string-append #$output "/bin"))
+ (file (string-append bin "/ukify")))
+ (mkdir-p bin)
+ (copy-file "src/ukify/ukify.py" file)))))))
+ (inputs
+ (list binutils pesign python-cryptography python-pefile sbsigntools))
+ (home-page "https://systemd.io/")
+ (synopsis "Unified kernel image UEFI tool")
+ (description "@command{ukify} joins together a UKI stub, linux kernel, initrd,
+kernel arguments, and optional secure boot signatures into a single, UEFI-bootable
+image.")
+ (license license:lgpl2.1+)))
+
(define-public dtc
(package
(name "dtc")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 11/15] gnu: bootloaders: Add uki-efi-bootloader.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
788156df85ec2c2f955465deaf9557d7a2e774c0.1722741997.git.lilah@lunabee.space
* gnu/bootloader.scm (<bootloader-configuration>): New keypair field.
* gnu/bootloader/uki.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add bootloader/uki.scm.

Change-Id: I2097da9f3dd35137b3419f6d0545de26d53cb6da
---
gnu/bootloader.scm | 3 ++
gnu/bootloader/uki.scm | 96 ++++++++++++++++++++++++++++++++++++++++++
gnu/local.mk | 1 +
3 files changed, 100 insertions(+)
create mode 100644 gnu/bootloader/uki.scm

Toggle diff (137 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 27b0c51342..a2a70d362f 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -100,6 +100,7 @@ (define-module (gnu bootloader)
bootloader-configuration-default-entry
bootloader-configuration-efi-removable?
bootloader-configuration-32bit?
+ bootloader-configuration-keypair
bootloader-configuration-timeout
bootloader-configuration-keyboard-layout
bootloader-configuration-theme
@@ -523,6 +524,8 @@ (define-record-type* <bootloader-configuration>
(default #f)) ;bool
(32bit? bootloader-configuration-32bit?
(default #f)) ;bool
+ (keypair bootloader-configuration-keypair
+ (default #f)) ;(cert . priv) pair
(timeout bootloader-configuration-timeout
(default 5)) ;seconds as integer
(keyboard-layout bootloader-configuration-keyboard-layout
diff --git a/gnu/bootloader/uki.scm b/gnu/bootloader/uki.scm
new file mode 100644
index 0000000000..4871dbe037
--- /dev/null
+++ b/gnu/bootloader/uki.scm
@@ -0,0 +1,96 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2024 Lilah Tascheter <lilah@lunabee.space>
+;;;
+;;; 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 uki)
+ #:use-module (gnu bootloader)
+ #:use-module (gnu packages bootloaders)
+ #:use-module (gnu packages efi)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu system boot)
+ #:use-module (guix gexp)
+ #:use-module (guix diagnostics)
+ #:use-module (guix i18n)
+ #:use-module (guix records)
+ #:export (uki-efi-bootloader))
+
+;; TODO: support 32bit/mixed-mode UEFI.
+;; https://github.com/systemd/systemd/issues/17056 may be relevant
+(define bootcfg->menu-entry->builder
+ (match-record-lambda <bootloader-configuration> (32bit? theme keypair)
+ (match-record-lambda <menu-entry>
+ (label linux linux-arguments initrd chain-loader)
+ ;; support chainloader in order to allow arbitrary signed EFI binaries
+ (cond
+ ((and chain-loader keypair)
+ #~(lambda (dest)
+ (invoke/quiet #+(sbsigntools "/bin/sbsign")
+ "--cert" #$(car keypair) "--key" #$(cdr keypair)
+ "--output" dest #$chain-loader)
+ (invoke/quiet #+(sbsigntools "/bin/sbverify")
+ "--cert" #$(car keypair) dest)))
+ (chain-loader #~(lambda (dest) (copy-file #$chain-loader dest)))
+ (linux
+ (let* ((arch (efi-arch #:32? 32bit?))
+ (stub (file-append systemd-stub
+ "/libexec/linux" arch ".efi.stub")))
+ #~(lambda (dest)
+ (invoke/quiet #+(file-append ukify "/bin/ukify")
+ "build" "--output" dest
+ "--linux" #$linux "--initrd" #$initrd
+ "--cmdline" (string-join (list #$@linux-arguments))
+ "--os-release" #$label "--stub" #$stub "--efi-arch" #$arch
+ #$@(if theme #~("--splash" #$theme) '())
+ #$@(if keypair #~("--secureboot-certificate" #$(car keypair)
+ "--secureboot-private-key" #$(cdr keypair))
+ '())))))
+ (else (leave (G_ "uki-efi-bootloader doesn't support multiboot")))))))
+
+;; we cannot use guix's build system to make UKI images for two reasons:
+;; 1. signing is necessarily non-reproducable, especially since keys should not
+;; be in the store, or else risk being publically accessible.
+;; 2. menu-entries may reference files which do not exist in the store.
+(define* (install-uki #:key bootloader-config
+ current-boot-alternative
+ old-boot-alternatives
+ #:allow-other-keys)
+ (define* (menu-entry->plan entry num #:optional (prefix "menu-entry"))
+ #~(cons* #$((bootcfg->menu-entry->builder bootloader-config) entry)
+ #$(string-append prefix "-" (number->string num) ".efi")
+ #$(menu-entry-label entry)))
+
+ (define (boot-alternative->plan alt)
+ (menu-entry->plan (boot-alternative->menu-entry alt)
+ (boot-alternative-generation alt)
+ "generation"))
+
+ (install-efi bootloader-config
+ (let ((entries (bootloader-configuration-menu-entries bootloader-config)))
+ #~(list #$(boot-alternative->plan current-boot-alternative)
+ #$@(map menu-entry->plan entries (iota (length entries)))
+ #$@(map boot-alternative->plan old-boot-alternatives)))))
+
+
+
+(define uki-efi-bootloader
+ (bootloader
+ (name 'uki-efi)
+ (default-targets (list (bootloader-target
+ (type 'vendir)
+ (offset 'esp)
+ (path "EFI/Guix"))))
+ (installer install-uki)))
diff --git a/gnu/local.mk b/gnu/local.mk
index 8375e13709..32ed753ee2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -93,6 +93,7 @@ GNU_SYSTEM_MODULES = \
%D%/bootloader/extlinux.scm \
%D%/bootloader/u-boot.scm \
%D%/bootloader/depthcharge.scm \
+ %D%/bootloader/uki.scm \
%D%/ci.scm \
%D%/compression.scm \
%D%/home.scm \
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 12/15] gnu: system: Update examples.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
a3ca6f369ad71d685916362c92be4469a7fb055b.1722741997.git.lilah@lunabee.space
* gnu/system/examples/asus-c201.tmpl (bootloader): Use new depthcharge
bootloader name scheme and update to new target system.

* gnu/system/examples/bare-bones.tmpl (bootloader),
gnu/system/examples/bare-hurd.tmpl (bootloader),
gnu/system/examples/beaglebone-black.tmpl (bootloader),
gnu/system/examples/desktop.tmpl (bootloader),
gnu/system/examples/lightweight-desktop.tmpl (bootloader),
gnu/system/examples/plasma.tmpl (bootloader),
gnu/system/examples/raspberry-pi-64-nfs-root.tmpl (bootloader),
gnu/system/examples/raspberry-pi-64.tmpl (bootloader): Use new target system.

* gnu/system/examples/docker-image.tmpl (bootloader): Delete.

* gnu/system/examples/vm-image.tmpl (bootloader): Use auto image target.

Change-Id: I3675f17ae9cd94cff99328762600fb4e491bc9f2
---
gnu/system/examples/asus-c201.tmpl | 6 +++--
gnu/system/examples/bare-bones.tmpl | 7 ++++--
gnu/system/examples/bare-hurd.tmpl | 4 +++-
gnu/system/examples/beaglebone-black.tmpl | 6 +++--
gnu/system/examples/desktop.tmpl | 4 +++-
gnu/system/examples/docker-image.tmpl | 6 ++---
gnu/system/examples/lightweight-desktop.tmpl | 4 +++-
gnu/system/examples/plasma.tmpl | 4 +++-
.../examples/raspberry-pi-64-nfs-root.tmpl | 23 ++++++++++++-------
gnu/system/examples/raspberry-pi-64.tmpl | 18 ++++++++-------
gnu/system/examples/vm-image.tmpl | 5 ++--
11 files changed, 54 insertions(+), 33 deletions(-)

Toggle diff (224 lines)
diff --git a/gnu/system/examples/asus-c201.tmpl b/gnu/system/examples/asus-c201.tmpl
index 019111c167..eec185eebf 100644
--- a/gnu/system/examples/asus-c201.tmpl
+++ b/gnu/system/examples/asus-c201.tmpl
@@ -14,8 +14,10 @@
;; Assuming /dev/mmcblk0p1 is the kernel partition, and
;; "my-root" is the label of the target root file system.
(bootloader (bootloader-configuration
- (bootloader depthcharge-bootloader)
- (targets '("/dev/mmcblk0p1"))))
+ (bootloader depthcharge-veyron-speedy-bootloader)
+ (targets (list (bootloader-target
+ (type 'part)
+ (device "/dev/mmcblk0p1"))))))
;; The ASUS C201PA requires a very particular kernel to boot,
;; as well as the following arguments.
diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare-bones.tmpl
index 7b6a4b09b0..9eed05f2e0 100644
--- a/gnu/system/examples/bare-bones.tmpl
+++ b/gnu/system/examples/bare-bones.tmpl
@@ -13,10 +13,13 @@
;; Boot in "legacy" BIOS mode, assuming /dev/sdX is the
;; target hard disk, and "my-root" is the label of the target
- ;; root file system.
+ ;; root file system. If you're just building an image, the
+ ;; 'targets' field may be omitted.
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
;; It's fitting to support the equally bare bones ‘-nographic’
;; QEMU option, which also nicely sidesteps forcing QWERTY.
(kernel-arguments (list "console=ttyS0,115200"))
diff --git a/gnu/system/examples/bare-hurd.tmpl b/gnu/system/examples/bare-hurd.tmpl
index 463c7ee798..8dd700cd9d 100644
--- a/gnu/system/examples/bare-hurd.tmpl
+++ b/gnu/system/examples/bare-hurd.tmpl
@@ -32,7 +32,9 @@
(inherit %hurd-default-operating-system)
(bootloader (bootloader-configuration
(bootloader grub-minimal-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/system/examples/beaglebone-black.tmpl b/gnu/system/examples/beaglebone-black.tmpl
index 18bbb2723c..99963ef2fe 100644
--- a/gnu/system/examples/beaglebone-black.tmpl
+++ b/gnu/system/examples/beaglebone-black.tmpl
@@ -11,11 +11,13 @@
(timezone "Europe/Berlin")
(locale "en_US.utf8")
- ;; Assuming /dev/mmcblk1 is the eMMC, and "my-root" is
+ ;; Assuming /dev/mmcblk1 is the eMMC. and "my-root" is
;; the label of the target root file system.
(bootloader (bootloader-configuration
(bootloader u-boot-beaglebone-black-bootloader)
- (targets '("/dev/mmcblk1"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/mmcblk1"))))))
;; This module is required to mount the SD card.
(initrd-modules (cons "omap_hsmmc" %base-initrd-modules))
diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl
index 2d65f22294..30dbdeea31 100644
--- a/gnu/system/examples/desktop.tmpl
+++ b/gnu/system/examples/desktop.tmpl
@@ -20,7 +20,9 @@
;; Partition mounted on /boot/efi.
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))
(keyboard-layout keyboard-layout)))
;; Specify a mapped device for the encrypted root partition.
diff --git a/gnu/system/examples/docker-image.tmpl b/gnu/system/examples/docker-image.tmpl
index 7123917af4..6d3114a0bc 100644
--- a/gnu/system/examples/docker-image.tmpl
+++ b/gnu/system/examples/docker-image.tmpl
@@ -9,6 +9,8 @@
(timezone "Europe/Berlin")
(locale "en_US.utf8")
+ ;; Bootloader can be left blank!
+
;; This is where user accounts are specified. The "root" account is
;; implicit, and is initially created with the empty password.
(users (cons (user-account
@@ -34,10 +36,6 @@
;; similar services for us.
;; This will be ignored.
- (bootloader (bootloader-configuration
- (bootloader grub-bootloader)
- (targets '("does-not-matter"))))
- ;; This will be ignored, too.
(file-systems (list (file-system
(device "does-not-matter")
(mount-point "/")
diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl
index c061284ba8..0964238cb0 100644
--- a/gnu/system/examples/lightweight-desktop.tmpl
+++ b/gnu/system/examples/lightweight-desktop.tmpl
@@ -17,7 +17,9 @@
;; Partition mounted on /boot/efi.
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))))
;; Assume the target root file system is labelled "my-root",
;; and the EFI System Partition has UUID 1234-ABCD.
diff --git a/gnu/system/examples/plasma.tmpl b/gnu/system/examples/plasma.tmpl
index c3850ffe37..a81916ffe9 100644
--- a/gnu/system/examples/plasma.tmpl
+++ b/gnu/system/examples/plasma.tmpl
@@ -15,7 +15,9 @@
;; is the label of the target root file system.
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device "my-root")
diff --git a/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl b/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl
index 1baca02491..85476854f3 100644
--- a/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl
+++ b/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl
@@ -25,14 +25,21 @@
(operating-system
(host-name "raspberrypi-guix")
(timezone "Europe/Berlin")
- (bootloader (bootloader-configuration
- (bootloader grub-efi-bootloader-chain-raspi-64)
- (targets (list "/boot/efi"))
- (theme (grub-theme
- (resolution '(1920 . 1080))
- (image (file-append
- %artwork-repository
- "/grub/GuixSD-fully-black-16-9.svg"))))))
+ (bootloader (list (bootloader-configuration
+ (bootloader u-boot-rpi-bootloader)
+ (targets (list (bootloader-target
+ (type 'install)
+ (path "/boot/efi")))))
+ (bootloader-configuration
+ (bootloader grub-efi-bootloader)
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))
+ (theme
+ (grub-theme
+ (resolution '(1920 . 1080))
+ (image (file-append %artwork-repository
+ "/grub/GuixSD-fully-black-16-9.svg")))))))
(kernel-arguments '("ip=dhcp"))
(kernel (customize-linux #:linux linux-libre-arm64-generic
#:extra-version "arm64-generic-netboot"
diff --git a/gnu/system/examples/raspberry-pi-64.tmpl b/gnu/system/examples/raspberry-pi-64.tmpl
index 414d8ac7a5..d5b90b9705 100644
--- a/gnu/system/examples/raspberry-pi-64.tmpl
+++ b/gnu/system/examples/raspberry-pi-64.tmpl
@@ -24,14 +24,16 @@
(operating-system
(host-name "raspberrypi-guix")
(timezone "Europe/Berlin")
- (bootloader (bootloader-configuration
- (bootloader grub-efi-bootloader-chain-raspi-64)
- (targets (list "/boot/efi"))
- (theme (grub-theme
- (resolution '(1920 . 1080))
- (image (file-append
- %artwork-repository
- "/grub/GuixSD-fully-black-16-9.svg"))))))
+ (bootloader (list (bootloader-configuration
+ (bootloader u-boot-rpi-bootloader)
+ (targets (list (bootloader-target
+ (type 'install)
+ (path "/boot/efi"))))
+ (theme
+ (grub-theme
+ (resolution '(1920 . 1080))
+ (image (file-append %artwork-repository
+ "/grub/GuixSD-fully-black-16-9.svg")))))))
(kernel (customize-linux #:linux linux-libre-arm64-generic
;; It is possible to use a specific defconfig
;; file, for example the "bcmrpi3_defconfig" with
diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl
index 589de493b1..050c0bb971 100644
--- a/gnu/system/examples/vm-image.tmpl
+++ b/gnu/system/examples/vm-image.tmpl
@@ -38,11 +38,10 @@ accounts.\x1b[0m
(firmware '())
- ;; Below we assume /dev/vda is the VM's hard disk.
- ;; Adjust as needed.
+ ;; Images automatically get the 'root, 'esp, and 'disk targets configured as
+ ;; needed.
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vda"))
(terminal-outputs '(console))))
(file-systems (cons (file-system
(mount-point "/")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 14/15] gnu: tests: Update tests to new targets system.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
f805917637d31d39adbd921c0fc7f82c92a4a801.1722741997.git.lilah@lunabee.space
* gnu/services/virtualization.scm
(%virtual-build-machine-operating-system): Remove bootloader.
(%hurd-vm-operating-system): Remove targets.

* gnu/system/hurd.scm (%hurd-default-operating-system): Remove targets.

* gnu/tests.scm (%simple-os), gnu/tests/ganeti.scm (%ganeti-os),
gnu/tests/image.scm (%simple-efi-os),
gnu/tests/install.scm (%minimal-os, %minimal-extlinux-os,
%minimal-os-on-vda, %separate-home-os, %separate-store-os, %raid-root-os,
%encrypted-root-os, %lvm-separate-home-os, %encrypted-home-os,
%encrypted-home-os-key-file, %encrypted-root-not-boot-os,
%btrfs-root-os-source, %btrfs-raid-root-os-source,
%btrfs-root-on-subvolume-os, %btrfs-raid10-root-os, %jfs-root-os,
%f2fs-root-os, %xfs-root-os), gnu/tests/nfs.scm (%base-os),
gnu/tests/telephony.scm (make-jami-os), gnu/tests/vnc.scm (%xvnc-os):
Update bootloader targets.

Change-Id: I3d66a839a9b2a73b8b65946950728b1e0155ca1e
---
gnu/services/virtualization.scm | 11 ++---
gnu/system/hurd.scm | 4 +-
gnu/tests.scm | 4 +-
gnu/tests/ganeti.scm | 4 +-
gnu/tests/image.scm | 4 +-
gnu/tests/install.scm | 72 ++++++++++++++++++++++++---------
gnu/tests/nfs.scm | 4 +-
gnu/tests/telephony.scm | 4 +-
gnu/tests/vnc.scm | 4 +-
tests/boot-parameters.scm | 2 +-
10 files changed, 77 insertions(+), 36 deletions(-)

Toggle diff (357 lines)
diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm
index d87e494348..f698532a94 100644
--- a/gnu/services/virtualization.scm
+++ b/gnu/services/virtualization.scm
@@ -1191,17 +1191,13 @@ (define %minimal-vm-syslog-config
(define %virtual-build-machine-operating-system
(operating-system
(host-name "build-machine")
-
(locale "en_US.utf8")
(locale-definitions
;; Save space by providing only one locale.
(list (locale-definition (name "en_US.utf8")
(source "en_US")
(charset "UTF-8"))))
-
- (bootloader (bootloader-configuration ;unused
- (bootloader grub-minimal-bootloader)
- (targets '("/dev/null"))))
+ ;; no bootloader
(file-systems (cons (file-system ;unused
(mount-point "/")
(device "none")
@@ -1624,9 +1620,8 @@ (define %hurd-vm-operating-system
(host-name "childhurd")
(timezone "Europe/Amsterdam")
(bootloader (bootloader-configuration
- (bootloader grub-minimal-bootloader)
- (targets '("/dev/vda"))
- (timeout 0)))
+ (bootloader grub-minimal-bootloader)
+ (timeout 0)))
(packages (cons* gdb-minimal
(operating-system-packages
%hurd-default-operating-system)))
diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm
index cbe0081382..af04e82485 100644
--- a/gnu/system/hurd.scm
+++ b/gnu/system/hurd.scm
@@ -119,9 +119,7 @@ (define %hurd-default-operating-system
(kernel %hurd-default-operating-system-kernel)
(kernel-arguments '())
(hurd hurd)
- (bootloader (bootloader-configuration
- (bootloader grub-minimal-bootloader)
- (targets '("/dev/vda"))))
+ (bootloader (bootloader-configuration (bootloader grub-minimal-bootloader)))
(initrd #f)
(initrd-modules '())
(firmware '())
diff --git a/gnu/tests.scm b/gnu/tests.scm
index 5ff9db82fc..f46ccf5174 100644
--- a/gnu/tests.scm
+++ b/gnu/tests.scm
@@ -237,7 +237,9 @@ (define %simple-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device"/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/tests/ganeti.scm b/gnu/tests/ganeti.scm
index 29eb354044..789879b26f 100644
--- a/gnu/tests/ganeti.scm
+++ b/gnu/tests/ganeti.scm
@@ -40,7 +40,9 @@ (define %ganeti-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vda"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vda"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/tests/image.scm b/gnu/tests/image.scm
index be6852cae0..8d960cf7b8 100644
--- a/gnu/tests/image.scm
+++ b/gnu/tests/image.scm
@@ -55,7 +55,9 @@ (define %simple-efi-os
(inherit %simple-os)
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))))))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))))))
;; An MBR disk image with a single ext4 partition.
(define i1
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 18a2fc119b..d67a71f12e 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -103,7 +103,9 @@ (define-os-with-source (%minimal-os %minimal-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -141,7 +143,9 @@ (define-os-with-source (%minimal-extlinux-os
(bootloader (bootloader-configuration
(bootloader extlinux-gpt-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -434,7 +438,9 @@ (define-os-with-source (%minimal-os-on-vda %minimal-os-on-vda-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vda"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vda"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -510,7 +516,9 @@ (define-os-with-source (%separate-home-os %separate-home-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
(device (file-system-label "my-root"))
@@ -565,7 +573,9 @@ (define-os-with-source (%separate-store-os %separate-store-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
(device (file-system-label "root-fs"))
@@ -642,7 +652,9 @@ (define-os-with-source (%raid-root-os %raid-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
;; Add a kernel module for RAID-1 (aka. "mirror").
@@ -725,7 +737,9 @@ (define-os-with-source (%encrypted-root-os %encrypted-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
;; Note: Do not pass "console=ttyS0" so we can use our passphrase prompt
;; detection logic in 'enter-luks-passphrase'.
@@ -858,7 +872,9 @@ (define-os-with-source (%lvm-separate-home-os %lvm-separate-home-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(mapped-devices (list (mapped-device
@@ -943,7 +959,9 @@ (define-os-with-source (%encrypted-home-os %encrypted-home-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
;; Note: Do not pass "console=ttyS0" so we can use our passphrase prompt
;; detection logic in 'enter-luks-passphrase'.
@@ -1070,7 +1088,9 @@ (define-os-with-source (%encrypted-home-os-key-file
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))
(extra-initrd "/key-file.cpio")))
(kernel-arguments '("console=ttyS0"))
@@ -1130,7 +1150,9 @@ (define-os-with-source (%encrypted-root-not-boot-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(mapped-devices (list (mapped-device
(source
@@ -1232,7 +1254,9 @@ (define-os-with-source (%btrfs-root-os %btrfs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -1306,7 +1330,9 @@ (define-os-with-source (%btrfs-raid-root-os %btrfs-raid-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
@@ -1374,7 +1400,9 @@ (define-os-with-source (%btrfs-root-on-subvolume-os
(locale "en_US.UTF-8")
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
(device (file-system-label "btrfs-pool"))
@@ -1467,7 +1495,9 @@ (define-os-with-source (%btrfs-raid10-root-os
(bootloader (map (lambda (targ)
(bootloader-configuration
(bootloader grub-bootloader)
- (targets (list targ))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device targ))))))
'("/dev/vdb" "/dev/vdc" "/dev/vdd" "/dev/vde")))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
@@ -1577,7 +1607,9 @@ (define-os-with-source (%jfs-root-os %jfs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -1650,7 +1682,9 @@ (define-os-with-source (%f2fs-root-os %f2fs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -1723,7 +1757,9 @@ (define-os-with-source (%xfs-root-os %xfs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm
index 0d9972e0e9..2f97126df7 100644
--- a/gnu/tests/nfs.scm
+++ b/gnu/tests/nfs.scm
@@ -51,7 +51,9 @@ (define %base-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems %base-file-systems)
(users %base-user-accounts)
(packages (cons*
diff --git a/gnu/tests/telephony.scm b/gnu/tests/telephony.scm
index f03ea963f7..ee858d9c91 100644
--- a/gnu/tests/telephony.scm
+++ b/gnu/tests/telephony.scm
@@ -90,7 +90,9 @@ (define* (make-jami-os #:key provisioning? partial?)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/tests/vnc.scm b/gnu/tests/vnc.scm
index ab1c2749f3..cba9c565e0 100644
--- a/gnu/tests/vnc.scm
+++ b/gnu/tests/vnc.scm
@@ -51,7 +51,9 @@ (define %xvnc-os
(locale "en_US.UTF-8")
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm
index f214de360d..f343dbdfdb 100644
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -63,7 +63,7 @@ (define %root-path "/")
(define %grub-boot-parameters
(boot-parameters
- (bootloader-name 'grub)
+ (bootloader-name '(grub))
(root-device %default-root-device)
(label %default-label)
(kernel %default-kernel)
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 15/15] teams: Add bootloading team.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
0eec4e84a83ba05105cac27761168afc0d08fde1.1722741997.git.lilah@lunabee.space
Might as well, to help ease the transition.

* etc/teams.scm (bootloaders): New team.
(Lilah Tascheter): Create add to above.

Change-Id: I63620f4e3151bb8e3d0bdf619fc70501af6397a0
---
etc/teams.scm | 10 ++++++++++
1 file changed, 10 insertions(+)

Toggle diff (30 lines)
diff --git a/etc/teams.scm b/etc/teams.scm
index 408ebbf3d9..d9af4ad7bb 100755
--- a/etc/teams.scm
+++ b/etc/teams.scm
@@ -328,6 +328,12 @@ (define-team embedded
#:scope (list "gnu/packages/bootloaders.scm"
"gnu/packages/firmware.scm")))
+(define-team bootloaders
+ (team 'bootloaders
+ #:name "Bootloaders"
+ #:scope (list "gnu/bootloader.scm"
+ (make-regexp* "^gnu/bootloader/"))))
+
(define-team rust
(team 'rust
#:name "Rust"
@@ -746,6 +752,10 @@ (define-member (person "Nicolas Goaziou"
"guix@nicolasgoaziou.fr")
tex)
+(define-member (person "Lilah Tascheter"
+ "lilah@lunabee.space")
+ bootloaders)
+
(define (find-team name)
(or (hash-ref %teams (string->symbol name))
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 05:55 +0200
[PATCH 13/15] doc: Update bootloader documentation.
(address . 72457@debbugs.gnu.org)(name . Lilah Tascheter)(address . lilah@lunabee.space)
6b11fe0d7c2ad9e4e1baf76ec205eb219546d623.1722741997.git.lilah@lunabee.space
* doc/guix.texi
(Manual Installation)[Proceeding with the Installation]: Offload
target reference.

(System Installation)[Building the Installation Image]: Use beaglebone
as the example, and don't reference deleted variables.

(System Configuration)[Using the Configuration System]: Update
example.
[operating-system Reference]<bootloader>: Can use multiple
bootloaders.
[Keyboard Layout]: Update example.
[Bootloader Configuration]<bootloader>: Update documentation for all
bootloaders, and add new ones. Document new fields efi-removable?,
32bit?, and keypair. Update terminal-outputs and terminal-outputs to
not be GRUB-specific.
<bootloader-target>: New record.
<menu-entry>: Remove now-unsupported GRUB specifics in linux. Move
device documentation and add some for device-mount-point and
device-subvol. Fix typo in multiboot-arguments. Document chain-loader
for arbitrary bootloaders.
[Invoking guix system]<switch-generation>: Bootloaders are now
reinstalled.
<image> Other bootloaders may be used.
[Invoking guix deploy]: Update template.

(Creating System Images)[image Reference]<partition Reference>: Add
target field.
[Instantiate an Image]: Update examples and update formatting.
<efi32-disk-image, efi32-raw-image-type>: Delete.
[image-type Reference]<pinebook-pro-image-type, rock64-image-type>:
Reword slightly.

Change-Id: I45ac9d5ad3cb491c693e9a4b2f0b44b527478ee7
---
doc/guix.texi | 458 +++++++++++++++++++++++++++++---------------------
1 file changed, 262 insertions(+), 196 deletions(-)

Toggle diff (371 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 41814042f5..b5f35a9066 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2516,12 +2516,9 @@ Proceeding with the Installation
Make sure the @code{bootloader-configuration} form refers to the targets
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{targets} field contain the names of the devices, like
-@code{(list "/dev/sda")}; for UEFI systems it names the paths to mounted
-EFI partitions, like @code{(list "/boot/efi")}; do make sure the paths
-are currently mounted and a @code{file-system} entry is specified in
-your configuration.
+@code{grub-efi-bootloader} for newer UEFI systems.
+@xref{Bootloader Configuration} for information on how to format the
+@code{targets} field.
@item
Be sure that your file system labels match the value of their respective
@@ -2653,11 +2650,13 @@ Building the Installation Image
includes the bootloader, specifically:
@example
-guix system image --system=armhf-linux -e '((@@ (gnu system install) os-with-u-boot) (@@ (gnu system install) installation-os) "A20-OLinuXino-Lime2")'
+guix system image --system=armhf-linux -e '(@ (gnu system install) beaglebone-black-installation-os)'
@end example
-@code{A20-OLinuXino-Lime2} is the name of the board. If you specify an invalid
-board, a list of possible boards will be printed.
+@code{beaglebone-black} is the name of the board. Similar
+@code{installation-os} variables exist for most other supported boards.
+Otherwise, you can use @code{embedded-installation-os}, passing it a u-boot
+bootloader and the desired console tty.
@c *********************************************************************
@@ -17229,7 +17228,9 @@ Using the Configuration System
@lisp
(bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi")))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi")))))
@end lisp
@xref{Bootloader Configuration}, for more information on the available
@@ -17535,8 +17536,10 @@ operating-system Reference
List of strings or gexps representing additional arguments to pass on
the command-line of the kernel---e.g., @code{("console=ttyS0")}.
-@item @code{bootloader}
-The system bootloader configuration object. @xref{Bootloader Configuration}.
+@item @code{bootloader} (default: '())
+The system bootloader configuration object. Can either be a single
+@code{bootloader-configuration} or a list of them, to install multiple or no
+bootloaders. @xref{Bootloader Configuration}.
@item @code{label}
This is the label (a string) as it appears in the bootloader's menu entry.
@@ -18731,7 +18734,9 @@ Keyboard Layout
(keyboard-layout (keyboard-layout "tr")) ;for the console
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))
(keyboard-layout keyboard-layout))) ;for GRUB
(services (cons (set-xorg-configuration
(xorg-configuration ;for Xorg
@@ -42119,132 +42124,124 @@ Bootloader Configuration
@cindex EFI, bootloader
@cindex UEFI, bootloader
@cindex BIOS, bootloader
-The bootloader to use, as a @code{bootloader} object. For now
-@code{grub-bootloader}, @code{grub-efi-bootloader},
-@code{grub-efi-removable-bootloader}, @code{grub-efi-netboot-bootloader},
-@code{grub-efi-netboot-removable-bootloader}, @code{extlinux-bootloader}
-and @code{u-boot-bootloader} are supported.
+The bootloader to use, as a @code{bootloader} object. Available bootloaders, in
+addition to what target types they require, are as follows:
-@cindex ARM, bootloaders
-@cindex AArch64, bootloaders
-Available bootloaders are described in @code{(gnu bootloader @dots{})}
-modules. In particular, @code{(gnu bootloader u-boot)} contains definitions
-of bootloaders for a wide range of ARM and AArch64 systems, using the
-@uref{https://www.denx.de/wiki/U-Boot/, U-Boot bootloader}.
+@itemize
+@vindex depthcharge-veyron-speedy-bootloader
+@item @code{depthcharge-veyron-speedy-bootloader}
+For the Asus C201. Requires a @code{'part} target, denoting the partition to
+install the kernel blob as a @code{device}, @code{label}, or @code{uuid}.
@vindex grub-bootloader
-@code{grub-bootloader} allows you to boot in particular Intel-based machines
-in ``legacy'' BIOS mode.
+@item @code{grub-bootloader}
+GRUB2 for BIOS systems. Requires a @code{'disk} target providing either a
+@code{device}, @code{label}, or @code{uuid}. If root is mounted over NFS, it
+will load its files and the Guix System over
+@acronym{PXE, Preboot eXecution Environment}.
+
+@vindex grub-minimal-bootloader
+@item @code{grub-minimal-bootloader}
+As above, but using a minimal build of GRUB.
@vindex grub-efi-bootloader
-@code{grub-efi-bootloader} allows to boot on modern systems using the
-@dfn{Unified Extensible Firmware Interface} (UEFI). This is what you should
-use if the installation image contains a @file{/sys/firmware/efi} directory
-when you boot it on your system.
-
-@vindex grub-efi-removable-bootloader
-@code{grub-efi-removable-bootloader} allows you to boot your system from
-removable media by writing the GRUB file to the UEFI-specification location of
-@file{/EFI/BOOT/BOOTX64.efi} of the boot directory, usually @file{/boot/efi}.
-This is also useful for some UEFI firmwares that ``forget'' their configuration
-from their non-volatile storage. Like @code{grub-efi-bootloader}, this can only
-be used if the @file{/sys/firmware/efi} directory is available.
+@item @code{grub-efi-bootloader}
+GRUB2 for "modern" systems using the @dfn{Unified Extensible Firmware Interface}
+(UEFI). Requires an @code{'esp} target providing a @code{path} to the mount
+point of the EFI System Partition. If root is mounted over NFS, it will load
+its files and the Guix System over a
+@acronym{TFTP, Trivial File Transfer Protocol} server as configured over
+@acronym{DHCP, Dynamic Host Configuration Protocol} as per PXE.
+
+@vindex extlinux-bootloader
+@item @code{extlinux-bootloader}
+Extlinux for "legacy" BIOS systems. Requires a @code{'disk} target providing
+either a @code{device}, @code{label}, or @code{uuid}.
+
+@vindex extlinux-gpt-bootloader
+@item @code{extlinux-gpt-bootloader}
+As above, but for systems using the GPT instead of MBR partition table.
+
+@cindex Secure Boot, UEFI
+@vindex uki-efi-bootloader
+@item @code{uki-efi-bootloader}
+Makes and installs UKI images for UEFI systems. Requires an @code{'esp} target
+providing a @code{path} to the mount point of the EFI System Partition. Not all
+system generations may be available with this option, as UKI images contain the
+entire kernel and initramfs, and ESPs tend to be small.
+
+Full disk encryption with @code{uki-efi-bootloader} only requires a single
+password entry with fast decryption, in contrast to GRUB2 requiring a second
+password entry with slow, LUKS1-only decryption.
+
+This is the only bootloader to currently support UEFI secure boot, when
+configured as below.
-@quotation Note
-This @emph{will} overwrite the GRUB file from any other operating systems that
-also place their GRUB file in the UEFI-specification location; making them
-unbootable.
-@end quotation
+@cindex ARM, bootloaders
+@cindex AArch64, bootloaders
+@vindex u-boot-a20-olinuxino-lime-bootloader
+@vindex u-boot-a20-olinuxino-lime2-bootloader
+@vindex u-boot-a20-olinuxino-micro-bootloader
+@vindex u-boot-bananapi-m2-ultra-bootloader
+@vindex u-boot-beaglebone-black-bootloader
+@vindex u-boot-cubietruck-bootloader
+@vindex u-boot-firefly-rk3399-bootloader
+@vindex u-boot-mx6cuboxi-bootloader
+@vindex u-boot-nintendo-nes-classic-edition-bootloader
+@vindex u-boot-novena-bootloader
+@vindex u-boot-orangepi-r1-plus-lts-rk3328-bootloader
+@vindex u-boot-pine64-plus-bootloader
+@vindex u-boot-pine64-lts-bootloader
+@vindex u-boot-pinebook-bootloader
+@vindex u-boot-pinebook-pro-rk3399-bootloader
+@vindex u-boot-puma-rk3399-bootloader
+@vindex u-boot-rock64-rk3328-bootloader
+@vindex u-boot-rockpro64-rk3399-bootloader
+@vindex u-boot-sifive-unmatched-bootloader
+@vindex u-boot-qemu-riscv64-bootloader
+@vindex u-boot-starfive-visionfive2-bootloader
+@vindex u-boot-ts7970-q-2g-1000mhz-c-bootloader
+@vindex u-boot-wandboard-bootloader
+@vindex u-boot-rpi-2-bootloader
+@vindex u-boot-rpi-3-bootloader
+@vindex u-boot-rpi-4-bootloader
+@vindex u-boot-rpi-bootloader
+@item U-Boot
+U-Boot has individual bootloaders @code{u-boot-board-bootloader} for each
+of the following @code{board}s: @code{a20-olinuxino-lime},
+@code{a20-olinuxino-lime2}, @code{a20-olinuxino-micro},
+@code{bananapi-m2-ultra}, @code{beaglebone-black}, @code{cubietruck},
+@code{firefly-rk3399}, @code{mx6cuboxi}, @code{nintendo-nes-classic-edition},
+@code{novena}, @code{orangepi-r1-plus-lts-rk3328}, @code{pine64-plus},
+@code{pine64-lts}, @code{pinebook}, @code{pinebook-pro-rk3399},
+@code{puma-rk3399}, @code{rock64-rk3328}, @code{rockpro64-rk3399},
+@code{rpi-2}, @code{rpi-3}, @code{rpi-4}, @code{rpi}, @code{sifive-unmatched},
+@code{ts7970-q-2g-1000mhz-c}, @code{qemu-riscv64}, and @code{wandboard}.
+
+Each of these requires a @code{'disk} target providing either a @code{device},
+@code{label}, or @code{uuid}, except for @code{ts7970-q-2g-1000mhz-c} and
+@code{qemu-riscv64}, in which the bootloader just copies U-Boot to
+@file{/boot/u-boot.imx} or @file{/boot/u-boot.bin}, respectively. You should
+then manually flash it to the SPI flash at the U-Boot prompt.
+
+By default Guix configures U-Boot to boot using a generated extlinux config, but
+U-Boot does support loading UEFI bootloaders, if you want to combine it with
+another.
+@end itemize
-@vindex grub-efi-netboot-bootloader
-@code{grub-efi-netboot-bootloader} allows you to boot your system over network
-through TFTP@. In combination with an NFS root file system this allows you to
-build a diskless Guix system.
-
-The installation of the @code{grub-efi-netboot-bootloader} generates the
-content of the TFTP root directory at @code{targets} (@pxref{Bootloader
-Configuration, @code{targets}}) below the sub-directory @file{efi/Guix}, to be
-served by a TFTP server. You may want to mount your TFTP server directories
-onto the @code{targets} to move the required files to the TFTP server
-automatically during installation.
-
-If you plan to use an NFS root file system as well (actually if you mount the
-store from an NFS share), then the TFTP server needs to serve the file
-@file{/boot/grub/grub.cfg} and other files from the store (like GRUBs background
-image, the kernel (@pxref{operating-system Reference, @code{kernel}}) and the
-initrd (@pxref{operating-system Reference, @code{initrd}})), too. All these
-files from the store will be accessed by GRUB through TFTP with their normal
-store path, for example as
-@file{tftp://tftp-server/gnu/store/…-initrd/initrd.cpio.gz}.
-
-Two symlinks are created to make this possible. For each target in the
-@code{targets} field, the first symlink is
-@samp{target}@file{/efi/Guix/boot/grub/grub.cfg} pointing to
-@file{../../../boot/grub/grub.cfg}, where @samp{target} may be
-@file{/boot}. In this case the link is not leaving the served TFTP root
-directory, but otherwise it does. The second link is
-@samp{target}@file{/gnu/store} and points to @file{../gnu/store}. This
-link is leaving the served TFTP root directory.
-
-The assumption behind all this is that you have an NFS server exporting
-the root file system for your Guix system, and additionally a TFTP
-server exporting your @code{targets} directories—usually a single
-@file{/boot}—from that same root file system for your Guix system. In
-this constellation the symlinks will work.
-
-For other constellations you will have to program your own bootloader
-installer, which then takes care to make necessary files from the store
-accessible through TFTP, for example by copying them into the TFTP root
-directory for your @code{targets}.
-
-It is important to note that symlinks pointing outside the TFTP root directory
-may need to be allowed in the configuration of your TFTP server. Further the
-store link exposes the whole store through TFTP@. Both points need to be
-considered carefully for security aspects. It is advised to disable any TFTP
-write access!
-
-Please note, that this bootloader will not modify the ‘UEFI Boot Manager’ of
-the system.
-
-Beside the @code{grub-efi-netboot-bootloader}, the already mentioned TFTP and
-NFS servers, you also need a properly configured DHCP server to make the booting
-over netboot possible. For all this we can currently only recommend you to look
-for instructions about @acronym{PXE, Preboot eXecution Environment}.
-
-If a local EFI System Partition (ESP) or a similar partition with a FAT
-file system is mounted in @code{targets}, then symlinks cannot be
-created. In this case everything will be prepared for booting from
-local storage, matching the behavior of @code{grub-efi-bootloader}, with
-the difference that all GRUB binaries are copied to @code{targets},
-necessary for booting over the network.
-
-@vindex grub-efi-netboot-removable-bootloader
-@code{grub-efi-netboot-removable-bootloader} is identical to
-@code{grub-efi-netboot-bootloader} with the exception that the
-sub-directory @file{efi/boot} will be used instead of @file{efi/Guix} to
-comply with the UEFI specification for removable media.
+@item @code{targets}
+This is a list of @code{bootloader-target} (see below) structures denoting
+where the bootloader should install itself. Interpretation of specific target
+types and target requirements depend on the specific @code{bootloader} used.
@quotation Note
-This @emph{will} overwrite the GRUB file from any other operating systems that
-also place their GRUB file in the UEFI-specification location; making them
-unbootable.
+Bootloaders have a set of default targets, that can interact with user-specified
+targets. For UEFI bootloaders using the @code{'esp} target, this typically
+includes a @code{'vendir} target. If you configure multiple UEFI bootloaders,
+you should set different @code{'vendir} target @code{path}s for each, each
+@code{offset} from @code{'esp}.
@end quotation
-@item @code{targets}
-This is a list of strings denoting the targets onto which to install the
-bootloader.
-
-The interpretation of targets depends on the bootloader in question.
-For @code{grub-bootloader}, for example, they should be device names
-understood by the bootloader @command{installer} command, such as
-@code{/dev/sda} or @code{(hd0)} (@pxref{Invoking grub-install,,, grub,
-GNU GRUB Manual}). For @code{grub-efi-bootloader} and
-@code{grub-efi-removable-bootloader} they should be mount
-points of the EFI file system, usually @file{/boot/efi}. For
-@code{grub-efi-netboot-bootloader}, @code{targets} should be the mount
-points corresponding to TFTP root directories served by your TFTP
-server.
-
@item @code{menu-entries} (default: @code{'()})
A possibly empty list of @code{menu-entry} objects (see below), denoting
entries to appear in the bootloader menu, in addition to the current
@@ -42254,6 +42251,29 @@ Bootloader Configuration
The index of the default boot menu entry. Index 0 is for the entry of the
current system.
+@item @code{efi-removable?} (default: @var{#f})
+Used by all UEFI bootloaders to determine whether they should be installed to
+the UEFI standard fallback bootloader path (on x86_64,
+@file{/EFI/BOOT/BOOTX64.EFI}). This allows it to be booted from removable media
+or otherwise in cases where the system has not been booted from UEFI already.
+
+@quotation Warning
+This will override any other bootloaders installed to the same path!
+@end quotation
+
+@item @code{32bit?} (default: @var{#f})
+Some 64-bit systems require their bootloaders to be 32-bit, including some early
+UEFI systems and some Raspberry Pis. If that is the case, and the bootloader
+supports it, setting this option will force the bootloader to install as if it
+were on a 32-bit system.
+
+@item @code{keypair} (default: @var{#f})
+Designates a keypair to be used by bootloaders that support some kind of
+cryptographic signature, such as UEFI Secure Boot. This must be a pair
+@code{'(cert . priv)} of paths to the public key (@code{cert}) and private key
+(@code{priv}). The keys these paths point to should be owned by root with 600
+permissions for security purposes.
+
@item @code{timeout} (default: @code{5})
The number of seconds to wait for keyboard input before booting. Set to
0 to boot immediately, and to -1 to wait indefinitely.
@@ -42276,19 +42296,20 @@ Bootloader Configuration
is provided, some bootloaders might use a default theme, that's true
for GRUB.
-@item @code{terminal-outputs} (default: @code{'(gfxterm)})
+@item @code{terminal-outputs} (default: @var{#f})
The output terminals used for the bootloader boot menu, as a list of
-symbols. GRUB accepts the values: @code{console}, @code{serial},
-@code{serial_@{0-3@}}, @code{gfxterm}, @code{vga_text},
-@code{mda_text}, @code{morse}, and @code{pkmodem}. This field
-corresponds to the GRUB variable @code{GRUB_TERMINAL_OUTPUT} (@pxref{Simple
-configuration,,, grub,GNU GRUB manual}).
-
-@item @code{terminal-inputs} (default: @code{'()})
+symbols. When @var{#f}, the default is used. For GRUB this is @code{gfxterm}.
+GRUB accepts the values: @code{console}, @code{serial}, @code{serial_@{0-3@}},
+@code{gfxterm}, @code{vga_text}, @code{mda_text}, @code{morse}, and
+@code{pkmodem}. This field corresponds to the GRUB variable
+@code{GRUB_TERMINAL_OUTPUT}
+(@pxref{Simple configuration,,, grub,GNU GRUB manual}).
+
+@item @code{terminal-inputs} (default: @var{#f})
The input terminals used for the bootloader boot menu, as a list of
-symbols. For GRUB, the default is the native platform terminal as
-determined at run-time. GRUB accepts the values: @code{console},
-@code{serial}, @code{serial_@{0-3@}}, @code{at_keyboard}, and
+symbols. When @var{#f}, the default is used. For GRUB, this is the native
+platform terminal as determined at run-time. GRUB accepts the values:
+@code
This message was truncated. Download the full message here.
S
S
Sergey Trofimov wrote on 4 Aug 10:53 +0200
Re: [bug#72457] [PATCH 00/15] Rewrite bootloader subsystem.
(name . Lilah Tascheter)(address . lilah@lunabee.space)(address . 72457@debbugs.gnu.org)
87a5hszn2r.fsf@sarg.org.ru
Lilah Tascheter <lilah@lunabee.space> writes:

Toggle quote (7 lines)
> The big thing is that this definately needs to be tested. We support lots of
> bootloaders for lots of hardware and I definately do not possess any of it.
> Please test this and send back the results for me to revise any bugs. I've made
> sure as many tests as I could run work, and that GRUB and uefi-uki-bootloader
> work both in regular systems and disk images.
>

I've built a new system generation, but it didn't apply properly,
showing this error:

Toggle snippet (14 lines)
196:43 4 (_ #(#(#(#(#(#(#(#(#(#(#(#(#<directory (gnu bootloader grub) 7fa9e0f99dc0>) install (#<<bootloader-target> type: vendir expected?: #f path: "EFI/Guix" offset: #<procedure offset (a)> device: #f file-system: #f label: #f uuid: #f> #<<bootloader-target> type: install expected?: #f path: "boot" offset: #<procedure offset (a)> device: "/dev/sda1" file-system: "vfat" label: "GNU-ESP" uuid: #vu8(77 160 163 107)> #<<bootloader-target> type: root expected?: #f path: "/" offset: #<procedure offset (a)> device: "/dev/sda2" file-system: "ext4" label: "Guix_image" uuid: #vu8(246 188 138 216 255 26 23 84 83 48 172 24 246 188 138 216)> #<<bootloader-target> type: esp expected?: #f path: "/boot" offset: #<procedure offset (a)> device: "/dev/sda1" file-system: "vfat" label: "GNU-ESP" uuid: #vu8(77 160 163 107)>) "root" #<gexp port /storage/devel/ext/guix/gnu/bootloader/grub.scm:221:54 7fa9e2a11e40>) #<variable 7fa9e4b2b3a0 value: #<procedure form (a b)>>) (…)) #) #) #) #) #) #) #) #))
In gnu/system/uuid.scm:
89:19 3 (dce-uuid->string #vu8(77 160 163 107))
In unknown file:
2 (bytevector-uint-ref #vu8(77 160 163 107) 4 big 2)
In ice-9/boot-9.scm:
1685:16 1 (raise-exception _ #:continuable? _)
1685:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure bytevector-uint-ref: Value out of range: 4


Relevant config part:
Toggle snippet (19 lines)
(bootloader
(bootloader-configuration
(bootloader grub-efi-bootloader)
(targets (list (bootloader-target
(type 'esp)
(path "/boot"))))))

(file-systems
(cons* (file-system
(mount-point "/")
(device (file-system-label "Guix_image"))
(type "ext4"))
(file-system
(mount-point "/boot")
(device (file-system-label "GNU-ESP"))
(type "vfat"))
%base-file-systems))

Filesystem info:
Toggle snippet (7 lines)
$ lsblk -o name,fstype,uuid,label,partuuid,partlabel
NAME FSTYPE UUID LABEL PARTUUID PARTLABEL
sda
??sda1 vfat 6BA3-A04D GNU-ESP 1ec0ace3-d9b3-4254-b9f4-c4aa21e572cd GNU-ESP
??sda2 ext4 f6bc8ad8-ff1a-1754-5330-ac18f6bc8ad8 Guix_image 6dfb79bf-9ec3-4722-91f8-b8e08b8c52a0 Guix_image

Should PARTUUID be used instead of fs UUID? I wasn't able to quickly locate the
place where to make this change.
S
S
Sergey Trofimov wrote on 4 Aug 11:19 +0200
(name . Lilah Tascheter)(address . lilah@lunabee.space)(address . 72457@debbugs.gnu.org)
87v80gy79g.fsf@sarg.org.ru
Sergey Trofimov <sarg@sarg.org.ru> writes:

Toggle quote (12 lines)
> Lilah Tascheter <lilah@lunabee.space> writes:
>
>> The big thing is that this definately needs to be tested. We support lots of
>> bootloaders for lots of hardware and I definately do not possess any of it.
>> Please test this and send back the results for me to revise any bugs. I've made
>> sure as many tests as I could run work, and that GRUB and uefi-uki-bootloader
>> work both in regular systems and disk images.
>>
>
> I've built a new system generation, but it didn't apply properly,
> showing this error:
>
I solved it by explicitly specifying uuid in bootloader-target: `(uuid "6BA3-A04D" 'fat)`.

Another issue is that `./pre-inst-env guix system list-generations` fails to print
older generations. Older guix prints fine even generations created with
the new bootloader code.

Toggle snippet (22 lines)
619:8 3 (_ #(#(#(#(#(#(#(#(#(#(#(#(#<directory (guix scripts system) 7fcc08817b40>) 120 "/var/guix/profiles/system" #f) #<variable 7fcbef
8cd0 value: #<procedure display-channel (a)>>) "/var/guix/profiles/system-120-link") #<<boot-parameters> label: "GNU with Linux 6.9.7" root-de
ce: #<file-system-label "Guix_image"> bootloader-name: (grub-efi) store-device: #<file-system-label "Guix_image"> store-mount-point: "/" store
irectory-prefix: #f store-crypto-devices: () locale: "en_GB.UTF-8" kernel: "/gnu/store/c2xsizqd0rw8jxmrfvvwrvzwmb75r028-linux-6.9.7/bzImage" k
nel-arguments: ("root=Guix_image" #<gexp (string-append (if #<gexp-input #t:out> "gnu.system=" "--system=") #<gexp-input "/var/guix/profiles/s
tem-120-link":out>) /storage/devel/ext/guix/gnu/system/boot.scm:299:11 7fcbee836150> #<gexp (string-append (if #<gexp-input #t:out> "gnu.load=
"--load=") #<gexp-input "/var/guix/profiles/system-120-link":out> "/boot") /storage/devel/ext/guix/gnu/syste…>) #) #) #) #) #) #) …))
163:9 2 (_ #(#(#(#(#(#(#(#(#(#(#(#(#<directory (guix scripts system) 7fcc08817b40>) 120 "/var/guix/profiles/system" #f) #<variable 7fcbef
8cd0 value: #<procedure display-channel (a)>>) "/var/guix/profiles/system-120-link") #<<boot-parameters> label: "GNU with Linux 6.9.7" root-de
ce: #<file-system-label "Guix_image"> bootloader-name: (grub-efi) store-device: #<file-system-label "Guix_image"> store-mount-point: "/" store
irectory-prefix: #f store-crypto-devices: () locale: "en_GB.UTF-8" kernel: "/gnu/store/c2xsizqd0rw8jxmrfvvwrvzwmb75r028-linux-6.9.7/bzImage" k
nel-arguments: ("root=Guix_image" #<gexp (string-append (if #<gexp-input #t:out> "gnu.system=" "--system=") #<gexp-input "/var/guix/profiles/s
tem-120-link":out>) /storage/devel/ext/guix/gnu/system/boot.scm:299:11 7fcbee836150> #<gexp (string-append (if #<gexp-input #t:out> "gnu.load=
"--load=") #<gexp-input "/var/guix/profiles/system-120-link":out> "/boot") /storage/devel/ext/guix/gnu/syste…>) #) #) #) #) #) #) …))
In unknown file:
1 (string-join (grub-efi) #<undefined> #<undefined>)
In ice-9/boot-9.scm:
1685:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure string-append: Wrong type (expecting string): grub-efi
T
T
Tomas Volf wrote on 4 Aug 11:22 +0200
Re: [PATCH 07/15] gnu: system: Fix bootloader crypto device recognition.
(name . Lilah Tascheter)(address . lilah@lunabee.space)(address . 72457@debbugs.gnu.org)
Zq9IVZH3tnoEYWXE@ws
On 2024-08-03 22:55:27 -0500, Lilah Tascheter wrote:
Toggle quote (24 lines)
> * gnu/system.scm (operating-system-bootloader-crypto-devices): Check for
> luks-device-mapping-with-options in addition to luks-device-mapping.
>
> Change-Id: Iafc9afe608640b97083c4d559c9240846330472a
> ---
> gnu/system.scm | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/gnu/system.scm b/gnu/system.scm
> index 66c1a80733..8926e1b065 100644
> --- a/gnu/system.scm
> +++ b/gnu/system.scm
> @@ -400,10 +400,11 @@ (define operating-system-bootloader-crypto-devices
> (mlambdaq (os) ;to avoid duplicated output
> "Return the sources of the LUKS mapped devices specified by UUID."
> ;; XXX: Device ordering is important, we trust the returned one.
> - (let* ((luks-devices (filter (lambda (m)
> - (eq? luks-device-mapping
> - (mapped-device-type m)))
> - (operating-system-boot-mapped-devices os)))
> + (let* ((luks? (lambda (m) (let ((t (mapped-device-type m)))
> + (or (eq? luks-device-mapping t)
> + (eq? luks-device-mapping-with-options t)))))

I think this will not work as expected. luks-device-mapping-with-options is a
procedure to be called, not an object you can eq? against.

Typical use case:

(mapped-device
(source "/dev/sdb1)
(target "data)
(type (luks-device-mapping-with-options
#:key-file "/crypto.key")))

Toggle quote (10 lines)
> + (luks-devices (filter luks?
> + (operating-system-boot-mapped-devices os)))
> (uuid-crypto-devices non-uuid-crypto-devices
> (partition (compose uuid? mapped-device-source)
> luks-devices)))
> --
> 2.45.2
>
>

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmavSFUACgkQL7/ufbZ/
wamhbRAAs0Em3Q0OAsGsdd0j8fH1CCS/6KkWXKW7tNWPh1gK6NDhH/CIbm3CvQHU
5ovmZUXqUW0YN9Cg+Yjy5ubno+bKnMtiiY6CblAzWFDtNlI5wTw15sItK1py8oSC
/vW6bAhMzW2vl2jIaiaRHE4Q8sGY5BRlAxmeRtDhRlRzHhKMbFBEqIGBfyS5yRYm
zJhYUQ+48K9IKAO4lG1mIuo1WOGunjhar5jpzuJBFVye4EIsyHB08hN91tRqa3q7
QMikcEc/vYoYKtnhgzZpdogpwIxAc0bJ2blavpHtSb1XkIUwDtYB8cWu4e5dlwXf
DkW4SSDKfhib8T0Ih40jyZ+tDpbAvgqeKdgHovfG1Ac9600UGyiRNO68LOmVE1qF
jZtOyl8VkjyZA0UeiOBMlsM2kMNVN3B3OYw2eBka1D2908wNOd9BTnAAOf4TzUpn
Y2BJjiLxo/uJt99Un9qZKn7dig2dq9ZGsGPNDsjYebk/rna1valh/HcoP2XvyiqJ
E0P3MJmWL+x4hu1Fh7kuh5y/+JNpVam+DmJvbgNwTn7r3ltIgrmt0IT1xdobPcYS
jKLV2Mn0dOJ+YgEpBe/GjwcUSpTAkrwR97ZuV2d1m5dUNseycIkbBAxWDAa7cmPd
SL2Onuw1ulpcsVARxATMiOpScb4i8ALEU2pI66LTOZ2h4WP7AKg=
=nk9F
-----END PGP SIGNATURE-----


L
L
Lilah Tascheter wrote on 4 Aug 20:05 +0200
[PATCH v2 00/15] Rewrite bootloader subsystem.
(address . 72457@debbugs.gnu.org)
cover.1722794774.git.lilah@lunabee.space
Thanks you two! This patch series should fix those issues; feel free to
double-check though :)

Lilah Tascheter (15):
guix: scripts: Rewrite reinstall-bootloader to use provenance data.
gnu: Add bootloader target infastructure.
guix: scripts: Remove unused code.
gnu: Core bootloader changes.
gnu: system: Remove useless boot parameters.
gnu: bootloader: Add raspberry pi bootloader.
gnu: system: Fix bootloader crypto device recognition.
gnu: packages: Add pesign.
gnu: packages: Add ukify.
gnu: packages: Add systemd-stub.
gnu: bootloaders: Add uki-efi-bootloader.
gnu: system: Update examples.
doc: Update bootloader documentation.
gnu: tests: Update tests to new targets system.
teams: Add bootloading team.

doc/guix.texi | 458 +++---
etc/teams.scm | 10 +
gnu/bootloader.scm | 660 ++++++---
gnu/bootloader/depthcharge.scm | 153 +-
gnu/bootloader/extlinux.scm | 149 +-
gnu/bootloader/grub.scm | 1279 +++++++----------
gnu/bootloader/u-boot.scm | 505 +++----
gnu/bootloader/uki.scm | 96 ++
gnu/build/bootloader.scm | 157 +-
gnu/build/image.scm | 40 +-
gnu/build/install.scm | 16 +-
gnu/image.scm | 3 +
gnu/installer/parted.scm | 12 +-
gnu/local.mk | 1 +
gnu/machine/ssh.scm | 71 +-
gnu/packages/bootloaders.scm | 277 ++--
gnu/packages/efi.scm | 47 +
gnu/packages/raspberry-pi.scm | 18 -
gnu/services/virtualization.scm | 11 +-
gnu/system.scm | 62 +-
gnu/system/boot.scm | 16 +-
gnu/system/examples/asus-c201.tmpl | 6 +-
gnu/system/examples/bare-bones.tmpl | 7 +-
gnu/system/examples/bare-hurd.tmpl | 4 +-
gnu/system/examples/beaglebone-black.tmpl | 6 +-
gnu/system/examples/desktop.tmpl | 4 +-
gnu/system/examples/docker-image.tmpl | 6 +-
gnu/system/examples/lightweight-desktop.tmpl | 4 +-
gnu/system/examples/plasma.tmpl | 4 +-
.../examples/raspberry-pi-64-nfs-root.tmpl | 23 +-
gnu/system/examples/raspberry-pi-64.tmpl | 18 +-
gnu/system/examples/vm-image.tmpl | 5 +-
gnu/system/hurd.scm | 4 +-
gnu/system/image.scm | 162 ++-
gnu/system/images/hurd.scm | 4 +-
gnu/system/images/novena.scm | 3 +-
.../images/orangepi-r1-plus-lts-rk3328.scm | 3 +-
gnu/system/images/pine64.scm | 3 +-
gnu/system/images/pinebook-pro.scm | 3 +-
gnu/system/images/rock64.scm | 3 +-
gnu/system/images/unmatched.scm | 3 +-
gnu/system/images/visionfive2.scm | 3 +-
gnu/system/images/wsl2.scm | 14 +-
gnu/system/install.scm | 43 +-
gnu/system/vm.scm | 11 -
gnu/tests.scm | 4 +-
gnu/tests/ganeti.scm | 4 +-
gnu/tests/image.scm | 4 +-
gnu/tests/install.scm | 80 +-
gnu/tests/nfs.scm | 4 +-
gnu/tests/reconfigure.scm | 86 +-
gnu/tests/telephony.scm | 4 +-
gnu/tests/vnc.scm | 4 +-
guix/scripts/system.scm | 162 +--
guix/scripts/system/reconfigure.scm | 159 +-
guix/ui.scm | 8 +
tests/boot-parameters.scm | 16 +-
57 files changed, 2387 insertions(+), 2535 deletions(-)
create mode 100644 gnu/bootloader/uki.scm


base-commit: 7d781027c78bdea5fdb3f1c9c9ec432b9606d2b5
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 01/15] guix: scripts: Rewrite reinstall-bootloader to use provenance data.
(address . 72457@debbugs.gnu.org)
6d8a2015a9e54642e3ecf0f7d1d95300496cbbde.1722794774.git.lilah@lunabee.space
The current implementation is broken anyway. Multiple bootloaders share
a name (including both versions of extlinux) and
bootloader-configuration data is significant to bootloader installation.
It shouldn't be just faked.

Rely on the provenance service instead, which while not always present,
should be for the vast majority of systems.

* guix/scripts/system.scm (reinstall-bootloader): Rename to...
(install-bootloader-from-provenance): ...this, and rewrite to extract
bootloader-configuration data from system provenance.

(switch-to-system-generation, process-command): Use
install-bootloader-from-provenance.

Change-Id: I5713a43ad4f9f32a129d980db06d70de16b03f27
---
guix/scripts/system.scm | 75 ++++++++++++++---------------------------
1 file changed, 25 insertions(+), 50 deletions(-)

Toggle diff (107 lines)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 0f7d864e06..bb7b5d37bf 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -88,6 +88,7 @@ (define-module (guix scripts system)
#:use-module (srfi srfi-37)
#:use-module (ice-9 format)
#:use-module (ice-9 match)
+ #:use-module (ice-9 receive)
#:use-module (rnrs bytevectors)
#:export (guix-system
read-operating-system
@@ -377,60 +378,33 @@ (define (switch-to-system-generation store spec)
(activate (string-append generation "/activate")))
(if number
(begin
- (reinstall-bootloader store number)
+ (install-bootloader-from-provenance store number)
(switch-to-generation* %system-profile number)
(unless-file-not-found (primitive-load activate)))
(leave (G_ "cannot switch to system generation '~a'~%") spec))))
-(define* (system-bootloader-name #:optional (system %system-profile))
- "Return the bootloader name stored in SYSTEM's \"parameters\" file."
- (let ((params (unless-file-not-found
- (read-boot-parameters-file system))))
- (boot-parameters-bootloader-name params)))
-
-(define (reinstall-bootloader store number)
- "Re-install bootloader for existing system profile generation NUMBER.
-STORE is an open connection to the store."
+(define (install-bootloader-from-provenance store number)
+ "Re-install an old bootloader using provenance data for system profile
+generation NUMBER with store STORE."
(let* ((generation (generation-file-name %system-profile number))
- ;; Detect the bootloader used in %system-profile.
- (bootloader (lookup-bootloader-by-name (system-bootloader-name)))
-
- ;; Use the detected bootloader with default configuration.
- ;; It will be enough to allow the system to boot.
- (bootloader-config (bootloader-configuration
- (bootloader bootloader)))
-
- ;; Make the specified system generation the default entry.
- (chosen-alternative (generation->boot-alternative
- %system-profile number))
- (params (boot-alternative-parameters chosen-alternative))
- (locale (boot-parameters-locale params))
- (store-crypto-devices (boot-parameters-store-crypto-devices params))
- (store-directory-prefix
- (boot-parameters-store-directory-prefix params))
- (old-generations
- (delv number (reverse (generation-numbers %system-profile))))
- (previous-boot-alternatives (profile->boot-alternatives
- %system-profile old-generations))
- (entries (list (boot-parameters->menu-entry params)))
- (old-entries (map boot-parameters->menu-entry
- (map boot-alternative-parameters
- previous-boot-alternatives))))
- (run-with-store store
- (mlet* %store-monad
- ((bootcfg (lower-object
- ((bootloader-configuration-file-generator bootloader)
- bootloader-config entries
- #:locale locale
- #:store-crypto-devices store-crypto-devices
- #:store-directory-prefix store-directory-prefix
- #:old-entries old-entries)))
- (drvs -> (list bootcfg)))
- (mbegin %store-monad
- (built-derivations drvs)
- ;; Only install bootloader configuration file.
- (install-bootloader local-eval bootloader-config bootcfg
- #:run-installer? #f))))))
+ (os (receive (_ os) (system-provenance generation)
+ (and=> os read-operating-system)))
+ (bootloader-config (operating-system-bootloader os))
+ (bootloader (bootloader-configuration-bootloader bootloader-config))
+ (numbers (delv number (reverse (generation-numbers %system-profile))))
+ (old (profile->boot-alternatives %system-profile numbers)))
+ (if os
+ (run-with-store store
+ (mlet* %store-monad
+ ((bootcfg (lower-object (operating-system-bootcfg os old)))
+ (drvs -> (list bootcfg)))
+ (mbegin %store-monad
+ (built-derivations drvs)
+ ;; Only install bootloader configuration file.
+ (install-bootloader local-eval bootloader-config bootcfg
+ #:run-installer? #f))))
+ (leave (G_ "cannot rollback to provenanceless generation '~a'~%")
+ number))))
;;;
@@ -1416,7 +1390,8 @@ (define (process-command command args opts)
(x (leave (G_ "wrong number of arguments~%"))))))
(with-store* store
(delete-matching-generations store %system-profile pattern)
- (reinstall-bootloader store (generation-number %system-profile)))))
+ (install-bootloader-from-provenance store
+ (generation-number %system-profile)))))
((switch-generation)
(let ((pattern (match args
((pattern) pattern)
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 02/15] gnu: Add bootloader target infastructure.
(address . 72457@debbugs.gnu.org)
f21ff71c8ceb6735b88bbd0683adad59f704a1de.1722794774.git.lilah@lunabee.space
* gnu/bootloader.scm (bootloader-target): New record.

(&target-error): New condition.

(pathcat, get-target-of-type, parent-of, unfold-pathcat, target-base?,
type-major?, ensure, ensure-target-types, ensure-majors, gbegin):
New procedures.

(define-literal, with-targets, :path, :devpath, :device,
:fs, :label, :uuid): New macros.

(bootloader-modules): Prevent mutual imports.

* guix/ui.scm (call-with-error-handling)[target-error?]:
Handle target-errors.

Change-Id: I3f07c9096dd8b91c04449b6360b3b7d21640da14
---
gnu/bootloader.scm | 212 ++++++++++++++++++++++++++++++++++++++++++++-
guix/ui.scm | 8 ++
2 files changed, 217 insertions(+), 3 deletions(-)

Toggle diff (277 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index f32e90e79d..3ddc112cc6 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -31,10 +31,11 @@ (define-module (gnu bootloader)
#:use-module (guix profiles)
#:use-module (guix records)
#:use-module (guix deprecation)
- #:use-module ((guix ui) #:select (warn-about-load-error))
#:use-module (guix diagnostics)
#:use-module (guix i18n)
+ #:use-module (guix modules)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (ice-9 match)
@@ -63,6 +64,26 @@ (define-module (gnu bootloader)
bootloader-configuration-file
bootloader-configuration-file-generator
+ <bootloader-target>
+ bootloader-target
+ bootloader-target?
+ bootloader-target-type
+ bootloader-target-expected?
+ bootloader-target-path
+ bootloader-target-offset
+ bootloader-target-device
+ bootloader-target-file-system
+ bootloader-target-label
+ bootloader-target-uuid
+
+ target-error?
+ target-error-type
+ target-error-targets
+
+ gbegin
+ :path :devpath :device :fs :label :uuid
+ with-targets
+
bootloader-configuration
bootloader-configuration?
bootloader-configuration-bootloader
@@ -236,6 +257,191 @@ (define-record-type* <bootloader>
(configuration-file bootloader-configuration-file)
(configuration-file-generator bootloader-configuration-file-generator))
+
+;;;
+;;; Bootloader target record.
+;;;
+
+;; <bootloader-target> represents different kinds of targets in a normalized form.
+
+(define-record-type* <bootloader-target>
+ bootloader-target make-bootloader-target bootloader-target?
+ (type bootloader-target-type) ; symbol
+ (expected? bootloader-target-expected? (default #f)) ; bool
+
+ (path bootloader-target-path (default #f)) ; string|#f
+ (offset bootloader-target-offset (thunked) ; symbol|#f
+ (default (and (bootloader-target-path this-record)
+ (not (eq? (bootloader-target-type this-record) 'root))
+ 'root)))
+ (device bootloader-target-device (default #f)) ; string|#f
+ (file-system bootloader-target-file-system (default #f)) ; string|#f
+ (label bootloader-target-label (default #f)) ; string|#f
+ (uuid bootloader-target-uuid (default #f))) ; uuid|#f
+
+(define-condition-type &target-error &error target-error?
+ (type target-error-type)
+ (targets target-error-targets))
+
+(define (pathcat p1 p2)
+ (string-append (string-trim-right p1 #\/) "/" (string-trim p2 #\/)))
+
+(define* (get-target-of-type type targets #:optional (require? #f))
+ "Finds a target in TARGETS of type TYPE, optionally providing an error when
+not found if REQUIRE? is provided."
+ (let* ((pred (lambda (target) (eq? type (bootloader-target-type target))))
+ (candidates (filter pred targets))
+ (ret (if (pair? candidates) (car candidates) #f)))
+ (if (and require? (not ret))
+ (raise (condition
+ (&message (message (G_ "required, but not provided")))
+ (&target-error (type type) (targets targets))))
+ ret)))
+
+(define (parent-of target targets)
+ (and=> (bootloader-target-offset target)
+ (cut get-target-of-type <> targets #t)))
+
+(define (unfold-pathcat target targets)
+ (let ((quit (lambda (t) (not (and=> t bootloader-target-path)))))
+ (reduce pathcat #f
+ (unfold quit bootloader-target-path (cut parent-of <> targets) target))))
+
+(define (target-base? t)
+ (or (not t) (match-record t <bootloader-target>
+ (expected? offset device label uuid)
+ (or device label uuid (not offset) expected?))))
+
+(define (type-major? target) (memq target '(root esp disk)))
+
+(define (ensure types targets end)
+ (let* ((used-in (cute unfold end identity (cut parent-of <> targets) <>))
+ (cons-in (lambda (t) (cons t (used-in t))))
+ (ensure (map (cut get-target-of-type <> targets #t) types)))
+ (filter ->bool (apply append (map cons-in ensure)))))
+
+(define* (ensure-target-types types targets #:optional (base? #f))
+ "Ensures all TYPES are provided in TARGETS. Returns #t iff every ensured
+target and its requirements are fully provided. Errors out when a required TYPE
+isn't provided. When BASE?, only ensure path requirements up to a device."
+ (not (any bootloader-target-expected?
+ (ensure types targets (if base? target-base? not)))))
+
+(define (ensure-majors types targets)
+ "Errors out when a required TYPE isn't provided, or when use of multiple major
+targets is detected."
+ (let* ((all (map bootloader-target-type (ensure types targets target-base?)))
+ (majors (delete-duplicates (filter type-major? all) eq?)))
+ (if (< (length majors) 2) #t
+ (raise (condition (&message (message (G_ "multiple major targets used")))
+ (&target-error (type majors) (targets targets)))))))
+
+
+
+(define (gbegin . gex)
+ "Sequence provided g-expressions."
+ (case (length gex) ((0) #f) ((1) (car gex)) (else #~(begin #$@gex))))
+
+;; syntax matching on free literals breaks easily, so bind them
+(define-syntax-rule (define-literal id) (define-syntax id (syntax-rules ())))
+(define-literal :path)
+(define-literal :devpath)
+(define-literal :device)
+(define-literal :fs)
+(define-literal :label)
+(define-literal :uuid)
+
+(define-syntax with-targets
+ (cut syntax-case <> ()
+ ((_ targets-expr block ...)
+ (let* ((genvars (compose generate-temporaries iota))
+ (targets (car (genvars 1)))
+
+ (path? (cut syntax-case <> (:path) ((_ :path) #t) (_ #f)))
+ (qualified? (cut syntax-case <> (=>)
+ ((_ => spec ...) (any path? #'(spec ...)))
+ (_ #f)))
+
+ (resolve
+ (lambda (in target base)
+ (with-syntax ((target target) (base base) (targets targets))
+ (syntax-case in
+ (:path :devpath :device :fs :label :uuid)
+ ((name _) (not (identifier? #'name))
+ #`(_ (syntax-error "binds must be to identifiers" #,in)))
+ ((name :device) #'(name (bootloader-target-device base)))
+ ((name :label) #'(name (bootloader-target-label base)))
+ ((name :uuid) #'(name (bootloader-target-uuid base)))
+ ((name :fs) #'(name (bootloader-target-file-system base)))
+ ((name :path) #'(name (unfold-pathcat target targets)))
+ ((name :devpath)
+ #'(name (pathcat "/" (bootloader-target-path target))))
+ (_ #`(_ (syntax-error "invalid binding spec" #,in)))))))
+ (binds
+ (lambda (spec)
+ (syntax-case spec (=>)
+ ((type => binds ...)
+ (with-syntax (((target base) (genvars 2)) (targets targets))
+ (append
+ #`((get (lambda (t) (get-target-of-type t targets #t)))
+ (target (get type))
+ (base (if (target-base? target) target
+ (get (bootloader-target-offset target)))))
+ (map (cut resolve <> #'target #'base) #'(binds ...)))))
+ (_ #f))))
+
+ (blocks
+ (cut syntax-case <> ()
+ ((spec ... expr)
+ (let* ((specs #'(spec ...))
+ (lets (apply append (filter-map binds specs)))
+ (type (cut syntax-case <> (=>)
+ ((t => _ ...) #'t) (t #'t))))
+ (receive (full part) (partition qualified? specs)
+ #`(and (ensure-majors (list #,@(map type specs)) #,targets)
+ (ensure-target-types (list #,@(map type part))
+ #,targets #t)
+ (ensure-target-types (list #,@(map type full))
+ #,targets #f)
+ (let* #,lets expr)))))
+ (bad #'(syntax-error "malformed block" bad)))))
+ "Using the list TARGETS, evaluate and sequence each BLOCK to produce a
+gexp. BLOCK is a set of SPECs followed by an EXPR (evaluating to a gexp). Each
+SPEC denotes a type of target to guard EXPR on their existance and
+full-qualification. This procedure is linear in regards to BLOCKs.
+
+SPEC may be of the following forms:
+@itemize
+@item 'TYPE Requires TYPE to be fully present or promised. Errors otherwise.
+@item ('TYPE => (VAR COMPONENT) ...): As type, but also binds variables. TYPE's
+ COMPONENT is bound to the variable VAR as described below.
+@end itemize
+
+Available COMPONENTs are:
+@itemize
+@item :path (fully-qualified)
+@item :devpath (relative from device)
+@item :device (auto-detected from uuid and label if not user-provided)
+@item :fs
+@item :label
+@item :uuid
+@end itemize
+
+Note that installers may be called multiple times with different targets being
+fully-qualified. To ensure that targets aren't installed multiple times, make sure
+that each BLOCK ensures at least one major target, either directly or indirectly.
+Corrolarily, at most one major target should be ensured per BLOCK, under the same
+conditions. Major targets originate from disk image handling, and are currently:
+@itemize
+@item disk
+@item root
+@item esp
+@end itemize"
+ #`(let ((#,targets targets-expr))
+ (apply gbegin (filter ->bool
+ (list #,@(map blocks #'(block ...))))))))
+ (bad #'(syntax-error "must provide targets" bad))))
+
;;;
;;; Bootloader configuration record.
@@ -305,10 +511,10 @@ (define (bootloader-configuration-targets config)
(define (bootloader-modules)
"Return the list of bootloader modules."
+ ;; don't provide #:warn to prevent mutual imports
(all-modules (map (lambda (entry)
`(,entry . "gnu/bootloader"))
- %load-path)
- #:warn warn-about-load-error))
+ %load-path)))
(define %bootloaders
;; The list of publically-known bootloaders.
diff --git a/guix/ui.scm b/guix/ui.scm
index 9db6f6e9d7..1c9300c9eb 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -36,6 +36,8 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix ui)
+ #:use-module ((gnu bootloader)
+ #:select (target-error? target-error-type target-error-targets))
#:use-module (guix i18n)
#:use-module (guix colors)
#:use-module (guix diagnostics)
@@ -857,6 +859,12 @@ (define (call-with-error-handling thunk)
(invoke-error-stop-signal c)
(cons (invoke-error-program c)
(invoke-error-arguments c))))
+ ((target-error? c)
+ (leave (G_ "bootloader-target '~a'~@[: ~a~] ~
+ among the following targets:~%~{~y~}")
+ (target-error-type c)
+ (and (message-condition? c) (condition-message c))
+ (target-error-targets c)))
((formatted-message? c)
(apply report-error
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 03/15] guix: scripts: Remove unused code.
(address . 72457@debbugs.gnu.org)
a70ac840abad3539f6d542341598d50172f7a0b1.1722794774.git.lilah@lunabee.space
* guix/scripts/system.scm (bootloader-installer-script): Delete.

Change-Id: Ic1e0a523c814e4f1bf44b2721f5658f00066b0ab
---
guix/scripts/system.scm | 22 ----------------------
1 file changed, 22 deletions(-)

Toggle diff (35 lines)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index bb7b5d37bf..344bb74151 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -731,28 +731,6 @@ (define (maybe-suggest-running-guix-pull)
(warning (G_ "Consider running 'guix pull' before 'reconfigure'.~%"))
(warning (G_ "Failing to do that may downgrade your system!~%"))))
-(define (bootloader-installer-script installer
- bootloader device target)
- "Return a file calling INSTALLER gexp with given BOOTLOADER, DEVICE
-and TARGET arguments."
- (scheme-file "bootloader-installer"
- (with-imported-modules '((gnu build bootloader)
- (guix build utils))
- #~(begin
- (use-modules (gnu build bootloader)
- (guix build utils)
- (ice-9 binary-ports)
- (srfi srfi-34)
- (srfi srfi-35))
-
- (guard (c ((message-condition? c) ;XXX: i18n
- (format (current-error-port) "error: ~a~%"
- (condition-message c))
- (exit 1)))
- (#$installer #$bootloader #$device #$target)
- (info (G_ "bootloader successfully installed on '~a'~%")
- #$device))))))
-
(define (local-eval exp)
"Evaluate EXP, a G-Expression, in-place."
(mlet* %store-monad ((lowered (lower-gexp exp))
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 06/15] gnu: bootloader: Add raspberry pi bootloader.
(address . 72457@debbugs.gnu.org)
97328cfde4efcf49ce806234ac09052c9981f1e9.1722794774.git.lilah@lunabee.space
Less adding and more making it an actual bootloader rather than some
weirdly specified packages.

* gnu/bootloader/u-boot.scm (rpi-config, install-rpi): New procedures.
(define-u-bootloader-rpi): New macro.
(u-boot-rpi-2-bootloader, u-boot-rpi-3-bootloader,
u-boot-rpi-4-bootloader, u-boot-rpi-bootloader): New variables.

* gnu/packages/bootloaders.scm (make-u-boot-bin-package): Delete
procedure.
(%u-boot-rpi-efi-description, %u-boot-rpi-efi-description-32-bit,
u-boot-rpi-2-efi, u-boot-rpi-3-32b-efi, u-boot-rpi-4-32b-efi,
u-boot-rpi-arm64-efi, u-boot-rpi-2-bin, u-boot-rpi-3_32b-bin,
u-boot-rpi-4_32b-bin, u-boot-rpi-arm64-bin, u-boot-rpi-2-efi-bin,
u-boot-rpi-3-32b-efi-bin, u-boot-rpi-4-32b-efi-bin,
u-boot-rpi-arm64-efi-bin): Delete variables.

Change-Id: I5139a0b00ec89189e8e7c84e06a7a3b7240259cd
---
gnu/bootloader/u-boot.scm | 66 ++++++++++++++++++++++++-
gnu/packages/bootloaders.scm | 94 +++---------------------------------
2 files changed, 71 insertions(+), 89 deletions(-)

Toggle diff (219 lines)
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 7d3e202f8c..e8dfe9b3a2 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -28,7 +28,10 @@ (define-module (gnu bootloader u-boot)
#:use-module (gnu bootloader)
#:use-module (gnu bootloader extlinux)
#:use-module (gnu packages bootloaders)
+ #:use-module (gnu packages raspberry-pi)
+ #:use-module (gnu system boot)
#:use-module (guix gexp)
+ #:use-module (guix utils)
#:export (u-boot-a20-olinuxino-lime-bootloader
u-boot-a20-olinuxino-lime2-bootloader
u-boot-a20-olinuxino-micro-bootloader
@@ -51,7 +54,11 @@ (define-module (gnu bootloader u-boot)
u-boot-qemu-riscv64-bootloader
u-boot-starfive-visionfive2-bootloader
u-boot-ts7970-q-2g-1000mhz-c-bootloader
- u-boot-wandboard-bootloader))
+ u-boot-wandboard-bootloader
+ u-boot-rpi-2-bootloader
+ u-boot-rpi-3-bootloader
+ u-boot-rpi-4-bootloader
+ u-boot-rpi-bootloader))
(define (make-install-u-boot firmware installers)
(lambda* (#:key bootloader-config #:allow-other-keys . args)
@@ -222,3 +229,60 @@ (define-u-bootloader-copy u-boot-ts7970-q-2g-1000mhz-c-bootloader
(define-u-bootloader-copy u-boot-qemu-riscv64-bootloader
u-boot-qemu-riscv64 "u-boot.bin")
+
+
+;;;
+;;; RasPi bootloader definitions.
+;;;
+
+(define (rpi-config 32?)
+ ;; allows a user-specified custom.txt
+ (plain-file "config.txt"
+ (format #f
+ "arm_64bit=~a~%enable_uart=1~%kernel=u-boot.bin~%include custom.txt~%"
+ (if (or 32? (not (target-64bit?))) "0" "1"))))
+
+(define (install-rpi u-boot-32 u-boot-64)
+ (lambda* (#:key bootloader-config #:allow-other-keys . args)
+ (with-targets (bootloader-configuration-targets bootloader-config)
+ ('install (apply install-extlinux-config args))
+ (('firmware => (firmware :path))
+ (let* ((32? (bootloader-configuration-32bit? bootloader-config))
+ (use-32? (or 32? (not (target-64bit?)) (not u-boot-64))))
+ #~(begin
+ (atomic-copy #$(file-append (if use-32? u-boot-32 u-boot-64)
+ "/libexec/u-boot.bin")
+ (string-append #$firmware "/u-boot.bin"))
+ (atomic-copy #$(rpi-config use-32?)
+ (string-append #$firmware "/config.txt"))))))))
+
+(define-syntax-rule (define-u-bootloader-rpi def-name u-boot-32 u-boot-64)
+ (define def-name
+ (bootloader (name 'u-boot)
+ (default-targets
+ (list (bootloader-target (type 'install)
+ (offset 'firmware)
+ (path "extlinux"))
+ (bootloader-target (type 'firmware)
+ (offset 'root)
+ (path "boot"))))
+ (installer (install-rpi u-boot-32 u-boot-64)))))
+
+
+;; These neither install firmware nor device-tree files for the Raspberry Pi.
+;; They just assume them to be existing in 'install in the same way that some
+;; UEFI firmware with ACPI data is usually assumed to be existing on PCs.
+;; They can be used with either extlinux or as UEFI firmware (alongside, eg,
+;; GRUB).
+(define-u-bootloader-rpi u-boot-rpi-2-bootloader
+ u-boot-rpi-2 #f)
+
+(define-u-bootloader-rpi u-boot-rpi-3-bootloader
+ u-boot-rpi-3-32b u-boot-rpi-arm64)
+
+(define-u-bootloader-rpi u-boot-rpi-4-bootloader
+ u-boot-rpi-4-32b u-boot-rpi-arm64)
+
+;; Usable for any 64-bit raspberry pi.
+(define-u-bootloader-rpi u-boot-rpi-bootloader
+ #f u-boot-rpi-arm64)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 12f918a123..e78602379d 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1409,40 +1409,8 @@ (define-public u-boot-pinebook-pro-rk3399
(modify-inputs (package-inputs base)
(append arm-trusted-firmware-rk3399))))))
-(define*-public (make-u-boot-bin-package u-boot-package
- #:key
- (u-boot-bin "u-boot.bin"))
- "Return a package with a single U-BOOT-BIN file from the U-BOOT-PACKAGE.
-The package name will be that of the U-BOOT package suffixed with \"-bin\"."
- (package
- (name (string-append (package-name u-boot-package) "-bin"))
- (version (package-version u-boot-package))
- (source #f)
- (build-system trivial-build-system)
- (arguments
- (list
- #:builder
- (with-imported-modules '((guix build utils))
- #~(begin
- (use-modules (guix build utils))
- (mkdir #$output)
- (symlink (search-input-file %build-inputs
- (string-append "libexec/" #$u-boot-bin))
- (string-append #$output "/" #$u-boot-bin))))))
- (inputs (list u-boot-package))
- (home-page (package-home-page u-boot-package))
- (synopsis (package-synopsis u-boot-package))
- (description (string-append
- (package-description u-boot-package)
- "\n\n"
- (format #f
- "This package only contains the file ~a."
- u-boot-bin)))
- (license (package-license u-boot-package))))
-
-(define-public %u-boot-rpi-efi-configs
- '("CONFIG_OF_EMBED"
- "CONFIG_OF_BOARD=y"))
+;; get dtbs from firmware to support dtoverlays
+(define-public %u-boot-rpi-configs '("CONFIG_OF_EMBED" "CONFIG_OF_BOARD=y"))
(define %u-boot-rpi-description-32-bit
"This is a 32-bit build of U-Boot.")
@@ -1451,76 +1419,26 @@ (define %u-boot-rpi-description-64-bit
"This is a common 64-bit build of U-Boot for all 64-bit capable Raspberry Pi
variants.")
-(define %u-boot-rpi-efi-description
- "It allows network booting and uses the device-tree from the firmware,
-allowing the usage of overlays. It can act as an EFI firmware for the
-grub-efi-netboot-removable-bootloader.")
-
-(define %u-boot-rpi-efi-description-32-bit
- (string-append %u-boot-rpi-efi-description " "
- %u-boot-rpi-description-32-bit))
-
(define-public u-boot-rpi-2
(make-u-boot-package "rpi_2" "arm-linux-gnueabihf"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-3-32b
(make-u-boot-package "rpi_3_32b" "arm-linux-gnueabihf"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-4-32b
(make-u-boot-package "rpi_4_32b" "arm-linux-gnueabihf"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-arm64
(make-u-boot-package "rpi_arm64" "aarch64-linux-gnu"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-64-bit))
-(define-public u-boot-rpi-2-efi
- (make-u-boot-package "rpi_2" "arm-linux-gnueabihf"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description %u-boot-rpi-efi-description-32-bit))
-
-(define-public u-boot-rpi-3-32b-efi
- (make-u-boot-package "rpi_3_32b" "arm-linux-gnueabihf"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description %u-boot-rpi-efi-description-32-bit))
-
-(define-public u-boot-rpi-4-32b-efi
- (make-u-boot-package "rpi_4_32b" "arm-linux-gnueabihf"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description %u-boot-rpi-efi-description-32-bit))
-
-(define-public u-boot-rpi-arm64-efi
- (make-u-boot-package "rpi_arm64""aarch64-linux-gnu"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description (string-append
- %u-boot-rpi-efi-description " "
- %u-boot-rpi-description-64-bit)))
-
-(define-public u-boot-rpi-2-bin (make-u-boot-bin-package u-boot-rpi-2))
-
-(define-public u-boot-rpi-3_32b-bin (make-u-boot-bin-package u-boot-rpi-3-32b))
-
-(define-public u-boot-rpi-4_32b-bin (make-u-boot-bin-package u-boot-rpi-4-32b))
-
-(define-public u-boot-rpi-arm64-bin (make-u-boot-bin-package u-boot-rpi-arm64))
-
-(define-public u-boot-rpi-2-efi-bin (make-u-boot-bin-package u-boot-rpi-2-efi))
-
-(define-public u-boot-rpi-3-32b-efi-bin
- (make-u-boot-bin-package u-boot-rpi-3-32b-efi))
-
-(define-public u-boot-rpi-4-32b-efi-bin
- (make-u-boot-bin-package u-boot-rpi-4-32b-efi))
-
-(define-public u-boot-rpi-arm64-efi-bin
- (make-u-boot-bin-package u-boot-rpi-arm64-efi))
-
(define u-boot-ts-mx6
;; There is no release; use the latest commit of the
;; 'imx_v2015.04_3.14.52_1.1.0_ga' branch.
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 05/15] gnu: system: Remove useless boot parameters.
(address . 72457@debbugs.gnu.org)
e4050ba0f33f1b80c5058d8ed8fd63be890a4269.1722794774.git.lilah@lunabee.space
* gnu/system.scm (operating-system-boot-parameters,
operating-system-boot-parameters-file): Delete
bootloader-menu-entries.

* gnu/system/boot.scm (boot-parameters)[bootloader-menu-entries]: Delete
fields.
(read-boot-parameters): Don't read bootloader-menu-entries.

* tests/boot-parameters.scm (%grub-boot-parameters,
test-read-boot-parameters, test-read-boot-parameters): Don't include
bootloader-menu-entries.
("read, bootloader-menu-entries, default value"): Delete test.

Change-Id: I46d9cff4604dbfcf654b0820fdb77e72aecffbb4
---
gnu/system.scm | 7 -------
gnu/system/boot.scm | 8 --------
tests/boot-parameters.scm | 14 ++------------
3 files changed, 2 insertions(+), 27 deletions(-)

Toggle diff (120 lines)
diff --git a/gnu/system.scm b/gnu/system.scm
index a345b52d55..66c1a80733 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1304,8 +1304,6 @@ (define* (operating-system-boot-parameters os root-device
(initrd initrd)
(multiboot-modules multiboot-modules)
(bootloader-name bootloader-name)
- (bootloader-menu-entries
- (bootloader-configuration-menu-entries (operating-system-bootloader os)))
(locale locale)
(store-device (ensure-not-/dev (file-system-device store)))
(store-directory-prefix (btrfs-store-subvolume-file-name file-systems))
@@ -1347,11 +1345,6 @@ (define* (operating-system-boot-parameters-file os)
#$(boot-parameters-multiboot-modules params)))
#~())
(bootloader-name #$(boot-parameters-bootloader-name params))
- (bootloader-menu-entries
- #$(map menu-entry->sexp
- (or (and=> (operating-system-bootloader os)
- bootloader-configuration-menu-entries)
- '())))
(locale #$(boot-parameters-locale params))
(store
(device
diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm
index 2b5302ce5f..4d89827ced 100644
--- a/gnu/system/boot.scm
+++ b/gnu/system/boot.scm
@@ -54,7 +54,6 @@ (define-module (gnu system boot)
boot-parameters-label
boot-parameters-root-device
boot-parameters-bootloader-name
- boot-parameters-bootloader-menu-entries
boot-parameters-store-crypto-devices
boot-parameters-store-device
boot-parameters-store-directory-prefix
@@ -113,8 +112,6 @@ (define-record-type* <boot-parameters>
;; partition.
(root-device boot-parameters-root-device)
(bootloader-name boot-parameters-bootloader-name)
- (bootloader-menu-entries ;list of <menu-entry>
- boot-parameters-bootloader-menu-entries)
(store-device boot-parameters-store-device)
(store-mount-point boot-parameters-store-mount-point)
(store-directory-prefix boot-parameters-store-directory-prefix)
@@ -176,11 +173,6 @@ (define (read-boot-parameters port)
((_ args) (list args))
(#f 'grub))) ; for compatibility reasons.
- (bootloader-menu-entries
- (match (assq 'bootloader-menu-entries rest)
- ((_ entries) (map sexp->menu-entry entries))
- (#f '())))
-
;; In the past, we would store the directory name of linux instead of
;; the absolute file name of its image. Detect that and correct it.
(kernel (if (string=? kernel (direct-store-path kernel))
diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm
index 2e7976aa6c..f214de360d 100644
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -64,7 +64,6 @@ (define %root-path "/")
(define %grub-boot-parameters
(boot-parameters
(bootloader-name 'grub)
- (bootloader-menu-entries '())
(root-device %default-root-device)
(label %default-label)
(kernel %default-kernel)
@@ -107,7 +106,6 @@ (define* (test-read-boot-parameters
#:key
(version %boot-parameters-version)
(bootloader-name 'grub)
- (bootloader-menu-entries '())
(label %default-label)
(root-device (quote-uuid %default-root-device))
(kernel %default-kernel)
@@ -127,7 +125,7 @@ (define* (test-read-boot-parameters
(cond ((eq? 'false val) (format #false fmt #false))
(val (format #false fmt val))
(else "")))
- (format #false "(boot-parameters~a~a~a~a~a~a~a~a~a~a)"
+ (format #false "(boot-parameters~a~a~a~a~a~a~a~a~a)"
(sexp-or-nothing " (version ~S)" version)
(sexp-or-nothing " (label ~S)" label)
(sexp-or-nothing " (root-device ~S)" root-device)
@@ -145,9 +143,7 @@ (define* (test-read-boot-parameters
store-crypto-devices))
"")
(sexp-or-nothing " (locale ~S)" locale)
- (sexp-or-nothing " (bootloader-name ~a)" bootloader-name)
- (sexp-or-nothing " (bootloader-menu-entries ~S)"
- bootloader-menu-entries)))
+ (sexp-or-nothing " (bootloader-name ~a)" bootloader-name)))
(let ((str (generate-boot-parameters)))
(call-with-input-string str read-boot-parameters)))
@@ -170,7 +166,6 @@ (define* (test-read-boot-parameters
(test-assert "read, construction, optional fields"
(and (test-read-boot-parameters #:bootloader-name #false)
- (test-read-boot-parameters #:bootloader-menu-entries #false)
(test-read-boot-parameters #:kernel-arguments #false)
(test-read-boot-parameters #:with-store #false)
(test-read-boot-parameters #:store-device #false)
@@ -223,11 +218,6 @@ (define* (test-read-boot-parameters
(boot-parameters-bootloader-name
(test-read-boot-parameters #:bootloader-name #false)))
-(test-eq "read, bootloader-menu-entries, default value"
- '()
- (boot-parameters-bootloader-menu-entries
- (test-read-boot-parameters #:bootloader-menu-entries #false)))
-
(test-eq "read, kernel-arguments, default value"
'()
(boot-parameters-kernel-arguments
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 07/15] gnu: system: Fix bootloader crypto device recognition.
(address . 72457@debbugs.gnu.org)
bfcccd30d3471cefe35d50c4f85492d404087116.1722794774.git.lilah@lunabee.space
* gnu/system.scm (operating-system-bootloader-crypto-devices): Check for
luks-device-mapping-with-options in addition to luks-device-mapping.

Change-Id: Iafc9afe608640b97083c4d559c9240846330472a
---
gnu/system.scm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

Toggle diff (23 lines)
diff --git a/gnu/system.scm b/gnu/system.scm
index 66c1a80733..093c8fa350 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -400,10 +400,12 @@ (define operating-system-bootloader-crypto-devices
(mlambdaq (os) ;to avoid duplicated output
"Return the sources of the LUKS mapped devices specified by UUID."
;; XXX: Device ordering is important, we trust the returned one.
- (let* ((luks-devices (filter (lambda (m)
- (eq? luks-device-mapping
- (mapped-device-type m)))
- (operating-system-boot-mapped-devices os)))
+ ;; Check against the close-luks-device procedure to get both maptypes
+ (let* ((close (mapped-device-kind-close luks-device-mapping))
+ (luks? (lambda (m) (let ((t (mapped-device-type m)))
+ (eq? (mapped-device-kind-close t) close))))
+ (luks-devices (filter luks?
+ (operating-system-boot-mapped-devices os)))
(uuid-crypto-devices non-uuid-crypto-devices
(partition (compose uuid? mapped-device-source)
luks-devices)))
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 08/15] gnu: packages: Add pesign.
(address . 72457@debbugs.gnu.org)
39b247716398486dd90f7477838897ce9b236113.1722794774.git.lilah@lunabee.space
* gnu/packages/efi.scm (pesign): New variable.

Change-Id: I00fcc679d9514c85d508183b9ec7e121e0a814db
---
gnu/packages/efi.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)

Toggle diff (69 lines)
diff --git a/gnu/packages/efi.scm b/gnu/packages/efi.scm
index 499745eba1..417b70d91b 100644
--- a/gnu/packages/efi.scm
+++ b/gnu/packages/efi.scm
@@ -24,8 +24,10 @@ (define-module (gnu packages efi)
#:use-module (gnu packages bash)
#:use-module (gnu packages linux)
#:use-module (gnu packages man)
+ #:use-module (gnu packages nss)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages popt)
#:use-module (gnu packages tls)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
@@ -153,6 +155,51 @@ (define-public sbsigntools
(home-page "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/")
(license license:gpl3+)))
+(define-public pesign
+ (package
+ (name "pesign")
+ (version "116")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/rhboot/pesign")
+ (commit version)))
+ (snippet #~(substitute* "Make.defaults"
+ (("pkg-config-ccldflags") "pkg-config-ldflags")))
+ (modules '((guix build utils)))
+ (sha256
+ (base32
+ "0fnqfiivj46bha4hsnwiqy8vq8b4i3w2dig0h9h2k4j7yq7r5qvj"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list #:tests? #f
+ #:modules '((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 match))
+ #:phases #~(modify-phases %standard-phases (delete 'configure))
+ #:make-flags
+ (let ((system (%current-system)) (target (%current-target-system)))
+ (define (arch s) (match (string-split s #\-)
+ (("i386" _ ...) "ia32")
+ (("i486" _ ...) "ia32")
+ (("i586" _ ...) "ia32")
+ (("i686" _ ...) "ia32")
+ ((x _ ...) x)))
+ #~(list "prefix=/" "libdir=/lib/"
+ (string-append "DESTDIR=" #$output)
+ (string-append "HOSTARCH=" #$(arch system))
+ (string-append "ARCH=" #$(arch (or target system)))
+ (string-append "CROSS_COMPILE="
+ #$@(if target (list target "-gcc") '()))))))
+ (inputs (list efivar nspr nss popt `(,util-linux "lib")))
+ (native-inputs (list mandoc pkg-config))
+ (synopsis "PE-COFF binary signing tools")
+ (description "Supports EFI keygen and subsequent signing of PE-COFF
+binaries. Contains the tools authvar, efikeygen, pesigcheck, pesign,
+pesign-client, and pesum.")
+ (home-page "https://github.com/rhboot/pesign")
+ (license license:gpl2+)))
+
(define-public efitools
(package
(name "efitools")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 09/15] gnu: packages: Add ukify.
(address . 72457@debbugs.gnu.org)
da1bc0531a6467a987f99975ab53cc83eb7564e2.1722794774.git.lilah@lunabee.space
* gnu/packages/bootloaders.scm
(systemd-version,systemd-source,ukify): New variables.

Change-Id: Icde59b7266529c8002331ff0375e0a35af3a2add
---
gnu/packages/bootloaders.scm | 54 ++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)

Toggle diff (93 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index e78602379d..04bb1b06f0 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -20,6 +20,7 @@
;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2023 Herman Rimm <herman@rimm.ee>
;;; Copyright © 2024 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2024 Lilah Tascheter <lilah@lunabee.space>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -47,6 +48,7 @@ (define-module (gnu packages bootloaders)
#:use-module (gnu packages compression)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages disk)
+ #:use-module (gnu packages efi)
#:use-module (gnu packages firmware)
#:use-module (gnu packages flex)
#:use-module (gnu packages fontutils)
@@ -73,11 +75,13 @@ (define-module (gnu packages bootloaders)
#:use-module (gnu packages valgrind)
#:use-module (gnu packages virtualization)
#:use-module (gnu packages xorg)
+ #:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (guix build-system gnu)
#:use-module (guix build-system meson)
#:use-module (guix build-system pyproject)
+ #:use-module (guix build-system python)
#:use-module (guix build-system trivial)
#:use-module (guix download)
#:use-module (guix gexp)
@@ -573,6 +577,56 @@ (define-public syslinux
;; Also contains:
license:expat license:isc license:zlib)))))
+(define systemd-version "255")
+(define systemd-source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/systemd/systemd")
+ (commit (string-append "v" systemd-version))))
+ (file-name (git-file-name "systemd" systemd-version))
+ (snippet #~(substitute* "src/ukify/ukify.py" ; remove after python 3.11
+ (("datetime\\.UTC") "datetime.timezone.utc")))
+ (modules '((guix build utils)))
+ (sha256
+ (base32
+ "1qdyw9g3jgvsbc1aryr11gpc3075w5pg00mqv4pyf3hwixxkwaq6"))))
+
+(define-public ukify
+ (package
+ (name "ukify")
+ (version systemd-version)
+ (source systemd-source)
+ (build-system python-build-system)
+ (arguments
+ (list #:phases
+ #~(modify-phases %standard-phases
+ (replace 'build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (define (get-tool tool)
+ (search-input-file inputs (string-append "bin/" tool)))
+
+ (substitute* "src/ukify/ukify.py" ; hardcode tool paths
+ (("(find_tool\\(')(readelf|sbsign|pesign)'," _ ctx tool)
+ (string-append ctx (get-tool tool) "',"))
+ (("('name': ')(sbverify|pesign)'," _ ctx tool)
+ (string-append ctx (get-tool tool) "',")))))
+ (delete 'check)
+ (replace 'install
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((bin (string-append #$output "/bin"))
+ (file (string-append bin "/ukify")))
+ (mkdir-p bin)
+ (copy-file "src/ukify/ukify.py" file)))))))
+ (inputs
+ (list binutils pesign python-cryptography python-pefile sbsigntools))
+ (home-page "https://systemd.io/")
+ (synopsis "Unified kernel image UEFI tool")
+ (description "@command{ukify} joins together a UKI stub, linux kernel, initrd,
+kernel arguments, and optional secure boot signatures into a single, UEFI-bootable
+image.")
+ (license license:lgpl2.1+)))
+
(define-public dtc
(package
(name "dtc")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 04/15] gnu: Core bootloader changes.
(address . 72457@debbugs.gnu.org)
d0f0139cc4f40654de5e8c349eff4d5f59948c44.1722794774.git.lilah@lunabee.space
Sorry this is a massive commit. It's kinda impossible to split it without
either completely breaking basic functionality or making a buggy shim
layer that's written just to be immediately removed.

But, anyway, this is the real body of the bootloader subsystem update.
One of my favorite new things possible with this is easy generation of
disk images using arbitrary bootloaders, including ones that require one
or more data/install partitions (such as p-boot or depthcharge)!

* gnu/bootloader.scm (menu-entry): Add device-subvol field.
(menu-entry->sexp, sexp->menu-entry): Support device-subvol.
(normalize-file, warn-update-targets, target-overrides, normalize,
bootloader-configuration->gexp, bootloader-configurations->gexps,
efi-arch, install-efi):
New procedures.
(bootloader): Rewrite record.
(bootloader-configuration)[target]: Remove deprecated field.
[targets]: Include sanitizer and allow multiple bootloaders.
[terminal-outputs, terminal-inputs]: Don't assume grub.
[efi-removable?, 32bit?]: New fields.
(warn-target-field-deprecation): Delete deprecation warning.
(%bootloaders): Delete variable.
(bootloader-configuration-target, bootloader-configuration-targets,
lookup-bootloader-by-name, bootloader-modules, efi-bootloader-profile,
efi-bootloader-chain): Delete procedures.

* gnu/bootloader/depthcharge.scm, gnu/bootloader/extlinux.scm,
gnu/bootloader/grub.scm, gnu/bootloader/u-boot.scm: Rewrite entirely.

* gnu/build/bootloader.scm (parse-bootnums): New variable.
(atomic-copy, in-temporary-directory, efi-bootnums): New procedures.
(install-efi-loader): Delete procedure.
(install-efi): Rewrite to support installation of any efi bootloader.

* gnu/build/image.scm (initialize-efi32-partition: Deprecate.
(initialize-efi-partitition): Only create EFI directory.
(initialize-root-partition): Don't install bootloader here.
(make-iso9660-image): Pull in grub.dir instead of a bootcfg.

* gnu/build/install.scm (install-boot-config): Delete procedure.

* gnu/image.scm (partition)[target]: New field in order to support
dynamic provision of image partitions as bootloader targets.

* gnu/installer/parted.scm (bootloader-configuration),
gnu/machine/ssh.scm (deploy-managed-host) (roll-back-managed-host):
Use new bootloader system.

* gnu/packages/bootloaders.scm (make-grub-efi-netboot): Delete
procedure.

* gnu/packages/raspberry-pi.scm (grub-efi-bootloader-chain-raspi-64):
Delete procedure. Can be recreated with a raspberry pi bootloader
combined with grub-efi.

* gnu/system.scm (convert-bootloader-field): New procedure.
(operating-system)[bootloader]: Use above sanitizer and support
multiple bootloaders.
(operating-system-bootcfg): Rename to...
(operating-system-bootmeta): ...this. Rewrite to return relavent
information instead of calling the config procedure directly.
(operating-system-boot-parameters): Support multiple bootloaders.

* gnu/system/boot.scm (read-boot-parameters): Support multiple
bootloaders.
(boot-parameters->menu-entry): Support device-subvol.
(boot-alternative->menu-entry): New procedure.

* gnu/system/image.scm (root-partition, esp-partition): Use target field.
(esp32-partition, efi32-disk-partition, efi32-raw-image-type): Deprecate.
(root-partition-index): Delete procedure.
(system-disk-image, system-iso9960-image): Support new bootloader system.
(system-disk-image)[targets]: New subprocedure.

* gnu/system/images/hurd.scm (hurd-barebones-os)[bootloader],
gnu/system/images/novena.scm (novena-barebones-os)[bootloader],
gnu/system/images/orangepi-r1-plus-lts-rk3328.scm
(orangepi-r1-plus-lts-rk3328-barebones-os)[bootloader],
gnu/system/images/pine64.scm (pine64-barebones-os)[bootloader],
gnu/system/images/pinebook-pro.scm
(pinebook-pro-barebones-os)[bootloader],
gnu/system/images/rock64.scm (rock64-barebones-os)[bootloader],
gnu/system/images/unmatched.scm (unmatched-barebones-os)[bootloader],
gnu/system/images/visionfive2.scm
(visionfive2-barebones-os)[bootloader]: Use new target format.

* gnu/system/images/wsl2.scm (dummy-bootloader): Delete variable.
(wsl-os)[bootloader]: Don't provide field.

* gnu/system/install.scm (installation-os)[bootloader]: Use new format.
(os-with-u-boot): Delete procedure.
(embedded-installation-os)[bootloader]: Use new format.
(beaglebone-black-installation-os, a20-olinuxino-lime-installation-os,
a20-olinuxino-lime2-emmc-installation-os,
a20-olinuxino-micro-installation-os, bananapi-m2-ultra-installation-os,
firefly-rk3399-installation-os, mx6cuboxi-installation-os,
novena-installation-os, nintendo-nes-classic-edition-installation-os,
orangepi-r1-plus-lts-rk3328-installation-os, pine64-plus-installation-os,
pinebook-installation-os, rock64-installation-os,
rockpro64-installation-os, rk3399-puma-installation-os,
wandboard-installation-os): Don't guess block device.

* gnu/system/vm.scm (virtualized-operating-system): Don't provide
bootloader.

* gnu/tests/install.scm (%minimal-extlinux-os)[bootloader]: Use proper
extlinux variable.
(%btrfs-raid10-root-os): Use multiple bootloaders.

* gnu/tests/reconfigure.scm (%test-install-bootloader): Delete variable.
(run-install-bootloader-test): Delete procedure.

* guix/scripts/system.scm (install, install-bootloader-from-provenance,
perform-action): Support multiple bootloaders and work with new
bootloader system instead of bootcfgs.
(display-system-generation): Support multiple bootloaders.

* guix/scripts/system/reconfigure.scm (install-bootloader-program):
Rewrite to simply insert each bootloader's installer in the gexp
directly, instead of copying bootcfgs.
(install-bootloader): Work with new bootloader system. Just in case,
add install-bootloader.scm to the gc roots too.

Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739
---
gnu/bootloader.scm | 440 +++---
gnu/bootloader/depthcharge.scm | 153 +-
gnu/bootloader/extlinux.scm | 149 +-
gnu/bootloader/grub.scm | 1279 +++++++----------
gnu/bootloader/u-boot.scm | 439 ++----
gnu/build/bootloader.scm | 157 +-
gnu/build/image.scm | 40 +-
gnu/build/install.scm | 16 +-
gnu/image.scm | 3 +
gnu/installer/parted.scm | 12 +-
gnu/machine/ssh.scm | 71 +-
gnu/packages/bootloaders.scm | 86 --
gnu/packages/raspberry-pi.scm | 18 -
gnu/system.scm | 45 +-
gnu/system/boot.scm | 8 +-
gnu/system/image.scm | 162 ++-
gnu/system/images/hurd.scm | 4 +-
gnu/system/images/novena.scm | 3 +-
.../images/orangepi-r1-plus-lts-rk3328.scm | 3 +-
gnu/system/images/pine64.scm | 3 +-
gnu/system/images/pinebook-pro.scm | 3 +-
gnu/system/images/rock64.scm | 3 +-
gnu/system/images/unmatched.scm | 3 +-
gnu/system/images/visionfive2.scm | 3 +-
gnu/system/images/wsl2.scm | 14 +-
gnu/system/install.scm | 43 +-
gnu/system/vm.scm | 11 -
gnu/tests/install.scm | 10 +-
gnu/tests/reconfigure.scm | 86 +-
guix/scripts/system.scm | 89 +-
guix/scripts/system/reconfigure.scm | 159 +-
31 files changed, 1425 insertions(+), 2090 deletions(-)

Toggle diff (300 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 3ddc112cc6..cb96b076ae 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
;;; Copyright © 2022 Reza Alizadeh Majd <r.majd@pantherx.org>
;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
+;;; Copyright © 2024 Lilah Tascheter <lilah@lunabee.space>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -24,45 +25,53 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu bootloader)
+ #:autoload (gnu build file-systems)
+ (read-partition-label read-partition-uuid
+ find-partition-by-label find-partition-by-uuid)
+ #:use-module (gnu packages linux)
#:use-module (gnu system file-systems)
#:use-module (gnu system uuid)
- #:use-module (guix discovery)
- #:use-module (guix gexp)
- #:use-module (guix profiles)
- #:use-module (guix records)
+ #:autoload (guix build syscalls)
+ (mounts mount-source mount-point mount-type)
#:use-module (guix deprecation)
#:use-module (guix diagnostics)
+ #:use-module (guix gexp)
#:use-module (guix i18n)
#:use-module (guix modules)
+ #:use-module (guix profiles)
+ #:use-module (guix records)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 receive)
+ #:use-module (rnrs bytevectors)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
- #:use-module (ice-9 match)
- #:export (menu-entry
+ #:export (<menu-entry>
+ menu-entry
menu-entry?
menu-entry-label
menu-entry-device
+ menu-entry-device-mount-point
+ menu-entry-device-subvol
menu-entry-linux
menu-entry-linux-arguments
menu-entry-initrd
- menu-entry-device-mount-point
menu-entry-multiboot-kernel
menu-entry-multiboot-arguments
menu-entry-multiboot-modules
menu-entry-chain-loader
+ normalize-file
menu-entry->sexp
sexp->menu-entry
bootloader
bootloader?
bootloader-name
- bootloader-package
+ bootloader-default-targets
bootloader-installer
- bootloader-disk-image-installer
- bootloader-configuration-file
- bootloader-configuration-file-generator
<bootloader-target>
bootloader-target
@@ -84,13 +93,15 @@ (define-module (gnu bootloader)
:path :devpath :device :fs :label :uuid
with-targets
+ <bootloader-configuration>
bootloader-configuration
bootloader-configuration?
bootloader-configuration-bootloader
- bootloader-configuration-target ;deprecated
bootloader-configuration-targets
bootloader-configuration-menu-entries
bootloader-configuration-default-entry
+ bootloader-configuration-efi-removable?
+ bootloader-configuration-32bit?
bootloader-configuration-timeout
bootloader-configuration-keyboard-layout
bootloader-configuration-theme
@@ -101,10 +112,11 @@ (define-module (gnu bootloader)
bootloader-configuration-device-tree-support?
bootloader-configuration-extra-initrd
- %bootloaders
- lookup-bootloader-by-name
+ bootloader-configuration->gexp
+ bootloader-configurations->gexp
- efi-bootloader-chain))
+ efi-arch
+ install-efi))
;;;
@@ -119,6 +131,8 @@ (define-record-type* <menu-entry>
(default #f))
(device-mount-point menu-entry-device-mount-point
(default #f))
+ (device-subvol menu-entry-device-subvol
+ (default #f))
(linux menu-entry-linux
(default #f))
(linux-arguments menu-entry-linux-arguments
@@ -135,6 +149,18 @@ (define-record-type* <menu-entry>
(chain-loader menu-entry-chain-loader
(default #f))) ; string, path of efi file
+(define (normalize-file entry val)
+ "Normalize a file VAL stored in a menu entry into one suitable for a
+bootloader. Realizes device-mount-point and device-subvol."
+ (match-record entry <menu-entry> (device-mount-point device-subvol)
+ #~(let* ((rel (lambda (s) (substring s (if (string-prefix? "/" s) 1 0))))
+ (file (rel #$val))
+ (subvol (and=> #$device-subvol rel))
+ (mount (and=> #$device-mount-point rel)))
+ (string-append (if subvol (string-append "/" subvol "/") "/")
+ (if (and mount (string-prefix? mount file))
+ (substring file (string-length mount)) file)))))
+
(define (report-menu-entry-error menu-entry)
(raise
(condition
@@ -162,7 +188,7 @@ (define (menu-entry->sexp entry)
`(label ,(file-system-label->string label)))
(_ device)))
(match entry
- (($ <menu-entry> label device mount-point
+ (($ <menu-entry> label device mount-point subvol
(? identity linux) linux-arguments (? identity initrd)
#f () () #f)
`(menu-entry (version 0)
@@ -171,8 +197,9 @@ (define (menu-entry->sexp entry)
(device-mount-point ,mount-point)
(linux ,linux)
(linux-arguments ,linux-arguments)
- (initrd ,initrd)))
- (($ <menu-entry> label device mount-point #f () #f
+ (initrd ,initrd)
+ (device-subvol ,subvol)))
+ (($ <menu-entry> label device mount-point subvol #f () #f
(? identity multiboot-kernel) multiboot-arguments
multiboot-modules #f)
`(menu-entry (version 0)
@@ -181,19 +208,23 @@ (define (menu-entry->sexp entry)
(device-mount-point ,mount-point)
(multiboot-kernel ,multiboot-kernel)
(multiboot-arguments ,multiboot-arguments)
- (multiboot-modules ,multiboot-modules)))
- (($ <menu-entry> label device mount-point #f () #f #f () ()
+ (multiboot-modules ,multiboot-modules)
+ (device-subvol ,subvol)))
+ (($ <menu-entry> label device mount-point subvol #f () #f #f () ()
(? identity chain-loader))
`(menu-entry (version 0)
(label ,label)
(device ,(device->sexp device))
(device-mount-point ,mount-point)
- (chain-loader ,chain-loader)))
+ (chain-loader ,chain-loader)
+ (device-subvol ,subvol)))
(_ (report-menu-entry-error entry))))
(define (sexp->menu-entry sexp)
"Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry>
record."
+ ;; XXX: rely on shadowing to support the match ors below
+ (define subvol #f)
(define (sexp->device device-sexp)
(match device-sexp
(('uuid type uuid-string)
@@ -206,35 +237,41 @@ (define (sexp->menu-entry sexp)
('label label) ('device device)
('device-mount-point mount-point)
('linux linux) ('linux-arguments linux-arguments)
- ('initrd initrd) _ ...)
+ ('initrd initrd)
+ (or ('device-subvol subvol _ ...) (_ ...)))
(menu-entry
(label label)
(device (sexp->device device))
(device-mount-point mount-point)
+ (device-subvol subvol)
(linux linux)
(linux-arguments linux-arguments)
(initrd initrd)))
(('menu-entry ('version 0)
('label label) ('device device)
- ('device-mount-point mount-point)
+ ('device-mount-point mount-point) ('device-subvol subvol)
('multiboot-kernel multiboot-kernel)
('multiboot-arguments multiboot-arguments)
- ('multiboot-modules multiboot-modules) _ ...)
+ ('multiboot-modules multiboot-modules)
+ (or ('device-subvol subvol _ ...) (_ ...)))
(menu-entry
(label label)
(device (sexp->device device))
(device-mount-point mount-point)
+ (device-subvol subvol)
(multiboot-kernel multiboot-kernel)
(multiboot-arguments multiboot-arguments)
(multiboot-modules multiboot-modules)))
(('menu-entry ('version 0)
('label label) ('device device)
- ('device-mount-point mount-point)
- ('chain-loader chain-loader) _ ...)
+ ('device-mount-point mount-point) ('device-subvol subvol)
+ ('chain-loader chain-loader)
+ (or ('device-subvol subvol _ ...) (_ ...)))
(menu-entry
(label label)
(device (sexp->device device))
(device-mount-point mount-point)
+ (device-subvol subvol)
(chain-loader chain-loader)))))
@@ -247,15 +284,10 @@ (define (sexp->menu-entry sexp)
;; has to be described by this record.
(define-record-type* <bootloader>
- bootloader make-bootloader
- bootloader?
- (name bootloader-name)
- (package bootloader-package)
- (installer bootloader-installer)
- (disk-image-installer bootloader-disk-image-installer
- (default #f))
- (configuration-file bootloader-configuration-file)
- (configuration-file-generator bootloader-configuration-file-generator))
+ bootloader make-bootloader bootloader?
+ (name bootloader-name)
+ (default-targets bootloader-default-targets (default '()))
+ (installer bootloader-installer))
;;;
@@ -450,28 +482,48 @@ (define-syntax with-targets
;; The <bootloader-configuration> record contains bootloader independant
;; configuration used to fill bootloader configuration file.
-(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)
+(define-with-syntax-properties (warn-update-targets (value properties))
+ (let ((loc (source-properties->location properties)))
+ (define update
+ (match-lambda
+ ((? bootloader-target? target) (cons #f target))
+ ((? string? s) (cons #t (if (string-prefix? "/dev" s)
+ (bootloader-target
+ (type 'disk)
+ (device s))
+ (bootloader-target
+ (type 'esp)
+ (offset 'root)
+ (path s)))))
+ (x (error loc (G_ "invalid target '~a'~%") x))))
+
+ (let* ((updated (map update (if (list? value) value (list value))))
+ (targets (map cdr updated))
+ (types (map bootloader-target-type targets)))
+ ;; XXX: should this be an error?
+ (when (any car updated)
+ (warning loc (G_ "the 'targets' field should now contain \
+<bootloader-target> records. inferring a best guess (this might break!)...~%")))
+ (when (not (eqv? (length types) (length (delete-duplicates types))))
+ (error loc (G_ "the 'targets' field may not contain duplicates~%")))
+ targets)))
(define-record-type* <bootloader-configuration>
bootloader-configuration make-bootloader-configuration
bootloader-configuration?
(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))
+ bootloader-config
This message was truncated. Download the full message here.
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 10/15] gnu: packages: Add systemd-stub.
(address . 72457@debbugs.gnu.org)
d393d581e40a2d3ca3c92e6baacac64f1f84a7cb.1722794774.git.lilah@lunabee.space
* gnu/bootloader.scm (%efi-supported-systems, lazy-efibootmgr): New variable.
(install-efi): Use lazy-efibootmgr.
* gnu/packages/bootloaders.scm (systemd-stub): New variable.

Change-Id: I974bad9ff7a52f736286d05de53f7c5ccb60b9d6
---
gnu/bootloader.scm | 13 +++++++++--
gnu/packages/bootloaders.scm | 43 ++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 2 deletions(-)

Toggle diff (120 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index cb96b076ae..bc1eb74ae9 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -28,7 +28,6 @@ (define-module (gnu bootloader)
#:autoload (gnu build file-systems)
(read-partition-label read-partition-uuid
find-partition-by-label find-partition-by-uuid)
- #:use-module (gnu packages linux)
#:use-module (gnu system file-systems)
#:use-module (gnu system uuid)
#:autoload (guix build syscalls)
@@ -115,6 +114,7 @@ (define-module (gnu bootloader)
bootloader-configuration->gexp
bootloader-configurations->gexp
+ %efi-supported-systems
efi-arch
install-efi))
@@ -645,6 +645,11 @@ (define (bootloader-configurations->gexp bootloader-configs . rest)
;;; EFI shit
;;;
+;; systems currently supported by efi-arch. should be used for packages relying
+;; on it.
+(define %efi-supported-systems
+ '("i686-linux" "x86_64-linux" "armhf-linux" "aarch64-linux" "riscv64-linux"))
+
(define* (efi-arch #:key (target (or (%current-target-system) (%current-system)))
(32? #f))
"Returns the UEFI architecture name for the current target, in lowercase."
@@ -656,6 +661,10 @@ (define* (efi-arch #:key (target (or (%current-target-system) (%current-system))
(else (raise (formatted-message (G_ "no UEFI standard arch for ~a!")
target)))))
+(define (lazy-efibootmgr)
+ "Lazy-loaded efibootmgr package, in order to prevent circular refs."
+ (module-ref (resolve-interface '(gnu packages linux)) 'efibootmgr))
+
(define (install-efi bootloader-config plan)
"Returns a gexp installing PLAN to the ESP, as denoted by the 'vendir target.
PLAN is a gexp of a list of '(BUILDER DEST-BASENAME . LABEL) triples, that
@@ -678,5 +687,5 @@ (define (install-efi bootloader-config plan)
;; normal install when not doing a removable config
(with-targets targets
(('vendir => (vendir :path) (loader :devpath) (disk :device))
- #~(install-efi #+(file-append efibootmgr "/sbin/efibootmgr")
+ #~(install-efi #+(file-append (lazy-efibootmgr) "/sbin/efibootmgr")
#$vendir #$loader #$disk #$plan))))))
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 04bb1b06f0..2bc04059d2 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -38,6 +38,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages bootloaders)
+ #:use-module (gnu bootloader)
#:use-module (gnu packages)
#:use-module (gnu packages assembly)
#:use-module (gnu packages base)
@@ -54,6 +55,7 @@ (define-module (gnu packages bootloaders)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gettext)
+ #:use-module (gnu packages gperf)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages man)
@@ -592,6 +594,47 @@ (define systemd-source
(base32
"1qdyw9g3jgvsbc1aryr11gpc3075w5pg00mqv4pyf3hwixxkwaq6"))))
+(define-public systemd-stub
+ (package
+ (name "systemd-stub")
+ (version systemd-version)
+ (source systemd-source)
+ (build-system meson-build-system)
+ (arguments
+ (list #:configure-flags
+ #~(list "-Dmode=release" "-Defi=true" "-Dsbat-distro=guix"
+ "-Dsbat-distro-generation=1" ; package revision!
+ "-Dsbat-distro-summary=Guix System"
+ "-Dsbat-distro-url=https://guix.gnu.org"
+ #$(string-append "-Dsbat-distro-pkgname="
+ (package-name this-package))
+ #$(string-append "-Dsbat-distro-version="
+ (package-version this-package)))
+ #:phases
+ ;; TODO: 32bit support
+ (let* ((stub (string-append
+ "src/boot/efi/linux" (efi-arch) ".efi.stub")))
+ #~(modify-phases %standard-phases
+ (replace 'build
+ (lambda* (#:key parallel-build? #:allow-other-keys)
+ (invoke "ninja" #$stub
+ "-j" (if parallel-build?
+ (number->string (parallel-job-count)) "1"))))
+ (replace 'install
+ (lambda _
+ (let ((libexec (string-append #$output "/libexec")))
+ (install-file #$stub libexec))))
+ (delete 'check)))))
+ (supported-systems %efi-supported-systems)
+ (inputs (list libcap python-pyelftools `(,util-linux "lib")))
+ (native-inputs (list gperf pkg-config python-3 python-jinja2))
+ (home-page "https://systemd.io/")
+ (synopsis "Unified kernel image UEFI stub")
+ (description "Simple UEFI boot stub that loads a conjoined kernel image and
+supporting data to their proper locations, before chainloading to the kernel.
+Supports measured and/or verified boot environments.")
+ (license license:lgpl2.1+)))
+
(define-public ukify
(package
(name "ukify")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 11/15] gnu: bootloaders: Add uki-efi-bootloader.
(address . 72457@debbugs.gnu.org)
ea0b2177e2e7d298aeb79c9381a36af30a36e6d4.1722794774.git.lilah@lunabee.space
* gnu/bootloader.scm (<bootloader-configuration>): New keypair field.
* gnu/bootloader/uki.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add bootloader/uki.scm.

Change-Id: I2097da9f3dd35137b3419f6d0545de26d53cb6da
---
gnu/bootloader.scm | 3 ++
gnu/bootloader/uki.scm | 96 ++++++++++++++++++++++++++++++++++++++++++
gnu/local.mk | 1 +
3 files changed, 100 insertions(+)
create mode 100644 gnu/bootloader/uki.scm

Toggle diff (137 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index bc1eb74ae9..a83d057bda 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -101,6 +101,7 @@ (define-module (gnu bootloader)
bootloader-configuration-default-entry
bootloader-configuration-efi-removable?
bootloader-configuration-32bit?
+ bootloader-configuration-keypair
bootloader-configuration-timeout
bootloader-configuration-keyboard-layout
bootloader-configuration-theme
@@ -524,6 +525,8 @@ (define-record-type* <bootloader-configuration>
(default #f)) ;bool
(32bit? bootloader-configuration-32bit?
(default #f)) ;bool
+ (keypair bootloader-configuration-keypair
+ (default #f)) ;(cert . priv) pair
(timeout bootloader-configuration-timeout
(default 5)) ;seconds as integer
(keyboard-layout bootloader-configuration-keyboard-layout
diff --git a/gnu/bootloader/uki.scm b/gnu/bootloader/uki.scm
new file mode 100644
index 0000000000..4871dbe037
--- /dev/null
+++ b/gnu/bootloader/uki.scm
@@ -0,0 +1,96 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2024 Lilah Tascheter <lilah@lunabee.space>
+;;;
+;;; 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 uki)
+ #:use-module (gnu bootloader)
+ #:use-module (gnu packages bootloaders)
+ #:use-module (gnu packages efi)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu system boot)
+ #:use-module (guix gexp)
+ #:use-module (guix diagnostics)
+ #:use-module (guix i18n)
+ #:use-module (guix records)
+ #:export (uki-efi-bootloader))
+
+;; TODO: support 32bit/mixed-mode UEFI.
+;; https://github.com/systemd/systemd/issues/17056 may be relevant
+(define bootcfg->menu-entry->builder
+ (match-record-lambda <bootloader-configuration> (32bit? theme keypair)
+ (match-record-lambda <menu-entry>
+ (label linux linux-arguments initrd chain-loader)
+ ;; support chainloader in order to allow arbitrary signed EFI binaries
+ (cond
+ ((and chain-loader keypair)
+ #~(lambda (dest)
+ (invoke/quiet #+(sbsigntools "/bin/sbsign")
+ "--cert" #$(car keypair) "--key" #$(cdr keypair)
+ "--output" dest #$chain-loader)
+ (invoke/quiet #+(sbsigntools "/bin/sbverify")
+ "--cert" #$(car keypair) dest)))
+ (chain-loader #~(lambda (dest) (copy-file #$chain-loader dest)))
+ (linux
+ (let* ((arch (efi-arch #:32? 32bit?))
+ (stub (file-append systemd-stub
+ "/libexec/linux" arch ".efi.stub")))
+ #~(lambda (dest)
+ (invoke/quiet #+(file-append ukify "/bin/ukify")
+ "build" "--output" dest
+ "--linux" #$linux "--initrd" #$initrd
+ "--cmdline" (string-join (list #$@linux-arguments))
+ "--os-release" #$label "--stub" #$stub "--efi-arch" #$arch
+ #$@(if theme #~("--splash" #$theme) '())
+ #$@(if keypair #~("--secureboot-certificate" #$(car keypair)
+ "--secureboot-private-key" #$(cdr keypair))
+ '())))))
+ (else (leave (G_ "uki-efi-bootloader doesn't support multiboot")))))))
+
+;; we cannot use guix's build system to make UKI images for two reasons:
+;; 1. signing is necessarily non-reproducable, especially since keys should not
+;; be in the store, or else risk being publically accessible.
+;; 2. menu-entries may reference files which do not exist in the store.
+(define* (install-uki #:key bootloader-config
+ current-boot-alternative
+ old-boot-alternatives
+ #:allow-other-keys)
+ (define* (menu-entry->plan entry num #:optional (prefix "menu-entry"))
+ #~(cons* #$((bootcfg->menu-entry->builder bootloader-config) entry)
+ #$(string-append prefix "-" (number->string num) ".efi")
+ #$(menu-entry-label entry)))
+
+ (define (boot-alternative->plan alt)
+ (menu-entry->plan (boot-alternative->menu-entry alt)
+ (boot-alternative-generation alt)
+ "generation"))
+
+ (install-efi bootloader-config
+ (let ((entries (bootloader-configuration-menu-entries bootloader-config)))
+ #~(list #$(boot-alternative->plan current-boot-alternative)
+ #$@(map menu-entry->plan entries (iota (length entries)))
+ #$@(map boot-alternative->plan old-boot-alternatives)))))
+
+
+
+(define uki-efi-bootloader
+ (bootloader
+ (name 'uki-efi)
+ (default-targets (list (bootloader-target
+ (type 'vendir)
+ (offset 'esp)
+ (path "EFI/Guix"))))
+ (installer install-uki)))
diff --git a/gnu/local.mk b/gnu/local.mk
index 8375e13709..32ed753ee2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -93,6 +93,7 @@ GNU_SYSTEM_MODULES = \
%D%/bootloader/extlinux.scm \
%D%/bootloader/u-boot.scm \
%D%/bootloader/depthcharge.scm \
+ %D%/bootloader/uki.scm \
%D%/ci.scm \
%D%/compression.scm \
%D%/home.scm \
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 12/15] gnu: system: Update examples.
(address . 72457@debbugs.gnu.org)
04ccc75cd1a5ad6d9e7b3c69bbf37049bdc20e7b.1722794774.git.lilah@lunabee.space
* gnu/system/examples/asus-c201.tmpl (bootloader): Use new depthcharge
bootloader name scheme and update to new target system.

* gnu/system/examples/bare-bones.tmpl (bootloader),
gnu/system/examples/bare-hurd.tmpl (bootloader),
gnu/system/examples/beaglebone-black.tmpl (bootloader),
gnu/system/examples/desktop.tmpl (bootloader),
gnu/system/examples/lightweight-desktop.tmpl (bootloader),
gnu/system/examples/plasma.tmpl (bootloader),
gnu/system/examples/raspberry-pi-64-nfs-root.tmpl (bootloader),
gnu/system/examples/raspberry-pi-64.tmpl (bootloader): Use new target system.

* gnu/system/examples/docker-image.tmpl (bootloader): Delete.

* gnu/system/examples/vm-image.tmpl (bootloader): Use auto image target.

Change-Id: I3675f17ae9cd94cff99328762600fb4e491bc9f2
---
gnu/system/examples/asus-c201.tmpl | 6 +++--
gnu/system/examples/bare-bones.tmpl | 7 ++++--
gnu/system/examples/bare-hurd.tmpl | 4 +++-
gnu/system/examples/beaglebone-black.tmpl | 6 +++--
gnu/system/examples/desktop.tmpl | 4 +++-
gnu/system/examples/docker-image.tmpl | 6 ++---
gnu/system/examples/lightweight-desktop.tmpl | 4 +++-
gnu/system/examples/plasma.tmpl | 4 +++-
.../examples/raspberry-pi-64-nfs-root.tmpl | 23 ++++++++++++-------
gnu/system/examples/raspberry-pi-64.tmpl | 18 ++++++++-------
gnu/system/examples/vm-image.tmpl | 5 ++--
11 files changed, 54 insertions(+), 33 deletions(-)

Toggle diff (224 lines)
diff --git a/gnu/system/examples/asus-c201.tmpl b/gnu/system/examples/asus-c201.tmpl
index 019111c167..eec185eebf 100644
--- a/gnu/system/examples/asus-c201.tmpl
+++ b/gnu/system/examples/asus-c201.tmpl
@@ -14,8 +14,10 @@
;; Assuming /dev/mmcblk0p1 is the kernel partition, and
;; "my-root" is the label of the target root file system.
(bootloader (bootloader-configuration
- (bootloader depthcharge-bootloader)
- (targets '("/dev/mmcblk0p1"))))
+ (bootloader depthcharge-veyron-speedy-bootloader)
+ (targets (list (bootloader-target
+ (type 'part)
+ (device "/dev/mmcblk0p1"))))))
;; The ASUS C201PA requires a very particular kernel to boot,
;; as well as the following arguments.
diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare-bones.tmpl
index 7b6a4b09b0..9eed05f2e0 100644
--- a/gnu/system/examples/bare-bones.tmpl
+++ b/gnu/system/examples/bare-bones.tmpl
@@ -13,10 +13,13 @@
;; Boot in "legacy" BIOS mode, assuming /dev/sdX is the
;; target hard disk, and "my-root" is the label of the target
- ;; root file system.
+ ;; root file system. If you're just building an image, the
+ ;; 'targets' field may be omitted.
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
;; It's fitting to support the equally bare bones ‘-nographic’
;; QEMU option, which also nicely sidesteps forcing QWERTY.
(kernel-arguments (list "console=ttyS0,115200"))
diff --git a/gnu/system/examples/bare-hurd.tmpl b/gnu/system/examples/bare-hurd.tmpl
index 463c7ee798..8dd700cd9d 100644
--- a/gnu/system/examples/bare-hurd.tmpl
+++ b/gnu/system/examples/bare-hurd.tmpl
@@ -32,7 +32,9 @@
(inherit %hurd-default-operating-system)
(bootloader (bootloader-configuration
(bootloader grub-minimal-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/system/examples/beaglebone-black.tmpl b/gnu/system/examples/beaglebone-black.tmpl
index 18bbb2723c..99963ef2fe 100644
--- a/gnu/system/examples/beaglebone-black.tmpl
+++ b/gnu/system/examples/beaglebone-black.tmpl
@@ -11,11 +11,13 @@
(timezone "Europe/Berlin")
(locale "en_US.utf8")
- ;; Assuming /dev/mmcblk1 is the eMMC, and "my-root" is
+ ;; Assuming /dev/mmcblk1 is the eMMC. and "my-root" is
;; the label of the target root file system.
(bootloader (bootloader-configuration
(bootloader u-boot-beaglebone-black-bootloader)
- (targets '("/dev/mmcblk1"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/mmcblk1"))))))
;; This module is required to mount the SD card.
(initrd-modules (cons "omap_hsmmc" %base-initrd-modules))
diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl
index 2d65f22294..30dbdeea31 100644
--- a/gnu/system/examples/desktop.tmpl
+++ b/gnu/system/examples/desktop.tmpl
@@ -20,7 +20,9 @@
;; Partition mounted on /boot/efi.
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))
(keyboard-layout keyboard-layout)))
;; Specify a mapped device for the encrypted root partition.
diff --git a/gnu/system/examples/docker-image.tmpl b/gnu/system/examples/docker-image.tmpl
index 7123917af4..6d3114a0bc 100644
--- a/gnu/system/examples/docker-image.tmpl
+++ b/gnu/system/examples/docker-image.tmpl
@@ -9,6 +9,8 @@
(timezone "Europe/Berlin")
(locale "en_US.utf8")
+ ;; Bootloader can be left blank!
+
;; This is where user accounts are specified. The "root" account is
;; implicit, and is initially created with the empty password.
(users (cons (user-account
@@ -34,10 +36,6 @@
;; similar services for us.
;; This will be ignored.
- (bootloader (bootloader-configuration
- (bootloader grub-bootloader)
- (targets '("does-not-matter"))))
- ;; This will be ignored, too.
(file-systems (list (file-system
(device "does-not-matter")
(mount-point "/")
diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl
index c061284ba8..0964238cb0 100644
--- a/gnu/system/examples/lightweight-desktop.tmpl
+++ b/gnu/system/examples/lightweight-desktop.tmpl
@@ -17,7 +17,9 @@
;; Partition mounted on /boot/efi.
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))))
;; Assume the target root file system is labelled "my-root",
;; and the EFI System Partition has UUID 1234-ABCD.
diff --git a/gnu/system/examples/plasma.tmpl b/gnu/system/examples/plasma.tmpl
index c3850ffe37..a81916ffe9 100644
--- a/gnu/system/examples/plasma.tmpl
+++ b/gnu/system/examples/plasma.tmpl
@@ -15,7 +15,9 @@
;; is the label of the target root file system.
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device "my-root")
diff --git a/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl b/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl
index 1baca02491..85476854f3 100644
--- a/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl
+++ b/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl
@@ -25,14 +25,21 @@
(operating-system
(host-name "raspberrypi-guix")
(timezone "Europe/Berlin")
- (bootloader (bootloader-configuration
- (bootloader grub-efi-bootloader-chain-raspi-64)
- (targets (list "/boot/efi"))
- (theme (grub-theme
- (resolution '(1920 . 1080))
- (image (file-append
- %artwork-repository
- "/grub/GuixSD-fully-black-16-9.svg"))))))
+ (bootloader (list (bootloader-configuration
+ (bootloader u-boot-rpi-bootloader)
+ (targets (list (bootloader-target
+ (type 'install)
+ (path "/boot/efi")))))
+ (bootloader-configuration
+ (bootloader grub-efi-bootloader)
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))
+ (theme
+ (grub-theme
+ (resolution '(1920 . 1080))
+ (image (file-append %artwork-repository
+ "/grub/GuixSD-fully-black-16-9.svg")))))))
(kernel-arguments '("ip=dhcp"))
(kernel (customize-linux #:linux linux-libre-arm64-generic
#:extra-version "arm64-generic-netboot"
diff --git a/gnu/system/examples/raspberry-pi-64.tmpl b/gnu/system/examples/raspberry-pi-64.tmpl
index 414d8ac7a5..d5b90b9705 100644
--- a/gnu/system/examples/raspberry-pi-64.tmpl
+++ b/gnu/system/examples/raspberry-pi-64.tmpl
@@ -24,14 +24,16 @@
(operating-system
(host-name "raspberrypi-guix")
(timezone "Europe/Berlin")
- (bootloader (bootloader-configuration
- (bootloader grub-efi-bootloader-chain-raspi-64)
- (targets (list "/boot/efi"))
- (theme (grub-theme
- (resolution '(1920 . 1080))
- (image (file-append
- %artwork-repository
- "/grub/GuixSD-fully-black-16-9.svg"))))))
+ (bootloader (list (bootloader-configuration
+ (bootloader u-boot-rpi-bootloader)
+ (targets (list (bootloader-target
+ (type 'install)
+ (path "/boot/efi"))))
+ (theme
+ (grub-theme
+ (resolution '(1920 . 1080))
+ (image (file-append %artwork-repository
+ "/grub/GuixSD-fully-black-16-9.svg")))))))
(kernel (customize-linux #:linux linux-libre-arm64-generic
;; It is possible to use a specific defconfig
;; file, for example the "bcmrpi3_defconfig" with
diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl
index 589de493b1..050c0bb971 100644
--- a/gnu/system/examples/vm-image.tmpl
+++ b/gnu/system/examples/vm-image.tmpl
@@ -38,11 +38,10 @@ accounts.\x1b[0m
(firmware '())
- ;; Below we assume /dev/vda is the VM's hard disk.
- ;; Adjust as needed.
+ ;; Images automatically get the 'root, 'esp, and 'disk targets configured as
+ ;; needed.
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vda"))
(terminal-outputs '(console))))
(file-systems (cons (file-system
(mount-point "/")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 15/15] teams: Add bootloading team.
(address . 72457@debbugs.gnu.org)
491b33320208c3590012b27a542ec8c307e57f76.1722794774.git.lilah@lunabee.space
Might as well, to help ease the transition.

* etc/teams.scm (bootloaders): New team.
(Lilah Tascheter): Create add to above.

Change-Id: I63620f4e3151bb8e3d0bdf619fc70501af6397a0
---
etc/teams.scm | 10 ++++++++++
1 file changed, 10 insertions(+)

Toggle diff (30 lines)
diff --git a/etc/teams.scm b/etc/teams.scm
index 408ebbf3d9..d9af4ad7bb 100755
--- a/etc/teams.scm
+++ b/etc/teams.scm
@@ -328,6 +328,12 @@ (define-team embedded
#:scope (list "gnu/packages/bootloaders.scm"
"gnu/packages/firmware.scm")))
+(define-team bootloaders
+ (team 'bootloaders
+ #:name "Bootloaders"
+ #:scope (list "gnu/bootloader.scm"
+ (make-regexp* "^gnu/bootloader/"))))
+
(define-team rust
(team 'rust
#:name "Rust"
@@ -746,6 +752,10 @@ (define-member (person "Nicolas Goaziou"
"guix@nicolasgoaziou.fr")
tex)
+(define-member (person "Lilah Tascheter"
+ "lilah@lunabee.space")
+ bootloaders)
+
(define (find-team name)
(or (hash-ref %teams (string->symbol name))
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 13/15] doc: Update bootloader documentation.
(address . 72457@debbugs.gnu.org)
cd8eedb402710474b1fcfd01b76f18805dd41d33.1722794774.git.lilah@lunabee.space
* doc/guix.texi
(Manual Installation)[Proceeding with the Installation]: Offload
target reference.

(System Installation)[Building the Installation Image]: Use beaglebone
as the example, and don't reference deleted variables.

(System Configuration)[Using the Configuration System]: Update
example.
[operating-system Reference]<bootloader>: Can use multiple
bootloaders.
[Keyboard Layout]: Update example.
[Bootloader Configuration]<bootloader>: Update documentation for all
bootloaders, and add new ones. Document new fields efi-removable?,
32bit?, and keypair. Update terminal-outputs and terminal-outputs to
not be GRUB-specific.
<bootloader-target>: New record.
<menu-entry>: Remove now-unsupported GRUB specifics in linux. Move
device documentation and add some for device-mount-point and
device-subvol. Fix typo in multiboot-arguments. Document chain-loader
for arbitrary bootloaders.
[Invoking guix system]<switch-generation>: Bootloaders are now
reinstalled.
<image> Other bootloaders may be used.
[Invoking guix deploy]: Update template.

(Creating System Images)[image Reference]<partition Reference>: Add
target field.
[Instantiate an Image]: Update examples and update formatting.
<efi32-disk-image, efi32-raw-image-type>: Delete.
[image-type Reference]<pinebook-pro-image-type, rock64-image-type>:
Reword slightly.

Change-Id: I45ac9d5ad3cb491c693e9a4b2f0b44b527478ee7
---
doc/guix.texi | 458 +++++++++++++++++++++++++++++---------------------
1 file changed, 262 insertions(+), 196 deletions(-)

Toggle diff (371 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 41814042f5..b5f35a9066 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2516,12 +2516,9 @@ Proceeding with the Installation
Make sure the @code{bootloader-configuration} form refers to the targets
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{targets} field contain the names of the devices, like
-@code{(list "/dev/sda")}; for UEFI systems it names the paths to mounted
-EFI partitions, like @code{(list "/boot/efi")}; do make sure the paths
-are currently mounted and a @code{file-system} entry is specified in
-your configuration.
+@code{grub-efi-bootloader} for newer UEFI systems.
+@xref{Bootloader Configuration} for information on how to format the
+@code{targets} field.
@item
Be sure that your file system labels match the value of their respective
@@ -2653,11 +2650,13 @@ Building the Installation Image
includes the bootloader, specifically:
@example
-guix system image --system=armhf-linux -e '((@@ (gnu system install) os-with-u-boot) (@@ (gnu system install) installation-os) "A20-OLinuXino-Lime2")'
+guix system image --system=armhf-linux -e '(@ (gnu system install) beaglebone-black-installation-os)'
@end example
-@code{A20-OLinuXino-Lime2} is the name of the board. If you specify an invalid
-board, a list of possible boards will be printed.
+@code{beaglebone-black} is the name of the board. Similar
+@code{installation-os} variables exist for most other supported boards.
+Otherwise, you can use @code{embedded-installation-os}, passing it a u-boot
+bootloader and the desired console tty.
@c *********************************************************************
@@ -17229,7 +17228,9 @@ Using the Configuration System
@lisp
(bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi")))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi")))))
@end lisp
@xref{Bootloader Configuration}, for more information on the available
@@ -17535,8 +17536,10 @@ operating-system Reference
List of strings or gexps representing additional arguments to pass on
the command-line of the kernel---e.g., @code{("console=ttyS0")}.
-@item @code{bootloader}
-The system bootloader configuration object. @xref{Bootloader Configuration}.
+@item @code{bootloader} (default: '())
+The system bootloader configuration object. Can either be a single
+@code{bootloader-configuration} or a list of them, to install multiple or no
+bootloaders. @xref{Bootloader Configuration}.
@item @code{label}
This is the label (a string) as it appears in the bootloader's menu entry.
@@ -18731,7 +18734,9 @@ Keyboard Layout
(keyboard-layout (keyboard-layout "tr")) ;for the console
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))
(keyboard-layout keyboard-layout))) ;for GRUB
(services (cons (set-xorg-configuration
(xorg-configuration ;for Xorg
@@ -42119,132 +42124,124 @@ Bootloader Configuration
@cindex EFI, bootloader
@cindex UEFI, bootloader
@cindex BIOS, bootloader
-The bootloader to use, as a @code{bootloader} object. For now
-@code{grub-bootloader}, @code{grub-efi-bootloader},
-@code{grub-efi-removable-bootloader}, @code{grub-efi-netboot-bootloader},
-@code{grub-efi-netboot-removable-bootloader}, @code{extlinux-bootloader}
-and @code{u-boot-bootloader} are supported.
+The bootloader to use, as a @code{bootloader} object. Available bootloaders, in
+addition to what target types they require, are as follows:
-@cindex ARM, bootloaders
-@cindex AArch64, bootloaders
-Available bootloaders are described in @code{(gnu bootloader @dots{})}
-modules. In particular, @code{(gnu bootloader u-boot)} contains definitions
-of bootloaders for a wide range of ARM and AArch64 systems, using the
-@uref{https://www.denx.de/wiki/U-Boot/, U-Boot bootloader}.
+@itemize
+@vindex depthcharge-veyron-speedy-bootloader
+@item @code{depthcharge-veyron-speedy-bootloader}
+For the Asus C201. Requires a @code{'part} target, denoting the partition to
+install the kernel blob as a @code{device}, @code{label}, or @code{uuid}.
@vindex grub-bootloader
-@code{grub-bootloader} allows you to boot in particular Intel-based machines
-in ``legacy'' BIOS mode.
+@item @code{grub-bootloader}
+GRUB2 for BIOS systems. Requires a @code{'disk} target providing either a
+@code{device}, @code{label}, or @code{uuid}. If root is mounted over NFS, it
+will load its files and the Guix System over
+@acronym{PXE, Preboot eXecution Environment}.
+
+@vindex grub-minimal-bootloader
+@item @code{grub-minimal-bootloader}
+As above, but using a minimal build of GRUB.
@vindex grub-efi-bootloader
-@code{grub-efi-bootloader} allows to boot on modern systems using the
-@dfn{Unified Extensible Firmware Interface} (UEFI). This is what you should
-use if the installation image contains a @file{/sys/firmware/efi} directory
-when you boot it on your system.
-
-@vindex grub-efi-removable-bootloader
-@code{grub-efi-removable-bootloader} allows you to boot your system from
-removable media by writing the GRUB file to the UEFI-specification location of
-@file{/EFI/BOOT/BOOTX64.efi} of the boot directory, usually @file{/boot/efi}.
-This is also useful for some UEFI firmwares that ``forget'' their configuration
-from their non-volatile storage. Like @code{grub-efi-bootloader}, this can only
-be used if the @file{/sys/firmware/efi} directory is available.
+@item @code{grub-efi-bootloader}
+GRUB2 for "modern" systems using the @dfn{Unified Extensible Firmware Interface}
+(UEFI). Requires an @code{'esp} target providing a @code{path} to the mount
+point of the EFI System Partition. If root is mounted over NFS, it will load
+its files and the Guix System over a
+@acronym{TFTP, Trivial File Transfer Protocol} server as configured over
+@acronym{DHCP, Dynamic Host Configuration Protocol} as per PXE.
+
+@vindex extlinux-bootloader
+@item @code{extlinux-bootloader}
+Extlinux for "legacy" BIOS systems. Requires a @code{'disk} target providing
+either a @code{device}, @code{label}, or @code{uuid}.
+
+@vindex extlinux-gpt-bootloader
+@item @code{extlinux-gpt-bootloader}
+As above, but for systems using the GPT instead of MBR partition table.
+
+@cindex Secure Boot, UEFI
+@vindex uki-efi-bootloader
+@item @code{uki-efi-bootloader}
+Makes and installs UKI images for UEFI systems. Requires an @code{'esp} target
+providing a @code{path} to the mount point of the EFI System Partition. Not all
+system generations may be available with this option, as UKI images contain the
+entire kernel and initramfs, and ESPs tend to be small.
+
+Full disk encryption with @code{uki-efi-bootloader} only requires a single
+password entry with fast decryption, in contrast to GRUB2 requiring a second
+password entry with slow, LUKS1-only decryption.
+
+This is the only bootloader to currently support UEFI secure boot, when
+configured as below.
-@quotation Note
-This @emph{will} overwrite the GRUB file from any other operating systems that
-also place their GRUB file in the UEFI-specification location; making them
-unbootable.
-@end quotation
+@cindex ARM, bootloaders
+@cindex AArch64, bootloaders
+@vindex u-boot-a20-olinuxino-lime-bootloader
+@vindex u-boot-a20-olinuxino-lime2-bootloader
+@vindex u-boot-a20-olinuxino-micro-bootloader
+@vindex u-boot-bananapi-m2-ultra-bootloader
+@vindex u-boot-beaglebone-black-bootloader
+@vindex u-boot-cubietruck-bootloader
+@vindex u-boot-firefly-rk3399-bootloader
+@vindex u-boot-mx6cuboxi-bootloader
+@vindex u-boot-nintendo-nes-classic-edition-bootloader
+@vindex u-boot-novena-bootloader
+@vindex u-boot-orangepi-r1-plus-lts-rk3328-bootloader
+@vindex u-boot-pine64-plus-bootloader
+@vindex u-boot-pine64-lts-bootloader
+@vindex u-boot-pinebook-bootloader
+@vindex u-boot-pinebook-pro-rk3399-bootloader
+@vindex u-boot-puma-rk3399-bootloader
+@vindex u-boot-rock64-rk3328-bootloader
+@vindex u-boot-rockpro64-rk3399-bootloader
+@vindex u-boot-sifive-unmatched-bootloader
+@vindex u-boot-qemu-riscv64-bootloader
+@vindex u-boot-starfive-visionfive2-bootloader
+@vindex u-boot-ts7970-q-2g-1000mhz-c-bootloader
+@vindex u-boot-wandboard-bootloader
+@vindex u-boot-rpi-2-bootloader
+@vindex u-boot-rpi-3-bootloader
+@vindex u-boot-rpi-4-bootloader
+@vindex u-boot-rpi-bootloader
+@item U-Boot
+U-Boot has individual bootloaders @code{u-boot-board-bootloader} for each
+of the following @code{board}s: @code{a20-olinuxino-lime},
+@code{a20-olinuxino-lime2}, @code{a20-olinuxino-micro},
+@code{bananapi-m2-ultra}, @code{beaglebone-black}, @code{cubietruck},
+@code{firefly-rk3399}, @code{mx6cuboxi}, @code{nintendo-nes-classic-edition},
+@code{novena}, @code{orangepi-r1-plus-lts-rk3328}, @code{pine64-plus},
+@code{pine64-lts}, @code{pinebook}, @code{pinebook-pro-rk3399},
+@code{puma-rk3399}, @code{rock64-rk3328}, @code{rockpro64-rk3399},
+@code{rpi-2}, @code{rpi-3}, @code{rpi-4}, @code{rpi}, @code{sifive-unmatched},
+@code{ts7970-q-2g-1000mhz-c}, @code{qemu-riscv64}, and @code{wandboard}.
+
+Each of these requires a @code{'disk} target providing either a @code{device},
+@code{label}, or @code{uuid}, except for @code{ts7970-q-2g-1000mhz-c} and
+@code{qemu-riscv64}, in which the bootloader just copies U-Boot to
+@file{/boot/u-boot.imx} or @file{/boot/u-boot.bin}, respectively. You should
+then manually flash it to the SPI flash at the U-Boot prompt.
+
+By default Guix configures U-Boot to boot using a generated extlinux config, but
+U-Boot does support loading UEFI bootloaders, if you want to combine it with
+another.
+@end itemize
-@vindex grub-efi-netboot-bootloader
-@code{grub-efi-netboot-bootloader} allows you to boot your system over network
-through TFTP@. In combination with an NFS root file system this allows you to
-build a diskless Guix system.
-
-The installation of the @code{grub-efi-netboot-bootloader} generates the
-content of the TFTP root directory at @code{targets} (@pxref{Bootloader
-Configuration, @code{targets}}) below the sub-directory @file{efi/Guix}, to be
-served by a TFTP server. You may want to mount your TFTP server directories
-onto the @code{targets} to move the required files to the TFTP server
-automatically during installation.
-
-If you plan to use an NFS root file system as well (actually if you mount the
-store from an NFS share), then the TFTP server needs to serve the file
-@file{/boot/grub/grub.cfg} and other files from the store (like GRUBs background
-image, the kernel (@pxref{operating-system Reference, @code{kernel}}) and the
-initrd (@pxref{operating-system Reference, @code{initrd}})), too. All these
-files from the store will be accessed by GRUB through TFTP with their normal
-store path, for example as
-@file{tftp://tftp-server/gnu/store/…-initrd/initrd.cpio.gz}.
-
-Two symlinks are created to make this possible. For each target in the
-@code{targets} field, the first symlink is
-@samp{target}@file{/efi/Guix/boot/grub/grub.cfg} pointing to
-@file{../../../boot/grub/grub.cfg}, where @samp{target} may be
-@file{/boot}. In this case the link is not leaving the served TFTP root
-directory, but otherwise it does. The second link is
-@samp{target}@file{/gnu/store} and points to @file{../gnu/store}. This
-link is leaving the served TFTP root directory.
-
-The assumption behind all this is that you have an NFS server exporting
-the root file system for your Guix system, and additionally a TFTP
-server exporting your @code{targets} directories—usually a single
-@file{/boot}—from that same root file system for your Guix system. In
-this constellation the symlinks will work.
-
-For other constellations you will have to program your own bootloader
-installer, which then takes care to make necessary files from the store
-accessible through TFTP, for example by copying them into the TFTP root
-directory for your @code{targets}.
-
-It is important to note that symlinks pointing outside the TFTP root directory
-may need to be allowed in the configuration of your TFTP server. Further the
-store link exposes the whole store through TFTP@. Both points need to be
-considered carefully for security aspects. It is advised to disable any TFTP
-write access!
-
-Please note, that this bootloader will not modify the ‘UEFI Boot Manager’ of
-the system.
-
-Beside the @code{grub-efi-netboot-bootloader}, the already mentioned TFTP and
-NFS servers, you also need a properly configured DHCP server to make the booting
-over netboot possible. For all this we can currently only recommend you to look
-for instructions about @acronym{PXE, Preboot eXecution Environment}.
-
-If a local EFI System Partition (ESP) or a similar partition with a FAT
-file system is mounted in @code{targets}, then symlinks cannot be
-created. In this case everything will be prepared for booting from
-local storage, matching the behavior of @code{grub-efi-bootloader}, with
-the difference that all GRUB binaries are copied to @code{targets},
-necessary for booting over the network.
-
-@vindex grub-efi-netboot-removable-bootloader
-@code{grub-efi-netboot-removable-bootloader} is identical to
-@code{grub-efi-netboot-bootloader} with the exception that the
-sub-directory @file{efi/boot} will be used instead of @file{efi/Guix} to
-comply with the UEFI specification for removable media.
+@item @code{targets}
+This is a list of @code{bootloader-target} (see below) structures denoting
+where the bootloader should install itself. Interpretation of specific target
+types and target requirements depend on the specific @code{bootloader} used.
@quotation Note
-This @emph{will} overwrite the GRUB file from any other operating systems that
-also place their GRUB file in the UEFI-specification location; making them
-unbootable.
+Bootloaders have a set of default targets, that can interact with user-specified
+targets. For UEFI bootloaders using the @code{'esp} target, this typically
+includes a @code{'vendir} target. If you configure multiple UEFI bootloaders,
+you should set different @code{'vendir} target @code{path}s for each, each
+@code{offset} from @code{'esp}.
@end quotation
-@item @code{targets}
-This is a list of strings denoting the targets onto which to install the
-bootloader.
-
-The interpretation of targets depends on the bootloader in question.
-For @code{grub-bootloader}, for example, they should be device names
-understood by the bootloader @command{installer} command, such as
-@code{/dev/sda} or @code{(hd0)} (@pxref{Invoking grub-install,,, grub,
-GNU GRUB Manual}). For @code{grub-efi-bootloader} and
-@code{grub-efi-removable-bootloader} they should be mount
-points of the EFI file system, usually @file{/boot/efi}. For
-@code{grub-efi-netboot-bootloader}, @code{targets} should be the mount
-points corresponding to TFTP root directories served by your TFTP
-server.
-
@item @code{menu-entries} (default: @code{'()})
A possibly empty list of @code{menu-entry} objects (see below), denoting
entries to appear in the bootloader menu, in addition to the current
@@ -42254,6 +42251,29 @@ Bootloader Configuration
The index of the default boot menu entry. Index 0 is for the entry of the
current system.
+@item @code{efi-removable?} (default: @var{#f})
+Used by all UEFI bootloaders to determine whether they should be installed to
+the UEFI standard fallback bootloader path (on x86_64,
+@file{/EFI/BOOT/BOOTX64.EFI}). This allows it to be booted from removable media
+or otherwise in cases where the system has not been booted from UEFI already.
+
+@quotation Warning
+This will override any other bootloaders installed to the same path!
+@end quotation
+
+@item @code{32bit?} (default: @var{#f})
+Some 64-bit systems require their bootloaders to be 32-bit, including some early
+UEFI systems and some Raspberry Pis. If that is the case, and the bootloader
+supports it, setting this option will force the bootloader to install as if it
+were on a 32-bit system.
+
+@item @code{keypair} (default: @var{#f})
+Designates a keypair to be used by bootloaders that support some kind of
+cryptographic signature, such as UEFI Secure Boot. This must be a pair
+@code{'(cert . priv)} of paths to the public key (@code{cert}) and private key
+(@code{priv}). The keys these paths point to should be owned by root with 600
+permissions for security purposes.
+
@item @code{timeout} (default: @code{5})
The number of seconds to wait for keyboard input before booting. Set to
0 to boot immediately, and to -1 to wait indefinitely.
@@ -42276,19 +42296,20 @@ Bootloader Configuration
is provided, some bootloaders might use a default theme, that's true
for GRUB.
-@item @code{terminal-outputs} (default: @code{'(gfxterm)})
+@item @code{terminal-outputs} (default: @var{#f})
The output terminals used for the bootloader boot menu, as a list of
-symbols. GRUB accepts the values: @code{console}, @code{serial},
-@code{serial_@{0-3@}}, @code{gfxterm}, @code{vga_text},
-@code{mda_text}, @code{morse}, and @code{pkmodem}. This field
-corresponds to the GRUB variable @code{GRUB_TERMINAL_OUTPUT} (@pxref{Simple
-configuration,,, grub,GNU GRUB manual}).
-
-@item @code{terminal-inputs} (default: @code{'()})
+symbols. When @var{#f}, the default is used. For GRUB this is @code{gfxterm}.
+GRUB accepts the values: @code{console}, @code{serial}, @code{serial_@{0-3@}},
+@code{gfxterm}, @code{vga_text}, @code{mda_text}, @code{morse}, and
+@code{pkmodem}. This field corresponds to the GRUB variable
+@code{GRUB_TERMINAL_OUTPUT}
+(@pxref{Simple configuration,,, grub,GNU GRUB manual}).
+
+@item @code{terminal-inputs} (default: @var{#f})
The input terminals used for the bootloader boot menu, as a list of
-symbols. For GRUB, the default is the native platform terminal as
-determined at run-time. GRUB accepts the values: @code{console},
-@code{serial}, @code{serial_@{0-3@}}, @code{at_keyboard}, and
+symbols. When @var{#f}, the default is used. For GRUB, this is the native
+platform terminal as determined at run-time. GRUB accepts the values:
+@code
This message was truncated. Download the full message here.
L
L
Lilah Tascheter wrote on 4 Aug 20:06 +0200
[PATCH v2 14/15] gnu: tests: Update tests to new targets system.
(address . 72457@debbugs.gnu.org)
08184fbd284268debb6ab0c9c9f428cda8491a78.1722794774.git.lilah@lunabee.space
* gnu/services/virtualization.scm
(%virtual-build-machine-operating-system): Remove bootloader.
(%hurd-vm-operating-system): Remove targets.

* gnu/system/hurd.scm (%hurd-default-operating-system): Remove targets.

* gnu/tests.scm (%simple-os), gnu/tests/ganeti.scm (%ganeti-os),
gnu/tests/image.scm (%simple-efi-os),
gnu/tests/install.scm (%minimal-os, %minimal-extlinux-os,
%minimal-os-on-vda, %separate-home-os, %separate-store-os, %raid-root-os,
%encrypted-root-os, %lvm-separate-home-os, %encrypted-home-os,
%encrypted-home-os-key-file, %encrypted-root-not-boot-os,
%btrfs-root-os-source, %btrfs-raid-root-os-source,
%btrfs-root-on-subvolume-os, %btrfs-raid10-root-os, %jfs-root-os,
%f2fs-root-os, %xfs-root-os), gnu/tests/nfs.scm (%base-os),
gnu/tests/telephony.scm (make-jami-os), gnu/tests/vnc.scm (%xvnc-os):
Update bootloader targets.

Change-Id: I3d66a839a9b2a73b8b65946950728b1e0155ca1e
---
gnu/services/virtualization.scm | 11 ++---
gnu/system/hurd.scm | 4 +-
gnu/tests.scm | 4 +-
gnu/tests/ganeti.scm | 4 +-
gnu/tests/image.scm | 4 +-
gnu/tests/install.scm | 72 ++++++++++++++++++++++++---------
gnu/tests/nfs.scm | 4 +-
gnu/tests/telephony.scm | 4 +-
gnu/tests/vnc.scm | 4 +-
tests/boot-parameters.scm | 2 +-
10 files changed, 77 insertions(+), 36 deletions(-)

Toggle diff (357 lines)
diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm
index d87e494348..f698532a94 100644
--- a/gnu/services/virtualization.scm
+++ b/gnu/services/virtualization.scm
@@ -1191,17 +1191,13 @@ (define %minimal-vm-syslog-config
(define %virtual-build-machine-operating-system
(operating-system
(host-name "build-machine")
-
(locale "en_US.utf8")
(locale-definitions
;; Save space by providing only one locale.
(list (locale-definition (name "en_US.utf8")
(source "en_US")
(charset "UTF-8"))))
-
- (bootloader (bootloader-configuration ;unused
- (bootloader grub-minimal-bootloader)
- (targets '("/dev/null"))))
+ ;; no bootloader
(file-systems (cons (file-system ;unused
(mount-point "/")
(device "none")
@@ -1624,9 +1620,8 @@ (define %hurd-vm-operating-system
(host-name "childhurd")
(timezone "Europe/Amsterdam")
(bootloader (bootloader-configuration
- (bootloader grub-minimal-bootloader)
- (targets '("/dev/vda"))
- (timeout 0)))
+ (bootloader grub-minimal-bootloader)
+ (timeout 0)))
(packages (cons* gdb-minimal
(operating-system-packages
%hurd-default-operating-system)))
diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm
index cbe0081382..af04e82485 100644
--- a/gnu/system/hurd.scm
+++ b/gnu/system/hurd.scm
@@ -119,9 +119,7 @@ (define %hurd-default-operating-system
(kernel %hurd-default-operating-system-kernel)
(kernel-arguments '())
(hurd hurd)
- (bootloader (bootloader-configuration
- (bootloader grub-minimal-bootloader)
- (targets '("/dev/vda"))))
+ (bootloader (bootloader-configuration (bootloader grub-minimal-bootloader)))
(initrd #f)
(initrd-modules '())
(firmware '())
diff --git a/gnu/tests.scm b/gnu/tests.scm
index 5ff9db82fc..f46ccf5174 100644
--- a/gnu/tests.scm
+++ b/gnu/tests.scm
@@ -237,7 +237,9 @@ (define %simple-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device"/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/tests/ganeti.scm b/gnu/tests/ganeti.scm
index 29eb354044..789879b26f 100644
--- a/gnu/tests/ganeti.scm
+++ b/gnu/tests/ganeti.scm
@@ -40,7 +40,9 @@ (define %ganeti-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vda"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vda"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/tests/image.scm b/gnu/tests/image.scm
index be6852cae0..8d960cf7b8 100644
--- a/gnu/tests/image.scm
+++ b/gnu/tests/image.scm
@@ -55,7 +55,9 @@ (define %simple-efi-os
(inherit %simple-os)
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))))))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))))))
;; An MBR disk image with a single ext4 partition.
(define i1
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 18a2fc119b..d67a71f12e 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -103,7 +103,9 @@ (define-os-with-source (%minimal-os %minimal-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -141,7 +143,9 @@ (define-os-with-source (%minimal-extlinux-os
(bootloader (bootloader-configuration
(bootloader extlinux-gpt-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -434,7 +438,9 @@ (define-os-with-source (%minimal-os-on-vda %minimal-os-on-vda-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vda"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vda"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -510,7 +516,9 @@ (define-os-with-source (%separate-home-os %separate-home-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
(device (file-system-label "my-root"))
@@ -565,7 +573,9 @@ (define-os-with-source (%separate-store-os %separate-store-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
(device (file-system-label "root-fs"))
@@ -642,7 +652,9 @@ (define-os-with-source (%raid-root-os %raid-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
;; Add a kernel module for RAID-1 (aka. "mirror").
@@ -725,7 +737,9 @@ (define-os-with-source (%encrypted-root-os %encrypted-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
;; Note: Do not pass "console=ttyS0" so we can use our passphrase prompt
;; detection logic in 'enter-luks-passphrase'.
@@ -858,7 +872,9 @@ (define-os-with-source (%lvm-separate-home-os %lvm-separate-home-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(mapped-devices (list (mapped-device
@@ -943,7 +959,9 @@ (define-os-with-source (%encrypted-home-os %encrypted-home-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
;; Note: Do not pass "console=ttyS0" so we can use our passphrase prompt
;; detection logic in 'enter-luks-passphrase'.
@@ -1070,7 +1088,9 @@ (define-os-with-source (%encrypted-home-os-key-file
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))
(extra-initrd "/key-file.cpio")))
(kernel-arguments '("console=ttyS0"))
@@ -1130,7 +1150,9 @@ (define-os-with-source (%encrypted-root-not-boot-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(mapped-devices (list (mapped-device
(source
@@ -1232,7 +1254,9 @@ (define-os-with-source (%btrfs-root-os %btrfs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -1306,7 +1330,9 @@ (define-os-with-source (%btrfs-raid-root-os %btrfs-raid-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
@@ -1374,7 +1400,9 @@ (define-os-with-source (%btrfs-root-on-subvolume-os
(locale "en_US.UTF-8")
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
(device (file-system-label "btrfs-pool"))
@@ -1467,7 +1495,9 @@ (define-os-with-source (%btrfs-raid10-root-os
(bootloader (map (lambda (targ)
(bootloader-configuration
(bootloader grub-bootloader)
- (targets (list targ))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device targ))))))
'("/dev/vdb" "/dev/vdc" "/dev/vdd" "/dev/vde")))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
@@ -1577,7 +1607,9 @@ (define-os-with-source (%jfs-root-os %jfs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -1650,7 +1682,9 @@ (define-os-with-source (%f2fs-root-os %f2fs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -1723,7 +1757,9 @@ (define-os-with-source (%xfs-root-os %xfs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm
index 0d9972e0e9..2f97126df7 100644
--- a/gnu/tests/nfs.scm
+++ b/gnu/tests/nfs.scm
@@ -51,7 +51,9 @@ (define %base-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems %base-file-systems)
(users %base-user-accounts)
(packages (cons*
diff --git a/gnu/tests/telephony.scm b/gnu/tests/telephony.scm
index f03ea963f7..ee858d9c91 100644
--- a/gnu/tests/telephony.scm
+++ b/gnu/tests/telephony.scm
@@ -90,7 +90,9 @@ (define* (make-jami-os #:key provisioning? partial?)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/tests/vnc.scm b/gnu/tests/vnc.scm
index ab1c2749f3..cba9c565e0 100644
--- a/gnu/tests/vnc.scm
+++ b/gnu/tests/vnc.scm
@@ -51,7 +51,9 @@ (define %xvnc-os
(locale "en_US.UTF-8")
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm
index f214de360d..f343dbdfdb 100644
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -63,7 +63,7 @@ (define %root-path "/")
(define %grub-boot-parameters
(boot-parameters
- (bootloader-name 'grub)
+ (bootloader-name '(grub))
(root-device %default-root-device)
(label %default-label)
(kernel %default-kernel)
--
2.45.2
S
S
Sergey Trofimov wrote on 4 Aug 21:52 +0200
Re: [PATCH v2 00/15] Rewrite bootloader subsystem.
(name . Lilah Tascheter)(address . lilah@lunabee.space)
CAE0nKzUT19qCwko9XrAt2FdPy+EjiGu2-RHPRf_np5fnTuioSw@mail.gmail.com
Lilah Tascheter <lilah@lunabee.space> writes:

Toggle quote (4 lines)
> Thanks you two! This patch series should fix those issues; feel free to
> double-check though :)
>

I've found a couple typos, although fixing these doesn't make it work
for me. I get an error in fixuuid.

Toggle snippet (11 lines)
In unknown file:
2 (string=? #f "ntfs")
In ice-9/boot-9.scm:
1685:16 1 (raise-exception _ #:continuable? _)
1685:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure string=: Wrong type argument in position 1 (expecting string): #f


Here is a patch for the typos.
Toggle snippet (23 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index a83d057bda..70b4c02447 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -584,13 +584,13 @@ (define (normalize targets)
(unfold-pathcat target targets)))))
(label (or label (accessible=> device read-partition-label)))
(uuid (or uuid (accessible=> device read-partition-uuid)))
- (file-system (or file-system (and=> device (assoc-mnt
mount-type))))
+ (file-system (or file-system (and=> device (assoc-mnt
mount-point))))
(offset (and path offset))
(path (or path (and=> device (assoc-mnt mount-point))))))))

(define (fixuuid target)
(match-record target <bootloader-target> (uuid file-system)
- (let ((type (cond ((member file-system '("vfat" "fat32") 'fat))
+ (let ((type (cond ((member file-system '("vfat" "fat32")) 'fat)
((string=? file-system "ntfs") 'ntfs)
((string=? file-system "iso9660") 'iso9660)
(else 'dce))))
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 00/15] Rewrite bootloader subsystem.
(address . 72457@debbugs.gnu.org)
cover.1722803521.git.lilah@lunabee.space
Goddamnit, alright, how's this?

And thanks for the patch :) though, the file-system bit there is supposed to be
mount-type. The file-system field holds the filesystem type; path holds
mountpoint.

Lilah Tascheter (15):
guix: scripts: Rewrite reinstall-bootloader to use provenance data.
gnu: Add bootloader target infastructure.
guix: scripts: Remove unused code.
gnu: Core bootloader changes.
gnu: system: Remove useless boot parameters.
gnu: bootloader: Add raspberry pi bootloader.
gnu: system: Fix bootloader crypto device recognition.
gnu: packages: Add pesign.
gnu: packages: Add ukify.
gnu: packages: Add systemd-stub.
gnu: bootloaders: Add uki-efi-bootloader.
gnu: system: Update examples.
doc: Update bootloader documentation.
gnu: tests: Update tests to new targets system.
teams: Add bootloading team.

doc/guix.texi | 458 +++---
etc/teams.scm | 10 +
gnu/bootloader.scm | 662 ++++++---
gnu/bootloader/depthcharge.scm | 153 +-
gnu/bootloader/extlinux.scm | 149 +-
gnu/bootloader/grub.scm | 1279 +++++++----------
gnu/bootloader/u-boot.scm | 505 +++----
gnu/bootloader/uki.scm | 96 ++
gnu/build/bootloader.scm | 157 +-
gnu/build/image.scm | 40 +-
gnu/build/install.scm | 16 +-
gnu/image.scm | 3 +
gnu/installer/parted.scm | 12 +-
gnu/local.mk | 1 +
gnu/machine/ssh.scm | 71 +-
gnu/packages/bootloaders.scm | 277 ++--
gnu/packages/efi.scm | 47 +
gnu/packages/raspberry-pi.scm | 18 -
gnu/services/virtualization.scm | 11 +-
gnu/system.scm | 62 +-
gnu/system/boot.scm | 16 +-
gnu/system/examples/asus-c201.tmpl | 6 +-
gnu/system/examples/bare-bones.tmpl | 7 +-
gnu/system/examples/bare-hurd.tmpl | 4 +-
gnu/system/examples/beaglebone-black.tmpl | 6 +-
gnu/system/examples/desktop.tmpl | 4 +-
gnu/system/examples/docker-image.tmpl | 6 +-
gnu/system/examples/lightweight-desktop.tmpl | 4 +-
gnu/system/examples/plasma.tmpl | 4 +-
.../examples/raspberry-pi-64-nfs-root.tmpl | 23 +-
gnu/system/examples/raspberry-pi-64.tmpl | 18 +-
gnu/system/examples/vm-image.tmpl | 5 +-
gnu/system/hurd.scm | 4 +-
gnu/system/image.scm | 162 ++-
gnu/system/images/hurd.scm | 4 +-
gnu/system/images/novena.scm | 3 +-
.../images/orangepi-r1-plus-lts-rk3328.scm | 3 +-
gnu/system/images/pine64.scm | 3 +-
gnu/system/images/pinebook-pro.scm | 3 +-
gnu/system/images/rock64.scm | 3 +-
gnu/system/images/unmatched.scm | 3 +-
gnu/system/images/visionfive2.scm | 3 +-
gnu/system/images/wsl2.scm | 14 +-
gnu/system/install.scm | 43 +-
gnu/system/vm.scm | 11 -
gnu/tests.scm | 4 +-
gnu/tests/ganeti.scm | 4 +-
gnu/tests/image.scm | 4 +-
gnu/tests/install.scm | 80 +-
gnu/tests/nfs.scm | 4 +-
gnu/tests/reconfigure.scm | 86 +-
gnu/tests/telephony.scm | 4 +-
gnu/tests/vnc.scm | 4 +-
guix/scripts/system.scm | 162 +--
guix/scripts/system/reconfigure.scm | 159 +-
guix/ui.scm | 8 +
tests/boot-parameters.scm | 16 +-
57 files changed, 2389 insertions(+), 2535 deletions(-)
create mode 100644 gnu/bootloader/uki.scm


base-commit: 7d781027c78bdea5fdb3f1c9c9ec432b9606d2b5
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 01/15] guix: scripts: Rewrite reinstall-bootloader to use provenance data.
(address . 72457@debbugs.gnu.org)
6d8a2015a9e54642e3ecf0f7d1d95300496cbbde.1722803521.git.lilah@lunabee.space
The current implementation is broken anyway. Multiple bootloaders share
a name (including both versions of extlinux) and
bootloader-configuration data is significant to bootloader installation.
It shouldn't be just faked.

Rely on the provenance service instead, which while not always present,
should be for the vast majority of systems.

* guix/scripts/system.scm (reinstall-bootloader): Rename to...
(install-bootloader-from-provenance): ...this, and rewrite to extract
bootloader-configuration data from system provenance.

(switch-to-system-generation, process-command): Use
install-bootloader-from-provenance.

Change-Id: I5713a43ad4f9f32a129d980db06d70de16b03f27
---
guix/scripts/system.scm | 75 ++++++++++++++---------------------------
1 file changed, 25 insertions(+), 50 deletions(-)

Toggle diff (107 lines)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 0f7d864e06..bb7b5d37bf 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -88,6 +88,7 @@ (define-module (guix scripts system)
#:use-module (srfi srfi-37)
#:use-module (ice-9 format)
#:use-module (ice-9 match)
+ #:use-module (ice-9 receive)
#:use-module (rnrs bytevectors)
#:export (guix-system
read-operating-system
@@ -377,60 +378,33 @@ (define (switch-to-system-generation store spec)
(activate (string-append generation "/activate")))
(if number
(begin
- (reinstall-bootloader store number)
+ (install-bootloader-from-provenance store number)
(switch-to-generation* %system-profile number)
(unless-file-not-found (primitive-load activate)))
(leave (G_ "cannot switch to system generation '~a'~%") spec))))
-(define* (system-bootloader-name #:optional (system %system-profile))
- "Return the bootloader name stored in SYSTEM's \"parameters\" file."
- (let ((params (unless-file-not-found
- (read-boot-parameters-file system))))
- (boot-parameters-bootloader-name params)))
-
-(define (reinstall-bootloader store number)
- "Re-install bootloader for existing system profile generation NUMBER.
-STORE is an open connection to the store."
+(define (install-bootloader-from-provenance store number)
+ "Re-install an old bootloader using provenance data for system profile
+generation NUMBER with store STORE."
(let* ((generation (generation-file-name %system-profile number))
- ;; Detect the bootloader used in %system-profile.
- (bootloader (lookup-bootloader-by-name (system-bootloader-name)))
-
- ;; Use the detected bootloader with default configuration.
- ;; It will be enough to allow the system to boot.
- (bootloader-config (bootloader-configuration
- (bootloader bootloader)))
-
- ;; Make the specified system generation the default entry.
- (chosen-alternative (generation->boot-alternative
- %system-profile number))
- (params (boot-alternative-parameters chosen-alternative))
- (locale (boot-parameters-locale params))
- (store-crypto-devices (boot-parameters-store-crypto-devices params))
- (store-directory-prefix
- (boot-parameters-store-directory-prefix params))
- (old-generations
- (delv number (reverse (generation-numbers %system-profile))))
- (previous-boot-alternatives (profile->boot-alternatives
- %system-profile old-generations))
- (entries (list (boot-parameters->menu-entry params)))
- (old-entries (map boot-parameters->menu-entry
- (map boot-alternative-parameters
- previous-boot-alternatives))))
- (run-with-store store
- (mlet* %store-monad
- ((bootcfg (lower-object
- ((bootloader-configuration-file-generator bootloader)
- bootloader-config entries
- #:locale locale
- #:store-crypto-devices store-crypto-devices
- #:store-directory-prefix store-directory-prefix
- #:old-entries old-entries)))
- (drvs -> (list bootcfg)))
- (mbegin %store-monad
- (built-derivations drvs)
- ;; Only install bootloader configuration file.
- (install-bootloader local-eval bootloader-config bootcfg
- #:run-installer? #f))))))
+ (os (receive (_ os) (system-provenance generation)
+ (and=> os read-operating-system)))
+ (bootloader-config (operating-system-bootloader os))
+ (bootloader (bootloader-configuration-bootloader bootloader-config))
+ (numbers (delv number (reverse (generation-numbers %system-profile))))
+ (old (profile->boot-alternatives %system-profile numbers)))
+ (if os
+ (run-with-store store
+ (mlet* %store-monad
+ ((bootcfg (lower-object (operating-system-bootcfg os old)))
+ (drvs -> (list bootcfg)))
+ (mbegin %store-monad
+ (built-derivations drvs)
+ ;; Only install bootloader configuration file.
+ (install-bootloader local-eval bootloader-config bootcfg
+ #:run-installer? #f))))
+ (leave (G_ "cannot rollback to provenanceless generation '~a'~%")
+ number))))
;;;
@@ -1416,7 +1390,8 @@ (define (process-command command args opts)
(x (leave (G_ "wrong number of arguments~%"))))))
(with-store* store
(delete-matching-generations store %system-profile pattern)
- (reinstall-bootloader store (generation-number %system-profile)))))
+ (install-bootloader-from-provenance store
+ (generation-number %system-profile)))))
((switch-generation)
(let ((pattern (match args
((pattern) pattern)
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 03/15] guix: scripts: Remove unused code.
(address . 72457@debbugs.gnu.org)
a70ac840abad3539f6d542341598d50172f7a0b1.1722803521.git.lilah@lunabee.space
* guix/scripts/system.scm (bootloader-installer-script): Delete.

Change-Id: Ic1e0a523c814e4f1bf44b2721f5658f00066b0ab
---
guix/scripts/system.scm | 22 ----------------------
1 file changed, 22 deletions(-)

Toggle diff (35 lines)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index bb7b5d37bf..344bb74151 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -731,28 +731,6 @@ (define (maybe-suggest-running-guix-pull)
(warning (G_ "Consider running 'guix pull' before 'reconfigure'.~%"))
(warning (G_ "Failing to do that may downgrade your system!~%"))))
-(define (bootloader-installer-script installer
- bootloader device target)
- "Return a file calling INSTALLER gexp with given BOOTLOADER, DEVICE
-and TARGET arguments."
- (scheme-file "bootloader-installer"
- (with-imported-modules '((gnu build bootloader)
- (guix build utils))
- #~(begin
- (use-modules (gnu build bootloader)
- (guix build utils)
- (ice-9 binary-ports)
- (srfi srfi-34)
- (srfi srfi-35))
-
- (guard (c ((message-condition? c) ;XXX: i18n
- (format (current-error-port) "error: ~a~%"
- (condition-message c))
- (exit 1)))
- (#$installer #$bootloader #$device #$target)
- (info (G_ "bootloader successfully installed on '~a'~%")
- #$device))))))
-
(define (local-eval exp)
"Evaluate EXP, a G-Expression, in-place."
(mlet* %store-monad ((lowered (lower-gexp exp))
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 05/15] gnu: system: Remove useless boot parameters.
(address . 72457@debbugs.gnu.org)
c185ed4f2974fe3065c00a2b704ddd657cf87eb7.1722803521.git.lilah@lunabee.space
* gnu/system.scm (operating-system-boot-parameters,
operating-system-boot-parameters-file): Delete
bootloader-menu-entries.

* gnu/system/boot.scm (boot-parameters)[bootloader-menu-entries]: Delete
fields.
(read-boot-parameters): Don't read bootloader-menu-entries.

* tests/boot-parameters.scm (%grub-boot-parameters,
test-read-boot-parameters, test-read-boot-parameters): Don't include
bootloader-menu-entries.
("read, bootloader-menu-entries, default value"): Delete test.

Change-Id: I46d9cff4604dbfcf654b0820fdb77e72aecffbb4
---
gnu/system.scm | 7 -------
gnu/system/boot.scm | 8 --------
tests/boot-parameters.scm | 14 ++------------
3 files changed, 2 insertions(+), 27 deletions(-)

Toggle diff (120 lines)
diff --git a/gnu/system.scm b/gnu/system.scm
index a345b52d55..66c1a80733 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -1304,8 +1304,6 @@ (define* (operating-system-boot-parameters os root-device
(initrd initrd)
(multiboot-modules multiboot-modules)
(bootloader-name bootloader-name)
- (bootloader-menu-entries
- (bootloader-configuration-menu-entries (operating-system-bootloader os)))
(locale locale)
(store-device (ensure-not-/dev (file-system-device store)))
(store-directory-prefix (btrfs-store-subvolume-file-name file-systems))
@@ -1347,11 +1345,6 @@ (define* (operating-system-boot-parameters-file os)
#$(boot-parameters-multiboot-modules params)))
#~())
(bootloader-name #$(boot-parameters-bootloader-name params))
- (bootloader-menu-entries
- #$(map menu-entry->sexp
- (or (and=> (operating-system-bootloader os)
- bootloader-configuration-menu-entries)
- '())))
(locale #$(boot-parameters-locale params))
(store
(device
diff --git a/gnu/system/boot.scm b/gnu/system/boot.scm
index 2b5302ce5f..4d89827ced 100644
--- a/gnu/system/boot.scm
+++ b/gnu/system/boot.scm
@@ -54,7 +54,6 @@ (define-module (gnu system boot)
boot-parameters-label
boot-parameters-root-device
boot-parameters-bootloader-name
- boot-parameters-bootloader-menu-entries
boot-parameters-store-crypto-devices
boot-parameters-store-device
boot-parameters-store-directory-prefix
@@ -113,8 +112,6 @@ (define-record-type* <boot-parameters>
;; partition.
(root-device boot-parameters-root-device)
(bootloader-name boot-parameters-bootloader-name)
- (bootloader-menu-entries ;list of <menu-entry>
- boot-parameters-bootloader-menu-entries)
(store-device boot-parameters-store-device)
(store-mount-point boot-parameters-store-mount-point)
(store-directory-prefix boot-parameters-store-directory-prefix)
@@ -176,11 +173,6 @@ (define (read-boot-parameters port)
((_ args) (list args))
(#f 'grub))) ; for compatibility reasons.
- (bootloader-menu-entries
- (match (assq 'bootloader-menu-entries rest)
- ((_ entries) (map sexp->menu-entry entries))
- (#f '())))
-
;; In the past, we would store the directory name of linux instead of
;; the absolute file name of its image. Detect that and correct it.
(kernel (if (string=? kernel (direct-store-path kernel))
diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm
index 2e7976aa6c..f214de360d 100644
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -64,7 +64,6 @@ (define %root-path "/")
(define %grub-boot-parameters
(boot-parameters
(bootloader-name 'grub)
- (bootloader-menu-entries '())
(root-device %default-root-device)
(label %default-label)
(kernel %default-kernel)
@@ -107,7 +106,6 @@ (define* (test-read-boot-parameters
#:key
(version %boot-parameters-version)
(bootloader-name 'grub)
- (bootloader-menu-entries '())
(label %default-label)
(root-device (quote-uuid %default-root-device))
(kernel %default-kernel)
@@ -127,7 +125,7 @@ (define* (test-read-boot-parameters
(cond ((eq? 'false val) (format #false fmt #false))
(val (format #false fmt val))
(else "")))
- (format #false "(boot-parameters~a~a~a~a~a~a~a~a~a~a)"
+ (format #false "(boot-parameters~a~a~a~a~a~a~a~a~a)"
(sexp-or-nothing " (version ~S)" version)
(sexp-or-nothing " (label ~S)" label)
(sexp-or-nothing " (root-device ~S)" root-device)
@@ -145,9 +143,7 @@ (define* (test-read-boot-parameters
store-crypto-devices))
"")
(sexp-or-nothing " (locale ~S)" locale)
- (sexp-or-nothing " (bootloader-name ~a)" bootloader-name)
- (sexp-or-nothing " (bootloader-menu-entries ~S)"
- bootloader-menu-entries)))
+ (sexp-or-nothing " (bootloader-name ~a)" bootloader-name)))
(let ((str (generate-boot-parameters)))
(call-with-input-string str read-boot-parameters)))
@@ -170,7 +166,6 @@ (define* (test-read-boot-parameters
(test-assert "read, construction, optional fields"
(and (test-read-boot-parameters #:bootloader-name #false)
- (test-read-boot-parameters #:bootloader-menu-entries #false)
(test-read-boot-parameters #:kernel-arguments #false)
(test-read-boot-parameters #:with-store #false)
(test-read-boot-parameters #:store-device #false)
@@ -223,11 +218,6 @@ (define* (test-read-boot-parameters
(boot-parameters-bootloader-name
(test-read-boot-parameters #:bootloader-name #false)))
-(test-eq "read, bootloader-menu-entries, default value"
- '()
- (boot-parameters-bootloader-menu-entries
- (test-read-boot-parameters #:bootloader-menu-entries #false)))
-
(test-eq "read, kernel-arguments, default value"
'()
(boot-parameters-kernel-arguments
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 02/15] gnu: Add bootloader target infastructure.
(address . 72457@debbugs.gnu.org)
f21ff71c8ceb6735b88bbd0683adad59f704a1de.1722803521.git.lilah@lunabee.space
* gnu/bootloader.scm (bootloader-target): New record.

(&target-error): New condition.

(pathcat, get-target-of-type, parent-of, unfold-pathcat, target-base?,
type-major?, ensure, ensure-target-types, ensure-majors, gbegin):
New procedures.

(define-literal, with-targets, :path, :devpath, :device,
:fs, :label, :uuid): New macros.

(bootloader-modules): Prevent mutual imports.

* guix/ui.scm (call-with-error-handling)[target-error?]:
Handle target-errors.

Change-Id: I3f07c9096dd8b91c04449b6360b3b7d21640da14
---
gnu/bootloader.scm | 212 ++++++++++++++++++++++++++++++++++++++++++++-
guix/ui.scm | 8 ++
2 files changed, 217 insertions(+), 3 deletions(-)

Toggle diff (277 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index f32e90e79d..3ddc112cc6 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -31,10 +31,11 @@ (define-module (gnu bootloader)
#:use-module (guix profiles)
#:use-module (guix records)
#:use-module (guix deprecation)
- #:use-module ((guix ui) #:select (warn-about-load-error))
#:use-module (guix diagnostics)
#:use-module (guix i18n)
+ #:use-module (guix modules)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (ice-9 match)
@@ -63,6 +64,26 @@ (define-module (gnu bootloader)
bootloader-configuration-file
bootloader-configuration-file-generator
+ <bootloader-target>
+ bootloader-target
+ bootloader-target?
+ bootloader-target-type
+ bootloader-target-expected?
+ bootloader-target-path
+ bootloader-target-offset
+ bootloader-target-device
+ bootloader-target-file-system
+ bootloader-target-label
+ bootloader-target-uuid
+
+ target-error?
+ target-error-type
+ target-error-targets
+
+ gbegin
+ :path :devpath :device :fs :label :uuid
+ with-targets
+
bootloader-configuration
bootloader-configuration?
bootloader-configuration-bootloader
@@ -236,6 +257,191 @@ (define-record-type* <bootloader>
(configuration-file bootloader-configuration-file)
(configuration-file-generator bootloader-configuration-file-generator))
+
+;;;
+;;; Bootloader target record.
+;;;
+
+;; <bootloader-target> represents different kinds of targets in a normalized form.
+
+(define-record-type* <bootloader-target>
+ bootloader-target make-bootloader-target bootloader-target?
+ (type bootloader-target-type) ; symbol
+ (expected? bootloader-target-expected? (default #f)) ; bool
+
+ (path bootloader-target-path (default #f)) ; string|#f
+ (offset bootloader-target-offset (thunked) ; symbol|#f
+ (default (and (bootloader-target-path this-record)
+ (not (eq? (bootloader-target-type this-record) 'root))
+ 'root)))
+ (device bootloader-target-device (default #f)) ; string|#f
+ (file-system bootloader-target-file-system (default #f)) ; string|#f
+ (label bootloader-target-label (default #f)) ; string|#f
+ (uuid bootloader-target-uuid (default #f))) ; uuid|#f
+
+(define-condition-type &target-error &error target-error?
+ (type target-error-type)
+ (targets target-error-targets))
+
+(define (pathcat p1 p2)
+ (string-append (string-trim-right p1 #\/) "/" (string-trim p2 #\/)))
+
+(define* (get-target-of-type type targets #:optional (require? #f))
+ "Finds a target in TARGETS of type TYPE, optionally providing an error when
+not found if REQUIRE? is provided."
+ (let* ((pred (lambda (target) (eq? type (bootloader-target-type target))))
+ (candidates (filter pred targets))
+ (ret (if (pair? candidates) (car candidates) #f)))
+ (if (and require? (not ret))
+ (raise (condition
+ (&message (message (G_ "required, but not provided")))
+ (&target-error (type type) (targets targets))))
+ ret)))
+
+(define (parent-of target targets)
+ (and=> (bootloader-target-offset target)
+ (cut get-target-of-type <> targets #t)))
+
+(define (unfold-pathcat target targets)
+ (let ((quit (lambda (t) (not (and=> t bootloader-target-path)))))
+ (reduce pathcat #f
+ (unfold quit bootloader-target-path (cut parent-of <> targets) target))))
+
+(define (target-base? t)
+ (or (not t) (match-record t <bootloader-target>
+ (expected? offset device label uuid)
+ (or device label uuid (not offset) expected?))))
+
+(define (type-major? target) (memq target '(root esp disk)))
+
+(define (ensure types targets end)
+ (let* ((used-in (cute unfold end identity (cut parent-of <> targets) <>))
+ (cons-in (lambda (t) (cons t (used-in t))))
+ (ensure (map (cut get-target-of-type <> targets #t) types)))
+ (filter ->bool (apply append (map cons-in ensure)))))
+
+(define* (ensure-target-types types targets #:optional (base? #f))
+ "Ensures all TYPES are provided in TARGETS. Returns #t iff every ensured
+target and its requirements are fully provided. Errors out when a required TYPE
+isn't provided. When BASE?, only ensure path requirements up to a device."
+ (not (any bootloader-target-expected?
+ (ensure types targets (if base? target-base? not)))))
+
+(define (ensure-majors types targets)
+ "Errors out when a required TYPE isn't provided, or when use of multiple major
+targets is detected."
+ (let* ((all (map bootloader-target-type (ensure types targets target-base?)))
+ (majors (delete-duplicates (filter type-major? all) eq?)))
+ (if (< (length majors) 2) #t
+ (raise (condition (&message (message (G_ "multiple major targets used")))
+ (&target-error (type majors) (targets targets)))))))
+
+
+
+(define (gbegin . gex)
+ "Sequence provided g-expressions."
+ (case (length gex) ((0) #f) ((1) (car gex)) (else #~(begin #$@gex))))
+
+;; syntax matching on free literals breaks easily, so bind them
+(define-syntax-rule (define-literal id) (define-syntax id (syntax-rules ())))
+(define-literal :path)
+(define-literal :devpath)
+(define-literal :device)
+(define-literal :fs)
+(define-literal :label)
+(define-literal :uuid)
+
+(define-syntax with-targets
+ (cut syntax-case <> ()
+ ((_ targets-expr block ...)
+ (let* ((genvars (compose generate-temporaries iota))
+ (targets (car (genvars 1)))
+
+ (path? (cut syntax-case <> (:path) ((_ :path) #t) (_ #f)))
+ (qualified? (cut syntax-case <> (=>)
+ ((_ => spec ...) (any path? #'(spec ...)))
+ (_ #f)))
+
+ (resolve
+ (lambda (in target base)
+ (with-syntax ((target target) (base base) (targets targets))
+ (syntax-case in
+ (:path :devpath :device :fs :label :uuid)
+ ((name _) (not (identifier? #'name))
+ #`(_ (syntax-error "binds must be to identifiers" #,in)))
+ ((name :device) #'(name (bootloader-target-device base)))
+ ((name :label) #'(name (bootloader-target-label base)))
+ ((name :uuid) #'(name (bootloader-target-uuid base)))
+ ((name :fs) #'(name (bootloader-target-file-system base)))
+ ((name :path) #'(name (unfold-pathcat target targets)))
+ ((name :devpath)
+ #'(name (pathcat "/" (bootloader-target-path target))))
+ (_ #`(_ (syntax-error "invalid binding spec" #,in)))))))
+ (binds
+ (lambda (spec)
+ (syntax-case spec (=>)
+ ((type => binds ...)
+ (with-syntax (((target base) (genvars 2)) (targets targets))
+ (append
+ #`((get (lambda (t) (get-target-of-type t targets #t)))
+ (target (get type))
+ (base (if (target-base? target) target
+ (get (bootloader-target-offset target)))))
+ (map (cut resolve <> #'target #'base) #'(binds ...)))))
+ (_ #f))))
+
+ (blocks
+ (cut syntax-case <> ()
+ ((spec ... expr)
+ (let* ((specs #'(spec ...))
+ (lets (apply append (filter-map binds specs)))
+ (type (cut syntax-case <> (=>)
+ ((t => _ ...) #'t) (t #'t))))
+ (receive (full part) (partition qualified? specs)
+ #`(and (ensure-majors (list #,@(map type specs)) #,targets)
+ (ensure-target-types (list #,@(map type part))
+ #,targets #t)
+ (ensure-target-types (list #,@(map type full))
+ #,targets #f)
+ (let* #,lets expr)))))
+ (bad #'(syntax-error "malformed block" bad)))))
+ "Using the list TARGETS, evaluate and sequence each BLOCK to produce a
+gexp. BLOCK is a set of SPECs followed by an EXPR (evaluating to a gexp). Each
+SPEC denotes a type of target to guard EXPR on their existance and
+full-qualification. This procedure is linear in regards to BLOCKs.
+
+SPEC may be of the following forms:
+@itemize
+@item 'TYPE Requires TYPE to be fully present or promised. Errors otherwise.
+@item ('TYPE => (VAR COMPONENT) ...): As type, but also binds variables. TYPE's
+ COMPONENT is bound to the variable VAR as described below.
+@end itemize
+
+Available COMPONENTs are:
+@itemize
+@item :path (fully-qualified)
+@item :devpath (relative from device)
+@item :device (auto-detected from uuid and label if not user-provided)
+@item :fs
+@item :label
+@item :uuid
+@end itemize
+
+Note that installers may be called multiple times with different targets being
+fully-qualified. To ensure that targets aren't installed multiple times, make sure
+that each BLOCK ensures at least one major target, either directly or indirectly.
+Corrolarily, at most one major target should be ensured per BLOCK, under the same
+conditions. Major targets originate from disk image handling, and are currently:
+@itemize
+@item disk
+@item root
+@item esp
+@end itemize"
+ #`(let ((#,targets targets-expr))
+ (apply gbegin (filter ->bool
+ (list #,@(map blocks #'(block ...))))))))
+ (bad #'(syntax-error "must provide targets" bad))))
+
;;;
;;; Bootloader configuration record.
@@ -305,10 +511,10 @@ (define (bootloader-configuration-targets config)
(define (bootloader-modules)
"Return the list of bootloader modules."
+ ;; don't provide #:warn to prevent mutual imports
(all-modules (map (lambda (entry)
`(,entry . "gnu/bootloader"))
- %load-path)
- #:warn warn-about-load-error))
+ %load-path)))
(define %bootloaders
;; The list of publically-known bootloaders.
diff --git a/guix/ui.scm b/guix/ui.scm
index 9db6f6e9d7..1c9300c9eb 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -36,6 +36,8 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix ui)
+ #:use-module ((gnu bootloader)
+ #:select (target-error? target-error-type target-error-targets))
#:use-module (guix i18n)
#:use-module (guix colors)
#:use-module (guix diagnostics)
@@ -857,6 +859,12 @@ (define (call-with-error-handling thunk)
(invoke-error-stop-signal c)
(cons (invoke-error-program c)
(invoke-error-arguments c))))
+ ((target-error? c)
+ (leave (G_ "bootloader-target '~a'~@[: ~a~] ~
+ among the following targets:~%~{~y~}")
+ (target-error-type c)
+ (and (message-condition? c) (condition-message c))
+ (target-error-targets c)))
((formatted-message? c)
(apply report-error
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 04/15] gnu: Core bootloader changes.
(address . 72457@debbugs.gnu.org)
37d9ed7280f720a59d8659cb716502c5c2c8fa73.1722803521.git.lilah@lunabee.space
Sorry this is a massive commit. It's kinda impossible to split it without
either completely breaking basic functionality or making a buggy shim
layer that's written just to be immediately removed.

But, anyway, this is the real body of the bootloader subsystem update.
One of my favorite new things possible with this is easy generation of
disk images using arbitrary bootloaders, including ones that require one
or more data/install partitions (such as p-boot or depthcharge)!

* gnu/bootloader.scm (menu-entry): Add device-subvol field.
(menu-entry->sexp, sexp->menu-entry): Support device-subvol.
(normalize-file, warn-update-targets, target-overrides, normalize,
bootloader-configuration->gexp, bootloader-configurations->gexps,
efi-arch, install-efi):
New procedures.
(bootloader): Rewrite record.
(bootloader-configuration)[target]: Remove deprecated field.
[targets]: Include sanitizer and allow multiple bootloaders.
[terminal-outputs, terminal-inputs]: Don't assume grub.
[efi-removable?, 32bit?]: New fields.
(warn-target-field-deprecation): Delete deprecation warning.
(%bootloaders): Delete variable.
(bootloader-configuration-target, bootloader-configuration-targets,
lookup-bootloader-by-name, bootloader-modules, efi-bootloader-profile,
efi-bootloader-chain): Delete procedures.

* gnu/bootloader/depthcharge.scm, gnu/bootloader/extlinux.scm,
gnu/bootloader/grub.scm, gnu/bootloader/u-boot.scm: Rewrite entirely.

* gnu/build/bootloader.scm (parse-bootnums): New variable.
(atomic-copy, in-temporary-directory, efi-bootnums): New procedures.
(install-efi-loader): Delete procedure.
(install-efi): Rewrite to support installation of any efi bootloader.

* gnu/build/image.scm (initialize-efi32-partition: Deprecate.
(initialize-efi-partitition): Only create EFI directory.
(initialize-root-partition): Don't install bootloader here.
(make-iso9660-image): Pull in grub.dir instead of a bootcfg.

* gnu/build/install.scm (install-boot-config): Delete procedure.

* gnu/image.scm (partition)[target]: New field in order to support
dynamic provision of image partitions as bootloader targets.

* gnu/installer/parted.scm (bootloader-configuration),
gnu/machine/ssh.scm (deploy-managed-host) (roll-back-managed-host):
Use new bootloader system.

* gnu/packages/bootloaders.scm (make-grub-efi-netboot): Delete
procedure.

* gnu/packages/raspberry-pi.scm (grub-efi-bootloader-chain-raspi-64):
Delete procedure. Can be recreated with a raspberry pi bootloader
combined with grub-efi.

* gnu/system.scm (convert-bootloader-field): New procedure.
(operating-system)[bootloader]: Use above sanitizer and support
multiple bootloaders.
(operating-system-bootcfg): Rename to...
(operating-system-bootmeta): ...this. Rewrite to return relavent
information instead of calling the config procedure directly.
(operating-system-boot-parameters): Support multiple bootloaders.

* gnu/system/boot.scm (read-boot-parameters): Support multiple
bootloaders.
(boot-parameters->menu-entry): Support device-subvol.
(boot-alternative->menu-entry): New procedure.

* gnu/system/image.scm (root-partition, esp-partition): Use target field.
(esp32-partition, efi32-disk-partition, efi32-raw-image-type): Deprecate.
(root-partition-index): Delete procedure.
(system-disk-image, system-iso9960-image): Support new bootloader system.
(system-disk-image)[targets]: New subprocedure.

* gnu/system/images/hurd.scm (hurd-barebones-os)[bootloader],
gnu/system/images/novena.scm (novena-barebones-os)[bootloader],
gnu/system/images/orangepi-r1-plus-lts-rk3328.scm
(orangepi-r1-plus-lts-rk3328-barebones-os)[bootloader],
gnu/system/images/pine64.scm (pine64-barebones-os)[bootloader],
gnu/system/images/pinebook-pro.scm
(pinebook-pro-barebones-os)[bootloader],
gnu/system/images/rock64.scm (rock64-barebones-os)[bootloader],
gnu/system/images/unmatched.scm (unmatched-barebones-os)[bootloader],
gnu/system/images/visionfive2.scm
(visionfive2-barebones-os)[bootloader]: Use new target format.

* gnu/system/images/wsl2.scm (dummy-bootloader): Delete variable.
(wsl-os)[bootloader]: Don't provide field.

* gnu/system/install.scm (installation-os)[bootloader]: Use new format.
(os-with-u-boot): Delete procedure.
(embedded-installation-os)[bootloader]: Use new format.
(beaglebone-black-installation-os, a20-olinuxino-lime-installation-os,
a20-olinuxino-lime2-emmc-installation-os,
a20-olinuxino-micro-installation-os, bananapi-m2-ultra-installation-os,
firefly-rk3399-installation-os, mx6cuboxi-installation-os,
novena-installation-os, nintendo-nes-classic-edition-installation-os,
orangepi-r1-plus-lts-rk3328-installation-os, pine64-plus-installation-os,
pinebook-installation-os, rock64-installation-os,
rockpro64-installation-os, rk3399-puma-installation-os,
wandboard-installation-os): Don't guess block device.

* gnu/system/vm.scm (virtualized-operating-system): Don't provide
bootloader.

* gnu/tests/install.scm (%minimal-extlinux-os)[bootloader]: Use proper
extlinux variable.
(%btrfs-raid10-root-os): Use multiple bootloaders.

* gnu/tests/reconfigure.scm (%test-install-bootloader): Delete variable.
(run-install-bootloader-test): Delete procedure.

* guix/scripts/system.scm (install, install-bootloader-from-provenance,
perform-action): Support multiple bootloaders and work with new
bootloader system instead of bootcfgs.
(display-system-generation): Support multiple bootloaders.

* guix/scripts/system/reconfigure.scm (install-bootloader-program):
Rewrite to simply insert each bootloader's installer in the gexp
directly, instead of copying bootcfgs.
(install-bootloader): Work with new bootloader system. Just in case,
add install-bootloader.scm to the gc roots too.

Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739
---
gnu/bootloader.scm | 442 +++---
gnu/bootloader/depthcharge.scm | 153 +-
gnu/bootloader/extlinux.scm | 149 +-
gnu/bootloader/grub.scm | 1279 +++++++----------
gnu/bootloader/u-boot.scm | 439 ++----
gnu/build/bootloader.scm | 157 +-
gnu/build/image.scm | 40 +-
gnu/build/install.scm | 16 +-
gnu/image.scm | 3 +
gnu/installer/parted.scm | 12 +-
gnu/machine/ssh.scm | 71 +-
gnu/packages/bootloaders.scm | 86 --
gnu/packages/raspberry-pi.scm | 18 -
gnu/system.scm | 45 +-
gnu/system/boot.scm | 8 +-
gnu/system/image.scm | 162 ++-
gnu/system/images/hurd.scm | 4 +-
gnu/system/images/novena.scm | 3 +-
.../images/orangepi-r1-plus-lts-rk3328.scm | 3 +-
gnu/system/images/pine64.scm | 3 +-
gnu/system/images/pinebook-pro.scm | 3 +-
gnu/system/images/rock64.scm | 3 +-
gnu/system/images/unmatched.scm | 3 +-
gnu/system/images/visionfive2.scm | 3 +-
gnu/system/images/wsl2.scm | 14 +-
gnu/system/install.scm | 43 +-
gnu/system/vm.scm | 11 -
gnu/tests/install.scm | 10 +-
gnu/tests/reconfigure.scm | 86 +-
guix/scripts/system.scm | 89 +-
guix/scripts/system/reconfigure.scm | 159 +-
31 files changed, 1427 insertions(+), 2090 deletions(-)

Toggle diff (300 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 3ddc112cc6..f855671e82 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
;;; Copyright © 2022 Reza Alizadeh Majd <r.majd@pantherx.org>
;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
+;;; Copyright © 2024 Lilah Tascheter <lilah@lunabee.space>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -24,45 +25,53 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu bootloader)
+ #:autoload (gnu build file-systems)
+ (read-partition-label read-partition-uuid
+ find-partition-by-label find-partition-by-uuid)
+ #:use-module (gnu packages linux)
#:use-module (gnu system file-systems)
#:use-module (gnu system uuid)
- #:use-module (guix discovery)
- #:use-module (guix gexp)
- #:use-module (guix profiles)
- #:use-module (guix records)
+ #:autoload (guix build syscalls)
+ (mounts mount-source mount-point mount-type)
#:use-module (guix deprecation)
#:use-module (guix diagnostics)
+ #:use-module (guix gexp)
#:use-module (guix i18n)
#:use-module (guix modules)
+ #:use-module (guix profiles)
+ #:use-module (guix records)
+ #:use-module (guix utils)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 receive)
+ #:use-module (rnrs bytevectors)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
- #:use-module (ice-9 match)
- #:export (menu-entry
+ #:export (<menu-entry>
+ menu-entry
menu-entry?
menu-entry-label
menu-entry-device
+ menu-entry-device-mount-point
+ menu-entry-device-subvol
menu-entry-linux
menu-entry-linux-arguments
menu-entry-initrd
- menu-entry-device-mount-point
menu-entry-multiboot-kernel
menu-entry-multiboot-arguments
menu-entry-multiboot-modules
menu-entry-chain-loader
+ normalize-file
menu-entry->sexp
sexp->menu-entry
bootloader
bootloader?
bootloader-name
- bootloader-package
+ bootloader-default-targets
bootloader-installer
- bootloader-disk-image-installer
- bootloader-configuration-file
- bootloader-configuration-file-generator
<bootloader-target>
bootloader-target
@@ -84,13 +93,15 @@ (define-module (gnu bootloader)
:path :devpath :device :fs :label :uuid
with-targets
+ <bootloader-configuration>
bootloader-configuration
bootloader-configuration?
bootloader-configuration-bootloader
- bootloader-configuration-target ;deprecated
bootloader-configuration-targets
bootloader-configuration-menu-entries
bootloader-configuration-default-entry
+ bootloader-configuration-efi-removable?
+ bootloader-configuration-32bit?
bootloader-configuration-timeout
bootloader-configuration-keyboard-layout
bootloader-configuration-theme
@@ -101,10 +112,11 @@ (define-module (gnu bootloader)
bootloader-configuration-device-tree-support?
bootloader-configuration-extra-initrd
- %bootloaders
- lookup-bootloader-by-name
+ bootloader-configuration->gexp
+ bootloader-configurations->gexp
- efi-bootloader-chain))
+ efi-arch
+ install-efi))
;;;
@@ -119,6 +131,8 @@ (define-record-type* <menu-entry>
(default #f))
(device-mount-point menu-entry-device-mount-point
(default #f))
+ (device-subvol menu-entry-device-subvol
+ (default #f))
(linux menu-entry-linux
(default #f))
(linux-arguments menu-entry-linux-arguments
@@ -135,6 +149,18 @@ (define-record-type* <menu-entry>
(chain-loader menu-entry-chain-loader
(default #f))) ; string, path of efi file
+(define (normalize-file entry val)
+ "Normalize a file VAL stored in a menu entry into one suitable for a
+bootloader. Realizes device-mount-point and device-subvol."
+ (match-record entry <menu-entry> (device-mount-point device-subvol)
+ #~(let* ((rel (lambda (s) (substring s (if (string-prefix? "/" s) 1 0))))
+ (file (rel #$val))
+ (subvol (and=> #$device-subvol rel))
+ (mount (and=> #$device-mount-point rel)))
+ (string-append (if subvol (string-append "/" subvol "/") "/")
+ (if (and mount (string-prefix? mount file))
+ (substring file (string-length mount)) file)))))
+
(define (report-menu-entry-error menu-entry)
(raise
(condition
@@ -162,7 +188,7 @@ (define (menu-entry->sexp entry)
`(label ,(file-system-label->string label)))
(_ device)))
(match entry
- (($ <menu-entry> label device mount-point
+ (($ <menu-entry> label device mount-point subvol
(? identity linux) linux-arguments (? identity initrd)
#f () () #f)
`(menu-entry (version 0)
@@ -171,8 +197,9 @@ (define (menu-entry->sexp entry)
(device-mount-point ,mount-point)
(linux ,linux)
(linux-arguments ,linux-arguments)
- (initrd ,initrd)))
- (($ <menu-entry> label device mount-point #f () #f
+ (initrd ,initrd)
+ (device-subvol ,subvol)))
+ (($ <menu-entry> label device mount-point subvol #f () #f
(? identity multiboot-kernel) multiboot-arguments
multiboot-modules #f)
`(menu-entry (version 0)
@@ -181,19 +208,23 @@ (define (menu-entry->sexp entry)
(device-mount-point ,mount-point)
(multiboot-kernel ,multiboot-kernel)
(multiboot-arguments ,multiboot-arguments)
- (multiboot-modules ,multiboot-modules)))
- (($ <menu-entry> label device mount-point #f () #f #f () ()
+ (multiboot-modules ,multiboot-modules)
+ (device-subvol ,subvol)))
+ (($ <menu-entry> label device mount-point subvol #f () #f #f () ()
(? identity chain-loader))
`(menu-entry (version 0)
(label ,label)
(device ,(device->sexp device))
(device-mount-point ,mount-point)
- (chain-loader ,chain-loader)))
+ (chain-loader ,chain-loader)
+ (device-subvol ,subvol)))
(_ (report-menu-entry-error entry))))
(define (sexp->menu-entry sexp)
"Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry>
record."
+ ;; XXX: rely on shadowing to support the match ors below
+ (define subvol #f)
(define (sexp->device device-sexp)
(match device-sexp
(('uuid type uuid-string)
@@ -206,35 +237,41 @@ (define (sexp->menu-entry sexp)
('label label) ('device device)
('device-mount-point mount-point)
('linux linux) ('linux-arguments linux-arguments)
- ('initrd initrd) _ ...)
+ ('initrd initrd)
+ (or ('device-subvol subvol _ ...) (_ ...)))
(menu-entry
(label label)
(device (sexp->device device))
(device-mount-point mount-point)
+ (device-subvol subvol)
(linux linux)
(linux-arguments linux-arguments)
(initrd initrd)))
(('menu-entry ('version 0)
('label label) ('device device)
- ('device-mount-point mount-point)
+ ('device-mount-point mount-point) ('device-subvol subvol)
('multiboot-kernel multiboot-kernel)
('multiboot-arguments multiboot-arguments)
- ('multiboot-modules multiboot-modules) _ ...)
+ ('multiboot-modules multiboot-modules)
+ (or ('device-subvol subvol _ ...) (_ ...)))
(menu-entry
(label label)
(device (sexp->device device))
(device-mount-point mount-point)
+ (device-subvol subvol)
(multiboot-kernel multiboot-kernel)
(multiboot-arguments multiboot-arguments)
(multiboot-modules multiboot-modules)))
(('menu-entry ('version 0)
('label label) ('device device)
- ('device-mount-point mount-point)
- ('chain-loader chain-loader) _ ...)
+ ('device-mount-point mount-point) ('device-subvol subvol)
+ ('chain-loader chain-loader)
+ (or ('device-subvol subvol _ ...) (_ ...)))
(menu-entry
(label label)
(device (sexp->device device))
(device-mount-point mount-point)
+ (device-subvol subvol)
(chain-loader chain-loader)))))
@@ -247,15 +284,10 @@ (define (sexp->menu-entry sexp)
;; has to be described by this record.
(define-record-type* <bootloader>
- bootloader make-bootloader
- bootloader?
- (name bootloader-name)
- (package bootloader-package)
- (installer bootloader-installer)
- (disk-image-installer bootloader-disk-image-installer
- (default #f))
- (configuration-file bootloader-configuration-file)
- (configuration-file-generator bootloader-configuration-file-generator))
+ bootloader make-bootloader bootloader?
+ (name bootloader-name)
+ (default-targets bootloader-default-targets (default '()))
+ (installer bootloader-installer))
;;;
@@ -450,28 +482,48 @@ (define-syntax with-targets
;; The <bootloader-configuration> record contains bootloader independant
;; configuration used to fill bootloader configuration file.
-(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)
+(define-with-syntax-properties (warn-update-targets (value properties))
+ (let ((loc (source-properties->location properties)))
+ (define update
+ (match-lambda
+ ((? bootloader-target? target) (cons #f target))
+ ((? string? s) (cons #t (if (string-prefix? "/dev" s)
+ (bootloader-target
+ (type 'disk)
+ (device s))
+ (bootloader-target
+ (type 'esp)
+ (offset 'root)
+ (path s)))))
+ (x (error loc (G_ "invalid target '~a'~%") x))))
+
+ (let* ((updated (map update (if (list? value) value (list value))))
+ (targets (map cdr updated))
+ (types (map bootloader-target-type targets)))
+ ;; XXX: should this be an error?
+ (when (any car updated)
+ (warning loc (G_ "the 'targets' field should now contain \
+<bootloader-target> records. inferring a best guess (this might break!)...~%")))
+ (when (not (eqv? (length types) (length (delete-duplicates types))))
+ (error loc (G_ "the 'targets' field may not contain duplicates~%")))
+ targets)))
(define-record-type* <bootloader-configuration>
bootloader-configuration make-bootloader-configuration
bootloader-configuration?
(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))
+ bootloader-config
This message was truncated. Download the full message here.
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 06/15] gnu: bootloader: Add raspberry pi bootloader.
(address . 72457@debbugs.gnu.org)
3111d1dbe934db826d03ff218d30784e3191488b.1722803521.git.lilah@lunabee.space
Less adding and more making it an actual bootloader rather than some
weirdly specified packages.

* gnu/bootloader/u-boot.scm (rpi-config, install-rpi): New procedures.
(define-u-bootloader-rpi): New macro.
(u-boot-rpi-2-bootloader, u-boot-rpi-3-bootloader,
u-boot-rpi-4-bootloader, u-boot-rpi-bootloader): New variables.

* gnu/packages/bootloaders.scm (make-u-boot-bin-package): Delete
procedure.
(%u-boot-rpi-efi-description, %u-boot-rpi-efi-description-32-bit,
u-boot-rpi-2-efi, u-boot-rpi-3-32b-efi, u-boot-rpi-4-32b-efi,
u-boot-rpi-arm64-efi, u-boot-rpi-2-bin, u-boot-rpi-3_32b-bin,
u-boot-rpi-4_32b-bin, u-boot-rpi-arm64-bin, u-boot-rpi-2-efi-bin,
u-boot-rpi-3-32b-efi-bin, u-boot-rpi-4-32b-efi-bin,
u-boot-rpi-arm64-efi-bin): Delete variables.

Change-Id: I5139a0b00ec89189e8e7c84e06a7a3b7240259cd
---
gnu/bootloader/u-boot.scm | 66 ++++++++++++++++++++++++-
gnu/packages/bootloaders.scm | 94 +++---------------------------------
2 files changed, 71 insertions(+), 89 deletions(-)

Toggle diff (219 lines)
diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm
index 7d3e202f8c..e8dfe9b3a2 100644
--- a/gnu/bootloader/u-boot.scm
+++ b/gnu/bootloader/u-boot.scm
@@ -28,7 +28,10 @@ (define-module (gnu bootloader u-boot)
#:use-module (gnu bootloader)
#:use-module (gnu bootloader extlinux)
#:use-module (gnu packages bootloaders)
+ #:use-module (gnu packages raspberry-pi)
+ #:use-module (gnu system boot)
#:use-module (guix gexp)
+ #:use-module (guix utils)
#:export (u-boot-a20-olinuxino-lime-bootloader
u-boot-a20-olinuxino-lime2-bootloader
u-boot-a20-olinuxino-micro-bootloader
@@ -51,7 +54,11 @@ (define-module (gnu bootloader u-boot)
u-boot-qemu-riscv64-bootloader
u-boot-starfive-visionfive2-bootloader
u-boot-ts7970-q-2g-1000mhz-c-bootloader
- u-boot-wandboard-bootloader))
+ u-boot-wandboard-bootloader
+ u-boot-rpi-2-bootloader
+ u-boot-rpi-3-bootloader
+ u-boot-rpi-4-bootloader
+ u-boot-rpi-bootloader))
(define (make-install-u-boot firmware installers)
(lambda* (#:key bootloader-config #:allow-other-keys . args)
@@ -222,3 +229,60 @@ (define-u-bootloader-copy u-boot-ts7970-q-2g-1000mhz-c-bootloader
(define-u-bootloader-copy u-boot-qemu-riscv64-bootloader
u-boot-qemu-riscv64 "u-boot.bin")
+
+
+;;;
+;;; RasPi bootloader definitions.
+;;;
+
+(define (rpi-config 32?)
+ ;; allows a user-specified custom.txt
+ (plain-file "config.txt"
+ (format #f
+ "arm_64bit=~a~%enable_uart=1~%kernel=u-boot.bin~%include custom.txt~%"
+ (if (or 32? (not (target-64bit?))) "0" "1"))))
+
+(define (install-rpi u-boot-32 u-boot-64)
+ (lambda* (#:key bootloader-config #:allow-other-keys . args)
+ (with-targets (bootloader-configuration-targets bootloader-config)
+ ('install (apply install-extlinux-config args))
+ (('firmware => (firmware :path))
+ (let* ((32? (bootloader-configuration-32bit? bootloader-config))
+ (use-32? (or 32? (not (target-64bit?)) (not u-boot-64))))
+ #~(begin
+ (atomic-copy #$(file-append (if use-32? u-boot-32 u-boot-64)
+ "/libexec/u-boot.bin")
+ (string-append #$firmware "/u-boot.bin"))
+ (atomic-copy #$(rpi-config use-32?)
+ (string-append #$firmware "/config.txt"))))))))
+
+(define-syntax-rule (define-u-bootloader-rpi def-name u-boot-32 u-boot-64)
+ (define def-name
+ (bootloader (name 'u-boot)
+ (default-targets
+ (list (bootloader-target (type 'install)
+ (offset 'firmware)
+ (path "extlinux"))
+ (bootloader-target (type 'firmware)
+ (offset 'root)
+ (path "boot"))))
+ (installer (install-rpi u-boot-32 u-boot-64)))))
+
+
+;; These neither install firmware nor device-tree files for the Raspberry Pi.
+;; They just assume them to be existing in 'install in the same way that some
+;; UEFI firmware with ACPI data is usually assumed to be existing on PCs.
+;; They can be used with either extlinux or as UEFI firmware (alongside, eg,
+;; GRUB).
+(define-u-bootloader-rpi u-boot-rpi-2-bootloader
+ u-boot-rpi-2 #f)
+
+(define-u-bootloader-rpi u-boot-rpi-3-bootloader
+ u-boot-rpi-3-32b u-boot-rpi-arm64)
+
+(define-u-bootloader-rpi u-boot-rpi-4-bootloader
+ u-boot-rpi-4-32b u-boot-rpi-arm64)
+
+;; Usable for any 64-bit raspberry pi.
+(define-u-bootloader-rpi u-boot-rpi-bootloader
+ #f u-boot-rpi-arm64)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 12f918a123..e78602379d 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1409,40 +1409,8 @@ (define-public u-boot-pinebook-pro-rk3399
(modify-inputs (package-inputs base)
(append arm-trusted-firmware-rk3399))))))
-(define*-public (make-u-boot-bin-package u-boot-package
- #:key
- (u-boot-bin "u-boot.bin"))
- "Return a package with a single U-BOOT-BIN file from the U-BOOT-PACKAGE.
-The package name will be that of the U-BOOT package suffixed with \"-bin\"."
- (package
- (name (string-append (package-name u-boot-package) "-bin"))
- (version (package-version u-boot-package))
- (source #f)
- (build-system trivial-build-system)
- (arguments
- (list
- #:builder
- (with-imported-modules '((guix build utils))
- #~(begin
- (use-modules (guix build utils))
- (mkdir #$output)
- (symlink (search-input-file %build-inputs
- (string-append "libexec/" #$u-boot-bin))
- (string-append #$output "/" #$u-boot-bin))))))
- (inputs (list u-boot-package))
- (home-page (package-home-page u-boot-package))
- (synopsis (package-synopsis u-boot-package))
- (description (string-append
- (package-description u-boot-package)
- "\n\n"
- (format #f
- "This package only contains the file ~a."
- u-boot-bin)))
- (license (package-license u-boot-package))))
-
-(define-public %u-boot-rpi-efi-configs
- '("CONFIG_OF_EMBED"
- "CONFIG_OF_BOARD=y"))
+;; get dtbs from firmware to support dtoverlays
+(define-public %u-boot-rpi-configs '("CONFIG_OF_EMBED" "CONFIG_OF_BOARD=y"))
(define %u-boot-rpi-description-32-bit
"This is a 32-bit build of U-Boot.")
@@ -1451,76 +1419,26 @@ (define %u-boot-rpi-description-64-bit
"This is a common 64-bit build of U-Boot for all 64-bit capable Raspberry Pi
variants.")
-(define %u-boot-rpi-efi-description
- "It allows network booting and uses the device-tree from the firmware,
-allowing the usage of overlays. It can act as an EFI firmware for the
-grub-efi-netboot-removable-bootloader.")
-
-(define %u-boot-rpi-efi-description-32-bit
- (string-append %u-boot-rpi-efi-description " "
- %u-boot-rpi-description-32-bit))
-
(define-public u-boot-rpi-2
(make-u-boot-package "rpi_2" "arm-linux-gnueabihf"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-3-32b
(make-u-boot-package "rpi_3_32b" "arm-linux-gnueabihf"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-4-32b
(make-u-boot-package "rpi_4_32b" "arm-linux-gnueabihf"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-32-bit))
(define-public u-boot-rpi-arm64
(make-u-boot-package "rpi_arm64" "aarch64-linux-gnu"
+ #:configs %u-boot-rpi-configs
#:append-description %u-boot-rpi-description-64-bit))
-(define-public u-boot-rpi-2-efi
- (make-u-boot-package "rpi_2" "arm-linux-gnueabihf"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description %u-boot-rpi-efi-description-32-bit))
-
-(define-public u-boot-rpi-3-32b-efi
- (make-u-boot-package "rpi_3_32b" "arm-linux-gnueabihf"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description %u-boot-rpi-efi-description-32-bit))
-
-(define-public u-boot-rpi-4-32b-efi
- (make-u-boot-package "rpi_4_32b" "arm-linux-gnueabihf"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description %u-boot-rpi-efi-description-32-bit))
-
-(define-public u-boot-rpi-arm64-efi
- (make-u-boot-package "rpi_arm64""aarch64-linux-gnu"
- #:name-suffix "-efi"
- #:configs %u-boot-rpi-efi-configs
- #:append-description (string-append
- %u-boot-rpi-efi-description " "
- %u-boot-rpi-description-64-bit)))
-
-(define-public u-boot-rpi-2-bin (make-u-boot-bin-package u-boot-rpi-2))
-
-(define-public u-boot-rpi-3_32b-bin (make-u-boot-bin-package u-boot-rpi-3-32b))
-
-(define-public u-boot-rpi-4_32b-bin (make-u-boot-bin-package u-boot-rpi-4-32b))
-
-(define-public u-boot-rpi-arm64-bin (make-u-boot-bin-package u-boot-rpi-arm64))
-
-(define-public u-boot-rpi-2-efi-bin (make-u-boot-bin-package u-boot-rpi-2-efi))
-
-(define-public u-boot-rpi-3-32b-efi-bin
- (make-u-boot-bin-package u-boot-rpi-3-32b-efi))
-
-(define-public u-boot-rpi-4-32b-efi-bin
- (make-u-boot-bin-package u-boot-rpi-4-32b-efi))
-
-(define-public u-boot-rpi-arm64-efi-bin
- (make-u-boot-bin-package u-boot-rpi-arm64-efi))
-
(define u-boot-ts-mx6
;; There is no release; use the latest commit of the
;; 'imx_v2015.04_3.14.52_1.1.0_ga' branch.
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 07/15] gnu: system: Fix bootloader crypto device recognition.
(address . 72457@debbugs.gnu.org)
0a87dfd7b7f40c55ba99df7952dd3eb2c2e5f183.1722803521.git.lilah@lunabee.space
* gnu/system.scm (operating-system-bootloader-crypto-devices): Check for
luks-device-mapping-with-options in addition to luks-device-mapping.

Change-Id: Iafc9afe608640b97083c4d559c9240846330472a
---
gnu/system.scm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

Toggle diff (23 lines)
diff --git a/gnu/system.scm b/gnu/system.scm
index 66c1a80733..093c8fa350 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -400,10 +400,12 @@ (define operating-system-bootloader-crypto-devices
(mlambdaq (os) ;to avoid duplicated output
"Return the sources of the LUKS mapped devices specified by UUID."
;; XXX: Device ordering is important, we trust the returned one.
- (let* ((luks-devices (filter (lambda (m)
- (eq? luks-device-mapping
- (mapped-device-type m)))
- (operating-system-boot-mapped-devices os)))
+ ;; Check against the close-luks-device procedure to get both maptypes
+ (let* ((close (mapped-device-kind-close luks-device-mapping))
+ (luks? (lambda (m) (let ((t (mapped-device-type m)))
+ (eq? (mapped-device-kind-close t) close))))
+ (luks-devices (filter luks?
+ (operating-system-boot-mapped-devices os)))
(uuid-crypto-devices non-uuid-crypto-devices
(partition (compose uuid? mapped-device-source)
luks-devices)))
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 08/15] gnu: packages: Add pesign.
(address . 72457@debbugs.gnu.org)
1a0a6070dd97d88544a22c58d208cba64915ff5c.1722803521.git.lilah@lunabee.space
* gnu/packages/efi.scm (pesign): New variable.

Change-Id: I00fcc679d9514c85d508183b9ec7e121e0a814db
---
gnu/packages/efi.scm | 47 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)

Toggle diff (69 lines)
diff --git a/gnu/packages/efi.scm b/gnu/packages/efi.scm
index 499745eba1..417b70d91b 100644
--- a/gnu/packages/efi.scm
+++ b/gnu/packages/efi.scm
@@ -24,8 +24,10 @@ (define-module (gnu packages efi)
#:use-module (gnu packages bash)
#:use-module (gnu packages linux)
#:use-module (gnu packages man)
+ #:use-module (gnu packages nss)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages popt)
#:use-module (gnu packages tls)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix build-system gnu)
@@ -153,6 +155,51 @@ (define-public sbsigntools
(home-page "https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/")
(license license:gpl3+)))
+(define-public pesign
+ (package
+ (name "pesign")
+ (version "116")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/rhboot/pesign")
+ (commit version)))
+ (snippet #~(substitute* "Make.defaults"
+ (("pkg-config-ccldflags") "pkg-config-ldflags")))
+ (modules '((guix build utils)))
+ (sha256
+ (base32
+ "0fnqfiivj46bha4hsnwiqy8vq8b4i3w2dig0h9h2k4j7yq7r5qvj"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list #:tests? #f
+ #:modules '((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 match))
+ #:phases #~(modify-phases %standard-phases (delete 'configure))
+ #:make-flags
+ (let ((system (%current-system)) (target (%current-target-system)))
+ (define (arch s) (match (string-split s #\-)
+ (("i386" _ ...) "ia32")
+ (("i486" _ ...) "ia32")
+ (("i586" _ ...) "ia32")
+ (("i686" _ ...) "ia32")
+ ((x _ ...) x)))
+ #~(list "prefix=/" "libdir=/lib/"
+ (string-append "DESTDIR=" #$output)
+ (string-append "HOSTARCH=" #$(arch system))
+ (string-append "ARCH=" #$(arch (or target system)))
+ (string-append "CROSS_COMPILE="
+ #$@(if target (list target "-gcc") '()))))))
+ (inputs (list efivar nspr nss popt `(,util-linux "lib")))
+ (native-inputs (list mandoc pkg-config))
+ (synopsis "PE-COFF binary signing tools")
+ (description "Supports EFI keygen and subsequent signing of PE-COFF
+binaries. Contains the tools authvar, efikeygen, pesigcheck, pesign,
+pesign-client, and pesum.")
+ (home-page "https://github.com/rhboot/pesign")
+ (license license:gpl2+)))
+
(define-public efitools
(package
(name "efitools")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 10/15] gnu: packages: Add systemd-stub.
(address . 72457@debbugs.gnu.org)
101a8d7e648c767fffec3c9d00849847dcaaf206.1722803521.git.lilah@lunabee.space
* gnu/bootloader.scm (%efi-supported-systems, lazy-efibootmgr): New variable.
(install-efi): Use lazy-efibootmgr.
* gnu/packages/bootloaders.scm (systemd-stub): New variable.

Change-Id: I974bad9ff7a52f736286d05de53f7c5ccb60b9d6
---
gnu/bootloader.scm | 13 +++++++++--
gnu/packages/bootloaders.scm | 43 ++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 2 deletions(-)

Toggle diff (120 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index f855671e82..6d1ecd9f00 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -28,7 +28,6 @@ (define-module (gnu bootloader)
#:autoload (gnu build file-systems)
(read-partition-label read-partition-uuid
find-partition-by-label find-partition-by-uuid)
- #:use-module (gnu packages linux)
#:use-module (gnu system file-systems)
#:use-module (gnu system uuid)
#:autoload (guix build syscalls)
@@ -115,6 +114,7 @@ (define-module (gnu bootloader)
bootloader-configuration->gexp
bootloader-configurations->gexp
+ %efi-supported-systems
efi-arch
install-efi))
@@ -647,6 +647,11 @@ (define (bootloader-configurations->gexp bootloader-configs . rest)
;;; EFI shit
;;;
+;; systems currently supported by efi-arch. should be used for packages relying
+;; on it.
+(define %efi-supported-systems
+ '("i686-linux" "x86_64-linux" "armhf-linux" "aarch64-linux" "riscv64-linux"))
+
(define* (efi-arch #:key (target (or (%current-target-system) (%current-system)))
(32? #f))
"Returns the UEFI architecture name for the current target, in lowercase."
@@ -658,6 +663,10 @@ (define* (efi-arch #:key (target (or (%current-target-system) (%current-system))
(else (raise (formatted-message (G_ "no UEFI standard arch for ~a!")
target)))))
+(define (lazy-efibootmgr)
+ "Lazy-loaded efibootmgr package, in order to prevent circular refs."
+ (module-ref (resolve-interface '(gnu packages linux)) 'efibootmgr))
+
(define (install-efi bootloader-config plan)
"Returns a gexp installing PLAN to the ESP, as denoted by the 'vendir target.
PLAN is a gexp of a list of '(BUILDER DEST-BASENAME . LABEL) triples, that
@@ -680,5 +689,5 @@ (define (install-efi bootloader-config plan)
;; normal install when not doing a removable config
(with-targets targets
(('vendir => (vendir :path) (loader :devpath) (disk :device))
- #~(install-efi #+(file-append efibootmgr "/sbin/efibootmgr")
+ #~(install-efi #+(file-append (lazy-efibootmgr) "/sbin/efibootmgr")
#$vendir #$loader #$disk #$plan))))))
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 04bb1b06f0..2bc04059d2 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -38,6 +38,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages bootloaders)
+ #:use-module (gnu bootloader)
#:use-module (gnu packages)
#:use-module (gnu packages assembly)
#:use-module (gnu packages base)
@@ -54,6 +55,7 @@ (define-module (gnu packages bootloaders)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gettext)
+ #:use-module (gnu packages gperf)
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages man)
@@ -592,6 +594,47 @@ (define systemd-source
(base32
"1qdyw9g3jgvsbc1aryr11gpc3075w5pg00mqv4pyf3hwixxkwaq6"))))
+(define-public systemd-stub
+ (package
+ (name "systemd-stub")
+ (version systemd-version)
+ (source systemd-source)
+ (build-system meson-build-system)
+ (arguments
+ (list #:configure-flags
+ #~(list "-Dmode=release" "-Defi=true" "-Dsbat-distro=guix"
+ "-Dsbat-distro-generation=1" ; package revision!
+ "-Dsbat-distro-summary=Guix System"
+ "-Dsbat-distro-url=https://guix.gnu.org"
+ #$(string-append "-Dsbat-distro-pkgname="
+ (package-name this-package))
+ #$(string-append "-Dsbat-distro-version="
+ (package-version this-package)))
+ #:phases
+ ;; TODO: 32bit support
+ (let* ((stub (string-append
+ "src/boot/efi/linux" (efi-arch) ".efi.stub")))
+ #~(modify-phases %standard-phases
+ (replace 'build
+ (lambda* (#:key parallel-build? #:allow-other-keys)
+ (invoke "ninja" #$stub
+ "-j" (if parallel-build?
+ (number->string (parallel-job-count)) "1"))))
+ (replace 'install
+ (lambda _
+ (let ((libexec (string-append #$output "/libexec")))
+ (install-file #$stub libexec))))
+ (delete 'check)))))
+ (supported-systems %efi-supported-systems)
+ (inputs (list libcap python-pyelftools `(,util-linux "lib")))
+ (native-inputs (list gperf pkg-config python-3 python-jinja2))
+ (home-page "https://systemd.io/")
+ (synopsis "Unified kernel image UEFI stub")
+ (description "Simple UEFI boot stub that loads a conjoined kernel image and
+supporting data to their proper locations, before chainloading to the kernel.
+Supports measured and/or verified boot environments.")
+ (license license:lgpl2.1+)))
+
(define-public ukify
(package
(name "ukify")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 09/15] gnu: packages: Add ukify.
(address . 72457@debbugs.gnu.org)
e426cd53523d947890ac32ba1ae9fe9724964764.1722803521.git.lilah@lunabee.space
* gnu/packages/bootloaders.scm
(systemd-version,systemd-source,ukify): New variables.

Change-Id: Icde59b7266529c8002331ff0375e0a35af3a2add
---
gnu/packages/bootloaders.scm | 54 ++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)

Toggle diff (93 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index e78602379d..04bb1b06f0 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -20,6 +20,7 @@
;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2023 Herman Rimm <herman@rimm.ee>
;;; Copyright © 2024 Zheng Junjie <873216071@qq.com>
+;;; Copyright © 2024 Lilah Tascheter <lilah@lunabee.space>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -47,6 +48,7 @@ (define-module (gnu packages bootloaders)
#:use-module (gnu packages compression)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages disk)
+ #:use-module (gnu packages efi)
#:use-module (gnu packages firmware)
#:use-module (gnu packages flex)
#:use-module (gnu packages fontutils)
@@ -73,11 +75,13 @@ (define-module (gnu packages bootloaders)
#:use-module (gnu packages valgrind)
#:use-module (gnu packages virtualization)
#:use-module (gnu packages xorg)
+ #:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (guix build-system gnu)
#:use-module (guix build-system meson)
#:use-module (guix build-system pyproject)
+ #:use-module (guix build-system python)
#:use-module (guix build-system trivial)
#:use-module (guix download)
#:use-module (guix gexp)
@@ -573,6 +577,56 @@ (define-public syslinux
;; Also contains:
license:expat license:isc license:zlib)))))
+(define systemd-version "255")
+(define systemd-source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/systemd/systemd")
+ (commit (string-append "v" systemd-version))))
+ (file-name (git-file-name "systemd" systemd-version))
+ (snippet #~(substitute* "src/ukify/ukify.py" ; remove after python 3.11
+ (("datetime\\.UTC") "datetime.timezone.utc")))
+ (modules '((guix build utils)))
+ (sha256
+ (base32
+ "1qdyw9g3jgvsbc1aryr11gpc3075w5pg00mqv4pyf3hwixxkwaq6"))))
+
+(define-public ukify
+ (package
+ (name "ukify")
+ (version systemd-version)
+ (source systemd-source)
+ (build-system python-build-system)
+ (arguments
+ (list #:phases
+ #~(modify-phases %standard-phases
+ (replace 'build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (define (get-tool tool)
+ (search-input-file inputs (string-append "bin/" tool)))
+
+ (substitute* "src/ukify/ukify.py" ; hardcode tool paths
+ (("(find_tool\\(')(readelf|sbsign|pesign)'," _ ctx tool)
+ (string-append ctx (get-tool tool) "',"))
+ (("('name': ')(sbverify|pesign)'," _ ctx tool)
+ (string-append ctx (get-tool tool) "',")))))
+ (delete 'check)
+ (replace 'install
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((bin (string-append #$output "/bin"))
+ (file (string-append bin "/ukify")))
+ (mkdir-p bin)
+ (copy-file "src/ukify/ukify.py" file)))))))
+ (inputs
+ (list binutils pesign python-cryptography python-pefile sbsigntools))
+ (home-page "https://systemd.io/")
+ (synopsis "Unified kernel image UEFI tool")
+ (description "@command{ukify} joins together a UKI stub, linux kernel, initrd,
+kernel arguments, and optional secure boot signatures into a single, UEFI-bootable
+image.")
+ (license license:lgpl2.1+)))
+
(define-public dtc
(package
(name "dtc")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 11/15] gnu: bootloaders: Add uki-efi-bootloader.
(address . 72457@debbugs.gnu.org)
4c3fcd5b3a2b5c5d5ff2dd74f79492dfaac370f2.1722803521.git.lilah@lunabee.space
* gnu/bootloader.scm (<bootloader-configuration>): New keypair field.
* gnu/bootloader/uki.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add bootloader/uki.scm.

Change-Id: I2097da9f3dd35137b3419f6d0545de26d53cb6da
---
gnu/bootloader.scm | 3 ++
gnu/bootloader/uki.scm | 96 ++++++++++++++++++++++++++++++++++++++++++
gnu/local.mk | 1 +
3 files changed, 100 insertions(+)
create mode 100644 gnu/bootloader/uki.scm

Toggle diff (137 lines)
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 6d1ecd9f00..b8116339ab 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -101,6 +101,7 @@ (define-module (gnu bootloader)
bootloader-configuration-default-entry
bootloader-configuration-efi-removable?
bootloader-configuration-32bit?
+ bootloader-configuration-keypair
bootloader-configuration-timeout
bootloader-configuration-keyboard-layout
bootloader-configuration-theme
@@ -524,6 +525,8 @@ (define-record-type* <bootloader-configuration>
(default #f)) ;bool
(32bit? bootloader-configuration-32bit?
(default #f)) ;bool
+ (keypair bootloader-configuration-keypair
+ (default #f)) ;(cert . priv) pair
(timeout bootloader-configuration-timeout
(default 5)) ;seconds as integer
(keyboard-layout bootloader-configuration-keyboard-layout
diff --git a/gnu/bootloader/uki.scm b/gnu/bootloader/uki.scm
new file mode 100644
index 0000000000..4871dbe037
--- /dev/null
+++ b/gnu/bootloader/uki.scm
@@ -0,0 +1,96 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2024 Lilah Tascheter <lilah@lunabee.space>
+;;;
+;;; 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 uki)
+ #:use-module (gnu bootloader)
+ #:use-module (gnu packages bootloaders)
+ #:use-module (gnu packages efi)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu system boot)
+ #:use-module (guix gexp)
+ #:use-module (guix diagnostics)
+ #:use-module (guix i18n)
+ #:use-module (guix records)
+ #:export (uki-efi-bootloader))
+
+;; TODO: support 32bit/mixed-mode UEFI.
+;; https://github.com/systemd/systemd/issues/17056 may be relevant
+(define bootcfg->menu-entry->builder
+ (match-record-lambda <bootloader-configuration> (32bit? theme keypair)
+ (match-record-lambda <menu-entry>
+ (label linux linux-arguments initrd chain-loader)
+ ;; support chainloader in order to allow arbitrary signed EFI binaries
+ (cond
+ ((and chain-loader keypair)
+ #~(lambda (dest)
+ (invoke/quiet #+(sbsigntools "/bin/sbsign")
+ "--cert" #$(car keypair) "--key" #$(cdr keypair)
+ "--output" dest #$chain-loader)
+ (invoke/quiet #+(sbsigntools "/bin/sbverify")
+ "--cert" #$(car keypair) dest)))
+ (chain-loader #~(lambda (dest) (copy-file #$chain-loader dest)))
+ (linux
+ (let* ((arch (efi-arch #:32? 32bit?))
+ (stub (file-append systemd-stub
+ "/libexec/linux" arch ".efi.stub")))
+ #~(lambda (dest)
+ (invoke/quiet #+(file-append ukify "/bin/ukify")
+ "build" "--output" dest
+ "--linux" #$linux "--initrd" #$initrd
+ "--cmdline" (string-join (list #$@linux-arguments))
+ "--os-release" #$label "--stub" #$stub "--efi-arch" #$arch
+ #$@(if theme #~("--splash" #$theme) '())
+ #$@(if keypair #~("--secureboot-certificate" #$(car keypair)
+ "--secureboot-private-key" #$(cdr keypair))
+ '())))))
+ (else (leave (G_ "uki-efi-bootloader doesn't support multiboot")))))))
+
+;; we cannot use guix's build system to make UKI images for two reasons:
+;; 1. signing is necessarily non-reproducable, especially since keys should not
+;; be in the store, or else risk being publically accessible.
+;; 2. menu-entries may reference files which do not exist in the store.
+(define* (install-uki #:key bootloader-config
+ current-boot-alternative
+ old-boot-alternatives
+ #:allow-other-keys)
+ (define* (menu-entry->plan entry num #:optional (prefix "menu-entry"))
+ #~(cons* #$((bootcfg->menu-entry->builder bootloader-config) entry)
+ #$(string-append prefix "-" (number->string num) ".efi")
+ #$(menu-entry-label entry)))
+
+ (define (boot-alternative->plan alt)
+ (menu-entry->plan (boot-alternative->menu-entry alt)
+ (boot-alternative-generation alt)
+ "generation"))
+
+ (install-efi bootloader-config
+ (let ((entries (bootloader-configuration-menu-entries bootloader-config)))
+ #~(list #$(boot-alternative->plan current-boot-alternative)
+ #$@(map menu-entry->plan entries (iota (length entries)))
+ #$@(map boot-alternative->plan old-boot-alternatives)))))
+
+
+
+(define uki-efi-bootloader
+ (bootloader
+ (name 'uki-efi)
+ (default-targets (list (bootloader-target
+ (type 'vendir)
+ (offset 'esp)
+ (path "EFI/Guix"))))
+ (installer install-uki)))
diff --git a/gnu/local.mk b/gnu/local.mk
index 8375e13709..32ed753ee2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -93,6 +93,7 @@ GNU_SYSTEM_MODULES = \
%D%/bootloader/extlinux.scm \
%D%/bootloader/u-boot.scm \
%D%/bootloader/depthcharge.scm \
+ %D%/bootloader/uki.scm \
%D%/ci.scm \
%D%/compression.scm \
%D%/home.scm \
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 12/15] gnu: system: Update examples.
(address . 72457@debbugs.gnu.org)
362227a8be0534e3fcb6f6e0822105e40668dac7.1722803521.git.lilah@lunabee.space
* gnu/system/examples/asus-c201.tmpl (bootloader): Use new depthcharge
bootloader name scheme and update to new target system.

* gnu/system/examples/bare-bones.tmpl (bootloader),
gnu/system/examples/bare-hurd.tmpl (bootloader),
gnu/system/examples/beaglebone-black.tmpl (bootloader),
gnu/system/examples/desktop.tmpl (bootloader),
gnu/system/examples/lightweight-desktop.tmpl (bootloader),
gnu/system/examples/plasma.tmpl (bootloader),
gnu/system/examples/raspberry-pi-64-nfs-root.tmpl (bootloader),
gnu/system/examples/raspberry-pi-64.tmpl (bootloader): Use new target system.

* gnu/system/examples/docker-image.tmpl (bootloader): Delete.

* gnu/system/examples/vm-image.tmpl (bootloader): Use auto image target.

Change-Id: I3675f17ae9cd94cff99328762600fb4e491bc9f2
---
gnu/system/examples/asus-c201.tmpl | 6 +++--
gnu/system/examples/bare-bones.tmpl | 7 ++++--
gnu/system/examples/bare-hurd.tmpl | 4 +++-
gnu/system/examples/beaglebone-black.tmpl | 6 +++--
gnu/system/examples/desktop.tmpl | 4 +++-
gnu/system/examples/docker-image.tmpl | 6 ++---
gnu/system/examples/lightweight-desktop.tmpl | 4 +++-
gnu/system/examples/plasma.tmpl | 4 +++-
.../examples/raspberry-pi-64-nfs-root.tmpl | 23 ++++++++++++-------
gnu/system/examples/raspberry-pi-64.tmpl | 18 ++++++++-------
gnu/system/examples/vm-image.tmpl | 5 ++--
11 files changed, 54 insertions(+), 33 deletions(-)

Toggle diff (224 lines)
diff --git a/gnu/system/examples/asus-c201.tmpl b/gnu/system/examples/asus-c201.tmpl
index 019111c167..eec185eebf 100644
--- a/gnu/system/examples/asus-c201.tmpl
+++ b/gnu/system/examples/asus-c201.tmpl
@@ -14,8 +14,10 @@
;; Assuming /dev/mmcblk0p1 is the kernel partition, and
;; "my-root" is the label of the target root file system.
(bootloader (bootloader-configuration
- (bootloader depthcharge-bootloader)
- (targets '("/dev/mmcblk0p1"))))
+ (bootloader depthcharge-veyron-speedy-bootloader)
+ (targets (list (bootloader-target
+ (type 'part)
+ (device "/dev/mmcblk0p1"))))))
;; The ASUS C201PA requires a very particular kernel to boot,
;; as well as the following arguments.
diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare-bones.tmpl
index 7b6a4b09b0..9eed05f2e0 100644
--- a/gnu/system/examples/bare-bones.tmpl
+++ b/gnu/system/examples/bare-bones.tmpl
@@ -13,10 +13,13 @@
;; Boot in "legacy" BIOS mode, assuming /dev/sdX is the
;; target hard disk, and "my-root" is the label of the target
- ;; root file system.
+ ;; root file system. If you're just building an image, the
+ ;; 'targets' field may be omitted.
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
;; It's fitting to support the equally bare bones ‘-nographic’
;; QEMU option, which also nicely sidesteps forcing QWERTY.
(kernel-arguments (list "console=ttyS0,115200"))
diff --git a/gnu/system/examples/bare-hurd.tmpl b/gnu/system/examples/bare-hurd.tmpl
index 463c7ee798..8dd700cd9d 100644
--- a/gnu/system/examples/bare-hurd.tmpl
+++ b/gnu/system/examples/bare-hurd.tmpl
@@ -32,7 +32,9 @@
(inherit %hurd-default-operating-system)
(bootloader (bootloader-configuration
(bootloader grub-minimal-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/system/examples/beaglebone-black.tmpl b/gnu/system/examples/beaglebone-black.tmpl
index 18bbb2723c..99963ef2fe 100644
--- a/gnu/system/examples/beaglebone-black.tmpl
+++ b/gnu/system/examples/beaglebone-black.tmpl
@@ -11,11 +11,13 @@
(timezone "Europe/Berlin")
(locale "en_US.utf8")
- ;; Assuming /dev/mmcblk1 is the eMMC, and "my-root" is
+ ;; Assuming /dev/mmcblk1 is the eMMC. and "my-root" is
;; the label of the target root file system.
(bootloader (bootloader-configuration
(bootloader u-boot-beaglebone-black-bootloader)
- (targets '("/dev/mmcblk1"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/mmcblk1"))))))
;; This module is required to mount the SD card.
(initrd-modules (cons "omap_hsmmc" %base-initrd-modules))
diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl
index 2d65f22294..30dbdeea31 100644
--- a/gnu/system/examples/desktop.tmpl
+++ b/gnu/system/examples/desktop.tmpl
@@ -20,7 +20,9 @@
;; Partition mounted on /boot/efi.
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))
(keyboard-layout keyboard-layout)))
;; Specify a mapped device for the encrypted root partition.
diff --git a/gnu/system/examples/docker-image.tmpl b/gnu/system/examples/docker-image.tmpl
index 7123917af4..6d3114a0bc 100644
--- a/gnu/system/examples/docker-image.tmpl
+++ b/gnu/system/examples/docker-image.tmpl
@@ -9,6 +9,8 @@
(timezone "Europe/Berlin")
(locale "en_US.utf8")
+ ;; Bootloader can be left blank!
+
;; This is where user accounts are specified. The "root" account is
;; implicit, and is initially created with the empty password.
(users (cons (user-account
@@ -34,10 +36,6 @@
;; similar services for us.
;; This will be ignored.
- (bootloader (bootloader-configuration
- (bootloader grub-bootloader)
- (targets '("does-not-matter"))))
- ;; This will be ignored, too.
(file-systems (list (file-system
(device "does-not-matter")
(mount-point "/")
diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl
index c061284ba8..0964238cb0 100644
--- a/gnu/system/examples/lightweight-desktop.tmpl
+++ b/gnu/system/examples/lightweight-desktop.tmpl
@@ -17,7 +17,9 @@
;; Partition mounted on /boot/efi.
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))))
;; Assume the target root file system is labelled "my-root",
;; and the EFI System Partition has UUID 1234-ABCD.
diff --git a/gnu/system/examples/plasma.tmpl b/gnu/system/examples/plasma.tmpl
index c3850ffe37..a81916ffe9 100644
--- a/gnu/system/examples/plasma.tmpl
+++ b/gnu/system/examples/plasma.tmpl
@@ -15,7 +15,9 @@
;; is the label of the target root file system.
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device "my-root")
diff --git a/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl b/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl
index 1baca02491..85476854f3 100644
--- a/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl
+++ b/gnu/system/examples/raspberry-pi-64-nfs-root.tmpl
@@ -25,14 +25,21 @@
(operating-system
(host-name "raspberrypi-guix")
(timezone "Europe/Berlin")
- (bootloader (bootloader-configuration
- (bootloader grub-efi-bootloader-chain-raspi-64)
- (targets (list "/boot/efi"))
- (theme (grub-theme
- (resolution '(1920 . 1080))
- (image (file-append
- %artwork-repository
- "/grub/GuixSD-fully-black-16-9.svg"))))))
+ (bootloader (list (bootloader-configuration
+ (bootloader u-boot-rpi-bootloader)
+ (targets (list (bootloader-target
+ (type 'install)
+ (path "/boot/efi")))))
+ (bootloader-configuration
+ (bootloader grub-efi-bootloader)
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))
+ (theme
+ (grub-theme
+ (resolution '(1920 . 1080))
+ (image (file-append %artwork-repository
+ "/grub/GuixSD-fully-black-16-9.svg")))))))
(kernel-arguments '("ip=dhcp"))
(kernel (customize-linux #:linux linux-libre-arm64-generic
#:extra-version "arm64-generic-netboot"
diff --git a/gnu/system/examples/raspberry-pi-64.tmpl b/gnu/system/examples/raspberry-pi-64.tmpl
index 414d8ac7a5..d5b90b9705 100644
--- a/gnu/system/examples/raspberry-pi-64.tmpl
+++ b/gnu/system/examples/raspberry-pi-64.tmpl
@@ -24,14 +24,16 @@
(operating-system
(host-name "raspberrypi-guix")
(timezone "Europe/Berlin")
- (bootloader (bootloader-configuration
- (bootloader grub-efi-bootloader-chain-raspi-64)
- (targets (list "/boot/efi"))
- (theme (grub-theme
- (resolution '(1920 . 1080))
- (image (file-append
- %artwork-repository
- "/grub/GuixSD-fully-black-16-9.svg"))))))
+ (bootloader (list (bootloader-configuration
+ (bootloader u-boot-rpi-bootloader)
+ (targets (list (bootloader-target
+ (type 'install)
+ (path "/boot/efi"))))
+ (theme
+ (grub-theme
+ (resolution '(1920 . 1080))
+ (image (file-append %artwork-repository
+ "/grub/GuixSD-fully-black-16-9.svg")))))))
(kernel (customize-linux #:linux linux-libre-arm64-generic
;; It is possible to use a specific defconfig
;; file, for example the "bcmrpi3_defconfig" with
diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl
index 589de493b1..050c0bb971 100644
--- a/gnu/system/examples/vm-image.tmpl
+++ b/gnu/system/examples/vm-image.tmpl
@@ -38,11 +38,10 @@ accounts.\x1b[0m
(firmware '())
- ;; Below we assume /dev/vda is the VM's hard disk.
- ;; Adjust as needed.
+ ;; Images automatically get the 'root, 'esp, and 'disk targets configured as
+ ;; needed.
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vda"))
(terminal-outputs '(console))))
(file-systems (cons (file-system
(mount-point "/")
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:32 +0200
[PATCH v3 14/15] gnu: tests: Update tests to new targets system.
(address . 72457@debbugs.gnu.org)
218462fbf87a6a3e7cd33abcea02c1a31e83e8bd.1722803521.git.lilah@lunabee.space
* gnu/services/virtualization.scm
(%virtual-build-machine-operating-system): Remove bootloader.
(%hurd-vm-operating-system): Remove targets.

* gnu/system/hurd.scm (%hurd-default-operating-system): Remove targets.

* gnu/tests.scm (%simple-os), gnu/tests/ganeti.scm (%ganeti-os),
gnu/tests/image.scm (%simple-efi-os),
gnu/tests/install.scm (%minimal-os, %minimal-extlinux-os,
%minimal-os-on-vda, %separate-home-os, %separate-store-os, %raid-root-os,
%encrypted-root-os, %lvm-separate-home-os, %encrypted-home-os,
%encrypted-home-os-key-file, %encrypted-root-not-boot-os,
%btrfs-root-os-source, %btrfs-raid-root-os-source,
%btrfs-root-on-subvolume-os, %btrfs-raid10-root-os, %jfs-root-os,
%f2fs-root-os, %xfs-root-os), gnu/tests/nfs.scm (%base-os),
gnu/tests/telephony.scm (make-jami-os), gnu/tests/vnc.scm (%xvnc-os):
Update bootloader targets.

Change-Id: I3d66a839a9b2a73b8b65946950728b1e0155ca1e
---
gnu/services/virtualization.scm | 11 ++---
gnu/system/hurd.scm | 4 +-
gnu/tests.scm | 4 +-
gnu/tests/ganeti.scm | 4 +-
gnu/tests/image.scm | 4 +-
gnu/tests/install.scm | 72 ++++++++++++++++++++++++---------
gnu/tests/nfs.scm | 4 +-
gnu/tests/telephony.scm | 4 +-
gnu/tests/vnc.scm | 4 +-
tests/boot-parameters.scm | 2 +-
10 files changed, 77 insertions(+), 36 deletions(-)

Toggle diff (357 lines)
diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm
index d87e494348..f698532a94 100644
--- a/gnu/services/virtualization.scm
+++ b/gnu/services/virtualization.scm
@@ -1191,17 +1191,13 @@ (define %minimal-vm-syslog-config
(define %virtual-build-machine-operating-system
(operating-system
(host-name "build-machine")
-
(locale "en_US.utf8")
(locale-definitions
;; Save space by providing only one locale.
(list (locale-definition (name "en_US.utf8")
(source "en_US")
(charset "UTF-8"))))
-
- (bootloader (bootloader-configuration ;unused
- (bootloader grub-minimal-bootloader)
- (targets '("/dev/null"))))
+ ;; no bootloader
(file-systems (cons (file-system ;unused
(mount-point "/")
(device "none")
@@ -1624,9 +1620,8 @@ (define %hurd-vm-operating-system
(host-name "childhurd")
(timezone "Europe/Amsterdam")
(bootloader (bootloader-configuration
- (bootloader grub-minimal-bootloader)
- (targets '("/dev/vda"))
- (timeout 0)))
+ (bootloader grub-minimal-bootloader)
+ (timeout 0)))
(packages (cons* gdb-minimal
(operating-system-packages
%hurd-default-operating-system)))
diff --git a/gnu/system/hurd.scm b/gnu/system/hurd.scm
index cbe0081382..af04e82485 100644
--- a/gnu/system/hurd.scm
+++ b/gnu/system/hurd.scm
@@ -119,9 +119,7 @@ (define %hurd-default-operating-system
(kernel %hurd-default-operating-system-kernel)
(kernel-arguments '())
(hurd hurd)
- (bootloader (bootloader-configuration
- (bootloader grub-minimal-bootloader)
- (targets '("/dev/vda"))))
+ (bootloader (bootloader-configuration (bootloader grub-minimal-bootloader)))
(initrd #f)
(initrd-modules '())
(firmware '())
diff --git a/gnu/tests.scm b/gnu/tests.scm
index 5ff9db82fc..f46ccf5174 100644
--- a/gnu/tests.scm
+++ b/gnu/tests.scm
@@ -237,7 +237,9 @@ (define %simple-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device"/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/tests/ganeti.scm b/gnu/tests/ganeti.scm
index 29eb354044..789879b26f 100644
--- a/gnu/tests/ganeti.scm
+++ b/gnu/tests/ganeti.scm
@@ -40,7 +40,9 @@ (define %ganeti-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vda"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vda"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/tests/image.scm b/gnu/tests/image.scm
index be6852cae0..8d960cf7b8 100644
--- a/gnu/tests/image.scm
+++ b/gnu/tests/image.scm
@@ -55,7 +55,9 @@ (define %simple-efi-os
(inherit %simple-os)
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))))))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))))))
;; An MBR disk image with a single ext4 partition.
(define i1
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 18a2fc119b..d67a71f12e 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -103,7 +103,9 @@ (define-os-with-source (%minimal-os %minimal-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -141,7 +143,9 @@ (define-os-with-source (%minimal-extlinux-os
(bootloader (bootloader-configuration
(bootloader extlinux-gpt-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -434,7 +438,9 @@ (define-os-with-source (%minimal-os-on-vda %minimal-os-on-vda-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vda"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vda"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -510,7 +516,9 @@ (define-os-with-source (%separate-home-os %separate-home-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
(device (file-system-label "my-root"))
@@ -565,7 +573,9 @@ (define-os-with-source (%separate-store-os %separate-store-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
(device (file-system-label "root-fs"))
@@ -642,7 +652,9 @@ (define-os-with-source (%raid-root-os %raid-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
;; Add a kernel module for RAID-1 (aka. "mirror").
@@ -725,7 +737,9 @@ (define-os-with-source (%encrypted-root-os %encrypted-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
;; Note: Do not pass "console=ttyS0" so we can use our passphrase prompt
;; detection logic in 'enter-luks-passphrase'.
@@ -858,7 +872,9 @@ (define-os-with-source (%lvm-separate-home-os %lvm-separate-home-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(mapped-devices (list (mapped-device
@@ -943,7 +959,9 @@ (define-os-with-source (%encrypted-home-os %encrypted-home-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
;; Note: Do not pass "console=ttyS0" so we can use our passphrase prompt
;; detection logic in 'enter-luks-passphrase'.
@@ -1070,7 +1088,9 @@ (define-os-with-source (%encrypted-home-os-key-file
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))
(extra-initrd "/key-file.cpio")))
(kernel-arguments '("console=ttyS0"))
@@ -1130,7 +1150,9 @@ (define-os-with-source (%encrypted-root-not-boot-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(mapped-devices (list (mapped-device
(source
@@ -1232,7 +1254,9 @@ (define-os-with-source (%btrfs-root-os %btrfs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -1306,7 +1330,9 @@ (define-os-with-source (%btrfs-raid-root-os %btrfs-raid-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
@@ -1374,7 +1400,9 @@ (define-os-with-source (%btrfs-root-on-subvolume-os
(locale "en_US.UTF-8")
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
(device (file-system-label "btrfs-pool"))
@@ -1467,7 +1495,9 @@ (define-os-with-source (%btrfs-raid10-root-os
(bootloader (map (lambda (targ)
(bootloader-configuration
(bootloader grub-bootloader)
- (targets (list targ))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device targ))))))
'("/dev/vdb" "/dev/vdc" "/dev/vdd" "/dev/vde")))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons* (file-system
@@ -1577,7 +1607,9 @@ (define-os-with-source (%jfs-root-os %jfs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -1650,7 +1682,9 @@ (define-os-with-source (%f2fs-root-os %f2fs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
@@ -1723,7 +1757,9 @@ (define-os-with-source (%xfs-root-os %xfs-root-os-source)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets (list "/dev/vdb"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/vdb"))))))
(kernel-arguments '("console=ttyS0"))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm
index 0d9972e0e9..2f97126df7 100644
--- a/gnu/tests/nfs.scm
+++ b/gnu/tests/nfs.scm
@@ -51,7 +51,9 @@ (define %base-os
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems %base-file-systems)
(users %base-user-accounts)
(packages (cons*
diff --git a/gnu/tests/telephony.scm b/gnu/tests/telephony.scm
index f03ea963f7..ee858d9c91 100644
--- a/gnu/tests/telephony.scm
+++ b/gnu/tests/telephony.scm
@@ -90,7 +90,9 @@ (define* (make-jami-os #:key provisioning? partial?)
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/gnu/tests/vnc.scm b/gnu/tests/vnc.scm
index ab1c2749f3..cba9c565e0 100644
--- a/gnu/tests/vnc.scm
+++ b/gnu/tests/vnc.scm
@@ -51,7 +51,9 @@ (define %xvnc-os
(locale "en_US.UTF-8")
(bootloader (bootloader-configuration
(bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
+ (targets (list (bootloader-target
+ (type 'disk)
+ (device "/dev/sdX"))))))
(file-systems (cons (file-system
(device (file-system-label "my-root"))
(mount-point "/")
diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm
index f214de360d..f343dbdfdb 100644
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -63,7 +63,7 @@ (define %root-path "/")
(define %grub-boot-parameters
(boot-parameters
- (bootloader-name 'grub)
+ (bootloader-name '(grub))
(root-device %default-root-device)
(label %default-label)
(kernel %default-kernel)
--
2.45.2
L
L
Lilah Tascheter wrote on 4 Aug 22:31 +0200
[PATCH v3 13/15] doc: Update bootloader documentation.
(address . 72457@debbugs.gnu.org)
ae5ad3a305d78d795540e5e2d0441d2fa039355d.1722803521.git.lilah@lunabee.space
* doc/guix.texi
(Manual Installation)[Proceeding with the Installation]: Offload
target reference.

(System Installation)[Building the Installation Image]: Use beaglebone
as the example, and don't reference deleted variables.

(System Configuration)[Using the Configuration System]: Update
example.
[operating-system Reference]<bootloader>: Can use multiple
bootloaders.
[Keyboard Layout]: Update example.
[Bootloader Configuration]<bootloader>: Update documentation for all
bootloaders, and add new ones. Document new fields efi-removable?,
32bit?, and keypair. Update terminal-outputs and terminal-outputs to
not be GRUB-specific.
<bootloader-target>: New record.
<menu-entry>: Remove now-unsupported GRUB specifics in linux. Move
device documentation and add some for device-mount-point and
device-subvol. Fix typo in multiboot-arguments. Document chain-loader
for arbitrary bootloaders.
[Invoking guix system]<switch-generation>: Bootloaders are now
reinstalled.
<image> Other bootloaders may be used.
[Invoking guix deploy]: Update template.

(Creating System Images)[image Reference]<partition Reference>: Add
target field.
[Instantiate an Image]: Update examples and update formatting.
<efi32-disk-image, efi32-raw-image-type>: Delete.
[image-type Reference]<pinebook-pro-image-type, rock64-image-type>:
Reword slightly.

Change-Id: I45ac9d5ad3cb491c693e9a4b2f0b44b527478ee7
---
doc/guix.texi | 458 +++++++++++++++++++++++++++++---------------------
1 file changed, 262 insertions(+), 196 deletions(-)

Toggle diff (371 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 41814042f5..b5f35a9066 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -2516,12 +2516,9 @@ Proceeding with the Installation
Make sure the @code{bootloader-configuration} form refers to the targets
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{targets} field contain the names of the devices, like
-@code{(list "/dev/sda")}; for UEFI systems it names the paths to mounted
-EFI partitions, like @code{(list "/boot/efi")}; do make sure the paths
-are currently mounted and a @code{file-system} entry is specified in
-your configuration.
+@code{grub-efi-bootloader} for newer UEFI systems.
+@xref{Bootloader Configuration} for information on how to format the
+@code{targets} field.
@item
Be sure that your file system labels match the value of their respective
@@ -2653,11 +2650,13 @@ Building the Installation Image
includes the bootloader, specifically:
@example
-guix system image --system=armhf-linux -e '((@@ (gnu system install) os-with-u-boot) (@@ (gnu system install) installation-os) "A20-OLinuXino-Lime2")'
+guix system image --system=armhf-linux -e '(@ (gnu system install) beaglebone-black-installation-os)'
@end example
-@code{A20-OLinuXino-Lime2} is the name of the board. If you specify an invalid
-board, a list of possible boards will be printed.
+@code{beaglebone-black} is the name of the board. Similar
+@code{installation-os} variables exist for most other supported boards.
+Otherwise, you can use @code{embedded-installation-os}, passing it a u-boot
+bootloader and the desired console tty.
@c *********************************************************************
@@ -17229,7 +17228,9 @@ Using the Configuration System
@lisp
(bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi")))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi")))))
@end lisp
@xref{Bootloader Configuration}, for more information on the available
@@ -17535,8 +17536,10 @@ operating-system Reference
List of strings or gexps representing additional arguments to pass on
the command-line of the kernel---e.g., @code{("console=ttyS0")}.
-@item @code{bootloader}
-The system bootloader configuration object. @xref{Bootloader Configuration}.
+@item @code{bootloader} (default: '())
+The system bootloader configuration object. Can either be a single
+@code{bootloader-configuration} or a list of them, to install multiple or no
+bootloaders. @xref{Bootloader Configuration}.
@item @code{label}
This is the label (a string) as it appears in the bootloader's menu entry.
@@ -18731,7 +18734,9 @@ Keyboard Layout
(keyboard-layout (keyboard-layout "tr")) ;for the console
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
- (targets '("/boot/efi"))
+ (targets (list (bootloader-target
+ (type 'esp)
+ (path "/boot/efi"))))
(keyboard-layout keyboard-layout))) ;for GRUB
(services (cons (set-xorg-configuration
(xorg-configuration ;for Xorg
@@ -42119,132 +42124,124 @@ Bootloader Configuration
@cindex EFI, bootloader
@cindex UEFI, bootloader
@cindex BIOS, bootloader
-The bootloader to use, as a @code{bootloader} object. For now
-@code{grub-bootloader}, @code{grub-efi-bootloader},
-@code{grub-efi-removable-bootloader}, @code{grub-efi-netboot-bootloader},
-@code{grub-efi-netboot-removable-bootloader}, @code{extlinux-bootloader}
-and @code{u-boot-bootloader} are supported.
+The bootloader to use, as a @code{bootloader} object. Available bootloaders, in
+addition to what target types they require, are as follows:
-@cindex ARM, bootloaders
-@cindex AArch64, bootloaders
-Available bootloaders are described in @code{(gnu bootloader @dots{})}
-modules. In particular, @code{(gnu bootloader u-boot)} contains definitions
-of bootloaders for a wide range of ARM and AArch64 systems, using the
-@uref{https://www.denx.de/wiki/U-Boot/, U-Boot bootloader}.
+@itemize
+@vindex depthcharge-veyron-speedy-bootloader
+@item @code{depthcharge-veyron-speedy-bootloader}
+For the Asus C201. Requires a @code{'part} target, denoting the partition to
+install the kernel blob as a @code{device}, @code{label}, or @code{uuid}.
@vindex grub-bootloader
-@code{grub-bootloader} allows you to boot in particular Intel-based machines
-in ``legacy'' BIOS mode.
+@item @code{grub-bootloader}
+GRUB2 for BIOS systems. Requires a @code{'disk} target providing either a
+@code{device}, @code{label}, or @code{uuid}. If root is mounted over NFS, it
+will load its files and the Guix System over
+@acronym{PXE, Preboot eXecution Environment}.
+
+@vindex grub-minimal-bootloader
+@item @code{grub-minimal-bootloader}
+As above, but using a minimal build of GRUB.
@vindex grub-efi-bootloader
-@code{grub-efi-bootloader} allows to boot on modern systems using the
-@dfn{Unified Extensible Firmware Interface} (UEFI). This is what you should
-use if the installation image contains a @file{/sys/firmware/efi} directory
-when you boot it on your system.
-
-@vindex grub-efi-removable-bootloader
-@code{grub-efi-removable-bootloader} allows you to boot your system from
-removable media by writing the GRUB file to the UEFI-specification location of
-@file{/EFI/BOOT/BOOTX64.efi} of the boot directory, usually @file{/boot/efi}.
-This is also useful for some UEFI firmwares that ``forget'' their configuration
-from their non-volatile storage. Like @code{grub-efi-bootloader}, this can only
-be used if the @file{/sys/firmware/efi} directory is available.
+@item @code{grub-efi-bootloader}
+GRUB2 for "modern" systems using the @dfn{Unified Extensible Firmware Interface}
+(UEFI). Requires an @code{'esp} target providing a @code{path} to the mount
+point of the EFI System Partition. If root is mounted over NFS, it will load
+its files and the Guix System over a
+@acronym{TFTP, Trivial File Transfer Protocol} server as configured over
+@acronym{DHCP, Dynamic Host Configuration Protocol} as per PXE.
+
+@vindex extlinux-bootloader
+@item @code{extlinux-bootloader}
+Extlinux for "legacy" BIOS systems. Requires a @code{'disk} target providing
+either a @code{device}, @code{label}, or @code{uuid}.
+
+@vindex extlinux-gpt-bootloader
+@item @code{extlinux-gpt-bootloader}
+As above, but for systems using the GPT instead of MBR partition table.
+
+@cindex Secure Boot, UEFI
+@vindex uki-efi-bootloader
+@item @code{uki-efi-bootloader}
+Makes and installs UKI images for UEFI systems. Requires an @code{'esp} target
+providing a @code{path} to the mount point of the EFI System Partition. Not all
+system generations may be available with this option, as UKI images contain the
+entire kernel and initramfs, and ESPs tend to be small.
+
+Full disk encryption with @code{uki-efi-bootloader} only requires a single
+password entry with fast decryption, in contrast to GRUB2 requiring a second
+password entry with slow, LUKS1-only decryption.
+
+This is the only bootloader to currently support UEFI secure boot, when
+configured as below.
-@quotation Note
-This @emph{will} overwrite the GRUB file from any other operating systems that
-also place their GRUB file in the UEFI-specification location; making them
-unbootable.
-@end quotation
+@cindex ARM, bootloaders
+@cindex AArch64, bootloaders
+@vindex u-boot-a20-olinuxino-lime-bootloader
+@vindex u-boot-a20-olinuxino-lime2-bootloader
+@vindex u-boot-a20-olinuxino-micro-bootloader
+@vindex u-boot-bananapi-m2-ultra-bootloader
+@vindex u-boot-beaglebone-black-bootloader
+@vindex u-boot-cubietruck-bootloader
+@vindex u-boot-firefly-rk3399-bootloader
+@vindex u-boot-mx6cuboxi-bootloader
+@vindex u-boot-nintendo-nes-classic-edition-bootloader
+@vindex u-boot-novena-bootloader
+@vindex u-boot-orangepi-r1-plus-lts-rk3328-bootloader
+@vindex u-boot-pine64-plus-bootloader
+@vindex u-boot-pine64-lts-bootloader
+@vindex u-boot-pinebook-bootloader
+@vindex u-boot-pinebook-pro-rk3399-bootloader
+@vindex u-boot-puma-rk3399-bootloader
+@vindex u-boot-rock64-rk3328-bootloader
+@vindex u-boot-rockpro64-rk3399-bootloader
+@vindex u-boot-sifive-unmatched-bootloader
+@vindex u-boot-qemu-riscv64-bootloader
+@vindex u-boot-starfive-visionfive2-bootloader
+@vindex u-boot-ts7970-q-2g-1000mhz-c-bootloader
+@vindex u-boot-wandboard-bootloader
+@vindex u-boot-rpi-2-bootloader
+@vindex u-boot-rpi-3-bootloader
+@vindex u-boot-rpi-4-bootloader
+@vindex u-boot-rpi-bootloader
+@item U-Boot
+U-Boot has individual bootloaders @code{u-boot-board-bootloader} for each
+of the following @code{board}s: @code{a20-olinuxino-lime},
+@code{a20-olinuxino-lime2}, @code{a20-olinuxino-micro},
+@code{bananapi-m2-ultra}, @code{beaglebone-black}, @code{cubietruck},
+@code{firefly-rk3399}, @code{mx6cuboxi}, @code{nintendo-nes-classic-edition},
+@code{novena}, @code{orangepi-r1-plus-lts-rk3328}, @code{pine64-plus},
+@code{pine64-lts}, @code{pinebook}, @code{pinebook-pro-rk3399},
+@code{puma-rk3399}, @code{rock64-rk3328}, @code{rockpro64-rk3399},
+@code{rpi-2}, @code{rpi-3}, @code{rpi-4}, @code{rpi}, @code{sifive-unmatched},
+@code{ts7970-q-2g-1000mhz-c}, @code{qemu-riscv64}, and @code{wandboard}.
+
+Each of these requires a @code{'disk} target providing either a @code{device},
+@code{label}, or @code{uuid}, except for @code{ts7970-q-2g-1000mhz-c} and
+@code{qemu-riscv64}, in which the bootloader just copies U-Boot to
+@file{/boot/u-boot.imx} or @file{/boot/u-boot.bin}, respectively. You should
+then manually flash it to the SPI flash at the U-Boot prompt.
+
+By default Guix configures U-Boot to boot using a generated extlinux config, but
+U-Boot does support loading UEFI bootloaders, if you want to combine it with
+another.
+@end itemize
-@vindex grub-efi-netboot-bootloader
-@code{grub-efi-netboot-bootloader} allows you to boot your system over network
-through TFTP@. In combination with an NFS root file system this allows you to
-build a diskless Guix system.
-
-The installation of the @code{grub-efi-netboot-bootloader} generates the
-content of the TFTP root directory at @code{targets} (@pxref{Bootloader
-Configuration, @code{targets}}) below the sub-directory @file{efi/Guix}, to be
-served by a TFTP server. You may want to mount your TFTP server directories
-onto the @code{targets} to move the required files to the TFTP server
-automatically during installation.
-
-If you plan to use an NFS root file system as well (actually if you mount the
-store from an NFS share), then the TFTP server needs to serve the file
-@file{/boot/grub/grub.cfg} and other files from the store (like GRUBs background
-image, the kernel (@pxref{operating-system Reference, @code{kernel}}) and the
-initrd (@pxref{operating-system Reference, @code{initrd}})), too. All these
-files from the store will be accessed by GRUB through TFTP with their normal
-store path, for example as
-@file{tftp://tftp-server/gnu/store/…-initrd/initrd.cpio.gz}.
-
-Two symlinks are created to make this possible. For each target in the
-@code{targets} field, the first symlink is
-@samp{target}@file{/efi/Guix/boot/grub/grub.cfg} pointing to
-@file{../../../boot/grub/grub.cfg}, where @samp{target} may be
-@file{/boot}. In this case the link is not leaving the served TFTP root
-directory, but otherwise it does. The second link is
-@samp{target}@file{/gnu/store} and points to @file{../gnu/store}. This
-link is leaving the served TFTP root directory.
-
-The assumption behind all this is that you have an NFS server exporting
-the root file system for your Guix system, and additionally a TFTP
-server exporting your @code{targets} directories—usually a single
-@file{/boot}—from that same root file system for your Guix system. In
-this constellation the symlinks will work.
-
-For other constellations you will have to program your own bootloader
-installer, which then takes care to make necessary files from the store
-accessible through TFTP, for example by copying them into the TFTP root
-directory for your @code{targets}.
-
-It is important to note that symlinks pointing outside the TFTP root directory
-may need to be allowed in the configuration of your TFTP server. Further the
-store link exposes the whole store through TFTP@. Both points need to be
-considered carefully for security aspects. It is advised to disable any TFTP
-write access!
-
-Please note, that this bootloader will not modify the ‘UEFI Boot Manager’ of
-the system.
-
-Beside the @code{grub-efi-netboot-bootloader}, the already mentioned TFTP and
-NFS servers, you also need a properly configured DHCP server to make the booting
-over netboot possible. For all this we can currently only recommend you to look
-for instructions about @acronym{PXE, Preboot eXecution Environment}.
-
-If a local EFI System Partition (ESP) or a similar partition with a FAT
-file system is mounted in @code{targets}, then symlinks cannot be
-created. In this case everything will be prepared for booting from
-local storage, matching the behavior of @code{grub-efi-bootloader}, with
-the difference that all GRUB binaries are copied to @code{targets},
-necessary for booting over the network.
-
-@vindex grub-efi-netboot-removable-bootloader
-@code{grub-efi-netboot-removable-bootloader} is identical to
-@code{grub-efi-netboot-bootloader} with the exception that the
-sub-directory @file{efi/boot} will be used instead of @file{efi/Guix} to
-comply with the UEFI specification for removable media.
+@item @code{targets}
+This is a list of @code{bootloader-target} (see below) structures denoting
+where the bootloader should install itself. Interpretation of specific target
+types and target requirements depend on the specific @code{bootloader} used.
@quotation Note
-This @emph{will} overwrite the GRUB file from any other operating systems that
-also place their GRUB file in the UEFI-specification location; making them
-unbootable.
+Bootloaders have a set of default targets, that can interact with user-specified
+targets. For UEFI bootloaders using the @code{'esp} target, this typically
+includes a @code{'vendir} target. If you configure multiple UEFI bootloaders,
+you should set different @code{'vendir} target @code{path}s for each, each
+@code{offset} from @code{'esp}.
@end quotation
-@item @code{targets}
-This is a list of strings denoting the targets onto which to install the
-bootloader.
-
-The interpretation of targets depends on the bootloader in question.
-For @code{grub-bootloader}, for example, they should be device names
-understood by the bootloader @command{installer} command, such as
-@code{/dev/sda} or @code{(hd0)} (@pxref{Invoking grub-install,,, grub,
-GNU GRUB Manual}). For @code{grub-efi-bootloader} and
-@code{grub-efi-removable-bootloader} they should be mount
-points of the EFI file system, usually @file{/boot/efi}. For
-@code{grub-efi-netboot-bootloader}, @code{targets} should be the mount
-points corresponding to TFTP root directories served by your TFTP
-server.
-
@item @code{menu-entries} (default: @code{'()})
A possibly empty list of @code{menu-entry} objects (see below), denoting
entries to appear in the bootloader menu, in addition to the current
@@ -42254,6 +42251,29 @@ Bootloader Configuration
The index of the default boot menu entry. Index 0 is for the entry of the
current system.
+@item @code{efi-removable?} (default: @var{#f})
+Used by all UEFI bootloaders to determine whether they should be installed to
+the UEFI standard fallback bootloader path (on x86_64,
+@file{/EFI/BOOT/BOOTX64.EFI}). This allows it to be booted from removable media
+or otherwise in cases where the system has not been booted from UEFI already.
+
+@quotation Warning
+This will override any other bootloaders installed to the same path!
+@end quotation
+
+@item @code{32bit?} (default: @var{#f})
+Some 64-bit systems require their bootloaders to be 32-bit, including some early
+UEFI systems and some Raspberry Pis. If that is the case, and the bootloader
+supports it, setting this option will force the bootloader to install as if it
+were on a 32-bit system.
+
+@item @code{keypair} (default: @var{#f})
+Designates a keypair to be used by bootloaders that support some kind of
+cryptographic signature, such as UEFI Secure Boot. This must be a pair
+@code{'(cert . priv)} of paths to the public key (@code{cert}) and private key
+(@code{priv}). The keys these paths point to should be owned by root with 600
+permissions for security purposes.
+
@item @code{timeout} (default: @code{5})
The number of seconds to wait for keyboard input before booting. Set to
0 to boot immediately, and to -1 to wait indefinitely.
@@ -42276,19 +42296,20 @@ Bootloader Configuration
is provided, some bootloaders might use a default theme, that's true
for GRUB.
-@item @code{terminal-outputs} (default: @code{'(gfxterm)})
+@item @code{terminal-outputs} (default: @var{#f})
The output terminals used for the bootloader boot menu, as a list of
-symbols. GRUB accepts the values: @code{console}, @code{serial},
-@code{serial_@{0-3@}}, @code{gfxterm}, @code{vga_text},
-@code{mda_text}, @code{morse}, and @code{pkmodem}. This field
-corresponds to the GRUB variable @code{GRUB_TERMINAL_OUTPUT} (@pxref{Simple
-configuration,,, grub,GNU GRUB manual}).
-
-@item @code{terminal-inputs} (default: @code{'()})
+symbols. When @var{#f}, the default is used. For GRUB this is @code{gfxterm}.
+GRUB accepts the values: @code{console}, @code{serial}, @code{serial_@{0-3@}},
+@code{gfxterm}, @code{vga_text}, @code{mda_text}, @code{morse}, and
+@code{pkmodem}. This field corresponds to the GRUB variable
+@code{GRUB_TERMINAL_OUTPUT}
+(@pxref{Simple configuration,,, grub,GNU GRUB manual}).
+
+@item @code{terminal-inputs} (default: @var{#f})
The input terminals used for the bootloader boot menu, as a list of
-symbols. For GRUB, the default is the native platform terminal as
-determined at run-time. GRUB accepts the values: @code{console},
-@code{serial}, @code{serial_@{0-3@}}, @code{at_keyboard}, and
+symbols. When @var{#f}, the default is used. For GRUB, this is the native
+platform terminal as determined at run-time. GRUB accepts the values:
+@code
This message was truncated. Download the full message here.
L
L
Lilah Tascheter wrote on 4 Aug 22:32 +0200
[PATCH v3 15/15] teams: Add bootloading team.
(address . 72457@debbugs.gnu.org)
746d7b775e4e33a937d80dd3927caa8609d63f4e.1722803521.git.lilah@lunabee.space
Might as well, to help ease the transition.

* etc/teams.scm (bootloaders): New team.
(Lilah Tascheter): Create add to above.

Change-Id: I63620f4e3151bb8e3d0bdf619fc70501af6397a0
---
etc/teams.scm | 10 ++++++++++
1 file changed, 10 insertions(+)

Toggle diff (30 lines)
diff --git a/etc/teams.scm b/etc/teams.scm
index 408ebbf3d9..d9af4ad7bb 100755
--- a/etc/teams.scm
+++ b/etc/teams.scm
@@ -328,6 +328,12 @@ (define-team embedded
#:scope (list "gnu/packages/bootloaders.scm"
"gnu/packages/firmware.scm")))
+(define-team bootloaders
+ (team 'bootloaders
+ #:name "Bootloaders"
+ #:scope (list "gnu/bootloader.scm"
+ (make-regexp* "^gnu/bootloader/"))))
+
(define-team rust
(team 'rust
#:name "Rust"
@@ -746,6 +752,10 @@ (define-member (person "Nicolas Goaziou"
"guix@nicolasgoaziou.fr")
tex)
+(define-member (person "Lilah Tascheter"
+ "lilah@lunabee.space")
+ bootloaders)
+
(define (find-team name)
(or (hash-ref %teams (string->symbol name))
--
2.45.2
S
S
Sergey Trofimov wrote on 5 Aug 09:00 +0200
Re: [PATCH v3 00/15] Rewrite bootloader subsystem.
(name . Lilah Tascheter)(address . lilah@lunabee.space)(address . 72457@debbugs.gnu.org)
CAE0nKzVqXZzQYY5V=Ftn9U_ixQKtvB7Da246TLT5aADYx5vo3Q@mail.gmail.com
Hi Lilah,

On Sun, 4 Aug 2024 at 22:33, Lilah Tascheter <lilah@lunabee.space> wrote:
Toggle quote (3 lines)
>
> Goddamnit, alright, how's this?

Unfortunately it still doesn't work. Here is my debug session:

Error:
Toggle snippet (35 lines)
In srfi/srfi-1.scm:
586:17 8 (map1 (#f #<<uuid> type: fat bv: #vu8(77 160 163 107)>
#<<uuid> type: dce bv: #vu8(246 188 138 216 255 26 23 84 83 48 172 24
246 188 138 216)> #<<uuid> type: fat bv: #vu8(77 160 163 107)>))
In ice-9/eval.scm:
293:34 7 (_ #(#(#(#(#(#(#<directory (gnu bootloader)
7f49dbce61e0>) #f (#f #<<uuid> type: fat bv: #vu8(77 160 163 107)>
#<<uuid> type: dce bv: #vu8(246 188 138 216 255 26 23 84 83 48 172 24
246 188 138 216)> #<<uuid> type: fat bv: #vu8(77 160 163 107)>))
#<procedure up (a)>) (#f)) (#f #f)) #<procedure offset (a)>))
191:35 6 (_ #(#(#(#(#(#(#<directory (gnu bootloader)
7f49dbce61e0>) #f (#f #<<uuid> type: fat bv: #vu8(77 160 163 107)>
#<<uuid> type: dce bv: #vu8(246 188 138 216 255 26 23 84 83 48 172 24
246 188 138 216)> #<<uuid> type: fat bv: #vu8(77 160 163 107)>))
#<procedure up (a)>) (#f)) (#f #f)) #<procedure offset (a)>))
163:9 5 (_ #(#(#(#(#(#(#<directory (gnu bootloader)
7f49dbce61e0>) #f (#f #<<uuid> type: fat bv: #vu8(77 160 163 107)>
#<<uuid> type: dce bv: #vu8(246 188 138 216 255 26 23 84 83 48 172 24
246 188 138 216)> #<<uuid> type: fat bv: #vu8(77 160 163 107)>))
#<procedure up (a)>) (#f)) (#f #f)) #<procedure offset (a)>))
In srfi/srfi-1.scm:
586:17 4 (map1 (#f))
In ice-9/eval.scm:
263:9 3 (_ #(#(#<directory (gnu bootloader) 7f49dbce61e0>) #f))
155:9 2 (_ _)
In ice-9/boot-9.scm:
1685:16 1 (raise-exception _ #:continuable? _)
1685:16 0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure struct-vtable: Wrong type argument in position 1
(expecting struct): #f


Trying to debug it in REPL:
Toggle snippet (9 lines)
,m (gnu bootloader)
,use (gnu bootloader grub)

(bootloader-configuration->gexp
(bootloader-configuration
(bootloader grub-efi-bootloader)
(targets (list (bootloader-target (type 'esp) (path "/boot"))))) '())

List of targets passed to normalize:
Toggle snippet (12 lines)
#<<bootloader-target> type: vendir expected?: #f path: "EFI/Guix"
offset: #<procedure offset (a)> device: #f file-system: #f label: #f
uuid: #f>
#<<bootloader-target> type: install expected?: #f path: "boot" offset:
#<procedure offset (a)> device: #f file-system: #f label: #f uuid: #f>
#<<bootloader-target> type: root expected?: #f path: "/" offset:
#<procedure offset (x)> device: #f file-system: #f label: #f uuid: #f>
#<<bootloader-target> type: esp expected?: #f path: "/boot" offset:
#<procedure feb5818 at <unknown port>:132:19 (x)> device: #f
file-system: #f label: #f uuid: #f>)

(mounts):
Toggle snippet (34 lines)
#<<mount> devno: 21 source: "none" point: "/proc" type: "proc"
options: "rw,relatime">
#<<mount> devno: 6 source: "none" point: "/dev" type: "devtmpfs"
options: "rw,relatime">
#<<mount> devno: 22 source: "none" point: "/sys" type: "sysfs"
options: "rw,relatime">
#<<mount> devno: 2050 source: "/dev/sda2" point: "/" type: "ext4"
options: "rw,relatime">
#<<mount> devno: 2049 source: "/dev/sda1" point: "/boot" type: "vfat"
options: "rw,relatime">
#<<mount> devno: 24 source: "none" point: "/dev/pts" type: "devpts"
options: "rw,relatime">
#<<mount> devno: 8 source: "none" point: "/sys/kernel/debug" type:
"debugfs" options: "rw,relatime">
#<<mount> devno: 25 source: "tmpfs" point: "/dev/shm" type: "tmpfs"
options: "rw,nosuid,nodev,relatime">
#<<mount> devno: 26 source: "efivarfs" point:
"/sys/firmware/efi/efivars" type: "efivarfs" options: "rw,relatime">
#<<mount> devno: 2050 source: "/dev/sda2" point: "/gnu/store" type:
"ext4" options: "ro,noatime">
#<<mount> devno: 27 source: "none" point: "/run/systemd" type: "tmpfs"
options: "rw,nosuid,nodev,noexec,relatime">
#<<mount> devno: 28 source: "none" point: "/run/user" type: "tmpfs"
options: "rw,nosuid,nodev,noexec,relatime">
#<<mount> devno: 29 source: "none" point: "/sys/fs/cgroup" type:
"cgroup2" options: "rw,relatime">
#<<mount> devno: 30 source: "cgroup" point: "/sys/fs/cgroup/elogind"
type: "cgroup" options: "rw,relatime">
#<<mount> devno: 31 source: "tmpfs" point: "/run/user/1000" type:
"tmpfs" options: "rw,nosuid,nodev,relatime">
#<<mount> devno: 33 source: "portal" point: "/run/user/1000/doc" type:
"fuse.portal" options: "rw,nosuid,nodev,relatime">

(disk-partitions): ("sda" "sda1" "sda2")

labels: sda1: GNU-ESP sda2: Guix_image

uuids:
Toggle snippet (7 lines)
(read-partition-uuid "/dev/sda2")
#vu8(246 188 138 216 255 26 23 84 83 48 172 24 246 188 138 216)

(read-partition-uuid "/dev/sda1")
#vu8(77 160 163 107)

It seems that device couldn't be guessed for the vendir target, as
(unfold-pathcat) returns a path (/boot/EFI/Guix) that is not in
(mounts).
L
L
Lilah Tascheter wrote on 6 Aug 04:44 +0200
[PATCH v4 00/15] Rewrite bootloader subsystem.
(address . 72457@debbugs.gnu.org)
cover.1722912293.git.lilah@lunabee.space
Fourth time's the charm. Thanks so much for your help!

Lilah Tascheter (15):
guix: scripts: Rewrite reinstall-bootloader to use provenance data.
gnu: Add bootloader target infastructure.
guix: scripts: Remove unused code.
gnu: Core bootloader changes.
gnu: system: Remove useless boot parameters.
gnu: bootloader: Add raspberry pi bootloader.
gnu: system: Fix bootloader crypto device recognition.
gnu: packages: Add pesign.
gnu: packages: Add ukify.
gnu: packages: Add systemd-stub.
gnu: bootloaders: Add uki-efi-bootloader.
gnu: system: Update examples.
doc: Update bootloader documentation.
gnu: tests: Update tests to new targets system.
teams: Add bootloading team.

doc/guix.texi | 458 +++---
etc/teams.scm | 10 +
gnu/bootloader.scm | 665 ++++++---
gnu/bootloader/depthcharge.scm | 153 +-
gnu/bootloader/extlinux.scm | 149 +-
gnu/bootloader/grub.scm | 1279 +++++++----------
gnu/bootloader/u-boot.scm | 505 +++----
gnu/bootloader/uki.scm | 96 ++
gnu/build/bootloader.scm | 157 +-
gnu/build/image.scm | 40 +-
gnu/build/install.scm | 16 +-
gnu/image.scm | 3 +
gnu/installer/parted.scm | 12 +-
gnu/local.mk | 1 +
gnu/machine/ssh.scm | 71 +-
gnu/packages/bootloaders.scm | 277 ++--
gnu/packages/efi.scm | 47 +
gnu/packages/raspberry-pi.scm | 18 -
gnu/services/virtualization.scm | 11 +-
gnu/system.scm | 62 +-
gnu/system/boot.scm | 16 +-
gnu/system/examples/asus-c201.tmpl | 6 +-
gnu/system/examples/bare-bones.tmpl | 7 +-
gnu/system/examples/bare-hurd.tmpl | 4 +-
gnu/system/examples/beaglebone-black.tmpl | 6 +-
gnu/system/examples/desktop.tmpl | 4 +-
gnu/system/examples/docker-image.tmpl | 6 +-
gnu/system/examples/lightweight-desktop.tmpl | 4 +-
gnu/system/examples/plasma.tmpl | 4 +-
.../examples/raspberry-pi-64-nfs-root.tmpl | 23 +-
gnu/system/examples/raspberry-pi-64.tmpl | 18 +-
gnu/system/examples/vm-image.tmpl | 5 +-
gnu/system/hurd.scm | 4 +-
gnu/system/image.scm | 162 ++-
gnu/system/images/hurd.scm | 4 +-
gnu/system/images/novena.scm | 3 +-
.../images/orangepi-r1-plus-lts-rk3328.scm | 3 +-
gnu/system/images/pine64.scm | 3 +-
gnu/system/images/pinebook-pro.scm | 3 +-
gnu/system/images/rock64.scm | 3 +-
gnu/system/images/unmatched.scm | 3 +-
gnu/system/images/visionfive2.scm | 3 +-
gnu/system/images/wsl2.scm | 14 +-
gnu/system/install.scm