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:
James Gutbub 2019-08-14 16:58:33 -07:00 committed by James Gutbub
parent 78e7b0225e
commit f9335e19a9
6 changed files with 16 additions and 39 deletions

View File

@ -223,12 +223,6 @@ FV = OsLoader
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
#------------------------------------------------------------------------------

View File

@ -170,9 +170,6 @@ NormalBootPath (
// It is a FV format
DEBUG ((DEBUG_INFO, "FV Format Payload\n"));
Status = LoadFvImage (Dst, Stage2Hob->PayloadActualLength, (VOID **)&PldEntry);
if ((FixedPcdGetBool (PcdPreOsCheckerEnabled))) {
PldBase = (UINT32) Dst;
}
} else if (IsElfImage (Dst)) {
Status = LoadElfImage (Dst, (VOID *)&PldEntry);
} else {

View File

@ -118,7 +118,6 @@
gPlatformModuleTokenSpaceGuid.PcdFlashSize
gPlatformModuleTokenSpaceGuid.PcdSplashEnabled
gPlatformModuleTokenSpaceGuid.PcdSplashLogoAddress
gPlatformModuleTokenSpaceGuid.PcdPreOsCheckerEnabled
gPlatformModuleTokenSpaceGuid.PcdOsBootOptionNumber
gPlatformModuleTokenSpaceGuid.PcdServiceNumber
gPlatformModuleTokenSpaceGuid.PcdFlashMapEnabled

View File

@ -265,8 +265,7 @@ SetupBootImage (
be loaded as part of the payload, if found get the entry point for
execution later instead of jumping into the OS directly.
@param[in] PldBase Payload Image base to search through for
the pre-OS checker binary.
@param[in] PreOsCheckerImageBase Base of the pre-OS checker loaded in memory.
@retval NULL Pre-OS checker is not loaded successfully.
@retval Others Pre-OS checker is loaded successfully and
@ -274,37 +273,17 @@ SetupBootImage (
**/
UINT32 *
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 PreOsCheckerImageBase;
EFI_STATUS Status;
EntryPoint = NULL;
if (((UINT32*) PldBase)[10] == EFI_FVH_SIGNATURE) {
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) PldBase;
// Find pre-OS checker FFS file
Status = GetFfsFileByType (FvHeader, EFI_FV_FILETYPE_FREEFORM, 0, &PreOsCheckerFile);
if (EFI_ERROR (Status)) {
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"));
}
}
}
Status = LoadElfImage ((VOID *)PreOsCheckerImageBase, (VOID *)&EntryPoint);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to load ELF binary and get entrypoint\n"));
}
return EntryPoint;
@ -736,10 +715,15 @@ PayloadMain (
)
{
OS_BOOT_OPTION_LIST *OsBootOptionList;
UINT32 *PreOsCheckerImage;
UINT32 Length;
EFI_STATUS Status;
UINTN ShellTimeout;
mEntryStack = Param;
mPreOsCheckerEntry = NULL;
PreOsCheckerImage = NULL;
Length = 0;
DEBUG ((DEBUG_INFO, "\n\n====================Os Loader====================\n\n"));
AddMeasurePoint (0x4010);
@ -776,11 +760,12 @@ PayloadMain (
#endif
// Check if there is a pre-OS checker that needs to be executed
if (PldBase != NULL) {
mPreOsCheckerEntry = LoadPreOsChecker (PldBase);
Status = LoadComponent (SIGNATURE_32 ('I', 'P', 'F', 'W'), SIGNATURE_32 ('P', 'O', 'S', 'C'),
(VOID **)&PreOsCheckerImage, &Length);
if (!EFI_ERROR (Status)) {
mPreOsCheckerEntry = LoadPreOsChecker (PreOsCheckerImage);
DEBUG ((DEBUG_INFO, "Pre-OS checker entry @ 0x%08X\n", mPreOsCheckerEntry));
}
//
// Load and run Image in order from OsImageList
//

View File

@ -43,6 +43,7 @@
#include <Library/UsbKbLib.h>
#include <Library/ElfLib.h>
#include <Library/LinuxLib.h>
#include <Library/ContainerLib.h>
#include <Guid/SeedInfoHobGuid.h>
#include <Guid/OsConfigDataHobGuid.h>
#include <Guid/OsBootOptionGuid.h>

View File

@ -75,6 +75,7 @@
ElfLib
LiteFvLib
LinuxLib
ContainerLib
[Guids]
gOsConfigDataGuid