From: Daan De Meyer Date: Tue, 14 Feb 2023 20:44:42 +0000 (+0100) Subject: Make sure we NUL terminate the cmdline section in the UKI X-Git-Tag: v15~325^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d48a5d9635ba059baca4c44f766046ca5fe03a31;p=thirdparty%2Fmkosi.git Make sure we NUL terminate the cmdline section in the UKI Older versions of systemd-stub expect the cmdline section to be NUL terminated so let's make sure that it is. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 59918e8c3..4939d70eb 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -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,