Subject: Re: bug#40998: Guix System's initrd doesn't honor rootflags

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 28 Feb 2022 15:31:55 -0500

Hi Ludovic,

Ludovic Courtès <[email-masked]> writes:

> Hi,
>
> Maxim Cournoyer <[email-masked]> skribis:
>
>> -(define (bootable-kernel-arguments system root-device)
>> -  "Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE."
>> -  (list (string-append "--root="
>> +(define* (bootable-kernel-arguments system root-device version)
>> +  "Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE.
>> +VERSION is the target version of the boot-parameters record."
>> +  ;; If the version is newer than 0, we use the new style initrd parameter
>> +  ;; names, otherwise we use the legacy ones.  This is to maintain backward
>> +  ;; compatibility when producing bootloader configurations for older
>> +  ;; generations.
>> +  (define version>0? (> version 0))
>> +  (list (string-append (if version>0? "root=" "--root=")
>>                         ;; Note: Always use the DCE format because that's what
>> -                       ;; (gnu build linux-boot) expects for the '--root'
>> +                       ;; (gnu build linux-boot) expects for the 'root'
>>                         ;; kernel command-line option.
>>                         (file-system-device->string root-device
>>                                                     #:uuid-type 'dce))
>> -        #~(string-append "--system=" #$system)
>> -        #~(string-append "--load=" #$system "/boot")))
>> +        #~(string-append (if #$version>0? "gnu.system=" "--system=") #$system)
>> +        #~(string-append (if #$version>0? "gnu.load=" "--load=")
>> +                         #$system "/boot")))
>
> This is the logic I was suggesting to move to ‘read-boot-parameters’.
>
> To do that, ‘read-boot-parameters’ would have to fill the
> ‘kernel-arguments’ field of <boot-parameters> such that it already
> contains --system/gnu.system and --load/gnu.load.

As mentioned in my previous reply, that'd only be possible if we no
longer cared about having the produced system directory
content-addressable, if I understood that comment in the docstring
referred earlier correctly.

Thanks,

Maxim