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
---
BaseTools/Source/Python/AutoGen/GenMake.py | 5 ++
BaseTools/Source/Python/GenFds/FfsInfStatement.py | 14 +++-
BaseTools/Source/Python/GenFds/GenFds.py | 85 +-
.../Source/Python/GenFds/GenFdsGlobalVariable.py | 2 -
4 files changed, 101 insertions(+), 5 deletions(-)
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py
b/BaseTools/Source/Python/AutoGen/GenMake.py
index a4844be..afe82c8 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1422,10 +1422,15 @@ class TopLevelMakefile(BuildFile):
ExtraOption += " -c"
if GlobalData.gIgnoreSource:
ExtraOption += " --ignore-sources"
+if GlobalData.BuildOptionPcd:
+for index, option in enumerate(GlobalData.gCommand):
+if "--pcd" == option and GlobalData.gCommand[index+1]:
+ExtraOption += " --pcd " + GlobalData.gCommand[index+1]
+
MakefileName = self._FILE_NAME_[self._FileType]
SubBuildCommandList = []
for A in PlatformInfo.ArchList:
Command = self._MAKE_TEMPLATE_[self._FileType] %
{"file":os.path.join("$(BUILD_DIR)", A, MakefileName)}
SubBuildCommandList.append(Command)
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
index 864e5be..a048949 100644
--- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py
+++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py
@@ -1,9 +1,9 @@
## @file
# process FFS generation from INF statement
#
-# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD
License
# which accompanies this distribution. The full text of the license may be
found at
@@ -41,10 +41,11 @@ from FvImageSection import FvImageSection
from Common.Misc import PeImageClass
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
#
#
class FfsInfStatement(FfsInfStatementClassObject):
@@ -258,11 +259,20 @@ class FfsInfStatement(FfsInfStatementClassObject):
FdfOverride = False
if PcdKey in FdfPcdDict:
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*":
if Pcd.DefaultValue == DefaultValue or DefaultValue in [None,
'']:
continue
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py
b/BaseTools/Source/Python/GenFds/GenFds.py
index d97fc28..ec9ff7a 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -36,17 +36,18 @@ from Common import EdkLogger
from Common.String import *
from Common.Misc import DirCache, PathClass
from Common.Misc import SaveFileOnChange
from Common.Misc import ClearDuplicatedInf
from Common.Misc import GuidStructureStringToGuidString
+from Common.Misc import CheckPcdDatum
from Common.BuildVersion import gBUILD_VERSION
from Common.MultipleWorkspace import MultipleWorkspace as mws
## Version and Copyright
versionNumber = "1.0" + ' ' + gBUILD_VERSION
__version__ = "%prog Version " + versionNumber
-__copyright__ = "Copyright (c) 2007 - 2014, Intel Corporation All rights
reserved."
+__copyright__ = "Copyright (c) 2007 - 2016, Intel Corporation All rights
reserved."
## Tool entrance method
#
# This method mainly dispatch specific methods per the command line options.
# If no error found, return zero value so the caller of this tool can know
@@ -272,10 +273,18 @@ def main():
GenFds.OnlyGenerateThisCap = Option