From: srs5694
Originally written: 3/14/2012; last Web page update: -12/6/2012, referencing rEFInd 0.5.0
+12/11/2012, referencing rEFInd 0.5.1I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/configfile.html b/docs/refind/configfile.html index dcf1fe1..8f8b2a8 100644 --- a/docs/refind/configfile.html +++ b/docs/refind/configfile.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/6/2012, referencing rEFInd 0.5.0
+12/11/2012, referencing rEFInd 0.5.1I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -175,8 +175,8 @@ timeout 20Prior to version 0.2.4, rEFInd supported a token called disable, whose function partially overlapped with hideui. Version 0.2.4 merges many of the features of these two tokens into hideui and creates the new showtools option, which provides the remaining functionality in a more flexible way.
diff --git a/docs/refind/drivers.html b/docs/refind/drivers.html index fb5852f..f20140a 100644 --- a/docs/refind/drivers.html +++ b/docs/refind/drivers.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 4/19/2012; last Web page update: -12/6/2012, referencing rEFInd 0.5.0
+12/11/2012, referencing rEFInd 0.5.1I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/features.html b/docs/refind/features.html index b9f41c3..8f12242 100644 --- a/docs/refind/features.html +++ b/docs/refind/features.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/6/2012, referencing rEFInd 0.5.0
+12/11/2012, referencing rEFInd 0.5.1I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/getting.html b/docs/refind/getting.html index 3da81ee..0266bb4 100644 --- a/docs/refind/getting.html +++ b/docs/refind/getting.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/6/2012, referencing rEFInd 0.5.0
+12/11/2012, referencing rEFInd 0.5.1I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -98,7 +98,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/6/2012, referencing rEFInd 0.5.0
+12/11/2012, referencing rEFInd 0.5.1I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/installing.html b/docs/refind/installing.html index 40c5f87..e5c6221 100644 --- a/docs/refind/installing.html +++ b/docs/refind/installing.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/6/2012, referencing rEFInd 0.5.0
+12/11/2012, referencing rEFInd 0.5.1I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -195,6 +195,18 @@ Installation has completed successfully. though; because of the popularity of dual boots with Windows on Macs, the BIOS/legacy scans are enabled by default on Macs.In addition to these quirks, you should be aware of some options that install.sh supports to enable you to customize your installation in various ways. The syntax for install.sh is as follows:
diff --git a/docs/refind/linux.html b/docs/refind/linux.html index 77cabc0..5a18814 100644 --- a/docs/refind/linux.html +++ b/docs/refind/linux.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/19/2012; last Web page update: -12/6/2012, referencing rEFInd 0.5.0
+12/11/2012, referencing rEFInd 0.5.1I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -92,17 +92,135 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comWindows and Mac OS X both provide relatively simple EFI boot loader programs. Launch them, and if they're launched from the correct locations and have the correct files in place, they'll boot their respective OSes. This makes rEFInd's job easy; it just locates the boot loader program files and runs them.
-Under Linux, by contrast, things can get complicated. As detailed on my Managing EFI Boot Loaders for Linux page, several different EFI boot loaders for Linux exist, and all of them require configuration. If you're lucky, your distribution will have set up a Linux boot loader in a sensible way, in which case rEFInd should detect it and it will work as easily as a Windows or Mac OS X boot loader. If you're not lucky, though, you may need to configure it further. rEFInd offers options to help out with this task. Specifically, you can use a traditional Linux boot loader or configure an EFI stub loader.
+Under Linux, by contrast, things can get complicated. As detailed on my Managing EFI Boot Loaders for Linux page, several different EFI boot loaders for Linux exist, and all of them require configuration. If you're lucky, your distribution will have set up a Linux boot loader in a sensible way, in which case rEFInd should detect it and it will work as easily as a Windows or Mac OS X boot loader. If you're not lucky, though, you may need to configure it further. rEFInd offers options to help out with this task. Naturally, rEFInd supports traditional Linux boot loaders. It works even better with the Linux EFI stub loader, so I provide instructions on starting with it. For those interested in manual configuration, I also provide detailed instructions on how the EFI stub support works and how to configure it.
+I consider ELILO, GRUB Legacy, and GRUB 2 to be traditional Linux boot loaders. These programs all exist as EFI programs that are independent of the Linux kernel, but that can load a kernel and hand off control to it. All three programs have their own configuration files that reside in the same directory as the boot loader itself (or optionally elsewhere, in the case of GRUB 2).
+I consider ELILO, GRUB Legacy, and GRUB 2 to be traditional Linux boot loaders. These programs all exist independent of the Linux kernel, but they can load a kernel and hand off control to it. All three programs have their own configuration files that reside in the same directory as the boot loader itself (or optionally elsewhere, in the case of GRUB 2).
Ordinarily, rEFInd will detect these traditional boot loaders and provide main menu entries for them. If the boot loader exists in a directory with a name that matches a Linux distribution's icon filename, you'll automatically get a distribution-specific icon to refer to the boot loader.
If you prefer, you can disable automatic scanning and create an entry in refind.conf for your distribution, as described on the Configuring the Boot Manager page. This method is harder to set up but can be preferable if you want to customize your options.
-The EFI stub loader is basic and reliable, but it requires some setup to use it. I describe both a quick test configuration and a long-term setup.
+ + +If you're not sure you want to use the EFI stub loader in the long term, you can perform a fairly quick initial test of it. This procedure assumes that you have access to a 3.3.0 or later Linux kernel with EFI stub support compiled into it. (Fedora 17, Ubuntu 12.10, and probably other distributions ship with such kernels.) Creating this configuration poses no risk to your current boot options, provided you don't accidentally delete existing files. The procedure for a quick test is:
+ +You can continue to boot your computer with this type of configuration; however, the drawback is that you'll need to copy your kernel whenever it's updated. This can be a hassle. A better way is to configure you system so that the EFI, and therefore rEFInd, can read your Linux /boot directory, where most Linux distributions place their kernels.
+ + +The ideal configuration for use of the EFI stub loader involves giving rEFInd the ability to load your kernels directly from /boot. The main obstacle to doing so is that this directory is frequently on an XFS, JFS, Btrfs, or ext4 filesystem that the EFI can't read, or it's tucked away in an LVM or RAID configuration that the EFI can't read. Fortunately, this problem can be overcome with relatively little fuss. Several variant procedures are possible, but I begin by describing one that will almost always work, although it's got some important caveats (described at the end). If you're currently booting via GRUB 2, it is likely to cease working when you try this, although GRUB should be recoverable by re-installing it. (On the other hand, GRUB will become redundant once this method of booting starts working so you might prefer to remove it completely.) You should perform the following steps as root, or precede each of these commands with sudo:
+ +Once this task is done, updates to your kernel will automatically be stored in the root directory of your ESP, where rEFInd will automatically detect them. Thus, the boot configuration becomes maintenance-free. The procedure as just described has some drawbacks, though. By placing your kernels in the root directory of your ESP, you render them vulnerable to any other OS with which you might be dual-booting. Your ESP must also be large enough to hold all your kernels. If you dual-boot with multiple Linux distributions, they might conceivably overwrite each others' kernels, and distinguishing one from another becomes more difficult.
+ +For these reasons, a variant of this procedure may be desirable. Most of the steps are similar, but in this variant, you create a separate /boot partition that's independent of the ESP. This partition can use FAT, HFS+, ReiserFS, ext2fs, ext3fs; but if you use any of the last four filesystems (three on Macs), you must install the matching EFI filesystem driver that ships with rEFInd. Creating the filesystem will normally require you to shrink an existing partition by a suitable amount (200–500MiB). Mount your new /boot partition at a temporary location, copy or move the current /boot files into it, unmount it, and add it to /etc/fstab as /boot.
+ + +If your distribution already uses a separate /boot partition (as Fedora 17 does by default), but if it uses ext4fs or some other unsuitable filesystem, you can back it up, create a fresh FAT, HFS+, ReiserFS, ext2, or ext3 filesystem on it, and restore the original files. If you use a separate non-ESP /boot partition, you'll probably want to continue mounting the ESP at /boot/efi.
+ + +The Linux EFI stub loader is a way to turn a Linux kernel into an EFI application. In a sense, the kernel becomes its own boot loader. This approach to booting Linux is very elegant in some ways, but as described on the page to which I just linked, it has its disadvantages, too. One challenge to booting in this way is that modern Linux installations typically require that the kernel be passed a number of options at boot time. These tell the kernel where the Linux root (/) filesystem is, where the initial RAM disk is, and so on. Without these options, Linux won't boot. These options are impossible for a generic boot loader to guess without a little help. It's possible to build a kernel with a default set of options, but this is rather limiting. Thus, rEFInd provides configuration options to help.
@@ -116,9 +234,9 @@ to modify its own rEFInd configuration; or the one that controls rEFInd might set inappropriate options for another distribution. This is a problem that's been a minor annoyance for years under BIOS, since the same potential for poor configuration applies to LILO, GRUB Legacy, and GRUB 2 -on BIOS. The most reliable solution there is to chainload one boot loader -to another. The same solution is possible under EFI, but rEFInd offers -another possibility. +on BIOS. The most reliable solution under BIOS is to chainload one boot +loader to another. The same solution is possible under EFI, but rEFInd +offers another possibility.rEFInd 0.2.1 and later supports semi-automatic Linux EFI stub loader detection. This feature works as part of the standard boot loader scan operation, but it extends it as follows:
@@ -131,9 +249,10 @@ another possibility. with version 0.3.0, if you uncomment the scan_all_linux_kernels option in refind.conf, rEFInd will also scan for kernels without a .efi filename - extension. This option is not the default, though, because it can pick - up old kernels that lack EFI stub loader support and even non-kernel - files. + extension. This option is uncommented by default, but if you comment it + out, delete it, or change it to read scan_all_linux_kernels 0, + rEFInd won't scan for kernels that lack .efi filename + extensions. @@ -157,12 +276,16 @@ another possibility. booting from an auto-detected kernel. It consists of a series of lines, each of which consists of a label followed by a series of kernel options. The first line sets default options, and subsequent lines set - options that are accessible from the main menu tag's submenu - screen. + options that are accessible from the main menu tag's submenu screen. If + you installed rEFInd 0.5.1 or later with the install.sh + script, that script created a sample refind_linux.conf file, + customized for your computer, in /boot. This file will work + without changes on many installations, but you may need to tweak it for + some. -The intent of this system is that distribution maintainers can place their kernels, initial RAM disks, and a refind_linux.conf file in their own subdirectory on the ESP. rEFInd will detect their kernels and create one main menu entry for each kernel. Each entry will implement as many options as there are lines in the refind_linux.conf file. In this way, two or more distributions can each maintain their boot loader entries, without being too concerned about who maintains rEFInd as a whole.
+The intent of this system is that distribution maintainers can place their kernels, initial RAM disks, and a refind_linux.conf file in their own subdirectories on the ESP, on EFI-accessible /boot partitions, or in /boot directories on EFI-accessible Linux root (/) partitions. rEFInd will detect these kernels and create one main menu entry for each kernel. Each entry will implement as many options as there are lines in the refind_linux.conf file. In this way, two or more distributions can each maintain their boot loader entries, without being too concerned about who maintains rEFInd as a whole.
The scan_all_linux_kernels option is intended to help users and distribution maintainers when rEFInd is used in conjunction with a Linux filesystem driver for EFI or when the ESP is mounted as the Linux /boot partition. In these cases, if all the kernels in Linux's /boot directory include EFI stub loader support, rEFInd will automatically detect and use kernels installed in the usual way, such as via an automatic system update. You won't even need to move or rename your kernels. You will need to set up a refind_linux.conf file and you may need to install a driver or set the also_scan_dirs option in refind.conf; but these are one-time requirements. Set up in this way, ongoing maintenance to handle kernel updates drops to zero!
@@ -179,12 +302,14 @@ total 17943When rEFInd scans this directory, it will find two EFI boot loaders in EFI/ubuntu: grubx64.EFI and bzImage-3.3.0.efi. rEFInd will create two main-menu tags for these two loaders, one of which will launch Ubuntu's standard GRUB and the other of which will launch the 3.3.0 kernel file directly. The refind_linux.conf file contains a list of labels and options:
+"Boot with defaults" "root=/dev/sda3 ro quiet splash vt.handoff=7" "Boot into single-user mode" "root=UUID=1cd95082-bce0-494c-a290-d2e642dd82b7 ro single" "Boot without graphics" "root=UUID=1cd95082-bce0-494c-a290-d2e642dd82b7 ro" # "Boot alternate install" "root=/dev/sdb9 ro quiet splash vt.handoff=7"+
Ordinarily, both fields in this file must be enclosed in quotes. If you have to pass an option that includes quotes, you can do so by doubling up on them, as in "root=/dev/sdb9 my_opt=""this is it""", which passes root=/dev/sdb9 my_opt="this is it" to the shell. You can include as much white space as you like between options. You can also place comments in the file, or remove an option by commenting it out with a leading hash mark (#), as in the fourth line in this example.
@@ -197,6 +322,8 @@ total 17943Note that the first entry shown here takes a name that's set in rEFInd rather than the one specified in the refind_linux.conf file. The remaining names match those specified in the file, though.
+To assist in initial configuration, rEFInd's install.sh script creates a sample refind_linux.conf file in /boot. This sample file defines two entries that use the default GRUB options defined in /etc/default/grub. The first entry boots normally and the second boots into single-user mode. If you want to create a new file, you can use the mkrlconf.sh script that comes with rEFInd. If you pass it the --force option, it will overwrite the existing /boot/refind_linux.conf file; otherwise it will create the file only if one doesn't already exist.
+From a user's perspective, the submenus defined in this way work just like submenus defined via the submenuentry options in refind.conf, or like the submenus that rEFInd creates automatically for Mac OS X or ELILO. There are, however, limitations in what you can accomplish with this method:
by Roderick W. Smith, rodsmith@rodsbooks.com
-Last Web page update: 12/6/2012
+Last Web page update: 12/11/2012
I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -93,7 +93,9 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 11/13/2012; last Web page update: -12/8/2012, referencing rEFInd 0.5.0.1
+12/11/2012, referencing rEFInd 0.5.1I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/themes.html b/docs/refind/themes.html index 884401b..077dc89 100644 --- a/docs/refind/themes.html +++ b/docs/refind/themes.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 4/19/2012; last Web page update: -12/6/2012, referencing rEFInd 0.5.0
+12/11/2012, referencing rEFInd 0.5.1I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/todo.html b/docs/refind/todo.html index 2fc86a5..92b4a38 100644 --- a/docs/refind/todo.html +++ b/docs/refind/todo.html @@ -209,10 +209,6 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com /usr/local/UDK2010/MyWorkSpace/MdeModulePkg/Core/Dxe/Image/Image.c for the reference UEFI implementation. --> -Originally written: 3/14/2012; last Web page update: -12/6/2012, referencing rEFInd 0.5.0
+12/11/2012, referencing rEFInd 0.5.1I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/install.sh b/install.sh index 7e2fef4..747475a 100755 --- a/install.sh +++ b/install.sh @@ -27,7 +27,8 @@ # # Revision history: # -# 0.5.1 -- Added --shim & --localkeys options +# 0.5.1 -- Added --shim & --localkeys options & create sample refind_linux.conf +# in /boot # 0.5.0 -- Added --usedefault & --drivers options & changed "esp" option to "--esp" # 0.4.5 -- Fixed check for rEFItBlesser in OS X # 0.4.2 -- Added notice about BIOS-based OSes & made NVRAM changes in Linux smarter @@ -65,16 +66,15 @@ GetParams() { TargetIA32="bootia32.efi" shift ;; + --localkeys) LocalKeys=1 + ;; --shim) ShimSource=$2 shift ;; --drivers) InstallDrivers=1 ;; - --localkeys) LocalKeys=1 - ;; * ) echo "Usage: $0 [--esp | --usedefault {device-file}] [--drivers] " - echo " [--localkeys] [--shim {shim-filename}]" - echo "Aborting!" + echo " [--shim {shim-filename}] [--localkeys]" exit 1 esac shift @@ -553,6 +553,28 @@ AddBootEntry() { fi } # AddBootEntry() +# Create a minimal/sample refind_linux.conf file in /boot. +GenerateRefindLinuxConf() { + if [[ ! -f /boot/refind_linux.conf ]] ; then + if [[ -f /etc/default/grub ]] ; then + # We want the default options used by the distribution, stored here.... + source /etc/default/grub + fi + RootFS=`df / | grep dev | cut -f 1 -d " "` + StartOfDevname=`echo $RootFS | cut -b 1-7` + if [[ $StartOfDevname == "/dev/sd" || $StartOfDevName == "/dev/hd" ]] ; then + # Identify root filesystem by UUID rather than by device node, if possible + Uuid=`blkid -o export $RootFS 2> /dev/null | grep UUID=` + if [[ -n $Uuid ]] ; then + RootFS=$Uuid + fi + fi + DefaultOptions="$GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT" + echo "\"Boot with standard options\" \"ro root=$RootFS $DefaultOptions \"" > $RLConfFile + echo "\"Boot to single-user mode\" \"ro root=$RootFS $DefaultOptions single\"" >> $RLConfFile + fi +} + # Controls rEFInd installation under Linux. # Sets Problems=1 if something goes wrong. InstallOnLinux() { @@ -600,6 +622,7 @@ InstallOnLinux() { CopyRefindFiles if [[ $TargetDir != "/EFI/BOOT" ]] ; then AddBootEntry + GenerateRefindLinuxConf fi } # InstallOnLinux() @@ -616,7 +639,7 @@ RefindDir="$ThisDir/refind" ThisScript="$ThisDir/`basename $0`" if [[ `whoami` != "root" ]] ; then echo "Not running as root; attempting to elevate privileges via sudo...." - sudo $ThisScript $1 $2 $3 $4 $5 $6 + sudo $ThisScript "$@" if [[ $? != 0 ]] ; then echo "This script must be run as root (or using sudo). Exiting!" exit 1 diff --git a/libeg/libeg.h b/libeg/libeg.h index 89ddb74..68aaf54 100644 --- a/libeg/libeg.h +++ b/libeg/libeg.h @@ -123,6 +123,7 @@ VOID egDrawImageArea(IN EG_IMAGE *Image, IN UINTN ScreenPosX, IN UINTN ScreenPosY); VOID egDisplayMessage(IN CHAR16 *Text, EG_PIXEL *BGColor); VOID egScreenShot(VOID); +//UINT32 egGetGraphicsMode(VOID); #endif /* __LIBEG_LIBEG_H__ */ diff --git a/libeg/screen.c b/libeg/screen.c index b332704..f17f7f5 100644 --- a/libeg/screen.c +++ b/libeg/screen.c @@ -100,6 +100,17 @@ VOID egInitScreen(VOID) } } +// // Returns current graphics mode number +// UINT32 egGetGraphicsMode(VOID) { +// UINT32 retval = 0; +// +// if (GraphicsOutput != NULL) { +// retval = GraphicsOutput->Mode->Mode; +// } +// +// return retval; +// } // UINT32 egGetGraphicsMode() + // Sets the screen resolution to the specified value, if possible. // If the specified value is not valid, displays a warning with the valid // modes on UEFI systems, or silently fails on EFI 1.x systems. Note that @@ -122,6 +133,8 @@ BOOLEAN egSetScreenSize(IN UINTN ScreenWidth, IN UINTN ScreenHeight) { if ((Status == EFI_SUCCESS) && (Size >= sizeof(*Info)) && (Info->HorizontalResolution == ScreenWidth) && (Info->VerticalResolution == ScreenHeight)) { Status = refit_call2_wrapper(GraphicsOutput->SetMode, GraphicsOutput, ModeNum); +// if (Status == EFI_SUCCESS) +// Status = refit_call2_wrapper(ST->ConOut->SetMode, ST->ConOut, ModeNum); ModeSet = (Status == EFI_SUCCESS); } // if ModeNum++; @@ -131,6 +144,7 @@ BOOLEAN egSetScreenSize(IN UINTN ScreenWidth, IN UINTN ScreenHeight) { egScreenWidth = ScreenWidth; egScreenHeight = ScreenHeight; } else {// If unsuccessful, display an error message for the user.... + SwitchToText(FALSE); Print(L"Error setting mode %d x %d; using default mode!\nAvailable modes are:\n", ScreenWidth, ScreenHeight); ModeNum = 0; Status = EFI_SUCCESS; @@ -142,6 +156,7 @@ BOOLEAN egSetScreenSize(IN UINTN ScreenWidth, IN UINTN ScreenHeight) { ModeNum++; } // while() PauseForKey(); + SwitchToGraphics(); } // if() } else if (UgaDraw != NULL) { // UGA mode (EFI 1.x) // Try to use current color depth & refresh rate for new mode. Maybe not the best choice diff --git a/mkdistrib b/mkdistrib index e55521b..264137c 100755 --- a/mkdistrib +++ b/mkdistrib @@ -42,7 +42,7 @@ make clean # Prepare a place and copy files there.... mkdir -p ../snapshots/$1/refind-$1/icons cp --preserve=timestamps icons/*icns ../snapshots/$1/refind-$1/icons/ -cp -a docs images include EfiLib libeg refind filesystems install.sh CREDITS.txt NEWS.txt BUILDING.txt COPYING.txt LICENSE.txt README.txt refind.inf Make.tiano Make.common Makefile refind.conf-sample ../snapshots/$1/refind-$1 +cp -a docs images include EfiLib libeg refind filesystems install.sh mkrlconf.sh CREDITS.txt NEWS.txt BUILDING.txt COPYING.txt LICENSE.txt README.txt refind.inf Make.tiano Make.common Makefile refind.conf-sample ../snapshots/$1/refind-$1 cp $KeysDir/refind.cer $KeysDir/refind.crt ../snapshots/$1/refind-$1/ # Go there and prepare a souce code zip file.... @@ -72,7 +72,7 @@ cp --preserve=timestamps filesystems/LICENSE*txt refind-bin-$1/refind/drivers_x6 cp --preserve=timestamps refind.conf-sample refind-bin-$1/refind/ $SBSign --key $KeysDir/refind.key --cert $KeysDir/refind.crt --output refind-bin-$1/refind/refind_x64.efi refind/refind_x64.efi cp refind-bin-$1/refind/refind_x64.efi $StartDir -cp -a COPYING.txt LICENSE.txt README.txt docs CREDITS.txt install.sh refind-bin-$1 +cp -a COPYING.txt LICENSE.txt README.txt docs CREDITS.txt install.sh mkrlconf.sh refind-bin-$1 # Prepare the final .zip file and clean up cp $KeysDir/refind.cer $KeysDir/refind.crt refind-bin-$1/ diff --git a/refind.conf-sample b/refind.conf-sample index 42c73fc..234ae98 100644 --- a/refind.conf-sample +++ b/refind.conf-sample @@ -52,6 +52,9 @@ timeout 20 #selection_small selection-small.bmp # Use text mode only. When enabled, this option forces rEFInd into text mode. +# Passing this option a "0" value causes graphics mode to be used. Pasing +# it no value or any non-0 value causes text mode to be used. +# Default is to use graphics mode. # #textonly @@ -188,6 +191,9 @@ timeout 20 # want to give a kernel a custom icon by placing an icon with the kernel's # filename but a ".icns" extension in the same directory as the kernel, this # option will cause the icon file to show up as a non-functional loader tag. +# Passing this option a "0" value causes kernels without ".efi" extensions +# to NOT be scanned; passing it alone or with any other value causes all +# kernels to be scanned. # Default is to NOT scan for kernels without ".efi" extensions. # scan_all_linux_kernels @@ -211,6 +217,14 @@ scan_all_linux_kernels # #default_selection 1 +# Include a secondary configuration file within this one. This secondary +# file is loaded as if its options appeared at the point of the "include" +# token itself, so if you want to override a setting in the main file, +# the secondary file must be referenced AFTER the setting you want to +# override. Note that the secondary file may NOT load a tertiary file. +# +#include manual.conf + # Sample manual configuration stanzas. Each begins with the "menuentry" # keyword followed by a name that's to appear in the menu (use quotes # if you want the name to contain a space) and an open curly brace diff --git a/refind/config.c b/refind/config.c index e275085..be8da92 100644 --- a/refind/config.c +++ b/refind/config.c @@ -53,7 +53,6 @@ // constants -#define CONFIG_FILE_NAME L"refind.conf" #define LINUX_OPTIONS_FILENAMES L"refind_linux.conf,refind-linux.conf" #define MAXCONFIGFILESIZE (128*1024) @@ -336,7 +335,7 @@ static VOID HandleStrings(IN CHAR16 **TokenList, IN UINTN TokenCount, OUT CHAR16 } // static VOID HandleStrings() // read config file -VOID ReadConfig(VOID) +VOID ReadConfig(CHAR16 *FileName) { EFI_STATUS Status; REFIT_FILE File; @@ -344,20 +343,23 @@ VOID ReadConfig(VOID) CHAR16 *FlagName; UINTN TokenCount, i; - if (!FileExists(SelfDir, CONFIG_FILE_NAME)) { - Print(L"Configuration file missing!\n"); + // Set a few defaults only if we're loading the default file. + if (StriCmp(FileName, CONFIG_FILE_NAME) == 0) { + MyFreePool(GlobalConfig.DontScanDirs); + GlobalConfig.DontScanDirs = StrDuplicate(SelfDirPath); + MyFreePool(GlobalConfig.DontScanFiles); + GlobalConfig.DontScanFiles = StrDuplicate(DONT_SCAN_FILES); + } + + if (!FileExists(SelfDir, FileName)) { + Print(L"Configuration file '%s' missing!\n", FileName); return; } - Status = ReadFile(SelfDir, CONFIG_FILE_NAME, &File, &i); + Status = ReadFile(SelfDir, FileName, &File, &i); if (EFI_ERROR(Status)) return; - MyFreePool(GlobalConfig.DontScanDirs); - GlobalConfig.DontScanDirs = StrDuplicate(SelfDirPath); - MyFreePool(GlobalConfig.DontScanFiles); - GlobalConfig.DontScanFiles = StrDuplicate(DONT_SCAN_FILES); - for (;;) { TokenCount = ReadTokenLine(&File, &TokenList); if (TokenCount == 0) @@ -450,7 +452,11 @@ VOID ReadConfig(VOID) HandleString(TokenList, TokenCount, &(GlobalConfig.DefaultSelection)); } else if (StriCmp(TokenList[0], L"textonly") == 0) { - GlobalConfig.TextOnly = TRUE; + if ((TokenCount >= 2) && (StriCmp(TokenList[1], L"0") == 0)) { + GlobalConfig.TextOnly = FALSE; + } else { + GlobalConfig.TextOnly = TRUE; + } } else if ((StriCmp(TokenList[0], L"resolution") == 0) && (TokenCount == 3)) { GlobalConfig.RequestedScreenWidth = Atoi(TokenList[1]); @@ -473,11 +479,20 @@ VOID ReadConfig(VOID) } // for (graphics_on tokens) } else if (StriCmp(TokenList[0], L"scan_all_linux_kernels") == 0) { - GlobalConfig.ScanAllLinux = TRUE; + if ((TokenCount >= 2) && (StriCmp(TokenList[1], L"0") == 0)) { + GlobalConfig.ScanAllLinux = FALSE; + } else { + GlobalConfig.ScanAllLinux = TRUE; + } } else if (StriCmp(TokenList[0], L"max_tags") == 0) { HandleInt(TokenList, TokenCount, &(GlobalConfig.MaxTags)); + } else if ((StriCmp(TokenList[0], L"include") == 0) && (TokenCount == 2) && (StriCmp(FileName, CONFIG_FILE_NAME) == 0)) { + if (StriCmp(TokenList[1], FileName) != 0) { + ReadConfig(TokenList[1]); + } + } FreeTokenLine(&TokenList, &TokenCount); diff --git a/refind/config.h b/refind/config.h index 5e5b042..a2c1a1e 100644 --- a/refind/config.h +++ b/refind/config.h @@ -74,10 +74,11 @@ typedef struct { #define HIDEUI_FLAG_ARROWS (0x0010) #define HIDEUI_ALL ((0xffff)) +#define CONFIG_FILE_NAME L"refind.conf" #define DONT_SCAN_FILES L"shim.efi,MokManager.efi,TextMode.efi,ebounce.efi,GraphicsConsole.efi" EFI_STATUS ReadFile(IN EFI_FILE_HANDLE BaseDir, CHAR16 *FileName, REFIT_FILE *File, UINTN *size); -VOID ReadConfig(VOID); +VOID ReadConfig(CHAR16 *FileName); VOID ScanUserConfigured(VOID); UINTN ReadTokenLine(IN REFIT_FILE *File, OUT CHAR16 ***TokenList); VOID FreeTokenLine(IN OUT CHAR16 ***TokenList, IN OUT UINTN *TokenCount); diff --git a/refind/main.c b/refind/main.c index 3ff6255..0158401 100644 --- a/refind/main.c +++ b/refind/main.c @@ -118,7 +118,7 @@ static VOID AboutrEFInd(VOID) if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.5.0.3"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.5.1"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith"); @@ -1860,7 +1860,7 @@ VOID RescanAll(VOID) { FreeList((VOID ***) &(MainMenu.Entries), &MainMenu.EntryCount); MainMenu.Entries = NULL; MainMenu.EntryCount = 0; - ReadConfig(); + ReadConfig(CONFIG_FILE_NAME); ConnectAllDriversToAllControllers(); ScanVolumes(); ScanForBootloaders(); @@ -1910,7 +1910,7 @@ efi_main (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) FindLegacyBootType(); if (GlobalConfig.LegacyType == LEGACY_TYPE_MAC) CopyMem(GlobalConfig.ScanFor, "ihebocm ", NUM_SCAN_OPTIONS); - ReadConfig(); + ReadConfig(CONFIG_FILE_NAME); WarnIfLegacyProblems(); MainMenu.TimeoutSeconds = GlobalConfig.Timeout; diff --git a/refind/mok.h b/refind/mok.h index 4fbfb22..d9545d5 100644 --- a/refind/mok.h +++ b/refind/mok.h @@ -4,6 +4,7 @@ #define SHIM_LOCK_GUID \ { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} } +#if defined (EFIX64) typedef struct _SHIM_LOCK { EFI_STATUS __attribute__((sysv_abi)) (*shim_verify) (VOID *buffer, UINT32 size); @@ -13,6 +14,17 @@ typedef struct _SHIM_LOCK EFI_STATUS __attribute__((sysv_abi)) (*read_header) (void *data, unsigned int datasize, GNUEFI_PE_COFF_LOADER_IMAGE_CONTEXT *context); } SHIM_LOCK; +#else +typedef struct _SHIM_LOCK +{ + EFI_STATUS (*shim_verify) (VOID *buffer, UINT32 size); + EFI_STATUS (*generate_hash) (char *data, int datasize, + GNUEFI_PE_COFF_LOADER_IMAGE_CONTEXT *context, UINT8 *sha256hash, + UINT8 *sha1hash); + EFI_STATUS (*read_header) (void *data, unsigned int datasize, + GNUEFI_PE_COFF_LOADER_IMAGE_CONTEXT *context); +} SHIM_LOCK; +#endif BOOLEAN ShimLoaded(void); BOOLEAN secure_mode (VOID);