2018-05-06 21:58:06 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2016-11-26 03:15:51 +00:00
|
|
|
# Copyright (c) 2016 Google, Inc
|
|
|
|
# Written by Simon Glass <sjg@chromium.org>
|
|
|
|
#
|
|
|
|
# Command-line parser for binman
|
|
|
|
#
|
|
|
|
|
|
|
|
from optparse import OptionParser
|
|
|
|
|
|
|
|
def ParseArgs(argv):
|
|
|
|
"""Parse the binman command-line arguments
|
|
|
|
|
|
|
|
Args:
|
|
|
|
argv: List of string arguments
|
|
|
|
Returns:
|
|
|
|
Tuple (options, args) with the command-line options and arugments.
|
|
|
|
options provides access to the options (e.g. option.debug)
|
|
|
|
args is a list of string arguments
|
|
|
|
"""
|
|
|
|
parser = OptionParser()
|
2018-07-17 19:25:32 +00:00
|
|
|
parser.add_option('-a', '--entry-arg', type='string', action='append',
|
|
|
|
help='Set argument value arg=value')
|
2016-11-26 03:15:51 +00:00
|
|
|
parser.add_option('-b', '--board', type='string',
|
|
|
|
help='Board name to build')
|
|
|
|
parser.add_option('-B', '--build-dir', type='string', default='b',
|
|
|
|
help='Directory containing the build output')
|
|
|
|
parser.add_option('-d', '--dt', type='string',
|
|
|
|
help='Configuration file (.dtb) to use')
|
|
|
|
parser.add_option('-D', '--debug', action='store_true',
|
|
|
|
help='Enabling debugging (provides a full traceback on error)')
|
2018-07-17 19:25:36 +00:00
|
|
|
parser.add_option('-E', '--entry-docs', action='store_true',
|
|
|
|
help='Write out entry documentation (see README.entries)')
|
2018-09-14 10:57:23 +00:00
|
|
|
parser.add_option('--fake-dtb', action='store_true',
|
|
|
|
help='Use fake device tree contents (for testing only)')
|
2018-09-14 10:57:12 +00:00
|
|
|
parser.add_option('-i', '--image', type='string', action='append',
|
|
|
|
help='Image filename to build (if not specified, build all)')
|
2016-11-26 03:15:51 +00:00
|
|
|
parser.add_option('-I', '--indir', action='append',
|
|
|
|
help='Add a path to a directory to use for input files')
|
|
|
|
parser.add_option('-H', '--full-help', action='store_true',
|
|
|
|
default=False, help='Display the README file')
|
2018-06-01 15:38:20 +00:00
|
|
|
parser.add_option('-m', '--map', action='store_true',
|
|
|
|
default=False, help='Output a map file for each image')
|
2016-11-26 03:15:51 +00:00
|
|
|
parser.add_option('-O', '--outdir', type='string',
|
|
|
|
action='store', help='Path to directory to use for intermediate and '
|
|
|
|
'output files')
|
|
|
|
parser.add_option('-p', '--preserve', action='store_true',\
|
|
|
|
help='Preserve temporary output directory even if option -O is not '
|
|
|
|
'given')
|
2018-10-02 03:12:47 +00:00
|
|
|
parser.add_option('-P', '--processes', type=int,
|
|
|
|
help='set number of processes to use for running tests')
|
2016-11-26 03:15:51 +00:00
|
|
|
parser.add_option('-t', '--test', action='store_true',
|
|
|
|
default=False, help='run tests')
|
|
|
|
parser.add_option('-T', '--test-coverage', action='store_true',
|
|
|
|
default=False, help='run tests and check for 100% coverage')
|
2018-07-06 16:27:41 +00:00
|
|
|
parser.add_option('-u', '--update-fdt', action='store_true',
|
2018-08-01 21:22:37 +00:00
|
|
|
default=False, help='Update the binman node with offset/size info')
|
2016-11-26 03:15:51 +00:00
|
|
|
parser.add_option('-v', '--verbosity', default=1,
|
|
|
|
type='int', help='Control verbosity: 0=silent, 1=progress, 3=full, '
|
|
|
|
'4=debug')
|
|
|
|
|
|
|
|
parser.usage += """
|
|
|
|
|
|
|
|
Create images for a board from a set of binaries. It is controlled by a
|
|
|
|
description in the board device tree."""
|
|
|
|
|
|
|
|
return parser.parse_args(argv)
|