mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 13:58:15 -05:00
gnu: make-arm-trusted-firmware: Simplify build.
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. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
parent
ea0d3e1ec4
commit
4276283b30
1 changed files with 52 additions and 64 deletions
|
@ -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")))
|
||||
|
|
Loading…
Reference in a new issue