From 7f81db9a465e39eecd594aef85df275ae1ae02ca Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Fri, 14 Sep 2018 16:56:12 +0100 Subject: [PATCH] qemu: use ccache readme: improve build variants --- README.adoc | 9 ++++++--- build-gem5 | 5 +++-- build-qemu | 6 +++--- common.py | 1 + 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/README.adoc b/README.adoc index fd8a7a4..f30f730 100644 --- a/README.adoc +++ b/README.adoc @@ -9305,6 +9305,7 @@ For example, if you want to keep two builds around, one for the latest Linux ver .... ./build-buildroot +git -C "$(./getvar linux_src_dir)" fetch --tags --unshallow git -C "$(./getvar linux_src_dir)" checkout v4.16 ./build-buildroot --linux-build-id v4.16 git -C "$(./getvar linux_src_dir)" checkout - @@ -9312,7 +9313,9 @@ git -C "$(./getvar linux_src_dir)" checkout - ./run --linux-build-id v4.16 .... -The `-L` option should be passed to all scripts that support it, much like `-a` for the <>, e.g. to step debug: +The `git fetch --unshallow` is needed the first time because link:configure[] only does a shallow clone of the Linux kernel to save space and time, see also: https://stackoverflow.com/questions/6802145/how-to-convert-a-git-shallow-clone-to-a-full-clone + +The `--linux-build-id` option should be passed to all scripts that support it, much like `-a` for the <>, e.g. to step debug: ..... ./rungdb --linux-build-id v4.16 @@ -9322,7 +9325,7 @@ This technique is implemented semi-hackishly by moving symlinks around inside th ==== QEMU build variants -Analogous to the <> but with the `-Q` option instead: +Analogous to the <> but with the `--qemu-build-id` option instead: .... ./build-qemu @@ -9335,7 +9338,7 @@ git -C "$(./getvar qemu_src_dir)" checkout - ==== gem5 build variants -Analogous to the <> but with the `-M` option instead: +Analogous to the <> but with the `--gem5-build-id` option instead: .... # Build master. diff --git a/build-gem5 b/build-gem5 index 19b8fcc..5d06e33 100755 --- a/build-gem5 +++ b/build-gem5 @@ -69,7 +69,8 @@ else: # TODO cross_compile is ignored because the make does not use CC... subprocess.check_call(['make', '-C', bootloader64_dir]) shutil.copy2(os.path.join(bootloader64_dir, 'boot_emm.arm64'), binaries_dir) - assert common.run_cmd([ + assert common.run_cmd( + [ 'scons', # TODO factor with build. '-j', str(multiprocessing.cpu_count()), @@ -78,7 +79,7 @@ else: ] + args.extra_scons_args, cwd=common.gem5_src_dir, - extra_env={'PATH': '/usr/lib/ccache:' + os.environ['PATH']}, + extra_env={'PATH': common.ccache_dir + ':' + os.environ['PATH']}, ) == 0 term_src_dir = os.path.join(common.gem5_src_dir, 'util/term') subprocess.check_call(['make', '-C', term_src_dir]) diff --git a/build-qemu b/build-qemu index ad9e5c0..8ec6564 100755 --- a/build-qemu +++ b/build-qemu @@ -33,14 +33,14 @@ else: args.extra_config_args, cwd=common.qemu_build_dir ) - subprocess.check_call( + assert common.run_cmd( [ 'make', # TODO factor with build. '-j', str(multiprocessing.cpu_count()), ], cwd=common.qemu_build_dir, - extra_env={'PATH': '/usr/lib/ccache:' + os.environ['PATH']}, - ) + extra_env={'PATH': common.ccache_dir + ':' + os.environ['PATH']}, + ) == 0 end_time = time.time() common.print_time(end_time - start_time) diff --git a/common.py b/common.py index 26a85bd..b33e171 100644 --- a/common.py +++ b/common.py @@ -32,6 +32,7 @@ gem5_default_src_dir = os.path.join(submodules_dir, 'gem5') linux_src_dir = os.path.join(submodules_dir, 'linux') qemu_src_dir = os.path.join(submodules_dir, 'qemu') parsec_benchmark_src_dir = os.path.join(submodules_dir, 'parsec-benchmark') +ccache_dir = os.path.join('/usr', 'lib', 'ccache') # Other default variables. arch_map = {