unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [WIP PATCH] linux-initrd: Allow own set of kernel modules.
@ 2016-07-28 10:42 Tomáš Čech
  2016-07-28 13:05 ` Ludovic Courtès
  2016-07-30 15:38 ` Alex Kost
  0 siblings, 2 replies; 6+ messages in thread
From: Tomáš Čech @ 2016-07-28 10:42 UTC (permalink / raw)
  To: guix-devel

* gnu/system/linux-initrd.scm(base-initrd): Add `linux-modules'
  parameter. Rename former `linux-modules' to
  `default-linux-modules'. Introduce used-linux-modules to make the code
  more readable.
---
 gnu/system/linux-initrd.scm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index bbaa5c0..4934c92 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -138,6 +138,7 @@ MODULES and taken from LINUX."
                       qemu-networking?
                       (virtio? #t)
                       volatile-root?
+                      (linux-modules #f)
                       (extra-modules '()))
   "Return a monadic derivation that builds a generic initrd, with kernel
 modules taken from LINUX.  FILE-SYSTEMS is a list of file-systems to be
@@ -174,7 +175,7 @@ loaded at boot time in the order in which they appear."
     (lambda (fs)
       (string=? (file-system-type fs) type)))
 
-  (define linux-modules
+  (define default-linux-modules
     ;; Modules added to the initrd and loaded from the initrd.
     `("ahci"                                  ;for SATA controllers
       "usb-storage" "uas"                     ;for the installation image etc.
@@ -220,8 +221,13 @@ loaded at boot time in the order in which they appear."
              (open source target)))
          mapped-devices))
 
+  (define used-linux-modules
+    (if (equal? linux-modules #f)
+        default-linux-modules
+        linux-modules))
+
   (mlet %store-monad ((kodir (flat-linux-module-directory linux
-                                                          linux-modules)))
+                                                          used-linux-modules)))
     (expression->initrd
      (with-imported-modules '((guix build bournish)
                               (guix build utils)
@@ -251,7 +257,7 @@ loaded at boot time in the order in which they appear."
            (boot-system #:mounts '#$(map file-system->spec file-systems)
                         #:pre-mount (lambda ()
                                       (and #$@device-mapping-commands))
-                        #:linux-modules '#$linux-modules
+                        #:linux-modules '#$used-linux-modules
                         #:linux-module-directory '#$kodir
                         #:qemu-guest-networking? #$qemu-networking?
                         #:volatile-root? '#$volatile-root?)))
-- 
2.9.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [WIP PATCH] linux-initrd: Allow own set of kernel modules.
  2016-07-28 10:42 [WIP PATCH] linux-initrd: Allow own set of kernel modules Tomáš Čech
@ 2016-07-28 13:05 ` Ludovic Courtès
  2016-07-28 13:35   ` Tomáš Čech
  2016-07-30 15:38 ` Alex Kost
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2016-07-28 13:05 UTC (permalink / raw)
  To: Tomáš Čech; +Cc: guix-devel

Tomáš Čech <sleep_walker@gnu.org> skribis:

> * gnu/system/linux-initrd.scm(base-initrd): Add `linux-modules'
>   parameter. Rename former `linux-modules' to
>   `default-linux-modules'. Introduce used-linux-modules to make the code
>   more readable.
> ---
>  gnu/system/linux-initrd.scm | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
> index bbaa5c0..4934c92 100644
> --- a/gnu/system/linux-initrd.scm
> +++ b/gnu/system/linux-initrd.scm
> @@ -138,6 +138,7 @@ MODULES and taken from LINUX."
>                        qemu-networking?
>                        (virtio? #t)
>                        volatile-root?
> +                      (linux-modules #f)
>                        (extra-modules '()))
>    "Return a monadic derivation that builds a generic initrd, with kernel
>  modules taken from LINUX.  FILE-SYSTEMS is a list of file-systems to be

It seems to serve the same purpose as #:extra-modules, no?

  https://www.gnu.org/software/guix/manual/html_node/Initial-RAM-Disk.html

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [WIP PATCH] linux-initrd: Allow own set of kernel modules.
  2016-07-28 13:05 ` Ludovic Courtès
@ 2016-07-28 13:35   ` Tomáš Čech
  2016-07-28 15:32     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Tomáš Čech @ 2016-07-28 13:35 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]

On Thu, Jul 28, 2016 at 03:05:34PM +0200, Ludovic Courtès wrote:
>Tomáš Čech <sleep_walker@gnu.org> skribis:
>
>> * gnu/system/linux-initrd.scm(base-initrd): Add `linux-modules'
>>   parameter. Rename former `linux-modules' to
>>   `default-linux-modules'. Introduce used-linux-modules to make the code
>>   more readable.
>> ---
>>  gnu/system/linux-initrd.scm | 12 +++++++++---
>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
>> index bbaa5c0..4934c92 100644
>> --- a/gnu/system/linux-initrd.scm
>> +++ b/gnu/system/linux-initrd.scm
>> @@ -138,6 +138,7 @@ MODULES and taken from LINUX."
>>                        qemu-networking?
>>                        (virtio? #t)
>>                        volatile-root?
>> +                      (linux-modules #f)
>>                        (extra-modules '()))
>>    "Return a monadic derivation that builds a generic initrd, with kernel
>>  modules taken from LINUX.  FILE-SYSTEMS is a list of file-systems to be
>
>It seems to serve the same purpose as #:extra-modules, no?
>
>  https://www.gnu.org/software/guix/manual/html_node/Initial-RAM-Disk.html

It gives me full control over the modules and not just appending to default set.

  #f --> default-kernel-modules (as it is now)
  '(some extraordinary special modules for other purpose) --> it will use this set
  '() --> it will use no module at all (my typical usecase)


But yes, it makes `extra-modules' useless.

I'd like to find a way, how to make default-kernel-modules available
as some lazy evaluated list (because what will go there is decided
when base-initrd is evaluated).

This is one of the steps for user defined kernel (besides specifying
kernel configuration) and I'm using it already.

If you're not against such change, it also would need to adjust
documentation (will do in next round).


S_W

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [WIP PATCH] linux-initrd: Allow own set of kernel modules.
  2016-07-28 13:35   ` Tomáš Čech
@ 2016-07-28 15:32     ` Ludovic Courtès
  2016-07-28 16:53       ` Tobias Geerinckx-Rice
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2016-07-28 15:32 UTC (permalink / raw)
  To: guix-devel

Tomáš Čech <sleep_walker@gnu.org> skribis:

> On Thu, Jul 28, 2016 at 03:05:34PM +0200, Ludovic Courtès wrote:
>>Tomáš Čech <sleep_walker@gnu.org> skribis:
>>
>>> * gnu/system/linux-initrd.scm(base-initrd): Add `linux-modules'
>>>   parameter. Rename former `linux-modules' to
>>>   `default-linux-modules'. Introduce used-linux-modules to make the code
>>>   more readable.
>>> ---
>>>  gnu/system/linux-initrd.scm | 12 +++++++++---
>>>  1 file changed, 9 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
>>> index bbaa5c0..4934c92 100644
>>> --- a/gnu/system/linux-initrd.scm
>>> +++ b/gnu/system/linux-initrd.scm
>>> @@ -138,6 +138,7 @@ MODULES and taken from LINUX."
>>>                        qemu-networking?
>>>                        (virtio? #t)
>>>                        volatile-root?
>>> +                      (linux-modules #f)
>>>                        (extra-modules '()))
>>>    "Return a monadic derivation that builds a generic initrd, with kernel
>>>  modules taken from LINUX.  FILE-SYSTEMS is a list of file-systems to be
>>
>>It seems to serve the same purpose as #:extra-modules, no?
>>
>>  https://www.gnu.org/software/guix/manual/html_node/Initial-RAM-Disk.html
>
> It gives me full control over the modules and not just appending to default set.
>
>  #f --> default-kernel-modules (as it is now)
>  '(some extraordinary special modules for other purpose) --> it will use this set
>  '() --> it will use no module at all (my typical usecase)

Oh, OK.  I had assumed that the last use case didn’t exist ;-), which is
why we have #:extra-modules instead of just #:modules.

> But yes, it makes `extra-modules' useless.
>
> I'd like to find a way, how to make default-kernel-modules available
> as some lazy evaluated list (because what will go there is decided
> when base-initrd is evaluated).

What about this: instead of adding #:linux-modules to ‘base-initrd’,
let’s split ‘base-initrd’ into two procedures:

  1. ‘raw-initrd’ wouldn’t do anything high-level and wouldn’t try to
     guess what modules are needed;

  2. ‘base-initrd’ would keep the interface it currently has, but would
     be rewritten in terms of ‘raw-initrd’:

       (define (base-initrd …)
         ;; …
         (raw-initrd file-system
                     #:linux-modules the-full-list-of-modules))

How does that sound?

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [WIP PATCH] linux-initrd: Allow own set of kernel modules.
  2016-07-28 15:32     ` Ludovic Courtès
@ 2016-07-28 16:53       ` Tobias Geerinckx-Rice
  0 siblings, 0 replies; 6+ messages in thread
From: Tobias Geerinckx-Rice @ 2016-07-28 16:53 UTC (permalink / raw)
  To: Ludovic Courtès, sleep_walker; +Cc: guix-devel

Hullo,

On 28/07/2016 17:32, Ludovic Courtès wrote:
> Tomáš Čech <sleep_walker@gnu.org> skribis:
>>  #f --> default-kernel-modules (as it is now)
>>  '(some extraordinary special modules for other purpose) --> it will use this set
>>  '() --> it will use no module at all (my typical usecase)
> 
> Oh, OK.  I had assumed that the last use case didn’t exist ;-), which is
> why we have #:extra-modules instead of just #:modules.

How could anyone not want PATA support in their kernel? ;-)

Thanks, Tomáš! I had a similar patch ready, but it still tiptoed about
to keep #:extra-modules around. This is much nicer.

Kind regards,

T G-R

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [WIP PATCH] linux-initrd: Allow own set of kernel modules.
  2016-07-28 10:42 [WIP PATCH] linux-initrd: Allow own set of kernel modules Tomáš Čech
  2016-07-28 13:05 ` Ludovic Courtès
@ 2016-07-30 15:38 ` Alex Kost
  1 sibling, 0 replies; 6+ messages in thread
From: Alex Kost @ 2016-07-30 15:38 UTC (permalink / raw)
  To: Tomáš Čech; +Cc: guix-devel

Tomáš Čech (2016-07-28 13:42 +0300) wrote:

> +  (define used-linux-modules
> +    (if (equal? linux-modules #f)
> +        default-linux-modules
> +        linux-modules))

Just a general note about the code.  This can simply be:

  (define used-linux-modules (or linux-modules default-linux-modules))

-- 
Alex

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-30 15:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-28 10:42 [WIP PATCH] linux-initrd: Allow own set of kernel modules Tomáš Čech
2016-07-28 13:05 ` Ludovic Courtès
2016-07-28 13:35   ` Tomáš Čech
2016-07-28 15:32     ` Ludovic Courtès
2016-07-28 16:53       ` Tobias Geerinckx-Rice
2016-07-30 15:38 ` Alex Kost

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).