Files
linux-kernel-module-cheat/build-qemu
Ciro Santilli 六四事件 法轮功 8fb9db3931 manually encode newlines on all printed commands
This way we group key value arguments: e.g.:

    make \
    -j 8 \
    all

instead of:

    make \
    -j \
    8 \
    all

and reach CLI nirvana, while also subtly breaking several commands due to
lack of testing.
2018-11-04 00:00:01 +00:00

64 lines
1.8 KiB
Python
Executable File

#!/usr/bin/env python3
import os
import common
class QemuComponent(common.Component):
def add_parser_arguments(self, parser):
parser.add_argument(
'--userland',
default=False,
action='store_true',
help='Build QEMU user mode instead of system.',
)
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 = []
if args.userland:
target_list = '{}-linux-user'.format(args.arch)
else:
target_list = '{}-softmmu'.format(args.arch)
common.run_cmd(
[
os.path.join(common.qemu_src_dir, 'configure'), common.Newline,
'--enable-debug', common.Newline,
'--enable-trace-backends=simple', common.Newline,
'--target-list={}'.format(target_list), common.Newline,
'--enable-sdl', common.Newline,
'--with-sdlabi=2.0', common.Newline,
] +
common.add_newlines(args.extra_config_args),
extra_paths=[common.ccache_dir],
cwd=build_dir
)
common.run_cmd(
(
[
'make', common.Newline,
'-j', str(args.nproc), common.Newline,
] +
verbose
),
cwd=build_dir,
extra_paths=[common.ccache_dir],
)
def get_build_dir(self, args):
return common.qemu_build_dir
if __name__ == '__main__':
QemuComponent().build()