From e8cd0caa9e9ffebcba07a9b74cf23f8a930537ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Tue, 9 Oct 2018 19:42:32 +0100 Subject: [PATCH] gem5: add --gem5-build-dir for private out of tree builds --- README.adoc | 12 ++++++------ build-gem5 | 2 +- common.py | 19 ++++++++++++++----- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/README.adoc b/README.adoc index 2c97aae2..5289d799 100644 --- a/README.adoc +++ b/README.adoc @@ -10674,21 +10674,21 @@ git clone https://my.private.repo.com/my-fork/gem5.git gem5-internal gem5_internal="$(pwd)/gem5-internal" .... -Next, when you want to build with this repository, use the `--gem5-source` argument to point this repository to the private source code: +Next, when you want to build with the private repository, use the `--gem5-build-dir` and `--gem5-source-dir` argument to override our default gem5 source and build locations: .... cd linux-kernel-module-cheat ./build-gem5 \ - --gem5-build-id private/master \ - --gem5-source "$gem5_internal" \ + --gem5-build-dir "${gem5_internal}/build" \ + --gem5-source-dir "$gem5_internal" \ ; ./run-gem5 \ - --gem5-build-id private/master \ - --gem5-source "$gem5_internal" \ + --gem5-build-dir "${gem5_internal}/build" \ + --gem5-source-dir "$gem5_internal" \ ; .... -With this setup, only the private gem5 build outputs are stored in this repository, and they are safely gitignored. +With this setup, both your private gem5 source and build are safely kept outside of this public repository. ===== gem5 debug build diff --git a/build-gem5 b/build-gem5 index 4b2316bd..08c0290a 100755 --- a/build-gem5 +++ b/build-gem5 @@ -27,7 +27,7 @@ else: start_time = time.time() os.makedirs(binaries_dir, exist_ok=True) os.makedirs(disks_dir, exist_ok=True) - if args.gem5_source is None: + if args.gem5_source_dir is None: if not os.path.exists(os.path.join(common.gem5_src_dir, '.git')): if common.gem5_src_dir == common.gem5_default_src_dir: raise Exception('gem5 submodule not checked out') diff --git a/common.py b/common.py index 56ab7ffd..cb7e3c22 100644 --- a/common.py +++ b/common.py @@ -134,7 +134,13 @@ given, just use the submodule source. ''' ) parser.add_argument( - '--gem5-source', + '--gem5-build-dir', + help='''\ +Use the given directory as the gem5 build directory. +''' + ) + parser.add_argument( + '--gem5-source-dir', help='''\ Use the given directory as the gem5 source tree. Ignore `--gem5-worktree`. ''' @@ -514,7 +520,10 @@ def setup(parser): this.qemu_termout_file = os.path.join(this.qemu_run_dir, 'termout.txt') this.qemu_rrfile = os.path.join(this.qemu_run_dir, 'rrfile') this.gem5_out_dir = os.path.join(this.out_dir, 'gem5') - this.gem5_build_dir = os.path.join(this.gem5_out_dir, args.gem5_build_id, args.gem5_build_type) + if args.gem5_build_dir is None: + this.gem5_build_dir = os.path.join(this.gem5_out_dir, args.gem5_build_id, args.gem5_build_type) + else: + this.gem5_build_dir = args.gem5_build_dir this.gem5_fake_iso = os.path.join(this.gem5_out_dir, 'fake.iso') this.gem5_m5term = os.path.join(this.gem5_build_dir, 'm5term') this.gem5_build_build_dir = os.path.join(this.gem5_build_dir, 'build') @@ -531,9 +540,9 @@ def setup(parser): this.crosstool_ng_build_dir = os.path.join(this.crosstool_ng_buildid_dir, 'build') this.crosstool_ng_download_dir = os.path.join(this.crosstool_ng_out_dir, 'download') this.gem5_default_src_dir = os.path.join(submodules_dir, 'gem5') - if args.gem5_source is not None: - this.gem5_src_dir = args.gem5_source - assert(os.path.exists(args.gem5_source)) + if args.gem5_source_dir is not None: + this.gem5_src_dir = args.gem5_source_dir + assert(os.path.exists(args.gem5_source_dir)) else: if args.gem5_worktree is not None: this.gem5_src_dir = os.path.join(this.gem5_non_default_src_root_dir, args.gem5_worktree)