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

From: Ludovic Courtès <[email-masked]>
Date: Sun, 27 Feb 2022 22:03:47 +0100

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.

And then ‘read-boot-parameters-file’ would become:

  (call-with-input-file (string-append system "/parameters")
    read-boot-parameters)

without the post-processing step it’s currently doing.

(And the version number doesn’t need to flow beyond
‘read-boot-parameters’.)

WDYT?

Ludo’.