tree: 105b4d9897a0575fb26ae55c9f483f990cd654f0 [path history] [tgz]
  2. disk-image/

Hack Back Checkpointing Disk Image

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:

  |___ 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
  |            |___    # Moves hack_back_ckpt.rcS to guest's .bashrc
  |___                           # 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
cd gem5/util/m5
scons build/x86/out/m5


cd disk-image
# if packer is not already installed

# 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:

  • On starting a gem5 simulation using this disk image, after the kernel boot, the hack back script is the first thing which will run and exit the simulation with an exit_event cause of checkpoint.
  • Your gem5 run script should be able to recognize this exit_event and take a checkpoint using m5.checkpoint(m5.options.outdir).
  • Later, on restoring the simulation from the checkpoint, you should be able to pass a new script to run your benchmarks, which will start simulating your benchmarks right from the point where the checkpoint was taken.
  • To restore from the checkpoint (assuming that it is in the gem5 outdir), use m5.instantiate(m5.options.outdir).
  • Your benchmark script can be passed using system.readfile=[path to the script] in your gem5 run script.