From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id IB39Loe8D2JFAwEAgWs5BA (envelope-from ) for ; Fri, 18 Feb 2022 16:34:31 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 2DSoJ4e8D2J3QwAAG6o9tA (envelope-from ) for ; Fri, 18 Feb 2022 16:34:31 +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 3B313353B7 for ; Fri, 18 Feb 2022 16:34:31 +0100 (CET) Received: from localhost ([::1]:51094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nL5HC-0007zx-0Q for larch@yhetil.org; Fri, 18 Feb 2022 10:34:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nL5Gl-0007yv-Cb for bug-guix@gnu.org; Fri, 18 Feb 2022 10:34:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:34106) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nL5Gk-0005FC-TS for bug-guix@gnu.org; Fri, 18 Feb 2022 10:34:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nL5Gk-00025R-Me for bug-guix@gnu.org; Fri, 18 Feb 2022 10:34:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#40998: [PATCH 2/3] initrd: Honor rootfstype and rootflags command-line parameters. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 18 Feb 2022 15:34: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: To: 40998@debbugs.gnu.org Received: via spool by 40998-submit@debbugs.gnu.org id=B40998.16451984207965 (code B ref 40998); Fri, 18 Feb 2022 15:34:02 +0000 Received: (at 40998) by debbugs.gnu.org; 18 Feb 2022 15:33:40 +0000 Received: from localhost ([127.0.0.1]:56230 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nL5GO-00024O-3M for submit@debbugs.gnu.org; Fri, 18 Feb 2022 10:33:40 -0500 Received: from mail-qv1-f49.google.com ([209.85.219.49]:36750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nL5GK-00023r-AQ for 40998@debbugs.gnu.org; Fri, 18 Feb 2022 10:33:36 -0500 Received: by mail-qv1-f49.google.com with SMTP id o5so15417232qvm.3 for <40998@debbugs.gnu.org>; Fri, 18 Feb 2022 07:33:36 -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=PMmQAm1rSCzEw/n2G196BjEQkvg4TTbf2nGcfwN3tu4=; b=RT1oVzpKxF8tRh+IoaaEHjrcUolo1HkfVSNLRZ2jgLfB1C+Oy3X4tqt29M3UiPWGB1 TVJk7gBpo3l0US84+ciokIPqEg6RlEG9D4IcMCfIPXIZA1A+uZHhZ/CigwxjvFJFate3 Iub4US54TFxD+PSyL8iYLxhcaJPVexg6aqUJ0KQ3Y4w4eSTn+SRfGNF16GbJrPa/SuoB ke9Q65y5j7BLfswAlur3LmelHLIIRKjznbmLd7fK6JmzoO8moDaSKUURN1Ndey+/T4Az 7yUvgxBIj2fX0+4bA92wiaLzc1AcRvw2NvOB5+fi8hk9WpfZTjyJAtV2Yv1rg63YRBVU X0HA== 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=PMmQAm1rSCzEw/n2G196BjEQkvg4TTbf2nGcfwN3tu4=; b=LRsqXVbirsEsb1PQUZWZ6bRDdf/D0p93JR8OXeigFXUcLJRU+M/EQ6OJiSanPSeGPJ s/uTWYCbt3/FeXQvFf3Mw8JHkqhhcB3xzF4KsHmx0afU/Nm/vXjfzftupxaTw7CWJPml hz7t1GHACzci4HtLFV2kmGMhrZvbSB2wHQ8yU8o4TIDAzdGeXadbWvHe7eOfUtweEKet WkttVlNWe8jB2Trn59R3Zu+zpJMLfEgEKn486PLMs+HDpngg9neC6FzCRfiVrVsbXHaZ 8svI7kXJl/zPmstv9R6vYk4DWVOBs7buGGQ0hkYtBBvuZBa0NB3TAWdL1AF1jDmazoUz YRYg== X-Gm-Message-State: AOAM533XE6Dr/f4bnh9eV95fa5kEfePv0Zc9MpVOKgTTIXi3vTrwTGKd X14bEgVgkT2jjwWpuULNEoTxIWfyH9A= X-Google-Smtp-Source: ABdhPJz8SG1R11/7MFRAcChiko+Hf14QmbvaLqBP/Eudh96W8g11UM3sogU23OTd1SBLGDZOIiwF7Q== X-Received: by 2002:ac8:5853:0:b0:2d6:8a16:753c with SMTP id h19-20020ac85853000000b002d68a16753cmr7235945qth.401.1645198410499; Fri, 18 Feb 2022 07:33:30 -0800 (PST) Received: from localhost.localdomain (dsl-149-79.b2b2c.ca. [66.158.149.79]) by smtp.gmail.com with ESMTPSA id y21sm3726781qtn.62.2022.02.18.07.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 07:33:29 -0800 (PST) From: Maxim Cournoyer Date: Fri, 18 Feb 2022 10:33:22 -0500 Message-Id: <20220218153323.29393-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220218153323.29393-1-maxim.cournoyer@gmail.com> References: <20220218153323.29393-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=1645198471; 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=PMmQAm1rSCzEw/n2G196BjEQkvg4TTbf2nGcfwN3tu4=; b=KSy764HElPtKMrYrSsh8uI1UXf4LqNu0VCCQoJg0T08/7nKAZt+st0nubcmlxrSC5Ehw1c WkOrqMgJ0ik5bIGeEtixnMeHIcxrsFaz5iDN7xROCkvMWD2K597c/Ee77LM3or7cSGZ2bb XegsKi71BTMdpQTuVS+8DK/CZKxVZDrU4CnMbxKRj9o43WsqWAp2buK6k75bvy8ZHb5D9f IwnCpNc2yZXrSPazDVbfHMBIcHxrV3O4Wgcj4MWFqC7/IBZBr0lcWYpPcZDxPnrtJsAQcC rcxwDqKN9AwoUvYuTqlPHRwcmNk2Hwzde4eIhTUR4RN/C28I5NF972RVFUtbxA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645198471; a=rsa-sha256; cv=none; b=H7ohnfRmyNN1tyia1rIGAUVwAwwxegR+u4ouA7CKnpt/TxT2jKfKVvv27+JB6AW2RvPW/Q ycWl9ViOOb5WutYxkcLdCeB18SO3Tk9fbOg0zDbaHtyMZ5WzkV3cbYQT1Q685mIV8ouGgZ cANr1W7ntGqpbunYztq5OTt8HeOv0T6AJNp3YKHS9m/hy7dO4RDPc7BBazSCTQpoRlblNa WKdl8XYk9VsqN1iYJugq8cARRNr63XVFbxMQfFk9h1ik99V0zSdkrWKYFEbXejXgF2e40T QOs6KlhcKZwIaYd59tzESk0YGSLKfFEwPSes9yiZOtnCW6c0mUPaYlbG82tb2A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=RT1oVzpK; 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.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=RT1oVzpK; 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: 3B313353B7 X-Spam-Score: -3.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: mKqX+77y42Go * 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 | 59 +++++++++++++++++++++++++--------------- 2 files changed, 47 insertions(+), 22 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ba613ea31f..cbfd9f68f2 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 d36601d824..b1573fe757 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 options '--load' and '--repl'. It also honors a -subset of the Linux kernel command-line parameters such as 'fsck.mode', -'resume', 'root' and 'rootdelay'. +supports the kernel command-line options '--load' and '--repl'. It +also honors a subset of the Linux kernel command-line parameters such as +'fsck.mode', 'resume', 'rootdelay', rootflags and rootfstype. Mount the root file system, specified by the 'root' command-line argument, if any. @@ -533,17 +533,32 @@ (define (device-string->file-system-device device-string) (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 - ;; 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 +630,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