aboutsummaryrefslogtreecommitdiff
path: root/gnu/build/linux-modules.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2019-03-14 15:06:06 +0100
committerMarius Bakke <mbakke@fastmail.com>2019-03-14 15:06:06 +0100
commitebfe259f6682b43d7f0d3b57b525e25f97410052 (patch)
treee3f09eb6159168e1736f8a629286eb3d148917a9 /gnu/build/linux-modules.scm
parent47b3eed821cf86c350dc4b0fdbe75647cdc275b0 (diff)
parent8cc3983a4d02a15ad4a863671c1a5a8b2b542625 (diff)
downloadgnu-guix-ebfe259f6682b43d7f0d3b57b525e25f97410052.tar
gnu-guix-ebfe259f6682b43d7f0d3b57b525e25f97410052.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'gnu/build/linux-modules.scm')
-rw-r--r--gnu/build/linux-modules.scm27
1 files changed, 25 insertions, 2 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