From e99aa7a04054658c8d5d4595717b9b10e848564d Mon Sep 17 00:00:00 2001
From: srs5694
Originally written: 3/14/2012; last Web page update: -12/11/2012, referencing rEFInd 0.5.1
+12/16/2012, referencing rEFInd 0.6.0I'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!
@@ -108,7 +108,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comA casual reader might easily overlook this option, or misinterpret it to mean that the feature is much less important than it is. In fact, this particular motherboard offers very poor control over its EFI vs. BIOS booting features. (See my Web page on this EFI implementation for details.)
-Some manuals omit even mention of EFI, and instead refer to "legacy boot" or some similar term, referring to BIOS-style booting. Such references may imply that the firmware supports EFI booting if the "legacy boot" mode is disabled or restricted in some way.
+Some manuals omit even mention of EFI, and instead refer to "legacy boot" or some similar term, referring to BIOS-style booting. The firmware for my ASUS P8H77-I motherboard uses the technical term CSM, which of course will be baffling to the uninitiated. (I referred to it earlier. It's the Compatibility Support Module—in other words, the BIOS support code.) Such references may imply that the firmware supports EFI booting if the "legacy boot" mode is disabled or restricted in some way.
Understated EFI features often indicate a slapdash approach to EFI. Such systems sometimes implement EFI as a layer atop a conventional BIOS. More modern EFIs, though, completely replace the BIOS. Some manufacturers, such as ASUS and its sibling ASRock, are now actively promoting their more advanced EFI implementations. Such products often come with flashy new GUIs in their firmware.
diff --git a/docs/refind/configfile.html b/docs/refind/configfile.html index b21e833..6b6ce6c 100644 --- a/docs/refind/configfile.html +++ b/docs/refind/configfile.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/11/2012, referencing rEFInd 0.5.1
+12/16/2012, referencing rEFInd 0.6.0I'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!
@@ -205,13 +205,18 @@ timeout 20Originally written: 4/19/2012; last Web page update: -12/11/2012, referencing rEFInd 0.5.1
+12/16/2012, referencing rEFInd 0.6.0I'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!
@@ -138,8 +138,18 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comAll of these drivers rely on filesystem wrapper code written by rEFIt's author, Christoph Phisterer. They all suffer from speed problems on some systems, as described later in "Notes on Specific Drivers;" however, these problems are very minor on most systems.
- +If you want to use one or more of these drivers, you can install them from the rEFInd binary package from the refind/drivers_arch directory, where arch is a CPU architecture code—x64 or ia32. The files are named after the filesystems they handle, such as ext2_x64.efi for the 64-bit ext2fs driver. You should copy the files for the filesystems you want to use to the drivers or drivers_arch subdirectory of the main rEFInd installation directory. (You may need to create this subdirectory.) Be careful to install drivers only for your own architecture. Attempting to load drivers for the wrong CPU type will cause a small delay at best, or may cause the computer to crash at worst. I've placed rEFInd's drivers in directories that are named to minimize this risk, but you should exercise care when copying driver files.
@@ -208,7 +218,7 @@ fs0: map -rI've tested several of the drivers described on this page on a handful of systems. The Pfisterer ext2fs driver (from any source) works on both ext2fs and ext3fs, but not on ext4fs—but Agner's derivative ext4fs driver handles ext4fs, so that's not a problem. The ReiserFS driver is obviously useful only on ReiserFS partitions. (Reiser4 is not supported, as far as I know.) Given that ext2fs, ext3fs, and ReiserFS are getting a bit on in age by Linux standards, you might do well to use them on a separate Linux /boot partition; however, if you're willing to use ext3fs or ReiserFS on your root (/) filesystem, you can use the EFI drivers to read your kernel from it. If you use ext4fs on your root (/) filesystem, you can use the ext4fs driver rather than a separate /boot partition. Note that this assumes you use conventional partitions; to the best of my knowledge, there's no EFI driver for Linux's Logical Volume Manager (LVM) or Redundant Array of Independent Disks (RAID) configurations, so the EFI can't access filesystems stored in these ways.
+I've tested several of the drivers described on this page on a handful of systems. The Pfisterer ext2fs driver (from any source) works on both ext2fs and ext3fs, but not on ext4fs—but Agner's derivative ext4fs driver handles ext4fs, so that's not a problem. The ReiserFS driver is obviously useful only on ReiserFS partitions. (Reiser4 is not supported, as far as I know.) Given that ext2fs, ext3fs, and ReiserFS are getting a bit on in age by Linux standards, you might do well to use them on a separate Linux /boot partition; however, if you're willing to use ext3fs, ext4fs, or ReiserFS on your root (/) filesystem, you can use the EFI drivers to read your kernel from it. Note that this assumes you use conventional partitions; to the best of my knowledge, there's no EFI driver for Linux's Logical Volume Manager (LVM) or Redundant Array of Independent Disks (RAID) configurations, so the EFI can't access filesystems stored in these ways.
The Pfisterer ReiserFS and ext2fs drivers work, but they are a bit sluggish—particularly the ext2fs driver. The Agner ext4fs driver, when handling an actual ext4 filesystem, is in-between these two drivers in speed. The extent of the problem depends on the computer. In my tests so far, VirtualBox has fared the worst. On it, loading a Linux kernel with EFI stub loader from a FAT partition takes 2 seconds, from the moment of selecting the OS in rEFInd to the moment the kernel messages begin to appear. The equivalent time using ReiserFS or HFS+ is 20 seconds, with ext4fs it's 75 seconds, and with ext2fs it's 200 seconds (that is, 3 minutes and 20 seconds). On a 32-bit Mac Mini, though, the speed problem is much less pronounced—my kernel loads in just 3 seconds from a ReiserFS partition and in 13 seconds from an ext2 filesystem. Speeds were similar with my newest computer, an ASUS P8H77-I board. Times with ext2fs on a UEFI PC with an Intel motherboard are in the 2–4 second range. If you try the ext2fs driver and it seems to hang, be patient; it may finally boot up. If so, and if the delay is too great for you to accept, you might consider using ext4fs or ReiserFS instead of ext2fs or ext3fs, at least if a change is practical. (For a /boot partition, it almost certainly is practical; you can back it up quite easily, create a fresh filesystem on it, and restore it. You may need to adjust your /etc/fstab entry for a new UUID value, though. As noted earlier, be sure to use notail as an option in /etc/fstab for ReiserFS if you want to read it from EFI.) You can even use HFS+ on a Linux /boot partition, although this makes the most sense on a Mac, which has its own EFI HFS+ driver. Of course, you can also create a FAT /boot partition and not deal with drivers at all. Mounting your ESP at /boot is a practical solution for many users.
diff --git a/docs/refind/features.html b/docs/refind/features.html index 8f12242..086c889 100644 --- a/docs/refind/features.html +++ b/docs/refind/features.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/11/2012, referencing rEFInd 0.5.1
+12/16/2012, referencing rEFInd 0.6.0I'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!
@@ -111,7 +111,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/12/2012, referencing rEFInd 0.5.1.1
+12/16/2012, referencing rEFInd 0.6.0I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -98,7 +98,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/11/2012, referencing rEFInd 0.5.1
+12/16/2012, referencing rEFInd 0.6.0I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/installing.html b/docs/refind/installing.html index 7f2f945..03f54cc 100644 --- a/docs/refind/installing.html +++ b/docs/refind/installing.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/13/2012, referencing rEFInd 0.5.1.2
+12/16/2012, referencing rEFInd 0.6.0I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -92,7 +92,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com -Once you've uncompressed a rEFInd binary zip file, you must install it to your computer's ESP (or conceivably to some other location). The details of how you do this depend on your OS and your computer (UEFI-based PC vs. Macintosh). The upcoming sections provide details. For Linux and Mac OS X, you can use the installation script, install.sh, which provides easy one-command installation on most systems. Occasionally this script will fail, though, so I also provide explicit instructions for Linux and Mac OS X. Installation under Windows also must be done manually. In some cases, you'll have to deviate from the default naming conventions, as described in a section on this topic. If you're upgrading rEFInd, see the section on upgrading. Finally, I describe how to install some additional components you might find useful. Note that this page describes installing the main rEFInd program; if you want to use the EFI filesystem drivers included with rEFInd, you should consult the page on using drivers with rEFInd.
+Once you've uncompressed a rEFInd binary zip file, you must install it to your computer's ESP (or conceivably to some other location). The details of how you do this depend on your OS and your computer (UEFI-based PC vs. Macintosh). The upcoming sections provide details. For Linux and Mac OS X, you can use the installation script, install.sh, which provides easy one-command installation on most systems. Occasionally this script will fail, though, so I also provide explicit instructions for Linux and Mac OS X. Installation under Windows also must be done manually. In some cases, you'll have to deviate from the default naming conventions, as described in a section on this topic. If you're upgrading rEFInd, see the section on upgrading. Finally, I describe how to install some additional components you might find useful.
Some sources suggest that delayed launches of rEFInd on Macs are more common when installing rEFInd to the ESP, so if you've done this, you could try re-installing it to your OS X boot partition.
+Originally written: 3/19/2012; last Web page update: -12/12/2012, referencing rEFInd 0.5.1
+12/16/2012, referencing rEFInd 0.6.0I'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!
@@ -108,7 +108,31 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comThe EFI stub loader is basic and reliable, but it requires some setup to use it. I describe both a quick test configuration and a long-term setup.
+The EFI stub loader is basic and reliable, but it requires some setup to use it on some computers. I describe three methods of using it: an easiest method for those with compatible partition and filesystem layouts, a quick test configuration for those without such a layout, and a long-term setup for those without the ideal setup.
+ + +This method requires that your /boot directory, whether it's on a separate partition or is a regular directory in your root (/) filesystem, be readable by the EFI. At the moment, all EFI implementations can read FAT and Macs can read HFS+. By using drivers, you can make any EFI read HFS+, ISO-9660, ReiserFS, ext2fs, ext3fs, or ext4fs. Thus, if you use any of these filesystems on a regular partition (not an LVM or RAID configuration) that holds your kernels in /boot, you qualify for this easy method. The default partition layouts used by Ubuntu, Fedora, and many other distributions qualify, because they use one of these filesystems (usually ext4fs) in a normal partition or on a separate /boot partition. You must also have a 3.3.0 or later Linux kernel with EFI stub support, of course.
+ +If you installed rEFInd 0.6.0 or later with its install.sh script from your regular Linux installation, chances are everything's set up; you should be able to reboot and see your Linux kernels as boot options. If you installed manually, from OS X, or from an emergency system, though, you may need to do a couple of things manually: + +
When you reboot, you should see rEFInd options for your Linux kernels. If they work, your job is done, although you might want to apply some of the tweaks described in the maintenance-free setup section. If you have problems, you may need to adjust the refind_linux.conf file, as described in the detailed configuration section.
The ideal configuration for use of the EFI stub loader involves giving rEFInd the ability to load your kernels directly from /boot. The main obstacle to doing so is that this directory is frequently on an XFS, JFS, Btrfs, or ext4 filesystem that the EFI can't read, or it's tucked away in an LVM or RAID configuration that the EFI can't read. Fortunately, this problem can be overcome with relatively little fuss. Several variant procedures are possible, but I begin by describing one that will almost always work, although it's got some important caveats (described at the end). You should perform the following steps as root, or precede each of these commands with sudo:
+If your /boot directory happens to be on an XFS, JFS, or Btrfs partition that the EFI can't read, or it's tucked away in an LVM or RAID configuration that the EFI can't read, you won't be able to use the easiest solution. 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). You should perform the following steps as root, or precede each of these commands with sudo:
Once this task is done, updates to your kernel will automatically be stored in the root directory of your ESP, where rEFInd will automatically detect them. Thus, the boot configuration becomes maintenance-free. The procedure as just described has some drawbacks, though. By placing your kernels in the root directory of your ESP, you render them vulnerable to any other OS with which you might be dual-booting. Your ESP must also be large enough to hold all your kernels. If you dual-boot with multiple Linux distributions, they might conceivably overwrite each others' kernels, and distinguishing one from another becomes more difficult.
-For these reasons, a variant of this procedure is desirable on some systems. Most of the steps are similar, but in this variant, you create a separate /boot partition that's independent of the ESP. This partition can use FAT, HFS+, ReiserFS, ext2fs, or ext3fs; but if you use any of the last four filesystems (three on Macs), you must install the matching EFI filesystem driver that ships with rEFInd. Creating the filesystem will normally require you to shrink an existing partition by a suitable amount (200–500MiB). Mount your new /boot partition at a temporary location, copy or move the current /boot files into it, unmount it, and add it to /etc/fstab as /boot.
- +For these reasons, a variant of this procedure is desirable on some systems. Most of the steps are similar, but in this variant, you create a separate /boot partition that's independent of the ESP. This partition can use FAT, HFS+, ReiserFS, ext2fs, ext3fs, or ext4fs; but if you use any of the last five filesystems (four on Macs), you must install the matching EFI filesystem driver that ships with rEFInd. Creating the filesystem will normally require you to shrink an existing partition by a suitable amount (200–500MiB). Mount your new /boot partition at a temporary location, copy or move the current /boot files into it, unmount it, and add it to /etc/fstab as /boot.
-If your distribution already uses a separate /boot partition (as Fedora 17 does by default), but if it uses ext4fs or some other unsuitable filesystem, you can back it up, create a fresh FAT, HFS+, ReiserFS, ext2, or ext3 filesystem on it, and restore the original files. You'll probably need to adjust the UUID value in /etc/fstab to ensure that the computer mounts the new filesystem when you boot. If you use a separate non-ESP /boot partition, you'll probably want to continue mounting the ESP at /boot/efi.
+If your distribution already uses a separate /boot partition, but if it uses XFS or some other unsuitable filesystem, you can back it up, create a fresh FAT, HFS+, ReiserFS, ext2, ext3, or ext4 filesystem on it, and restore the original files. You'll probably need to adjust the UUID value in /etc/fstab to ensure that the computer mounts the new filesystem when you boot. If you use a separate non-ESP /boot partition, you'll probably want to continue mounting the ESP at /boot/efi.
-"Boot with defaults" "root=/dev/sda3 ro quiet splash vt.handoff=7" +"Boot using default options" "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" @@ -322,9 +345,7 @@ total 17943 a refind_linux.conf file in the Linux kernel's directory." border=2>
-Note that the first entry shown here takes a name that's set in rEFInd rather than the one specified in the refind_linux.conf file. The remaining names match those specified in the file, though.
- -To assist in initial configuration, rEFInd's install.sh script creates a sample refind_linux.conf file in /boot. This sample file defines two entries that use the default GRUB options defined in /etc/default/grub. The first entry boots normally and the second boots into single-user mode. If you want to create a new file, you can use the mkrlconf.sh script that comes with rEFInd. If you pass it the --force option, it will overwrite the existing /boot/refind_linux.conf file; otherwise it will create the file only if one doesn't already exist.
+To assist in initial configuration, rEFInd's install.sh script creates a sample refind_linux.conf file in /boot. This sample file defines three entries, the first two of which use the default GRUB options defined in /etc/default/grub and the last of which uses minimal options. The first entry boots normally and the second boots into single-user mode. If you want to create a new file, you can use the mkrlconf.sh script that comes with rEFInd. If you pass it the --force option, it will overwrite the existing /boot/refind_linux.conf file; otherwise it will create the file only if one doesn't already exist.
From a user's perspective, the submenus defined in this way work just like submenus defined via the submenuentry options in refind.conf, or like the submenus that rEFInd creates automatically for Mac OS X or ELILO. There are, however, limitations in what you can accomplish with this method:
diff --git a/docs/refind/revisions.html b/docs/refind/revisions.html index f8c2f3d..7e1c775 100644 --- a/docs/refind/revisions.html +++ b/docs/refind/revisions.html @@ -14,7 +14,7 @@by Roderick W. Smith, rodsmith@rodsbooks.com
-Last Web page update: 12/12/2012
+Last Web page update: 12/16/2012
I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -92,6 +92,8 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com
Originally written: 11/13/2012; last Web page update: -12/12/2012, referencing rEFInd 0.5.1
+12/16/2012, referencing rEFInd 0.6.0I'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!
@@ -232,7 +232,7 @@ described on this page currently supports only x86-64, notAt this point the computer may boot into its default OS, reboot, or perhaps even hang. When you reboot it, though, rEFInd should start up in Secure Boot mode. (You can verify this by selecting the About rEFInd tool in the main menu. Check the Platform item in the resulting screen; it should verify that Secure Boot is active.) You should now be able to launch any boot loader signed with a key recognized by the firmware or by shim (including any MOKs you've enrolled). If you want to manage keys in the future, rEFInd displays a new icon in the second (tools) row you can use to launch MokManager. (This icon appears by default if MokManager is installed, but if you edit showtools in refind.conf, you must be sure to include mok_tool as an option in order to gain access to it.)
-If you're using Ubuntu 12.10, you can't use its version of shim, but you can replace it with Garrett's shim. If you do so, though, you'll have to add Ubuntu's public key as a MOK, at least if you intend to launch Ubuntu's version of GRUB or launch Ubuntu-provided signed kernels. Ubuntu's public key is available in the shim_0~20120906.bcd0a4e8-0ubuntu4.debian.tar.gz tarball, as canonical-uefi-ca.der. (The filename extensions .cer and .der are interchangeable for most purposes.) To use it, copy canonical-uefi-ca.der to your ESP and enroll it with MokManager. See this blog post for further details on Ubuntu 12.10's handling of Secure Boot. In principle, you should be able to use shim 0.2 or later from future distributions that include it; but you must be sure that whatever you use supports MokManager.
+If you're using Ubuntu 12.10, you can't use its version of shim, but you can replace it with Garrett's shim. If you do so, though, you'll have to add Ubuntu's public key as a MOK, at least if you intend to launch Ubuntu's version of GRUB or launch Ubuntu-provided signed kernels. Ubuntu's public key is available in the shim_0~20120906.bcd0a4e8-0ubuntu4.debian.tar.gz tarball, as canonical-uefi-ca.der. (The filename extensions .cer and .der are interchangeable for most purposes.) I've also included this key with rEFInd, in the refind/keys subdirectory of its package file. To use this key, copy it to your ESP and enroll it with MokManager. See this blog post for further details on Ubuntu 12.10's handling of Secure Boot. In principle, you should be able to use shim 0.2 or later from future distributions that include it; but you must be sure that whatever you use supports MokManager.
Originally written: 4/19/2012; last Web page update: -12/11/2012, referencing rEFInd 0.5.1
+12/16/2012, referencing rEFInd 0.6.0I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/docs/refind/todo.html b/docs/refind/todo.html index 92b4a38..459f766 100644 --- a/docs/refind/todo.html +++ b/docs/refind/todo.html @@ -15,7 +15,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/6/2012, referencing rEFInd 0.5.0
+12/16/2012, referencing rEFInd 0.6.0I'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!
@@ -318,9 +318,9 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comOriginally written: 3/14/2012; last Web page update: -12/11/2012, referencing rEFInd 0.5.1
+12/16/2012, referencing rEFInd 0.6.0I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
diff --git a/filesystems/fsw_efi.c b/filesystems/fsw_efi.c index 7df71aa..3e96e62 100644 --- a/filesystems/fsw_efi.c +++ b/filesystems/fsw_efi.c @@ -76,7 +76,7 @@ /** Helper macro for stringification. */ #define FSW_EFI_STRINGIFY(x) #x /** Expands to the EFI driver name given the file system type name. */ -#define FSW_EFI_DRIVER_NAME(t) L"rEFInd 0.5.0 " FSW_EFI_STRINGIFY(t) L" File System Driver" +#define FSW_EFI_DRIVER_NAME(t) L"rEFInd 0.6.0 " FSW_EFI_STRINGIFY(t) L" File System Driver" // function prototypes diff --git a/install.sh b/install.sh index cb0d6d3..e28fb41 100755 --- a/install.sh +++ b/install.sh @@ -29,7 +29,7 @@ # # Revision history: # -# 0.5.2 -- Changed --drivers to --alldrivers and added --nodrivers option; +# 0.6.0 -- Changed --drivers to --alldrivers and added --nodrivers option; # changed default driver installation behavior in Linux to install # the driver needed to read /boot (if available) # 0.5.1.2 -- Fixed bug that caused failure to generate refind_linux.conf file @@ -163,11 +163,12 @@ CopyShimFiles() { # Copy the public keys to the installation medium CopyKeys() { if [[ $LocalKeys == 1 ]] ; then - cp $EtcKeysDir/$LocalKeysBase.cer $InstallDir/$TargetDir - cp $EtcKeysDir/$LocalKeysBase.crt $InstallDir/$TargetDir - else - cp $ThisDir/refind.cer $InstallDir/$TargetDir - cp $ThisDir/refind.crt $InstallDir/$TargetDir + mkdir -p $InstallDir/$TargetDir/keys/ + cp $EtcKeysDir/$LocalKeysBase.cer $InstallDir/$TargetDir/keys/ + cp $EtcKeysDir/$LocalKeysBase.crt $InstallDir/$TargetDir/keys/ +# else +# cp $ThisDir/refind.cer $InstallDir/$TargetDir/keys/ +# cp $ThisDir/refind.crt $InstallDir/$TargetDir/keys/ fi } # CopyKeys() @@ -184,10 +185,8 @@ CopyDrivers() { BootFS=`blkid -o export $BootPart 2> /dev/null | grep TYPE= | cut -f 2 -d =` DriverType="" case $BootFS in - ext2 | ext3) DriverType="ext2" + ext2 | ext3 | ext4) DriverType="ext4" ;; - ext4) DriverType="ext4" - ;; reiserfs) DriverType="reiserfs" ;; hfsplus) DriverType="hfs" @@ -247,8 +246,8 @@ CopyRefindFiles() { if [[ $LocalKeys == 0 ]] ; then echo "Storing copies of rEFInd Secure Boot public keys in $EtcKeysDir" mkdir -p $EtcKeysDir - cp $ThisDir/refind.cer $EtcKeysDir - cp $ThisDir/refind.crt $EtcKeysDir + cp $ThisDir/keys/refind.cer $EtcKeysDir + cp $ThisDir/keys/refind.crt $EtcKeysDir fi fi else @@ -266,6 +265,7 @@ CopyRefindFiles() { if [[ $? != 0 ]] ; then Problems=1 fi + cp -rf $ThisDir/keys $InstallDir/$TargetDir/ if [[ -f $InstallDir/$TargetDir/refind.conf ]] ; then echo "Existing refind.conf file found; copying sample file as refind.conf-sample" echo "to avoid overwriting your customizations." @@ -516,7 +516,7 @@ ReSignBinaries() { cp $RefindDir/refind_ia32.efi $TempDir 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 + SignOneBinary $RefindDir/refind_x64.efi $TempDir/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 diff --git a/libeg/screen.c b/libeg/screen.c index 2228959..90988cf 100644 --- a/libeg/screen.c +++ b/libeg/screen.c @@ -46,6 +46,16 @@ #define LibLocateProtocol EfiLibLocateProtocol #endif +// Scan for at least this many text-mode and graphics-mode display modes, even +// if the first modes are invalid. The number of text modes scanned must be at +// least 3 on some computers to properly list all the available modes when the +// user specifies an invalid value, since mode 1 (numbered from 0) is often +// invalid, but mode 2 (the third one) is usually valid. AFAIK, gaps never +// occur in graphics modes, although I've heard of one case that makes me think +// some exceptions may occur. +#define MIN_SCAN_TEXT_MODES 3 +#define MIN_SCAN_GRAPHICS_MODES 1 + // Console defines and variables static EFI_GUID ConsoleControlProtocolGuid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; @@ -140,7 +150,7 @@ BOOLEAN egSetScreenSize(IN OUT UINTN *ScreenWidth, IN OUT UINTN *ScreenHeight) { Status = refit_call2_wrapper(GraphicsOutput->SetMode, GraphicsOutput, ModeNum); ModeSet = (Status == EFI_SUCCESS); } // if - } while (((ModeNum++ < 10) || (Status == EFI_SUCCESS)) && !ModeSet); + } while (((++ModeNum < MIN_SCAN_GRAPHICS_MODES) || (Status == EFI_SUCCESS)) && !ModeSet); // while ((Status == EFI_SUCCESS) && (!ModeSet)) { // Status = refit_call4_wrapper(GraphicsOutput->QueryMode, GraphicsOutput, ModeNum, &Size, &Info); // if ((Status == EFI_SUCCESS) && (Size >= sizeof(*Info)) && @@ -164,7 +174,7 @@ BOOLEAN egSetScreenSize(IN OUT UINTN *ScreenWidth, IN OUT UINTN *ScreenHeight) { if ((Status == EFI_SUCCESS) && (Info != NULL)) { Print(L"Mode %d: %d x %d\n", ModeNum, Info->HorizontalResolution, Info->VerticalResolution); } // else - } while ((ModeNum++ < 10) || (Status == EFI_SUCCESS)); + } while ((++ModeNum < MIN_SCAN_GRAPHICS_MODES) || (Status == EFI_SUCCESS)); // Status = EFI_SUCCESS; // while (Status == EFI_SUCCESS) { // Status = refit_call4_wrapper(GraphicsOutput->QueryMode, GraphicsOutput, ModeNum, &Size, &Info); @@ -222,7 +232,7 @@ UINT32 egSetTextMode(UINT32 RequestedMode) { Status = refit_call4_wrapper(ST->ConOut->QueryMode, ST->ConOut, i, &Width, &Height); if (Status == EFI_SUCCESS) Print(L"Mode: %d: %d x %d\n", i, Width, Height); - } while ((i++ < 2) || (Status == EFI_SUCCESS)); + } while ((++i < MIN_SCAN_TEXT_MODES) || (Status == EFI_SUCCESS)); PauseForKey(); SwitchToGraphics(); diff --git a/mkdistrib b/mkdistrib index c12196f..78f24e3 100755 --- a/mkdistrib +++ b/mkdistrib @@ -47,10 +47,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 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 -if [[ SignIt == 1 ]] ; then - cp $KeysDir/refind.cer $KeysDir/refind.crt ../snapshots/$1/refind-$1/ -fi +cp -a docs images keys 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 # Go there and prepare a souce code zip file.... cd ../snapshots/$1/ @@ -87,11 +84,10 @@ else cp refind/refind_x64.efi refind-bin-$1/refind/refind_x64.efi fi cp refind-bin-$1/refind/refind_x64.efi $StartDir -cp -a COPYING.txt LICENSE.txt README.txt docs CREDITS.txt install.sh mkrlconf.sh refind-bin-$1 +cp -a docs keys COPYING.txt LICENSE.txt README.txt CREDITS.txt install.sh mkrlconf.sh refind-bin-$1 # Prepare the final .zip file and clean up if [[ $SignIt == 1 ]] ; then - cp $KeysDir/refind.cer $KeysDir/refind.crt refind-bin-$1/ umount $KeysDir fi zip -9r ../refind-bin-$1.zip refind-bin-$1 diff --git a/refind.conf-sample b/refind.conf-sample index 7d2950a..7d77fde 100644 --- a/refind.conf-sample +++ b/refind.conf-sample @@ -167,10 +167,19 @@ timeout 20 # Directories are specified relative to the volume's root directory. This # option applies to ALL the volumes that rEFInd scans. If a specified # directory doesn't exist, it's ignored (no error condition results). -# The default is to scan no additional directories. +# The default is to scan the "boot" directory in addition to various +# hard-coded directories. # #also_scan_dirs boot,EFI/linux/kernels +# Partitions to omit from scans. You must specify a volume by its +# label, which you can obtain in an EFI shell by typing "vol", from +# Linux by typing "blkid /dev/{devicename}", or by examining the +# disk's label in various OSes' file browsers. +# The default is an empty list (all volumes are scanned). +# +#dont_scan_volumes + # Directories that should NOT be scanned for boot loaders. By default, # rEFInd doesn't scan its own directory or the EFI/tools directory. # You can "blacklist" additional directories with this option, which diff --git a/refind/config.c b/refind/config.c index 3831e4c..b1e0929 100644 --- a/refind/config.c +++ b/refind/config.c @@ -347,6 +347,8 @@ VOID ReadConfig(CHAR16 *FileName) if (StriCmp(FileName, CONFIG_FILE_NAME) == 0) { MyFreePool(GlobalConfig.AlsoScan); GlobalConfig.AlsoScan = StrDuplicate(ALSO_SCAN_DIRS); +// MyFreePool(GlobalConfig.DontScanVolumes); +// GlobalConfig.DontScanVolumes = StrDuplicate(L" "); MyFreePool(GlobalConfig.DontScanDirs); GlobalConfig.DontScanDirs = StrDuplicate(SelfDirPath); MyFreePool(GlobalConfig.DontScanFiles); @@ -411,6 +413,15 @@ VOID ReadConfig(CHAR16 *FileName) } else if (StriCmp(TokenList[0], L"also_scan_dirs") == 0) { HandleStrings(TokenList, TokenCount, &(GlobalConfig.AlsoScan)); + } else if ((StriCmp(TokenList[0], L"don't_scan_volumes") == 0) || (StriCmp(TokenList[0], L"dont_scan_volumes") == 0)) { + HandleStrings(TokenList, TokenCount, &(GlobalConfig.AlsoScan)); + // Note: Don't use HandleStrings() because it modifies slashes, which might be present in volume name + MyFreePool(GlobalConfig.DontScanVolumes); + GlobalConfig.DontScanVolumes = NULL; + for (i = 1; i < TokenCount; i++) { + MergeStrings(&GlobalConfig.DontScanVolumes, TokenList[i], L','); + } + } else if ((StriCmp(TokenList[0], L"don't_scan_dirs") == 0) || (StriCmp(TokenList[0], L"dont_scan_dirs") == 0)) { HandleStrings(TokenList, TokenCount, &(GlobalConfig.DontScanDirs)); @@ -718,7 +729,6 @@ VOID ScanUserConfigured(VOID) CHAR16 *Title = NULL; UINTN TokenCount, size; LOADER_ENTRY *Entry; -// REFIT_MENU_SCREEN *SubScreen; if (FileExists(SelfDir, CONFIG_FILE_NAME)) { Status = ReadFile(SelfDir, CONFIG_FILE_NAME, &File, &size); diff --git a/refind/global.h b/refind/global.h index 49cb081..a2db177 100644 --- a/refind/global.h +++ b/refind/global.h @@ -216,6 +216,7 @@ typedef struct { CHAR16 *SelectionBigFileName; CHAR16 *DefaultSelection; CHAR16 *AlsoScan; + CHAR16 *DontScanVolumes; CHAR16 *DontScanDirs; CHAR16 *DontScanFiles; CHAR16 *DriverDirs; diff --git a/refind/lib.c b/refind/lib.c index 77e6842..4eb8378 100644 --- a/refind/lib.c +++ b/refind/lib.c @@ -94,7 +94,7 @@ static VOID UninitVolumes(VOID); // // Converts forward slashes to backslashes, removes duplicate slashes, and -// removes slashes from the end of the pathname. +// removes slashes from both the start and end of the pathname. // Necessary because some (buggy?) EFI implementations produce "\/" strings // in pathnames, because some user inputs can produce duplicate directory // separators, and because we want consistent start and end slashes for @@ -106,23 +106,20 @@ VOID CleanUpPathNameSlashes(IN OUT CHAR16 *PathName) { UINTN i, FinalChar = 0; BOOLEAN LastWasSlash = FALSE; - NewName = AllocateZeroPool(sizeof(CHAR16) * (StrLen(PathName) + 4)); + NewName = AllocateZeroPool(sizeof(CHAR16) * (StrLen(PathName) + 2)); if (NewName != NULL) { for (i = 0; i < StrLen(PathName); i++) { if ((PathName[i] == L'/') || (PathName[i] == L'\\')) { - if ((!LastWasSlash) /* && (FinalChar != 0) */) + if ((!LastWasSlash) && (FinalChar != 0)) NewName[FinalChar++] = L'\\'; LastWasSlash = TRUE; } else { - if (FinalChar == 0) { - NewName[FinalChar++] = L'\\'; - } NewName[FinalChar++] = PathName[i]; LastWasSlash = FALSE; } // if/else } // for NewName[FinalChar] = 0; - if ((FinalChar > 1) && (NewName[FinalChar - 1] == L'\\')) + if ((FinalChar > 0) && (NewName[FinalChar - 1] == L'\\')) NewName[--FinalChar] = 0; if (FinalChar == 0) { NewName[0] = L'\\'; @@ -134,6 +131,39 @@ VOID CleanUpPathNameSlashes(IN OUT CHAR16 *PathName) { } // if allocation OK } // CleanUpPathNameSlashes() +// VOID CleanUpPathNameSlashes(IN OUT CHAR16 *PathName) { +// CHAR16 *NewName; +// UINTN i, FinalChar = 0; +// BOOLEAN LastWasSlash = FALSE; +// +// NewName = AllocateZeroPool(sizeof(CHAR16) * (StrLen(PathName) + 4)); +// if (NewName != NULL) { +// for (i = 0; i < StrLen(PathName); i++) { +// if ((PathName[i] == L'/') || (PathName[i] == L'\\')) { +// if ((!LastWasSlash) /* && (FinalChar != 0) */) +// NewName[FinalChar++] = L'\\'; +// LastWasSlash = TRUE; +// } else { +// if (FinalChar == 0) { +// NewName[FinalChar++] = L'\\'; +// } +// NewName[FinalChar++] = PathName[i]; +// LastWasSlash = FALSE; +// } // if/else +// } // for +// NewName[FinalChar] = 0; +// if ((FinalChar > 1) && (NewName[FinalChar - 1] == L'\\')) +// NewName[--FinalChar] = 0; +// if (FinalChar == 0) { +// NewName[0] = L'\\'; +// NewName[1] = 0; +// } +// // Copy the transformed name back.... +// StrCpy(PathName, NewName); +// FreePool(NewName); +// } // if allocation OK +// } // CleanUpPathNameSlashes() + // Splits an EFI device path into device and filename components. For instance, if InString is // PciRoot(0x0)/Pci(0x1f,0x2)/Ata(Secondary,Master,0x0)/HD(2,GPT,8314ae90-ada3-48e9-9c3b-09a88f80d921,0x96028,0xfa000)/\bzImage-3.5.1.efi, // this function will truncate that input to @@ -1229,7 +1259,7 @@ VOID MergeStrings(IN OUT CHAR16 **First, IN CHAR16 *Second, CHAR16 AddChar) { StrCat(NewString, *First); if (AddChar) { NewString[Length1] = AddChar; - NewString[Length1 + 1] = 0; + NewString[Length1 + 1] = '\0'; } // if (AddChar) } // if (*First != NULL) if (Second != NULL) @@ -1463,18 +1493,18 @@ BOOLEAN EjectMedia(VOID) { } // VOID EjectMedia() -// Return the GUID as a string, suitable for display to the user. Note that the calling -// function is responsible for freeing the allocated memory. -CHAR16 * GuidAsString(EFI_GUID *GuidData) { - CHAR16 *TheString; - - TheString = AllocateZeroPool(42 * sizeof(CHAR16)); - if (TheString != 0) { - SPrint (TheString, 82, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - (UINTN)GuidData->Data1, (UINTN)GuidData->Data2, (UINTN)GuidData->Data3, - (UINTN)GuidData->Data4[0], (UINTN)GuidData->Data4[1], (UINTN)GuidData->Data4[2], - (UINTN)GuidData->Data4[3], (UINTN)GuidData->Data4[4], (UINTN)GuidData->Data4[5], - (UINTN)GuidData->Data4[6], (UINTN)GuidData->Data4[7]); - } - return TheString; -} // GuidAsString(EFI_GUID *GuidData) +// // Return the GUID as a string, suitable for display to the user. Note that the calling +// // function is responsible for freeing the allocated memory. +// CHAR16 * GuidAsString(EFI_GUID *GuidData) { +// CHAR16 *TheString; +// +// TheString = AllocateZeroPool(42 * sizeof(CHAR16)); +// if (TheString != 0) { +// SPrint (TheString, 82, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", +// (UINTN)GuidData->Data1, (UINTN)GuidData->Data2, (UINTN)GuidData->Data3, +// (UINTN)GuidData->Data4[0], (UINTN)GuidData->Data4[1], (UINTN)GuidData->Data4[2], +// (UINTN)GuidData->Data4[3], (UINTN)GuidData->Data4[4], (UINTN)GuidData->Data4[5], +// (UINTN)GuidData->Data4[6], (UINTN)GuidData->Data4[7]); +// } +// return TheString; +// } // GuidAsString(EFI_GUID *GuidData) diff --git a/refind/lib.h b/refind/lib.h index 1e74ac9..7245191 100644 --- a/refind/lib.h +++ b/refind/lib.h @@ -116,6 +116,6 @@ VOID MyFreePool(IN OUT VOID *Pointer); BOOLEAN EjectMedia(VOID); -CHAR16 * GuidAsString(EFI_GUID *GuidData); +//CHAR16 * GuidAsString(EFI_GUID *GuidData); #endif \ No newline at end of file diff --git a/refind/main.c b/refind/main.c index 05d15be..ab6efe6 100644 --- a/refind/main.c +++ b/refind/main.c @@ -61,7 +61,7 @@ // // variables -#define MACOSX_LOADER_PATH L"\\System\\Library\\CoreServices\\boot.efi" +#define MACOSX_LOADER_PATH L"System\\Library\\CoreServices\\boot.efi" #if defined (EFIX64) #define SHELL_NAMES L"\\EFI\\tools\\shell.efi,\\shellx64.efi" #define DRIVER_DIRS L"drivers,drivers_x64" @@ -97,7 +97,7 @@ static REFIT_MENU_SCREEN MainMenu = { L"Main Menu", NULL, 0, NULL, 0, NULL static REFIT_MENU_SCREEN AboutMenu = { L"About", NULL, 0, NULL, 0, NULL, 0, NULL }; REFIT_CONFIG GlobalConfig = { FALSE, FALSE, 0, 0, 0, 20, 0, 0, GRAPHICS_FOR_OSX, LEGACY_TYPE_MAC, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, {TAG_SHELL, TAG_APPLE_RECOVERY, TAG_MOK_TOOL, TAG_ABOUT, TAG_SHUTDOWN, TAG_REBOOT, 0, 0, 0, 0, 0 }}; // Structure used to hold boot loader filenames and time stamps in @@ -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.1.6"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.6.0"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith"); @@ -186,7 +186,7 @@ static EFI_STATUS StartEFIImageList(IN EFI_DEVICE_PATH **DevicePaths, // set load options if (LoadOptions != NULL) { if (LoadOptionsPrefix != NULL) { - MergeStrings(&FullLoadOptions, LoadOptionsPrefix, 0); +// MergeStrings(&FullLoadOptions, LoadOptionsPrefix, 0); MergeStrings(&FullLoadOptions, LoadOptions, L' '); if (OSType == 'M') { MergeStrings(&FullLoadOptions, L" ", 0); @@ -461,9 +461,10 @@ LOADER_ENTRY *InitializeLoaderEntry(IN LOADER_ENTRY *Entry) { // Returns a pointer to a new string. The calling function is responsible for // freeing its memory. static CHAR16 *AddInitrdToOptions(CHAR16 *Options, CHAR16 *InitrdPath) { - CHAR16 *NewOptions; + CHAR16 *NewOptions = NULL; - NewOptions = StrDuplicate(Options); + if (Options != NULL) + NewOptions = StrDuplicate(Options); if ((InitrdPath != NULL) && !StriSubCmp(L"initrd=", Options)) { MergeStrings(&NewOptions, L"initrd=", L' '); MergeStrings(&NewOptions, InitrdPath, 0); @@ -494,7 +495,7 @@ REFIT_MENU_SCREEN *InitializeSubScreen(IN LOADER_ENTRY *Entry) { // default entry SubEntry = InitializeLoaderEntry(Entry); if (SubEntry != NULL) { - SubEntry->me.Title = L"Boot using default options"; + SubEntry->me.Title = StrDuplicate(L"Boot using default options"); MainOptions = SubEntry->LoadOptions; SubEntry->LoadOptions = AddInitrdToOptions(MainOptions, SubEntry->InitrdPath); MyFreePool(MainOptions); @@ -510,7 +511,7 @@ REFIT_MENU_SCREEN *InitializeSubScreen(IN LOADER_ENTRY *Entry) { VOID GenerateSubScreen(LOADER_ENTRY *Entry, IN REFIT_VOLUME *Volume) { REFIT_MENU_SCREEN *SubScreen; LOADER_ENTRY *SubEntry; - CHAR16 *InitrdOption = NULL, *Temp; + CHAR16 *InitrdName; CHAR16 DiagsFileName[256]; REFIT_FILE *File; UINTN TokenCount; @@ -580,7 +581,7 @@ VOID GenerateSubScreen(LOADER_ENTRY *Entry, IN REFIT_VOLUME *Volume) { } // not single-user // check for Apple hardware diagnostics - StrCpy(DiagsFileName, L"\\System\\Library\\CoreServices\\.diagnostics\\diags.efi"); + StrCpy(DiagsFileName, L"System\\Library\\CoreServices\\.diagnostics\\diags.efi"); if (FileExists(Volume->RootDir, DiagsFileName) && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HWTEST)) { SubEntry = InitializeLoaderEntry(Entry); if (SubEntry != NULL) { @@ -596,20 +597,26 @@ VOID GenerateSubScreen(LOADER_ENTRY *Entry, IN REFIT_VOLUME *Volume) { } else if (Entry->OSType == 'L') { // entries for Linux kernels with EFI stub loaders File = ReadLinuxOptionsFile(Entry->LoaderPath, Volume); if (File != NULL) { - Temp = FindInitrd(Entry->LoaderPath, Volume); - TokenCount = ReadTokenLine(File, &TokenList); // read and discard first entry, since it's - FreeTokenLine(&TokenList, &TokenCount); // set up by InitializeSubScreen(), earlier.... + InitrdName = FindInitrd(Entry->LoaderPath, Volume); + TokenCount = ReadTokenLine(File, &TokenList); + // first entry requires special processing, since it was initially set + // up with a default title but correct options by InitializeSubScreen(), + // earlier.... + if ((SubScreen->Entries != NULL) && (SubScreen->Entries[0] != NULL)) { + MyFreePool(SubScreen->Entries[0]->Title); + SubScreen->Entries[0]->Title = StrDuplicate(TokenList[0]); + } // if + FreeTokenLine(&TokenList, &TokenCount); while ((TokenCount = ReadTokenLine(File, &TokenList)) > 1) { SubEntry = InitializeLoaderEntry(Entry); SubEntry->me.Title = StrDuplicate(TokenList[0]); MyFreePool(SubEntry->LoadOptions); - SubEntry->LoadOptions = AddInitrdToOptions(TokenList[1], Temp); + SubEntry->LoadOptions = AddInitrdToOptions(TokenList[1], InitrdName); FreeTokenLine(&TokenList, &TokenCount); SubEntry->UseGraphicsMode = GlobalConfig.GraphicsFor & GRAPHICS_FOR_LINUX; AddMenuEntry(SubScreen, (REFIT_MENU_ENTRY *)SubEntry); } // while - MyFreePool(InitrdOption); - MyFreePool(Temp); + MyFreePool(InitrdName); MyFreePool(File); } // if Linux options file exists @@ -820,8 +827,7 @@ INTN TimeComp(EFI_TIME *Time1, EFI_TIME *Time2) { INT64 Time1InSeconds, Time2InSeconds; // Following values are overestimates; I'm assuming 31 days in every month. - // This is fine for the purpose of this function, which has a limited - // purpose. + // This is fine for the purpose of this function, which is limited Time1InSeconds = Time1->Second + (Time1->Minute * 60) + (Time1->Hour * 3600) + (Time1->Day * 86400) + (Time1->Month * 2678400) + ((Time1->Year - 1998) * 32140800); Time2InSeconds = Time2->Second + (Time2->Minute * 60) + (Time2->Hour * 3600) + (Time2->Day * 86400) + @@ -880,8 +886,10 @@ static VOID ScanLoaderDir(IN REFIT_VOLUME *Volume, IN CHAR16 *Path, IN CHAR16 *P CHAR16 FileName[256], *Extension; struct LOADER_LIST *LoaderList = NULL, *NewLoader; - if ((!SelfDirPath || !Path || ((StriCmp(Path, SelfDirPath) == 0) && Volume->DeviceHandle != SelfVolume->DeviceHandle) || - (StriCmp(Path, SelfDirPath) != 0)) && (!IsIn(Path, GlobalConfig.DontScanDirs))) { + if ((!SelfDirPath || !Path || ((StriCmp(Path, SelfDirPath) == 0) && (Volume->DeviceHandle != SelfVolume->DeviceHandle)) || + (StriCmp(Path, SelfDirPath) != 0)) && + (!IsIn(Path, GlobalConfig.DontScanDirs)) && + (!IsIn(Volume->VolName, GlobalConfig.DontScanVolumes))) { // look through contents of the directory DirIterOpen(Volume->RootDir, Path, &DirIter); while (DirIterNext(&DirIter, 2, Pattern, &DirEntry)) { @@ -893,9 +901,9 @@ static VOID ScanLoaderDir(IN REFIT_VOLUME *Volume, IN CHAR16 *Path, IN CHAR16 *P continue; // skip this if (Path) - SPrint(FileName, 255, L"\\%s\\%s", Path, DirEntry->FileName); + SPrint(FileName, 255, L"\\%s\\%s", Path, DirEntry->FileName); else - SPrint(FileName, 255, L"\\%s", DirEntry->FileName); + SPrint(FileName, 255, L"\\%s", DirEntry->FileName); CleanUpPathNameSlashes(FileName); NewLoader = AllocateZeroPool(sizeof(struct LOADER_LIST)); if (NewLoader != NULL) { @@ -935,22 +943,22 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) { if ((Volume->RootDir != NULL) && (Volume->VolName != NULL)) { // check for Mac OS X boot loader - if (!IsIn(L"\\System\\Library\\CoreServices", GlobalConfig.DontScanDirs)) { + if (!IsIn(L"System\\Library\\CoreServices", GlobalConfig.DontScanDirs)) { StrCpy(FileName, MACOSX_LOADER_PATH); if (FileExists(Volume->RootDir, FileName) && !IsIn(L"boot.efi", GlobalConfig.DontScanFiles)) { AddLoaderEntry(FileName, L"Mac OS X", Volume); } // check for XOM - StrCpy(FileName, L"\\System\\Library\\CoreServices\\xom.efi"); + StrCpy(FileName, L"System\\Library\\CoreServices\\xom.efi"); if (FileExists(Volume->RootDir, FileName) && !IsIn(L"boot.efi", GlobalConfig.DontScanFiles)) { AddLoaderEntry(FileName, L"Windows XP (XoM)", Volume); } } // if Mac directory not in GlobalConfig.DontScanDirs list // check for Microsoft boot loader/menu - StrCpy(FileName, L"\\EFI\\Microsoft\\Boot\\Bootmgfw.efi"); - if (FileExists(Volume->RootDir, FileName) && !IsIn(L"\\EFI\\Microsoft\\Boot", GlobalConfig.DontScanDirs) && + StrCpy(FileName, L"EFI\\Microsoft\\Boot\\Bootmgfw.efi"); + if (FileExists(Volume->RootDir, FileName) && !IsIn(L"EFI\\Microsoft\\Boot", GlobalConfig.DontScanDirs) && !IsIn(L"bootmgfw.efi", GlobalConfig.DontScanFiles)) { AddLoaderEntry(FileName, L"Microsoft EFI boot", Volume); } @@ -963,7 +971,7 @@ static VOID ScanEfiFiles(REFIT_VOLUME *Volume) { while (DirIterNext(&EfiDirIter, 1, NULL, &EfiDirEntry)) { if (StriCmp(EfiDirEntry->FileName, L"tools") == 0 || EfiDirEntry->FileName[0] == '.') continue; // skip this, doesn't contain boot loaders - SPrint(FileName, 255, L"\\EFI\\%s", EfiDirEntry->FileName); + SPrint(FileName, 255, L"EFI\\%s", EfiDirEntry->FileName); ScanLoaderDir(Volume, FileName, MatchPatterns); } // while() Status = DirIterClose(&EfiDirIter); @@ -1805,16 +1813,16 @@ static VOID ScanForTools(VOID) { break; case TAG_GPTSYNC: MyFreePool(FileName); - FileName = NULL; - MergeStrings(&FileName, L"\\efi\\tools\\gptsync.efi", 0); + FileName = StrDuplicate(L"\\efi\\tools\\gptsync.efi"); +// MergeStrings(&FileName, L"\\efi\\tools\\gptsync.efi", 0); if (FileExists(SelfRootDir, FileName)) { AddToolEntry(SelfLoadedImage->DeviceHandle, FileName, L"Make Hybrid MBR", BuiltinIcon(BUILTIN_ICON_TOOL_PART), 'P', FALSE); } break; case TAG_APPLE_RECOVERY: MyFreePool(FileName); - FileName = NULL; - MergeStrings(&FileName, L"\\com.apple.recovery.boot\\boot.efi", 0); + FileName = StrDuplicate(L"\\com.apple.recovery.boot\\boot.efi"); +// MergeStrings(&FileName, L"\\com.apple.recovery.boot\\boot.efi", 0); for (VolumeIndex = 0; VolumeIndex < VolumesCount; VolumeIndex++) { if ((Volumes[VolumeIndex]->RootDir != NULL) && (FileExists(Volumes[VolumeIndex]->RootDir, FileName))) { SPrint(Description, 255, L"Apple Recovery on %s", Volumes[VolumeIndex]->VolName); diff --git a/refind/menu.c b/refind/menu.c index 7b74e51..7579978 100644 --- a/refind/menu.c +++ b/refind/menu.c @@ -721,8 +721,8 @@ static VOID GraphicsMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *Sta } else { DrawMenuText(L"Use arrow keys to move cursor; Enter to boot;", 0, (UGAWidth - (45 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3)); - DrawMenuText(L"Insert or F2 to edit options", 0, - (UGAWidth - (28 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2)); + DrawMenuText(L"Insert or F2 to edit options; Esc to return to main menu", 0, + (UGAWidth - (56 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2)); } // if/else } // if break; @@ -799,7 +799,7 @@ static VOID PaintAll(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, UINTN if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) { DrawMainMenuText(L"Use arrow keys to move cursor; Enter to boot;", (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3)); - DrawMainMenuText(L"Insert or F2 for more options", + DrawMainMenuText(L"Insert or F2 for more options; Esc to refresh", (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2)); } // if } // static VOID PaintAll() -- 2.39.2