efi - How to access command line arguments in UEFI? -


what part of specification details how command line arguments can obtained?

you need careful one.

as aware, there uefi loadedimage protocol - protocol returns structure called efi_loaded_image in turn has loadoptions member.

the uefi shell set loadoptions variable whatever type on command line. alternatively, believe can set through bootoptions efi variable, care needed - first "argument" not process path in case.

so need process one-long-string deduce "arguments" want them.

to use loadedimage protocol, this:

efi_status status = efi_success; efi_loaded_image* loaded_image; efi_guid loaded_image_protocol = loaded_image_protocol; status = gbs->handleprotocol(imagehandle,                               &loaded_image_protocol,                               (void**) &loaded_image); 

you can length of (0-terminated) string passed in by:

loaded_image->loadoptionssize; 

be aware size in bytes, not length. that, use library function:

loadoptionslength = strlen((char16 *)li->loadoptions); 

finally, actual string available from:

char16* commandlineargs = (char16 *)li->loadoptions; 

there uefi shell specification available free determines protocols shell speaks. can talk directly it, i'm yet experiment that.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -