GNU bug report logs - #55231
[PATCH v1] initrd: Allow extra search paths with ‘initrd-extra-module-paths’

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Brian Cully <bjc@HIDDEN>; Keywords: patch; dated Mon, 2 May 2022 19:55:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 55231 <at> debbugs.gnu.org:


Received: (at 55231) by debbugs.gnu.org; 13 May 2022 19:46:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 13 15:46:20 2022
Received: from localhost ([127.0.0.1]:45080 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1npbEy-0007PC-6L
	for submit <at> debbugs.gnu.org; Fri, 13 May 2022 15:46:20 -0400
Received: from mail-40138.protonmail.ch ([185.70.40.138]:13975)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <kaelyn.alexi@HIDDEN>) id 1npbEw-0007Oy-2H
 for 55231 <at> debbugs.gnu.org; Fri, 13 May 2022 15:46:18 -0400
Date: Fri, 13 May 2022 19:46:02 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail2; t=1652471170; x=1652730370;
 bh=8jQUkjaGsOdNjWHjXT41h4SNsXREShc41EWYMNFdmwk=;
 h=Date:To:From:Reply-To:Subject:Message-ID:Feedback-ID:From:To:Cc:
 Date:Subject:Reply-To:Feedback-ID:Message-ID;
 b=gDAlUBEqqAS8lwHmrVqdIJgbFt+aZBvyEcAZShoEP5ODhZB41RFoj4gcEwLKe5Eei
 TWUybaRMNMJxdxCcN+CM9M170cx3B1rzHUw/K/dGeJNdFue9J3IoLiVAWrKEO9RCmW
 MzgEpL3Puhp7H9dHJ2VNmCO3EHYIrhwYqLxKe2+Ocjd8IJpMO9mvcTjRf3W3LzKmii
 lbr7ISfMFLmWKPmJlpRBCtoPbncnClKA5yVIOV2Eqzn1gE6tSijSx5ZlS/NNO8MwKW
 6gOuSi9NfAA+asSQdwGYy6RxSoyjzFzMeDSr/Co7PS7K6HqqETpt6VLd/jNRBOG3RW
 m1WXJWKwCJUJA==
To: "55231 <at> debbugs.gnu.org" <55231 <at> debbugs.gnu.org>
From: Kaelyn <kaelyn.alexi@HIDDEN>
Subject: =?utf-8?Q?[PATCH_v1]_initrd:_Allow_extra_search_paths_with_=E2=80=98initrd-extra-module-paths=E2=80=99?=
Message-ID: <j3O4Vb5dVlLA_P-LaSEH-2wB7aPJM3Zlupj1seuNjR34OijQwAiM9ZECRx309TmNwIejOzHv_W5lkUkeQC8MqGTbK3kqjcZa3fCx440oWcw=@protonmail.com>
Feedback-ID: 34709329:user:proton
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55231
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Kaelyn <kaelyn.alexi@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

I've read through the original patch and the doc patch, and based on my own=
 tinkering with guix initrd generation, the patches look good to me. I'm al=
so happy to see the functionality being added, and already have plans for u=
sing it with zfs (to further the goal of an encrypted multi-disk zfs root).

Cheers,
Kaelyn




Information forwarded to guix-patches@HIDDEN:
bug#55231; Package guix-patches. Full text available.

Message received at 55231 <at> debbugs.gnu.org:


Received: (at 55231) by debbugs.gnu.org; 2 May 2022 22:55:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 02 18:55:20 2022
Received: from localhost ([127.0.0.1]:38263 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nlewq-0002ZI-0d
	for submit <at> debbugs.gnu.org; Mon, 02 May 2022 18:55:20 -0400
Received: from coleridge.kublai.com ([166.84.7.167]:57300 helo=mail.spork.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bjc@HIDDEN>) id 1nlewo-0002ZA-5i
 for 55231 <at> debbugs.gnu.org; Mon, 02 May 2022 18:55:18 -0400
Received: from ditto (unknown [IPv6:2001:470:1f07:1b9:8650:a942:ec5e:856b])
 by mail.spork.org (Postfix) with ESMTPSA id BCCE755FF;
 Mon,  2 May 2022 18:55:07 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=spork.org; s=dkim;
 t=1651532117; bh=NO9Rci0bsXvPsmtn24mKPzumpNi0MfZAYg/H9ioZ7hQ=;
 h=References:From:To:Cc:Subject:Date:In-reply-to;
 b=MlfUQYH7c3Of4W9f651wQaFR3xpo2bmYvqYpkXcevQcv7BM3/cmTHklp7VZBUWgJo
 7bt/L/9iMuiMn/tN4Jkn2BUvNYArIvagqjYOp9p2TDPbDe4Edd0iBZoQPxYgV08+OB
 NkwZOMRWImo0FwDStO0RXqvqhQgGuN2YpY4zhpxg=
References: <87wnf3pv87.fsf@HIDDEN>
 <c87a1c647289c0f0fb60773e2fd50916861b4d8b.camel@HIDDEN>
User-agent: mu4e 1.6.10; emacs 28.1
From: Brian Cully <bjc@HIDDEN>
To: Maxime Devos <maximedevos@HIDDEN>
Subject: Re: [bug#55231] [PATCH v1] initrd: Allow extra search paths with
 =?utf-8?Q?=E2=80=98initrd-extra-module-paths=E2=80=99?=
Date: Mon, 02 May 2022 18:53:31 -0400
In-reply-to: <c87a1c647289c0f0fb60773e2fd50916861b4d8b.camel@HIDDEN>
Message-ID: <87sfprpmt3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55231
Cc: 55231 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Maxime Devos <maximedevos@HIDDEN> writes:

> This needs some information in the manual -- when does the field=20
> need
> to be set?  For what kernel modules?  Is this required by=20
> v4l2loopback-
> linux-module and librem-ec-acpi-linux-module?  Things like that.
> As-is, this functionality is hard to discover.

I knew I missed something. How=E2=80=99s this look?

---
 doc/guix.texi | 42 ++++++++++++++++++++++++++++++++++--------
 1 file changed, 34 insertions(+), 8 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5399584cb0..1ee2c1b4a3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -15173,6 +15173,16 @@ Window System.
 The list of Linux kernel modules that need to be available in the
 initial RAM disk.  @xref{Initial RAM Disk}.
=20
+@item @code{initrd-extra-module-paths} (default: @code{'()})
+@cindex initrd
+@cindex initial RAM disk
+A list of paths outside of the Linux kernel tree to search for=20
Linux
+kernel modules.
+
+The items in this may be either file-like objects (usually=20
packages), or
+a list where the first element is a package and the second is an
+output--e.g. @code{(list (list zfs "module"))}.
+
 @item @code{initrd} (default: @code{base-initrd})
 A procedure that returns an initial RAM disk for the Linux
 kernel.  This field is provided to support low-level=20
 customization and
@@ -35516,6 +35526,19 @@ file system, you would write:
   (initrd-modules (cons "megaraid_sas" %base-initrd-modules)))
 @end lisp
=20
+If a module listed in @code{initrd-modules} is not included in=20
the
+Linux-libre kernel, then the location to it must be added to the
+@code{initrd-extra-module-paths} list.  For example, if your root=20
file
+system exists on a ZFS pool, then your configuration might look=20
like the
+following:
+
+@lisp
+(operating-system
+  ;; @dots{}
+  (initrd-modules (cons "zfs" %base-initrd-modules))
+  (initrd-extra-module-paths (list (list zfs "module"))))
+@end lisp
+
 @defvr {Scheme Variable} %base-initrd-modules
 This is the list of kernel modules included in the initrd by=20
 default.
 @end defvr
@@ -35629,13 +35652,15 @@ here is how to use it and customize it=20
further.
 @cindex initrd
 @cindex initial RAM disk
 @deffn {Scheme Procedure} raw-initrd @var{file-systems} @
-       [#:linux-modules '()] [#:mapped-devices '()] @
-       [#:keyboard-layout #f] @
+       [#:linux-modules '()] [#:linux-extra-module-paths '()] @
+       [#:mapped-devices '()] [#:keyboard-layout #f] @
        [#:helper-packages '()] [#:qemu-networking? #f]=20
        [#:volatile-root? #f]
 Return a derivation that builds a raw initrd.  @var{file-systems}=20
 is
 a list of file systems to be mounted by the initrd, possibly in=20
 addition to
 the root file system specified on the kernel command line via=20
 @option{root}.
 @var{linux-modules} is a list of kernel modules to be loaded at=20
 boot time.
+@var{linux-extra-module-paths} is a list of file-like objects to=20
be searched
+for kernel modules.
 @var{mapped-devices} is a list of device mappings to realize=20
 before
 @var{file-systems} are mounted (@pxref{Mapped Devices}).
 @var{helper-packages} is a list of packages to be copied in the=20
 initrd.
@@ -35660,12 +35685,13 @@ to it are lost.
 @deffn {Scheme Procedure} base-initrd @var{file-systems} @
        [#:mapped-devices '()] [#:keyboard-layout #f] @
        [#:qemu-networking? #f] [#:volatile-root? #f] @
-       [#:linux-modules '()]
-Return as a file-like object a generic initrd, with kernel
-modules taken from @var{linux}.  @var{file-systems} is a list of=20
 file-systems to be
-mounted by the initrd, possibly in addition to the root file=20
 system specified
-on the kernel command line via @option{root}.=20
 @var{mapped-devices} is a list of device
-mappings to realize before @var{file-systems} are mounted.
+       [#:linux-modules '()] [#:linux-extra-module-paths '()]
+Return as a file-like object a generic initrd, with kernel=20
modules taken
+from @var{linux} and @var{linux-extra-module-paths}.=20
@var{file-systems}
+is a list of file-systems to be mounted by the initrd, possibly=20
in
+addition to the root file system specified on the kernel command=20
line
+via @option{root}.  @var{mapped-devices} is a list of device=20
mappings to
+realize before @var{file-systems} are mounted.
=20
 When true, @var{keyboard-layout} is a @code{<keyboard-layout>}=20
 record denoting
 the desired console keyboard layout.  This is done before=20
 @var{mapped-devices}
--=20
2.35.1




Information forwarded to guix-patches@HIDDEN:
bug#55231; Package guix-patches. Full text available.

Message received at 55231 <at> debbugs.gnu.org:


Received: (at 55231) by debbugs.gnu.org; 2 May 2022 22:03:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 02 18:03:57 2022
Received: from localhost ([127.0.0.1]:38240 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nle97-0001L5-Jq
	for submit <at> debbugs.gnu.org; Mon, 02 May 2022 18:03:57 -0400
Received: from laurent.telenet-ops.be ([195.130.137.89]:50054)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nle95-0001Kv-5C
 for 55231 <at> debbugs.gnu.org; Mon, 02 May 2022 18:03:56 -0400
Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be
 ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a])
 by laurent.telenet-ops.be with bizsmtp
 id Ry3t270024UW6Th01y3tna; Tue, 03 May 2022 00:03:53 +0200
Message-ID: <c87a1c647289c0f0fb60773e2fd50916861b4d8b.camel@HIDDEN>
Subject: Re: [bug#55231] [PATCH v1] initrd: Allow extra search paths with
 =?UTF-8?Q?=E2=80=98initrd-extra-module-paths=E2=80=99?=
From: Maxime Devos <maximedevos@HIDDEN>
To: Brian Cully <bjc@HIDDEN>, 55231 <at> debbugs.gnu.org
Date: Tue, 03 May 2022 00:03:42 +0200
In-Reply-To: <87wnf3pv87.fsf@HIDDEN>
References: <87wnf3pv87.fsf@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-5cTRqjaDdOITOGA8BtZm"
User-Agent: Evolution 3.38.3-1 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22;
 t=1651529033; bh=XZzrAxdED9UE0kZqDG7/zrZguBSgAhh08TfHgfjeJ18=;
 h=Subject:From:To:Date:In-Reply-To:References;
 b=a1IMb0s5GIMCk2aJpsuGVMzA0jzezfT3Wd8wTZLFLrtz6h5kdGSb0EYqZoEGCfcxx
 54YSgQrBwLjX8CbOq7J4zSOgRbevxyDbbKSy+rC45UCNJsQytrp/F9L2bKue7Yetef
 sBioKm3tFmgcm4gThpP/paG9owZOkSFKgVMKknKv0rS0B8NZ5gJLV861aPtM3s1Rzd
 yZtSDh8L0n7OQSvBHEKpIffORqakDBO+l/jzy3L1nIMcufTkuGccEf39i5QudrmZe8
 5NGOAqsm3mbAT1RUjDV3MKu9N2dW/F6AMoJZUIo9k5QK3Bd9yVGq9k5/6ilws2z/YX
 Lg611BNeUBfYg==
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55231
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--=-5cTRqjaDdOITOGA8BtZm
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Brian Cully via Guix-patches via schreef op ma 02-05-2022 om 15:11 [-
0400]:
> This patch allows copying of out-of-tree kernel modules to the Linux
> initrd.

This needs some information in the manual -- when does the field need
to be set?  For what kernel modules?  Is this required by v4l2loopback-
linux-module and librem-ec-acpi-linux-module?  Things like that.
As-is, this functionality is hard to discover.

Greetings,
Maxime.


--=-5cTRqjaDdOITOGA8BtZm
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYnBVPhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7hICAP9CDCAYffBUwkoR9lfzmRg/llBf
MbwZUM4GSZzfcnSn5QEAyofUp0BgfQaywlQmN6VYwaebfeGIVq7RjHqV4Dn2EAk=
=fPl7
-----END PGP SIGNATURE-----

--=-5cTRqjaDdOITOGA8BtZm--





Information forwarded to guix-patches@HIDDEN:
bug#55231; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 May 2022 19:54:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 02 15:54:11 2022
Received: from localhost ([127.0.0.1]:38041 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nlc7W-0007Eo-QW
	for submit <at> debbugs.gnu.org; Mon, 02 May 2022 15:54:11 -0400
Received: from lists.gnu.org ([209.51.188.17]:53716)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bjc@HIDDEN>) id 1nlc7V-0007EY-Hr
 for submit <at> debbugs.gnu.org; Mon, 02 May 2022 15:54:10 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51000)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bjc@HIDDEN>) id 1nlc7V-0003im-7Q
 for guix-patches@HIDDEN; Mon, 02 May 2022 15:54:09 -0400
Received: from coleridge.kublai.com ([166.84.7.167]:53283 helo=mail.spork.org)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <bjc@HIDDEN>) id 1nlc7T-0004gU-3g
 for guix-patches@HIDDEN; Mon, 02 May 2022 15:54:08 -0400
Received: from ditto (unknown [IPv6:2001:470:1f07:1b9:8650:a942:ec5e:856b])
 by mail.spork.org (Postfix) with ESMTPSA id AAD7D5717
 for <guix-patches@HIDDEN>; Mon,  2 May 2022 15:53:15 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=spork.org; s=dkim;
 t=1651521195; bh=u+B+QyVD+9RTOMbyzoXzK6TU4GFt79n3l1oU6PKQJI4=;
 h=From:To:Subject:Date;
 b=iAiqhE7p1+86cqE/QfFtAmUv/a0C43yTldM18CZz6yFy6+QnFTKlhlySCpUdMcPh3
 AqKxzxQWZnl/b02PFZY7Q39Hg6tVgzgFJjXf1RXB9QOOqAEa/UtK+LYmJloxdK/OGY
 xr64CNKYwjX22yoXj6ArB5EaJJJvnRHc3gb96uWo=
User-agent: mu4e 1.6.10; emacs 28.1
From: Brian Cully <bjc@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH v1] =?UTF-8?q?initrd:=20Allow=20extra=20search=20paths=20w?=
 =?UTF-8?q?ith=20=E2=80=98initrd-extra-module-paths=E2=80=99?=
Date: Mon, 2 May 2022 15:11:30 -0400
Message-ID: <87wnf3pv87.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=166.84.7.167; envelope-from=bjc@HIDDEN;
 helo=mail.spork.org
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

This patch allows copying of out-of-tree kernel modules to the Linux
initrd.

For out-of-tree modules to found, an extra slot has been added to
=E2=80=98operating-system=E2=80=99: =E2=80=98initrd-extra-module-paths=E2=
=80=99, which contains a list
containing items of either FILE-LIKE or (FILE-LIKE OUTPUT) which will be
searched for modules in addition to the standard Linux module path. The
required modules can then be added to =E2=80=98initrd-modules=E2=80=99 as n=
ormal and all paths
will be searched for it, including for any modules depended on.

* gnu/build/linux-modules.scm (find-module-file): change DIRECTORY argument=
 to
DIRECTORIES. Now takes a list of directories to search, rather than a single
one.
* gnu/system.scm <operating-system>: Add INITRD-EXTRA-MODULE-PATHS
field and accessor. Takes a list of file-like objects.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): change LINUX
argument to PACKAGES. Now contains a list of file-likes to search for modul=
es.
(raw-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
to (flat-linux-extra-module-paths) along with the selected LINUX package.
(base-initrd): Add LINUX-EXTRA-MODULE-PATHS keyword argument. Pass it
to (raw-initrd).
---
 gnu/build/linux-modules.scm | 19 ++++++++------
 gnu/system.scm              |  5 ++++
 gnu/system/linux-initrd.scm | 52 +++++++++++++++++++++++++------------
 3 files changed, 51 insertions(+), 25 deletions(-)

diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 053720574b..97b7e429ea 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -225,8 +225,8 @@ (define (file-name->module-name file)
 '.ko[.gz|.xz]' and normalizing it."
   (normalize-module-name (strip-extension (basename file))))
=20
-(define (find-module-file directory module)
-  "Lookup module NAME under DIRECTORY, and return its absolute file name.
+(define (find-module-file directories module)
+  "Lookup module NAME under DIRECTORIES, and return its absolute file name.
 NAME can be a file name with or without '.ko', or it can be a module name.
 Raise an error if it could not be found.
=20
@@ -247,16 +247,19 @@ (define names
                            (else chr)))
                        module))))
=20
-  (match (find-files directory
-                     (lambda (file stat)
-                       (member (strip-extension
-                                (basename file)) names)))
+  (match (append-map (lambda (directory)
+                       (find-files directory
+                                   (lambda (file _stat)
+                                     (member (strip-extension
+                                              (basename file))
+                                             names))))
+                       directories)
     ((file)
      file)
     (()
-     (error "kernel module not found" module directory))
+     (error "kernel module not found" module directories))
     ((_ ...)
-     (error "several modules by that name" module directory))))
+     (error "several modules by that name" module directories))))
=20
 (define* (recursive-module-dependencies files
                                         #:key (lookup-module dot-ko))
diff --git a/gnu/system.scm b/gnu/system.scm
index c3810cbeeb..15ac30c933 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -103,6 +103,7 @@ (define-module (gnu system)
             operating-system-label
             operating-system-default-label
             operating-system-initrd-modules
+            operating-system-initrd-extra-module-paths
             operating-system-initrd
             operating-system-users
             operating-system-groups
@@ -232,6 +233,8 @@ (define-record-type* <operating-system> operating-system
   (initrd-modules operating-system-initrd-modules ; list of strings
                   (thunked)                       ; it's system-dependent
                   (default %base-initrd-modules))
+  (initrd-extra-module-paths operating-system-initrd-extra-module-paths ; =
list of file-likes
+                             (default '()))
=20
   (firmware operating-system-firmware             ; list of packages
             (default %base-firmware))
@@ -1307,6 +1310,8 @@ (define make-initrd
                #:linux (operating-system-kernel os)
                #:linux-modules
                (operating-system-initrd-modules os)
+               #:linux-extra-module-paths
+               (operating-system-initrd-extra-module-paths os)
                #:mapped-devices mapped-devices
                #:keyboard-layout (operating-system-keyboard-layout os)))
=20
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 4c4c78e444..50a182d7d5 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -119,13 +119,23 @@ (define builder
                               `(#:references-graphs (("closure" ,init))))
                "/initrd.cpio.gz"))
=20
-(define (flat-linux-module-directory linux modules)
+(define (flat-linux-module-directory packages modules)
   "Return a flat directory containing the Linux kernel modules listed in
-MODULES and taken from LINUX."
+MODULES and taken from PACKAGES."
   (define imported-modules
     (source-module-closure '((gnu build linux-modules)
                              (guix build utils))))
=20
+  (define (package+out->input package out)
+    (gexp-input package out))
+
+  (define package-inputs
+    (map (lambda (p)
+           (match p
+             ((p o) (package+out->input p o))
+             (p     (package+out->input p "out"))))
+         packages))
+
   (define build-exp
     (with-imported-modules imported-modules
       (with-extensions (list guile-zlib)
@@ -135,11 +145,12 @@ (define build-exp
                          (srfi srfi-1)
                          (srfi srfi-26))
=20
-            (define module-dir
-              (string-append #$linux "/lib/modules"))
+            (define module-dirs
+              (map (cut string-append <> "/lib/modules")
+                   '#$package-inputs))
=20
             (define modules
-              (let* ((lookup  (cut find-module-file module-dir <>))
+              (let* ((lookup  (cut find-module-file module-dirs <>))
                      (modules (map lookup '#$modules)))
                 (append modules
                         (recursive-module-dependencies
@@ -172,20 +183,23 @@ (define* (raw-initrd file-systems
                       #:key
                       (linux linux-libre)
                       (linux-modules '())
+                      (linux-extra-module-paths '())
                       (mapped-devices '())
                       (keyboard-layout #f)
                       (helper-packages '())
                       qemu-networking?
                       volatile-root?
                       (on-error 'debug))
-  "Return as a file-like object a raw initrd, with kernel
-modules taken from LINUX.  FILE-SYSTEMS is a list of file-systems to be
-mounted by the initrd, possibly in addition to the root file system specif=
ied
-on the kernel command line via 'root'.  LINUX-MODULES is a list of kernel
-modules to be loaded at boot time. MAPPED-DEVICES is a list of device
-mappings to realize before FILE-SYSTEMS are mounted.
-HELPER-PACKAGES is a list of packages to be copied in the initrd. It may i=
nclude
-e2fsck/static or other packages needed by the initrd to check root partiti=
on.
+  "Return as a file-like object a raw initrd, with kernel modules taken fr=
om
+LINUX.  FILE-SYSTEMS is a list of file-systems to be mounted by the initrd,
+possibly in addition to the root file system specified on the kernel comma=
nd
+line via 'root'.  LINUX-MODULES is a list of kernel modules to be loaded at
+boot time. LINUX-EXTRA-MODULE-PATHS is a list of file-like objects which w=
ill
+be searched for modules in addition to the linux kernel. MAPPED-DEVICES is=
 a
+list of device mappings to realize before FILE-SYSTEMS are mounted.
+HELPER-PACKAGES is a list of packages to be copied in the initrd. It may
+include e2fsck/static or other packages needed by the initrd to check root
+partition.
=20
 When true, KEYBOARD-LAYOUT is a <keyboard-layout> record denoting the desi=
red
 console keyboard layout.  This is done before MAPPED-DEVICES are set up and
@@ -221,7 +235,8 @@ (define file-system-scan-commands
           #~())))
=20
   (define kodir
-    (flat-linux-module-directory linux linux-modules))
+    (flat-linux-module-directory (cons linux linux-extra-module-paths)
+                                 linux-modules))
=20
   (expression->initrd
    (with-imported-modules (source-module-closure
@@ -366,6 +381,7 @@ (define* (base-initrd file-systems
                       #:key
                       (linux linux-libre)
                       (linux-modules '())
+                      (linux-extra-module-paths '())
                       (mapped-devices '())
                       (keyboard-layout #f)
                       qemu-networking?
@@ -386,9 +402,10 @@ (define* (base-initrd file-systems
 QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd.
=20
 The initrd is automatically populated with all the kernel modules necessary
-for FILE-SYSTEMS and for the given options.  Additional kernel
-modules can be listed in LINUX-MODULES.  They will be added to the initrd,=
 and
-loaded at boot time in the order in which they appear."
+for FILE-SYSTEMS and for the given options.  Additional kernel modules can=
 be
+listed in LINUX-MODULES.  Additional search paths for modules can be liste=
d in
+LINUX-EXTRA-MODULE-PATHS.  They will be added to the initrd, and loaded at
+boot time in the order in which they appear."
   (define linux-modules*
     ;; Modules added to the initrd and loaded from the initrd.
     `(,@linux-modules
@@ -408,6 +425,7 @@ (define helper-packages
   (raw-initrd file-systems
               #:linux linux
               #:linux-modules linux-modules*
+              #:linux-extra-module-paths linux-extra-module-paths
               #:mapped-devices mapped-devices
               #:helper-packages helper-packages
               #:keyboard-layout keyboard-layout

base-commit: 0a64b629ae8512790d532158a72a4a25698e8157
prerequisite-patch-id: 213ce2b9743f11d45836fe0794f117f3bb84063d
--=20
2.35.1




Acknowledgement sent to Brian Cully <bjc@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#55231; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 13 May 2022 20:00:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.