diff options
author | Feng, Bob C <bob.c.feng@intel.com> | 2018-12-20 19:12:12 +0800 |
---|---|---|
committer | BobCF <bob.c.feng@intel.com> | 2018-12-25 10:40:10 +0800 |
commit | abc4c3386a50cb97c30ec108f0cb85aef769c267 (patch) | |
tree | 5563ccf8489b521fec6615e925a76448ce318e34 /BaseTools/Source/Python/GenFds/GenFds.py | |
parent | b70ec0de46d052d2debf0c8e2159addf9628604f (diff) | |
download | edk2-abc4c3386a50cb97c30ec108f0cb85aef769c267.tar.gz edk2-abc4c3386a50cb97c30ec108f0cb85aef769c267.tar.bz2 edk2-abc4c3386a50cb97c30ec108f0cb85aef769c267.zip |
BaseTools: Reset FdsGlobalVariable
https://bugzilla.tianocore.org/show_bug.cgi?id=1418
This patch is going to fix a regression issue that is introduced
by commit b3497bad1221704a5dbc5da0b10f42625f1ad2ed.
Before commit b3497b, build launched a external GenFds.py to generate
Fd, so the global variable in GenFds.py was reset in each execution.
After commit b3497b, each GenFds run in the same python interpeter, so
we need to explicitly reset global variable in each GenFdsApi call.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'BaseTools/Source/Python/GenFds/GenFds.py')
-rw-r--r-- | BaseTools/Source/Python/GenFds/GenFds.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py index 51655cc09c..447aa7f5eb 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -41,6 +41,8 @@ from Workspace.WorkspaceDatabase import WorkspaceDatabase from .FdfParser import FdfParser, Warning
from .GenFdsGlobalVariable import GenFdsGlobalVariable
from .FfsFileStatement import FileStatement
+import Common.DataType as DataType
+from struct import Struct
## Version and Copyright
versionNumber = "1.0" + ' ' + gBUILD_VERSION
@@ -62,11 +64,60 @@ def main(): EdkLogger.Initialize()
return GenFdsApi(OptionsToCommandDict(Options))
+def resetFdsGlobalVariable():
+ GenFdsGlobalVariable.FvDir = ''
+ GenFdsGlobalVariable.OutputDirDict = {}
+ GenFdsGlobalVariable.BinDir = ''
+ # will be FvDir + os.sep + 'Ffs'
+ GenFdsGlobalVariable.FfsDir = ''
+ GenFdsGlobalVariable.FdfParser = None
+ GenFdsGlobalVariable.LibDir = ''
+ GenFdsGlobalVariable.WorkSpace = None
+ GenFdsGlobalVariable.WorkSpaceDir = ''
+ GenFdsGlobalVariable.ConfDir = ''
+ GenFdsGlobalVariable.EdkSourceDir = ''
+ GenFdsGlobalVariable.OutputDirFromDscDict = {}
+ GenFdsGlobalVariable.TargetName = ''
+ GenFdsGlobalVariable.ToolChainTag = ''
+ GenFdsGlobalVariable.RuleDict = {}
+ GenFdsGlobalVariable.ArchList = None
+ GenFdsGlobalVariable.VtfDict = {}
+ GenFdsGlobalVariable.ActivePlatform = None
+ GenFdsGlobalVariable.FvAddressFileName = ''
+ GenFdsGlobalVariable.VerboseMode = False
+ GenFdsGlobalVariable.DebugLevel = -1
+ GenFdsGlobalVariable.SharpCounter = 0
+ GenFdsGlobalVariable.SharpNumberPerLine = 40
+ GenFdsGlobalVariable.FdfFile = ''
+ GenFdsGlobalVariable.FdfFileTimeStamp = 0
+ GenFdsGlobalVariable.FixedLoadAddress = False
+ GenFdsGlobalVariable.PlatformName = ''
+
+ GenFdsGlobalVariable.BuildRuleFamily = DataType.TAB_COMPILER_MSFT
+ GenFdsGlobalVariable.ToolChainFamily = DataType.TAB_COMPILER_MSFT
+ GenFdsGlobalVariable.__BuildRuleDatabase = None
+ GenFdsGlobalVariable.GuidToolDefinition = {}
+ GenFdsGlobalVariable.FfsCmdDict = {}
+ GenFdsGlobalVariable.SecCmdList = []
+ GenFdsGlobalVariable.CopyList = []
+ GenFdsGlobalVariable.ModuleFile = ''
+ GenFdsGlobalVariable.EnableGenfdsMultiThread = False
+
+ GenFdsGlobalVariable.LargeFileInFvFlags = []
+ GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID = '5473C07A-3DCB-4dca-BD6F-1E9689E7349A'
+ GenFdsGlobalVariable.LARGE_FILE_SIZE = 0x1000000
+
+ GenFdsGlobalVariable.SectionHeader = Struct("3B 1B")
+
+ # FvName, FdName, CapName in FDF, Image file name
+ GenFdsGlobalVariable.ImageBinDict = {}
+
def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None):
global Workspace
Workspace = ""
ArchList = None
ReturnCode = 0
+ resetFdsGlobalVariable()
try:
if FdsCommandDict.get("verbose"):
|