mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-22 17:55:57 +01:00
Allow extra make args to ./build-qemu -- arg0 arg1
configure args are now ./build-qemu --extra-config-args '"aa a" bb' Also factor out arg names with other builds through _add_argument. Fix #113.
This commit is contained in:
@@ -61,16 +61,10 @@ Don't add our overlay which contains all files we build without going through Bu
|
||||
This prevents us from overwriting certain Buildroot files. Remember however that you must
|
||||
still rebuild the Buildroot package that provides those files to actually put the Buildroot
|
||||
files on the root filesystem.
|
||||
'''
|
||||
)
|
||||
self.add_argument(
|
||||
'extra-make-args', default=[], nargs='*',
|
||||
help='''\
|
||||
Extra arguments to be passed to the Buildroot make,
|
||||
usually extra Buildroot targets.
|
||||
'''
|
||||
)
|
||||
self._add_argument('--force-rebuild')
|
||||
self._add_argument('extra_make_args')
|
||||
|
||||
def build(self):
|
||||
build_dir = self.get_build_dir()
|
||||
|
||||
@@ -33,11 +33,7 @@ Build and run all the gem5 unit tests instead of the gem5 executable.
|
||||
https://github.com/cirosantilli/linux-kernel-module-cheat-regression#gem5-unit-tests
|
||||
'''
|
||||
)
|
||||
self.add_argument(
|
||||
'extra_scons_args',
|
||||
metavar='extra-scons-args',
|
||||
nargs='*',
|
||||
)
|
||||
self._add_argument('extra_make_args')
|
||||
|
||||
def build(self):
|
||||
build_dir = self.get_build_dir()
|
||||
@@ -141,7 +137,7 @@ https://github.com/cirosantilli/linux-kernel-module-cheat-regression#gem5-unit-t
|
||||
#'SLICC_HTML=True', LF,
|
||||
] +
|
||||
self.sh.add_newlines(targets) +
|
||||
self.sh.add_newlines(self.env['extra_scons_args'])
|
||||
self.sh.add_newlines(self.env['extra_make_args'])
|
||||
),
|
||||
cwd=self.env['gem5_source_dir'],
|
||||
extra_env=extra_env,
|
||||
|
||||
@@ -75,13 +75,8 @@ so you might want to --clean the build first.
|
||||
Run `make modules_install` after `make`.
|
||||
'''
|
||||
)
|
||||
self.add_argument(
|
||||
'extra_make_args',
|
||||
default=[],
|
||||
metavar='extra-make-args',
|
||||
nargs='*'
|
||||
)
|
||||
self._add_argument('--force-rebuild')
|
||||
self._add_argument('extra_make_args')
|
||||
|
||||
def build(self):
|
||||
build_dir = self.get_build_dir()
|
||||
|
||||
13
build-qemu
13
build-qemu
@@ -9,12 +9,8 @@ class Main(common.BuildCliFunction):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self._add_argument('--configure')
|
||||
self.add_argument(
|
||||
'extra_config_args',
|
||||
default=[],
|
||||
metavar='extra-config-args',
|
||||
nargs='*'
|
||||
)
|
||||
self.add_argument('--extra-config-args')
|
||||
self._add_argument('extra_make_args')
|
||||
|
||||
def build(self):
|
||||
build_dir = self.get_build_dir()
|
||||
@@ -41,7 +37,7 @@ class Main(common.BuildCliFunction):
|
||||
'--enable-sdl', LF,
|
||||
] +
|
||||
build_type_cmd +
|
||||
self.sh.add_newlines(self.env['extra_config_args']),
|
||||
self.sh.shlex_split(self.env['extra_config_args']),
|
||||
extra_paths=[self.env['ccache_dir']],
|
||||
cwd=build_dir
|
||||
)
|
||||
@@ -52,7 +48,8 @@ class Main(common.BuildCliFunction):
|
||||
'-j', str(self.env['nproc']), LF,
|
||||
|
||||
] +
|
||||
verbose
|
||||
verbose +
|
||||
self.sh.add_newlines(self.env['extra_make_args'])
|
||||
),
|
||||
cwd=build_dir,
|
||||
extra_paths=[self.env['ccache_dir']],
|
||||
|
||||
29
common.py
29
common.py
@@ -1613,33 +1613,46 @@ class BuildCliFunction(LkmcCliFunction):
|
||||
'default': '',
|
||||
'help': '''\
|
||||
Pass the given compiler flags to all languages (C, C++, Fortran, etc.)
|
||||
''',
|
||||
},
|
||||
'--configure': {
|
||||
'default': True,
|
||||
'help': '''\
|
||||
Also run the configuration step during build.
|
||||
''',
|
||||
},
|
||||
'--force-rebuild': {
|
||||
'default': False,
|
||||
"help": '''\
|
||||
Force rebuild even if sources didn't change.
|
||||
''',
|
||||
},
|
||||
'--configure': {
|
||||
'default': True,
|
||||
"help": '''\
|
||||
Also run the configuration step during build.
|
||||
''',
|
||||
},
|
||||
'--optimization-level': {
|
||||
'default': '0',
|
||||
'help': '''
|
||||
'help': '''\
|
||||
Use the given GCC -O optimization level.
|
||||
For some scripts, there are hard technical challenges why it cannot
|
||||
be implemented, e.g.: https://cirosantilli.com/linux-kernel-module-cheat#kernel-o0
|
||||
and for others such as gem5 have their custom mechanism:
|
||||
https://cirosantilli.com/linux-kernel-module-cheat#gem5-debug-build
|
||||
''',
|
||||
}
|
||||
},
|
||||
'extra_make_args': {
|
||||
'default': [],
|
||||
'help': '''\
|
||||
Extra arguments to pass to the Make command or analogous final build command,
|
||||
after configure, e.g. SCons. Usually contains specific targets or other build flags.
|
||||
''',
|
||||
'metavar': 'extra-make-args',
|
||||
'nargs': '*',
|
||||
},
|
||||
}
|
||||
|
||||
def _add_argument(self, argument_name):
|
||||
'''
|
||||
Enable build argument with a fixed name to provide an uniform CLI API
|
||||
across different builds.
|
||||
'''
|
||||
self.add_argument(
|
||||
argument_name,
|
||||
**self._build_arguments[argument_name]
|
||||
|
||||
Reference in New Issue
Block a user