[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#60224] [PATCH v4 11/12] gnu: make-arm-trusted-firmware: Simplify bu
From: |
Maxim Cournoyer |
Subject: |
[bug#60224] [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@gmail.com>
;;; Copyright © 2020, 2021, 2022 Marius Bakke <marius@gnu.org>
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
-;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -944,70 +944,58 @@ (define-public ovmf-arm
(string-append fmw "/ovmf_arm.bin")))))))))
(supported-systems %supported-systems)))
-(define* (make-arm-trusted-firmware platform #:optional (arch "aarch64"))
- (package
- (name (string-append "arm-trusted-firmware-" platform))
- (version "2.8")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
+(define* (make-arm-trusted-firmware platform
+ #:key (triplet "aarch64-linux-gnu"))
+ (let ((native-build? (lambda ()
+ ;; Note: %current-system is a *triplet*, unlike its
+ ;; name would suggest.
+ (or (not triplet) ;disable cross-compilation
+ (string=? (%current-system)
+ (gnu-triplet->nix-system triplet))))))
+ (package
+ (name (string-append "arm-trusted-firmware-" platform))
+ (version "2.8")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
;; There are only GitHub generated release snapshots.
(url
"https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/")
(commit (string-append "v" version))))
- (file-name (git-file-name "arm-trusted-firmware" version))
- (sha256
- (base32
- "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3"))
- (snippet
- #~(begin
- (use-modules (guix build utils))
- ;; Remove binary blobs which do not contain source or proper
license.
- (for-each (lambda (file)
- (delete-file file))
- (find-files "." "\\.bin$"))))))
- (build-system gnu-build-system)
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (delete 'configure) ; no configure script
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (bin (find-files "." "\\.(bin|elf)$")))
- (for-each
- (lambda (file)
- (install-file file out))
- bin)))))
- #:make-flags (list (string-append "PLAT=" ,platform)
- ,@(if (and (not (string-prefix? "aarch64"
- (%current-system)))
- (string-prefix? "aarch64" arch))
- `("CROSS_COMPILE=aarch64-linux-gnu-")
- '())
- ,@(if (and (not (string-prefix? "armhf"
- (%current-system)))
- (string-prefix? "armhf" arch))
- `("CROSS_COMPILE=arm-linux-gnueabihf-")
- '())
- "DEBUG=1")
- #:tests? #f)) ; no tests
- (native-inputs
- (let ((system (%current-system)))
- (cond
- ((and (not (string-prefix? "aarch64" system))
- (string-prefix? "aarch64" arch))
- (list (cross-gcc "aarch64-linux-gnu")
- (cross-binutils "aarch64-linux-gnu")))
- ((and (not (string-prefix? "armhf" system))
- (string-prefix? "armhf" arch))
- (list (cross-gcc "arm-linux-gnueabihf")
- (cross-binutils "arm-linux-gnueabihf")))
- (else '()))))
- (home-page "https://www.trustedfirmware.org/")
- (synopsis "Implementation of \"secure world software\"")
- (description
- "ARM Trusted Firmware provides a reference implementation of secure world
+ (file-name (git-file-name "arm-trusted-firmware" version))
+ (sha256
+ (base32
+ "0grq3fgxi9xhcljnhwlxjvdghyz15gaq50raw41xy4lm8rkmnzp3"))
+ (snippet
+ #~(begin
+ (use-modules (guix build utils))
+ ;; Remove binary blobs which do not contain source or proper
+ ;; license.
+ (for-each (lambda (file)
+ (delete-file file))
+ (find-files "." "\\.bin$"))))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:target (and (not (native-build?)) triplet)
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure) ;no configure script
+ (replace 'install
+ (lambda _
+ (for-each (lambda (file)
+ (install-file file #$output))
+ (find-files "." "\\.(bin|elf)$")))))
+ #:make-flags #~(list (string-append "PLAT=" #$platform)
+ #$@(if (not (native-build?))
+ (list (string-append "CROSS_COMPILE="
triplet "-"))
+ '())
+ "DEBUG=1")
+ #:tests? #f)) ;no test suite
+ (home-page "https://www.trustedfirmware.org/")
+ (synopsis "Implementation of \"secure world software\"")
+ (description
+ "ARM Trusted Firmware provides a reference implementation of secure
world
software for ARMv7A and ARMv8-A, including a Secure Monitor executing at
@dfn{Exception Level 3} (EL3). It implements various ARM interface standards,
such as:
@@ -1018,8 +1006,8 @@ (define* (make-arm-trusted-firmware platform #:optional
(arch "aarch64"))
@item System Control and Management Interface
@item Software Delegated Exception Interface (SDEI)
@end enumerate\n")
- (license (list license:bsd-3
- license:bsd-2)))) ; libfdt
+ (license (list license:bsd-3
+ license:bsd-2))))) ; libfdt
(define-public arm-trusted-firmware-sun50i-a64
(let ((base (make-arm-trusted-firmware "sun50i_a64")))
--
2.38.1
- [bug#60224] [PATCH v4 03/12] gnu: make-uboot-package: Simplify build., (continued)
- [bug#60224] [PATCH v4 03/12] gnu: make-uboot-package: Simplify build., Maxim Cournoyer, 2023/01/11
- [bug#60224] [PATCH v4 07/12] gnu: make-u-boot-sunxi64-package: Use gexps and adjust file name., Maxim Cournoyer, 2023/01/11
- [bug#60224] [PATCH v4 06/12] gnu: u-boot-firefly-rk3399: Use gexps and fix cross-build., Maxim Cournoyer, 2023/01/11
- [bug#60224] [PATCH v4 04/12] gnu: make-u-boot-package: Allow disabling cross-compilation., Maxim Cournoyer, 2023/01/11
- [bug#60224] [PATCH v4 05/12] gnu: u-boot-pinebook-pro-rk3399: Remove input labels and use gexps., Maxim Cournoyer, 2023/01/11
- [bug#60224] [PATCH v4 08/12] gnu: u-boot-rock64-rk3328: Fix build., Maxim Cournoyer, 2023/01/11
- [bug#60224] [PATCH v4 09/12] gnu: u-boot-sifive-unmatched: Use gexps and remove inputs., Maxim Cournoyer, 2023/01/11
- [bug#60224] [PATCH v4 10/12] gnu: u-boot-rockpro64-rk3399: Fix build., Maxim Cournoyer, 2023/01/11
- [bug#60224] [PATCH v4 12/12] gnu: u-boot-puma-rk3399: Fix build., Maxim Cournoyer, 2023/01/11
- [bug#60224] [PATCH v4 11/12] gnu: make-arm-trusted-firmware: Simplify build.,
Maxim Cournoyer <=