Update build-m5 to the new scons build system

Fix https://github.com/cirosantilli/linux-kernel-module-cheat/issues/128
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2020-09-15 02:00:01 +00:00
parent 91a65612a9
commit f292401eee
2 changed files with 10 additions and 13 deletions

View File

@@ -16,18 +16,12 @@ See: https://cirosantilli.com/linux-kernel-module-cheat#gem5-m5-executable
def _get_make_cmd(self):
allowed_toolchains = ['buildroot']
if self.env['arch'] == 'x86_64':
arch = 'x86'
else:
arch = self.env['arch']
return [
'make', LF,
'scons', LF,
'-C', self.env['gem5_m5_source_dir'], LF,
'-j', str(self.env['nproc']), LF,
'-f', 'Makefile.{}'.format(arch), LF,
'CC={}'.format(self.env['gcc_path']), LF,
'CROSS_COMPILE={}'.format(self.env['toolchain_prefix_dash']), LF,
'LD={}'.format(self.env['ld_path']), LF,
'PWD={}'.format(self.env['gem5_m5_source_dir']), LF,
self.env['gem5_m5_source_dir_build'], LF
]
def build(self):
@@ -37,18 +31,16 @@ See: https://cirosantilli.com/linux-kernel-module-cheat#gem5-m5-executable
self.clean()
self.sh.run_cmd(
self._get_make_cmd(),
cwd=self.env['gem5_m5_source_dir'],
)
os.makedirs(self.env['out_rootfs_overlay_bin_dir'], exist_ok=True)
self.sh.cp(
os.path.join(self.env['gem5_m5_source_dir'], 'm5'),
self.env['gem5_m5_source_dir_build'],
self.env['out_rootfs_overlay_bin_dir']
)
def clean(self):
self.sh.run_cmd(
self._get_make_cmd() + ['clean', LF],
cwd=self.env['gem5_m5_source_dir'],
self._get_make_cmd() + ['--clean', LF],
)
return None