mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 03:31:36 +01:00
38 lines
812 B
Python
Executable File
38 lines
812 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import glob
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
import common
|
|
|
|
parser = common.get_argparse(argparse_args={
|
|
'description':'''Run a Buildroot ToolChain tool like readelf or objdump.
|
|
|
|
For example, to run `readelf -h` for the `arm` architecture, use:
|
|
|
|
....
|
|
./%(prog)s -a arm readelf -- -h
|
|
....
|
|
|
|
Get the list of available tools with:
|
|
|
|
....
|
|
ls "$(./getvar -a arm host_bin_dir)"
|
|
....
|
|
'''
|
|
})
|
|
parser.add_argument('tool', help='Which tool to run.')
|
|
parser.add_argument(
|
|
'extra_args',
|
|
default=[],
|
|
help='Extra arguments for the tool.',
|
|
metavar='extra-args',
|
|
nargs='*'
|
|
)
|
|
args = common.setup(parser)
|
|
paths = glob.glob(os.path.join(common.host_bin_dir, '*-buildroot-*-{}'.format(args.tool)))
|
|
assert len(paths) == 1
|
|
sys.exit(subprocess.Popen(paths + args.extra_args).wait())
|