[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Feature Request: add a command to get/set (U)EFI firmware variables

From: SevenBits
Subject: Feature Request: add a command to get/set (U)EFI firmware variables
Date: Tue, 12 Nov 2013 16:54:00 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

Greetings everyone:

I want to request a feature for GRUB that will improve on its usability
on the (U)EFI platform. Specifically, a command to get/set (U)EFI
firmware variables using (U)EFI system calls. Let me take a moment to
explain why it is necessary and what it could be used for.

For those who don't know, (U)EFI is a new firmware specification to
replace BIOS. Unlike BIOS, however, it includes a small firmware
environment similar to those found in MS/DOS or other small operating

I am the developer of Mac Linux USB Loader and Enterprise, a combination
of tools to allow Linux distributions without (U)EFI support to boot
from USB on Intel-based Apple Macintosh computers. While some
distributions like Ubuntu and Fedora are making progress, generally
speaking their solutions don't work well on Macs due to various quirks
and inconsistencies in Apple's implementation of (U)EFI.

Currently, to boot USB drives, I am using a pre-compiled image of GRUB 2
for (U)EFI to boot a Linux distribution from an ISO file using GRUB's
loop back and iso9660 file system support. Sadly, the image was
downloaded from the web, was likely modified, is incompatible with many
distributions of GNU/Linux and, unfortunately, appears to use a modified
copy of GRUB without providing source code. For these reasons I am
developing my own solution, Enterprise, to fix these problems.

In my current build of Enterprise, I have compiled GRUB to use the
provided distribution's loopback.cfg file to boot. Sadly, this has not
been a pleasant experience as all distributions have these files set up
differently, and some do not include them at all.

So, what I have currently is a (U)EFI executable that guides the user
through figuring out which Linux kernel options would assist them in
booting Linux on their Macs (more info can be found here on my blog at: ). My trouble is getting the information from
Enterprise and my compiled GRUB image. So, I intend to set the boot
options using (U)EFI firmware variables created using (U)EFI's
RT->SetVariable and RT->GetVariable calls. Now I just need the
equivalent functionality in GRUB, accessible from GRUB "functions" that
are callable from GRUB's normal module and configuration (grub.cfg)
files. The results would be saved to variables.

This would not only be useful for me. Others could use this, for
instance, to detect what (U)EFI firmware version that they have and boot
different GNU/Linux distributions, or check for other things. For
example, you could do something like:

set firmware_version=getuefivar 'LoaderFirmwareVendor'
export firmware_version


if [ ${firmware_version} == 'Apple' ]; then
        linux ...
        initrd ...
        linux ...
        initrd ...

I'm fluent in C, am somewhat knowledgeable of the (U)EFI system, and am
not afraid to modify GRUB's source code. What do you guys think of this

Sorry for this long-winded post. :)

-- SevenBits

reply via email to

[Prev in Thread] Current Thread [Next in Thread]