gnu: Add datafly.
[jackhill/guix/guix.git] / gnu / packages / bootloaders.scm
index 6665627..7692382 100644 (file)
@@ -2,12 +2,12 @@
 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
-;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016, 2017, 2018 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2016, 2017 Danny Milosavljevic <dannym@scratchpost.org>
 ;;; Copyright © 2016, 2017 David Craven <david@craven.ch>
 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 nee <nee@cock.li>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
              (sha256
               (base32
                "0zgp5m3hmc9jh8wpjx6czzkh5id2y8n1k823x2mjvm2sk6b28ag5"))
-             (patches (search-patches "grub-efi-fat-serial-number.patch"))))
+             (patches (search-patches
+                       "grub-efi-fat-serial-number.patch"
+                       "grub-setup-root.patch"
+                       "grub-verifiers-Blocklist-fallout-cleanup.patch"
+                       "grub-cross-system-i686.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags
 
        ;; Depend on LVM2 for libdevmapper, used by 'grub-probe' and
        ;; 'grub-install' to recognize mapped devices (LUKS, etc.)
-       ("lvm2" ,lvm2)
+       ,@(if (member (or (%current-target-system)
+                         (%current-system))
+                     (package-supported-systems lvm2))
+             `(("lvm2" ,lvm2))
+             '())
 
        ;; Depend on mdadm, which is invoked by 'grub-probe' and 'grub-install'
        ;; to determine whether the root file system is RAID.
-       ("mdadm" ,mdadm)
+       ,@(if (member (or (%current-target-system)
+                         (%current-system))
+                     (package-supported-systems mdadm))
+             `(("mdadm" ,mdadm))
+             '())
 
        ;; Console-setup's ckbcomp is invoked by grub-kbdcomp.  It is required
        ;; for generating alternative keyboard layouts.
 
        ;; Needed for ‘grub-mount’, the only reliable way to tell whether a given
        ;; file system will be readable by GRUB without rebooting.
-       ("fuse" ,fuse)
+       ,@(if (member (or (%current-target-system)
+                         (%current-system))
+                     (package-supported-systems fuse))
+             `(("fuse" ,fuse))
+             '())
 
        ("freetype" ,freetype)
        ;; ("libusb" ,libusb)
        ;; Dependencies for the test suite.  The "real" QEMU is needed here,
        ;; because several targets are used.
        ("parted" ,parted)
-       ("qemu" ,qemu-minimal)
+       ,@(if (member (%current-system) (package-supported-systems qemu-minimal))
+             `(("qemu" ,qemu-minimal))
+             '())
        ("xorriso" ,xorriso)))
     (home-page "https://www.gnu.org/software/grub/")
     (synopsis "GRand Unified Boot loader")
@@ -212,6 +230,33 @@ menu to select one of the installed operating systems.")
     (license license:gpl3+)
     (properties '((cpe-name . "grub2")))))
 
+(define-public grub-minimal
+  (package
+    (inherit grub)
+    (name "grub-minimal")
+    (inputs
+     (fold alist-delete (package-inputs grub)
+           '("lvm2" "mdadm" "fuse" "console-setup")))
+    (native-inputs
+     (fold alist-delete (package-native-inputs grub)
+           '("help2man" "texinfo" "parted" "qemu" "xorriso")))
+    (arguments
+     `(#:configure-flags (list "PYTHON=true")
+       #:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'patch-stuff
+                   (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                     (substitute* "grub-core/Makefile.in"
+                       (("/bin/sh") (which "sh")))
+
+                     ;; Make the font visible.
+                     (copy-file (assoc-ref (or native-inputs inputs)
+                                           "unifont")
+                                "unifont.bdf.gz")
+                     (system* "gunzip" "unifont.bdf.gz")
+
+                     #t)))
+       #:tests? #f))))
+
 (define-public grub-efi
   (package
     (inherit grub)
@@ -305,7 +350,7 @@ menu to select one of the installed operating systems.")
          ("perl" ,perl)
          ("python-2" ,python-2)))
       (inputs
-       `(("libuuid" ,util-linux)
+       `(("libuuid" ,util-linux "lib")
          ("mtools" ,mtools)))
       (arguments
        `(#:parallel-build? #f
@@ -401,7 +446,7 @@ tree binary files.  These are board description files used by Linux and BSD.")
 (define u-boot
   (package
     (name "u-boot")
-    (version "2020.04")
+    (version "2020.07")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -409,7 +454,7 @@ tree binary files.  These are board description files used by Linux and BSD.")
                     "u-boot-" version ".tar.bz2"))
               (sha256
                (base32
-                "0wjkasnz87q86hx93inspdjfjsinmxi87bcvj30c773x0fpjlwzy"))))
+                "0sjzy262x93aaqd6z24ziaq19xjjjk5f577ivf768vmvwsgbzxf1"))))
     (native-inputs
      `(("bc" ,bc)
        ("bison" ,bison)
@@ -840,15 +885,6 @@ to Novena upstream, does not load u-boot.img from the first partition.")
   (let ((base (make-u-boot-package "pinebook-pro-rk3399" "aarch64-linux-gnu")))
     (package
      (inherit base)
-     (source (origin
-              (inherit (package-source u-boot))
-              (patches
-               (search-patches "u-boot-add-boe-nv140fhmn49-display.patch"
-                               "u-boot-gpio-keys-binding-cons.patch"
-                               "u-boot-leds-common-binding-con.patch"
-                               "u-boot-DT-for-Pinebook-Pro.patch"
-                               "u-boot-support-Pinebook-Pro-laptop.patch"
-                               "u-boot-video-rockchip-fix-build.patch"))))
       (arguments
         (substitute-keyword-arguments (package-arguments base)
           ((#:phases phases)
@@ -943,7 +979,7 @@ to Novena upstream, does not load u-boot.img from the first partition.")
        ("libyaml" ,libyaml)
        ("openssl" ,openssl)
        ("openssl:static" ,openssl "static")
-       ("util-linux" ,util-linux)))
+       ("util-linux" ,util-linux "lib")))
     (home-page
      "https://dev.chromium.org/chromium-os/chromiumos-design-docs/verified-boot")
     (synopsis "ChromiumOS verified boot utilities")
@@ -972,7 +1008,8 @@ tools, and more.")
                   (guix build utils)
                   (ice-9 regex)         ; for string-match
                   (srfi srfi-26))       ; for cut
-       #:make-flags (list "CC=gcc")
+       #:make-flags
+       (list ,(string-append "CC=" (cc-for-target)))
        #:tests? #f                      ; no tests
        #:phases
        (modify-phases %standard-phases