This document provides instructions to create a disk image with hack_back_ckpt.rcS script (located in gem5/configs/boot/) installed. This script creates a checkpoint once the Linux system boots up. Using environment variables the script makes sure that the checkpoint is not created if one already exists. On restoring the simulation from the checkpoint, a new script can be provided to execute the desired applications.

Note: The instructions in this README are based on experiments with gem5-20.

We assume the following directory structure while following the instructions in this README file:

npb/
  |___ gem5/                                # gem5 source code
  |
  |___ disk-image/
  |      |___ shared/                       # Auxiliary files needed for disk creation
  |      |___ hack-back/
  |            |___ hack-back-image/        # Will be created once the disk is generated
  |            |      |___ hack-back        # The generated disk image
  |            |___ hack-back.json          # The Packer script to build the disk image
  |            |___ hack_back_ckpt.rcS      # Main script responsible for checkpointing
  |            |___ post-installation.sh    # Moves hack_back_ckpt.rcS to guest's .bashrc
  |
  |
  |___ README.md                           # This README file

Disk Image

Assuming that you are in the src/hack-back/ directory (the directory containing this README), first build m5 (which is needed to create the disk image):

git clone https://gem5.googlesource.com/public/gem5
cd gem5/util/m5
scons build/x86/out/m5

Next,

cd disk-image
# if packer is not already installed
wget https://releases.hashicorp.com/packer/1.6.0/packer_1.6.0_linux_amd64.zip
unzip packer_1.6.0_linux_amd64.zip

# validate the packer script
./packer validate hack-back/hack-back.json
# build the disk image
./packer build hack-back/hack-back.json

Once this process succeeds, the created disk image can be found on hack-back/hack-back-image/hack-back.

Using this Disk Image

The details of how to use this disk image are following: