0

I have written a .efi executable using Edk2 and have been able to successfully execute the file in the UEFI Shell. I'm attempting to have my file execute as my device, which is running Ubuntu, boots up.

Is there any way to accomplish this objective?

silkyskate
  • 11
  • 2
  • The simplest way is to run your program from startup.nsh. – prl Aug 06 '22 at 08:29
  • You can go into BIOS setup, go to boot menu settings, and add a boot menu entry that runs your program. Then change the boot order so your new boot entry is first. – prl Aug 06 '22 at 08:30
  • @prl when you say run the program from startup.nsh do you mean call my program at the end of startup.nsh? – silkyskate Aug 08 '22 at 16:53

1 Answers1

0

I know 2 ways to achieve this.

BOOTX64.EFI

Note: I assume we use standard x86 64 bit platform.

In EFI partition create folders EFI\boot. Put there your EFI application and name it BOOTX64.EFI. That's it. Normally you even don't need to add an entry to NVRAM via efibootmgr because many vendors check existance of EFI\boot\BOOTX64.EFI on all FAT32 partitions by default.

EFI shell

As @prl mentioned in the comment, it's possible to start an EFI application automatically from a startup.nsh script if your boot manager goes to EFI Shell as the first option. I think the script can be simple as this:

my_program.efi

Put startup.nsh in the root of EFI partition. One downside, you usually see the 5 second countdown.

Mikolasan
  • 626
  • 10
  • 19