From: srs5694 Date: Wed, 4 Apr 2012 04:05:06 +0000 (-0400) Subject: Added max_tags option; new shell filenames; new rEFIt icon X-Git-Url: https://code.delx.au/refind/commitdiff_plain/8a3ec8229a0dd64677196895baa4733b0c241288 Added max_tags option; new shell filenames; new rEFIt icon --- diff --git a/NEWS.txt b/NEWS.txt index abfad76..e6132fa 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,3 +1,25 @@ +0.2.4 (?/??/2012): +------------------ + +- Added max_tags option to the refind.conf file, enabling users to reduce + the maximum number of OS loader tags that can be displayed at once. + +- Updated rEFIt icon, based on the 128x128 volume label from the rEFIt CD + image. + +- Added x86 and x86-64 EFI shells to the CD image version of the binary, + but NOT to the binary zip file. The logic is that the CD image is more + likely to be used directly as an emergency disc and so may need this + feature, even though the source isn't part of the rEFInd project. (The + source is readily available from the TianoCore project.) + +- EFI shells may now be stored at /shellx64.efi for x86-64 systems or at + /shellia32.efi for x86 systems. The /EFI/tools/shell.efi name is also + recognized; however, if both files are present, two EFI shell icons will + appear on the main menu. The /efi/{refind-path/apps/shell.efi filename, + which was never officially documented but worked as a carryover from + rEFIt, is no longer valid. + 0.2.3 (3/26/2012): ------------------ diff --git a/docs/refind/windows8-on-mac-efi.txt b/docs/refind/windows8-on-mac-efi.txt index 160919f..099d1a4 100644 --- a/docs/refind/windows8-on-mac-efi.txt +++ b/docs/refind/windows8-on-mac-efi.txt @@ -4,3 +4,4 @@ http://forums.macrumors.com/showpost.php?p=13381781&postcount=82 http://forums.macrumors.com/showpost.php?p=14026284&postcount=170 +http://forums.macrumors.com/showpost.php?p=14631912&postcount=459 diff --git a/icons/os_refit.icns b/icons/os_refit.icns index 16ec814..652c8b2 100644 Binary files a/icons/os_refit.icns and b/icons/os_refit.icns differ diff --git a/mkcdimage b/mkcdimage index 613ab62..d38bcd8 100755 --- a/mkcdimage +++ b/mkcdimage @@ -23,11 +23,16 @@ rm -rf temp mkdir temp cd temp unzip ../refind-bin-$Version.zip +cp $StartDir/SHELLS.txt ./refind-bin-$Version -# Create hard links to the files so that they'll be suitable for an -# EFI-boot CD... +# Create a boot directory and (temporarily) copy the EFI shell +# files to it.... mkdir -p refind-bin-$Version/EFI/boot cd refind-bin-$Version/EFI/boot +cp $StartDir/shell*.efi ./ + +# Create hard links to the rEFInd files so that they'll be suitable for an +# EFI-boot CD... ln ../../refind/refind_ia32.efi ./bootia32.efi ln ../../refind/refind_x64.efi ./bootx64.efi ln ../../refind/refind.conf-sample ./refind.conf @@ -41,18 +46,30 @@ ToritoSize=`du -s EFI | cut -f 1` let ToritoSize=($ToritoSize)/28 let ToritoSize=($ToritoSize)*32 +# Move the EFI shell files back to the root where they belong +# (They were in EFI/boot just so they'd get counted in ToritoSize) +mv EFI/boot/shell*.efi ./ + # Prepare a FAT filesystem image and populate it with the # EFI boot files.... dd if=/dev/zero of=refind-bin-$Version.img bs=1024 count=$ToritoSize mkdosfs -n "rEFInd.ET" refind-bin-$Version.img -mcopy -irefind-bin-$Version.img -s EFI ::/ +mcopy -irefind-bin-$Version.img -s EFI shell*.efi ::/ # Make the ISO-9660 image file.... mkisofs -A "Bootable rEFInd" -V "rEFInd $Version" -volset "rEFInd $Version" \ -J -r -v -x ./lost+found -o ../../refind-cd-$Version.iso \ - -b refind-bin-$Version.img -c boot.cat -no-emul-boot -boot-load-size 4 \ -eltorito-alt-boot -efi-boot refind-bin-$Version.img \ -no-emul-boot ./ + +# Below is like above, but also creates an El Torito entry for BIOS +# booting. That's useless, but in case something flakes out without +# it, I'll preserve this version for a while.... +#mkisofs -A "Bootable rEFInd" -V "rEFInd $Version" -volset "rEFInd $Version" \ +# -J -r -v -x ./lost+found -o ../../refind-cd-$Version.iso \ +# -b refind-bin-$Version.img -c boot.cat -no-emul-boot -boot-load-size 4 \ +# -eltorito-alt-boot -efi-boot refind-bin-$Version.img \ +# -no-emul-boot ./ cd ../../ rm -r temp/ diff --git a/refind.conf-sample b/refind.conf-sample index 06ecaa9..336a11c 100644 --- a/refind.conf-sample +++ b/refind.conf-sample @@ -76,6 +76,15 @@ timeout 20 # Default is internal,external,optical scanfor internal,external,optical +# 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 +# a subset in a scrolling list. If this value is set too high for the +# screen to handle, it's reduced to the value that the screen can manage. +# If this value is set to 0 (the default), it's adjusted to the number +# that the screen can handle. +# +#max_tags 0 + # Set the default menu selection. The available arguments match the # keyboard accelerators available within rEFInd. You may select the default # loader using a one-character abbreviation for the OS name ("M" = Mac OS X, diff --git a/refind/config.c b/refind/config.c index 36026c0..2100a91 100644 --- a/refind/config.c +++ b/refind/config.c @@ -390,6 +390,8 @@ VOID ReadConfig(VOID) } else if ((StriCmp(TokenList[0], L"}") == 0) || (StriCmp(TokenList[0], L"loader") == 0) || (StriCmp(TokenList[0], L"icon") == 0) || (StriCmp(TokenList[0], L"options") == 0)) { // Do nothing; handled by ScanUserConfigured() + } else if ((StriCmp(TokenList[0], L"max_tags") == 0) && (TokenCount > 1)) { + GlobalConfig.MaxTags = Atoi(TokenList[1]); } FreeTokenLine(&TokenList, &TokenCount); diff --git a/refind/global.h b/refind/global.h index dccac51..2c0d681 100644 --- a/refind/global.h +++ b/refind/global.h @@ -147,7 +147,7 @@ typedef struct { UINTN Timeout; UINTN DisableFlags; UINTN HideUIFlags; - BOOLEAN Quiet; + UINTN MaxTags; // max. number of entries to show simultaneously in graphics mode CHAR16 *BannerFileName; CHAR16 *SelectionSmallFileName; CHAR16 *SelectionBigFileName; diff --git a/refind/lib.c b/refind/lib.c index 3feacbe..b0090c6 100644 --- a/refind/lib.c +++ b/refind/lib.c @@ -1048,7 +1048,7 @@ VOID MergeStrings(IN OUT CHAR16 **First, IN CHAR16 *Second, CHAR16 AddChar) { NewString[Length1] = AddChar; NewString[Length1 + 1] = 0; } // if (AddChar) - } // if (First != NULL) + } // if (*First != NULL) if (First != NULL) StrCat(NewString, Second); FreePool(*First); diff --git a/refind/main.c b/refind/main.c index 48f41fe..9612f4d 100644 --- a/refind/main.c +++ b/refind/main.c @@ -55,6 +55,13 @@ // variables #define MACOSX_LOADER_PATH L"\\System\\Library\\CoreServices\\boot.efi" +#if defined (EFIX64) +#define SHELL_NAMES L"\\EFI\\tools\\shell.efi,\\shellx64.efi" +#elif defined (EFI32) +#define SHELL_NAMES L"\\EFI\\tools\\shell.efi,\\shellia32.efi" +#else +#define SHELL_NAMES L"\\EFI\\tools\\shell.efi" +#endif static REFIT_MENU_ENTRY MenuEntryAbout = { L"About rEFInd", TAG_ABOUT, 1, 0, 'A', NULL, NULL, NULL }; static REFIT_MENU_ENTRY MenuEntryReset = { L"Restart Computer", TAG_RESET, 1, 0, 'R', NULL, NULL, NULL }; @@ -64,7 +71,7 @@ static REFIT_MENU_ENTRY MenuEntryReturn = { L"Return to Main Menu", TAG_RETURN static REFIT_MENU_SCREEN MainMenu = { L"Main Menu", NULL, 0, NULL, 0, NULL, 0, L"Automatic boot" }; static REFIT_MENU_SCREEN AboutMenu = { L"About", NULL, 0, NULL, 0, NULL, 0, NULL }; -REFIT_CONFIG GlobalConfig = { FALSE, 20, 0, 0, FALSE, NULL, NULL, NULL, NULL }; +REFIT_CONFIG GlobalConfig = { FALSE, 20, 0, 0, 0, NULL, NULL, NULL, NULL }; // // misc functions @@ -74,11 +81,12 @@ static VOID AboutrEFInd(VOID) { if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.3"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.3.3"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith"); AddMenuInfoLine(&AboutMenu, L"Portions Copyright (c) Intel Corporation and others"); + AddMenuInfoLine(&AboutMenu, L"Distributed under the terms of the GNU GPLv3 license"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Running on:"); AddMenuInfoLine(&AboutMenu, PoolPrint(L" EFI Revision %d.%02d", @@ -614,7 +622,8 @@ static VOID ScanLoaderDir(IN REFIT_VOLUME *Volume, IN CHAR16 *Path) if (DirEntry->FileName[0] == '.' || StriCmp(DirEntry->FileName, L"TextMode.efi") == 0 || StriCmp(DirEntry->FileName, L"ebounce.efi") == 0 || - StriCmp(DirEntry->FileName, L"GraphicsConsole.efi") == 0) + StriCmp(DirEntry->FileName, L"GraphicsConsole.efi") == 0 || + StriSubCmp(L"shell", DirEntry->FileName)) continue; // skip this if (Path) @@ -639,7 +648,6 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) { REFIT_DIR_ITER EfiDirIter; EFI_FILE_INFO *EfiDirEntry; CHAR16 FileName[256]; -// LOADER_ENTRY *Entry; if ((Volume->RootDir != NULL) && (Volume->VolName != NULL)) { // check for Mac OS X boot loader @@ -670,7 +678,7 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) { // scan subdirectories of the EFI directory (as per the standard) DirIterOpen(Volume->RootDir, L"EFI", &EfiDirIter); while (DirIterNext(&EfiDirIter, 1, NULL, &EfiDirEntry)) { - if (StriCmp(EfiDirEntry->FileName, L"TOOLS") == 0 || EfiDirEntry->FileName[0] == '.') + if (StriCmp(EfiDirEntry->FileName, L"tools") == 0 || EfiDirEntry->FileName[0] == '.') continue; // skip this, doesn't contain boot loaders SPrint(FileName, 255, L"EFI\\%s", EfiDirEntry->FileName); ScanLoaderDir(Volume, FileName); @@ -1061,35 +1069,36 @@ static LOADER_ENTRY * AddToolEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderTitle return Entry; } /* static LOADER_ENTRY * AddToolEntry() */ +// Check the disk for add-on tools -- an EFI shell, the dangerous gptsync.efi, and a rescue Linux +// installation. static VOID ScanTool(VOID) { - CHAR16 FileName[256]; + CHAR16 *FileName; LOADER_ENTRY *Entry; + UINTN i = 0; if (GlobalConfig.DisableFlags & DISABLE_FLAG_TOOLS) return; // look for the EFI shell - if (!(GlobalConfig.DisableFlags & DISABLE_FLAG_SHELL)) { - SPrint(FileName, 255, L"%s\\apps\\shell.efi", SelfDirPath); - if (FileExists(SelfRootDir, FileName)) { - AddToolEntry(FileName, L"EFI Shell", BuiltinIcon(BUILTIN_ICON_TOOL_SHELL), 'E', FALSE); - } else { - StrCpy(FileName, L"\\efi\\tools\\shell.efi"); - if (FileExists(SelfRootDir, FileName)) { - AddToolEntry(FileName, L"EFI Shell", BuiltinIcon(BUILTIN_ICON_TOOL_SHELL), 'E', FALSE); - } - } - } + while (((FileName = FindCommaDelimited(SHELL_NAMES, i++)) != NULL) && (!(GlobalConfig.DisableFlags & DISABLE_FLAG_SHELL))) { + if (FileExists(SelfRootDir, FileName)) { + AddToolEntry(FileName, L"EFI Shell", BuiltinIcon(BUILTIN_ICON_TOOL_SHELL), 'E', FALSE); + } + FreePool(FileName); + FileName = NULL; + } // while // look for the GPT/MBR sync tool - StrCpy(FileName, L"\\efi\\tools\\gptsync.efi"); + MergeStrings(&FileName, L"\\efi\\tools\\gptsync.efi", 0); if (FileExists(SelfRootDir, FileName)) { AddToolEntry(FileName, L"Make Hybrid MBR", BuiltinIcon(BUILTIN_ICON_TOOL_PART), 'P', FALSE); } + FreePool(FileName); + FileName = NULL; // look for rescue Linux - StrCpy(FileName, L"\\efi\\rescue\\elilo.efi"); + MergeStrings(&FileName, L"\\efi\\rescue\\elilo.efi", 0); if (SelfVolume != NULL && FileExists(SelfRootDir, FileName)) { Entry = AddToolEntry(FileName, L"Rescue Linux", BuiltinIcon(BUILTIN_ICON_TOOL_RESCUE), '0', FALSE); @@ -1100,7 +1109,8 @@ static VOID ScanTool(VOID) else Entry->LoadOptions = L"-d 0 mini"; } -} + FreePool(FileName); +} /* VOID ScanTool() */ #ifdef DEBIAN_ENABLE_EFI110 diff --git a/refind/menu.c b/refind/menu.c index aedeb22..a1120ba 100644 --- a/refind/menu.c +++ b/refind/menu.c @@ -166,9 +166,8 @@ static VOID InitScroll(OUT SCROLL_STATE *State, IN UINTN ItemCount, IN UINTN Vis State->LastSelection = State->CurrentSelection = 0; State->MaxIndex = (INTN)ItemCount - 1; State->FirstVisible = 0; - if (VisibleSpace == 0) - State->MaxVisible = UGAWidth / (ROW0_TILESIZE + TILE_XSPACING) - 1; - else + State->MaxVisible = UGAWidth / (ROW0_TILESIZE + TILE_XSPACING) - 1; + if ((VisibleSpace > 0) && (VisibleSpace < State->MaxVisible)) State->MaxVisible = (INTN)VisibleSpace; State->PaintAll = TRUE; State->PaintSelection = FALSE; @@ -729,7 +728,7 @@ VOID MainMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, IN UINT switch (Function) { case MENU_FUNCTION_INIT: - InitScroll(State, Screen->EntryCount, 0); + InitScroll(State, Screen->EntryCount, GlobalConfig.MaxTags); // layout row0Count = 0;