linux-modules: Add 'load-linux-modules-from-directory'.

* gnu/build/linux-modules.scm (load-linux-modules-from-directory): New
procedure.
* gnu/build/linux-boot.scm (boot-system)[lookup-module]: Remove.
Use 'load-linux-modules-from-directory' instead.
This commit is contained in:
Ludovic Courtès 2018-03-09 10:41:46 +01:00
parent 2a693b69ca
commit e1a9a7f275
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 14 additions and 7 deletions

View File

@ -471,10 +471,6 @@ upon error."
mounts) mounts)
"ext4")) "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 "Welcome, this is GNU's early boot Guile.\n")
(display "Use '--repl' for an initrd REPL.\n\n") (display "Use '--repl' for an initrd REPL.\n\n")
@ -489,9 +485,8 @@ upon error."
(start-repl)) (start-repl))
(display "loading kernel modules...\n") (display "loading kernel modules...\n")
(for-each (cut load-linux-module* <> (load-linux-modules-from-directory linux-modules
#:lookup-module lookup-module) linux-module-directory)
(map lookup-module linux-modules))
(when keymap-file (when keymap-file
(let ((status (system* "loadkeys" keymap-file))) (let ((status (system* "loadkeys" keymap-file)))

View File

@ -43,6 +43,7 @@
modules-loaded modules-loaded
module-loaded? module-loaded?
load-linux-module* load-linux-module*
load-linux-modules-from-directory
current-module-debugging-port current-module-debugging-port
@ -314,6 +315,17 @@ appears in BLACK-LIST are not loaded."
(or (and recursive? (= EEXIST (system-error-errno args))) (or (and recursive? (= EEXIST (system-error-errno args)))
(apply throw 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. ;;; Device modules.