summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2010-06-28 09:33:10 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2010-06-28 09:33:10 +0000
commit9053bc517ea77b9780830bf08b966979eff1cb0f (patch)
tree960bef933abdad405b30af68375d4743e98b80c5 /BaseTools/Source/Python
parent96dd57ee8d5deb549310c4fbd4e4b5c7a810a928 (diff)
downloadedk2-platforms-9053bc517ea77b9780830bf08b966979eff1cb0f.tar.xz
Sync EDKII BaseTools to BaseTools project r1988
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10607 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenC.py8
-rw-r--r--BaseTools/Source/Python/Common/String.py11
-rw-r--r--BaseTools/Source/Python/CommonDataClass/DataClass.py6
-rw-r--r--BaseTools/Source/Python/GenFds/DataSection.py9
-rw-r--r--BaseTools/Source/Python/GenFds/FdfParser.py8
-rw-r--r--BaseTools/Source/Python/Trim/Trim.py5
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py2
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceDatabase.py7
8 files changed, 41 insertions, 15 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 824e5e0583..f0f92b0865 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1227,7 +1227,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
NumberOfExTokens = 0
NumberOfSizeItems = 0
GuidList = []
-
+
for Pcd in Platform.DynamicPcdList:
CName = Pcd.TokenCName
TokenSpaceGuidCName = Pcd.TokenSpaceGuidCName
@@ -1262,7 +1262,9 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
VariableHeadValueList = []
Pcd.InitString = 'UNINIT'
- if Pcd.DatumType == 'VOID*':
+ if Pcd.Type in ["DynamicVpd", "DynamicExVpd"]:
+ Pcd.TokenTypeList = ['PCD_TYPE_VPD']
+ elif Pcd.DatumType == 'VOID*':
Pcd.TokenTypeList = ['PCD_TYPE_STRING']
elif Pcd.DatumType == 'BOOLEAN':
Pcd.TokenTypeList = ['PCD_DATUM_TYPE_UINT8']
@@ -1329,7 +1331,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
Pcd.TokenTypeList += ['PCD_TYPE_VPD']
Pcd.InitString = 'INIT'
VpdHeadOffsetList.append(Sku.VpdOffset)
-
+ continue
if Pcd.DatumType == 'VOID*':
Pcd.TokenTypeList += ['PCD_TYPE_STRING']
diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py
index 1f199fe2ca..896fb7da0f 100644
--- a/BaseTools/Source/Python/Common/String.py
+++ b/BaseTools/Source/Python/Common/String.py
@@ -279,9 +279,16 @@ def CleanString(Line, CommentCharacter = DataType.TAB_COMMENT_SPLIT, AllowCppSty
if AllowCppStyleComment:
Line = Line.replace(DataType.TAB_COMMENT_R8_SPLIT, CommentCharacter)
#
- # remove comments
+ # remove comments, but we should escape comment character in string
#
- Line = Line.split(CommentCharacter, 1)[0];
+ InString = False
+ for Index in range(0, len(Line)):
+ if Line[Index] == '"':
+ InString = not InString
+ elif Line[Index] == CommentCharacter and not InString:
+ Line = Line[0: Index]
+ break
+
#
# remove whitespace again
#
diff --git a/BaseTools/Source/Python/CommonDataClass/DataClass.py b/BaseTools/Source/Python/CommonDataClass/DataClass.py
index a0eddc2365..2615bd17b0 100644
--- a/BaseTools/Source/Python/CommonDataClass/DataClass.py
+++ b/BaseTools/Source/Python/CommonDataClass/DataClass.py
@@ -1,7 +1,7 @@
## @file
-# This file is used to define class for data sturcture used in ECC
+# This file is used to define class for data structure used in ECC
#
-# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -92,6 +92,8 @@ MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 50013
MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF = 5014
MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH = 5015
+MODEL_EXTERNAL_DEPENDENCY = 10000
+
MODEL_LIST = [('MODEL_UNKNOWN', MODEL_UNKNOWN),
('MODEL_FILE_C', MODEL_FILE_C),
('MODEL_FILE_H', MODEL_FILE_H),
diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/Python/GenFds/DataSection.py
index dff4691462..0f41953ad4 100644
--- a/BaseTools/Source/Python/GenFds/DataSection.py
+++ b/BaseTools/Source/Python/GenFds/DataSection.py
@@ -21,6 +21,7 @@ import subprocess
from Ffs import Ffs
import os
from CommonDataClass.FdfClass import DataSectionClassObject
+from Common.Misc import PeImageClass
import shutil
## generate data section
@@ -74,6 +75,14 @@ class DataSection (DataSectionClassObject):
(os.path.getmtime(MapFile) > os.path.getmtime(CopyMapFile)):
shutil.copyfile(MapFile, CopyMapFile)
+ #Get PE Section alignment when align is set to AUTO
+ if self.Alignment == 'Auto' and self.SecType in ('TE', 'PE32'):
+ ImageObj = PeImageClass (Filename)
+ if ImageObj.SectionAlignment < 0x400:
+ self.Alignment = str (ImageObj.SectionAlignment)
+ else:
+ self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'
+
NoStrip = True
if self.SecType in ('TE', 'PE32'):
if self.KeepReloc != None:
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py
index ea19156daf..69a4898499 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -2388,9 +2388,11 @@ class FdfParser:
FfsFileObj.CheckSum = True
if self.__GetAlignment():
- FfsFileObj.Alignment = self.__Token
-
-
+ 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)
+ #For FFS, Auto is default option same to ""
+ if not self.__Token == "Auto":
+ FfsFileObj.Alignment = self.__Token
## __GetAlignment() method
#
diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python/Trim/Trim.py
index d19bb09b2d..75c08bbabf 100644
--- a/BaseTools/Source/Python/Trim/Trim.py
+++ b/BaseTools/Source/Python/Trim/Trim.py
@@ -77,11 +77,6 @@ gImportCodePatterns = [
],
[
- re.compile('#include\s+["<]LoadFile\.h[">]', re.MULTILINE),
- '#include <FvLoadFile.h>'
- ],
-
- [
re.compile('#include\s+EFI_GUID_DEFINITION\s*\(FirmwareFileSystem\)', re.MULTILINE),
'#include EFI_GUID_DEFINITION (FirmwareFileSystem)\n#include EFI_GUID_DEFINITION (FirmwareFileSystem2)'
],
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 70c6e62fe9..7a6152c8fb 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -774,6 +774,8 @@ class DscParser(MetaFileParser):
except:
EdkLogger.error("Parser", PARSER_ERROR, File=self.MetaFile, Line=self._LineIndex+1,
ExtraData="Failed to parse content in file %s" % IncludedFile)
+ # insert an imaginary token in the DSC table to indicate its external dependency on another file
+ self._Store(MODEL_EXTERNAL_DEPENDENCY, IncludedFile, str(os.stat(IncludedFile)[8]), "")
# update current status with sub-parser's status
self._SectionName = Parser._SectionName
self._SectionType = Parser._SectionType
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index 12c3324b8d..3aabd545d5 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -2287,6 +2287,13 @@ determine whether database file is out of date!\n")
Result = self.Cur.execute("select min(ID) from %s" % (TableName)).fetchall()
if Result[0][0] != -1:
return False
+ #
+ # Check whether the meta data file has external dependency by comparing the time stamp
+ #
+ Sql = "select Value1, Value2 from %s where Model=%d" % (TableName, MODEL_EXTERNAL_DEPENDENCY)
+ for Dependency in self.Cur.execute(Sql).fetchall():
+ if str(os.stat(Dependency[0])[8]) != Dependency[1]:
+ return False
except:
return False
return True