From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 IKOlMsqZEGL2rwAAgWs5BA (envelope-from ) for ; Sat, 19 Feb 2022 08:18:34 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 4M5sL8qZEGJHrAAAauVa8A (envelope-from ) for ; Sat, 19 Feb 2022 08:18:34 +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 55D04F857 for ; Sat, 19 Feb 2022 08:18:34 +0100 (CET) Received: from localhost ([::1]:57328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nLK0n-00045W-Gm for larch@yhetil.org; Sat, 19 Feb 2022 02:18:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nLJlo-000780-Fv for bug-guix@gnu.org; Sat, 19 Feb 2022 02:03:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:34666) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nLJln-0007TX-4o 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 1nLJln-0005Sf-1a for bug-guix@gnu.org; Sat, 19 Feb 2022 02:03:03 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#40998: [PATCH v2 3/4] initrd: Honor rootfstype and rootflags command-line parameters. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 19 Feb 2022 07:03:03 +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.164525414120913 (code B ref 40998); Sat, 19 Feb 2022 07:03:03 +0000 Received: (at 40998) by debbugs.gnu.org; 19 Feb 2022 07:02:21 +0000 Received: from localhost ([127.0.0.1]:56792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLJl7-0005RE-5W for submit@debbugs.gnu.org; Sat, 19 Feb 2022 02:02:21 -0500 Received: from mail-qv1-f51.google.com ([209.85.219.51]:35424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLJl3-0005QR-MW for 40998@debbugs.gnu.org; Sat, 19 Feb 2022 02:02:18 -0500 Received: by mail-qv1-f51.google.com with SMTP id d7so19258212qvk.2 for <40998@debbugs.gnu.org>; Fri, 18 Feb 2022 23:02:17 -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=205DMcXOBl+dQmS2V+Wu9jm5drCExIC2TL+igSObGYA=; b=WfYSj/EAVr7Ts6t5YEdCuSHzTZstra1AiYoffntbiorjcNxuDgtIER2NcriaZmiSdN DbA//cSU+yyHBb87EpvLE9GGm0vhJkvMEnJu+oithnFAjGfKMFa8BchcpUc2Ux8Ov8u5 +qbeXfpMlf8V+ukgHFjudO/whndQeKQ+ivGhR2YEjywj0r+Jqtvv1VU0cNBwGLimb+ts 3MDbqxnWXMUx2v6NxaBW8644BJViraEwQ8iQCQ7FMZ2DIRsykRJ/Km1VblyokrYFgXQ4 GU6BTkGNLKD/lB9jh6qmgSMJauduzCXKuAatanJ3DatWq9sjcXPmVJwk25B2hC6T5SBS olLA== 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=205DMcXOBl+dQmS2V+Wu9jm5drCExIC2TL+igSObGYA=; b=37rRR3U/vjw6sBhpkoT0lXAHeHnEeqecYLC66qZX3BPSJ/Cu7vl02aD+cHRViXHJqW yBtJm0x2uXuLJ4OrAx16M1YlVa63ndDD2EEBMmE1Nav2YogA0ijX05fcVcqNyzW3YrXQ 6c/WFYTubzidBjr3iLjkEusX77f1u7F4vtI7/btQEWs/jSJ9lTf07F8ISCelx8wRO1Jt DcLgfHh7z7idKMxFmgt2rgtOOu5zOAMpUKOBuY4RBV8YF0tsvp56NzLsrF2N5Nvub4Rp FEL4DTMAJznyfIt/MqI1pz2++2EShLU+hzwcZhdbn9jm0aGc1QHsk5Fbj2sD+LUO2bBS 8djg== X-Gm-Message-State: AOAM5324fMoqTG2JLN5N1v4IQTRM4+GYp/x1fqdEfhQ92OyhtbIZ3WY4 Wd/CMUU5q98WVU0dBVl3VLS0wgha4DY= X-Google-Smtp-Source: ABdhPJz0eUUNXwGAqitRXYlg/TbbZVJaczyFJoWjfL7RUbx6cFjB9PBkpuYj70zb0LU1QLewJ1DtXQ== X-Received: by 2002:a0c:eb0a:0:b0:42c:5084:622 with SMTP id j10-20020a0ceb0a000000b0042c50840622mr8281517qvp.127.1645254131924; Fri, 18 Feb 2022 23:02:11 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 23:02:11 -0800 (PST) From: Maxim Cournoyer Date: Sat, 19 Feb 2022 02:01:54 -0500 Message-Id: <20220219070155.1924-3-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=1645255114; 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=205DMcXOBl+dQmS2V+Wu9jm5drCExIC2TL+igSObGYA=; b=rSXBiNiltaOipNUHflRPcECF3EXMqSjYcP7NrpDwCczI3lOF/HEbi40zL0z9ggWfXPpq2w N2DU7L6jh/PAzdnODCf1mtBjcDZADBiHgHpzgG0EefQhOR7c/SKvHpPnRfk7SXxnp+u4K4 tdYJdBd9L8tn3CZ+VCduXXynu139/+tfGP62lXnX+qwxgkqDvGVAxKP8UbNkF4B/qa5Xkb Ka/AsM8ODjvlFUS9cJD48PZUUtuKCU45rTYPruE3eeCbjxuwQRSnO9DkKDuH8MzExaohWS zQOmVTlVyhifJNt8yquat49Ksj6CHN0FTasPYS0pG/sRjeci8zDP2ufCMjO1Zw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645255114; a=rsa-sha256; cv=none; b=ug4Kdsh+xGRsLBro0SO6LVXZLbeq2eBdEhm70HAvPyBOX7w8PRq9VTETdbPAZcHjb57E+I xxCCxcu7/Xcav/AhoZQI7KomYz7YKDWeKobLBFxsyUDH4AiMkOT9hP+DrbCHl0IgPqHme3 ue2Y4A5P+6mHcy4Yd/21NBTY1lrI3so2B91jgeN/HA0riFf70J3hXe7M4a+hoymUT22oMI VwhtZQIqGWD+sxSNBsbUVRGUm3wsgL8D0QdEweqkO5IH4v4yEeG6gErc7UI/aXB/N5m28K do2YR56TNvHkhgy8SNebinH4uTgkteTeqasHmkwDAr12ov8bbHSQChqK1CZTIg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="WfYSj/EA"; 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: -3.53 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="WfYSj/EA"; 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: 55D04F857 X-Spam-Score: -3.53 X-Migadu-Scanner: scn0.migadu.com X-TUID: TijQK3Afqx7b * gnu/build/linux-boot.scm (boot-system): Honor rootfstype and rootflags arguments. Update doc. Error out in case there is insufficient information with regard to the root file system. Restore the behavior of inferring the root device from the root file system from the operating system in case the root argument is not provided. * doc/guix.texi (Initial RAM Disk): Document the new command-line parameters. --- doc/guix.texi | 10 ++++++++ gnu/build/linux-boot.scm | 55 ++++++++++++++++++++++++++-------------- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index d3f9216563..ec1e49630f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -34915,6 +34915,16 @@ 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 operating system declaration is used. +@item rootfstype=@var{type} +Set the type of the root file system. It overrides the @code{type} +field of the root file system specified via the @code{operating-system} +declaration, if any. + +@item rootflags=@var{options} +Set the mount @emph{options} of the root file system. It overrides the +@code{options} field of the root file system specified via the +@code{operating-system} declaration, if any. + @item fsck.mode=@var{mode} Whether to check the @var{root} file system for errors before mounting it. @var{mode} is one of @code{skip} (never check), @code{force} (always diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm index 179fb12a2b..2f8b114806 100644 --- a/gnu/build/linux-boot.scm +++ b/gnu/build/linux-boot.scm @@ -499,9 +499,9 @@ (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 parameters 'gnu.load' and 'gnu.repl'. It also +supports the kernel command-line options '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'. +'fsck.mode', 'resume', 'rootdelay', rootflags and rootfstype. Mount the root file system, specified by the 'root' command-line argument, if any. @@ -537,13 +537,30 @@ (define (device-string->file-system-device device-string) ;; over the ‘device’ field of the root record. (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. - (file-system (device (or root-device "/dev/root")) - (mount-point "/") - (type "ext4")))) + (rootfstype (find-long-option "rootfstype" args)) + (rootflags (find-long-option "rootflags" args)) + (root-fs* (find root-mount-point? mounts)) (fsck.mode (find-long-option "fsck.mode" args))) + (unless (or root-fs* (and root-device rootfstype)) + (error "no root file system or 'root' and 'rootfstype' parameters")) + + ;; If present, ‘root’ on the kernel command line takes precedence over + ;; the ‘device’ field of the root record; likewise for + ;; the 'rootfstype' and 'rootflags' arguments. + (define root-fs + (if root-fs* + (file-system + (inherit root-fs*) + (device (or root-device (file-system-device root-fs*))) + (type (or rootfstype (file-system-type root-fs*))) + (options (or rootflags (file-system-options root-fs*)))) + (file-system + (device root-device) + (mount-point "/") + (type rootfstype) + (options rootflags)))) + (define (check? fs) (match fsck.mode ("skip" #f) @@ -615,18 +632,18 @@ (define (repair fs) (setenv "EXT2FS_NO_MTAB_OK" "1") - (if root-device - (mount-root-file-system (canonicalize-device-spec root-device) - (file-system-type root-fs) - #:volatile-root? volatile-root? - #:flags (mount-flags->bit-mask - (file-system-flags root-fs)) - #:options (file-system-options root-fs) - #:check? (check? root-fs) - #:skip-check-if-clean? - (skip-check-if-clean? root-fs) - #:repair (repair root-fs)) - (mount "none" "/root" "tmpfs")) + ;; Mount the root file system. + (mount-root-file-system (canonicalize-device-spec + (file-system-device root-fs)) + (file-system-type root-fs) + #:volatile-root? volatile-root? + #:flags (mount-flags->bit-mask + (file-system-flags root-fs)) + #:options (file-system-options root-fs) + #:check? (check? root-fs) + #:skip-check-if-clean? + (skip-check-if-clean? root-fs) + #:repair (repair root-fs)) ;; Mount the specified non-root file systems. (for-each (lambda (fs) -- 2.34.0