From 959d997f90467091f3b8d7ed5a428f9050960e2a Mon Sep 17 00:00:00 2001 From: srs5694 Date: Thu, 9 May 2013 12:03:47 -0400 Subject: [PATCH] Fixed gptsync bug that could cause system hang; changed "Reboot to Firmware User Interface" to "Reboot to Computer Setup Utility" in main menu. --- Make.common | 16 ++++++++-------- NEWS.txt | 9 +++++++++ docs/refind/configfile.html | 2 +- gptsync/Make.tiano | 2 +- gptsync/gptsync.c | 8 ++++---- gptsync/gptsync.h | 1 + refind/lib.c | 2 +- refind/main.c | 4 ++-- 8 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Make.common b/Make.common index 7127fdf..0d994e5 100644 --- a/Make.common +++ b/Make.common @@ -3,16 +3,16 @@ # Common make rules for building with gnu-efi # -#EFIINC = /usr/include/efi -#GNUEFILIB = /usr/lib64 -#EFILIB = /usr/lib64 -#EFICRT0 = /usr/lib64 +EFIINC = /usr/include/efi +GNUEFILIB = /usr/lib64 +EFILIB = /usr/lib64 +EFICRT0 = /usr/lib64 # Comment out above and uncomment below if using locally-compiled GNU-EFI.... -EFIINC = /usr/local/include/efi -GNUEFILIB = /usr/local/lib -EFILIB = /usr/local/lib -EFICRT0 = /usr/local/lib +#EFIINC = /usr/local/include/efi +#GNUEFILIB = /usr/local/lib +#EFILIB = /usr/local/lib +#EFICRT0 = /usr/local/lib HOSTARCH = $(shell uname -m | sed s,i[3456789]86,ia32,) ARCH := $(HOSTARCH) diff --git a/NEWS.txt b/NEWS.txt index a72a1bc..63dbd54 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,3 +1,12 @@ +0.6.10 (?/??/2013): +------------------- + +- Renamed "Reboot to Firmware User Interface" to "Reboot to Computer Setup + Utility" in menu. + +- Fixed bug in gptsync that caused it to hang if the disk had too few GPT + partitions to fill the MBR. + 0.6.10 (5/5/2013): ------------------ diff --git a/docs/refind/configfile.html b/docs/refind/configfile.html index a8dcb59..62438d3 100644 --- a/docs/refind/configfile.html +++ b/docs/refind/configfile.html @@ -244,7 +244,7 @@ timeout 20 showtools shell, gptsync, apple_recovery, mok_tool, about, exit, shutdown, reboot, and firmware - Specifies which tool tags to display on the second row. shell launches an EFI shell, gptsync launches a tool that creates a hybrid MBR, apple_recovery boots the OS X Recovery HD, mok_tool launches a tool to manage Machine Owner Keys (MOKs) on systems with Secure Boot active, about displays information about the program, exit terminates rEFInd, shutdown shuts down the computer (or reboots it, on some UEFI PCs), reboot reboots the computer, and firmware reboots the computer into the firmware's own user interface. The tags appear in the order in which you specify them. The default is shell, apple_recovery, mok_tool, about, shutdown, reboot, firmware. Note that the shell, apple_recovery, and mok_tool options all require the presence of programs not included with rEFInd. The gptsync option requires use of a like-named program which, although it ships with rEFInd 0.6.9 and later, is not installed by default except under OS X. See the "Installing Additional Components" section of the Installing rEFInd page for pointers to the shell and gptsync programs. The apple_recovery option will appear only if you've got an Apple Recovery HD partition (which has a boot loader called com.apple.recovery.boot/boot.efi). The firmware option works only on computers that support this option; on other computers, the option is quietly ignored. See the Secure Boot page for information on Secure Boot and MOK management. + Specifies which tool tags to display on the second row. shell launches an EFI shell, gptsync launches a tool that creates a hybrid MBR, apple_recovery boots the OS X Recovery HD, mok_tool launches a tool to manage Machine Owner Keys (MOKs) on systems with Secure Boot active, about displays information about the program, exit terminates rEFInd, shutdown shuts down the computer (or reboots it, on some UEFI PCs), reboot reboots the computer, and firmware reboots the computer into the computer's own setup utility. The tags appear in the order in which you specify them. The default is shell, apple_recovery, mok_tool, about, shutdown, reboot, firmware. Note that the shell, apple_recovery, and mok_tool options all require the presence of programs not included with rEFInd. The gptsync option requires use of a like-named program which, although it ships with rEFInd 0.6.9 and later, is not installed by default except under OS X. See the "Installing Additional Components" section of the Installing rEFInd page for pointers to the shell and gptsync programs. The apple_recovery option will appear only if you've got an Apple Recovery HD partition (which has a boot loader called com.apple.recovery.boot/boot.efi). The firmware option works only on computers that support this option; on other computers, the option is quietly ignored. See the Secure Boot page for information on Secure Boot and MOK management. font diff --git a/gptsync/Make.tiano b/gptsync/Make.tiano index b6c46f2..68a43ec 100644 --- a/gptsync/Make.tiano +++ b/gptsync/Make.tiano @@ -68,7 +68,7 @@ BUILDME = gptsync_$(FILENAME_CODE).efi OPTIMFLAGS = -fno-strict-aliasing -mno-red-zone -Wno-address -Os DEBUGFLAGS = -Wall -Wno-missing-braces -Wno-array-bounds -ffunction-sections -fdata-sections -CFLAGS = $(OPTIMFLAGS) -g -fshort-wchar -fno-stack-protector $(DEBUGFLAGS) -c -DHOST_EFI_EDK2 -D__MAKEWITH_TIANO +CFLAGS = $(OPTIMFLAGS) -g -fshort-wchar -fno-stack-protector $(DEBUGFLAGS) -c -DHOST_EFI_EDK2 -D__MAKEWITH_TIANO -std=gnu89 #CFLAGS = $(OPTIMFLAGS) -g -fshort-wchar -fno-stack-protector $(DEBUGFLAGS) -c -include AutoGen.h -DHOST_EFI_EDK2 prefix = /usr/bin/ diff --git a/gptsync/gptsync.c b/gptsync/gptsync.c index 6cc1562..963e61c 100644 --- a/gptsync/gptsync.c +++ b/gptsync/gptsync.c @@ -285,7 +285,7 @@ static VOID generate_hybrid_mbr(VOID) { // partition if there are several Linux partitions before other hybridized // partitions. i = gpt_part_count - 1; // Note that gpt_part_count can't be 0; filtered by check_gpt() - while (i >= 0 && new_mbr_part_count <= 3) { + while (i < gpt_part_count && new_mbr_part_count <= 3) { // if too few GPT partitions, i loops around to a huge value if ((gpt_parts[i].start_lba > 0) && (gpt_parts[i].end_lba > 0) && (gpt_parts[i].end_lba <= MAX_MBR_LBA) && ((gpt_parts[i].gpt_parttype->kind == GPT_KIND_DATA) || (gpt_parts[i].gpt_parttype->kind == GPT_KIND_BASIC_DATA)) && @@ -353,9 +353,9 @@ static VOID generate_hybrid_mbr(VOID) { // set active on the first matching partition if (count_active == 0) { for (i = 0; i < new_mbr_part_count; i++) { - if ((iter >= 0 && (new_mbr_parts[i].mbr_type == 0x07 || // NTFS - new_mbr_parts[i].mbr_type == 0x0b || // FAT32 - new_mbr_parts[i].mbr_type == 0x0c)) || // FAT32 (LBA) + if (((new_mbr_parts[i].mbr_type == 0x07 || // NTFS + new_mbr_parts[i].mbr_type == 0x0b || // FAT32 + new_mbr_parts[i].mbr_type == 0x0c)) || // FAT32 (LBA) (iter >= 1 && (new_mbr_parts[i].mbr_type == 0x83)) || // Linux (iter >= 2 && i > 0)) { new_mbr_parts[i].active = TRUE; diff --git a/gptsync/gptsync.h b/gptsync/gptsync.h index 6ac9838..17150e2 100644 --- a/gptsync/gptsync.h +++ b/gptsync/gptsync.h @@ -41,6 +41,7 @@ // config // + #if defined(EFI32) || defined(EFIX64) #define CONFIG_EFI #endif diff --git a/refind/lib.c b/refind/lib.c index d0262c1..787c896 100644 --- a/refind/lib.c +++ b/refind/lib.c @@ -1429,7 +1429,7 @@ VOID MergeStrings(IN OUT CHAR16 **First, IN CHAR16 *Second, CHAR16 AddChar) { CHAR16 *FindExtension(IN CHAR16 *Path) { CHAR16 *Extension; BOOLEAN Found = FALSE, FoundSlash = FALSE; - UINTN i; + INTN i; Extension = AllocateZeroPool(sizeof(CHAR16)); if (Path) { diff --git a/refind/main.c b/refind/main.c index 60de8df..8144b2d 100644 --- a/refind/main.c +++ b/refind/main.c @@ -111,7 +111,7 @@ static REFIT_MENU_ENTRY MenuEntryReset = { L"Reboot Computer", TAG_REBOOT, 1, 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, 1, 0, 0, NULL, NULL, NULL }; static REFIT_MENU_ENTRY MenuEntryExit = { L"Exit rEFInd", TAG_EXIT, 1, 0, 0, NULL, NULL, NULL }; -static REFIT_MENU_ENTRY MenuEntryFirmware = { L"Reboot to Firmware User Interface", TAG_FIRMWARE, 1, 0, 0, NULL, NULL, NULL }; +static REFIT_MENU_ENTRY MenuEntryFirmware = { L"Reboot to Computer Setup Utility", TAG_FIRMWARE, 1, 0, 0, NULL, NULL, NULL }; static REFIT_MENU_SCREEN MainMenu = { L"Main Menu", NULL, 0, NULL, 0, NULL, 0, L"Automatic boot", L"Use arrow keys to move cursor; Enter to boot;", @@ -144,7 +144,7 @@ static VOID AboutrEFInd(VOID) if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.6.10"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.6.10.1"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2013 Roderick W. Smith"); -- 2.39.2