summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/Common/FdfParserLite.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/Common/FdfParserLite.py
parentfe35c036354c4b6bf18c4699a45156f3965fae2a (diff)
downloadedk2-platforms-52302d4dee589a5df43a464420c9fe68ba83937d.tar.xz
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/Common/FdfParserLite.py')
-rw-r--r--BaseTools/Source/Python/Common/FdfParserLite.py43
1 files changed, 31 insertions, 12 deletions
diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py
index b397b16b42..e9b69ff1b9 100644
--- a/BaseTools/Source/Python/Common/FdfParserLite.py
+++ b/BaseTools/Source/Python/Common/FdfParserLite.py
@@ -1439,10 +1439,17 @@ class FdfParser(object):
def __GetBlockStatements(self, Obj):
if not self.__GetBlockStatement(Obj):
- raise Warning("expected block statement At Line ", self.FileName, self.CurrentLineNumber)
-
+ #set default block size is 1
+ Obj.BlockSizeList.append((1, Obj.Size, None))
+ return True
+
while self.__GetBlockStatement(Obj):
pass
+
+ for Item in Obj.BlockSizeList:
+ if Item[0] == None or Item[1] == None:
+ raise Warning("expected block statement for Fd Section", self.FileName, self.CurrentLineNumber)
+
return True
## __GetBlockStatement() method
@@ -2329,6 +2336,8 @@ class FdfParser(object):
AlignValue = None
if self.__GetAlignment():
+ if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
+ raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
AlignValue = self.__Token
BuildNum = None
@@ -2342,6 +2351,8 @@ class FdfParser(object):
BuildNum = self.__Token
if self.__IsKeyword( "VERSION"):
+ if AlignValue == 'Auto':
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="):
raise Warning("expected '=' At Line ", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken():
@@ -2356,6 +2367,8 @@ class FdfParser(object):
Obj.SectionList.append(VerSectionObj)
elif self.__IsKeyword( "UI"):
+ if AlignValue == 'Auto':
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="):
raise Warning("expected '=' At Line ", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken():
@@ -2369,6 +2382,8 @@ class FdfParser(object):
Obj.SectionList.append(UiSectionObj)
elif self.__IsKeyword( "FV_IMAGE"):
+ if AlignValue == 'Auto':
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="):
raise Warning("expected '=' At Line ", self.FileName, self.CurrentLineNumber)
if not self.__GetNextWord():
@@ -2409,6 +2424,8 @@ class FdfParser(object):
Obj.SectionList.append(FvImageSectionObj)
elif self.__IsKeyword("PEI_DEPEX_EXP") or self.__IsKeyword("DXE_DEPEX_EXP") or self.__IsKeyword("SMM_DEPEX_EXP"):
+ if AlignValue == 'Auto':
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
DepexSectionObj = CommonDataClass.FdfClass.DepexSectionClassObject()
DepexSectionObj.Alignment = AlignValue
DepexSectionObj.DepexType = self.__Token
@@ -2436,6 +2453,8 @@ class FdfParser(object):
if self.__Token not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
"UI", "VERSION", "PEI_DEPEX", "SUBTYPE_GUID", "SMM_DEPEX"):
raise Warning("Unknown section type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
+ if AlignValue == 'Auto'and (not self.__Token == 'PE32') and (not self.__Token == 'TE'):
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
# DataSection
DataSectionObj = CommonDataClass.FdfClass.DataSectionClassObject()
DataSectionObj.Alignment = AlignValue
@@ -2585,6 +2604,8 @@ class FdfParser(object):
AlignValue = None
if self.__GetAlignment():
+ if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
+ raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
AlignValue = self.__Token
if not self.__GetCglSection(FfsFileObj, AlignValue):
@@ -2899,7 +2920,7 @@ class FdfParser(object):
AlignValue = ""
if self.__GetAlignment():
- if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
+ if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber)
AlignValue = self.__Token
@@ -2963,8 +2984,10 @@ class FdfParser(object):
CheckSum = True
if self.__GetAlignment():
- if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
+ if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber)
+ if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
AlignValue = self.__Token
if not self.__GetNextToken():
@@ -3039,14 +3062,6 @@ class FdfParser(object):
raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber)
FvImageSectionObj.Alignment = self.__Token
- if self.__IsKeyword("FV"):
- FvImageSectionObj.FvFileType = self.__Token
-
- if self.__GetAlignment():
- if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
- raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber)
- FvImageSectionObj.Alignment = self.__Token
-
if self.__IsToken('|'):
FvImageSectionObj.FvFileExtension = self.__GetFileExtension()
elif self.__GetNextToken():
@@ -3110,6 +3125,10 @@ class FdfParser(object):
EfiSectionObj.BuildNum = self.__Token
if self.__GetAlignment():
+ if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
+ raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
+ if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):
+ raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
EfiSectionObj.Alignment = self.__Token
if self.__IsKeyword('RELOCS_STRIPPED') or self.__IsKeyword('RELOCS_RETAINED'):