From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VgLuf-0004wG-Po for mharc-grub-devel@gnu.org; Tue, 12 Nov 2013 16:54:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgLuZ-0004vE-70 for grub-devel@gnu.org; Tue, 12 Nov 2013 16:54:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VgLuT-0000oq-RQ for grub-devel@gnu.org; Tue, 12 Nov 2013 16:54:15 -0500 Received: from mail-qe0-x22b.google.com ([2607:f8b0:400d:c02::22b]:52379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgLuT-0000od-Mn for grub-devel@gnu.org; Tue, 12 Nov 2013 16:54:09 -0500 Received: by mail-qe0-f43.google.com with SMTP id nc12so5979483qeb.2 for ; Tue, 12 Nov 2013 13:54:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=uHH6B8gk9BENpc6yaNODmSbx8iIOLK3Xp7QIOtd7n7g=; b=Ryl4Tz4xNT9sFKOwzkN8Rhv6Yj/8SYUw8Jv7BGq0uAUTY2ZLIwQA20jp1JFk8Q2Wdt 8lXkFO66VjNyu6+yEGEKvtrgB1Mjd+0UjONKJWgc9OLtf7TJpuTF9Bxz1VaXR/OJIlIv wjyyArRyyZNRXP1hPXtLLPJS/KdsgJe7ta/HLdTCxneihrdGS6AEWQM3iWZGkvr34NbE SQtxy5mG6L8l9IMjAQeValm5bmdDGHC0/gyGmhFURBG4nWW+bMdNh05awMS/qZsfd7a+ PbyPcvkIUXaTbwVZiPS+6EPvlob9Nl6FuAaiX1TbxOODEV3LAzteoyleICwg+zZ3NHPc KZPA== X-Received: by 10.224.171.66 with SMTP id g2mr15663644qaz.54.1384293248875; Tue, 12 Nov 2013 13:54:08 -0800 (PST) Received: from [10.0.0.14] (c-50-169-245-128.hsd1.nh.comcast.net. [50.169.245.128]) by mx.google.com with ESMTPSA id q15sm23145063qac.12.2013.11.12.13.54.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Nov 2013 13:54:08 -0800 (PST) Message-ID: <5282A378.7040207@gmail.com> Date: Tue, 12 Nov 2013 16:54:00 -0500 From: SevenBits User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Feature Request: add a command to get/set (U)EFI firmware variables Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c02::22b X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Nov 2013 21:54:20 -0000 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 systems. 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: http://bit.ly/1j2COHX ). 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 ... else linux ... initrd ... fi 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 idea? Sorry for this long-winded post. :) -- SevenBits