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