From: Daan De Meyer Date: Sun, 16 Feb 2025 14:54:49 +0000 (+0100) Subject: Add Splash= to set the boot splash for unified kernel images X-Git-Tag: v26~376 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86a45644b47a889e99352bec1d6947f79ee0b032;p=thirdparty%2Fmkosi.git Add Splash= to set the boot splash for unified kernel images --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 9a6f221ea..e7d6df3eb 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1710,6 +1710,11 @@ def build_uki( arguments += ["--devicetree", workdir(dtb)] options += ["--ro-bind", dtb, workdir(dtb)] + if context.config.splash: + splash = context.root / os.fspath(context.config.splash).lstrip("/") + arguments += ["--splash", workdir(splash)] + options += ["--ro-bind", splash, workdir(splash)] + if context.config.secure_boot: assert context.config.secure_boot_key assert context.config.secure_boot_certificate diff --git a/mkosi/config.py b/mkosi/config.py index 91db141e0..c08a4ac94 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -1207,6 +1207,7 @@ def config_make_path_parser( expanduser: bool = True, expandvars: bool = True, secret: bool = False, + absolute: bool = False, constants: Sequence[str] = (), ) -> ConfigParseCallback[Path]: def config_parse_path(value: Optional[str], old: Optional[Path]) -> Optional[Path]: @@ -1220,6 +1221,7 @@ def config_make_path_parser( expanduser=expanduser, expandvars=expandvars, secret=secret, + absolute=absolute, constants=constants, ) @@ -1872,6 +1874,7 @@ class Config: initrd_volatile_packages: list[str] microcode_host: bool devicetree: Optional[Path] + splash: Optional[Path] kernel_command_line: list[str] kernel_modules_include: list[str] kernel_modules_exclude: list[str] @@ -2967,6 +2970,12 @@ SETTINGS: list[ConfigSetting[Any]] = [ parse=config_parse_string, help="Devicetree to be used by the booting kernel", ), + ConfigSetting( + dest="splash", + section="Content", + parse=config_make_path_parser(required=False, absolute=True), + help="Splash screen image to be used by the booting kernel", + ), ConfigSetting( dest="kernel_command_line", metavar="OPTIONS", @@ -4972,6 +4981,7 @@ def summary(config: Config) -> str: Initrd Packages: {line_join_list(config.initrd_packages)} Initrd Volatile Packages: {line_join_list(config.initrd_volatile_packages)} Devicetree: {none_to_none(config.devicetree)} + Splash: {none_to_none(config.splash)} Kernel Command Line: {line_join_list(config.kernel_command_line)} Kernel Modules Include: {line_join_list(config.kernel_modules_include)} Kernel Modules Exclude: {line_join_list(config.kernel_modules_exclude)} diff --git a/mkosi/resources/man/mkosi.1.md b/mkosi/resources/man/mkosi.1.md index d1afa882b..6234090f5 100644 --- a/mkosi/resources/man/mkosi.1.md +++ b/mkosi/resources/man/mkosi.1.md @@ -1024,6 +1024,10 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`, specified file relative to common paths where Linux distributions install Devicetree files. It should typically have the format `/.dtb`. +`Splash=`, `--splash=` +: When set, the boot splash for any unified kernel image built by **mkosi** will + be picked up from the given path inside the image. + `MicrocodeHost=`, `--microcode-host=` : When set to true only include microcode for the host's CPU in the image. diff --git a/tests/test_json.py b/tests/test_json.py index a9749b914..e7d8aac7e 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -350,6 +350,7 @@ def test_config() -> None: } ], "SourceDateEpoch": 12345, + "Splash": "/splash", "SplitArtifacts": [ "uki", "kernel" @@ -570,6 +571,7 @@ def test_config() -> None: sign=False, skeleton_trees=[ConfigTree(Path("/foo/bar"), Path("/")), ConfigTree(Path("/bar/baz"), Path("/qux"))], source_date_epoch=12345, + splash=Path("/splash"), split_artifacts=[ArtifactOutput.uki, ArtifactOutput.kernel], ssh_certificate=Path("/path/to/cert"), ssh_key=None,