Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 7072

UEFI grT->GetVariable() returning Not Found Status

$
0
0

I have written a UEFI application and running it in a QEMU setup where I have Ubuntu as an operating system.

I am reading the variable like this in the code:

EFI_STATUSEFIAPIUefiMain(    IN EFI_HANDLE ImageHandle,    IN EFI_SYSTEM_TABLE *SystemTable) {    EFI_STATUS Status;    UINT8 CheckValue;    UINTN DataSize = sizeof(CheckValue);    UINT32 Attributes;      Status = gRT->GetVariable(        L"my_variable",&MyGuid,&Attributes,    &DataSize,&CheckValue    );if (EFI_ERROR(Status)) {        Print(L"Error: variable not found. Returning\n");        return EFI_SUCCESS;    }    if (CheckValue != 100) {        Print(L"Variable is not set to 100. Returning\n");        return EFI_SUCCESS;    }

And the value is beiing set like this from Ubuntu OS on QEMU with this script:

#!/bin/bashVAR_NAME="my_variable"GUID="12345678-1234-1234-1234-123456789abc"DATA_FILE="/tmp/check_data"echo -ne '\x07\x00\x00\x00\x64'> "$DATA_FILE"sudo efivar --name "${GUID}-${VAR_NAME}" --write --data "$DATA_FILE"rm "$DATA_FILE"

As you can see from the script I am trying to set the variable to 100(0x64). I also have another similar script for setting it to 0. At boottime when UEFI shell comes up I read the value with dmpstore command and I confirm that it's value is 0x64(100). However when the application tries to read it with GetVariable() as in the above example it doesn't find it as if the variable would not exist(Not found status).My variable which I set from ubuntu has following propreties: Non-Volatile, Boot Service Access, Runtime service Access. So the way I see it it should be accessible for the app.

I am reading through UEFI specs but I have not figured out what the issue is. Please help me fix this if possible. Thanks.


Viewing all articles
Browse latest Browse all 7072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>