From: Daan De Meyer Date: Tue, 26 Sep 2023 10:35:33 +0000 (+0200) Subject: Always copy kernel to split output X-Git-Tag: v18~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=253bba8d40d6877a6178e48b39a298dde3a7820b;p=thirdparty%2Fmkosi.git Always copy kernel to split output Even if we don't have a bootloader or aren't configured to be bootable, make sure we copy a kernel out of the image so we can linux direct boot images in qemu. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index f640f637b..8ab118191 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1139,10 +1139,6 @@ def install_uki(state: MkosiState, partitions: Sequence[Partition]) -> None: if state.config.bootloader == Bootloader.none: return - for kver, kimg in gen_kernel_images(state): - shutil.copy(state.root / kimg, state.staging / state.config.output_split_kernel) - break - if ( state.config.output_format in (OutputFormat.cpio, OutputFormat.uki) and state.config.bootable == ConfigFeature.auto @@ -1268,6 +1264,15 @@ def copy_nspawn_settings(state: MkosiState) -> None: shutil.copy2(state.config.nspawn_settings, state.staging / state.config.output_nspawn_settings) +def copy_vmlinuz(state: MkosiState) -> None: + if (state.staging / state.config.output_split_kernel).exists(): + return + + for _, kimg in gen_kernel_images(state): + shutil.copy(state.root / kimg, state.staging / state.config.output_split_kernel) + break + + def hash_file(of: TextIO, path: Path) -> None: bs = 16 * 1024**2 h = hashlib.sha256() @@ -1925,6 +1930,7 @@ def build_image(args: MkosiArgs, config: MkosiConfig, name: str, uid: int, gid: partitions = make_image(state) install_grub_bios(state, partitions) make_image(state, split=True) + copy_vmlinuz(state) if state.config.output_format == OutputFormat.tar: make_tar(state.root, state.staging / state.config.output_with_format)