mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
55 lines
1.4 KiB
Python
Executable File
55 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import multiprocessing
|
|
import os
|
|
import subprocess
|
|
|
|
import common
|
|
|
|
class QemuComponent(common.Component):
|
|
def add_parser_arguments(self, parser):
|
|
parser.add_argument(
|
|
'extra_config_args',
|
|
default=[],
|
|
metavar='extra-config-args',
|
|
nargs='*'
|
|
)
|
|
|
|
def do_build(self, args):
|
|
build_dir = self.get_build_dir(args)
|
|
os.makedirs(build_dir, exist_ok=True)
|
|
if args.verbose:
|
|
verbose = ['V=1']
|
|
else:
|
|
verbose = []
|
|
assert common.run_cmd(
|
|
[
|
|
os.path.join(common.qemu_src_dir, 'configure'),
|
|
'--enable-debug',
|
|
'--enable-trace-backends=simple',
|
|
'--target-list={}-softmmu'.format(args.arch),
|
|
'--enable-sdl',
|
|
'--with-sdlabi=2.0',
|
|
] +
|
|
args.extra_config_args,
|
|
extra_paths=[common.ccache_dir],
|
|
cwd=build_dir
|
|
) == 0
|
|
assert common.run_cmd(
|
|
(
|
|
[
|
|
'make',
|
|
'-j', str(multiprocessing.cpu_count()),
|
|
|
|
] +
|
|
verbose
|
|
),
|
|
cwd=build_dir,
|
|
extra_paths=[common.ccache_dir],
|
|
) == 0
|
|
|
|
def get_build_dir(self, args):
|
|
return common.qemu_build_dir
|
|
|
|
QemuComponent().build()
|