rhboot / efivar

Tools and libraries to work with EFI variables
GNU Lesser General Public License v2.1
238 stars 104 forks source link

Best way to demand mount efivarfs and link libefivar #266

Open schallee opened 3 months ago

schallee commented 3 months ago

Greetings,

I'm working on a project that references EFI variables through efivarfs. It can run in a early user space environment where efivarfs is not mounted. My current code checks for efivarfs being mounted and if it isn't mounted, it mounts it before utilizing efivar.

Unfortunately, this doesn't work as libefivar actually probes for efivarfs when the library is loaded and not after my code mounts efivarfs if needed.

I can think of two methods to get around this:

  1. dlopen libefivar instead of linking against it after efivarfs is mounted
  2. If efivarfs isn't mounted, mount it and rexec myself

Neither of these is particularly attractive. Are there other methods I'm not aware of? If not would it be worth my implementing such?

Thanks in advance!