Skip to content

Instantly share code, notes, and snippets.

@sameo
Last active January 14, 2020 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sameo/64e58c953c2946061e88db41c1bc45e6 to your computer and use it in GitHub Desktop.
Save sameo/64e58c953c2946061e88db41c1bc45e6 to your computer and use it in GitHub Desktop.
Cloud Hypervisor minimal VM build

Cloud Hypervisor build

cargo build --no-default-features --release && sudo setcap cap_net_admin+ep ./target/release/cloud-hypervisor

This will create a VMM that only emulates the serial and I/O APIC devices

Initramfs

git clone https://github.com/sameo/cloud-hypervisor-rootfs

Then follow the README instructions.

Kernel build

Use the default 5.0 cloud-hypervisor kernel config and change CONFIG_INITRAMFS_SOURCE to point to the initramfs directory mentioned in the previous section.

Boot a minimal guest

sudo ./target/release/cloud-hypervisor \
    --kernel /path/to/your/vmlinux \
    --api-socket /tmp/ch.sock \
    --console off \
    --serial tty \
    --cmdline "console=ttyS0 reboot=k panic=1 nomodules i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd" \
    --cpus boot=1 \
    --memory size=512M,file=/dev/shm \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment