From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esSr2-0005j8-Uz for guix-patches@gnu.org; Sun, 04 Mar 2018 07:35:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esSr0-0004n1-Ip for guix-patches@gnu.org; Sun, 04 Mar 2018 07:35:04 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:35619) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esSr0-0004mj-FI for guix-patches@gnu.org; Sun, 04 Mar 2018 07:35:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1esSr0-0005oC-07 for guix-patches@gnu.org; Sun, 04 Mar 2018 07:35:02 -0500 Subject: [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present. Resent-Message-ID: Date: Sun, 4 Mar 2018 13:34:44 +0100 From: Danny Milosavljevic Message-ID: <20180304133444.4edceecd@scratchpost.org> In-Reply-To: <87sh9g4vy1.fsf@gnu.org> References: <20180302153408.14091-1-dannym@scratchpost.org> <20180303135533.6112-1-dannym@scratchpost.org> <20180303135533.6112-4-dannym@scratchpost.org> <87sh9g4vy1.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/war/2NgU7F4a1M/YUNS3K5e"; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 30604@debbugs.gnu.org --Sig_/war/2NgU7F4a1M/YUNS3K5e Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Ludo, I've been thinking about it some more - I think it can be made to work "you= r" way. I'm trying to integrate it right now. But! The module-aliases->module-file-names way I've been pursuing (which a= lso 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 direc= tory 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) --Sig_/war/2NgU7F4a1M/YUNS3K5e Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlqb5+QACgkQ5xo1VCww uqXJ9wf/UFzvHkvHtXvKpynbANSL48kLwGHYSKetR6r353nTtySJZV0kVrRf6aEk eLZnfbjOFX1Y7cQYKPgiC4/lg5JbqxWkWNR0R1zNQvUgXByL8hxfkuZYtwWE7z5G Buw/dZBJNdRcG8ZlaOw6r88bhD3CtnceI+XhcqH6sOGud2Bef3cn8HO2gLeA5vi9 DOmeXM1wlP45eYxZ+FNKRJ7WXQwsnGo3WTwowpttZQdA0p80BKmjy+7Jv2DOW3D9 z8lfZ/yHeOQkW1PE7vi0TsjTKy1ryFSBfI37MMcOfmFgenkMKG4K/+c9rMUPltGi 0rBPw7P1HKqxQAXWYaISS3MpQRrvpQ== =uxOr -----END PGP SIGNATURE----- --Sig_/war/2NgU7F4a1M/YUNS3K5e--