From d08e2e5a96feb53f1c343a3913ee69f6c598bbe4 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Mon, 8 Mar 2021 14:05:08 +0100 Subject: [PATCH] ci: Move Kernel build tasks into its own file Allows to reuse the Kernel build tasks everywhere it is needed. The x86_test-gl container now need a kernel image to use for the crosvm environment, Reuse this task there. Part-of: --- .gitlab-ci.yml | 6 ++-- .gitlab-ci/container/build-kernel.sh | 51 ++++++++++++++++++++++++++++ .gitlab-ci/container/lava_build.sh | 50 ++------------------------- .gitlab-ci/container/x86_test-gl.sh | 15 ++++++++ 4 files changed, 72 insertions(+), 50 deletions(-) create mode 100644 .gitlab-ci/container/build-kernel.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d5440b30c69..a7b654632b9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -415,7 +415,9 @@ x86_test-base: x86_test-gl: extends: .use-x86_test-base variables: - MESA_IMAGE_TAG: &x86_test-gl "2021-05-31-piglit-vk" + FDO_DISTRIBUTION_EXEC: 'env KERNEL_URL=${KERNEL_URL} FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/container/${CI_JOB_NAME}.sh' + KERNEL_URL: &kernel-rootfs-url "https://gitlab.freedesktop.org/gfx-ci/linux/-/archive/v5.13-rc5-for-mesa-ci-27df41f1e0cf/linux-v5.13-rc5-for-mesa-ci-27df41f1e0cf.tar.bz2" + MESA_IMAGE_TAG: &x86_test-gl "2021-06-08-virgl-crosvm-kernel" # Debian 11 based x86 test image for VK x86_test-vk: @@ -449,7 +451,7 @@ arm_build: stage: container-2 variables: GIT_STRATEGY: fetch - KERNEL_URL: "https://gitlab.freedesktop.org/gfx-ci/linux/-/archive/v5.13-rc2-for-mesa-ci-2a4a4fa4407f/v5.13-rc2-for-mesa-ci-2a4a4fa4407f.tar.bz2" + KERNEL_URL: *kernel-rootfs-url MESA_ROOTFS_TAG: &kernel-rootfs "2021-05-25-apitrace" DISTRIBUTION_TAG: &distribution-tag-arm "${MESA_ROOTFS_TAG}--${MESA_ARTIFACTS_TAG}--${MESA_TEMPLATES_COMMIT}" script: diff --git a/.gitlab-ci/container/build-kernel.sh b/.gitlab-ci/container/build-kernel.sh new file mode 100644 index 00000000000..7367924c723 --- /dev/null +++ b/.gitlab-ci/container/build-kernel.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +set -ex + +mkdir -p kernel +wget -qO- ${KERNEL_URL} | tar -xj --strip-components=1 -C kernel +pushd kernel + +# The kernel doesn't like the gold linker (or the old lld in our debians). +# Sneak in some override symlinks during kernel build until we can update +# debian (they'll get blown away by the rm of the kernel dir at the end). +mkdir -p ld-links +for i in /usr/bin/*-ld /usr/bin/ld; do + i=`basename $i` + ln -sf /usr/bin/$i.bfd ld-links/$i +done +export PATH=`pwd`/ld-links:$PATH + +export LOCALVERSION="`basename $KERNEL_URL`" +./scripts/kconfig/merge_config.sh ${DEFCONFIG} ../.gitlab-ci/container/${KERNEL_ARCH}.config +make ${KERNEL_IMAGE_NAME} +for image in ${KERNEL_IMAGE_NAME}; do + cp arch/${KERNEL_ARCH}/boot/${image} /lava-files/. +done + +if [[ -n ${DEVICE_TREES} ]]; then + make dtbs + cp ${DEVICE_TREES} /lava-files/. +fi + +if [[ ${DEBIAN_ARCH} = "amd64" ]]; then + make modules + INSTALL_MOD_PATH=/lava-files/rootfs-${DEBIAN_ARCH}/ make modules_install +fi + +if [[ ${DEBIAN_ARCH} = "arm64" ]]; then + make Image.lzma + mkimage \ + -f auto \ + -A arm \ + -O linux \ + -d arch/arm64/boot/Image.lzma \ + -C lzma\ + -b arch/arm64/boot/dts/qcom/sdm845-cheza-r3.dtb \ + /lava-files/cheza-kernel + KERNEL_IMAGE_NAME+=" cheza-kernel" +fi + +popd +rm -rf kernel + diff --git a/.gitlab-ci/container/lava_build.sh b/.gitlab-ci/container/lava_build.sh index c42f60c3984..88a78c2d322 100755 --- a/.gitlab-ci/container/lava_build.sh +++ b/.gitlab-ci/container/lava_build.sh @@ -144,54 +144,8 @@ mv /piglit /lava-files/rootfs-${DEBIAN_ARCH}/. EXTRA_MESON_ARGS+=" -D prefix=/libdrm" . .gitlab-ci/container/build-libdrm.sh - -############### Cross-build kernel -mkdir -p kernel -wget -qO- ${KERNEL_URL} | tar -xj --strip-components=1 -C kernel -pushd kernel - -# The kernel doesn't like the gold linker (or the old lld in our debians). -# Sneak in some override symlinks during kernel build until we can update -# debian (they'll get blown away by the rm of the kernel dir at the end). -mkdir -p ld-links -for i in /usr/bin/*-ld /usr/bin/ld; do - i=`basename $i` - ln -sf /usr/bin/$i.bfd ld-links/$i -done -export PATH=`pwd`/ld-links:$PATH - -export LOCALVERSION="`basename $KERNEL_URL`" -./scripts/kconfig/merge_config.sh ${DEFCONFIG} ../.gitlab-ci/container/${KERNEL_ARCH}.config -make ${KERNEL_IMAGE_NAME} -for image in ${KERNEL_IMAGE_NAME}; do - cp arch/${KERNEL_ARCH}/boot/${image} /lava-files/. -done - -if [[ -n ${DEVICE_TREES} ]]; then - make dtbs - cp ${DEVICE_TREES} /lava-files/. -fi - -if [[ ${DEBIAN_ARCH} = "amd64" ]]; then - make modules - INSTALL_MOD_PATH=/lava-files/rootfs-${DEBIAN_ARCH}/ make modules_install -fi - -if [[ ${DEBIAN_ARCH} = "arm64" ]]; then - make Image.lzma - mkimage \ - -f auto \ - -A arm \ - -O linux \ - -d arch/arm64/boot/Image.lzma \ - -C lzma\ - -b arch/arm64/boot/dts/qcom/sdm845-cheza-r3.dtb \ - /lava-files/cheza-kernel - KERNEL_IMAGE_NAME+=" cheza-kernel" -fi - -popd -rm -rf kernel +############### Build kernel +. .gitlab-ci/container/build-kernel.sh ############### Delete rust, since the tests won't be compiling anything. rm -rf /root/.cargo diff --git a/.gitlab-ci/container/x86_test-gl.sh b/.gitlab-ci/container/x86_test-gl.sh index 6b126ac33e8..e3d03a13257 100644 --- a/.gitlab-ci/container/x86_test-gl.sh +++ b/.gitlab-ci/container/x86_test-gl.sh @@ -9,15 +9,20 @@ export DEBIAN_FRONTEND=noninteractive STABLE_EPHEMERAL=" \ autoconf \ automake \ + bc \ + bison \ + bzip2 \ cargo \ ccache \ clang-11 \ cmake \ + flex \ g++ \ glslang-tools \ libasound2-dev \ libcap-dev \ libclang-cpp11-dev \ + libelf-dev \ libfdt-dev \ libgbm-dev \ libgles2-mesa-dev \ @@ -67,6 +72,16 @@ apt-get install -y --no-remove \ . .gitlab-ci/container/container_pre_build.sh +############### Build kernel + +export DEFCONFIG="arch/x86/configs/x86_64_defconfig" +export KERNEL_IMAGE_NAME=bzImage +export KERNEL_ARCH=x86_64 +export DEBIAN_ARCH=amd64 + +mkdir -p /lava-files/ +. .gitlab-ci/container/build-kernel.sh + ############### Build libdrm . .gitlab-ci/container/build-libdrm.sh