summary refs log tree commit diff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorCristian Ciocaltea <cristian.ciocaltea@collabora.com>2022-10-27 22:47:47 +0300
committerCristian Ciocaltea <cristian.ciocaltea@collabora.com>2022-12-12 17:57:13 +0200
commitd3f35dd7b2ebc71edfea06d7e12bed9a5710b781 (patch)
tree2f44a34d9e1df8b9abf458c5bc0a26e2755bb5f6 /.gitlab-ci.yml
parent9196ed5bbb5103a3f567d15b321ab071d8cf2aa7 (diff)
downloadlinux-d3f35dd7b2ebc71edfea06d7e12bed9a5710b781.tar.gz
gitlab-ci: Build required firmware blobs into the kernel image
Since all the kernel drivers are built into the kernel, we also need to
provide the firmware blobs required by some of those drivers, e.g.
amdgpu, rtw88, cirrus.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml27
1 files changed, 22 insertions, 5 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a2cbeb74ca6c..463a879fc717 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,8 @@
 variables:
   DOCKER_DRIVER: overlay2
   KERNEL: "bzImage"
+  LINUX_FIRMWARE_URL: "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
+  LINUX_FIRMWARE_DL_DIR: "dl/linux-firmware"
   ROOTFS_NAME: "stretch.img"
   ROOTFS_IMAGE_URL: "https://gitlab.steamos.cloud/api/v4/projects/kernel-research%2Frootfs/jobs/128684/artifacts"
   GIT_AUTHOR_NAME: "Gitlab-ci"
@@ -17,26 +19,41 @@ kernel build:
   stage: build
   tags:
     - autoscaled
+
   before_script:
     - apt-get update -y
     - apt-get install -y rsync git build-essential bc kmod cpio flex libncurses5-dev bison libssl-dev libelf-dev openssh-client curl qemu-system* unzip python3 zstd
+
   script:
+    # Prepare the firmware files to be included in the kernel image
+    - git clone --depth=1 ${LINUX_FIRMWARE_URL} ${LINUX_FIRMWARE_DL_DIR}
+    - |
+      FW_FILES="amdgpu/vangogh_asd.bin amdgpu/vangogh_ce.bin amdgpu/vangogh_dmcub.bin amdgpu/vangogh_me.bin amdgpu/vangogh_mec2.bin amdgpu/vangogh_mec.bin amdgpu/vangogh_pfp.bin amdgpu/vangogh_rlc.bin amdgpu/vangogh_sdma.bin amdgpu/vangogh_toc.bin amdgpu/vangogh_vcn.bin" &&
+      FW_FILES="${FW_FILES} rtw88/rtw8822c_fw.bin rtw88/rtw8822c_wow_fw.bin" &&
+      FW_FILES="${FW_FILES} rtl_bt/rtl8822cu_fw.bin rtl_bt/rtl8822cu_config.bin" &&
+      FW_FILES="${FW_FILES} cirrus/cs35l41-dsp1-spk-prot.wmfw cirrus/cs35l41-dsp1-spk-prot.bin" &&
+      printf "%s\n" \
+        "CONFIG_EXTRA_FIRMWARE_DIR=\"${LINUX_FIRMWARE_DL_DIR}\"" \
+        "CONFIG_EXTRA_FIRMWARE=\"${FW_FILES}\"" &> .config-fragment-firmware
+    # Prepare kernel config
     - make x86_64_defconfig && make kvm_guest.config
-    - ./scripts/kconfig/merge_config.sh .config .config-fragment
+    - ./scripts/kconfig/merge_config.sh .config .config-fragment .config-fragment-firmware
+    - cp .config kernel_config
+    # Build kernel
     - make -j $(nproc)
     - git rev-parse HEAD &> commit_id_file
     - cp -v arch/x86/boot/bzImage .
-    - cp .config kernel_config
-    # download rootfs
+    # Download rootfs
     - 'curl -L --header "PRIVATE-TOKEN: ${KERNEL_RESEARCH_ROOTFS_TOKEN}" "${ROOTFS_IMAGE_URL}" --output artifact.zip'
     - unzip artifact.zip
+    # Start QEMU
     - qemu-system-x86_64 -enable-kvm -nographic -kernel ${KERNEL} -drive file=${ROOTFS_NAME},format=raw -device virtio-serial-pci -virtfs local,path=$(pwd),mount_tag=steamlogs,security_model=none -m 2G -smp $(nproc --ignore=1) -cpu host -net user,hostfwd=tcp::2222-:22 -net nic,model=virtio --append "root=/dev/sda rw console=ttyS0" &
     - QEMU_PID=$!
     - echo "QEMU pid is $QEMU_PID"
+    # Dump kernel test results
     - sleep 90
     - tail --pid=$QEMU_PID -f kernel_results.log
-
-    # notify
+    # Notify
     - test -f "fail.txt" && exit 1
     - echo "All tests passed."