mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 19:51:35 +01:00
prebuilt: failed extract-vmlinux attempt
This commit is contained in:
@@ -582,12 +582,15 @@ but QEMU builds are pretty quick, and this further increases the probability of
|
|||||||
For gem5, do:
|
For gem5, do:
|
||||||
|
|
||||||
....
|
....
|
||||||
|
git submodule update --init --depth 1 "$(./getvar linux_src_dir)"
|
||||||
sudo apt-get install qemu-utils
|
sudo apt-get install qemu-utils
|
||||||
./build-gem5
|
./build-gem5
|
||||||
./run --gem5 --prebuilt
|
./run --gem5 --prebuilt
|
||||||
....
|
....
|
||||||
|
|
||||||
`qemu-utils` is required because we currently distribute `.qcow2` files which <<gem5-qcow2,gem5 can't handle>>, so we need `qemu-img` to extract them first.
|
`qemu-utils` is required because we currently distribute `.qcow2` files which <<gem5-qcow2,gem5 can't handle>>, 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]]
|
[[host]]
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ 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')
|
||||||
gem5_default_src_dir = os.path.join(submodules_dir, 'gem5')
|
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')
|
||||||
qemu_src_dir = os.path.join(submodules_dir, 'qemu')
|
qemu_src_dir = os.path.join(submodules_dir, 'qemu')
|
||||||
parsec_benchmark_src_dir = os.path.join(submodules_dir, 'parsec-benchmark')
|
parsec_benchmark_src_dir = os.path.join(submodules_dir, 'parsec-benchmark')
|
||||||
ccache_dir = os.path.join('/usr', 'lib', 'ccache')
|
ccache_dir = os.path.join('/usr', 'lib', 'ccache')
|
||||||
|
|||||||
10
run
10
run
@@ -104,6 +104,14 @@ def main(args, extra_args=None):
|
|||||||
if not os.path.exists(common.qcow2_file):
|
if not os.path.exists(common.qcow2_file):
|
||||||
raise_rootfs_not_found()
|
raise_rootfs_not_found()
|
||||||
common.raw_to_qcow2(prebuilt=args.prebuilt, reverse=True)
|
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)
|
os.makedirs(os.path.dirname(common.gem5_readfile), exist_ok=True)
|
||||||
with open(common.gem5_readfile, 'w') as readfile:
|
with open(common.gem5_readfile, 'w') as readfile:
|
||||||
readfile.write(args.gem5_readfile)
|
readfile.write(args.gem5_readfile)
|
||||||
@@ -175,7 +183,7 @@ def main(args, extra_args=None):
|
|||||||
qemu_executable = common.qemu_executable
|
qemu_executable = common.qemu_executable
|
||||||
qemu_found = os.path.exists(qemu_executable)
|
qemu_found = os.path.exists(qemu_executable)
|
||||||
if not qemu_found:
|
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)
|
'Tried to use: ' + qemu_executable)
|
||||||
if not os.path.exists(common.qcow2_file):
|
if not os.path.exists(common.qcow2_file):
|
||||||
if not os.path.exists(common.rootfs_raw_file):
|
if not os.path.exists(common.rootfs_raw_file):
|
||||||
|
|||||||
Reference in New Issue
Block a user