From 85f3218b8717046ea8516e17a51f66a979c8b0c4 Mon Sep 17 00:00:00 2001
From: srs5694
Date: Fri, 9 Nov 2012 14:49:24 -0500
Subject: [PATCH] Fixed right- vs. left-alignment issues for text-mode menus
---
BUILDING.txt | 21 +++++++----
NEWS.txt | 4 +++
docs/refind/installing.html | 70 ++++++++++++++++++++-----------------
refind/main.c | 2 +-
refind/menu.c | 22 +++++++++---
5 files changed, 75 insertions(+), 44 deletions(-)
diff --git a/BUILDING.txt b/BUILDING.txt
index f41a666..4109142 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -159,7 +159,8 @@ installed the toolkit:
- ACTIVE_PLATFORM = MdePkg/MdePkg.dsc
- TARGET = RELEASE (DEBUG might work, but I've not tested it).
- TARGET_ARCH = X64 (on x86-64; leave this as IA32 on x86). If you plan
- to build both architectures, you can set this to "IA32 X64".
+ to build both architectures on an x86-64 system, you can set this to
+ "IA32 X64".
- TOOL_CHAIN_TAG = GCC46 (or other value depending on your GCC version;
type "gcc -v" to learn your GCC version number). Note that GCC 4.7
doesn't have its own entry, so use GCC46 for GCC 4.7.
@@ -212,11 +213,15 @@ With your development system set up, you can compile rEFInd as follows:
want to build IA32 binaries on an x86-64 (X64) system, type "ARCH=ia32
make". This works only if you're using the TianoCore build kit, and only
if you set TARGET_ARCH to either "IA32" or "IA32 X64" in target.txt when
- you set up the TianoCore.
+ you set up the TianoCore. If you plan to build both architectures, be
+ sure to copy the .efi file for the first build out of the refind
+ subdirectory before building the second architecture.
5) The default build process does NOT build the filesystem drivers. If you
want to build them, you must type "make fs" in the main rEFInd source
- directory. The result is filesystem drivers in the filesystems
+ directory. (Typing "ARCH=ia32 make fs" builds IA32 filesystem drivers on
+ an x86-64 system, provided TianoCore is properly configured, as
+ described earlier.) The result is filesystem drivers in the filesystems
subdirectory, and also copies placed in the drivers subdirectory. You
must install the TianoCore EDK2 to build the drivers.
@@ -263,8 +268,8 @@ Installing rEFInd
With rEFInd compiled, you can install it. The easiest way to do this is
with the install.sh script, which works on both Linux and Mac OS X.
Alternatively, you can type "make install" to install using this script.
-Note that this installation copies files to the ESP and uses "efibootmgr"
-(on Linux) or "bless" (on OS X) to add rEFInd to the firmware's boot loader
+Note that this script copies files to the ESP and uses "efibootmgr" (on
+Linux) or "bless" (on OS X) to add rEFInd to the firmware's boot loader
list. The docs/refind/installing.html file provides more details on this
script and its use.
@@ -310,14 +315,16 @@ change into the "filesystems" directory and type "make {fsname}", where
To install drivers, you can type "make install" in the "filesystems"
directory. This copies all the drivers to the
"/boot/efi/EFI/refind/drivers" directory. Alternatively, you can copy the
-files you want manually.
+files you want manually. As of version 0.4.8, the install.sh script
+includes an optional "--drivers" option that will install the drivers along
+with the main rEFInd program.
*CAUTION:* Install drivers for your system's architecture *ONLY*.
Installing drivers for the wrong architecture causes some systems to hang
at boot time.
The drivers all rely on filesystem wrapper code created by rEFIt's author,
-Christoph Phisterer. Most of the drivers seem to have passed through
+Christoph Pfisterer. Most of the drivers seem to have passed through
Oracle's VirtualBox project (https://www.virtualbox.org) and the Clover
boot loader project (https://sourceforge.net/projects/cloverefiboot/),
which I used as the source for this build.
diff --git a/NEWS.txt b/NEWS.txt
index b9b1b56..00449be 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,10 @@
0.4.8 (??/??/2012):
-------------------
+- Fixed bug that caused text-mode ("textonly" refind.conf option enabled)
+ menu entries to be right-aligned rather than left-aligned when rEFInd was
+ compiled with the TianoCore EDK2.
+
- Added "--usedefault {devicename}" and "--drivers" options to the
install.sh script and changed the "esp" option to "--esp".
diff --git a/docs/refind/installing.html b/docs/refind/installing.html
index 57dcf0b..42fbe8a 100644
--- a/docs/refind/installing.html
+++ b/docs/refind/installing.html
@@ -99,7 +99,11 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com
-If you're using Linux or Mac OS X, the easiest way to install rEFInd is to use the install.sh script. Under Linux, this script installs rEFInd to your disk's ESP. Under Mac OS X, the script installs rEFInd to your current OS X boot partition by default; but you can install to your ESP instead by passing the script the esp option.
+If you're using Linux or Mac OS X, the easiest way to install rEFInd is to use the install.sh script. This script automatically copies rEFInd's files to your ESP or other target location and makes changes to your firmware's NVRAM settings so that rEFInd will start the next time you boot. If you've booted to OS X or in EFI mode to Linux on a UEFI-based PC, install.sh will probably do the right thing, so you can get by with the quick instructions. If your setup is unusual, though, or if you want to create a USB flash drive with rEFInd on it, you should read the extra instructions for this utility.
+
+Quick install.sh Instructions
+
+Under Linux, the install.sh script installs rEFInd to your disk's ESP. Under Mac OS X, the script installs rEFInd to your current OS X boot partition by default; but you can install to your ESP instead by passing the script the --esp option.
Before running this script under Linux, you should ensure that your ESP is mounted at /boot or /boot/efi, as described in more detail in the Installing rEFInd Manually Using Linux section. (If you installed Linux in EFI mode, chances are your ESP is properly mounted.) This precaution isn't necessary under OS X.
@@ -135,15 +139,16 @@ WARNING: If you have an Advanced Format disk, *DO NOT* attempt to check the
bless status with 'bless --info', since this is known to cause disk corruption
on some systems!!
-NOTE: If you want to boot an OS via BIOS emulation (such as Windows or some
-Linux installations), you *MUST* edit the ///EFI/refind/refind.conf
-file's 'scanfor' line to include the 'hdbios' option, and perhaps
-'biosexternal' and 'cd', as well.
-
Installation has completed successfully.
-In either case, the details of the output differ depending on your existing configuration and how you ran the program. Some details that can affect how the script runs include the following:
+In either case, the details of the output differ depending on your existing configuration and how you ran the program. Unless you see an obvious warning or error, you shouldn't be concerned about minor deviations from these examples. If you run into such a situation, or if you want to install in an unusual way, read on....
+
+
+Extra install.sh Instructions
+
+
+Some details that can affect how the script runs include the following:
@@ -159,13 +164,13 @@ Installation has completed successfully.
the Terminal window. You'll need to press the Return or Enter key to
run the script.
-- Under OS X, passing the "--esp" option causes the script to install
- rEFInd to the ESP. The script finds the first ESP that's identified by
- the diskutil program and, if it's not already mounted, mounts
- it to install rEFInd. Thus, it's conceivable that install.sh
- will install rEFInd to the wrong partition if you have multiple disks
- or if a disk has multiple ESPs. If you believe this has happened, you
- may need to re-install manually.
+- Under OS X, passing the --esp option causes the script to
+ install rEFInd to the ESP. The script finds the first ESP that's
+ identified by the diskutil program and, if it's not already
+ mounted, mounts it to install rEFInd. Thus, it's conceivable that
+ install.sh will install rEFInd to the wrong partition if you
+ have multiple disks or if a disk has multiple ESPs. If you believe this
+ has happened, you may need to re-install manually.
- If you're using OS X 10.7's Whole Disk Encryption (WDE) feature, you
must install rEFInd to the ESP, so the --esp option to
@@ -175,12 +180,12 @@ Installation has completed successfully.
forum thread for a discussion of the topic.
- If you're replacing rEFIt with rEFInd on a Mac, there's a chance that
- install.sh will warn you about the presence of a file called
- /Library/StartupItems/rEFItBlesser and ask if you want to
- delete the file. This file is designed to keep rEFIt set as the boot
+ install.sh will warn you about the presence of a program
+ called /Library/StartupItems/rEFItBlesser and ask if you want
+ to delete it. This program is designed to keep rEFIt set as the boot
manager by automatically re-blessing it if the default boot manager
changes. This is obviously undesirable if you install rEFInd as your
- primary boot manager, so it's generally best to remove this file. If
+ primary boot manager, so it's generally best to remove this program. If
you prefer to keep your options open, you can answer N when install.sh asks if you want to
delete rEFItBlesser, and instead manually copy it elsewhere. If you
@@ -192,11 +197,11 @@ Installation has completed successfully.
--info to check your installation status; this combination has
been reported to cause disk corruption on some Macs!
-- If you intend to boot BIOS-based OSes, such as most Windows
- installations and some Linux installations, you must edit the
- refind.conf file, as noted near the end of the installation
- script's output. (Note that rEFInd can only boot such OSes on Macs at
- the moment.)
+- If you intend to boot BIOS-based OSes on a UEFI-based PC, you
+ must edit the refind.conf file's scanfor line
+ to enable the relevant searches. This is not necessary on Macs,
+ though; because of the popularity of dual boots with Windows on Macs,
+ the BIOS/legacy scans are enabled by default on Macs.
- Under both Linux and OS X, you can add the --drivers option to
have install.sh install all the filesystem drivers along with
@@ -207,15 +212,16 @@ Installation has completed successfully.
class="variable">devicepath option to install rEFInd to the
specified device as EFI/BOOT/bootx64.efi and
EFI/BOOT/bootia32.efi. The specified device must be a valid
- FAT partition. The idea is that you can easily create a bootable USB
- flash drive with this option: Create a proper FAT-formatted ESP on a
- disk (say, /dev/sdd1) and then type sh
- ./install --usedefault /dev/sdd1 to turn the disk into an
- emergency disk. This option can also be used to install rEFInd to an
- ESP using the alternative naming options
- described later. This latter usage will result in a bootable rEFInd
- only if no other OS has already created an NVRAM variable pointing to
- itself.
+ FAT partition. This option also tells the script to not make
+ changes to the computer's NVRAM. The idea is that you can easily create
+ a bootable USB flash drive with this option: Create a proper
+ FAT-formatted ESP on a disk (say, /dev/sdd1) and then type sh ./install --usedefault /dev/sdd1 to turn the
+ disk into an emergency disk. This option can also be used to install
+ rEFInd to an ESP using the alternative naming
+ options described later. This latter usage will result in a
+ bootable rEFInd only if no other OS has already created an NVRAM
+ variable pointing to itself.
diff --git a/refind/main.c b/refind/main.c
index 5e3bdc5..11a4181 100644
--- a/refind/main.c
+++ b/refind/main.c
@@ -115,7 +115,7 @@ static VOID AboutrEFInd(VOID)
if (AboutMenu.EntryCount == 0) {
AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
- AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.4.7");
+ AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.4.7.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 ba1f78d..423e8ed 100644
--- a/refind/menu.c
+++ b/refind/menu.c
@@ -526,10 +526,24 @@ static VOID TextMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State,
// prepare strings for display
DisplayStrings = AllocatePool(sizeof(CHAR16 *) * Screen->EntryCount);
for (i = 0; i <= State->MaxIndex; i++) {
- DisplayStrings[i] = AllocateZeroPool(256 * sizeof(CHAR16));
- SPrint(DisplayStrings[i], 255, L" %-.*s ", MenuWidth, Screen->Entries[i]->Title);
- // TODO: use more elaborate techniques for shortening too long strings (ellipses in the middle)
- // TODO: account for double-width characters
+ // Note: Theoretically, SPrint() is a cleaner way to do this; but the
+ // description of the StrSize parameter to SPrint implies it's measured
+ // in characters, but in practice both TianoCore and GNU-EFI seem to
+ // use bytes instead, resulting in truncated displays. I could just
+ // double the size of the StrSize parameter, but that seems unsafe in
+ // case a future library change starts treating this as characters, so
+ // I'm doing it the hard way in this instance.
+ // TODO: Review the above and possibly change other uses of SPrint()
+ DisplayStrings[i] = AllocateZeroPool(2 * sizeof(CHAR16));
+ DisplayStrings[i][0] = L' ';
+ MergeStrings(&DisplayStrings[i], Screen->Entries[i]->Title, 0);
+ if (StrLen(DisplayStrings[i]) > MenuWidth)
+ DisplayStrings[i][MenuWidth - 1] = 0;
+// DisplayStrings[i] = AllocateZeroPool(256 * sizeof(CHAR16));
+// SPrint(DisplayStrings[i], ((MenuWidth < 255) ? MenuWidth : 255) * sizeof(CHAR16),
+// L" %s ", Screen->Entries[i]->Title);
+ // TODO: use more elaborate techniques for shortening too long strings (ellipses in the middle)
+ // TODO: account for double-width characters
} // for
// initial painting
--
2.39.2