BaseTools: add the support for --pcd feature to patch the binary efi

the original --pcd feature can override the Pcd value when build the
source driver, while it missed the binary driver. this patch add the
support to patch the binary efi for --pcd feature.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Yonghong Zhu
2016-04-20 09:32:52 +08:00
parent 2a29017e3e
commit 6b17c11b6f
4 changed files with 101 additions and 5 deletions

View File

@ -1,7 +1,7 @@
## @file
# process FFS generation from INF statement
#
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2014-2016 Hewlett-Packard Development Company, L.P.<BR>
#
# This program and the accompanying materials
@ -43,6 +43,7 @@ from AutoGen.GenDepex import DependencyExpression
from PatchPcdValue.PatchPcdValue import PatchBinaryFile
from Common.LongFilePathSupport import CopyLongFilePath
from Common.LongFilePathSupport import OpenLongFilePath as open
import Common.GlobalData as GlobalData
## generate FFS from INF
#
@ -260,7 +261,16 @@ class FfsInfStatement(FfsInfStatementClassObject):
DefaultValue = FdfPcdDict[PcdKey]
FdfOverride = True
if not DscOverride and not FdfOverride:
# Override Patchable PCD value by the value from Build Option
BuildOptionOverride = False
if GlobalData.BuildOptionPcd:
for pcd in GlobalData.BuildOptionPcd:
if PcdKey == (pcd[1], pcd[0]):
DefaultValue = pcd[2]
BuildOptionOverride = True
break
if not DscOverride and not FdfOverride and not BuildOptionOverride:
continue
# Check value, if value are equal, no need to patch
if Pcd.DatumType == "VOID*":