]> code.delx.au - refind/commitdiff
New configuration token, deep_uefi_legacy_scan, controls whether to
authorsrs5694 <srs5694@users.sourceforge.net>
Sat, 17 May 2014 02:35:13 +0000 (22:35 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Sat, 17 May 2014 02:35:13 +0000 (22:35 -0400)
modify NVRAM variables in service of BIOS-mode booting on UEFI PCs.

NEWS.txt
docs/refind/configfile.html
refind.conf-sample
refind/config.c
refind/global.h
refind/main.c

index 220ec480eb60e53c3a50e7e8e71b1b946f3bfd97..32b4428da56bcc0ca71aa8caec62f88c4bf7dc36 100644 (file)
--- 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):
 ------------------
 
index a93cd73090a0ee4142ece86e6074e15ea20e6917..2fa7a34a62cf8328b37f1016c208438e5a9405ba 100644 (file)
@@ -284,8 +284,8 @@ timeout 20
 </tr>
 <tr>
    <td><tt>textonly</tt></td>
-   <td>none or <tt>0</tt></td>
-   <td>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 <tt>0</tt> causes text mode to be used; passing a <tt>0</tt> 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.)</td>
+   <td>none or one of <tt>true</tt>, <tt>on</tt>, <tt>1</tt>, <tt>false</tt>, <tt>off</tt>, or <tt>0</tt></td>
+   <td>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 <tt>true</tt>, <tt>on</tt>, or <tt>1</tt>). Passing <tt>false</tt>, <tt>off</tt>, or <tt>0</tt> 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.)</td>
 </tr>
 <tr>
    <td><tt>textmode</tt></td>
@@ -312,6 +312,11 @@ timeout 20
    <td><tt>internal</tt>, <tt>external</tt>, <tt>optical</tt>, <tt>hdbios</tt>, <tt>biosexternal</tt>, <tt>cd</tt>, and <tt>manual</tt></td>
    <td>Tells rEFInd what methods to use to locate boot loaders. The <tt>internal</tt>, <tt>external</tt>, and <tt>optical</tt> parameters tell rEFInd to scan for EFI boot loaders on internal, external, and optical (CD, DVD, and Blu-ray) devices, respectively. The <tt>hdbios</tt>, <tt>biosexternal</tt>, and <tt>cd</tt> 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 <a href="using.html">Using rEFInd</a> page.) The <tt>manual</tt> 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 <tt>internal, external, optical, manual</tt> on most systems, but <tt>internal, hdbios, external, biosexternal, optical, cd, manual</tt> on Macs.</td>
 </tr>
+<tr>
+   <td><tt>deep_uefi_legacy_scan</tt></td>
+   <td>none or one of <tt>true</tt>, <tt>on</tt>, <tt>1</tt>, <tt>false</tt>, <tt>off</tt>, or <tt>0</tt></td>
+   <td>Tells rEFInd how aggressively to scan for BIOS/CSM/legacy boot loaders on UEFI-based PCs. Ordinarily or if this option is set to <tt>false</tt>, <tt>off</tt>, or <tt>0</tt>, rEFInd presents only those options that were available in the NVRAM when it launched. When uncommented with no option or with <tt>true</tt>, <tt>on</tt>, or <tt>1</tt> set, rEFInd adds every possible BIOS-mode boot device (of types specified by <tt>scanfor</tt>) 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.</td>
+</tr>
 <tr>
    <td><tt>scan_delay</tt></td>
    <td>numeric (integer) value</td>
@@ -344,8 +349,8 @@ timeout 20
 </tr>
 <tr>
    <td><tt>scan_all_linux_kernels</tt></td>
-   <td>none or <tt>0</tt></td>
-   <td>When set, causes rEFInd to add Linux kernels (files with names that begin with <tt>vmlinuz</tt> or <tt>bzImage</tt>) to the list of EFI boot loaders, even if they lack <tt>.efi</tt> 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 <tt>.efi</tt>. Of course, the kernels must still be stored on a filesystem that rEFInd can read, and in a directory that it scans. (<a href="drivers.html">Drivers</a> and the <tt>also_scan_dirs</tt> 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 <tt>0</tt> causes scans for all kernels to occur; passing a <tt>0</tt> causes these kernels to not be scanned. (This could be useful if you want to override a setting of <tt>scan_all_linux_kernels</tt> in an included secondary configuration file.)</td>
+   <td>none or one of <tt>true</tt>, <tt>on</tt>, <tt>1</tt>, <tt>false</tt>, <tt>off</tt>, or <tt>0</tt></td>
+   <td>When uncommented or set to <tt>true</tt>, <tt>on</tt>, or <tt>1</tt>, causes rEFInd to add Linux kernels (files with names that begin with <tt>vmlinuz</tt> or <tt>bzImage</tt>) to the list of EFI boot loaders, even if they lack <tt>.efi</tt> 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 <tt>.efi</tt>. Of course, the kernels must still be stored on a filesystem that rEFInd can read, and in a directory that it scans. (<a href="drivers.html">Drivers</a> and the <tt>also_scan_dirs</tt> 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 <tt>false</tt>, <tt>off</tt>, or <tt>0</tt> causes these kernels to not be scanned. (This could be useful if you want to override a setting of <tt>scan_all_linux_kernels</tt> in an included secondary configuration file.)</td>
 </tr>
 <tr>
    <td><tt>max_tags</tt></td>
index 825489046b936444118c49168609196eb8e2e1e3..e06c5c3eb39d74641db239950d6e64e5f1fcfc6c 100644 (file)
@@ -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,
index 72bffd7f05ef6cbb28be7a17a20fd74409d5c6b3..bb5a53d076c6a2f65f501a5b36c28d9064d8faf4 100644 (file)
@@ -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));
index f8575530f075ac62cf1ebf4a80cc0edd252373da..e7aee6255f9f02d4b740230f12582eb84f255a91 100644 (file)
@@ -246,6 +246,7 @@ typedef struct {
 typedef struct {
    BOOLEAN     TextOnly;
    BOOLEAN     ScanAllLinux;
+   BOOLEAN     DeepLegacyScan;
    UINTN       RequestedScreenWidth;
    UINTN       RequestedScreenHeight;
    UINTN       BannerBottomEdge;
index d01b0deebaccedddd3138d17417b3be6bbe9dbf6..45d544cdf31d99609c801fe52e2c6a6b16043ac3 100644 (file)
@@ -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