gnu: Add seabios.
[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>
4902c3ec
LC
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages firmware)
ce03b453 22 #:use-module ((guix licenses) #:prefix license:)
4902c3ec 23 #:use-module (guix packages)
e36a67c9 24 #:use-module (guix download)
4902c3ec
LC
25 #:use-module (guix git-download)
26 #:use-module (guix build-system gnu)
27 #:use-module (gnu packages)
e36a67c9 28 #:use-module (gnu packages bison)
4902c3ec
LC
29 #:use-module (gnu packages cmake)
30 #:use-module (gnu packages cross-base)
e36a67c9 31 #:use-module (gnu packages flex)
1b533bad
DC
32 #:use-module (gnu packages perl)
33 #:use-module (gnu packages python))
4902c3ec
LC
34
35(define-public ath9k-htc-firmware
36 (package
37 (name "ath9k-htc-firmware")
7c473310 38 (version "1.4.0")
4902c3ec
LC
39 (source (origin
40 (method git-fetch)
41 (uri (git-reference
42 (url "https://github.com/qca/open-ath9k-htc-firmware.git")
43 (commit version)))
44 (sha256
45 (base32
7c473310 46 "16jbj8avg5jkgvq5lxm0hdxxn4c3zn7fx8b4nxllvr024apk9w23"))
821f4dc2 47 (file-name (string-append name "-" version "-checkout"))
fc1adab1 48 (patches (search-patches "ath9k-htc-firmware-objcopy.patch"))))
4902c3ec
LC
49 (build-system gnu-build-system)
50 (arguments
51 '(#:phases (alist-cons-before
52 'configure 'pre-configure
53 (lambda* (#:key inputs #:allow-other-keys)
54 (chdir "target_firmware")
55
56 ;; 'configure' is a simple script that runs 'cmake' with
57 ;; the right flags.
58 (substitute* "configure"
59 (("^TOOLCHAIN=.*$")
60 (string-append "TOOLCHAIN="
61 (assoc-ref inputs "cross-gcc")
62 "\n"))))
63 (alist-replace
64 'install
65 (lambda* (#:key outputs #:allow-other-keys)
66 (let* ((out (assoc-ref outputs "out"))
67 (fw-dir (string-append out "/lib/firmware")))
68 (mkdir-p fw-dir)
69 (for-each (lambda (file)
70 (copy-file file
71 (string-append fw-dir "/"
72 (basename file))))
73 (find-files "." "\\.fw$"))
74 #t))
75 %standard-phases))
76 #:tests? #f))
77
78 ;; The firmware is cross-compiled using a "bare bones" compiler (no libc.)
79 ;; Use our own tool chain for that.
bd2e1a8c 80 (native-inputs `(("cross-gcc" ,(cross-gcc "xtensa-elf"))
4902c3ec
LC
81 ("cross-binutils" ,(cross-binutils "xtensa-elf"))
82 ("cmake" ,cmake)
83 ("perl" ,perl)))
84 (home-page "http://wireless.kernel.org/en/users/Drivers/ath9k_htc")
85 (synopsis "Firmware for the Atheros AR7010 and AR9271 USB 802.11n NICs")
86 (description
87 "This is the firmware for the Qualcomm Atheros AR7010 and AR9271 USB
e881752c 88802.11n NICs (aka Wi-Fi USB dongles). It is used by the ath9k driver of
4902c3ec 89Linux-libre.")
ce03b453 90 (license (license:non-copyleft "http://directory.fsf.org/wiki/License:ClearBSD"))))
e36a67c9
EB
91
92(define-public b43-tools
93 (let ((commit "8dce53297966b31b6c70a7a03c2433978dd9f288")
94 (rev "1"))
95 (package
96 (name "b43-tools")
97 (version (string-append "20140625-" rev "." (string-take commit 7)))
98 (source
99 (origin
100 (method git-fetch)
101 (uri (git-reference
102 (url "http://git.bues.ch/git/b43-tools.git")
103 (commit commit)))
104 (file-name (string-append name "-" version "-checkout"))
105 (sha256
106 (base32
107 "08k7sdr9jagm43r2zv4h03j86klhkblpk73p12444a3vzg1gy1lv"))))
108 (build-system gnu-build-system)
109 (native-inputs
110 `(("flex" ,flex)
111 ("bison" ,bison)))
112 (arguments
113 `(#:modules ((srfi srfi-1)
114 (guix build gnu-build-system)
115 (guix build utils))
116 #:tests? #f ;no tests
117 #:phases
118 (let ((subdirs '("assembler" "disassembler")))
119 (modify-phases %standard-phases
120 (delete 'configure)
121 (add-before 'build 'patch-/bin/true
122 (lambda _
123 (substitute* (find-files "." "Makefile")
124 (("/bin/true") ":"))
125 #t))
126 (replace 'build
127 (lambda _
128 (every (lambda (dir)
129 (zero? (system* "make" "-C" dir "CC=gcc")))
130 subdirs)))
131 (replace 'install
132 (lambda* (#:key outputs #:allow-other-keys)
133 (let ((out (assoc-ref outputs "out")))
134 (mkdir-p (string-append out "/bin"))
135 (every (lambda (dir)
136 (zero?
137 (system* "make" "-C" dir
138 (string-append "PREFIX=" out)
139 "install")))
140 subdirs))))))))
141 (home-page
142 "http://bues.ch/cms/hacking/misc.html#linux_b43_driver_firmware_tools")
143 (synopsis "Collection of tools for the b43 wireless driver")
144 (description
145 "The b43 firmware tools is a collection of firmware extractor,
146assembler, disassembler, and debugging tools for the Linux kernel b43 wireless
147driver.")
ce03b453 148 (license license:gpl2))))
e36a67c9
EB
149
150(define-public openfwwf-firmware
151 (package
152 (name "openfwwf-firmware")
153 (version "5.2")
154 (source
155 (origin
156 (method url-fetch)
157 (uri (string-append "http://netweb.ing.unibs.it/~openfwwf/firmware/"
158 "openfwwf-" version ".tar.gz"))
159 (sha256
160 (base32
161 "1p60gdi7w88s7qw82d3g9v7mk887mhvidf4l5q5hh09j10h37q4x"))))
162 (build-system gnu-build-system)
163 (native-inputs
164 `(("b43-tools" ,b43-tools)))
165 (arguments
166 `(#:make-flags (list (string-append "PREFIX="
167 (assoc-ref %outputs "out")
168 "/lib/firmware/b43-open"))
169 #:tests? #f ;no tests
170 #:phases (modify-phases %standard-phases
171 (delete 'configure))))
172 (home-page "http://netweb.ing.unibs.it/~openfwwf/")
173 (synopsis "Firmware for BCM43xx devices")
174 (description
175 "This is firmware from Open FirmWare for WiFi networks (OpenFWWF) for the
176Broadcom/AirForce chipset BCM43xx with Wireless-Core Revision 5. It is used
177by the b43-open driver of Linux-libre.")
ce03b453 178 (license license:gpl2)))
1b533bad
DC
179
180(define-public seabios
181 (package
182 (name "seabios")
183 (version "1.10.1")
184 (source (origin
185 (method url-fetch)
186 (uri (string-append "https://code.coreboot.org/p/seabios/downloads/get/"
187 "seabios-" version ".tar.gz"))
188 (sha256
189 (base32
190 "1jyjl719drnl1v0gf0l5q6qjjmkyqcqkka6s28dfdi0yqsxdsqsh"))))
191 (build-system gnu-build-system)
192 (native-inputs
193 `(("python-2" ,python-2)))
194 (arguments
195 `(#:tests? #f ; No check target.
196 #:phases
197 (modify-phases %standard-phases
198 (replace 'configure
199 (lambda _
200 (setenv "CC" "gcc")
201 #t))
202 (replace 'install
203 (lambda* (#:key outputs #:allow-other-keys)
204 (let* ((out (assoc-ref outputs "out"))
205 (fmw (string-append out "/share/firmware")))
206 (mkdir-p fmw)
207 (copy-file "out/bios.bin" (string-append fmw "/bios.bin"))))))))
208 (home-page "https://www.seabios.org/SeaBIOS")
209 (synopsis "x86 BIOS implementation")
210 (description "SeaBIOS is an open source implementation of a 16bit x86 BIOS.
211SeaBIOS can run in an emulator or it can run natively on X86 hardware with the
212use of coreboot.")
213 ;; Dual licensed.
214 (license (list license:gpl3+ license:lgpl3+
215 ;; src/fw/acpi-dsdt.dsl is lgpl2
216 license:lgpl2.1
217 ;; src/fw/lzmadecode.c and src/fw/lzmadecode.h are lgpl3+ and
218 ;; cpl with a linking exception.
219 license:cpl1.0))))