Usecases/XenOnTCG: Difference between revisions

From QEMU
(Dump initial example)
 
m (Replace == with = in CLI args, and fix deprecated readonly flag)
Line 13: Line 13:
So for this to work you want a boot using firmware (-drive pflash) with virtualisation enabled:
So for this to work you want a boot using firmware (-drive pflash) with virtualisation enabled:


   qemu-system-aarch64 -cpu cortex-a57 -machine type==virt,virtualization=on,gic-version=3 \
   qemu-system-aarch64 -cpu cortex-a57 -machine type=virt,virtualization=on,gic-version=3 \
     -display none -serial mon:stdio -netdev user,id=unet,hostfwd=tcp::2222-:22 \
     -display none -serial mon:stdio -netdev user,id=unet,hostfwd=tcp::2222-:22 \
     -device virtio-net-pci,netdev=unet,id=virt-net,disable-legacy=on \
     -device virtio-net-pci,netdev=unet,id=virt-net,disable-legacy=on \
Line 19: Line 19:
     -blockdev driver=raw,node-name=hd,discard=unmap,file.driver=host_device,file.filename=/dev/zen-disk/debian-buster-arm64 \
     -blockdev driver=raw,node-name=hd,discard=unmap,file.driver=host_device,file.filename=/dev/zen-disk/debian-buster-arm64 \
     -device scsi-hd,drive=hd,id=virt-scsi-hd \
     -device scsi-hd,drive=hd,id=virt-scsi-hd \
     -drive if=pflash,file=/usr/share/AAVMF/AAVMF_CODE.fd,format=raw,readonly \
     -drive if=pflash,file=/usr/share/AAVMF/AAVMF_CODE.fd,format=raw,readonly=on \
     -drive if=pflash,file=/home/alex/models/qemu-arm64-efivars,format==raw \
     -drive if=pflash,file=/home/alex/models/qemu-arm64-efivars,format=raw \
     -smp 1 -m 4096
     -smp 1 -m 4096

Revision as of 07:17, 23 May 2025

Running Xen under TCG emulation

You might want to do this is you are debugging the hypervisor which is tricky to do on a real machine. While Xen supports x86 and ARM architectures for TCG emulation we are only concerned with ARM as the x86 emulation support for virtualization is limited and only lightly tested.

Traditional Boot

The normal boot sequence is:

  • Firmware/BIOS (e.g. EDK2) - which loads..
  • Grub2 - which loads both Xen and the Kernel (via xen_hypervisor/xen_module) - which the boots...
  • Xen - which boots and then loads the Dom0 kernel

So for this to work you want a boot using firmware (-drive pflash) with virtualisation enabled:

 qemu-system-aarch64 -cpu cortex-a57 -machine type=virt,virtualization=on,gic-version=3 \
   -display none -serial mon:stdio -netdev user,id=unet,hostfwd=tcp::2222-:22 \
   -device virtio-net-pci,netdev=unet,id=virt-net,disable-legacy=on \
   -device virtio-scsi-pci,id=virt-scsi,disable-legacy=on \
   -blockdev driver=raw,node-name=hd,discard=unmap,file.driver=host_device,file.filename=/dev/zen-disk/debian-buster-arm64 \
   -device scsi-hd,drive=hd,id=virt-scsi-hd \
   -drive if=pflash,file=/usr/share/AAVMF/AAVMF_CODE.fd,format=raw,readonly=on \
   -drive if=pflash,file=/home/alex/models/qemu-arm64-efivars,format=raw \
   -smp 1 -m 4096