mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-08 00:20:38 -09:00
support/testing: test_xen: add block
Enhance the Xen python tests to exercise block devices: this boils down to switching from ramdisks to disk partitions for the domains rootfs. (Refer to the comments in the python script for block devices details.) - Add support for PCI and Xen block to the Linux kernel configurations. - Add a few commands to list the xvda block device for good measure. - Generate two partitions with the rootfs in the disk images; we use the same rootfs contents twice, once for each domain. - Add a paravirtualized block device to the Xen dom1 configurations and adjust both domains kernel command lines, to specify the rootfs locations. - Build host-qemu for Arm v7, to workaround an issue with 32b Arm and old Qemu versions, which is what we have on CI currently. - While at it, bump Linux kernel to 6.18.4 and U-Boot to 2026.01. Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com> Cc: Julien Olivain <ju.o@free.fr> Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
committed by
Julien Olivain
parent
ca23f860d1
commit
09baeb4653
@@ -6,27 +6,28 @@ import infra.basetest
|
||||
class TestXenBase(infra.basetest.BRTest):
|
||||
"""A class to test Xen for multiple architectures."""
|
||||
|
||||
# We run only in the initramfs; this allows to use a single ramdisk image
|
||||
# for both the host and the guest.
|
||||
# We use the same rootfs contents for both the host and the guest.
|
||||
base_config = \
|
||||
"""
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="support/testing/tests/package/test_xen/common/post-build.sh"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.17.1"
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.18.4"
|
||||
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
|
||||
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
|
||||
BR2_PACKAGE_BRIDGE_UTILS=y
|
||||
BR2_PACKAGE_XEN=y
|
||||
BR2_PACKAGE_XEN_HYPERVISOR=y
|
||||
BR2_PACKAGE_XEN_TOOLS=y
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_4=y
|
||||
BR2_TARGET_ROOTFS_EXT2_SIZE="128M"
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_TARGET_UBOOT=y
|
||||
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
|
||||
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
|
||||
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2025.07"
|
||||
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2026.01"
|
||||
BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
|
||||
BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
@@ -66,6 +67,15 @@ class TestXenBase(infra.basetest.BRTest):
|
||||
There is a stability issue for Armv7 with Qemu < 9.1, which makes the
|
||||
dom1 -> gw connection unreliable. As a workaround, we interact only with
|
||||
dom0 from dom1 (hence the fixed IP addresses).
|
||||
|
||||
Here is the disk setup we use in the test:
|
||||
|
||||
Image/part. Dom0 Dom1 Description
|
||||
----------- ---------- ------- -----------
|
||||
disk.img vda
|
||||
+-- boot vda1, /mnt Contains Xen and kernel
|
||||
+-- root vda2, / Dom0 rootfs
|
||||
`- guest vda3 xvda, / Dom1 rootfs
|
||||
"""
|
||||
|
||||
# Boot the emulator.
|
||||
@@ -105,6 +115,11 @@ class TestXenBase(infra.basetest.BRTest):
|
||||
uuid = self.get_dom_uuid()
|
||||
self.assertNotEqual(uuid, dom0_uuid, "Unexpected dom0 UUID")
|
||||
|
||||
# Verify dom1 block device.
|
||||
# (This is a bit redundant, as if the test runs this far we already know
|
||||
# that dom1 found its rootfs.)
|
||||
self.assertRunOk("ls -laF /sys/class/block/xvda")
|
||||
|
||||
# Bring up the network in the dom1.
|
||||
self.assertRunOk("ifconfig eth0 10.0.2.43")
|
||||
self.assertRunOk("ifconfig -a")
|
||||
@@ -127,6 +142,9 @@ class TestXenBase(infra.basetest.BRTest):
|
||||
# Check that we have two VMs running.
|
||||
self.assertNumVM(2)
|
||||
|
||||
# Print the block setup for debugging.
|
||||
self.assertRunOk("xl block-list dom1")
|
||||
|
||||
# Print the bridge setup for debugging.
|
||||
self.assertRunOk("brctl show")
|
||||
|
||||
@@ -178,6 +196,12 @@ class TestXenArmv7(TestXenBase):
|
||||
# We use U-Boot and a script to load the Dom0 images and amend the
|
||||
# Devicetree for Xen dynamically.
|
||||
# We have a custom kernel config to reduce build time.
|
||||
# We need to build host-qemu to workaround an issue with Xen guest block
|
||||
# devices on 32b Arm.
|
||||
# This was fixed by commit 7175a562f157 ("hw/intc/arm_gic: Fix deactivation
|
||||
# of SPI lines") and the fix is present in Qemu versions >= 9.1.0.
|
||||
# When the CI docker image will have a recent-enough Qemu version with the
|
||||
# fix, we can remove the host-qemu package from the test configuration.
|
||||
config = TestXenBase.base_config + \
|
||||
"""
|
||||
BR2_arm=y
|
||||
@@ -191,6 +215,8 @@ class TestXenArmv7(TestXenBase):
|
||||
BR2_PACKAGE_HOST_UBOOT_TOOLS=y
|
||||
BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y
|
||||
BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="support/testing/tests/package/test_xen/arm/boot.cmd"
|
||||
BR2_PACKAGE_HOST_QEMU=y
|
||||
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
|
||||
@@ -9,8 +9,7 @@ image efi-part.vfat {
|
||||
}
|
||||
|
||||
files = {
|
||||
"Image",
|
||||
"rootfs.cpio"
|
||||
"Image"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,4 +27,15 @@ image disk.img {
|
||||
offset = 32K
|
||||
bootable = true
|
||||
}
|
||||
|
||||
partition root {
|
||||
partition-type-uuid = root-arm64
|
||||
image = "rootfs.ext2"
|
||||
}
|
||||
|
||||
partition guest {
|
||||
# Linux reserved
|
||||
partition-type-uuid = 8DA63339-0007-60C0-C436-083AC8230908
|
||||
image = "rootfs.ext2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,10 +75,13 @@ CONFIG_UNIX=y
|
||||
CONFIG_INET=y
|
||||
# CONFIG_IPV6 is not set
|
||||
CONFIG_BRIDGE=m
|
||||
CONFIG_PCI=y
|
||||
CONFIG_PCI_HOST_GENERIC=y
|
||||
CONFIG_DEVTMPFS=y
|
||||
CONFIG_DEVTMPFS_MOUNT=y
|
||||
CONFIG_FW_LOADER_USER_HELPER=y
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
CONFIG_XEN_BLKDEV_BACKEND=y
|
||||
CONFIG_VIRTIO_BLK=y
|
||||
CONFIG_RAID_ATTRS=m
|
||||
CONFIG_SCSI=y
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name="dom1"
|
||||
kernel="/mnt/Image"
|
||||
ramdisk="/mnt/rootfs.cpio"
|
||||
memory=256
|
||||
cmdline="console=hvc0"
|
||||
cmdline="console=hvc0 root=/dev/xvda rootwait"
|
||||
vif=['bridge=br0']
|
||||
disk=['phy:/dev/vda3,xvda,w']
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
options=dom0_mem=256M loglvl=all guest_loglvl=all
|
||||
kernel=\Image console=hvc0
|
||||
ramdisk=\rootfs.cpio
|
||||
kernel=\Image console=hvc0 root=PARTLABEL=root rootwait
|
||||
|
||||
@@ -11,13 +11,8 @@ fdt set /chosen/modules/module@0 compatible "xen,linux-zimage" "xen,multiboot-mo
|
||||
load ${devtype} ${devnum} ${kernel_addr_r} zImage
|
||||
fdt set /chosen/modules/module@0 reg <${kernel_addr_r} 0x${filesize} >
|
||||
|
||||
fdt mknod /chosen/modules module@1
|
||||
fdt set /chosen/modules/module@1 compatible "xen,linux-initrd" "xen,multiboot-module"
|
||||
load ${devtype} ${devnum} ${ramdisk_addr_r} rootfs.cpio
|
||||
fdt set /chosen/modules/module@1 reg <${ramdisk_addr_r} 0x${filesize} >
|
||||
|
||||
load ${devtype} ${devnum} ${loadaddr} xen
|
||||
fdt set /chosen xen,dom0-bootargs "console=hvc0"
|
||||
fdt set /chosen xen,dom0-bootargs "console=hvc0 root=PARTLABEL=root rootwait"
|
||||
fdt set /chosen xen,xen-bootargs "dom0_mem=256M loglvl=all guest_loglvl=all"
|
||||
fdt print /chosen
|
||||
bootz ${loadaddr} - ${fdt_addr}
|
||||
|
||||
@@ -3,8 +3,7 @@ image boot.vfat {
|
||||
files = {
|
||||
"boot.scr",
|
||||
"xen",
|
||||
"zImage",
|
||||
"rootfs.cpio"
|
||||
"zImage"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,4 +21,15 @@ image disk.img {
|
||||
offset = 32K
|
||||
bootable = true
|
||||
}
|
||||
|
||||
partition root {
|
||||
partition-type-uuid = root-arm
|
||||
image = "rootfs.ext2"
|
||||
}
|
||||
|
||||
partition guest {
|
||||
# Linux reserved
|
||||
partition-type-uuid = 8DA63339-0007-60C0-C436-083AC8230908
|
||||
image = "rootfs.ext2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ CONFIG_IP_PNP_BOOTP=y
|
||||
CONFIG_IP_PNP_RARP=y
|
||||
# CONFIG_IPV6 is not set
|
||||
CONFIG_BRIDGE=y
|
||||
CONFIG_PCI=y
|
||||
CONFIG_PCI_HOST_GENERIC=y
|
||||
CONFIG_QRTR=m
|
||||
CONFIG_PAGE_POOL_STATS=y
|
||||
CONFIG_DEVTMPFS=y
|
||||
@@ -57,6 +59,7 @@ CONFIG_MTD_PHYSMAP_OF=y
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
CONFIG_BLK_DEV_RAM=y
|
||||
CONFIG_BLK_DEV_RAM_SIZE=65536
|
||||
CONFIG_XEN_BLKDEV_BACKEND=y
|
||||
CONFIG_VIRTIO_BLK=y
|
||||
CONFIG_SRAM=y
|
||||
CONFIG_NETDEVICES=y
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name="dom1"
|
||||
kernel="/mnt/zImage"
|
||||
ramdisk="/mnt/rootfs.cpio"
|
||||
memory=256
|
||||
cmdline="console=hvc0"
|
||||
cmdline="console=hvc0 root=/dev/xvda rootwait"
|
||||
vif=['bridge=br0']
|
||||
disk=['phy:/dev/vda3,xvda,w']
|
||||
|
||||
Reference in New Issue
Block a user