]> code.delx.au - refind/commitdiff
Fixed gptsync bug that could cause system hang; changed "Reboot to
authorsrs5694 <srs5694@users.sourceforge.net>
Thu, 9 May 2013 16:03:47 +0000 (12:03 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Thu, 9 May 2013 16:03:47 +0000 (12:03 -0400)
Firmware User Interface" to "Reboot to Computer Setup Utility" in main
menu.

Make.common
NEWS.txt
docs/refind/configfile.html
gptsync/Make.tiano
gptsync/gptsync.c
gptsync/gptsync.h
refind/lib.c
refind/main.c

index 7127fdf2db4b92eadda6c69a1bd7b0d818c4aefd..0d994e598131655c0458b45de1d08528affeff5b 100644 (file)
@@ -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)
index a72a1bc5cdbd1b203c471b2d3764637b88783f6d..63dbd54d9fc3b3af5cb40e84d695281c1ad37762 100644 (file)
--- 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):
 ------------------
 
index a8dcb595bb541b40ed3cd8ea1af543bf7ac3f739..62438d3169010feb5cd2d6d86def4e042c291ee9 100644 (file)
@@ -244,7 +244,7 @@ timeout 20
 <tr>
    <td><tt>showtools</tt></td>
    <td><tt>shell</tt>, <tt>gptsync</tt>, <tt>apple_recovery</tt>, <tt>mok_tool</tt>, <tt>about</tt>, <tt>exit</tt>, <tt>shutdown</tt>, <tt>reboot</tt>, and <tt>firmware</tt></td>
-   <td>Specifies which tool tags to display on the second row. <tt>shell</tt> launches an EFI shell, <tt>gptsync</tt> launches a tool that creates a hybrid MBR, <tt>apple_recovery</tt> boots the OS X Recovery HD, <tt>mok_tool</tt> launches a tool to manage Machine Owner Keys (MOKs) on systems with Secure Boot active, <tt>about</tt> displays information about the program, <tt>exit</tt> terminates rEFInd, <tt>shutdown</tt> shuts down the computer (or reboots it, on some UEFI PCs), <tt>reboot</tt> reboots the computer, and <tt>firmware</tt> reboots the computer into the firmware's own user interface. The tags appear in the order in which you specify them. The default is <tt>shell, apple_recovery, mok_tool, about, shutdown, reboot, firmware</tt>. Note that the <tt>shell</tt>, <tt>apple_recovery</tt>, and <tt>mok_tool</tt> options all require the presence of programs not included with rEFInd. The <tt>gptsync</tt> 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 <a href="installing.html#addons">"Installing Additional Components"</a> section of the <a href="installing.html">Installing rEFInd</a> page for pointers to the shell and <tt>gptsync</tt> programs. The <tt>apple_recovery</tt> option will appear only if you've got an Apple Recovery HD partition (which has a boot loader called <tt>com.apple.recovery.boot/boot.efi</tt>). The <tt>firmware</tt> option works only on computers that support this option; on other computers, the option is quietly ignored. See the <a href="secureboot.html">Secure Boot</a> page for information on Secure Boot and MOK management.</td>
+   <td>Specifies which tool tags to display on the second row. <tt>shell</tt> launches an EFI shell, <tt>gptsync</tt> launches a tool that creates a hybrid MBR, <tt>apple_recovery</tt> boots the OS X Recovery HD, <tt>mok_tool</tt> launches a tool to manage Machine Owner Keys (MOKs) on systems with Secure Boot active, <tt>about</tt> displays information about the program, <tt>exit</tt> terminates rEFInd, <tt>shutdown</tt> shuts down the computer (or reboots it, on some UEFI PCs), <tt>reboot</tt> reboots the computer, and <tt>firmware</tt> reboots the computer into the computer's own setup utility. The tags appear in the order in which you specify them. The default is <tt>shell, apple_recovery, mok_tool, about, shutdown, reboot, firmware</tt>. Note that the <tt>shell</tt>, <tt>apple_recovery</tt>, and <tt>mok_tool</tt> options all require the presence of programs not included with rEFInd. The <tt>gptsync</tt> 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 <a href="installing.html#addons">"Installing Additional Components"</a> section of the <a href="installing.html">Installing rEFInd</a> page for pointers to the shell and <tt>gptsync</tt> programs. The <tt>apple_recovery</tt> option will appear only if you've got an Apple Recovery HD partition (which has a boot loader called <tt>com.apple.recovery.boot/boot.efi</tt>). The <tt>firmware</tt> option works only on computers that support this option; on other computers, the option is quietly ignored. See the <a href="secureboot.html">Secure Boot</a> page for information on Secure Boot and MOK management.</td>
 </tr>
 <tr>
    <td><tt>font</tt></td>
index b6c46f2c7112984b0d3759fa13cd5bfdcba2f602..68a43ece994cb98f9d6a8b21dbfe17e699d66902 100644 (file)
@@ -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/
index 6cc156269a7b942d68029dc2c444b7ff0a1c890f..963e61c3250e80905aa0143d986b1372934cf5a3 100644 (file)
@@ -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;
index 6ac983829b3f0e103be5a93f85df28b833f4357f..17150e28dc14900b9bb9f01a57e51fac456dd1d7 100644 (file)
@@ -41,6 +41,7 @@
 // config
 //
 
+
 #if defined(EFI32) || defined(EFIX64)
 #define CONFIG_EFI
 #endif
index d0262c1ff279b351f26ef9d92ccf54594b6f8e02..787c89644ce3f8cba90282ce822ec32033153d37 100644 (file)
@@ -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) {
index 60de8df1ac2e6f9397ee933af6fd2ac0c5e96c72..8144b2dcd2f058ba2b63f8209f1b5d8f5a73b3c8 100644 (file)
@@ -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");