Skip to content

Commit 86b7f63

Browse files
committed
Make user provided command line take preference over roothash=
If the user provides their own root= or mount.usr= configuration, let's always have that take preference over the partition roothash= or usrhash= This is preparation for adding support for root=dissect in which case we don't need roothash= or usrhash= on the kernel command line.
1 parent cb72902 commit 86b7f63

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

mkosi/__init__.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -1946,18 +1946,20 @@ def finalize_cmdline(
19461946
else:
19471947
cmdline = []
19481948

1949-
if roothash:
1950-
cmdline += [roothash]
1951-
19521949
cmdline += context.config.kernel_command_line
19531950

1954-
if not roothash:
1955-
for name in ("root", "mount.usr"):
1956-
type_prefix = name.removeprefix("mount.")
1957-
if not (root := next((p.uuid for p in partitions if p.type.startswith(type_prefix)), None)):
1958-
continue
1951+
for name in ("root", "mount.usr"):
1952+
type_prefix = name.removeprefix("mount.")
1953+
if not (root := next((p.uuid for p in partitions if p.type.startswith(type_prefix)), None)):
1954+
continue
19591955

1960-
cmdline = [f"{name}=PARTUUID={root}" if c == f"{name}=PARTUUID" else c for c in cmdline]
1956+
cmdline = [f"{name}=PARTUUID={root}" if c == f"{name}=PARTUUID" else c for c in cmdline]
1957+
1958+
if roothash and (
1959+
(roothash.startswith("roothash=") and not any(c.startswith("root=") for c in cmdline))
1960+
or (roothash.startswith("usrhash=") and not any(c.startswith("mount.usr") for c in cmdline))
1961+
):
1962+
cmdline += [roothash]
19611963

19621964
return cmdline
19631965

0 commit comments

Comments
 (0)