summaryrefslogtreecommitdiff
path: root/configs
diff options
context:
space:
mode:
authorGiacomo Travaglini <giacomo.travaglini@arm.com>2019-11-21 09:29:36 +0000
committerGiacomo Travaglini <giacomo.travaglini@arm.com>2019-11-27 09:44:41 +0000
commit653dfec89ad6d3b8b10f1da7afddff7366e27c82 (patch)
treea6ba660b30874a1041c509ee57b858a8b892c425 /configs
parentccc46bbc20dd30f2288faa3d22ed46024e36dc92 (diff)
downloadgem5-653dfec89ad6d3b8b10f1da7afddff7366e27c82.tar.xz
configs: Add root redirect path in SE mode only when set
As it is now, the default behaviour, if chroot is not specified, is to add a redirect path which is simply mappping "/" in guest to "/" in host. This patch avoids this unnecessary mapping, and adds a redirect path to root only if chroot is specified. Change-Id: Icbe863887330d7071e0005333b408ffc8cad41d6 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23064 Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Brandon Potter <Brandon.Potter@amd.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'configs')
-rw-r--r--configs/common/FileSystemConfig.py20
-rw-r--r--configs/common/Options.py2
2 files changed, 12 insertions, 10 deletions
diff --git a/configs/common/FileSystemConfig.py b/configs/common/FileSystemConfig.py
index 67e380193..1f32ec1c8 100644
--- a/configs/common/FileSystemConfig.py
+++ b/configs/common/FileSystemConfig.py
@@ -140,11 +140,7 @@ def config_filesystem(system, options = None):
tmpdir = joinpath(fsdir, 'tmp')
replace_tree(tmpdir)
- if options and hasattr(options, 'chroot'):
- chroot = os.path.expanduser(options.chroot)
- else:
- chroot = '/'
- system.redirect_paths = _redirect_paths(chroot)
+ system.redirect_paths = _redirect_paths(options)
def register_node(cpu_list, mem, node_number):
nodebasedir = joinpath(m5.options.outdir, 'fs', 'sys', 'devices',
@@ -201,14 +197,20 @@ def register_cache(level, idu_type, size, line_size, assoc, cpus):
file_append((indexdir, 'physical_line_partition'), '1')
file_append((indexdir, 'shared_cpu_map'), hex_mask(cpus))
-def _redirect_paths(chroot):
+def _redirect_paths(options):
# Redirect filesystem syscalls from src to the first matching dests
redirect_paths = [RedirectPath(app_path = "/proc",
host_paths = ["%s/fs/proc" % m5.options.outdir]),
RedirectPath(app_path = "/sys",
host_paths = ["%s/fs/sys" % m5.options.outdir]),
RedirectPath(app_path = "/tmp",
- host_paths = ["%s/fs/tmp" % m5.options.outdir]),
- RedirectPath(app_path = "/",
- host_paths = ["%s" % chroot])]
+ host_paths = ["%s/fs/tmp" % m5.options.outdir])]
+
+ chroot = getattr(options, 'chroot', None)
+ if chroot:
+ redirect_paths.append(
+ RedirectPath(
+ app_path = "/",
+ host_paths = ["%s" % os.path.expanduser(chroot)]))
+
return redirect_paths
diff --git a/configs/common/Options.py b/configs/common/Options.py
index 86523ee64..71f9f1429 100644
--- a/configs/common/Options.py
+++ b/configs/common/Options.py
@@ -369,7 +369,7 @@ def addSEOptions(parser):
help="Redirect stdout to a file.")
parser.add_option("--errout", default="",
help="Redirect stderr to a file.")
- parser.add_option("--chroot", action="store", type="string", default="/",
+ parser.add_option("--chroot", action="store", type="string", default=None,
help="The chroot option allows a user to alter the " \
"search path for processes running in SE mode. " \
"Normally, the search path would begin at the " \