>From 626930cbad11e7f5546589fc290b2c95fee97b80 Mon Sep 17 00:00:00 2001 Message-ID: <626930cbad11e7f5546589fc290b2c95fee97b80.1703992381.git.nathan_mail@nborghese.com> From: nathan Date: Sat, 30 Dec 2023 22:10:26 -0500 Subject: [PATCH 1/3] linux-modules: Allow parameters to be passed to kernel modules * gnu/build/linux-modules.scm (load-linux-module*): New parameter, `get-options', for getting kernel module parameters to give to Linux. Change-Id: I8c4629a1404270fe641fef02a9fbbaeac4360e65 --- gnu/build/linux-modules.scm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm index 12cb9c4ba6..c4950ea6d2 100644 --- a/gnu/build/linux-modules.scm +++ b/gnu/build/linux-modules.scm @@ -332,12 +332,15 @@ (define* (load-linux-module* file #:key (recursive? #t) (lookup-module dot-ko) - (black-list (module-black-list))) + (black-list (module-black-list)) + (get-options (const ""))) "Load Linux module from FILE, the name of a '.ko[.gz|.xz]' file; return true on success, false otherwise. When RECURSIVE? is true, load its dependencies first (à la 'modprobe'.) The actual files containing modules depended on are obtained by calling LOOKUP-MODULE with the module name. Modules whose name -appears in BLACK-LIST are not loaded." +appears in BLACK-LIST are not loaded. GET-OPTIONS is a procedure that takes a +normalized module name string input and returns a string containing the complete +parameters to pass to the module. See init_module(2) for the parameters format." (define (black-listed? module) (let ((result (member module black-list))) (when result @@ -350,20 +353,23 @@ (define* (load-linux-module* file (let ((dependencies (module-dependencies file))) (every (cut load-linux-module* <> #:lookup-module lookup-module - #:black-list black-list) + #:black-list black-list + #:get-options get-options) (map lookup-module dependencies)))) (and (not (black-listed? (file-name->module-name file))) (or (not recursive?) (load-dependencies file)) - (let ((fd #f)) + (let ((fd #f) + (options (get-options (file-name->module-name file)))) (format (current-module-debugging-port) - "loading Linux module from '~a'...~%" file) + "loading Linux module from '~a' with options '~a'...~%" file + options) (catch 'system-error (lambda () (set! fd (open-fdes file O_RDONLY)) - (load-linux-module/fd fd) + (load-linux-module/fd fd options) (close-fdes fd) #t) (lambda args base-commit: f24b14767d362a84e6469682b4fe303b50f4b589 -- 2.41.0