]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Write grub BIOS partition definition after ESP definition 2155/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 10 Dec 2023 18:40:41 +0000 (19:40 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 10 Dec 2023 18:53:46 +0000 (19:53 +0100)
The BIOS partition is ordered after the ESP so let's write their
config file in the same order for clarity.

mkosi/__init__.py

index 74e2ff4c5136c7f9d9d15a2edae5001c5d926c15..8993db3ece15900ad2f23bf60bd5f28d4cc3cb2e 100644 (file)
@@ -2266,25 +2266,11 @@ def make_disk(
             else:
                 bootloader = None
 
-            # If grub for BIOS is installed, let's add a BIOS boot partition onto which we can install grub.
-            bios = (state.config.bootable != ConfigFeature.disabled and want_grub_bios(state))
-
-            if bios:
-                (defaults / "05-bios.conf").write_text(
-                    textwrap.dedent(
-                        f"""\
-                        [Partition]
-                        Type={Partition.GRUB_BOOT_PARTITION_UUID}
-                        SizeMinBytes=1M
-                        SizeMaxBytes=1M
-                        """
-                    )
-                )
-
             esp = (
                 state.config.bootable == ConfigFeature.enabled or
                 (state.config.bootable == ConfigFeature.auto and bootloader and bootloader.exists())
             )
+            bios = (state.config.bootable != ConfigFeature.disabled and want_grub_bios(state))
 
             if esp or bios:
                 # Even if we're doing BIOS, let's still use the ESP to store the kernels, initrds and grub
@@ -2303,6 +2289,19 @@ def make_disk(
                     )
                 )
 
+            # If grub for BIOS is installed, let's add a BIOS boot partition onto which we can install grub.
+            if bios:
+                (defaults / "05-bios.conf").write_text(
+                    textwrap.dedent(
+                        f"""\
+                        [Partition]
+                        Type={Partition.GRUB_BOOT_PARTITION_UUID}
+                        SizeMinBytes=1M
+                        SizeMaxBytes=1M
+                        """
+                    )
+                )
+
             (defaults / "10-root.conf").write_text(
                 textwrap.dedent(
                     f"""\