From 0bf7c7cb81cf905e1e50b873f8bb01d1d38eff3f 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: Sun, 16 Sep 2018 06:43:18 +0100 Subject: [PATCH] prebuilt: failed extract-vmlinux attempt --- README.adoc | 3 +++ common.py | 1 + run | 10 +++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index a292156..d44e4b3 100644 --- a/README.adoc +++ b/README.adoc @@ -582,12 +582,15 @@ but QEMU builds are pretty quick, and this further increases the probability of For gem5, do: .... +git submodule update --init --depth 1 "$(./getvar linux_src_dir)" sudo apt-get install qemu-utils ./build-gem5 ./run --gem5 --prebuilt .... `qemu-utils` is required because we currently distribute `.qcow2` files which <>, so we need `qemu-img` to extract them first. + +The Linux kernel is required for `extract-vmlinux` to convert the compressed kernel image which QEMU understands into the raw vmlinux that gem5 understands: https://superuser.com/questions/298826/how-do-i-uncompress-vmlinuz-to-vmlinux //// [[host]] diff --git a/common.py b/common.py index c660504..146b1e1 100644 --- a/common.py +++ b/common.py @@ -30,6 +30,7 @@ submodules_dir = os.path.join(root_dir, 'submodules') buildroot_src_dir = os.path.join(submodules_dir, 'buildroot') gem5_default_src_dir = os.path.join(submodules_dir, 'gem5') linux_src_dir = os.path.join(submodules_dir, 'linux') +extract_vmlinux = os.path.join(linux_src_dir, 'scripts', 'extract-vmlinux') 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') diff --git a/run b/run index 5bccb34..873a14a 100755 --- a/run +++ b/run @@ -104,6 +104,14 @@ def main(args, extra_args=None): if not os.path.exists(common.qcow2_file): raise_rootfs_not_found() common.raw_to_qcow2(prebuilt=args.prebuilt, reverse=True) + if not os.path.exists(common.vmlinux): + # This would allow us to run the prebuilt QEMU Linux image. + # but TODO cannot convert Image to vmlinux on aarch64: + # run-detectors: unable to find an interpreter for + if not os.path.exists(common.linux_image): + raise Exception('Linux kernel image not found. Did you compile it?\n' \ + 'Tried: ' + common.vmlinux) + assert common.run_cmd([os.path.join(common.extract_vmlinux, common.linux_image)]) == 0 os.makedirs(os.path.dirname(common.gem5_readfile), exist_ok=True) with open(common.gem5_readfile, 'w') as readfile: readfile.write(args.gem5_readfile) @@ -175,7 +183,7 @@ def main(args, extra_args=None): qemu_executable = common.qemu_executable qemu_found = os.path.exists(qemu_executable) if not qemu_found: - raise Exception('Could not find the QEMU executable, did you forget to build or install it?\n' \ + raise Exception('QEMU executable not found, did you forget to build or install it?\n' \ 'Tried to use: ' + qemu_executable) if not os.path.exists(common.qcow2_file): if not os.path.exists(common.rootfs_raw_file):