[PATCH 0/9] Improvements to our u-boot tooling

  • Done
  • quality assurance status badge
Details
3 participants
  • Maxim Cournoyer
  • Ricardo Wurmus
  • Vagrant Cascadian
Owner
unassigned
Submitted by
Maxim Cournoyer
Severity
normal
Blocked by
M
M
Maxim Cournoyer wrote on 20 Dec 2022 17:50
(address . guix-patches@gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20221220165038.25114-1-maxim.cournoyer@gmail.com
This series include a few changes that were useful or needed to build U-Boot
for the i.MX6, notably installation of the u-boot.imx image. It also cleans up
things for cross-compilation, no longer explicitly adding cross-gcc and
cross-binutils, leaving the build system taking care of that.

The two first commits of this series were previously submitted as #59761, now
extracted and submitted here for transparency, with fixes for impacted u-boot
packages that broke because the move to use gexps.


Maxim Cournoyer (9):
gnu: make-u-boot-package: Add a u-boot argument and use gexps.
gnu: make-u-boot-package: Install .imx files.
gnu: make-uboot-package: Simplify build.
gnu: u-boot-pinebook-pro-rk3399: Remove input labels and use gexps.
gnu: u-boot-firefly-rk3399: Use gexps and fix cross-build.
gnu: make-u-boot-sunxi64-package: Use gexps and adjust file name.
gnu: u-boot-rock64-rk3328: Fix build.
gnu: u-boot-sifive-unmatched: Use gexps and remove inputs.
gnu: u-boot-puma-rk3399: Use make-u-boot-sunxi64-package.

gnu/packages/bootloaders.scm | 295 +++++++++++++++++------------------
1 file changed, 144 insertions(+), 151 deletions(-)


base-commit: 1a3d8b922863c22f612ea679d9419bb457874fdf
--
2.38.1
M
M
Maxim Cournoyer wrote on 20 Dec 2022 19:34
[PATCH 1/9] gnu: make-u-boot-package: Add a u-boot argument and use gexps.
(address . 60224@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20221220183427.31752-2-maxim.cournoyer@gmail.com
And have that u-boot argument used as the complete base of the template, so
that a user can override it.

* gnu/packages/bootloaders.scm (make-u-boot-package): New U-BOOT argument.
Document it.
[native-inputs]: Move the native-inputs of U-BOOT first, so that the
cross compilation tools can be overridden via U-BOOT.
[arguments]: Rewrite using substitute-keyword-arguments, extending rather than
overriding most arguments. Use gexps.

---

gnu/packages/bootloaders.scm | 182 +++++++++++++++++++----------------
1 file changed, 98 insertions(+), 84 deletions(-)

Toggle diff (215 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index b968ecd441..42f859c362 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -17,6 +17,7 @@
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;; Copyright © 2021 Stefan <stefan-guix@vodafonemail.de>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -782,11 +783,13 @@ (define*-public (make-u-boot-package board triplet
defconfig
configs
name-suffix
- append-description)
+ append-description
+ (u-boot u-boot))
"Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
optional DEFCONFIG file and optional configuration changes from CONFIGS.
NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
-appended to the package description."
+appended to the package description. U-BOOT can be used when a fork or a
+different version of U-Boot must be used."
(let ((same-arch? (lambda ()
(string=? (%current-system)
(gnu-triplet->nix-system triplet)))))
@@ -801,91 +804,102 @@ (define*-public (make-u-boot-package board triplet
"\n\n" append-description)
(package-description u-boot)))
(native-inputs
- `(,@(if (not (same-arch?))
+ ;; Note: leave the native u-boot inputs first, so that a user can
+ ;; override the cross-gcc and cross-binutils packages.
+ `(,@(package-native-inputs u-boot)
+ ,@(if (not (same-arch?))
`(("cross-gcc" ,(cross-gcc triplet))
("cross-binutils" ,(cross-binutils triplet)))
- `())
- ,@(package-native-inputs u-boot)))
+ `())))
(arguments
- `(#:modules ((ice-9 ftw)
- (srfi srfi-1)
- (guix build gnu-build-system)
- (guix build kconfig)
- (guix build utils))
- #:imported-modules (,@%gnu-build-system-modules
- (guix build kconfig))
- #:test-target "test"
- #:make-flags
- (list "HOSTCC=gcc"
- "KBUILD_VERBOSE=1"
- ,@(if (not (same-arch?))
- `((string-append "CROSS_COMPILE=" ,triplet "-"))
- '()))
- #:phases
- (modify-phases %standard-phases
- (replace 'configure
- (lambda* (#:key outputs make-flags #:allow-other-keys)
- (let* ((config-name (string-append ,board "_defconfig"))
- (config-file (string-append "configs/" config-name))
- (defconfig ,defconfig)
- (configs ',configs))
- (when defconfig
- ;; Replace the board-specific defconfig with the given one.
- (copy-file defconfig config-file))
- (if (file-exists? config-file)
- (begin
- (when configs
- (modify-defconfig config-file configs))
- (apply invoke "make" `(,@make-flags ,config-name))
- (verify-config ".config" config-file))
- (begin
- (display "invalid board name; valid board names are:"
- (current-error-port))
- (let ((suffix-len (string-length "_defconfig"))
- (entries (scandir "configs")))
- (for-each (lambda (file-name)
- (when (string-suffix? "_defconfig" file-name)
- (format (current-error-port)
- "- ~A\n"
- (string-drop-right file-name
- suffix-len))))
- (sort entries string-ci<)))
- (error "invalid boardname ~s" ,board))))))
- (add-after 'configure 'disable-tools-libcrypto
- ;; Disable libcrypto due to GPL and OpenSSL license
- ;; incompatibilities
- (lambda _
- (substitute* ".config"
- (("CONFIG_TOOLS_LIBCRYPTO=.*$") "CONFIG_TOOLS_LIBCRYPTO=n"))))
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (libexec (string-append out "/libexec"))
- (uboot-files (append
- (remove
- ;; Those would not be reproducible
- ;; because of the randomness used
- ;; to produce them.
- ;; It's expected that the user will
- ;; use u-boot-tools to generate them
- ;; instead.
- (lambda (name)
- (string-suffix?
- "sunxi-spl-with-ecc.bin"
- name))
- (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
- (find-files "." "^(MLO|SPL)$"))))
- (mkdir-p libexec)
- (install-file ".config" libexec)
- ;; Useful for "qemu -kernel".
- (install-file "u-boot" libexec)
- (for-each
- (lambda (file)
- (let ((target-file (string-append libexec "/" file)))
- (mkdir-p (dirname target-file))
- (copy-file file target-file)))
- uboot-files)
- #t)))))))))
+ (substitute-keyword-arguments (package-arguments u-boot)
+ ((#:modules modules '())
+ `((ice-9 ftw)
+ (srfi srfi-1)
+ (guix build gnu-build-system)
+ (guix build kconfig)
+ (guix build utils)
+ ,@modules))
+ ((#:imported-modules imported-modules '())
+ `((guix build kconfig)
+ ,@%gnu-build-system-modules
+ ,@imported-modules))
+ ((#:test-target _ "test")
+ "test")
+ ((#:make-flags make-flags '())
+ #~(list "HOSTCC=gcc"
+ "KBUILD_VERBOSE=1"
+ #$@(if (not (same-arch?))
+ (list (string-append "CROSS_COMPILE=" triplet "-"))
+ '())
+ #$@make-flags))
+ ((#:phases phases '%standard-phases)
+ #~(modify-phases #$phases
+ (replace 'configure
+ (lambda* (#:key outputs make-flags #:allow-other-keys)
+ (let* ((config-name (string-append #$board "_defconfig"))
+ (config-file (string-append "configs/" config-name))
+ (defconfig #$defconfig)
+ (configs '#$configs))
+ (when defconfig
+ ;; Replace the board-specific defconfig with the given
+ ;; one.
+ (copy-file defconfig config-file))
+ (if (file-exists? config-file)
+ (begin
+ (when configs
+ (modify-defconfig config-file configs))
+ (apply invoke "make" `(,@make-flags ,config-name))
+ (verify-config ".config" config-file))
+ (begin
+ (display "invalid board name; valid board names are:"
+ (current-error-port))
+ (let ((suffix-len (string-length "_defconfig"))
+ (entries (scandir "configs")))
+ (for-each (lambda (file-name)
+ (when (string-suffix? "_defconfig"
+ file-name)
+ (format (current-error-port)
+ "- ~A\n"
+ (string-drop-right
+ file-name suffix-len))))
+ (sort entries string-ci<)))
+ (error "invalid boardname ~s" #$board))))))
+ (add-after 'configure 'disable-tools-libcrypto
+ ;; Disable libcrypto due to GPL and OpenSSL license
+ ;; incompatibilities
+ (lambda _
+ (substitute* ".config"
+ (("CONFIG_TOOLS_LIBCRYPTO=.*$")
+ "CONFIG_TOOLS_LIBCRYPTO=n"))))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((libexec (string-append #$output "/libexec"))
+ (uboot-files
+ (append
+ (remove
+ ;; Those would not be reproducible
+ ;; because of the randomness used to
+ ;; produce them. It's expected that the
+ ;; user will use u-boot-tools to generate
+ ;; them instead.
+ (lambda (name)
+ (string-suffix?
+ "sunxi-spl-with-ecc.bin"
+ name))
+ (find-files "."
+ ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+ (find-files "." "^(MLO|SPL)$"))))
+ (mkdir-p libexec)
+ (install-file ".config" libexec)
+ ;; Useful for "qemu -kernel".
+ (install-file "u-boot" libexec)
+ (for-each
+ (lambda (file)
+ (let ((target-file (string-append libexec "/" file)))
+ (mkdir-p (dirname target-file))
+ (copy-file file target-file)))
+ uboot-files)))))))))))
(define-public u-boot-malta
(make-u-boot-package "malta" "mips64el-linux-gnuabi64"))
--
2.38.1
M
M
Maxim Cournoyer wrote on 20 Dec 2022 19:34
[PATCH 2/9] gnu: make-u-boot-package: Install .imx files.
(address . 60224@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20221220183427.31752-3-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm
(make-u-boot-package) [phases] <install>: Add imx to the regexp of files
considered for installation.
---

gnu/packages/bootloaders.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 42f859c362..bc9f32c9aa 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -888,7 +888,7 @@ (define*-public (make-u-boot-package board triplet
"sunxi-spl-with-ecc.bin"
name))
(find-files "."
- ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+ ".*\\.(bin|efi|img|imx|spl|itb|dtb|rksd)$"))
(find-files "." "^(MLO|SPL)$"))))
(mkdir-p libexec)
(install-file ".config" libexec)
--
2.38.1
M
M
Maxim Cournoyer wrote on 20 Dec 2022 19:34
[PATCH 3/9] gnu: make-uboot-package: Simplify build.
(address . 60224@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20221220183427.31752-4-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (make-u-boot-package) <same-arch?>: Rename
procedure to 'native-build?'.
[native-inputs]: Remove field.
[arguments]: Specify the #:target argument, when not natively building.
Adjust for the above renaming.
---

gnu/packages/bootloaders.scm | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)

Toggle diff (50 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index bc9f32c9aa..6893d12745 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -790,9 +790,11 @@ (define*-public (make-u-boot-package board triplet
NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
appended to the package description. U-BOOT can be used when a fork or a
different version of U-Boot must be used."
- (let ((same-arch? (lambda ()
- (string=? (%current-system)
- (gnu-triplet->nix-system triplet)))))
+ (let ((native-build? (lambda ()
+ ;; Note: %current-target-system is a *triplet*, unlike
+ ;; its name would suggest.
+ (string=? (%current-system)
+ (gnu-triplet->nix-system triplet)))))
(package
(inherit u-boot)
(name (string-append "u-boot-"
@@ -803,16 +805,11 @@ (define*-public (make-u-boot-package board triplet
(string-append (package-description u-boot)
"\n\n" append-description)
(package-description u-boot)))
- (native-inputs
- ;; Note: leave the native u-boot inputs first, so that a user can
- ;; override the cross-gcc and cross-binutils packages.
- `(,@(package-native-inputs u-boot)
- ,@(if (not (same-arch?))
- `(("cross-gcc" ,(cross-gcc triplet))
- ("cross-binutils" ,(cross-binutils triplet)))
- `())))
+ (build-system gnu-build-system)
(arguments
(substitute-keyword-arguments (package-arguments u-boot)
+ ((#:target _ #f)
+ (and (not (native-build?)) triplet))
((#:modules modules '())
`((ice-9 ftw)
(srfi srfi-1)
@@ -829,7 +826,7 @@ (define*-public (make-u-boot-package board triplet
((#:make-flags make-flags '())
#~(list "HOSTCC=gcc"
"KBUILD_VERBOSE=1"
- #$@(if (not (same-arch?))
+ #$@(if (not (native-build?))
(list (string-append "CROSS_COMPILE=" triplet "-"))
'())
#$@make-flags))
--
2.38.1
M
M
Maxim Cournoyer wrote on 20 Dec 2022 19:34
[PATCH 4/9] gnu: u-boot-pinebook-pro-rk3399: Remove input labels and use gexps.
(address . 60224@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20221220183427.31752-5-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-pinebook-pro-rk3399)
[arguments]: Use gexps.
[phases] {set-environment}: Look also in native-inputs (for
cross-compilation).
[native-inputs]: Remove input labels and use modify-inputs.
---

gnu/packages/bootloaders.scm | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

Toggle diff (35 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 6893d12745..7e78b9af41 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1145,17 +1145,18 @@ (define-public u-boot-pinebook-pro-rk3399
(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"
- (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31"
+ (search-input-file (or native-inputs inputs)
+ "bl31.elf"))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
(native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ (modify-inputs (package-native-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define*-public (make-u-boot-bin-package u-boot-package
#:key
--
2.38.1
M
M
Maxim Cournoyer wrote on 20 Dec 2022 19:34
[PATCH 5/9] gnu: u-boot-firefly-rk3399: Use gexps and fix cross-build.
(address . 60224@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20221220183427.31752-6-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-firefly-rk3399) [arguments]: Use gexps.
[phases] {set-environment}: Look for the bl31.elf in native-inputs, useful when
cross-compiling.
---

gnu/packages/bootloaders.scm | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

Toggle diff (33 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 7e78b9af41..ae847080d0 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1080,16 +1080,17 @@ (define-public u-boot-firefly-rk3399
(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" (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file (or native-inputs inputs)
+ "bl31.elf"))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
(native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ (modify-inputs (package-native-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define-public u-boot-rockpro64-rk3399
(let ((base (make-u-boot-package "rockpro64-rk3399" "aarch64-linux-gnu"
--
2.38.1
M
M
Maxim Cournoyer wrote on 20 Dec 2022 19:34
[PATCH 6/9] gnu: make-u-boot-sunxi64-package: Use gexps and adjust file name.
(address . 60224@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20221220183427.31752-7-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package)
[phases] {set-environment}: Replace bl31.bin with bl31.elf; bl31.elf doesn't
exist anymore due to the package being a true cross-build.
---

gnu/packages/bootloaders.scm | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index ae847080d0..5f0182524d 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -925,17 +925,14 @@ (define*-public (make-u-boot-sunxi64-package board triplet
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases)
- `(modify-phases ,phases
- (add-after 'unpack 'set-environment
- (lambda* (#:key native-inputs inputs #:allow-other-keys)
- (let ((bl31
- (string-append
- (assoc-ref (or native-inputs inputs) "firmware")
- "/bl31.bin")))
- (setenv "BL31" bl31))))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file (or native-inputs inputs)
+ "bl31.elf"))))))))
(native-inputs
- `(("firmware" ,arm-trusted-firmware-sun50i-a64)
- ,@(package-native-inputs base))))))
+ (modify-inputs (package-native-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define-public u-boot-pine64-plus
(make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
--
2.38.1
M
M
Maxim Cournoyer wrote on 20 Dec 2022 19:34
[PATCH 7/9] gnu: u-boot-rock64-rk3328: Fix build.
(address . 60224@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20221220183427.31752-8-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-rock64-rk3328)
[arguments]: Use gexps.
[phases] {set-environment}: Also look in native-inputs.
[native-inputs]: Remove input labels and use modify-inputs.
---

gnu/packages/bootloaders.scm | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

Toggle diff (28 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 5f0182524d..ce7be6f7b1 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1061,14 +1061,14 @@ (define-public u-boot-rock64-rk3328
(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 (search-input-file inputs "/bl31.elf")))
- (setenv "BL31" bl31))))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31 "(search-input-file (or native-inputs inputs)
+ "bl31.elf"))))))))
(native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3328)
- ,@(package-native-inputs base))))))
+ (modify-inputs (package-native-inputs base)
+ (append arm-trusted-firmware-rk3328))))))
(define-public u-boot-firefly-rk3399
(let ((base (make-u-boot-package "firefly-rk3399" "aarch64-linux-gnu")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 20 Dec 2022 19:34
[PATCH 8/9] gnu: u-boot-sifive-unmatched: Use gexps and remove inputs.
(address . 60224@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20221220183427.31752-9-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-sifive-unmatched)
[arguments]: Use gexps. Use search-input-file.
[inputs]: Remove labels. Use modify-inputs.
---

gnu/packages/bootloaders.scm | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

Toggle diff (29 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index ce7be6f7b1..fa11fa4bc7 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1044,15 +1044,14 @@ (define-public u-boot-sifive-unmatched
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases)
- `(modify-phases ,phases
- (add-after 'unpack 'set-environment
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((opensbi (string-append (assoc-ref inputs "firmware")
- "/fw_dynamic.bin")))
- (setenv "OPENSBI" opensbi))))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "OPENSBI" (search-input-file inputs
+ "fw_dynamic.bin"))))))))
(inputs
- `(("firmware" ,opensbi-generic)
- ,@(package-inputs base))))))
+ (modify-inputs (package-inputs base)
+ (append opensbi-generic))))))
(define-public u-boot-rock64-rk3328
(let ((base (make-u-boot-package "rock64-rk3328" "aarch64-linux-gnu")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 20 Dec 2022 19:34
[PATCH 9/9] gnu: u-boot-puma-rk3399: Use make-u-boot-sunxi64-package.
(address . 60224@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20221220183427.31752-10-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-puma-rk3399): Use make-u-boot-sunxi64-package.
---

gnu/packages/bootloaders.scm | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index fa11fa4bc7..738f3975f5 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1010,23 +1010,7 @@ (define-public u-boot-cubietruck
(make-u-boot-package "Cubietruck" "arm-linux-gnueabihf"))
(define-public u-boot-puma-rk3399
- (let ((base (make-u-boot-package "puma-rk3399" "aarch64-linux-gnu")))
- (package
- (inherit base)
- (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"
- (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ (make-u-boot-sunxi64-package "puma-rk3399" "aarch64-linux-gnu"))
(define-public u-boot-qemu-riscv64
(make-u-boot-package "qemu-riscv64" "riscv64-linux-gnu"))
--
2.38.1
M
M
Maxim Cournoyer wrote on 20 Dec 2022 19:35
control message for bug #59761
(address . control@debbugs.gnu.org)
87ili553fr.fsf@gmail.com
block 59761 by 60224
quit
R
R
Ricardo Wurmus wrote on 29 Dec 2022 20:18
[PATCH 0/9] Improvements to our u-boot tooling
(address . 60224@debbugs.gnu.org)
875ydu9fch.fsf@elephly.net
Hi Maxim,

this looks reasonable to me. Some comments below.

A minor comment about the first patch: you still bind “outputs” in the
build phases, but since you’re using #$output anyway this value is never
used.

[PATCH 3/9] introduces a comment in the definition of “native-build?”,
which references %current-target-system, yet only %current-system is
used. Is this a mistake?

[PATCH 4/9] — This one appends arm-trusted-firmware-rk3399 instead of
prepending it. This differs from how it was done with the labeled
inputs. Does this have any consequences? Is the “firmware” label used
anywhere (such as downstream packages)? The same applies to patches
5/9, 7/9, and 8/9.

[PATCH 6/9] — The change from .bin to .elf confuses me. Is this due to the
fact that “target” is now actually set and the package build thus
behaves differently?

[PATCH 8/9] removes a reference to “firware”; this answers my question
to patch 4/9, but perhaps other such references remain?

--
Ricardo
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:27
(name . Ricardo Wurmus)(address . rekado@elephly.net)(address . 60224@debbugs.gnu.org)
875ydp4w6v.fsf_-_@gmail.com
Hi Ricardo!

Ricardo Wurmus <rekado@elephly.net> writes:

Toggle quote (4 lines)
> Hi Maxim,
>
> this looks reasonable to me. Some comments below.

Sorry for the late reply, it hadn't reached my INBOX (please keep me in
CC to ensure it does :-)).

Toggle quote (4 lines)
> A minor comment about the first patch: you still bind “outputs” in the
> build phases, but since you’re using #$output anyway this value is never
> used.

Fixed!

Toggle quote (4 lines)
> [PATCH 3/9] introduces a comment in the definition of “native-build?”,
> which references %current-target-system, yet only %current-system is
> used. Is this a mistake?

Fixed!

Toggle quote (6 lines)
> [PATCH 4/9] — This one appends arm-trusted-firmware-rk3399 instead of
> prepending it. This differs from how it was done with the labeled
> inputs. Does this have any consequences? Is the “firmware” label used
> anywhere (such as downstream packages)? The same applies to patches
> 5/9, 7/9, and 8/9.

I don't think it matters; the base u-boot package which gets used
doesn't include any "firmware" input, and the file provided via
arm-trusted-firmware-rk3399 is searched via "search-input-file". I've
grepped for 'assoc-ref.*"firmware"' and there doesn't seem to be any
remnants except for u-boot-rockpro64-rk3399, which I've now fixed in the
last commit.

Toggle quote (4 lines)
> [PATCH 6/9] — The change from .bin to .elf confuses me. Is this due to the
> fact that “target” is now actually set and the package build thus
> behaves differently?

I think so. I was puzzled by it too, especially since some packages
already were searching for a .elf file rather than a .bin file.

Toggle quote (3 lines)
> [PATCH 8/9] removes a reference to “firware”; this answers my question
> to patch 4/9, but perhaps other such references remain?

Answered above.

Thanks for the review! v3 will appear shortly.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:46
[PATCH v3 02/11] gnu: make-u-boot-package: Install .imx files.
(address . 60224@debbugs.gnu.org)
20230102004637.3920-2-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm
(make-u-boot-package) [phases] <install>: Add imx to the regexp of files
considered for installation.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index be460ac715..75033c4def 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -960,7 +960,7 @@ (define*-public (make-u-boot-package board triplet
"sunxi-spl-with-ecc.bin"
name))
(find-files "."
- ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+ ".*\\.(bin|efi|img|imx|spl|itb|dtb|rksd)$"))
(find-files "." "^(MLO|SPL)$"))))
(mkdir-p libexec)
(install-file ".config" libexec)
--
2.38.1
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:46
[PATCH v3 01/11] gnu: make-u-boot-package: Add a u-boot argument and use gexps.
(address . 60224@debbugs.gnu.org)
20230102004637.3920-1-maxim.cournoyer@gmail.com
And have that u-boot argument used as the complete base of the template, so
that a user can override it.

* gnu/packages/bootloaders.scm (make-u-boot-package): New U-BOOT argument.
Document it.
[native-inputs]: Move the native-inputs of U-BOOT first, so that the
cross compilation tools can be overridden via U-BOOT.
[arguments]: Rewrite using substitute-keyword-arguments, extending rather than
overriding most arguments. Use gexps. Do not bind OUTPUTS.

---

Changes in v3:
- No longer bind 'outputs' extraneously in build phases

gnu/packages/bootloaders.scm | 181 +++++++++++++++++++----------------
1 file changed, 97 insertions(+), 84 deletions(-)

Toggle diff (209 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index e3a63882e9..be460ac715 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -855,11 +855,13 @@ (define*-public (make-u-boot-package board triplet
defconfig
configs
name-suffix
- append-description)
+ append-description
+ (u-boot u-boot))
"Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
optional DEFCONFIG file and optional configuration changes from CONFIGS.
NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
-appended to the package description."
+appended to the package description. U-BOOT can be used when a fork or a
+different version of U-Boot must be used."
(let ((same-arch? (lambda ()
(string=? (%current-system)
(gnu-triplet->nix-system triplet)))))
@@ -874,91 +876,102 @@ (define*-public (make-u-boot-package board triplet
"\n\n" append-description)
(package-description u-boot)))
(native-inputs
- `(,@(if (not (same-arch?))
+ ;; Note: leave the native u-boot inputs first, so that a user can
+ ;; override the cross-gcc and cross-binutils packages.
+ `(,@(package-native-inputs u-boot)
+ ,@(if (not (same-arch?))
`(("cross-gcc" ,(cross-gcc triplet))
("cross-binutils" ,(cross-binutils triplet)))
- `())
- ,@(package-native-inputs u-boot)))
+ `())))
(arguments
- `(#:modules ((ice-9 ftw)
- (srfi srfi-1)
- (guix build gnu-build-system)
- (guix build kconfig)
- (guix build utils))
- #:imported-modules (,@%gnu-build-system-modules
- (guix build kconfig))
- #:test-target "test"
- #:make-flags
- (list "HOSTCC=gcc"
- "KBUILD_VERBOSE=1"
- ,@(if (not (same-arch?))
- `((string-append "CROSS_COMPILE=" ,triplet "-"))
- '()))
- #:phases
- (modify-phases %standard-phases
- (replace 'configure
- (lambda* (#:key outputs make-flags #:allow-other-keys)
- (let* ((config-name (string-append ,board "_defconfig"))
- (config-file (string-append "configs/" config-name))
- (defconfig ,defconfig)
- (configs ',configs))
- (when defconfig
- ;; Replace the board-specific defconfig with the given one.
- (copy-file defconfig config-file))
- (if (file-exists? config-file)
- (begin
- (when configs
- (modify-defconfig config-file configs))
- (apply invoke "make" `(,@make-flags ,config-name))
- (verify-config ".config" config-file))
- (begin
- (display "invalid board name; valid board names are:"
- (current-error-port))
- (let ((suffix-len (string-length "_defconfig"))
- (entries (scandir "configs")))
- (for-each (lambda (file-name)
- (when (string-suffix? "_defconfig" file-name)
- (format (current-error-port)
- "- ~A\n"
- (string-drop-right file-name
- suffix-len))))
- (sort entries string-ci<)))
- (error "invalid boardname ~s" ,board))))))
- (add-after 'configure 'disable-tools-libcrypto
- ;; Disable libcrypto due to GPL and OpenSSL license
- ;; incompatibilities
- (lambda _
- (substitute* ".config"
- (("CONFIG_TOOLS_LIBCRYPTO=.*$") "CONFIG_TOOLS_LIBCRYPTO=n"))))
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (libexec (string-append out "/libexec"))
- (uboot-files (append
- (remove
- ;; Those would not be reproducible
- ;; because of the randomness used
- ;; to produce them.
- ;; It's expected that the user will
- ;; use u-boot-tools to generate them
- ;; instead.
- (lambda (name)
- (string-suffix?
- "sunxi-spl-with-ecc.bin"
- name))
- (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
- (find-files "." "^(MLO|SPL)$"))))
- (mkdir-p libexec)
- (install-file ".config" libexec)
- ;; Useful for "qemu -kernel".
- (install-file "u-boot" libexec)
- (for-each
- (lambda (file)
- (let ((target-file (string-append libexec "/" file)))
- (mkdir-p (dirname target-file))
- (copy-file file target-file)))
- uboot-files)
- #t)))))))))
+ (substitute-keyword-arguments (package-arguments u-boot)
+ ((#:modules modules '())
+ `((ice-9 ftw)
+ (srfi srfi-1)
+ (guix build gnu-build-system)
+ (guix build kconfig)
+ (guix build utils)
+ ,@modules))
+ ((#:imported-modules imported-modules '())
+ `((guix build kconfig)
+ ,@%gnu-build-system-modules
+ ,@imported-modules))
+ ((#:test-target _ "test")
+ "test")
+ ((#:make-flags make-flags '())
+ #~(list "HOSTCC=gcc"
+ "KBUILD_VERBOSE=1"
+ #$@(if (not (same-arch?))
+ (list (string-append "CROSS_COMPILE=" triplet "-"))
+ '())
+ #$@make-flags))
+ ((#:phases phases '%standard-phases)
+ #~(modify-phases #$phases
+ (replace 'configure
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (let* ((config-name (string-append #$board "_defconfig"))
+ (config-file (string-append "configs/" config-name))
+ (defconfig #$defconfig)
+ (configs '#$configs))
+ (when defconfig
+ ;; Replace the board-specific defconfig with the given
+ ;; one.
+ (copy-file defconfig config-file))
+ (if (file-exists? config-file)
+ (begin
+ (when configs
+ (modify-defconfig config-file configs))
+ (apply invoke "make" `(,@make-flags ,config-name))
+ (verify-config ".config" config-file))
+ (begin
+ (display "invalid board name; valid board names are:"
+ (current-error-port))
+ (let ((suffix-len (string-length "_defconfig"))
+ (entries (scandir "configs")))
+ (for-each (lambda (file-name)
+ (when (string-suffix? "_defconfig"
+ file-name)
+ (format (current-error-port)
+ "- ~A\n"
+ (string-drop-right
+ file-name suffix-len))))
+ (sort entries string-ci<)))
+ (error "invalid boardname ~s" #$board))))))
+ (add-after 'configure 'disable-tools-libcrypto
+ ;; Disable libcrypto due to GPL and OpenSSL license
+ ;; incompatibilities
+ (lambda _
+ (substitute* ".config"
+ (("CONFIG_TOOLS_LIBCRYPTO=.*$")
+ "CONFIG_TOOLS_LIBCRYPTO=n"))))
+ (replace 'install
+ (lambda _
+ (let ((libexec (string-append #$output "/libexec"))
+ (uboot-files
+ (append
+ (remove
+ ;; Those would not be reproducible
+ ;; because of the randomness used to
+ ;; produce them. It's expected that the
+ ;; user will use u-boot-tools to generate
+ ;; them instead.
+ (lambda (name)
+ (string-suffix?
+ "sunxi-spl-with-ecc.bin"
+ name))
+ (find-files "."
+ ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+ (find-files "." "^(MLO|SPL)$"))))
+ (mkdir-p libexec)
+ (install-file ".config" libexec)
+ ;; Useful for "qemu -kernel".
+ (install-file "u-boot" libexec)
+ (for-each
+ (lambda (file)
+ (let ((target-file (string-append libexec "/" file)))
+ (mkdir-p (dirname target-file))
+ (copy-file file target-file)))
+ uboot-files)))))))))))
(define-public u-boot-malta
(make-u-boot-package "malta" "mips64el-linux-gnuabi64"))

base-commit: d7a9d72bb02a2a3b1a99183655bf878547116032
--
2.38.1
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:46
[PATCH v3 03/11] gnu: make-uboot-package: Simplify build.
(address . 60224@debbugs.gnu.org)
20230102004637.3920-3-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (make-u-boot-package) <same-arch?>: Rename
procedure to 'native-build?'.
[native-inputs]: Remove field.
[arguments]: Specify the #:target argument, when not natively building.
Adjust for the above renaming.

---

Changes in v3:
- Rename %current-target-system to %current-system in comment

gnu/packages/bootloaders.scm | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)

Toggle diff (50 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 75033c4def..c3c15d557a 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -862,9 +862,11 @@ (define*-public (make-u-boot-package board triplet
NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
appended to the package description. U-BOOT can be used when a fork or a
different version of U-Boot must be used."
- (let ((same-arch? (lambda ()
- (string=? (%current-system)
- (gnu-triplet->nix-system triplet)))))
+ (let ((native-build? (lambda ()
+ ;; Note: %current-system is a *triplet*, unlike its
+ ;; name would suggest.
+ (string=? (%current-system)
+ (gnu-triplet->nix-system triplet)))))
(package
(inherit u-boot)
(name (string-append "u-boot-"
@@ -875,16 +877,11 @@ (define*-public (make-u-boot-package board triplet
(string-append (package-description u-boot)
"\n\n" append-description)
(package-description u-boot)))
- (native-inputs
- ;; Note: leave the native u-boot inputs first, so that a user can
- ;; override the cross-gcc and cross-binutils packages.
- `(,@(package-native-inputs u-boot)
- ,@(if (not (same-arch?))
- `(("cross-gcc" ,(cross-gcc triplet))
- ("cross-binutils" ,(cross-binutils triplet)))
- `())))
+ (build-system gnu-build-system)
(arguments
(substitute-keyword-arguments (package-arguments u-boot)
+ ((#:target _ #f)
+ (and (not (native-build?)) triplet))
((#:modules modules '())
`((ice-9 ftw)
(srfi srfi-1)
@@ -901,7 +898,7 @@ (define*-public (make-u-boot-package board triplet
((#:make-flags make-flags '())
#~(list "HOSTCC=gcc"
"KBUILD_VERBOSE=1"
- #$@(if (not (same-arch?))
+ #$@(if (not (native-build?))
(list (string-append "CROSS_COMPILE=" triplet "-"))
'())
#$@make-flags))
--
2.38.1
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:46
[PATCH v3 04/11] gnu: make-u-boot-package: Allow disabling cross-compilation.
(address . 60224@debbugs.gnu.org)
20230102004637.3920-4-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (make-u-boot-package): Accept #f for the
TRIPLET argument to disable cross-compilation. Update doc.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index c3c15d557a..1a4415b858 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -859,14 +859,16 @@ (define*-public (make-u-boot-package board triplet
(u-boot u-boot))
"Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
optional DEFCONFIG file and optional configuration changes from CONFIGS.
-NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
-appended to the package description. U-BOOT can be used when a fork or a
-different version of U-Boot must be used."
+TRIPLET may also be set to #f to disable cross-compilation. NAME-SUFFIX is
+appended to the package name, while APPEND-DESCRIPTION is appended to the
+package description. U-BOOT can be used when a fork or a different version of
+U-Boot must be used."
(let ((native-build? (lambda ()
;; Note: %current-system is a *triplet*, unlike its
;; name would suggest.
- (string=? (%current-system)
- (gnu-triplet->nix-system triplet)))))
+ (or (not triplet) ;disable cross-compilation
+ (string=? (%current-system)
+ (gnu-triplet->nix-system triplet))))))
(package
(inherit u-boot)
(name (string-append "u-boot-"
--
2.38.1
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:46
[PATCH v3 10/11] gnu: u-boot-puma-rk3399: Use make-u-boot-sunxi64-package.
(address . 60224@debbugs.gnu.org)
20230102004637.3920-10-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-puma-rk3399): Use make-u-boot-sunxi64-package.

---

(no changes since v2)

Changes in v2:
- Add commit to allow disabling cross-compilation

gnu/packages/bootloaders.scm | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 960c5b4a88..18750c2ad4 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1090,23 +1090,7 @@ (define-public u-boot-cubietruck
(make-u-boot-package "Cubietruck" "arm-linux-gnueabihf"))
(define-public u-boot-puma-rk3399
- (let ((base (make-u-boot-package "puma-rk3399" "aarch64-linux-gnu")))
- (package
- (inherit base)
- (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"
- (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ (make-u-boot-sunxi64-package "puma-rk3399" "aarch64-linux-gnu"))
(define-public u-boot-qemu-riscv64
(make-u-boot-package "qemu-riscv64" "riscv64-linux-gnu"))
--
2.38.1
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:46
[PATCH v3 05/11] gnu: u-boot-pinebook-pro-rk3399: Remove input labels and use gexps.
(address . 60224@debbugs.gnu.org)
20230102004637.3920-5-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-pinebook-pro-rk3399) [arguments]:
Remove input labels.
[phases] {set-environment}: Look also in native-inputs (for
cross-compilation).
[native-inputs]: Use gexps.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

Toggle diff (35 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 1a4415b858..602ec7f8a3 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1225,17 +1225,18 @@ (define-public u-boot-pinebook-pro-rk3399
(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"
- (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31"
+ (search-input-file (or native-inputs inputs)
+ "bl31.elf"))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
(native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ (modify-inputs (package-native-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define*-public (make-u-boot-bin-package u-boot-package
#:key
--
2.38.1
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:46
[PATCH v3 06/11] gnu: u-boot-firefly-rk3399: Use gexps and fix cross-build.
(address . 60224@debbugs.gnu.org)
20230102004637.3920-6-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-firefly-rk3399) [arguments]: Use gexps.
[phases] {set-environment}: Look for the bl31.elf in native-inputs, useful when
cross-compiling.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

Toggle diff (33 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 602ec7f8a3..8a56ee9cec 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1160,16 +1160,17 @@ (define-public u-boot-firefly-rk3399
(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" (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file (or native-inputs inputs)
+ "bl31.elf"))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
(native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ (modify-inputs (package-native-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define-public u-boot-rockpro64-rk3399
(let ((base (make-u-boot-package "rockpro64-rk3399" "aarch64-linux-gnu"
--
2.38.1
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:46
[PATCH v3 07/11] gnu: make-u-boot-sunxi64-package: Use gexps and adjust file name.
(address . 60224@debbugs.gnu.org)
20230102004637.3920-7-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package)
[phases] {set-environment}: Replace bl31.bin with bl31.elf; bl31.elf doesn't
exist anymore for some reason.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 8a56ee9cec..a19d1ebf17 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1005,17 +1005,14 @@ (define*-public (make-u-boot-sunxi64-package board triplet
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases)
- `(modify-phases ,phases
- (add-after 'unpack 'set-environment
- (lambda* (#:key native-inputs inputs #:allow-other-keys)
- (let ((bl31
- (string-append
- (assoc-ref (or native-inputs inputs) "firmware")
- "/bl31.bin")))
- (setenv "BL31" bl31))))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file (or native-inputs inputs)
+ "bl31.elf"))))))))
(native-inputs
- `(("firmware" ,arm-trusted-firmware-sun50i-a64)
- ,@(package-native-inputs base))))))
+ (modify-inputs (package-native-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define-public u-boot-pine64-plus
(make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
--
2.38.1
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:46
[PATCH v3 08/11] gnu: u-boot-rock64-rk3328: Fix build.
(address . 60224@debbugs.gnu.org)
20230102004637.3920-8-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-rock64-rk3328)
[arguments]: Use gexps.
[phases] {set-environment}: Also look in native-inputs.
[native-inputs]: Remove input labels and use modify-inputs.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

Toggle diff (28 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index a19d1ebf17..d1c04db66a 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1141,14 +1141,14 @@ (define-public u-boot-rock64-rk3328
(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 (search-input-file inputs "/bl31.elf")))
- (setenv "BL31" bl31))))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31 "(search-input-file (or native-inputs inputs)
+ "bl31.elf"))))))))
(native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3328)
- ,@(package-native-inputs base))))))
+ (modify-inputs (package-native-inputs base)
+ (append arm-trusted-firmware-rk3328))))))
(define-public u-boot-firefly-rk3399
(let ((base (make-u-boot-package "firefly-rk3399" "aarch64-linux-gnu")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:46
[PATCH v3 11/11] gnu: u-boot-rockpro64-rk3399: Fix build.
(address . 60224@debbugs.gnu.org)
20230102004637.3920-11-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-rockpro64-rk3399)
[phases]: Use gexps.
{set-environment}: Search native-inputs as well as inputs.
[native-inputs]: Use modify-inputs.

---

Changes in v3:
- New commit.

gnu/packages/bootloaders.scm | 45 ++++++++++++++++++------------------
1 file changed, 23 insertions(+), 22 deletions(-)

Toggle diff (67 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 18750c2ad4..6b985c4572 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1167,37 +1167,38 @@ (define-public u-boot-rockpro64-rk3399
(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"
- (search-input-file inputs "/bl31.elf"))))
- (add-after 'unpack 'patch-header
- (lambda _
- (substitute* "include/config_distro_bootcmd.h"
- (("\"scsi_need_init=false")
- "\"setenv scsi_need_init false")
- (("#define BOOTENV_SET_SCSI_NEED_INIT \"scsi_need_init=;")
- "#define BOOTENV_SET_SCSI_NEED_INIT \"setenv scsi_need_init;"))
- (substitute* "include/configs/rockchip-common.h"
- (("#define BOOT_TARGET_DEVICES\\(func\\)")
- "
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "BL31"
+ (search-input-file (or native-inputs inputs)
+ "/bl31.elf"))))
+ (add-after 'unpack 'patch-header
+ (lambda _
+ (substitute* "include/config_distro_bootcmd.h"
+ (("\"scsi_need_init=false")
+ "\"setenv scsi_need_init false")
+ (("#define BOOTENV_SET_SCSI_NEED_INIT \"scsi_need_init=;")
+ "#define BOOTENV_SET_SCSI_NEED_INIT \"setenv scsi_need_init;"))
+ (substitute* "include/configs/rockchip-common.h"
+ (("#define BOOT_TARGET_DEVICES\\(func\\)")
+ "
#if CONFIG_IS_ENABLED(CMD_SCSI)
#define BOOT_TARGET_SCSI(func) func(SCSI, scsi, 0)
#else
#define BOOT_TARGET_SCSI(func)
#endif
#define BOOT_TARGET_DEVICES(func)")
- (("BOOT_TARGET_NVME\\(func\\) \\\\")
- "\
+ (("BOOT_TARGET_NVME\\(func\\) \\\\")
+ "\
BOOT_TARGET_NVME(func) \\
BOOT_TARGET_SCSI(func) \\"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
(native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ (modify-inputs (package-native-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define-public u-boot-pinebook-pro-rk3399
(let ((base (make-u-boot-package "pinebook-pro-rk3399" "aarch64-linux-gnu")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 2 Jan 2023 01:46
[PATCH v3 09/11] gnu: u-boot-sifive-unmatched: Use gexps and remove inputs.
(address . 60224@debbugs.gnu.org)
20230102004637.3920-9-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-sifive-unmatched)
[arguments]: Use gexps. Use search-input-file.
[inputs]: Remove labels. Use modify-inputs.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

Toggle diff (29 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index d1c04db66a..960c5b4a88 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1124,15 +1124,14 @@ (define-public u-boot-sifive-unmatched
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases)
- `(modify-phases ,phases
- (add-after 'unpack 'set-environment
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((opensbi (string-append (assoc-ref inputs "firmware")
- "/fw_dynamic.bin")))
- (setenv "OPENSBI" opensbi))))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "OPENSBI" (search-input-file inputs
+ "fw_dynamic.bin"))))))))
(inputs
- `(("firmware" ,opensbi-generic)
- ,@(package-inputs base))))))
+ (modify-inputs (package-inputs base)
+ (append opensbi-generic))))))
(define-public u-boot-rock64-rk3328
(let ((base (make-u-boot-package "rock64-rk3328" "aarch64-linux-gnu")))
--
2.38.1
V
V
Vagrant Cascadian wrote on 6 Jan 2023 18:09
Re: [bug#60224] [PATCH v3 10/11] gnu: u-boot-puma-rk3399: Use make-u-boot-sunxi64-package.
(address . rekado@elephly.net)
87mt6vk2t0.fsf@yucca
On 2023-01-01, Maxim Cournoyer wrote:
Toggle quote (1 lines)
> * gnu/packages/bootloaders.scm (u-boot-puma-rk3399): Use make-u-boot-sunxi64-package.
...
Toggle quote (27 lines)
> diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
> index 960c5b4a88..18750c2ad4 100644
> --- a/gnu/packages/bootloaders.scm
> +++ b/gnu/packages/bootloaders.scm
> @@ -1090,23 +1090,7 @@ (define-public u-boot-cubietruck
> (make-u-boot-package "Cubietruck" "arm-linux-gnueabihf"))
>
> (define-public u-boot-puma-rk3399
> - (let ((base (make-u-boot-package "puma-rk3399" "aarch64-linux-gnu")))
> - (package
> - (inherit base)
> - (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"
> - (search-input-file inputs "/bl31.elf"))))
> - ;; Phases do not succeed on the bl31 ELF.
> - (delete 'strip)
> - (delete 'validate-runpath)))))
> - (native-inputs
> - `(("firmware" ,arm-trusted-firmware-rk3399)
> - ,@(package-native-inputs base))))))
> + (make-u-boot-sunxi64-package "puma-rk3399" "aarch64-linux-gnu"))

This is definitely not a sunxi64 platform (sunxi ~= the community name
for allwinner platforms, and rk3399 is rockchip based), so either the
make-u-boot-sunx64-package has been overgeneralized and should be
renamed, or this is just not right...

live well,
vagrant
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCY7hVywAKCRDcUY/If5cW
qnqyAP9vBuOfZ4tqoGCaCVIM8e3hklrtO9KpP54dM57KQmnkLgD8Cv9PrB5QyPZc
spE+s4RNtwsRq0svSr1GV/H2NevQJQk=
=1B8i
-----END PGP SIGNATURE-----

V
V
Vagrant Cascadian wrote on 6 Jan 2023 18:17
Re: [bug#60224] [PATCH v3 07/11] gnu: make-u-boot-sunxi64-package: Use gexps and adjust file name.
87k01zk2g7.fsf@yucca
On 2023-01-01, Maxim Cournoyer wrote:
Toggle quote (4 lines)
> * gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package)
> [phases] {set-environment}: Replace bl31.bin with bl31.elf; bl31.elf doesn't
> exist anymore for some reason.

Seems like the description is the inverse of what it is actually
doing. But what it is doing is ... not right either. :/

This appears to repurpose a function targeted at sunxi64 platforms for
rockchip platforms.

Seems like you might want to make a make-u-boot-rockchip-package
function instead?

More details below...

Toggle quote (25 lines)
> gnu/packages/bootloaders.scm | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
> index 8a56ee9cec..a19d1ebf17 100644
> --- a/gnu/packages/bootloaders.scm
> +++ b/gnu/packages/bootloaders.scm
> @@ -1005,17 +1005,14 @@ (define*-public (make-u-boot-sunxi64-package board triplet
> (arguments
> (substitute-keyword-arguments (package-arguments base)
> ((#:phases phases)
> - `(modify-phases ,phases
> - (add-after 'unpack 'set-environment
> - (lambda* (#:key native-inputs inputs #:allow-other-keys)
> - (let ((bl31
> - (string-append
> - (assoc-ref (or native-inputs inputs) "firmware")
> - "/bl31.bin")))
> - (setenv "BL31" bl31))))))))
> + #~(modify-phases #$phases
> + (add-after 'unpack 'set-environment
> + (lambda* (#:key native-inputs inputs #:allow-other-keys)
> + (setenv "BL31" (search-input-file (or native-inputs inputs)
> + "bl31.elf"))))))))

bl31.elf is built on rockchip platforms, but not sunxi/allwinner
platforms. The sunxi/allwinner platforms need bl31.bin.


Toggle quote (6 lines)
> (native-inputs
> - `(("firmware" ,arm-trusted-firmware-sun50i-a64)
> - ,@(package-native-inputs base))))))
> + (modify-inputs (package-native-inputs base)
> + (append arm-trusted-firmware-rk3399))))))

This is absolutely incorrect, as this forces it to be rk3399, which is
not even a sunxi platform, and will break all the sun50i-a64 platforms
(e.g. pine64, pinebook). That said, there are technically sunxi64
platforms that would use a different arm-trusted-firmware build, so this
could use improving.


live well,
vagrant
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCY7hXmQAKCRDcUY/If5cW
qtkaAP91SxzfmPY/5ydhfgkR92XjYUosU3XxIMD08QaP7xmcgAD+L1SXPLb9HhEr
o260mfwfz0XIeK/VDiLG6q51Y+0k0AQ=
=MpCY
-----END PGP SIGNATURE-----

M
M
Maxim Cournoyer wrote on 11 Jan 2023 20:55
(name . Vagrant Cascadian)(address . vagrant@debian.org)
87v8lchmm3.fsf@gmail.com
Hi Vagrant!

Vagrant Cascadian <vagrant@debian.org> writes:

Toggle quote (8 lines)
> On 2023-01-01, Maxim Cournoyer wrote:
>> * gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package)
>> [phases] {set-environment}: Replace bl31.bin with bl31.elf; bl31.elf doesn't
>> exist anymore for some reason.
>
> Seems like the description is the inverse of what it is actually
> doing. But what it is doing is ... not right either. :/

[...]

Toggle quote (9 lines)
>> + #~(modify-phases #$phases
>> + (add-after 'unpack 'set-environment
>> + (lambda* (#:key native-inputs inputs #:allow-other-keys)
>> + (setenv "BL31" (search-input-file (or native-inputs inputs)
>> + "bl31.elf"))))))))
>
> bl31.elf is built on rockchip platforms, but not sunxi/allwinner
> platforms. The sunxi/allwinner platforms need bl31.bin.

This ^ ...
Toggle quote (8 lines)
>
>> (native-inputs
>> - `(("firmware" ,arm-trusted-firmware-sun50i-a64)
>> - ,@(package-native-inputs base))))))
>> + (modify-inputs (package-native-inputs base)
>> + (append arm-trusted-firmware-rk3399))))))
>

... was the product of the above typo; thanks for catching it!

Toggle quote (6 lines)
> This is absolutely incorrect, as this forces it to be rk3399, which is
> not even a sunxi platform, and will break all the sun50i-a64 platforms
> (e.g. pine64, pinebook). That said, there are technically sunxi64
> platforms that would use a different arm-trusted-firmware build, so this
> could use improving.

I've now removed that commit; and undid the previous change to, which
was based on that mistake.

I'll sent a v4 shortly.

I've noted something annoying though; is that cross-compiling doesn't
work yet because U-Boot uses python packages, which barfs like:

Toggle snippet (5 lines)
$ ./pre-inst-env guix build u-boot-puma-rk3399 guix build: error: gnu/packages/check.scm:1997:2:
python-coverage@5.2.1: build system `python' does not support cross
builds

So currently the only way to build it is via --system, e.g. 'guix build
-s aarch64-linux u-boot-puma-rk3399'. The complications I simplified
were probably papering over that issue. That said, I see no reason we
couldn't convince our Python build system to "cross-compile" Python
packages, so I intend to look at this. Not sure if this should be a
blocker or not.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 01/12] gnu: make-u-boot-package: Add a u-boot argument and use gexps.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-1-maxim.cournoyer@gmail.com
And have that u-boot argument used as the complete base of the template, so
that a user can override it.

* gnu/packages/bootloaders.scm (make-u-boot-package): New U-BOOT argument.
Document it.
[native-inputs]: Move the native-inputs of U-BOOT first, so that the
cross compilation tools can be overridden via U-BOOT.
[arguments]: Rewrite using substitute-keyword-arguments, extending rather than
overriding most arguments. Use gexps. Do not bind OUTPUTS.

---

(no changes since v3)

Changes in v3:
- No longer bind 'outputs' extraneously in build phases

gnu/packages/bootloaders.scm | 181 +++++++++++++++++++----------------
1 file changed, 97 insertions(+), 84 deletions(-)

Toggle diff (209 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 6e6bdb4c08..52427ca9d6 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -860,11 +860,13 @@ (define*-public (make-u-boot-package board triplet
defconfig
configs
name-suffix
- append-description)
+ append-description
+ (u-boot u-boot))
"Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
optional DEFCONFIG file and optional configuration changes from CONFIGS.
NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
-appended to the package description."
+appended to the package description. U-BOOT can be used when a fork or a
+different version of U-Boot must be used."
(let ((same-arch? (lambda ()
(string=? (%current-system)
(gnu-triplet->nix-system triplet)))))
@@ -879,91 +881,102 @@ (define*-public (make-u-boot-package board triplet
"\n\n" append-description)
(package-description u-boot)))
(native-inputs
- `(,@(if (not (same-arch?))
+ ;; Note: leave the native u-boot inputs first, so that a user can
+ ;; override the cross-gcc and cross-binutils packages.
+ `(,@(package-native-inputs u-boot)
+ ,@(if (not (same-arch?))
`(("cross-gcc" ,(cross-gcc triplet))
("cross-binutils" ,(cross-binutils triplet)))
- `())
- ,@(package-native-inputs u-boot)))
+ `())))
(arguments
- `(#:modules ((ice-9 ftw)
- (srfi srfi-1)
- (guix build gnu-build-system)
- (guix build kconfig)
- (guix build utils))
- #:imported-modules (,@%gnu-build-system-modules
- (guix build kconfig))
- #:test-target "test"
- #:make-flags
- (list "HOSTCC=gcc"
- "KBUILD_VERBOSE=1"
- ,@(if (not (same-arch?))
- `((string-append "CROSS_COMPILE=" ,triplet "-"))
- '()))
- #:phases
- (modify-phases %standard-phases
- (replace 'configure
- (lambda* (#:key outputs make-flags #:allow-other-keys)
- (let* ((config-name (string-append ,board "_defconfig"))
- (config-file (string-append "configs/" config-name))
- (defconfig ,defconfig)
- (configs ',configs))
- (when defconfig
- ;; Replace the board-specific defconfig with the given one.
- (copy-file defconfig config-file))
- (if (file-exists? config-file)
- (begin
- (when configs
- (modify-defconfig config-file configs))
- (apply invoke "make" `(,@make-flags ,config-name))
- (verify-config ".config" config-file))
- (begin
- (display "invalid board name; valid board names are:"
- (current-error-port))
- (let ((suffix-len (string-length "_defconfig"))
- (entries (scandir "configs")))
- (for-each (lambda (file-name)
- (when (string-suffix? "_defconfig" file-name)
- (format (current-error-port)
- "- ~A\n"
- (string-drop-right file-name
- suffix-len))))
- (sort entries string-ci<)))
- (error "invalid boardname ~s" ,board))))))
- (add-after 'configure 'disable-tools-libcrypto
- ;; Disable libcrypto due to GPL and OpenSSL license
- ;; incompatibilities
- (lambda _
- (substitute* ".config"
- (("CONFIG_TOOLS_LIBCRYPTO=.*$") "CONFIG_TOOLS_LIBCRYPTO=n"))))
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (libexec (string-append out "/libexec"))
- (uboot-files (append
- (remove
- ;; Those would not be reproducible
- ;; because of the randomness used
- ;; to produce them.
- ;; It's expected that the user will
- ;; use u-boot-tools to generate them
- ;; instead.
- (lambda (name)
- (string-suffix?
- "sunxi-spl-with-ecc.bin"
- name))
- (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
- (find-files "." "^(MLO|SPL)$"))))
- (mkdir-p libexec)
- (install-file ".config" libexec)
- ;; Useful for "qemu -kernel".
- (install-file "u-boot" libexec)
- (for-each
- (lambda (file)
- (let ((target-file (string-append libexec "/" file)))
- (mkdir-p (dirname target-file))
- (copy-file file target-file)))
- uboot-files)
- #t)))))))))
+ (substitute-keyword-arguments (package-arguments u-boot)
+ ((#:modules modules '())
+ `((ice-9 ftw)
+ (srfi srfi-1)
+ (guix build gnu-build-system)
+ (guix build kconfig)
+ (guix build utils)
+ ,@modules))
+ ((#:imported-modules imported-modules '())
+ `((guix build kconfig)
+ ,@%gnu-build-system-modules
+ ,@imported-modules))
+ ((#:test-target _ "test")
+ "test")
+ ((#:make-flags make-flags '())
+ #~(list "HOSTCC=gcc"
+ "KBUILD_VERBOSE=1"
+ #$@(if (not (same-arch?))
+ (list (string-append "CROSS_COMPILE=" triplet "-"))
+ '())
+ #$@make-flags))
+ ((#:phases phases '%standard-phases)
+ #~(modify-phases #$phases
+ (replace 'configure
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (let* ((config-name (string-append #$board "_defconfig"))
+ (config-file (string-append "configs/" config-name))
+ (defconfig #$defconfig)
+ (configs '#$configs))
+ (when defconfig
+ ;; Replace the board-specific defconfig with the given
+ ;; one.
+ (copy-file defconfig config-file))
+ (if (file-exists? config-file)
+ (begin
+ (when configs
+ (modify-defconfig config-file configs))
+ (apply invoke "make" `(,@make-flags ,config-name))
+ (verify-config ".config" config-file))
+ (begin
+ (display "invalid board name; valid board names are:"
+ (current-error-port))
+ (let ((suffix-len (string-length "_defconfig"))
+ (entries (scandir "configs")))
+ (for-each (lambda (file-name)
+ (when (string-suffix? "_defconfig"
+ file-name)
+ (format (current-error-port)
+ "- ~A\n"
+ (string-drop-right
+ file-name suffix-len))))
+ (sort entries string-ci<)))
+ (error "invalid boardname ~s" #$board))))))
+ (add-after 'configure 'disable-tools-libcrypto
+ ;; Disable libcrypto due to GPL and OpenSSL license
+ ;; incompatibilities
+ (lambda _
+ (substitute* ".config"
+ (("CONFIG_TOOLS_LIBCRYPTO=.*$")
+ "CONFIG_TOOLS_LIBCRYPTO=n"))))
+ (replace 'install
+ (lambda _
+ (let ((libexec (string-append #$output "/libexec"))
+ (uboot-files
+ (append
+ (remove
+ ;; Those would not be reproducible
+ ;; because of the randomness used to
+ ;; produce them. It's expected that the
+ ;; user will use u-boot-tools to generate
+ ;; them instead.
+ (lambda (name)
+ (string-suffix?
+ "sunxi-spl-with-ecc.bin"
+ name))
+ (find-files "."
+ ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+ (find-files "." "^(MLO|SPL)$"))))
+ (mkdir-p libexec)
+ (install-file ".config" libexec)
+ ;; Useful for "qemu -kernel".
+ (install-file "u-boot" libexec)
+ (for-each
+ (lambda (file)
+ (let ((target-file (string-append libexec "/" file)))
+ (mkdir-p (dirname target-file))
+ (copy-file file target-file)))
+ uboot-files)))))))))))
(define-public u-boot-malta
(make-u-boot-package "malta" "mips64el-linux-gnuabi64"))

base-commit: 5e4ec8218142eee8e6e148e787381a5ef891c5b1
--
2.38.1
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 02/12] gnu: make-u-boot-package: Install .imx files.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-2-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm
(make-u-boot-package) [phases] <install>: Add imx to the regexp of files
considered for installation.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 52427ca9d6..10750e0448 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -965,7 +965,7 @@ (define*-public (make-u-boot-package board triplet
"sunxi-spl-with-ecc.bin"
name))
(find-files "."
- ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+ ".*\\.(bin|efi|img|imx|spl|itb|dtb|rksd)$"))
(find-files "." "^(MLO|SPL)$"))))
(mkdir-p libexec)
(install-file ".config" libexec)
--
2.38.1
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 07/12] gnu: make-u-boot-sunxi64-package: Use gexps and adjust file name.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-7-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package)
[phases] {set-environment}: Replace bl31.bin with bl31.elf; bl31.elf doesn't
exist anymore for some reason.
[native-inputs]: Turn into...
[inputs]: ... this.

---

Changes in v4:
- Revert erroneously replaced firmware package
- Revert bl31.bin -> bl31.elf change caused by the above
- Make the arm-trusted-firmware-sun50i-a64 a host input

gnu/packages/bootloaders.scm | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 87d5bcb824..0c5205fa86 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1010,17 +1010,13 @@ (define*-public (make-u-boot-sunxi64-package board triplet
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases)
- `(modify-phases ,phases
- (add-after 'unpack 'set-environment
- (lambda* (#:key native-inputs inputs #:allow-other-keys)
- (let ((bl31
- (string-append
- (assoc-ref (or native-inputs inputs) "firmware")
- "/bl31.bin")))
- (setenv "BL31" bl31))))))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-sun50i-a64)
- ,@(package-native-inputs base))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
+ (inputs
+ (modify-inputs (package-inputs base)
+ (append arm-trusted-firmware-sun50i-a64))))))
(define-public u-boot-pine64-plus
(make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
--
2.38.1
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 03/12] gnu: make-uboot-package: Simplify build.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-3-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (make-u-boot-package) <same-arch?>: Rename
procedure to 'native-build?'.
[native-inputs]: Remove field.
[arguments]: Specify the #:target argument, when not natively building.
Adjust for the above renaming.

---

(no changes since v3)

Changes in v3:
- Rename %current-target-system to %current-system in comment

gnu/packages/bootloaders.scm | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)

Toggle diff (50 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 10750e0448..4a27a36d78 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -867,9 +867,11 @@ (define*-public (make-u-boot-package board triplet
NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
appended to the package description. U-BOOT can be used when a fork or a
different version of U-Boot must be used."
- (let ((same-arch? (lambda ()
- (string=? (%current-system)
- (gnu-triplet->nix-system triplet)))))
+ (let ((native-build? (lambda ()
+ ;; Note: %current-system is a *triplet*, unlike its
+ ;; name would suggest.
+ (string=? (%current-system)
+ (gnu-triplet->nix-system triplet)))))
(package
(inherit u-boot)
(name (string-append "u-boot-"
@@ -880,16 +882,11 @@ (define*-public (make-u-boot-package board triplet
(string-append (package-description u-boot)
"\n\n" append-description)
(package-description u-boot)))
- (native-inputs
- ;; Note: leave the native u-boot inputs first, so that a user can
- ;; override the cross-gcc and cross-binutils packages.
- `(,@(package-native-inputs u-boot)
- ,@(if (not (same-arch?))
- `(("cross-gcc" ,(cross-gcc triplet))
- ("cross-binutils" ,(cross-binutils triplet)))
- `())))
+ (build-system gnu-build-system)
(arguments
(substitute-keyword-arguments (package-arguments u-boot)
+ ((#:target _ #f)
+ (and (not (native-build?)) triplet))
((#:modules modules '())
`((ice-9 ftw)
(srfi srfi-1)
@@ -906,7 +903,7 @@ (define*-public (make-u-boot-package board triplet
((#:make-flags make-flags '())
#~(list "HOSTCC=gcc"
"KBUILD_VERBOSE=1"
- #$@(if (not (same-arch?))
+ #$@(if (not (native-build?))
(list (string-append "CROSS_COMPILE=" triplet "-"))
'())
#$@make-flags))
--
2.38.1
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 04/12] gnu: make-u-boot-package: Allow disabling cross-compilation.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-4-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (make-u-boot-package): Accept #f for the
TRIPLET argument to disable cross-compilation. Update doc.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 4a27a36d78..e48b55018b 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -864,14 +864,16 @@ (define*-public (make-u-boot-package board triplet
(u-boot u-boot))
"Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
optional DEFCONFIG file and optional configuration changes from CONFIGS.
-NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
-appended to the package description. U-BOOT can be used when a fork or a
-different version of U-Boot must be used."
+TRIPLET may also be set to #f to disable cross-compilation. NAME-SUFFIX is
+appended to the package name, while APPEND-DESCRIPTION is appended to the
+package description. U-BOOT can be used when a fork or a different version of
+U-Boot must be used."
(let ((native-build? (lambda ()
;; Note: %current-system is a *triplet*, unlike its
;; name would suggest.
- (string=? (%current-system)
- (gnu-triplet->nix-system triplet)))))
+ (or (not triplet) ;disable cross-compilation
+ (string=? (%current-system)
+ (gnu-triplet->nix-system triplet))))))
(package
(inherit u-boot)
(name (string-append "u-boot-"
--
2.38.1
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 05/12] gnu: u-boot-pinebook-pro-rk3399: Remove input labels and use gexps.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-5-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-pinebook-pro-rk3399) [arguments]:
Remove input labels.
[native-inputs]: Use modify-inputs and turn into...
[inputs]: ... this.

---

Changes in v4:
- Move arm-trusted-firmware-rk3399 to inputs

gnu/packages/bootloaders.scm | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index e48b55018b..3ac29a844b 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1230,17 +1230,16 @@ (define-public u-boot-pinebook-pro-rk3399
(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"
- (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file inputs "bl31.elf"))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
+ (inputs
+ (modify-inputs (package-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define*-public (make-u-boot-bin-package u-boot-package
#:key
--
2.38.1
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 06/12] gnu: u-boot-firefly-rk3399: Use gexps and fix cross-build.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-6-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-firefly-rk3399) [arguments]: Use gexps.
[native-inputs]: Use modify-inputs and turn into...
[inputs]: ... this.

---

Changes in v4:
- Move arm-trusted-firmware-rk3399 to inputs

gnu/packages/bootloaders.scm | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

Toggle diff (33 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 3ac29a844b..87d5bcb824 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1165,16 +1165,16 @@ (define-public u-boot-firefly-rk3399
(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" (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file inputs "bl31.elf"))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
+ (inputs
+ (modify-inputs (package-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define-public u-boot-rockpro64-rk3399
(let ((base (make-u-boot-package "rockpro64-rk3399" "aarch64-linux-gnu"
--
2.38.1
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 08/12] gnu: u-boot-rock64-rk3328: Fix build.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-8-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-rock64-rk3328)
[arguments]: Use gexps.
[native-inputs]: Remove input labels and use modify-inputs, and turn into...
[inputs]: ... this.

---

Changes in v4:
- Make arm-trusted-firmware-rk3328 a regular input

gnu/packages/bootloaders.scm | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

Toggle diff (28 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 0c5205fa86..464c1f5729 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1145,14 +1145,13 @@ (define-public u-boot-rock64-rk3328
(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 (search-input-file inputs "/bl31.elf")))
- (setenv "BL31" bl31))))))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3328)
- ,@(package-native-inputs base))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31 "(search-input-file inputs "bl31.elf"))))))))
+ (inputs
+ (modify-inputs (package-inputs base)
+ (append arm-trusted-firmware-rk3328))))))
(define-public u-boot-firefly-rk3399
(let ((base (make-u-boot-package "firefly-rk3399" "aarch64-linux-gnu")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 09/12] gnu: u-boot-sifive-unmatched: Use gexps and remove inputs.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-9-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-sifive-unmatched)
[arguments]: Use gexps. Use search-input-file.
[inputs]: Remove labels. Use modify-inputs.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

Toggle diff (29 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 464c1f5729..b2e15b88f1 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1128,15 +1128,14 @@ (define-public u-boot-sifive-unmatched
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases)
- `(modify-phases ,phases
- (add-after 'unpack 'set-environment
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((opensbi (string-append (assoc-ref inputs "firmware")
- "/fw_dynamic.bin")))
- (setenv "OPENSBI" opensbi))))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "OPENSBI" (search-input-file inputs
+ "fw_dynamic.bin"))))))))
(inputs
- `(("firmware" ,opensbi-generic)
- ,@(package-inputs base))))))
+ (modify-inputs (package-inputs base)
+ (append opensbi-generic))))))
(define-public u-boot-rock64-rk3328
(let ((base (make-u-boot-package "rock64-rk3328" "aarch64-linux-gnu")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 10/12] gnu: u-boot-rockpro64-rk3399: Fix build.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-10-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-rockpro64-rk3399)
[phases]: Use gexps.
[native-inputs]: Use modify-inputs and turn into...
[inputs]: ... this.

---

Changes in v4:
- Make the arm-trusted-firmware-rk3399 a regular input

Changes in v3:
- New commit.

gnu/packages/bootloaders.scm | 45 ++++++++++++++++++------------------
1 file changed, 22 insertions(+), 23 deletions(-)

Toggle diff (66 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index b2e15b88f1..0878dd3168 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1185,37 +1185,36 @@ (define-public u-boot-rockpro64-rk3399
(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"
- (search-input-file inputs "/bl31.elf"))))
- (add-after 'unpack 'patch-header
- (lambda _
- (substitute* "include/config_distro_bootcmd.h"
- (("\"scsi_need_init=false")
- "\"setenv scsi_need_init false")
- (("#define BOOTENV_SET_SCSI_NEED_INIT \"scsi_need_init=;")
- "#define BOOTENV_SET_SCSI_NEED_INIT \"setenv scsi_need_init;"))
- (substitute* "include/configs/rockchip-common.h"
- (("#define BOOT_TARGET_DEVICES\\(func\\)")
- "
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
+ (add-after 'unpack 'patch-header
+ (lambda _
+ (substitute* "include/config_distro_bootcmd.h"
+ (("\"scsi_need_init=false")
+ "\"setenv scsi_need_init false")
+ (("#define BOOTENV_SET_SCSI_NEED_INIT \"scsi_need_init=;")
+ "#define BOOTENV_SET_SCSI_NEED_INIT \"setenv scsi_need_init;"))
+ (substitute* "include/configs/rockchip-common.h"
+ (("#define BOOT_TARGET_DEVICES\\(func\\)")
+ "
#if CONFIG_IS_ENABLED(CMD_SCSI)
#define BOOT_TARGET_SCSI(func) func(SCSI, scsi, 0)
#else
#define BOOT_TARGET_SCSI(func)
#endif
#define BOOT_TARGET_DEVICES(func)")
- (("BOOT_TARGET_NVME\\(func\\) \\\\")
- "\
+ (("BOOT_TARGET_NVME\\(func\\) \\\\")
+ "\
BOOT_TARGET_NVME(func) \\
BOOT_TARGET_SCSI(func) \\"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
+ (inputs
+ (modify-inputs (package-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define-public u-boot-pinebook-pro-rk3399
(let ((base (make-u-boot-package "pinebook-pro-rk3399" "aarch64-linux-gnu")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 11/12] gnu: make-arm-trusted-firmware: Simplify build.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-11-maxim.cournoyer@gmail.com
Reuse knowledge from recent U-Boot modifications to streamline the package
definition.

* gnu/packages/firmware.scm (make-arm-trusted-firmware): Change optional
argument ARCH to keyword TRIPLET. Default to aarch64-linux-gnu.
[arguments]: Use gexps. Add a #:target argument. Streamline how the
CROSS_COMPILE make flag is computed.
[native-inputs]: Delete field.

---

Changes in v4:
- New commit

gnu/packages/firmware.scm | 116 +++++++++++++++++---------------------
1 file changed, 52 insertions(+), 64 deletions(-)

Toggle diff (146 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index f08d59752a..bd20ee81d9 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -8,7 +8,7 @@
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2020, 2021, 2022 Marius Bakke <marius@gnu.org>
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
-;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -944,70 +944,58 @@ (define-public ovmf-arm
(string-append fmw "/ovmf_arm.bin")))))))))
(supported-systems %supported-systems)))
-(define* (make-arm-trusted-firmware platform #:optional (arch "aarch64"))
- (package
- (name (string-append "arm-trusted-firmware-" platform))
- (version "2.8")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
+(define* (make-arm-trusted-firmware platform
+ #:key (triplet "aarch64-linux-gnu"))
+ (let ((native-build? (lambda ()
+ ;; Note: %current-system is a *triplet*, unlike its
+ ;; name would suggest.
+ (or (not triplet) ;disable cross-compilation
+ (string=? (%current-system)
+ (gnu-triplet->nix-system triplet))))))
+ (package
+ (name (string-append "arm-trusted-firmware-" platform))
+ (version "2.8")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
;; There are only GitHub generated release snapshots.
(url "https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/")
(commit (string-append "v" version))))
- (file-name (git-file-name "arm-trusted-firmware" version))
- (sha256
- (base32
- "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3"))
- (snippet
- #~(begin
- (use-modules (guix build utils))
- ;; Remove binary blobs which do not contain source or proper license.
- (for-each (lambda (file)
- (delete-file file))
- (find-files "." "\\.bin$"))))))
- (build-system gnu-build-system)
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (delete 'configure) ; no configure script
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (bin (find-files "." "\\.(bin|elf)$")))
- (for-each
- (lambda (file)
- (install-file file out))
- bin)))))
- #:make-flags (list (string-append "PLAT=" ,platform)
- ,@(if (and (not (string-prefix? "aarch64"
- (%current-system)))
- (string-prefix? "aarch64" arch))
- `("CROSS_COMPILE=aarch64-linux-gnu-")
- '())
- ,@(if (and (not (string-prefix? "armhf"
- (%current-system)))
- (string-prefix? "armhf" arch))
- `("CROSS_COMPILE=arm-linux-gnueabihf-")
- '())
- "DEBUG=1")
- #:tests? #f)) ; no tests
- (native-inputs
- (let ((system (%current-system)))
- (cond
- ((and (not (string-prefix? "aarch64" system))
- (string-prefix? "aarch64" arch))
- (list (cross-gcc "aarch64-linux-gnu")
- (cross-binutils "aarch64-linux-gnu")))
- ((and (not (string-prefix? "armhf" system))
- (string-prefix? "armhf" arch))
- (list (cross-gcc "arm-linux-gnueabihf")
- (cross-binutils "arm-linux-gnueabihf")))
- (else '()))))
- (home-page "https://www.trustedfirmware.org/")
- (synopsis "Implementation of \"secure world software\"")
- (description
- "ARM Trusted Firmware provides a reference implementation of secure world
+ (file-name (git-file-name "arm-trusted-firmware" version))
+ (sha256
+ (base32
+ "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3"))
+ (snippet
+ #~(begin
+ (use-modules (guix build utils))
+ ;; Remove binary blobs which do not contain source or proper
+ ;; license.
+ (for-each (lambda (file)
+ (delete-file file))
+ (find-files "." "\\.bin$"))))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:target (and (not (native-build?)) triplet)
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure) ;no configure script
+ (replace 'install
+ (lambda _
+ (for-each (lambda (file)
+ (install-file file #$output))
+ (find-files "." "\\.(bin|elf)$")))))
+ #:make-flags #~(list (string-append "PLAT=" #$platform)
+ #$@(if (not (native-build?))
+ (list (string-append "CROSS_COMPILE=" triplet "-"))
+ '())
+ "DEBUG=1")
+ #:tests? #f)) ;no test suite
+ (home-page "https://www.trustedfirmware.org/")
+ (synopsis "Implementation of \"secure world software\"")
+ (description
+ "ARM Trusted Firmware provides a reference implementation of secure world
software for ARMv7A and ARMv8-A, including a Secure Monitor executing at
@dfn{Exception Level 3} (EL3). It implements various ARM interface standards,
such as:
@@ -1018,8 +1006,8 @@ (define* (make-arm-trusted-firmware platform #:optional (arch "aarch64"))
@item System Control and Management Interface
@item Software Delegated Exception Interface (SDEI)
@end enumerate\n")
- (license (list license:bsd-3
- license:bsd-2)))) ; libfdt
+ (license (list license:bsd-3
+ license:bsd-2))))) ; libfdt
(define-public arm-trusted-firmware-sun50i-a64
(let ((base (make-arm-trusted-firmware "sun50i_a64")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 11 Jan 2023 21:44
[PATCH v4 12/12] gnu: u-boot-puma-rk3399: Fix build.
(address . 60224@debbugs.gnu.org)
20230111204433.15305-12-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-puma-rk3399)
[arguments]: Use gexps.
[native-inputs]: Turn into...
[inputs]: ... this, and use modify-inputs.

---

Changes in v4:
- New commit

gnu/packages/bootloaders.scm | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 0878dd3168..c3f254cf0b 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1100,17 +1100,16 @@ (define-public u-boot-puma-rk3399
(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"
- (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
+ (inputs
+ (modify-inputs (package-native-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define-public u-boot-qemu-riscv64
(make-u-boot-package "qemu-riscv64" "riscv64-linux-gnu"))
--
2.38.1
V
V
Vagrant Cascadian wrote on 12 Jan 2023 23:12
Re: [PATCH v4 07/12] gnu: make-u-boot-sunxi64-package: Use gexps and adjust file name.
(address . rekado@elephly.net)
87tu0v7683.fsf@contorta
On 2023-01-11, Maxim Cournoyer wrote:
Toggle quote (4 lines)
> * gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package)
> [phases] {set-environment}: Replace bl31.bin with bl31.elf; bl31.elf doesn't
> exist anymore for some reason.

The code no longer mentions bl31.elf, but the commit comment still does!

Toggle quote (10 lines)
> [native-inputs]: Turn into...
> [inputs]: ... this.
>
> ---
>
> Changes in v4:
> - Revert erroneously replaced firmware package
> - Revert bl31.bin -> bl31.elf change caused by the above
> - Make the arm-trusted-firmware-sun50i-a64 a host input

So fix the commit comment to reflect that...

Toggle quote (34 lines)
> gnu/packages/bootloaders.scm | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
> index 87d5bcb824..0c5205fa86 100644
> --- a/gnu/packages/bootloaders.scm
> +++ b/gnu/packages/bootloaders.scm
> @@ -1010,17 +1010,13 @@ (define*-public (make-u-boot-sunxi64-package board triplet
> (arguments
> (substitute-keyword-arguments (package-arguments base)
> ((#:phases phases)
> - `(modify-phases ,phases
> - (add-after 'unpack 'set-environment
> - (lambda* (#:key native-inputs inputs #:allow-other-keys)
> - (let ((bl31
> - (string-append
> - (assoc-ref (or native-inputs inputs) "firmware")
> - "/bl31.bin")))
> - (setenv "BL31" bl31))))))))
> - (native-inputs
> - `(("firmware" ,arm-trusted-firmware-sun50i-a64)
> - ,@(package-native-inputs base))))))
> + #~(modify-phases #$phases
> + (add-after 'unpack 'set-environment
> + (lambda* (#:key native-inputs inputs #:allow-other-keys)
> + (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
> + (inputs
> + (modify-inputs (package-inputs base)
> + (append arm-trusted-firmware-sun50i-a64))))))
>
> (define-public u-boot-pine64-plus
> (make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
> --
> 2.38.1
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCY8CFvAAKCRDcUY/If5cW
qjsIAQCzceVg54TqcPCMuIUYQyhHQ21NkajdBa32N+EcSUzaWgD+Im8Snkih8c5a
a6O2VmJBZXwWWQ073J11If5psJqJ7AU=
=dEEF
-----END PGP SIGNATURE-----

M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 01/13] gnu: make-u-boot-package: Add a u-boot argument and use gexps.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-1-maxim.cournoyer@gmail.com
And have that u-boot argument used as the complete base of the template, so
that a user can override it.

* gnu/packages/bootloaders.scm (make-u-boot-package): New U-BOOT argument.
Document it.
[native-inputs]: Move the native-inputs of U-BOOT first, so that the
cross compilation tools can be overridden via U-BOOT.
[arguments]: Rewrite using substitute-keyword-arguments, extending rather than
overriding most arguments. Use gexps. Do not bind OUTPUTS.

---

(no changes since v3)

Changes in v3:
- No longer bind 'outputs' extraneously in build phases

gnu/packages/bootloaders.scm | 181 +++++++++++++++++++----------------
1 file changed, 97 insertions(+), 84 deletions(-)

Toggle diff (209 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 8dc6ff698d..96dd65ae9d 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -860,11 +860,13 @@ (define*-public (make-u-boot-package board triplet
defconfig
configs
name-suffix
- append-description)
+ append-description
+ (u-boot u-boot))
"Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
optional DEFCONFIG file and optional configuration changes from CONFIGS.
NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
-appended to the package description."
+appended to the package description. U-BOOT can be used when a fork or a
+different version of U-Boot must be used."
(let ((same-arch? (lambda ()
(string=? (%current-system)
(gnu-triplet->nix-system triplet)))))
@@ -879,91 +881,102 @@ (define*-public (make-u-boot-package board triplet
"\n\n" append-description)
(package-description u-boot)))
(native-inputs
- `(,@(if (not (same-arch?))
+ ;; Note: leave the native u-boot inputs first, so that a user can
+ ;; override the cross-gcc and cross-binutils packages.
+ `(,@(package-native-inputs u-boot)
+ ,@(if (not (same-arch?))
`(("cross-gcc" ,(cross-gcc triplet))
("cross-binutils" ,(cross-binutils triplet)))
- `())
- ,@(package-native-inputs u-boot)))
+ `())))
(arguments
- `(#:modules ((ice-9 ftw)
- (srfi srfi-1)
- (guix build gnu-build-system)
- (guix build kconfig)
- (guix build utils))
- #:imported-modules (,@%gnu-build-system-modules
- (guix build kconfig))
- #:test-target "test"
- #:make-flags
- (list "HOSTCC=gcc"
- "KBUILD_VERBOSE=1"
- ,@(if (not (same-arch?))
- `((string-append "CROSS_COMPILE=" ,triplet "-"))
- '()))
- #:phases
- (modify-phases %standard-phases
- (replace 'configure
- (lambda* (#:key outputs make-flags #:allow-other-keys)
- (let* ((config-name (string-append ,board "_defconfig"))
- (config-file (string-append "configs/" config-name))
- (defconfig ,defconfig)
- (configs ',configs))
- (when defconfig
- ;; Replace the board-specific defconfig with the given one.
- (copy-file defconfig config-file))
- (if (file-exists? config-file)
- (begin
- (when configs
- (modify-defconfig config-file configs))
- (apply invoke "make" `(,@make-flags ,config-name))
- (verify-config ".config" config-file))
- (begin
- (display "invalid board name; valid board names are:"
- (current-error-port))
- (let ((suffix-len (string-length "_defconfig"))
- (entries (scandir "configs")))
- (for-each (lambda (file-name)
- (when (string-suffix? "_defconfig" file-name)
- (format (current-error-port)
- "- ~A\n"
- (string-drop-right file-name
- suffix-len))))
- (sort entries string-ci<)))
- (error "invalid boardname ~s" ,board))))))
- (add-after 'configure 'disable-tools-libcrypto
- ;; Disable libcrypto due to GPL and OpenSSL license
- ;; incompatibilities
- (lambda _
- (substitute* ".config"
- (("CONFIG_TOOLS_LIBCRYPTO=.*$") "CONFIG_TOOLS_LIBCRYPTO=n"))))
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (libexec (string-append out "/libexec"))
- (uboot-files (append
- (remove
- ;; Those would not be reproducible
- ;; because of the randomness used
- ;; to produce them.
- ;; It's expected that the user will
- ;; use u-boot-tools to generate them
- ;; instead.
- (lambda (name)
- (string-suffix?
- "sunxi-spl-with-ecc.bin"
- name))
- (find-files "." ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
- (find-files "." "^(MLO|SPL)$"))))
- (mkdir-p libexec)
- (install-file ".config" libexec)
- ;; Useful for "qemu -kernel".
- (install-file "u-boot" libexec)
- (for-each
- (lambda (file)
- (let ((target-file (string-append libexec "/" file)))
- (mkdir-p (dirname target-file))
- (copy-file file target-file)))
- uboot-files)
- #t)))))))))
+ (substitute-keyword-arguments (package-arguments u-boot)
+ ((#:modules modules '())
+ `((ice-9 ftw)
+ (srfi srfi-1)
+ (guix build gnu-build-system)
+ (guix build kconfig)
+ (guix build utils)
+ ,@modules))
+ ((#:imported-modules imported-modules '())
+ `((guix build kconfig)
+ ,@%gnu-build-system-modules
+ ,@imported-modules))
+ ((#:test-target _ "test")
+ "test")
+ ((#:make-flags make-flags '())
+ #~(list "HOSTCC=gcc"
+ "KBUILD_VERBOSE=1"
+ #$@(if (not (same-arch?))
+ (list (string-append "CROSS_COMPILE=" triplet "-"))
+ '())
+ #$@make-flags))
+ ((#:phases phases '%standard-phases)
+ #~(modify-phases #$phases
+ (replace 'configure
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (let* ((config-name (string-append #$board "_defconfig"))
+ (config-file (string-append "configs/" config-name))
+ (defconfig #$defconfig)
+ (configs '#$configs))
+ (when defconfig
+ ;; Replace the board-specific defconfig with the given
+ ;; one.
+ (copy-file defconfig config-file))
+ (if (file-exists? config-file)
+ (begin
+ (when configs
+ (modify-defconfig config-file configs))
+ (apply invoke "make" `(,@make-flags ,config-name))
+ (verify-config ".config" config-file))
+ (begin
+ (display "invalid board name; valid board names are:"
+ (current-error-port))
+ (let ((suffix-len (string-length "_defconfig"))
+ (entries (scandir "configs")))
+ (for-each (lambda (file-name)
+ (when (string-suffix? "_defconfig"
+ file-name)
+ (format (current-error-port)
+ "- ~A\n"
+ (string-drop-right
+ file-name suffix-len))))
+ (sort entries string-ci<)))
+ (error "invalid boardname ~s" #$board))))))
+ (add-after 'configure 'disable-tools-libcrypto
+ ;; Disable libcrypto due to GPL and OpenSSL license
+ ;; incompatibilities
+ (lambda _
+ (substitute* ".config"
+ (("CONFIG_TOOLS_LIBCRYPTO=.*$")
+ "CONFIG_TOOLS_LIBCRYPTO=n"))))
+ (replace 'install
+ (lambda _
+ (let ((libexec (string-append #$output "/libexec"))
+ (uboot-files
+ (append
+ (remove
+ ;; Those would not be reproducible
+ ;; because of the randomness used to
+ ;; produce them. It's expected that the
+ ;; user will use u-boot-tools to generate
+ ;; them instead.
+ (lambda (name)
+ (string-suffix?
+ "sunxi-spl-with-ecc.bin"
+ name))
+ (find-files "."
+ ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+ (find-files "." "^(MLO|SPL)$"))))
+ (mkdir-p libexec)
+ (install-file ".config" libexec)
+ ;; Useful for "qemu -kernel".
+ (install-file "u-boot" libexec)
+ (for-each
+ (lambda (file)
+ (let ((target-file (string-append libexec "/" file)))
+ (mkdir-p (dirname target-file))
+ (copy-file file target-file)))
+ uboot-files)))))))))))
(define-public u-boot-am335x-boneblack
(let ((base (make-u-boot-package

base-commit: a9a38f515e5770fe7d19052c761f0f5e839af4e6
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 02/13] gnu: make-u-boot-package: Install .imx files.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-2-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm
(make-u-boot-package) [phases] <install>: Add imx to the regexp of files
considered for installation.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 96dd65ae9d..b17f8b1a9f 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -965,7 +965,7 @@ (define*-public (make-u-boot-package board triplet
"sunxi-spl-with-ecc.bin"
name))
(find-files "."
- ".*\\.(bin|efi|img|spl|itb|dtb|rksd)$"))
+ ".*\\.(bin|efi|img|imx|spl|itb|dtb|rksd)$"))
(find-files "." "^(MLO|SPL)$"))))
(mkdir-p libexec)
(install-file ".config" libexec)
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 03/13] gnu: u-boot: Reduce the number of native inputs.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-3-maxim.cournoyer@gmail.com
The extra python inputs are only needed for running the u-boot-test-tools test
suite. This lowers the requirements for cross-building the various u-boot
packages.

* gnu/packages/bootloaders.scm (u-boot) [native-inputs]: Delete bc.
Move python-coverage, python-pycryptodomex and python-pytest to...
* gnu/packages/bootloaders.scm (u-boot-tools) [native-inputs]: ... here.

---

Changes in v5:
- New commit.

gnu/packages/bootloaders.scm | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

Toggle diff (35 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index b17f8b1a9f..7ec26dda05 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -662,8 +662,7 @@ (define u-boot
"1y5x8vxdgsqdqlsvq01mn8lmw53fqairkhvhhjx83hjva0m4id2h"))))
(build-system gnu-build-system)
(native-inputs
- (list bc
- bison
+ (list bison
dtc
gnutls
flex
@@ -672,9 +671,6 @@ (define u-boot
perl
pkg-config ;for 'make menuconfig'
python
- python-coverage
- python-pycryptodomex
- python-pytest
swig
(list util-linux "lib")))
(home-page "https://www.denx.de/wiki/U-Boot/")
@@ -725,7 +721,7 @@ (define-public u-boot-tools
(name "u-boot-tools")
(native-inputs
(modify-inputs (package-native-inputs u-boot)
- (prepend sdl2)))
+ (prepend python-coverage python-pycryptodomex python-pytest sdl2)))
(arguments
`(#:make-flags '("HOSTCC=gcc")
#:test-target "tcheck"
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 04/13] gnu: make-uboot-package: Simplify build.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-4-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (make-u-boot-package) <same-arch?>: Rename
procedure to 'native-build?'.
[native-inputs]: Remove field.
[arguments]: Specify the #:target argument, when not natively building.
Adjust for the above renaming.

---

Changes in v5:
- Remove bogus comment

Changes in v3:
- Rename %current-target-system to %current-system in comment

gnu/packages/bootloaders.scm | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)

Toggle diff (48 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 7ec26dda05..b7a31c8b48 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -863,9 +863,9 @@ (define*-public (make-u-boot-package board triplet
NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
appended to the package description. U-BOOT can be used when a fork or a
different version of U-Boot must be used."
- (let ((same-arch? (lambda ()
- (string=? (%current-system)
- (gnu-triplet->nix-system triplet)))))
+ (let ((native-build? (lambda ()
+ (string=? (%current-system)
+ (gnu-triplet->nix-system triplet)))))
(package
(inherit u-boot)
(name (string-append "u-boot-"
@@ -876,16 +876,11 @@ (define*-public (make-u-boot-package board triplet
(string-append (package-description u-boot)
"\n\n" append-description)
(package-description u-boot)))
- (native-inputs
- ;; Note: leave the native u-boot inputs first, so that a user can
- ;; override the cross-gcc and cross-binutils packages.
- `(,@(package-native-inputs u-boot)
- ,@(if (not (same-arch?))
- `(("cross-gcc" ,(cross-gcc triplet))
- ("cross-binutils" ,(cross-binutils triplet)))
- `())))
+ (build-system gnu-build-system)
(arguments
(substitute-keyword-arguments (package-arguments u-boot)
+ ((#:target _ #f)
+ (and (not (native-build?)) triplet))
((#:modules modules '())
`((ice-9 ftw)
(srfi srfi-1)
@@ -902,7 +897,7 @@ (define*-public (make-u-boot-package board triplet
((#:make-flags make-flags '())
#~(list "HOSTCC=gcc"
"KBUILD_VERBOSE=1"
- #$@(if (not (same-arch?))
+ #$@(if (not (native-build?))
(list (string-append "CROSS_COMPILE=" triplet "-"))
'())
#$@make-flags))
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 05/13] gnu: make-u-boot-package: Allow disabling cross-compilation.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-5-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (make-u-boot-package): Accept #f for the
TRIPLET argument to disable cross-compilation. Update doc.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

Toggle diff (26 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index b7a31c8b48..290d832a83 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -860,12 +860,14 @@ (define*-public (make-u-boot-package board triplet
(u-boot u-boot))
"Return a U-Boot package for BOARD cross-compiled for TRIPLET with the
optional DEFCONFIG file and optional configuration changes from CONFIGS.
-NAME-SUFFIX is appended to the package name, while APPEND-DESCRIPTION is
-appended to the package description. U-BOOT can be used when a fork or a
-different version of U-Boot must be used."
+TRIPLET may also be set to #f to disable cross-compilation. NAME-SUFFIX is
+appended to the package name, while APPEND-DESCRIPTION is appended to the
+package description. U-BOOT can be used when a fork or a different version of
+U-Boot must be used."
(let ((native-build? (lambda ()
- (string=? (%current-system)
- (gnu-triplet->nix-system triplet)))))
+ (or (not triplet) ;disable cross-compilation
+ (string=? (%current-system)
+ (gnu-triplet->nix-system triplet))))))
(package
(inherit u-boot)
(name (string-append "u-boot-"
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 06/13] gnu: u-boot-pinebook-pro-rk3399: Remove input labels and use gexps.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-6-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-pinebook-pro-rk3399) [arguments]:
Remove input labels.
[native-inputs]: Use modify-inputs and turn into...
[inputs]: ... this.

---

(no changes since v4)

Changes in v4:
- Move arm-trusted-firmware-rk3399 to inputs

gnu/packages/bootloaders.scm | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 290d832a83..f3b3c91c47 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1221,17 +1221,16 @@ (define-public u-boot-pinebook-pro-rk3399
(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"
- (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file inputs "bl31.elf"))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
+ (inputs
+ (modify-inputs (package-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define*-public (make-u-boot-bin-package u-boot-package
#:key
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 07/13] gnu: u-boot-firefly-rk3399: Use gexps and fix build.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-7-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-firefly-rk3399) [arguments]: Use gexps.
[native-inputs]: Use modify-inputs and turn into...
[inputs]: ... this.

---

(no changes since v4)

Changes in v4:
- Move arm-trusted-firmware-rk3399 to inputs

gnu/packages/bootloaders.scm | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

Toggle diff (33 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index f3b3c91c47..624a832802 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1156,16 +1156,16 @@ (define-public u-boot-firefly-rk3399
(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" (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file inputs "bl31.elf"))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
+ (inputs
+ (modify-inputs (package-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define-public u-boot-rockpro64-rk3399
(let ((base (make-u-boot-package "rockpro64-rk3399" "aarch64-linux-gnu"
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 08/13] gnu: make-u-boot-sunxi64-package: Use gexps and fix build.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-8-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (make-u-boot-sunxi64-package)
[native-inputs]: Turn into...
[inputs]: ... this.

---

Changes in v5:
- Fix commit message

Changes in v4:
- Revert erroneously replaced firmware package
- Revert bl31.bin -> bl31.elf change caused by the above
- Make the arm-trusted-firmware-sun50i-a64 a host input

gnu/packages/bootloaders.scm | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 624a832802..53e6557ac7 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1001,17 +1001,13 @@ (define*-public (make-u-boot-sunxi64-package board triplet
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases)
- `(modify-phases ,phases
- (add-after 'unpack 'set-environment
- (lambda* (#:key native-inputs inputs #:allow-other-keys)
- (let ((bl31
- (string-append
- (assoc-ref (or native-inputs inputs) "firmware")
- "/bl31.bin")))
- (setenv "BL31" bl31))))))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-sun50i-a64)
- ,@(package-native-inputs base))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file inputs "bl31.bin"))))))))
+ (inputs
+ (modify-inputs (package-inputs base)
+ (append arm-trusted-firmware-sun50i-a64))))))
(define-public u-boot-pine64-plus
(make-u-boot-sunxi64-package "pine64_plus" "aarch64-linux-gnu"))
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 09/13] gnu: u-boot-rock64-rk3328: Use gexps and fix build.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-9-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-rock64-rk3328)
[arguments]: Use gexps.
[native-inputs]: Remove input labels and use modify-inputs, and turn into...
[inputs]: ... this.

---

(no changes since v4)

Changes in v4:
- Make arm-trusted-firmware-rk3328 a regular input

gnu/packages/bootloaders.scm | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

Toggle diff (28 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 53e6557ac7..64af453844 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1136,14 +1136,13 @@ (define-public u-boot-rock64-rk3328
(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 (search-input-file inputs "/bl31.elf")))
- (setenv "BL31" bl31))))))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3328)
- ,@(package-native-inputs base))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (setenv "BL31 "(search-input-file inputs "bl31.elf"))))))))
+ (inputs
+ (modify-inputs (package-inputs base)
+ (append arm-trusted-firmware-rk3328))))))
(define-public u-boot-firefly-rk3399
(let ((base (make-u-boot-package "firefly-rk3399" "aarch64-linux-gnu")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 10/13] gnu: u-boot-sifive-unmatched: Use gexps and remove inputs labels.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-10-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-sifive-unmatched)
[arguments]: Use gexps. Use search-input-file.
[inputs]: Remove labels. Use modify-inputs.
---

(no changes since v1)

gnu/packages/bootloaders.scm | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

Toggle diff (29 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 64af453844..d9f9672f77 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1119,15 +1119,14 @@ (define-public u-boot-sifive-unmatched
(arguments
(substitute-keyword-arguments (package-arguments base)
((#:phases phases)
- `(modify-phases ,phases
- (add-after 'unpack 'set-environment
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((opensbi (string-append (assoc-ref inputs "firmware")
- "/fw_dynamic.bin")))
- (setenv "OPENSBI" opensbi))))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "OPENSBI" (search-input-file inputs
+ "fw_dynamic.bin"))))))))
(inputs
- `(("firmware" ,opensbi-generic)
- ,@(package-inputs base))))))
+ (modify-inputs (package-inputs base)
+ (append opensbi-generic))))))
(define-public u-boot-rock64-rk3328
(let ((base (make-u-boot-package "rock64-rk3328" "aarch64-linux-gnu")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 11/13] gnu: u-boot-rockpro64-rk3399: Use gexps and fix build.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-11-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-rockpro64-rk3399)
[phases]: Use gexps.
[native-inputs]: Use modify-inputs and turn into...
[inputs]: ... this.

---

(no changes since v4)

Changes in v4:
- Make the arm-trusted-firmware-rk3399 a regular input

gnu/packages/bootloaders.scm | 45 ++++++++++++++++++------------------
1 file changed, 22 insertions(+), 23 deletions(-)

Toggle diff (66 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index d9f9672f77..9da97232ea 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1176,37 +1176,36 @@ (define-public u-boot-rockpro64-rk3399
(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"
- (search-input-file inputs "/bl31.elf"))))
- (add-after 'unpack 'patch-header
- (lambda _
- (substitute* "include/config_distro_bootcmd.h"
- (("\"scsi_need_init=false")
- "\"setenv scsi_need_init false")
- (("#define BOOTENV_SET_SCSI_NEED_INIT \"scsi_need_init=;")
- "#define BOOTENV_SET_SCSI_NEED_INIT \"setenv scsi_need_init;"))
- (substitute* "include/configs/rockchip-common.h"
- (("#define BOOT_TARGET_DEVICES\\(func\\)")
- "
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
+ (add-after 'unpack 'patch-header
+ (lambda _
+ (substitute* "include/config_distro_bootcmd.h"
+ (("\"scsi_need_init=false")
+ "\"setenv scsi_need_init false")
+ (("#define BOOTENV_SET_SCSI_NEED_INIT \"scsi_need_init=;")
+ "#define BOOTENV_SET_SCSI_NEED_INIT \"setenv scsi_need_init;"))
+ (substitute* "include/configs/rockchip-common.h"
+ (("#define BOOT_TARGET_DEVICES\\(func\\)")
+ "
#if CONFIG_IS_ENABLED(CMD_SCSI)
#define BOOT_TARGET_SCSI(func) func(SCSI, scsi, 0)
#else
#define BOOT_TARGET_SCSI(func)
#endif
#define BOOT_TARGET_DEVICES(func)")
- (("BOOT_TARGET_NVME\\(func\\) \\\\")
- "\
+ (("BOOT_TARGET_NVME\\(func\\) \\\\")
+ "\
BOOT_TARGET_NVME(func) \\
BOOT_TARGET_SCSI(func) \\"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
+ (inputs
+ (modify-inputs (package-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define-public u-boot-pinebook-pro-rk3399
(let ((base (make-u-boot-package "pinebook-pro-rk3399" "aarch64-linux-gnu")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 12/13] gnu: make-arm-trusted-firmware: Simplify build.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-12-maxim.cournoyer@gmail.com
Reuse knowledge from recent U-Boot modifications to streamline the package
definition.

* gnu/packages/firmware.scm (make-arm-trusted-firmware): Change optional
argument ARCH to keyword TRIPLET. Default to aarch64-linux-gnu.
[arguments]: Use gexps. Add a #:target argument. Streamline how the
CROSS_COMPILE make flag is computed.
[native-inputs]: Delete field.

---

(no changes since v4)

Changes in v4:
- New commit

gnu/packages/firmware.scm | 116 +++++++++++++++++---------------------
1 file changed, 52 insertions(+), 64 deletions(-)

Toggle diff (146 lines)
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index b6ee4c0565..029e84d5c2 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -8,7 +8,7 @@
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2020, 2021, 2022 Marius Bakke <marius@gnu.org>
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
-;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -944,70 +944,58 @@ (define-public ovmf-arm
(string-append fmw "/ovmf_arm.bin")))))))))
(supported-systems %supported-systems)))
-(define* (make-arm-trusted-firmware platform #:optional (arch "aarch64"))
- (package
- (name (string-append "arm-trusted-firmware-" platform))
- (version "2.8")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
+(define* (make-arm-trusted-firmware platform
+ #:key (triplet "aarch64-linux-gnu"))
+ (let ((native-build? (lambda ()
+ ;; Note: %current-system is a *triplet*, unlike its
+ ;; name would suggest.
+ (or (not triplet) ;disable cross-compilation
+ (string=? (%current-system)
+ (gnu-triplet->nix-system triplet))))))
+ (package
+ (name (string-append "arm-trusted-firmware-" platform))
+ (version "2.8")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
;; There are only GitHub generated release snapshots.
(url "https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/")
(commit (string-append "v" version))))
- (file-name (git-file-name "arm-trusted-firmware" version))
- (sha256
- (base32
- "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3"))
- (snippet
- #~(begin
- (use-modules (guix build utils))
- ;; Remove binary blobs which do not contain source or proper license.
- (for-each (lambda (file)
- (delete-file file))
- (find-files "." "\\.bin$"))))))
- (build-system gnu-build-system)
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (delete 'configure) ; no configure script
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (bin (find-files "." "\\.(bin|elf)$")))
- (for-each
- (lambda (file)
- (install-file file out))
- bin)))))
- #:make-flags (list (string-append "PLAT=" ,platform)
- ,@(if (and (not (string-prefix? "aarch64"
- (%current-system)))
- (string-prefix? "aarch64" arch))
- `("CROSS_COMPILE=aarch64-linux-gnu-")
- '())
- ,@(if (and (not (string-prefix? "armhf"
- (%current-system)))
- (string-prefix? "armhf" arch))
- `("CROSS_COMPILE=arm-linux-gnueabihf-")
- '())
- "DEBUG=1")
- #:tests? #f)) ; no tests
- (native-inputs
- (let ((system (%current-system)))
- (cond
- ((and (not (string-prefix? "aarch64" system))
- (string-prefix? "aarch64" arch))
- (list (cross-gcc "aarch64-linux-gnu")
- (cross-binutils "aarch64-linux-gnu")))
- ((and (not (string-prefix? "armhf" system))
- (string-prefix? "armhf" arch))
- (list (cross-gcc "arm-linux-gnueabihf")
- (cross-binutils "arm-linux-gnueabihf")))
- (else '()))))
- (home-page "https://www.trustedfirmware.org/")
- (synopsis "Implementation of \"secure world software\"")
- (description
- "ARM Trusted Firmware provides a reference implementation of secure world
+ (file-name (git-file-name "arm-trusted-firmware" version))
+ (sha256
+ (base32
+ "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3"))
+ (snippet
+ #~(begin
+ (use-modules (guix build utils))
+ ;; Remove binary blobs which do not contain source or proper
+ ;; license.
+ (for-each (lambda (file)
+ (delete-file file))
+ (find-files "." "\\.bin$"))))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:target (and (not (native-build?)) triplet)
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure) ;no configure script
+ (replace 'install
+ (lambda _
+ (for-each (lambda (file)
+ (install-file file #$output))
+ (find-files "." "\\.(bin|elf)$")))))
+ #:make-flags #~(list (string-append "PLAT=" #$platform)
+ #$@(if (not (native-build?))
+ (list (string-append "CROSS_COMPILE=" triplet "-"))
+ '())
+ "DEBUG=1")
+ #:tests? #f)) ;no test suite
+ (home-page "https://www.trustedfirmware.org/")
+ (synopsis "Implementation of \"secure world software\"")
+ (description
+ "ARM Trusted Firmware provides a reference implementation of secure world
software for ARMv7A and ARMv8-A, including a Secure Monitor executing at
@dfn{Exception Level 3} (EL3). It implements various ARM interface standards,
such as:
@@ -1018,8 +1006,8 @@ (define* (make-arm-trusted-firmware platform #:optional (arch "aarch64"))
@item System Control and Management Interface
@item Software Delegated Exception Interface (SDEI)
@end enumerate\n")
- (license (list license:bsd-3
- license:bsd-2)))) ; libfdt
+ (license (list license:bsd-3
+ license:bsd-2))))) ; libfdt
(define-public arm-trusted-firmware-sun50i-a64
(let ((base (make-arm-trusted-firmware "sun50i_a64")))
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:25
[PATCH v5 13/13] gnu: u-boot-puma-rk3399: Use gexps and fix build.
(address . 60224@debbugs.gnu.org)
20230116032544.1378-13-maxim.cournoyer@gmail.com
* gnu/packages/bootloaders.scm (u-boot-puma-rk3399)
[arguments]: Use gexps.
[native-inputs]: Turn into...
[inputs]: ... this, and use modify-inputs.

---

(no changes since v4)

Changes in v4:
- New commit

gnu/packages/bootloaders.scm | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

Toggle diff (34 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 9da97232ea..4cf6a74022 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -1091,17 +1091,16 @@ (define-public u-boot-puma-rk3399
(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"
- (search-input-file inputs "/bl31.elf"))))
- ;; Phases do not succeed on the bl31 ELF.
- (delete 'strip)
- (delete 'validate-runpath)))))
- (native-inputs
- `(("firmware" ,arm-trusted-firmware-rk3399)
- ,@(package-native-inputs base))))))
+ #~(modify-phases #$phases
+ (add-after 'unpack 'set-environment
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "BL31" (search-input-file inputs "/bl31.elf"))))
+ ;; Phases do not succeed on the bl31 ELF.
+ (delete 'strip)
+ (delete 'validate-runpath)))))
+ (inputs
+ (modify-inputs (package-native-inputs base)
+ (append arm-trusted-firmware-rk3399))))))
(define-public u-boot-qemu-riscv64
(make-u-boot-package "qemu-riscv64" "riscv64-linux-gnu"))
--
2.38.1
M
M
Maxim Cournoyer wrote on 16 Jan 2023 04:26
control message for bug #60224
(address . control@debbugs.gnu.org)
87bkmzcg72.fsf@gmail.com
block 60224 by 60802
quit
M
M
Maxim Cournoyer wrote on 19 Jan 2023 03:10
Re: bug#60224: [PATCH 0/9] Improvements to our u-boot tooling
(address . 60224-done@debbugs.gnu.org)
87cz7be0l0.fsf_-_@gmail.com
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (10 lines)
> And have that u-boot argument used as the complete base of the template, so
> that a user can override it.
>
> * gnu/packages/bootloaders.scm (make-u-boot-package): New U-BOOT argument.
> Document it.
> [native-inputs]: Move the native-inputs of U-BOOT first, so that the
> cross compilation tools can be overridden via U-BOOT.
> [arguments]: Rewrite using substitute-keyword-arguments, extending rather than
> overriding most arguments. Use gexps. Do not bind OUTPUTS.

As suggested by Vagrant on #guix, I've checked some outputs md5 sums
matched with the new build style (they did!) and pushed.

Thanks for the reviews!

--
Thanks,
Maxim
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 60224@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 60224
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch