summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-28 23:39:39 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-28 23:39:39 +0000
commit52302d4dee589a5df43a464420c9fe68ba83937d (patch)
tree2393f61b9e8975134e3cdfa0352d4c51a3b2ac8d /BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
parentfe35c036354c4b6bf18c4699a45156f3965fae2a (diff)
downloadedk2-52302d4dee589a5df43a464420c9fe68ba83937d.tar.gz
edk2-52302d4dee589a5df43a464420c9fe68ba83937d.tar.bz2
edk2-52302d4dee589a5df43a464420c9fe68ba83937d.zip
Sync EDKII BaseTools to BaseTools project r1903.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10123 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py')
-rw-r--r--BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py37
1 files changed, 29 insertions, 8 deletions
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index b54e8c88e2..cad2758627 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -1,7 +1,7 @@
## @file
# Global variables for GenFds
#
-# Copyright (c) 2007, Intel Corporation
+# Copyright (c) 2007 - 2010, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -54,6 +54,7 @@ class GenFdsGlobalVariable:
FdfFile = ''
FdfFileTimeStamp = 0
FixedLoadAddress = False
+ PlatformName = ''
SectionHeader = struct.Struct("3B 1B")
@@ -154,7 +155,7 @@ class GenFdsGlobalVariable:
@staticmethod
def GenerateSection(Output, Input, Type=None, CompressionType=None, Guid=None,
- GuidHdrLen=None, GuidAttr=None, Ui=None, Ver=None):
+ GuidHdrLen=None, GuidAttr=[], Ui=None, Ver=None, InputAlign=None):
if not GenFdsGlobalVariable.NeedsUpdate(Output, Input):
return
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
@@ -168,8 +169,14 @@ class GenFdsGlobalVariable:
Cmd += ["-g", Guid]
if GuidHdrLen not in [None, '']:
Cmd += ["-l", GuidHdrLen]
- if GuidAttr not in [None, '']:
- Cmd += ["-r", GuidAttr]
+ if len(GuidAttr) != 0:
+ #Add each guided attribute
+ for Attr in GuidAttr:
+ Cmd += ["-r", Attr]
+ if InputAlign != None:
+ #Section Align is only for dummy section without section type
+ for SecAlign in InputAlign:
+ Cmd += ["--sectionalign", SecAlign]
if Ui not in [None, '']:
#Cmd += ["-n", '"' + Ui + '"']
@@ -195,6 +202,15 @@ class GenFdsGlobalVariable:
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")
@staticmethod
+ def GetAlignment (AlignString):
+ if AlignString == None:
+ return 0
+ if AlignString in ("1K", "2K", "4K", "8K", "16K", "32K", "64K"):
+ return int (AlignString.rstrip('K')) * 1024
+ else:
+ return int (AlignString)
+
+ @staticmethod
def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, Align=None,
SectionAlign=None):
if not GenFdsGlobalVariable.NeedsUpdate(Output, Input):
@@ -331,18 +347,19 @@ class GenFdsGlobalVariable:
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate option rom")
@staticmethod
- def GuidTool(Output, Input, ToolPath, Options=''):
+ def GuidTool(Output, Input, ToolPath, Options='', returnValue=[]):
if not GenFdsGlobalVariable.NeedsUpdate(Output, Input):
return
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))
- Cmd = [ToolPath, Options]
+ Cmd = [ToolPath, ]
+ Cmd += Options.split(' ')
Cmd += ["-o", Output]
Cmd += Input
- GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to call " + ToolPath)
+ GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to call " + ToolPath, returnValue)
- def CallExternalTool (cmd, errorMess):
+ def CallExternalTool (cmd, errorMess, returnValue=[]):
if type(cmd) not in (tuple, list):
GenFdsGlobalVariable.ErrorLogger("ToolError! Invalid parameter type in call to CallExternalTool")
@@ -369,6 +386,10 @@ class GenFdsGlobalVariable:
while PopenObject.returncode == None :
PopenObject.wait()
+ if returnValue != [] and returnValue[0] != 0:
+ #get command return value
+ returnValue[0] = PopenObject.returncode
+ return
if PopenObject.returncode != 0 or GenFdsGlobalVariable.VerboseMode or GenFdsGlobalVariable.DebugLevel != -1:
GenFdsGlobalVariable.InfLogger ("Return Value = %d" %PopenObject.returncode)
GenFdsGlobalVariable.InfLogger (out)