qemu_swtpm: ConfigFeature
qemu_cdrom: bool
qemu_firmware: QemuFirmware
+ qemu_kernel: Optional[Path]
qemu_args: Sequence[str]
preset: Optional[str]
help="Set qemu firmware to use",
choices=QemuFirmware.values(),
),
+ MkosiConfigSetting(
+ dest="qemu_kernel",
+ metavar="PATH",
+ section="Host",
+ parse=config_make_path_parser(),
+ help="Specify the kernel to use for qemu direct kernel boot",
+ ),
MkosiConfigSetting(
dest="qemu_args",
metavar="ARGS",
fname])
if config.qemu_firmware == QemuFirmware.direct or config.output_format == OutputFormat.cpio:
- if "-kernel" not in args.cmdline:
+ if config.qemu_kernel:
+ kernel = config.qemu_kernel
+ elif "-kernel" not in args.cmdline:
kernel = config.output_dir / config.output_split_kernel
if not kernel.exists():
die("No kernel found, please install a kernel in the image or provide a -kernel argument to mkosi qemu")
+ else:
+ kernel = None
+ if kernel:
cmdline += ["-kernel", kernel]
cmdline += ["-append", " ".join(config.kernel_command_line + config.kernel_command_line_extra)]
Takes one of `uefi`, `bios` or `direct`. Defaults to `uefi`. When set
to `uefi`, the OVMF firmware is used. When set to `bios`, the default
SeaBIOS firmware is used. When set to `direct`, direct kernel boot is
- used. The kernel used for direct kernel boot can either be provided by
- passing qemu's `-kernel` option on the mkosi command line or by
- installing a kernel into the image, in which case it will be picked up
- automatically.
+ used. See the `QemuKernel=` option for more details on which kernel
+ image is used with direct kernel boot.
+
+`QemuKernel=`, `--qemu-kernel=`
+
+: Set the kernel image to use for qemu direct kernel boot. If not
+ specified, mkosi will use the kernel provided via the command line
+ (`-kernel` option) or latest the kernel that was installed into
+ the image (or fail if no kernel was installed into the image).
: Note that when the `cpio` output format is used, direct kernel boot is
used regardless of the configured firmware. Depending on the