removable: bool
firmware: Firmware
firmware_variables: Optional[Path]
- linux: Optional[Path]
+ linux: Optional[str]
drives: list[Drive]
qemu_args: list[str]
return expand_delayed_specifiers(specifiers, key)
+ def expand_linux_specifiers(self) -> Path:
+ assert self.linux
+
+ specifiers = {
+ "&": "&",
+ "b": os.fspath(self.build_subdir) if self.build_dir else "",
+ }
+
+ return parse_path(expand_delayed_specifiers(specifiers, self.linux))
+
def to_dict(self) -> dict[str, Any]:
d = dataclasses.asdict(self, dict_factory=dict_with_capitalised_keys_factory)
dest="linux",
metavar="PATH",
section="Runtime",
- parse=config_make_path_parser(),
+ parse=config_parse_string,
help="Specify the kernel to use for direct kernel boot",
compat_longs=("--qemu-kernel",),
compat_names=("QemuKernel",),
die(f"Console mode {config.console} requested but systemd-pty-forward not found")
if config.linux:
- kernel = config.linux
+ kernel = config.expand_linux_specifiers()
elif "-kernel" in args.cmdline:
kernel = Path(args.cmdline[args.cmdline.index("-kernel") + 1])
else:
`Linux=`, `--linux=`
: 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
+ (`-kernel` option) or the latest 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
configured firmware, **qemu** might boot the kernel itself or using the
configured firmware.
+ This setting may include both the regular specifiers (see
+ **Specifiers**) and special delayed specifiers, that are expanded
+ after config parsing has finished, instead of during config parsing,
+ which are described below.
+
+ The following specifiers may be used:
+
+ | Specifier | Value |
+ |-----------|----------------------------------------------------|
+ | `&&` | `&` character |
+ | `&b` | The final build directory (including subdirectory) |
+
`Drives=`, `--drive=`
: Add a drive. Takes a colon-delimited string of format
`<id>:<size>[:<directory>[:<options>[:<file-id>]]]`. `id` specifies
if config.firmware_variables and config.firmware_variables != Path("microsoft"):
die("mkosi vmspawn does not support FirmwareVariables=")
- kernel = config.linux
+ kernel = config.expand_linux_specifiers() if config.linux else None
firmware = finalize_firmware(config, kernel)
if not kernel and firmware == Firmware.linux: