Skip to content
forked from Alignof/hikami

Light weight hypervisor for RISC-V H-extension.

License

Notifications You must be signed in to change notification settings

NanaHigh/hikami

This branch is 244 commits behind Alignof/hikami:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7c808a5 · Oct 19, 2024
Oct 15, 2024
Sep 29, 2024
Oct 15, 2024
Oct 17, 2024
Oct 1, 2024
Oct 19, 2024
Jun 25, 2023
Oct 15, 2024
Oct 14, 2024
Oct 15, 2024
Oct 15, 2024
Oct 15, 2024
Oct 14, 2024

Repository files navigation

hikami

Rust
Light weight type-1 hypervisor for RISC-V H-extension.

This project aims not only to realize a lightweight hypervisor that can be used on RISC-V H extensions, but also to easily reproduce and manage the "extension" on the hypervisor. (currently in progress)
Poster in RISC-V Days Tokyo 2024 Summer: PDF

Run Linux

Build QEMU

We need to build manually the QEMU to support IOMMU.

$ git clone https://github.com/qemu/qemu.git -b staging
$ cd qemu/
# https://patchwork.ozlabs.org/project/qemu-devel/list/?series=417654
$ wget https://patchwork.ozlabs.org/series/417654/mbox/ --output-document riscv-QEMU-RISC-V-IOMMU-Support.patch
$ git apply riscv-QEMU-RISC-V-IOMMU-Support.patch
$ ./configure --target-list=riscv64-softmmu
$ make -j $(nproc)
# $ sudo make install

Ver. 9.2 or later should officially support IOMMU, so it should no longer be necessary to apply patches.

Build Linux

$ git clone https://github.com/torvalds/linux -b v6.9

$ cd /path/to/this/repository
$ cp ./guest_image/.config /path/to/linux

$ cd /path/to/linux
$ make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- defconfig
$ make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- -j$(nproc)
$ mv vmlinux /path/to/this/repository

See also for custom guest image: guest_image/README.md.

Create rootfs

$ git clone https://gitee.com/mirrors/busyboxsource.git
$ cd busyboxsource

# Select: Settings -> Build Options -> Build static binary
$ CROSS_COMPILE=riscv64-unknown-linux-gnu- make menuconfig

$ CROSS_COMPILE=riscv64-unknown-linux-gnu- make -j8
$ CROSS_COMPILE=riscv64-unknown-linux-gnu- make install

$ cd ../
$ qemu-img create rootfs.img  1g
$ mkfs.ext4 rootfs.img

$ mkdir rootfs
$ mount -o loop rootfs.img rootfs
$ cd rootfs
$ cp -r ../busyboxsource/_install/* .
$ mkdir proc dev tec etc/init.d

$ cd etc/init.d/
$ cat << EOS > rcS
#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
/sbin/mdev -s
EOS

$ chmod +x rcS

$ umount rootfs
$ mv rootfs.img /path/to/this/repository

Run

# The actual command to be executed is written in .cargo/config.toml.
$ cargo r

Documents

$ cargo doc --open

References

Acknowledgement

Exploratory IT Human Resources Project (MITOU Program) of Information-technology Promotion Agency, Japan (IPA) in the fiscal year 2024.
https://www.ipa.go.jp/jinzai/mitou/it/2024/gaiyou-tn-3.html

About

Light weight hypervisor for RISC-V H-extension.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 96.7%
  • Shell 1.7%
  • Assembly 1.6%