Currently I am programming with efi API.
How do I use in an efi programing ? I want to know how to write argv and argc in efi.
c code written till now:
#include <stdio.h>
int main(int argc,char *argv[])
{
int i;
printf("Program name is %s \n",argv[0]);
if (argc <2)
printf("argument is no exist \n");
else
for (i=0;i<argc;i++)
printf ("argv[%d] = %s \n",i,argv[i]);
}
argc
, argv
and main
are standard library concepts, and don't directly translate to UEFI applications.
On a generic level:
In either case, when the application launches, its entry point will only be passed a pointer to the UEFI System Table and an Image Handle , providing the link to information about how the current image was invoked.
Pure UEFI applications have only the EFI_LOADED_IMAGE_PROTOCOL
installed on their image handle. UEFI Shell applications also have the EFI_SHELL_PARAMETERS_PROTOCOL
.
The EFI_SHELL_PARAMETERS_PROTOCOL
gives you access to argc/argv constructs. Without this, you're down to parsing EFI_LOADED_IMAGE_PROTOCOL.LoadOptions
manually.
You can find the details of these protocols in the UEFI Specification and the UEFI Shell Specification , from the UEFI Forum website .
Of course, abstracting frameworks like gnu-efi (and maybe VisualUefi) may hide the underlying mechanics, or provide alternative means for getting at them.`
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.