diff options
Diffstat (limited to 'gnu/bootloader')
-rw-r--r-- | gnu/bootloader/extlinux.scm | 19 | ||||
-rw-r--r-- | gnu/bootloader/grub.scm | 49 | ||||
-rw-r--r-- | gnu/bootloader/u-boot.scm | 47 |
3 files changed, 89 insertions, 26 deletions
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..a9f0875f36 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -55,6 +55,7 @@ grub-bootloader grub-efi-bootloader + grub-mkrescue-bootloader grub-configuration)) @@ -316,16 +317,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 +340,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 +360,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 "}~%")) #~())))) @@ -391,7 +389,20 @@ submenu \"GNU system, old configurations...\" {~%") (unless (zero? (system* grub "--no-floppy" "--boot-directory" install-dir device)) - (error "failed to install GRUB"))))) + (error "failed to install GRUB (BIOS)"))))) + +(define install-grub-efi + #~(lambda (bootloader efi-dir mount-point) + ;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the + ;; system whose root is mounted at MOUNT-POINT. + (let ((grub-install (string-append bootloader "/sbin/grub-install")) + (install-dir (string-append mount-point "/boot"))) + ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or + ;; root partition. + (setenv "GRUB_ENABLE_CRYPTODISK" "y") + (unless (zero? (system* grub-install "--boot-directory" install-dir + "--efi-directory" efi-dir)) + (error "failed to install GRUB (EFI)"))))) @@ -410,9 +421,15 @@ submenu \"GNU system, old configurations...\" {~%") (define* grub-efi-bootloader (bootloader (inherit grub-bootloader) + (installer install-grub-efi) (name 'grub-efi) (package grub-efi))) +(define* grub-mkrescue-bootloader + (bootloader + (inherit grub-efi-bootloader) + (package grub-hybrid))) + ;;; ;;; Compatibility macros. diff --git a/gnu/bootloader/u-boot.scm b/gnu/bootloader/u-boot.scm new file mode 100644 index 0000000000..963b0d7597 --- /dev/null +++ b/gnu/bootloader/u-boot.scm @@ -0,0 +1,47 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2017 David Craven <david@craven.ch> +;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> +;;; +;;; 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 u-boot) + #:use-module (gnu bootloader extlinux) + #:use-module (gnu bootloader) + #:use-module (gnu system) + #:use-module (gnu packages bootloaders) + #:use-module (guix gexp) + #:use-module (guix monads) + #:use-module (guix records) + #:use-module (guix utils) + #:export (u-boot-bootloader)) + +(define install-u-boot + #~(lambda (bootloader device mount-point) + (if bootloader + (error "Failed to install U-Boot")))) + + + +;;; +;;; Bootloader definitions. +;;; + +(define u-boot-bootloader + (bootloader + (inherit extlinux-bootloader) + (name 'u-boot) + (package #f) + (installer install-u-boot))) |