From: srs5694 Date: Sat, 17 May 2014 02:35:13 +0000 (-0400) Subject: New configuration token, deep_uefi_legacy_scan, controls whether to X-Git-Url: https://code.delx.au/refind/commitdiff_plain/9a669ad3b5fb341500d76d487c38a7102eb01b3d New configuration token, deep_uefi_legacy_scan, controls whether to modify NVRAM variables in service of BIOS-mode booting on UEFI PCs. --- diff --git a/NEWS.txt b/NEWS.txt index 220ec48..32b4428 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,3 +1,14 @@ +0.8.2 (5/??/2014): +------------------ + +- Added "deep_uefi_legacy_scan" token. When not set (the default), rEFInd + does not modify EFI NVRAM settings when scanning for BIOS-mode boot + loaders on UEFI-based (non-Mac) computers. Some computers require + uncommenting this setting for rEFInd to reliably detect some BIOS-mode + boot devices. Passing "0", "off", or "false" as an option resets it to + the default value (useful in a loaded secondary configuration file to + override a setting in the main file). + 0.8.1 (5/15/2014): ------------------ diff --git a/docs/refind/configfile.html b/docs/refind/configfile.html index a93cd73..2fa7a34 100644 --- a/docs/refind/configfile.html +++ b/docs/refind/configfile.html @@ -284,8 +284,8 @@ timeout 20 textonly - none or 0 - rEFInd defaults to a graphical mode; however, if you prefer to do without the flashy graphics, you can run it in text mode by including this option. Passing any option but 0 causes text mode to be used; passing a 0 causes graphics mode to be used. (This could be useful if you want to override a text-mode setting in an included secondary configuration file.) + none or one of true, on, 1, false, off, or 0 + rEFInd defaults to a graphical mode; however, if you prefer to do without the flashy graphics, you can run it in text mode by including this option (alone or with true, on, or 1). Passing false, off, or 0 causes graphics mode to be used. (This could be useful if you want to override a text-mode setting in an included secondary configuration file.) textmode @@ -312,6 +312,11 @@ timeout 20 internal, external, optical, hdbios, biosexternal, cd, and manual Tells rEFInd what methods to use to locate boot loaders. The internal, external, and optical parameters tell rEFInd to scan for EFI boot loaders on internal, external, and optical (CD, DVD, and Blu-ray) devices, respectively. The hdbios, biosexternal, and cd parameters are similar, but scan for BIOS boot loaders. (Note that the BIOS options scan more thoroughly and actively on Macs than on UEFI-based PCs; for the latter, only options in the firmware's boot list are scanned, as described on the Using rEFInd page.) The manual parameter tells rEFInd to scan the configuration file for manual settings. You can specify multiple parameters to have the program scan for multiple boot loader types. When you do so, the order determines the order in which the boot loaders appear in the menu. The default is internal, external, optical, manual on most systems, but internal, hdbios, external, biosexternal, optical, cd, manual on Macs. + + deep_uefi_legacy_scan + none or one of true, on, 1, false, off, or 0 + Tells rEFInd how aggressively to scan for BIOS/CSM/legacy boot loaders on UEFI-based PCs. Ordinarily or if this option is set to false, off, or 0, rEFInd presents only those options that were available in the NVRAM when it launched. When uncommented with no option or with true, on, or 1 set, rEFInd adds every possible BIOS-mode boot device (of types specified by scanfor) as a BIOS/CSM/legacy boot option. This latter behavior is sometimes required to detect USB flash drives or hard disks beyond the first one. + scan_delay numeric (integer) value @@ -344,8 +349,8 @@ timeout 20 scan_all_linux_kernels - none or 0 - When set, causes rEFInd to add Linux kernels (files with names that begin with vmlinuz or bzImage) to the list of EFI boot loaders, even if they lack .efi filename extensions. This simplifies use of rEFInd on most Linux distributions, which usually provide kernels with EFI stub loader support but don't give those kernels names that end in .efi. Of course, the kernels must still be stored on a filesystem that rEFInd can read, and in a directory that it scans. (Drivers and the also_scan_dirs options can help with those issues.) As of version 0.5.0, this option is enabled in the default configuration file. The program default remains to not scan for such kernels, though, so you can delete or uncomment this option to keep them from appearing in your boot menu. Passing any option but 0 causes scans for all kernels to occur; passing a 0 causes these kernels to not be scanned. (This could be useful if you want to override a setting of scan_all_linux_kernels in an included secondary configuration file.) + none or one of true, on, 1, false, off, or 0 + When uncommented or set to true, on, or 1, causes rEFInd to add Linux kernels (files with names that begin with vmlinuz or bzImage) to the list of EFI boot loaders, even if they lack .efi filename extensions. This simplifies use of rEFInd on most Linux distributions, which usually provide kernels with EFI stub loader support but don't give those kernels names that end in .efi. Of course, the kernels must still be stored on a filesystem that rEFInd can read, and in a directory that it scans. (Drivers and the also_scan_dirs options can help with those issues.) As of version 0.5.0, this option is enabled in the default configuration file. The program default remains to not scan for such kernels, though, so you can delete or uncomment this option to keep them from appearing in your boot menu. Passing false, off, or 0 causes these kernels to not be scanned. (This could be useful if you want to override a setting of scan_all_linux_kernels in an included secondary configuration file.) max_tags diff --git a/refind.conf-sample b/refind.conf-sample index 8254890..e06c5c3 100644 --- a/refind.conf-sample +++ b/refind.conf-sample @@ -207,6 +207,15 @@ timeout 20 # #scanfor internal,external,optical,manual +# By default, rEFInd relies on the UEFI firmware to detect BIOS-mode boot +# devices. This sometimes doesn't detect all the available devices, though. +# For these cases, deep_uefi_legacy_scan results in a forced scan and +# modification of NVRAM variables on each boot. Adding "0", "off", or +# "false" resets to the default value. This token has no effect on Macs or +# when no BIOS-mode options are set via scanfor. +# Default is unset (or "deep_uefi_legacy_scan true") +#deep_uefi_legacy_scan + # Delay for the specified number of seconds before scanning disks. # This can help some users who find that some of their disks # (usually external or optical discs) aren't detected initially, diff --git a/refind/config.c b/refind/config.c index 72bffd7..bb5a53d 100644 --- a/refind/config.c +++ b/refind/config.c @@ -372,6 +372,18 @@ static UINTN HandleTime(IN CHAR16 *TimeString) { return (Hour * 60 + Minute); } // BOOLEAN HandleTime() +static BOOLEAN HandleBoolean(IN CHAR16 **TokenList, IN UINTN TokenCount) { + BOOLEAN TruthValue = TRUE; + + if ((TokenCount >= 2) && ((StriCmp(TokenList[1], L"0") == 0) || + (StriCmp(TokenList[1], L"false") == 0) || + (StriCmp(TokenList[1], L"off") == 0))) { + TruthValue = FALSE; + } // if + + return TruthValue; +} // BOOLEAN HandleBoolean + // Sets the default boot loader IF the current time is within the bounds // defined by the third and fourth tokens in the TokenList. static VOID SetDefaultByTime(IN CHAR16 **TokenList, OUT CHAR16 **Default) { @@ -498,6 +510,9 @@ VOID ReadConfig(CHAR16 *FileName) GlobalConfig.ScanFor[i] = ' '; } + } else if (StriCmp(TokenList[0], L"deep_uefi_legacy_scan") == 0) { + GlobalConfig.DeepLegacyScan = HandleBoolean(TokenList, TokenCount); + } else if ((StriCmp(TokenList[0], L"scan_delay") == 0) && (TokenCount == 2)) { HandleInt(TokenList, TokenCount, &(GlobalConfig.ScanDelay)); @@ -595,11 +610,12 @@ VOID ReadConfig(CHAR16 *FileName) } } else if (StriCmp(TokenList[0], L"textonly") == 0) { - if ((TokenCount >= 2) && (StriCmp(TokenList[1], L"0") == 0)) { - GlobalConfig.TextOnly = FALSE; - } else { - GlobalConfig.TextOnly = TRUE; - } + GlobalConfig.TextOnly = HandleBoolean(TokenList, TokenCount); +// if ((TokenCount >= 2) && (StriCmp(TokenList[1], L"0") == 0)) { +// GlobalConfig.TextOnly = FALSE; +// } else { +// GlobalConfig.TextOnly = TRUE; +// } } else if (StriCmp(TokenList[0], L"textmode") == 0) { HandleInt(TokenList, TokenCount, &(GlobalConfig.RequestedTextMode)); @@ -635,11 +651,12 @@ VOID ReadConfig(CHAR16 *FileName) egLoadFont(TokenList[1]); } else if (StriCmp(TokenList[0], L"scan_all_linux_kernels") == 0) { - if ((TokenCount >= 2) && (StriCmp(TokenList[1], L"0") == 0)) { - GlobalConfig.ScanAllLinux = FALSE; - } else { - GlobalConfig.ScanAllLinux = TRUE; - } + GlobalConfig.ScanAllLinux = HandleBoolean(TokenList, TokenCount); +// if ((TokenCount >= 2) && (StriCmp(TokenList[1], L"0") == 0)) { +// GlobalConfig.ScanAllLinux = FALSE; +// } else { +// GlobalConfig.ScanAllLinux = TRUE; +// } } else if (StriCmp(TokenList[0], L"max_tags") == 0) { HandleInt(TokenList, TokenCount, &(GlobalConfig.MaxTags)); diff --git a/refind/global.h b/refind/global.h index f857553..e7aee62 100644 --- a/refind/global.h +++ b/refind/global.h @@ -246,6 +246,7 @@ typedef struct { typedef struct { BOOLEAN TextOnly; BOOLEAN ScanAllLinux; + BOOLEAN DeepLegacyScan; UINTN RequestedScreenWidth; UINTN RequestedScreenHeight; UINTN BannerBottomEdge; diff --git a/refind/main.c b/refind/main.c index d01b0de..45d544c 100644 --- a/refind/main.c +++ b/refind/main.c @@ -139,7 +139,7 @@ static REFIT_MENU_SCREEN MainMenu = { L"Main Menu", NULL, 0, NULL, 0, NULL L"Insert or F2 for more options; Esc to refresh" }; static REFIT_MENU_SCREEN AboutMenu = { L"About", NULL, 0, NULL, 0, NULL, 0, NULL, L"Press Enter to return to main menu", L"" }; -REFIT_CONFIG GlobalConfig = { FALSE, FALSE, 0, 0, 0, DONT_CHANGE_TEXT_MODE, 20, 0, 0, GRAPHICS_FOR_OSX, LEGACY_TYPE_MAC, 0, 0, +REFIT_CONFIG GlobalConfig = { FALSE, FALSE, FALSE, 0, 0, 0, DONT_CHANGE_TEXT_MODE, 20, 0, 0, GRAPHICS_FOR_OSX, LEGACY_TYPE_MAC, 0, 0, { DEFAULT_BIG_ICON_SIZE / 4, DEFAULT_SMALL_ICON_SIZE, DEFAULT_BIG_ICON_SIZE }, BANNER_NOSCALE, NULL, NULL, CONFIG_FILE_NAME, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, { TAG_SHELL, TAG_MEMTEST, TAG_GDISK, TAG_APPLE_RECOVERY, TAG_WINDOWS_RECOVERY, TAG_MOK_TOOL, @@ -168,7 +168,7 @@ static VOID AboutrEFInd(VOID) if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.1"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.1.1"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2014 Roderick W. Smith"); @@ -1737,9 +1737,6 @@ static LEGACY_ENTRY * AddLegacyEntry(IN CHAR16 *LoaderTitle, IN REFIT_VOLUME *Vo } /* static LEGACY_ENTRY * AddLegacyEntry() */ -// #ifdef __MAKEWITH_GNUEFI -// static VOID ScanLegacyUEFI(IN UINTN DiskType){} -// #else // default volume badge icon based on disk kind static EG_IMAGE * GetDiskBadge(IN UINTN DiskType) { EG_IMAGE * Badge = NULL; @@ -1891,7 +1888,6 @@ static VOID ScanLegacyUEFI(IN UINTN DiskType) Index++; } // while } /* static VOID ScanLegacyUEFI() */ -//#endif // __MAKEWITH_GNUEFI static VOID ScanLegacyVolume(REFIT_VOLUME *Volume, UINTN VolumeIndex) { UINTN VolumeIndex2; @@ -2214,8 +2210,8 @@ static VOID ScanForBootloaders(VOID) { ScanForLegacy = TRUE; } // for - // If UEFI & scanning for legacy loaders, update NVRAM boot manager list - if ((GlobalConfig.LegacyType == LEGACY_TYPE_UEFI) && ScanForLegacy) { + // If UEFI & scanning for legacy loaders & deep legacy scan, update NVRAM boot manager list + if ((GlobalConfig.LegacyType == LEGACY_TYPE_UEFI) && ScanForLegacy && GlobalConfig.DeepLegacyScan) { BdsDeleteAllInvalidLegacyBootOptions(); BdsAddNonExistingLegacyBootOptions(); } // if