public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrew Fish" <afish@apple.com>
To: devel@edk2.groups.io, d.meneses@softi9.pt
Subject: Re: [edk2-devel] How to add a DXE driver to an OVMF image?
Date: Wed, 09 Nov 2022 09:52:06 -0800	[thread overview]
Message-ID: <D9F9A230-4F3A-4470-B3E0-5D837E1154F2@apple.com> (raw)
In-Reply-To: <17126.1667568054194961949@groups.io>

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



> On Nov 4, 2022, at 6:20 AM, d.meneses via groups.io <d.meneses=softi9.pt@groups.io> wrote:
> 
> Using DebugLib instead to print a message, I was able to confirm that my driver is now running properly:
> cat debug.log | grep Hello
> This works both when adding it in the OVMF build and also when inserted by UEFITool.
> 
> The drivers is not being listed by the EFI Shell drivers command.
> This is expected to me as Dxe Drivers are unloaded after they return.
> Nonetheless, the same is happening when I package it as a DXE_RUNTIME_DRIVER.
> What is it that I'm missing?
> 

The UEFI Shell drivers command is managing UEFI Driver Model Drivers [1]. A UEFI Driver Model Driver has no depex and publishes an EFI Driver Binding protocol [2]. The idea is the BDS (platform) can now have the policy of what driver gets connected to what device. This is all managed by gBS->ConnectController()/gBS->DisconnectController(). 

A DXE Driver just publishes an arbitrary protocol. 

[1] https://uefi.org/specs/UEFI/2.10/11_Protocols_UEFI_Driver_Model.html
[2] https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Protocol/DriverBinding.h


PS I seem to remember a question about launching an App….

It is possible to customize a generic UEFIs system boot policy via NVRAM variable. You can read up on that here [3]. 

If you want to change the platform policy in a secure way to do something you likely need to modify the BDS (Boot Device Selection). The design idea around BDS is you could make a system an ATM or a PC just by changing the policy in the BDS, thus the BDS is a place to centralize the platform policy. The easiest way to customize the edk2 BDS is via a custom PlatformBootManagerLib. You can look at the OVMF instance here [4]. You can use this library to add extra policy on top of the NVRAM variables in the UEFI Spec [3]. If you look at the OVMF example this is how the OVMF platform makes the UEFI Shell a default boot option [5].

[3] https://uefi.org/specs/UEFI/2.10/03_Boot_Manager.html#globally-defined-variables
[4] https://github.com/tianocore/edk2/tree/master/OvmfPkg/Library/PlatformBootManagerLib
[5] https://github.com/tianocore/edk2/blob/master/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c#L1717

Sorry if I’m mixing up threads. So much email, and so little time….

> Thank you for your attention,
> Diogo
> 


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

  reply	other threads:[~2022-11-09 17:52 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
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 [this message]
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=D9F9A230-4F3A-4470-B3E0-5D837E1154F2@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