This application will handle QEMU's -kernel parameter if it was used when QEMU was launched.
Signed-off-by: Jordan Justen <[email protected]> --- OvmfPkg/Include/Guid/OvmfQemuKernelFile.h | 25 +++++++++ OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c | 58 +++++++++++++++++++++ OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h | 1 + OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf | 4 ++ OvmfPkg/OvmfPkg.dec | 2 + 5 files changed, 90 insertions(+) create mode 100644 OvmfPkg/Include/Guid/OvmfQemuKernelFile.h diff --git a/OvmfPkg/Include/Guid/OvmfQemuKernelFile.h b/OvmfPkg/Include/Guid/OvmfQemuKernelFile.h new file mode 100644 index 0000000..d91af78 --- /dev/null +++ b/OvmfPkg/Include/Guid/OvmfQemuKernelFile.h @@ -0,0 +1,25 @@ +/** @file + + Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __OVMF_QEMU_KERNEL_FILE_H__ +#define __OVMF_QEMU_KERNEL_FILE_H__ + +#define OVMF_QEMU_KERNEL_FILE \ + { \ + 0x3f588f11, 0xb6b2, 0x4859, {0xb8, 0x67, 0x9d, 0x4c, 0xcc, 0x2f, 0x98, 0x65}} \ + } + +extern EFI_GUID gOvmfQemuKernelFile; + +#endif + diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c index d6e1e93..64dcb75 100644 --- a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c @@ -103,6 +103,59 @@ Returns: EFI_STATUS +TryRunningQemuKernel ( + VOID + ) +{ + EFI_STATUS Status; + UINTN Index; + UINTN FvHandleCount; + EFI_HANDLE *FvHandleBuffer; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_HANDLE ImageHandle; + MEDIA_FW_VOL_FILEPATH_DEVICE_PATH ShellNode; + + // + // Check if we have on flash shell + // + gBS->LocateHandleBuffer ( + ByProtocol, + &gEfiFirmwareVolume2ProtocolGuid, + NULL, + &FvHandleCount, + &FvHandleBuffer + ); + for (Index = 0; Index < FvHandleCount; Index++) { + gBS->HandleProtocol ( + FvHandleBuffer[Index], + &gEfiDevicePathProtocolGuid, + (VOID **) &DevicePath + ); + + // + // Build device path for QEMU Kernel executable + // + EfiInitializeFwVolDevicepathNode (&ShellNode, &gOvmfQemuKernelFile); + DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &ShellNode); + Status = gBS->LoadImage ( + TRUE, + gImageHandle, + DevicePath, + NULL, + 0, + &ImageHandle + ); + if (!EFI_ERROR (Status)) { + Status = gBS->StartImage (ImageHandle, NULL, NULL); + break; + } + } + + return EFI_SUCCESS; +} + + +EFI_STATUS ConnectRootBridge ( VOID ) @@ -1128,6 +1181,11 @@ Returns: PlatformBdsConnectSequence (); // + // Process QEMU's -kernel command line option + // + TryRunningQemuKernel (); + + // // Give one chance to enter the setup if we // have the time out // diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h index cf8bb12..c572b8b 100644 --- a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h +++ b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h @@ -58,6 +58,7 @@ Abstract: #include <Guid/Mps.h> #include <Guid/HobList.h> #include <Guid/GlobalVariable.h> +#include <Guid/OvmfQemuKernelFile.h> extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[]; extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[]; diff --git a/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf b/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf index 81602f5..3a5a1b5 100644 --- a/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf +++ b/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf @@ -61,4 +61,8 @@ [Protocols] gEfiDecompressProtocolGuid + gEfiDevicePathProtocolGuid + +[Guids] + gOvmfQemuKernelFile diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index d874f0c..9ee2b23 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -43,6 +43,8 @@ gUefiOvmfPkgTokenSpaceGuid = {0x93bb96af, 0xb9f2, 0x4eb8, {0x94, 0x62, 0xe0, 0xba, 0x74, 0x56, 0x42, 0x36}} gEfiXenInfoGuid = {0xd3b46f3b, 0xd441, 0x1244, {0x9a, 0x12, 0x0, 0x12, 0x27, 0x3f, 0xc1, 0x4d}} + gOvmfQemuKernelFile = {0x3f588f11, 0xb6b2, 0x4859, {0xb8, 0x67, 0x9d, 0x4c, 0xcc, 0x2f, 0x98, 0x65}} + [Protocols] gBlockMmioProtocolGuid = {0x6b558ce3, 0x69e5, 0x4c67, {0xa6, 0x34, 0xf7, 0xfe, 0x72, 0xad, 0xbe, 0x84}} -- 1.7.9.5 ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
