1#!/bin/bash 2 3set -ex -o pipefail 4 5# DomU Busybox 6cd binaries 7mkdir -p initrd 8mkdir -p initrd/bin 9mkdir -p initrd/sbin 10mkdir -p initrd/etc 11mkdir -p initrd/dev 12mkdir -p initrd/proc 13mkdir -p initrd/sys 14mkdir -p initrd/lib 15mkdir -p initrd/var 16mkdir -p initrd/mnt 17cp /bin/busybox initrd/bin/busybox 18initrd/bin/busybox --install initrd/bin 19echo "#!/bin/sh 20 21mount -t proc proc /proc 22mount -t sysfs sysfs /sys 23mount -t devtmpfs devtmpfs /dev 24/bin/sh" > initrd/init 25chmod +x initrd/init 26cd initrd 27find . | cpio -H newc -o | gzip > ../domU-rootfs.cpio.gz 28cd .. 29 30# Dom0 rootfs 31cp rootfs.cpio.gz dom0-rootfs.cpio.gz 32cat xen-tools.cpio.gz >> dom0-rootfs.cpio.gz 33 34# test-local configuration 35mkdir -p rootfs 36cd rootfs 37mkdir -p etc/local.d root 38mv ../domU-rootfs.cpio.gz ./root 39cp ../Image ./root 40echo "name=\"domU\" 41memory=512 42vcpus=1 43kernel=\"/root/Image\" 44ramdisk=\"/root/domU-rootfs.cpio.gz\" 45extra=\"console=hvc0 root=/dev/ram0 rdinit=/bin/sh\" 46" > root/domU.cfg 47echo "#!/bin/bash 48 49bash /etc/init.d/xencommons start 50 51xl list 52 53xl -vvv create -c /root/domU.cfg 54 55" > etc/local.d/xen.start 56chmod +x etc/local.d/xen.start 57find . | cpio -H newc -o | gzip >> ../dom0-rootfs.cpio.gz 58cd ../.. 59 60# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded 61curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom 62./binaries/qemu-system-aarch64 \ 63 -machine virtualization=true \ 64 -cpu cortex-a57 -machine type=virt \ 65 -m 2048 -smp 2 -display none \ 66 -machine dumpdtb=binaries/virt-gicv2.dtb 67 68# XXX disable pl061 to avoid Linux crash 69fdtput binaries/virt-gicv2.dtb -p -t s /pl061@9030000 status disabled 70 71# ImageBuilder 72echo 'MEMORY_START="0x40000000" 73MEMORY_END="0xC0000000" 74 75DEVICE_TREE="virt-gicv2.dtb" 76XEN="xen" 77DOM0_KERNEL="Image" 78DOM0_RAMDISK="dom0-rootfs.cpio.gz" 79XEN_CMD="console=dtuart dom0_mem=1024M console_timestamps=boot" 80 81NUM_DOMUS=0 82 83LOAD_CMD="tftpb" 84UBOOT_SOURCE="boot.source" 85UBOOT_SCRIPT="boot.scr"' > binaries/config 86rm -rf imagebuilder 87git clone --depth 1 https://gitlab.com/xen-project/imagebuilder.git 88bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/config 89 90 91# Run the test 92rm -f smoke.serial 93export TEST_CMD="./binaries/qemu-system-aarch64 \ 94 -machine virtualization=true \ 95 -cpu cortex-a57 -machine type=virt \ 96 -m 2048 -monitor none -serial stdio \ 97 -smp 2 \ 98 -no-reboot \ 99 -device virtio-net-pci,netdev=n0 \ 100 -netdev user,id=n0,tftp=binaries \ 101 -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin" 102 103export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000" 104export BOOT_MSG="Latest ChangeSet: " 105export TEST_LOG="smoke.serial" 106export LOG_MSG="Domain-0" 107export PASSED="BusyBox" 108 109./automation/scripts/console.exp | sed 's/\r\+$//' 110