Switch to use container for pre-OS checker/payload
Since we may want to perform FW update on pre-OS checker/payload binaries separately from the OS Loader payload we will search for pre-OS checker/payload in the container entries instead of adding it into the OS Loader FD. Signed-off-by: James Gutbub <james.gutbub@intel.com>
This commit is contained in:
parent
78e7b0225e
commit
f9335e19a9
|
@ -223,12 +223,6 @@ FV = OsLoader
|
||||||
|
|
||||||
INF PayloadPkg/OsLoader/OsLoader.inf
|
INF PayloadPkg/OsLoader/OsLoader.inf
|
||||||
|
|
||||||
!if $(ENABLE_PRE_OS_CHECKER)
|
|
||||||
FILE FREEFORM = 01C46D7E-00A2-48E8-A50F-17467D1CA0C5 {
|
|
||||||
SECTION RAW = Platform/$(BOARD_PKG_NAME)/Binaries/PreOsChecker.bin
|
|
||||||
}
|
|
||||||
!endif
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# FwUpdate FV to make FirmwareUpdate.efi visible to modules
|
# FwUpdate FV to make FirmwareUpdate.efi visible to modules
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
|
@ -170,9 +170,6 @@ NormalBootPath (
|
||||||
// It is a FV format
|
// It is a FV format
|
||||||
DEBUG ((DEBUG_INFO, "FV Format Payload\n"));
|
DEBUG ((DEBUG_INFO, "FV Format Payload\n"));
|
||||||
Status = LoadFvImage (Dst, Stage2Hob->PayloadActualLength, (VOID **)&PldEntry);
|
Status = LoadFvImage (Dst, Stage2Hob->PayloadActualLength, (VOID **)&PldEntry);
|
||||||
if ((FixedPcdGetBool (PcdPreOsCheckerEnabled))) {
|
|
||||||
PldBase = (UINT32) Dst;
|
|
||||||
}
|
|
||||||
} else if (IsElfImage (Dst)) {
|
} else if (IsElfImage (Dst)) {
|
||||||
Status = LoadElfImage (Dst, (VOID *)&PldEntry);
|
Status = LoadElfImage (Dst, (VOID *)&PldEntry);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -118,7 +118,6 @@
|
||||||
gPlatformModuleTokenSpaceGuid.PcdFlashSize
|
gPlatformModuleTokenSpaceGuid.PcdFlashSize
|
||||||
gPlatformModuleTokenSpaceGuid.PcdSplashEnabled
|
gPlatformModuleTokenSpaceGuid.PcdSplashEnabled
|
||||||
gPlatformModuleTokenSpaceGuid.PcdSplashLogoAddress
|
gPlatformModuleTokenSpaceGuid.PcdSplashLogoAddress
|
||||||
gPlatformModuleTokenSpaceGuid.PcdPreOsCheckerEnabled
|
|
||||||
gPlatformModuleTokenSpaceGuid.PcdOsBootOptionNumber
|
gPlatformModuleTokenSpaceGuid.PcdOsBootOptionNumber
|
||||||
gPlatformModuleTokenSpaceGuid.PcdServiceNumber
|
gPlatformModuleTokenSpaceGuid.PcdServiceNumber
|
||||||
gPlatformModuleTokenSpaceGuid.PcdFlashMapEnabled
|
gPlatformModuleTokenSpaceGuid.PcdFlashMapEnabled
|
||||||
|
|
|
@ -265,8 +265,7 @@ SetupBootImage (
|
||||||
be loaded as part of the payload, if found get the entry point for
|
be loaded as part of the payload, if found get the entry point for
|
||||||
execution later instead of jumping into the OS directly.
|
execution later instead of jumping into the OS directly.
|
||||||
|
|
||||||
@param[in] PldBase Payload Image base to search through for
|
@param[in] PreOsCheckerImageBase Base of the pre-OS checker loaded in memory.
|
||||||
the pre-OS checker binary.
|
|
||||||
|
|
||||||
@retval NULL Pre-OS checker is not loaded successfully.
|
@retval NULL Pre-OS checker is not loaded successfully.
|
||||||
@retval Others Pre-OS checker is loaded successfully and
|
@retval Others Pre-OS checker is loaded successfully and
|
||||||
|
@ -274,37 +273,17 @@ SetupBootImage (
|
||||||
**/
|
**/
|
||||||
UINT32 *
|
UINT32 *
|
||||||
LoadPreOsChecker (
|
LoadPreOsChecker (
|
||||||
IN VOID *PldBase
|
IN UINT32 *PreOsCheckerImageBase
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
|
|
||||||
EFI_FFS_FILE_HEADER *PreOsCheckerFile;
|
|
||||||
EFI_COMMON_SECTION_HEADER *Section;
|
|
||||||
UINT32 *EntryPoint;
|
UINT32 *EntryPoint;
|
||||||
UINT32 PreOsCheckerImageBase;
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
EntryPoint = NULL;
|
EntryPoint = NULL;
|
||||||
if (((UINT32*) PldBase)[10] == EFI_FVH_SIGNATURE) {
|
|
||||||
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) PldBase;
|
|
||||||
|
|
||||||
// Find pre-OS checker FFS file
|
Status = LoadElfImage ((VOID *)PreOsCheckerImageBase, (VOID *)&EntryPoint);
|
||||||
Status = GetFfsFileByType (FvHeader, EFI_FV_FILETYPE_FREEFORM, 0, &PreOsCheckerFile);
|
if (EFI_ERROR (Status)) {
|
||||||
if (EFI_ERROR (Status)) {
|
DEBUG ((DEBUG_ERROR, "Failed to load ELF binary and get entrypoint\n"));
|
||||||
DEBUG ((DEBUG_ERROR, "Did NOT find PreOsChecker.bin\n"));
|
|
||||||
} else {
|
|
||||||
// Get PreOsChcker.bin data
|
|
||||||
Status = GetSectionByType (PreOsCheckerFile, EFI_SECTION_RAW, 0, (VOID **)&Section);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((DEBUG_INFO, "PreOsChecker.bin data NOT FOUND\n"));
|
|
||||||
} else {
|
|
||||||
PreOsCheckerImageBase = (UINTN)Section;
|
|
||||||
Status = LoadElfImage ((VOID *)PreOsCheckerImageBase, (VOID *)&EntryPoint);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((DEBUG_ERROR, "Failed to load ELF binary and get entrypoint\n"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EntryPoint;
|
return EntryPoint;
|
||||||
|
@ -736,10 +715,15 @@ PayloadMain (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
OS_BOOT_OPTION_LIST *OsBootOptionList;
|
OS_BOOT_OPTION_LIST *OsBootOptionList;
|
||||||
|
UINT32 *PreOsCheckerImage;
|
||||||
|
UINT32 Length;
|
||||||
|
EFI_STATUS Status;
|
||||||
UINTN ShellTimeout;
|
UINTN ShellTimeout;
|
||||||
|
|
||||||
mEntryStack = Param;
|
mEntryStack = Param;
|
||||||
mPreOsCheckerEntry = NULL;
|
mPreOsCheckerEntry = NULL;
|
||||||
|
PreOsCheckerImage = NULL;
|
||||||
|
Length = 0;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "\n\n====================Os Loader====================\n\n"));
|
DEBUG ((DEBUG_INFO, "\n\n====================Os Loader====================\n\n"));
|
||||||
AddMeasurePoint (0x4010);
|
AddMeasurePoint (0x4010);
|
||||||
|
@ -776,11 +760,12 @@ PayloadMain (
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check if there is a pre-OS checker that needs to be executed
|
// Check if there is a pre-OS checker that needs to be executed
|
||||||
if (PldBase != NULL) {
|
Status = LoadComponent (SIGNATURE_32 ('I', 'P', 'F', 'W'), SIGNATURE_32 ('P', 'O', 'S', 'C'),
|
||||||
mPreOsCheckerEntry = LoadPreOsChecker (PldBase);
|
(VOID **)&PreOsCheckerImage, &Length);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
mPreOsCheckerEntry = LoadPreOsChecker (PreOsCheckerImage);
|
||||||
DEBUG ((DEBUG_INFO, "Pre-OS checker entry @ 0x%08X\n", mPreOsCheckerEntry));
|
DEBUG ((DEBUG_INFO, "Pre-OS checker entry @ 0x%08X\n", mPreOsCheckerEntry));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load and run Image in order from OsImageList
|
// Load and run Image in order from OsImageList
|
||||||
//
|
//
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include <Library/UsbKbLib.h>
|
#include <Library/UsbKbLib.h>
|
||||||
#include <Library/ElfLib.h>
|
#include <Library/ElfLib.h>
|
||||||
#include <Library/LinuxLib.h>
|
#include <Library/LinuxLib.h>
|
||||||
|
#include <Library/ContainerLib.h>
|
||||||
#include <Guid/SeedInfoHobGuid.h>
|
#include <Guid/SeedInfoHobGuid.h>
|
||||||
#include <Guid/OsConfigDataHobGuid.h>
|
#include <Guid/OsConfigDataHobGuid.h>
|
||||||
#include <Guid/OsBootOptionGuid.h>
|
#include <Guid/OsBootOptionGuid.h>
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
ElfLib
|
ElfLib
|
||||||
LiteFvLib
|
LiteFvLib
|
||||||
LinuxLib
|
LinuxLib
|
||||||
|
ContainerLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gOsConfigDataGuid
|
gOsConfigDataGuid
|
||||||
|
|
Loading…
Reference in New Issue