]> code.delx.au - refind/blobdiff - refind/main.c
Remove second and subsequent occurrences of ext2/3/4 and ReiserFS filesystems
[refind] / refind / main.c
index 0715dbbb7759a439cd2c6bb7421393e3edd47666..be3dca4a0b7a5789ef2ef97f17b40c325896e649 100644 (file)
@@ -59,6 +59,7 @@
 #define EFI_SECURITY_VIOLATION    EFIERR (26)
 #else
 #include "../EfiLib/BdsHelper.h"
+#include "../EfiLib/legacy.h"
 #endif // __MAKEWITH_GNUEFI
 
 #ifndef EFI_OS_INDICATIONS_BOOT_TO_FW_UI
@@ -152,7 +153,7 @@ static VOID AboutrEFInd(VOID)
 {
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
-        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.7.3.11");
+        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.7.6.1");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2013 Roderick W. Smith");
@@ -283,7 +284,7 @@ static EFI_STATUS StartEFIImageList(IN EFI_DEVICE_PATH **DevicePaths,
        // 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)) {
-          if (Filename) {
+          if (Filename && (LoaderType != TYPE_LEGACY)) {
              Temp = PoolPrint(L"\\%s %s", Filename, FullLoadOptions ? FullLoadOptions : L"");
              if (Temp != NULL) {
                 MyFreePool(FullLoadOptions);
@@ -589,13 +590,13 @@ LOADER_ENTRY *InitializeLoaderEntry(IN LOADER_ENTRY *Entry) {
 // Returns a pointer to a new string. The calling function is responsible for
 // freeing its memory.
 static CHAR16 *AddInitrdToOptions(CHAR16 *Options, CHAR16 *InitrdPath) {
-   CHAR16 *NewOptions;
+   CHAR16 *NewOptions = NULL;
 
-
-   if ((InitrdPath != NULL) && !StriSubCmp(L"initrd=", Options)) {
-      NewOptions = PoolPrint(L"%s initrd=%s", Options ? Options : L"", InitrdPath);
-   } else {
+   if (Options != NULL)
       NewOptions = StrDuplicate(Options);
+   if ((InitrdPath != NULL) && !StriSubCmp(L"initrd=", Options)) {
+      MergeStrings(&NewOptions, L"initrd=", L' ');
+      MergeStrings(&NewOptions, InitrdPath, 0);
    }
    return NewOptions;
 } // CHAR16 *AddInitrdToOptions()
@@ -1314,7 +1315,7 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) {
    if (GlobalConfig.ScanAllLinux)
       MergeStrings(&MatchPatterns, LINUX_MATCH_PATTERNS, L',');
 
-   if ((Volume->RootDir != NULL) && (Volume->VolName != NULL)) {
+   if ((Volume->RootDir != NULL) && (Volume->VolName != NULL) && (Volume->IsReadable)) {
       // check for Mac OS X boot loader
       if (ShouldScan(Volume, L"System\\Library\\CoreServices")) {
          StrCpy(FileName, MACOSX_LOADER_PATH);
@@ -1624,10 +1625,18 @@ static VOID StartLegacy(IN LEGACY_ENTRY *Entry)
 
 // Start a device on a non-Mac using the EFI_LEGACY_BIOS_PROTOCOL
 #ifdef __MAKEWITH_TIANO
-static VOID StartLegacyUEFI(IN LEGACY_ENTRY *Entry)
+static VOID StartLegacyUEFI(LEGACY_ENTRY *Entry)
 {
+//     UINTN ExitDataSize = 0;
+//     CHAR16 *ExitData = NULL;
+//     EFI_STATUS Status;
+
     BeginExternalScreen(TRUE, L"Booting Legacy OS (UEFI mode)");
+//    Print(L"Launching from '%s'\n", DevicePathToStr(Entry->BdsOption->DevicePath));
+//    PauseForKey();
 
+//    Status = BdsLibBootViaBootOption(Entry->BdsOption, Entry->BdsOption->DevicePath, &ExitDataSize, &ExitData);
+//    Print(L"BdsLibBootViaBootOption() returned %d\n", Status);
     BdsLibConnectDevicePath (Entry->BdsOption->DevicePath);
     BdsLibDoLegacyBoot(Entry->BdsOption);
 
@@ -2149,6 +2158,17 @@ static VOID WarnIfLegacyProblems() {
 static VOID ScanForBootloaders(VOID) {
    UINTN  i;
 
+//    if (GlobalConfig.LegacyType == LEGACY_TYPE_UEFI) {
+//       Print(L"About to call BdsDeleteAllInvalidLegacyBootOptions()\n");
+//       BdsDeleteAllInvalidLegacyBootOptions();
+//       Print(L"About to call BdsAddNonExistingLegacyBootOptions()\n");
+//       BdsAddNonExistingLegacyBootOptions();
+//       Print(L"About to call BdsUpdateLegacyDevOrder()\n");
+// //      BdsUpdateLegacyDevOrder(); // EXTREME CAUTION: HOSED ONE FIRMWARE!
+//       Print(L"Done with legacy boot updates!\n");
+//       PauseForKey();
+//    }
+
    ScanVolumes();
 
    // scan for loaders and tools, add them to the menu