From owner-freebsd-hackers@freebsd.org Wed Nov 25 02:27:05 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4DD3A37F1C for ; Wed, 25 Nov 2015 02:27:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 795271096 for ; Wed, 25 Nov 2015 02:27:05 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7BABFB923; Tue, 24 Nov 2015 21:27:01 -0500 (EST) From: John Baldwin To: freebsd-hackers@freebsd.org Cc: Rui Paulo , Ganael Laplanche , Emmanuel Vadot , 'Warner Losh' Subject: Re: EFI Variables Date: Tue, 24 Nov 2015 18:15:29 -0800 Message-ID: <1547195.8ivBxpzumr@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <1446064708.28809.77.camel@me.com> References: <6ce779725aab266bc85e92f0ee2186b6@megadrive.org> <201510280727.19357.ganael.laplanche@corp.ovh.com> <1446064708.28809.77.camel@me.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 24 Nov 2015 21:27:01 -0500 (EST) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2015 02:27:05 -0000 On Wednesday, October 28, 2015 01:38:28 PM Rui Paulo wrote: > On Wed, 2015-10-28 at 07:27 +0100, Ganael Laplanche wrote: > > On Tuesday, October 27, 2015 07:24:23 PM Emmanuel Vadot wrote: > > > > Hi Emmanuel, > > > > > I'm currently hacking around the loader.efi > > > > Great :) > > > > > I've also added the list and get command to the not working > > > "nvram" > > > command. > > > > I had myself posted a PR to fix that command as well as add a verbose > > switch > > and the ability to specify a variable name, see : > > > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202614 > > > > > For the "set" subcommand I think that the best way to handle it > > > is : > > > "nvram set myvar data" -> This will set the variable myvar to > > > data with > > > the freebsd guid (if there is any) > > > > > > and > > > > > > "nvram set myvar guid data" -> This will force the guid to > > > > It can be useful to set variables containing *strings*, but will > > hardly handle > > binary stuff :/ > > > > I am not sure whether it should be the loader's job to set > > variables... I can > > think of changing the boot order, but it may be difficult to get it > > right by > > hand and would probably require an upper-level tool, such as > > efibootmgr on > > Linux. > > > > > I'll look tomorrow how to access efivars once the kernel is > > > booted so > > > we can set some from some userland tool (especially the boot > > > related > > > one). > > > > Yes, this is interesting as the current kernel (amd64) does not > > provide access > > to EFI variables at all. > > > > 10.x/ia64 provided access to EFI variables through libefi(3) and > > io(4). It > > should be possible to import that code to other archs too, but you'll > > have to > > save the entry point to the Runtime Services Tables and maybe set a > > Virtual > > Address Map too (not sure about that point). > > > > It would be nice to set some EFI variables in the loader, but you can't > expect to handle binary data from the loader. Like you said, we need a > special tool to change EFI variables on a system already running > FreeBSD. I belive Warner has been working on adding more support for EFI runtime services to FreeBSD multiuser which might permit this. -- John Baldwin