summaryrefslogtreecommitdiff
path: root/gnu/packages/bootloaders.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/bootloaders.scm')
-rw-r--r--gnu/packages/bootloaders.scm255
1 files changed, 200 insertions, 55 deletions
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index c4b721c9f5..afde840823 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -17,11 +17,12 @@
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2022, 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;; Copyright © 2021 Stefan <stefan-guix@vodafonemail.de>
-;;; Copyright © 2022, 2023, 2024 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022, 2023, 2024 Maxim Cournoyer <maxim@guixotic.coop>
;;; Copyright © 2023-2024 Herman Rimm <herman@rimm.ee>
;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2024 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2025 Esther Flashner <esther@flashner.co.il>
+;;; Copyright © 2025 André Batista <nandre@riseup.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -108,9 +109,9 @@
(base32
"0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys"))))
-(define-public grub
+(define*-public (make-grub platform)
(package
- (name "grub")
+ (name (string-append "grub-" platform))
(version "2.12")
(source (origin
(method url-fetch)
@@ -140,7 +141,8 @@
;; calling the ‘true’ binary instead. Python is only needed during
;; bootstrapping (for genptl.py), not when building from a release.
#~(append
- (list "PYTHON=true")
+ (list "PYTHON=true"
+ (string-append "--with-platform=" #$platform))
;; This needs to be compiled with clang for powerpc64le.
(if #$(and=> (%current-target-system)
target-ppc64le?)
@@ -210,25 +212,20 @@
(substitute* "Makefile.in"
(("grub_cmd_date grub_cmd_set_date grub_cmd_sleep")
"grub_cmd_date grub_cmd_sleep"))))
- #$@(if (target-ppc64le?)
- #~((add-before 'check 'skip-tests
- (lambda _
- (substitute* "Makefile.in"
- ((" grub_cmd_date ") " ")
- ((" pseries_test ") " ")))))
- #~())
+ (add-before 'check 'skip-tests
+ (lambda _
+ (substitute* "Makefile.in"
+ ;; The grub_cmd_date sometimes fail (see:
+ ;; <https://savannah.gnu.org/bugs/index.php?67471>).
+ ((" grub_cmd_date ") " ")
+ ((" pseries_test ") " "))))
(add-before 'check 'disable-pixel-perfect-test
(lambda _
;; This test compares many screenshots rendered with an older
;; Unifont (9.0.06) than that packaged in Guix.
(substitute* "Makefile.in"
(("test_unset grub_func_test")
- "test_unset")))))
-
- ;; Disable tests on ARM and AARCH64 platforms or when cross-compiling.
- #:tests? (not (or (any (cute string-prefix? <> (%current-system))
- '("arm" "aarch64"))
- (%current-target-system)))))
+ "test_unset")))))))
(inputs
(append (list gettext-minimal freetype ncurses
@@ -315,18 +312,26 @@ menu to select one of the installed operating systems.")
(license license:gpl3+)
(properties '((cpe-name . "grub2")))))
+(define-public grub-pc
+ (package
+ (inherit (make-grub "pc"))
+ (supported-systems '("i686-linux" "x86_64-linux"
+ "i586-gnu" "x86_64-gnu"))))
+
+(define-public grub grub-pc)
+
(define-public grub-minimal
(package
- (inherit grub)
+ (inherit grub-pc)
(name "grub-minimal")
(inputs
- (modify-inputs (package-inputs grub)
+ (modify-inputs (package-inputs grub-pc)
(delete "lvm2" "mdadm" "fuse" "console-setup")))
(native-inputs
(modify-inputs (package-native-inputs grub)
(delete "help2man" "texinfo" "parted" "qemu" "qemu-minimal" "xorriso")))
(arguments
- (substitute-keyword-arguments (package-arguments grub)
+ (substitute-keyword-arguments (package-arguments grub-pc)
((#:tests? _ #t) #f)
((#:phases phases #~%standard-phases)
#~(modify-phases #$phases
@@ -341,12 +346,12 @@ menu to select one of the installed operating systems.")
(system* "gunzip" "unifont.bdf.gz")))))))))
(define-public grub-coreboot
+ (let ((base (make-grub "coreboot")))
(package
- (inherit grub)
- (name "grub-coreboot")
+ (inherit base)
(synopsis "GRand Unified Boot loader (Coreboot payload version)")
(arguments
- (substitute-keyword-arguments (package-arguments grub)
+ (substitute-keyword-arguments (package-arguments base)
((#:phases phases #~%standard-phases)
#~(modify-phases #$phases
(add-before 'check 'disable-broken-tests
@@ -399,17 +404,16 @@ menu to select one of the installed operating systems.")
"grub_cmd_tr"
"test_unset"
"file_filter_test")
- " "))))))
- ((#:configure-flags flags #~'())
- #~(cons* "--with-platform=coreboot" #$flags))))))
+ " "))))))))
+ (supported-systems '("i686-linux" "x86_64-linux")))))
(define-public grub-efi
+ (let ((base (make-grub "efi")))
(package
- (inherit grub)
- (name "grub-efi")
+ (inherit base)
(synopsis "GRand Unified Boot loader (UEFI version)")
(inputs
- (modify-inputs (package-inputs grub)
+ (modify-inputs (package-inputs base)
(prepend efibootmgr mtools)))
(native-inputs
(cond ((or (target-x86-64?)
@@ -417,7 +421,7 @@ menu to select one of the installed operating systems.")
(target-aarch64?)
(target-arm32?))
;; We add the firmware needed to run the tests.
- (modify-inputs (package-native-inputs grub)
+ (modify-inputs (package-native-inputs base)
(prepend
(cond ((target-x86-64?) ovmf-x86-64)
((target-x86-32?) ovmf-i686)
@@ -427,15 +431,14 @@ menu to select one of the installed operating systems.")
(else
;; The tests are skipped in this package so we remove some
;; test dependencies.
- (modify-inputs (package-native-inputs grub)
+ (modify-inputs (package-native-inputs base)
(delete "parted" "qemu-minimal" "xorriso")))))
(arguments
- (substitute-keyword-arguments (package-arguments grub)
+ (substitute-keyword-arguments (package-arguments base)
((#:tests? _ #f) (and (not (%current-target-system))
(this-package-native-input "qemu-minimal")))
((#:configure-flags flags #~'())
- #~(cons* "--with-platform=efi"
- #$@(if (string-prefix? "x86_64"
+ #~(cons* #$@(if (string-prefix? "x86_64"
(or (%current-target-system)
(%current-system)))
#~("--enable-stack-protector") ;EFI-only for now
@@ -445,7 +448,7 @@ menu to select one of the installed operating systems.")
#~(modify-phases #$phases
#$@(if (this-package-native-input "qemu-minimal")
#~((add-after 'patch-stuff 'patch-ovmf-path
- (lambda* (#:key inputs #:allow-other-keys)
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
(let ((arch #$(cond ((target-x86-64?) "x64")
((target-x86-32?) "ia32")
((target-aarch64?) "aarch64")
@@ -454,20 +457,24 @@ menu to select one of the installed operating systems.")
(substitute* "tests/util/grub-shell.in"
(("OVMF-ia32\\.fd")
(search-input-file
- inputs (string-append
- "/share/firmware/ovmf_" arch ".bin")))
+ (or native-inputs inputs)
+ (string-append
+ "/share/firmware/ovmf_" arch ".bin")))
(("OVMF\\.fd")
(search-input-file
- inputs (string-append
- "/share/firmware/ovmf_" arch ".bin")))
+ (or native-inputs inputs)
+ (string-append
+ "/share/firmware/ovmf_" arch ".bin")))
(("/usr/share/qemu-efi/QEMU_EFI\\.fd")
(search-input-file
- inputs (string-append
- "/share/firmware/ovmf_" arch ".bin")))
+ (or native-inputs inputs)
+ (string-append
+ "/share/firmware/ovmf_" arch ".bin")))
(("/usr/share/ovmf-arm/QEMU_EFI\\.fd")
(search-input-file
- inputs (string-append
- "/share/firmware/ovmf_" arch ".bin"))))))))
+ (or native-inputs inputs)
+ (string-append
+ "/share/firmware/ovmf_" arch ".bin"))))))))
#~())
(add-after 'patch-stuff 'use-absolute-efibootmgr-path
(lambda* (#:key inputs #:allow-other-keys)
@@ -485,7 +492,11 @@ menu to select one of the installed operating systems.")
(("\"mcopy\"")
(string-append "\""
(search-input-file inputs "/bin/mcopy")
- "\"")))))))))))
+ "\"")))))))))
+ ;; Check configure.ac for the list of supported EFI platforms.
+ (supported-systems '("i686-linux" "x86_64-linux"
+ "i586-gnu" "x86_64-gnu"
+ "armhf-linux" "aarch64-linux" "riscv64-linux")))))
(define-public grub-efi32
(package
@@ -539,13 +550,35 @@ menu to select one of the installed operating systems.")
(else (package-native-inputs grub-efi))))))
(define-public grub-emu
- (package/inherit grub
- (name "grub-emu")
- (synopsis "GRand Unified Boot loader (Emu version)")
- (arguments
- (substitute-keyword-arguments (package-arguments grub)
- ((#:configure-flags flags #~'())
- #~(cons* "--with-platform=emu" #$flags))))))
+ (package
+ (inherit (make-grub "emu"))
+ (synopsis "GRand Unified Boot loader (Emu version)")))
+
+(define-public grub-ieee1275
+ (package
+ (inherit (make-grub "ieee1275"))
+ (synopsis "GRand Unified Boot loader (ieee1275 version)")
+ (supported-systems '("i686-linux" "x86_64-linux"
+ "i586-gnu" "x86_64-gnu"
+ "powerpc-linux" "powerpc64le-linux"))))
+
+(define-public grub-qemu
+ (package
+ (inherit (make-grub "qemu"))
+ (synopsis "GRand Unified Boot loader (qemu version)")
+ (supported-systems '("i686-linux" "x86_64-linux"
+ "i586-gnu" "x86_64-gnu"))))
+
+(define-public grub-uboot
+ (let ((base (make-grub "uboot")))
+ (package
+ (inherit base)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ;; Running the tests isn't supported for this grub platform.
+ ((#:tests? _ #t) #f)))
+ (synopsis "GRand Unified Boot loader (u-boot version)")
+ (supported-systems '("armhf-linux")))))
;; Because grub searches hardcoded paths it's easiest to just build grub
;; again to make it find both grub-pc and grub-efi. There is a command
@@ -1040,6 +1073,7 @@ CONFIG_TOOLS_KWBIMAGE=n")
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(invoke "./u_boot_pylib")))))))
+ (native-inputs (list python-setuptools))
(synopsis "U-Boot Python library")
(description "This package provides common Python code used by some of the
commands part of the U-Boot project, such as Patman.")))
@@ -1075,6 +1109,7 @@ commands part of the U-Boot project, such as Patman.")))
,(dirname (search-input-file
inputs
"libexec/git-core/git-send-email"))))))))))
+ (native-inputs (list python-setuptools))
(inputs
(list git
`(,git "send-email")
@@ -1491,6 +1526,9 @@ Documentation} for more information (for example by running @samp{info
(define-public u-boot-firefly-rk3399
(make-u-boot-rockchip-package "firefly" 'rk3399))
+(define-public u-boot-rock-4c-plus-rk3399
+ (make-u-boot-rockchip-package "rock-4c-plus" 'rk3399))
+
(define-public u-boot-rockpro64-rk3399
(let ((base (make-u-boot-rockchip-package
"rockpro64" 'rk3399
@@ -1939,9 +1977,9 @@ order to add a suitable bootloader menu entry.")
;;
;; TODO: Bump this timestamp at each modifications of the package (not only
;; for updates) by running: date +%s.
- (let ((timestamp "1733491642")
- (commit "24db39fb2983ca83ab5c6ee37cb57a4f7f6f94e6")
- (revision "3"))
+ (let ((timestamp "1756877872")
+ (commit "969ce2c559a6841a949a1b73a3967b1889e0c999")
+ (revision "4"))
(package
(name "ipxe")
(version (git-version "1.21.1" revision commit))
@@ -1953,7 +1991,7 @@ order to add a suitable bootloader menu entry.")
(file-name (git-file-name name version))
(sha256
(base32
- "0b2h4bsdgnyjna6piwfqqn985vqfjmbz80jh0n7hrnncp2v53qj6"))))
+ "0ijgc9w0az2zb5w5zlzfxjqizhx8fxc2rgq47wgbpka0ssindlvb"))))
(build-system gnu-build-system)
(arguments
(list
@@ -2031,6 +2069,13 @@ order to add a suitable bootloader menu entry.")
"/share/syslinux \\\n"
all))))))
#~())
+ #$@(if (target-x86-32?)
+ ;; Otherwise (u)int64 assertion failure on this arch.
+ ;; See <https://github.com/ipxe/ipxe/issues/1506>
+ #~((add-after 'enter-source-directory 'fix-x86-align
+ (lambda _
+ (setenv "HOST_EFI_CFLAGS" "-malign-double"))))
+ #~())
(delete 'configure) ; no configure script
(replace 'install
(lambda _
@@ -2154,3 +2199,103 @@ the features of iPXE without the hassle of reflashing.")
"-o" (string-append firmware
"/efi-" name ".rom")))))
'#$roms)))))))))))
+
+(define-public refind
+ (package
+ (name "refind")
+ (version "0.14.2")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/refind/" version
+ "/refind-src-" version ".tar.gz"))
+ (sha256
+ (base32
+ "1w682p0j59apjcy26xzzhv70fyd8nqjs47i8cz2qcsx71pl3rngp"))
+ (snippet
+ #~(begin
+ (use-modules (guix build utils))
+ (delete-file-recursively
+ "refind/tools_x64/gptsync_x64.efi")))))
+ (build-system gnu-build-system)
+ (outputs '("out" "doc"))
+ (native-inputs
+ (list binutils))
+ (inputs
+ (list gnu-efi))
+ (arguments
+ (list #:tests? #f ; no tests
+ #:make-flags
+ #~(list ;; Make build reproducible.
+ ;; Also disables secure boot anti-rollback protection.
+ ;; Otherwise, "objcopy --add-section" would change the
+ ;; timestamp inside the EFI file.
+ "OMIT_SBAT=1"
+ (string-append "AR=" #$(ar-for-target))
+ (string-append "CC=" #$(cc-for-target))
+ (string-append "LD=" #$(ld-for-target))
+ (string-append "EFIINC=" (assoc-ref %build-inputs "gnu-efi")
+ "/include/efi")
+ (string-append "GNUEFILIB=" (assoc-ref %build-inputs "gnu-efi")
+ "/lib")
+ (string-append "EFILIB=" (assoc-ref %build-inputs "gnu-efi")
+ "/lib")
+ (string-append "EFICRT0=" (assoc-ref %build-inputs "gnu-efi")
+ "/lib")
+ (string-append "OBJCOPY=" (assoc-ref %build-inputs "binutils")
+ "/bin/objcopy"))
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-after 'build 'build-fs
+ (lambda* (#:key inputs make-flags #:allow-other-keys)
+ (apply invoke "make" "fs" make-flags)))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out-sbin (string-append #$output "/sbin"))
+ (out-share
+ (string-append #$output "/share/refind-"
+ #$version))
+ (out-share-refind
+ (string-append out-share "/refind")))
+ (mkdir-p out-share)
+ (copy-recursively "banners"
+ (string-append out-share "/banners"))
+ (copy-recursively "fonts"
+ (string-append out-share "/fonts"))
+ (for-each (lambda (name)
+ (copy-recursively name
+ (string-append
+ out-share-refind "/"
+ name)))
+ (find-files "." "^drivers_" #:directories? #t))
+ (copy-recursively "icons"
+ (string-append out-share-refind "/icons"))
+ ;(copy-recursively "keys" "/etc/refind.d")
+ (install-file "mkrlconf" out-sbin)
+ (install-file "mvrefind" out-sbin)
+ (install-file "refind-sb-healthcheck" out-sbin)
+ (install-file "refind-install" out-share)
+ (install-file "refind-mkdefault" out-sbin)
+ (install-file "refind.conf-sample" out-share-refind)
+ (for-each
+ (lambda (name)
+ (install-file name
+ (string-append #$output "/share/man/man8")))
+ (find-files "docs/man" "[.]8$"))
+ (for-each (lambda (f)
+ (install-file f out-share-refind))
+ (find-files "refind" "refind.*\\.efi$")))))
+ (add-after 'install 'install-doc
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out-doc
+ (string-append #$output:doc "/share/doc/refind-"
+ #$version)))
+ (copy-recursively "docs/refind"
+ (string-append out-doc "/refind"))
+ (copy-recursively "docs/Styles"
+ (string-append out-doc "/Styles"))))))))
+ (synopsis "rEFInd boot manager")
+ (description "This package provides a boot manager that is an EFI
+program.")
+ (home-page "https://www.rodsbooks.com/refind/")
+ (license license:gpl3+)))