Search code examples
cparsingbootloaderuefignu-efi

EFI variables or config file on the EFI partition for EFI application?


I'm writing a small EFI application with gnu-efi, which boots depending on the Wake-Up Type into Ubuntu or Windows.

The application works, but I want to configure the WakeUp Type - Boot Option mapping without recompiling the application.

Is it better to configure the mapping over EFI variables or with a config file on the EFI partition?

I already pursued the way of using a config file, but couldn't find a parser only written in Standard C. I think it would be less effort to use EFI variables, but i don't now if it's as "nice" as an config file.

EDIT: With I wrote Standard C, but a EFI application can't use standard libraries.


Solution

  • So after some thinking I came to the decision, that efi variables are the better way to go for me.

    I just need 9 values and I map them from 0 to 9. I created a efi variable with 9 words separated by spaces and just implemented a function which saves the words to an array.

    For a greater application I still would recommend using a config file for the ease of use, but writing a parser for just some values would be overkill.

    You can look at my test application here:
    https://gist.github.com/KastenKlicker/a1947bec5254d16646dd88484ce8b59e