diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-10-11 06:26:52 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-10-11 06:26:52 +0000 |
commit | 08dd311f5dc735c595d39faf2e6f7e2810bb79a9 (patch) | |
tree | eb384e3139391ac0dabc69e40b4605d9d7315342 /BaseTools/Source/Python/BPDG/BPDG.py | |
parent | d69bf66dc1ad8143260dcb8e095d7ed91b211dd7 (diff) | |
download | edk2-platforms-08dd311f5dc735c595d39faf2e6f7e2810bb79a9.tar.xz |
Sync EDKII BaseTools to BaseTools project r2065.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10915 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/BPDG/BPDG.py')
-rw-r--r-- | BaseTools/Source/Python/BPDG/BPDG.py | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/BaseTools/Source/Python/BPDG/BPDG.py b/BaseTools/Source/Python/BPDG/BPDG.py index 10692c4834..f50e6f7d22 100644 --- a/BaseTools/Source/Python/BPDG/BPDG.py +++ b/BaseTools/Source/Python/BPDG/BPDG.py @@ -25,7 +25,6 @@ import sys import encodings.ascii
from optparse import OptionParser
-from encodings import gbk
from Common import EdkLogger
from Common.BuildToolError import *
@@ -49,13 +48,11 @@ def main(): # Initialize log system
EdkLogger.Initialize()
- Options, Args = myOptionParser()
+ Options, Args = MyOptionParser()
ReturnCode = 0
- if Options.opt_slient:
- EdkLogger.SetLevel(EdkLogger.ERROR)
- elif Options.opt_verbose:
+ if Options.opt_verbose:
EdkLogger.SetLevel(EdkLogger.VERBOSE)
elif Options.opt_quiet:
EdkLogger.SetLevel(EdkLogger.QUIET)
@@ -64,7 +61,7 @@ def main(): else:
EdkLogger.SetLevel(EdkLogger.INFO)
- if Options.vpd_filename == None:
+ if Options.bin_filename == None:
EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please use the -o option to specify the file name for the VPD binary file")
if Options.filename == None:
EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please use the -m option to specify the file name for the mapping file")
@@ -74,14 +71,22 @@ def main(): Force = True
if (Args[0] != None) :
- startBPDG(Args[0], Options.filename, Options.vpd_filename, Force)
+ StartBpdg(Args[0], Options.filename, Options.bin_filename, Force)
else :
EdkLogger.error("BPDG", ATTRIBUTE_NOT_AVAILABLE, "Please specify the file which contain the VPD pcd info.",
None)
return ReturnCode
-
-def myOptionParser():
+
+
+## Parse command line options
+#
+# Using standard Python module optparse to parse command line option of this tool.
+#
+# @retval options A optparse.Values object containing the parsed options
+# @retval args Target of BPDG command
+#
+def MyOptionParser():
#
# Process command line firstly.
#
@@ -94,11 +99,9 @@ def myOptionParser(): help=st.MSG_OPTION_DEBUG_LEVEL)
parser.add_option('-v', '--verbose', action='store_true', dest='opt_verbose',
help=st.MSG_OPTION_VERBOSE)
- parser.add_option('-s', '--silent', action='store_true', dest='opt_slient', default=False,
- help=st.MSG_OPTION_SILENT)
parser.add_option('-q', '--quiet', action='store_true', dest='opt_quiet', default=False,
help=st.MSG_OPTION_QUIET)
- parser.add_option('-o', '--vpd-filename', action='store', dest='vpd_filename',
+ parser.add_option('-o', '--vpd-filename', action='store', dest='bin_filename',
help=st.MSG_OPTION_VPD_FILENAME)
parser.add_option('-m', '--map-filename', action='store', dest='filename',
help=st.MSG_OPTION_MAP_FILENAME)
@@ -111,8 +114,22 @@ def myOptionParser(): EdkLogger.info(parser.usage)
sys.exit(1)
return options, args
-
-def startBPDG(InputFileName, MapFileName, VpdFileName, Force):
+
+
+## Start BPDG and call the main functions
+#
+# This method mainly focus on call GenVPD class member functions to complete
+# BPDG's target. It will process VpdFile override, and provide the interface file
+# information.
+#
+# @Param InputFileName The filename include the vpd type pcd information
+# @param MapFileName The filename of map file that stores vpd type pcd information.
+# This file will be generated by the BPDG tool after fix the offset
+# and adjust the offset to make the pcd data aligned.
+# @param VpdFileName The filename of Vpd file that hold vpd pcd information.
+# @param Force Override the exist Vpdfile or not.
+#
+def StartBpdg(InputFileName, MapFileName, VpdFileName, Force):
if os.path.exists(VpdFileName) and not Force:
print "\nFile %s already exist, Overwrite(Yes/No)?[Y]: " % VpdFileName
choice = sys.stdin.readline()
|