]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / GenPatchPcdTable / GenPatchPcdTable.py
index 9645e9b08db4eea5e7e143615396e52941330601..1be0a28177ff8c39f001629c93d8a84c883d897f 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Generate PCD table for 'Patchable In Module' type PCD with given .map file.\r
 #    The Patch PCD table like:\r
-#    \r
+#\r
 #    PCD Name    Offset in binary\r
 #    ========    ================\r
 #\r
@@ -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)\r
 \r
 def parsePcdInfoFromMapFile(mapfilepath, efifilepath):\r
-    """ Parse map file to get binary patch pcd information \r
+    """ Parse map file to get binary patch pcd information\r
     @param path    Map file absolution path\r
-    \r
+\r
     @return a list which element hold (PcdName, Offset, SectionName)\r
     """\r
     lines = []\r
@@ -52,7 +52,7 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
         f.close()\r
     except:\r
         return None\r
-    \r
+\r
     if len(lines) == 0: return None\r
     firstline = lines[0].strip()\r
     if (firstline.startswith("Archive member included ") and\r
@@ -111,7 +111,7 @@ def _parseForGCC(lines, efifilepath):
                     m = pcdPatternGcc.match(lines[index + 1].strip())\r
                     if m is not None:\r
                         bpcds.append((PcdName, int(m.groups(0)[0], 16), int(sections[-1][1], 16), sections[-1][0]))\r
-                \r
+\r
     # get section information from efi file\r
     efisecs = PeImageClass(efifilepath).SectionHeaderList\r
     if efisecs is None or len(efisecs) == 0:\r
@@ -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"\r
                 pcds.append([pcd[0], efisec[2] + pcd[1] - efisec[1] - redirection, efisec[0]])\r
     return pcds\r
-                \r
+\r
 def _parseGeneral(lines, efifilepath):\r
-    """ For MSFT, ICC, EBC \r
+    """ For MSFT, ICC, EBC\r
     @param lines    line array for map file\r
-    \r
+\r
     @return a list which element hold (PcdName, Offset, SectionName)\r
     """\r
     status = 0    #0 - beginning of file; 1 - PE section definition; 2 - symbol table\r
@@ -177,7 +177,7 @@ def _parseGeneral(lines, efifilepath):
     efisecs = PeImageClass(efifilepath).SectionHeaderList\r
     if efisecs is None or len(efisecs) == 0:\r
         return None\r
-    \r
+\r
     pcds = []\r
     for pcd in bPcds:\r
         index = 0\r
@@ -188,7 +188,7 @@ def _parseGeneral(lines, efifilepath):
             elif pcd[4] == index:\r
                 pcds.append([pcd[0], efisec[2] + pcd[2], efisec[0]])\r
     return pcds\r
-    \r
+\r
 def generatePcdTable(list, pcdpath):\r
     try:\r
         f = open(pcdpath, 'w')\r
@@ -196,12 +196,12 @@ def generatePcdTable(list, pcdpath):
         pass\r
 \r
     f.write('PCD Name                       Offset    Section Name\r\n')\r
-    \r
+\r
     for pcditem in list:\r
         f.write('%-30s 0x%-08X %-6s\r\n' % (pcditem[0], pcditem[1], pcditem[2]))\r
     f.close()\r
 \r
-    #print 'Success to generate Binary Patch PCD table at %s!' % pcdpath \r
+    #print 'Success to generate Binary Patch PCD table at %s!' % pcdpath\r
 \r
 if __name__ == '__main__':\r
     UsageString = "%prog -m <MapFile> -e <EfiFile> -o <OutFile>"\r
@@ -213,7 +213,7 @@ if __name__ == '__main__':
                       help='Absolute path of EFI binary file.')\r
     parser.add_option('-o', '--outputfile', action='store', dest='outfile',\r
                       help='Absolute path of output file to store the got patchable PCD table.')\r
-  \r
+\r
     (options, args) = parser.parse_args()\r
 \r
     if options.mapfile is None or options.efifile is None:\r