public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Accessing global variables from Shell
@ 2017-07-03  7:18 Udit Kumar
  2017-07-03 18:13 ` Laszlo Ersek
  0 siblings, 1 reply; 3+ messages in thread
From: Udit Kumar @ 2017-07-03  7:18 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Dear Edk2, 

I am trying to create one global variables, and access that from shell. 
If I am using gEfiGlobalVariableGuid to create variable then I could access it perfectly ok ,  If I use other Guid (even vendor guid) then I couldn't access from shell. 

Original code 
STATIC CONST CHAR16           myVar[] = L"MacUniqueId";
Status = gRT->SetVariable ((CHAR16 *)myVar,
                    &gEfiCallerIdGuid,
                    EFI_VARIABLE_NON_VOLATILE |
                     EFI_VARIABLE_BOOTSERVICE_ACCESS |
                     EFI_VARIABLE_RUNTIME_ACCESS, Size,

On shell 
FS0:\> setvar MacUniqueId -guid C9DCF469-A7C4-11D5-87DA-00062945C3B9
setvar: Unable to get - C9DCF469-A7C4-11D5-87DA-00062945C3B9 - MacUniqueId
FS0:\> setvar MacUniqueId
setvar: Unable to get - 8BE4DF61-93CA-11D2-AA0D-00E098032B8C - Hello


When I changed the guid to gEfiGlobalVariableGuid
STATIC CONST CHAR16           myVar[] = L"MacUniqueId";
Status = gRT->SetVariable ((CHAR16 *)myVar,
                    &gEfiGlobalVariableGuid,
                    EFI_VARIABLE_NON_VOLATILE |
                     EFI_VARIABLE_BOOTSERVICE_ACCESS |
                     EFI_VARIABLE_RUNTIME_ACCESS, Size,
I could access it 
FS0:\> setvar MacUniqueId
8BE4DF61-93CA-11D2-AA0D-00E098032B8C - MacUniqueId - 0004 Bytes
42 FF 7A AF

Thanks for suggestion. 

Regards
Udit


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Accessing global variables from Shell
  2017-07-03  7:18 Accessing global variables from Shell Udit Kumar
@ 2017-07-03 18:13 ` Laszlo Ersek
  2017-07-04  4:33   ` Udit Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2017-07-03 18:13 UTC (permalink / raw)
  To: Udit Kumar, edk2-devel@lists.01.org

On 07/03/17 09:18, Udit Kumar wrote:
> Dear Edk2, 
> 
> I am trying to create one global variables, and access that from shell. 
> If I am using gEfiGlobalVariableGuid to create variable then I could access it perfectly ok ,  If I use other Guid (even vendor guid) then I couldn't access from shell. 
> 
> Original code 
> STATIC CONST CHAR16           myVar[] = L"MacUniqueId";
> Status = gRT->SetVariable ((CHAR16 *)myVar,
>                     &gEfiCallerIdGuid,
>                     EFI_VARIABLE_NON_VOLATILE |
>                      EFI_VARIABLE_BOOTSERVICE_ACCESS |
>                      EFI_VARIABLE_RUNTIME_ACCESS, Size,
> 
> On shell 
> FS0:\> setvar MacUniqueId -guid C9DCF469-A7C4-11D5-87DA-00062945C3B9
> setvar: Unable to get - C9DCF469-A7C4-11D5-87DA-00062945C3B9 - MacUniqueId

This GUID (in the shell command) is not one that you generated afresh
with "uuidgen", namely it is found in
"EdkCompatibilityPkg/Foundation/Guid/StatusCodeCallerId/StatusCodeCallerId.h".

My take is that "gEfiCallerIdGuid" denotes a different GUID from
C9DCF469-... If you take the actual FILE_GUID of the module INF where
your example code is from, and use that GUID in the shell command too,
it should work.

Laszlo


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Accessing global variables from Shell
  2017-07-03 18:13 ` Laszlo Ersek
@ 2017-07-04  4:33   ` Udit Kumar
  0 siblings, 0 replies; 3+ messages in thread
From: Udit Kumar @ 2017-07-04  4:33 UTC (permalink / raw)
  To: Laszlo Ersek, edk2-devel@lists.01.org

Thanks Laszlo 
Using file_guid works for me 
Regards
Udit

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Monday, July 03, 2017 11:44 PM
> To: Udit Kumar <udit.kumar@nxp.com>; edk2-devel@lists.01.org
> Subject: Re: [edk2] Accessing global variables from Shell
> 
> On 07/03/17 09:18, Udit Kumar wrote:
> > Dear Edk2,
> >
> > I am trying to create one global variables, and access that from shell.
> > If I am using gEfiGlobalVariableGuid to create variable then I could access it
> perfectly ok ,  If I use other Guid (even vendor guid) then I couldn't access from
> shell.
> >
> > Original code
> > STATIC CONST CHAR16           myVar[] = L"MacUniqueId";
> > Status = gRT->SetVariable ((CHAR16 *)myVar,
> >                     &gEfiCallerIdGuid,
> >                     EFI_VARIABLE_NON_VOLATILE |
> >                      EFI_VARIABLE_BOOTSERVICE_ACCESS |
> >                      EFI_VARIABLE_RUNTIME_ACCESS, Size,
> >
> > On shell
> > FS0:\> setvar MacUniqueId -guid C9DCF469-A7C4-11D5-87DA-00062945C3B9
> > setvar: Unable to get - C9DCF469-A7C4-11D5-87DA-00062945C3B9 -
> > MacUniqueId
> 
> This GUID (in the shell command) is not one that you generated afresh with
> "uuidgen", namely it is found in
> "EdkCompatibilityPkg/Foundation/Guid/StatusCodeCallerId/StatusCodeCallerId.
> h".
> 
> My take is that "gEfiCallerIdGuid" denotes a different GUID from C9DCF469-... If
> you take the actual FILE_GUID of the module INF where your example code is
> from, and use that GUID in the shell command too, it should work.
> 
> Laszlo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-04  4:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-03  7:18 Accessing global variables from Shell Udit Kumar
2017-07-03 18:13 ` Laszlo Ersek
2017-07-04  4:33   ` Udit Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox