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