mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
gnu: bootloader: grub: Rewrite entirely.
* gnu/bootloader.scm (bootloader-configuration)[terminal-outputs, terminal-inputs]: Don't assume grub. [%bootloader-configuration-targets]: Rename to the below. (bootloader-configuration-targets): Delete procedure. * gnu/bootloader/grub.scm (normalize-file, bootloader-theme, image->png, grub-background-image, grub-locale-directory, eye-candy, keyboard-layout-file, grub-setup-io, grub-root-search, make-grub-configuration, grub-configuration-file, grub-efi-configuration-file, install-grub, install-grub-disk-image, install-grub-efi, install-grub-efi-removable, install-grub-efi32, make-grub-efi-netboot-installer, make-grub-efi-netboot-bootloader): Remove procedures. (grub-cfg, grub-mkrescue-bootloader): Remove variables. (grub-efi-removable-bootloader, grub-efi32-bootloader, grub-efi-netboot-bootloader, grub-efi-netboot-removable-bootloader): Deprecate variables. (grub-configuration): Remove macro. (sanitize, search/target, search/menu-entry, when-list, grub-theme-png, core.cfg->core.img, core.cfg, core.img, menu-entry->gexp, make-grub.cfg, grub.cfg, grub.dir, install-grub.dir, install-grub-bios, install-grub-efi, deprecated-installer): Add procedures. (%grub-default-targets, %netboot-targets): Add variables. (keyboard-layout-file): Return computed file. * gnu/packages/bootloaders.scm (make-grub-efi-netboot): Delete procedure. * doc/guix.texi (system Configuration)[Bootloader Configuration]: Update terminal-outputs and terminal-inputs to not be GRUB-specific. Change-Id: I3654d160f7306bb45a78b82ea6b249ff4281f739
This commit is contained in:
parent
b658d324df
commit
5a6f0fbc58
4 changed files with 540 additions and 895 deletions
|
@ -42395,19 +42395,20 @@ The bootloader theme object describing the theme to use. If no theme
|
||||||
is provided, some bootloaders might use a default theme, that's true
|
is provided, some bootloaders might use a default theme, that's true
|
||||||
for GRUB.
|
for GRUB.
|
||||||
|
|
||||||
@item @code{terminal-outputs} (default: @code{'(gfxterm)})
|
@item @code{terminal-outputs} (default: @var{#f})
|
||||||
The output terminals used for the bootloader boot menu, as a list of
|
The output terminals used for the bootloader boot menu, as a list of
|
||||||
symbols. GRUB accepts the values: @code{console}, @code{serial},
|
symbols. When @var{#f}, the default is used. For GRUB this is @code{gfxterm}.
|
||||||
@code{serial_@{0-3@}}, @code{gfxterm}, @code{vga_text},
|
GRUB accepts the values: @code{console}, @code{serial}, @code{serial_@{0-3@}},
|
||||||
@code{mda_text}, @code{morse}, and @code{pkmodem}. This field
|
@code{gfxterm}, @code{vga_text}, @code{mda_text}, @code{morse}, and
|
||||||
corresponds to the GRUB variable @code{GRUB_TERMINAL_OUTPUT} (@pxref{Simple
|
@code{pkmodem}. This field corresponds to the GRUB variable
|
||||||
configuration,,, grub,GNU GRUB manual}).
|
@code{GRUB_TERMINAL_OUTPUT}
|
||||||
|
(@pxref{Simple configuration,,, grub,GNU GRUB manual}).
|
||||||
|
|
||||||
@item @code{terminal-inputs} (default: @code{'()})
|
@item @code{terminal-inputs} (default: @code{#f})
|
||||||
The input terminals used for the bootloader boot menu, as a list of
|
The input terminals used for the bootloader boot menu, as a list of
|
||||||
symbols. For GRUB, the default is the native platform terminal as
|
symbols, or @code{#f} to use the default. For GRUB, this is the native
|
||||||
determined at run-time. GRUB accepts the values: @code{console},
|
platform terminal as determined at run-time. GRUB accepts the values:
|
||||||
@code{serial}, @code{serial_@{0-3@}}, @code{at_keyboard}, and
|
@code{console}, @code{serial}, @code{serial_@{0-3@}}, @code{at_keyboard}, and
|
||||||
@code{usb_keyboard}. This field corresponds to the GRUB variable
|
@code{usb_keyboard}. This field corresponds to the GRUB variable
|
||||||
@code{GRUB_TERMINAL_INPUT} (@pxref{Simple configuration,,, grub,GNU GRUB
|
@code{GRUB_TERMINAL_INPUT} (@pxref{Simple configuration,,, grub,GNU GRUB
|
||||||
manual}).
|
manual}).
|
||||||
|
|
|
@ -495,7 +495,7 @@ (define-record-type* <bootloader-configuration>
|
||||||
bootloader-configuration?
|
bootloader-configuration?
|
||||||
(bootloader
|
(bootloader
|
||||||
bootloader-configuration-bootloader) ;<bootloader>
|
bootloader-configuration-bootloader) ;<bootloader>
|
||||||
(targets %bootloader-configuration-targets
|
(targets bootloader-configuration-targets
|
||||||
(default #f)) ;list of strings
|
(default #f)) ;list of strings
|
||||||
(menu-entries bootloader-configuration-menu-entries
|
(menu-entries bootloader-configuration-menu-entries
|
||||||
(default '())) ;list of <menu-entry>
|
(default '())) ;list of <menu-entry>
|
||||||
|
@ -512,9 +512,9 @@ (define-record-type* <bootloader-configuration>
|
||||||
(theme bootloader-configuration-theme
|
(theme bootloader-configuration-theme
|
||||||
(default #f)) ;bootloader-specific theme
|
(default #f)) ;bootloader-specific theme
|
||||||
(terminal-outputs bootloader-configuration-terminal-outputs
|
(terminal-outputs bootloader-configuration-terminal-outputs
|
||||||
(default '(gfxterm))) ;list of symbols
|
(default #f)) ;list of symbols | #f (default outs)
|
||||||
(terminal-inputs bootloader-configuration-terminal-inputs
|
(terminal-inputs bootloader-configuration-terminal-inputs
|
||||||
(default '())) ;list of symbols
|
(default #f)) ;list of symbols | #f (default ins)
|
||||||
(serial-unit bootloader-configuration-serial-unit
|
(serial-unit bootloader-configuration-serial-unit
|
||||||
(default #f)) ;integer | #f
|
(default #f)) ;integer | #f
|
||||||
(serial-speed bootloader-configuration-serial-speed
|
(serial-speed bootloader-configuration-serial-speed
|
||||||
|
@ -524,14 +524,6 @@ (define-record-type* <bootloader-configuration>
|
||||||
(extra-initrd bootloader-configuration-extra-initrd
|
(extra-initrd bootloader-configuration-extra-initrd
|
||||||
(default #f))) ;string | #f
|
(default #f))) ;string | #f
|
||||||
|
|
||||||
|
|
||||||
(define (bootloader-configuration-targets config)
|
|
||||||
(or (%bootloader-configuration-targets config)
|
|
||||||
;; XXX: At least the GRUB installer (see (gnu bootloader grub)) has this
|
|
||||||
;; peculiar behavior of installing fonts and GRUB modules when DEVICE is #f,
|
|
||||||
;; hence the default value of '(#f) rather than '().
|
|
||||||
(list #f)))
|
|
||||||
|
|
||||||
|
|
||||||
;;;
|
;;;
|
||||||
;;; Bootloader installation paths.
|
;;; Bootloader installation paths.
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -501,92 +501,6 @@ (define-public grub-hybrid
|
||||||
basename))))
|
basename))))
|
||||||
(scandir input-dir)))))))))))
|
(scandir input-dir)))))))))))
|
||||||
|
|
||||||
(define-public (make-grub-efi-netboot name subdir)
|
|
||||||
"Make a grub-efi-netboot package named NAME, which will be able to boot over
|
|
||||||
network via TFTP by accessing its files in the SUBDIR of a TFTP root directory.
|
|
||||||
This package is also able to boot from local storage devices.
|
|
||||||
|
|
||||||
A bootloader-installer basically needs to copy the package content into the
|
|
||||||
bootloader-target directory, which will usually be the TFTP root, as
|
|
||||||
'grub-mknetdir' will be invoked already during the package creation.
|
|
||||||
|
|
||||||
Alternatively the bootloader-target directory can be a mounted EFI System
|
|
||||||
Partition (ESP), or a similar partition with a FAT file system, for booting
|
|
||||||
from local storage devices.
|
|
||||||
|
|
||||||
The name of the GRUB EFI binary will conform to the UEFI specification for
|
|
||||||
removable media. Depending on the system it will be e.g. bootx64.efi or
|
|
||||||
bootaa64.efi below SUBDIR.
|
|
||||||
|
|
||||||
The SUBDIR argument needs to be set to \"efi/boot\" to create a package which
|
|
||||||
conforms to the UEFI specification for removable media.
|
|
||||||
|
|
||||||
The SUBDIR argument defaults to \"efi/Guix\", as it is also the case for
|
|
||||||
'grub-efi-bootloader'."
|
|
||||||
(package
|
|
||||||
(name name)
|
|
||||||
(version (package-version grub-efi))
|
|
||||||
;; Source is not needed, but it cannot be omitted.
|
|
||||||
(source #f)
|
|
||||||
(build-system trivial-build-system)
|
|
||||||
(arguments
|
|
||||||
(let* ((system (string-split (nix-system->gnu-triplet
|
|
||||||
(or (%current-target-system)
|
|
||||||
(%current-system)))
|
|
||||||
#\-))
|
|
||||||
(arch (first system))
|
|
||||||
(boot-efi
|
|
||||||
(match system
|
|
||||||
;; These are the supportend systems and the names defined by
|
|
||||||
;; the UEFI standard for removable media.
|
|
||||||
(("i686" _ ...) "/bootia32.efi")
|
|
||||||
(("x86_64" _ ...) "/bootx64.efi")
|
|
||||||
(("arm" _ ...) "/bootarm.efi")
|
|
||||||
(("aarch64" _ ...) "/bootaa64.efi")
|
|
||||||
(("riscv" _ ...) "/bootriscv32.efi")
|
|
||||||
(("riscv64" _ ...) "/bootriscv64.efi")
|
|
||||||
;; Other systems are not supported, although defined.
|
|
||||||
;; (("riscv128" _ ...) "/bootriscv128.efi")
|
|
||||||
;; (("ia64" _ ...) "/bootia64.efi")
|
|
||||||
((_ ...) #f)))
|
|
||||||
(core-efi (string-append
|
|
||||||
;; This is the arch dependent file name of GRUB, e.g.
|
|
||||||
;; i368-efi/core.efi or arm64-efi/core.efi.
|
|
||||||
(match arch
|
|
||||||
("i686" "i386")
|
|
||||||
("aarch64" "arm64")
|
|
||||||
("riscv" "riscv32")
|
|
||||||
(_ arch))
|
|
||||||
"-efi/core.efi")))
|
|
||||||
(list
|
|
||||||
#:modules '((guix build utils))
|
|
||||||
#:builder
|
|
||||||
#~(begin
|
|
||||||
(use-modules (guix build utils))
|
|
||||||
(let* ((bootloader #$(this-package-input "grub-efi"))
|
|
||||||
(net-dir #$output)
|
|
||||||
(sub-dir (string-append net-dir "/" #$subdir "/"))
|
|
||||||
(boot-efi (string-append sub-dir #$boot-efi))
|
|
||||||
(core-efi (string-append sub-dir #$core-efi)))
|
|
||||||
;; Install GRUB, which refers to the grub.cfg, with support for
|
|
||||||
;; encrypted partitions,
|
|
||||||
(setenv "GRUB_ENABLE_CRYPTODISK" "y")
|
|
||||||
(invoke/quiet (string-append bootloader "/bin/grub-mknetdir")
|
|
||||||
(string-append "--net-directory=" net-dir)
|
|
||||||
(string-append "--subdir=" #$subdir)
|
|
||||||
;; These modules must be pre-loaded to allow booting
|
|
||||||
;; from an ESP or a similar partition with a FAT
|
|
||||||
;; file system.
|
|
||||||
(string-append "--modules=part_msdos part_gpt fat"))
|
|
||||||
;; Move GRUB's core.efi to the removable media name.
|
|
||||||
(false-if-exception (delete-file boot-efi))
|
|
||||||
(rename-file core-efi boot-efi))))))
|
|
||||||
(inputs (list grub-efi))
|
|
||||||
(synopsis (package-synopsis grub-efi))
|
|
||||||
(description (package-description grub-efi))
|
|
||||||
(home-page (package-home-page grub-efi))
|
|
||||||
(license (package-license grub-efi))))
|
|
||||||
|
|
||||||
(define-public syslinux
|
(define-public syslinux
|
||||||
(let ((commit "bb41e935cc83c6242de24d2271e067d76af3585c"))
|
(let ((commit "bb41e935cc83c6242de24d2271e067d76af3585c"))
|
||||||
(package
|
(package
|
||||||
|
|
Loading…
Reference in a new issue