main/systemd-boot: add patch to load dtb even if fw is missing config (MR 4509)

Submitted upstream: https://github.com/systemd/systemd/pull/29749

[ci:skip-build] already built successfully in CI
This commit is contained in:
Clayton Craft 2023-10-27 13:15:41 -07:00
parent 22c6020965
commit c748048ef3
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
2 changed files with 54 additions and 1 deletions

View file

@ -0,0 +1,51 @@
From 847a31aa8d6c76e966cb5eceaa57b02e651e2cfc Mon Sep 17 00:00:00 2001
From: Clayton Craft <clayton@craftyguy.net>
Date: Fri, 27 Oct 2023 12:50:50 -0700
Subject: [PATCH] boot: load device tree even if no original config exists
Firmware may not have loaded a devicetree, for example if the device
shipped with windows and exclusively supports ACPI.
We should always load the specified devicetree regardless of firmware
state to enable booting on platforms where Linux only supports DT.
Fixes #24059
Co-authored-by: Daniel Thompson <daniel.thompson@linaro.org>
---
src/boot/efi/devicetree.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/boot/efi/devicetree.c b/src/boot/efi/devicetree.c
index 3916bca946..ef599bd7bc 100644
--- a/src/boot/efi/devicetree.c
+++ b/src/boot/efi/devicetree.c
@@ -72,8 +72,6 @@ EFI_STATUS devicetree_install(struct devicetree_state *state, EFI_FILE *root_dir
assert(name);
state->orig = find_configuration_table(MAKE_GUID_PTR(EFI_DTB_TABLE));
- if (!state->orig)
- return EFI_UNSUPPORTED;
err = root_dir->Open(root_dir, &handle, name, EFI_FILE_MODE_READ, EFI_FILE_READ_ONLY);
if (err != EFI_SUCCESS)
@@ -113,8 +111,6 @@ EFI_STATUS devicetree_install_from_memory(
assert(dtb_buffer && dtb_length > 0);
state->orig = find_configuration_table(MAKE_GUID_PTR(EFI_DTB_TABLE));
- if (!state->orig)
- return EFI_UNSUPPORTED;
err = devicetree_allocate(state, dtb_length);
if (err != EFI_SUCCESS)
@@ -133,7 +129,7 @@ EFI_STATUS devicetree_install_from_memory(
void devicetree_cleanup(struct devicetree_state *state) {
EFI_STATUS err;
- if (!state->pages)
+ if (!state->pages || !state->orig)
return;
err = BS->InstallConfigurationTable(MAKE_GUID_PTR(EFI_DTB_TABLE), state->orig);
--
2.40.1

View file

@ -14,7 +14,7 @@
#
pkgname=systemd-boot
pkgver=254
pkgrel=0
pkgrel=1
pkgdesc="systemd's EFI boot manager and stub"
url="https://systemd.io/"
# TODO:
@ -35,6 +35,7 @@ makedepends="
"
source="
systemd-$pkgver.tar.gz::https://github.com/systemd/systemd/archive/refs/tags/v$pkgver.tar.gz
0001-boot-load-device-tree-even-if-no-original-config-exi.patch
0001-meson-minimal-configure-for-building-systemd-boot.patch
0002-fix-wchar-for-compiling-on-musl.patch
cross-x86.meson
@ -112,6 +113,7 @@ ukify() {
sha512sums="
84b4d16980fe2e64d5c3c95b9b4fbaad1076f368f493fdd745cbafbe7ce825293384f5fa0b6360ba8188da23c4575e87402fb666a3b71f84ff8b323aba0c07ff systemd-254.tar.gz
8ffd9c340568989b32217c9b7db8425d44b2a2116cac9c0e6d1ca5ace921810d01eef9ac8030a460fb7ad54ed2b779355fd861201a32ddd51f768242a3012140 0001-boot-load-device-tree-even-if-no-original-config-exi.patch
e97835fa20b99ae8553b2140a14ed7da14de1e18e98f39718edba64b960a92cc9edcbf89b16bdd6c20ac1566a9c5b9e6203898e104c0312e1aae9b300b116c27 0001-meson-minimal-configure-for-building-systemd-boot.patch
c666b42f37a5710138ebc880c5defa8b5d0645ff78eb1ec685068d7219626af285a64bee78bb9460e31de1ca293c6c051a59a97e58b4335ad2c85a7424518763 0002-fix-wchar-for-compiling-on-musl.patch
ad54e2c7e7a21bfa9b5f9e8db1b6af6a6d78a3e5dfe2dafcec77488f6224865ab4d4c8a8c8ee1c54c99d1741361e9fb3a51e5d36bcbc7a1c3fdcc4d0c1672132 cross-x86.meson