]> code.delx.au - refind/commitdiff
Refinements to installation script.
authorsrs5694 <srs5694@users.sourceforge.net>
Mon, 10 Dec 2012 18:04:35 +0000 (13:04 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Mon, 10 Dec 2012 18:04:35 +0000 (13:04 -0500)
BUILDING.txt
docs/refind/secureboot.html
filesystems/Make.tiano
install.sh
mkdistrib
refind/main.c

index 410914280ee371b9d5c4aac23f6afb93e1a7ee52..e5501c2c6d91f2e1957d052fb1b575e0ad74ab84 100644 (file)
@@ -222,8 +222,8 @@ With your development system set up, you can compile rEFInd as follows:
    directory. (Typing "ARCH=ia32 make fs" builds IA32 filesystem drivers on
    an x86-64 system, provided TianoCore is properly configured, as
    described earlier.) The result is filesystem drivers in the filesystems
-   subdirectory, and also copies placed in the drivers subdirectory. You
-   must install the TianoCore EDK2 to build the drivers.
+   subdirectory, and also copies placed in the drivers_{arch} subdirectory.
+   You must install the TianoCore EDK2 to build the drivers.
 
 If rEFInd doesn't compile correctly, you'll need to track down the source
 of the problem. Double-check that you've got all the necessary development
@@ -308,8 +308,8 @@ Compiling the EFI Filesystem Drivers
 
 To build all the drivers, you can type "make fs" from the main directory,
 which builds the drivers and places copies in both the filesystems and
-drivers subdirectories. If you want to build just one driver, you can
-change into the "filesystems" directory and type "make {fsname}", where
+drivers_{arch} subdirectories. If you want to build just one driver, you
+can change into the "filesystems" directory and type "make {fsname}", where
 {fsname} is a filesystem name -- "ext2", "reiserfs", "iso9660", or "hfs".
 
 To install drivers, you can type "make install" in the "filesystems"
@@ -317,11 +317,13 @@ directory. This copies all the drivers to the
 "/boot/efi/EFI/refind/drivers" directory. Alternatively, you can copy the
 files you want manually. As of version 0.4.8, the install.sh script
 includes an optional "--drivers" option that will install the drivers along
-with the main rEFInd program.
+with the main rEFInd program, but to the drivers_{arch} subdirectory of the
+main rEFInd installation directory.
 
 *CAUTION:* Install drivers for your system's architecture *ONLY*.
 Installing drivers for the wrong architecture causes some systems to hang
-at boot time.
+at boot time. This risk can be minimized by including the architecture code
+in the drivers subdirectory name (drivers_x64 or drivers_ia32).
 
 The drivers all rely on filesystem wrapper code created by rEFIt's author,
 Christoph Pfisterer. Most of the drivers seem to have passed through
index d254f817b3557ae935f649851e540fe6b0d5922d..7a5dc9763d08229d2e26d04876a9a70cfb483d07 100644 (file)
@@ -98,23 +98,50 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 <h2>Basic Issues</h2>
 </a>
 
-<p class="sidebar"><b>Note:</b> You don't <i>have to</i> use Secure Boot. If you don't want it, you can <a href="http://www.rodsbooks.com/efi-bootloaders/secureboot.html#disable">disable it,</a> at least on <i>x</i>86-64 PCs. If an ARM-based computer ships with Windows 8, this isn't an option for it. Unfortunately, the shim software described on this page currently supports only x86-64, not x86 or ARM.</p>
+<p class="sidebar"><b>Note:</b> You don't <i>have to</i> use Secure Boot.
+If you don't want it, you can <a
+href="http://www.rodsbooks.com/efi-bootloaders/secureboot.html#disable">disable
+it,</a> at least on <i>x</i>86-64 PCs. If an ARM-based computer ships with
+Windows 8, this isn't an option for it. Unfortunately, the shim software
+described on this page currently supports only <i>x</i>86-64, not
+<i>x</i>86 or ARM.</p>
 
 <p>Through 2012, it became obvious that Secure Boot would be a feature that was controlled, to a large extent, by Microsoft. This is because Microsoft requires that non-server computers that display Windows 8 logos ship with Secure Boot enabled. As a practical matter, this also means that such computers ship with Microsoft's keys in their firmware. In the absence of an industry-standard body to manage the signing of Secure Boot keys, this means that Microsoft's key is the only one that's more-or-less guaranteed to be installed on the computer, thus blocking the ability to boot any OS that lacks a boot path through Microsoft's signing key.</p>
 
-<p>Fortunately, Microsoft will sign third-party binaries with their key. A payment of $99 to Verisign enables a software distributor to sign as many binaries as desired. Red Hat (Fedora), Novell (SUSE), and Canonical (Ubuntu) have all announced plans to take advantage of this system. Unfortunately, using a third-party signing service is an awkward solution for open source software. In fact, for this very reason Red Hat has developed a program that it calls <i>shim</i> that essentially shifts the Secure Boot "train" from Microsoft's proprietary "track" to one that's more friendly to open source authors. Shim is signed by Microsoft and redirects the boot process to another boot loader that can be signed with keys that the distribution maintains and that are built into shim. Fedora 18 is expected to use this system. SUSE has announced that it will use the same system, as does Ubuntu with version 12.10 and later. SUSE has contributed to the shim approach by providing expansions to shim that support a set of keys that users can maintain themselves. These keys are known as Machine Owner Keys (MOKs), and managing them is described later, in <a href="#mok">Managing MOKs.</a> To reiterate, then, there are potentially three ways to sign a binary that will get it launched on a system that uses shim:</p>
+<p>Fortunately, Microsoft will sign third-party binaries with their key. A payment of $99 to Verisign enables a software distributor to sign as many binaries as desired. Red Hat (Fedora), Novell (SUSE), and Canonical (Ubuntu) have all announced plans to take advantage of this system. Unfortunately, using a third-party signing service is an awkward solution for open source software. In fact, for this very reason Red Hat has developed a program that it calls <i>shim</i> that essentially shifts the Secure Boot "train" from Microsoft's proprietary "track" to one that's more friendly to open source authors. Shim is signed by Microsoft and redirects the boot process to another boot loader that can be signed with keys that the distribution maintains and that are built into shim. Fedora 18 is expected to use this system. SUSE has announced that it will use the same system, as does Ubuntu with version 12.10 and later. SUSE has contributed to the shim approach by providing expansions to shim that support a set of keys that users can maintain themselves. These keys are known as Machine Owner Keys (MOKs), and managing them is described later, in <a href="#mok">Managing MOKs.</a> To reiterate, then, there are potentially three ways to sign a binary that will get it launched on a computer that uses shim:</p>
 
 <ul>
 
-<li><b>Secure Boot keys</b>&mdash;These keys are managed by the EFI firmware. In a default configuration, Microsoft is the only party that's more-or-less guaranteed to be able to sign boot loaders with these keys; however, it's possible to <a href="http://www.rodsbooks.com/efi-bootloaders/secureboot.html#add_keys">replace Microsoft's keys with your own,</a> in order to take full control of Secure Boot on your computer. The trouble is that this process is tedious and varies in details from one computer to another.</li>
-
-<li><b>Shim's built-in keys</b>&mdash;It's possible, but not necessary, to compile shim with a built-in public key. Its private counterpart can then be used to sign binaries. In practice, this key type is limited in utility; it's likely to be used by distribution maintainers to sign their own version of GRUB and the Linux kernels that it launches, nothing more. On the plus side, shim's keys require little or no maintenance by users. One potential complication is that if you swap out one shim binary for another, its built-in key may change, which means that the replacement shim might no longer launch its follow-on boot loader.</li>
-
-<li><b>MOKs</b>&mdash;Versions 0.2 and later of shim support MOKs, which give you the ability to add your own keys to the computer. If you want to install multiple Linux distributions in Secure Boot mode, MOKs are likely to be helpful. They're vital if you want to launch kernels you compile yourself or use boot managers or boot loaders other than those provided by your distribution.</li>
+<li><b>Secure Boot keys</b>&mdash;These keys are managed by the EFI
+    firmware. In a default configuration, Microsoft is the only party
+    that's more-or-less guaranteed to be able to sign boot loaders with
+    these keys; however, it's possible to <a
+    href="http://www.rodsbooks.com/efi-bootloaders/secureboot.html#add_keys">replace
+    Microsoft's keys with your own,</a> in order to take full control of
+    Secure Boot on your computer. The trouble is that this process is
+    tedious and varies in details from one computer to another.</li>
+
+<li><b>Shim's built-in keys</b>&mdash;It's possible, but not necessary, to
+    compile shim with a built-in public key. Its private counterpart can
+    then be used to sign binaries. In practice, this key type is limited in
+    utility; it's likely to be used by distribution maintainers to sign
+    their own version of GRUB and the Linux kernels that it launches,
+    nothing more. On the plus side, shim's keys require little or no
+    maintenance by users. One potential complication is that if you swap
+    out one shim binary for another, its built-in key may change, which
+    means that the replacement shim might no longer launch its follow-on
+    boot loader.</li>
+
+<li><b>MOKs</b>&mdash;Versions 0.2 and later of shim support MOKs, which
+    give you the ability to add your own keys to the computer. If you want
+    to install multiple Linux distributions in Secure Boot mode, MOKs are
+    likely to be helpful. They're vital if you want to launch kernels you
+    compile yourself or use boot managers or boot loaders other than those
+    provided by your distribution.</li>
 
 </ul>
 
-<p>All three key types are the same in form&mdash;shim's built-in keys and MOKs are both generated using the same tools used to generate Secure Boot keys. Unfortunately, the tools used to generate these keys are still rather crude and are rarely installed on Linux systems, which is one of the reasons that rEFInd's installation script doesn't yet support setting up a Secure Boot configuration. Although it's theoretically possible to use rEFInd without signing your own binaries, this is not yet practical, because distributions don't yet provide their own signed binaries or the public MOK files you must have to enroll their keys. With any luck this will change in 2013. At the very least, many distributions will begin supporting Secure Boot in the near future, and with any luck they'll include their public MOKs for use with other distributions' versions of shim.</p>
+<p>All three key types are the same in form&mdash;shim's built-in keys and MOKs are both generated using the same tools used to generate Secure Boot keys. The keys can be generated with the common <tt>openssl</tt> program, but signing EFI binaries requires a rarer program called <tt>sbsign</tt> or <tt>pesign</tt>. Although it's theoretically possible to use rEFInd without signing your own binaries, this is not yet practical, because distributions don't yet provide their own signed binaries or the public MOK files you must have to enroll their keys. With any luck this will change in 2013. At the very least, many distributions will begin supporting Secure Boot in the near future, and with any luck they'll include their public MOKs for use with other distributions' versions of shim.</p>
 
 <p>Because shim and MOK are being supported by several of the major players in the Linux world, I've decided to do the same with rEFInd. Beginning with version 0.5.0, rEFInd can communicate with the shim system to authenticate boot loaders. If a boot loader has been signed by a valid UEFI Secure Boot key, a valid shim key, or a valid MOK key, rEFInd will launch it. rEFInd will also launch unsigned boot loaders or those with invalid signatures <i>if</i> Secure Boot is disabled in or unsupported by the firmware. (If that's your situation, you needn't bother reading this page.)</p>
 
@@ -132,7 +159,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <li><b>MokManager</b>&mdash;This program is included with shim 0.2 and later. It presents a crude user interface for managing MOKs, and it's launched by shim if shim can't find its default boot loader (generally <tt>grubx64.efi</tt>) or if that program isn't properly signed. In principle, this program could be signed with a Secure Boot key or a MOK, but the binary in Garrett's shim 0.2 is signed with a shim key, and I expect that versions distributed with most Linux distributions will also be signed by their respective shim keys. This program should reside in the same directory as <tt>shim.efi</tt>, under the name <tt>MokManager.efi</tt>. Although you could theoretically do without MokManager, in practice you'll need it at least temporarily to install the MOK with which rEFInd is signed.</li>
 
-<li><b>rEFInd</b>&mdash;Naturally, you need rEFInd. Because shim is hard-coded to launch a program called <tt>grubx64.efi</tt>, you must install rEFInd using that name and to the same directory in which <tt>shim.efi</tt> resides. In theory, rEFInd could be signed with a Secure Boot key, a shim key, or a MOK; however, because Microsoft won't sign binaries distributed under the GPLv3, I can't distribute a version of rEFInd signed with Microsoft's Secure Boot key; and as I don't have access to the private shim keys used by any distribution, I can't distribute a rEFInd binary signed by them. (If distributions begin including rEFInd in their package sets, though, such distribution-provided binaries could be signed with the distributions' shim keys.) Thus, rEFInd will normally be signed by a MOK. Beginning with version 0.5.0, rEFInd binaries that I provide are signed by me.</li>
+<li><b>rEFInd</b>&mdash;Naturally, you need rEFInd. Because shim is hard-coded to launch a program called <tt>grubx64.efi</tt>, you must install rEFInd using that name and to the same directory in which <tt>shim.efi</tt> resides. In theory, rEFInd could be signed with a Secure Boot key, a shim key, or a MOK; however, because Microsoft won't sign binaries distributed under the GPLv3, I can't distribute a version of rEFInd signed with Microsoft's Secure Boot key; and as I don't have access to the private shim keys used by any distribution, I can't distribute a rEFInd binary signed by them. (If distributions begin including rEFInd in their package sets, though, such distribution-provided binaries could be signed with the distributions' shim keys.) Thus, rEFInd will normally be signed by a MOK. Beginning with version 0.5.0, rEFInd binaries that I provide are signed by me. Beginning with version 0.5.1, the installation script provides an option to sign the rEFInd binary with your own key, provided the necessary support software is installed.</li>
 
 <li><b>Your boot loaders and kernels</b>&mdash;Your OS boot loaders, and perhaps your Linux kernels, must be signed. They can be signed with any of the three key types. Indeed, your system may have a mix of all three types&mdash;a Windows 8 boot loader will most likely be signed with Microsoft's Secure Boot key, GRUB and kernels provided by most distributions will be signed with their own shim keys, and if you use your own locally-compiled kernel or a boot loader from an unusual source you may need to sign it with a MOK. Aside from signing, these files can be installed in exactly the same way as if your computer were not using Secure Boot.</li>
 
@@ -142,31 +169,62 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <ol>
 
-<li>Boot the computer. This can be a challenge in and of itself. You may need to use a Secure Boot&ndash;enabled Linux emergency disc, temporarily disable Secure Boot, or do the work from Windows.</li>
+<li>Boot the computer. This can be a challenge in and of itself. You may
+    need to use a Secure Boot&ndash;enabled Linux emergency disc,
+    temporarily disable Secure Boot, or do the work from Windows.</li>
+
+<li><a href="getting.html">Download rEFInd</a> in binary form (the binary
+    zip or CD-R image file). If you download the binary zip file, unzip it;
+    if you get the CD-R image file, burn it to a CD-R and mount it.</li>
 
-<li><a href="getting.html">Download rEFInd</a> in binary form (the binary zip or CD-R image file). If you download the binary zip file, unzip it; if you get the CD-R image file, burn it to a CD-R and mount it.</li>
+<li>Download shim from <a
+    href="http://www.codon.org.uk/~mjg59/shim-signed/">Matthew J. Garrett's
+    download site</a> or from your distribution. (Don't use Ubuntu 12.10's
+    version, though; as noted earlier, it's inadequate for use with
+    rEFInd.)</li>
 
-<li>Download shim from <a href="http://www.codon.org.uk/~mjg59/shim-signed/">Matthew J. Garrett's download site</a> or from your distribution. (Don't use Ubuntu 12.10's version, though; as noted earlier, it's inadequate for use with rEFInd.)</li>
+<p class="sidebar"><b>Tip:</b> If you're running Linux, you can save some effort by using the <tt>install.sh</tt> script with its <tt>--shim <tt class="variable">/path/to/shim.efi</tt></tt> option rather than installing manually, as in steps 4&ndash;6 of this procedure. If you've installed <tt>openssl</tt> and <tt>sbsign</tt>, using <tt>--localkeys</tt> will generate local signing keys and re-sign the rEFInd binaries with your own key, too. You can then use <tt>sbsign</tt> and the keys in <tt>/etc/refind.d/keys</tt> to sign your kernels or boot loaders.</p>
 
-<li>Copy the <tt>shim.efi</tt> and <tt>MokManager.efi</tt> binaries to the directory you intend to use for rEFInd&mdash;for instance, <tt>EFI/refind</tt> on the ESP.</li>
+<li>Copy the <tt>shim.efi</tt> and <tt>MokManager.efi</tt> binaries to the
+    directory you intend to use for rEFInd&mdash;for instance,
+    <tt>EFI/refind</tt> on the ESP.</li>
 
-<li>Follow the installation instructions for rEFInd on the <a href="installing.html">Installing rEFInd</a> page; however, give rEFInd the filename <tt>grubx64.efi</tt> and register <tt>shim.efi</tt> with the EFI by using <tt>efibootmgr</tt> in Linux or <tt>bcdedit</tt> in Windows. This is most cleanly done by following the manual instructions; however, you can use the <tt>install.sh</tt> script if you subsequently rename the files and register <tt>shim.efi</tt> with <tt>efibootmgr</tt>. Be sure that rEFInd (as <tt>grubx64.efi</tt>), <tt>shim.efi</tt>, and <tt>MokManager.efi</tt> all reside in the same directory.</li>
+<li>Follow the installation instructions for rEFInd on the <a
+    href="installing.html">Installing rEFInd</a> page; however, give rEFInd
+    the filename <tt>grubx64.efi</tt> and register <tt>shim.efi</tt> with
+    the EFI by using <tt>efibootmgr</tt> in Linux or <tt>bcdedit</tt> in
+    Windows. Be sure that rEFInd (as <tt>grubx64.efi</tt>),
+    <tt>shim.efi</tt>, and <tt>MokManager.efi</tt> all reside in the same
+    directory.</li>
 
-<li>Copy the <tt>refind.cer</tt> file from the rEFInd package to your ESP, ideally to a location with few other files. (The rEFInd installation directory should work fine.)</li>
+<li>Copy the <tt>refind.cer</tt> file from the rEFInd package to your ESP,
+    ideally to a location with few other files. (The rEFInd installation
+    directory should work fine.)</li>
 
-<li>Reboot. With any luck, you'll see a simple text-mode user interface with a label of <tt>Shim UEFI key management</tt>. This is the MokManager program, which shim launched when rEFInd failed verification because its key is not yet enrolled.</li>
+<li>Reboot. With any luck, you'll see a simple text-mode user interface
+    with a label of <tt>Shim UEFI key management</tt>. This is the
+    MokManager program, which shim launched when rEFInd failed verification
+    because its key is not yet enrolled.</li>
 
-<li>Press your down arrow key and press Enter to select <tt>Enroll key from disk</tt>. The screen will clear and prompt you to select a key, as shown here:</li>
+<li>Press your down arrow key and press Enter to select <tt>Enroll key from
+    disk</tt>. The screen will clear and prompt you to select a key, as
+    shown here:</li>
 
     <br /><IMG SRC="MokManager1.png" ALIGN="CENTER" WIDTH="676"
     HEIGHT="186" ALT="MokManager's user interface is crude but effective."
     BORDER=2> <br />
 
-<li>Each of the lines with a long awkward string represents a disk partition. Select one and you'll see a list of files. Continue selecting subdirectories until you find the <tt>refind.cer</tt> file you copied to the ESP earlier.</li>
+<li>Each of the lines with a long awkward string represents a disk
+    partition. Select one and you'll see a list of files. Continue
+    selecting subdirectories until you find the <tt>refind.cer</tt> file
+    you copied to the ESP earlier.</li>
 
-<li>Select <tt>refind.cer</tt>. You can type <tt class="userinput">1</tt> to view the certificate's details if you like, or skip that and type <tt class="userinput">0</tt> to enroll the key.</li>
+<li>Select <tt>refind.cer</tt>. You can type <tt class="userinput">1</tt>
+    to view the certificate's details if you like, or skip that and type
+    <tt class="userinput">0</tt> to enroll the key.</li>
 
-<li>Back out of any directories you entered and return to the MokManager main menu.</li>
+<li>Back out of any directories you entered and return to the MokManager
+    main menu.</li>
 
 <li>Select <tt>Continue boot</tt> at the main menu.</li>
 
@@ -180,35 +238,72 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 <h2>Managing Your MOKs</h2>
 </a>
 
-<p>The preceding instructions provided the basics of getting rEFInd up and running, including using MokManager to enroll a MOK on your computer. If you need to sign binaries, though, you'll have to use additional tools. The OpenSSL package provides the cryptographic tools necessary, but actually signing EFI binaries requires additional software. Two packages for this are available: <tt>sbsigntool</tt> and <tt>pesign</tt>. Both are available in binary form from <a href="https://build.opensuse.org/project/show?project=home%3Ajejb1%3AUEFI">this OpenSUSE Build Service (OBS)</a> repository. The following procedure uses <tt>sbsigntool</tt>. To sign your own binaries, follow these steps:</p>
+<p>The preceding instructions provided the basics of getting rEFInd up and running, including using MokManager to enroll a MOK on your computer. If you need to sign binaries, though, you'll have to use additional tools. The OpenSSL package provides the cryptographic tools necessary, but actually signing EFI binaries requires additional software. Two packages for this are available: <tt>sbsigntool</tt> and <tt>pesign</tt>. Both are available in binary form from <a href="https://build.opensuse.org/project/show?project=home%3Ajejb1%3AUEFI">this OpenSUSE Build Service (OBS)</a> repository. The following procedure uses <tt>sbsigntool</tt>. To sign your own binaries, follow these steps (you can skip the first five steps if you've used <tt>install.sh</tt>'s <tt>--localkeys</tt> option):</p>
 
 <ol>
 
-<li>If it's not already installed, install OpenSSL on your computer. (It normally comes in a package called <tt>openssl</tt>.</li>
+<li>If it's not already installed, install OpenSSL on your computer. (It
+    normally comes in a package called <tt>openssl</tt>.)</li>
 
-<li>Type the following two commands to generate your public and private keys:
+<li>If you did <i>not</i> re-sign your rEFInd binaries with
+    <tt>install.sh</tt>'s <tt>--localkeys</tt> option, type the following
+    two commands to generate your public and private keys:
 
 <pre class="listing">
-$ <tt class="userinput">openssl req -new -x509 -newkey rsa:2048 -keyout MOK.key -out MOK.crt \
-  -nodes -days 3650 -subj "/CN=Your Name/"</tt>
-$ <tt class="userinput">openssl x509 -in MOK.crt -out MOK.cer -outform DER</tt>
+$ <tt class="userinput">openssl req -new -x509 -newkey rsa:2048 -keyout refind_local.key \
+  -out refind_local.crt -nodes -days 3650 -subj "/CN=Your Name/"</tt>
+$ <tt class="userinput">openssl x509 -in refind_local.crt -out refind_local.cer -outform DER</tt>
 </pre>
 
-Change <tt>Your Name</tt> to your own name or other identifying characteristics, and adjust the certificate's time span (set via <tt>-days</tt>) as you see fit. If you omit the <tt>-nodes</tt> option, the program will prompt you for a passphrase for added security. Remember this, since you'll need it to sign your binaries. The result is a private key file (<tt>MOK.key</tt>), which is highly sensitive since it's required to sign binaries, and two public keys (<tt>MOK.crt</tt> and <tt>MOK.cer</tt>), which can be used to verify signed binaries' authenticity. The two public key files are equivalent, but are used by different tools&mdash;<tt>sbsigntool</tt> uses <tt>MOK.crt</tt> to sign binaries, but MokManager uses <tt>MOK.cer</tt> to enroll the key.</li>
-
-<li>Copy the three key files to a secure location and adjust permissions such that only you can read <tt>MOK.key</tt>. You'll need these keys to sign future binaries, so don't discard them.</li>
-
-<li>Copy the <tt>MOK.cer</tt> file to your ESP, ideally to a location with few other files. (MokManager's user interface becomes unreliable when browsing directories with lots of files.)</li>
-
-<li>Download and install the <tt>sbsigntool</tt> package. Binary links for various distributions are available from the <a href="https://build.opensuse.org/package/show?package=sbsigntools&project=home%3Ajejb1%3AUEFI">OpenSUSE Build Service</a>, or you can obtain the source code by typing <tt class="userinput">git clone git://kernel.ubuntu.com/jk/sbsigntool</tt>.</li>
-
-<li>Sign your binary by typing <tt class="userinput">sbsign --key MOK.key --cert MOK.crt --output <tt class="variable">binary-signed.efi binary.efi</tt></tt>, adjusting the paths to the keys and the binary names.</li>
-
-<li>Copy your signed binary to a suitable location on the ESP for rEFInd to locate it. Be sure to include any support files that it needs, too.</li>
-
-<li>Check your <tt>refind.conf</tt> file to ensure that the <tt>showtools</tt> option is either commented out or includes <tt>mok_tool</tt> among its options.</li>
-
-<li>Reboot. You can try launching the boot loader you just installed, but chances are it will generate an <tt>Access Denied</tt> message. For it to work, you must launch MokManager using the tool that rEFInd presents on its second row. You can then enroll your <tt>MOK.cer</tt> key just as you enrolled the <tt>refind.cer</tt> key.</li>
+    Change <tt>Your Name</tt> to your own name or other identifying
+    characteristics, and adjust the certificate's time span (set via
+    <tt>-days</tt>) as you see fit. If you omit the <tt>-nodes</tt> option,
+    the program will prompt you for a passphrase for added security.
+    Remember this, since you'll need it to sign your binaries. The result
+    is a private key file (<tt>refind_local.key</tt>), which is highly
+    sensitive since it's required to sign binaries, and two public keys
+    (<tt>refind_local.crt</tt> and <tt>refind_local.cer</tt>), which can be
+    used to verify signed binaries' authenticity. The two public key files
+    are equivalent, but are used by different
+    tools&mdash;<tt>sbsigntool</tt> uses <tt>refind_local.crt</tt> to sign
+    binaries, but MokManager uses <tt>refind_local.cer</tt> to enroll the
+    key. If you used <tt>install.sh</tt>'s <tt>--localkeys</tt> option,
+    this step is unnecessary, since these keys have already been created
+    and are stored in <tt>/etc/refind.d/keys</tt>.</li>
+
+<li>Copy the three key files to a secure location and adjust permissions
+    such that only you can read <tt>refind_local.key</tt>. You'll need
+    these keys to sign future binaries, so don't discard them.</li>
+
+<li>Copy the <tt>refind_local.cer</tt> file to your ESP, ideally to a
+    location with few other files. (MokManager's user interface becomes
+    unreliable when browsing directories with lots of files.)</li>
+
+<li>Download and install the <tt>sbsigntool</tt> package. Binary links for
+    various distributions are available from the <a
+    href="https://build.opensuse.org/package/show?package=sbsigntools&project=home%3Ajejb1%3AUEFI">OpenSUSE
+    Build Service</a>, or you can obtain the source code by typing <tt
+    class="userinput">git clone
+    git://kernel.ubuntu.com/jk/sbsigntool</tt>.</li>
+
+<li>Sign your binary by typing <tt class="userinput">sbsign --key
+    refind_local.key --cert refind_local.crt --output <tt
+    class="variable">binary-signed.efi binary.efi</tt></tt>, adjusting the
+    paths to the keys and the binary names.</li>
+
+<li>Copy your signed binary to a suitable location on the ESP for rEFInd to
+    locate it. Be sure to include any support files that it needs,
+    too.</li>
+
+<li>Check your <tt>refind.conf</tt> file to ensure that the
+    <tt>showtools</tt> option is either commented out or includes
+    <tt>mok_tool</tt> among its options.</li>
+
+<li>Reboot. You can try launching the boot loader you just installed, but
+    chances are it will generate an <tt>Access Denied</tt> message. For it
+    to work, you must launch MokManager using the tool that rEFInd presents
+    on its second row. You can then enroll your <tt>refind_local.cer</tt>
+    key just as you enrolled the <tt>refind.cer</tt> key.</li>
 
 </ol>
 
index 35e487a7ee0d4f7c74c8df9d8ad2866d0bf168ba..9eea2216c440c031124718683b27502b07ee41c2 100644 (file)
@@ -96,8 +96,8 @@ $(BUILDME): $(DLL_TARGET)
        $(GENFW) -e UEFI_DRIVER -o $(BUILDME) $(DLL_TARGET)
 #      $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
 #                 -j .rela -j .reloc --rename-section .data=.hii --target=efi-bsdrv-$(ARCH) $< $@
-       mkdir -p ../drivers
-       cp $(BUILDME) ../drivers
+       mkdir -p ../drivers_$(FILENAME_CODE)
+       cp $(BUILDME) ../drivers_$(FILENAME_CODE)
 
 endif
 
index 76fc27bda90f683532ff073fc4e964a38d8115b3..7e2fef4a89c16e96462651e467a8cc152a605e13 100755 (executable)
 #    "--esp" to install to the ESP rather than to the system's root
 #           filesystem. This is the default on Linux
 #    "--usedefault {devicefile}" to install as default
-#           (/EFI/BOOT/BOOTX64.EFI and similar) to the specified
-#           device (/dev/sdd1 or whatever) without registering with
-#           the NVRAM
+#           (/EFI/BOOT/BOOTX64.EFI and similar) to the specified device
+#           (/dev/sdd1 or whatever) without registering with the NVRAM.
 #    "--drivers" to install drivers along with regular files
+#    "--shim {shimfile}" to install a shim.efi file for Secure Boot
+#    "--localkeys" to re-sign x86-64 binaries with a locally-generated key
 #
 # The "esp" option is valid only on Mac OS X; it causes
 # installation to the EFI System Partition (ESP) rather than
@@ -26,7 +27,7 @@
 #
 # Revision history:
 #
-# 0.5.1   -- Added --shim option
+# 0.5.1   -- Added --shim & --localkeys options
 # 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
@@ -173,7 +174,8 @@ CopyRefindFiles() {
          CopyShimFiles
       fi
       if [[ $InstallDrivers == 1 ]] ; then
-         cp -r $RefindDir/drivers_* $InstallDir/$TargetDir/
+         cp -r $RefindDir/drivers_* $InstallDir/$TargetDir/ 2> /dev/null
+         cp -r $ThisDir/drivers_* $InstallDir/$TargetDir/ 2> /dev/null
       fi
       Refind=""
       CopyKeys
@@ -184,7 +186,8 @@ CopyRefindFiles() {
       fi
       if [[ $InstallDrivers == 1 ]] ; then
          mkdir -p $InstallDir/$TargetDir/drivers_ia32
-         cp -r $RefindDir/drivers_ia32/*_ia32.efi $InstallDir/$TargetDir/drivers_ia32/
+         cp $RefindDir/drivers_ia32/*_ia32.efi $InstallDir/$TargetDir/drivers_ia32/ 2> /dev/null
+         cp $ThisDir/drivers_ia32/*_ia32.efi $InstallDir/$TargetDir/drivers_ia32/ 2> /dev/null
       fi
       Refind="refind_ia32.efi"
    elif [[ $Platform == 'EFI64' ]] ; then
@@ -194,7 +197,8 @@ CopyRefindFiles() {
       fi
       if [[ $InstallDrivers == 1 ]] ; then
          mkdir -p $InstallDir/$TargetDir/drivers_x64
-         cp -r $RefindDir/drivers_x64/*_x64.efi $InstallDir/$TargetDir/drivers_x64/
+         cp $RefindDir/drivers_x64/*_x64.efi $InstallDir/$TargetDir/drivers_x64/ 2> /dev/null
+         cp $ThisDir/drivers_x64/*_x64.efi $InstallDir/$TargetDir/drivers_x64/ 2> /dev/null
       fi
       Refind="refind_x64.efi"
       CopyKeys
@@ -448,14 +452,9 @@ GenerateKeys() {
 # appropriately.
 # Aborts script on error
 SignOneBinary() {
-   if [[ $UseSBSign == 1 ]] ; then
-      $SBSign --key $PrivateKey --cert $CertKey --output $2 $1
-      if [[ $? != 0 ]] ; then
-         echo "Problem signing the binary $1! Aborting!"
-         exit 1
-      fi
-   else
-      echo "PESign code not yet written; aborting!"
+   $SBSign --key $PrivateKey --cert $CertKey --output $2 $1
+   if [[ $? != 0 ]] ; then
+      echo "Problem signing the binary $1! Aborting!"
       exit 1
    fi
 }
@@ -465,19 +464,22 @@ SignOneBinary() {
 # not, try to generate new keys and store them in $EtcKeysDir.
 ReSignBinaries() {
    SBSign=`which sbsign 2> /dev/null`
+   echo "Found sbsign at $SBSign"
    TempDir="/tmp/refind_local"
    if [[ ! -x $SBSign ]] ; then
-      echo "Can't find either sbsign or pesign; one of these is required to sign rEFInd"
-      echo "with your own keys! Aborting!"
+      echo "Can't find sbsign, which is required to sign rEFInd with your own keys!"
+      echo "Aborting!"
       exit 1
    fi
    GenerateKeys
    mkdir -p $TempDir/drivers_x64
-   cp $RefindDir/refind.conf-sample $TempDir
+   cp $RefindDir/refind.conf-sample $TempDir 2> /dev/null
+   cp $ThisDir/refind.conf-sample $TempDir 2> /dev/null
    cp $RefindDir/refind_ia32.efi $TempDir
-   cp -a $RefindDir/drivers_ia32 $TempDir
-   SignOneBinary $RefindDir/refind_x64.efi $TempDir/refind_x64.efi
-   for Driver in `ls $RefindDir/drivers_x64/*.efi` ; do
+   cp -a $RefindDir/drivers_ia32 $TempDir 2> /dev/null
+   cp -a $ThisDir/drivers_ia32 $TempDir 2> /dev/null
+   SignOneBinary $RefindDir/refind_x64.efi $ThisDir/refind_x64.efi
+   for Driver in `ls $RefindDir/drivers_x64/*.efi $ThisDir/drivers_x64/*.efi 2> /dev/null` ; do
       TempName=`basename $Driver`
       SignOneBinary $Driver $TempDir/drivers_x64/$TempName
    done
index 2f894edde5bf39ffbc9e094bd61a670041313793..e55521b2d195ba7f49bc8b39b3c709a75e3d568e 100755 (executable)
--- a/mkdistrib
+++ b/mkdistrib
@@ -54,7 +54,7 @@ cd refind-$1
 ARCH=ia32 make
 ARCH=ia32 make fs
 mkdir -p refind-bin-$1/refind/drivers_ia32
-cp --preserve=timestamps drivers/*_ia32.efi refind-bin-$1/refind/drivers_ia32/
+cp --preserve=timestamps drivers_ia32/*_ia32.efi refind-bin-$1/refind/drivers_ia32/
 cp --preserve=timestamps filesystems/LICENSE*txt refind-bin-$1/refind/drivers_ia32/
 cp refind/refind_ia32.efi refind-bin-$1/refind/refind_ia32.efi
 cp refind/refind_ia32.efi $StartDir/
@@ -63,12 +63,11 @@ cp refind/refind_ia32.efi $StartDir/
 make clean
 make
 make fs
-mkdir -p refind-bin-$1/refind/drivers
+mkdir -p refind-bin-$1/refind/drivers_x64
 cp -a icons refind-bin-$1/refind/
-for File in `ls drivers/*_x64.efi` ; do
+for File in `ls drivers_x64/*_x64.efi` ; do
    $SBSign --key $KeysDir/refind.key --cert $KeysDir/refind.crt --output refind-bin-$1/refind/$File $File
 done
-mv refind-bin-$1/refind/drivers refind-bin-$1/refind/drivers_x64
 cp --preserve=timestamps filesystems/LICENSE*txt refind-bin-$1/refind/drivers_x64/
 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
index e53c2edad1bf6657b7f13630057172005f78065a..3ff6255f51bb2c61a9fdf489f7fa3e5935ef6651 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.2");
+        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.5.0.3");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith");