mkosi won't automatically build new unified kernel images anymore when a kernel is updated or installed. To keep this
behavior, you can install the kernel-install script manually via a skeleton tree. The original script can be found
[here](https://github.com/systemd/mkosi/blob/3798eb0c2ebcdf7dac207a559a3cb5a65cdb77b0/mkosi/resources/dracut_unified_kernel_install.sh).
+- Added QemuKvm option to configure whether to use KVM or not when running `mkosi qemu`.
## v12
: When used with the `qemu` verb, this options sets `qemu`'s `-m`
argument which controls the amount of guest's RAM. Defaults to `1G`.
+`QemuKvm=`, `--qemu-kvm=`
+
+: When used with the `qemu` verb, this option specifies whether QEMU
+ should use KVM acceleration. Defaults to yes if the host machine
+ supports KVM acceleration, no otherwise.
+
`NspawnKeepUnit=`, `--nspawn-keep-unit`
: When used, this option instructs underlying calls of systemd-nspawn to
group.add_argument("--qemu-headless", action=BooleanAction, help="Configure image for qemu's -nographic mode")
group.add_argument("--qemu-smp", help="Configure guest's SMP settings", metavar="SMP", default="2")
group.add_argument("--qemu-mem", help="Configure guest's RAM size", metavar="MEM", default="1G")
+ group.add_argument("--qemu-kvm", action=BooleanAction, help="Configure whether to use KVM or not",
+ default=qemu_check_kvm_support())
group.add_argument(
"--nspawn-keep-unit",
action=BooleanAction,
if args.base_image is not None:
args.base_packages = False
+ if args.qemu_kvm and not qemu_check_kvm_support():
+ die("Sorry, the host machine does not support KVM acceleration.")
+
return MkosiArgs(**vars(args))
@contextlib.contextmanager
def run_qemu_cmdline(args: MkosiArgs) -> Iterator[List[str]]:
- has_kvm = qemu_check_kvm_support()
- accel = "kvm" if has_kvm else "tcg"
+ accel = "kvm" if args.qemu_kvm else "tcg"
firmware, fw_supports_sb = find_qemu_firmware()
"virtio-rng-pci,rng=rng0,id=rng-device0",
]
- if has_kvm:
+ if args.qemu_kvm:
cmdline += ["-cpu", "host"]
if args.qemu_headless: