]> code.delx.au - refind/commitdiff
Work around keyboard input problem in gptsync on some Macs. Minor
authorsrs5694 <srs5694@users.sourceforge.net>
Sun, 6 Dec 2015 21:22:51 +0000 (16:22 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Sun, 6 Dec 2015 21:22:51 +0000 (16:22 -0500)
reformatting/cleanup of Makefiles.

Make.common
NEWS.txt
filesystems/Make.gnuefi
filesystems/Make.tiano
gptsync/os_efi.c
refind/Make.tiano
refind/Makefile

index 563cdbf97890313ffd7302e84f6b2b48c992b5f6..d46be779b533560f74ea9db38493b11bcd27a39e 100644 (file)
@@ -113,8 +113,6 @@ FORMAT_DRIVER   = --target=efi-bsdrv-$(ARCH)
 #
 
 ifeq ($(ARCH),x86_64)
-#  CFLAGS += -DEFI_FUNCTION_WRAPPER
-#  GNUEFI_CFLAGS += -DEFIX64
   GNUEFI_LDFLAGS += -znocombreloc -zdefs
 
   ARCH_CFLAGS = -DEFIX64 -DEFI_FUNCTION_WRAPPER -m64 -mno-red-zone 
@@ -128,23 +126,14 @@ endif
   UC_ARCH = X64
   FILENAME_CODE = x64
   LD_CODE = elf_x86_64
-
-#   ifeq ($(HOSTARCH),ia32)
-#     ARCH3264 = -m64
-# 
-#     GNUEFILIB := $(GNUEFILIB)64
-#     EFILIB    := $(EFILIB)64
-#     EFICRT0   := $(EFICRT0)64
-#   endif
 endif
 
 ifeq ($(ARCH),ia32)
-#  GNUEFI_CFLAGS += -DEFI32 -malign-double
   GNUEFI_LDFLAGS += -znocombreloc -zdefs
 
+  # In practice, cross-compiling filesystem drivers works, but not the main
+  # rEFInd binary....
   ifeq ($(HOSTARCH),x86_64)
-#    ARCH3264 = -m32
-
     GNUEFILIB := $(GNUEFILIB)32
     EFILIB    := $(EFILIB)32
     EFICRT0   := $(EFICRT0)32
@@ -161,7 +150,6 @@ endif
 endif
 
 ifeq ($(ARCH), aarch64)
-#  CFLAGS += -fno-stack-check 
   GNUEFI_CFLAGS += -DEFIAARCH64
   FORMAT          = -O binary
   FORMAT_DRIVER   = -O binary
@@ -181,24 +169,12 @@ ifeq ($(ARCH), aarch64)
   LD_CODE = aarch64elf
 endif
 
-# ifneq (,$(findstring FreeBSD,$(OS)))
-#  ifeq ($(ARCH),x86_64)
-#      LDSCRIPT = $(EFICRT0)/elf_$(ARCH)_fbsd_efi.lds
-#  else
-#      LDSCRIPT = $(EFICRT0)/elf_$(ARCH)_efi.lds
-#  endif
-# else
-#      LDSCRIPT = $(EFICRT0)/elf_$(ARCH)_efi.lds
-# endif
-
-#
-# general rules
-#
-
+# GNU-EFI compilation path uses .o files for compiled object code
 %.o: %.c
        $(CC) $(CFLAGS) $(ARCH_CFLAGS) $(GNUEFI_CFLAGS) $(LOCAL_GNUEFI_CFLAGS) \
              -D__MAKEWITH_GNUEFI -DREFIND_VERSION=$(REFIND_VERSION) -c $< -o $@
 
+# TianoCore compilation path uses .obj files for compiled object code
 %.obj: %.c
        $(CC) $(CFLAGS) $(ARCH_CFLAGS) $(TIANO_INCLUDE_DIRS) -DNO_BUILTIN_VA_FUNCS \
              -D__MAKEWITH_TIANO -DREFIND_VERSION=$(REFIND_VERSION) -c $< -o $@
index d39db5f85544ba4dcb704f746ce1c5386c9ca089..0beac951e670df70ede9714badd48ef779100127 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -6,6 +6,10 @@
   it; but it should make future extensions to additional platforms or
   building in different environments easier.
 
+- Added workaround to gptsync for issue with some Macs' EFIs that caused
+  the program to skip through all prompts accepting the default option.
+  This would normally cause gptsync to do nothing.
+
 - Added type code 53746F72-6167-11AA-AA11-00306543ECAC (Apple Core Storage,
   gdisk type AF05) to list of partition types recognized by gptsync.
 
index cfa669500305a184aa5b7ea5a15ee6094000f742..71d397f2a6a6826edc229666d3ba3ee39b9fc9cb 100644 (file)
@@ -13,8 +13,6 @@ SRCDIR = .
 VPATH = $(SRCDIR)
 HOSTARCH        = $(shell uname -m | sed s,i[3456789]86,ia32,)
 
-# Note: IA64 options are untested; taken from Debian's rEFIt package.
-
 LOCAL_GNUEFI_CFLAGS   = -DFSTYPE=$(DRIVERNAME) -I$(SRCDIR) 
 ifeq ($(HOSTARCH),x86_64)
   LOCAL_GNUEFI_CFLAGS += "-DEFIAPI=__attribute__((ms_abi))" 
index 2c30d54b8a08d4fcc9410ef96fedf0135f8ad4d0..537c0e0b81cd91c0f5cf7495e3fa863162af8f5a 100644 (file)
@@ -45,7 +45,9 @@ BUILDME          = $(DRIVERNAME)_$(FILENAME_CODE).efi
 ENTRYPOINT = _ModuleEntryPoint
 
 %.obj: %.c
-       $(CC) $(ARCH_CFLAGS) $(CFLAGS) $(TIANO_INCLUDE_DIRS) -DFSTYPE=$(DRIVERNAME) -DNO_BUILTIN_VA_FUNCS -D__MAKEWITH_TIANO -c $< -o $@
+       $(CC) $(ARCH_CFLAGS) $(CFLAGS) $(TIANO_INCLUDE_DIRS) \
+             -DFSTYPE=$(DRIVERNAME) -DNO_BUILTIN_VA_FUNCS \
+             -D__MAKEWITH_TIANO -c $< -o $@
 
 ifneq (,$(filter %.efi,$(BUILDME)))
 
@@ -54,7 +56,8 @@ DLL_TARGET = $(subst .efi,.dll,$(BUILDME))
 all: $(BUILDME)
 
 $(DLL_TARGET): $(OBJS) fsw_$(DRIVERNAME).obj
-       $(LD) -o $(DRIVERNAME)_$(FILENAME_CODE).dll $(TIANO_LDFLAGS) --start-group $(ALL_EFILIBS) $(OBJS) fsw_$(DRIVERNAME).obj --end-group
+       $(LD) -o $(DRIVERNAME)_$(FILENAME_CODE).dll $(TIANO_LDFLAGS) \
+             --start-group $(ALL_EFILIBS) $(OBJS) fsw_$(DRIVERNAME).obj --end-group
 
 $(BUILDME): $(DLL_TARGET)
        $(OBJCOPY) --strip-unneeded -R .eh_frame $(DLL_TARGET)
index 51293d80f00e309a7c0bc8a99623602d5974ea0f..e857f712111a8acde4d34bc4a28e810344afa4db 100644 (file)
@@ -125,15 +125,13 @@ UINTN input_boolean(CHARN *prompt, BOOLEAN *bool_out)
 
     Print(prompt);
 
-    if (ReadAllKeyStrokes()) {  // remove buffered key strokes
-        refit_call1_wrapper(BS->Stall, 500000);      // 0.5 seconds delay
-        ReadAllKeyStrokes();    // empty the buffer again
-    }
-
-    refit_call3_wrapper(BS->WaitForEvent, 1, &ST->ConIn->WaitForKey, &Index);
-    Status = refit_call2_wrapper(ST->ConIn->ReadKeyStroke, ST->ConIn, &Key);
-    if (EFI_ERROR(Status))
-        return 1;
+    ReadAllKeyStrokes(); // Remove buffered key strokes
+    do {
+        refit_call3_wrapper(BS->WaitForEvent, 1, &ST->ConIn->WaitForKey, &Index);
+        Status = refit_call2_wrapper(ST->ConIn->ReadKeyStroke, ST->ConIn, &Key);
+        if (EFI_ERROR(Status) && Status != EFI_NOT_READY)
+            return 1;
+    } while (Status == EFI_NOT_READY);
 
     if (Key.UnicodeChar == 'y' || Key.UnicodeChar == 'Y') {
         Print(L"Yes\n");
index 6120c2f31f68123a36e161a283b3845e63ed4a4b..1ef88e6aad1fd9ecc5b2c306152e887899b9885c 100644 (file)
@@ -46,13 +46,13 @@ $(AR_TARGET): $(OBJS)
 
 $(DLL_TARGET)_$(FILENAME_CODE).dll: $(OBJS) ../libeg/libeg.lib ../EfiLib/EfiLib.lib ../mok/mok.lib
        $(LD) -o $(DLL_TARGET)_$(FILENAME_CODE).dll $(TIANO_LDFLAGS) \
-         --start-group $(ALL_EFILIBS) $(OBJS) ../libeg/libeg.lib \
-         ../EfiLib/EfiLib.lib ../mok/mok.lib --end-group
+                 --start-group $(ALL_EFILIBS) $(OBJS) ../libeg/libeg.lib \
+                 ../EfiLib/EfiLib.lib ../mok/mok.lib --end-group
 
 $(BUILDME): $(DLL_TARGET)_$(FILENAME_CODE).dll
        $(OBJCOPY) --strip-unneeded -R .eh_frame $(DLL_TARGET)_$(FILENAME_CODE).dll
        $(GENFW) -e UEFI_APPLICATION -o $(BUILDME)_$(FILENAME_CODE).efi \
-         $(DLL_TARGET)_$(FILENAME_CODE).dll
+                $(DLL_TARGET)_$(FILENAME_CODE).dll
 
 clean:
        make clean
index afda38abef3a60b8b012ccd10734e094cd0420eb..88fbc407775cede3141c68614b438752275b686a 100644 (file)
@@ -30,18 +30,23 @@ ifeq ($(ARCH),aarch64)
   TARGET = refind_aa64.efi
 endif
 
-LOCAL_GNUEFI_CFLAGS  = -I$(SRCDIR) -I$(SRCDIR)/../include -I$(SRCDIR)/../libeg -I$(SRCDIR)/../mok
-LOCAL_LDFLAGS   = -L$(SRCDIR)/../libeg/ -L$(SRCDIR)/../mok/ -L$(SRCDIR)/../EfiLib/
+LOCAL_GNUEFI_CFLAGS  = -I$(SRCDIR) -I$(SRCDIR)/../include \
+                       -I$(SRCDIR)/../libeg -I$(SRCDIR)/../mok
+LOCAL_LDFLAGS   = -L$(SRCDIR)/../libeg/ -L$(SRCDIR)/../mok/ \
+                  -L$(SRCDIR)/../EfiLib/
 LOCAL_LIBS      = -leg -lmok -lEfiLib
 
-OBJS            = main.o mystrings.o apple.o line_edit.o config.o menu.o screen.o icns.o gpt.o crc32.o lib.o driver_support.o legacy.o
+OBJS            = main.o mystrings.o apple.o line_edit.o config.o menu.o \
+                  screen.o icns.o gpt.o crc32.o lib.o driver_support.o \
+                 legacy.o
 
 include $(SRCDIR)/../Make.common
 
 all: $(TARGET)
 
 $(SHLIB_TARGET): $(OBJS)
-       $(LD) $(LOCAL_LDFLAGS) $(GNUEFI_LDFLAGS) $(SUBSYSTEM_LDFLAG) $(OBJS) -o $@ $(LOCAL_LIBS) $(GNUEFI_LIBS)
+       $(LD) $(LOCAL_LDFLAGS) $(GNUEFI_LDFLAGS) $(SUBSYSTEM_LDFLAG) $(OBJS) \
+             -o $@ $(LOCAL_LIBS) $(GNUEFI_LIBS)
 
 $(TARGET): $(SHLIB_TARGET)
        $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
@@ -50,7 +55,6 @@ $(TARGET): $(SHLIB_TARGET)
        chmod a-x $(TARGET)
 
 clean:
-       rm -f $(TARGET) *~ *.so $(OBJS) *.efi *.obj refind_*.txt refind_*.dll *.lib
+       rm -f $(TARGET) *~ *.so $(OBJS) *.efi *.obj refind_*.txt \
+               refind_*.dll *.lib
 
-# EOF
-# DO NOT DELETE