10119c894STomeu Vizoso#!/bin/bash 20119c894STomeu Vizoso# SPDX-License-Identifier: MIT 30119c894STomeu Vizoso 40119c894STomeu Vizososet -ex 50119c894STomeu Vizoso 60119c894STomeu Vizoso# Clean up stale rebases that GitLab might not have removed when reusing a checkout dir 70119c894STomeu Vizosorm -rf .git/rebase-apply 80119c894STomeu Vizoso 90119c894STomeu Vizoso. .gitlab-ci/container/container_pre_build.sh 100119c894STomeu Vizoso 110119c894STomeu Vizoso# libssl-dev was uninstalled because it was considered an ephemeral package 120119c894STomeu Vizosoapt-get update 130119c894STomeu Vizosoapt-get install -y libssl-dev 140119c894STomeu Vizoso 15*c4e32678SDmitry Baryshkov# for msm header validation 16*c4e32678SDmitry Baryshkovapt-get install -y python3-lxml 17*c4e32678SDmitry Baryshkov 180119c894STomeu Vizosoif [[ "$KERNEL_ARCH" = "arm64" ]]; then 190119c894STomeu Vizoso GCC_ARCH="aarch64-linux-gnu" 200119c894STomeu Vizoso DEBIAN_ARCH="arm64" 210119c894STomeu Vizoso DEVICE_TREES="arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dtb" 220119c894STomeu Vizoso DEVICE_TREES+=" arch/arm64/boot/dts/amlogic/meson-gxl-s805x-libretech-ac.dtb" 230119c894STomeu Vizoso DEVICE_TREES+=" arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dtb" 240119c894STomeu Vizoso DEVICE_TREES+=" arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dtb" 25910d2d85SVignesh Raman DEVICE_TREES+=" arch/arm64/boot/dts/qcom/apq8016-sbc-usb-host.dtb" 260119c894STomeu Vizoso DEVICE_TREES+=" arch/arm64/boot/dts/qcom/apq8096-db820c.dtb" 270119c894STomeu Vizoso DEVICE_TREES+=" arch/arm64/boot/dts/amlogic/meson-g12b-a311d-khadas-vim3.dtb" 280119c894STomeu Vizoso DEVICE_TREES+=" arch/arm64/boot/dts/mediatek/mt8173-elm-hana.dtb" 290119c894STomeu Vizoso DEVICE_TREES+=" arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-juniper-sku16.dtb" 300119c894STomeu Vizoso DEVICE_TREES+=" arch/arm64/boot/dts/mediatek/mt8192-asurada-spherion-r0.dtb" 310119c894STomeu Vizoso DEVICE_TREES+=" arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-limozeen-nots-r5.dtb" 32ea489a3dSVignesh Raman DEVICE_TREES+=" arch/arm64/boot/dts/qcom/sc7180-trogdor-kingoftown.dtb" 330119c894STomeu Vizosoelif [[ "$KERNEL_ARCH" = "arm" ]]; then 340119c894STomeu Vizoso GCC_ARCH="arm-linux-gnueabihf" 350119c894STomeu Vizoso DEBIAN_ARCH="armhf" 360119c894STomeu Vizoso DEVICE_TREES="arch/arm/boot/dts/rockchip/rk3288-veyron-jaq.dtb" 370119c894STomeu Vizoso DEVICE_TREES+=" arch/arm/boot/dts/allwinner/sun8i-h3-libretech-all-h3-cc.dtb" 380119c894STomeu Vizoso DEVICE_TREES+=" arch/arm/boot/dts/nxp/imx/imx6q-cubox-i.dtb" 390119c894STomeu Vizoso apt-get install -y libssl-dev:armhf 400119c894STomeu Vizosoelse 410119c894STomeu Vizoso GCC_ARCH="x86_64-linux-gnu" 422b126e06SHelen Koike DEBIAN_ARCH="amd64" 430119c894STomeu Vizoso DEVICE_TREES="" 440119c894STomeu Vizosofi 450119c894STomeu Vizoso 460119c894STomeu Vizosoexport ARCH=${KERNEL_ARCH} 470119c894STomeu Vizosoexport CROSS_COMPILE="${GCC_ARCH}-" 480119c894STomeu Vizoso 490119c894STomeu Vizoso# The kernel doesn't like the gold linker (or the old lld in our debians). 500119c894STomeu Vizoso# Sneak in some override symlinks during kernel build until we can update 510119c894STomeu Vizoso# debian. 520119c894STomeu Vizosomkdir -p ld-links 530119c894STomeu Vizosofor i in /usr/bin/*-ld /usr/bin/ld; do 540119c894STomeu Vizoso i=$(basename $i) 550119c894STomeu Vizoso ln -sf /usr/bin/$i.bfd ld-links/$i 560119c894STomeu Vizosodone 570119c894STomeu Vizoso 580119c894STomeu VizosoNEWPATH=$(pwd)/ld-links 590119c894STomeu Vizosoexport PATH=$NEWPATH:$PATH 600119c894STomeu Vizoso 610119c894STomeu Vizosogit config --global user.email "fdo@example.com" 620119c894STomeu Vizosogit config --global user.name "freedesktop.org CI" 630119c894STomeu Vizosogit config --global pull.rebase true 640119c894STomeu Vizoso 65236fa387SDmitry Baryshkov# cleanup git state on the worker 66236fa387SDmitry Baryshkovrm -rf .git/rebase-merge 67236fa387SDmitry Baryshkov 680119c894STomeu Vizoso# Try to merge fixes from target repo 690119c894STomeu Vizosoif [ "$(git ls-remote --exit-code --heads ${UPSTREAM_REPO} ${TARGET_BRANCH}-external-fixes)" ]; then 700119c894STomeu Vizoso git pull ${UPSTREAM_REPO} ${TARGET_BRANCH}-external-fixes 710119c894STomeu Vizosofi 720119c894STomeu Vizoso 730119c894STomeu Vizoso# Try to merge fixes from local repo if this isn't a merge request 74f9b4fbcbSDmitry Baryshkov# otherwise try merging the fixes from the merge target 750119c894STomeu Vizosoif [ -z "$CI_MERGE_REQUEST_PROJECT_PATH" ]; then 760119c894STomeu Vizoso if [ "$(git ls-remote --exit-code --heads origin ${TARGET_BRANCH}-external-fixes)" ]; then 770119c894STomeu Vizoso git pull origin ${TARGET_BRANCH}-external-fixes 780119c894STomeu Vizoso fi 79f9b4fbcbSDmitry Baryshkovelse 80f9b4fbcbSDmitry Baryshkov if [ "$(git ls-remote --exit-code --heads ${CI_MERGE_REQUEST_PROJECT_URL} ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}-external-fixes)" ]; then 81f9b4fbcbSDmitry Baryshkov git pull ${CI_MERGE_REQUEST_PROJECT_URL} ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}-external-fixes 82f9b4fbcbSDmitry Baryshkov fi 830119c894STomeu Vizosofi 840119c894STomeu Vizoso 850119c894STomeu Vizosoif [[ -n "${MERGE_FRAGMENT}" ]]; then 860119c894STomeu Vizoso ./scripts/kconfig/merge_config.sh ${DEFCONFIG} drivers/gpu/drm/ci/${MERGE_FRAGMENT} 870119c894STomeu Vizosoelse 880119c894STomeu Vizoso make `basename ${DEFCONFIG}` 890119c894STomeu Vizosofi 900119c894STomeu Vizoso 9134ec9287SVignesh Ramanfor opt in $ENABLE_KCONFIGS; do 9234ec9287SVignesh Raman ./scripts/config --enable CONFIG_$opt 9334ec9287SVignesh Ramandone 9434ec9287SVignesh Ramanfor opt in $DISABLE_KCONFIGS; do 9534ec9287SVignesh Raman ./scripts/config --disable CONFIG_$opt 9634ec9287SVignesh Ramandone 9734ec9287SVignesh Raman 980119c894STomeu Vizosomake ${KERNEL_IMAGE_NAME} 990119c894STomeu Vizoso 1000119c894STomeu Vizosomkdir -p /lava-files/ 1010119c894STomeu Vizosofor image in ${KERNEL_IMAGE_NAME}; do 1020119c894STomeu Vizoso cp arch/${KERNEL_ARCH}/boot/${image} /lava-files/. 1030119c894STomeu Vizosodone 1040119c894STomeu Vizoso 1050119c894STomeu Vizosoif [[ -n ${DEVICE_TREES} ]]; then 1060119c894STomeu Vizoso make dtbs 1070119c894STomeu Vizoso cp ${DEVICE_TREES} /lava-files/. 1080119c894STomeu Vizosofi 1090119c894STomeu Vizoso 1100119c894STomeu Vizosomake modules 1110119c894STomeu Vizosomkdir -p install/modules/ 1120119c894STomeu VizosoINSTALL_MOD_PATH=install/modules/ make modules_install 1130119c894STomeu Vizoso 1140119c894STomeu Vizosoif [[ ${DEBIAN_ARCH} = "arm64" ]]; then 1150119c894STomeu Vizoso make Image.lzma 1160119c894STomeu Vizoso mkimage \ 1170119c894STomeu Vizoso -f auto \ 1180119c894STomeu Vizoso -A arm \ 1190119c894STomeu Vizoso -O linux \ 1200119c894STomeu Vizoso -d arch/arm64/boot/Image.lzma \ 1210119c894STomeu Vizoso -C lzma\ 1220119c894STomeu Vizoso -b arch/arm64/boot/dts/qcom/sdm845-cheza-r3.dtb \ 1230119c894STomeu Vizoso /lava-files/cheza-kernel 1240119c894STomeu Vizoso KERNEL_IMAGE_NAME+=" cheza-kernel" 1250119c894STomeu Vizoso 1260119c894STomeu Vizoso # Make a gzipped copy of the Image for db410c. 1270119c894STomeu Vizoso gzip -k /lava-files/Image 1280119c894STomeu Vizoso KERNEL_IMAGE_NAME+=" Image.gz" 1290119c894STomeu Vizosofi 1300119c894STomeu Vizoso 1310119c894STomeu Vizoso# Pass needed files to the test stage 1320119c894STomeu Vizosomkdir -p install 1330119c894STomeu Vizosocp -rfv .gitlab-ci/* install/. 1340119c894STomeu Vizosocp -rfv install/common install/ci-common 1350119c894STomeu Vizosocp -rfv drivers/gpu/drm/ci/* install/. 1360119c894STomeu Vizoso 1370119c894STomeu Vizoso. .gitlab-ci/container/container_post_build.sh 1380119c894STomeu Vizoso 1390119c894STomeu Vizosoif [[ "$UPLOAD_TO_MINIO" = "1" ]]; then 1400119c894STomeu Vizoso xz -7 -c -T${FDO_CI_CONCURRENT:-4} vmlinux > /lava-files/vmlinux.xz 1410119c894STomeu Vizoso FILES_TO_UPLOAD="$KERNEL_IMAGE_NAME vmlinux.xz" 1420119c894STomeu Vizoso 1430119c894STomeu Vizoso if [[ -n $DEVICE_TREES ]]; then 1440119c894STomeu Vizoso FILES_TO_UPLOAD="$FILES_TO_UPLOAD $(basename -a $DEVICE_TREES)" 1450119c894STomeu Vizoso fi 1460119c894STomeu Vizoso 1470119c894STomeu Vizoso for f in $FILES_TO_UPLOAD; do 1480119c894STomeu Vizoso ci-fairy s3cp --token-file "${CI_JOB_JWT_FILE}" /lava-files/$f \ 1490119c894STomeu Vizoso https://${PIPELINE_ARTIFACTS_BASE}/${DEBIAN_ARCH}/$f 1500119c894STomeu Vizoso done 1510119c894STomeu Vizoso 1520119c894STomeu Vizoso S3_ARTIFACT_NAME="kernel-files.tar.zst" 1530119c894STomeu Vizoso tar --zstd -cf $S3_ARTIFACT_NAME install 1540119c894STomeu Vizoso ci-fairy s3cp --token-file "${CI_JOB_JWT_FILE}" ${S3_ARTIFACT_NAME} https://${PIPELINE_ARTIFACTS_BASE}/${DEBIAN_ARCH}/${S3_ARTIFACT_NAME} 1550119c894STomeu Vizoso 1560119c894STomeu Vizoso echo "Download vmlinux.xz from https://${PIPELINE_ARTIFACTS_BASE}/${DEBIAN_ARCH}/vmlinux.xz" 1570119c894STomeu Vizosofi 1580119c894STomeu Vizoso 1590119c894STomeu Vizosomkdir -p artifacts/install/lib 1600119c894STomeu Vizosomv install/* artifacts/install/. 1610119c894STomeu Vizosorm -rf artifacts/install/modules 1620119c894STomeu Vizosoln -s common artifacts/install/ci-common 16380b6434bSHelen Koikecp .config artifacts/${CI_JOB_NAME}_config 1640119c894STomeu Vizoso 1650119c894STomeu Vizosofor image in ${KERNEL_IMAGE_NAME}; do 1660119c894STomeu Vizoso cp /lava-files/$image artifacts/install/. 1670119c894STomeu Vizosodone 1680119c894STomeu Vizoso 1690119c894STomeu Vizosotar -C artifacts -cf artifacts/install.tar install 1700119c894STomeu Vizosorm -rf artifacts/install 171