From c06923297fc0928a75efc63ffd8f49086327166b 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: Tue, 29 Oct 2019 00:00:00 +0000 Subject: [PATCH] gem5 readfile use file, not stdin, or else sh does not work to start interaction --- README.adoc | 2 +- rootfs_overlay/lkmc/gem5.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index b8e8e55..9587939 100644 --- a/README.adoc +++ b/README.adoc @@ -11528,7 +11528,7 @@ So we can do it like: .... # Boot, checkpoint and exit. printf 'echo "setup run";m5 exit' > "$(./getvar gem5_readfile_file)" -./run --emulator gem5 --eval 'm5 checkpoint;m5 readfile | sh' +./run --emulator gem5 --eval 'm5 checkpoint;m5 readfile > /tmp/gem5.sh && sh /tmp/gem5.sh' # Restore and run the first benchmark. printf 'echo "first benchmark";m5 exit' > "$(./getvar gem5_readfile_file)" diff --git a/rootfs_overlay/lkmc/gem5.sh b/rootfs_overlay/lkmc/gem5.sh index eedae30..8966156 100755 --- a/rootfs_overlay/lkmc/gem5.sh +++ b/rootfs_overlay/lkmc/gem5.sh @@ -1,6 +1,8 @@ #!/bin/sh # https://cirosantilli.com/linux-kernel-module-cheat#gem5-restore-new-script m5 checkpoint +tmp="$(mktemp)" +m5 readfile > "$tmp" m5 resetstats -m5 readfile | sh +sh "$tmp" m5 exit