firmware.scm 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
  4. ;;; Copyright © 2017 David Craven <david@craven.ch>
  5. ;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
  6. ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  7. ;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
  8. ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
  9. ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
  10. ;;;
  11. ;;; This file is part of GNU Guix.
  12. ;;;
  13. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  14. ;;; under the terms of the GNU General Public License as published by
  15. ;;; the Free Software Foundation; either version 3 of the License, or (at
  16. ;;; your option) any later version.
  17. ;;;
  18. ;;; GNU Guix is distributed in the hope that it will be useful, but
  19. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  20. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. ;;; GNU General Public License for more details.
  22. ;;;
  23. ;;; You should have received a copy of the GNU General Public License
  24. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  25. (define-module (gnu packages firmware)
  26. #:use-module ((guix licenses) #:prefix license:)
  27. #:use-module (guix packages)
  28. #:use-module (guix download)
  29. #:use-module (guix utils)
  30. #:use-module (guix git-download)
  31. #:use-module (guix build-system gnu)
  32. #:use-module (gnu packages)
  33. #:use-module (gnu packages admin)
  34. #:use-module (gnu packages assembly)
  35. #:use-module (gnu packages base)
  36. #:use-module (gnu packages bison)
  37. #:use-module (gnu packages cmake)
  38. #:use-module (gnu packages cross-base)
  39. #:use-module (gnu packages flex)
  40. #:use-module (gnu packages gcc)
  41. #:use-module (gnu packages linux)
  42. #:use-module (gnu packages perl)
  43. #:use-module (gnu packages python))
  44. (define-public ath9k-htc-firmware
  45. (package
  46. (name "ath9k-htc-firmware")
  47. (version "1.4.0")
  48. (source (origin
  49. (method git-fetch)
  50. (uri (git-reference
  51. (url "https://github.com/qca/open-ath9k-htc-firmware")
  52. (commit version)))
  53. (sha256
  54. (base32
  55. "16jbj8avg5jkgvq5lxm0hdxxn4c3zn7fx8b4nxllvr024apk9w23"))
  56. (file-name (git-file-name name version))
  57. (patches (search-patches "ath9k-htc-firmware-objcopy.patch"
  58. "ath9k-htc-firmware-gcc-compat.patch"))))
  59. (build-system gnu-build-system)
  60. (arguments
  61. '(#:phases
  62. (modify-phases %standard-phases
  63. (add-before 'configure 'pre-configure
  64. (lambda* (#:key inputs native-inputs #:allow-other-keys)
  65. (chdir "target_firmware")
  66. ;; 'configure' is a simple script that runs 'cmake' with
  67. ;; the right flags.
  68. (substitute* "configure"
  69. (("^TOOLCHAIN=.*$")
  70. (string-append "TOOLCHAIN="
  71. (assoc-ref (or native-inputs inputs) "cross-gcc")
  72. "\n")))
  73. #t))
  74. (replace 'install
  75. (lambda* (#:key outputs #:allow-other-keys)
  76. (let* ((out (assoc-ref outputs "out"))
  77. (fw-dir (string-append out "/lib/firmware")))
  78. (for-each (lambda (file)
  79. (install-file file fw-dir))
  80. (find-files "." "\\.fw$"))
  81. #t))))
  82. #:tests? #f))
  83. ;; The firmware is cross-compiled using a "bare bones" compiler (no libc.)
  84. ;; Use our own tool chain for that.
  85. (native-inputs `(("cross-gcc" ,(cross-gcc
  86. "xtensa-elf"
  87. #:xbinutils (cross-binutils "xtensa-elf"
  88. binutils-2.33)))
  89. ("cross-binutils" ,(cross-binutils "xtensa-elf" binutils-2.33))
  90. ("cmake" ,cmake-minimal)
  91. ("perl" ,perl)))
  92. (home-page "https://wireless.wiki.kernel.org/en/users/Drivers/ath9k_htc")
  93. (synopsis "Firmware for the Atheros AR7010 and AR9271 USB 802.11n NICs")
  94. (description
  95. "This is the firmware for the Qualcomm Atheros AR7010 and AR9271 USB
  96. 802.11n NICs (aka Wi-Fi USB dongles). It is used by the ath9k driver of
  97. Linux-libre.")
  98. (license (license:non-copyleft "http://directory.fsf.org/wiki/License:ClearBSD"))))
  99. (define-public b43-tools
  100. (let ((commit "27892ef741e7f1d08cb939744f8b8f5dac7b04ae")
  101. (revision "1"))
  102. (package
  103. (name "b43-tools")
  104. (version (git-version "0.0.0" revision commit))
  105. (source
  106. (origin
  107. (method git-fetch)
  108. (uri (git-reference
  109. (url "http://git.bues.ch/git/b43-tools.git")
  110. (commit commit)))
  111. (file-name (git-file-name name version))
  112. (sha256
  113. (base32
  114. "1wgmj4d65izbhprwb5bcwimc2ryv19b9066lqzy4sa5m6wncm9cn"))))
  115. (build-system gnu-build-system)
  116. (native-inputs
  117. `(("flex" ,flex)
  118. ("bison" ,bison)))
  119. (arguments
  120. `(#:modules ((srfi srfi-1)
  121. (guix build gnu-build-system)
  122. (guix build utils))
  123. #:tests? #f ; no tests
  124. #:phases
  125. (let ((subdirs '("assembler" "disassembler")))
  126. (modify-phases %standard-phases
  127. (delete 'configure) ; no configure script
  128. (add-before 'build 'patch-/bin/true
  129. (lambda _
  130. (substitute* (find-files "." "Makefile")
  131. (("/bin/true") ":"))
  132. #t))
  133. (replace 'build
  134. (lambda _
  135. (for-each (lambda (dir)
  136. (invoke "make" "-C" dir "CC=gcc"))
  137. subdirs)
  138. #t))
  139. (replace 'install
  140. (lambda* (#:key outputs #:allow-other-keys)
  141. (let ((out (assoc-ref outputs "out")))
  142. (mkdir-p (string-append out "/bin"))
  143. (for-each (lambda (dir)
  144. (invoke "make" "-C" dir
  145. (string-append "PREFIX=" out)
  146. "install"))
  147. subdirs)
  148. #t)))))))
  149. (home-page
  150. "https://bues.ch/cms/hacking/misc.html#linux_b43_driver_firmware_tools")
  151. (synopsis "Collection of tools for the b43 wireless driver")
  152. (description
  153. "The b43 firmware tools is a collection of firmware extractor,
  154. assembler, disassembler, and debugging tools for the Linux kernel b43 wireless
  155. driver.")
  156. (license license:gpl2))))
  157. (define-public openfwwf-firmware
  158. (package
  159. (name "openfwwf-firmware")
  160. (version "5.2")
  161. (source
  162. (origin
  163. (method url-fetch)
  164. (uri (string-append "http://netweb.ing.unibs.it/~openfwwf/firmware/"
  165. "openfwwf-" version ".tar.gz"))
  166. (sha256
  167. (base32
  168. "1p60gdi7w88s7qw82d3g9v7mk887mhvidf4l5q5hh09j10h37q4x"))))
  169. (build-system gnu-build-system)
  170. (native-inputs
  171. `(("b43-tools" ,b43-tools)))
  172. (arguments
  173. `(#:make-flags (list (string-append "PREFIX="
  174. (assoc-ref %outputs "out")
  175. "/lib/firmware/b43-open"))
  176. #:tests? #f ;no tests
  177. #:phases (modify-phases %standard-phases
  178. (delete 'configure))))
  179. (home-page "http://netweb.ing.unibs.it/~openfwwf/")
  180. (synopsis "Firmware for BCM43xx devices")
  181. (description
  182. "This is firmware from Open FirmWare for WiFi networks (OpenFWWF) for the
  183. Broadcom/AirForce chipset BCM43xx with Wireless-Core Revision 5. It is used
  184. by the b43-open driver of Linux-libre.")
  185. (license license:gpl2)))
  186. (define* (make-opensbi-package platform name #:optional (arch "riscv64"))
  187. (package
  188. (name name)
  189. (version "0.8")
  190. (source
  191. (origin
  192. (method git-fetch)
  193. (uri (git-reference
  194. (url "https://github.com/riscv/opensbi")
  195. (commit (string-append "v" version))))
  196. (file-name (git-file-name name version))
  197. (sha256
  198. (base32 "1y9z0b6q6wpw7mgy31wml4djc6m8ydm71a9f1asnks4ragc7m98b"))))
  199. (build-system gnu-build-system)
  200. (native-inputs
  201. `(,@(if (and (not (string-prefix? "riscv64" (%current-system)))
  202. (string-prefix? "riscv64" arch))
  203. `(("cross-gcc" ,(cross-gcc "riscv64-linux-gnu" #:xgcc gcc-7))
  204. ("cross-binutils" ,(cross-binutils "riscv64-linux-gnu")))
  205. '())))
  206. (arguments
  207. `(#:tests? #f ; no check target
  208. #:make-flags (list (string-append "PLATFORM=" ,platform)
  209. ,@(if (and (not (string-prefix? "riscv64"
  210. (%current-system)))
  211. (string-prefix? "riscv64" arch))
  212. `("CROSS_COMPILE=riscv64-linux-gnu-")
  213. '())
  214. "FW_PAYLOAD=n"
  215. "V=1")
  216. #:phases
  217. (modify-phases %standard-phases
  218. (delete 'configure)
  219. (replace 'install
  220. (lambda* (#:key outputs #:allow-other-keys)
  221. (let ((out (assoc-ref outputs "out"))
  222. (bin (find-files "." ".*fw_.*.elf$")))
  223. (for-each
  224. (lambda (file)
  225. (install-file file out))
  226. bin))
  227. #t)))))
  228. (home-page "https://github.com/riscv/opensbi")
  229. (synopsis "RISC-V Open Source Supervisor Binary Interface")
  230. (description "A reference implementation of the RISC-V SBI specifications
  231. for platform-specific firmwares executing in M-mode.")
  232. (license (list license:bsd-2
  233. ;; lib/utils/libfdt/* is dual licensed under bsd-2 and gpl2+.
  234. license:gpl2+
  235. ;; platform/ariane-fpga/* is gpl2.
  236. license:gpl2))))
  237. (define-public opensbi-qemu-generic
  238. (make-opensbi-package "generic" "opensbi-qemu-generic"))
  239. (define-public opensbi-qemu-virt
  240. (deprecated-package "opensbi-qemu-virt" opensbi-qemu-generic))
  241. (define-public opensbi-sifive-fu540
  242. (make-opensbi-package "sifive/fu540" "opensbi-sifive-fu540"))
  243. (define-public opensbi-qemu-sifive-u
  244. ;; Dropped upstream, as all functionality is present in the sifive-fu540
  245. ;; target for recent versions of qemu, u-boot and linux.
  246. (deprecated-package "opensbi-qemu-sifive-u" opensbi-sifive-fu540))
  247. (define-public seabios
  248. (package
  249. (name "seabios")
  250. (version "1.14.0")
  251. (source
  252. (origin
  253. (method git-fetch)
  254. (uri (git-reference
  255. (url "https://review.coreboot.org/seabios.git")
  256. (commit (string-append "rel-" version))))
  257. (file-name (git-file-name name version))
  258. (sha256
  259. (base32 "0jp4rxsv9jdzvx4gjvkybj6g1yjg8pkd2wys4sdh6c029npp6y8p"))))
  260. (build-system gnu-build-system)
  261. (native-inputs
  262. `(("python" ,python-wrapper)))
  263. (arguments
  264. `(#:tests? #f ; no check target
  265. #:phases
  266. (modify-phases %standard-phases
  267. (replace 'configure
  268. (lambda _
  269. (setenv "CC" "gcc")
  270. #t))
  271. (replace 'install
  272. (lambda* (#:key outputs #:allow-other-keys)
  273. (let* ((out (assoc-ref outputs "out"))
  274. (fmw (string-append out "/share/firmware")))
  275. (mkdir-p fmw)
  276. (copy-file "out/bios.bin" (string-append fmw "/bios.bin"))
  277. #t))))))
  278. (home-page "https://www.seabios.org/SeaBIOS")
  279. (synopsis "x86 BIOS implementation")
  280. (description "SeaBIOS is an implementation of a 16bit x86 BIOS. SeaBIOS
  281. can run in an emulator or it can run natively on X86 hardware with the use of
  282. coreboot.")
  283. ;; Dual licensed.
  284. (license (list license:gpl3+ license:lgpl3+
  285. ;; src/fw/acpi-dsdt.dsl is lgpl2
  286. license:lgpl2.1
  287. ;; src/fw/lzmadecode.c and src/fw/lzmadecode.h are lgpl3+ and
  288. ;; cpl with a linking exception.
  289. license:cpl1.0))))
  290. ;; OVMF is part of the edk2 source tree.
  291. (define edk2-commit "13a50a6fe1dcfa6600c38456ee24e0f9ecf51b5f")
  292. (define edk2-version (git-version "20170116" "1" edk2-commit))
  293. (define edk2-origin
  294. (origin
  295. (method git-fetch)
  296. (uri (git-reference
  297. (url "https://github.com/tianocore/edk2")
  298. (commit edk2-commit)))
  299. (file-name (git-file-name "edk2" edk2-version))
  300. (sha256
  301. (base32
  302. "1gy2332kdqk8bjzpcsripx10896rbvgl0ic7r344kmpiwdgm948b"))))
  303. (define-public ovmf
  304. (package
  305. (name "ovmf")
  306. (version edk2-version)
  307. (source edk2-origin)
  308. (build-system gnu-build-system)
  309. (native-inputs
  310. `(("acpica" ,acpica)
  311. ("gcc@5" ,gcc-5)
  312. ("nasm" ,nasm)
  313. ("python-2" ,python-2)
  314. ("util-linux" ,util-linux "lib")))
  315. (arguments
  316. `(#:tests? #f ; No check target.
  317. #:phases
  318. (modify-phases %standard-phases
  319. ;; Hide the default GCC from CPLUS_INCLUDE_PATH to prevent it from
  320. ;; shadowing the version of GCC provided in native-inputs.
  321. (add-after 'set-paths 'hide-gcc7
  322. (lambda* (#:key inputs #:allow-other-keys)
  323. (let ((gcc (assoc-ref inputs "gcc")))
  324. (setenv "CPLUS_INCLUDE_PATH"
  325. (string-join
  326. (delete (string-append gcc "/include/c++")
  327. (string-split (getenv "CPLUS_INCLUDE_PATH")
  328. #\:))
  329. ":"))
  330. #t)))
  331. (replace 'configure
  332. (lambda _
  333. (let* ((cwd (getcwd))
  334. (tools (string-append cwd "/BaseTools"))
  335. (bin (string-append tools "/BinWrappers/PosixLike")))
  336. (setenv "WORKSPACE" cwd)
  337. (setenv "EDK_TOOLS_PATH" tools)
  338. (setenv "PATH" (string-append (getenv "PATH") ":" bin))
  339. ; FIXME: The below script errors out. When using 'invoke' instead
  340. ; of 'system*' this causes the build to fail.
  341. (system* "bash" "edksetup.sh")
  342. (substitute* "Conf/target.txt"
  343. (("^TARGET[ ]*=.*$") "TARGET = RELEASE\n")
  344. (("^MAX_CONCURRENT_THREAD_NUMBER[ ]*=.*$")
  345. (format #f "MAX_CONCURRENT_THREAD_NUMBER = ~a~%"
  346. (number->string (parallel-job-count)))))
  347. ;; Build build support.
  348. (setenv "BUILD_CC" "gcc")
  349. (invoke "make" "-C" tools)
  350. #t)))
  351. (replace 'build
  352. (lambda _
  353. (invoke "build" "-a" "IA32" "-t" "GCC49"
  354. "-p" "OvmfPkg/OvmfPkgIa32.dsc")))
  355. ,@(if (string=? "x86_64-linux" (%current-system))
  356. '((add-after 'build 'build-x64
  357. (lambda _
  358. (invoke "build" "-a" "X64" "-t" "GCC49"
  359. "-p" "OvmfPkg/OvmfPkgX64.dsc"))))
  360. '())
  361. (replace 'install
  362. (lambda* (#:key outputs #:allow-other-keys)
  363. (let* ((out (assoc-ref outputs "out"))
  364. (fmw (string-append out "/share/firmware")))
  365. (mkdir-p fmw)
  366. (copy-file "Build/OvmfIa32/RELEASE_GCC49/FV/OVMF.fd"
  367. (string-append fmw "/ovmf_ia32.bin"))
  368. ,@(if (string=? "x86_64-linux" (%current-system))
  369. '((copy-file "Build/OvmfX64/RELEASE_GCC49/FV/OVMF.fd"
  370. (string-append fmw "/ovmf_x64.bin")))
  371. '()))
  372. #t)))))
  373. (supported-systems '("x86_64-linux" "i686-linux"))
  374. (home-page "https://www.tianocore.org")
  375. (synopsis "UEFI firmware for QEMU")
  376. (description "OVMF is an EDK II based project to enable UEFI support for
  377. Virtual Machines. OVMF contains a sample UEFI firmware for QEMU and KVM.")
  378. (license (list license:expat
  379. license:bsd-2 license:bsd-3 license:bsd-4))))
  380. (define-public ovmf-aarch64
  381. (package
  382. (inherit ovmf)
  383. (name "ovmf-aarch64")
  384. (native-inputs
  385. `(,@(package-native-inputs ovmf)
  386. ,@(if (not (string-prefix? "aarch64" (%current-system)))
  387. `(("cross-gcc" ,(cross-gcc "aarch64-linux-gnu"))
  388. ("cross-binutils" ,(cross-binutils "aarch64-linux-gnu")))
  389. '())))
  390. (arguments
  391. (substitute-keyword-arguments (package-arguments ovmf)
  392. ((#:phases phases)
  393. `(modify-phases ,phases
  394. (add-before 'configure 'set-env
  395. (lambda _
  396. ,@(if (not (string-prefix? "aarch64" (%current-system)))
  397. `((setenv "GCC49_AARCH64_PREFIX" "aarch64-linux-gnu-"))
  398. '())
  399. #t))
  400. (replace 'build
  401. (lambda _
  402. (invoke "build" "-a" "AARCH64" "-t" "GCC49"
  403. "-p" "ArmVirtPkg/ArmVirtQemu.dsc")))
  404. (delete 'build-x64)
  405. (replace 'install
  406. (lambda* (#:key outputs #:allow-other-keys)
  407. (let* ((out (assoc-ref outputs "out"))
  408. (fmw (string-append out "/share/firmware")))
  409. (mkdir-p fmw)
  410. (copy-file "Build/ArmVirtQemu-AARCH64/RELEASE_GCC49/FV/QEMU_EFI.fd"
  411. (string-append fmw "/ovmf_aarch64.bin"))
  412. #t)))))))
  413. (supported-systems %supported-systems)))
  414. (define-public ovmf-arm
  415. (package
  416. (inherit ovmf)
  417. (name "ovmf-arm")
  418. (native-inputs
  419. `(,@(package-native-inputs ovmf)
  420. ,@(if (not (string-prefix? "armhf" (%current-system)))
  421. `(("cross-gcc" ,(cross-gcc "arm-linux-gnueabihf"))
  422. ("cross-binutils" ,(cross-binutils "arm-linux-gnueabihf")))
  423. '())))
  424. (arguments
  425. (substitute-keyword-arguments (package-arguments ovmf)
  426. ((#:phases phases)
  427. `(modify-phases ,phases
  428. (add-before 'configure 'set-env
  429. (lambda _
  430. ,@(if (not (string-prefix? "armhf" (%current-system)))
  431. `((setenv "GCC49_ARM_PREFIX" "arm-linux-gnueabihf-"))
  432. '())
  433. #t))
  434. (replace 'build
  435. (lambda _
  436. (invoke "build" "-a" "ARM" "-t" "GCC49"
  437. "-p" "ArmVirtPkg/ArmVirtQemu.dsc")))
  438. (delete 'build-x64)
  439. (replace 'install
  440. (lambda* (#:key outputs #:allow-other-keys)
  441. (let* ((out (assoc-ref outputs "out"))
  442. (fmw (string-append out "/share/firmware")))
  443. (mkdir-p fmw)
  444. (copy-file "Build/ArmVirtQemu-ARM/RELEASE_GCC49/FV/QEMU_EFI.fd"
  445. (string-append fmw "/ovmf_arm.bin"))
  446. #t)))))))
  447. (supported-systems %supported-systems)))
  448. (define* (make-arm-trusted-firmware platform #:optional (arch "aarch64"))
  449. (package
  450. (name (string-append "arm-trusted-firmware-" platform))
  451. (version "2.4")
  452. (source
  453. (origin
  454. (method git-fetch)
  455. (uri (git-reference
  456. ;; There are only GitHub generated release snapshots.
  457. (url "https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/")
  458. (commit (string-append "v" version))))
  459. (file-name (git-file-name "arm-trusted-firmware" version))
  460. (sha256
  461. (base32
  462. "12k0n79j156bdzqws18kpbli04kn00nh6dy42pjv6gakqrkx9px3"))))
  463. (build-system gnu-build-system)
  464. (arguments
  465. `(#:phases
  466. (modify-phases %standard-phases
  467. (delete 'configure) ; no configure script
  468. ;; Remove binary blobs which do not contain source or proper license.
  469. (add-after 'unpack 'remove-binary-blobs
  470. (lambda _
  471. (for-each (lambda (file)
  472. (delete-file file))
  473. (find-files "." ".*\\.bin$"))))
  474. (replace 'install
  475. (lambda* (#:key outputs #:allow-other-keys)
  476. (let ((out (assoc-ref outputs "out"))
  477. (bin (find-files "." ".*\\.(bin|elf)$")))
  478. (for-each
  479. (lambda (file)
  480. (install-file file out))
  481. bin))
  482. #t)))
  483. #:make-flags (list (string-append "PLAT=" ,platform)
  484. ,@(if (and (not (string-prefix? "aarch64"
  485. (%current-system)))
  486. (string-prefix? "aarch64" arch))
  487. `("CROSS_COMPILE=aarch64-linux-gnu-")
  488. '())
  489. ,@(if (and (not (string-prefix? "armhf"
  490. (%current-system)))
  491. (string-prefix? "armhf" arch))
  492. `("CROSS_COMPILE=arm-linux-gnueabihf-")
  493. '())
  494. "DEBUG=1")
  495. #:tests? #f)) ; no tests
  496. (native-inputs
  497. `(,@(if (and (not (string-prefix? "aarch64" (%current-system)))
  498. (string-prefix? "aarch64" arch))
  499. ;; Needs newer gcc version for some targets
  500. `(("cross-gcc" ,(cross-gcc "aarch64-linux-gnu" #:xgcc gcc-9))
  501. ("cross-binutils" ,(cross-binutils "aarch64-linux-gnu")))
  502. '())
  503. ,@(if (and (not (string-prefix? "armhf" (%current-system)))
  504. (string-prefix? "armhf" arch))
  505. ;; Needs newer gcc version for some targets
  506. `(("cross-gcc" ,(cross-gcc "arm-linux-gnueabihf" #:xgcc gcc-9))
  507. ("cross-binutils" ,(cross-binutils "arm-linux-gnueabihf")))
  508. '())
  509. ;; Needs newer gcc version for some targets
  510. ("gcc" ,gcc-9)))
  511. (home-page "https://www.trustedfirmware.org/")
  512. (synopsis "Implementation of \"secure world software\"")
  513. (description
  514. "ARM Trusted Firmware provides a reference implementation of secure world
  515. software for ARMv7A and ARMv8-A, including a Secure Monitor executing at
  516. @dfn{Exception Level 3} (EL3). It implements various ARM interface standards,
  517. such as:
  518. @enumerate
  519. @item The Power State Coordination Interface (PSCI)
  520. @item Trusted Board Boot Requirements (TBBR, ARM DEN0006C-1)
  521. @item SMC Calling Convention
  522. @item System Control and Management Interface
  523. @item Software Delegated Exception Interface (SDEI)
  524. @end enumerate\n")
  525. (license (list license:bsd-3
  526. license:bsd-2)))) ; libfdt
  527. (define-public arm-trusted-firmware-sun50i-a64
  528. (let ((base (make-arm-trusted-firmware "sun50i_a64")))
  529. (package
  530. (inherit base)
  531. (name "arm-trusted-firmware-sun50i-a64"))))
  532. (define-public arm-trusted-firmware-rk3328
  533. (make-arm-trusted-firmware "rk3328"))
  534. (define-public arm-trusted-firmware-rk3399
  535. (let ((base (make-arm-trusted-firmware "rk3399")))
  536. (package
  537. (inherit base)
  538. (name "arm-trusted-firmware-rk3399")
  539. (native-inputs
  540. `(("cross32-gcc" ,(cross-gcc "arm-none-eabi"))
  541. ("cross32-binutils", (cross-binutils "arm-none-eabi"))
  542. ,@(package-native-inputs base))))))