On Nov 3, 2022, at 12:11 PM, d.meneses via groups.io <d.meneses=softi9.pt@groups.io> wrote:

Yes I also believe I'm threading a XY problem. 

Let's simplify my learning and set the goal to: add an UEFI application to OVMF so that it runs natively on startup.

Does this make more sense?

I followed the same process and I can use UEFITool to confirm there's an UefiApplication inside the OVMF image.

How can I make it run?

Do you need to run it from FLASH? Or do you just want to run it? 

What I usually do with QEMU is pass -hda fat:rw:Build/OvmfX64/DEBUG_XCODE5/X64 to mount a directory on my system in QEMU. This should show up in the UEFI Shell as FS0: if you don’t have any other disks. The path is the build output, so you need to match what you built. So DEBUG_GCC??? Vs DEBUG_XCODE, as this path encodes the build target, compiler, etc.

Then when you boot to the UEFI Shell you just need to mount the disk and run your app. 

Fs0:
MyApp.efi

You can also redirect the text output of your app to a file, and since fs0: is just your build directory you can get the output out of the VM. 

From the UEFI Shell you can `reset -s` to shut down the VM.

If you place a startup.nsh the UEFI Shell command should run those commands when launched. 

It is also possible to make a FAT32 disk image and boot your app directly, just like an OS loader[1]. Just copy your app to /EFI/BOOT/BOOTx64.EFI in the disk image and mount the disk image from the QEMU command line.

[1] https://uefi.org/specs/UEFI/2.10/03_Boot_Manager.html#removable-media-boot-behavior

Thanks,

Andrew Fish