summaryrefslogtreecommitdiff
path: root/gnu/bootloader.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2019-09-06 20:46:00 -0400
committerMark H Weaver <mhw@netris.org>2019-09-06 20:46:00 -0400
commit65542a8852759f35e19959149ac92297c8b54be5 (patch)
treebc8f398c7b10a4725b20aa59ab1452d30f358ea3 /gnu/bootloader.scm
parentbc60349b5bc58a0b803df5adce1de6db82453744 (diff)
parentf66aee3d0d2f573187ed5d44ae7c13d73cd4097a (diff)
downloadpatches-65542a8852759f35e19959149ac92297c8b54be5.tar
patches-65542a8852759f35e19959149ac92297c8b54be5.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/bootloader.scm')
-rw-r--r--gnu/bootloader.scm36
1 files changed, 35 insertions, 1 deletions
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index a381f67145..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.
@@ -108,7 +142,7 @@
(bootloader bootloader-configuration-bootloader) ;<bootloader>
(target bootloader-configuration-target ;string
(default #f))
- (menu-entries bootloader-configuration-menu-entries ;list of <boot-parameters>
+ (menu-entries bootloader-configuration-menu-entries ;list of <menu-entry>
(default '()))
(default-entry bootloader-configuration-default-entry ;integer
(default 0))