Last active
March 31, 2024 14:17
-
-
Save yiidtw/b7ce5a54f7ad8627580db7f439b6b72f to your computer and use it in GitHub Desktop.
simple script to run gem5 full system simulation with configs/example/arm/starter_fs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Disclaimer: | |
# This is a simple script to run gem5 full system simulation. | |
# Tested on gem5 version 23.1.0.0. | |
# Quickstart and compile gem5: https://www.gem5.org/getting_started/ | |
# prebuilt kernel image: http://dist.gem5.org/dist/v22-0/arm/aarch-system-20220707.tar.bz2 | |
# prebuilt rootfs: http://dist.gem5.org/dist/current/arm/disks/linaro-minimal-aarch64.img.bz2 | |
# Author of this script: yiidtw | |
# Directory layout: | |
# gem5 | |
# ├── scripts (manually put this script here) | |
# │ └── run_starter_fs.sh | |
# ├── m5 (manually decompress the prebuilt files here) | |
# │ ├── binaries (kernel images, bootloader) | |
# │ ├── disks (disk images) | |
# │ └── cpts (m5 checkpoint; eval `m5 readfile`;) | |
# ├── m5out (managed by this script) | |
# │ └── logs (config, stats, dtb, log...etc) | |
# └── ... (other original files) | |
BASEDIR=$(dirname $0)/.. | |
cd $BASEDIR | |
M5OUT_PATH=$BASEDIR/m5out/logs/`date +%Y%m%dT%H%M%S` | |
mkdir -p $M5OUT_PATH | |
echo "INFO: output system log in `realpath $M5OUT_PATH`" | |
RUN_FS_COMMAND=""" | |
./build/ARM/gem5.opt \ | |
--outdir=$M5OUT_PATH \ | |
configs/example/arm/starter_fs.py \ | |
--kernel vmlinux.arm64 \ | |
--disk linaro-minimal-aarch64.img \ | |
""" | |
CHECKPOINT_PATH=m5/cpts/cpt.linaro-minimal-aarch64 | |
if [ -d $CHECKPOINT_PATH ]; then | |
echo "INFO: restore from checkpoint in `realpath $CHECKPOINT_PATH`" | |
RUN_FS_COMMAND="$RUN_FS_COMMAND --restore $CHECKPOINT_PATH" | |
fi | |
echo "INFO: run full-system simulation with command \n" | |
# echo "INFO: command dry-run $RUN_FS_COMMAND \n" | |
export M5_PATH=$BASEDIR/m5 | |
eval $(echo $RUN_FS_COMMAND) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment