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