generator: add root=off to explicitly turn search for rootfs off

This is useful when booting into storage target mode, where we do not
want to enter a root fs, we just want to stay forever in the initrd,
and hence there's value in not even generating and jobs to find the
rootfs
This commit is contained in:
Lennart Poettering
2025-03-14 15:57:03 +01:00
parent 198f7badaa
commit c05a132fef
2 changed files with 10 additions and 1 deletions

View File

@@ -1132,6 +1132,11 @@ static bool validate_root_or_usr_mount_source(const char *what, const char *swit
return false;
}
if (streq(what, "off")) {
log_debug("Skipping %s directory handling, as this was explicitly turned off.", switch_name);
return false;
}
if (parse_gpt_auto_root(what) > 0) {
/* This is handled by gpt-auto-generator */
log_debug("Skipping %s directory handling, as gpt-auto was requested.", switch_name);

View File

@@ -1114,6 +1114,10 @@ GptAutoRoot parse_gpt_auto_root(const char *value) {
return GPT_AUTO_ROOT_DISSECT_FORCE;
}
log_debug("Disabling root partition auto-detection, root= is neither unset, nor set to 'gpt-auto', 'gpt-auto-force', 'dissect' or 'dissect-force'.");
if (streq(value, "off"))
log_debug("Disabling root partition auto-detection, root= handling is explicitly turned off.");
else
log_debug("Disabling root partition auto-detection, root= is neither unset, nor set to 'gpt-auto', 'gpt-auto-force', 'dissect' or 'dissect-force'.");
return GPT_AUTO_ROOT_OFF;
}