From 463d49c9646ad30a500cc9a6305676b790871945 Mon Sep 17 00:00:00 2001 From: srs5694 Date: Sat, 28 Jun 2014 22:54:05 -0400 Subject: [PATCH] Don't unload drivers immediately after loading them. (Fix required for some non-rEFInd drivers.) --- NEWS.txt | 25 +++++++++++++++++++++++++ debian/changelog | 10 ++++++++-- docs/refind/getting.html | 6 +++--- docs/refind/installing.html | 24 +++++++++++++++++++++--- refind.conf-sample | 17 ++++++++--------- refind.spec | 2 +- refind/config.c | 6 ------ refind/global.h | 2 +- refind/main.c | 24 ++++++++++++++---------- 9 files changed, 81 insertions(+), 35 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 61ae509..f1cc43c 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,3 +1,28 @@ +0.8.3 (?/??/2014): +------------------ + +- Fixed bug that caused rEFInd to unload drivers immediately after loading + them. This didn't affect rEFInd's own drivers because they didn't include + the unload hooks, but it did affect some other drivers. + +- Changed default scan_all_linux_kernels setting from "false" to "true", + and commented the option out in refind.conf-sample. This should not + affect most people, since refind.conf-sample had this option commented + out, and most rEFInd users either use it that way or don't have Linux + kernels installed at all. I've made this change because I want rEFInd to + "do the right thing" by default in as many cases as possible. For a while + now, rEFInd has been excluding non-bootable files from its menu, and most + kernels "in the wild" now include the EFI stub. Thus, enabling this + support by default seems worthwhile. If you prefer to not scan Linux + kernels by default, simply uncomment the "scan_all_linux_kernels" line + and ensure it's set to "false". + +0.8.2.1 (6/8/2014): +------------------- + +- Removed stray bit of debugging code that caused a prompt to press a + key to appear at rEFInd startup. + 0.8.2 (6/8/2014): ----------------- diff --git a/debian/changelog b/debian/changelog index 47f98c5..bed26ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ -refind (0.8.2-0ppa1) trusty; urgency=medium +refind (0.8.2-0ppa3) trusty; urgency=medium + + * Removed stray debugging code that caused pause during startup + + -- Rod Smith Sun, 08 Jun 2014 16:48:48 -0400 + +refind (0.8.2-0ppa2) trusty; urgency=medium * Version bump - -- Rod Smith Sun, 08 Jun 2014 12:32:48 -0400 + -- Rod Smith Sun, 08 Jun 2014 12:32:48 -0400 refind (0.8.1-0ppa2) trusty; urgency=medium diff --git a/docs/refind/getting.html b/docs/refind/getting.html index 8e9a33f..e9e62ec 100644 --- a/docs/refind/getting.html +++ b/docs/refind/getting.html @@ -152,7 +152,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

users with this problem.
  • A + href="http://sourceforge.net/projects/refind/files/0.8.2/refind-0.8.2-2.x86_64.rpm/download">A binary RPM file—If you use an RPM-based x86-64 Linux system such as Fedora or openSUSE, you can install the binary RPM package rather than use the binary zip file. (I don't provide an @@ -161,13 +161,13 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

    rEFInd page) as part of the installation process. Distribution maintainers can examine the refind.spec file in the source package and tweak it to their needs. The source + href="http://sourceforge.net/projects/refind/files/0.8.2/refind-0.8.2-2.src.rpm/download">source RPM file might or might not build on your system as-is; it relies on assumptions about the locations of the GNU-EFI development files.
  • A + href="http://sourceforge.net/projects/refind/files/0.8.2/refind_0.8.2-2_amd64.deb/download">A binary Debian package—If you use an x86-64 version of Debian, Ubuntu, Mint, or another Debian-based distribution, you can install from this package, which was converted from the binary RPM diff --git a/docs/refind/installing.html b/docs/refind/installing.html index afa6cd0..54ad51f 100644 --- a/docs/refind/installing.html +++ b/docs/refind/installing.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

    Originally written: 3/14/2012; last Web page update: -6/8/2014, referencing rEFInd 0.8.2

    +6/23/2014, referencing rEFInd 0.8.2

    This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!

    @@ -194,6 +194,8 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

  • Clearing the NVRAM Entries
  • +
  • Fixing Wake Problems
  • +
  • Uninstalling rEFInd
  • @@ -943,10 +945,10 @@ $ ioreg -l -p IODeviceTree | grep firmware-abi

    I've seen links to other versions of these tools from time to time on the Web, so if you try one of these programs and it crashes or behaves strangely, try performing a Web search; you may turn up something that works better for you than the one to which I've linked.

    -

    Fixing a Sluggish Macintosh Boot

    +

    Fixing Macintosh Boot Problems

    -

    I've received a few reports of a sluggish boot process (a delay of about 30 seconds before starting rEFInd) on some Macs after installing rEFInd. I've been unable to replicate this problem myself, and its true cause remains mysterious to me. I have found three possible solutions, though: moving rEFInd to an HFS+ volume, using the fallback filename, and clearing NVRAM entries.

    +

    I've received a few reports of a sluggish boot process (a delay of about 30 seconds before starting rEFInd) on some Macs after installing rEFInd, as well as some other Mac-specific peculiarities. I've been unable to replicate this problem myself, and its true cause remains mysterious to me. I have found three possible solutions, though: moving rEFInd to an HFS+ volume, using the fallback filename, and clearing NVRAM entries.

    Moving rEFInd to an HFS+ Volume

    @@ -986,6 +988,22 @@ $ ioreg -l -p IODeviceTree | grep firmware-abi

    Some sources suggest that delayed launches of rEFInd on Macs are more common when installing rEFInd to the ESP, so if you've done this, you could try re-installing it to your OS X boot partition.

    +
    +

    Fixing Wake Problems

    +
    + +

    Some people have reported that installing rEFInd causes problems with resuming from a suspended OS X session. I know of two workarounds to such problems:

    + +
      + +
    • Install rEFInd to an HFS+ volume using the --ownhfs option to install.sh. Unfortunately, this solution requires either creating a small HFS+ volume for rEFInd or using an already-existing non-bootable HFS+ volume (if you've got one for data storage, for example).
    • + +
    • Type sudo pmset -a autopoweroff 0 in a Terminal window. This solution is likely to work if sleep operations work normally up to a point, but fail after about three hours.
    • + +
    + +

    Unfortunately, I lack a recent Mac and so can't investigate these issues myself, so I'm dependent upon others (mostly non-programmers) to offer workarounds. This is the type of problem that really requires hands-on interactive debugging sessions with the code to stand any chance of finding a better solution.

    +

    Uninstalling rEFInd

    diff --git a/refind.conf-sample b/refind.conf-sample index 4c6fdd0..19d0430 100644 --- a/refind.conf-sample +++ b/refind.conf-sample @@ -214,6 +214,7 @@ timeout 20 # "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 "uefi_deep_legacy_scan true") +# #uefi_deep_legacy_scan # Delay for the specified number of seconds before scanning disks. @@ -291,16 +292,14 @@ timeout 20 # useful for better integration with Linux distributions that provide # kernels with EFI stub loaders but that don't give those kernels filenames # that end in ".efi", particularly if the kernels are stored on a -# filesystem that the EFI can read. When uncommented, this option causes -# all files in scanned directories with names that begin with "vmlinuz" -# or "bzImage" to be included as loaders, even if they lack ".efi" -# extensions. The drawback to this option is that it can pick up kernels -# that lack EFI stub loader support and other files. Passing this option -# a "0" value causes kernels without ".efi" extensions to NOT be scanned; -# passing it alone or with any other value causes all kernels to be scanned. -# Default is to NOT scan for kernels without ".efi" extensions. +# filesystem that the EFI can read. When set to "1", "true", or "on", this +# option causes all files in scanned directories with names that begin with +# "vmlinuz" or "bzImage" to be included as loaders, even if they lack ".efi" +# extensions. Passing this option a "0", "false", or "off" value causes +# kernels without ".efi" extensions to NOT be scanned. +# Default is "true" -- to scan for kernels without ".efi" extensions. # -scan_all_linux_kernels +#scan_all_linux_kernels false # Set the maximum number of tags that can be displayed on the screen at # any time. If more loaders are discovered than this value, rEFInd shows diff --git a/refind.spec b/refind.spec index 15a37fb..3501732 100644 --- a/refind.spec +++ b/refind.spec @@ -1,7 +1,7 @@ Summary: EFI boot manager software Name: refind Version: 0.8.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: EFI boot manager software License: GPLv3 URL: http://www.rodsbooks.com/refind/ diff --git a/refind/config.c b/refind/config.c index e58238b..7afb529 100644 --- a/refind/config.c +++ b/refind/config.c @@ -332,7 +332,6 @@ static VOID HandleString(IN CHAR16 **TokenList, IN UINTN TokenCount, OUT CHAR16 *Target = StrDuplicate(TokenList[1]); } // if/else } // if - PauseForKey(); } // static VOID HandleString() // Handle a parameter with a series of string arguments, to replace or be added to a @@ -666,11 +665,6 @@ VOID ReadConfig(CHAR16 *FileName) } else if (StriCmp(TokenList[0], L"scan_all_linux_kernels") == 0) { 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)); diff --git a/refind/global.h b/refind/global.h index 95ac32f..4397db8 100644 --- a/refind/global.h +++ b/refind/global.h @@ -146,7 +146,7 @@ // Directories to search for memtest86.... #define MEMTEST_LOCATIONS L"EFI\\tools,EFI\\tools\\memtest86,EFI\\tools\\memtest,EFI\\memtest86,EFI\\memtest" // Files that may be Windows recovery files -#define WINDOWS_RECOVERY_FILES L"EFI\\Microsoft\\Boot\\LrsBootmgr.efi" +#define WINDOWS_RECOVERY_FILES L"EFI\\Microsoft\\Boot\\LrsBootmgr.efi,Recovery:\\EFI\\BOOT\\bootx64.efi,Recovery:\\EFI\\BOOT\\bootia32.efi" #define NULL_GUID_VALUE { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }; #define REFIND_GUID_VALUE { 0x36D08FA7, 0xCF0B, 0x42F5, {0x8F, 0x14, 0x68, 0xDF, 0x73, 0xED, 0x37, 0x40} }; diff --git a/refind/main.c b/refind/main.c index aacbe93..0032e16 100644 --- a/refind/main.c +++ b/refind/main.c @@ -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, FALSE, 0, 0, 0, DONT_CHANGE_TEXT_MODE, 20, 0, 0, GRAPHICS_FOR_OSX, LEGACY_TYPE_MAC, 0, 0, +REFIT_CONFIG GlobalConfig = { FALSE, TRUE, 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, @@ -169,7 +169,7 @@ static VOID AboutrEFInd(VOID) if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.2"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.2.3"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2014 Roderick W. Smith"); @@ -267,7 +267,8 @@ static EFI_STATUS StartEFIImageList(IN EFI_DEVICE_PATH **DevicePaths, IN CHAR16 *LoadOptions, IN UINTN LoaderType, IN CHAR16 *ImageTitle, IN CHAR8 OSType, OUT UINTN *ErrorInStep, - IN BOOLEAN Verbose) + IN BOOLEAN Verbose, + IN BOOLEAN IsDriver) { EFI_STATUS Status, ReturnStatus; EFI_HANDLE ChildImageHandle; @@ -366,7 +367,8 @@ static EFI_STATUS StartEFIImageList(IN EFI_DEVICE_PATH **DevicePaths, bailout_unload: // unload the image, we don't care if it works or not... - Status = refit_call1_wrapper(BS->UnloadImage, ChildImageHandle); + if (!IsDriver) + Status = refit_call1_wrapper(BS->UnloadImage, ChildImageHandle); bailout: MyFreePool(FullLoadOptions); @@ -377,13 +379,15 @@ static EFI_STATUS StartEFIImage(IN EFI_DEVICE_PATH *DevicePath, IN CHAR16 *LoadOptions, IN UINTN LoaderType, IN CHAR16 *ImageTitle, IN CHAR8 OSType, OUT UINTN *ErrorInStep, - IN BOOLEAN Verbose) + IN BOOLEAN Verbose, + IN BOOLEAN IsDriver + ) { EFI_DEVICE_PATH *DevicePaths[2]; DevicePaths[0] = DevicePath; DevicePaths[1] = NULL; - return StartEFIImageList(DevicePaths, LoadOptions, LoaderType, ImageTitle, OSType, ErrorInStep, Verbose); + return StartEFIImageList(DevicePaths, LoadOptions, LoaderType, ImageTitle, OSType, ErrorInStep, Verbose, IsDriver); } /* static EFI_STATUS StartEFIImage() */ // From gummiboot: Reboot the computer into its built-in user interface @@ -437,7 +441,7 @@ static VOID StartLoader(LOADER_ENTRY *Entry, CHAR16 *SelectionName) BeginExternalScreen(Entry->UseGraphicsMode, L"Booting OS"); StoreLoaderName(SelectionName); StartEFIImage(Entry->DevicePath, Entry->LoadOptions, TYPE_EFI, - Basename(Entry->LoaderPath), Entry->OSType, &ErrorInStep, !Entry->UseGraphicsMode); + Basename(Entry->LoaderPath), Entry->OSType, &ErrorInStep, !Entry->UseGraphicsMode, FALSE); FinishExternalScreen(); } @@ -1629,7 +1633,7 @@ static VOID StartLegacy(IN LEGACY_ENTRY *Entry, IN CHAR16 *SelectionName) ExtractLegacyLoaderPaths(DiscoveredPathList, MAX_DISCOVERED_PATHS, LegacyLoaderList); StoreLoaderName(SelectionName); - Status = StartEFIImageList(DiscoveredPathList, Entry->LoadOptions, TYPE_LEGACY, L"legacy loader", 0, &ErrorInStep, TRUE); + Status = StartEFIImageList(DiscoveredPathList, Entry->LoadOptions, TYPE_LEGACY, L"legacy loader", 0, &ErrorInStep, TRUE, FALSE); if (Status == EFI_NOT_FOUND) { if (ErrorInStep == 1) { Print(L"\nPlease make sure that you have the latest firmware update installed.\n"); @@ -1974,7 +1978,7 @@ static VOID StartTool(IN LOADER_ENTRY *Entry) BeginExternalScreen(Entry->UseGraphicsMode, Entry->me.Title + 6); // assumes "Start " as assigned below StoreLoaderName(Entry->me.Title); StartEFIImage(Entry->DevicePath, Entry->LoadOptions, TYPE_EFI, - Basename(Entry->LoaderPath), Entry->OSType, NULL, TRUE); + Basename(Entry->LoaderPath), Entry->OSType, NULL, TRUE, FALSE); FinishExternalScreen(); } /* static VOID StartTool() */ @@ -2022,7 +2026,7 @@ static UINTN ScanDriverDir(IN CHAR16 *Path) SPrint(FileName, 255, L"%s\\%s", Path, DirEntry->FileName); NumFound++; Status = StartEFIImage(FileDevicePath(SelfLoadedImage->DeviceHandle, FileName), - L"", TYPE_EFI, DirEntry->FileName, 0, NULL, FALSE); + L"", TYPE_EFI, DirEntry->FileName, 0, NULL, FALSE, TRUE); } Status = DirIterClose(&DirIter); if (Status != EFI_NOT_FOUND) { -- 2.39.2