From dc9cd18f522d09dc447e2e3f1c80af0549d45660 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Thu, 4 Feb 2021 15:10:08 +0100 Subject: [PATCH] ci: Build Crosvm in our container And also add the required bits to the x86_64 kernel. syslogd is needed by Crosvm. iptables is needed to route packets in and out the VM. Signed-off-by: Tomeu Vizoso Part-of: --- .gitlab-ci/container/build-crosvm.sh | 50 +++++++++++++++++++++ .gitlab-ci/container/build-virglrenderer.sh | 4 +- .gitlab-ci/container/x86_64.config | 23 ++++++++++ .gitlab-ci/container/x86_test-gl.sh | 21 ++++++++- 4 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 .gitlab-ci/container/build-crosvm.sh diff --git a/.gitlab-ci/container/build-crosvm.sh b/.gitlab-ci/container/build-crosvm.sh new file mode 100644 index 00000000000..8993287b950 --- /dev/null +++ b/.gitlab-ci/container/build-crosvm.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +set -ex + +# Pull down repositories that crosvm depends on to cros checkout-like locations. +CROS_ROOT=/ +THIRD_PARTY_ROOT=$CROS_ROOT/third_party +mkdir -p $THIRD_PARTY_ROOT +AOSP_EXTERNAL_ROOT=$CROS_ROOT/aosp/external +mkdir -p $AOSP_EXTERNAL_ROOT +PLATFORM2_ROOT=/platform2 + +PLATFORM2_COMMIT=2079dd5fcd61f1ac39e2fc16595956617f3f1e9e +git clone --single-branch --no-checkout https://chromium.googlesource.com/chromiumos/platform2 $PLATFORM2_ROOT +pushd $PLATFORM2_ROOT +git checkout $PLATFORM2_COMMIT +popd + +# minijail does not exist in upstream linux distros. +MINIJAIL_COMMIT=5f9e3001c61626d2863dad91248ba8496c3ef511 +git clone --single-branch --no-checkout https://android.googlesource.com/platform/external/minijail $AOSP_EXTERNAL_ROOT/minijail +pushd $AOSP_EXTERNAL_ROOT/minijail +git checkout $MINIJAIL_COMMIT +make +cp libminijail.so /usr/lib/x86_64-linux-gnu/ +popd + +# Pull the cras library for audio access. +ADHD_COMMIT=5068bdd18b51de8f2d5bcff754cdecda80de8f44 +git clone --single-branch --no-checkout https://chromium.googlesource.com/chromiumos/third_party/adhd $THIRD_PARTY_ROOT/adhd +pushd $THIRD_PARTY_ROOT/adhd +git checkout $ADHD_COMMIT +popd + +CROSVM_VERSION=f70350ba51e9631e3b7fe711c0296e041a61a499 +git clone --single-branch --no-checkout https://chromium.googlesource.com/chromiumos/platform/crosvm /platform/crosvm +pushd /platform/crosvm +git checkout "$CROSVM_VERSION" + +RUSTFLAGS='-L native=/usr/local/lib' cargo install \ + -j ${FDO_CI_CONCURRENT:-4} \ + --locked \ + --features 'default-no-sandbox gpu x virtio-gpu-next' \ + --path . \ + --root /usr/local \ + $EXTRA_CARGO_ARGS + +popd + +rm -rf $PLATFORM2_ROOT $AOSP_EXTERNAL_ROOT/minijail $THIRD_PARTY_ROOT/adhd /platform/crosvm diff --git a/.gitlab-ci/container/build-virglrenderer.sh b/.gitlab-ci/container/build-virglrenderer.sh index 20cd9474147..e917fcf4c6b 100644 --- a/.gitlab-ci/container/build-virglrenderer.sh +++ b/.gitlab-ci/container/build-virglrenderer.sh @@ -4,13 +4,13 @@ set -ex mkdir -p /epoxy pushd /epoxy -wget -qO- https://github.com/anholt/libepoxy/releases/download/1.5.4/libepoxy-1.5.4.tar.xz | tar -xJ --strip-components=1 +wget -qO- https://github.com/anholt/libepoxy/releases/download/1.5.8/libepoxy-1.5.8.tar.xz | tar -xJ --strip-components=1 meson build/ $EXTRA_MESON_ARGS ninja -C build install popd rm -rf /epoxy -VIRGLRENDERER_VERSION=43148d1115a12219a0560a538c9872d07c28c558 +VIRGLRENDERER_VERSION=7db2faa354a895b75cee9e9c872c87500e1be7cb git clone https://gitlab.freedesktop.org/virgl/virglrenderer.git --single-branch --no-checkout /virglrenderer pushd /virglrenderer git checkout "$VIRGLRENDERER_VERSION" diff --git a/.gitlab-ci/container/x86_64.config b/.gitlab-ci/container/x86_64.config index ddaada4053b..5717f7d7fe3 100644 --- a/.gitlab-ci/container/x86_64.config +++ b/.gitlab-ci/container/x86_64.config @@ -70,3 +70,26 @@ CONFIG_CHROME_PLATFORMS=y #options for Intel devices CONFIG_MFD_INTEL_LPSS_PCI=y + +#options for KVM guests +CONFIG_FUSE_FS=y +CONFIG_HYPERVISOR_GUEST=y +CONFIG_KVM=y +CONFIG_KVM_GUEST=y +CONFIG_VIRT_DRIVERS=y +CONFIG_VIRTIO_FS=y +CONFIG_DRM_VIRTIO_GPU=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_VIRTIO_NET=y +CONFIG_VIRTIO_CONSOLE=y +CONFIG_PARAVIRT=y +CONFIG_VIRTIO_BLK=y +CONFIG_VIRTUALIZATION=y +CONFIG_VIRTIO=y +CONFIG_VIRTIO_PCI=y +CONFIG_VIRTIO_MMIO=y +CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y +CONFIG_CRYPTO_DEV_VIRTIO=y +CONFIG_HW_RANDOM_VIRTIO=y +CONFIG_BLK_MQ_VIRTIO=y +CONFIG_TUN=y diff --git a/.gitlab-ci/container/x86_test-gl.sh b/.gitlab-ci/container/x86_test-gl.sh index e814aa1a138..6b126ac33e8 100644 --- a/.gitlab-ci/container/x86_test-gl.sh +++ b/.gitlab-ci/container/x86_test-gl.sh @@ -9,12 +9,16 @@ export DEBIAN_FRONTEND=noninteractive STABLE_EPHEMERAL=" \ autoconf \ automake \ + cargo \ ccache \ clang-11 \ cmake \ g++ \ glslang-tools \ + libasound2-dev \ + libcap-dev \ libclang-cpp11-dev \ + libfdt-dev \ libgbm-dev \ libgles2-mesa-dev \ libllvmspirvlib-dev \ @@ -25,6 +29,7 @@ STABLE_EPHEMERAL=" \ libwaffle-dev \ libwayland-dev \ libx11-xcb-dev \ + libxext-dev \ libxkbcommon-dev \ libxrender-dev \ llvm-11-dev \ @@ -35,6 +40,7 @@ STABLE_EPHEMERAL=" \ patch \ pkg-config \ python3-distutils \ + wayland-protocols \ wget \ xz-utils \ " @@ -42,21 +48,25 @@ STABLE_EPHEMERAL=" \ apt-get install -y --no-remove \ $STABLE_EPHEMERAL \ clinfo \ + inetutils-syslogd \ + iptables \ libclang-common-11-dev \ libclang-cpp11 \ + libcap2 \ libegl1 \ + libfdt1 \ libllvmspirvlib11 \ libxcb-shm0 \ ocl-icd-libopencl1 \ python3-lxml \ python3-renderdoc \ python3-simplejson \ - spirv-tools + spirv-tools \ + sysvinit-core . .gitlab-ci/container/container_pre_build.sh - ############### Build libdrm . .gitlab-ci/container/build-libdrm.sh @@ -73,6 +83,13 @@ apt-get install -y --no-remove \ PIGLIT_OPTS="-DPIGLIT_BUILD_CL_TESTS=ON" . .gitlab-ci/container/build-piglit.sh +############### Build Rust deps (Crosvm and deqp-runner) + +. .gitlab-ci/container/build-crosvm.sh +. .gitlab-ci/container/build-deqp-runner.sh + +rm -rf /root/.cargo + ############### Build dEQP GL DEQP_TARGET=surfaceless . .gitlab-ci/container/build-deqp.sh