]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
portable: support split roothash
authorLuca Boccassi <luca.boccassi@gmail.com>
Sat, 6 Dec 2025 17:05:03 +0000 (17:05 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sun, 7 Dec 2025 19:16:59 +0000 (19:16 +0000)
Portable images are DDIs too, support writing a split roothash
as with OS images

mkosi/__init__.py

index 3decb80b03198c5a5e0c9616c4acb9b92581cbe6..a7be4899abfd8da88da42601972d9d72d9a56435 100644 (file)
@@ -3462,10 +3462,7 @@ def make_image(
             if p.split_path and p.type not in skip:
                 maybe_compress(context, context.config.compress_output, p.split_path)
 
-    if ArtifactOutput.roothash in context.config.split_artifacts and (
-        roothash := finalize_roothash(partitions)
-    ):
-        (context.staging / context.config.output_split_roothash).write_text(roothash.partition("=")[2])
+    write_split_roothash(context, partitions)
 
     return partitions
 
@@ -3725,6 +3722,13 @@ def make_esp(
     )
 
 
+def write_split_roothash(context: Context, partitions: Sequence[Partition]) -> None:
+    if ArtifactOutput.roothash in context.config.split_artifacts and (
+        roothash := finalize_roothash(partitions)
+    ):
+        (context.staging / context.config.output_split_roothash).write_text(roothash.partition("=")[2])
+
+
 def make_extension_or_portable_image(context: Context, output: Path) -> None:
     if context.config.verity == Verity.disabled or (
         context.config.verity == Verity.auto
@@ -3807,6 +3811,8 @@ def make_extension_or_portable_image(context: Context, output: Path) -> None:
             if p.split_path:
                 maybe_compress(context, context.config.compress_output, p.split_path)
 
+    write_split_roothash(context, [Partition.from_dict(d) for d in j])
+
 
 def finalize_staging(context: Context) -> None:
     rmtree(