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
|
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
|
still rebuild the Buildroot package that provides those files to actually put the Buildroot
|
||||||
files on the root filesystem.
|
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('--force-rebuild')
|
||||||
|
self._add_argument('extra_make_args')
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
build_dir = self.get_build_dir()
|
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
|
https://github.com/cirosantilli/linux-kernel-module-cheat-regression#gem5-unit-tests
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
self.add_argument(
|
self._add_argument('extra_make_args')
|
||||||
'extra_scons_args',
|
|
||||||
metavar='extra-scons-args',
|
|
||||||
nargs='*',
|
|
||||||
)
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
build_dir = self.get_build_dir()
|
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,
|
#'SLICC_HTML=True', LF,
|
||||||
] +
|
] +
|
||||||
self.sh.add_newlines(targets) +
|
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'],
|
cwd=self.env['gem5_source_dir'],
|
||||||
extra_env=extra_env,
|
extra_env=extra_env,
|
||||||
|
|||||||
@@ -75,13 +75,8 @@ so you might want to --clean the build first.
|
|||||||
Run `make modules_install` after `make`.
|
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('--force-rebuild')
|
||||||
|
self._add_argument('extra_make_args')
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
build_dir = self.get_build_dir()
|
build_dir = self.get_build_dir()
|
||||||
|
|||||||
13
build-qemu
13
build-qemu
@@ -9,12 +9,8 @@ class Main(common.BuildCliFunction):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._add_argument('--configure')
|
self._add_argument('--configure')
|
||||||
self.add_argument(
|
self.add_argument('--extra-config-args')
|
||||||
'extra_config_args',
|
self._add_argument('extra_make_args')
|
||||||
default=[],
|
|
||||||
metavar='extra-config-args',
|
|
||||||
nargs='*'
|
|
||||||
)
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
build_dir = self.get_build_dir()
|
build_dir = self.get_build_dir()
|
||||||
@@ -41,7 +37,7 @@ class Main(common.BuildCliFunction):
|
|||||||
'--enable-sdl', LF,
|
'--enable-sdl', LF,
|
||||||
] +
|
] +
|
||||||
build_type_cmd +
|
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']],
|
extra_paths=[self.env['ccache_dir']],
|
||||||
cwd=build_dir
|
cwd=build_dir
|
||||||
)
|
)
|
||||||
@@ -52,7 +48,8 @@ class Main(common.BuildCliFunction):
|
|||||||
'-j', str(self.env['nproc']), LF,
|
'-j', str(self.env['nproc']), LF,
|
||||||
|
|
||||||
] +
|
] +
|
||||||
verbose
|
verbose +
|
||||||
|
self.sh.add_newlines(self.env['extra_make_args'])
|
||||||
),
|
),
|
||||||
cwd=build_dir,
|
cwd=build_dir,
|
||||||
extra_paths=[self.env['ccache_dir']],
|
extra_paths=[self.env['ccache_dir']],
|
||||||
|
|||||||
29
common.py
29
common.py
@@ -1613,33 +1613,46 @@ class BuildCliFunction(LkmcCliFunction):
|
|||||||
'default': '',
|
'default': '',
|
||||||
'help': '''\
|
'help': '''\
|
||||||
Pass the given compiler flags to all languages (C, C++, Fortran, etc.)
|
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': {
|
'--force-rebuild': {
|
||||||
'default': False,
|
'default': False,
|
||||||
"help": '''\
|
"help": '''\
|
||||||
Force rebuild even if sources didn't change.
|
Force rebuild even if sources didn't change.
|
||||||
''',
|
|
||||||
},
|
|
||||||
'--configure': {
|
|
||||||
'default': True,
|
|
||||||
"help": '''\
|
|
||||||
Also run the configuration step during build.
|
|
||||||
''',
|
''',
|
||||||
},
|
},
|
||||||
'--optimization-level': {
|
'--optimization-level': {
|
||||||
'default': '0',
|
'default': '0',
|
||||||
'help': '''
|
'help': '''\
|
||||||
Use the given GCC -O optimization level.
|
Use the given GCC -O optimization level.
|
||||||
For some scripts, there are hard technical challenges why it cannot
|
For some scripts, there are hard technical challenges why it cannot
|
||||||
be implemented, e.g.: https://cirosantilli.com/linux-kernel-module-cheat#kernel-o0
|
be implemented, e.g.: https://cirosantilli.com/linux-kernel-module-cheat#kernel-o0
|
||||||
and for others such as gem5 have their custom mechanism:
|
and for others such as gem5 have their custom mechanism:
|
||||||
https://cirosantilli.com/linux-kernel-module-cheat#gem5-debug-build
|
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):
|
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(
|
self.add_argument(
|
||||||
argument_name,
|
argument_name,
|
||||||
**self._build_arguments[argument_name]
|
**self._build_arguments[argument_name]
|
||||||
|
|||||||
Reference in New Issue
Block a user