From b93d50582d6beed0694a9ab0e9a7d350df22f835 Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Thu, 8 Dec 2022 00:35:20 -0500 Subject: [PATCH] docs: Consolidate AArch64 guest booting doc into README Take the opportunity to fix a bug in the `Booting the guest VM` doc in README. Signed-off-by: Henry Wang --- README.md | 44 +++++++++++++++++++++++++++++++++++++------- docs/arm64.md | 25 ------------------------- 2 files changed, 37 insertions(+), 32 deletions(-) delete mode 100644 docs/arm64.md diff --git a/README.md b/README.md index 2afec30f0..1bfc5f2ff 100644 --- a/README.md +++ b/README.md @@ -107,13 +107,10 @@ do not wish to use the pre-built binaries. ## Booting Linux -The instructions below are for the `x86-64` platform. For `AArch64` please see -the [AArch64 specific documentation](docs/arm64.md). - -Cloud Hypervisor supports direct kernel boot (if the kernel is built with PVH -support) or booting via a firmware (either [Rust Hypervisor +Cloud Hypervisor supports direct kernel boot (the x86-64 kernel requires the kernel +built with PVH support) or booting via a firmware (either [Rust Hypervisor Firmware](https://github.com/cloud-hypervisor/rust-hypervisor-firmware) or an -edk2 UEFI firmware called `CLOUDHV`.) +edk2 UEFI firmware called `CLOUDHV` / `CLOUDHV_EFI`.) Binary builds of the firmware files are available for the latest release of [Rust Hyperivor @@ -218,6 +215,8 @@ $ qemu-img convert -p -f qcow2 -O raw focal-server-cloudimg-arm64.img focal-serv These sample commands boot the disk image using the custom kernel whilst also supplying the desired kernel command line. +- x86-64 + ```shell $ sudo setcap cap_net_admin+ep ./cloud-hypervisor $ ./create-cloud-init.sh @@ -230,9 +229,26 @@ $ ./cloud-hypervisor \ --net "tap=,mac=,ip=,mask=" ``` +- AArch64 + +```shell +$ sudo setcap cap_net_admin+ep ./cloud-hypervisor +$ ./create-cloud-init.sh +$ ./cloud-hypervisor \ + --kernel ./linux-cloud-hypervisor/arch/arm64/boot/Image \ + --disk path=focal-server-cloudimg-arm64.raw path=/tmp/ubuntu-cloudinit.img \ + --cmdline "console=hvc0 root=/dev/vda1 rw" \ + --cpus boot=4 \ + --memory size=1024M \ + --net "tap=,mac=,ip=,mask=" +``` + If earlier kernel messages are required the serial console should be used instead of `virtio-console`. -```./cloud-hypervisor \ +- x86-64 + +```shell +$ ./cloud-hypervisor \ --kernel ./linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin \ --console off \ --serial tty \ @@ -243,6 +259,20 @@ If earlier kernel messages are required the serial console should be used instea --net "tap=,mac=,ip=,mask=" ``` +- AArch64 + +```shell +$ ./cloud-hypervisor \ + --kernel ./linux-cloud-hypervisor/arch/arm64/boot/Image \ + --console off \ + --serial tty \ + --disk path=focal-server-cloudimg-arm64.raw \ + --cmdline "console=ttyAMA0 root=/dev/vda1 rw" \ + --cpus boot=4 \ + --memory size=1024M \ + --net "tap=,mac=,ip=,mask=" +``` + # 3. Status Cloud Hypervisor is under active development. The following stability diff --git a/docs/arm64.md b/docs/arm64.md deleted file mode 100644 index ab778e7de..000000000 --- a/docs/arm64.md +++ /dev/null @@ -1,25 +0,0 @@ -# How to build and test Cloud Hypervisor on AArch64 - -This document introduces how to build and test Cloud Hypervisor on AArch64. -Currently, Cloud Hypervisor supports 2 methods of booting on AArch64: UEFI -booting and direct-kernel booting. The document covers both methods. - -All the steps are based on Ubuntu. We use the Ubuntu cloud image for guest VM -disk. - -### Booting the guest VM - -```bash -$ pushd $CLOUDH -$ sudo $CLOUDH/cloud-hypervisor/target/debug/cloud-hypervisor \ - --api-socket /tmp/cloud-hypervisor.sock \ - --kernel $CLOUDH/linux/arch/arm64/boot/Image \ - --disk path=focal-server-cloudimg-arm64.raw \ - --cmdline "keep_bootcon console=ttyAMA0 reboot=k panic=1 root=/dev/vda1 rw" \ - --cpus boot=4 \ - --memory size=4096M \ - --net tap=,mac=12:34:56:78:90:01,ip=192.168.1.1,mask=255.255.255.0 \ - --serial tty \ - --console off -$ popd -```