]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
arch: Move bios kernel-install workaround to install function
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 15 Jul 2022 21:01:46 +0000 (23:01 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 27 Jul 2022 14:29:59 +0000 (16:29 +0200)
We can already create the symlinks early in the install function.
This removes one more distribution specific check.

mkosi/__init__.py

index c569e7de01264bf265e733b35124064fa96dfcce..7607b35a3d4e0895c3b43effc42a7b3d7a9b52da 100644 (file)
@@ -2970,6 +2970,14 @@ def install_arch(args: MkosiArgs, root: Path, do_run_build_script: bool) -> None
     # systemd-nspawn containers. See https://bugs.archlinux.org/task/45903.
     disable_pam_securetty(root)
 
+    # grub expects the kernel image and initramfs to be located in the /boot folder so let's create some
+    # symlinks in /boot that point to where kernel-install will store the kernel image and initramfs.
+    if "bios" in args.boot_protocols:
+        for kver, _ in gen_kernel_images(args, root):
+            boot_dir = Path("/") / boot_directory(args, kver)
+            root.joinpath(f"boot/vmlinuz-{kver}").symlink_to(boot_dir / "linux")
+            root.joinpath(f"boot/initramfs-{kver}.img").symlink_to(boot_dir / "initrd")
+
 
 @complete_step("Installing openSUSE…")
 def install_opensuse(args: MkosiArgs, root: Path, do_run_build_script: bool) -> None:
@@ -7201,11 +7209,6 @@ def run_kernel_install(args: MkosiArgs, root: Path, do_run_build_script: bool, f
             run_workspace_command(args, root, ["kernel-install", "add", kver, Path("/") / kimg],
                                   env=args.environment)
 
-            if args.distribution == Distribution.arch and "bios" in args.boot_protocols:
-                boot_dir = Path("/") / boot_directory(args, kver)
-                root.joinpath(f"boot/vmlinuz-{kver}").symlink_to(boot_dir / "linux")
-                root.joinpath(f"boot/initramfs-{kver}.img").symlink_to(boot_dir / "initrd")
-
 
 @dataclasses.dataclass
 class BuildOutput: