public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrew Fish" <afish@apple.com>
To: edk2-devel-groups-io <devel@edk2.groups.io>, d.meneses@softi9.pt
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Subject: Re: [edk2-devel] How to add a DXE driver to an OVMF image?
Date: Thu, 03 Nov 2022 14:34:40 -0700	[thread overview]
Message-ID: <FCEAE898-A06C-403C-99E4-6E09B6D0B794@apple.com> (raw)
In-Reply-To: <4722.1667502663480435497@groups.io>

[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]



> 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


> 


[-- Attachment #2: Type: text/html, Size: 2624 bytes --]

  reply	other threads:[~2022-11-03 21:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 11:11 How to add a DXE driver to an OVMF image? d.meneses
2022-11-03  0:58 ` [edk2-devel] " Pedro Falcato
2022-11-03  1:07   ` Andrew Fish
2022-11-03 15:23     ` d.meneses
2022-11-03 16:51       ` Pedro Falcato
2022-11-03 19:11         ` d.meneses
2022-11-03 21:34           ` Andrew Fish [this message]
2022-11-03 22:02             ` d.meneses
2022-11-03 22:02               ` Pedro Falcato
2022-11-03 22:12                 ` d.meneses
2022-11-04 13:20                   ` d.meneses
2022-11-09 17:52                     ` Andrew Fish
2022-11-09 18:29                       ` d.meneses
2022-11-09 20:09                         ` Andrew Fish
2022-11-10  7:43                           ` d.meneses

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FCEAE898-A06C-403C-99E4-6E09B6D0B794@apple.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox