summary refs log tree commit diff
path: root/gnu/build
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/linux-modules.scm27
-rw-r--r--gnu/build/vm.scm6
2 files changed, 28 insertions, 5 deletions
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index d99d1f01a4..c66ef97012 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2016, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -47,7 +47,8 @@
 
             device-module-aliases
             known-module-aliases
-            matching-modules))
+            matching-modules
+            missing-modules))
 
 ;;; Commentary:
 ;;;
@@ -463,4 +464,26 @@ ALIAS is a string like \"scsi:t-0x00\" as returned by
                       module)))
               known-aliases))
 
+(define* (missing-modules device modules-provided)
+  "Assuming MODULES-PROVIDED lists kernel modules that are already
+provided--e.g., in the initrd, return the list of missing kernel modules that
+are required to access DEVICE."
+  (define aliases
+    ;; Attempt to load 'modules.alias' from the current kernel, assuming we're
+    ;; on Guix System, and assuming that corresponds to the kernel we'll be
+    ;; installing.
+    (known-module-aliases))
+
+  (if aliases
+      (let* ((modules  (delete-duplicates
+                        (append-map (cut matching-modules <> aliases)
+                                    (device-module-aliases device))))
+
+             ;; Module names (not file names) are supposed to use underscores
+             ;; instead of hyphens.  MODULES is a list of module names, whereas
+             ;; LINUX-MODULES is file names without '.ko', so normalize them.
+             (provided (map file-name->module-name modules-provided)))
+        (remove (cut member <> provided) modules))
+      '()))
+
 ;;; linux-modules.scm ends here
diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm
index 0aef73d26d..6d6a0c4cb4 100644
--- a/gnu/build/vm.scm
+++ b/gnu/build/vm.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
 ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
@@ -422,7 +422,7 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation."
             (string-append "boot/grub/grub.cfg=" config-file))))
 
 (define* (make-iso9660-image grub config-file os-drv target
-                             #:key (volume-id "GuixSD_image") (volume-uuid #f)
+                             #:key (volume-id "Guix_image") (volume-uuid #f)
                              register-closures? (closures '()))
   "Given a GRUB package, creates an iso image as TARGET, using CONFIG-FILE as
 GRUB configuration and OS-DRV as the stuff in it."
@@ -550,7 +550,7 @@ passing it a directory name where it is mounted."
           (lambda (port)
             (format port
                     "insmod part_msdos~@
-                    search --set=root --label GuixSD_image~@
+                    search --set=root --label Guix_image~@
                     configfile /boot/grub/grub.cfg~%")))
 
         (display "creating EFI firmware image...")