]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Make sure we NUL terminate the cmdline section in the UKI
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 14 Feb 2023 20:44:42 +0000 (21:44 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 14 Feb 2023 21:45:59 +0000 (22:45 +0100)
Older versions of systemd-stub expect the cmdline section to be
NUL terminated so let's make sure that it is.

mkosi/__init__.py

index 59918e8c3264b2c68ec5123fc5414ecfdfc04ae5..4939d70eb07492588a014c1586fa5ea6c581dc6e 100644 (file)
@@ -782,9 +782,13 @@ def install_unified_kernel(state: MkosiState, roothash: Optional[str]) -> None:
             if roothash:
                 boot_options = f"{boot_options} {roothash}"
 
+            # Older versions of systemd-stub expect the cmdline section to be null terminated. We can't embed
+            # nul terminators in argv so let's communicate the cmdline via a file instead.
+            state.workspace.joinpath("cmdline").write_text(f"{boot_options}\x00")
+
             cmd: list[PathString] = [
                 "ukify",
-                "--cmdline", boot_options,
+                "--cmdline", f"@{state.workspace / 'cmdline'}",
                 "--os-release", f"@{state.root / 'usr/lib/os-release'}",
                 "--stub", state.root / f"lib/systemd/boot/efi/linux{EFI_ARCHITECTURES[state.config.architecture]}.efi.stub",
                 "--output", boot_binary,