all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Type of 'os' in gnu/system.scm
@ 2023-12-12  0:19 Felix Lechner via Development of GNU Guix and the GNU System distribution.
  2023-12-12  7:44 ` Saku Laesvuori
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Lechner via Development of GNU Guix and the GNU System distribution. @ 2023-12-12  0:19 UTC (permalink / raw)
  To: guix-devel

Hi,

Looking at this definition in gnu/system.scm [1] I am trying to figure
out what 'os' is:

  (define* (operating-system-kernel-arguments
            os root-device #:key (version %boot-parameters-version))
    "Return all the kernel arguments, including the ones not specified directly
  by the user.  VERSION should match that of the target <boot-parameters> record
  object that will contain the kernel parameters."
    (append (bootable-kernel-arguments os root-device version)
            (operating-system-user-kernel-arguments os)))

The same file also contains a record definition for <operating-system>
so it seemed reasonable to assume that 'os' referred to such a
record. In fact, the second procedure inside the 'append' above,
operating-system-user-kernel-arguments, is one of the accessors [2]
(even though the name does not match the field).

In the first procedure bootable-kernel-arguments [3] however, 'os'
(which is called 'system' there) is used like a string, although inside
a gexp:

  (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'
                         ;; kernel command-line option.
                         (file-system-device->string root-device
                                                     #:uuid-type 'dce))
          #~(string-append (if #$version>0? "gnu.system=" "--system=") #$system)
          #~(string-append (if #$version>0? "gnu.load=" "--load=")
                           #$system "/boot")))

I know objects in the store become paths when unquoted via '#$'. Does
that also work for Guix records declared via define-record-type* [4]
(please note the asterisk)? Thanks!

Kind regards
Felix

[1] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system.scm#n319
[2] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system.scm#n231
[3] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system.scm#n207
[4] https://git.savannah.gnu.org/cgit/guix.git/tree/guix/records.scm#n282


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

end of thread, other threads:[~2023-12-12  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-12  0:19 Type of 'os' in gnu/system.scm Felix Lechner via Development of GNU Guix and the GNU System distribution.
2023-12-12  7:44 ` Saku Laesvuori

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.