Skip to content

Commit

Permalink
Merge pull request #2924 from DaanDeMeyer/kernel-install
Browse files Browse the repository at this point in the history
Set up proper environment variables for kernel-install
  • Loading branch information
DaanDeMeyer authored Jul 30, 2024
2 parents 8312df8 + 04b240d commit fa27a82
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mkosi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ def install_distribution(context: Context) -> None:
# should not be read from or written to.
with umask(~0o500):
(context.root / "efi").mkdir(exist_ok=True)
(context.root / "boot").mkdir(exist_ok=True)

# Ensure /boot/loader/entries.srel exists and has type1 written to it to nudge kernel-install towards using
# the boot loader specification layout.
with umask(~0o700):
(context.root / "boot/loader").mkdir(exist_ok=True)
with umask(~0o600):
(context.root / "boot/loader/entries.srel").write_text("type1\n")

if context.config.packages:
context.config.distribution.install_packages(context, context.config.packages)
Expand Down Expand Up @@ -2311,7 +2319,7 @@ def find_entry_token(context: Context) -> str:
["kernel-install", "--root=/buildroot", "--json=pretty", "inspect"],
sandbox=context.sandbox(binary="kernel-install", mounts=[Mount(context.root, "/buildroot", ro=True)]),
stdout=subprocess.PIPE,
env={"SYSTEMD_ESP_PATH": "/efi", "SYSTEMD_XBOOTLDR_PATH": "/boot"},
env={"BOOT_ROOT": "/boot"},
).stdout
)

Expand Down
8 changes: 8 additions & 0 deletions mkosi/installer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ def finalize_environment(cls, context: Context) -> dict[str, str]:
context.config.bootable != ConfigFeature.disabled
):
env["KERNEL_INSTALL_BYPASS"] = "1"
else:
env |= {
"BOOT_ROOT": "/boot",
# Required to make 90-loaderentry.install put the right paths into the bootloader entry.
"BOOT_MNT": "/boot",
# Hack to tell dracut to not create a hostonly initrd when it's invoked by kernel-install.
"hostonly_l": "no",
}

return env

Expand Down

0 comments on commit fa27a82

Please sign in to comment.