GNU bug report logs - #60224
[PATCH 0/9] Improvements to our u-boot tooling

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Tue, 20 Dec 2022 16:52:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60224 in the body.
You can then email your comments to 60224 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Tue, 20 Dec 2022 16:52:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 20 Dec 2022 16:52:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 0/9] Improvements to our u-boot tooling
Date: Tue, 20 Dec 2022 11:50:38 -0500
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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Tue, 20 Dec 2022 18:35:02 GMT) Full text and rfc822 format available.

Message #8 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 1/9] gnu: make-u-boot-package: Add a u-boot argument and use
 gexps.
Date: Tue, 20 Dec 2022 13:34:19 -0500
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(-)

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 <at> waegenei.re>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
 ;;; Copyright © 2021 Stefan <stefan-guix <at> vodafonemail.de>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Tue, 20 Dec 2022 18:35:03 GMT) Full text and rfc822 format available.

Message #11 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 2/9] gnu: make-u-boot-package: Install .imx files.
Date: Tue, 20 Dec 2022 13:34:20 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Tue, 20 Dec 2022 18:35:03 GMT) Full text and rfc822 format available.

Message #14 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 3/9] gnu: make-uboot-package: Simplify build.
Date: Tue, 20 Dec 2022 13:34:21 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Tue, 20 Dec 2022 18:35:04 GMT) Full text and rfc822 format available.

Message #17 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 4/9] gnu: u-boot-pinebook-pro-rk3399: Remove input labels and
 use gexps.
Date: Tue, 20 Dec 2022 13:34:22 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Tue, 20 Dec 2022 18:35:04 GMT) Full text and rfc822 format available.

Message #20 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 5/9] gnu: u-boot-firefly-rk3399: Use gexps and fix cross-build.
Date: Tue, 20 Dec 2022 13:34:23 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Tue, 20 Dec 2022 18:35:04 GMT) Full text and rfc822 format available.

Message #23 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 6/9] gnu: make-u-boot-sunxi64-package: Use gexps and adjust
 file name.
Date: Tue, 20 Dec 2022 13:34:24 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Tue, 20 Dec 2022 18:35:05 GMT) Full text and rfc822 format available.

Message #26 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 7/9] gnu: u-boot-rock64-rk3328: Fix build.
Date: Tue, 20 Dec 2022 13:34:25 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Tue, 20 Dec 2022 18:35:05 GMT) Full text and rfc822 format available.

Message #29 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 8/9] gnu: u-boot-sifive-unmatched: Use gexps and remove inputs.
Date: Tue, 20 Dec 2022 13:34:26 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Tue, 20 Dec 2022 18:35:06 GMT) Full text and rfc822 format available.

Message #32 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH 9/9] gnu: u-boot-puma-rk3399: Use make-u-boot-sunxi64-package.
Date: Tue, 20 Dec 2022 13:34:27 -0500
* 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(-)

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





Added indication that bug 60224 blocks59761 Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 20 Dec 2022 18:36:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Thu, 29 Dec 2022 19:32:01 GMT) Full text and rfc822 format available.

Message #37 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: 60224 <at> debbugs.gnu.org
Subject: [PATCH 0/9] Improvements to our u-boot tooling
Date: Thu, 29 Dec 2022 20:18:57 +0100
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




Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:29:01 GMT) Full text and rfc822 format available.

Message #40 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 60224 <at> debbugs.gnu.org
Subject: Re: bug#60224: [PATCH 0/9] Improvements to our u-boot tooling
Date: Sun, 01 Jan 2023 19:27:52 -0500
Hi Ricardo!

Ricardo Wurmus <rekado <at> elephly.net> writes:

> 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 :-)).

> 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!

> [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!

> [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.

> [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.

> [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




Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:47:02 GMT) Full text and rfc822 format available.

Message #43 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 02/11] gnu: make-u-boot-package: Install .imx files.
Date: Sun,  1 Jan 2023 19:46:27 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:47:03 GMT) Full text and rfc822 format available.

Message #46 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 01/11] gnu: make-u-boot-package: Add a u-boot argument and
 use gexps.
Date: Sun,  1 Jan 2023 19:46:26 -0500
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:47:03 GMT) Full text and rfc822 format available.

Message #49 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 03/11] gnu: make-uboot-package: Simplify build.
Date: Sun,  1 Jan 2023 19:46:28 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:47:04 GMT) Full text and rfc822 format available.

Message #52 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 04/11] gnu: make-u-boot-package: Allow disabling
 cross-compilation.
Date: Sun,  1 Jan 2023 19:46:29 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:47:04 GMT) Full text and rfc822 format available.

Message #55 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 10/11] gnu: u-boot-puma-rk3399: Use
 make-u-boot-sunxi64-package.
Date: Sun,  1 Jan 2023 19:46:35 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:47:05 GMT) Full text and rfc822 format available.

Message #58 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 05/11] gnu: u-boot-pinebook-pro-rk3399: Remove input labels
 and use gexps.
Date: Sun,  1 Jan 2023 19:46:30 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:47:06 GMT) Full text and rfc822 format available.

Message #61 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 06/11] gnu: u-boot-firefly-rk3399: Use gexps and fix
 cross-build.
Date: Sun,  1 Jan 2023 19:46:31 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:47:06 GMT) Full text and rfc822 format available.

Message #64 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 07/11] gnu: make-u-boot-sunxi64-package: Use gexps and
 adjust file name.
Date: Sun,  1 Jan 2023 19:46:32 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:47:06 GMT) Full text and rfc822 format available.

Message #67 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 08/11] gnu: u-boot-rock64-rk3328: Fix build.
Date: Sun,  1 Jan 2023 19:46:33 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:48:02 GMT) Full text and rfc822 format available.

Message #70 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 11/11] gnu: u-boot-rockpro64-rk3399: Fix build.
Date: Sun,  1 Jan 2023 19:46:36 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 02 Jan 2023 00:48:03 GMT) Full text and rfc822 format available.

Message #73 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [PATCH v3 09/11] gnu: u-boot-sifive-unmatched: Use gexps and remove
 inputs.
Date: Sun,  1 Jan 2023 19:46:34 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Fri, 06 Jan 2023 17:10:01 GMT) Full text and rfc822 format available.

Message #76 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Vagrant Cascadian <vagrant <at> debian.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net
Subject: Re: [bug#60224] [PATCH v3 10/11] gnu: u-boot-puma-rk3399: Use
 make-u-boot-sunxi64-package.
Date: Fri, 06 Jan 2023 09:09:31 -0800
[Message part 1 (text/plain, inline)]
On 2023-01-01, Maxim Cournoyer wrote:
> * gnu/packages/bootloaders.scm (u-boot-puma-rk3399): Use make-u-boot-sunxi64-package.
...
> 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
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Fri, 06 Jan 2023 17:18:02 GMT) Full text and rfc822 format available.

Message #79 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Vagrant Cascadian <vagrant <at> debian.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: Re: [bug#60224] [PATCH v3 07/11] gnu: make-u-boot-sunxi64-package:
 Use gexps and adjust file name.
Date: Fri, 06 Jan 2023 09:17:12 -0800
[Message part 1 (text/plain, inline)]
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. :/

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...

>  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.


>        (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
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 19:56:01 GMT) Full text and rfc822 format available.

Message #82 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Vagrant Cascadian <vagrant <at> debian.org>
Cc: rekado <at> elephly.net, 60224 <at> debbugs.gnu.org
Subject: Re: [bug#60224] [PATCH v3 07/11] gnu: make-u-boot-sunxi64-package:
 Use gexps and adjust file name.
Date: Wed, 11 Jan 2023 14:55:48 -0500
Hi Vagrant!

Vagrant Cascadian <vagrant <at> debian.org> writes:

> 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. :/

[...]

>> +          #~(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 ^ ...
>
>>        (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!

> 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:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build u-boot-puma-rk3399 guix build: error: gnu/packages/check.scm:1997:2:
python-coverage <at> 5.2.1: build system `python' does not support cross
builds
--8<---------------cut here---------------end--------------->8---

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




Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:45:03 GMT) Full text and rfc822 format available.

Message #85 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 01/12] gnu: make-u-boot-package: Add a u-boot argument and
 use gexps.
Date: Wed, 11 Jan 2023 15:44:22 -0500
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:45:04 GMT) Full text and rfc822 format available.

Message #88 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 02/12] gnu: make-u-boot-package: Install .imx files.
Date: Wed, 11 Jan 2023 15:44:23 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:45:04 GMT) Full text and rfc822 format available.

Message #91 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 07/12] gnu: make-u-boot-sunxi64-package: Use gexps and
 adjust file name.
Date: Wed, 11 Jan 2023 15:44:28 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:45:05 GMT) Full text and rfc822 format available.

Message #94 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 03/12] gnu: make-uboot-package: Simplify build.
Date: Wed, 11 Jan 2023 15:44:24 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:45:05 GMT) Full text and rfc822 format available.

Message #97 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 04/12] gnu: make-u-boot-package: Allow disabling
 cross-compilation.
Date: Wed, 11 Jan 2023 15:44:25 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:45:06 GMT) Full text and rfc822 format available.

Message #100 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 05/12] gnu: u-boot-pinebook-pro-rk3399: Remove input labels
 and use gexps.
Date: Wed, 11 Jan 2023 15:44:26 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:45:06 GMT) Full text and rfc822 format available.

Message #103 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 06/12] gnu: u-boot-firefly-rk3399: Use gexps and fix
 cross-build.
Date: Wed, 11 Jan 2023 15:44:27 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:46:02 GMT) Full text and rfc822 format available.

Message #106 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 08/12] gnu: u-boot-rock64-rk3328: Fix build.
Date: Wed, 11 Jan 2023 15:44:29 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:46:02 GMT) Full text and rfc822 format available.

Message #109 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 09/12] gnu: u-boot-sifive-unmatched: Use gexps and remove
 inputs.
Date: Wed, 11 Jan 2023 15:44:30 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:46:02 GMT) Full text and rfc822 format available.

Message #112 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 10/12] gnu: u-boot-rockpro64-rk3399: Fix build.
Date: Wed, 11 Jan 2023 15:44:31 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:46:03 GMT) Full text and rfc822 format available.

Message #115 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 11/12] gnu: make-arm-trusted-firmware: Simplify build.
Date: Wed, 11 Jan 2023 15:44:32 -0500
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(-)

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 <at> gmail.com>
 ;;; Copyright © 2020, 2021, 2022 Marius Bakke <marius <at> gnu.org>
 ;;; Copyright © 2021 Petr Hodina <phodina <at> protonmail.com>
-;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Wed, 11 Jan 2023 20:46:03 GMT) Full text and rfc822 format available.

Message #118 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v4 12/12] gnu: u-boot-puma-rk3399: Fix build.
Date: Wed, 11 Jan 2023 15:44:33 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Thu, 12 Jan 2023 22:13:01 GMT) Full text and rfc822 format available.

Message #121 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Vagrant Cascadian <vagrant <at> debian.org>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net
Subject: Re: [PATCH v4 07/12] gnu: make-u-boot-sunxi64-package: Use gexps
 and adjust file name.
Date: Thu, 12 Jan 2023 14:12:12 -0800
[Message part 1 (text/plain, inline)]
On 2023-01-11, 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.

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

> [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...

>  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
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:02 GMT) Full text and rfc822 format available.

Message #124 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 01/13] gnu: make-u-boot-package: Add a u-boot argument and
 use gexps.
Date: Sun, 15 Jan 2023 22:25:32 -0500
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:02 GMT) Full text and rfc822 format available.

Message #127 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 02/13] gnu: make-u-boot-package: Install .imx files.
Date: Sun, 15 Jan 2023 22:25:33 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:02 GMT) Full text and rfc822 format available.

Message #130 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, U-Boot Mailing List <u-boot <at> lists.denx.de>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, vagrant <at> reproducible-builds.org
Subject: [PATCH v5 03/13] gnu: u-boot: Reduce the number of native inputs.
Date: Sun, 15 Jan 2023 22:25:34 -0500
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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:03 GMT) Full text and rfc822 format available.

Message #133 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 04/13] gnu: make-uboot-package: Simplify build.
Date: Sun, 15 Jan 2023 22:25:35 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:03 GMT) Full text and rfc822 format available.

Message #136 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 05/13] gnu: make-u-boot-package: Allow disabling
 cross-compilation.
Date: Sun, 15 Jan 2023 22:25:36 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:04 GMT) Full text and rfc822 format available.

Message #139 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 06/13] gnu: u-boot-pinebook-pro-rk3399: Remove input labels
 and use gexps.
Date: Sun, 15 Jan 2023 22:25:37 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:04 GMT) Full text and rfc822 format available.

Message #142 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 07/13] gnu: u-boot-firefly-rk3399: Use gexps and fix build.
Date: Sun, 15 Jan 2023 22:25:38 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:05 GMT) Full text and rfc822 format available.

Message #145 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 08/13] gnu: make-u-boot-sunxi64-package: Use gexps and fix
 build.
Date: Sun, 15 Jan 2023 22:25:39 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:05 GMT) Full text and rfc822 format available.

Message #148 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 09/13] gnu: u-boot-rock64-rk3328: Use gexps and fix build.
Date: Sun, 15 Jan 2023 22:25:40 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:05 GMT) Full text and rfc822 format available.

Message #151 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 10/13] gnu: u-boot-sifive-unmatched: Use gexps and remove
 inputs labels.
Date: Sun, 15 Jan 2023 22:25:41 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:06 GMT) Full text and rfc822 format available.

Message #154 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 11/13] gnu: u-boot-rockpro64-rk3399: Use gexps and fix
 build.
Date: Sun, 15 Jan 2023 22:25:42 -0500
* 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(-)

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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:06 GMT) Full text and rfc822 format available.

Message #157 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 12/13] gnu: make-arm-trusted-firmware: Simplify build.
Date: Sun, 15 Jan 2023 22:25:43 -0500
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(-)

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 <at> gmail.com>
 ;;; Copyright © 2020, 2021, 2022 Marius Bakke <marius <at> gnu.org>
 ;;; Copyright © 2021 Petr Hodina <phodina <at> protonmail.com>
-;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer <at> 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





Information forwarded to guix-patches <at> gnu.org:
bug#60224; Package guix-patches. (Mon, 16 Jan 2023 03:27:07 GMT) Full text and rfc822 format available.

Message #160 received at 60224 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224 <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 vagrant <at> reproducible-builds.org
Subject: [PATCH v5 13/13] gnu: u-boot-puma-rk3399: Use gexps and fix build.
Date: Sun, 15 Jan 2023 22:25:44 -0500
* 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(-)

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





Added blocking bug(s) 60802 Request was from Maxim Cournoyer <maxim.cournoyer <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 16 Jan 2023 03:27:07 GMT) Full text and rfc822 format available.

Reply sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
You have taken responsibility. (Thu, 19 Jan 2023 02:11:02 GMT) Full text and rfc822 format available.

Notification sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
bug acknowledged by developer. (Thu, 19 Jan 2023 02:11:02 GMT) Full text and rfc822 format available.

Message #167 received at 60224-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 60224-done <at> debbugs.gnu.org
Cc: rekado <at> elephly.net, vagrant <at> reproducible-builds.org
Subject: Re: bug#60224: [PATCH 0/9] Improvements to our u-boot tooling
Date: Wed, 18 Jan 2023 21:10:19 -0500
Hi,

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

> 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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 16 Feb 2023 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 181 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.