installs kernels with a separate initrd and boot loader config to
the efi or bootloader partition.
-`HostonlyInitrd=`, `--hostonly-initrd`
-
-: If specified, mkosi will run the tool to create the initrd such that
- a non-generic initrd is created that will only be able to run on the
- system mkosi is run on. Currently mkosi uses dracut for all
- supported distributions and this option translates to enabling dracut's
- hostonly option.
-
`CacheInitrd=`, `--cache-initrd`
: If specified, and incremental mode is used, mkosi will build the initrd
dracut_dir = state.root / "etc/dracut.conf.d"
dracut_dir.mkdir(mode=0o755, exist_ok=True)
- dracut_dir.joinpath('30-mkosi-hostonly.conf').write_text(
- f'hostonly={yes_no(state.config.hostonly_initrd)}\n'
- 'hostonly_default_device=no\n'
- )
-
dracut_dir.joinpath("30-mkosi-qemu.conf").write_text('add_dracutmodules+=" qemu "\n')
with dracut_dir.joinpath("30-mkosi-systemd-extras.conf").open("w") as f:
for conf in state.root.joinpath("etc/systemd/system.conf.d").iterdir():
f.write(f'install_optional_items+=" {Path("/") / conf.relative_to(state.root)} "\n')
- if state.config.hostonly_initrd:
- dracut_dir.joinpath("30-mkosi-filesystem.conf").write_text(
- f'filesystems+=" {(state.config.output_format.needed_kernel_module())} "\n'
- )
-
if state.get_partition(PartitionIdentifier.esp):
# efivarfs must be present in order to GPT root discovery work
dracut_dir.joinpath("30-mkosi-efivarfs.conf").write_text(
help=argparse.SUPPRESS,
)
group.add_argument("--gpt-first-lba", type=int, help="Set the first LBA within GPT Header", metavar="FIRSTLBA")
- group.add_argument(
- "--hostonly-initrd",
- metavar="BOOL",
- action=BooleanAction,
- help="Enable dracut hostonly option",
- )
group.add_argument(
"--cache-initrd",
metavar="BOOL",
print(" UEFI SecureBoot:", yes_no(config.secure_boot))
print(" Unified Kernel Images:", yes_no(config.with_unified_kernel_images))
print(" GPT First LBA:", str(config.gpt_first_lba))
- print(" Hostonly Initrd:", yes_no(config.hostonly_initrd))
if config.secure_boot or config.verity == "sign":
print("SecureBoot/Verity Sign Key:", config.secure_boot_key)
minimize: bool
with_unified_kernel_images: bool
gpt_first_lba: Optional[int]
- hostonly_initrd: bool
cache_initrd: bool
base_packages: Union[str, bool]
packages: List[str]
packages = {*state.config.packages}
add_packages(state.config, packages, "systemd", "dnf")
if not state.do_run_build_script and state.config.bootable:
- add_packages(state.config, packages, "kernel", "dracut")
+ add_packages(state.config, packages, "kernel", "dracut", "dracut-config-generic")
add_packages(state.config, packages, "systemd-udev", conditional="systemd")
if state.do_run_build_script:
extra_packages.update(state.config.build_packages)
if not state.do_run_build_script and state.config.bootable:
- add_packages(state.config, extra_packages, "dracut")
+ add_packages(state.config, extra_packages, "dracut", "dracut-config-generic")
cls._add_default_kernel_package(state, extra_packages)
if state.config.output_format == OutputFormat.gpt_btrfs:
add_packages(state.config, packages, "systemd", "util-linux", "dnf")
if not state.do_run_build_script and state.config.bootable:
- add_packages(state.config, packages, "kernel-core", "kernel-modules", "dracut")
+ add_packages(state.config, packages, "kernel-core", "kernel-modules", "dracut", "dracut-config-generic")
add_packages(state.config, packages, "systemd-udev", conditional="systemd")
if state.do_run_build_script:
packages.update(state.config.build_packages)
"netdev": False,
"ephemeral": False,
"with_unified_kernel_images": True,
- "hostonly_initrd": False,
"cache_initrd": False,
"ssh": False,
"ssh_key": None,
self.reference_config[job_name]["with_unified_kernel_images"] = mk_config_output[
"WithUnifiedKernelImages"
]
- if "HostonlyInitrd" in mk_config_output:
- self.reference_config[job_name]["hostonly_initrd"] = mk_config_output["HostonlyInitrd"]
if "CacheInitrd" in mk_config_output:
self.reference_config[job_name]["cache_initrd"] = mk_config_output["CacheInitrd"]
if "MachineID" in mk_config_output: