Search code examples
cuefignu-efi

How can I get a protocol working under GNU-EFI?


I use GNU-EFI to develop UEFI apps. I have some trouble getting a protocol (EFI_SHELL_PROTOCOL) working under GNU-EFI. My compiler says that it is undefined. Should I include something? I already included efi.h and efilib.h. Do I need more?

Code that I tried:

EFI_SHELL_PROTOCOL shell;

The error that I got:

error: unknown type name ‘EFI_SHELL_PROTOCOL’; did you mean ‘EFI_OPEN_PROTOCOL’?
  161 |  EFI_SHELL_PROTOCOL shell;

Solution

  • The EFI_SHELL_PROTOCOL isn't part of the main UEFI interface, and is therefore not included in the main header files (e.g. efi.h) and not included in the main UEFI standard.

    Instead, EFI_SHELL_PROTOCOL is just an optional extension (that may not exist, and I'd assume is only likely to exist when a shell is being used and provides it), with its own separate standard and its own separate header file.

    Assuming you're using GNU's tools; the right files to include are probably efishellintf.h and efishellparm.h.