]> code.delx.au - refind/commitdiff
installation script improvements; 0.5.1 release
authorsrs5694 <srs5694@users.sourceforge.net>
Wed, 12 Dec 2012 01:47:00 +0000 (20:47 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Wed, 12 Dec 2012 01:47:00 +0000 (20:47 -0500)
23 files changed:
NEWS.txt
docs/refind/bootmode.html
docs/refind/configfile.html
docs/refind/drivers.html
docs/refind/features.html
docs/refind/getting.html
docs/refind/index.html
docs/refind/installing.html
docs/refind/linux.html
docs/refind/revisions.html
docs/refind/secureboot.html
docs/refind/themes.html
docs/refind/todo.html
docs/refind/using.html
install.sh
libeg/libeg.h
libeg/screen.c
mkdistrib
refind.conf-sample
refind/config.c
refind/config.h
refind/main.c
refind/mok.h

index c9277003cd5e9110e80fa0b8837f369aed49918b..65b4e727ad39b1fa0ac0a7d46614e04514cda5af 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,30 @@
-0.5.1 (??/??/201?):
+0.5.1 (12/11/2012):
 -------------------
 
+- Added support for "0" options to "textonly" and "scan_all_linux_kernels"
+  to reverse the usual meaning of these tokens. This is useful for
+  including these options in a secondary configuration file called with the
+  new "include" token to override a setting set in the main file.
+
+- Added "include" token for refind.conf, to enable including a secondary
+  configuration file from a primary one.
+
+- Modified install.sh so that it creates a simple refind_linux.conf file in
+  /boot, if that file doesn't already exist and if install.sh is run from
+  Linux. If that directory happens to be on a FAT, HFS+, ext2fs, ext3fs, or
+  ReiserFS volume, and if the necessary drivers are installed, the result
+  is that rEFInd will detect the Linux installation with no further
+  configuration on many systems. (Some may still require tweaking of kernel
+  options, though; for instance, adding "dolvm" on Gentoo systems that use
+  LVM.)
+
+- Added --shim and --localkeys options to install.sh to help simplify setup
+  on systems with Secure Boot active.
+
+- Fixed (maybe) bug that caused resolution options to not be displayed on
+  recent Macs with GOP graphics when specifying an invalid resolution in
+  refind.conf.
+
 - Fixed bug that caused some programs (EFI shells, in particular) to hang
   when launching on some systems (DUET, in particular).
 
index 15e5218ab6a8e2906c238d6fd610d39f6d471cde..2ff249bcaa411b0f395a42eb265d8816f8e3407b 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>\r
 \r
 <p>Originally written: 3/14/2012; last Web page update:\r
-12/6/2012, referencing rEFInd 0.5.0</p>\r
+12/11/2012, referencing rEFInd 0.5.1</p>\r
 \r
 \r
 <p>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!</p>\r
index dcf1fe10392890fa94ab0bf835d0b472f850292d..8f8b2a81321bbf140efe242a6b077c1cdeafb549 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/14/2012; last Web page update:
-12/6/2012, referencing rEFInd 0.5.0</p>
+12/11/2012, referencing rEFInd 0.5.1</p>
 
 
 <p>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!</p>
@@ -175,8 +175,8 @@ timeout 20
 </tr>
 <tr>
    <td><tt>textonly</tt></td>
-   <td>None</td>
-   <td>rEFInd defaults to a graphical mode; however, if you prefer to do without the flashy graphics, you can run it in text mode by including this option.</td>
+   <td>None or <tt>0</tt></td>
+   <td>rEFInd defaults to a graphical mode; however, if you prefer to do without the flashy graphics, you can run it in text mode by including this option. Passing any option but <tt>0</tt> causes text mode to be used; passing a <tt>0</tt> causes graphics mode to be used. (This could be useful if you want to override a text-mode setting in an included secondary configuration file.)</td>
 </tr>
 <tr>
    <td><tt>resolution</tt></td>
@@ -220,14 +220,19 @@ timeout 20
 </tr>
 <tr>
    <td><tt>scan_all_linux_kernels</tt></td>
-   <td>None</td>
-   <td>When set, causes rEFInd to add Linux kernels (files with names that begin with <tt>vmlinuz</tt> or <tt>bzImage</tt>) to the list of EFI boot loaders, even if they lack <tt>.efi</tt> filename extensions. The hope is that this will simplify use of rEFInd on distributions that provide kernels with EFI stub loader support but that don't give those kernels names that end in <tt>.efi</tt>. Of course, the kernels must still be stored on a filesystem that rEFInd can read, and in a directory that it scans. (<a href="drivers.html">Drivers</a> and the <tt>also_scan_dirs</tt> options can help with those issues.) Note that this option can cause unwanted files to be improperly detected and given loader tags, such as older kernels without EFI stub loader support. Versions of rEFInd prior to 0.5.0 left this option commented out in the <tt>refind.conf-sample</tt> file, but as of version 0.5.0, this option is enabled in the default configuration file. The program default remains to not scan for such kernels, though, so you can delete or uncomment this option to keep them from appearing in your boot menu.</td>
+   <td>None or <tt>0</tt></td>
+   <td>When set, causes rEFInd to add Linux kernels (files with names that begin with <tt>vmlinuz</tt> or <tt>bzImage</tt>) to the list of EFI boot loaders, even if they lack <tt>.efi</tt> filename extensions. The hope is that this will simplify use of rEFInd on distributions that provide kernels with EFI stub loader support but that don't give those kernels names that end in <tt>.efi</tt>. Of course, the kernels must still be stored on a filesystem that rEFInd can read, and in a directory that it scans. (<a href="drivers.html">Drivers</a> and the <tt>also_scan_dirs</tt> options can help with those issues.) Note that this option can cause unwanted files to be improperly detected and given loader tags, such as older kernels without EFI stub loader support. Versions of rEFInd prior to 0.5.0 left this option commented out in the <tt>refind.conf-sample</tt> file, but as of version 0.5.0, this option is enabled in the default configuration file. The program default remains to not scan for such kernels, though, so you can delete or uncomment this option to keep them from appearing in your boot menu. Passing any option but <tt>0</tt> causes scans for all kernels to occur; passing a <tt>0</tt> causes these kernels to not be scanned. (This could be useful if you want to override a setting of <tt>scan_all_linux_kernels</tt> in an included secondary configuration file.)</td>
 </tr>
 <tr>
    <td><tt>default_selection</tt></td>
    <td>A substring of a boot loader's title; or a numeric position</td>
    <td>Sets the default boot OS based on the loader's title, which appears in the main menu beneath the icons when you select the loader. You can enter any substring of the title as the <tt>default_selection</tt>, so long as it's two or more characters in length. It's best to use a unique substring, since rEFInd stops searching when it finds the first match. Because rEFInd sorts entries within a directory in descending order by file modification time, if you specify a directory (or volume name, for loaders in a partition's root directory) as the <tt>default_selection</tt>, the most recent loader in that directory will be the default. One-character entries are matched against the first character of the title, except for digits, which refer to the numeric order of the boot loader entries.</td>
 </tr>
+<tr>
+   <td><tt>include</tt></td>
+   <td>filename</td>
+   <td>Includes the specified file into the current configuration file. Essentially, the included file replaces the <tt>include</tt> line, so positioning of this token is important if the included file includes options that contradict those in the main file. The included file must reside in the same directory as the rEFInd binary and the main configuration file. This option is valid only in the main configuration file; included files may not include third-tier configuration files.</td>
+</tr>
 </table>
 
 <p>Prior to version 0.2.4, rEFInd supported a token called <tt>disable</tt>, whose function partially overlapped with <tt>hideui</tt>. Version 0.2.4 merges many of the features of these two tokens into <tt>hideui</tt> and creates the new <tt>showtools</tt> option, which provides the remaining functionality in a more flexible way.</p>
index fb5852f1313e431e10bd2980bab1e7f189a45e7c..f20140a094b50320ab878cf52032cf9f7bc48788 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 4/19/2012; last Web page update:
-12/6/2012, referencing rEFInd 0.5.0</p>
+12/11/2012, referencing rEFInd 0.5.1</p>
 
 
 <p>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!</p>
index b9f41c31cff018663c95e871747d87bdab562247..8f12242d367e7a9ebf5a2fa62ff16401663417ad 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/14/2012; last Web page update:
-12/6/2012, referencing rEFInd 0.5.0</p>
+12/11/2012, referencing rEFInd 0.5.1</p>
 
 <p>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!</p>
 
index 3da81eec34d12bcf521e6c3287333cbada9657a9..0266bb4617f10d92a4d9abc7b58c31afe90dad7e 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/14/2012; last Web page update:
-12/6/2012, referencing rEFInd 0.5.0</p>
+12/11/2012, referencing rEFInd 0.5.1</p>
 
 <p>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!</p>
 
@@ -98,7 +98,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 <ul>
 
 <li><b><a
-    href="http://sourceforge.net/projects/refind/files/0.5.0/refind-src-0.5.0.zip/download">A
+    href="http://sourceforge.net/projects/refind/files/0.5.1/refind-src-0.5.1.zip/download">A
     source code zip file</a></b>&mdash;This is useful if you want to
     compile the software locally. Note that I use Linux with the <a
     href="https://sourceforge.net/projects/tianocore/">TianoCore EFI
@@ -109,7 +109,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
     possible, but I've not attempted it.</li>
 
 <li><b><a
-    href="http://sourceforge.net/projects/refind/files/0.5.0/refind-bin-0.5.0.zip/download">A
+    href="http://sourceforge.net/projects/refind/files/0.5.1/refind-bin-0.5.1.zip/download">A
     binary zip file</a></b>&mdash;Download this if you want to install
     rEFInd and/or its filesystem drivers on an <i>x</i>86 or <i>x</i>86-64
     computer and have no need to test rEFInd first by booting it on an
@@ -134,7 +134,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 <p class="sidebar"><b>Tip:</b> If you want a bootable USB flash drive, download the binary zip file or CD-R image file, prepare a USB flash drive with a FAT32 ESP, and then use the <tt>install.sh</tt> program's <tt>--usedefault</tt> option, as in <tt class="userinput">bash install.sh --usedefault /dev/sdd1</tt> to install to the first partition on <tt>/dev/sdd</tt>. This procedure should work even on a BIOS-booted computer.</p>
 
 <li><b><a
-    href="http://sourceforge.net/projects/refind/files/0.5.0/refind-cd-0.5.0.zip/download">A
+    href="http://sourceforge.net/projects/refind/files/0.5.1/refind-cd-0.5.1.zip/download">A
     CD-R image file</a></b>&mdash;This download contains the same files as
     the binary zip file, but you can burn it to a CD-R to test rEFInd
     (and its filesystem drivers) without installing it first. (It boots on
index bef175ad9f732f3e1cb4dd42e2a8b2cd42896414..84350472d34288c1d9bec61e456aefa61c361246 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/14/2012; last Web page update:
-12/6/2012, referencing rEFInd 0.5.0</p>
+12/11/2012, referencing rEFInd 0.5.1</p>
 
 
 <p>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!</p>
index 40c5f87cee13e369b9764c84f4189976137ab5ed..e5c62214ff21aa2b660e34b54f1d9915e3398324 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/14/2012; last Web page update:
-12/6/2012, referencing rEFInd 0.5.0</p>
+12/11/2012, referencing rEFInd 0.5.1</p>
 
 
 <p>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!</p>
@@ -195,6 +195,18 @@ Installation has completed successfully.</pre>
     though; because of the popularity of dual boots with Windows on Macs,
     the BIOS/legacy scans are enabled by default on Macs.</li>
 
+<li>If you run <tt>install.sh</tt> on Linux and if
+    <tt>/boot/refind_linux.conf</tt> doesn't already exist,
+    <tt>install.sh</tt> creates this file and populates it with a couple of
+    sample entries. If <tt>/boot</tt> is on a FAT partition (or HFS+ on a
+    Mac), or if it's on an ext2fs, ext3fs, ReiserFS, or HFS+ partition and
+    you install an appropriate driver (for instance by passing
+    <tt>--drivers</tt> to the script), the result is that rEFInd will
+    detect your kernel and will probably boot it correctly. Some systems
+    will require manual tweaking to <tt>refind_linux.conf</tt>,
+    though&mdash;for instance, to add <tt>dolvm</tt> to the boot options on
+    Gentoo systems that use LVM.</li>
+
 </ul>
 
 <p>In addition to these quirks, you should be aware of some options that <tt>install.sh</tt> supports to enable you to customize your installation in various ways. The syntax for <tt>install.sh</tt> is as follows:</p>
index 77cabc0e1a1d03c1d17790d983f48b20000eed19..5a188149cc1bd9033db8bbb8bc787803a4480895 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/19/2012; last Web page update:
-12/6/2012, referencing rEFInd 0.5.0</p>
+12/11/2012, referencing rEFInd 0.5.1</p>
 
 
 <p>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!</p>
@@ -92,17 +92,135 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Windows 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.</p>
 
-<p>Under Linux, by contrast, things can get complicated. As detailed on my <a href="http://www.rodsbooks.com/efi-bootloaders/index.html">Managing EFI Boot Loaders for Linux</a> 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.</p>
+<p>Under Linux, by contrast, things can get complicated. As detailed on my <a href="http://www.rodsbooks.com/efi-bootloaders/index.html">Managing EFI Boot Loaders for Linux</a> 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 <a href="#traditional">traditional Linux boot loaders.</a> It works even better with the Linux EFI stub loader, so I provide <a href="#quickstart">instructions on starting with it.</a> For those interested in manual configuration, I also provide <a href="#efistub">detailed instructions</a> on how the EFI stub support works and how to configure it.</p>
 
+<a name="traditional">
 <h2>Using a Traditional Linux Boot Loader</h2>
+</a>
 
-<p>I consider <a href="http://www.rodsbooks.com/efi-bootloaders/elilo.html">ELILO,</a> <a href="http://www.rodsbooks.com/efi-bootloaders/grub_legacy.html">GRUB Legacy,</a> and <a href="http://www.rodsbooks.com/efi-bootloaders/grub2.html">GRUB 2</a> 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).</p>
+<p>I consider <a href="http://www.rodsbooks.com/efi-bootloaders/elilo.html">ELILO,</a> <a href="http://www.rodsbooks.com/efi-bootloaders/grub_legacy.html">GRUB Legacy,</a> and <a href="http://www.rodsbooks.com/efi-bootloaders/grub2.html">GRUB 2</a> 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).</p>
 
 <p>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.</p>
 
 <p>If you prefer, you can disable automatic scanning and create an entry in <tt>refind.conf</tt> for your distribution, as described on the <a href="configfile.html">Configuring the Boot Manager</a> page. This method is harder to set up but can be preferable if you want to customize your options.</p>
 
-<h2>Using the EFI Stub Loader</h2>
+<a name="quickstart">
+<h2>Using the EFI Stub Loader: A Quick Setup Guide</h2>
+</a>
+
+<p>The EFI stub loader is basic and reliable, but it requires some setup to use it. I describe both <a href="#testing">a quick test configuration</a> and <a href="#longterm">a long-term setup.</a></p>
+
+<a name="testing">
+<h3>Testing the EFI Stub Loader</h3>
+</a>
+
+<p>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:</p>
+
+<ol>
+
+<li>Copy your kernel file (<tt>vmlinuz-*</tt>) and matching initial RAM
+    disk file (<tt>init*</tt>) from <tt>/boot</tt> to a subdirectory of
+    <tt>EFI</tt> on your ESP. Your distribution's directory there should
+    work fine. For instance, typing <tt class="userinput">cp
+    /boot/vmlinuz-3.6.7-4.fc17.x86_64
+    /boot/initramfs-3.6.7-4.fc17.x86_64.img /boot/efi/EFI/redhat</tt> might
+    do the trick on a Fedora system, although you'll probably have to
+    adjust the version numbers. Note that the filename forms vary from one
+    distribution to another, so don't worry if yours look different from
+    these. Be sure that you match up the correct files by version number,
+    though.</li>
+
+<li>Copy the <tt>/boot/refind_linux.conf</tt> file to the same directory to
+    which you copied your kernel. If this file doesn't exist, create it by
+    running (as <tt>root</tt>) the <tt>mkrlconf.sh</tt> script that came
+    with rEFInd.</li>
+
+<li>Reboot. You should now see a new entry for launching the Linux kernel
+    that you copied. Try the option. If it works, great. If not, you may
+    need to adjust your <tt>refind_linux.conf</tt> file. See the <a
+    href="#efistub">detailed configuration section</a> for a description of
+    this file's format. If the kernel begins to boot but complains that it
+    couldn't find its root filesystem, double-check the version numbers on
+    your kernel and initial RAM disk file, and check the <tt>root=</tt>
+    option in <tt>refind_linux.conf</tt>.</li>
+
+</ol>
+
+<p>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 <tt>/boot</tt> directory, where most Linux distributions place their kernels.</p>
+
+<a name="longterm">
+<h3>Configuring a Maintenance-Free Setup</h3>
+</a>
+
+<p>The ideal configuration for use of the EFI stub loader involves giving rEFInd the ability to load your kernels directly from <tt>/boot</tt>. 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 <tt>root</tt>, or precede each of these commands with <tt>sudo</tt>:</p>
+
+<ol>
+
+<li>Begin with your ESP mounted at <tt>/boot/efi</tt>, which is the most
+    common location. If it's not mounted there, type <tt
+    class="userinput">mount /dev/sda1 /boot/efi</tt> to do so (adjusting
+    <tt>/dev/sda1</tt>, if necessary), or mount it elsewhere and adjust the
+    paths in the following procedure as necessary.</li>
+
+<li>Check the size of the ESP by typing <tt class="userinput">df -h
+    /boot/efi</tt>. The ESP must be large enough to hold several Linux
+    kernels and initial RAM disk files&mdash;100MiB at a bare minimum, and
+    preferably 200&ndash;500MiB.</li>
+
+<li>Check your <tt>/boot</tt> directory to be sure it contains no links or
+    other files that rely on Unix/Linux-style permissions or ownership. If
+    it does, don't proceed, or at least research these files further to
+    determine if you can work around the need for such permissions and
+    ownership.</li>
+
+<li>Type <tt class="userinput">mv /boot/* /boot/efi</tt>. You'll see an
+    error message about being unable to move <tt>/boot/efi</tt> into
+    itself. Ignore this.</li>
+
+<li>Type <tt class="userinput">umount /boot/efi</tt>.</li>
+
+<li>Edit <tt>/etc/fstab</tt> and change the mount point for
+    <tt>/boot/efi</tt> to <tt>/boot</tt>. If the ESP isn't present in
+    <tt>/etc/fstab</tt>, you must create an entry for it, with a mount
+    point of <tt>/boot</tt>.</li>
+
+<li>Type <tt class="userinput">mount -a</tt> to re-mount everything,
+    including <tt>/boot</tt>. Check that your normal <tt>/boot</tt> files
+    are all present, along with the new <tt>/boot/EFI</tt> directory, which
+    holds what used to be <tt>/boot/efi/EFI</tt>. If something seems to be
+    missing (other than <tt>/boot/efi</tt> with a lowercase <tt>efi</tt>),
+    then you should try to correct the problem.</li>
+
+<li>If it doesn't already exist, create a file called
+    <tt>/boot/refind_linux.conf</tt> and populate it with kernel options,
+    as described <a href="#refind_linux">later.</a> If this file doesn't
+    already exist, the easiest way to create it is to run the
+    <tt>mkrlconf.sh</tt> script that comes with rEFInd 0.5.1 and
+    later.</li>
+
+<li>Check your <tt>refind.conf</tt> file (presumably in
+    <tt>/boot/EFI/refind</tt>) to be sure that the
+    <tt>scan_all_linux_kernels</tt> line is uncommented. If it's not,
+    uncomment that line.</li>
+
+<li>Optionally, type <tt class="userinput">cp
+    /boot/EFI/refind/icons/os_<i>name</i>.icns /boot/.VolumeIcon.icns</tt>
+    to give loaders in <tt>/boot</tt> an icon for your distribution.</li>
+
+<li>Reboot to test that this configuration works.</li>
+
+</ol>
+
+<p>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.</p>
+
+<p>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 <tt>/boot</tt> 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&ndash;500MiB). Mount your new <tt>/boot</tt> partition at a temporary location, copy or move the current <tt>/boot</tt> files into it, unmount it, and add it to <tt>/etc/fstab</tt> as <tt>/boot</tt>.</p>
+
+
+<p>If your distribution already uses a separate <tt>/boot</tt> 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 <tt>/boot</tt> partition, you'll probably want to continue mounting the ESP at <tt>/boot/efi</tt>.</p>
+
+<a name="efistub">
+<h2>EFI Stub Loader Support Technical Details</h2>
+</a>
 
 <p>The Linux <a href="http://www.rodsbooks.com/efi-bootloaders/efistub.html">EFI stub loader</a> 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 (<tt>/</tt>) 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.</p>
 
@@ -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.</p>
+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.</p>
 
 <p>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:</p>
 
@@ -131,9 +249,10 @@ another possibility.</p>
     with version 0.3.0, if you uncomment the
     <tt>scan_all_linux_kernels</tt> option in <tt>refind.conf</tt>, rEFInd
     will also scan for kernels <i>without</i> a <tt>.efi</tt> 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.</li>
+    extension. This option is uncommented by default, but if you comment it
+    out, delete it, or change it to read <tt>scan_all_linux_kernels 0</tt>,
+    rEFInd won't scan for kernels that lack <tt>.efi</tt> filename
+    extensions.</li>
 
 <p class="sidebar">A kernel whose filename lacks a version string matches an initial RAM disk that also lacks a version string in its filename. Note that you can reliably use only <i>one</i> kernel and initial RAM disk per directory that lack version numbers in their filenames.</p>
 
@@ -157,12 +276,16 @@ another possibility.</p>
     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.</li>
+    options that are accessible from the main menu tag's submenu screen. If
+    you installed rEFInd 0.5.1 or later with the <tt>install.sh</tt>
+    script, that script created a sample <tt>refind_linux.conf</tt> file,
+    customized for your computer, in <tt>/boot</tt>. This file will work
+    without changes on many installations, but you may need to tweak it for
+    some.</li>
 
 </ol>
 
-<p>The intent of this system is that distribution maintainers can place their kernels, initial RAM disks, and a <tt>refind_linux.conf</tt> 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 <tt>refind_linux.conf</tt> 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.</p>
+<p>The intent of this system is that distribution maintainers can place their kernels, initial RAM disks, and a <tt>refind_linux.conf</tt> file in their own subdirectories on the ESP, on EFI-accessible <tt>/boot</tt> partitions, or in <tt>/boot</tt> directories on EFI-accessible Linux root (<tt>/</tt>) 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 <tt>refind_linux.conf</tt> 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.</p>
 
 <p>The <tt>scan_all_linux_kernels</tt> 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 <tt>/boot</tt> partition. In these cases, if all the kernels in Linux's <tt>/boot</tt> 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 <tt>refind_linux.conf</tt> file and you may need to install a driver or set the <tt>also_scan_dirs</tt> option in <tt>refind.conf</tt>; but these are one-time requirements. Set up in this way, ongoing maintenance to handle kernel updates drops to zero!</p>
 
@@ -179,12 +302,14 @@ total 17943
 
 <p>When rEFInd scans this directory, it will find two EFI boot loaders in <tt>EFI/ubuntu</tt>: <tt>grubx64.EFI</tt> and <tt>bzImage-3.3.0.efi</tt>. 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 <tt>refind_linux.conf</tt> file contains a list of labels and options:</p>
 
+<a name="refind_linux">
 <pre class="listing">
 "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"
 </pre>
+</a>
 
 <p>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 <tt>"root=/dev/sdb9 my_opt=""this is it"""</tt>, which passes <tt>root=/dev/sdb9 my_opt="this is it"</tt> 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 (<tt>#</tt>), as in the fourth line in this example.</p>
 
@@ -197,6 +322,8 @@ total 17943
 
 <p>Note that the first entry shown here takes a name that's set in rEFInd rather than the one specified in the <tt>refind_linux.conf</tt> file. The remaining names match those specified in the file, though.</p>
 
+<p>To assist in initial configuration, rEFInd's <tt>install.sh</tt> script creates a sample <tt>refind_linux.conf</tt> file in <tt>/boot</tt>. This sample file defines two entries that use the default GRUB options defined in <tt>/etc/default/grub</tt>. 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 <tt>mkrlconf.sh</tt> script that comes with rEFInd. If you pass it the <tt>--force</tt> option, it will overwrite the existing <tt>/boot/refind_linux.conf</tt> file; otherwise it will create the file only if one doesn't already exist.</p>
+
 <p>From a user's perspective, the submenus defined in this way work just like submenus defined via the <tt>submenuentry</tt> options in <tt>refind.conf</tt>, 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:</p>
 
 <ul>
index 7ccd1c0a3a7f65cb588c0c006aa3fc915d3d868a..1aab57f619f2a130689adc8a3eee556dc7f67f73 100644 (file)
@@ -14,7 +14,7 @@
 <p class="subhead">by Roderick W. Smith, <a
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
-<p>Last Web page update: 12/6/2012</p>
+<p>Last Web page update: 12/11/2012</p>
 
 
 <p>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!</p>
@@ -93,7 +93,9 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <ul>
 
-<li><b>0.5.0 (12/5/2012)</b>&mdash;I've focused on adding support for Matthew J. Garrett's shim program to this version of rEFInd; with this support, rEFInd is capable of launching Linux kernels and other programs signed with a suitable key while the computer is in Secure Boot mode. This initial release, however, requires significant manual configuration and has some known bugs and limitations. See the <a href="secureboot.html">Managing Secure Boot</a> page for details. Beyond this major new feature, this version includes several more minor improvements. These include a change to the <tt>resolution</tt> token so that it applies to text mode as well as to graphics mode; a bug fix that caused the line editor to blank out lines that were left unedited; a new <tt>dont_scan_files</tt> option to blacklist boot programs by filename; support for launching MokManager and Apple's Recovery HD partitions via tools (2nd-row) icons; new <tt>--usedefault</tt> and <tt>--drivers</tt> options to the <tt>install.sh</tt> script; a change of the <tt>esp</tt> installation script option to <tt>--esp</tt>; and the ability to use quote marks inside option strings by doubling them up.</li>
+<li><b>0.5.1 (12/11/2012)</b>&mdash;The most important changes to this version are to the <tt>install.sh</tt> script. It now supports two options, <tt>--shim</tt> and <tt>--localkeys</tt>, to aid in installation on a Secure Boot system. See the <a href="installing.html">Installing rEFInd</a> and <a href="secureboot.html">Managing Secure Boot</a> pages for details. The script also now creates a sample <tt>/boot/refind_linux.conf</tt> file to assist in setting up boots via the Linux EFI stub loader. All of these <tt>install.sh</tt> improvements work only in Linux. A separate <tt>mkrlconf.sh</tt> script creates a <tt>/boot/refind_linux.conf</tt> file if it doesn't exist, for help in post-installation configuration. In rEFInd itself, I've fixed the bug that caused ELILO to be unable to locate its configuration file when launched in Secure Boot mode and fixed a couple of more obscure bugs. I've also added an <tt>include</tt> token to <tt>refind.conf</tt>, to enable you to create a secondary configuration file (say, one managed by scripts while leaving the main file untouched; or one dedicated to manual boot stanzas).</li>
+
+<li><b>0.5.0 (12/6/2012)</b>&mdash;I've focused on adding support for Matthew J. Garrett's shim program to this version of rEFInd; with this support, rEFInd is capable of launching Linux kernels and other programs signed with a suitable key while the computer is in Secure Boot mode. This initial release, however, requires significant manual configuration and has some known bugs and limitations. See the <a href="secureboot.html">Managing Secure Boot</a> page for details. Beyond this major new feature, this version includes several more minor improvements. These include a change to the <tt>resolution</tt> token so that it applies to text mode as well as to graphics mode; a bug fix that caused the line editor to blank out lines that were left unedited; a new <tt>dont_scan_files</tt> option to blacklist boot programs by filename; support for launching MokManager and Apple's Recovery HD partitions via tools (2nd-row) icons; new <tt>--usedefault</tt> and <tt>--drivers</tt> options to the <tt>install.sh</tt> script; a change of the <tt>esp</tt> installation script option to <tt>--esp</tt>; and the ability to use quote marks inside option strings by doubling them up.</li>
 
 <li><b>0.4.7 (11/6/2012)</b>&mdash;The most important new feature in this version is a boot options editor. From rEFInd's main menu, press Insert or F2 to see the options menu. Select one of the options and press Insert or F2 again and the screen switches to a text-mode display in which you can edit the options that will be passed to the boot loader. A second new feature is a new icon for <a href="http://freedesktop.org/wiki/Software/gummiboot">gummiboot,</a> which is another EFI boot manager. This version also alters the behavior of the <tt>scan_delay</tt> option, since I've been told that the previous version didn't work; the new one does. Finally, this version omits the space that followed boot options when booting most OSes. This behavior was inherited from rEFIt; a comment in the source code indicates it's needed by OS X, but I've been told it causes boot failures when launching Linux on some Macs. Thus, rEFInd now adds this space only when booting Mac OS X.</li>
 
index 7a5dc9763d08229d2e26d04876a9a70cfb483d07..d73fe3acc70eea486c0796f6371565390f24802e 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 11/13/2012; last Web page update:
-12/8/2012, referencing rEFInd 0.5.0.1</p>
+12/11/2012, referencing rEFInd 0.5.1</p>
 
 
 <p>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!</p>
index 884401b4530b0e7c99d896d2fe4fa0ed20936e5d..077dc89e6e44fabd7158017b3da6d15225b0520e 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 4/19/2012; last Web page update:
-12/6/2012, referencing rEFInd 0.5.0</p>
+12/11/2012, referencing rEFInd 0.5.1</p>
 
 
 <p>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!</p>
index 2fc86a5e93320f47091a694c5322d6c7484a2b52..92b4a38142100805f6f54324d79740176bbc40c8 100644 (file)
@@ -209,10 +209,6 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
        <tt>/usr/local/UDK2010/MyWorkSpace/MdeModulePkg/Core/Dxe/Image/Image.c</tt>
        for the reference UEFI implementation. --> </li>
 
-    <li>When launching ELILO in Secure Boot mode, ELILO can't find its
-       configuration file. It's possible that a similar problem exists for
-       other boot loaders, too.</li>
-
     <li>When setting a resolution higher than about 800x600 (or maybe even
        640x480) in text mode, the text displayed by rEFInd, and on some
        systems shells and other programs launched from rEFInd, is
@@ -270,14 +266,6 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
     <ul>
 
-    <li>With the arrival of PCs preloaded with Windows 8 and with Secure
-       Boot enabled, some way to cope is in order. I'm thinking of adding
-       code to limit or prohibit booting of unsigned boot loaders if
-       rEFInd detects that Secure Boot is active, and link with the <a
-       href="http://mjg59.dreamwidth.org/18945.html">Shim</a>
-       pre-bootloader to help handle signing and authentication. I need to
-       research the technical details more, though.</li>
-
     <li>EFI supports network boots. rEFInd doesn't, but it would be nice if
        it would.</li>
 
@@ -313,9 +301,6 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
        boot. Perhaps this could be done via a separate tool that could be
        launched much like the shell or <tt>gptsync</tt>.</li>
 
-    <li>I'd like to give the user the ability to set custom options on a
-       single-boot basis, similar to what's possible in GRUB.</li>
-
     <li>A way to set the color of the font would be useful for theming
         purposes.</li>
 
@@ -327,11 +312,6 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
        written in a cross-platform GUI toolkit, so that a single code base
        can be used on any of the major OSes.</li>
 
-    <li>A way to "source" one configuration file from another one would be
-       helpful for some types of configuration scripts. (This would enable
-       overriding options in a secondary file without modifying the
-       default original file, for instance.)</li>
-
     </ul></li> <!-- New features -->
 
     <li><b>Improvements to the EFI drivers:</b>
index 341045d0e34da4c22c9fffa6625c41024a9e97a7..48a94ff135ebfd9535e2ecabc524ad8b52374cb0 100644 (file)
@@ -15,7 +15,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/14/2012; last Web page update:
-12/6/2012, referencing rEFInd 0.5.0</p>
+12/11/2012, referencing rEFInd 0.5.1</p>
 
 
 <p>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!</p>
index 7e2fef4a89c16e96462651e467a8cc152a605e13..747475af73177b5541bff3b82e02bbd36be74db0 100755 (executable)
@@ -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
index 89ddb740cdfda2d18c412428b17df98d9047f9b8..68aaf54757b0b690ea26d2b63206c2e7ea8b3597 100644 (file)
@@ -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__ */
index b3327042c013ff8e25f7cc52a36e865d676ca52e..f17f7f563e897178584fa04c319c258aa4672702 100644 (file)
@@ -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
index e55521b2d195ba7f49bc8b39b3c709a75e3d568e..264137ca25e19b367dbcc721571d8d328719c2b9 100755 (executable)
--- 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/
index 42c73fce309ee5b97a7670dfcc016d8bd7083c2e..234ae9863bb5b0b892f510dc4009b0793170434a 100644 (file)
@@ -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
index e2750858308fc75d6cd2391d3d39c138ab316e88..be8da92bd8cd29f8835c2d063917d118b6fd0d5a 100644 (file)
@@ -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);
index 5e5b042d9d9bd774e8fb8cd6bf2bc159ec003ceb..a2c1a1efa7e77534f5fb8579d0dcfcc7907c35bf 100644 (file)
@@ -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);
index 3ff6255f51bb2c61a9fdf489f7fa3e5935ef6651..01584014792425f855a8616f7140a782b79ac176 100644 (file)
@@ -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;
 
index 4fbfb220b22f2a17f3a6ea580153017471e60b73..d9545d52e99bb9e09540d47f9645ff3585f5b400 100644 (file)
@@ -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);