...
The following steps lets one test I2C vhost-device
on Xen.
Putting the pieces together:
Now that we have built everything we need, we need to assemble the pieces. We will be using a Debian 12 arm64 root filesystem and adding or components to it.
There are many was to add the content to the disk but here we will use guestfish.
Code Block |
---|
mkdir -p build/disk
(cd build/disk; wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-arm64.qcow2)
cp build/disk/debian-12-nocloud-arm64.qcow2 build/disk.qcow2
MODULES_TAR=$(ls -1 build/linux-install/modules-*.tar.gz)
DEB=$(cd xen/dist; ls -1 xen-*.deb)
guestfish --rw -a build/disk.qcow2 <<EOF
run
mount /dev/sda1 /
tar-in $MODULES_TAR / compress:gzip
upload build/vhost-device-i2c /root/vhost-device-i2c
upload build/xen-vhost-frontend /root/xen-vhost-frontend
upload xen/dist/$DEB /root/$DEB
EOF |
Run Xen via Qemu on X86 machine:
...
Code Block |
---|
./build/qemu-install/bin/qemu-system-aarch64 -machine virt,virtualization=on -cpu cortex-a57 -serial mon:stdio \ -device virtio-net-pci,netdev=net0 -netdev user,id=net0,hostfwd=tcp::8022-:22 \ -drive file=./home/debian-bullseye-arm64build/disk.qcow2,index=0,id=hd0,if=none,format=qcow2 \ -device virtio-scsi-pci -device scsi-hd,drive=hd0 \ -display none -m 8192 -smp 8 -kernel ./home/xenbuild/xen \ -append "dom0_mem=5G,max:5G dom0_max_vcpus=7 loglvl=all guest_loglvl=all" \ -device guest-loader,addr=0x49000000,kernel=./homebuild/Image,bootargs="root=/dev/sda1 console=hvc0 earlyprintk=xen" \ -device ds1338,address=0x20 |
...
Code Block |
---|
vhost-device-i2c -s /root/i2c.sock -c 1 -l `90c0000"90c0000.i2c:32`32" |
This tells the I2C backend to hook up to /root/i2c.sock0
socket and wait for the master to start transacting.
...