summaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-03-27 00:12:15 +0100
committerMarius Bakke <mbakke@fastmail.com>2020-03-27 00:12:15 +0100
commit18af6870370226b4d502d7372844e7f2aded5887 (patch)
tree749d93209bd0cb9710ccaae2207df670f37eaa36 /gnu/build
parent0ab8ad46322bea331ed5f5592843ba35e7f38b37 (diff)
parent3089b70d766bd9ec70e1464867130b7b864fbe17 (diff)
Merge branch 'master' into core-updates
Conflicts: gnu/packages/icu4c.scm gnu/packages/man.scm gnu/packages/python-xyz.scm guix/scripts/environment.scm guix/scripts/pack.scm guix/scripts/package.scm guix/scripts/pull.scm guix/store.scm
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/linux-modules.scm46
1 files changed, 44 insertions, 2 deletions
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index a149eff329..aa1c7cfeae 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -22,12 +22,14 @@
#:use-module (guix elf)
#:use-module (guix glob)
#:use-module (guix build syscalls)
- #:use-module ((guix build utils) #:select (find-files))
+ #:use-module ((guix build utils) #:select (find-files invoke))
+ #:use-module (guix build union)
#:use-module (rnrs io ports)
#:use-module (rnrs bytevectors)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
+ #:use-module (ice-9 ftw)
#:use-module (ice-9 vlist)
#:use-module (ice-9 match)
#:use-module (ice-9 rdelim)
@@ -56,7 +58,9 @@
write-module-name-database
write-module-alias-database
- write-module-device-database))
+ write-module-device-database
+
+ make-linux-module-directory))
;;; Commentary:
;;;
@@ -631,4 +635,42 @@ be loaded on-demand, such as file system modules."
module devname type major minor)))
aliases))))
+(define (depmod version directory)
+ "Given an (existing) DIRECTORY, invoke depmod on it for
+kernel version VERSION."
+ (let ((destination-directory (string-append directory "/lib/modules/"
+ version))
+ ;; Note: "System.map" is an input file.
+ (maps-file (string-append directory "/System.map"))
+ ;; Note: "Module.symvers" is an input file.
+ (symvers-file (string-append directory "/Module.symvers")))
+ ;; These files will be regenerated by depmod below.
+ (for-each (lambda (basename)
+ (when (and (string-prefix? "modules." basename)
+ ;; Note: "modules.builtin" is an input file.
+ (not (string=? "modules.builtin" basename))
+ ;; Note: "modules.order" is an input file.
+ (not (string=? "modules.order" basename)))
+ (delete-file (string-append destination-directory "/"
+ basename))))
+ (scandir destination-directory))
+ (invoke "depmod"
+ "-e" ; Report symbols that aren't supplied
+ ;"-w" ; Warn on duplicates
+ "-b" directory
+ "-F" maps-file
+ ;"-E" symvers-file ; using both "-E" and "-F" is not possible.
+ version)))
+
+(define (make-linux-module-directory inputs version output)
+ "Create a new directory OUTPUT and ensure that the directory
+OUTPUT/lib/modules/VERSION can be used as a source of Linux
+kernel modules for the first kmod in PATH now to eventually
+load. Take modules to put into OUTPUT from INPUTS.
+
+Right now that means it creates @code{modules.*.bin} which
+@command{modprobe} will use to find loadable modules."
+ (union-build output inputs #:create-all-directories? #t)
+ (depmod version output))
+
;;; linux-modules.scm ends here