From owner-freebsd-hackers@freebsd.org Mon Nov 30 21:19:57 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 55919A3DAD4 for ; Mon, 30 Nov 2015 21:19:57 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qg0-x22e.google.com (mail-qg0-x22e.google.com [IPv6:2607:f8b0:400d:c04::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1069B1EE3 for ; Mon, 30 Nov 2015 21:19:56 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by qgeb1 with SMTP id b1so130444875qge.1 for ; Mon, 30 Nov 2015 13:19:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=HAl638dzCv3NXEbzAZiJ+W8CC3bDiG+k4Nmn+ZR8s3Y=; b=evM9EILEph4wCiEbM8KzKBQ/Xg23OJxGIVwDpCxWgnGZsUKqQjjCzUxnKCeTxKrDYh BJWR7vaNL7bwiqCEx3lul+hjgCc8or3h6YUw2jdTSPhenlb670hwfHqbIbp5NtIRr1Pm z4s54kgw85Vo220w7Spm441dop2Ikt0yvQlPthunZH101UrhwH1dc/2FiN075rzgjwnm naiiCwJrLeL7oMnqiOxtKFEbDzvjVJg83SsFPK0rrmmQPI2IeE+seYkykWTlEStbsMoI 661NS2uU9H9zBPkGzHlOOHSEg7+MsT9qYSXtTi2Nhh11HV+2ZYQzgZeSwn205XBdIc4f iTZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=HAl638dzCv3NXEbzAZiJ+W8CC3bDiG+k4Nmn+ZR8s3Y=; b=g6e5yFqH68i5O2fL3kjbYggy14CQbHmO1gOUGoi0Va1+a7UkfOfamTxADQYFnp2svK 5kbM9s69wrHx2kHM9twOSD9cNh5R6Sg4mCgVF68tpK5ZLNpPMLZMDisF7koT/htLD4v6 tzCFPXTw7NHueCz2XG2LY26j9D3i/9TlrsYllFad+Pw4tobrZNzyYcruEvQplrakUTGu wlXGv7EJ6CLAJox62mBRTUZ2Uguo4XM7V7FC0H6lM0obCGImKUaeyZAmQpjUaKwrS+tD jnUkzv/OPgNy3EivvttBVbLnL1vKB4XxPNBCecMhYA++aNfrRkC9Gam0aLrpiXs8fF8r wnUA== X-Gm-Message-State: ALoCoQlGarZhCEn3G6acN8C277zbrJgK38G/CaFgu1BUPkFRZtaNgYF7DhCvRAQiChOdwN0xHOcb MIME-Version: 1.0 X-Received: by 10.140.196.69 with SMTP id r66mr81392602qha.40.1448918395953; Mon, 30 Nov 2015 13:19:55 -0800 (PST) Sender: wlosh@bsdimp.com Received: by 10.140.27.181 with HTTP; Mon, 30 Nov 2015 13:19:55 -0800 (PST) X-Originating-IP: [69.53.245.31] In-Reply-To: <1547195.8ivBxpzumr@ralph.baldwin.cx> References: <6ce779725aab266bc85e92f0ee2186b6@megadrive.org> <201510280727.19357.ganael.laplanche@corp.ovh.com> <1446064708.28809.77.camel@me.com> <1547195.8ivBxpzumr@ralph.baldwin.cx> Date: Mon, 30 Nov 2015 14:19:55 -0700 X-Google-Sender-Auth: XHILMmES8yv8MpUzJ7xTkptJBf4 Message-ID: Subject: Re: EFI Variables From: Warner Losh To: John Baldwin Cc: "freebsd-hackers@freebsd.org" , Rui Paulo , Ganael Laplanche , Emmanuel Vadot Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 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: Mon, 30 Nov 2015 21:19:57 -0000 On Tue, Nov 24, 2015 at 7:15 PM, John Baldwin wrote: > 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. > I'll see if I can get them in.... Warner