Skip to content

Commit

Permalink
uefi-capsule: Prefer esp volumes over msftdata when choosing the default
Browse files Browse the repository at this point in the history
Fixes #6035
  • Loading branch information
hughsie committed Dec 7, 2023
1 parent 20bfc8f commit 114c6c4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/uefi-capsule/fu-uefi-capsule-plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ fu_uefi_capsule_plugin_get_default_esp(FuPlugin *plugin, GError **error)
FuVolume *esp = g_ptr_array_index(esp_volumes, i);
guint score = 0;
g_autofree gchar *name = NULL;
g_autofree gchar *kind = NULL;
g_autoptr(FuDeviceLocker) locker = NULL;
g_autoptr(GError) error_local = NULL;

Expand All @@ -653,6 +654,11 @@ fu_uefi_capsule_plugin_get_default_esp(FuPlugin *plugin, GError **error)
/* big partitions are better than small partitions */
score += fu_volume_get_size(esp) / (1024 * 1024);

/* prefer partitions with the ESP flag set over msftdata */
kind = fu_volume_get_partition_kind(esp);
if (g_strcmp0(kind, FU_VOLUME_KIND_ESP) == 0)
score += 0x20000;

/* prefer linux ESP */
if (!fu_uefi_capsule_plugin_is_esp_linux(esp, &error_local)) {
g_debug("not a Linux ESP: %s", error_local->message);
Expand Down

0 comments on commit 114c6c4

Please sign in to comment.