初次接触UEFI,一脸懵逼。不过接触新认知事务都得有个熟悉过程,那么就先顺藤摸瓜。
UEFI启动流程依次 SEC ->DEX ->BDS ->OS Loader
/**************************SEC Pre-PI**************************/
BOOT.XF.4.1\boot_images\QcomPkg\XBLCore\ModuleEntryPoint.S
|
BOOT.XF.4.1\boot_images\QcomPkg\XBLCore\Sec.c
|
CEntryPoint
|
VOID Main (IN VOID *StackBase, IN UINTN StackSize) //初始化ddr、debug uart打印、早期cache、共享库
|
LoadAndParsePlatformCfg -> InitSplitBoot-> UefiBootContinue -> LoadDxeCoreFromFv
/**************************SEC Pre-PI**************************/
/**************DEX (driver execution environment)***************/
InitSplitBoot//配置CPU启动线程和多核启动配置
|
kern_init //被高通封装成库函数
|
_ModuleEntryPoint
|
/**************DEX (driver execution environment)***************/
/**************BDS (boot devices select)***************/
boot_images/QcomPkg/Tools/load_drvr_sym.cmm:122: &EntryPoint="\\&ModuleName\AutoGen\ProcessModuleEntryPointList"
boot_images/QcomPkg/Tools/sym.cmm:96: &ModuleBkpt="\\&ModName\AutoGen\ProcessModuleEntryPointList"
ProcessModuleEntryPointList
|
BdsInitialize -> gEfiBdsArchProtocolGuid //After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be invoked to enter BDS phase
|
BdsEntry
|
BdsBootDeviceSelect(); // BDS select the boot device to load OS
|
BdsLibBootViaBootOption
|
gBS->LoadImage //Load the default boot file \EFI\BOOT\boot{machinename}.EFI from removable, Media machinename is ia32, ia64, x64, ...
|
gBS->StartImage
|
gST、gBS的出处在MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c中被定义和初始化。
所以从UEFI XBL阶段过渡到ABL阶段
|
CoreStartImage//Transfer control to a loaded image's entry point.
|
Image->EntryPoint (ImageHandle, Image->Info.SystemTable); //这里的Image->Info.SystemTable和gST指向同一个结构体
/**************BDS (boot devices select)***************/
/**************OS Loader (Linux Loader)***************/
LinuxLoaderEntry
/**************OS Loader (Linux Loader)***************/