diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-08-28 23:27:20 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-08-30 01:33:45 +0200 |
commit | a28cfee841e9c5ab179291d3065f1486fd065e7e (patch) | |
tree | 539e7d4c15350a8a52eedfc12e10822c825f4cea /gnu/bootloader.scm | |
parent | 546a709f202024c8a5173ad372a87ddc1c284c63 (diff) | |
download | patches-a28cfee841e9c5ab179291d3065f1486fd065e7e.tar patches-a28cfee841e9c5ab179291d3065f1486fd065e7e.tar.gz |
system: Add 'bootloader-menu-entries' field to <boot-parameters>.
This allows us to keep track of the extra menu entries specified in the
OS configuration.
* gnu/system.scm (<boot-parameters>)[bootloader-menu-entries]: New field.
(read-boot-parameters): Initialize it.
(operating-system-boot-parameters): Likewise.
(operating-system-boot-parameters-file): Serialize it.
* gnu/bootloader.scm (menu-entry->sexp, sexp->menu-entry): New
procedures.
Diffstat (limited to 'gnu/bootloader.scm')
-rw-r--r-- | gnu/bootloader.scm | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 909036042f..01bdd4acaa 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2017 David Craven <david@craven.ch> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2017 Leo Famulari <leo@famulari.name> +;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,6 +24,7 @@ #:use-module (guix records) #:use-module (guix ui) #:use-module (srfi srfi-1) + #:use-module (ice-9 match) #:export (menu-entry menu-entry? menu-entry-label @@ -32,6 +34,9 @@ menu-entry-initrd menu-entry-device-mount-point + menu-entry->sexp + sexp->menu-entry + bootloader bootloader? bootloader-name @@ -76,6 +81,35 @@ (default '())) ; list of string-valued gexps (initrd menu-entry-initrd)) ; file name of the initrd as a gexp +(define (menu-entry->sexp entry) + "Return ENTRY serialized as an sexp." + (match entry + (($ <menu-entry> label device mount-point linux linux-arguments initrd) + `(menu-entry (version 0) + (label ,label) + (device ,device) + (device-mount-point ,mount-point) + (linux ,linux) + (linux-arguments ,linux-arguments) + (initrd ,initrd))))) + +(define (sexp->menu-entry sexp) + "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry> +record." + (match sexp + (('menu-entry ('version 0) + ('label label) ('device device) + ('device-mount-point mount-point) + ('linux linux) ('linux-arguments linux-arguments) + ('initrd initrd) _ ...) + (menu-entry + (label label) + (device device) + (device-mount-point mount-point) + (linux linux) + (linux-arguments linux-arguments) + (initrd initrd))))) + ;;; ;;; Bootloader record. |