These are the files to run gem5 in full system mode. Including the linux kernel, arm bootloader, and root filesystem.
We can use buildroot to create rootfs.ext2
filesystems and load applications into gem5.
Follow these instructions to do so:
git clone https://github.com/buildroot/buildroot.git
make ARCH=aarch64 BR2_JLEVEL=$(nproc) CROSS_COMPILE=aarch64-linux-gnu- \
-C buildroot/ arm_foundationv8_defconfig
Buildroot uses the menuconfig
system to graphically select desired parameters.
make ARCH=aarch64 BR2_JLEVEL=$(nproc) CROSS_COMPILE=aarch64-linux-gnu-
-C buildroot/ menuconfig
Our default parameters are:
- Target Options
- Target Architecture -> AArch64 (little endian)
- Target Architecture Variant -> Cortex-A57
- Toolchain
- Kernel Headers -> Linux 5.4.x
- Kernel -> Disabled
- Target packages
- BusyBox configuration file to use?
- package/busybox/busybox-minimal.config
- BusyBox configuration file to use?
- Filesystem Images
- enable ext2
This step will take a few minutes.
make ARCH=aarch64 BR2_JLEVEL=$(nproc) CROSS_COMPILE=aarch64-linux-gnu- \
-C buildroot/
You can skip this step if you have built the disk image before.
We need to add the m5
binary to enable gem5 magic commands.
cp -r simtools/m5 <buildroot_dir>/output/target/sbin
Then we add the S98
script to enable run script on startup.
cp -r simtools/S98 <buildroot_dir>/output/target/etc/init.d
Lastly, replace the inittab
file with ours to ensure S98 is run.
cp -r simtools/inittab <buildroot_dir>/output/target/etc
The buildroot overlay system allows for files to be placed in the disk image. In the directory: <buildroot_dir>/output/target/ The linux file system is mimicked.
This step will take a few seconds this time.
cd <buildroot_dir>
make ARCH=aarch64 BR2_JLEVEL=$(nproc) CROSS_COMPILE=aarch64-linux-gnu-
mv output/images/rootfs.ext2 ../resources/