mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-25 11:11:35 +01:00
I'm sad no one reported qemu-monitor break, that one is kind of important. count.out arguments broke it as an init program, since the kernel adds trash parameters to every init. Is anyone using this repo, I wonder? Keep pushing, keep pushing. One day it gets good enough, and the whole world will see.
64 lines
1.6 KiB
Python
Executable File
64 lines
1.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import os
|
|
|
|
import common
|
|
from shell_helpers import LF
|
|
|
|
class Main(common.LkmcCliFunction):
|
|
def __init__(self):
|
|
super().__init__(
|
|
defaults = {
|
|
'show_time': False,
|
|
},
|
|
description='''Run a Buildroot ToolChain tool like readelf or objdump.
|
|
|
|
For example, to get some information about the arm vmlinux:
|
|
|
|
....
|
|
./%(prog)s readelf -- -e "$(./getvar vmlinux)"
|
|
....
|
|
|
|
Get the list of available tools with:
|
|
|
|
....
|
|
ls "$(./getvar -a arm buildroot_host_bin_dir)"
|
|
....
|
|
''',
|
|
)
|
|
self.add_argument(
|
|
'--print-tool',
|
|
default=False,
|
|
help='''
|
|
Just output print tool path to stdout but don't actually run it.
|
|
Suitable for programmatic consumption by other shell programs.
|
|
''',
|
|
)
|
|
self.add_argument('tool', help='Which tool to run.')
|
|
self.add_argument(
|
|
'extra_args',
|
|
default=[],
|
|
help='Extra arguments for the tool.',
|
|
metavar='extra-args',
|
|
nargs='*'
|
|
)
|
|
|
|
def timed_main(self):
|
|
if self.env['baremetal'] is None:
|
|
image = self.env['vmlinux']
|
|
else:
|
|
image = self.env['image']
|
|
tool = self.get_toolchain_tool(self.env['tool'])
|
|
if self.env['print_tool']:
|
|
print(tool)
|
|
return 0
|
|
else:
|
|
return self.sh.run_cmd(
|
|
[tool, LF]
|
|
+ self.sh.add_newlines(self.env['extra_args']),
|
|
cmd_file=os.path.join(self.env['run_dir'], 'run-toolchain.sh'),
|
|
)
|
|
|
|
if __name__ == '__main__':
|
|
Main().cli()
|