From 32af1a6f9af65e08b7e7bb60a5a8177eb254c8f0 Mon Sep 17 00:00:00 2001
From: srs5694 by Roderick W. Smith, rodsmith@rodsbooks.com Originally written: 3/14/2012; last Web page update: 4/9/2012, referencing rEFInd 0.2.5 Originally written: 3/14/2012; last Web page update: 4/14/2012, referencing rEFInd 0.2.6 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! The following menu entry illustrates the use of submenu entries. This is an expansion on the second entry presented earlier: The following menu entry illustrates the use of submenu entries. This is a variant of the second entry presented earlier: by Roderick W. Smith, rodsmith@rodsbooks.com Originally written: 3/14/2012; last Web page update: 4/9/2012, referencing rEFInd 0.2.5 Originally written: 3/14/2012; last Web page update: 4/14/2012, referencing rEFInd 0.2.6 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! by Roderick W. Smith, rodsmith@rodsbooks.com Originally written: 3/14/2012; last Web page update: 4/9/2012, referencing rEFInd 0.2.5 Originally written: 3/14/2012; last Web page update: 4/14/2012, referencing rEFInd 0.2.6 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!
volume
filesystem label
- Sets the volume that's used for subsequent file accesses (by icon and loader, and by implication by initrd if loader follows volume). You pass this token a filesystem's name/label, which is typically displayed under the volume's icon in file managers and that rEFInd displays on its menu at the end of the boot prompt string. If this label isn't unique, the first volume with the specified label is used. The matching is nominally case-insensitive, but on some EFIs it's case-sensitive.
+ Sets the volume that's used for subsequent file accesses (by icon and loader, and by implication by initrd if loader follows volume). You pass this token a filesystem's label or a volume number. A filesystem label is typically displayed under the volume's icon in file managers and that rEFInd displays on its menu at the end of the boot prompt string. If this label isn't unique, the first volume with the specified label is used. The matching is nominally case-insensitive, but on some EFIs it's case-sensitive. If a filesystem has no label, you can use a volume number followed by a colon, such as 0: to refer to the first filesystem or 1: to refer to the second. The assignment of numbers is arbitrary and may not be consistent across boots, though. It might change if you insert an optical disc or plug in a USB flash drive, for instance. If this option is not set, the volume defaults to the one from which rEFInd launched.
loader
filename
- Sets the filename for the boot loader. You may use either Unix-style slashes (/) or Windows/EFI-style backslashes (\) to separate directory elements. In either case, the references are to files on the ESP from which rEFInd launched; you can't (yet) launch loaders from other locations. This option should normally be the first in the body of an OS stanza; if it's not, some other options may be ignored.
+ Sets the filename for the boot loader. You may use either Unix-style slashes (/) or Windows/EFI-style backslashes (\) to separate directory elements. In either case, the references are to files on the ESP from which rEFInd launched or to the one identified by a preceding volume token. This option should normally be the first in the body of an OS stanza; if it's not, some other options may be ignored. An exception is if you want to boot a loader from a volume other than the one on which rEFInd resides, in which case volume should precede loader.
initrd
filename
- Sets the filename for a Linux kernel's initial RAM disk (initrd). This option is useful only when booting a Linux kernel that includes an EFI stub loader, which enables you to boot a kernel without the benefit of a separate boot loader. When booted in this way, though, you must normally pass an initrd filename to the boot loader. You must specify the complete EFI path to the initrd file with this option, as in initrd EFI/linux/initrd-3.3.0-rc7.img. You'll also have to use the options line to pass the Linux root filesystem, and perhaps other options (as in options "root=/dev/sda4 ro").
+ Sets the filename for a Linux kernel's initial RAM disk (initrd). This option is useful only when booting a Linux kernel that includes an EFI stub loader, which enables you to boot a kernel without the benefit of a separate boot loader. When booted in this way, though, you must normally pass an initrd filename to the boot loader. You must specify the complete EFI path to the initrd file with this option, as in initrd EFI/linux/initrd-3.3.0-rc7.img. You'll also have to use the options line to pass the Linux root filesystem, and perhaps other options (as in options "root=/dev/sda4 ro"). The initial RAM disk file must reside on the same volume as the kernel.
icon
@@ -317,7 +317,7 @@ menuentry Gentoo {
loader
filename
- Sets the filename for the boot loader, as described in Table 2.
+ Sets the filename for the boot loader, as described in Table 2. Note that the loader is read from whatever filesystem is specified by the main stanza's volume option, provided that option precedes the submenu definition.
-initrd
@@ -346,7 +346,7 @@ menuentry Gentoo {
menuentry Gentoo {
diff --git a/docs/refind/features.html b/docs/refind/features.html
index 13508ae..0789f19 100644
--- a/docs/refind/features.html
+++ b/docs/refind/features.html
@@ -14,7 +14,7 @@
by Roderick W. Smith, rodsmith@rodsbooks.com
-Originally written: 3/14/2012; last Web page update: 4/9/2012, referencing rEFInd 0.2.5
+Originally written: 3/14/2012; last Web page update: 4/14/2012, referencing rEFInd 0.2.6
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!
diff --git a/docs/refind/installing.html b/docs/refind/installing.html index 978a70e..048807c 100644 --- a/docs/refind/installing.html +++ b/docs/refind/installing.html @@ -14,7 +14,7 @@by Roderick W. Smith, rodsmith@rodsbooks.com
-Originally written: 3/14/2012; last Web page update: 4/9/2012, referencing rEFInd 0.2.5
+Originally written: 3/14/2012; last Web page update: 4/14/2012, referencing rEFInd 0.2.6
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!
@@ -147,13 +147,13 @@ Filesystem 1K-blocks Used Available Use% Mounted on -The procedure for installing rEFInd on a Mac is similar to that for installing it under Linux, except that you can install it to the OS X's system directory rather than to the ESP, and you must use the bless utility rather than efibootmgr. To be precise, you should follow these steps:
+The procedure for installing rEFInd on a Mac is similar to that for installing it under Linux, except that you can (and probably should) install it to the OS X's system directory or some other HFS+ partition rather than to the ESP, and you must use the bless utility rather than efibootmgr. To be precise, you should follow these steps:
When you reboot, your Mac should bring up the rEFInd menu, and should continue to do so thereafter. If you make changes that break this association, you can re-run the bless command (if necessary, restoring the rEFInd files first). This might be necessary after installing system updates from Apple.
+When you reboot, your Mac should bring up the rEFInd menu, and should continue to do so thereafter. If you make changes that break this association, you can re-run the bless command (if necessary, restoring the rEFInd files first). This might be necessary after installing system updates from Apple or if you upgrade rEFInd to a newer version.
If you're replacing rEFIt, you may discover that rEFInd works on the first boot, but the system reverts back to rEFIt or a direct boot to OS X on the second boot. To fix this problem, you can remove the rEFItBlesser program, which is located at /Library/StartupItems/rEFItBlesser. This program attempts to keep rEFIt set as the default boot loader, but it also has the purpose of protecting the computer from launching the wrong OS after waking from sleep. If you want that protection, my suggestion is to install rEFIt and rEFItBlesser and then replace the refit.efi file with refind_x64.efi or refind_ia32.efi (renaming it to refit.efi. Used in this way, rEFInd will still look for its own configuration file, refind.conf, so you'll need to move it but not rename it. If you don't move the icons from the rEFInd package, your icons will continue to look like rEFIt icons, and you'll be missing the new icons for specific Linux distributions that rEFInd provides.
diff --git a/docs/refind/linux.html b/docs/refind/linux.html index 939e798..b31d20d 100644 --- a/docs/refind/linux.html +++ b/docs/refind/linux.html @@ -14,7 +14,7 @@by Roderick W. Smith, rodsmith@rodsbooks.com
-Originally written: 3/19/2012; last Web page update: 4/9/2012, referencing rEFInd 0.2.5
+Originally written: 3/19/2012; last Web page update: 4/14/2012, referencing rEFInd 0.2.6
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!
diff --git a/docs/refind/revisions.html b/docs/refind/revisions.html index bb06648..9b39aad 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: 4/9/2012
+Last Web page update: 4/14/2012
I'm a technical writer and consultant specializing in Linux technologies. This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!
@@ -93,6 +93,8 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comby Roderick W. Smith, rodsmith@rodsbooks.com
-Originally written: 3/14/2012; last Web page update: 4/9/2012, referencing rEFInd 0.2.5
+Originally written: 3/14/2012; last Web page update: 4/14/2012, referencing rEFInd 0.2.6
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!
@@ -101,7 +101,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.comIf you don't press any key before the timeout (shown on the last line) expires, the default boot loader will launch. This is normally the first item in the menu, but you can adjust the default by editing the configuration file. (In this example, it's the SUSE loader, which is further identified by text above the timeout as Linux 3.3.0-rc7 from ESP.)
-This display is dominated by the central set of icons, which in this example includes icons for OS X, Windows, Ubuntu, a generic Linux installation (ELILO, in fact), SUSE, and an unkown boot loader. All but the last of these are on hard disks, but the unknown boot loader is on an optical disc, as revealed by the small icons in the lower-right corner of the OS icons.
+This display is dominated by the central set of icons, which in this example includes icons for OS X, Windows, Ubuntu, a generic Linux installation (ELILO, in fact), SUSE, and an unkown boot loader. All but the last of these are on hard disks, but the unknown boot loader is on an optical disc, as revealed by the small icons (known as badges) in the lower-right corner of the OS icons.
In this example, the SUSE tag is selected. You can move the selection left by pressing the left or down arrow key and right by pressing the right or up arrow key. If your system has many boot loaders, an arrow icon will appear to the right of the boot loader list, indicating that the boot loader list will scroll when you move off the right edge. If you do this, an arrow icon will appear to the left of the icon list, indicating that you can scroll back in a similar manner. Moving past the final selection or using the Page Down key moves the selection to the second row of small icons, which launch ancillary programs or perform special actions. In this figure, these five icons are present:
diff --git a/refind.conf-sample b/refind.conf-sample index 1c0d57b..7e3cb2c 100644 --- a/refind.conf-sample +++ b/refind.conf-sample @@ -93,6 +93,10 @@ scanfor internal,external,optical # ("{"). Each entry ends with a close curly brace ("}"). Common # keywords within each stanza include: # +# volume - identifies the filesystem from which subsequent files +# are loaded. You can specify the volume by label or by +# a number followed by a colon (as in "0:" for the first +# filesystem or "1:" for the second). # loader - identifies the boot loader file # initrd - Specifies an initial RAM disk file # icon - specifies a custom boot loader icon @@ -125,14 +129,16 @@ scanfor internal,external,optical # and adjust the entries to suit your needs. # A sample entry for a Linux 3.3 kernel with its new EFI boot stub -# support. This includes Linux-specific boot options and specification -# of an initial RAM disk. Note uses of Linux-style forward slashes, -# even in the initrd specification. Also note that a leading slash is -# optional in file specifications. +# support on a filesystem called "KERNELS". This entry includes +# Linux-specific boot options and specification of an initial RAM disk. +# Note uses of Linux-style forward slashes, even in the initrd +# specification. Also note that a leading slash is optional in file +# specifications. menuentry Linux { - loader EFI/Linux/bzImage-3.3.0-rc7 - initrd EFI/Linux/initrd-3.3.0.img icon EFI/refind/icons/os_linux.icns + volume KERNELS + loader bzImage-3.3.0-rc7 + initrd initrd-3.3.0.img options "ro root=UUID=5f96cafa-e0a7-4057-b18f-fa709db5b837" disabled } diff --git a/refind/config.c b/refind/config.c index 8f955e1..8016931 100644 --- a/refind/config.c +++ b/refind/config.c @@ -389,7 +389,7 @@ VOID ReadConfig(VOID) } else if (StriCmp(TokenList[0], L"default_selection") == 0) { HandleString(TokenList, TokenCount, &(GlobalConfig.DefaultSelection)); - + } else if (StriCmp(TokenList[0], L"textonly") == 0) { GlobalConfig.TextOnly = TRUE; @@ -461,24 +461,40 @@ static VOID AddSubmenu(LOADER_ENTRY *Entry, REFIT_FILE *File, REFIT_VOLUME *Volu Entry->me.SubScreen = SubScreen; } // VOID AddSubmenu() -// Finds a volume with the specified Identifier (a volume label, for the moment). -// If found, sets *Volume to point to that volume. If not, leaves it unchanged. +// Finds a volume with the specified Identifier (a volume label or a number +// followed by a colon, for the moment). If found, sets *Volume to point to +// that volume. If not, leaves it unchanged. // Returns TRUE if a match was found, FALSE if not. static BOOLEAN FindVolume(REFIT_VOLUME **Volume, CHAR16 *Identifier) { - UINTN i = 0; + UINTN i = 0, CountedVolumes = 0; + INTN Number = -1; BOOLEAN Found = FALSE; + if ((StrLen(Identifier) >= 2) && (Identifier[StrLen(Identifier) - 1] == L':') && + (Identifier[0] >= L'0') && (Identifier[0] <= L'9')) { + Number = (INTN) Atoi(Identifier); + } while ((i < VolumesCount) && (!Found)) { - if (StriCmp(Identifier, Volumes[i]->VolName) == 0) { - *Volume = Volumes[i]; - Found = TRUE; - } // if + if (Number >= 0) { // User specified a volume by number + if (Volumes[i]->IsReadable) { + if (CountedVolumes == Number) { + *Volume = Volumes[i]; + Found = TRUE; + } + CountedVolumes++; + } // if + } else { // User specified a volume by label + if (StriCmp(Identifier, Volumes[i]->VolName) == 0) { + *Volume = Volumes[i]; + Found = TRUE; + } // if + } // if/else i++; } // while() return (Found); } // static VOID FindVolume() -// Adds the options from a SINGLE loaders.conf stanza to a new loader entry and returns +// Adds the options from a SINGLE refind.conf stanza to a new loader entry and returns // that entry. The calling function is then responsible for adding the entry to the // list of entries. static LOADER_ENTRY * AddStanzaEntries(REFIT_FILE *File, REFIT_VOLUME *Volume, CHAR16 *Title) { diff --git a/refind/global.h b/refind/global.h index 63bc008..9489bee 100644 --- a/refind/global.h +++ b/refind/global.h @@ -105,6 +105,7 @@ typedef struct { EFI_BLOCK_IO *WholeDiskBlockIO; EFI_DEVICE_PATH *WholeDiskDevicePath; MBR_PARTITION_INFO *MbrPartitionTable; + BOOLEAN IsReadable; } REFIT_VOLUME; typedef struct _refit_menu_entry { diff --git a/refind/lib.c b/refind/lib.c index 18ab997..e78ae6a 100644 --- a/refind/lib.c +++ b/refind/lib.c @@ -579,7 +579,10 @@ static VOID ScanVolume(IN OUT REFIT_VOLUME *Volume) // open the root directory of the volume Volume->RootDir = LibOpenRoot(Volume->DeviceHandle); if (Volume->RootDir == NULL) { + Volume->IsReadable = FALSE; return; + } else { + Volume->IsReadable = TRUE; } // get volume name diff --git a/refind/main.c b/refind/main.c index e97be62..5e8496e 100644 --- a/refind/main.c +++ b/refind/main.c @@ -83,7 +83,7 @@ static VOID AboutrEFInd(VOID) { if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.5.2"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.6"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith"); @@ -650,9 +650,8 @@ static VOID ScanLoaderDir(IN REFIT_VOLUME *Volume, IN CHAR16 *Path) SPrint(FileName, 255, L"\\%s\\%s", Path, DirEntry->FileName); else SPrint(FileName, 255, L"\\%s", DirEntry->FileName); - // TODO: Sort loader entries by date/time, most recent first AddLoaderEntry(FileName, NULL, Volume); - } // while() + } Status = DirIterClose(&DirIter); if (Status != EFI_NOT_FOUND) { if (Path) -- 2.39.2