gnu: Add ath9k-htc-firmware.
[jackhill/guix/guix.git] / gnu / packages / firmware.scm
CommitLineData
4902c3ec
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages firmware)
20 #:use-module (guix licenses)
21 #:use-module (guix packages)
22 #:use-module (guix git-download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages cmake)
26 #:use-module (gnu packages cross-base)
27 #:use-module (gnu packages perl))
28
29(define-public ath9k-htc-firmware
30 (package
31 (name "ath9k-htc-firmware")
32 (version "1.3.2")
33 (source (origin
34 (method git-fetch)
35 (uri (git-reference
36 (url "https://github.com/qca/open-ath9k-htc-firmware.git")
37 (commit version)))
38 (sha256
39 (base32
40 "0dgqfp4cbky79vzjrdy3j462l8figymzrk2v0jalmmz3lkxw88ww"))
41 (patches (list (search-patch "ath9k-htc-firmware-objcopy.patch")))))
42 (build-system gnu-build-system)
43 (arguments
44 '(#:phases (alist-cons-before
45 'configure 'pre-configure
46 (lambda* (#:key inputs #:allow-other-keys)
47 (chdir "target_firmware")
48
49 ;; 'configure' is a simple script that runs 'cmake' with
50 ;; the right flags.
51 (substitute* "configure"
52 (("^TOOLCHAIN=.*$")
53 (string-append "TOOLCHAIN="
54 (assoc-ref inputs "cross-gcc")
55 "\n"))))
56 (alist-replace
57 'install
58 (lambda* (#:key outputs #:allow-other-keys)
59 (let* ((out (assoc-ref outputs "out"))
60 (fw-dir (string-append out "/lib/firmware")))
61 (mkdir-p fw-dir)
62 (for-each (lambda (file)
63 (copy-file file
64 (string-append fw-dir "/"
65 (basename file))))
66 (find-files "." "\\.fw$"))
67 #t))
68 %standard-phases))
69 #:tests? #f))
70
71 ;; The firmware is cross-compiled using a "bare bones" compiler (no libc.)
72 ;; Use our own tool chain for that.
73 (native-inputs `(("cross-gcc" ,xgcc-xtensa)
74 ("cross-binutils" ,(cross-binutils "xtensa-elf"))
75 ("cmake" ,cmake)
76 ("perl" ,perl)))
77 (home-page "http://wireless.kernel.org/en/users/Drivers/ath9k_htc")
78 (synopsis "Firmware for the Atheros AR7010 and AR9271 USB 802.11n NICs")
79 (description
80 "This is the firmware for the Qualcomm Atheros AR7010 and AR9271 USB
81802.11n NICs (aka. Wi-Fi USB dongles.) It is used by the ath9k driver of
82Linux-libre.")
83 (license (bsd-style "http://directory.fsf.org/wiki/License:ClearBSD"))))