From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqgDi-0006Aw-2a for guix-patches@gnu.org; Tue, 27 Feb 2018 09:27:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqgDe-00029s-RN for guix-patches@gnu.org; Tue, 27 Feb 2018 09:27:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:54930) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqgDe-00029l-NU for guix-patches@gnu.org; Tue, 27 Feb 2018 09:27:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqgDe-0003UN-HB for guix-patches@gnu.org; Tue, 27 Feb 2018 09:27:02 -0500 Subject: [bug#30604] [PATCH v3 4/6] linux-boot: Load kernel modules only when the hardware is present. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180226035025.1698-1-dannym@scratchpost.org> <20180226040609.3066-1-dannym@scratchpost.org> <20180226040609.3066-5-dannym@scratchpost.org> Date: Tue, 27 Feb 2018 15:26:06 +0100 In-Reply-To: <20180226040609.3066-5-dannym@scratchpost.org> (Danny Milosavljevic's message of "Mon, 26 Feb 2018 05:06:07 +0100") Message-ID: <87muzu33wh.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Danny Milosavljevic Cc: 30604@debbugs.gnu.org Hello, Nice patch series! Danny Milosavljevic skribis: > * gnu/build/linux-boot.scm (boot-system): Load kernel modules only when > the hardware is present. > * gnu/system/linux-initrd.scm (raw-initrd): Add imports. [...] > + (define (load-kernel-modules) > + "Examine /sys/devices to find out which modules to load and load the= m." > + (define enter? > + (const #t)) > + (define (down! path stat result) > + ;; Note: modprobe mutates the tree starting with path. > + (let ((modalias-name (string-append path "/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)))) Can we build upon (gnu build linux-modules) to achieve this? Hopefully the tools at can help a bit. Thanks, Ludo=E2=80=99.