X-Git-Url: https://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/e36a67c91a2a48c6a534afae767bf0758b949644..a3a932c008d0d9051eb8cdfdcea07ebd7b68b1b3:/gnu/packages/firmware.scm diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index 443c38e944..12595dc31c 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -1,6 +1,8 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014, 2015, 2016 Ludovic Courtès ;;; Copyright © 2016 Eric Bavier +;;; Copyright © 2017 David Craven +;;; Copyright © 2017 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,17 +20,21 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu packages firmware) - #:use-module (guix licenses) + #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix build-system gnu) #:use-module (gnu packages) + #:use-module (gnu packages admin) + #:use-module (gnu packages assembly) #:use-module (gnu packages bison) #:use-module (gnu packages cmake) #:use-module (gnu packages cross-base) #:use-module (gnu packages flex) - #:use-module (gnu packages perl)) + #:use-module (gnu packages linux) + #:use-module (gnu packages perl) + #:use-module (gnu packages python)) (define-public ath9k-htc-firmware (package @@ -46,31 +52,31 @@ (patches (search-patches "ath9k-htc-firmware-objcopy.patch")))) (build-system gnu-build-system) (arguments - '(#:phases (alist-cons-before - 'configure 'pre-configure - (lambda* (#:key inputs #:allow-other-keys) - (chdir "target_firmware") + '(#:phases + (modify-phases %standard-phases + (add-before 'configure 'pre-configure + (lambda* (#:key inputs #:allow-other-keys) + (chdir "target_firmware") - ;; 'configure' is a simple script that runs 'cmake' with - ;; the right flags. - (substitute* "configure" - (("^TOOLCHAIN=.*$") - (string-append "TOOLCHAIN=" - (assoc-ref inputs "cross-gcc") - "\n")))) - (alist-replace - 'install - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (fw-dir (string-append out "/lib/firmware"))) - (mkdir-p fw-dir) - (for-each (lambda (file) - (copy-file file - (string-append fw-dir "/" - (basename file)))) - (find-files "." "\\.fw$")) - #t)) - %standard-phases)) + ;; 'configure' is a simple script that runs 'cmake' with + ;; the right flags. + (substitute* "configure" + (("^TOOLCHAIN=.*$") + (string-append "TOOLCHAIN=" + (assoc-ref inputs "cross-gcc") + "\n"))) + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (fw-dir (string-append out "/lib/firmware"))) + (mkdir-p fw-dir) + (for-each (lambda (file) + (copy-file file + (string-append fw-dir "/" + (basename file)))) + (find-files "." "\\.fw$")) + #t)))) #:tests? #f)) ;; The firmware is cross-compiled using a "bare bones" compiler (no libc.) @@ -85,7 +91,7 @@ "This is the firmware for the Qualcomm Atheros AR7010 and AR9271 USB 802.11n NICs (aka Wi-Fi USB dongles). It is used by the ath9k driver of Linux-libre.") - (license (non-copyleft "http://directory.fsf.org/wiki/License:ClearBSD")))) + (license (license:non-copyleft "http://directory.fsf.org/wiki/License:ClearBSD")))) (define-public b43-tools (let ((commit "8dce53297966b31b6c70a7a03c2433978dd9f288") @@ -143,7 +149,7 @@ Linux-libre.") "The b43 firmware tools is a collection of firmware extractor, assembler, disassembler, and debugging tools for the Linux kernel b43 wireless driver.") - (license gpl2)))) + (license license:gpl2)))) (define-public openfwwf-firmware (package @@ -173,4 +179,129 @@ driver.") "This is firmware from Open FirmWare for WiFi networks (OpenFWWF) for the Broadcom/AirForce chipset BCM43xx with Wireless-Core Revision 5. It is used by the b43-open driver of Linux-libre.") - (license gpl2))) + (license license:gpl2))) + +(define-public seabios + (package + (name "seabios") + (version "1.11.0") + (source (origin + (method url-fetch) + (uri (string-append "https://code.coreboot.org/p/seabios/downloads/get/" + "seabios-" version ".tar.gz")) + (sha256 + (base32 + "1xwvp77djxbxbxg82hzj26pv6zka3556vkdcp09hnfwapcp46av2")))) + (build-system gnu-build-system) + (native-inputs + `(("python-2" ,python-2))) + (arguments + `(#:tests? #f ; No check target. + #:phases + (modify-phases %standard-phases + (replace 'configure + (lambda _ + (setenv "CC" "gcc") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (fmw (string-append out "/share/firmware"))) + (mkdir-p fmw) + (copy-file "out/bios.bin" (string-append fmw "/bios.bin")))))))) + (home-page "https://www.seabios.org/SeaBIOS") + (synopsis "x86 BIOS implementation") + (description "SeaBIOS is an implementation of a 16bit x86 BIOS. SeaBIOS +can run in an emulator or it can run natively on X86 hardware with the use of +coreboot.") + ;; Dual licensed. + (license (list license:gpl3+ license:lgpl3+ + ;; src/fw/acpi-dsdt.dsl is lgpl2 + license:lgpl2.1 + ;; src/fw/lzmadecode.c and src/fw/lzmadecode.h are lgpl3+ and + ;; cpl with a linking exception. + license:cpl1.0)))) + +;; OVMF is part of the edk2 source tree. +(define edk2-commit "13a50a6fe1dcfa6600c38456ee24e0f9ecf51b5f") +(define edk2-version (git-version "20170116" "1" edk2-commit)) +(define edk2-origin + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/tianocore/edk2") + (commit edk2-commit))) + (file-name (git-file-name "edk2" edk2-version)) + (sha256 + (base32 + "1gy2332kdqk8bjzpcsripx10896rbvgl0ic7r344kmpiwdgm948b")))) + +(define-public ovmf + (package + (name "ovmf") + (version edk2-version) + (source edk2-origin) + (build-system gnu-build-system) + (native-inputs + `(("acpica" ,acpica) + ("nasm" ,nasm) + ("python-2" ,python-2) + ("util-linux" ,util-linux))) + (arguments + `(#:tests? #f ; No check target. + #:phases + (modify-phases %standard-phases + (replace 'configure + (lambda _ + (let* ((cwd (getcwd)) + (tools (string-append cwd "/BaseTools")) + (bin (string-append tools "/BinWrappers/PosixLike"))) + (setenv "WORKSPACE" cwd) + (setenv "EDK_TOOLS_PATH" tools) + (setenv "PATH" (string-append (getenv "PATH") ":" bin)) + (system* "bash" "edksetup.sh" "BaseTools") + (substitute* "Conf/target.txt" + (("^TARGET[ ]*=.*$") "TARGET = RELEASE\n") + (("^TOOL_CHAIN_TAG[ ]*=.*$") "TOOL_CHAIN_TAG = GCC49\n") + (("^MAX_CONCURRENT_THREAD_NUMBER[ ]*=.*$") + (format #f "MAX_CONCURRENT_THREAD_NUMBER = ~a~%" + (number->string (parallel-job-count))))) + ;; Build build support. + (setenv "BUILD_CC" "gcc") + (zero? (system* "make" "-C" (string-append tools "/Source/C")))))) + (add-after 'build 'build-ia32 + (lambda _ + (substitute* "Conf/target.txt" + (("^TARGET_ARCH[ ]*=.*$") "TARGET_ARCH = IA32\n") + (("^ACTIVE_PLATFORM[ ]*=.*$") + "ACTIVE_PLATFORM = OvmfPkg/OvmfPkgIa32.dsc\n")) + (zero? (system* "build")))) + ,@(if (string=? "x86_64-linux" (%current-system)) + '((add-after 'build 'build-x64 + (lambda _ + (substitute* "Conf/target.txt" + (("^TARGET_ARCH[ ]*=.*$") "TARGET_ARCH = X64\n") + (("^ACTIVE_PLATFORM[ ]*=.*$") + "ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc\n")) + (zero? (system* "build"))))) + '()) + (delete 'build) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (fmw (string-append out "/share/firmware"))) + (mkdir-p fmw) + (copy-file "Build/OvmfIa32/RELEASE_GCC49/FV/OVMF.fd" + (string-append fmw "/ovmf_ia32.bin")) + ,@(if (string=? "x86_64-linux" (%current-system)) + '((copy-file "Build/OvmfX64/RELEASE_GCC49/FV/OVMF.fd" + (string-append fmw "/ovmf_x64.bin"))) + '())) + #t))))) + (supported-systems '("x86_64-linux" "i686-linux")) + (home-page "http://www.tianocore.org") + (synopsis "UEFI firmware for QEMU") + (description "OVMF is an EDK II based project to enable UEFI support for +Virtual Machines. OVMF contains a sample UEFI firmware for QEMU and KVM.") + (license (list license:expat + license:bsd-2 license:bsd-3 license:bsd-4))))