]> code.delx.au - refind/commitdiff
Fixed (maybe) a Mac-specific bug that caused hangs on returning from
authorsrs5694 <srs5694@users.sourceforge.net>
Sat, 21 Apr 2012 23:40:17 +0000 (19:40 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Sat, 21 Apr 2012 23:40:17 +0000 (19:40 -0400)
the EFI shell.

NEWS.txt
docs/refind/configfile.html
refind/lib.c
refind/main.c

index 71e4ab0b7369d04abab933569f86ff51c7f3ff38..36fb2fb09f0c250bf29fcc53dbe7fb1984914430 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,13 @@
 0.2.8 (?/??/2012):
 ------------------
 
+- Fixed (maybe) a bug that caused rEFInd to crash when returning from an
+  EFI shell or other programs on Macs, particularly when rEFInd used
+  graphical mode. I'm not 100% sure this bug is squashed because I still
+  don't understand the cause and I only have one Mac for testing. See
+  comments in the ReinitRefitLib() function in refit/lib.c for more
+  details.
+
 - Added new refind.conf option: scan_all_linux_kernels, which causes Linux
   kernels that lack ".efi" extensions to be included in scans for EFI boot
   loaders. This may help integration with Linux distributions that don't
index 808302186d31497e4db80dd67fb359a635c577b5..354349e67e1757606fe6665c1c1fe1c38fc61802 100644 (file)
@@ -109,7 +109,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <li>You can place a boot loader in a directory with a name that matches one of rEFInd's standard icons, which take names of the form <tt>os_<tt class="variable">name</tt>.icns</tt>. To use this icon, you would place the boot loader in the directory called <tt class="variable">name</tt>.</li>
 
-<li>You can name an icon file after your boot loader, but with an extension of <tt>.icns</tt>. For instance, if you're using <tt class="variable">loader</tt><tt>.efi</tt>, you would name the icon file <tt class="variable">loader</tt><tt>.icns</tt>. These icon files should be 128x128 images in <a href="http://en.wikipedia.org/wiki/Apple_Icon_Image_format">Apple's ICNS format.</a> You can create such files easily in OS X or convert PNG files to ICNS format with <a href="http://icns.sourceforge.net/">libicns.</a></li>
+<li>You can name an icon file after your boot loader, but with an extension of <tt>.icns</tt>. For instance, if you're using <tt class="variable">loader</tt><tt>.efi</tt>, you would name the icon file <tt class="variable">loader</tt><tt>.icns</tt>. These icon files should be 128x128 images in <a href="http://en.wikipedia.org/wiki/Apple_Icon_Image_format">Apple's ICNS format.</a> You can create such files easily in OS X or convert PNG files to ICNS format with <a href="http://icns.sourceforge.net/">libicns.</a> Note that the <tt>scan_all_linux_kernels</tt> option can cause loader-specific icon files for Linux kernels (but not other loaders) to be improperly assigned loader tags, so if you want to use this option, you should not also assign your kernels custom icons in this way.</li>
 
 <li>If you're booting OS X from its standard boot loader, or if you place a boot loader file in the root directory of a partition, you can create a file called <tt>.VolumeIcon.icns</tt> that holds an icon file. OS X uses this file for its volume icons, so rEFInd picks up these icons automatically, provided they include 128x128 bitmaps.</li>
 
@@ -187,6 +187,11 @@ timeout 20
    <td>directory path(s)</td>
    <td>Adds the specified directory or directories to the directory list that rEFInd scans for EFI boot loaders when <tt>scanfor</tt> includes the <tt>internal</tt>, <tt>external</tt>, or <tt>optical</tt> options. Directories are specified relative to the filesystem's root directory. If this option is used, it's applied to <i>all</i> the filesystems that rEFInd scans. If a specified directory doesn't exist, rEFInd ignores it (no error results).</td>
 </tr>
+<tr>
+   <td><tt>scan_all_linux_kernels</tt></td>
+   <td>None</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. The hope is that this will simplify use of rEFInd on distributions that provide kernels with EFI stub loader support but that 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.) Note that this option can cause unwanted files to be improperly detected and given loader tags, such as older kernels without EFI stub loader support and <tt>.icns</tt> files used to give kernels unique icons. For this reason, it's disabled by default.</td>
+</tr>
 <tr>
    <td><tt>default_selection</tt></td>
    <td>A substring of a boot loader's title</td>
index 174c27be652296db9fbf70cd8bdc54da8ae71302..968500525d41bad7ec3b20b4e59d886d6d9e0a18 100644 (file)
@@ -157,16 +157,23 @@ EFI_STATUS ReinitRefitLib(VOID)
 {
     ReinitVolumes();
 
-    // Below two lines were in rEFIt, but seem to cause problems on
-    // most systems. OTOH, my Mac Mini produces (apparently harmless)
-    // errors about "(re)opening our installation volume" (see the
-    // next function) when returning from programs when these two lines
-    // are removed. On the gripping hand, the Mac SOMETIMES crashes
-    // when launching a second program even with these lines removed.
-    // TODO: Figure out cause of above weirdness and fix it more
-    // reliably!
-    /* if (SelfVolume != NULL && SelfVolume->RootDir != NULL)
-       SelfRootDir = SelfVolume->RootDir; */
+    if ((ST->Hdr.Revision >> 16) == 1) {
+       // Below two lines were in rEFIt, but seem to cause system crashes or
+       // reboots when launching OSes after returning from programs on most
+       // systems. OTOH, my Mac Mini produces errors about "(re)opening our
+       // installation volume" (see the next function) when returning from
+       // programs when these two lines are removed, and it often crashes
+       // when returning from a program or when launching a second program
+       // with these lines removed. Therefore, the preceding if() statement
+       // executes these lines only on EFIs with a major version number of 1
+       // (which Macs have) and not with 2 (which UEFI PCs have). My selection
+       // of hardware on which to test is limited, though, so this may be the
+       // wrong test, or there may be a better way to fix this problem.
+       // TODO: Figure out cause of above weirdness and fix it more
+       // reliably!
+       if (SelfVolume != NULL && SelfVolume->RootDir != NULL)
+          SelfRootDir = SelfVolume->RootDir;
+    } // if
 
     return FinishInitRefitLib();
 }
@@ -197,7 +204,7 @@ static EFI_STATUS FinishInitRefitLib(VOID)
 VOID CreateList(OUT VOID ***ListPtr, OUT UINTN *ElementCount, IN UINTN InitialElementCount)
 {
     UINTN AllocateCount;
-    
+
     *ElementCount = InitialElementCount;
     if (*ElementCount > 0) {
         AllocateCount = (*ElementCount + 7) & ~7;   // next multiple of 8
index 7ce4bcc5b78411447c5df03967cab2de236b838f..03b53cc0fc4cc10a408702dbae55b705d6c50ad3 100644 (file)
@@ -96,7 +96,7 @@ static VOID AboutrEFInd(VOID)
 {
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
-        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.7.2");
+        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.7.3");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");
@@ -1134,7 +1134,7 @@ static UINTN ScanDriverDir(IN CHAR16 *Path)
 
     // look through contents of the directory
     DirIterOpen(SelfRootDir, Path, &DirIter);
-    while (DirIterNext(&DirIter, 2, L"*.efi", &DirEntry)) {
+    while (DirIterNext(&DirIter, 2, LOADER_MATCH_PATTERNS, &DirEntry)) {
         if (DirEntry->FileName[0] == '.')
             continue;   // skip this