diff options
author | Bob Feng <bob.c.feng@intel.com> | 2021-06-08 10:31:55 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-07-12 07:40:07 +0000 |
commit | 40a9066439cbab235933525810f46f03806c6ef1 (patch) | |
tree | 2096e83224bf5e14623622f2ec41b0d2642d022b /BaseTools | |
parent | 3de3c24755bdee191429c0a72aed5110e9a0b2f9 (diff) | |
download | edk2-40a9066439cbab235933525810f46f03806c6ef1.tar.gz edk2-40a9066439cbab235933525810f46f03806c6ef1.tar.bz2 edk2-40a9066439cbab235933525810f46f03806c6ef1.zip |
BaseTools: Enable the flag to treat dynamic pcd as dynamicEx
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1688
In order to support binary build, build tool add a
flag to convert type of Dynamic Pcd to DynamicEx Pcd
User can append -D PCD_DYNAMIC_AS_DYNAMICEX to build command
to enable this function.
Also, user can add "PCD_DYNAMIC_AS_DYNAMICEX = TRUE/FALSE" to the
defines section of Dsc file to enable this function.
PCD_DYNAMIC_AS_DYNAMICEX is a new reserved key word for this function.
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/Python/Common/DataType.py | 1 | ||||
-rw-r--r-- | BaseTools/Source/Python/Workspace/BuildClassObject.py | 153 | ||||
-rw-r--r-- | BaseTools/Source/Python/Workspace/DecBuildData.py | 16 | ||||
-rw-r--r-- | BaseTools/Source/Python/Workspace/DscBuildData.py | 19 | ||||
-rw-r--r-- | BaseTools/Source/Python/Workspace/InfBuildData.py | 15 |
5 files changed, 73 insertions, 131 deletions
diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py index fb88f20cc4..4e9c9e34af 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -404,6 +404,7 @@ TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES = 'SUPPORTED_ARCHITECTURES' TAB_DSC_DEFINES_BUILD_TARGETS = 'BUILD_TARGETS'
TAB_DSC_DEFINES_SKUID_IDENTIFIER = 'SKUID_IDENTIFIER'
TAB_DSC_DEFINES_PCD_INFO_GENERATION = 'PCD_INFO_GENERATION'
+TAB_DSC_DEFINES_PCD_DYNAMIC_AS_DYNAMICEX = 'PCD_DYNAMIC_AS_DYNAMICEX'
TAB_DSC_DEFINES_PCD_VAR_CHECK_GENERATION = 'PCD_VAR_CHECK_GENERATION'
TAB_DSC_DEFINES_FLASH_DEFINITION = 'FLASH_DEFINITION'
TAB_DSC_DEFINES_BUILD_NUMBER = 'BUILD_NUMBER'
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index ebb65fc2fe..88a1d1582c 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -12,7 +12,9 @@ import re from collections import OrderedDict
from Common.Misc import CopyDict,ArrayIndex
import copy
+from CommonDataClass.DataClass import *
import Common.EdkLogger as EdkLogger
+import Common.GlobalData as GlobalData
from Common.BuildToolError import OPTION_VALUE_INVALID
from Common.caching import cached_property
StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$')
@@ -398,6 +400,67 @@ class StructurePcd(PcdClassObject): LibraryClassObject = namedtuple('LibraryClassObject', ['LibraryClass','SupModList'])
+class BuildData(object):
+ # dict used to convert PCD type in database to string used by build tool
+
+ _PCD_TYPE_STRING_ = {
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
+ }
+
+ def UpdatePcdTypeDict(self):
+ if GlobalData.gCommandLineDefines.get(TAB_DSC_DEFINES_PCD_DYNAMIC_AS_DYNAMICEX,"FALSE").upper() == "TRUE":
+ self._PCD_TYPE_STRING_ = {
+ MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
+ MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
+ MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
+ MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
+ MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
+ MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
+ MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
+ }
+
+ ## Convert the class to a string
+ #
+ # Convert member MetaFile of the class to a string
+ #
+ # @retval string Formatted String
+ #
+ def __str__(self):
+ return str(self.MetaFile)
+
+ ## Override __eq__ function
+ #
+ # Check whether ModuleBuildClassObjects are the same
+ #
+ # @retval False The two ModuleBuildClassObjects are different
+ # @retval True The two ModuleBuildClassObjects are the same
+ #
+ def __eq__(self, Other):
+ return self.MetaFile == Other
+
+ ## Override __hash__ function
+ #
+ # Use MetaFile as key in hash table
+ #
+ # @retval string Key for hash table
+ #
+ def __hash__(self):
+ return hash(self.MetaFile)
+
## ModuleBuildClassObject
#
# This Class defines ModuleBuildClass
@@ -442,7 +505,7 @@ LibraryClassObject = namedtuple('LibraryClassObject', ['LibraryClass','SupModLis # { [BuildOptionKey] : BuildOptionValue}
# @var Depex: To store value for Depex
#
-class ModuleBuildClassObject(object):
+class ModuleBuildClassObject(BuildData):
def __init__(self):
self.AutoGenVersion = 0
self.MetaFile = ''
@@ -476,34 +539,6 @@ class ModuleBuildClassObject(object): self.StrPcdSet = []
self.StrPcdOverallValue = {}
- ## Convert the class to a string
- #
- # Convert member MetaFile of the class to a string
- #
- # @retval string Formatted String
- #
- def __str__(self):
- return str(self.MetaFile)
-
- ## Override __eq__ function
- #
- # Check whether ModuleBuildClassObjects are the same
- #
- # @retval False The two ModuleBuildClassObjects are different
- # @retval True The two ModuleBuildClassObjects are the same
- #
- def __eq__(self, Other):
- return self.MetaFile == Other
-
- ## Override __hash__ function
- #
- # Use MetaFile as key in hash table
- #
- # @retval string Key for hash table
- #
- def __hash__(self):
- return hash(self.MetaFile)
-
## PackageBuildClassObject
#
# This Class defines PackageBuildClass
@@ -527,7 +562,7 @@ class ModuleBuildClassObject(object): # @var Pcds: To store value for Pcds, it is a set structure as
# { [(PcdCName, PcdGuidCName)] : PcdClassObject}
#
-class PackageBuildClassObject(object):
+class PackageBuildClassObject(BuildData):
def __init__(self):
self.MetaFile = ''
self.PackageName = ''
@@ -541,34 +576,6 @@ class PackageBuildClassObject(object): self.LibraryClasses = {}
self.Pcds = {}
- ## Convert the class to a string
- #
- # Convert member MetaFile of the class to a string
- #
- # @retval string Formatted String
- #
- def __str__(self):
- return str(self.MetaFile)
-
- ## Override __eq__ function
- #
- # Check whether PackageBuildClassObjects are the same
- #
- # @retval False The two PackageBuildClassObjects are different
- # @retval True The two PackageBuildClassObjects are the same
- #
- def __eq__(self, Other):
- return self.MetaFile == Other
-
- ## Override __hash__ function
- #
- # Use MetaFile as key in hash table
- #
- # @retval string Key for hash table
- #
- def __hash__(self):
- return hash(self.MetaFile)
-
## PlatformBuildClassObject
#
# This Class defines PlatformBuildClass
@@ -597,7 +604,7 @@ class PackageBuildClassObject(object): # @var BuildOptions: To store value for BuildOptions, it is a set structure as
# { [BuildOptionKey] : BuildOptionValue }
#
-class PlatformBuildClassObject(object):
+class PlatformBuildClassObject(BuildData):
def __init__(self):
self.MetaFile = ''
self.PlatformName = ''
@@ -616,31 +623,3 @@ class PlatformBuildClassObject(object): self.Libraries = {}
self.Pcds = {}
self.BuildOptions = {}
-
- ## Convert the class to a string
- #
- # Convert member MetaFile of the class to a string
- #
- # @retval string Formatted String
- #
- def __str__(self):
- return str(self.MetaFile)
-
- ## Override __eq__ function
- #
- # Check whether PlatformBuildClassObjects are the same
- #
- # @retval False The two PlatformBuildClassObjects are different
- # @retval True The two PlatformBuildClassObjects are the same
- #
- def __eq__(self, Other):
- return self.MetaFile == Other
-
- ## Override __hash__ function
- #
- # Use MetaFile as key in hash table
- #
- # @retval string Key for hash table
- #
- def __hash__(self):
- return hash(self.MetaFile)
diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/Source/Python/Workspace/DecBuildData.py index 30826a3cea..eeb7c490ac 100644 --- a/BaseTools/Source/Python/Workspace/DecBuildData.py +++ b/BaseTools/Source/Python/Workspace/DecBuildData.py @@ -21,20 +21,6 @@ from re import compile # into PackageBuildClassObject form for easier use for AutoGen.
#
class DecBuildData(PackageBuildClassObject):
- # dict used to convert PCD type in database to string used by build tool
- _PCD_TYPE_STRING_ = {
- MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
- MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
- MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
- MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
- MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
- MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
- MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
- MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
- MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
- MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
- MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
- }
# dict used to convert part of [Defines] to members of DecBuildData directly
_PROPERTY_ = {
@@ -47,7 +33,6 @@ class DecBuildData(PackageBuildClassObject): TAB_DEC_DEFINES_PKG_UNI_FILE : "_PkgUniFile",
}
-
## Constructor of DecBuildData
#
# Initialize object of DecBuildData
@@ -68,6 +53,7 @@ class DecBuildData(PackageBuildClassObject): self._Target = Target
self._Toolchain = Toolchain
self._Clear()
+ self.UpdatePcdTypeDict()
## XXX[key] = value
def __setitem__(self, key, value):
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 5f07d3e75c..4d5b1ad4d9 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -179,20 +179,6 @@ def GetDependencyList(FileStack, SearchPathList): return DependencyList
class DscBuildData(PlatformBuildClassObject):
- # dict used to convert PCD type in database to string used by build tool
- _PCD_TYPE_STRING_ = {
- MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
- MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
- MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
- MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
- MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
- MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
- MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
- MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
- MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
- MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
- MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
- }
# dict used to convert part of [Defines] to members of DscBuildData directly
_PROPERTY_ = {
@@ -242,7 +228,7 @@ class DscBuildData(PlatformBuildClassObject): self.WorkspaceDir = os.getenv("WORKSPACE") if os.getenv("WORKSPACE") else ""
self.DefaultStores = None
self.SkuIdMgr = SkuClass(self.SkuName, self.SkuIds)
-
+ self.UpdatePcdTypeDict()
@property
def OutputPath(self):
if os.getenv("WORKSPACE"):
@@ -411,6 +397,9 @@ class DscBuildData(PlatformBuildClassObject): except:
EdkLogger.error("build", FORMAT_INVALID, "Invalid GUID format for VPD_TOOL_GUID", File=self.MetaFile)
self._VpdToolGuid = Record[2]
+ elif Name == TAB_DSC_DEFINES_PCD_DYNAMIC_AS_DYNAMICEX:
+ if TAB_DSC_DEFINES_PCD_DYNAMIC_AS_DYNAMICEX not in gCommandLineDefines:
+ gCommandLineDefines[TAB_DSC_DEFINES_PCD_DYNAMIC_AS_DYNAMICEX] = Record[2].strip()
elif Name in self:
self[Name] = Record[2]
# set _Header to non-None in order to avoid database re-querying
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/Source/Python/Workspace/InfBuildData.py index 7675b0ea00..45b8ef4716 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -59,20 +59,6 @@ def _PpiValue(CName, PackageList, Inffile = None): # into ModuleBuildClassObject form for easier use for AutoGen.
#
class InfBuildData(ModuleBuildClassObject):
- # dict used to convert PCD type in database to string used by build tool
- _PCD_TYPE_STRING_ = {
- MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD,
- MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE,
- MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG,
- MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC,
- MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC,
- MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII,
- MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD,
- MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX,
- MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX,
- MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII,
- MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD,
- }
# dict used to convert part of [Defines] to members of InfBuildData directly
_PROPERTY_ = {
@@ -154,6 +140,7 @@ class InfBuildData(ModuleBuildClassObject): self._PcdComments = None
self._BuildOptions = None
self._DependencyFileList = None
+ self.UpdatePcdTypeDict()
self.LibInstances = []
self.ReferenceModules = set()
|