shim: don't set CSV boot entry as the first boot option

Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
This commit is contained in:
Lans Zhang
2017-08-01 13:13:06 +08:00
parent 7f3143523d
commit a3e1038d71
2 changed files with 50 additions and 0 deletions
@@ -0,0 +1,49 @@
From 9f6d9f6b7f88b9d15dd2f25ae7f16b68a980922a Mon Sep 17 00:00:00 2001
From: Lans Zhang <jia.zhang@windriver.com>
Date: Tue, 1 Aug 2017 10:25:45 +0800
Subject: [PATCH] fallback: don't set the csv entry as the first boot by
default
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
---
fallback.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/fallback.c b/fallback.c
index 8c408fd..c39f280 100644
--- a/fallback.c
+++ b/fallback.c
@@ -138,6 +138,11 @@ make_full_path(CHAR16 *dirname, CHAR16 *filename, CHAR16 **out, UINT64 *outlen)
CHAR16 *bootorder = NULL;
int nbootorder = 0;
+#ifdef FALLBACK_RUN_AS_FIRST_BOOT
+UINTN run_as_first_boot = 1;
+#else
+UINTN run_as_first_boot = 0;
+#endif
EFI_DEVICE_PATH *first_new_option = NULL;
VOID *first_new_option_args = NULL;
UINTN first_new_option_size = 0;
@@ -199,6 +204,9 @@ add_boot_option(EFI_DEVICE_PATH *hddp, EFI_DEVICE_PATH *fulldp,
return rc;
}
+ if (!run_as_first_boot)
+ return EFI_SUCCESS;
+
CHAR16 *newbootorder = AllocateZeroPool(sizeof (CHAR16)
* (nbootorder + 1));
if (!newbootorder)
@@ -414,7 +422,7 @@ add_to_boot_list(EFI_FILE_HANDLE fh, CHAR16 *dirname, CHAR16 *filename, CHAR16 *
rc = find_boot_option(dp, full_device_path, fullpath, label, arguments, &option);
if (EFI_ERROR(rc)) {
add_boot_option(dp, full_device_path, fullpath, label, arguments);
- } else if (option != 0) {
+ } else if (run_as_first_boot && option != 0) {
CHAR16 *newbootorder;
newbootorder = AllocateZeroPool(sizeof (CHAR16) * nbootorder);
if (!newbootorder)
--
2.7.5
@@ -32,6 +32,7 @@ SRC_URI = "\
file://0011-Update-verification_method-if-the-loaded-image-is-si.patch;apply=0 \
file://0012-netboot-replace-the-depreciated-EFI_PXE_BASE_CODE.patch \
file://0013-fallback-allow-to-search-.csv-in-EFI-BOOT.patch \
file://0014-fallback-don-t-set-the-csv-entry-as-the-first-boot-b.patch \
"
SRC_URI_append_x86-64 = "\
${@bb.utils.contains('DISTRO_FEATURES', 'msft', \