]> code.delx.au - refind/commitdiff
Fix to hang when booting from Mac Firewire devices.
authorsrs5694 <srs5694@users.sourceforge.net>
Tue, 13 Aug 2013 22:57:53 +0000 (18:57 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Tue, 13 Aug 2013 22:57:53 +0000 (18:57 -0400)
NEWS.txt
docs/refind/installing.html
mkcdimage
refind/main.c

index 5cd1109aced731ba424f4f15daaca7e54e10daab..f4b8a4af455a08a61d9fec8336147d8cc582caf5 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,3 +1,10 @@
+0.7.4 (?/??/2013):
+------------------
+
+- Fixed bug that could cause rEFInd to hang when launching boot loaders
+  under some conditions. (Launching from Firewire drives on Macs is the
+  known case, but there may be others.)
+
 0.7.3 (8/7/2013):
 -----------------
 
index 0e49b6656da3ac398b0d3b6c85342f18fe059702..afa024117635141143589f8f3cae7fa9bc3dd1bd 100644 (file)
@@ -904,6 +904,8 @@ $ <b>ioreg -l -p IODeviceTree | grep firmware-abi</b>
 
 <p>The biggest drawback to this approach is that you won't be able to edit the rEFInd configuration file or move rEFInd-related binaries from an EFI shell if you install it in this way, since Apple's HFS+ driver for EFI is read-only. (The same is true of rEFInd's HFS+ driver, so it won't help you overcome this limitation.) You may also be limited in making changes to your rEFInd configuration from Linux or other OSes, too, since Linux's HFS+ drivers disable write support by default on volumes with an active journal. You can force write access by using the <tt>force</tt> option to <tt>mount</tt>; however, this procedure is noted as being risky in the Linux HFS+ documentation, so I don't recommend doing this on a regular basis. As a compromise, you might try creating a small non-journaled HFS+ volume that's dedicated to holding rEFInd. You could even mount it as the Linux <tt>/boot</tt> partition, in which case it would also hold the Linux kernel and related files. You'll need to install rEFInd manually if you try this.</p>
 
+<p>A variant of this solution is suggested in <a href="http://www.sparxeng.com/blog/software/fixing-slow-boot-on-a-triple-boot-mountain-lion-mac">this blog post,</a> which recommends placing rEFInd on an HFS+ volume on the first SATA channel. (In the blogger's case, that channel used to hold an optical drive, but that drive was replaced by a hard disk.)</p>
+
 <a name="fallback">
 <h3>Using the Fallback Filename</h3>
 </a>
index 934199a8af4b5f6c13f8c2c41be78e5859bb5b1f..3c8b58f792c245201ab98f2f320e7611999c3fc9 100755 (executable)
--- a/mkcdimage
+++ b/mkcdimage
@@ -46,7 +46,7 @@ ln ../../../refind/drivers_x64/* ./
 cd ..
 mkdir drivers_ia32
 cd drivers_ia32
-ln ../../../refind/drivers_x64/* ./
+ln ../../../refind/drivers_ia32/* ./
 cd ../../..
 
 # Get the size of the binaries to go in the El Torito image in kB
index bb400e117f908ebcc77e9cfaafd60614e84f526f..392bed2c53f0ef8a0acd2e4abc25fd50886844b0 100644 (file)
@@ -151,7 +151,7 @@ static VOID AboutrEFInd(VOID)
 
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
-        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.7.3");
+        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.7.3.4");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2013 Roderick W. Smith");
@@ -223,9 +223,16 @@ static BOOLEAN IsValidLoader(EFI_FILE *RootDir, CHAR16 *FileName) {
     CHAR8           Header[512];
     UINTN           Size = sizeof(Header);
 
+    if ((RootDir == NULL) || (FileName == NULL)) {
+       // Assume valid here, because Macs produce NULL RootDir (& maybe FileName)
+       // when launching from a Firewire drive. This should be handled better, but
+       // fix would have to be in StartEFIImageList() and/or in FindVolumeAndFilename().
+       return TRUE;
+    } // if
+
     Status = refit_call5_wrapper(RootDir->Open, RootDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0);
     if (EFI_ERROR(Status))
-       return 0;
+       return FALSE;
 
     Status = refit_call3_wrapper(FileHandle->Read, FileHandle, &Size, Header);
     refit_call1_wrapper(FileHandle->Close, FileHandle);
@@ -287,8 +294,9 @@ static EFI_STATUS StartEFIImageList(IN EFI_DEVICE_PATH **DevicePaths,
     for (DevicePathIndex = 0; DevicePaths[DevicePathIndex] != NULL; DevicePathIndex++) {
        FindVolumeAndFilename(DevicePaths[DevicePathIndex], &Volume, &Filename);
        // Some EFIs crash if attempting to load driver for invalid architecture, so
-       // protect for this condition....
-       if ((LoaderType == TYPE_LEGACY) || IsValidLoader(Volume->RootDir, Filename)) {
+       // protect for this condition; but sometimes Volume comes back NULL, so provide
+       // an exception. (TODO: Handle this special condition better.)
+       if ((LoaderType == TYPE_LEGACY) || (Volume == NULL) || IsValidLoader(Volume->RootDir, Filename)) {
           // NOTE: Below commented-out line could be more efficient if file were read ahead of
           // time and passed as a pre-loaded image to LoadImage(), but it doesn't work on my
           // 32-bit Mac Mini or my 64-bit Intel box when launching a Linux kernel; the