BaseTools: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Generate PCD table for 'Patchable In Module' type PCD with given .map file.
|
||||
# The Patch PCD table like:
|
||||
#
|
||||
#
|
||||
# PCD Name Offset in binary
|
||||
# ======== ================
|
||||
#
|
||||
@ -40,9 +40,9 @@ __copyright__ = "Copyright (c) 2008 - 2018, Intel Corporation. All rights reserv
|
||||
symRe = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.\-:\\\\\w\?@\$<>]+) +([\da-fA-F]+)', re.UNICODE)
|
||||
|
||||
def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
|
||||
""" Parse map file to get binary patch pcd information
|
||||
""" Parse map file to get binary patch pcd information
|
||||
@param path Map file absolution path
|
||||
|
||||
|
||||
@return a list which element hold (PcdName, Offset, SectionName)
|
||||
"""
|
||||
lines = []
|
||||
@ -52,7 +52,7 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
|
||||
f.close()
|
||||
except:
|
||||
return None
|
||||
|
||||
|
||||
if len(lines) == 0: return None
|
||||
firstline = lines[0].strip()
|
||||
if (firstline.startswith("Archive member included ") and
|
||||
@ -111,7 +111,7 @@ def _parseForGCC(lines, efifilepath):
|
||||
m = pcdPatternGcc.match(lines[index + 1].strip())
|
||||
if m is not None:
|
||||
bpcds.append((PcdName, int(m.groups(0)[0], 16), int(sections[-1][1], 16), sections[-1][0]))
|
||||
|
||||
|
||||
# get section information from efi file
|
||||
efisecs = PeImageClass(efifilepath).SectionHeaderList
|
||||
if efisecs is None or len(efisecs) == 0:
|
||||
@ -129,11 +129,11 @@ def _parseForGCC(lines, efifilepath):
|
||||
#assert efisec[0].strip() == pcd[3].strip() and efisec[1] + redirection == pcd[2], "There are some differences between map file and efi file"
|
||||
pcds.append([pcd[0], efisec[2] + pcd[1] - efisec[1] - redirection, efisec[0]])
|
||||
return pcds
|
||||
|
||||
|
||||
def _parseGeneral(lines, efifilepath):
|
||||
""" For MSFT, ICC, EBC
|
||||
""" For MSFT, ICC, EBC
|
||||
@param lines line array for map file
|
||||
|
||||
|
||||
@return a list which element hold (PcdName, Offset, SectionName)
|
||||
"""
|
||||
status = 0 #0 - beginning of file; 1 - PE section definition; 2 - symbol table
|
||||
@ -177,7 +177,7 @@ def _parseGeneral(lines, efifilepath):
|
||||
efisecs = PeImageClass(efifilepath).SectionHeaderList
|
||||
if efisecs is None or len(efisecs) == 0:
|
||||
return None
|
||||
|
||||
|
||||
pcds = []
|
||||
for pcd in bPcds:
|
||||
index = 0
|
||||
@ -188,7 +188,7 @@ def _parseGeneral(lines, efifilepath):
|
||||
elif pcd[4] == index:
|
||||
pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]])
|
||||
return pcds
|
||||
|
||||
|
||||
def generatePcdTable(list, pcdpath):
|
||||
try:
|
||||
f = open(pcdpath, 'w')
|
||||
@ -196,12 +196,12 @@ def generatePcdTable(list, pcdpath):
|
||||
pass
|
||||
|
||||
f.write('PCD Name Offset Section Name\r\n')
|
||||
|
||||
|
||||
for pcditem in list:
|
||||
f.write('%-30s 0x%-08X %-6s\r\n' % (pcditem[0], pcditem[1], pcditem[2]))
|
||||
f.close()
|
||||
|
||||
#print 'Success to generate Binary Patch PCD table at %s!' % pcdpath
|
||||
#print 'Success to generate Binary Patch PCD table at %s!' % pcdpath
|
||||
|
||||
if __name__ == '__main__':
|
||||
UsageString = "%prog -m <MapFile> -e <EfiFile> -o <OutFile>"
|
||||
@ -213,7 +213,7 @@ if __name__ == '__main__':
|
||||
help='Absolute path of EFI binary file.')
|
||||
parser.add_option('-o', '--outputfile', action='store', dest='outfile',
|
||||
help='Absolute path of output file to store the got patchable PCD table.')
|
||||
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if options.mapfile is None or options.efifile is None:
|
||||
|
Reference in New Issue
Block a user