fwupd/fwupd-bsc1130056-change-esp-os-name.patch
Dominique Leuenberger 0cb28681d1 Accepting request 689521 from home:gary_lin:branches:Base:System
- change the OS directory in ESP (bsc#1130056)
- set the default shim binary for openSUSE/SLE (bsc#1130056)
- Link fwupd*.efi.signed to fwupd*.efi as requested by fwupd (bsc#1129466)

OBS-URL: https://build.opensuse.org/request/show/689521
OBS-URL: https://build.opensuse.org/package/show/Base:System/fwupd?expand=0&rev=47
2019-04-08 19:22:48 +00:00

75 lines
2.7 KiB
Diff

From 89552eec34eccda2d119465370d07be9fa53092e Mon Sep 17 00:00:00 2001
From: Gary Lin <glin@suse.com>
Date: Thu, 28 Mar 2019 16:20:22 +0800
Subject: [PATCH] uefi: add a new option to specify the os name
fu_uefi_get_esp_path_for_os() generates the path to the OS directory
based on "ID" in /etc/os-release, and it may not work for some distros.
Take openSUSE as an example, the "ID" for openSUSE Leap is
"opensuse-leap" and that for openSUSE Tumbleweed is "opensuse-tumbleweed".
However, both of them use the same OS directory in the ESP, i.e.
"/EFI/opensuse".
This commit adds a new build option, efi_os_dir, to allow the packager to
specify the name of OS directory at build time instead of the runtime
detection.
Signed-off-by: Gary Lin <glin@suse.com>
---
meson_options.txt | 1 +
plugins/uefi/fu-uefi-common.c | 4 ++++
plugins/uefi/meson.build | 5 +++++
3 files changed, 10 insertions(+)
diff --git a/meson_options.txt b/meson_options.txt
index 889a888e..5d4163e8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -28,3 +28,4 @@ option('efi-ld', type : 'string', value : 'ld', description : 'the linker to use
option('efi-libdir', type : 'string', description : 'path to the EFI lib directory')
option('efi-ldsdir', type : 'string', description : 'path to the EFI lds directory')
option('efi-includedir', type : 'string', value : '/usr/include/efi', description : 'path to the EFI header directory')
+option('efi_os_dir', type: 'string', description : 'the name of OS directory in ESP')
diff --git a/plugins/uefi/fu-uefi-common.c b/plugins/uefi/fu-uefi-common.c
index aa1d1105..fadb469f 100644
--- a/plugins/uefi/fu-uefi-common.c
+++ b/plugins/uefi/fu-uefi-common.c
@@ -246,6 +246,7 @@ gchar *
fu_uefi_get_esp_path_for_os (const gchar *esp_path)
{
const gchar *os_release_id = NULL;
+#ifndef EFI_OS_DIR
g_autoptr(GError) error_local = NULL;
g_autoptr(GHashTable) os_release = fwupd_get_os_release (&error_local);
if (os_release != NULL) {
@@ -255,6 +256,9 @@ fu_uefi_get_esp_path_for_os (const gchar *esp_path)
}
if (os_release_id == NULL)
os_release_id = "unknown";
+#else
+ os_release_id = EFI_OS_DIR;
+#endif
return g_build_filename (esp_path, "EFI", os_release_id, NULL);
}
diff --git a/plugins/uefi/meson.build b/plugins/uefi/meson.build
index fd1b3976..8b742864 100644
--- a/plugins/uefi/meson.build
+++ b/plugins/uefi/meson.build
@@ -3,6 +3,11 @@ subdir('efi')
cargs = ['-DG_LOG_DOMAIN="FuPluginUefi"']
cargs += '-DEFI_APP_LOCATION_BUILD="' + app.full_path() + '"'
+efi_os_dir = get_option('efi_os_dir')
+if efi_os_dir != ''
+ cargs += '-DEFI_OS_DIR="' + efi_os_dir + '"'
+endif
+
install_data(['uefi.quirk'],
install_dir: join_paths(datadir, 'fwupd', 'quirks.d')
)
--
2.21.0