gem5: replace --gem5-src with --gem5-worktree-path

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2018-09-28 00:00:00 +00:00
parent f403f86934
commit ca55bc2d61
3 changed files with 30 additions and 30 deletions

View File

@@ -10667,32 +10667,28 @@ Even removing remotes is not safe enough, since `git submodule update` and other
Instead, we provide the following safer process.
First do a separate private clone of you private repository:
First do a separate private clone of you private repository outside of this repository:
....
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-src` argument to point this repository to the private source code:
Next, when you want to build with this repository, use the `--gem5-worktree-path` argument to point this repository to the private source code:
....
cd linux-kernel-module-cheat
./build-gem5 \
--gem5-build-id private/master \
--gem5-src "$gem5_internal" \
--gem5-worktree private/master \
--gem5-worktree-path "$gem5_internal" \
;
./run-gem5
--gem5-build-id private/master \
--gem5-src "$gem5_internal" \
--gem5-worktree private/master \
--gem5-worktree-path "$gem5_internal" \
;
....
`private` is not mandatory, but it is a sane default that will remind you at all times that you are dealing with private code instead of public.
This setup only creates gitignored worktrees of the private repository inside this repository, which is pretty safe, while still allowing fully use our infrastructure as usual.
With this setup, only the private gem5 build outputs are stored in this repository, and they are safely gitignored.
===== gem5 debug build

View File

@@ -27,16 +27,17 @@ else:
start_time = time.time()
os.makedirs(binaries_dir, exist_ok=True)
os.makedirs(disks_dir, exist_ok=True)
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')
assert common.run_cmd([
'git',
'-C', common.gem5_default_src_dir,
'worktree', 'add',
'-b', os.path.join('wt', args.gem5_build_id),
common.gem5_src_dir
]) == 0
if args.gem5_src 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')
assert common.run_cmd([
'git',
'-C', common.gem5_default_src_dir,
'worktree', 'add',
'-b', os.path.join('wt', args.gem5_build_id),
common.gem5_src_dir
]) == 0
if args.arch == 'x86_64':
dummy_img_path = os.path.join(disks_dir, 'linux-bigswap2.img')
with open(dummy_img_path, 'wb') as dummy_img_file:

View File

@@ -125,16 +125,18 @@ See the documentation for other values known to work.
'-M', '--gem5-build-id', default=default_build_id,
help='gem5 build ID. Allows you to keep multiple separate gem5 builds. Default: %(default)s'
)
parser.add_argument(
'--gem5-src',
help='If given, use the gem5 directory exactly as submodules/gem5 is would normally used.'
)
parser.add_argument(
'-N', '--gem5-worktree',
help='''\
gem5 git worktree to use for build and Python scripts at runtime. Automatically
create a new git worktree with the given id if one does not exist. If not
given, just use the submodule source.
'''
)
parser.add_argument(
'--gem5-src',
help='''\
Use the given directory as the gem5 source tree. Ignore `--gem5-worktree`.
'''
)
parser.add_argument(
@@ -528,14 +530,15 @@ def setup(parser):
this.crosstool_ng_executable = os.path.join(this.crosstool_ng_util_dir, 'ct-ng')
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')
if (args.gem5_src):
this.gem5_default_src_dir = args.gem5_src
this.gem5_default_src_dir = os.path.join(submodules_dir, 'gem5')
if args.gem5_src is not None:
this.gem5_src_dir = args.gem5_src
assert(os.path.exists(args.gem5_src))
else:
this.gem5_default_src_dir = os.path.join(submodules_dir, 'gem5')
if args.gem5_worktree is not None:
this.gem5_src_dir = os.path.join(this.gem5_non_default_src_root_dir, args.gem5_worktree)
else:
this.gem5_src_dir = this.gem5_default_src_dir
if args.gem5_worktree is not None:
this.gem5_src_dir = os.path.join(this.gem5_non_default_src_root_dir, args.gem5_worktree)
else:
this.gem5_src_dir = this.gem5_default_src_dir
if args.gem5:
this.executable = this.gem5_executable
this.run_dir = this.gem5_run_dir