mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
gem5: support variants
This commit is contained in:
31
run
31
run
@@ -34,7 +34,7 @@ trace_enabled=false
|
||||
# just to prevent QEMU from emitting a warning that '' is not valid.
|
||||
trace_type=pr_manager_run
|
||||
vnc=
|
||||
while getopts a:c:DdE:e:F:f:G:ghIiKkL:m:PT:U:uVx OPT; do
|
||||
while getopts a:c:DdE:e:F:f:G:ghIiKkL:M:m:PT:U:uVx OPT; do
|
||||
case "$OPT" in
|
||||
a)
|
||||
arch="$OPTARG"
|
||||
@@ -94,6 +94,9 @@ while getopts a:c:DdE:e:F:f:G:ghIiKkL:m:PT:U:uVx OPT; do
|
||||
L)
|
||||
common_linux_variant="$OPTARG"
|
||||
;;
|
||||
M)
|
||||
common_gem5_variant="$OPTARG"
|
||||
;;
|
||||
m)
|
||||
memory="$OPTARG"
|
||||
;;
|
||||
@@ -124,8 +127,7 @@ while getopts a:c:DdE:e:F:f:G:ghIiKkL:m:PT:U:uVx OPT; do
|
||||
done
|
||||
shift "$(($OPTIND - 1))"
|
||||
extra_flags="$extra_flags $@"
|
||||
set_common_vars -L "$common_linux_variant" "$arch" "$gem5"
|
||||
images_dir="${buildroot_out_dir}/images"
|
||||
set_common_vars -L "$common_linux_variant" -M "$common_gem5_variant" "$arch" "$gem5"
|
||||
if "$debug" && "$kvm"; then
|
||||
echo 'error: -d and -K are incompatible' 1>&2
|
||||
exit 1
|
||||
@@ -156,9 +158,6 @@ if [ -n "$extra_append_after_dash" ]; then
|
||||
fi
|
||||
|
||||
if "$gem5"; then
|
||||
gem5_build_dir="${buildroot_out_dir}/build/gem5-1.0"
|
||||
gem5_src_dir="${root_dir}/gem5/gem5"
|
||||
gem5_system_dir="${gem5_out_dir}/system"
|
||||
memory="${memory}B"
|
||||
if [ "$arch" = x86_64 ]; then
|
||||
gem5_arch=X86
|
||||
@@ -170,14 +169,14 @@ if "$gem5"; then
|
||||
"
|
||||
fi
|
||||
gem5_common="\
|
||||
M5_PATH='${gem5_system_dir}' \\
|
||||
M5_PATH='${common_gem5_system_dir}' \\
|
||||
${debug_vm} \
|
||||
'${gem5_out_dir}/build/${gem5_arch}/gem5.opt' \\
|
||||
'${common_gem5_build_dir}/${gem5_arch}/gem5.opt' \\
|
||||
--debug-file=trace.txt \\
|
||||
${gem5opts} \
|
||||
-d '${m5out_dir}' \\
|
||||
'${gem5_src_dir}/configs/example/fs.py' \\
|
||||
--disk-image='${images_dir}/rootfs.ext2' \\
|
||||
-d '${common_m5out_dir}' \\
|
||||
'${common_gem5_src_dir}/configs/example/fs.py' \\
|
||||
--disk-image='${common_images_dir}/rootfs.ext2' \\
|
||||
--kernel='${common_vmlinux}' \\
|
||||
--mem-size='${memory}' \\
|
||||
--num-cpus='${cpus}' \\
|
||||
@@ -197,7 +196,7 @@ ${extra_flags} \
|
||||
# Anything smaller than physical blows up as expected, but why can't it auto-detect the right value?
|
||||
cmd="${gem5_common} \
|
||||
--command-line='earlyprintk=pl011,0x1c090000 console=ttyAMA0 lpj=19988480 rw loglevel=8 mem=${memory} root=/dev/sda ${extra_append}' \\
|
||||
--dtb-file='${gem5_system_dir}/arm/dt/$([ "$arch" = arm ] && echo "armv7_gem5_v1_${cpus}cpu" || echo "armv8_gem5_v1_${cpus}cpu").dtb' \\
|
||||
--dtb-file='${common_gem5_system_dir}/arm/dt/$([ "$arch" = arm ] && echo "armv7_gem5_v1_${cpus}cpu" || echo "armv8_gem5_v1_${cpus}cpu").dtb' \\
|
||||
--machine-type=VExpress_GEM5_V1 \\
|
||||
${extra_flags} \
|
||||
"
|
||||
@@ -235,7 +234,7 @@ ${serial_monitor} \
|
||||
-virtfs 'local,path=${buildroot_out_dir}/build,mount_tag=host_out,security_model=mapped,id=host_out' \\
|
||||
${vnc}"
|
||||
if "$initrd"; then
|
||||
extra_flags="${extra_flags} -initrd '${images_dir}/rootfs.cpio' \\
|
||||
extra_flags="${extra_flags} -initrd '${common_images_dir}/rootfs.cpio' \\
|
||||
"
|
||||
fi
|
||||
if "$ramfs"; then
|
||||
@@ -243,7 +242,7 @@ ${vnc}"
|
||||
root='root=/dev/anything'
|
||||
else
|
||||
if [ ! "$arch" = mips64 ]; then
|
||||
extra_flags="${extra_flags} -drive 'file=${images_dir}/rootfs.ext2.qcow2,format=qcow2,if=virtio,snapshot' \\
|
||||
extra_flags="${extra_flags} -drive 'file=${common_images_dir}/rootfs.ext2.qcow2,format=qcow2,if=virtio,snapshot' \\
|
||||
"
|
||||
root='root=/dev/vda'
|
||||
fi
|
||||
@@ -291,14 +290,14 @@ ${qemu_common} \
|
||||
-append '${root} ${extra_append}' \\
|
||||
-cpu cortex-a57 \\
|
||||
-device virtio-gpu-pci \\
|
||||
-kernel '${images_dir}/Image' \\
|
||||
-kernel '${common_images_dir}/Image' \\
|
||||
${extra_flags} \
|
||||
"
|
||||
;;
|
||||
mips64)
|
||||
if ! "$ramfs"; then
|
||||
root='root=/dev/hda'
|
||||
extra_flags="${extra_flags} -drive 'file=${images_dir}/rootfs.ext2.qcow2,format=qcow2,snapshot' \\
|
||||
extra_flags="${extra_flags} -drive 'file=${common_images_dir}/rootfs.ext2.qcow2,format=qcow2,snapshot' \\
|
||||
"
|
||||
fi
|
||||
cmd="\
|
||||
|
||||
Reference in New Issue
Block a user