Skip to contentSkip to conversation

grub-install: Allow to install to non-EFI ESP when --force

PATCH In review Icenowy Zheng 2 participants 2 messages Apr 24, 2022 – Apr 27, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 grub-install: Allow to install to non-EFI ESP when --force

Although the EFI specification enforces support for FAT ESP, it's free for EFI implementations to implement support for ESPs with other formats (e.g. ext4, ntfs, etc), and at least U-Boot EFI will support ext4 ESP if U-Boot is built with ext4 support. In some situations a GRUB installation on such a non-FAT ESP could be useful (e.g. a NTFS-based USB disk that can dual boot a Windows installation media and a Linux LiveCD).

As this is advanced and implementation-dependent behavior, let grub-install allow this kind of installation, but only when --force is specified.

---
 util/grub-install.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
util/grub-install.c +9 -1
index d601c3e8d..1f5d58b2b 100644
@@ -1092,7 +1092,15 @@ main (int argc, char *argv[])
 	efidir_is_mac = 1;
 
       if (!efidir_is_mac && grub_strcmp (fs->name, "fat") != 0)
-	grub_util_error (_("%s doesn't look like an EFI partition"), efidir);
+	{
+	  if (force)
+	    grub_util_warn (_
+			    ("%s doesn't look like an EFI partition, system may not boot"),
+			    efidir);
+	  else
+	    grub_util_error (_("%s doesn't look like an EFI partition"),
+			     efidir);
+	}
 
       /* The EFI specification requires that an EFI System Partition must
 	 contain an "EFI" subdirectory, and that OS loaders are stored in
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Icenowy Zheng

Although the EFI specification enforces support for FAT ESP, it's free for EFI implementations to implement support for ESPs with other formats (e.g. ext4, ntfs, etc), and at least U-Boot EFI will support ext4 ESP if U-Boot is built with ext4 support. In some situations a GRUB installation on such a non-FAT ESP could be useful (e.g. a NTFS-based USB disk that can dual boot a Windows installation media and a Linux LiveCD).

Quoted 5 lines

As this is advanced and implementation-dependent behavior, let grub-install allow this kind of installation, but only when --force is specified.

Daniel