1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
4 ;;; Copyright © 2017 David Craven <david@craven.ch>
5 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages firmware)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (guix build-system gnu)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages admin)
30 #:use-module (gnu packages assembly)
31 #:use-module (gnu packages bison)
32 #:use-module (gnu packages cmake)
33 #:use-module (gnu packages cross-base)
34 #:use-module (gnu packages flex)
35 #:use-module (gnu packages linux)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages python))
39 (define-public ath9k-htc-firmware
41 (name "ath9k-htc-firmware")
46 (url "https://github.com/qca/open-ath9k-htc-firmware.git")
50 "16jbj8avg5jkgvq5lxm0hdxxn4c3zn7fx8b4nxllvr024apk9w23"))
51 (file-name (string-append name "-" version "-checkout"))
52 (patches (search-patches "ath9k-htc-firmware-objcopy.patch"))))
53 (build-system gnu-build-system)
55 '(#:phases (alist-cons-before
56 'configure 'pre-configure
57 (lambda* (#:key inputs #:allow-other-keys)
58 (chdir "target_firmware")
60 ;; 'configure' is a simple script that runs 'cmake' with
62 (substitute* "configure"
64 (string-append "TOOLCHAIN="
65 (assoc-ref inputs "cross-gcc")
69 (lambda* (#:key outputs #:allow-other-keys)
70 (let* ((out (assoc-ref outputs "out"))
71 (fw-dir (string-append out "/lib/firmware")))
73 (for-each (lambda (file)
75 (string-append fw-dir "/"
77 (find-files "." "\\.fw$"))
82 ;; The firmware is cross-compiled using a "bare bones" compiler (no libc.)
83 ;; Use our own tool chain for that.
84 (native-inputs `(("cross-gcc" ,(cross-gcc "xtensa-elf"))
85 ("cross-binutils" ,(cross-binutils "xtensa-elf"))
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")
91 "This is the firmware for the Qualcomm Atheros AR7010 and AR9271 USB
92 802.11n NICs (aka Wi-Fi USB dongles). It is used by the ath9k driver of
94 (license (license:non-copyleft "http://directory.fsf.org/wiki/License:ClearBSD"))))
96 (define-public b43-tools
97 (let ((commit "8dce53297966b31b6c70a7a03c2433978dd9f288")
101 (version (string-append "20140625-" rev "." (string-take commit 7)))
106 (url "http://git.bues.ch/git/b43-tools.git")
108 (file-name (string-append name "-" version "-checkout"))
111 "08k7sdr9jagm43r2zv4h03j86klhkblpk73p12444a3vzg1gy1lv"))))
112 (build-system gnu-build-system)
117 `(#:modules ((srfi srfi-1)
118 (guix build gnu-build-system)
120 #:tests? #f ;no tests
122 (let ((subdirs '("assembler" "disassembler")))
123 (modify-phases %standard-phases
125 (add-before 'build 'patch-/bin/true
127 (substitute* (find-files "." "Makefile")
133 (zero? (system* "make" "-C" dir "CC=gcc")))
136 (lambda* (#:key outputs #:allow-other-keys)
137 (let ((out (assoc-ref outputs "out")))
138 (mkdir-p (string-append out "/bin"))
141 (system* "make" "-C" dir
142 (string-append "PREFIX=" out)
146 "http://bues.ch/cms/hacking/misc.html#linux_b43_driver_firmware_tools")
147 (synopsis "Collection of tools for the b43 wireless driver")
149 "The b43 firmware tools is a collection of firmware extractor,
150 assembler, disassembler, and debugging tools for the Linux kernel b43 wireless
152 (license license:gpl2))))
154 (define-public openfwwf-firmware
156 (name "openfwwf-firmware")
161 (uri (string-append "http://netweb.ing.unibs.it/~openfwwf/firmware/"
162 "openfwwf-" version ".tar.gz"))
165 "1p60gdi7w88s7qw82d3g9v7mk887mhvidf4l5q5hh09j10h37q4x"))))
166 (build-system gnu-build-system)
168 `(("b43-tools" ,b43-tools)))
170 `(#:make-flags (list (string-append "PREFIX="
171 (assoc-ref %outputs "out")
172 "/lib/firmware/b43-open"))
173 #:tests? #f ;no tests
174 #:phases (modify-phases %standard-phases
175 (delete 'configure))))
176 (home-page "http://netweb.ing.unibs.it/~openfwwf/")
177 (synopsis "Firmware for BCM43xx devices")
179 "This is firmware from Open FirmWare for WiFi networks (OpenFWWF) for the
180 Broadcom/AirForce chipset BCM43xx with Wireless-Core Revision 5. It is used
181 by the b43-open driver of Linux-libre.")
182 (license license:gpl2)))
184 (define-public seabios
190 (uri (string-append "https://code.coreboot.org/p/seabios/downloads/get/"
191 "seabios-" version ".tar.gz"))
194 "1jyjl719drnl1v0gf0l5q6qjjmkyqcqkka6s28dfdi0yqsxdsqsh"))))
195 (build-system gnu-build-system)
197 `(("python-2" ,python-2)))
199 `(#:tests? #f ; No check target.
201 (modify-phases %standard-phases
207 (lambda* (#:key outputs #:allow-other-keys)
208 (let* ((out (assoc-ref outputs "out"))
209 (fmw (string-append out "/share/firmware")))
211 (copy-file "out/bios.bin" (string-append fmw "/bios.bin"))))))))
212 (home-page "https://www.seabios.org/SeaBIOS")
213 (synopsis "x86 BIOS implementation")
214 (description "SeaBIOS is an open source implementation of a 16bit x86 BIOS.
215 SeaBIOS can run in an emulator or it can run natively on X86 hardware with the
218 (license (list license:gpl3+ license:lgpl3+
219 ;; src/fw/acpi-dsdt.dsl is lgpl2
221 ;; src/fw/lzmadecode.c and src/fw/lzmadecode.h are lgpl3+ and
222 ;; cpl with a linking exception.
225 ;; OVMF is part of the edk2 source tree.
226 (define edk2-commit "13a50a6fe1dcfa6600c38456ee24e0f9ecf51b5f")
227 (define edk2-version (git-version "20170116" "1" edk2-commit))
232 (url "https://github.com/tianocore/edk2")
233 (commit edk2-commit)))
234 (file-name (git-file-name "edk2" edk2-version))
237 "1gy2332kdqk8bjzpcsripx10896rbvgl0ic7r344kmpiwdgm948b"))))
242 (version edk2-version)
244 (build-system gnu-build-system)
248 ("python-2" ,python-2)
249 ("util-linux" ,util-linux)))
251 `(#:tests? #f ; No check target.
253 (modify-phases %standard-phases
256 (let* ((cwd (getcwd))
257 (tools (string-append cwd "/BaseTools"))
258 (bin (string-append tools "/BinWrappers/PosixLike")))
259 (setenv "WORKSPACE" cwd)
260 (setenv "EDK_TOOLS_PATH" tools)
261 (setenv "PATH" (string-append (getenv "PATH") ":" bin))
262 (system* "bash" "edksetup.sh" "BaseTools")
263 (substitute* "Conf/target.txt"
264 (("^TARGET[ ]*=.*$") "TARGET = RELEASE\n")
265 (("^TOOL_CHAIN_TAG[ ]*=.*$") "TOOL_CHAIN_TAG = GCC49\n")
266 (("^MAX_CONCURRENT_THREAD_NUMBER[ ]*=.*$")
267 (format #f "MAX_CONCURRENT_THREAD_NUMBER = ~a~%"
268 (number->string (parallel-job-count)))))
269 ;; Build build support.
270 (setenv "BUILD_CC" "gcc")
271 (zero? (system* "make" "-C" (string-append tools "/Source/C"))))))
272 (add-after 'build 'build-ia32
274 (substitute* "Conf/target.txt"
275 (("^TARGET_ARCH[ ]*=.*$") "TARGET_ARCH = IA32\n")
276 (("^ACTIVE_PLATFORM[ ]*=.*$")
277 "ACTIVE_PLATFORM = OvmfPkg/OvmfPkgIa32.dsc\n"))
278 (zero? (system* "build"))))
279 ,@(if (string=? "x86_64-linux" (%current-system))
280 '((add-after 'build 'build-x64
282 (substitute* "Conf/target.txt"
283 (("^TARGET_ARCH[ ]*=.*$") "TARGET_ARCH = X64\n")
284 (("^ACTIVE_PLATFORM[ ]*=.*$")
285 "ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc\n"))
286 (zero? (system* "build")))))
290 (lambda* (#:key outputs #:allow-other-keys)
291 (let* ((out (assoc-ref outputs "out"))
292 (fmw (string-append out "/share/firmware")))
294 (copy-file "Build/OvmfIa32/RELEASE_GCC49/FV/OVMF.fd"
295 (string-append fmw "/ovmf_ia32.bin"))
296 ,@(if (string=? "x86_64-linux" (%current-system))
297 '((copy-file "Build/OvmfX64/RELEASE_GCC49/FV/OVMF.fd"
298 (string-append fmw "/ovmf_x64.bin")))
301 (supported-systems '("x86_64-linux" "i686-linux"))
302 (home-page "http://www.tianocore.org")
303 (synopsis "UEFI firmware for QEMU")
304 (description "OVMF is an EDK II based project to enable UEFI support for
305 Virtual Machines. OVMF contains a sample UEFI firmware for QEMU and KVM.")
306 (license (list license:expat
307 license:bsd-2 license:bsd-3 license:bsd-4))))