]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add Splash= to set the boot splash for unified kernel images
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 16 Feb 2025 14:54:49 +0000 (15:54 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 16 Feb 2025 15:14:26 +0000 (16:14 +0100)
mkosi/__init__.py
mkosi/config.py
mkosi/resources/man/mkosi.1.md
tests/test_json.py

index 9a6f221eabcff98c8c88eef6a60487732f8b931b..e7d6df3eb96a216f86e0e5db290727658bc63882 100644 (file)
@@ -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
index 91db141e038b1036a94400a392df812429f01a58..c08a4ac94ab99228fd5b9caf5d7123c68c1df45b 100644 (file)
@@ -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)}
index d1afa882bdbd9e7f930df4dc8f39fd004d656bc3..6234090f5eb000379d67ebd0937817228d8bf0d5 100644 (file)
@@ -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 `<vendor>/<board>.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.
 
index a9749b914b40f44bbd2a72662b882bfd9cbc4feb..e7d8aac7e3959f96917e731b21d07ace41aeaac1 100644 (file)
@@ -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,