Blame view
tools/binman/cmdline.py
5.95 KB
83d290c56 SPDX: Convert all... |
1 |
# SPDX-License-Identifier: GPL-2.0+ |
bf7fd50b3 binman: Introduce... |
2 3 4 |
# Copyright (c) 2016 Google, Inc # Written by Simon Glass <sjg@chromium.org> # |
bf7fd50b3 binman: Introduce... |
5 6 |
# Command-line parser for binman # |
53cd5d921 binman: Convert t... |
7 |
from argparse import ArgumentParser |
bf7fd50b3 binman: Introduce... |
8 9 10 11 12 13 14 15 16 17 18 |
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 """ |
53cd5d921 binman: Convert t... |
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
if '-H' in argv: argv.append('build') epilog = '''Binman creates and manipulate images for a board from a set of binaries. Binman is controlled by a description in the board device tree.''' parser = ArgumentParser(epilog=epilog) parser.add_argument('-B', '--build-dir', type=str, default='b', help='Directory containing the build output') parser.add_argument('-D', '--debug', action='store_true', help='Enabling debugging (provides a full traceback on error)') parser.add_argument('-H', '--full-help', action='store_true', default=False, help='Display the README file') parser.add_argument('--toolpath', type=str, action='append', help='Add a path to the directories containing tools') parser.add_argument('-v', '--verbosity', default=1, type=int, help='Control verbosity: 0=silent, 1=warnings, 2=notices, ' '3=info, 4=detail, 5=debug') subparsers = parser.add_subparsers(dest='cmd') build_parser = subparsers.add_parser('build', help='Build firmware image') build_parser.add_argument('-a', '--entry-arg', type=str, action='append', |
53af22a99 binman: Add suppo... |
42 |
help='Set argument value arg=value') |
53cd5d921 binman: Convert t... |
43 |
build_parser.add_argument('-b', '--board', type=str, |
bf7fd50b3 binman: Introduce... |
44 |
help='Board name to build') |
53cd5d921 binman: Convert t... |
45 |
build_parser.add_argument('-d', '--dt', type=str, |
bf7fd50b3 binman: Introduce... |
46 |
help='Configuration file (.dtb) to use') |
53cd5d921 binman: Convert t... |
47 |
build_parser.add_argument('--fake-dtb', action='store_true', |
93d174135 binman: Allow con... |
48 |
help='Use fake device tree contents (for testing only)') |
53cd5d921 binman: Convert t... |
49 |
build_parser.add_argument('-i', '--image', type=str, action='append', |
0bfa7b09b binman: Support b... |
50 |
help='Image filename to build (if not specified, build all)') |
53cd5d921 binman: Convert t... |
51 |
build_parser.add_argument('-I', '--indir', action='append', |
497409fec binman: Tidy up h... |
52 |
help='Add a path to the list of directories to use for input files') |
53cd5d921 binman: Convert t... |
53 |
build_parser.add_argument('-m', '--map', action='store_true', |
3b0c3821d binman: Add suppo... |
54 |
default=False, help='Output a map file for each image') |
53cd5d921 binman: Convert t... |
55 |
build_parser.add_argument('-O', '--outdir', type=str, |
bf7fd50b3 binman: Introduce... |
56 57 |
action='store', help='Path to directory to use for intermediate and ' 'output files') |
53cd5d921 binman: Convert t... |
58 |
build_parser.add_argument('-p', '--preserve', action='store_true',\ |
bf7fd50b3 binman: Introduce... |
59 60 |
help='Preserve temporary output directory even if option -O is not ' 'given') |
53cd5d921 binman: Convert t... |
61 |
build_parser.add_argument('-u', '--update-fdt', action='store_true', |
3ab9598df binman: Rename 'p... |
62 |
default=False, help='Update the binman node with offset/size info') |
53cd5d921 binman: Convert t... |
63 64 65 |
entry_parser = subparsers.add_parser('entry-docs', help='Write out entry documentation (see README.entries)') |
61f564d15 binman: Support l... |
66 67 68 69 70 |
list_parser = subparsers.add_parser('ls', help='List files in an image') list_parser.add_argument('-i', '--image', type=str, required=True, help='Image filename to list') list_parser.add_argument('paths', type=str, nargs='*', help='Paths within file to list (wildcard)') |
71ce0ba28 binman: Add an 'e... |
71 72 73 74 75 76 77 78 79 80 81 82 |
extract_parser = subparsers.add_parser('extract', help='Extract files from an image') extract_parser.add_argument('-i', '--image', type=str, required=True, help='Image filename to extract') extract_parser.add_argument('-f', '--filename', type=str, help='Output filename to write to') extract_parser.add_argument('-O', '--outdir', type=str, default='', help='Path to directory to use for output files') extract_parser.add_argument('paths', type=str, nargs='*', help='Paths within file to extract (wildcard)') extract_parser.add_argument('-U', '--uncompressed', action='store_true', help='Output raw uncompressed data for compressed entries') |
a6cb99509 binman: Add comma... |
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
replace_parser = subparsers.add_parser('replace', help='Replace entries in an image') replace_parser.add_argument('-C', '--compressed', action='store_true', help='Input data is already compressed if needed for the entry') replace_parser.add_argument('-i', '--image', type=str, required=True, help='Image filename to extract') replace_parser.add_argument('-f', '--filename', type=str, help='Input filename to read from') replace_parser.add_argument('-F', '--fix-size', action='store_true', help="Don't allow entries to be resized") replace_parser.add_argument('-I', '--indir', type=str, default='', help='Path to directory to use for input files') replace_parser.add_argument('-m', '--map', action='store_true', default=False, help='Output a map file for the updated image') replace_parser.add_argument('paths', type=str, nargs='*', help='Paths within file to extract (wildcard)') |
53cd5d921 binman: Convert t... |
99 100 101 102 103 104 |
test_parser = subparsers.add_parser('test', help='Run tests') test_parser.add_argument('-P', '--processes', type=int, help='set number of processes to use for running tests') test_parser.add_argument('-T', '--test-coverage', action='store_true', default=False, help='run tests and check for 100%% coverage') test_parser.add_argument('-X', '--test-preserve-dirs', action='store_true', |
d5164a797 binman: Allow pre... |
105 106 107 |
help='Preserve and display test-created input directories; also ' 'preserve the output directory if a single test is run (pass test ' 'name at the end of the command line') |
53cd5d921 binman: Convert t... |
108 109 |
test_parser.add_argument('tests', nargs='*', help='Test names to run (omit for all)') |
bf7fd50b3 binman: Introduce... |
110 111 |
return parser.parse_args(argv) |