From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1a1JBj-00013n-30 for mharc-grub-devel@gnu.org; Tue, 24 Nov 2015 14:23:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1JBf-00012S-MQ for grub-devel@gnu.org; Tue, 24 Nov 2015 14:23:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1JBe-0002Qt-Ib for grub-devel@gnu.org; Tue, 24 Nov 2015 14:23:35 -0500 Received: from mail-io0-x235.google.com ([2607:f8b0:4001:c06::235]:35385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1JBe-0002Qp-Bx for grub-devel@gnu.org; Tue, 24 Nov 2015 14:23:34 -0500 Received: by ioc74 with SMTP id 74so30837555ioc.2 for ; Tue, 24 Nov 2015 11:23:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=UaJjr+tRAQnJ1keYxAWpDdagd9aYqXxFHt8qeY6hb8Y=; b=vcJG2RibiI6OLbei9qXW5Z21RHrzHa8hdOZI6PDH+9V/Eue/U4mcY4HFzb8ZUoyIS5 MEYsPpi6nkGqeOc2ndXnFVRaCjCiT+VoQxoxSC7KyMFn5kLDb/zeTodD5gBw7gt5Igla tb+BPAVXIt0HtB70yu/8SSz54a5SctsLCxEaFzWv+vGASbVAZx9mPYidmcSGIsCH9rS4 RnacFrRIA+SxsEK/uRE4FBiq+LAaUMScXEATRe0+Parvy3uAZIC5R5h4/aRxCBTCH2uv X86v3bMauMXGFtGVadwkMvCFmDIAZk1FX3QRSQqkXCWGsMDeeMMJ1pc3mbhE/Wi6OFIF 9FJQ== MIME-Version: 1.0 X-Received: by 10.107.11.166 with SMTP id 38mr32608666iol.186.1448393013646; Tue, 24 Nov 2015 11:23:33 -0800 (PST) Received: by 10.36.51.74 with HTTP; Tue, 24 Nov 2015 11:23:33 -0800 (PST) In-Reply-To: <5646B275.5040707@gmail.com> References: <563999B9.7020108@gmail.com> <5643845E.9060204@gmail.com> <5646B275.5040707@gmail.com> Date: Tue, 24 Nov 2015 11:23:33 -0800 Message-ID: Subject: Re: Grub get and set efi variables From: Mat Troi To: The development of GNU GRUB Content-Type: multipart/alternative; boundary=001a113ed81812d9f305254e4747 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c06::235 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, 24 Nov 2015 19:23:37 -0000 --001a113ed81812d9f305254e4747 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable For a specific project implementation, I need to be able to write and read one EFI variable during boot only. So I have written a grub command to do just that. But the issue is with setting these attributes to the variable (GRUB_EFI_VARIABLE_NON_VOLATILE, GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS), I am not able to modify it during boot on some platform. Since this is so specific, I am wondering if anyone has seen similar issue? On Fri, Nov 13, 2015 at 8:03 PM, Andrei Borzenkov wrote: > 13.11.2015 22:42, Ignat Korchagin =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > >> +static enum efi_var_type >>>>> +parse_efi_var_type (const char *type) >>>>> +{ >>>>> + if (!grub_strncmp (type, "string", sizeof("string"))) >>>>> + return EFI_VAR_STRING; >>>>> + >>>>> >>>> >>>> >>>> I think this should be "ascii" or "utf8". "string" is too ambiguous in >>>> UEFI >>>> environment, it can also mean sequence of UCS-2 characters. >>>> >>> I'm still not sure how exactly GRUB + UEFI interprets "raw buffers" >>> when printing. Maybe, to avoid confusion, it might be better to >>> completely remove this option. Basically, you do not want to interpret >>> raw buffers as strings. For best compatibility "hex" mode should be >>> promoted, I guess. What do you think? >>> >> Checked again the UEFI spec. For globally defined variables which are >> strings they specify ASCII. So if we leave this option, ascii is the >> best name. >> >> > What about > > - ascii - print ASCII characters verbatim, escape non-ASCII in usual wa= y > (similar to "od -c") > > - raw - simply put raw variable without any interpretation. > > This is better aligned with argument describing output formatting rather > than attempting to "type" variable. > > Alternative (or in addition to) ascii - dump which prints usual pretty he= x > dump of content (hexdump -C). This is handy to interactively look at > variable content. > > Or, and change name from --type to --format :) > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel > --001a113ed81812d9f305254e4747 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
For a specific project implementation, I need to be able t= o write and read one EFI variable during boot only.=C2=A0 So I have written= a grub command to do just that.=C2=A0 But the issue is with setting these = attributes to the variable (GRUB_EFI_VARIABLE_NON_VOLATILE, GRUB_EFI_VARIABLE_BOOTSERVICE_ACCESS), I am not able to modify it durin= g boot on some platform.=C2=A0 Since this is so specific, I am wondering if= anyone has seen similar issue?

On Fri, Nov 13, 2015 at 8:03 PM, Andrei Borzenkov <= arvidjaar@gmail.com> wrote:
13.11.2015 22:42, Ignat Korchagin =D0=BF=D0=B8=D1=88=D0=B5=D1=82:
+static enum efi_var_type
+parse_efi_var_type (const char *type)
+{
+=C2=A0 if (!grub_strncmp (type, "string", sizeof("string&qu= ot;)))
+=C2=A0 =C2=A0 return EFI_VAR_STRING;
+


I think this should be "ascii" or "utf8". "string&= quot; is too ambiguous in UEFI
environment, it can also mean sequence of UCS-2 characters.
I'm still not sure how exactly GRUB + UEFI interprets "raw buffers= "
when printing. Maybe, to avoid confusion, it might be better to
completely remove this option. Basically, you do not want to interpret
raw buffers as strings. For best compatibility "hex" mode should = be
promoted, I guess. What do you think?
Checked again the UEFI spec. For globally defined variables which are
strings they specify ASCII. So if we leave this option, ascii is the
best name.


What about

=C2=A0 - ascii - print ASCII characters verbatim, escape non-ASCII in usual= way (similar to "od -c")

=C2=A0 - raw - simply put raw variable without any interpretation.

This is better aligned with argument describing output formatting rather th= an attempting to "type" variable.

Alternative (or in addition to) ascii - dump which prints usual pretty hex = dump of content (hexdump -C). This is handy to interactively look at variab= le content.

Or, and change name from --type to --format :)


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org<= /a>
https://lists.gnu.org/mailman/listinfo/grub-devel

--001a113ed81812d9f305254e4747--