From 3530c522f82e71eee5b8a598916b51b9b8e4434f Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 22 Jun 2021 00:33:01 +0100 Subject: [PATCH] CI: Add full AArch64 KVM support Build a kernel for AArch64 and run it under virtme just like we do for x86-64. This requires adding support for the AArch64 defconfig variant, and accommodating for the fact that it builds DRM as a module by default rather than built in. The virtme branch we are using has also been rebased on top of newer virtme upstream which unbreaks AArch64. Signed-off-by: Daniel Stone --- .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++------ .gitlab-ci/build-deps.sh | 18 ++++++++++++++---- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fc99c459..5a0af05b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,7 +43,7 @@ variables: FDO_UPSTREAM_REPO: wayland/weston FDO_REPO_SUFFIX: "$BUILD_OS/$BUILD_ARCH" - FDO_DISTRIBUTION_TAG: '2021-08-02.2-meson' + FDO_DISTRIBUTION_TAG: '2021-08-02.3-aarch64-virt' include: @@ -109,6 +109,9 @@ check-commit: - .os-debian variables: BUILD_ARCH: "aarch64" + KERNEL_IMAGE: "Image" + KERNEL_DEFCONFIG: "defconfig" + QEMU_SMP: 8 # built-in QEmu limit # Build our base container image, which contains the core distribution, the # toolchain, and all our build dependencies. This will be reused in the build @@ -156,7 +159,8 @@ aarch64-debian-container_prep: - meson --prefix="$PREFIX" -Db_sanitize=address ${MESON_OPTIONS} .. - ninja -k0 -j${FDO_CI_CONCURRENT:-4} - ninja install - - virtme-run --rw --pwd --kimg /weston-virtme/${KERNEL_IMAGE} --kopt quiet --script-dir ../.gitlab-ci/virtme-scripts --qemu-opts -m 4096 -smp ${FDO_CI_CONCURRENT:-4} + - test -n "${QEMU_SMP}" || QEMU_SMP=${FDO_CI_CONCURRENT:-4} + - virtme-run --rw --pwd --kimg /weston-virtme/${KERNEL_IMAGE} --kopt quiet --script-dir ../.gitlab-ci/virtme-scripts --qemu-opts -m 4096 -smp ${QEMU_SMP} - TEST_RES=$(cat $TESTS_RES_PATH) - rm $TESTS_RES_PATH - cp -R /weston-virtme ./ @@ -222,9 +226,18 @@ aarch64-debian-container_prep: - job: x86_64-debian-container_prep artifacts: false +.test-env-debian-aarch64: + tags: + - kvm-aarch64 + extends: + - .build-env-debian-aarch64 + - .build-and-test + needs: + - job: aarch64-debian-container_prep + artifacts: false + # Full build, used for testing under KVM. -x86_64-debian-full-build: - extends: .test-env-debian-x86_64 +.build-options-full: variables: MESON_OPTIONS: > -Doptimization=0 @@ -240,6 +253,16 @@ x86_64-debian-full-build: reports: cobertura: $BUILDDIR/meson-logs/coverage.xml +x86_64-debian-full-build: + extends: + - .test-env-debian-x86_64 + - .build-options-full + +aarch64-debian-full-build: + extends: + - .test-env-debian-aarch64 + - .build-options-full + # Docs should be invariant on all architectures, so we only do it on Debian # x86-64. docs-build: @@ -269,8 +292,7 @@ x86_64-debian-no-gl-build: aarch64-debian-no-gl-build: extends: - - .build-env-debian-aarch64 - - .build-no-test + - .test-env-debian-aarch64 - .build-options-no-gl # Expose docs and coverage reports, so we can show users any changes to these diff --git a/.gitlab-ci/build-deps.sh b/.gitlab-ci/build-deps.sh index 212b3257..25facdcd 100755 --- a/.gitlab-ci/build-deps.sh +++ b/.gitlab-ci/build-deps.sh @@ -44,12 +44,17 @@ pip3 install sphinx_rtd_theme==0.4.3 --user # results: --script-sh and --script-exec. Unfornutately they are not completely # implemented yet, so we had some trouble to use them and it was becoming # hackery. -if [[ -n "${KERNEL_DEFCONFIG}" ]]; then +# +# The fork pulls in this support from the original GitHub PR, rebased on top of +# a newer upstream version which fixes AArch64 support. +if [[ -n "$KERNEL_DEFCONFIG" ]]; then git clone --depth=1 --branch=drm-next-2020-06-11-1 https://anongit.freedesktop.org/git/drm/drm.git linux cd linux if [[ "${BUILD_ARCH}" = "x86-64" ]]; then LINUX_ARCH=x86 + elif [[ "$BUILD_ARCH" = "aarch64" ]]; then + LINUX_ARCH=arm64 else echo "Invalid or missing \$BUILD_ARCH" exit 1 @@ -66,18 +71,23 @@ if [[ -n "${KERNEL_DEFCONFIG}" ]]; then make ARCH=${LINUX_ARCH} ${KERNEL_DEFCONFIG} make ARCH=${LINUX_ARCH} kvmconfig - ./scripts/config --enable CONFIG_DRM_VKMS + ./scripts/config \ + --enable CONFIG_DRM \ + --enable CONFIG_DRM_KMS_HELPER \ + --enable CONFIG_DRM_KMS_FB_HELPER \ + --enable CONFIG_DRM_VKMS make ARCH=${LINUX_ARCH} oldconfig make ARCH=${LINUX_ARCH} + cd .. mkdir /weston-virtme mv linux/arch/${LINUX_ARCH}/boot/${KERNEL_IMAGE} /weston-virtme/ mv linux/.config /weston-virtme/.config rm -rf linux - git clone https://github.com/ezequielgarcia/virtme + git clone https://github.com/fooishbar/virtme cd virtme - git checkout -b snapshot 69e3cb83b3405edc99fcf9611f50012a4f210f78 + git checkout -b snapshot 70e390c564cd09e0da287a7f2c04a6592e59e379 ./setup.py install cd .. fi