Skip to content

CVA6-CHERI, genesys2, RVY: Add support for generating bootable SD card images for CheriBSD, CHERI-Linux, and CHERI-seL4 - #523

Open
heshamelmatary wants to merge 21 commits into
mainfrom
cva6-cheri
Open

CVA6-CHERI, genesys2, RVY: Add support for generating bootable SD card images for CheriBSD, CHERI-Linux, and CHERI-seL4#523
heshamelmatary wants to merge 21 commits into
mainfrom
cva6-cheri

Conversation

@heshamelmatary

@heshamelmatary heshamelmatary commented Jul 28, 2026

Copy link
Copy Markdown
Member

This PR adds targets for generating bootable images that can be flashed to an SD card (or injected directly into RAM) and used to run on both Mocha and CVA6-CHERI on the Genesys2 board. Only purecap RVY targets are currently supported. The boot flow and tools align as closely as possible with CVA6-SDK, which uses U-Boot as an OpenSBI payload and embeds kernels/OSes, ramdisks, and DTBs in a new U-Boot FIT image format. The currently supported OS images include:

  1. CheriBSD:
    ./cheribuild.py genimage-cva6-cheribsd --cheribsd-mfs-root-kernel-riscv64-purecap/kernel-config RVY-PURECAP-PRIME --riscv-cheri-isa=experimental_std093 --cheribsd/git-revision cheri-rv64y-rebased-c18n -d

Note: At the time of creating this PR, a working and tested RVY CheriBSD build requires the custom flags, branches, repositories, and toolchain specified above. This will hopefully become more stable and eventually be merged upstream, at which point fewer custom options should be required.

  1. CHERI-Linux (minimal):
    ./cheribuild.py genimage-cva6-cheri-linux -d
    or for Mocha:
    ./cheribuild.py genimage-mocha-cheri-linux --riscv-float-abi soft -d

  2. CHERI-seL4 (CHERI-Microkit userspace and CHERI-Exercises on top):
    ./cheribuild.py genimage-cva6-cheri-sel4 --cheri-microkit/boards ariane

The above have been tested against bitfiles generated from CVA6-CHERI for the Genesys2 board.


Note:
This PR/branch is standalone and self-contained (i.e. it can be used independently to build the images) and includes commits from #483, #502, #503, #504, #505, and #521. It will likely be force-pushed during the review process to address comments and fixes until it is merged into main.

Similar to CheriBSD's kernel-config, this commit allows the user to
specify a defconfig that is not a default eg for CVA6-CHERI or
Codasip's X730 by passing its name to --linux-kernel/defconfig $XXX.
Similar to Linux's defconfig, this commit allows the user to
specify a defconfig that is not a default eg for CVA6-CHERI or
Codasip's X730 by passing its name to --u-boot/defconfig $XXX
Currently the launch target will add -cpu codasip-a730 only if
--riscv-cheri-isa experimental_std093 is passed, and will discard -cpu if not.
Discarding -cpu will result in a CHERI-enabled RVY QEMU, but with extended CHERI
flags/features disabled such as cheri_pte, cheri_levels, etc, in the QEMU 7.1
branch.

This PR fixes this by:
1- Always pass -cpu rv64,cheri_pte,cheri_levels for RVY by default,
without having to check for the --riscv-cheri-isa flag, by also relying on the
cross compilation target.
2- Use a more generic -cpu rv64 and not codasip-a730.
Install the host-built mkimage tool as part of the U-Boot installation.

mkimage is useful for creating U-Boot payload images and scripts, including
FIT images and .scr boot scripts.
Install any generated RISC-V device tree blobs alongside the other U-Boot
artifacts.
Some platforms and U-Boot configurations (e.g. FIT images) require DTBs to
be packaged with the boot artifacts when booting operating systems such as
Linux. Installing the generated DTBs is also useful when using custom DTBs
instead of relying on those provided by the firmware, so install them when
they are present.
Current cheribuild only uses the fw_jump variant of OpenSBI while
there exists other variants as well such as fw_payload that could
be used. This commit enables choosing the payload variant of
opensbi (which could embed u-boot and/or other OSes) and install
it as an optional (QEMU's) firmware variant besides fw_jump.
To avoid getting stuck if there is no dhcp server.
Mocha is lowRISC's CHERI-enabled SoC part of the COSMIC project [1]
and is based on our CVA6-CHERI. This commit uses lowRISC's GitHub
repos and configs to reproduce their images using cheribuild and
for our own CI testing as well.

[1] https://cosmic-project.lowrisc.org
@PeterRugg

Copy link
Copy Markdown
Contributor

Thanks for this! Will be very helpful for getting people set up on the Genesys2 CVA6-CHERI platform.

@heshamelmatary
heshamelmatary force-pushed the cva6-cheri branch 2 times, most recently from e33c1d1 to 57b0a51 Compare July 28, 2026 14:28
Microkit is a tool and light-weight libraries to build/run seL4
applications on top of it; it is usually packaged, along with the
toolchain, as a package to be used as an seL4 SDK.
There is a corner case when a user provides both repository _and_
git-revision (eg for LLVM), which will fail to clone if the passed
repository does not have the default_branch encoded in the target.
This is also tested and works fine for CHERI-Linux and CHERI-seL4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants