From: srs5694 Date: Tue, 8 May 2012 02:35:21 +0000 (-0400) Subject: Small menu improvements; bug fixes & improvements to install.sh X-Git-Url: https://code.delx.au/refind/commitdiff_plain/fde5d6e97a5ec6c37eaa79ff05729d72b31133ef Small menu improvements; bug fixes & improvements to install.sh --- diff --git a/BUILDING.txt b/BUILDING.txt index a3d2dc8..7c14bf6 100644 --- a/BUILDING.txt +++ b/BUILDING.txt @@ -48,14 +48,14 @@ To compile rEFInd, you'll need the following: * A standard set of Linux development tools, based on GCC. -* The GNU-EFI package (http://sourceforge.net/projects/gnu-efi/). You - can install this from a package called "gnu-efi"; however, rEFInd relies - on features that were added somewhere between GNU-EFI 3.0i and 3.0p to - provide driver-loading capabilities. As of 4/2012, most Linux - distributions seem to deliver rather elderly versions of GNU-EFI, so you - may need to download the latest source code, compile it, and install it - locally. Since rEFInd version 0.2.7, the Makefiles assume this (see - below). +* The GNU-EFI package (http://sourceforge.net/projects/gnu-efi/). You can + install this from a package called "gnu-efi"; however, rEFInd relies on + features that were added in (I think) 3.0l to provide driver-loading + capabilities. The versions I've used and that work are 3.0p and 3.0q. As + of 5/2012, most Linux distributions seem to deliver rather elderly + versions of GNU-EFI, so you may need to download the latest source code, + compile it, and install it locally. Since rEFInd version 0.2.7, the + Makefiles assume this (see below). It's possible that you could use a non-Linux platform to compile rEFInd. To the best of my knowledge, the rEFInd code doesn't rely on anything @@ -99,12 +99,12 @@ EFICRT0 = /usr/local/lib If you've installed GNU-EFI from a distribution's package, you may need to remove "local" from those paths, and perhaps change references to "lib" to -"lib64". As noted earlier, though, as of 4/2012, most distributions provide +"lib64". As noted earlier, though, as of 5/2012, most distributions provide out-of-date GNU-EFI implementations that will not work with rEFInd 0.2.7 and later. When I tried to compile rEFInd under Ubuntu 12.04 (i386), even with a -locally-compiled GNU-EFI 3.0p, I got errors like this: +locally-compiled GNU-EFI 3.0p or 3.0q, I got errors like this: main.o: In function `StartLegacy.isra.0': main.c:(.text+0x8b1): undefined reference to `__stack_chk_fail_local' @@ -112,8 +112,8 @@ lib.o: In function `ScanVolumeBootcode.part.3': lib.c:(.text+0xf2f): undefined reference to `__stack_chk_fail_local' lib.o: In function `ScanExtendedPartition.isra.4': -The solution was to recompile GNU-EFI 3.0p with the -fno-stack-protector -GCC flag. In GNU-EFI, this can be added to the CFLAGS line in Make.common. +The solution was to recompile GNU-EFI with the -fno-stack-protector GCC +flag. In GNU-EFI, this can be added to the CFLAGS line in Make.defaults. Installing rEFInd ================= diff --git a/Makefile b/Makefile index 2b7a549..704334f 100644 --- a/Makefile +++ b/Makefile @@ -17,4 +17,7 @@ all: clean: make -C $(LIB_DIR) clean make -C $(LOADER_DIR) clean + +install: + ./install.sh # DO NOT DELETE diff --git a/NEWS.txt b/NEWS.txt index a8fed26..13c8107 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,3 +1,9 @@ +0.3.4 (?/??/2012): +------------------ + +- Improved screen redraws to produce less flicker when moving among the + second-row tags. + 0.3.3 (5/6/2012): ----------------- diff --git a/install.sh b/install.sh index 479cef7..52fab3d 100755 --- a/install.sh +++ b/install.sh @@ -17,6 +17,7 @@ # # Revision history: # +# 0.3.3.1 -- Fixed OS X 10.7 bug; also works as make target # 0.3.2.1 -- Check for presence of source files; aborts if not present # 0.3.2 -- Initial version # @@ -30,11 +31,35 @@ TargetDir=/EFI/refind # # Abort if the rEFInd files can't be found. +# Also sets $ConfFile to point to the configuration file, and +# $IconsDir to point to the icons directory CheckForFiles() { - if [[ ! -f $SourceDir/refind_ia32.efi || ! -f $SourceDir/refind_x64.efi || ! -f $SourceDir/refind.conf-sample || ! -d $SourceDir/icons ]] ; then - echo "One or more files missing! Aborting installation!" + # Note: This check is satisfied if EITHER the 32- or the 64-bit version + # is found, even on the wrong platform. This is because the platform + # hasn't yet been determined. This could obviously be improved, but it + # would mean restructuring lots more code.... + if [[ ! -f $RefindDir/refind_ia32.efi && ! -f $RefindDir/refind_x64.efi ]] ; then + echo "The rEFInd binary file is missing! Aborting installation!" exit 1 fi + + if [[ -f $RefindDir/refind.conf-sample ]] ; then + ConfFile=$RefindDir/refind.conf-sample + elif [[ -f $ThisDir/refind.conf-sample ]] ; then + ConfFile=$ThisDir/refind.conf-sample + else + echo "The sample configuration file is missing! Aborting installation!" + exit 1 + fi + + if [[ -d $RefindDir/icons ]] ; then + IconsDir=$RefindDir/icons + elif [[ -d $ThisDir/icons ]] ; then + IconsDir=$ThisDir/icons + else + echo "The icons directory is missing! Aborting installation!" + fi +#|| ! -f $RefindDir/refind.conf-sample || ! -d $RefindDir/icons } # CheckForFiles() # Copy the rEFInd files to the ESP or OS X root partition. @@ -42,13 +67,13 @@ CheckForFiles() { CopyRefindFiles() { mkdir -p $InstallPart/$TargetDir &> /dev/null if [[ $Platform == 'EFI32' ]] ; then - cp $SourceDir/refind_ia32.efi $InstallPart/$TargetDir + cp $RefindDir/refind_ia32.efi $InstallPart/$TargetDir if [[ $? != 0 ]] ; then Problems=1 fi Refind="refind_ia32.efi" elif [[ $Platform == 'EFI64' ]] ; then - cp $SourceDir/refind_x64.efi $InstallPart/$TargetDir + cp $RefindDir/refind_x64.efi $InstallPart/$TargetDir if [[ $? != 0 ]] ; then Problems=1 fi @@ -64,7 +89,7 @@ CopyRefindFiles() { mv -f $InstallPart/$TargetDir/icons $InstallPart/$TargetDir/icons-backup echo "Notice: Backed up existing icons directory as icons-backup." fi - cp -r $SourceDir/icons $InstallPart/$TargetDir + cp -r $IconsDir $InstallPart/$TargetDir if [[ $? != 0 ]] ; then Problems=1 fi @@ -72,7 +97,7 @@ CopyRefindFiles() { echo "Existing refind.conf file found; copying sample file as refind.conf-sample" echo "to avoid collision." echo "" - cp -f $SourceDir/refind.conf-sample $InstallPart/$TargetDir + cp -f $ConfFile $InstallPart/$TargetDir if [[ $? != 0 ]] ; then Problems=1 fi @@ -80,7 +105,7 @@ CopyRefindFiles() { echo "Copying sample configuration file as refind.conf; edit this file to configure" echo "rEFInd." echo "" - cp -f $SourceDir/refind.conf-sample $InstallPart/$TargetDir/refind.conf + cp -f $ConfFile $InstallPart/$TargetDir/refind.conf if [[ $? != 0 ]] ; then Problems=1 fi @@ -239,9 +264,10 @@ InstallOnLinux() { # install under OS X or Linux, depending on the detected platform. # -ThisScript=`readlink -f $0` OSName=`uname -s` -SourceDir=`dirname $ThisScript`/refind +ThisDir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +RefindDir="$ThisDir/refind" +ThisScript="$ThisDir/`basename $0`" CheckForFiles if [[ `whoami` != "root" ]] ; then echo "Not running as root; attempting to elevate privileges via sudo...." diff --git a/refind/Makefile b/refind/Makefile index 50a131b..221016a 100644 --- a/refind/Makefile +++ b/refind/Makefile @@ -7,20 +7,26 @@ SRCDIR = . VPATH = $(SRCDIR) +ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,) + +TARGET = refind.efi + ifeq ($(ARCH),ia32) LIBEG = build32 + TARGET = refind_ia32.efi endif ifeq ($(ARCH),x86_64) LIBEG = build64 + TARGET = refind_x64.efi endif LOCAL_CPPFLAGS = -I$(SRCDIR) -I$(SRCDIR)/../include -I$(SRCDIR)/../libeg -LOCAL_LDFLAGS = -L$(SRCDIR)/../libeg/$(LIBEG) +#LOCAL_LDFLAGS = -L$(SRCDIR)/../libeg/$(LIBEG) +LOCAL_LDFLAGS = -L$(SRCDIR)/../libeg/ LOCAL_LIBS = -leg OBJS = main.o config.o menu.o screen.o icns.o lib.o driver_support.o -TARGET = refind.efi all: $(TARGET) diff --git a/refind/main.c b/refind/main.c index b531905..8c4a78e 100644 --- a/refind/main.c +++ b/refind/main.c @@ -104,7 +104,7 @@ static VOID AboutrEFInd(VOID) { if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.3.3"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.3.3.1"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith"); diff --git a/refind/menu.c b/refind/menu.c index 2b63d05..ad8d39c 100644 --- a/refind/menu.c +++ b/refind/menu.c @@ -770,24 +770,30 @@ static VOID PaintAll(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, UINTN // Move the selection to State->CurrentSelection, adjusting icon row if necessary... static VOID PaintSelection(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, UINTN *itemPosX, UINTN row0PosY, UINTN row1PosY, UINTN textPosY) { - UINTN XSelect, YPos; + UINTN XSelectPrev, XSelectCur, YPosPrev, YPosCur; - if ((State->CurrentSelection < State->LastVisible) && (State->CurrentSelection >= State->FirstVisible)) { + if (((State->CurrentSelection < State->LastVisible) && (State->CurrentSelection >= State->FirstVisible)) || + (State->CurrentSelection >= State->InitialRow1) ) { if (Screen->Entries[State->PreviousSelection]->Row == 0) { - XSelect = State->PreviousSelection - State->FirstVisible; - YPos = row0PosY; + XSelectPrev = State->PreviousSelection - State->FirstVisible; + YPosPrev = row0PosY; } else { - XSelect = State->PreviousSelection; - YPos = row1PosY; + XSelectPrev = State->PreviousSelection; + YPosPrev = row1PosY; } // if/else - DrawMainMenuEntry(Screen->Entries[State->PreviousSelection], FALSE, itemPosX[XSelect], YPos); - DrawMainMenuEntry(Screen->Entries[State->CurrentSelection], TRUE, - itemPosX[State->CurrentSelection - State->FirstVisible], - (Screen->Entries[State->CurrentSelection]->Row == 0) ? row0PosY : row1PosY); + if (Screen->Entries[State->CurrentSelection]->Row == 0) { + XSelectCur = State->CurrentSelection - State->FirstVisible; + YPosCur = row0PosY; + } else { + XSelectCur = State->CurrentSelection; + YPosCur = row1PosY; + } // if/else + DrawMainMenuEntry(Screen->Entries[State->PreviousSelection], FALSE, itemPosX[XSelectPrev], YPosPrev); + DrawMainMenuEntry(Screen->Entries[State->CurrentSelection], TRUE, itemPosX[XSelectCur], YPosCur); if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) DrawMainMenuText(Screen->Entries[State->CurrentSelection]->Title, (UGAWidth - LAYOUT_TEXT_WIDTH) >> 1, textPosY); - } else { + } else { // Current selection not visible; must redraw the menu.... MainMenuStyle(Screen, State, MENU_FUNCTION_PAINT_ALL, NULL); } } // static VOID MoveSelection(VOID)