edk 2 的基本架构

来源:互联网 发布:美化照片软件 编辑:程序博客网 时间:2024/05/21 14:03




写在最前, meta-data file 指的就是dsc, dec , inf, fdf 文件。 出自dsc spec,

the build tools use EDK II meta-data files (INF, DEC, DSC and , optionally, the FDF) to create Makefies that are

then processed by third party tools.


首先FDF 是Flash Description File 的缩写,用来创建 firmware images, option rom images 或者 bootable images .

为了这一节的讨论,我们还要参考FlashMap.fdf 文件,一般约定FlashMap.fdf 用来作为flash 描述文件(flash

description file). 一般建议用fdf 后缀作为flash 描述文件。

一般来讲, flash 描述文件是和dsc 文件放在同一个文件夹里面的。

在后续的章节里面我们用fdf 代替 Flash Description File."


EDK II 编译生成符合 UEFI 和PI 规范的binary images。

注意: FDF文件里面路径以及文件名是大小写敏感的,因为它需要支持unix style 操作系统,


条件语句  Conditional Statements( !if...)

条件语句用来给编译工具的预处理函数决定包含还是不包含某个语句。


3.10  PCD Sections

The PCD sections are optional. optional 就是可有可无的。

PCD Values listed in the DSC file must be absolute values, macro names or expressions which may include

other PCD names and/or macro names that have been previously defined. While each PCD type has its own

section definition, it is possible for PCDs accessed using either the FixedAtBuild or PatchableInModule

methods to have different values for different modules.


It is not permitted to list a PCD in different type sections. A PCD can only be listed under one type. All

PCDs listed in these sections must be declared in a DEC file if the PCD is used in any modules listed in the

DSC or FDF file.


inf 描述一个module, dsc 描述一个platform, 如果在编译的时候,遇到error 4000: Instance of libray class [DxeServicesLib] is not found




如果我在nt32pkg.dsc 里面将



DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf

注释掉,然而DxeMain.inf 又要用到这个lib.

所以就会出现这个问题。


下面是来自官方的对dsc [Libraryclasses] seciton 的介绍

每个module 要用到各种各样的lib, 而lib 必然有一个相应的instance. 建立这种映射关系就得靠我们这里说的 libraryClasses section了。

举个例子,在EDK II里面, DebugLib 有很多个instance, 但具体到每个component 的时候,肯定只能link 一个进去,这时候,就需要我们去选取了:






DSC 的文件构成


依次下来,有这些section
[Defines]
[BuildOptions]
[BuildOptions.IA32]

[BuildOptions.X64]

[SkuIds]

[LibraryClasses.common]

LibraryClasses.IA32.SEC]

[LibraryClasses.IA32.PEIM, LibraryClasses.IA32.PEI_CORE, LibraryClasses.IA32.SEC]

[LibraryClasses.common.DXE_DRIVER]

[LibraryClasses.common.DXE_SMM_DRIVER]

LibraryClasses.common.SMM_CORE]

[LibraryClasses.common.DXE_RUNTIME_DRIVER]

[LibraryClasses.common.UEFI_DRIVER]

[LibraryClasses.X64.UEFI_APPLICATION]



Pcd Section

[PcdsFeatureFlag.common]

[PcdsFixedAtBuild.common]

[PcdsPatchableInModule.common]

[PcdsDynamicExHii.common.DEFAULT]

[PcdsDynamicExDefault.common.IA32]

[PcdsDynamicExDefault.common.DEFAULT]


Components Section 

[Components.IA32]    可以没有[Components.X64] ? 


Components section 是必不可少的。


几是列在components section 里面的module 或者component 都将会被编译器以及EDK II A工具生成PE32/PE32+/Coff image 文件。


在Components section 里面 !include 语句是可以使用的,但是,一般不推荐使用。





[Components.common]



[BuildOptions]

[BuildOptions.Common.EDKII]


0 0
原创粉丝点击