|
|
4210fa |
From 0ba09477afac58ef2eadc7311440e695e6250029 Mon Sep 17 00:00:00 2001
|
|
|
4210fa |
From: Gary Ching-Pang Lin <glin@suse.com>
|
|
|
4210fa |
Date: Wed, 5 Mar 2014 18:14:09 +0800
|
|
|
4210fa |
Subject: [PATCH 28/74] [fallback] Try to boot the first boot option anyway
|
|
|
4210fa |
|
|
|
4210fa |
Some UEFI implementations never care the boot options, so the
|
|
|
4210fa |
restored boot options could be just ignored and this results in
|
|
|
4210fa |
endless reboot. To avoid this situation, this commit makes
|
|
|
4210fa |
fallback.efi to load the first matched boot option even if there
|
|
|
4210fa |
is no boot option to be restored. It may not be perfect, but at
|
|
|
4210fa |
least the bootloader is loaded...
|
|
|
4210fa |
|
|
|
4210fa |
Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
|
|
|
4210fa |
---
|
|
|
4210fa |
fallback.c | 13 ++++++++++---
|
|
|
4210fa |
1 file changed, 10 insertions(+), 3 deletions(-)
|
|
|
4210fa |
|
|
|
4210fa |
diff --git a/fallback.c b/fallback.c
|
|
|
4210fa |
index 7f242e1..d10fb62 100644
|
|
|
4210fa |
--- a/fallback.c
|
|
|
4210fa |
+++ b/fallback.c
|
|
|
4210fa |
@@ -226,8 +226,9 @@ add_boot_option(EFI_DEVICE_PATH *hddp, EFI_DEVICE_PATH *fulldp,
|
|
|
4210fa |
}
|
|
|
4210fa |
|
|
|
4210fa |
EFI_STATUS
|
|
|
4210fa |
-find_boot_option(EFI_DEVICE_PATH *dp, CHAR16 *filename, CHAR16 *label,
|
|
|
4210fa |
- CHAR16 *arguments, UINT16 *optnum)
|
|
|
4210fa |
+find_boot_option(EFI_DEVICE_PATH *dp, EFI_DEVICE_PATH *fulldp,
|
|
|
4210fa |
+ CHAR16 *filename, CHAR16 *label, CHAR16 *arguments,
|
|
|
4210fa |
+ UINT16 *optnum)
|
|
|
4210fa |
{
|
|
|
4210fa |
unsigned int size = sizeof(UINT32) + sizeof (UINT16) +
|
|
|
4210fa |
StrLen(label)*2 + 2 + DevicePathSize(dp) +
|
|
|
4210fa |
@@ -278,6 +279,12 @@ find_boot_option(EFI_DEVICE_PATH *dp, CHAR16 *filename, CHAR16 *label,
|
|
|
4210fa |
continue;
|
|
|
4210fa |
|
|
|
4210fa |
/* at this point, we have duplicate data. */
|
|
|
4210fa |
+ if (!first_new_option) {
|
|
|
4210fa |
+ first_new_option = DuplicateDevicePath(fulldp);
|
|
|
4210fa |
+ first_new_option_args = arguments;
|
|
|
4210fa |
+ first_new_option_size = StrLen(arguments) * sizeof (CHAR16);
|
|
|
4210fa |
+ }
|
|
|
4210fa |
+
|
|
|
4210fa |
*optnum = i;
|
|
|
4210fa |
FreePool(candidate);
|
|
|
4210fa |
FreePool(data);
|
|
|
4210fa |
@@ -403,7 +410,7 @@ add_to_boot_list(EFI_FILE_HANDLE fh, CHAR16 *dirname, CHAR16 *filename, CHAR16 *
|
|
|
4210fa |
#endif
|
|
|
4210fa |
|
|
|
4210fa |
UINT16 option;
|
|
|
4210fa |
- rc = find_boot_option(dp, fullpath, label, arguments, &option);
|
|
|
4210fa |
+ rc = find_boot_option(dp, full_device_path, fullpath, label, arguments, &option);
|
|
|
4210fa |
if (EFI_ERROR(rc)) {
|
|
|
4210fa |
add_boot_option(dp, full_device_path, fullpath, label, arguments);
|
|
|
4210fa |
} else if (option != 0) {
|
|
|
4210fa |
--
|
|
|
4210fa |
1.9.3
|
|
|
4210fa |
|