[edk2-devel] [PATCH v2 03/11] OvmfPkg: PlatformBootManagerLibGrub: Allow executing kernel via fw_cfg

Lendacky, Thomas via groups.io thomas.lendacky=amd.com at groups.io
Mon Jul 19 15:21:54 UTC 2021


On 7/6/21 3:54 AM, Dov Murik wrote:
> From: James Bottomley <jejb at linux.ibm.com>
> 
> Support QEMU's -kernel option.
> 
> OvmfPkg/Library/PlatformBootManagerLibGrub/QemuKernel.c is an exact copy
> of OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c .

Just a nit, but this confused me initially. Maybe it should say something
along the lines of create a QemuKernel.c for PlatformBootManagerLibGrub
that is an exact copy of the file from PlatformBootManagerLib.

Is there any way that the two libraries can use the same file rather than
making an exact copy?

Thanks,
Tom

> 
> Cc: Laszlo Ersek <lersek at redhat.com>
> Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
> Cc: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Ashish Kalra <ashish.kalra at amd.com>
> Cc: Brijesh Singh <brijesh.singh at amd.com>
> Cc: Erdem Aktas <erdemaktas at google.com>
> Cc: James Bottomley <jejb at linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao at intel.com>
> Cc: Min Xu <min.m.xu at intel.com>
> Cc: Tom Lendacky <thomas.lendacky at amd.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3457
> Signed-off-by: James Bottomley <jejb at linux.ibm.com>
> ---
>  OvmfPkg/AmdSev/AmdSevX64.dsc                                                        |  1 +
>  OvmfPkg/Library/PlatformBootManagerLibGrub/PlatformBootManagerLibGrub.inf           |  2 ++
>  OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.h                            | 11 +++++++++++
>  OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c                            |  5 +++++
>  OvmfPkg/Library/{PlatformBootManagerLib => PlatformBootManagerLibGrub}/QemuKernel.c |  0
>  5 files changed, 19 insertions(+)
> 
> diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
> index a2f1324c40a6..aefdcf881c99 100644
> --- a/OvmfPkg/AmdSev/AmdSevX64.dsc
> +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
> @@ -281,6 +281,7 @@ [LibraryClasses.common.PEIM]
>    CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
>    MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
>    QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/PeiQemuFwCfgS3LibFwCfg.inf
> +  QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
>    PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
>    QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPeiLib.inf
>  
> diff --git a/OvmfPkg/Library/PlatformBootManagerLibGrub/PlatformBootManagerLibGrub.inf b/OvmfPkg/Library/PlatformBootManagerLibGrub/PlatformBootManagerLibGrub.inf
> index 9a806d17ec45..5f6f73d18470 100644
> --- a/OvmfPkg/Library/PlatformBootManagerLibGrub/PlatformBootManagerLibGrub.inf
> +++ b/OvmfPkg/Library/PlatformBootManagerLibGrub/PlatformBootManagerLibGrub.inf
> @@ -23,6 +23,7 @@ [Defines]
>  
>  [Sources]
>    BdsPlatform.c
> +  QemuKernel.c
>    PlatformData.c
>    BdsPlatform.h
>  
> @@ -46,6 +47,7 @@ [LibraryClasses]
>    BootLogoLib
>    DevicePathLib
>    PciLib
> +  QemuLoadImageLib
>    UefiLib
>    PlatformBmPrintScLib
>    Tcg2PhysicalPresenceLib
> diff --git a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.h b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.h
> index 748c63081920..f1d3a2906c00 100644
> --- a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.h
> +++ b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.h
> @@ -172,4 +172,15 @@ PlatformInitializeConsole (
>    IN PLATFORM_CONSOLE_CONNECT_ENTRY   *PlatformConsole
>    );
>  
> +/**
> +  Loads and boots UEFI Linux via the FwCfg interface.
> +
> +  @retval    EFI_NOT_FOUND - The Linux kernel was not found
> +
> +**/
> +EFI_STATUS
> +TryRunningQemuKernel (
> +  VOID
> +  );
> +
>  #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
> diff --git a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
> index 5c92d4fc2b09..7cceeea4879c 100644
> --- a/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
> +++ b/OvmfPkg/Library/PlatformBootManagerLibGrub/BdsPlatform.c
> @@ -1315,6 +1315,11 @@ PlatformBootManagerAfterConsole (
>    //
>    Tcg2PhysicalPresenceLibProcessRequest (NULL);
>  
> +  //
> +  // Process QEMU's -kernel command line option
> +  //
> +  TryRunningQemuKernel ();
> +
>    //
>    // Perform some platform specific connect sequence
>    //
> diff --git a/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c b/OvmfPkg/Library/PlatformBootManagerLibGrub/QemuKernel.c
> similarity index 100%
> copy from OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c
> copy to OvmfPkg/Library/PlatformBootManagerLibGrub/QemuKernel.c
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#77901): https://edk2.groups.io/g/devel/message/77901
Mute This Topic: https://groups.io/mt/84016356/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list