summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/build/linux-boot.scm9
-rw-r--r--gnu/build/linux-modules.scm12
2 files changed, 14 insertions, 7 deletions
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 03f2ea245c..f273957d78 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -471,10 +471,6 @@ upon error."
              mounts)
         "ext4"))
 
-  (define (lookup-module name)
-    (string-append linux-module-directory "/"
-                   (ensure-dot-ko name)))
-
   (display "Welcome, this is GNU's early boot Guile.\n")
   (display "Use '--repl' for an initrd REPL.\n\n")
 
@@ -489,9 +485,8 @@ upon error."
          (start-repl))
 
        (display "loading kernel modules...\n")
-       (for-each (cut load-linux-module* <>
-                      #:lookup-module lookup-module)
-                 (map lookup-module linux-modules))
+       (load-linux-modules-from-directory linux-modules
+                                          linux-module-directory)
 
        (when keymap-file
          (let ((status (system* "loadkeys" keymap-file)))
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index a73ccaf511..2af7c33d42 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -43,6 +43,7 @@
             modules-loaded
             module-loaded?
             load-linux-module*
+            load-linux-modules-from-directory
 
             current-module-debugging-port
 
@@ -314,6 +315,17 @@ appears in BLACK-LIST are not loaded."
              (or (and recursive? (= EEXIST (system-error-errno args)))
                  (apply throw args)))))))
 
+(define (load-linux-modules-from-directory modules directory)
+  "Load MODULES and their dependencies from DIRECTORY, a directory containing
+the '.ko' files.  The '.ko' suffix is automatically added to MODULES if
+needed."
+  (define (lookup-module name)
+    (string-append directory "/" (ensure-dot-ko name)))
+
+  (for-each (cut load-linux-module* <>
+                 #:lookup-module lookup-module)
+            (map lookup-module modules)))
+
 
 ;;;
 ;;; Device modules.