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
This commit is contained in:
Dominique Leuenberger 2019-04-08 19:22:48 +00:00 committed by Git OBS Bridge
parent a2c51051ca
commit 0cb28681d1
4 changed files with 127 additions and 0 deletions

View File

@ -0,0 +1,74 @@
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

View File

@ -0,0 +1,29 @@
From f8bbcefe3eed253cda0c86a4c2443292beca82ee Mon Sep 17 00:00:00 2001
From: Gary Lin <glin@suse.com>
Date: Thu, 28 Mar 2019 15:26:28 +0800
Subject: [PATCH] Change the path to shim.efi
For openSUSE/SLE, we use shim.efi instead of shimx64.efi.
Signed-off-by: Gary Lin <glin@suse.com>
---
plugins/uefi/fu-uefi-bootmgr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/plugins/uefi/fu-uefi-bootmgr.c b/plugins/uefi/fu-uefi-bootmgr.c
index 7bec311..22357d4 100644
--- a/plugins/uefi/fu-uefi-bootmgr.c
+++ b/plugins/uefi/fu-uefi-bootmgr.c
@@ -319,7 +319,8 @@ fu_uefi_bootmgr_bootnext (const gchar *esp_path, FuUefiBootmgrFlags flags, GErro
return FALSE;
/* test to make sure shim is there if we need it */
- shim_app = fu_uefi_get_esp_app_path (esp_path, "shim", error);
+ shim_app = g_strdup_printf ("%s/shim.efi",
+ fu_uefi_get_esp_path_for_os (esp_path));
if (shim_app == NULL)
return FALSE;
if (!g_file_test (shim_app, G_FILE_TEST_EXISTS)) {
--
2.21.0

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu Mar 28 07:31:49 UTC 2019 - Gary Ching-Pang Lin <glin@suse.com>
- Add fwupd-bsc1130056-change-esp-os-name.patch to change the
OS directory in ESP (bsc#1130056)
- Add fwupd-bsc1130056-change-shim-path.patch to set the default
shim binary for openSUSE/SLE (bsc#1130056)
- Link fwupd*.efi.signed to fwupd*.efi as requested by fwupd
(bsc#1129466)
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Feb 5 23:00:20 UTC 2019 - Bernhard Voelker <mail@bernhard-voelker.de> Tue Feb 5 23:00:20 UTC 2019 - Bernhard Voelker <mail@bernhard-voelker.de>

View File

@ -35,6 +35,10 @@ License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: System/Management Group: System/Management
URL: https://fwupd.org/ URL: https://fwupd.org/
Source: %{name}-%{version}.tar.xz Source: %{name}-%{version}.tar.xz
# PATCH-FIX-UPSTREAM fwupd-bsc1130056-change-esp-os-name.patch bsc#1130056
Patch1: fwupd-bsc1130056-change-esp-os-name.patch
# PATCH-FIX-OPENSUSE fwupd-bsc1130056-shim-path.patch bsc#1130056
Patch2: fwupd-bsc1130056-change-shim-path.patch
BuildRequires: dejavu-fonts BuildRequires: dejavu-fonts
BuildRequires: docbook-utils-minimal BuildRequires: docbook-utils-minimal
BuildRequires: gcab BuildRequires: gcab
@ -139,6 +143,8 @@ the local machine.
%prep %prep
%setup -q %setup -q
%patch1 -p1
%patch2 -p1
for file in $(grep -l %{_bindir}/env . -r); do for file in $(grep -l %{_bindir}/env . -r); do
sed -i "s|%{_bindir}/env python3|%{_bindir}/python3|" $file sed -i "s|%{_bindir}/env python3|%{_bindir}/python3|" $file
done done
@ -151,6 +157,8 @@ done
-Dplugin_nvme=false \ -Dplugin_nvme=false \
-Dplugin_redfish=false \ -Dplugin_redfish=false \
-Dplugin_uefi=false \ -Dplugin_uefi=false \
%else
-Defi_os_dir="%{efidir}" \
%endif %endif
%ifnarch %{ix86} x86_64 %ifnarch %{ix86} x86_64
-Dplugin_dell=false \ -Dplugin_dell=false \
@ -173,6 +181,12 @@ ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcfwupd-offline-update
# do not package tests # do not package tests
rm -fr %{buildroot}%{_datadir}/installed-tests rm -fr %{buildroot}%{_datadir}/installed-tests
%if %{with efi_fw_update}
# link fwupd*.efi.signed to fwupd*.efi (bsc#1129466)
FWUPD_EFI=`basename %{buildroot}/%{_libexecdir}/fwupd/efi/fwupd*.efi`
ln -s %{_libexecdir}/fwupd/efi/$FWUPD_EFI %{buildroot}/%{_libexecdir}/fwupd/efi/$FWUPD_EFI.signed
%endif
%post -n libfwupd2 -p /sbin/ldconfig %post -n libfwupd2 -p /sbin/ldconfig
%postun -n libfwupd2 -p /sbin/ldconfig %postun -n libfwupd2 -p /sbin/ldconfig
%preun %preun