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
This commit is contained in:
@ -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()
|
||||
|
Reference in New Issue
Block a user