From 202b7f59ca31dd7fdf8aff4ecc3487989151cce0 Mon Sep 17 00:00:00 2001 From: David Heidelberg <david@ixit.cz> Date: Mon, 12 Jun 2023 00:17:03 +0200 Subject: [PATCH] ci: build kernels! Change for v6.4: - rename sc7180-trogdor-kingoftown-r1 to sc7180-trogdor-kingoftown - enable BCM2835 on ARM64 (Raspberry Pi) thx @ Eric Change for v6.6: - source symlink in modules directory no longer exists - enable QRTR Signed-off-by: David Heidelberg <david@ixit.cz> --- .gitlab-ci.yml | 78 ++++++++++++++++ .gitlab-ci/build.sh | 128 ++++++++++++++++++++++++++ arch/arm/configs/multi_v7_defconfig | 2 + kernel/configs/mesa3d-ci_arm64.config | 3 +- 4 files changed, 210 insertions(+), 1 deletion(-) create mode 100644 .gitlab-ci.yml create mode 100755 .gitlab-ci/build.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000..714865b7b2bad --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,78 @@ +.templates_sha: &templates_sha 08fce249df1067b52423a6532fb66ad6bd96a79f + +variables: + TEMPLATES_SHA: *templates_sha + FDO_UPSTREAM_REPO: gfx-ci/linux + DEBIAN_DISTRO: bookworm + S3_HOST: s3.freedesktop.org + + +include: + - project: 'freedesktop/ci-templates' + ref: *templates_sha + file: + - '/templates/debian.yml' + +stages: + - prepare + - build + +.debian-image: + variables: + FDO_DISTRIBUTION_TAG: '2023-06-10.4' + FDO_DISTRIBUTION_VERSION: 'bookworm-slim' + +debian-image: + stage: prepare + rules: + - if: '$CI_COMMIT_TAG' + when: always + - when: manual + extends: + - .fdo.container-build@debian + - .debian-image + variables: + FDO_DISTRIBUTION_EXEC: 'pip3 install --break-system-packages git+http://gitlab.freedesktop.org/freedesktop/ci-templates@$TEMPLATES_SHA' + FDO_DISTRIBUTION_PACKAGES: 'git python3-pip ccache apt-utils curl build-essential linux-source bc kmod cpio flex libncurses5-dev libelf-dev libssl-dev dwarves bison crossbuild-essential-armhf crossbuild-essential-arm64 u-boot-tools zstd' + GIT_STRATEGY: none + FDO_DISTRIBUTION_EXEC: 'pip3 install --break-system-packages git+http://gitlab.freedesktop.org/freedesktop/ci-templates@08fce249df1067b52423a6532fb66ad6bd96a79f' + +build-kernel: + stage: build + extends: + - .fdo.distribution-image@debian + - .debian-image + tags: + - packet.net + before_script: + - export PATH="/usr/lib/ccache:$PATH" + - export CCACHE_BASEDIR="$PWD" + - export CCACHE_DIR="$PWD/ccache" + - export CCACHE_COMPILERCHECK=content + - ccache --show-stats || true + after_script: + - export CCACHE_DIR="$PWD/ccache" + - ccache --show-stats + script: + - .gitlab-ci/build.sh + artifacts: + name: $CI_JOB_NAME + paths: + - .config + - defconfig + - kernels + - dtbs + - modules.tar.zst + expire_in: 9 months + cache: + key: $CI_JOB_NAME_SLUG + paths: + - ccache/ + parallel: + matrix: + - DEBIAN_ARCH: amd64 + KERNEL_ARCH: x86_64 + - DEBIAN_ARCH: armhf + KERNEL_ARCH: arm + - DEBIAN_ARCH: arm64 + KERNEL_ARCH: arm64 diff --git a/.gitlab-ci/build.sh b/.gitlab-ci/build.sh new file mode 100755 index 0000000000000..ab3364fe9ad14 --- /dev/null +++ b/.gitlab-ci/build.sh @@ -0,0 +1,128 @@ +#!/usr/bin/env bash +set -ex + +if [ -z "$KERNEL_ARCH" ] || [ -z "$S3_HOST" ]; then + exit 1 +fi + +# preparation +mkdir -p kernels modules dtbs +rm -f .config defconfig kernels/* modules/* dtbs/* + +LOCALVERSION=$(git branch --show-current) +export LOCALVERSION +export MAKEFLAGS="-j${FDO_CI_CONCURRENT:-4}" + +GIT_TAG=$(git describe --tags --always) +# FIXME: drop DEBIAN_ARCH +S3_PATH="${S3_HOST}/mesa-lava/${CI_PROJECT_PATH}/${GIT_TAG}/${DEBIAN_ARCH}" + +if [ "${KERNEL_ARCH}" == "x86_64" ]; then + DEFCONFIG="arch/x86/configs/x86_64_defconfig" + KERNEL_IMAGE_NAME=( bzImage ) +elif [ "${KERNEL_ARCH}" == "arm" ]; then + CROSS_COMPILE=arm-linux-gnueabihf- + DEFCONFIG="arch/arm/configs/multi_v7_defconfig" + KERNEL_IMAGE_NAME=( zImage ) + DT_PATH="arch/arm/boot/dts" + DT=( + allwinner/sun8i-h3-libretech-all-h3-cc.dtb + broadcom/bcm2837-rpi-3-b.dtb + broadcom/bcm2711-rpi-4-b.dtb + rockchip/rk3288-veyron-jaq.dtb + nxp/imx/imx6q-cubox-i.dtb + nvidia/tegra124-jetson-tk1.dtb + ) + +elif [ "${KERNEL_ARCH}" == "arm64" ]; then + CROSS_COMPILE=aarch64-linux-gnu- + DEFCONFIG="arch/arm64/configs/defconfig" + KERNEL_IMAGE_NAME=( Image ) + DT_PATH="arch/arm64/boot/dts" + DT=( + rockchip/rk3399-gru-kevin.dtb + amlogic/meson-g12b-a311d-khadas-vim3.dtb + amlogic/meson-gxl-s805x-libretech-ac.dtb + amlogic/meson-gxm-khadas-vim2.dtb + allwinner/sun50i-h6-pine-h64.dtb + broadcom/bcm2837-rpi-3-b.dtb + broadcom/bcm2711-rpi-4-b.dtb + freescale/imx8mq-librem5-devkit.dtb + freescale/imx8mq-nitrogen.dtb + mediatek/mt8192-asurada-spherion-r0.dtb + mediatek/mt8183-kukui-jacuzzi-juniper-sku16.dtb + nvidia/tegra210-p3450-0000.dtb + qcom/apq8016-sbc.dtb + qcom/apq8096-db820c.dtb + qcom/sc7180-trogdor-lazor-limozeen-nots-r5.dtb + qcom/sc7180-trogdor-kingoftown.dtb + qcom/sdm845-cheza-r3.dtb + qcom/sm8350-hdk.dtb + ) +else + exit 1 +fi + +make() { + command make ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "$@" +} +export ARCH="${KERNEL_ARCH}" +export CROSS_COMPILE="${CROSS_COMPILE}" + +# defconfig +./scripts/kconfig/merge_config.sh ${DEFCONFIG} kernel/configs/mesa3d-ci_"${KERNEL_ARCH}".config + +#build +make "${KERNEL_IMAGE_NAME[@]}" +for image in "${KERNEL_IMAGE_NAME[@]}"; do + cp -v "arch/${KERNEL_ARCH}/boot/${image}" kernels/ +done + +for dtb_file in "${DT[@]}"; do + make "$dtb_file" + cp -v "${DT_PATH}/${dtb_file}" dtbs/ +done + +# workarounds and specific stuff +if [[ ${KERNEL_ARCH} = "arm64" ]]; then + { # Google's Cheza + make Image.lzma # Google's Cheza + 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 \ + kernels/cheza-kernel + KERNEL_IMAGE_NAME+=( cheza-kernel ) + } + { # db410c + gzip -k kernels/Image + KERNEL_IMAGE_NAME+=( Image.gz ) + } +fi + +# modules +make modules +make INSTALL_MOD_PATH=modules modules_install +rm modules/lib/modules/*/build +tar --zstd -cvf modules.tar.zst -C modules . +rm modules -rf + +# defconfig template +make savedefconfig + +# upload +FILES_TO_UPLOAD=( modules.tar.zst kernels/* ) +if [ "${KERNEL_ARCH}" != "x86_64" ]; then + FILES_TO_UPLOAD+=( dtbs/* ) +fi + +for f in "${FILES_TO_UPLOAD[@]}"; do + ci-fairy s3cp --token "${CI_JOB_JWT:?}" "$f" "https://${S3_PATH}/$(basename -a "$f")" +done + +git clean --quiet -fdx -e 'ccache/' -e '.config' -e 'defconfig' -e 'modules.tar.zst' -e 'kernels/' -e 'dtbs/' + +echo "GIT_TAG: ${GIT_TAG}" diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 23fc49f23d255..934f129a06d7f 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -1,6 +1,8 @@ CONFIG_SYSVIPC=y CONFIG_NO_HZ_IDLE=y CONFIG_HIGH_RES_TIMERS=y +CONFIG_IKCONFIG=m +CONFIG_IKCONFIG_PROC=y CONFIG_CGROUPS=y CONFIG_BLK_DEV_INITRD=y CONFIG_EXPERT=y diff --git a/kernel/configs/mesa3d-ci_arm64.config b/kernel/configs/mesa3d-ci_arm64.config index 5e48362a7f6c5..927d3853c4f27 100644 --- a/kernel/configs/mesa3d-ci_arm64.config +++ b/kernel/configs/mesa3d-ci_arm64.config @@ -90,7 +90,8 @@ CONFIG_PHY_QCOM_USB_HS=y CONFIG_QCOM_GPI_DMA=y CONFIG_NVMEM_QCOM_QFPROM=y CONFIG_PHY_QCOM_USB_SNPS_FEMTO_V2=y - +CONFIG_QRTR=y +CONFIG_QRTR_SMD=y # sc7180 chromebooks ethernet CONFIG_USB_ONBOARD_HUB=y -- GitLab