summaryrefslogtreecommitdiffstats
path: root/common/recipes-bsp
diff options
context:
space:
mode:
authorMikko Ylinen <mikko.ylinen@linux.intel.com>2017-02-28 12:35:12 +0200
committerSaul Wold <sgw@linux.intel.com>2017-03-13 09:17:14 -0700
commitdf8aa97ec59a800efa660697b3760fbbf17e4c7a (patch)
treeadb392e0eddb458f79f833436e5458a945e8d4f7 /common/recipes-bsp
parent54df72f06e4a946f4bc403c67313f4cb385b4301 (diff)
downloadmeta-intel-df8aa97ec59a800efa660697b3760fbbf17e4c7a.tar.gz
systemd-boot: stub: check LoadOptions contains data
With some UEFI shells LoadOptionsSize is reported being > 0 but the corresponding LoadOptions does not contain any data (the first element has value 0). When that happens, the stub feature that allows .cmdline to be replaced by what's in LoadOptions ends up copying nothing/random data to the kernel cmdline resulting in different kinds of boot problems. To fix this, add a check to see if LoadOptions contains data before replacing the .cmdline. Upstream-Status: Accepted [https://github.com/systemd/systemd/pull/5467] Fixes [YOCTO #11078]. Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'common/recipes-bsp')
-rw-r--r--common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch42
-rw-r--r--common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend1
2 files changed, 43 insertions, 0 deletions
diff --git a/common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch b/common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch
new file mode 100644
index 00000000..69acc8f8
--- /dev/null
+++ b/common/recipes-bsp/systemd-boot/systemd-boot/0001-sd-boot-stub-check-LoadOptions-contains-data.patch
@@ -0,0 +1,42 @@
1From 87cd5a5e0f06ceb7f9dbdcc4029e0c279a38e6ad Mon Sep 17 00:00:00 2001
2From: Mikko Ylinen <mikko.ylinen@linux.intel.com>
3Date: Mon, 27 Feb 2017 10:04:03 +0200
4Subject: [PATCH] sd-boot: stub: check LoadOptions contains data
5
6With some UEFI shells LoadOptionsSize is reported being > 0
7but the corresponding LoadOptions does not contain any data
8(the first element has value 0).
9
10When that happens, the stub feature that allows .cmdline to be
11replaced by what's in LoadOptions ends up copying nothing/random
12data to the kernel cmdline resulting in different kinds of boot
13problems.
14
15To fix this, add a check to see if LoadOptions contains data
16before replacing the .cmdline.
17
18Upstream-Status: Accepted [https://github.com/systemd/systemd/pull/5467]
19
20Fixes [YOCTO #11078].
21
22Signed-off-by: Mikko Ylinen <mikko.ylinen@linux.intel.com>
23---
24 src/boot/efi/stub.c | 2 +-
25 1 file changed, 1 insertion(+), 1 deletion(-)
26
27diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c
28index 7c1ffb1bc..b7d5d3cda 100644
29--- a/src/boot/efi/stub.c
30+++ b/src/boot/efi/stub.c
31@@ -87,7 +87,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
32 cmdline_len = szs[0];
33
34 /* if we are not in secure boot mode, accept a custom command line and replace the built-in one */
35- if (!secure && loaded_image->LoadOptionsSize > 0) {
36+ if (!secure && loaded_image->LoadOptionsSize > 0 && *(CHAR16 *)loaded_image->LoadOptions != 0) {
37 CHAR16 *options;
38 CHAR8 *line;
39 UINTN i;
40--
412.11.0
42
diff --git a/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend b/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
index 0db67b13..98eaf45e 100644
--- a/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
+++ b/common/recipes-bsp/systemd-boot/systemd-boot_%.bbappend
@@ -20,6 +20,7 @@ SRC_URI_append_intel-x86-common = " \
20 file://0003-sd-boot-Support-global-kernel-command-line-fragment.patch \ 20 file://0003-sd-boot-Support-global-kernel-command-line-fragment.patch \
21 file://0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch \ 21 file://0004-sd-boot-Support-global-kernel-command-line-fragment-in-EFI-stub.patch \
22 file://0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch \ 22 file://0001-efi-boot.c-workaround-for-Joule-BIOS-hang.patch \
23 file://0001-sd-boot-stub-check-LoadOptions-contains-data.patch \
23 " 24 "
24 25
25PACKAGE_ARCH_intel-x86-common = "${INTEL_COMMON_PACKAGE_ARCH}" 26PACKAGE_ARCH_intel-x86-common = "${INTEL_COMMON_PACKAGE_ARCH}"