;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
;;; 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.
;;;
(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"
- "grub-efi-fat-serial-number.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* "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)
;; 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)
(define-public dtc
(package
(name "dtc")
- (version "1.5.0")
+ (version "1.5.1")
(source (origin
(method url-fetch)
(uri (string-append
"dtc-" version ".tar.xz"))
(sha256
(base32
- "0wh10p42hf5403ipvs0dsxddb6kzfyk2sq4fgid9zqzpr51y8wn6"))))
+ "07q3mdsvl4smbiakriq3hnsyyd0q344lsm306q0kgz4hjq1p82v6"))))
(build-system gnu-build-system)
(native-inputs
`(("bison" ,bison)
(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")
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)
(("def test_ctrl_c")
"@pytest.mark.skip(reason='Guix has problems with SIGINT')
def test_ctrl_c"))
+ ;; 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
(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
((#: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") ":"
(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"))
("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")