diff options
author | Danny Milosavljevic <dannym@scratchpost.org> | 2017-06-29 12:42:59 +0200 |
---|---|---|
committer | Danny Milosavljevic <dannym@scratchpost.org> | 2017-07-28 21:56:18 +0200 |
commit | 1975c754f487eb4933724ca3b116442d21ef8dd9 (patch) | |
tree | 6b6ffb984416b197135118ff0222c3ec85e53434 /gnu | |
parent | 9ca8aa38ecce0b0651a0ff394ee4ce32bdd0bb41 (diff) | |
download | guix-1975c754f487eb4933724ca3b116442d21ef8dd9.tar.gz |
bootloader: Use <menu-entry> for the bootloader side.
* gnu/bootloader.scm (menu-entry-device-mount-point): New variable. Export it. (<menu-entry>: New field "device". * gnu/bootloader/grub.scm (grub-confgiuration-file): Handle <menu-entry> entries. * gnu/bootloader/extlinux.scm (extlinux-configuration-file): Handle <menu-entry> entries. * gnu/system.scm (menu->entry->boot-parameters): Delete variable. (boot-parameters->menu-entry): New variable. Export it. (operating-system-bootcfg): Make OLD-ENTRIES a list of <menu-entry>. * guix/script/system.scm (reinstall-bootloader): Fix bootcfg usage. (perform-action): Fix bootcfg usage.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/bootloader.scm | 3 | ||||
-rw-r--r-- | gnu/bootloader/extlinux.scm | 19 | ||||
-rw-r--r-- | gnu/bootloader/grub.scm | 27 | ||||
-rw-r--r-- | gnu/system.scm | 29 |
4 files changed, 38 insertions, 40 deletions
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index d5fcf30f05..e080b04568 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -30,6 +30,7 @@ menu-entry-linux menu-entry-linux-arguments menu-entry-initrd + menu-entry-device-mount-point bootloader bootloader? @@ -67,6 +68,8 @@ (label menu-entry-label) (device menu-entry-device ; file system uuid, label, or #f (default #f)) + (device-mount-point menu-entry-device-mount-point + (default #f)) (linux menu-entry-linux) (linux-arguments menu-entry-linux-arguments (default '())) ; list of string-valued gexps diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm index 219b058e53..e5fdeb5801 100644 --- a/gnu/bootloader/extlinux.scm +++ b/gnu/bootloader/extlinux.scm @@ -38,14 +38,13 @@ corresponding to old generations of the system." (define all-entries - (append entries (map menu-entry->boot-parameters - (bootloader-configuration-menu-entries config)))) - - (define (boot-parameters->gexp params) - (let ((label (boot-parameters-label params)) - (kernel (boot-parameters-kernel params)) - (kernel-arguments (boot-parameters-kernel-arguments params)) - (initrd (boot-parameters-initrd params))) + (append entries (bootloader-configuration-menu-entries config))) + + (define (menu-entry->gexp entry) + (let ((label (menu-entry-label entry)) + (kernel (menu-entry-linux entry)) + (kernel-arguments (menu-entry-linux-arguments entry)) + (initrd (menu-entry-initrd entry))) #~(format port "LABEL ~a MENU LABEL ~a KERNEL ~a @@ -69,11 +68,11 @@ TIMEOUT ~a~%" (if (> timeout 0) 1 0) ;; timeout is expressed in 1/10s of seconds. (* 10 timeout)) - #$@(map boot-parameters->gexp all-entries) + #$@(map menu-entry->gexp all-entries) #$@(if (pair? old-entries) #~((format port "~%") - #$@(map boot-parameters->gexp old-entries) + #$@(map menu-entry->gexp old-entries) (format port "~%")) #~()))))) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 880491c983..3a3456ca46 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -316,16 +316,14 @@ code." STORE-FS, a <file-system> object. OLD-ENTRIES is taken to be a list of menu entries corresponding to old generations of the system." (define all-entries - (append entries (map menu-entry->boot-parameters - (bootloader-configuration-menu-entries config)))) - - (define (boot-parameters->gexp params) - (let ((device (boot-parameters-store-device params)) - (device-mount-point (boot-parameters-store-mount-point params)) - (label (boot-parameters-label params)) - (kernel (boot-parameters-kernel params)) - (arguments (boot-parameters-kernel-arguments params)) - (initrd (boot-parameters-initrd params))) + (append entries (bootloader-configuration-menu-entries config))) + (define (menu-entry->gexp entry) + (let ((device (menu-entry-device entry)) + (device-mount-point (menu-entry-device-mount-point entry)) + (label (menu-entry-label entry)) + (kernel (menu-entry-linux entry)) + (arguments (menu-entry-linux-arguments entry)) + (initrd (menu-entry-initrd entry))) ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. ;; Use the right file names for KERNEL and INITRD in case ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a @@ -341,11 +339,10 @@ entries corresponding to old generations of the system." #$(grub-root-search device kernel) #$kernel (string-join (list #$@arguments)) #$initrd)))) - (mlet %store-monad ((sugar (eye-candy config - (boot-parameters-store-device + (menu-entry-device (first all-entries)) - (boot-parameters-store-mount-point + (menu-entry-device-mount-point (first all-entries)) #:system system #:port #~port))) @@ -362,12 +359,12 @@ set default=~a set timeout=~a~%" #$(bootloader-configuration-default-entry config) #$(bootloader-configuration-timeout config)) - #$@(map boot-parameters->gexp all-entries) + #$@(map menu-entry->gexp all-entries) #$@(if (pair? old-entries) #~((format port " submenu \"GNU system, old configurations...\" {~%") - #$@(map boot-parameters->gexp old-entries) + #$@(map menu-entry->gexp old-entries) (format port "}~%")) #~())))) diff --git a/gnu/system.scm b/gnu/system.scm index 746c511187..fdb5be287e 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -112,7 +112,7 @@ boot-parameters-initrd read-boot-parameters read-boot-parameters-file - menu-entry->boot-parameters + boot-parameters->menu-entry local-host-aliases %setuid-programs @@ -301,17 +301,15 @@ The object has its kernel-arguments extended in order to make it bootable." root-device))) #f))) -(define (menu-entry->boot-parameters menu-entry) - "Convert a <menu-entry> instance to a corresponding <boot-parameters>." - (boot-parameters - (label (menu-entry-label menu-entry)) - (root-device #f) - (bootloader-name 'custom) - (store-device #f) - (store-mount-point #f) - (kernel (menu-entry-linux menu-entry)) - (kernel-arguments (menu-entry-linux-arguments menu-entry)) - (initrd (menu-entry-initrd menu-entry)))) +(define (boot-parameters->menu-entry conf) + (menu-entry + (label (boot-parameters-label conf)) + (device (boot-parameters-store-device conf)) + (device-mount-point (boot-parameters-store-mount-point conf)) + (linux (boot-parameters-kernel conf)) + (linux-arguments (boot-parameters-kernel-arguments conf)) + (initrd (boot-parameters-initrd conf)))) + ;;; @@ -866,15 +864,16 @@ listed in OS. The C library expects to find it under (store-file-system (operating-system-file-systems os))) (define* (operating-system-bootcfg os #:optional (old-entries '())) - "Return the bootloader configuration file for OS. Use OLD-ENTRIES to -populate the \"old entries\" menu." + "Return the bootloader configuration file for OS. Use OLD-ENTRIES +(which is a list of <menu-entry>) to populate the \"old entries\" menu." (mlet* %store-monad ((system (operating-system-derivation os)) (root-fs -> (operating-system-root-file-system os)) (root-device -> (if (eq? 'uuid (file-system-title root-fs)) (uuid->string (file-system-device root-fs)) (file-system-device root-fs))) - (entry (operating-system-boot-parameters os system root-device)) + (params (operating-system-boot-parameters os system root-device)) + (entry -> (boot-parameters->menu-entry params)) (bootloader-conf -> (operating-system-bootloader os))) ((bootloader-configuration-file-generator (bootloader-configuration-bootloader bootloader-conf)) |