]> code.delx.au - refind/commitdiff
Fine-tuning of loader detection code.
authorsrs5694 <srs5694@users.sourceforge.net>
Fri, 1 Feb 2013 16:34:45 +0000 (11:34 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Fri, 1 Feb 2013 16:34:45 +0000 (11:34 -0500)
12 files changed:
NEWS.txt
docs/refind/configfile.html
libeg/image.c
mok/guid.c
refind.conf-sample
refind.inf
refind.spec
refind/config.c
refind/config.h
refind/lib.c
refind/lib.h
refind/main.c

index f2d1578209fe7aeb7b3bbf6c79e6c21da70cf604..a4939132a823ca7c2d8e5a0094470c289b189f2f 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,14 @@
 0.6.7 (?/??/2013):
 ------------------
 
 0.6.7 (?/??/2013):
 ------------------
 
+- Fixed bug that caused rEFInd to present an entry for itself as a
+  Microsoft OS if it was launched as EFI/Microsoft/Boot/bootmgfw.efi.
+
+- Fixed bug that caused dont_scan_volumes option to be added to
+  also_scan_dirst list.
+
+- Fixed dont_scan_volumes so that it works with OS X boot loaders.
+
 - Fixed broken mixing of PNG and ICNS icons when using a user-specified
   icons directory -- previously, an ICNS file in the default directory
   would override a PNG file in the user-specified directory.
 - Fixed broken mixing of PNG and ICNS icons when using a user-specified
   icons directory -- previously, an ICNS file in the default directory
   would override a PNG file in the user-specified directory.
index 4a05a9d701b4c4bcf87df209a49ca36006e2c048..f6358ab5c19f9e5542340b16724d7cd50e71b1b8 100644 (file)
@@ -251,7 +251,7 @@ timeout 20
 <tr>
    <td><tt>dont_scan_volumes</tt> or <tt>don't_scan_volumes</tt></td>
    <td>filesystem label(s)</td>
 <tr>
    <td><tt>dont_scan_volumes</tt> or <tt>don't_scan_volumes</tt></td>
    <td>filesystem label(s)</td>
-   <td>Adds the specified volume or volumes to a volume "blacklist"&mdash;these filesystems are <i>not</i> scanned for EFI boot loaders. This may be useful to keep unwanted EFI boot entries, such as for a Macintosh recovery partition, from appearing on the main list of boot loaders.</td>
+   <td>Adds the specified volume or volumes to a volume "blacklist"&mdash;these filesystems are <i>not</i> scanned for EFI boot loaders. This may be useful to keep unwanted EFI boot entries, such as for a Macintosh recovery partition, from appearing on the main list of boot loaders. The default value is <tt>Recovery HD</tt>, to keep the Mac recovery volume from appearing. (It should get its own tools icon instead&mdash;see the <tt>showtools</tt> token.)</td>
 </tr>
 <tr>
    <td><tt>dont_scan_dirs</tt> or <tt>don't_scan_dirs</tt></td>
 </tr>
 <tr>
    <td><tt>dont_scan_dirs</tt> or <tt>don't_scan_dirs</tt></td>
index a688bdf128545b4d86bc51a01be3b3feffc703c2..88829a546c149597c002dc5ae80779330b310251 100644 (file)
@@ -204,7 +204,7 @@ EFI_STATUS egSaveFile(IN EFI_FILE* BaseDir OPTIONAL, IN CHAR16 *FileName,
     }
 
     Status = refit_call5_wrapper(BaseDir->Open, BaseDir, &FileHandle, FileName,
     }
 
     Status = refit_call5_wrapper(BaseDir->Open, BaseDir, &FileHandle, FileName,
-                           EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
+                                 EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
     if (EFI_ERROR(Status))
         return Status;
 
     if (EFI_ERROR(Status))
         return Status;
 
index b0e430f67658b608ad4e5e194ddc40116c9ed4da..155b8ed2778130db754804cfbb0f139ca2d793b3 100644 (file)
@@ -6,7 +6,6 @@
 
 #include "global.h"
 #include "guid.h"
 
 #include "global.h"
 #include "guid.h"
-#include <stdio.h>
 
 // #ifndef BUILD_EFI
 // /* EFI has %g for this, so it's only needed in platform c */
 
 // #ifndef BUILD_EFI
 // /* EFI has %g for this, so it's only needed in platform c */
index b7ccc2e74e6378262470b20c55e104c707e040cc..d96a1b88ee8a2ea5843d414018bc2b1d1cd8d70a 100644 (file)
@@ -195,7 +195,7 @@ timeout 20
 # label, which you can obtain in an EFI shell by typing "vol", from
 # Linux by typing "blkid /dev/{devicename}", or by examining the
 # disk's label in various OSes' file browsers.
 # label, which you can obtain in an EFI shell by typing "vol", from
 # Linux by typing "blkid /dev/{devicename}", or by examining the
 # disk's label in various OSes' file browsers.
-# The default is an empty list (all volumes are scanned).
+# The default is "Recovery HD".
 #
 #dont_scan_volumes "Recovery HD"
 
 #
 #dont_scan_volumes "Recovery HD"
 
index e8e9d478d441e3294561e98c64105d4d56f17b1b..8619ec415716073ebe43a249cab9ac1557a38387 100644 (file)
@@ -47,6 +47,7 @@
   libeg/image.c\r
   libeg/load_bmp.c\r
   libeg/load_icns.c\r
   libeg/image.c\r
   libeg/load_bmp.c\r
   libeg/load_icns.c\r
+  libeg/lodepng.c\r
   libeg/screen.c\r
   libeg/text.c\r
 \r
   libeg/screen.c\r
   libeg/text.c\r
 \r
index 429e22ba543b102090e22c4d5fb346a3644b1ee4..d666622a1d4ec4f43cb13f8342a46dfdfa911e2d 100644 (file)
@@ -1,6 +1,6 @@
 Summary: EFI boot manager software
 Name: refind
 Summary: EFI boot manager software
 Name: refind
-Version: 0.6.6.6
+Version: 0.6.6.7
 Release: 1%{?dist}
 Summary: EFI boot manager software
 License: GPLv3
 Release: 1%{?dist}
 Summary: EFI boot manager software
 License: GPLv3
index cc0a93170b3b38999c40bdca222597e69c60efec..92ef5a6f74cbbf053a49ac004102eef281e011f3 100644 (file)
@@ -361,6 +361,8 @@ VOID ReadConfig(CHAR16 *FileName)
        GlobalConfig.DontScanDirs = SelfPath;
        MyFreePool(GlobalConfig.DontScanFiles);
        GlobalConfig.DontScanFiles = StrDuplicate(DONT_SCAN_FILES);
        GlobalConfig.DontScanDirs = SelfPath;
        MyFreePool(GlobalConfig.DontScanFiles);
        GlobalConfig.DontScanFiles = StrDuplicate(DONT_SCAN_FILES);
+       MyFreePool(GlobalConfig.DontScanVolumes);
+       GlobalConfig.DontScanVolumes = StrDuplicate(DONT_SCAN_VOLUMES);
     } // if
 
     if (!FileExists(SelfDir, FileName)) {
     } // if
 
     if (!FileExists(SelfDir, FileName)) {
@@ -424,7 +426,6 @@ VOID ReadConfig(CHAR16 *FileName)
             HandleStrings(TokenList, TokenCount, &(GlobalConfig.AlsoScan));
 
         } else if ((StriCmp(TokenList[0], L"don't_scan_volumes") == 0) || (StriCmp(TokenList[0], L"dont_scan_volumes") == 0)) {
             HandleStrings(TokenList, TokenCount, &(GlobalConfig.AlsoScan));
 
         } else if ((StriCmp(TokenList[0], L"don't_scan_volumes") == 0) || (StriCmp(TokenList[0], L"dont_scan_volumes") == 0)) {
-           HandleStrings(TokenList, TokenCount, &(GlobalConfig.AlsoScan));
            // Note: Don't use HandleStrings() because it modifies slashes, which might be present in volume name
            MyFreePool(GlobalConfig.DontScanVolumes);
            GlobalConfig.DontScanVolumes = NULL;
            // Note: Don't use HandleStrings() because it modifies slashes, which might be present in volume name
            MyFreePool(GlobalConfig.DontScanVolumes);
            GlobalConfig.DontScanVolumes = NULL;
index 79acf2122ee60b5c8b7b729ee701b7247a70a2a5..a91b52f5a759b1fedf1b9e159dd3e1fe5381fe39 100644 (file)
@@ -80,6 +80,7 @@ typedef struct {
 
 #define CONFIG_FILE_NAME         L"refind.conf"
 #define DONT_SCAN_FILES L"shim.efi,MokManager.efi,TextMode.efi,ebounce.efi,GraphicsConsole.efi"
 
 #define CONFIG_FILE_NAME         L"refind.conf"
 #define DONT_SCAN_FILES L"shim.efi,MokManager.efi,TextMode.efi,ebounce.efi,GraphicsConsole.efi"
+#define DONT_SCAN_VOLUMES L"Recovery HD"
 #define ALSO_SCAN_DIRS L"boot"
 
 EFI_STATUS ReadFile(IN EFI_FILE_HANDLE BaseDir, CHAR16 *FileName, REFIT_FILE *File, UINTN *size);
 #define ALSO_SCAN_DIRS L"boot"
 
 EFI_STATUS ReadFile(IN EFI_FILE_HANDLE BaseDir, CHAR16 *FileName, REFIT_FILE *File, UINTN *size);
index bf2c2ef27b38e60f79a4840f5cf5abc7d930c124..66dbe00e21fd967858cd5764a5d31b287040a52b 100644 (file)
@@ -48,6 +48,7 @@
 #include "screen.h"
 #include "../include/refit_call_wrapper.h"
 #include "../include/RemovableMedia.h"
 #include "screen.h"
 #include "../include/refit_call_wrapper.h"
 #include "../include/RemovableMedia.h"
+//#include "../include/UsbMass.h"
 
 #ifdef __MAKEWITH_GNUEFI
 #define EfiReallocatePool ReallocatePool
 
 #ifdef __MAKEWITH_GNUEFI
 #define EfiReallocatePool ReallocatePool
@@ -92,9 +93,6 @@ UINTN            VolumesCount = 0;
 // and identify its boot loader, and hence probable BIOS-mode OS installation
 #define SAMPLE_SIZE 69632 /* 68 KiB -- ReiserFS superblock begins at 64 KiB */
 
 // and identify its boot loader, and hence probable BIOS-mode OS installation
 #define SAMPLE_SIZE 69632 /* 68 KiB -- ReiserFS superblock begins at 64 KiB */
 
-// Default names for volume badges (mini-icon to define disk type) and icons
-#define VOLUME_BADGE_NAMES L".VolumeBadge.icns,.VolumeBadge.png"
-#define VOLUME_ICON_NAMES L".VolumeIcon.icns,.VolumeIcon.png"
 
 // functions
 
 
 // functions
 
index 4004c454b9a04f0eeac3c685e1e14cd222d6b325..d0a4022611a434b73f7ec5805fd6cec3995e6af8 100644 (file)
@@ -73,7 +73,6 @@ typedef struct {
 #define DISK_KIND_EXTERNAL  (1)
 #define DISK_KIND_OPTICAL   (2)
 
 #define DISK_KIND_EXTERNAL  (1)
 #define DISK_KIND_OPTICAL   (2)
 
-#define VOL_DONTSCAN   998
 #define VOL_UNREADABLE 999
 
 #define IS_EXTENDED_PART_TYPE(type) ((type) == 0x05 || (type) == 0x0f || (type) == 0x85)
 #define VOL_UNREADABLE 999
 
 #define IS_EXTENDED_PART_TYPE(type) ((type) == 0x05 || (type) == 0x0f || (type) == 0x85)
index fc5d062d585bc0f9c081c97499556150b7e085b3..ecb082565d3556d455a5c6bf9313e3b96857ed1c 100644 (file)
@@ -134,7 +134,7 @@ static VOID AboutrEFInd(VOID)
 
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
 
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
-        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.6.6.6");
+        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.6.6.7");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");
@@ -904,9 +904,9 @@ static VOID CleanUpLoaderList(struct LOADER_LIST *LoaderList) {
 
 // Returns FALSE if the specified file/volume matches the GlobalConfig.DontScanDirs
 // or GlobalConfig.DontScanVolumes specification, or if Path points to a volume
 
 // Returns FALSE if the specified file/volume matches the GlobalConfig.DontScanDirs
 // or GlobalConfig.DontScanVolumes specification, or if Path points to a volume
-// other than the one specified by Volume. Returns TRUE if none of these conditions
-// is met -- that is, if the path is eligible for scanning. Also reduces *Path to a
-// path alone, with no volume specification.
+// other than the one specified by Volume, or if the specified path is SelfDir.
+// Returns TRUE if none of these conditions is met -- that is, if the path is
+// eligible for scanning.
 static BOOLEAN ShouldScan(REFIT_VOLUME *Volume, CHAR16 *Path) {
    CHAR16   *VolName = NULL, *DontScanDir;
    UINTN    i = 0, VolNum;
 static BOOLEAN ShouldScan(REFIT_VOLUME *Volume, CHAR16 *Path) {
    CHAR16   *VolName = NULL, *DontScanDir;
    UINTN    i = 0, VolNum;
@@ -915,6 +915,9 @@ static BOOLEAN ShouldScan(REFIT_VOLUME *Volume, CHAR16 *Path) {
    if (IsIn(Volume->VolName, GlobalConfig.DontScanVolumes))
       return FALSE;
 
    if (IsIn(Volume->VolName, GlobalConfig.DontScanVolumes))
       return FALSE;
 
+   if ((StriCmp(Path, SelfDirPath) == 0) && (Volume->DeviceHandle == SelfVolume->DeviceHandle))
+      return FALSE;
+
    while ((DontScanDir = FindCommaDelimited(GlobalConfig.DontScanDirs, i++)) && ScanIt) {
       SplitVolumeAndFilename(&DontScanDir, &VolName);
       CleanUpPathNameSlashes(DontScanDir);
    while ((DontScanDir = FindCommaDelimited(GlobalConfig.DontScanDirs, i++)) && ScanIt) {
       SplitVolumeAndFilename(&DontScanDir, &VolName);
       CleanUpPathNameSlashes(DontScanDir);
@@ -941,7 +944,7 @@ static BOOLEAN ShouldScan(REFIT_VOLUME *Volume, CHAR16 *Path) {
 // FALSE if the file is not identical to the fallback file OR if the file
 // IS the fallback file. Intended for use in excluding the fallback boot
 // loader when it's a duplicate of another boot loader.
 // FALSE if the file is not identical to the fallback file OR if the file
 // IS the fallback file. Intended for use in excluding the fallback boot
 // loader when it's a duplicate of another boot loader.
-BOOLEAN DuplicatesFallback(IN REFIT_VOLUME *Volume, IN CHAR16 *FileName) {
+static BOOLEAN DuplicatesFallback(IN REFIT_VOLUME *Volume, IN CHAR16 *FileName) {
    CHAR8           *FileContents, *FallbackContents;
    EFI_FILE_HANDLE FileHandle, FallbackHandle;
    EFI_FILE_INFO   *FileInfo, *FallbackInfo;
    CHAR8           *FileContents, *FallbackContents;
    EFI_FILE_HANDLE FileHandle, FallbackHandle;
    EFI_FILE_INFO   *FileInfo, *FallbackInfo;
@@ -1062,7 +1065,7 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) {
    REFIT_DIR_ITER          EfiDirIter;
    EFI_FILE_INFO           *EfiDirEntry;
    CHAR16                  FileName[256], *Directory, *MatchPatterns, *VolName = NULL;
    REFIT_DIR_ITER          EfiDirIter;
    EFI_FILE_INFO           *EfiDirEntry;
    CHAR16                  FileName[256], *Directory, *MatchPatterns, *VolName = NULL;
-   UINTN                   i, Length, VolNum;
+   UINTN                   i, Length;
    BOOLEAN                 ScanFallbackLoader = TRUE;
 
 //   Print(L"Entering ScanEfiFiles(), GlobalConfig.ScanAllLinux = %s\n", GlobalConfig.ScanAllLinux ? L"TRUE" : L"FALSE");
    BOOLEAN                 ScanFallbackLoader = TRUE;
 
 //   Print(L"Entering ScanEfiFiles(), GlobalConfig.ScanAllLinux = %s\n", GlobalConfig.ScanAllLinux ? L"TRUE" : L"FALSE");
@@ -1073,7 +1076,7 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) {
 
    if ((Volume->RootDir != NULL) && (Volume->VolName != NULL)) {
       // check for Mac OS X boot loader
 
    if ((Volume->RootDir != NULL) && (Volume->VolName != NULL)) {
       // check for Mac OS X boot loader
-      if (!IsIn(L"System\\Library\\CoreServices", GlobalConfig.DontScanDirs)) {
+      if (ShouldScan(Volume, L"System\\Library\\CoreServices")) {
          StrCpy(FileName, MACOSX_LOADER_PATH);
          if (FileExists(Volume->RootDir, FileName) && !IsIn(L"boot.efi", GlobalConfig.DontScanFiles)) {
             AddLoaderEntry(FileName, L"Mac OS X", Volume);
          StrCpy(FileName, MACOSX_LOADER_PATH);
          if (FileExists(Volume->RootDir, FileName) && !IsIn(L"boot.efi", GlobalConfig.DontScanFiles)) {
             AddLoaderEntry(FileName, L"Mac OS X", Volume);
@@ -1088,11 +1091,11 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) {
             if (DuplicatesFallback(Volume, FileName))
                ScanFallbackLoader = FALSE;
          }
             if (DuplicatesFallback(Volume, FileName))
                ScanFallbackLoader = FALSE;
          }
-      } // if Mac directory not in GlobalConfig.DontScanDirs list
+      } // if should scan Mac directory
 
       // check for Microsoft boot loader/menu
       StrCpy(FileName, L"EFI\\Microsoft\\Boot\\Bootmgfw.efi");
 
       // check for Microsoft boot loader/menu
       StrCpy(FileName, L"EFI\\Microsoft\\Boot\\Bootmgfw.efi");
-      if (FileExists(Volume->RootDir, FileName) && !IsIn(L"EFI\\Microsoft\\Boot", GlobalConfig.DontScanDirs) &&
+      if (FileExists(Volume->RootDir, FileName) && ShouldScan(Volume, L"EFI\\Microsoft\\Boot") &&
           !IsIn(L"bootmgfw.efi", GlobalConfig.DontScanFiles)) {
          AddLoaderEntry(FileName, L"Microsoft EFI boot", Volume);
          if (DuplicatesFallback(Volume, FileName))
           !IsIn(L"bootmgfw.efi", GlobalConfig.DontScanFiles)) {
          AddLoaderEntry(FileName, L"Microsoft EFI boot", Volume);
          if (DuplicatesFallback(Volume, FileName))
@@ -1119,24 +1122,18 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) {
       // Scan user-specified (or additional default) directories....
       i = 0;
       while ((Directory = FindCommaDelimited(GlobalConfig.AlsoScan, i++)) != NULL) {
       // Scan user-specified (or additional default) directories....
       i = 0;
       while ((Directory = FindCommaDelimited(GlobalConfig.AlsoScan, i++)) != NULL) {
-         VolNum = VOL_DONTSCAN;
          SplitVolumeAndFilename(&Directory, &VolName);
          CleanUpPathNameSlashes(Directory);
          Length = StrLen(Directory);
          SplitVolumeAndFilename(&Directory, &VolName);
          CleanUpPathNameSlashes(Directory);
          Length = StrLen(Directory);
-         if (VolName && (Length > 0) && (StrLen(VolName) > 2) && (VolName[0] == L'f') && (VolName[1] == L's') &&
-             (VolName[2] >= L'0') && (VolName[2] <= L'9'))
-            VolNum = Atoi(VolName + 2);
-         if ((Length > 0) && ((VolName == NULL) || (StriCmp(VolName, Volume->VolName) == 0) || (Volume->VolNumber == VolNum)))
-            if (ScanLoaderDir(Volume, Directory, MatchPatterns))
-               ScanFallbackLoader = FALSE;
+         if ((Length > 0) && ScanLoaderDir(Volume, Directory, MatchPatterns))
+            ScanFallbackLoader = FALSE;
          MyFreePool(Directory);
          MyFreePool(VolName);
       } // while
 
       // If not a duplicate & if it exists & if it's not us, create an entry
       // for the fallback boot loader
          MyFreePool(Directory);
          MyFreePool(VolName);
       } // while
 
       // If not a duplicate & if it exists & if it's not us, create an entry
       // for the fallback boot loader
-      if (ScanFallbackLoader && FileExists(Volume->RootDir, FALLBACK_FULLNAME) &&
-          ((StriCmp(SelfDirPath, L"EFI\\BOOT") != 0) || (Volume->DeviceHandle != SelfVolume->DeviceHandle))) {
+      if (ScanFallbackLoader && FileExists(Volume->RootDir, FALLBACK_FULLNAME) && ShouldScan(Volume, L"EFI\\BOOT")) {
          AddLoaderEntry(FALLBACK_FULLNAME, L"Fallback boot loader", Volume);
       }
    } // if
          AddLoaderEntry(FALLBACK_FULLNAME, L"Fallback boot loader", Volume);
       }
    } // if