From: srs5694 Date: Sun, 22 Apr 2012 19:54:00 +0000 (-0400) Subject: Version 0.3.0 (beta) release. Adds "resolution" option to refind.conf. X-Git-Url: https://code.delx.au/refind/commitdiff_plain/4cd24d129d16bd6c49d19c84757f769f09a53236 Version 0.3.0 (beta) release. Adds "resolution" option to refind.conf. --- diff --git a/NEWS.txt b/NEWS.txt index 36fb2fb..2947edf 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,6 +1,27 @@ -0.2.8 (?/??/2012): +0.3.0 (?/??/2012): ------------------ +- I'm officially upgrading this project's status from "alpha" to "beta" and + giving it a bump from 0.2.x to 0.3.0. This doesn't reflect any major + milestone with this version; rather, it reflects my sense that rEFInd has + been "out there" for a while, and although I've gotten bug reports, + they've been minor and/or have been fixed. The program still has known + bugs, but my impression is that it is, overall, usable by ordinary users. + +- Added "resolution" option to refind.conf, which enables setting the video + resolution. To use it, pass two numeric values, as in "resolution 1024 + 768" to use a 1024x768 video mode. Note that not all modes are supported. + If you specify a non-supported video mode on a UEFI system, a message + appears listing the supported video modes and you must then press a key + to continue, using the default video mode (usually 800x600). + Unfortunately, I don't know the calls to get a list of supported video + modes on older EFI 1.x systems (including Macs), so on Macs setting an + incorrect video mode silently fails (you keep using the default mode). + This makes changing your video mode a hit-or-miss proposition on Macs. + CAUTION: It's possible to set a legal video mode that your monitor can't + handle, in which case you'll get a blank display until you boot an OS + that resets the video mode. + - Fixed (maybe) a bug that caused rEFInd to crash when returning from an EFI shell or other programs on Macs, particularly when rEFInd used graphical mode. I'm not 100% sure this bug is squashed because I still diff --git a/docs/refind/bootmode.html b/docs/refind/bootmode.html index f002cb8..f7478e1 100644 --- a/docs/refind/bootmode.html +++ b/docs/refind/bootmode.html @@ -14,7 +14,7 @@

by Roderick W. Smith, rodsmith@rodsbooks.com

-

Originally written: 3/14/2012; last Web page update: 4/19/2012, referencing rEFInd 0.2.7

+

Originally written: 3/14/2012; last Web page update: 4/22/2012, referencing rEFInd 0.3.0

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/configfile.html b/docs/refind/configfile.html index 354349e..b43819d 100644 --- a/docs/refind/configfile.html +++ b/docs/refind/configfile.html @@ -14,7 +14,7 @@

by Roderick W. Smith, rodsmith@rodsbooks.com

-

Originally written: 3/14/2012; last Web page update: 4/19/2012, referencing rEFInd 0.2.7

+

Originally written: 3/14/2012; last Web page update: 4/22/2012, referencing rEFInd 0.3.0

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!

@@ -172,6 +172,11 @@ timeout 20 None rEFInd defaults to a graphical mode; however, if you prefer to do without the flashy graphics, you can run it in text mode by including this option. + + resolution + Two integer values + Sets the video resolution used by rEFInd; takes a width and a height as options. For instance, resolution 1024 768 sets the resolution to 1024x768. If you set a resolution that doesn't work on a UEFI-based system, rEFInd displays a message along with a list of valid modes. On an system built around EFI 1.x (such as a Mac), setting an incorrect resolution fails silently; you'll get the system's default resolution. You'll also get the system's default resolution if you set either resolution value to 0 or if you pass anything but two numbers. (Note that passing a resolution with an x, as in 1024x768, will be interpreted as one option and so will cause the default resolution to be used.) Also, be aware that it is possible to set a valid resolution for your video card that's invalid for your monitor. If you do this, your monitor will go blank until you've booted an OS that resets the video mode. + scan_driver_dirs directory path(s) @@ -216,7 +221,7 @@ default_selection elilo

Creating OS Stanzas

-

OS stanzas in rEFInd are similar to those in GRUB Legacy, GRUB 2, or ELILO. You can use them to add configuration options to those that are auto-detected. You cannot modify the auto-detected options, though; if you just want to tweak one OS's configuration, you has several options, none of which is ideal:

+

OS stanzas in rEFInd are similar to those in GRUB Legacy, GRUB 2, or ELILO. You can use them to add configuration options to those that are auto-detected. You cannot modify the auto-detected options, though; if you just want to tweak one OS's configuration, you have several options, none of which is ideal:

diff --git a/docs/refind/features.html b/docs/refind/features.html index bb28a91..3d3fb05 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/19/2012, referencing rEFInd 0.2.7

+

Originally written: 3/14/2012; last Web page update: 4/22/2012, referencing rEFInd 0.3.0

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!

@@ -128,6 +128,8 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

  • The ability to specify additional directories to scan for boot loaders and drivers (as of version 0.2.7).
  • +
  • The ability to set the screen's resolution, within limits imposed by the EFI (as of rEFInd 0.3.0).
  • +
  • Proper handling of more OS options than can fit on the screen. (rEFIt displays an empty list in graphical mode when it detects too many OSes.)
  • Additional OS icons (all of which are Linux distributions, at least so far). This can make it easier to find a specific distribution in the boot list if you've installed multiple Linux distributions.
  • diff --git a/docs/refind/getting.html b/docs/refind/getting.html index 2899079..da91a3f 100644 --- a/docs/refind/getting.html +++ b/docs/refind/getting.html @@ -14,7 +14,7 @@

    by Roderick W. Smith, rodsmith@rodsbooks.com

    -

    Originally written: 3/14/2012; last Web page update: 4/19/2012, referencing rEFInd 0.2.7

    +

    Originally written: 3/14/2012; last Web page update: 4/22/2012, referencing rEFInd 0.3.0

    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!

    @@ -88,7 +88,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com


    -

    Note: I consider rEFInd to be alpha-quality software! Although rEFIt 0.14, upon which rEFInd is based, is beta-quality, I've changed a great deal of the code, and I'm still learning about it. I'm discovering bugs (old and new) and fixing them every day or two. That said, rEFInd is a usable program in its current form on many systems. If you have problems, feel free to drop me a line.

    +

    Note: I consider rEFInd to be beta-quality software! I'm discovering bugs (old and new) and fixing them every few days. That said, rEFInd is a usable program in its current form on many systems. If you have problems, feel free to drop me a line.

    Getting rEFInd from Sourceforge

    @@ -96,7 +96,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

    -

    Note: I consider rEFInd to be alpha-quality software! Although rEFIt 0.14, upon which rEFInd is based, is beta-quality, I've changed a great deal of the code, and I'm still learning about it. I'm discovering bugs (old and new) and fixing them every day or two. That said, rEFInd is a usable program in its current form on many systems. If you have problems, feel free to drop me a line.

    +

    Note: I consider rEFInd to be beta-quality software! I'm discovering bugs (old and new) and fixing them every few days. That said, rEFInd is a usable program in its current form on many systems. If you have problems, feel free to drop me a line.

    References and Additional Information

    @@ -149,6 +149,8 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

  • My own EFI Boot Loaders for Linux page provides information on installing and configuring several common Linux EFI boot loaders and boot managers.
  • +
  • Phoenix Technologies maintains a wiki on EFI topics, including information on many EFI system calls useful to programmers.
  • +
  • Additional programs diff --git a/docs/refind/installing.html b/docs/refind/installing.html index 2209f88..e7dcaef 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/19/2012, referencing rEFInd 0.2.7

    +

    Originally written: 3/14/2012; last Web page update: 4/22/2012, referencing rEFInd 0.3.0

    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/linux.html b/docs/refind/linux.html index a2df431..9232a3b 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/19/2012, referencing rEFInd 0.2.7

    +

    Originally written: 3/19/2012; last Web page update: 4/22/2012, referencing rEFInd 0.3.0

    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 788d8f6..8b53c10 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/19/2012

    +

    Last Web page update: 4/22/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.com

      +
    • 0.3.0 (4/22/2012)—This version marks the official transition from alpha to beta status for rEFInd. This isn't because of any important objective milestone being passed; it's just that rEFInd has been used by many people who have reported no show-stopping bugs, so I'm now confident that rEFInd is stable enough for general use. That's not to say it's perfect; it still has numerous known bugs and limitations. That's why it's still beta. To get down to specifics, this version adds two new configuration file tokens: resolution, which sets the screen resolution; and scan_all_linux_kernels, which adds Linux kernel files to the boot loader list even if they lack .efi filename extensions. See the Configuring the Boot Manager page for details on these new options. I've also fixed some bugs: One that sometimes caused Macs to crash when returning from the EFI shell or other programs; another that caused rEFInd to fail to scan filesystems if the filesystem driver didn't return a volume name; and a third that caused rEFInd to fail to detect boot loaders depending on the case of the filename on some EFIs (this is really a workaround for an EFI implementation bug). The first of these is a very tentative fix and it could have negative effects on some systems (non-Mac EFI 1.x systems or Macs that weren't affected by the bug in other recent releases), so be sure to contact me if rEFInd crashes or otherwise misbehaves after you use an EFI shell.
    • +
    • 0.2.7 (4/19/2012)—I've added two new tokens to the refind.conf file, with associated new functionality. The new scan_driver_dirs option tells rEFInd where to scan for EFI drivers, in addition to the default of the drivers subdirectory of the rEFInd installation directory. For more on EFI drivers, see Using EFI Drivers. Note that previous versions of rEFInd couldn't load drivers at all, although they could make use of hardware and filesystems activated by drivers loaded before rEFInd launched. The second new token is also_scan_dirs, which adds arbitrary directories to the list that rEFInd scans for boot loaders. (Without this option, rEFInd scans each volume's boot directory and every subdirectory of the /EFI directory, with the exception of /EFI/tools and rEFInd's own directory.) This version also fixes a minor bug that caused rEFInd to sometimes include itself in the list of OS options. Finally, if you build rEFInd yourself, you should be aware that it now requires a newer version of the GNU-EFI library than it required in the past. See the BUILDING.txt file, included in the source code package, for details.
    • 0.2.6 (4/14/2012)—This version provides one bug fix and one new feature. The bug was introduced in version 0.2.5 and prevents rEFInd from identifying a Linux initial RAM disk file on some (but not all) EFI implementations. The new feature is the volume stanza token, which enables you to manually load a boot program from a filesystem other than the one from which rEFInd launched. You can specify a volume either by its label (as in volume KERNELS to load from the volume with a filesystem name KERNELS) or by number followed by a colon (as in volume 0: for the first filesystem or volume 1: for the second). See the Configuring the Boot Manager page for more on this new feature.
    • diff --git a/docs/refind/themes.html b/docs/refind/themes.html index 9e6ed32..2049bba 100644 --- a/docs/refind/themes.html +++ b/docs/refind/themes.html @@ -14,7 +14,7 @@

      by Roderick W. Smith, rodsmith@rodsbooks.com

      -

      Originally written: 4/19/2012; last Web page update: 4/19/2012, referencing rEFInd 0.2.7

      +

      Originally written: 4/19/2012; last Web page update: 4/22/2012, referencing rEFInd 0.3.0

      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/todo.html b/docs/refind/todo.html index 21e0738..09e78ea 100644 --- a/docs/refind/todo.html +++ b/docs/refind/todo.html @@ -14,7 +14,7 @@

      by Roderick W. Smith, rodsmith@rodsbooks.com

      -

      Originally written: 3/14/2012; last Web page update: 4/19/2012, referencing rEFInd 0.2.7

      +

      Originally written: 3/14/2012; last Web page update: 4/22/2012, referencing rEFInd 0.3.0

      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!

      @@ -97,7 +97,9 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com

        -
      • Testing! rEFIt was complex enough that changes such as the ones I've made have the potential to disrupt the program's operation in unexpected ways. I can only test on a handful of systems with a limited number of configurations. Therefore, if you try rEFInd and run into bugs, please report them to me!
      • +
      • Testing! rEFIt was complex enough that changes such as the ones I've made have the potential to disrupt the program's operation in unexpected ways. Since the initial 0.2.0 release, I've continued to add features to rEFInd, and every new feature is another way for bugs to get into the program. I can only test on a handful of systems with a limited number of configurations. Therefore, if you try rEFInd and run into bugs, please report them to me!
      • + +
      • Currently, rEFInd can detect whether it's compiled for x86 or x86-64 systems and displays this information in its "About" screen (AboutrEFInd() in main.c). I'd like to add detection for Itanium and ARM systems, but I have no way to test such changes.
      • I have little talent with graphics manipulation programs, so rEFInd's boot logo, such as it is, is pretty weak. If you have artistic talent and would like to create a rEFInd logo, please feel free to send it to me. I won't make any final decision about changes until at least June 30 of 2012.
      • @@ -111,7 +113,7 @@ them on the project's Sourceforge page). For more information on designing theme
      • The code could be more flexible in its handling of the sizes of various graphical elements, and particularly drawn text. Prior to version 0.2.2, submenu text was invisible on UEFI-based PCs with 800x600 and smaller displays because of an inability to properly crop the graphics fields that hold the text. With version 0.2.2, I've put a band-aid on this problem by reducing the field size so that it now works on 800x600 displays, but smaller displays still suffer from this problem. This is just an example of the inflexibility of certain layout issues within rEFInd.
      • -
      • I'd like to add a configuration option to set the screen resolution. Many computers seem to default to 800x600, even when the hardware can handle much higher resolutions. A higher resolution would enable fitting more OS tags on the screen at once. I haven't yet looked into the system calls that would enable such changes.
      • +
      • Text mode has a known display glitch: Not all loaders are shown until you use the cursor keys to move down the list, effectively "drawing" the "invisible" tags. This obviously needs to be fixed.
      • Although the ICNS file format used by rEFInd supports multiple image sizes, if a size that rEFInd needs isn't present in the file, rEFInd can't use the icon. The ability to scale images to the desired size would be useful.
      • @@ -123,11 +125,9 @@ them on the project's Sourceforge page). For more information on designing theme
      • There's currently no way to create a manual boot stanza for a BIOS-booted OS. This isn't a big priority for me personally, but I can see how it could be for some people.
      • -
      • I'd like to find a way to get rEFInd to launch BIOS boot loaders on UEFI-based systems. This option currently works only on Macs—or at least, I've not gotten it to work on any of my UEFI-based PCs.
      • - -
      • Returning from a program (such as an EFI shell or a boot loader that fails) produces an error message about a failure when "(re)opening our installation volume" on some computers. (Among mine, only a 32-bit Mac Mini produces this message.) In some cases, rEFInd then hangs. I don't fully understand its cause or why it doesn't appear on most systems. This needs investigating and fixing.
      • +
      • I'd like to find a way to get rEFInd to launch BIOS boot loaders on UEFI-based systems. This option currently works only on Macs—or at least, I've not gotten it to work on any of my UEFI-based PCs. (I have an idea about this, but haven't yet investigated it in detail. If you'd like to help on this, e-mail me for my thoughts.)
      • -
      • The Gigabyte Hybrid EFI has a bug that causes the allegedly case-insensitive StriCmp() function to perform a case-sensitive comparison. This causes any number of bugs in file matching. For instance: Changing the case of icon filename extensions (or various other parts of icon filenames) causes icons to be replaced by ugly "generic" ones; rEFInd sometimes appears in its own menu (the firmware sometimes returns an all-caps version of the filename, but other times returns the filename with the correct case, causing a mismatch if the path includes lowercase elements); and boot loaders will not be detected if their filenames use uppercase .EFI extensions. Some of these problems can be overcome by converting both strings to be compared to one case before doing the comparison, but others aren't so easy, since I think StriCmp() is being called internally to the EFI. In any event, it'd be nice to fix some of these problems. OTOH, this is a workaround for a bug on just one EFI implementation, and a dismal one at that, so I'm inclined to just let it go.
      • +
      • The Gigabyte Hybrid EFI has a bug that causes the allegedly case-insensitive StriCmp() function to perform a case-sensitive comparison. This causes any number of bugs in file matching. For instance: Changing the case of icon filename extensions (or various other parts of icon filenames) causes icons to be replaced by ugly "generic" ones; and rEFInd sometimes appears in its own menu (the firmware sometimes returns an all-caps version of the filename, but other times returns the filename with the correct case, causing a mismatch if the path includes lowercase elements). Some of these problems can be overcome by converting both strings to be compared to one case before doing the comparison, but others aren't so easy, since I think StriCmp() is being called internally to the EFI. In any event, it'd be nice to fix some of these problems. OTOH, this is a workaround for a bug on just one EFI implementation, and a dismal one at that, so I'm inclined to just let it go.
      • I've received queries about rEFInd's ability to work with Apple's whole-disk encryption scheme that's new with OS X 10.7. Unfortunately, I lack the hardware to test this.
      • @@ -135,6 +135,8 @@ them on the project's Sourceforge page). For more information on designing theme
      • I'd like to find a way to enable users to enter customizations for boot options and then save them to the refind.conf file.
      • +
      • Auto-detected boot loaders are currently displayed in an arbitrary order, aside from the crude internal/external/optical distinctions, which can be affected by the order of options in scanfor. I'd like to sort entries by file timestamp within each directory, with the newest entry first. This will be beneficial because using the directory name as the entry in default_selection will then return the most recent boot loader in that directory, which is most likely the desired result when you upgrade a Linux kernel with an EFI stub loader. (As it is, to guarantee use of the most recent kernel, you must update refind.conf.) There might also be other ways to sort entries to some beneficial end, but I haven't thought of any.
      • +
      • It should be possible to override specific auto-detected boot loader settings—say, to disable one specific boot loader or change its icon.
      • A way to read boot options set via efibootmgr, bless, or similar options from NVRAM to add to the boot set would be useful.
      • diff --git a/docs/refind/using.html b/docs/refind/using.html index d1999f1..d9f527a 100644 --- a/docs/refind/using.html +++ b/docs/refind/using.html @@ -14,7 +14,7 @@

        by Roderick W. Smith, rodsmith@rodsbooks.com

        -

        Originally written: 3/14/2012; last Web page update: 4/19/2012, referencing rEFInd 0.2.7

        +

        Originally written: 3/14/2012; last Web page update: 4/22/2012, referencing rEFInd 0.3.0

        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/libeg/efiGraphicsOutput.h b/libeg/efiGraphicsOutput.h deleted file mode 100644 index 7f80094..0000000 --- a/libeg/efiGraphicsOutput.h +++ /dev/null @@ -1,207 +0,0 @@ -/*++ - -Copyright (c) 2006, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - - GraphicsOutput.h - -Abstract: - - Graphics Output Protocol from the UEFI 2.0 specification. - - Abstraction of a very simple graphics device. - ---*/ - -#ifndef __GRAPHICS_OUTPUT_H__ -#define __GRAPHICS_OUTPUT_H__ - -#include - -#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \ - { \ - 0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a \ - } - -/* typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL; */ -struct _EFI_GRAPHICS_OUTPUT_PROTOCOL; - -typedef struct { - UINT32 RedMask; - UINT32 GreenMask; - UINT32 BlueMask; - UINT32 ReservedMask; -} EFI_PIXEL_BITMASK; - -typedef enum { - PixelRedGreenBlueReserved8BitPerColor, - PixelBlueGreenRedReserved8BitPerColor, - PixelBitMask, - PixelBltOnly, - PixelFormatMax -} EFI_GRAPHICS_PIXEL_FORMAT; - -typedef struct { - UINT32 Version; - UINT32 HorizontalResolution; - UINT32 VerticalResolution; - EFI_GRAPHICS_PIXEL_FORMAT PixelFormat; - EFI_PIXEL_BITMASK PixelInformation; - UINT32 PixelsPerScanLine; -} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION; - -typedef -EFI_STATUS -(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) ( - IN struct _EFI_GRAPHICS_OUTPUT_PROTOCOL *This, - IN UINT32 ModeNumber, - OUT UINTN *SizeOfInfo, - OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info - ) -/*++ - - Routine Description: - Return the current video mode information. - - Arguments: - This - Protocol instance pointer. - ModeNumber - The mode number to return information on. - SizeOfInfo - A pointer to the size, in bytes, of the Info buffer. - Info - A pointer to callee allocated buffer that returns information about ModeNumber. - - Returns: - EFI_SUCCESS - Mode information returned. - EFI_DEVICE_ERROR - A hardware error occurred trying to retrieve the video mode. - EFI_NOT_STARTED - Video display is not initialized. Call SetMode () - EFI_INVALID_PARAMETER - One of the input args was NULL. - ---*/ -; - -typedef -EFI_STATUS -(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) ( - IN struct _EFI_GRAPHICS_OUTPUT_PROTOCOL * This, - IN UINT32 ModeNumber - ) -/*++ - - Routine Description: - Return the current video mode information. - - Arguments: - This - Protocol instance pointer. - ModeNumber - The mode number to be set. - - Returns: - EFI_SUCCESS - Graphics mode was changed. - EFI_DEVICE_ERROR - The device had an error and could not complete the request. - EFI_UNSUPPORTED - ModeNumber is not supported by this device. - ---*/ -; - -typedef EFI_UGA_PIXEL EFI_GRAPHICS_OUTPUT_BLT_PIXEL; - -typedef union { - EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel; - UINT32 Raw; -} EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION; - -typedef enum { - EfiBltVideoFill, - EfiBltVideoToBltBuffer, - EfiBltBufferToVideo, - EfiBltVideoToVideo, - EfiGraphicsOutputBltOperationMax -} EFI_GRAPHICS_OUTPUT_BLT_OPERATION; - -typedef -EFI_STATUS -(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) ( - IN struct _EFI_GRAPHICS_OUTPUT_PROTOCOL * This, - IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL * BltBuffer, OPTIONAL - IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation, - IN UINTN SourceX, - IN UINTN SourceY, - IN UINTN DestinationX, - IN UINTN DestinationY, - IN UINTN Width, - IN UINTN Height, - IN UINTN Delta OPTIONAL - ); - -/*++ - - Routine Description: - The following table defines actions for BltOperations: - EfiBltVideoFill - Write data from the BltBuffer pixel (SourceX, SourceY) - directly to every pixel of the video display rectangle - (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). - Only one pixel will be used from the BltBuffer. Delta is NOT used. - EfiBltVideoToBltBuffer - Read data from the video display rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in - the BltBuffer rectangle (DestinationX, DestinationY ) - (DestinationX + Width, DestinationY + Height). If DestinationX or - DestinationY is not zero then Delta must be set to the length in bytes - of a row in the BltBuffer. - EfiBltBufferToVideo - Write data from the BltBuffer rectangle - (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the - video display rectangle (DestinationX, DestinationY) - (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is - not zero then Delta must be set to the length in bytes of a row in the - BltBuffer. - EfiBltVideoToVideo - Copy from the video display rectangle (SourceX, SourceY) - (SourceX + Width, SourceY + Height) .to the video display rectangle - (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height). - The BltBuffer and Delta are not used in this mode. - - Arguments: - This - Protocol instance pointer. - BltBuffer - Buffer containing data to blit into video buffer. This - buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL) - BltOperation - Operation to perform on BlitBuffer and video memory - SourceX - X coordinate of source for the BltBuffer. - SourceY - Y coordinate of source for the BltBuffer. - DestinationX - X coordinate of destination for the BltBuffer. - DestinationY - Y coordinate of destination for the BltBuffer. - Width - Width of rectangle in BltBuffer in pixels. - Height - Hight of rectangle in BltBuffer in pixels. - Delta - - - Returns: - EFI_SUCCESS - The Blt operation completed. - EFI_INVALID_PARAMETER - BltOperation is not valid. - EFI_DEVICE_ERROR - A hardware error occured writting to the video - buffer. - ---*/ -; - -typedef struct { - UINT32 MaxMode; - UINT32 Mode; - EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; - UINTN SizeOfInfo; - EFI_PHYSICAL_ADDRESS FrameBufferBase; - UINTN FrameBufferSize; -} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE; - -typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL { - EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode; - EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode; - EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt; - EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode; -} EFI_GRAPHICS_OUTPUT_PROTOCOL; - -extern EFI_GUID gEfiGraphicsOutputProtocolGuid; - -#endif diff --git a/libeg/image.c b/libeg/image.c index 2767195..4dac964 100644 --- a/libeg/image.c +++ b/libeg/image.c @@ -153,7 +153,7 @@ static EFI_STATUS egFindESP(OUT EFI_FILE_HANDLE *RootDir) EFI_STATUS Status; UINTN HandleCount = 0; EFI_HANDLE *Handles; - + Status = LibLocateHandle(ByProtocol, &ESPGuid, NULL, &HandleCount, &Handles); if (!EFI_ERROR(Status) && HandleCount > 0) { *RootDir = LibOpenRoot(Handles[0]); diff --git a/libeg/libegint.h b/libeg/libegint.h index 6bcdf1d..1b2cff8 100644 --- a/libeg/libegint.h +++ b/libeg/libegint.h @@ -49,6 +49,8 @@ typedef EG_IMAGE * (*EG_DECODE_FUNC)(IN UINT8 *FileData, IN UINTN FileDataLength /* functions */ +BOOLEAN egSetScreenSize(IN UINTN ScreenWidth, IN UINTN ScreenHeight); + VOID egRestrictImageArea(IN EG_IMAGE *Image, IN UINTN AreaPosX, IN UINTN AreaPosY, IN OUT UINTN *AreaWidth, IN OUT UINTN *AreaHeight); diff --git a/libeg/screen.c b/libeg/screen.c index 1fa517a..a183578 100644 --- a/libeg/screen.c +++ b/libeg/screen.c @@ -35,6 +35,7 @@ */ #include "libegint.h" +#include "../refind/screen.h" #include "refit_call_wrapper.h" #include @@ -62,7 +63,7 @@ static UINTN egScreenHeight = 600; VOID egInitScreen(VOID) { - EFI_STATUS Status; + EFI_STATUS Status = EFI_SUCCESS; UINT32 UGAWidth, UGAHeight, UGADepth, UGARefreshRate; // get protocols @@ -96,6 +97,68 @@ VOID egInitScreen(VOID) } } +// Sets the screen resolution to the specified value, if possible. +// If the specified value is not valid, displays a warning with the valid +// modes on UEFI systems, or silently fails on EFI 1.x systems. Note that +// this function attempts to set ANY screen resolution, even 0x0 or +// ridiculously large values. +// Returns TRUE if successful, FALSE if not. +BOOLEAN egSetScreenSize(IN UINTN ScreenWidth, IN UINTN ScreenHeight) { + EFI_STATUS Status = EFI_SUCCESS; + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; + UINT32 ModeNum = 0; + UINTN Size; + BOOLEAN ModeSet = FALSE; + UINT32 UGAWidth, UGAHeight, UGADepth, UGARefreshRate; + + if (GraphicsOutput != NULL) { // GOP mode (UEFI) + // Do a loop through the modes to see if the specified one is available; + // and if so, switch to it.... + while ((Status == EFI_SUCCESS) && (!ModeSet)) { + Status = refit_call4_wrapper(GraphicsOutput->QueryMode, GraphicsOutput, ModeNum, &Size, &Info); + if ((Status == EFI_SUCCESS) && (Size >= sizeof(*Info)) && + (Info->HorizontalResolution == ScreenWidth) && (Info->VerticalResolution == ScreenHeight)) { + Status = refit_call2_wrapper(GraphicsOutput->SetMode, GraphicsOutput, ModeNum); + ModeSet = (Status == EFI_SUCCESS); + } // if + ModeNum++; + } // while() + + if (ModeSet) { + egScreenWidth = ScreenWidth; + egScreenHeight = ScreenHeight; + } else {// If unsuccessful, display an error message for the user.... + Print(L"Error setting mode %d x %d; using default mode!\nAvailable modes are:\n", ScreenWidth, ScreenHeight); + ModeNum = 0; + Status = EFI_SUCCESS; + while (Status == EFI_SUCCESS) { + Status = refit_call4_wrapper(GraphicsOutput->QueryMode, GraphicsOutput, ModeNum, &Size, &Info); + if ((Status == EFI_SUCCESS) && (Size >= sizeof(*Info))) { + Print(L"Mode %d: %d x %d\n", ModeNum, Info->HorizontalResolution, Info->VerticalResolution); + } // else + ModeNum++; + } // while() + PauseForKey(); + } // if() + } else if (UgaDraw != NULL) { // UGA mode (EFI 1.x) + // Try to use current color depth & refresh rate for new mode. Maybe not the best choice + // in all cases, but I don't know how to probe for alternatives.... + Status = refit_call5_wrapper(UgaDraw->GetMode, UgaDraw, &UGAWidth, &UGAHeight, &UGADepth, &UGARefreshRate); + Status = refit_call5_wrapper(UgaDraw->SetMode, UgaDraw, ScreenWidth, ScreenHeight, UGADepth, UGARefreshRate); + if (Status == EFI_SUCCESS) { + egScreenWidth = ScreenWidth; + egScreenHeight = ScreenHeight; + ModeSet = TRUE; + } else { + // TODO: Find a list of supported modes and display it. + // NOTE: Below doesn't actually appear unless we explicitly switch to text mode. + // This is just a placeholder until something better can be done.... + Print(L"Error setting mode %d x %d; unsupported mode!\n"); + } // if/else + } // if/else if + return (ModeSet); +} // BOOLEAN egSetScreenSize() + VOID egGetScreenSize(OUT UINTN *ScreenWidth, OUT UINTN *ScreenHeight) { if (ScreenWidth != NULL) @@ -129,12 +192,12 @@ BOOLEAN egHasGraphicsMode(VOID) BOOLEAN egIsGraphicsModeEnabled(VOID) { EFI_CONSOLE_CONTROL_SCREEN_MODE CurrentMode; - + if (ConsoleControl != NULL) { refit_call4_wrapper(ConsoleControl->GetMode, ConsoleControl, &CurrentMode, NULL, NULL); return (CurrentMode == EfiConsoleControlScreenGraphics) ? TRUE : FALSE; } - + return FALSE; } @@ -160,15 +223,15 @@ VOID egSetGraphicsModeEnabled(IN BOOLEAN Enable) VOID egClearScreen(IN EG_PIXEL *Color) { EFI_UGA_PIXEL FillColor; - + if (!egHasGraphics) return; - + FillColor.Red = Color->r; FillColor.Green = Color->g; FillColor.Blue = Color->b; FillColor.Reserved = 0; - + if (GraphicsOutput != NULL) { // EFI_GRAPHICS_OUTPUT_BLT_PIXEL and EFI_UGA_PIXEL have the same // layout, and the header from TianoCore actually defines them @@ -185,7 +248,7 @@ VOID egDrawImage(IN EG_IMAGE *Image, IN UINTN ScreenPosX, IN UINTN ScreenPosY) { if (!egHasGraphics) return; - + if (Image->HasAlpha) { Image->HasAlpha = FALSE; egSetPlane(PLPTR(Image, a), 0, Image->Width * Image->Height); diff --git a/refind.conf-sample b/refind.conf-sample index 26ee27b..882e437 100644 --- a/refind.conf-sample +++ b/refind.conf-sample @@ -45,6 +45,18 @@ timeout 20 # #textonly +# Set the screen's video resolution. Pass this option two values, +# corresponding to the X and Y resolutions. Note that not all resolutions +# are supported. On UEFI systems, passing an incorrect value results in a +# message being shown on the screen to that effect, along with a list of +# supported modes. On EFI 1.x systems (e.g., Macintoshes), setting an +# incorrect mode silently fails. On both types of systems, setting an +# incorrect resolution results in the default resolution being used. +# A resolution of 1024x768 usually works, but higher values often don't. +# Default is "0 0" (use the system default resolution, usually 800x600). +# +#resolution 1024 768 + # Which non-bootloader tools to show on the tools line, and in what # order to display them: # shell - the EFI shell diff --git a/refind/config.c b/refind/config.c index f08d3dc..0a15cc6 100644 --- a/refind/config.c +++ b/refind/config.c @@ -175,15 +175,15 @@ static CHAR16 *ReadLine(REFIT_FILE *File) *q++ = *p++; } *q = 0; - + } else if (File->Encoding == ENCODING_UTF16_LE) { - + CHAR16 *p, *LineStart, *LineEnd; - + p = File->Current16Ptr; if (p >= File->End16Ptr) return NULL; - + LineStart = p; for (; p < File->End16Ptr; p++) if (*p == 13 || *p == 10) @@ -193,19 +193,19 @@ static CHAR16 *ReadLine(REFIT_FILE *File) if (*p != 13 && *p != 10) break; File->Current16Ptr = p; - + LineLength = (UINTN)(LineEnd - LineStart) + 1; Line = AllocatePool(LineLength * sizeof(CHAR16)); if (Line == NULL) return NULL; - + for (p = LineStart, q = Line; p < LineEnd; ) *q++ = *p++; *q = 0; - + } else return NULL; // unsupported encoding - + return Line; } @@ -410,6 +410,10 @@ VOID ReadConfig(VOID) } else if (StriCmp(TokenList[0], L"textonly") == 0) { GlobalConfig.TextOnly = TRUE; + } else if ((StriCmp(TokenList[0], L"resolution") == 0) && (TokenCount == 3)) { + GlobalConfig.RequestedScreenWidth = Atoi(TokenList[1]); + GlobalConfig.RequestedScreenHeight = Atoi(TokenList[2]); + } else if (StriCmp(TokenList[0], L"scan_all_linux_kernels") == 0) { GlobalConfig.ScanAllLinux = TRUE; diff --git a/refind/global.h b/refind/global.h index d4e8aaa..2cd9b37 100644 --- a/refind/global.h +++ b/refind/global.h @@ -153,6 +153,8 @@ typedef struct { typedef struct { BOOLEAN TextOnly; BOOLEAN ScanAllLinux; + UINTN RequestedScreenWidth; + UINTN RequestedScreenHeight; UINTN Timeout; UINTN HideUIFlags; UINTN MaxTags; // max. number of OS entries to show simultaneously in graphics mode diff --git a/refind/main.c b/refind/main.c index 03b53cc..35c125a 100644 --- a/refind/main.c +++ b/refind/main.c @@ -85,7 +85,7 @@ static REFIT_MENU_ENTRY MenuEntryExit = { L"Exit rEFInd", TAG_EXIT, 1, 0, 0, static REFIT_MENU_SCREEN MainMenu = { L"Main Menu", NULL, 0, NULL, 0, NULL, 0, L"Automatic boot" }; static REFIT_MENU_SCREEN AboutMenu = { L"About", NULL, 0, NULL, 0, NULL, 0, NULL }; -REFIT_CONFIG GlobalConfig = { FALSE, FALSE, 20, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, +REFIT_CONFIG GlobalConfig = { FALSE, FALSE, 0, 0, 20, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, {TAG_SHELL, TAG_ABOUT, TAG_SHUTDOWN, TAG_REBOOT, 0, 0, 0, 0, 0 }}; // @@ -96,7 +96,7 @@ static VOID AboutrEFInd(VOID) { if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.2.7.3"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.3.0"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012 Roderick W. Smith"); diff --git a/refind/screen.c b/refind/screen.c index fe57a23..86407f4 100644 --- a/refind/screen.c +++ b/refind/screen.c @@ -37,6 +37,7 @@ #include "global.h" #include "screen.h" #include "config.h" +#include "libegint.h" #include "refit_call_wrapper.h" #include "egemb_refind_banner.h" @@ -73,10 +74,10 @@ static BOOLEAN haveError = FALSE; VOID InitScreen(VOID) { UINTN i; - + // initialize libeg egInitScreen(); - + if (egHasGraphicsMode()) { egGetScreenSize(&UGAWidth, &UGAHeight); AllowGraphicsMode = TRUE; @@ -85,23 +86,23 @@ VOID InitScreen(VOID) egSetGraphicsModeEnabled(FALSE); // just to be sure we are in text mode } GraphicsScreenDirty = TRUE; - + // disable cursor refit_call2_wrapper(ST->ConOut->EnableCursor, ST->ConOut, FALSE); - + // get size of text console if (refit_call4_wrapper(ST->ConOut->QueryMode, ST->ConOut, ST->ConOut->Mode->Mode, &ConWidth, &ConHeight) != EFI_SUCCESS) { // use default values on error ConWidth = 80; ConHeight = 25; } - + // make a buffer for a whole text line BlankLine = AllocatePool((ConWidth + 1) * sizeof(CHAR16)); for (i = 0; i < ConWidth; i++) BlankLine[i] = ' '; BlankLine[i] = 0; - + // show the banner (even when in graphics mode) DrawScreenHeader(L"Initializing..."); } @@ -112,10 +113,15 @@ VOID SetupScreen(VOID) // switch to text mode if requested AllowGraphicsMode = FALSE; SwitchToText(FALSE); - + } else if (AllowGraphicsMode) { // clear screen and show banner // (now we know we'll stay in graphics mode) + if ((GlobalConfig.RequestedScreenWidth > 0) && (GlobalConfig.RequestedScreenHeight > 0) && + egSetScreenSize(GlobalConfig.RequestedScreenWidth, GlobalConfig.RequestedScreenHeight)) { + UGAWidth = GlobalConfig.RequestedScreenWidth; + UGAHeight = GlobalConfig.RequestedScreenHeight; + } // if user requested a particular screen resolution SwitchToGraphics(); BltClearScreen(TRUE); } @@ -143,7 +149,7 @@ VOID BeginTextScreen(IN CHAR16 *Title) { DrawScreenHeader(Title); SwitchToText(FALSE); - + // reset error flag haveError = FALSE; } @@ -154,7 +160,7 @@ VOID FinishTextScreen(IN BOOLEAN WaitAlways) SwitchToText(FALSE); PauseForKey(); } - + // reset error flag haveError = FALSE; } @@ -163,18 +169,18 @@ VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CHAR16 *Title) { if (!AllowGraphicsMode) UseGraphicsMode = FALSE; - + if (UseGraphicsMode) { SwitchToGraphics(); BltClearScreen(FALSE); } - + // show the header DrawScreenHeader(Title); - + if (!UseGraphicsMode) SwitchToText(TRUE); - + // reset error flag haveError = FALSE; } @@ -183,12 +189,12 @@ VOID FinishExternalScreen(VOID) { // make sure we clean up later GraphicsScreenDirty = TRUE; - + if (haveError) { SwitchToText(FALSE); PauseForKey(); } - + // reset error flag haveError = FALSE; } @@ -236,7 +242,7 @@ static BOOLEAN ReadAllKeyStrokes(VOID) BOOLEAN GotKeyStrokes; EFI_STATUS Status; EFI_INPUT_KEY key; - + GotKeyStrokes = FALSE; for (;;) { Status = refit_call2_wrapper(ST->ConIn->ReadKeyStroke, ST->ConIn, &key); @@ -259,10 +265,10 @@ VOID PauseForKey(VOID) refit_call1_wrapper(BS->Stall, 5000000); // 5 seconds delay ReadAllKeyStrokes(); // empty the buffer again } - + refit_call3_wrapper(BS->WaitForEvent, 1, &ST->ConIn->WaitForKey, &index); ReadAllKeyStrokes(); // empty the buffer to protect the menu - + Print(L"\n"); } @@ -272,7 +278,7 @@ VOID DebugPause(VOID) // show console and wait for key SwitchToText(FALSE); PauseForKey(); - + // reset error flag haveError = FALSE; } @@ -281,7 +287,7 @@ VOID DebugPause(VOID) VOID EndlessIdleLoop(VOID) { UINTN index; - + for (;;) { ReadAllKeyStrokes(); refit_call3_wrapper(BS->WaitForEvent, 1, &ST->ConIn->WaitForKey, &index); @@ -295,34 +301,34 @@ VOID EndlessIdleLoop(VOID) BOOLEAN CheckFatalError(IN EFI_STATUS Status, IN CHAR16 *where) { CHAR16 ErrorName[64]; - + if (!EFI_ERROR(Status)) return FALSE; - + StatusToString(ErrorName, Status); refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_ERROR); Print(L"Fatal Error: %s %s\n", ErrorName, where); refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_BASIC); haveError = TRUE; - + //BS->Exit(ImageHandle, ExitStatus, ExitDataSize, ExitData); - + return TRUE; } BOOLEAN CheckError(IN EFI_STATUS Status, IN CHAR16 *where) { CHAR16 ErrorName[64]; - + if (!EFI_ERROR(Status)) return FALSE; - + StatusToString(ErrorName, Status); refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_ERROR); Print(L"Error: %s %s\n", ErrorName, where); refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_BASIC); haveError = TRUE; - + return TRUE; } @@ -351,18 +357,18 @@ VOID BltClearScreen(IN BOOLEAN ShowBanner) if (Banner != NULL) MenuBackgroundPixel = Banner->PixelData[0]; } - + // clear and draw banner egClearScreen(&MenuBackgroundPixel); if (Banner != NULL) BltImage(Banner, (UGAWidth - Banner->Width) >> 1, ((UGAHeight - LAYOUT_TOTAL_HEIGHT) >> 1) + LAYOUT_BANNER_HEIGHT - Banner->Height); - + } else { // clear to standard background color egClearScreen(&StdBackgroundPixel); } - + GraphicsScreenDirty = FALSE; }