From 696e27fb7f12c5ef33acccac55a093ee9bd07ab8 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 10 Dec 2023 19:40:41 +0100 Subject: [PATCH] Write grub BIOS partition definition after ESP definition The BIOS partition is ordered after the ESP so let's write their config file in the same order for clarity. --- mkosi/__init__.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 74e2ff4c5..8993db3ec 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -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"""\ -- 2.47.2