Morello FPGA Benchmarking Images - CTSRD-CHERI/cheripedia GitHub Wiki
The Morello FPGA environment used for benchmarking is extremely minimal. Other than loading an image into memory, the only I/O is a serial console. This means images need to be produced using the following:
cheribuild --disk-image-mfs-root/extra-files=$EXTRA_FILES cheribsd-morello-purecap disk-image-mfs-root-morello-purecap cheribsd-mfs-root-kernel-morello-purecap
$EXTRA_FILES
should point to a directory that contains an etc/rc.local
file. This file will be sourced at the end of boot, and must:
- Prepare the environment for the benchmark (e.g. create directories, load hwpmc.ko)
- Run the benchmark
- Print any required benchmark output
- Shut down
As an example:
if [ ! -f /boot/kernel/kernel ]; then
echo "Creating dummy /boot/kernel/kernel"
mkdir -p /boot/kernel
touch /boot/kernel/kernel
fi
kldload hwpmc
pmcstat ... /path/to/my/benchmark
cat /path/to/my/output
poweroff
Note that these are minimal images. Many non-critical libraries and utilities are missing, and almost all utilities are replaced with "cheribsdbox" (similar to BusyBox in a minimal Linux image), so benchmark dependencies should be minimised, and you may need to include extra files needed by your benchmark (either by putting them in $EXTRA_FILES
, which will be merged into the root filesystem, or by editing cheribuild's disk_image.py). Kernel modules are also not included by default, so if you are using hwpmc.ko you will need to pass --disk-image-mfs-root/include-pmc to cheribuild.
These images can be tested on real hardware by placing them in /boot/kernel.foo/kernel
, selecting the desired kernel from the FreeBSD loader, running set vfs.root.mountfrom=ufs:/dev/md0
(press Escape for a command line, and use the menu
command to return to the menu) and booting.
As with benchmarking on a real Morello system, be sure to follow CheriBSD's benchmarking guidance.