naccyde / rpms / systemd

Forked from rpms/systemd 11 months ago
Clone
594167
From 2d3b47dcd5a4b356c481f89c483db3eb308fcab9 Mon Sep 17 00:00:00 2001
594167
From: Jan Janssen <medhefgo@web.de>
594167
Date: Tue, 28 Dec 2021 13:10:39 +0100
594167
Subject: [PATCH] boot: Build BCD parser only on arches supported by Windows
594167
594167
(cherry picked from commit 77fcf28cb88b302453b4c991a6571cb37f10634d)
594167
594167
Related: #2017035
594167
---
594167
 src/boot/efi/boot.c      |  2 ++
594167
 src/boot/efi/meson.build | 21 ++++++++++++---------
594167
 2 files changed, 14 insertions(+), 9 deletions(-)
594167
594167
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
594167
index 0286914b8b..83358406f2 100644
594167
--- a/src/boot/efi/boot.c
594167
+++ b/src/boot/efi/boot.c
594167
@@ -1941,6 +1941,7 @@ static void config_entry_add_osx(Config *config) {
594167
 }
594167
 
594167
 static void config_entry_add_windows(Config *config, EFI_HANDLE *device, EFI_FILE *root_dir) {
594167
+#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
594167
         _cleanup_freepool_ CHAR8 *bcd = NULL;
594167
         CHAR16 *title = NULL;
594167
         EFI_STATUS err;
594167
@@ -1961,6 +1962,7 @@ static void config_entry_add_windows(Config *config, EFI_HANDLE *device, EFI_FIL
594167
         config_entry_add_loader_auto(config, device, root_dir, NULL,
594167
                                      L"auto-windows", 'w', title ?: L"Windows Boot Manager",
594167
                                      L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi");
594167
+#endif
594167
 }
594167
 
594167
 static void config_entry_add_linux(
594167
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
594167
index e628068596..6a0c8da9ba 100644
594167
--- a/src/boot/efi/meson.build
594167
+++ b/src/boot/efi/meson.build
594167
@@ -331,7 +331,6 @@ common_sources = [
594167
         'util.c']
594167
 
594167
 systemd_boot_sources = [
594167
-        'bcd.c',
594167
         'boot.c',
594167
         'console.c',
594167
         'drivers.c',
594167
@@ -351,6 +350,18 @@ else
594167
         stub_sources += 'linux.c'
594167
 endif
594167
 
594167
+# BCD parser only makes sense on arches that Windows supports.
594167
+if efi_arch[1] in ['ia32', 'x86_64', 'arm', 'aarch64']
594167
+        systemd_boot_sources += 'bcd.c'
594167
+        tests += [
594167
+                [['src/boot/efi/test-bcd.c'],
594167
+                 [],
594167
+                 [libzstd],
594167
+                 [],
594167
+                 'HAVE_ZSTD'],
594167
+        ]
594167
+endif
594167
+
594167
 systemd_boot_objects = []
594167
 stub_objects = []
594167
 foreach file : fundamental_source_paths + common_sources + systemd_boot_sources + stub_sources
594167
@@ -408,14 +419,6 @@ endforeach
594167
 
594167
 ############################################################
594167
 
594167
-tests += [
594167
-        [['src/boot/efi/test-bcd.c'],
594167
-         [],
594167
-         [libzstd],
594167
-         [],
594167
-         'HAVE_ZSTD'],
594167
-]
594167
-
594167
 test_efi_disk_img = custom_target(
594167
         'test-efi-disk.img',
594167
         input : [efi_stubs[0][0], efi_stubs[1][1]],