Merge branch 'staging' into core-updates
[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
DC
186
187(define-public seabios
188 (package
189 (name "seabios")
dbc533c1 190 (version "1.13.0")
ae623b3f
TGR
191 (source
192 (origin
193 (method git-fetch)
194 (uri (git-reference
195 (url "https://review.coreboot.org/seabios.git")
196 (commit (string-append "rel-" version))))
197 (file-name (git-file-name name version))
198 (sha256
dbc533c1 199 (base32 "1n1bd6msfs7xn8844sz2qnm7hb5x2qfl3zb06kp4bx9vdc3i6619"))))
1b533bad
DC
200 (build-system gnu-build-system)
201 (native-inputs
dbc533c1 202 `(("python" ,python-wrapper)))
1b533bad 203 (arguments
ae623b3f 204 `(#:tests? #f ; no check target
1b533bad
DC
205 #:phases
206 (modify-phases %standard-phases
207 (replace 'configure
208 (lambda _
209 (setenv "CC" "gcc")
210 #t))
211 (replace 'install
212 (lambda* (#:key outputs #:allow-other-keys)
213 (let* ((out (assoc-ref outputs "out"))
214 (fmw (string-append out "/share/firmware")))
215 (mkdir-p fmw)
5f82a9d5
TGR
216 (copy-file "out/bios.bin" (string-append fmw "/bios.bin"))
217 #t))))))
1b533bad
DC
218 (home-page "https://www.seabios.org/SeaBIOS")
219 (synopsis "x86 BIOS implementation")
5a80c15c
RW
220 (description "SeaBIOS is an implementation of a 16bit x86 BIOS. SeaBIOS
221can run in an emulator or it can run natively on X86 hardware with the use of
222coreboot.")
1b533bad
DC
223 ;; Dual licensed.
224 (license (list license:gpl3+ license:lgpl3+
225 ;; src/fw/acpi-dsdt.dsl is lgpl2
226 license:lgpl2.1
227 ;; src/fw/lzmadecode.c and src/fw/lzmadecode.h are lgpl3+ and
228 ;; cpl with a linking exception.
229 license:cpl1.0))))
a5bc3dfe
DC
230
231;; OVMF is part of the edk2 source tree.
232(define edk2-commit "13a50a6fe1dcfa6600c38456ee24e0f9ecf51b5f")
233(define edk2-version (git-version "20170116" "1" edk2-commit))
234(define edk2-origin
235 (origin
236 (method git-fetch)
237 (uri (git-reference
238 (url "https://github.com/tianocore/edk2")
239 (commit edk2-commit)))
240 (file-name (git-file-name "edk2" edk2-version))
241 (sha256
242 (base32
243 "1gy2332kdqk8bjzpcsripx10896rbvgl0ic7r344kmpiwdgm948b"))))
244
245(define-public ovmf
246 (package
247 (name "ovmf")
248 (version edk2-version)
249 (source edk2-origin)
250 (build-system gnu-build-system)
251 (native-inputs
252 `(("acpica" ,acpica)
90efc2f2 253 ("gcc" ,gcc-5)
a5bc3dfe
DC
254 ("nasm" ,nasm)
255 ("python-2" ,python-2)
bb93042c 256 ("util-linux" ,util-linux "lib")))
a5bc3dfe
DC
257 (arguments
258 `(#:tests? #f ; No check target.
259 #:phases
260 (modify-phases %standard-phases
261 (replace 'configure
262 (lambda _
263 (let* ((cwd (getcwd))
264 (tools (string-append cwd "/BaseTools"))
265 (bin (string-append tools "/BinWrappers/PosixLike")))
266 (setenv "WORKSPACE" cwd)
267 (setenv "EDK_TOOLS_PATH" tools)
268 (setenv "PATH" (string-append (getenv "PATH") ":" bin))
cee03b26
RH
269 ; FIXME: The below script errors out. When using 'invoke' instead
270 ; of 'system*' this causes the build to fail.
bb63502f 271 (system* "bash" "edksetup.sh")
a5bc3dfe
DC
272 (substitute* "Conf/target.txt"
273 (("^TARGET[ ]*=.*$") "TARGET = RELEASE\n")
a5bc3dfe
DC
274 (("^MAX_CONCURRENT_THREAD_NUMBER[ ]*=.*$")
275 (format #f "MAX_CONCURRENT_THREAD_NUMBER = ~a~%"
276 (number->string (parallel-job-count)))))
277 ;; Build build support.
278 (setenv "BUILD_CC" "gcc")
bb63502f 279 (invoke "make" "-C" tools)
f563d199 280 #t)))
bb63502f 281 (replace 'build
a5bc3dfe 282 (lambda _
bb63502f
EF
283 (invoke "build" "-a" "IA32" "-t" "GCC49"
284 "-p" "OvmfPkg/OvmfPkgIa32.dsc")))
2eb95ade 285 ,@(if (string=? "x86_64-linux" (%current-system))
bfba1269
EF
286 '((add-after 'build 'build-x64
287 (lambda _
bb63502f
EF
288 (invoke "build" "-a" "X64" "-t" "GCC49"
289 "-p" "OvmfPkg/OvmfPkgX64.dsc"))))
2eb95ade 290 '())
a5bc3dfe
DC
291 (replace 'install
292 (lambda* (#:key outputs #:allow-other-keys)
293 (let* ((out (assoc-ref outputs "out"))
294 (fmw (string-append out "/share/firmware")))
295 (mkdir-p fmw)
296 (copy-file "Build/OvmfIa32/RELEASE_GCC49/FV/OVMF.fd"
297 (string-append fmw "/ovmf_ia32.bin"))
2eb95ade
EF
298 ,@(if (string=? "x86_64-linux" (%current-system))
299 '((copy-file "Build/OvmfX64/RELEASE_GCC49/FV/OVMF.fd"
300 (string-append fmw "/ovmf_x64.bin")))
301 '()))
a5bc3dfe
DC
302 #t)))))
303 (supported-systems '("x86_64-linux" "i686-linux"))
0dae4921 304 (home-page "https://www.tianocore.org")
a5bc3dfe
DC
305 (synopsis "UEFI firmware for QEMU")
306 (description "OVMF is an EDK II based project to enable UEFI support for
307Virtual Machines. OVMF contains a sample UEFI firmware for QEMU and KVM.")
308 (license (list license:expat
309 license:bsd-2 license:bsd-3 license:bsd-4))))
e9252fd1 310
cb97be5f
EF
311(define-public ovmf-aarch64
312 (package
313 (inherit ovmf)
314 (name "ovmf-aarch64")
315 (native-inputs
316 `(,@(package-native-inputs ovmf)
317 ,@(if (not (string-prefix? "aarch64" (%current-system)))
318 `(("cross-gcc" ,(cross-gcc "aarch64-linux-gnu"))
319 ("cross-binutils" ,(cross-binutils "aarch64-linux-gnu")))
320 '())))
321 (arguments
322 (substitute-keyword-arguments (package-arguments ovmf)
323 ((#:phases phases)
324 `(modify-phases ,phases
325 (add-before 'configure 'set-env
326 (lambda _
327 ,@(if (not (string-prefix? "aarch64" (%current-system)))
328 `((setenv "GCC49_AARCH64_PREFIX" "aarch64-linux-gnu-"))
329 '())
330 #t))
331 (replace 'build
332 (lambda _
333 (invoke "build" "-a" "AARCH64" "-t" "GCC49"
334 "-p" "ArmVirtPkg/ArmVirtQemu.dsc")))
335 (delete 'build-x64)
336 (replace 'install
337 (lambda* (#:key outputs #:allow-other-keys)
338 (let* ((out (assoc-ref outputs "out"))
339 (fmw (string-append out "/share/firmware")))
340 (mkdir-p fmw)
341 (copy-file "Build/ArmVirtQemu-AARCH64/RELEASE_GCC49/FV/QEMU_EFI.fd"
342 (string-append fmw "/ovmf_aarch64.bin"))
343 #t)))))))
344 (supported-systems %supported-systems)))
345
6da97043
EF
346(define-public ovmf-arm
347 (package
348 (inherit ovmf)
349 (name "ovmf-arm")
350 (native-inputs
351 `(,@(package-native-inputs ovmf)
352 ,@(if (not (string-prefix? "armhf" (%current-system)))
353 `(("cross-gcc" ,(cross-gcc "arm-linux-gnueabihf"))
354 ("cross-binutils" ,(cross-binutils "arm-linux-gnueabihf")))
355 '())))
356 (arguments
357 (substitute-keyword-arguments (package-arguments ovmf)
358 ((#:phases phases)
359 `(modify-phases ,phases
360 (add-before 'configure 'set-env
361 (lambda _
362 ,@(if (not (string-prefix? "armhf" (%current-system)))
363 `((setenv "GCC49_ARM_PREFIX" "arm-linux-gnueabihf-"))
364 '())
365 #t))
366 (replace 'build
367 (lambda _
368 (invoke "build" "-a" "ARM" "-t" "GCC49"
369 "-p" "ArmVirtPkg/ArmVirtQemu.dsc")))
370 (delete 'build-x64)
371 (replace 'install
372 (lambda* (#:key outputs #:allow-other-keys)
373 (let* ((out (assoc-ref outputs "out"))
374 (fmw (string-append out "/share/firmware")))
375 (mkdir-p fmw)
376 (copy-file "Build/ArmVirtQemu-ARM/RELEASE_GCC49/FV/QEMU_EFI.fd"
377 (string-append fmw "/ovmf_arm.bin"))
378 #t)))))))
379 (supported-systems %supported-systems)))
380
e9252fd1
EF
381(define* (make-arm-trusted-firmware platform #:optional (arch "aarch64"))
382 (package
383 (name (string-append "arm-trusted-firmware-" platform))
a1fd8c5d 384 (version "2.2")
e9252fd1
EF
385 (source
386 (origin
387 (method git-fetch)
388 (uri (git-reference
389 ;; There are only GitHub generated release snapshots.
a1fd8c5d 390 (url "https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/")
e9252fd1
EF
391 (commit (string-append "v" version))))
392 (file-name (git-file-name "arm-trusted-firmware" version))
475dac08 393 (patches (search-patches
a90fd72b 394 "arm-trusted-firmware-disable-hdcp.patch"))
e9252fd1
EF
395 (sha256
396 (base32
a1fd8c5d 397 "03fjl5hy1bqlya6fg553bqz7jrvilzrzpbs87cv6jd04v8qrvry8"))))
e9252fd1
EF
398 (build-system gnu-build-system)
399 (arguments
400 `(#:phases
401 (modify-phases %standard-phases
402 (delete 'configure) ; no configure script
a90fd72b
VC
403 ;; Remove binary blobs which do not contain source or proper license.
404 (add-after 'unpack 'remove-binary-blobs
405 (lambda _
406 (for-each (lambda (file)
407 (delete-file file))
408 (find-files "." ".*\\.bin$"))))
e9252fd1
EF
409 (replace 'install
410 (lambda* (#:key outputs #:allow-other-keys)
411 (let ((out (assoc-ref outputs "out"))
074554a2 412 (bin (find-files "." ".*\\.(bin|elf)$")))
e9252fd1
EF
413 (for-each
414 (lambda (file)
415 (install-file file out))
416 bin))
417 #t)))
418 #:make-flags (list (string-append "PLAT=" ,platform)
419 ,@(if (and (not (string-prefix? "aarch64"
420 (%current-system)))
421 (string-prefix? "aarch64" arch))
422 `("CROSS_COMPILE=aarch64-linux-gnu-")
423 '())
424 ,@(if (and (not (string-prefix? "armhf"
425 (%current-system)))
426 (string-prefix? "armhf" arch))
427 `("CROSS_COMPILE=arm-linux-gnueabihf-")
428 '())
429 "DEBUG=1")
430 #:tests? #f)) ; no tests
431 (native-inputs
432 `(,@(if (and (not (string-prefix? "aarch64" (%current-system)))
433 (string-prefix? "aarch64" arch))
434 ;; gcc-7 since it is used for u-boot, which needs gcc-7.
435 `(("cross-gcc" ,(cross-gcc "aarch64-linux-gnu" #:xgcc gcc-7))
436 ("cross-binutils" ,(cross-binutils "aarch64-linux-gnu")))
437 '())
438 ,@(if (and (not (string-prefix? "armhf" (%current-system)))
439 (string-prefix? "armhf" arch))
440 ;; gcc-7 since it is used for u-boot, which needs gcc-7.
441 `(("cross-gcc" ,(cross-gcc "arm-linux-gnueabihf" #:xgcc gcc-7))
442 ("cross-binutils" ,(cross-binutils "arm-linux-gnueabihf")))
443 '())
444 ))
a1fd8c5d 445 (home-page "https://www.trustedfirmware.org/")
e9252fd1
EF
446 (synopsis "Implementation of \"secure world software\"")
447 (description
448 "ARM Trusted Firmware provides a reference implementation of secure world
449software for ARMv7A and ARMv8-A, including a Secure Monitor executing at
450@dfn{Exception Level 3} (EL3). It implements various ARM interface standards,
451such as:
452@enumerate
453@item The Power State Coordination Interface (PSCI)
454@item Trusted Board Boot Requirements (TBBR, ARM DEN0006C-1)
455@item SMC Calling Convention
456@item System Control and Management Interface
457@item Software Delegated Exception Interface (SDEI)
458@end enumerate\n")
459 (license (list license:bsd-3
460 license:bsd-2)))) ; libfdt
ecff374e 461
95d91986 462(define-public arm-trusted-firmware-sun50i-a64
8b87b1bf 463 (let ((base (make-arm-trusted-firmware "sun50i_a64")))
ecff374e
EF
464 (package
465 (inherit base)
8b87b1bf 466 (name "arm-trusted-firmware-sun50i-a64"))))
6fe16577 467
c07f3b18
VC
468(define-public arm-trusted-firmware-rk3328
469 (make-arm-trusted-firmware "rk3328"))
470
6fe16577
VC
471(define-public arm-trusted-firmware-puma-rk3399
472 (let ((base (make-arm-trusted-firmware "rk3399"))
473 ;; Vendor's arm trusted firmware branch hasn't been upstreamed yet.
474 (commit "d71e6d83612df896774ec4c03d49500312d2c324")
475 (revision "1"))
476 (package
477 (inherit base)
478 (name "arm-trusted-firmware-puma-rk3399")
479 (version (git-version "1.3" revision commit))
480 (source
481 (origin
482 (method git-fetch)
483 (uri (git-reference
484 (url "https://git.theobroma-systems.com/arm-trusted-firmware.git")
485 (commit commit)))
486 (file-name (git-file-name name version))
487 (sha256
488 (base32
489 "0vqhwqqh8h9qlkpybg2v94911091c1418bc4pnzq5fd7zf0fjkf8")))))))
490
074554a2
CN
491(define-public arm-trusted-firmware-rk3399
492 (let ((base (make-arm-trusted-firmware "rk3399")))
493 (package
494 (inherit base)
495 (name "arm-trusted-firmware-rk3399")
496 (native-inputs
497 `(("cross32-gcc" ,(cross-gcc "arm-none-eabi"))
498 ("cross32-binutils", (cross-binutils "arm-none-eabi"))
499 ,@(package-native-inputs base))))))
500
6fe16577
VC
501(define-public rk3399-cortex-m0
502 (package
503 (name "rk3399-cortex-m0")
504 (version "1")
505 (source
506 (origin
507 (method git-fetch)
508 (uri (git-reference
509 (url "https://git.theobroma-systems.com/rk3399-cortex-m0.git")
510 (commit (string-append "v" version))))
511 (file-name (git-file-name "rk3399-cortex-m0" version))
512 (sha256
513 (base32
514 "02wz1vkf4j3zc8rx289z76xhrf71jhb2p05lvmygky393a9gjh9w"))))
515 (home-page "https://git.theobroma-systems.com/rk3399-cortex-m0.git/about/")
516 (synopsis "PMU Cortex M0 firmware for RK3399 Q7 (Puma)")
517 (description
518 "Cortex-M0 firmware used with the RK3399 to implement
519power-management functionality and helpers (e.g. DRAM frequency
520switching support).\n")
521 (license license:bsd-3)
522 (build-system gnu-build-system)
523 (arguments
524 `(#:phases
525 (modify-phases %standard-phases
526 (delete 'configure)
527 (delete 'check)
528 (replace 'install
529 (lambda* (#:key outputs #:allow-other-keys)
530 (let ((out (assoc-ref outputs "out"))
531 (mzerofiles (find-files "." "rk3399m0.(elf|bin)$")))
532 (for-each
533 (lambda (file)
534 (install-file file out))
535 mzerofiles))
536 #t))
537 (add-before 'build 'setenv
538 (lambda* (#:key inputs #:allow-other-keys)
539 (setenv "CROSS_COMPILE" "arm-none-eabi-")
540 #t)))))
541 (native-inputs `(("cross-gcc" ,(cross-gcc "arm-none-eabi" #:xgcc gcc-7))
542 ("cross-binutils" ,(cross-binutils "arm-none-eabi"))))))