Skip to content
forked from syswonder/hvisor

a Rust Hypervisor for mission-critical system

License

Notifications You must be signed in to change notification settings

ZhongkaiXu/hvisor

 
 

Repository files navigation

hvisor





README:中文 | English

Armv8 hypervisor based on Linux & implemented in Rust,porting from RVM1.5 & jailhouse.

🚧 Working In Progress.

Progress

  • Architecture: aarch64
  • Platform: Qemu virt aarch64
  • Exception
  • Gicv3
  • Memory
  • Enable non root linux
  • VirtIO device: block, net
  • Architecture: riscv64
  • Platform: nxp

Build & Run

For detailed build and running tutorials, including building the development environment and creating a file system, please refer to here.

To make it easy to get started, here (extraction code: sysH) provides a Linux kernel Image and a file system ubuntu-20.04-rootfs_ext4.img with the username arm64 and the password as a whitespace. The directories are organized as follows:

├── home
	├── arm64 
		├── images: Contains a Linux Image and ramfs.
		├── hvisor: Files required to run hvisor.
		├── jailhouse: Files required to run jailhouse.

The following describes how to run a non-root-linux on jailhouse/hvisor based on ubuntu-20.04-rootfs_ext4.img:

  1. Build hvisor.bin:

    make all

    Then copy target/aarch64/debug/hvisor.bin to ~/hvisor/ in ubuntu-20.04-rootfs_ext4.img.

  2. Start QEMU:

    sudo qemu-system-aarch64 \
        -machine virt,gic_version=3 \
        -machine virtualization=true \
        -cpu cortex-a53 \
        -machine type=virt \
        -nographic \
        -smp 16  \
        -m 1024 \
        -kernel your-linux-Image-path/Image \
        -append "console=ttyAMA0 root=/dev/vda rw mem=768m" \
        -drive if=none,file=your-rootfs-path/ubuntu-20.04-rootfs_ext4.img,id=hd0,format=raw \
        -device virtio-blk-device,drive=hd0 \
        -net nic \
        -net user,hostfwd=tcp::2333-:22
  3. Enter the username arm64 and the password as a whitespace after startup.

  4. Go to the home directory and start non-root-linux:

    • For hvisor: go to the hvisor folder and run:

      ./setup.sh
      ./linux.sh
      
    • For Jailhouse: go to the jailhouse folder and run:

      ./linux.sh
      

Enable a second serial console

If someone wants non-root-linux and root-linux in two different terminals, add this line at the end of the qemu startup command:

-device virtio-serial-device -chardev pty,id=serial3 -device virtconsole,chardev=serial3

After starting qemu, the char device redirected to /dev/pts/num (label serial3) message will output by the first terminal, execute this in another terminal:

sudo screen /dev/pts/num

where num is a specific number.

About

a Rust Hypervisor for mission-critical system

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 94.9%
  • Makefile 2.9%
  • Assembly 2.2%