;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016, 2017 Danny Milosavljevic <dannym@scratchpost.org>
;;; Copyright © 2016, 2017 David Craven <david@craven.ch>
;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 nee <nee@cock.li>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
#:use-module (gnu packages bison)
#:use-module (gnu packages cdrom)
#:use-module (gnu packages check)
+ #:use-module (gnu packages compression)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages disk)
#:use-module (gnu packages firmware)
#:use-module (gnu packages swig)
#:use-module (gnu packages valgrind)
#:use-module (gnu packages virtualization)
+ #:use-module (gnu packages xorg)
#:use-module (gnu packages web)
#:use-module (guix build-system gnu)
#:use-module (guix download)
(define-public grub
(package
(name "grub")
- (version "2.02")
+ (version "2.04")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/grub/grub-" version ".tar.xz"))
(sha256
(base32
- "03vvdfhdmf16121v7xs8is2krwnv15wpkhkf16a4yf8nsfc3f2w1"))
- (patches (search-patches "grub-check-error-efibootmgr.patch"
- "grub-binutils-compat.patch"))))
+ "0zgp5m3hmc9jh8wpjx6czzkh5id2y8n1k823x2mjvm2sk6b28ag5"))
+ (patches (search-patches "grub-efi-fat-serial-number.patch"))))
(build-system gnu-build-system)
(arguments
- `(#:phases (modify-phases %standard-phases
+ `(#:configure-flags
+ ;; Counterintuitively, this *disables* a spurious Python dependency by
+ ;; calling the ‘true’ binary instead. Python is only needed during
+ ;; bootstrapping (for genptl.py), not when building from a release.
+ (list "PYTHON=true")
+ #:phases (modify-phases %standard-phases
(add-after 'unpack 'patch-stuff
- (lambda* (#:key inputs #:allow-other-keys)
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
(substitute* "grub-core/Makefile.in"
(("/bin/sh") (which "sh")))
"/sbin/mdadm\"")))
;; Make the font visible.
- (copy-file (assoc-ref inputs "unifont") "unifont.bdf.gz")
+ (copy-file (assoc-ref (or native-inputs inputs)
+ "unifont")
+ "unifont.bdf.gz")
(system* "gunzip" "unifont.bdf.gz")
+
+ ;; Give the absolute file name of 'ckbcomp'.
+ (substitute* "util/grub-kbdcomp.in"
+ (("^ckbcomp ")
+ (string-append (assoc-ref inputs "console-setup")
+ "/bin/ckbcomp ")))
#t))
(add-before 'check 'disable-flaky-test
(lambda _
(substitute* "Makefile.in"
(("grub_cmd_date grub_cmd_set_date grub_cmd_sleep")
"grub_cmd_date grub_cmd_sleep"))
+ #t))
+ (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"))
#t)))
;; Disable tests on ARM and AARCH64 platforms.
#:tests? ,(not (any (cute string-prefix? <> (or (%current-target-system)
;; to determine whether the root file system is RAID.
("mdadm" ,mdadm)
+ ;; Console-setup's ckbcomp is invoked by grub-kbdcomp. It is required
+ ;; for generating alternative keyboard layouts.
+ ("console-setup" ,console-setup)
+
+ ;; Needed for ‘grub-mount’, the only reliable way to tell whether a given
+ ;; file system will be readable by GRUB without rebooting.
+ ("fuse" ,fuse)
+
("freetype" ,freetype)
;; ("libusb" ,libusb)
- ;; ("fuse" ,fuse)
("ncurses" ,ncurses)))
(native-inputs
`(("pkg-config" ,pkg-config)
(delete 'configure)
(add-before 'build 'set-permissions
(lambda _
- (zero? (system* "chmod" "a+w" "utils/isohybrid.in"))))
+ (invoke "chmod" "a+w" "utils/isohybrid.in")))
(replace 'check
(lambda _
(setenv "CC" "gcc")
(substitute* "tests/unittest/include/unittest/unittest.h"
;; Don't look up headers under /usr.
(("/usr/include/") ""))
- (zero? (system* "make" "unittest")))))))
- (home-page "http://www.syslinux.org")
+ (invoke "make" "unittest"))))))
+ (home-page "https://www.syslinux.org")
(synopsis "Lightweight Linux bootloader")
(description "Syslinux is a lightweight Linux bootloader.")
+ ;; The Makefile specifically targets i386 and x86_64 using nasm.
+ (supported-systems '("i686-linux" "x86_64-linux"))
(license (list license:gpl2+
license:bsd-3 ; gnu-efi/*
license:bsd-4 ; gnu-efi/inc/* gnu-efi/lib/*
(define-public dtc
(package
(name "dtc")
- (version "1.4.7")
+ (version "1.5.1")
(source (origin
(method url-fetch)
(uri (string-append
"dtc-" version ".tar.xz"))
(sha256
(base32
- "1rydi5jvhlhsr110h6n0pavv3daqa0cb4m5vcps50qzq1zqfhhv6"))))
+ "07q3mdsvl4smbiakriq3hnsyyd0q344lsm306q0kgz4hjq1p82v6"))))
(build-system gnu-build-system)
(native-inputs
`(("bison" ,bison)
("flex" ,flex)
+ ("libyaml" ,libyaml)
+ ("pkg-config" ,pkg-config)
("swig" ,swig)
("valgrind" ,valgrind)))
(inputs
(arguments
`(#:make-flags
(list "CC=gcc"
+
+ ;; /bin/fdt{get,overlay,put} need help finding libfdt.so.1.
+ (string-append "LDFLAGS=-Wl,-rpath="
+ (assoc-ref %outputs "out") "/lib")
+
(string-append "PREFIX=" (assoc-ref %outputs "out"))
(string-append "SETUP_PREFIX=" (assoc-ref %outputs "out"))
"INSTALL=install")
(define u-boot
(package
(name "u-boot")
- (version "2018.07")
+ (version "2019.04")
(source (origin
(method url-fetch)
(uri (string-append
"u-boot-" version ".tar.bz2"))
(sha256
(base32
- "1m7nw64mxflpc6sqvnz2kb5fxfkb4mrpy8b1wi15dcwipj4dy44z"))))
+ "1vwv4bgbl7fjcm073zrphn17hnz5h5h778f88ivdsgbb2lnpgdvn"))
+ (patches
+ (search-patches
+ "u-boot-fix-mkimage-header-verification.patch"))))
(native-inputs
`(("bc" ,bc)
("bison" ,bison)
("dtc" ,dtc)
("flex" ,flex)
- ("openssl" ,openssl)
+ ("lz4" ,lz4)
("python-2" ,python-2)
("python2-coverage" ,python2-coverage)
("python2-pytest" ,python2-pytest)
("sdl" ,sdl)
("swig" ,swig)))
(build-system gnu-build-system)
- (home-page "http://www.denx.de/wiki/U-Boot/")
+ (home-page "https://www.denx.de/wiki/U-Boot/")
(synopsis "ARM bootloader")
(description "U-Boot is a bootloader used mostly for ARM boards. It
also initializes the boards (RAM etc).")
(license license:gpl2+)))
+(define u-boot-2019.10
+ (package
+ (inherit u-boot)
+ (version "2019.10")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append
+ "ftp://ftp.denx.de/pub/u-boot/"
+ "u-boot-" version ".tar.bz2"))
+ (sha256
+ (base32
+ "053hcrwwlacqh2niisn0zas95zkbffw5aw5sdhixs8lmfdq60vcd"))))))
+
(define-public u-boot-tools
(package
(inherit u-boot)
(("/bin/false") (which "false")))
(substitute* "tools/dtoc/fdt_util.py"
(("'cc'") "'gcc'"))
+ (substitute* "tools/patman/test_util.py"
+ ;; python-coverage is simply called coverage in guix.
+ (("python-coverage") "coverage")
+ ;; XXX Allow for only 99% test coverage.
+ ;; TODO: Find out why that is needed.
+ (("if coverage != '100%':") "if not int(coverage.rstrip('%')) >= 99:"))
(substitute* "test/run"
;; Make it easier to find test failures.
(("#!/bin/bash") "#!/bin/bash -x")
(("def test_ctrl_c")
"@pytest.mark.skip(reason='Guix has problems with SIGINT')
def test_ctrl_c"))
- (substitute* "tools/binman/binman.py"
- (("100%") "99%")) ; TODO: Find out why that is needed.
+ ;; Test against the tools being installed rather than tools built
+ ;; for "sandbox" target.
+ (substitute* "test/image/test-imagetools.sh"
+ (("BASEDIR=sandbox") "BASEDIR=."))
+ (for-each (lambda (file)
+ (substitute* file
+ ;; Disable signatures, due to GPL/Openssl
+ ;; license incompatibilities. See
+ ;; https://bugs.gnu.org/34717 for details.
+ (("CONFIG_FIT_SIGNATURE=y") "CONFIG_FIT_SIGNATURE=n")
+ ;; This test requires a sound system, which is un-used
+ ;; in u-boot-tools.
+ (("CONFIG_SOUND=y") "CONFIG_SOUND=n")))
+ (find-files "configs" "sandbox_.*defconfig$"))
#t))
(replace 'configure
(lambda* (#:key make-flags #:allow-other-keys)
(delete 'check)
(add-after 'install 'check
(lambda* (#:key make-flags test-target #:allow-other-keys)
- (apply invoke "make" "mrproper" make-flags)
- (setenv "SDL_VIDEODRIVER" "dummy")
- (setenv "PAGER" "cat")
- (apply invoke "make" test-target make-flags)
- (symlink "build-sandbox_spl" "sandbox")
- (invoke "test/image/test-imagetools.sh"))))))
+ (invoke "test/image/test-imagetools.sh")))
+ ;; Only run full test suite on x86_64 systems, as many tests
+ ;; assume x86_64.
+ ,@(if (string-match "^x86_64-linux"
+ (or (%current-target-system)
+ (%current-system)))
+ '((add-after 'check 'check-x86
+ (lambda* (#:key make-flags test-target #:allow-other-keys)
+ (apply invoke "make" "mrproper" make-flags)
+ (setenv "SDL_VIDEODRIVER" "dummy")
+ (setenv "PAGER" "cat")
+ (apply invoke "make" test-target make-flags))))
+ '()))))
(description "U-Boot is a bootloader used mostly for ARM boards. It
also initializes the boards (RAM etc). This package provides its
board-independent tools.")))
(define-public (make-u-boot-package board triplet)
"Returns a u-boot package for BOARD cross-compiled for TRIPLET."
- (let ((same-arch? (if (string-prefix? (%current-system)
- (gnu-triplet->nix-system triplet))
- `#t
- `#f)))
+ (let ((same-arch? (lambda ()
+ (string=? (%current-system)
+ (gnu-triplet->nix-system triplet)))))
(package
(inherit u-boot)
(name (string-append "u-boot-"
(string-replace-substring (string-downcase board)
"_" "-")))
(native-inputs
- `(,@(if (not same-arch?)
- `(("cross-gcc" ,(cross-gcc triplet #:xgcc gcc-7))
+ `(,@(if (not (same-arch?))
+ `(("cross-gcc" ,(cross-gcc triplet))
("cross-binutils" ,(cross-binutils triplet)))
- `(("gcc-7" ,gcc-7)))
+ `())
,@(package-native-inputs u-boot)))
(arguments
`(#:modules ((ice-9 ftw)
#:test-target "test"
#:make-flags
(list "HOSTCC=gcc"
- ,@(if (not same-arch?)
+ ,@(if (not (same-arch?))
`((string-append "CROSS_COMPILE=" ,triplet "-"))
'()))
#:phases
(lambda* (#:key outputs make-flags #:allow-other-keys)
(let ((config-name (string-append ,board "_defconfig")))
(if (file-exists? (string-append "configs/" config-name))
- (zero? (apply system* "make" `(,@make-flags ,config-name)))
+ (apply invoke "make" `(,@make-flags ,config-name))
(begin
(display "Invalid board name. Valid board names are:"
(current-error-port))
(define-public u-boot-malta
(make-u-boot-package "malta" "mips64el-linux-gnuabi64"))
-(define-public u-boot-beagle-bone-black
- (make-u-boot-package "am335x_boneblack" "arm-linux-gnueabihf"))
+(define-public u-boot-am335x-boneblack
+ (let ((base (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf")))
+ (package
+ (inherit base)
+ (name "u-boot-am335x-boneblack")
+ (description "U-Boot is a bootloader used mostly for ARM boards. It
+also initializes the boards (RAM etc).
-(define-public u-boot-pine64-plus
- (let ((base (make-u-boot-package "pine64_plus" "aarch64-linux-gnu")))
+This U-Boot is built for the BeagleBone Black, which was removed upstream,
+adjusted from the am335x_evm build with several device trees removed so that
+it fits within common partitioning schemes.")
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'patch-defconfig
+ ;; Patch out other devicetrees to build image small enough to
+ ;; fit within typical partitioning schemes where the first
+ ;; partition begins at sector 2048.
+ (lambda _
+ (substitute* "configs/am335x_evm_defconfig"
+ (("CONFIG_OF_LIST=.*$") "CONFIG_OF_LIST=\"am335x-evm am335x-boneblack\"\n"))
+ #t)))))))))
+
+(define-public u-boot-am335x-evm
+ (make-u-boot-package "am335x_evm" "arm-linux-gnueabihf"))
+
+(define-public (make-u-boot-sunxi64-package board triplet)
+ (let ((base (make-u-boot-package board triplet)))
(package
(inherit base)
(arguments
((#:phases phases)
`(modify-phases ,phases
(add-after 'unpack 'set-environment
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((bl31 (string-append (assoc-ref inputs "firmware")
- "/bl31.bin")))
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (let ((bl31
+ (string-append
+ (assoc-ref (or native-inputs inputs) "firmware")
+ "/bl31.bin")))
(setenv "BL31" bl31)
;; This is necessary when we're using the bundled dtc.
;(setenv "PATH" (string-append (getenv "PATH") ":"
)
#t))))))
(native-inputs
- `(("firmware" ,arm-trusted-firmware-pine64-plus)
+ `(("firmware" ,arm-trusted-firmware-sun50i-a64)
,@(package-native-inputs base))))))
-(define-public u-boot-banana-pi-m2-ultra
+(define-public u-boot-pine64-plus
+ (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
+
+(define-public u-boot-pine64-lts
+ (make-u-boot-sunxi64-package "pine64-lts" "aarch64-linux-gnu"))
+
+(define-public u-boot-pinebook
+ (make-u-boot-sunxi64-package "pinebook" "aarch64-linux-gnu"))
+
+(define-public u-boot-bananapi-m2-ultra
(make-u-boot-package "Bananapi_M2_Ultra" "arm-linux-gnueabihf"))
(define-public u-boot-a20-olinuxino-lime
(make-u-boot-package "mx6cuboxi" "arm-linux-gnueabihf"))
(define-public u-boot-novena
- (make-u-boot-package "novena" "arm-linux-gnueabihf"))
+ (let ((base (make-u-boot-package "novena" "arm-linux-gnueabihf")))
+ (package
+ (inherit base)
+ (description "U-Boot is a bootloader used mostly for ARM boards. It
+also initializes the boards (RAM etc).
+
+This U-Boot is built for Novena. Be advised that this version, contrary
+to Novena upstream, does not load u-boot.img from the first partition.")
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'patch-novena-defconfig
+ ;; Patch configuration to disable loading u-boot.img from FAT partition,
+ ;; allowing it to be installed at a device offset.
+ (lambda _
+ (substitute* "configs/novena_defconfig"
+ (("CONFIG_SPL_FS_FAT=y") "# CONFIG_SPL_FS_FAT is not set"))
+ #t)))))))))
(define-public u-boot-cubieboard
(make-u-boot-package "Cubieboard" "arm-linux-gnueabihf"))
("firmware-m0" ,rk3399-cortex-m0)
,@(package-native-inputs base))))))
+(define-public u-boot-rock64-rk3328
+ (let ((base (make-u-boot-package "rock64-rk3328" "aarch64-linux-gnu")))
+ (package
+ (inherit base)
+ (version (package-version u-boot-2019.10))
+ (source (package-source u-boot-2019.10))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((bl31 (string-append (assoc-ref inputs "firmware")
+ "/bl31.elf")))
+ (setenv "BL31" bl31))
+ #t))
+ (add-after 'unpack 'add-u-boot-itb
+ (lambda _
+ (substitute* "Kconfig"
+ (("default .u-boot.itb. if SPL_LOAD_FIT && .ROCKCHIP_RK3399")
+ "default \"u-boot.itb\" if SPL_LOAD_FIT && (ARCH_ROCKCHIP"))
+ #t))))))
+ (native-inputs
+ `(("firmware" ,arm-trusted-firmware-rk3328)
+ ,@(package-native-inputs base))))))
+
+(define-public u-boot-firefly-rk3399
+ (let ((base (make-u-boot-package "firefly-rk3399" "aarch64-linux-gnu")))
+ (package
+ (inherit base)
+ (version (package-version u-boot-2019.10))
+ (source (package-source u-boot-2019.10))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "BL31" (string-append (assoc-ref inputs "firmware")
+ "/bl31.elf"))
+ #t))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
+ (native-inputs
+ `(("firmware" ,arm-trusted-firmware-rk3399)
+ ,@(package-native-inputs base))))))
+
+(define-public u-boot-rockpro64-rk3399
+ (let ((base (make-u-boot-package "rockpro64-rk3399" "aarch64-linux-gnu")))
+ (package
+ (inherit base)
+ (version (package-version u-boot-2019.10))
+ (source (package-source u-boot-2019.10))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "BL31" (string-append (assoc-ref inputs "firmware")
+ "/bl31.elf"))
+ #t))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
+ (native-inputs
+ `(("firmware" ,arm-trusted-firmware-rk3399)
+ ,@(package-native-inputs base))))))
+
(define-public vboot-utils
(package
(name "vboot-utils")
(file-name (string-append name "-" version "-checkout"))
(sha256
(base32
- "0h0m3l69vp9dr6xrs1p6y7ilkq3jq8jraw2z20kqfv7lvc9l1lxj"))))
+ "0h0m3l69vp9dr6xrs1p6y7ilkq3jq8jraw2z20kqfv7lvc9l1lxj"))
+ (patches
+ (search-patches "vboot-utils-skip-test-workbuf.patch"
+ "vboot-utils-fix-tests-show-contents.patch"
+ "vboot-utils-fix-format-load-address.patch"))))
(build-system gnu-build-system)
(arguments
`(#:make-flags (list "CC=gcc"
+ ;; On ARM, we must pass "HOST_ARCH=arm" so that the
+ ;; ${HOST_ARCH} and ${ARCH} variables in the makefile
+ ;; match. Otherwise, ${HOST_ARCH} will be assigned
+ ;; "armv7l", the value of `uname -m`, and will not
+ ;; match ${ARCH}, which will make the tests require
+ ;; QEMU for testing.
+ ,@(if (string-prefix? "arm"
+ (or (%current-target-system)
+ (%current-system)))
+ '("HOST_ARCH=arm")
+ '())
(string-append "DESTDIR=" (assoc-ref %outputs "out")))
#:phases (modify-phases %standard-phases
(add-after 'unpack 'patch-hard-coded-paths
".drv-0/source")))
;; Tests require write permissions to many of these files.
(for-each make-file-writable (find-files "tests/futility"))
- #t)))
+ #t))
+ (add-after 'install 'install-devkeys
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (share (string-append out "/share/vboot-utils")))
+ (copy-recursively "tests/devkeys"
+ (string-append share "/devkeys"))
+ #t))))
#:test-target "runtests"))
(native-inputs
`(("pkg-config" ,pkg-config)
(define-public os-prober
(package
(name "os-prober")
- (version "1.76")
+ (version "1.77")
(source
(origin
(method url-fetch)
version ".tar.xz"))
(sha256
(base32
- "1vb45i76bqivlghrq7m3n07qfmmq4wxrkplqx8gywj011rhq19fk"))))
+ "0pvhrw4h05n21zw7ig3a3bi8aqdh6zxs0x1znz4g7vhspsps93ld"))))
(build-system gnu-build-system)
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build utils)
- (ice-9 regex) ; for string-match
- (srfi srfi-26)) ; for cut
+ (ice-9 regex) ; for string-match
+ (srfi srfi-26)) ; for cut
#:make-flags (list "CC=gcc")
- #:tests? #f ; no tests
+ #:tests? #f ; no tests
#:phases
(modify-phases %standard-phases
(replace 'configure