mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
gem5: update to 7bfb7f3a43f382eb49853f47b140bfd6caad0fb8
The update is required to include 3c3ca64b5f0dd9eef7b1ce1c65cc6e8e9147dd38 otherwise baremetal does not on VExpress. baremetal: create a baremetal setup with crosstool-ng buildroot: improve directory location: move out/dl inside out/buildroot/download, and add a new out/buildroot/build level tagline: generalize, deliver more value than howto, since now howtos are starting to multiply rename all top scripts to separate words with hyphen more consistently, e.g. run-gdb instead of rungdb getvar: list all variables gem5: make m5out section to focus all releated information at Prevent m5term Text file busy when rebuilding gem5 while it is running.
This commit is contained in:
83
build-crosstool-ng
Executable file
83
build-crosstool-ng
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import multiprocessing
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import time
|
||||
|
||||
import common
|
||||
|
||||
def get_argparse():
|
||||
parser = common.get_argparse(argparse_args={
|
||||
'description': 'Build crosstool-NG with Newlib for bare metal compilation'
|
||||
})
|
||||
common.add_build_arguments(parser)
|
||||
return parser
|
||||
|
||||
def main(args, extra_args=None):
|
||||
common.raise_no_x86(args.arch)
|
||||
nproc = multiprocessing.cpu_count()
|
||||
defconfig_dest = os.path.join(common.crosstool_ng_util_dir, 'defconfig')
|
||||
os.makedirs(common.crosstool_ng_util_dir, exist_ok=True)
|
||||
os.makedirs(common.crosstool_ng_download_dir, exist_ok=True)
|
||||
|
||||
# Bootstrap out-ot-tree WONTFIX. I've tried.
|
||||
# https://github.com/crosstool-ng/crosstool-ng/issues/1021
|
||||
os.chdir(common.crosstool_ng_src_dir)
|
||||
assert common.run_cmd(
|
||||
[os.path.join(common.crosstool_ng_src_dir, 'bootstrap')],
|
||||
) == 0
|
||||
os.chdir(common.crosstool_ng_util_dir)
|
||||
assert common.run_cmd(
|
||||
[
|
||||
os.path.join(common.crosstool_ng_src_dir, 'configure'),
|
||||
'--enable-local',
|
||||
],
|
||||
) == 0
|
||||
assert common.run_cmd(
|
||||
[
|
||||
'make',
|
||||
'-j', str(nproc)
|
||||
],
|
||||
) == 0
|
||||
|
||||
# Build the toolchain.
|
||||
shutil.copy2(
|
||||
os.path.join(common.root_dir, 'crosstool_ng_config', args.arch),
|
||||
defconfig_dest
|
||||
)
|
||||
common.write_configs(
|
||||
common.crosstool_ng_defconfig,
|
||||
[
|
||||
'CT_PREFIX_DIR="{}"'.format(common.crosstool_ng_install_dir),
|
||||
'CT_WORK_DIR="{}"'.format(common.crosstool_ng_build_dir),
|
||||
'CT_LOCAL_TARBALLS_DIR="{}"'.format(common.crosstool_ng_download_dir),
|
||||
]
|
||||
)
|
||||
assert common.run_cmd(
|
||||
[
|
||||
common.crosstool_ng_executable,
|
||||
'defconfig',
|
||||
],
|
||||
) == 0
|
||||
os.unlink(defconfig_dest)
|
||||
assert common.run_cmd(
|
||||
[
|
||||
common.crosstool_ng_executable,
|
||||
'build',
|
||||
'-j', str(nproc)
|
||||
],
|
||||
out_file=os.path.join(common.crosstool_ng_build_dir, 'lkmc.log'),
|
||||
delete_env=['LD_LIBRARY_PATH'],
|
||||
extra_env={'PATH': common.ccache_dir + ':' + os.environ['PATH']},
|
||||
) == 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = get_argparse()
|
||||
args = common.setup(parser)
|
||||
start_time = time.time()
|
||||
exit_status = main(args)
|
||||
end_time = time.time()
|
||||
common.print_time(end_time - start_time)
|
||||
sys.exit(exit_status)
|
||||
Reference in New Issue
Block a user