Running an EFI application automatically on boot

PaulH picture PaulH · Mar 25, 2014 · Viewed 17.4k times · Source

I can build and manually execute an EFI application in a UEFI environment. But, I'd like to have my application executed automatically at boot time.

Is there a way to tell the bootloader to do this or do I need to turn my application in to a driver to have it automatically executed? Is there maybe some entry in an FDF, DEC, DSC, or INF file I'm missing?

Answer

Rose Lynn Embry picture Rose Lynn Embry · Mar 26, 2014

You can add a startup.nsh script file to your UEFI Shell boot drive that calls you application.

The following link should serve as a handy reference for working with scripts in the shell: UEFI Shells and Scripting. Look at section 3 (EFI Shell Scripts) specifically.

However, if you are actually building your own firmware, you can also look at creating a bootable EFI image and set your default boot option to this binary. This is most useful if you are including the binary as a part of your ROM, but it might be a little involved to set up the filesystem so that it is seen as a normal boot option.

Also, if you have complete access to your firmware source, you could also just load and call your binary from your BDS driver. I don't recommend this route, unless you are specifically aiming to create a standalone device that will never boot any other image.