summary refs log tree commit diff
path: root/gnu/packages/firmware.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/firmware.scm')
-rw-r--r--gnu/packages/firmware.scm130
1 files changed, 91 insertions, 39 deletions
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 1dc64a5341..3a97765931 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -6,7 +6,7 @@
 ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
-;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2020, 2021, 2022 Marius Bakke <marius@gnu.org>
 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -28,6 +28,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix utils)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
@@ -199,7 +200,7 @@ by the b43-open driver of Linux-libre.")
 (define-public eg25-manager
   (package
     (name "eg25-manager")
-    (version "0.4.1")
+    (version "0.4.2")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -208,7 +209,7 @@ by the b43-open driver of Linux-libre.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1h4c4ndcnh88jn65h1kycxkjrydwwwh3irkxvpaxb6ry4wpc45r0"))))
+                "1czq2yi852aqkdnrxdifzcq669bdvlm7j40xivxq77jq04fggpmf"))))
     (build-system meson-build-system)
     (native-inputs (list curl
                          `(,glib "bin") pkg-config))
@@ -223,16 +224,16 @@ broadband modem as found, for example, on PinePhone.")
 (define* (make-opensbi-package platform name #:optional (arch "riscv64"))
   (package
     (name name)
-    (version "0.8")
+    (version "1.0")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/riscv/opensbi")
+             (url "https://github.com/riscv-software-src/opensbi")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1y9z0b6q6wpw7mgy31wml4djc6m8ydm71a9f1asnks4ragc7m98b"))))
+        (base32 "0srqkhd9b1mq4qkqk31dlrzy4mhljr49bzjxm0saylsbwhgxq31s"))))
     (build-system gnu-build-system)
     (native-inputs
      `(,@(if (and (not (string-prefix? "riscv64" (%current-system)))
@@ -256,13 +257,13 @@ broadband modem as found, for example, on PinePhone.")
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))
-                   (bin (find-files "." ".*fw_.*.elf$")))
+                   (bin (find-files "." "fw_.*\\.(elf|bin)$")))
                (for-each
                  (lambda (file)
                    (install-file file out))
                  bin))
              #t)))))
-    (home-page "https://github.com/riscv/opensbi")
+    (home-page "https://github.com/riscv-software-src/opensbi")
     (synopsis "RISC-V Open Source Supervisor Binary Interface")
     (description "A reference implementation of the RISC-V SBI specifications
 for platform-specific firmwares executing in M-mode.")
@@ -272,16 +273,13 @@ for platform-specific firmwares executing in M-mode.")
                    ;; platform/ariane-fpga/* is gpl2.
                    license:gpl2))))
 
-(define-public opensbi-qemu-generic
-  (make-opensbi-package "generic" "opensbi-qemu-generic"))
-
-(define-public opensbi-sifive-fu540
-  (make-opensbi-package "sifive/fu540" "opensbi-sifive-fu540"))
+(define-public opensbi-generic
+  (make-opensbi-package "generic" "opensbi-generic"))
 
 (define-public seabios
   (package
     (name "seabios")
-    (version "1.14.0")
+    (version "1.15.0")
     (source
      (origin
        (method git-fetch)
@@ -290,25 +288,71 @@ for platform-specific firmwares executing in M-mode.")
              (commit (string-append "rel-" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0jp4rxsv9jdzvx4gjvkybj6g1yjg8pkd2wys4sdh6c029npp6y8p"))))
+        (base32 "0gnsfmbgcvihsap8sz8c2n3qs439q44i3pwrms2nv3xcnf1sclj9"))))
     (build-system gnu-build-system)
-    (native-inputs
-     `(("python" ,python-wrapper)))
+    (native-inputs (list python-wrapper))
     (arguments
      `(#:tests? #f                      ; no check target
+       #:make-flags '("EXTRAVERSION=-guix") ;upstream wants distros to set this
+       #:modules (,@%gnu-build-system-modules
+                  (ice-9 match))
        #:phases
        (modify-phases %standard-phases
          (replace 'configure
            (lambda _
-             (setenv "CC" "gcc")
-             #t))
+             ;; Create the ".version" file that is present in release tarballs.
+             ;; Otherwise this will be regarded as an "unclean" build, and the
+             ;; build system ends up encoding the build date in the binaries.
+             (call-with-output-file ".version"
+               (lambda (port)
+                 (format port ,(package-version this-package))))
+             (setenv "CC" "gcc")))
+         (add-after 'build 'build-vgabios
+           (lambda* (#:key (make-flags ''()) #:allow-other-keys)
+             (for-each
+              (match-lambda
+                ((target . config)
+                 (let* ((dot-config (string-append (getcwd) "/" target "/.config"))
+                        (flags (append make-flags
+                                      (list (string-append "KCONFIG_CONFIG="
+                                                           dot-config)
+                                            (string-append "OUT=" target "/")))))
+                   (mkdir target)
+                   (call-with-output-file dot-config
+                     (lambda (port)
+                       (for-each (lambda (entry)
+                                   (if (string-suffix? "=n" entry)
+                                       (format port "# CONFIG_~a is not set~%"
+                                               (string-drop-right entry 2))
+                                       (format port "CONFIG_~a~%" entry)))
+                                 (cons "BUILD_VGABIOS=y" config))))
+                   (apply invoke "make" (append flags '("oldnoconfig")))
+                   (apply invoke "make" flags)
+                   (link (string-append target "/bios.bin")
+                         (string-append "out/" target ".bin")))))
+              ;; These tuples are modelled after Debians packaging:
+              ;; https://salsa.debian.org/qemu-team/seabios/-/blob/master/debian/rules
+              '(("ati"    . ("VGA_ATI=y" "VGA_PCI=y"))
+                ("bochs-display" . ("DISPLAY_BOCHS=y" "VGA_PCI=y"))
+                ("cirrus" . ("VGA_CIRRUS=y" "VGA_PCI=y"))
+                ("stdvga" . ("VGA_BOCHS=y" "VGA_PCI=y"))
+                ("virtio" . ("VGA_BOCHS_VIRTIO=y" "VGA_PCI=y"))
+                ("vmware" . ("VGA_BOCHS_VMWARE=y" "VGA_PCI=y"))
+                ("qxl"    . ("VGA_BOCHS_QXL=y" "VGA_PCI=y"))
+                ("isavga" . ("VGA_BOCHS=y" "VGA_PCI=n"))
+                ("ramfb"  . ("VGA_RAMFB=y" "VGA_PCI=n"))))))
          (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"))
-               #t))))))
+               (for-each (lambda (bios)
+                           (install-file bios fmw))
+                         (find-files "out" "\\.bin$"))
+               (with-directory-excursion fmw
+                 ;; QEMU 1.7 and later looks only for the latter.
+                 (symlink "bios.bin" "bios-256k.bin"))))))))
     (home-page "https://www.seabios.org/SeaBIOS")
     (synopsis "x86 BIOS implementation")
     (description "SeaBIOS is an implementation of a 16bit x86 BIOS.  SeaBIOS
@@ -487,7 +531,7 @@ Virtual Machines.  OVMF contains a sample UEFI firmware for QEMU and KVM.")
 (define* (make-arm-trusted-firmware platform #:optional (arch "aarch64"))
   (package
     (name (string-append "arm-trusted-firmware-" platform))
-    (version "2.5")
+    (version "2.6")
     (source
       (origin
         (method git-fetch)
@@ -498,7 +542,7 @@ Virtual Machines.  OVMF contains a sample UEFI firmware for QEMU and KVM.")
         (file-name (git-file-name "arm-trusted-firmware" version))
        (sha256
         (base32
-         "0w3blkqgmyb5bahlp04hmh8abrflbzy0qg83kmj1x9nv4mw66f3b"))))
+         "1j0rn33pwgmksqliwf2npm2px84qmbyma9iq8zpllwfc7dsl6gx9"))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
@@ -533,20 +577,17 @@ Virtual Machines.  OVMF contains a sample UEFI firmware for QEMU and KVM.")
                           "DEBUG=1")
        #:tests? #f)) ; no tests
     (native-inputs
-     `(,@(if (and (not (string-prefix? "aarch64" (%current-system)))
-                  (string-prefix? "aarch64" arch))
-           ;; Needs newer gcc version for some targets
-           `(("cross-gcc" ,(cross-gcc "aarch64-linux-gnu" #:xgcc gcc-9))
-             ("cross-binutils" ,(cross-binutils "aarch64-linux-gnu")))
-           '())
-       ,@(if (and (not (string-prefix? "armhf" (%current-system)))
-                  (string-prefix? "armhf" arch))
-           ;; Needs newer gcc version for some targets
-           `(("cross-gcc" ,(cross-gcc "arm-linux-gnueabihf" #:xgcc gcc-9))
-             ("cross-binutils" ,(cross-binutils "arm-linux-gnueabihf")))
-           '())
-       ;; Needs newer gcc version for some targets
-       ("gcc" ,gcc-9)))
+     (let ((system (%current-system)))
+       (cond
+        ((and (not (string-prefix? "aarch64" system))
+              (string-prefix? "aarch64" arch))
+         (list (cross-gcc "aarch64-linux-gnu")
+               (cross-binutils "aarch64-linux-gnu")))
+        ((and (not (string-prefix? "armhf" system))
+              (string-prefix? "armhf" arch))
+         (list (cross-gcc "arm-linux-gnueabihf")
+               (cross-binutils "arm-linux-gnueabihf")))
+        (else '()))))
     (home-page "https://www.trustedfirmware.org/")
     (synopsis "Implementation of \"secure world software\"")
     (description
@@ -579,6 +620,17 @@ such as:
       (inherit base)
       (name "arm-trusted-firmware-rk3399")
       (native-inputs
-       `(("cross32-gcc" ,(cross-gcc "arm-none-eabi"))
-         ("cross32-binutils", (cross-binutils "arm-none-eabi"))
-         ,@(package-native-inputs base))))))
+       (modify-inputs (package-native-inputs base)
+         (prepend
+             (cross-gcc "arm-none-eabi")
+             (cross-binutils "arm-none-eabi")))))))
+
+(define-public arm-trusted-firmware-imx8mq
+  (let ((base (make-arm-trusted-firmware "imx8mq")))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:make-flags flags ''())
+          ;; Adding debug symbols causes the size to exceed limits.
+          #~(delete "DEBUG=1" #$flags)))))))