gnu: r-gviz: Update to 1.24.0.
[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>
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 92802.11n NICs (aka Wi-Fi USB dongles). It is used by the ath9k driver of
4902c3ec 93Linux-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,
151assembler, disassembler, and debugging tools for the Linux kernel b43 wireless
152driver.")
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
181Broadcom/AirForce chipset BCM43xx with Wireless-Core Revision 5. It is used
182by 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)
212 (copy-file "out/bios.bin" (string-append fmw "/bios.bin"))))))))
213 (home-page "https://www.seabios.org/SeaBIOS")
214 (synopsis "x86 BIOS implementation")
5a80c15c
RW
215 (description "SeaBIOS is an implementation of a 16bit x86 BIOS. SeaBIOS
216can run in an emulator or it can run natively on X86 hardware with the use of
217coreboot.")
1b533bad
DC
218 ;; Dual licensed.
219 (license (list license:gpl3+ license:lgpl3+
220 ;; src/fw/acpi-dsdt.dsl is lgpl2
221 license:lgpl2.1
222 ;; src/fw/lzmadecode.c and src/fw/lzmadecode.h are lgpl3+ and
223 ;; cpl with a linking exception.
224 license:cpl1.0))))
a5bc3dfe
DC
225
226;; OVMF is part of the edk2 source tree.
227(define edk2-commit "13a50a6fe1dcfa6600c38456ee24e0f9ecf51b5f")
228(define edk2-version (git-version "20170116" "1" edk2-commit))
229(define edk2-origin
230 (origin
231 (method git-fetch)
232 (uri (git-reference
233 (url "https://github.com/tianocore/edk2")
234 (commit edk2-commit)))
235 (file-name (git-file-name "edk2" edk2-version))
236 (sha256
237 (base32
238 "1gy2332kdqk8bjzpcsripx10896rbvgl0ic7r344kmpiwdgm948b"))))
239
240(define-public ovmf
241 (package
242 (name "ovmf")
243 (version edk2-version)
244 (source edk2-origin)
245 (build-system gnu-build-system)
246 (native-inputs
247 `(("acpica" ,acpica)
248 ("nasm" ,nasm)
249 ("python-2" ,python-2)
250 ("util-linux" ,util-linux)))
251 (arguments
252 `(#:tests? #f ; No check target.
253 #:phases
254 (modify-phases %standard-phases
255 (replace 'configure
256 (lambda _
257 (let* ((cwd (getcwd))
258 (tools (string-append cwd "/BaseTools"))
259 (bin (string-append tools "/BinWrappers/PosixLike")))
260 (setenv "WORKSPACE" cwd)
261 (setenv "EDK_TOOLS_PATH" tools)
262 (setenv "PATH" (string-append (getenv "PATH") ":" bin))
cee03b26
RH
263 ; FIXME: The below script errors out. When using 'invoke' instead
264 ; of 'system*' this causes the build to fail.
265 (system* "bash" "edksetup.sh" "BaseTools")
a5bc3dfe
DC
266 (substitute* "Conf/target.txt"
267 (("^TARGET[ ]*=.*$") "TARGET = RELEASE\n")
268 (("^TOOL_CHAIN_TAG[ ]*=.*$") "TOOL_CHAIN_TAG = GCC49\n")
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")
f563d199
TGR
274 (invoke "make" "-C" (string-append tools "/Source/C"))
275 #t)))
a5bc3dfe
DC
276 (add-after 'build 'build-ia32
277 (lambda _
278 (substitute* "Conf/target.txt"
279 (("^TARGET_ARCH[ ]*=.*$") "TARGET_ARCH = IA32\n")
280 (("^ACTIVE_PLATFORM[ ]*=.*$")
281 "ACTIVE_PLATFORM = OvmfPkg/OvmfPkgIa32.dsc\n"))
f563d199
TGR
282 (invoke "build")
283 #t))
2eb95ade 284 ,@(if (string=? "x86_64-linux" (%current-system))
bfba1269
EF
285 '((add-after 'build 'build-x64
286 (lambda _
287 (substitute* "Conf/target.txt"
288 (("^TARGET_ARCH[ ]*=.*$") "TARGET_ARCH = X64\n")
289 (("^ACTIVE_PLATFORM[ ]*=.*$")
290 "ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc\n"))
f563d199
TGR
291 (invoke "build")
292 #t)))
2eb95ade 293 '())
a5bc3dfe
DC
294 (delete 'build)
295 (replace 'install
296 (lambda* (#:key outputs #:allow-other-keys)
297 (let* ((out (assoc-ref outputs "out"))
298 (fmw (string-append out "/share/firmware")))
299 (mkdir-p fmw)
300 (copy-file "Build/OvmfIa32/RELEASE_GCC49/FV/OVMF.fd"
301 (string-append fmw "/ovmf_ia32.bin"))
2eb95ade
EF
302 ,@(if (string=? "x86_64-linux" (%current-system))
303 '((copy-file "Build/OvmfX64/RELEASE_GCC49/FV/OVMF.fd"
304 (string-append fmw "/ovmf_x64.bin")))
305 '()))
a5bc3dfe
DC
306 #t)))))
307 (supported-systems '("x86_64-linux" "i686-linux"))
0dae4921 308 (home-page "https://www.tianocore.org")
a5bc3dfe
DC
309 (synopsis "UEFI firmware for QEMU")
310 (description "OVMF is an EDK II based project to enable UEFI support for
311Virtual Machines. OVMF contains a sample UEFI firmware for QEMU and KVM.")
312 (license (list license:expat
313 license:bsd-2 license:bsd-3 license:bsd-4))))
e9252fd1
EF
314
315(define* (make-arm-trusted-firmware platform #:optional (arch "aarch64"))
316 (package
317 (name (string-append "arm-trusted-firmware-" platform))
318 (version "1.5")
319 (source
320 (origin
321 (method git-fetch)
322 (uri (git-reference
323 ;; There are only GitHub generated release snapshots.
324 (url "https://github.com/ARM-software/arm-trusted-firmware.git")
325 (commit (string-append "v" version))))
326 (file-name (git-file-name "arm-trusted-firmware" version))
327 (sha256
328 (base32
329 "1gm0bn2llzfzz9bfsz11fhwxj5lxvyrq7bc13fjj033nljzxn7k8"))))
330 (build-system gnu-build-system)
331 (arguments
332 `(#:phases
333 (modify-phases %standard-phases
334 (delete 'configure) ; no configure script
335 (replace 'install
336 (lambda* (#:key outputs #:allow-other-keys)
337 (let ((out (assoc-ref outputs "out"))
338 (bin (find-files "." ".*\\.bin$")))
339 (for-each
340 (lambda (file)
341 (install-file file out))
342 bin))
343 #t)))
344 #:make-flags (list (string-append "PLAT=" ,platform)
345 ,@(if (and (not (string-prefix? "aarch64"
346 (%current-system)))
347 (string-prefix? "aarch64" arch))
348 `("CROSS_COMPILE=aarch64-linux-gnu-")
349 '())
350 ,@(if (and (not (string-prefix? "armhf"
351 (%current-system)))
352 (string-prefix? "armhf" arch))
353 `("CROSS_COMPILE=arm-linux-gnueabihf-")
354 '())
355 "DEBUG=1")
356 #:tests? #f)) ; no tests
357 (native-inputs
358 `(,@(if (and (not (string-prefix? "aarch64" (%current-system)))
359 (string-prefix? "aarch64" arch))
360 ;; gcc-7 since it is used for u-boot, which needs gcc-7.
361 `(("cross-gcc" ,(cross-gcc "aarch64-linux-gnu" #:xgcc gcc-7))
362 ("cross-binutils" ,(cross-binutils "aarch64-linux-gnu")))
363 '())
364 ,@(if (and (not (string-prefix? "armhf" (%current-system)))
365 (string-prefix? "armhf" arch))
366 ;; gcc-7 since it is used for u-boot, which needs gcc-7.
367 `(("cross-gcc" ,(cross-gcc "arm-linux-gnueabihf" #:xgcc gcc-7))
368 ("cross-binutils" ,(cross-binutils "arm-linux-gnueabihf")))
369 '())
370 ))
371 (home-page "https://github.com/ARM-software/arm-trusted-firmware")
372 (synopsis "Implementation of \"secure world software\"")
373 (description
374 "ARM Trusted Firmware provides a reference implementation of secure world
375software for ARMv7A and ARMv8-A, including a Secure Monitor executing at
376@dfn{Exception Level 3} (EL3). It implements various ARM interface standards,
377such as:
378@enumerate
379@item The Power State Coordination Interface (PSCI)
380@item Trusted Board Boot Requirements (TBBR, ARM DEN0006C-1)
381@item SMC Calling Convention
382@item System Control and Management Interface
383@item Software Delegated Exception Interface (SDEI)
384@end enumerate\n")
385 (license (list license:bsd-3
386 license:bsd-2)))) ; libfdt
ecff374e
EF
387
388(define-public arm-trusted-firmware-pine64-plus
389 (let ((base (make-arm-trusted-firmware "sun50iw1p1"))
390 ;; Vendor's arm trusted firmware branch hasn't been upstreamed yet.
391 (commit "ae78724247a01560164d607ed66db111c74d8df0")
392 (revision "1"))
393 (package
394 (inherit base)
395 (name "arm-trusted-firmware-pine64-plus")
396 (version (string-append "1.2-" revision "." (string-take commit 7)))
397 (source
398 (origin
399 (method git-fetch)
400 (uri (git-reference
401 (url "https://github.com/apritzel/arm-trusted-firmware.git")
402 (commit commit)))
403 (file-name (git-file-name name version))
404 (sha256
405 (base32
406 "0r4xnlq7v9khjfcg6gqp7nmrmnw4z1r8bipwdr07png1dcbb8214")))))))
6fe16577
VC
407
408(define-public arm-trusted-firmware-puma-rk3399
409 (let ((base (make-arm-trusted-firmware "rk3399"))
410 ;; Vendor's arm trusted firmware branch hasn't been upstreamed yet.
411 (commit "d71e6d83612df896774ec4c03d49500312d2c324")
412 (revision "1"))
413 (package
414 (inherit base)
415 (name "arm-trusted-firmware-puma-rk3399")
416 (version (git-version "1.3" revision commit))
417 (source
418 (origin
419 (method git-fetch)
420 (uri (git-reference
421 (url "https://git.theobroma-systems.com/arm-trusted-firmware.git")
422 (commit commit)))
423 (file-name (git-file-name name version))
424 (sha256
425 (base32
426 "0vqhwqqh8h9qlkpybg2v94911091c1418bc4pnzq5fd7zf0fjkf8")))))))
427
428(define-public rk3399-cortex-m0
429 (package
430 (name "rk3399-cortex-m0")
431 (version "1")
432 (source
433 (origin
434 (method git-fetch)
435 (uri (git-reference
436 (url "https://git.theobroma-systems.com/rk3399-cortex-m0.git")
437 (commit (string-append "v" version))))
438 (file-name (git-file-name "rk3399-cortex-m0" version))
439 (sha256
440 (base32
441 "02wz1vkf4j3zc8rx289z76xhrf71jhb2p05lvmygky393a9gjh9w"))))
442 (home-page "https://git.theobroma-systems.com/rk3399-cortex-m0.git/about/")
443 (synopsis "PMU Cortex M0 firmware for RK3399 Q7 (Puma)")
444 (description
445 "Cortex-M0 firmware used with the RK3399 to implement
446power-management functionality and helpers (e.g. DRAM frequency
447switching support).\n")
448 (license license:bsd-3)
449 (build-system gnu-build-system)
450 (arguments
451 `(#:phases
452 (modify-phases %standard-phases
453 (delete 'configure)
454 (delete 'check)
455 (replace 'install
456 (lambda* (#:key outputs #:allow-other-keys)
457 (let ((out (assoc-ref outputs "out"))
458 (mzerofiles (find-files "." "rk3399m0.(elf|bin)$")))
459 (for-each
460 (lambda (file)
461 (install-file file out))
462 mzerofiles))
463 #t))
464 (add-before 'build 'setenv
465 (lambda* (#:key inputs #:allow-other-keys)
466 (setenv "CROSS_COMPILE" "arm-none-eabi-")
467 #t)))))
468 (native-inputs `(("cross-gcc" ,(cross-gcc "arm-none-eabi" #:xgcc gcc-7))
469 ("cross-binutils" ,(cross-binutils "arm-none-eabi"))))))