gem5: --gem5-src

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2018-09-25 00:00:00 +00:00
parent 6b563c0234
commit fd15d3e9df
3 changed files with 54 additions and 1 deletions

5
.gitignore vendored
View File

@@ -15,3 +15,8 @@ gitignore*
# Python trash. # Python trash.
*.pyc *.pyc
__pycache__ __pycache__
# Accidents.
/m5out
*.o
*.out

View File

@@ -10657,6 +10657,47 @@ git -C data/gem5/some-branch checkout some-branch-v2
`--gem5-worktree` is only required if you have multiple gem5 checkouts, e.g. it would not be required for multiple builds of the same tree, e.g. a <<gem5-debug-build>> and a non-debug one. `--gem5-worktree` is only required if you have multiple gem5 checkouts, e.g. it would not be required for multiple builds of the same tree, e.g. a <<gem5-debug-build>> and a non-debug one.
===== gem5 private source trees
Suppose that you are working on a private fork of gem5, but you want to use this repository to develop it as well.
Simply adding your private repository as a remote to `submodules/gem5` is dangerous, as you might forget and push your private work by mistake one day.
Even removing remotes is not safe enough, since `git submodule update` and other submodule commands can restore the old public remote.
Instead, we provide the following safer process.
First do a separate private clone of you private 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:
....
cd linux-kernel-module-cheat
./build-gem5 \
--gem5-build-id p/lkmc/master \
--gem5-src "$gem5_internal" \
--gem5-worktree p/lkmc/master \
;
./run-gem5
--gem5-build-id p/lkmc/master \
--gem5-src "$gem5_internal" \
--gem5-worktree p/lkmc/master \
;
....
`p/lkmc/` is not mandatory but it provides a sane default:
* `p` stands for `private`, and will separate the private from public builds
* `lkmc` is added to prevent name conflicts with other work-trees of the private repository
* `master`, finally, reflects that the worktree is at the `master` state of private repository
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.
===== gem5 debug build ===== gem5 debug build
The `gem5.debug` has optimizations turned off unlike the default `gem5.opt`, and provides a much better <<debug-the-emulator,debug experience>>: The `gem5.debug` has optimizations turned off unlike the default `gem5.opt`, and provides a much better <<debug-the-emulator,debug experience>>:

View File

@@ -31,7 +31,6 @@ kernel_modules_src_dir = os.path.join(this.packages_dir, 'kernel_modules')
submodules_dir = os.path.join(root_dir, 'submodules') submodules_dir = os.path.join(root_dir, 'submodules')
buildroot_src_dir = os.path.join(submodules_dir, 'buildroot') buildroot_src_dir = os.path.join(submodules_dir, 'buildroot')
crosstool_ng_src_dir = os.path.join(submodules_dir, 'crosstool-ng') crosstool_ng_src_dir = os.path.join(submodules_dir, 'crosstool-ng')
gem5_default_src_dir = os.path.join(submodules_dir, 'gem5')
linux_src_dir = os.path.join(submodules_dir, 'linux') linux_src_dir = os.path.join(submodules_dir, 'linux')
extract_vmlinux = os.path.join(linux_src_dir, 'scripts', 'extract-vmlinux') extract_vmlinux = os.path.join(linux_src_dir, 'scripts', 'extract-vmlinux')
qemu_src_dir = os.path.join(submodules_dir, 'qemu') qemu_src_dir = os.path.join(submodules_dir, 'qemu')
@@ -126,6 +125,10 @@ See the documentation for other values known to work.
'-M', '--gem5-build-id', default=default_build_id, '-M', '--gem5-build-id', default=default_build_id,
help='gem5 build ID. Allows you to keep multiple separate gem5 builds. Default: %(default)s' 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( parser.add_argument(
'-N', '--gem5-worktree', '-N', '--gem5-worktree',
help='''\ help='''\
@@ -512,6 +515,10 @@ def setup(parser):
this.crosstool_ng_executable = os.path.join(this.crosstool_ng_util_dir, 'ct-ng') 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_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.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
else:
this.gem5_default_src_dir = os.path.join(submodules_dir, 'gem5')
if args.gem5_worktree is not None: if args.gem5_worktree is not None:
this.gem5_src_dir = os.path.join(this.gem5_non_default_src_root_dir, args.gem5_worktree) this.gem5_src_dir = os.path.join(this.gem5_non_default_src_root_dir, args.gem5_worktree)
else: else: