From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id COSHHdGZEGI1jAAAgWs5BA (envelope-from ) for ; Sat, 19 Feb 2022 08:18:41 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id SMZTFtGZEGK6fgAAG6o9tA (envelope-from ) for ; Sat, 19 Feb 2022 08:18:41 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B797AF760 for ; Sat, 19 Feb 2022 08:18:40 +0100 (CET) Received: from localhost ([::1]:57588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nLK0t-0004Fn-II for larch@yhetil.org; Sat, 19 Feb 2022 02:18:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nLJlo-00077z-EK for bug-guix@gnu.org; Sat, 19 Feb 2022 02:03:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:34665) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nLJlm-0007TO-RY for bug-guix@gnu.org; Sat, 19 Feb 2022 02:03:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nLJlm-0005SX-M0 for bug-guix@gnu.org; Sat, 19 Feb 2022 02:03:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#40998: [PATCH v2 2/4] initrd: Use non-hyphenated kernel command-line parameter names. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 19 Feb 2022 07:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40998 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: 40998@debbugs.gnu.org Received: via spool by 40998-submit@debbugs.gnu.org id=B40998.164525413920901 (code B ref 40998); Sat, 19 Feb 2022 07:03:02 +0000 Received: (at 40998) by debbugs.gnu.org; 19 Feb 2022 07:02:19 +0000 Received: from localhost ([127.0.0.1]:56788 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLJl3-0005Qh-Dw for submit@debbugs.gnu.org; Sat, 19 Feb 2022 02:02:19 -0500 Received: from mail-qk1-f179.google.com ([209.85.222.179]:33504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLJl1-0005QD-Jc for 40998@debbugs.gnu.org; Sat, 19 Feb 2022 02:02:16 -0500 Received: by mail-qk1-f179.google.com with SMTP id o10so10290645qkg.0 for <40998@debbugs.gnu.org>; Fri, 18 Feb 2022 23:02:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hSUaQYq8oMWzdOs6PPW+/p28+ne7KflWY2wuaOrTw+A=; b=c/lvJHwL5KzNe1Liny6YiVFRrFaBrWX3gkU8N5Dj7beOwlu3vptiDqGrRv2F1gthAc 3FjbixqN/d7HQGqa+TW8xVATxsm18w6CcgNXUaigw7bg56NaezdH3GFzX4GJwBopPJdt Ad7Usz2q+EuNcastKy0ETZG+3JGu1SOObTK21nbn7Z89oSNLJy772LnSWTJcey/Zbe51 Jhn61L+v/NmIzyMQI1G/gk5sdIJ9mz13ZRl93OixtyLda6PuysQMY5ZCnNtFUQmhah9U 149jMsJhtHLeKTU7xbR3UmFUmfi7PMVYlNVvNAPGjXY8P1jXtrVHExCVp/VUFr6r3i3E KpUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hSUaQYq8oMWzdOs6PPW+/p28+ne7KflWY2wuaOrTw+A=; b=RBYbQDERuUDnAaUJAj4BlH/pHYJf0sTUHdW2CNtNLLiGjHiUp4/Hxif3BVE57cmDQO Rdw3APLI3NmQegWUPNFx4QEDv69S28c64PGogNjjqorTQ7W1jZEo/oEdFk69G6cra1w0 iAfl//69qahTAZ+pWXTkIdFvHOZxhFwuVfqExgkdpYHfvXofPS234E/6m8so87W0PHiC tAivdPaTovzobINPKQ2v36X/cw6B8J+zk21zne0kMyJW1qI9wRWi5dk3LN51wUphW1r9 Vk8OoXG1nBLZpiKvLrOYy1jf4iAIe0Hj0n+eKGj1VM87yQ3sw+VPaLBFGyu0SUsK50e2 vFWQ== X-Gm-Message-State: AOAM533uEi31fVXVu+DQmwHVxkMXLl0JtJ8JaA4k3Ao8LSZ/at6VOMgo yT/pKRl0/t9jA8nCdVpB0i+XhKjqD2Y= X-Google-Smtp-Source: ABdhPJyWglsc6KFQ5AMlePXZ6Udmity56Fctt7MT1MtTVX6duCnsgSND+yPb9dKi3lVIlKaT1ERvVQ== X-Received: by 2002:a37:b905:0:b0:4f5:4d72:e517 with SMTP id j5-20020a37b905000000b004f54d72e517mr6905076qkf.534.1645254129485; Fri, 18 Feb 2022 23:02:09 -0800 (PST) Received: from localhost.localdomain (dsl-149-79.b2b2c.ca. [66.158.149.79]) by smtp.gmail.com with ESMTPSA id g16sm4121024qka.11.2022.02.18.23.02.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 23:02:09 -0800 (PST) From: Maxim Cournoyer Date: Sat, 19 Feb 2022 02:01:53 -0500 Message-Id: <20220219070155.1924-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220219070155.1924-1-maxim.cournoyer@gmail.com> References: <20220219070155.1924-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxim Cournoyer Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1645255120; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vJQ0Siior+M8OqsIggb4Hc0gTP+gjrIsJdW5Lg+A8iY=; b=shiKktC7K1Mhy8U+qtE5FPwpTYWpgCzXonW55Z50klCnLZUtSIFXwPGBFIJa6t0QVcQ2Z8 zt4+S24wV0+PTQ2842+VfXP9OlSvPPwf706jyFLiYDoE7HLxp2aC7DSccyiVw5Igv8ro5x Cp1YGXb8wAJnIgneBDhXDNDpCTGnle5mwP0qwFuo6ujbSAVpbMvUzMxh/y4dnCTpRnOruN ZkJfc4tfLAhag0OYESa3fPL8g91HNyp9iij788H89qexoMax5AcmO9RdaSrZIUq9wo/jwT vwbNvBdVD52YhNJ2K6cAkFNwF0rBmBWEfXfuTP3bojZmmHwXgJYTArSZq9Ff1g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645255120; a=rsa-sha256; cv=none; b=ZpnEfSZA5CZdgcAw/LIkor4Ohr1CBCyqIIt+tBiN9bvGYEnlL+To3j8IJ1L02Lae9XID/e ZZI6M+c0om16ZcL0BlhiUhPa4BTMlpsCQbpuA2r88aaXMRZbpzUrJh/tM3Vd6qJYkrIcEZ 7KKh/nARvyMTB+pleXM3wDn8jrKrEfjRXYhjf0N+mMumf58QoP3qHsiR/7TKXu6YH4yzbU LeC2e174FZtfcUFCxxo7Dqmh8MV3bH5WPOJKK7tRQayiaTrS8z97hk516Pg0NdUoZDgwQ3 ykCgntYCyQ0+Skfw/Su8WtJtgj/6J9BDyVDgmtq+f9gO62BWbNDRKfOItvZYxw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b="c/lvJHwL"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20210112 header.b="c/lvJHwL"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B797AF760 X-Spam-Score: -2.03 X-Migadu-Scanner: scn1.migadu.com X-TUID: yskZ/YHMrq7b This is to make it less surprising, given the common convention sets forth by the kernel Linux command-line parameters. * gnu/build/linux-boot.scm (boot-system): Rename '--load', '--repl', '--root' and '--system' to 'gnu.load', 'gnu.repl', 'root' and 'gnu.system', respectively. Adjust doc. (find-long-option): Adjust doc. * gnu/installer/parted.scm (installer-root-partition-path): Adjust accordingly. * gnu/system.scm (bootable-kernel-arguments): Add a VERSION argument and update doc. Use VERSION to conditionally return old style vs new style initrd arguments. (%boot-parameters-version): Increment to 1. (operating-system-boot-parameters): Adjust doc. (operating-system-boot-parameters-file): Likewise. * gnu/system/linux-initrd.scm (raw-initrd, base-initrd): Likewise. * doc/guix.texi: Adjust doc. * gnu/build/activation.scm (boot-time-system): Adjust accordingly. * gnu/build/hurd-boot.scm (boot-hurd-system): Likewise. * gnu/packages/commencement.scm (%final-inputs-riscv64): Adjust comment. --- doc/guix.texi | 12 +++++----- gnu/build/activation.scm | 4 ++-- gnu/build/hurd-boot.scm | 12 +++++----- gnu/build/linux-boot.scm | 30 +++++++++++------------ gnu/installer/parted.scm | 2 +- gnu/machine/ssh.scm | 5 ++-- gnu/packages/commencement.scm | 4 ++-- gnu/system.scm | 45 ++++++++++++++++++++++------------- gnu/system/linux-initrd.scm | 4 ++-- 9 files changed, 66 insertions(+), 52 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index a4145af7fd..d3f9216563 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -34901,7 +34901,7 @@ honors several options passed on the Linux kernel command line @code{-append} option of QEMU), notably: @table @code -@item --load=@var{boot} +@item gnu.load=@var{boot} Tell the initial RAM disk to load @var{boot}, a file containing a Scheme program, once it has mounted the root file system. @@ -34909,7 +34909,7 @@ Guix uses this option to yield control to a boot program that runs the service activation programs and then spawns the GNU@tie{}Shepherd, the initialization system. -@item --root=@var{root} +@item root=@var{root} Mount @var{root} as the root file system. @var{root} can be a device name like @code{/dev/sda1}, a file system label, or a file system UUID. When unspecified, the device name from the root file system of the @@ -34934,7 +34934,7 @@ or @code{preen} to repair problems considered safe to repair automatically. @code{preen} is the default if this option is not present or if @var{level} is not one of the above. -@item --system=@var{system} +@item gnu.system=@var{system} Have @file{/run/booted-system} and @file{/run/current-system} point to @var{system}. @@ -34946,7 +34946,7 @@ Instruct the initial RAM disk as well as the @command{modprobe} command must be a comma-separated list of module names---e.g., @code{usbkbd,9pnet}. -@item --repl +@item gnu.repl Start a read-eval-print loop (REPL) from the initial RAM disk before it tries to load kernel modules and to mount the root file system. Our marketing team calls it @dfn{boot-to-Guile}. The Schemer in you will @@ -34967,7 +34967,7 @@ here is how to use it and customize it further. [#:helper-packages '()] [#:qemu-networking? #f] [#:volatile-root? #f] Return a derivation that builds a raw initrd. @var{file-systems} is a list of file systems to be mounted by the initrd, possibly in addition to -the root file system specified on the kernel command line via @option{--root}. +the root file system specified on the kernel command line via @option{root}. @var{linux-modules} is a list of kernel modules to be loaded at boot time. @var{mapped-devices} is a list of device mappings to realize before @var{file-systems} are mounted (@pxref{Mapped Devices}). @@ -34997,7 +34997,7 @@ to it are lost. Return as a file-like object a generic initrd, with kernel modules taken from @var{linux}. @var{file-systems} is a list of file-systems to be mounted by the initrd, possibly in addition to the root file system specified -on the kernel command line via @option{--root}. @var{mapped-devices} is a list of device +on the kernel command line via @option{root}. @var{mapped-devices} is a list of device mappings to realize before @var{file-systems} are mounted. When true, @var{keyboard-layout} is a @code{} record denoting diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm index 9f6126023c..10c9045740 100644 --- a/gnu/build/activation.scm +++ b/gnu/build/activation.scm @@ -389,8 +389,8 @@ (define %current-system "/run/current-system") (define (boot-time-system) - "Return the '--system' argument passed on the kernel command line." - (find-long-option "--system" (if (string-contains %host-type "linux-gnu") + "Return the 'gnu.system' argument passed on the kernel command line." + (find-long-option "gnu.system" (if (string-contains %host-type "linux-gnu") (linux-command-line) (command-line)))) diff --git a/gnu/build/hurd-boot.scm b/gnu/build/hurd-boot.scm index ac36bd17d4..ad3c50d61e 100644 --- a/gnu/build/hurd-boot.scm +++ b/gnu/build/hurd-boot.scm @@ -254,7 +254,7 @@ (define* (boot-hurd-system #:key (on-error 'debug)) "This procedure is meant to be called from an early RC script. Install the relevant passive translators on the first boot. Then, run system -activation by using the kernel command-line options '--system' and '--load'; +activation by using the kernel command-line options 'gnu.system' and 'gnu.load'; starting the Shepherd. XXX TODO: see linux-boot.scm:boot-system. @@ -265,14 +265,14 @@ (define* (boot-hurd-system #:key (on-error 'debug)) " (display "Welcome, this is GNU's early boot Guile.\n") - (display "Use '--repl' for an initrd REPL.\n\n") + (display "Use 'gnu.repl' for an initrd REPL.\n\n") (call-with-error-handling (lambda () (let* ((args (command-line)) - (system (find-long-option "--system" args)) - (to-load (find-long-option "--load" args))) + (system (find-long-option "gnu.system" args)) + (to-load (find-long-option "gnu.load" args))) (format #t "Setting-up essential translators...\n") (setenv "PATH" (string-append system "/profile/bin")) @@ -286,7 +286,7 @@ (define* (boot-hurd-system #:key (on-error 'debug)) (unless (zero? (system* "/hurd/mach-defpager")) (format #t "FAILED...Good luck!\n")) - (cond ((member "--repl" args) + (cond ((member "gnu.repl" args) (format #t "Starting repl...\n") (start-repl)) (to-load @@ -298,7 +298,7 @@ (define* (boot-hurd-system #:key (on-error 'debug)) (sleep 2) (reboot)) (else - (display "no boot file passed via '--load'\n") + (display "no boot file passed via 'gnu.load'\n") (display "entering a warm and cozy REPL\n") (start-repl))))) #:on-error on-error)) diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm index 0ae316849e..179fb12a2b 100644 --- a/gnu/build/linux-boot.scm +++ b/gnu/build/linux-boot.scm @@ -93,7 +93,7 @@ (define (linux-command-line) get-string-all))) (define (find-long-option option arguments) - "Find OPTION among ARGUMENTS, where OPTION is something like \"--load\". + "Find OPTION among ARGUMENTS, where OPTION is something like \"gnu.load\". Return the value associated with OPTION, or #f on failure." (let ((opt (string-append option "="))) (and=> (find (cut string-prefix? opt <>) @@ -499,12 +499,12 @@ (define* (boot-system #:key KEYMAP-FILE is true), then setting up QEMU guest networking if QEMU-GUEST-NETWORKING? is true, calling PRE-MOUNT, mounting the file systems specified in MOUNTS, and finally booting into the new root if any. The initrd -supports kernel command-line options '--load', '--root', and '--repl'. It -also honors a subset of the documented Linux kernel command-line parameters -such as 'fsck.mode', 'resume' and 'rootdelay'. +supports kernel command-line parameters 'gnu.load' and 'gnu.repl'. It also +honors a subset of the Linux kernel command-line parameters such as +'fsck.mode', 'resume', 'root' and 'rootdelay'. -Mount the root file system, specified by the '--root' command-line argument, -if any. +Mount the root file system, specified by the 'root' command-line argument, if +any. MOUNTS must be a list of objects. @@ -517,25 +517,25 @@ (define (root-mount-point? fs) (string=? (file-system-mount-point fs) "/")) (define (device-string->file-system-device device-string) - ;; The "--root=SPEC" kernel command-line option always provides a - ;; string, but the string can represent a device, an nfs-root, a UUID, or a - ;; label. So check for all four. + ;; The "root=SPEC" kernel command-line option always provides a string, + ;; but the string can represent a device, an nfs-root, a UUID, or a label. + ;; So check for all four. (cond ((string-prefix? "/" device-string) device-string) ((string-contains device-string ":/") device-string) ; nfs-root ((uuid device-string) => identity) (else (file-system-label device-string)))) (display "Welcome, this is GNU's early boot Guile.\n") - (display "Use '--repl' for an initrd REPL.\n\n") + (display "Use 'gnu.repl' for an initrd REPL.\n\n") (call-with-error-handling (lambda () (mount-essential-file-systems) (let* ((args (linux-command-line)) - (to-load (find-long-option "--load" args)) - ;; If present, ‘--root’ on the kernel command line takes precedence + (to-load (find-long-option "gnu.load" args)) + ;; If present, ‘root’ on the kernel command line takes precedence ;; over the ‘device’ field of the root record. - (root-device (and=> (find-long-option "--root" args) + (root-device (and=> (find-long-option "root" args) device-string->file-system-device)) (root-fs (or (find root-mount-point? mounts) ;; Fall back to fictitious defaults. @@ -564,7 +564,7 @@ (define (repair fs) (_ 'preen)) (file-system-repair fs)))) - (when (member "--repl" args) + (when (member "gnu.repl" args) (start-repl)) (display "loading kernel modules...\n") @@ -652,7 +652,7 @@ (define (repair fs) (sleep 2) (reboot)) (begin - (display "no boot file passed via '--load'\n") + (display "no boot file passed via 'gnu.load'\n") (display "entering a warm and cozy REPL\n") (start-repl))))) #:on-error on-error)) diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm index e33ef5f8fd..94ef9b42bc 100644 --- a/gnu/installer/parted.scm +++ b/gnu/installer/parted.scm @@ -348,7 +348,7 @@ (define (remove-logical-devices) (define (installer-root-partition-path) "Return the root partition path, or #f if it could not be detected." (let* ((cmdline (linux-command-line)) - (root (find-long-option "--root" cmdline))) + (root (find-long-option "root" cmdline))) (and root (or (and (access? root F_OK) root) (find-partition-by-label root) diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm index 0dc8933c82..550c989c34 100644 --- a/gnu/machine/ssh.scm +++ b/gnu/machine/ssh.scm @@ -422,7 +422,8 @@ (define (read-file path) (let* ((params (call-with-input-string serialized-params read-boot-parameters)) (root (boot-parameters-root-device params)) - (label (boot-parameters-label params))) + (label (boot-parameters-label params)) + (version (boot-parameters-version params))) (boot-parameters (inherit params) (label @@ -433,7 +434,7 @@ (define (read-file path) "~Y-~m-~d ~H:~M")) ")")) (kernel-arguments - (append (bootable-kernel-arguments system-path root) + (append (bootable-kernel-arguments system-path root version) (boot-parameters-kernel-arguments params)))))))) generations)))) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index cdc9c1d621..9b495d8d84 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -3740,10 +3740,10 @@ (define-public %final-inputs (define-public %final-inputs-riscv64 ;; This is similar to the added (list gcc "lib") elsewhere in this file, but ;; due to how (%current-system) is re-defined when performing builds with the - ;; '--system' flag, %final-inputs is too early in the evaulation pipeline to + ;; 'gnu.system' flag, %final-inputs is too early in the evaulation pipeline to ;; correctly identify the system for which a derivation will be built. Thus, ;; since (%current-system) is re-determined by (guix build-system gnu) after - ;; loading %final-inputs but before taking into account the '--system' flag, + ;; loading %final-inputs but before taking into account the 'gnu.system' flag, ;; the test for (target-riscv64?) needs to be in (guix build-system gnu), ;; with %final-inputs-riscv64 already available at the same time that ;; %final-inputs is available. diff --git a/gnu/system.scm b/gnu/system.scm index c29a44111b..97669daa1b 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -187,16 +187,23 @@ (define-module (gnu system) ;;; ;;; Code: -(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"))) ;; System-wide configuration. ;; TODO: Add per-field docstrings/stexi. @@ -286,10 +293,12 @@ (define-record-type* operating-system source-properties->location)) (innate))) -(define (operating-system-kernel-arguments os root-device) - "Return all the kernel arguments, including the ones not specified -directly by the user." - (append (bootable-kernel-arguments os root-device) +(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 record +object that will contain the kernel parameters." + (append (bootable-kernel-arguments os root-device version) (operating-system-user-kernel-arguments os))) @@ -297,7 +306,10 @@ (define (operating-system-kernel-arguments os root-device) ;;; Boot parameters ;;; -(define %boot-parameters-version 0) +;;; Version 1 was introduced early 2022 to mark the departure from long option +;;; names such as '--load' to the more conventional initrd option names like +;;; 'gnu.load'. +(define %boot-parameters-version 1) (define-record-type* boot-parameters make-boot-parameters boot-parameters? @@ -476,10 +488,11 @@ (define (read-boot-parameters-file system) The object has its kernel-arguments extended in order to make it bootable." (let* ((file (string-append system "/parameters")) (params (call-with-input-file file read-boot-parameters)) - (root (boot-parameters-root-device params))) + (root (boot-parameters-root-device params)) + (version (boot-parameters-version params))) (boot-parameters (inherit params) - (kernel-arguments (append (bootable-kernel-arguments system root) + (kernel-arguments (append (bootable-kernel-arguments system root version) (boot-parameters-kernel-arguments params)))))) (define (boot-parameters->menu-entry conf) @@ -1451,7 +1464,7 @@ (define* (operating-system-boot-parameters os root-device #:key system-kernel-arguments?) "Return a monadic record that describes the boot parameters of OS. When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments -such as '--root' and '--load' to ." +such as 'root' and 'gnu.load' to ." (let* ((initrd (and (not (operating-system-hurd os)) (operating-system-initrd-file os))) (store (operating-system-store-file-system os)) @@ -1497,8 +1510,8 @@ (define* (operating-system-boot-parameters-file os "Return a file that describes the boot parameters of OS. The primary use of this file is the reconstruction of GRUB menu entries for old configurations. -When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments such as '--root' -and '--load' to the returned file (since the returned file is then usually +When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments such as 'root' +and 'gnu.load' to the returned file (since the returned file is then usually stored into the content-addressed \"system\" directory, it's usually not a good idea to give it because the content hash would change by the content hash being stored into the \"parameters\" file)." diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index 329cd38cd6..4c4c78e444 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -181,7 +181,7 @@ (define* (raw-initrd file-systems "Return as a file-like object a raw initrd, with kernel modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd, possibly in addition to the root file system specified -on the kernel command line via '--root'. LINUX-MODULES is a list of kernel +on the kernel command line via 'root'. LINUX-MODULES is a list of kernel modules to be loaded at boot time. MAPPED-DEVICES is a list of device mappings to realize before FILE-SYSTEMS are mounted. HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include @@ -375,7 +375,7 @@ (define* (base-initrd file-systems "Return as a file-like object a generic initrd, with kernel modules taken from LINUX. FILE-SYSTEMS is a list of file-systems to be mounted by the initrd, possibly in addition to the root file system specified -on the kernel command line via '--root'. MAPPED-DEVICES is a list of device +on the kernel command line via 'root'. MAPPED-DEVICES is a list of device mappings to realize before FILE-SYSTEMS are mounted. When true, KEYBOARD-LAYOUT is a record denoting the desired -- 2.34.0