Subject: bug#26339: bootloader and kernel arguments "--root", "--system", "--load"

From: Danny Milosavljevic <[email-masked]>
Date: Sat, 15 Apr 2017 21:50:38 +0200

Ok, I'm in the process of reverting the patches to grub.

------

Problem analysis:

- (profile-boot-parameters ...) doesn't pick up the correct kernel-arguments.  It's reading them from a parameters file for the system generation back then, for example from /gnu/store/x8ymiksnhfyvjdi8ms38ysc4yr92lyk9-system/parameters, which contains:

(boot-parameters
  (version 0)
  (label "GNU with Linux-Libre 4.5.1 (beta)")
  (root-device "/dev/sda1")
  (kernel "/gnu/store/h977riqrp7c3w2v0mcpp48ldcapy09gx-linux-libre-4.5.1")
  (kernel-arguments ("crashkernel=256M" "modprobe.blacklist=pcspkr,snd_pcsp" "quiet" "acpi_osi=Linux" "clocksource=acpi_pm"))
  (initrd (string-append "/gnu/store/8w1abpwlhnilibiamcp6j01rhjh9k5ix-base-initrd" "/initrd")))

, which indeed doesn't contain the correct kernel arguments for it to boot.

Why not?  Shouldn't we just store the correct arguments in there eventually?

Those kernel arguments should include (in the front):

linux-arguments
        let root = (boot-parameters-root-device params) or #f
        let root-device = (if (bytevector? root) (uuid->string root) root)
        let system = "/gnu/store/x8ymiksnhfyvjdi8ms38ysc4yr92lyk9-system" in
        "--root=<root-device>"
        "--system=<system>"
        "--load=<system>/boot"
.

Or is it something grub-specific?

Or is it because we don't know system's own hash value in order to be able to write it there?

Would it be good to (later) replace the kernel-arguments accessor by a procedure that also takes system and root and prepends them on-the-fly?

i.e.

(define (boot-parameters-all-kernel-arguments params system root)
  (cons
    (string-append "--root=" root)
    (cons
      (string-append "--system=" system)
      ... load etc
      (boot-parameters-kernel-arguments params))))

... and only use this one, never boot-parameters-kernel-arguments anywhere else?