0.2.4 (?/??/2012):
------------------
+- Created new refind.conf entry: "showtools". This entry takes options of
+ "shell", "gptsync", "about", "exit", "reboot", and "shutdown". This
+ option is in some respects an affirmative version of portions of the old
+ "disable" and "hideui" options; however, it enables users to specify the
+ order in which these options appear on the screen. Also, the "exit"
+ option is new; it terminates the program. The effect is usually to return
+ to whatever tool launched it or to launch a default OS; however, this is
+ somewhat unpredictable. The default therefore omits the "exit" option, as
+ well as "gptsync", which has always been dangerous (but necessary on most
+ MacOS/Windows dual-boot setups on Macs). As part of this reconfiguration,
+ I've eliminated the "rescue Linux" option, which always seemed pointless
+ to me.
+
+- Folded "disable" and "hideui" refind.conf entries into one ("disable"),
+ and reduced the number of options to six: "banner", "label",
+ "singleuser", "hwtest", "arrows", and "all". ("arrows" is new and
+ disables the scroll arrows when a system has too many tags to display
+ simultaneously.)
+
- 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.
#
timeout 20
-# Disable menu options for increased security. These are intended for a lab
-# environment where the administrator doesn't want users to mess with the
-# operating system. List the names for the options you want to hide from
-# the boot menu. Currently supported:
-# shell - remove the EFI shell
-# tools - remove all EFI tools (shell and gptsync)
+# Disable user interface elements for personal preference or to increase
+# security:
+# banner - the rEFInd title banner
+# label - text label in the menu
# singleuser - remove the submenu options to boot Mac OS X in single-user
-# or verbose modes
-# hwtest - remove the submenu option to run Apple Hardware Test
+# or verbose modes
+# hwtest - the submenu option to run Apple's hardware test
+# arrows - scroll arrows on the OS selection tag line
# all - all of the above
#
-#disable shell singleuser
+#disable singleuser
#disable all
# Use a custom title banner instead of the rEFInd icon and name. The file
#selection_big selection-big.bmp
#selection_small selection-small.bmp
-# Hide various user interface elements. Here you can list the names of
-# interface elements to hide. Currently supported:
-# banner - the rEFInd title banner
-# shell - the EFI shell icon
-# tools - all EFI tools (shell and gptsync)
-# funcs - built-in functions (about, restart)
-# ('tools' and 'funcs' together hide the complete second row of icons.)
-# label - text label in the menu
-# badges - all volume badges (same as 'hidebadges all'); this setting
-# is not recommended because it won't let you distinguish
-# installed OSes and bootable CDs/DVDs.
-# all - all of the above, except for 'badges'
-#
-# Note: The 'shell' and 'tools' options are equivalent to the 'disable'
-# options with the same names.
-#
-#hideui tools funcs hdbadges
-#hideui all
-
# Use text mode only. When enabled, this option forces rEFInd into text mode.
#
#textonly
-# Which types of boot loaders to search:
+# Which non-bootloader tools to show on the tools line, and in what
+# order to display them:
+# shell - the EFI shell
+# gptsync - the (dangerous) gptsync.efi utility
+# about - an "about this program" option
+# exit - a tag to exit from rEFInd
+# shutdown - shuts down the computer (a bug causes this to reboot EFI
+# systems)
+# reboot - a tag to reboot the computer
+# Default is shell,about,shutdown,reboot
+#showtools shell, about, reboot
+
+# Which types of boot loaders to search, and in what order to display them:
# internal - internal EFI disk-based boot loaders
# external - external EFI disk-based boot loaders
# optical - EFI optical discs (CD, DVD, etc.)
disabled
}
-# EOF
if (StriCmp(TokenList[0], L"timeout") == 0) {
HandleInt(TokenList, TokenCount, &(GlobalConfig.Timeout));
-
- } else if (StriCmp(TokenList[0], L"disable") == 0) {
+
+ // Note: I'm using "hideui" as equivalent to "disable" for the moment (as of rEFInd 0.2.4)
+ // because I've folded two options into one and removed some values, so I want to catch
+ // existing configurations as much as possible. The "hideui" equivalency to "disable" will
+ // be removed sooner or later....
+ } else if ((StriCmp(TokenList[0], L"disable") == 0) || (StriCmp(TokenList[0], L"hideui") == 0)) {
for (i = 1; i < TokenCount; i++) {
FlagName = TokenList[i];
- if (StriCmp(FlagName, L"shell") == 0) {
- GlobalConfig.DisableFlags |= DISABLE_FLAG_SHELL;
- } else if (StriCmp(FlagName, L"tools") == 0) {
- GlobalConfig.DisableFlags |= DISABLE_FLAG_TOOLS;
+ if (StriCmp(FlagName, L"banner") == 0) {
+ GlobalConfig.DisableFlags |= DISABLE_FLAG_BANNER;
+ } else if (StriCmp(FlagName, L"label") == 0) {
+ GlobalConfig.DisableFlags |= DISABLE_FLAG_LABEL;
} else if (StriCmp(FlagName, L"singleuser") == 0) {
GlobalConfig.DisableFlags |= DISABLE_FLAG_SINGLEUSER;
} else if (StriCmp(FlagName, L"hwtest") == 0) {
GlobalConfig.DisableFlags |= DISABLE_FLAG_HWTEST;
+ } else if (StriCmp(FlagName, L"arrows") == 0) {
+ GlobalConfig.DisableFlags |= DISABLE_FLAG_ARROWS;
} else if (StriCmp(FlagName, L"all") == 0) {
GlobalConfig.DisableFlags = DISABLE_ALL;
} else {
else
GlobalConfig.ScanFor[i] = ' ';
}
- } else if (StriCmp(TokenList[0], L"hideui") == 0) {
- for (i = 1; i < TokenCount; i++) {
+ } else if (StriCmp(TokenList[0], L"showtools") == 0) {
+ SetMem(GlobalConfig.ShowTools, NUM_TOOLS * sizeof(UINTN), 0);
+ for (i = 1; (i < TokenCount) && (i < NUM_TOOLS); i++) {
FlagName = TokenList[i];
- if (StriCmp(FlagName, L"banner") == 0) {
- GlobalConfig.HideUIFlags |= HIDEUI_FLAG_BANNER;
- } else if (StriCmp(FlagName, L"shell") == 0) {
- GlobalConfig.DisableFlags |= DISABLE_FLAG_SHELL;
- } else if (StriCmp(FlagName, L"tools") == 0) {
- GlobalConfig.DisableFlags |= DISABLE_FLAG_TOOLS;
- } else if (StriCmp(FlagName, L"funcs") == 0) {
- GlobalConfig.HideUIFlags |= HIDEUI_FLAG_FUNCS;
- } else if (StriCmp(FlagName, L"label") == 0) {
- GlobalConfig.HideUIFlags |= HIDEUI_FLAG_LABEL;
- } else if (StriCmp(FlagName, L"all") == 0) {
- GlobalConfig.HideUIFlags = HIDEUI_ALL;
- GlobalConfig.DisableFlags |= DISABLE_FLAG_SHELL | DISABLE_FLAG_TOOLS;
+ if (StriCmp(FlagName, L"shell") == 0) {
+ GlobalConfig.ShowTools[i - 1] = TAG_SHELL;
+ } else if (StriCmp(FlagName, L"gptsync") == 0) {
+ GlobalConfig.ShowTools[i - 1] = TAG_GPTSYNC;
+ } else if (StriCmp(FlagName, L"about") == 0) {
+ GlobalConfig.ShowTools[i - 1] = TAG_ABOUT;
+ } else if (StriCmp(FlagName, L"exit") == 0) {
+ GlobalConfig.ShowTools[i - 1] = TAG_EXIT;
+ } else if (StriCmp(FlagName, L"reboot") == 0) {
+ GlobalConfig.ShowTools[i - 1] = TAG_REBOOT;
+ } else if (StriCmp(FlagName, L"shutdown") == 0) {
+ GlobalConfig.ShowTools[i - 1] = TAG_SHUTDOWN;
} else {
- Print(L" unknown hideui flag: '%s'\n", FlagName);
+ Print(L" unknown showtools flag: '%s'\n", FlagName);
}
- }
-
+ } // showtools options
+
} else if (StriCmp(TokenList[0], L"banner") == 0) {
HandleString(TokenList, TokenCount, &(GlobalConfig.BannerFileName));
FreeTokenLine(&TokenList, &TokenCount);
}
-
FreePool(File.Buffer);
} /* VOID ReadConfig() */
CHAR16 *End16Ptr;
} REFIT_FILE;
-#define DISABLE_FLAG_SHELL (0x0001)
-#define DISABLE_FLAG_TOOLS (0x0002)
+#define DISABLE_FLAG_BANNER (0x0001)
+#define DISABLE_FLAG_LABEL (0x0002)
#define DISABLE_FLAG_SINGLEUSER (0x0004)
#define DISABLE_FLAG_HWTEST (0x0008)
+#define DISABLE_FLAG_ARROWS (0x0010)
#define DISABLE_ALL ((0xffff))
-#define HIDEUI_FLAG_BANNER (0x0001)
-#define HIDEUI_FLAG_FUNCS (0x0002)
-#define HIDEUI_FLAG_LABEL (0x0004)
-#define HIDEUI_ALL (0xffff)
-
VOID ReadConfig(VOID);
VOID ScanUserConfigured(VOID);
UINTN ReadTokenLine(IN REFIT_FILE *File, OUT CHAR16 ***TokenList);
#define REFIT_DEBUG (0)
+// Tag classifications; used in various ways.
#define TAG_ABOUT (1)
-#define TAG_RESET (2)
+#define TAG_REBOOT (2)
#define TAG_SHUTDOWN (3)
#define TAG_TOOL (4)
#define TAG_LOADER (5)
#define TAG_LEGACY (6)
+#define TAG_EXIT (7)
+#define TAG_SHELL (8)
+#define TAG_GPTSYNC (9)
+#define NUM_TOOLS (9)
#define NUM_SCAN_OPTIONS 10
+
//
// global definitions
//
BOOLEAN TextOnly;
UINTN Timeout;
UINTN DisableFlags;
- UINTN HideUIFlags;
- UINTN MaxTags; // max. number of entries to show simultaneously in graphics mode
+ UINTN MaxTags; // max. number of OS entries to show simultaneously in graphics mode
CHAR16 *BannerFileName;
CHAR16 *SelectionSmallFileName;
CHAR16 *SelectionBigFileName;
CHAR16 *DefaultSelection;
+ UINTN ShowTools[NUM_TOOLS];
CHAR8 ScanFor[NUM_SCAN_OPTIONS]; // codes of types of loaders for which to scan
} REFIT_CONFIG;
{ NULL, L"icons\\func_about.icns", 48 },
{ NULL, L"icons\\func_reset.icns", 48 },
{ NULL, L"icons\\func_shutdown.icns", 48 },
+ { NULL, L"icons\\func_exit.icns", 48 },
{ NULL, L"icons\\tool_shell.icns", 48 },
{ NULL, L"icons\\tool_part.icns", 48 },
{ NULL, L"icons\\tool_rescue.icns", 48 },
#define BUILTIN_ICON_FUNC_ABOUT (0)
#define BUILTIN_ICON_FUNC_RESET (1)
#define BUILTIN_ICON_FUNC_SHUTDOWN (2)
-#define BUILTIN_ICON_TOOL_SHELL (3)
-#define BUILTIN_ICON_TOOL_PART (4)
-#define BUILTIN_ICON_TOOL_RESCUE (5)
-#define BUILTIN_ICON_VOL_INTERNAL (6)
-#define BUILTIN_ICON_VOL_EXTERNAL (7)
-#define BUILTIN_ICON_VOL_OPTICAL (8)
-#define BUILTIN_ICON_COUNT (9)
+#define BUILTIN_ICON_FUNC_EXIT (3)
+#define BUILTIN_ICON_TOOL_SHELL (4)
+#define BUILTIN_ICON_TOOL_PART (5)
+#define BUILTIN_ICON_TOOL_RESCUE (6)
+#define BUILTIN_ICON_VOL_INTERNAL (7)
+#define BUILTIN_ICON_VOL_EXTERNAL (8)
+#define BUILTIN_ICON_VOL_OPTICAL (9)
+#define BUILTIN_ICON_COUNT (10)
#endif
#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 };
+static REFIT_MENU_ENTRY MenuEntryReset = { L"Reboot Computer", TAG_REBOOT, 1, 0, 'R', NULL, NULL, NULL };
static REFIT_MENU_ENTRY MenuEntryShutdown = { L"Shut Down Computer", TAG_SHUTDOWN, 1, 0, 'U', NULL, NULL, NULL };
static REFIT_MENU_ENTRY MenuEntryReturn = { L"Return to Main Menu", TAG_RETURN, 0, 0, 0, NULL, NULL, NULL };
+static REFIT_MENU_ENTRY MenuEntryExit = { L"Exit rEFInd", TAG_EXIT, 1, 0, 0, NULL, NULL, NULL };
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, 0, NULL, NULL, NULL, NULL };
+REFIT_CONFIG GlobalConfig = { FALSE, 20, 0, 0, NULL, NULL, NULL, NULL,
+ {TAG_SHELL, TAG_ABOUT, TAG_SHUTDOWN, TAG_REBOOT, 0, 0, 0, 0, 0 }};
//
// misc functions
{
if (AboutMenu.EntryCount == 0) {
AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
- AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.3.3");
+ AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.3.4");
AddMenuInfoLine(&AboutMenu, L"");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");
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;
- LOADER_ENTRY *Entry;
- UINTN i = 0;
-
- if (GlobalConfig.DisableFlags & DISABLE_FLAG_TOOLS)
- return;
-
- // look for the EFI shell
- 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
- 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
- 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);
-
- if (UGAWidth == 1440 && UGAHeight == 900)
- Entry->LoadOptions = L"-d 0 i17";
- else if (UGAWidth == 1680 && UGAHeight == 1050)
- Entry->LoadOptions = L"-d 0 i20";
- else
- Entry->LoadOptions = L"-d 0 mini";
- }
- FreePool(FileName);
-} /* VOID ScanTool() */
-
-
#ifdef DEBIAN_ENABLE_EFI110
//
// pre-boot driver functions
break;
} // switch()
} // for
- ScanTool();
- // fixed other menu entries
- if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_FUNCS)) {
- MenuEntryAbout.Image = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
- AddMenuEntry(&MainMenu, &MenuEntryAbout);
- }
- if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_FUNCS) || MainMenu.EntryCount == 0) {
- MenuEntryShutdown.Image = BuiltinIcon(BUILTIN_ICON_FUNC_SHUTDOWN);
- AddMenuEntry(&MainMenu, &MenuEntryShutdown);
- MenuEntryReset.Image = BuiltinIcon(BUILTIN_ICON_FUNC_RESET);
- AddMenuEntry(&MainMenu, &MenuEntryReset);
- }
-
// assign shortcut keys
for (i = 0; i < MainMenu.EntryCount && MainMenu.Entries[i]->Row == 0 && i < 9; i++)
MainMenu.Entries[i]->ShortcutDigit = (CHAR16)('1' + i);
FinishTextScreen(FALSE);
} // static VOID ScanForBootloaders()
+// Add the second-row tags containing built-in and external tools (EFI shell,
+// reboot, etc.)
+static VOID ScanForTools(VOID) {
+ CHAR16 *FileName = NULL;
+ UINTN i, j;
+
+ for (i = 0; i < NUM_TOOLS; i++) {
+ switch(GlobalConfig.ShowTools[i]) {
+ case TAG_SHUTDOWN:
+ MenuEntryShutdown.Image = BuiltinIcon(BUILTIN_ICON_FUNC_SHUTDOWN);
+ AddMenuEntry(&MainMenu, &MenuEntryShutdown);
+ break;
+ case TAG_REBOOT:
+ MenuEntryReset.Image = BuiltinIcon(BUILTIN_ICON_FUNC_RESET);
+ AddMenuEntry(&MainMenu, &MenuEntryReset);
+ break;
+ case TAG_ABOUT:
+ Print(L"Adding menu entry for the 'about' tag....\n");
+ MenuEntryAbout.Image = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
+ AddMenuEntry(&MainMenu, &MenuEntryAbout);
+ break;
+ case TAG_EXIT:
+ MenuEntryExit.Image = BuiltinIcon(BUILTIN_ICON_FUNC_EXIT);
+ AddMenuEntry(&MainMenu, &MenuEntryExit);
+ break;
+ case TAG_SHELL:
+ j = 0;
+ while ((FileName = FindCommaDelimited(SHELL_NAMES, j++)) != NULL) {
+ if (FileExists(SelfRootDir, FileName)) {
+ AddToolEntry(FileName, L"EFI Shell", BuiltinIcon(BUILTIN_ICON_TOOL_SHELL), 'E', FALSE);
+ }
+ } // while
+ break;
+ case TAG_GPTSYNC:
+ 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);
+ }
+ break;
+ } // switch()
+ if (FileName != NULL) {
+ FreePool(FileName);
+ FileName = NULL;
+ }
+ } // for
+} // static VOID ScanForTools
+
//
// main entry point
//
LoadDrivers();
#endif /* DEBIAN_ENABLE_EFI110 */
ScanForBootloaders();
+ ScanForTools();
while (MainLoopRunning) {
MenuExit = RunMainMenu(&MainMenu, GlobalConfig.DefaultSelection, &ChosenEntry);
}
switch (ChosenEntry->Tag) {
-
- case TAG_RESET: // Restart
+
+ case TAG_REBOOT: // Reboot
TerminateScreen();
refit_call4_wrapper(RT->ResetSystem, EfiResetCold, EFI_SUCCESS, 0, NULL);
MainLoopRunning = FALSE; // just in case we get this far
case TAG_TOOL: // Start a EFI tool
StartTool((LOADER_ENTRY *)ChosenEntry);
break;
+
+ case TAG_EXIT: // Terminate rEFInd
+ BeginTextScreen(L" ");
+ return EFI_SUCCESS;
+ break;
}
}
itemPosX[i], row1PosY);
}
}
- if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL))
+ if (!(GlobalConfig.DisableFlags & DISABLE_FLAG_LABEL))
DrawMainMenuText(Screen->Entries[State->CurrentSelection]->Title,
(UGAWidth - LAYOUT_TEXT_WIDTH) >> 1, textPosY);
} // static VOID PaintAll()
DrawMainMenuEntry(Screen->Entries[State->CurrentSelection], TRUE,
itemPosX[State->CurrentSelection - State->FirstVisible],
(Screen->Entries[State->CurrentSelection]->Row == 0) ? row0PosY : row1PosY);
- if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL))
+ if (!(GlobalConfig.DisableFlags & DISABLE_FLAG_LABEL))
DrawMainMenuText(Screen->Entries[State->CurrentSelection]->Title,
(UGAWidth - LAYOUT_TEXT_WIDTH) >> 1, textPosY);
} else {
// For PaintIcon() calls, the starting Y position is moved to the midpoint
// of the surrounding row; PaintIcon() adjusts this back up by half the
// icon's height to properly center it.
- if (State->FirstVisible > 0)
+ if ((State->FirstVisible > 0) && (!(GlobalConfig.DisableFlags & DISABLE_FLAG_ARROWS)))
PaintIcon(&egemb_arrow_left, L"icons\\arrow_left.icns", row0PosX - TILE_XSPACING,
row0PosY + (ROW0_TILESIZE / 2), ALIGN_RIGHT);
- if (State->LastVisible < (row0Loaders - 1))
+ if ((State->LastVisible < (row0Loaders - 1)) && (!(GlobalConfig.DisableFlags & DISABLE_FLAG_ARROWS)))
PaintIcon(&egemb_arrow_right, L"icons\\arrow_right.icns",
(UGAWidth + (ROW0_TILESIZE + TILE_XSPACING) * State->MaxVisible) / 2 + TILE_XSPACING,
row0PosY + (ROW0_TILESIZE / 2), ALIGN_LEFT);
break;
case MENU_FUNCTION_PAINT_TIMEOUT:
- if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL))
+ if (!(GlobalConfig.DisableFlags & DISABLE_FLAG_LABEL))
DrawMainMenuText(ParamText, (UGAWidth - LAYOUT_TEXT_WIDTH) >> 1, textPosY + TEXT_LINE_HEIGHT);
break;
{
static EG_IMAGE *Banner = NULL;
- if (ShowBanner && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_BANNER)) {
+ if (ShowBanner && !(GlobalConfig.DisableFlags & DISABLE_FLAG_BANNER)) {
// load banner on first call
if (Banner == NULL) {
if (GlobalConfig.BannerFileName == NULL)