return Path(ovmf_vars.name), ovmf_vars_format
+def apply_runtime_size(config: Config, image: Path) -> None:
+ if config.output_format != OutputFormat.disk or not config.runtime_size:
+ return
+
+ run(
+ [
+ "systemd-repart",
+ "--definitions", "",
+ "--no-pager",
+ f"--size={config.runtime_size}",
+ "--pretty=no",
+ "--offline=yes",
+ image,
+ ],
+ sandbox=config.sandbox(mounts=[Mount(image, image)]),
+ )
+
+
def run_qemu(args: Args, config: Config) -> None:
if config.output_format not in (
OutputFormat.disk,
else:
fname = stack.enter_context(flock_or_die(config.output_dir_or_cwd() / config.output_with_compression))
- if config.output_format == OutputFormat.disk and config.runtime_size:
- run(
- [
- "systemd-repart",
- "--definitions", "",
- "--no-pager",
- f"--size={config.runtime_size}",
- "--pretty=no",
- "--offline=yes",
- fname,
- ],
- sandbox=config.sandbox(mounts=[Mount(fname, fname)]),
- )
+ apply_runtime_size(config, fname)
if (
kernel and
)
from mkosi.log import die
from mkosi.qemu import (
+ apply_runtime_size,
copy_ephemeral,
finalize_qemu_firmware,
find_ovmf_firmware,
else:
fname = stack.enter_context(flock_or_die(config.output_dir_or_cwd() / config.output))
- if config.output_format == OutputFormat.disk and config.runtime_size:
- run(
- [
- "systemd-repart",
- "--definitions", "",
- "--no-pager",
- f"--size={config.runtime_size}",
- "--pretty=no",
- "--offline=yes",
- fname,
- ],
- sandbox=config.sandbox(mounts=[Mount(fname, fname)]),
- )
+ apply_runtime_size(config, fname)
kcl = config.kernel_command_line_extra