Initial Commit
- initial default booting image
This commit is contained in:
0
support/testing/tests/boot/__init__.py
Normal file
0
support/testing/tests/boot/__init__.py
Normal file
33
support/testing/tests/boot/test_atf.py
Normal file
33
support/testing/tests/boot/test_atf.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestATFAllwinner(infra.basetest.BRTest):
|
||||
config = \
|
||||
"""
|
||||
BR2_aarch64=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_TOOLCHAIN_EXTERNAL_ARM_AARCH64=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.11"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="sun50i_a64"
|
||||
# BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP is not set
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31=y
|
||||
BR2_TARGET_UBOOT=y
|
||||
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
|
||||
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
|
||||
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2026.01"
|
||||
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="orangepi_zero_plus2"
|
||||
BR2_TARGET_UBOOT_NEEDS_DTC=y
|
||||
BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
|
||||
BR2_TARGET_UBOOT_NEEDS_PYTHON3=y
|
||||
BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y
|
||||
BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
|
||||
BR2_TARGET_UBOOT_NEEDS_GNUTLS=y
|
||||
BR2_TARGET_UBOOT_SPL=y
|
||||
BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
|
||||
BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="SCP=/dev/null"
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
pass
|
||||
155
support/testing/tests/boot/test_edk2.py
Normal file
155
support/testing/tests/boot/test_edk2.py
Normal file
@@ -0,0 +1,155 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
# gitlab-runner: large
|
||||
class TestEdk2(infra.basetest.BRTest):
|
||||
config = \
|
||||
"""
|
||||
BR2_aarch64=y
|
||||
BR2_neoverse_n2=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_ROOTFS_EXT2_4=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/aarch64-sbsa/assemble-flash-images support/scripts/genimage.sh"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/qemu/aarch64-sbsa/genimage.cfg"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.18.21"
|
||||
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="support/testing/tests/boot/test_edk2/linux.config"
|
||||
BR2_TARGET_EDK2=y
|
||||
BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA=y
|
||||
BR2_TARGET_GRUB2=y
|
||||
BR2_TARGET_GRUB2_ARM64_EFI=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.12"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu_sbsa"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
|
||||
BR2_PACKAGE_HOST_GENIMAGE=y
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_HOST_MTOOLS=y
|
||||
BR2_PACKAGE_HOST_QEMU=y
|
||||
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
hda = os.path.join(self.builddir, "images", "disk.img")
|
||||
flash0 = os.path.join(self.builddir, "images", "SBSA_FLASH0.fd")
|
||||
flash1 = os.path.join(self.builddir, "images", "SBSA_FLASH1.fd")
|
||||
self.emulator.boot(arch="aarch64",
|
||||
options=["-M", "sbsa-ref",
|
||||
"-cpu", "neoverse-n2",
|
||||
"-m", "512M",
|
||||
"-pflash", flash0,
|
||||
"-pflash", flash1,
|
||||
"-hda", hda])
|
||||
self.emulator.login()
|
||||
|
||||
|
||||
class TestEdk2BuildBase(infra.basetest.BRTest):
|
||||
"""A class to test the build of various edk2 platforms."""
|
||||
base_config = \
|
||||
"""
|
||||
# BR2_PACKAGE_BUSYBOX is not set
|
||||
# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_INIT_NONE=y
|
||||
BR2_SYSTEM_BIN_SH_NONE=y
|
||||
BR2_TARGET_EDK2=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
"""
|
||||
|
||||
def assertBinariesExist(self, *binaries: str) -> None:
|
||||
"""Assert that the binaries passed as argument exist
|
||||
under the images folder.
|
||||
We print a message to the emulator logfile for each binary found.
|
||||
"""
|
||||
for binary in binaries:
|
||||
binpath = os.path.join(self.builddir, "images", binary)
|
||||
self.assertTrue(os.path.exists(binpath), f"Missing {binpath}!")
|
||||
print(f"{binary} exists: {binpath}", file=self.emulator.logfile,
|
||||
flush=True)
|
||||
|
||||
|
||||
class TestEdk2BuildArmVirtQemu(TestEdk2BuildBase):
|
||||
config = TestEdk2BuildBase.base_config + \
|
||||
"""
|
||||
BR2_aarch64=y
|
||||
BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU=y
|
||||
"""
|
||||
|
||||
def test_run(self) -> None:
|
||||
self.assertBinariesExist("QEMU_EFI.fd", "QEMU_VARS.fd")
|
||||
|
||||
|
||||
class TestEdk2BuildArmVirtQemuKernel(TestEdk2BuildBase):
|
||||
config = TestEdk2BuildBase.base_config + \
|
||||
"""
|
||||
BR2_aarch64=y
|
||||
BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU_KERNEL=y
|
||||
"""
|
||||
|
||||
def test_run(self) -> None:
|
||||
self.assertBinariesExist("QEMU_EFI.fd", "QEMU_VARS.fd")
|
||||
|
||||
|
||||
class TestEdk2BuildArmSgi575(TestEdk2BuildBase):
|
||||
config = TestEdk2BuildBase.base_config + \
|
||||
"""
|
||||
BR2_aarch64=y
|
||||
BR2_TARGET_EDK2_PLATFORM_ARM_SGI575=y
|
||||
"""
|
||||
|
||||
def test_run(self) -> None:
|
||||
self.assertBinariesExist("BL33_AP_UEFI.fd")
|
||||
|
||||
|
||||
class TestEdk2BuildArmVexpressFvpAarch64(TestEdk2BuildBase):
|
||||
config = TestEdk2BuildBase.base_config + \
|
||||
"""
|
||||
BR2_aarch64=y
|
||||
BR2_TARGET_EDK2_PLATFORM_ARM_VEXPRESS_FVP_AARCH64=y
|
||||
"""
|
||||
|
||||
def test_run(self) -> None:
|
||||
self.assertBinariesExist("FVP_AARCH64_EFI.fd")
|
||||
|
||||
|
||||
class TestEdk2BuildQemuSbsa(TestEdk2BuildBase):
|
||||
# This configuration is not exactly identical to the configuration built
|
||||
# during TestEdk2, as we use the latest arm-trusted-firmware version, among
|
||||
# other things.
|
||||
config = TestEdk2BuildBase.base_config + \
|
||||
"""
|
||||
BR2_aarch64=y
|
||||
BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu_sbsa"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
|
||||
"""
|
||||
|
||||
def test_run(self) -> None:
|
||||
self.assertBinariesExist("SBSA_FLASH0.fd", "SBSA_FLASH1.fd", "fip.bin")
|
||||
|
||||
|
||||
class TestEdk2BuildSolidrunArmada80x0mcbin(TestEdk2BuildBase):
|
||||
config = TestEdk2BuildBase.base_config + \
|
||||
"""
|
||||
BR2_aarch64=y
|
||||
BR2_cortex_a72=y
|
||||
BR2_TARGET_EDK2_PLATFORM_SOLIDRUN_ARMADA80X0MCBIN=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="a80x0_mcbin"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33=y
|
||||
BR2_TARGET_BINARIES_MARVELL=y
|
||||
BR2_TARGET_MV_DDR_MARVELL=y
|
||||
"""
|
||||
|
||||
def test_run(self) -> None:
|
||||
self.assertBinariesExist("ARMADA_EFI.fd", "fip.bin", "ble.bin",
|
||||
"scp-fw.bin")
|
||||
68
support/testing/tests/boot/test_edk2/linux.config
Normal file
68
support/testing/tests/boot/test_edk2/linux.config
Normal file
@@ -0,0 +1,68 @@
|
||||
CONFIG_SYSVIPC=y
|
||||
CONFIG_POSIX_MQUEUE=y
|
||||
CONFIG_NO_HZ_IDLE=y
|
||||
CONFIG_HIGH_RES_TIMERS=y
|
||||
CONFIG_TASKSTATS=y
|
||||
CONFIG_SCHED_AUTOGROUP=y
|
||||
CONFIG_PROFILING=y
|
||||
CONFIG_ARCH_VEXPRESS=y
|
||||
CONFIG_COMPAT=y
|
||||
CONFIG_FW_CFG_SYSFS=y
|
||||
CONFIG_FW_CFG_SYSFS_CMDLINE=y
|
||||
CONFIG_ACPI=y
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
CONFIG_BLK_DEV_BSGLIB=y
|
||||
CONFIG_BINFMT_MISC=y
|
||||
CONFIG_TRANSPARENT_HUGEPAGE=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_PACKET=y
|
||||
CONFIG_PACKET_DIAG=y
|
||||
CONFIG_UNIX=y
|
||||
CONFIG_NET_KEY=y
|
||||
CONFIG_INET=y
|
||||
CONFIG_IP_MULTICAST=y
|
||||
CONFIG_IP_ADVANCED_ROUTER=y
|
||||
CONFIG_BRIDGE=m
|
||||
CONFIG_NET_SCHED=y
|
||||
CONFIG_VSOCKETS=y
|
||||
CONFIG_PCI=y
|
||||
CONFIG_PCI_HOST_GENERIC=y
|
||||
CONFIG_DEVTMPFS=y
|
||||
CONFIG_DEVTMPFS_MOUNT=y
|
||||
CONFIG_VIRTIO_BLK=y
|
||||
CONFIG_BLK_DEV_SD=y
|
||||
CONFIG_CHR_DEV_SG=y
|
||||
CONFIG_SCSI_CONSTANTS=y
|
||||
CONFIG_SCSI_LOGGING=y
|
||||
CONFIG_SCSI_SCAN_ASYNC=y
|
||||
CONFIG_SCSI_VIRTIO=y
|
||||
CONFIG_ATA=y
|
||||
CONFIG_SATA_AHCI_PLATFORM=y
|
||||
CONFIG_NETDEVICES=y
|
||||
CONFIG_DUMMY=y
|
||||
CONFIG_MACVLAN=y
|
||||
CONFIG_VIRTIO_NET=y
|
||||
CONFIG_NLMON=y
|
||||
CONFIG_SERIAL_AMBA_PL011=y
|
||||
CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
|
||||
CONFIG_VIRTIO_CONSOLE=y
|
||||
CONFIG_HW_RANDOM=y
|
||||
CONFIG_HW_RANDOM_VIRTIO=y
|
||||
CONFIG_TCG_TPM=y
|
||||
CONFIG_TCG_TIS=y
|
||||
CONFIG_DRM=y
|
||||
CONFIG_DRM_VIRTIO_GPU=y
|
||||
CONFIG_RTC_CLASS=y
|
||||
CONFIG_RTC_DRV_PL031=y
|
||||
CONFIG_VIRTIO_PCI=y
|
||||
CONFIG_VIRTIO_MMIO=y
|
||||
CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
|
||||
CONFIG_MAILBOX=y
|
||||
CONFIG_PL320_MBOX=y
|
||||
CONFIG_ARM_SMMU_V3=y
|
||||
CONFIG_EXT4_FS=y
|
||||
CONFIG_FUSE_FS=y
|
||||
CONFIG_VIRTIO_FS=y
|
||||
CONFIG_TMPFS=y
|
||||
CONFIG_TMPFS_POSIX_ACL=y
|
||||
178
support/testing/tests/boot/test_grub.py
Normal file
178
support/testing/tests/boot/test_grub.py
Normal file
@@ -0,0 +1,178 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestGrubi386BIOS(infra.basetest.BRTest):
|
||||
config = \
|
||||
"""
|
||||
BR2_x86_core2=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_CORE2_GLIBC_STABLE=y
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="board/pc/post-build.sh {}"
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/pc/genimage-bios.cfg"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.18.21"
|
||||
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/pc/linux.config"
|
||||
BR2_LINUX_KERNEL_INSTALL_TARGET=y
|
||||
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_GRUB2=y
|
||||
BR2_TARGET_GRUB2_I386_PC=y
|
||||
BR2_TARGET_GRUB2_INSTALL_TOOLS=y
|
||||
BR2_PACKAGE_HOST_GENIMAGE=y
|
||||
""".format(infra.filepath("tests/boot/test_grub/post-build.sh"))
|
||||
|
||||
def test_run(self):
|
||||
hda = os.path.join(self.builddir, "images", "disk.img")
|
||||
self.emulator.boot(arch="i386", options=["-hda", hda])
|
||||
self.emulator.login()
|
||||
|
||||
|
||||
# gitlab-runner: large
|
||||
class TestGrubX8664EFI(infra.basetest.BRTest):
|
||||
config = \
|
||||
"""
|
||||
BR2_x86_64=y
|
||||
BR2_x86_corei7=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_64_GLIBC_STABLE=y
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="board/pc/post-build.sh {}"
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image-efi.sh"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.18.21"
|
||||
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/pc/linux.config"
|
||||
BR2_LINUX_KERNEL_INSTALL_TARGET=y
|
||||
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
|
||||
BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
|
||||
BR2_PACKAGE_EFIVAR=y
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_EDK2=y
|
||||
BR2_TARGET_GRUB2=y
|
||||
BR2_TARGET_GRUB2_X86_64_EFI=y
|
||||
BR2_TARGET_GRUB2_INSTALL_TOOLS=y
|
||||
BR2_PACKAGE_HOST_GENIMAGE=y
|
||||
BR2_PACKAGE_HOST_MTOOLS=y
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
""".format(infra.filepath("tests/boot/test_grub/post-build.sh"))
|
||||
|
||||
def test_run(self):
|
||||
hda = os.path.join(self.builddir, "images", "disk.img")
|
||||
bios = os.path.join(self.builddir, "images", "OVMF.fd")
|
||||
# In QEMU v5.1.0 up to v7.2.0, the CPU hotplug register block misbehaves.
|
||||
# EDK2 hang if the bug is detected in Qemu after printing errors to IO port 0x402
|
||||
# (requires BR2_TARGET_EDK2_OVMF_DEBUG_ON_SERIAL to see them)
|
||||
# The Docker image used by the Buildroot gitlab-ci uses Qemu 5.2.0, the workaround
|
||||
# can be removed as soon as the Docker image is updated to provided Qemu >= 8.0.0.
|
||||
# https://github.com/tianocore/edk2/commit/bf5678b5802685e07583e3c7ec56d883cbdd5da3
|
||||
# http://lists.busybox.net/pipermail/buildroot/2023-July/670825.html
|
||||
qemu_fw_cfg = "name=opt/org.tianocore/X-Cpuhp-Bugcheck-Override,string=yes"
|
||||
self.emulator.boot(arch="x86_64", options=["-bios", bios, "-cpu", "Nehalem", "-hda", hda, "-fw_cfg", qemu_fw_cfg])
|
||||
self.emulator.login()
|
||||
|
||||
cmd = "modprobe efivarfs"
|
||||
self.assertRunOk(cmd)
|
||||
|
||||
cmd = "mount -t efivarfs none /sys/firmware/efi/efivars"
|
||||
self.assertRunOk(cmd)
|
||||
|
||||
cmd = "efivar -l"
|
||||
self.assertRunOk(cmd)
|
||||
|
||||
|
||||
# gitlab-runner: large
|
||||
class TestGrubAArch64EFI(infra.basetest.BRTest):
|
||||
config = \
|
||||
"""
|
||||
BR2_aarch64=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="{post_image}"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.18.21"
|
||||
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
|
||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{linux_fragment}"
|
||||
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
|
||||
BR2_PACKAGE_EFIVAR=y
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
BR2_TARGET_EDK2=y
|
||||
BR2_TARGET_GRUB2=y
|
||||
BR2_PACKAGE_HOST_GENIMAGE=y
|
||||
BR2_PACKAGE_HOST_MTOOLS=y
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_HOST_QEMU=y
|
||||
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
|
||||
""".format(post_image=infra.filepath("tests/boot/test_grub/post-image-aarch64-efi.sh"),
|
||||
linux_fragment=infra.filepath("tests/boot/test_grub/linux-aarch64-efi.config"))
|
||||
|
||||
def test_run(self):
|
||||
hda = os.path.join(self.builddir, "images", "disk.img")
|
||||
bios = os.path.join(self.builddir, "images", "QEMU_EFI.fd")
|
||||
self.emulator.boot(arch="aarch64", options=["-M", "virt", "-cpu", "cortex-a53", "-bios", bios, "-hda", hda])
|
||||
self.emulator.login()
|
||||
|
||||
cmd = "modprobe efivarfs"
|
||||
self.assertRunOk(cmd)
|
||||
|
||||
cmd = "mount -t efivarfs none /sys/firmware/efi/efivars"
|
||||
self.assertRunOk(cmd)
|
||||
|
||||
cmd = "efivar -l"
|
||||
self.assertRunOk(cmd)
|
||||
|
||||
|
||||
# gitlab-runner: large
|
||||
class TestGrubRiscV64EFI(infra.basetest.BRTest):
|
||||
scripts = [
|
||||
"board/qemu/post-image.sh",
|
||||
"board/qemu/riscv64-virt-efi/assemble-flash-images",
|
||||
"support/scripts/genimage.sh"
|
||||
]
|
||||
post_image_script = " ".join(scripts)
|
||||
config = \
|
||||
f"""
|
||||
BR2_riscv=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_ROOTFS_POST_IMAGE_SCRIPT="{post_image_script}"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/qemu/riscv64-virt-efi/genimage.cfg"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.18.21"
|
||||
BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
|
||||
BR2_PACKAGE_EFIVAR=y
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_TARGET_EDK2=y
|
||||
BR2_TARGET_GRUB2=y
|
||||
BR2_TARGET_GRUB2_RISCV64_EFI=y
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_HOST_GENIMAGE=y
|
||||
BR2_PACKAGE_HOST_MTOOLS=y
|
||||
BR2_PACKAGE_HOST_QEMU=y
|
||||
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
disk = os.path.join(self.builddir, "images", "disk.img")
|
||||
flash0 = os.path.join(self.builddir, "images", "RISCV_VIRT_CODE.fd")
|
||||
flash1 = os.path.join(self.builddir, "images", "RISCV_VIRT_VARS.fd")
|
||||
qemu_opts = [
|
||||
"-M", "virt,pflash0=pflash0,pflash1=pflash1,acpi=off",
|
||||
"-blockdev", f"node-name=pflash0,driver=file,read-only=on,filename={flash0}",
|
||||
"-blockdev", f"node-name=pflash1,driver=file,filename={flash1}",
|
||||
"-drive", f"file={disk},format=raw,if=virtio"
|
||||
]
|
||||
self.emulator.boot(arch="riscv64", options=qemu_opts)
|
||||
self.emulator.login()
|
||||
|
||||
cmd = "mount -t efivarfs none /sys/firmware/efi/efivars"
|
||||
self.assertRunOk(cmd)
|
||||
|
||||
cmd = "efivar -l"
|
||||
self.assertRunOk(cmd)
|
||||
@@ -0,0 +1,32 @@
|
||||
image efi-part.vfat {
|
||||
vfat {
|
||||
file EFI {
|
||||
image = "efi-part/EFI"
|
||||
}
|
||||
|
||||
file Image {
|
||||
image = "Image"
|
||||
}
|
||||
}
|
||||
|
||||
size = 16352K # 16MB - 32KB
|
||||
}
|
||||
|
||||
image disk.img {
|
||||
hdimage {
|
||||
partition-table-type = "gpt"
|
||||
}
|
||||
|
||||
partition boot {
|
||||
image = "efi-part.vfat"
|
||||
partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
|
||||
offset = 32K
|
||||
bootable = true
|
||||
}
|
||||
|
||||
partition root {
|
||||
partition-type-uuid = 44479540-f297-41b2-9af7-d131d5f0458a
|
||||
partition-uuid = UUID_TMP
|
||||
image = "rootfs.ext2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
set default="0"
|
||||
set timeout="5"
|
||||
|
||||
menuentry "Buildroot" {
|
||||
linux /Image root=PARTUUID=UUID_TMP rootwait console=ttyAMA0
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
CONFIG_ACPI=y
|
||||
7
support/testing/tests/boot/test_grub/post-build.sh
Executable file
7
support/testing/tests/boot/test_grub/post-build.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -d "$BINARIES_DIR/efi-part/" ]; then
|
||||
sed -i 's%tty1%ttyS0,115200%' "$BINARIES_DIR/efi-part/EFI/BOOT/grub.cfg"
|
||||
else
|
||||
sed -i 's%tty1%ttyS0,115200%' "$TARGET_DIR/boot/grub/grub.cfg"
|
||||
fi
|
||||
8
support/testing/tests/boot/test_grub/post-image-aarch64-efi.sh
Executable file
8
support/testing/tests/boot/test_grub/post-image-aarch64-efi.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
UUID=$(dumpe2fs "$BINARIES_DIR/rootfs.ext2" 2>/dev/null | sed -n 's/^Filesystem UUID: *\(.*\)/\1/p')
|
||||
sed "s/UUID_TMP/$UUID/g" support/testing/tests/boot/test_grub/grub-aarch64-efi.cfg > "$BINARIES_DIR/efi-part/EFI/BOOT/grub.cfg"
|
||||
sed "s/UUID_TMP/$UUID/g" support/testing/tests/boot/test_grub/genimage-aarch64-efi.cfg > "$BINARIES_DIR/genimage-aarch64-efi.cfg"
|
||||
support/scripts/genimage.sh -c "$BINARIES_DIR/genimage-aarch64-efi.cfg"
|
||||
74
support/testing/tests/boot/test_optee_os.py
Normal file
74
support/testing/tests/boot/test_optee_os.py
Normal file
@@ -0,0 +1,74 @@
|
||||
import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestOptee(infra.basetest.BRTest):
|
||||
# A custom configuration is needed to enable OP-TEE support in the
|
||||
# Kernel. This config is inspired from:
|
||||
# configs/qemu_arm_vexpress_tz_defconfig
|
||||
uboot_fragment = \
|
||||
infra.filepath("tests/boot/test_optee_os/u-boot.fragment")
|
||||
config = \
|
||||
f"""
|
||||
BR2_arm=y
|
||||
BR2_cortex_a15=y
|
||||
BR2_ARM_FPU_VFPV3D16=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/arm-vexpress-tz/post-build.sh"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.73"
|
||||
BR2_LINUX_KERNEL_DEFCONFIG="vexpress"
|
||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/qemu/arm-vexpress-tz/linux.fragment"
|
||||
BR2_PACKAGE_OPTEE_EXAMPLES=y
|
||||
BR2_TARGET_ROOTFS_CPIO=y
|
||||
BR2_TARGET_ROOTFS_CPIO_GZIP=y
|
||||
BR2_TARGET_ROOTFS_CPIO_UIMAGE=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.9"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu"
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33=y
|
||||
BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="BL32_RAM_LOCATION=tdram"
|
||||
BR2_TARGET_OPTEE_OS=y
|
||||
BR2_TARGET_OPTEE_OS_NEEDS_DTC=y
|
||||
BR2_TARGET_OPTEE_OS_PLATFORM="vexpress-qemu_virt"
|
||||
BR2_TARGET_UBOOT=y
|
||||
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
|
||||
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
|
||||
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2022.04"
|
||||
BR2_TARGET_UBOOT_BOARD_DEFCONFIG="qemu_arm"
|
||||
BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="{uboot_fragment}"
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
# There is no Kernel nor rootfs image here. They will be
|
||||
# loaded by TFTP through the emulated network interface in
|
||||
# u-boot.
|
||||
bios = os.path.join(self.builddir, "images", "flash.bin")
|
||||
tftp_dir = os.path.join(self.builddir, "images")
|
||||
self.emulator.boot(arch="arm",
|
||||
options=["-M", "virt,secure=on",
|
||||
"-d", "unimp",
|
||||
"-cpu", "cortex-a15",
|
||||
"-m", "1024M",
|
||||
"-netdev", f"user,id=vmnic,tftp={tftp_dir}",
|
||||
"-device", "virtio-net-device,netdev=vmnic",
|
||||
"-bios", bios])
|
||||
self.emulator.login()
|
||||
|
||||
# Check the Kernel has OP-TEE messages
|
||||
self.assertRunOk("dmesg | grep -F optee:")
|
||||
|
||||
# Check we have OP-TEE devices
|
||||
self.assertRunOk("ls -al /dev/tee*")
|
||||
|
||||
# Run some OP-TEE examples
|
||||
examples = ["aes", "hello_world", "hotp", "random", "secure_storage"]
|
||||
for ex in examples:
|
||||
self.assertRunOk(f"optee_example_{ex}")
|
||||
8
support/testing/tests/boot/test_optee_os/u-boot.fragment
Normal file
8
support/testing/tests/boot/test_optee_os/u-boot.fragment
Normal file
@@ -0,0 +1,8 @@
|
||||
CONFIG_SYS_TEXT_BASE=0x60000000
|
||||
CONFIG_BOOTCOMMAND="setenv ipaddr 10.0.2.15 && setenv serverip 10.0.2.2 && tftp ${kernel_addr_r} zImage && tftp ${ramdisk_addr_r} rootfs.cpio.uboot && setenv bootargs console=ttyAMA0,115200 earlyprintk=serial,ttyAMA0,115200 && bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr}"
|
||||
CONFIG_SEMIHOSTING=y
|
||||
# Drop flash accesses
|
||||
CONFIG_ENV_IS_IN_FLASH=n
|
||||
CONFIG_MTD=n
|
||||
CONFIG_MTD_NOR_FLASH=n
|
||||
CONFIG_ENV_IS_NOWHERE=y
|
||||
73
support/testing/tests/boot/test_syslinux.py
Normal file
73
support/testing/tests/boot/test_syslinux.py
Normal file
@@ -0,0 +1,73 @@
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestSysLinuxBase(infra.basetest.BRTest):
|
||||
x86_toolchain_config = \
|
||||
"""
|
||||
BR2_x86_i686=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_I686_GLIBC_BLEEDING_EDGE=y
|
||||
"""
|
||||
|
||||
x86_64_toolchain_config = \
|
||||
"""
|
||||
BR2_x86_64=y
|
||||
BR2_x86_corei7=y
|
||||
BR2_TOOLCHAIN_EXTERNAL=y
|
||||
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_64_CORE_I7_GLIBC_BLEEDING_EDGE=y
|
||||
"""
|
||||
|
||||
syslinux_legacy_config = \
|
||||
"""
|
||||
BR2_TARGET_SYSLINUX=y
|
||||
BR2_TARGET_SYSLINUX_ISOLINUX=y
|
||||
BR2_TARGET_SYSLINUX_LPXELINUX=y
|
||||
BR2_TARGET_SYSLINUX_PXELINUX=y
|
||||
BR2_TARGET_SYSLINUX_MBR=y
|
||||
"""
|
||||
|
||||
syslinux_efi_config = \
|
||||
"""
|
||||
BR2_TARGET_SYSLINUX=y
|
||||
BR2_TARGET_SYSLINUX_EFI=y
|
||||
"""
|
||||
|
||||
|
||||
class TestSysLinuxX86LegacyBios(TestSysLinuxBase):
|
||||
config = \
|
||||
TestSysLinuxBase.x86_toolchain_config + \
|
||||
infra.basetest.MINIMAL_CONFIG + \
|
||||
TestSysLinuxBase.syslinux_legacy_config
|
||||
|
||||
def test_run(self):
|
||||
pass
|
||||
|
||||
|
||||
class TestSysLinuxX86EFI(TestSysLinuxBase):
|
||||
config = \
|
||||
TestSysLinuxBase.x86_toolchain_config + \
|
||||
infra.basetest.MINIMAL_CONFIG + \
|
||||
TestSysLinuxBase.syslinux_efi_config
|
||||
|
||||
def test_run(self):
|
||||
pass
|
||||
|
||||
|
||||
class TestSysLinuxX86_64LegacyBios(TestSysLinuxBase):
|
||||
config = \
|
||||
TestSysLinuxBase.x86_64_toolchain_config + \
|
||||
infra.basetest.MINIMAL_CONFIG + \
|
||||
TestSysLinuxBase.syslinux_legacy_config
|
||||
|
||||
def test_run(self):
|
||||
pass
|
||||
|
||||
|
||||
class TestSysLinuxX86_64EFI(TestSysLinuxBase):
|
||||
config = \
|
||||
TestSysLinuxBase.x86_64_toolchain_config + \
|
||||
infra.basetest.MINIMAL_CONFIG + \
|
||||
TestSysLinuxBase.syslinux_efi_config
|
||||
|
||||
def test_run(self):
|
||||
pass
|
||||
Reference in New Issue
Block a user