edk2中的fdf文件简介

fdf的全称叫做flash device file,它用于描述固件在flash中的布局和位置,他可以分为几个部分[Defines],[FD],[FV],[Rule],本文主要介绍如下关键的3个部分:

  • FD Section
    这个部分需要在起始的地方标注[FD.xxx],一个fdf文件中可以分为多个FD Section。
 ################################################################################
 #
 # FD Section
 # The [FD] Section is made up of the definition statements and a
 # description of what goes into  the Flash Device Image.  Each FD section
 # defines one flash "device" image.  A flash device image may be one of
 # the following: Removable media bootable image (like a boot floppy
 # image,) an Option ROM image (that would be "flashed" into an add-in
 # card,) a System "Flash"  image (that would be burned into a system's
 # flash) or an Update ("Capsule") image that will be used to update and
 # existing system flash.
 #
 ################################################################################



 [FD.QcomModule_EFI]
 BaseAddress   = 0x80200000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress  #The base address of the FLASH Device.
 Size          = 0x00024000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdSize         #The size in bytes of the FLASH Device
 ErasePolarity = 1
 BlockSize     = 0x200
 NumBlocks     = 0x120 
  • FD Region

每个FD的最后都会跟上该FD的区域布局,通过Region Type可以来表示存放在该FD中的内容类型,比如是FV还是DATA,或者是FILE。举例如下:

 ################################################################################
 #
 # Following are lists of FD Region layout which correspond to the locations of different
 # images within the flash device.
 #
 # Regions must be defined in ascending order and may not overlap.
 #
 # A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
 # the pipe "|" character, followed by the size of the region, also in hex with the leading
 # "0x" characters. Like:
 # Offset|Size
 # PcdOffsetCName|PcdSizeCName
 # RegionType <FV, DATA, or FILE>
 #
 ################################################################################

 # 512 bytes of configuration header & 8 bytes of image header
 0x00000000|0x00024000
 gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase|gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize
 FV = FVMAIN_COMPACT

这里的FV表示存放在该FD中的FV是什么,本例表示存放的是FVMAIN_COMPACT这个FV,它会在下面进行定义。

  • FV(Flash Volume)

该区域定义该FD的布局形势,其中包含很多inf文件,表示的是该FD包含的各个子模块,该区域需要在起始位置标注[FV]如下所示:

################################################################################
#
# FV Section
#
# [FV] section is used to define what components or modules are placed within a flash
# device file.  This section also defines order the components and modules are positioned
# within the image.  The [FV] section consists of define statements, set statements and
# module statements.
#
################################################################################

[FV.FvMain]
BlockSize          = 0x40
NumBlocks          = 0         # This FV gets compressed so make it just big enough
FvAlignment        = 8         # FV alignment and FV attributes setting.
ERASE_POLARITY     = 1
MEMORY_MAPPED      = TRUE
STICKY_WRITE       = TRUE
LOCK_CAP           = TRUE
LOCK_STATUS        = TRUE
WRITE_DISABLED_CAP = TRUE
WRITE_ENABLED_CAP  = TRUE
WRITE_STATUS       = TRUE
WRITE_LOCK_CAP     = TRUE
WRITE_LOCK_STATUS  = TRUE
READ_DISABLED_CAP  = TRUE
READ_ENABLED_CAP   = TRUE
READ_STATUS        = TRUE
READ_LOCK_CAP      = TRUE
READ_LOCK_STATUS   = TRUE
FvNameGuid         = 046fae99-cf2e-49ed-a6a8-a1488b7e80d3



INF QcomModulePkg/Application/LinuxLoader/LinuxLoader.inf
 [FV.FVMAIN_COMPACT]
 FvAlignment        = 8
 ERASE_POLARITY     = 1
 MEMORY_MAPPED      = TRUE
 STICKY_WRITE       = TRUE
 LOCK_CAP           = TRUE
 LOCK_STATUS        = TRUE
 WRITE_DISABLED_CAP = TRUE
 WRITE_ENABLED_CAP  = TRUE
 WRITE_STATUS       = TRUE
 WRITE_LOCK_CAP     = TRUE
 WRITE_LOCK_STATUS  = TRUE
 READ_DISABLED_CAP  = TRUE
 READ_ENABLED_CAP   = TRUE
 READ_STATUS        = TRUE
 READ_LOCK_CAP      = TRUE
 READ_LOCK_STATUS   = TRUE
 
   FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
     SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
       SECTION FV_IMAGE = FVMAIN
     }
   }
 

  • 3
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值