mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
gpt-auto-generator: honour rootfstype= and rootflags= kernel cmdline option
Even if root= is not specified on the kernel cmdline, we should honour the other rootXYZ= options. Fixes: #8411 See: #17034
This commit is contained in:
parent
ec6267e862
commit
cf451f382a
|
@ -336,11 +336,16 @@
|
|||
<term><varname>rw</varname></term>
|
||||
|
||||
<listitem>
|
||||
<para>Configures the root file system and its file system
|
||||
type and mount options, as well as whether it shall be
|
||||
mounted read-only or read-write initially. For details,
|
||||
see
|
||||
<para>Configures the root file system and its file system type and mount options, as well as
|
||||
whether it shall be mounted read-only or read-write initially. For details, see
|
||||
<citerefentry><refentrytitle>systemd-fstab-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
|
||||
|
||||
<para>If <varname>root=</varname> is not set (or set to <literal>gpt-auto</literal>) the automatic
|
||||
root partition discovery implemented by
|
||||
<citerefentry><refentrytitle>systemd-gpt-auto-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||
will be in effect. In this case <varname>rootfstype=</varname>, <varname>rootflags=</varname>,
|
||||
<varname>ro</varname>, <varname>rw</varname> will be interpreted by
|
||||
<command>systemd-gpt-auto-generator</command>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
|
|
@ -244,10 +244,16 @@
|
|||
|
||||
<varlistentry>
|
||||
<term><varname>root=</varname></term>
|
||||
<term><varname>rootfstype=</varname></term>
|
||||
<term><varname>rootflags=</varname></term>
|
||||
|
||||
<listitem><para>When used with the special value <literal>gpt-auto</literal>, automatic discovery of
|
||||
the root partition based on the GPT partition type is enabled. Any other value disables this
|
||||
generator.</para></listitem>
|
||||
<listitem><para>When <varname>root=</varname> is used with the special value
|
||||
<literal>gpt-auto</literal> (or if the parameter is not used at all), automatic discovery of the root
|
||||
partition based on the GPT partition type is enabled. Any other value disables this
|
||||
logic.</para>
|
||||
|
||||
<para>The <varname>rootfstype=</varname> and <varname>rootflags=</varname> are used to select the
|
||||
file system type and options when the root file system is automatically discovered.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
|
|
@ -40,8 +40,13 @@
|
|||
static const char *arg_dest = NULL;
|
||||
static bool arg_enabled = true;
|
||||
static bool arg_root_enabled = true;
|
||||
static char *arg_root_fstype = NULL;
|
||||
static char *arg_root_options = NULL;
|
||||
static int arg_root_rw = -1;
|
||||
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_root_fstype, freep);
|
||||
STATIC_DESTRUCTOR_REGISTER(arg_root_options, freep);
|
||||
|
||||
static int add_cryptsetup(
|
||||
const char *id,
|
||||
const char *what,
|
||||
|
@ -622,10 +627,10 @@ static int add_root_mount(void) {
|
|||
"root",
|
||||
"/dev/gpt-auto-root",
|
||||
in_initrd() ? "/sysroot" : "/",
|
||||
NULL,
|
||||
arg_root_fstype,
|
||||
/* rw= */ arg_root_rw > 0,
|
||||
/* growfs= */ false,
|
||||
NULL,
|
||||
arg_root_options,
|
||||
"Root Partition",
|
||||
in_initrd() ? SPECIAL_INITRD_ROOT_FS_TARGET : SPECIAL_LOCAL_FS_TARGET);
|
||||
#else
|
||||
|
@ -801,6 +806,21 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
|||
|
||||
arg_root_enabled = false;
|
||||
|
||||
} else if (streq(key, "rootfstype")) {
|
||||
|
||||
if (proc_cmdline_value_missing(key, value))
|
||||
return 0;
|
||||
|
||||
return free_and_strdup_warn(&arg_root_fstype, value);
|
||||
|
||||
} else if (streq(key, "rootflags")) {
|
||||
|
||||
if (proc_cmdline_value_missing(key, value))
|
||||
return 0;
|
||||
|
||||
if (!strextend_with_separator(&arg_root_options, ",", value))
|
||||
return log_oom();
|
||||
|
||||
} else if (proc_cmdline_key_streq(key, "rw") && !value)
|
||||
arg_root_rw = true;
|
||||
else if (proc_cmdline_key_streq(key, "ro") && !value)
|
||||
|
|
Loading…
Reference in a new issue