summaryrefslogtreecommitdiff
path: root/gnu/bootloader.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-08-28 23:27:20 +0200
committerLudovic Courtès <ludo@gnu.org>2019-08-30 01:33:45 +0200
commita28cfee841e9c5ab179291d3065f1486fd065e7e (patch)
tree539e7d4c15350a8a52eedfc12e10822c825f4cea /gnu/bootloader.scm
parent546a709f202024c8a5173ad372a87ddc1c284c63 (diff)
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.scm34
1 files changed, 34 insertions, 0 deletions
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 909036042fd..01bdd4acaa9 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -2,6 +2,7 @@
2;;; Copyright © 2017 David Craven <david@craven.ch> 2;;; Copyright © 2017 David Craven <david@craven.ch>
3;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> 3;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
4;;; Copyright © 2017 Leo Famulari <leo@famulari.name> 4;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
5;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
5;;; 6;;;
6;;; This file is part of GNU Guix. 7;;; This file is part of GNU Guix.
7;;; 8;;;
@@ -23,6 +24,7 @@
23 #:use-module (guix records) 24 #:use-module (guix records)
24 #:use-module (guix ui) 25 #:use-module (guix ui)
25 #:use-module (srfi srfi-1) 26 #:use-module (srfi srfi-1)
27 #:use-module (ice-9 match)
26 #:export (menu-entry 28 #:export (menu-entry
27 menu-entry? 29 menu-entry?
28 menu-entry-label 30 menu-entry-label
@@ -32,6 +34,9 @@
32 menu-entry-initrd 34 menu-entry-initrd
33 menu-entry-device-mount-point 35 menu-entry-device-mount-point
34 36
37 menu-entry->sexp
38 sexp->menu-entry
39
35 bootloader 40 bootloader
36 bootloader? 41 bootloader?
37 bootloader-name 42 bootloader-name
@@ -76,6 +81,35 @@
76 (default '())) ; list of string-valued gexps 81 (default '())) ; list of string-valued gexps
77 (initrd menu-entry-initrd)) ; file name of the initrd as a gexp 82 (initrd menu-entry-initrd)) ; file name of the initrd as a gexp
78 83
84(define (menu-entry->sexp entry)
85 "Return ENTRY serialized as an sexp."
86 (match entry
87 (($ <menu-entry> label device mount-point linux linux-arguments initrd)
88 `(menu-entry (version 0)
89 (label ,label)
90 (device ,device)
91 (device-mount-point ,mount-point)
92 (linux ,linux)
93 (linux-arguments ,linux-arguments)
94 (initrd ,initrd)))))
95
96(define (sexp->menu-entry sexp)
97 "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry>
98record."
99 (match sexp
100 (('menu-entry ('version 0)
101 ('label label) ('device device)
102 ('device-mount-point mount-point)
103 ('linux linux) ('linux-arguments linux-arguments)
104 ('initrd initrd) _ ...)
105 (menu-entry
106 (label label)
107 (device device)
108 (device-mount-point mount-point)
109 (linux linux)
110 (linux-arguments linux-arguments)
111 (initrd initrd)))))
112
79 113
80;;; 114;;;
81;;; Bootloader record. 115;;; Bootloader record.