guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the


From: Danny Milosavljevic
Subject: [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present.
Date: Sun, 4 Mar 2018 13:34:44 +0100

Hi Ludo,

I've been thinking about it some more - I think it can be made to work "your" 
way.

I'm trying to integrate it right now.

But!  The module-aliases->module-file-names way I've been pursuing (which also
returns the recursive dependencies) has the advantage of using exactly the same
procedure for both flat-linux-module-directory (which copies files) and for
our modprobe (which loads them later).

This means that it's very likely these two will match.

But if load-linux-module* recursively loads modules on its own it's easily
possible that these will diverge - what flat-linux-module-directory is doing
could (accidentially) differ in the future.

Maybe that's overly defensive programming.  What do you think?

My flat-linux-module-directory basically just returns a subset of the directory
tree it gets as parameter (and flattens it for no reason).

Also, I've been trying to use find-files for /sys before, like you do.
It doesn't work correctly - probably because of the mutation that modprobe does
(find-files sorts - not sure whether that's the whole story).

Integration tests just finished - even the basic system test fails because of it
now.

I tried only this:

   (define (load-kernel-modules)
     "Examine /sys/devices to find out which modules to load and load them."
-    (define enter?
-      (const #t))
-    (define (down! directory stat result)
-     ;; Note: modprobe mutates the tree starting with DIRECTORY.
-     (let ((modalias-name (string-append directory "/modalias")))
-       (if (file-exists? modalias-name)
-           (let ((modalias
-                 (string-trim-right (call-with-input-file modalias-name
-                                                          read-string)
-                                    #\newline)))
-             (system* "/sbin/modprobe" "-q" "--" modalias))))
-       #t)
-    (define up
-      (const #t))
-    (define skip
-      (const #t))
-    (define leaf
-      (const #t))
-    (define (error name stat errno result)
-      (format (current-error-port) "warning: ~a: ~a~%"
-              name (strerror errno))
-      result)
-    (file-system-fold enter? leaf down! up skip error #t "/sys/devices"))
+    (for-each (lambda (modalias)
+                (system* "/sbin/modprobe" "-q" "--" modalias))
+              (system-device-aliases)))

Doesn't work anymore...

ERROR: In procedure network-interface-flags:
In procedure network-interface-flags: No such device

(I've exported system-device-aliases)

Attachment: pgpkZvVNRPvKj.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]