diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-11 02:49:48 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-11 02:49:48 +0000 |
commit | 79b74a03e018ecbf03d8d50e6f20301e249c1ba5 (patch) | |
tree | effd580da4f1fff58f1f1523e79997732f1748e7 /BaseTools/Source/Python/GenFds | |
parent | 4d10ab79d771f6ad88f54db324a7ac184118ccf7 (diff) | |
download | edk2-platforms-79b74a03e018ecbf03d8d50e6f20301e249c1ba5.tar.xz |
Sync BaseTools Branch (version r2362) to EDKII main trunk.
Signed-off-by: lgao4
Reviewed-by: jsu1
Reviewed-by: ydliu
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12525 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/GenFds')
-rw-r--r-- | BaseTools/Source/Python/GenFds/FdfParser.py | 53 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/FfsFileStatement.py | 6 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/FfsInfStatement.py | 6 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/Fv.py | 7 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 8 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/OptRomInfStatement.py | 4 |
6 files changed, 72 insertions, 12 deletions
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 6a9e5b7b40..4f555e32bb 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1690,9 +1690,13 @@ class FdfParser: self.__UndoToken()
self.__GetRegionFileType( RegionObj)
- else:
+ elif self.__Token == "DATA":
self.__UndoToken()
self.__GetRegionDataType( RegionObj)
+ else:
+ raise Warning("A valid region type was not found. "
+ "Valid types are [SET, FV, CAPSULE, FILE, DATA]. This error occurred",
+ self.FileName, self.CurrentLineNumber)
return True
@@ -1929,6 +1933,8 @@ class FdfParser: self.__GetSetStatements(FvObj)
self.__GetFvBaseAddress(FvObj)
+
+ self.__GetFvForceRebase(FvObj)
self.__GetFvAlignment(FvObj)
@@ -2006,11 +2012,42 @@ class FdfParser: IsValidBaseAddrValue = re.compile('^0[x|X][0-9a-fA-F]+')
if not IsValidBaseAddrValue.match(self.__Token.upper()):
- raise Warning("Unknown alignment value '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
+ raise Warning("Unknown FV base address value '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
Obj.FvBaseAddress = self.__Token
return True
+ ## __GetFvForceRebase() method
+ #
+ # Get FvForceRebase for FV
+ #
+ # @param self The object pointer
+ # @param Obj for whom FvForceRebase is got
+ # @retval True Successfully find a FvForceRebase statement
+ # @retval False Not able to find a FvForceRebase statement
+ #
+ def __GetFvForceRebase(self, Obj):
+
+ if not self.__IsKeyword("FvForceRebase"):
+ return False
+
+ if not self.__IsToken( "="):
+ raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
+
+ if not self.__GetNextToken():
+ raise Warning("expected FvForceRebase value", self.FileName, self.CurrentLineNumber)
+ if self.__Token.upper() not in ["TRUE", "FALSE", "0", "0X0", "0X00", "1", "0X1", "0X01"]:
+ raise Warning("Unknown FvForceRebase value '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
+
+ if self.__Token.upper() in ["TRUE", "1", "0X1", "0X01"]:
+ Obj.FvForceRebase = True
+ elif self.__Token.upper() in ["FALSE", "0", "0X0", "0X00"]:
+ Obj.FvForceRebase = False
+ else:
+ Obj.FvForceRebase = None
+
+ return True
+
## __GetFvAttributes() method
#
# Get attributes for FV
@@ -2215,7 +2252,10 @@ class FdfParser: ffsInf.KeepReloc = True
else:
raise Warning("Unknown reloc strip flag '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
-
+
+ ffsInf.CurrentLineNum = self.CurrentLineNumber
+ ffsInf.CurrentLineContent = self.__CurrentLine()
+
if ForCapsule:
capsuleFfs = CapsuleData.CapsuleFfs()
capsuleFfs.Ffs = ffsInf
@@ -2325,7 +2365,10 @@ class FdfParser: self.__Token = 'PCD('+PcdPair[1]+'.'+PcdPair[0]+')'
FfsFileObj.NameGuid = self.__Token
-
+
+ FfsFileObj.CurrentLineNum = self.CurrentLineNumber
+ FfsFileObj.CurrentLineContent = self.__CurrentLine()
+
self.__GetFilePart( FfsFileObj, MacroDict.copy())
if ForCapsule:
@@ -3922,7 +3965,7 @@ class FdfParser: Overrides.PciRevision = self.__Token
continue
- if self.__IsKeyword( "COMPRESS"):
+ if self.__IsKeyword( "PCI_COMPRESS"):
if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken():
diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/BaseTools/Source/Python/GenFds/FfsFileStatement.py index 013dbb1f02..b858549361 100644 --- a/BaseTools/Source/Python/GenFds/FfsFileStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsFileStatement.py @@ -39,6 +39,10 @@ class FileStatement (FileStatementClassObject) : #
def __init__(self):
FileStatementClassObject.__init__(self)
+ self.CurrentLineNum = None
+ self.CurrentLineContent = None
+ self.FileName = None
+ self.InfFileName = None
## GenFfs() method
#
@@ -94,7 +98,7 @@ class FileStatement (FileStatementClassObject) : SectionFiles = []
Index = 0
SectionAlignments = []
- for section in self.SectionList :
+ for section in self.SectionList:
Index = Index + 1
SecIndex = '%d' %Index
# process the inside FvImage from FvSection or GuidSection
diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index b9e18f6bca..c6f29f6ddd 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -56,6 +56,10 @@ class FfsInfStatement(FfsInfStatementClassObject): self.PiSpecVersion = '0x00000000'
self.InfModule = None
self.FinalTargetSuffixMap = {}
+ self.CurrentLineNum = None
+ self.CurrentLineContent = None
+ self.FileName = None
+ self.InfFileName = None
## GetFinalTargetSuffixMap() method
#
@@ -452,7 +456,7 @@ class FfsInfStatement(FfsInfStatementClassObject): Arch = ''
OutputPath = ''
(ModulePath, FileName) = os.path.split(self.InfFileName)
- Index = FileName.find('.')
+ Index = FileName.rfind('.')
FileName = FileName[0:Index]
Arch = "NoneArch"
if self.CurrentArch != None:
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py index 773b0efbe8..f186ab0e73 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -47,6 +47,7 @@ class FV (FvClassObject): self.FvAddressFileName = None
self.CapsuleName = None
self.FvBaseAddress = None
+ self.FvForceRebase = None
## AddToBuffer()
#
@@ -133,7 +134,8 @@ class FV (FvClassObject): FvOutputFile,
[self.InfFileName],
AddressFile=FvInfoFileName,
- FfsList=FfsFileList
+ FfsList=FfsFileList,
+ ForceRebase=self.FvForceRebase
)
NewFvInfo = None
@@ -162,7 +164,8 @@ class FV (FvClassObject): FvOutputFile,
[self.InfFileName],
AddressFile=FvInfoFileName,
- FfsList=FfsFileList
+ FfsList=FfsFileList,
+ ForceRebase=self.FvForceRebase
)
#
diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index 3abaef2023..236283751e 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -422,7 +422,7 @@ class GenFdsGlobalVariable: GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FFS") @staticmethod - def GenerateFirmwareVolume(Output, Input, BaseAddress=None, Capsule=False, Dump=False, + def GenerateFirmwareVolume(Output, Input, BaseAddress=None, ForceRebase=None, Capsule=False, Dump=False, AddressFile=None, MapFile=None, FfsList=[]): if not GenFdsGlobalVariable.NeedsUpdate(Output, Input+FfsList): return @@ -431,6 +431,12 @@ class GenFdsGlobalVariable: Cmd = ["GenFv"] if BaseAddress not in [None, '']: Cmd += ["-r", BaseAddress] + + if ForceRebase == False: + Cmd +=["-F", "FALSE"] + elif ForceRebase == True: + Cmd +=["-F", "TRUE"] + if Capsule: Cmd += ["-c"] if Dump: diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py index d64f836164..069414df5b 100644 --- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py +++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py @@ -50,10 +50,10 @@ class OptRomInfStatement (FfsInfStatement): self.OverrideAttribs = OptionRom.OverrideAttribs()
if self.OverrideAttribs.NeedCompress == None:
- self.OverrideAttribs.NeedCompress = self.OptRomDefs.get ('COMPRESS')
+ self.OverrideAttribs.NeedCompress = self.OptRomDefs.get ('PCI_COMPRESS')
if self.OverrideAttribs.NeedCompress is not None:
if self.OverrideAttribs.NeedCompress.upper() not in ('TRUE', 'FALSE'):
- GenFdsGlobalVariable.ErrorLogger( "Expected TRUE/FALSE for COMPRESS: %s" %self.InfFileName)
+ GenFdsGlobalVariable.ErrorLogger( "Expected TRUE/FALSE for PCI_COMPRESS: %s" %self.InfFileName)
self.OverrideAttribs.NeedCompress = \
self.OverrideAttribs.NeedCompress.upper() == 'TRUE'
|