SecureBootSignTool,
ShimBootloader,
Verb,
+ Vmm,
__version__,
format_bytes,
parse_config,
if verb == Verb.boot:
check_systemd_tool(config, "systemd-nspawn", version="254", reason="boot images")
- if verb == Verb.vmspawn:
+ if verb == Verb.qemu and config.vmm == Vmm.vmspawn:
check_systemd_tool(config, "systemd-vmspawn", version="256~devel", reason="boot images with vmspawn")
if args.verb in (Verb.shell, Verb.boot)
else contextlib.nullcontext()
):
+ run_vm = {
+ Vmm.qemu: run_qemu,
+ Vmm.vmspawn: run_vmspawn,
+ }[last.vmm]
+
{
Verb.shell: run_shell,
Verb.boot: run_shell,
- Verb.qemu: run_qemu,
+ Verb.qemu: run_vm,
Verb.serve: run_serve,
Verb.burn: run_burn,
- Verb.vmspawn: run_vmspawn,
}[args.verb](args, last)
journalctl = enum.auto()
coredumpctl = enum.auto()
burn = enum.auto()
- vmspawn = enum.auto()
def supports_cmdline(self) -> bool:
return self in (
Verb.journalctl,
Verb.coredumpctl,
Verb.burn,
- Verb.vmspawn,
)
def needs_build(self) -> bool:
Verb.qemu,
Verb.serve,
Verb.burn,
- Verb.vmspawn,
)
def needs_root(self) -> bool:
none = enum.auto()
+class Vmm(StrEnum):
+ qemu = enum.auto()
+ vmspawn = enum.auto()
+
+
class Architecture(StrEnum):
alpha = enum.auto()
arc = enum.auto()
runtime_network: Network
ssh_key: Optional[Path]
ssh_certificate: Optional[Path]
+ vmm: Vmm
# QEMU-specific options
qemu_gui: bool
paths=("mkosi.crt",),
help="Certificate for use with mkosi ssh in X509 format",
),
+ ConfigSetting(
+ dest="vmm",
+ name="VirtualMachineMonitor",
+ metavar="VMM",
+ section="Host",
+ parse=config_make_enum_parser(Vmm),
+ default=Vmm.qemu,
+ help="Set the virtual machine monitor to use for mkosi qemu",
+ ),
ConfigSetting(
dest="qemu_gui",
metavar="BOOL",
SSH Signing Key: {none_to_none(config.ssh_key)}
SSH Certificate: {none_to_none(config.ssh_certificate)}
+ Virtual Machine Monitor: {config.vmm}
QEMU GUI: {yes_no(config.qemu_gui)}
QEMU CPU Cores: {config.qemu_smp}
QEMU Memory: {config.qemu_mem}
Cacheonly: enum_transformer,
Network: enum_transformer,
KeySource: key_source_transformer,
+ Vmm: enum_transformer,
}
def json_transformer(key: str, val: Any) -> Any:
`mkosi [options…] qemu [qemu parameters…]`
-`mkosi [options…] vmspawn [vmspawn settings…]`
-
`mkosi [options…] ssh [command line…]`
`mkosi [options…] journalctl [command line…]`
`qemu`
-: Similar to `boot`, but uses `qemu` to boot up the image, i.e. instead
- of container virtualization virtual machine virtualization is used.
- This verb is only supported for disk images that contain a boot loader
- and cpio images in which a kernel was installed. For cpio images a
- kernel can also be provided by passing the `-kernel` qemu argument to
- the `qemu` verb. Any arguments specified after the `qemu` verb are
- appended to the `qemu` invocation.
-
-`vmspawn`
-
-: Similar to `boot`, but uses `systemd-vmspawn` to boot up the image, i.e.
- instead of container virtualization virtual machine virtualization is used.
- This verb is only supported for disk and directory type images.
- Any arguments specified after the `vmspawn` verb are appended to the
- `systemd-vmspawn` invocation.
+: Similar to `boot`, but uses the configured virtual machine monitor (by
+ default `qemu`) to boot up the image, i.e. instead of container
+ virtualization virtual machine virtualization is used. How extra
+ command line arguments are interpreted depends on the configured
+ virtual machine monitor. See `VirtualMachineMonitor=` for more
+ information.
`ssh`
: List of colon-separated paths to look for tools in, before using the
regular `$PATH` search path.
+`VirtualMachineMonitor=`, `--vmm=`
+
+: Configures the virtual machine monitor to use. Takes one of `qemu` or
+ `vmspawn`. Defaults to `qemu`.
+
+: When set to `qemu`, the image is booted with `qemu`. Most output
+ formats can be booted in `qemu`. Any arguments specified after the
+ verb are appended to the `qemu` invocation and are interpreted as
+ extra qemu command line arguments.
+
+: When set to `vmspawn`, `systemd-vmspawn` is used to boot up the image,
+ `vmspawn` only supports disk and directory type images. Any arguments
+ specified after the verb are appended to the `systemd-vmspawn`
+ invocation and are interpreted as extra vmspawn options and extra
+ kernel command line arguments.
+
`QemuGui=`, `--qemu-gui=`
: If enabled, qemu is executed with its graphical interface instead of