From 48a0ff08fdae613eba090fca8736b5ec2b1bacf8 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 10 Sep 2026 18:18:29 +0200 Subject: Kernel: T9298: make linux-firmware package architecture aware Currently when the Kernel is build and creates the vyos-linux-firmware package, the Kernel modules are inspected and the firmware file string is extracted. This is the case for years. Now with ARM64 on the doorstep, we would assemble the vyos-linux-firmware package twice, once for x86_64 and once for amd64. The generated package is for CPU architecture all - as the package is build twice, the longer running build will win -> perfect race condition. --- data/architectures/arm64.toml | 1 + .../linux-kernel/build-linux-firmware.sh | 25 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/data/architectures/arm64.toml b/data/architectures/arm64.toml index 1aa67021..c60ad9fd 100644 --- a/data/architectures/arm64.toml +++ b/data/architectures/arm64.toml @@ -1,6 +1,7 @@ # Packages included in ARM64 images by default packages = [ "grub-efi-arm64", + "vyos-linux-firmware", "vyos-ipt-netflow" ] bootloaders = "grub-efi" diff --git a/scripts/package-build/linux-kernel/build-linux-firmware.sh b/scripts/package-build/linux-kernel/build-linux-firmware.sh index d542327d..db6f69f9 100755 --- a/scripts/package-build/linux-kernel/build-linux-firmware.sh +++ b/scripts/package-build/linux-kernel/build-linux-firmware.sh @@ -27,7 +27,10 @@ FW_FILES=$(find ${KERNEL_DIR}/debian/linux-image-${KERNEL_VERSION}${KERNEL_SUFFI # Debian package will use the descriptive Git commit as version GIT_COMMIT=$(cd ${CWD}/${LINUX_FIRMWARE}; git describe --always) VYOS_FIRMWARE_NAME="vyos-linux-firmware" -VYOS_FIRMWARE_DIR="${VYOS_FIRMWARE_NAME}_${GIT_COMMIT}-0_all" +# The firmware blobs are selected from the modules of the kernel built on this +# host, so the package content differs per architecture - build it arch-dependent. +BUILD_ARCH=$(dpkg --print-architecture) +VYOS_FIRMWARE_DIR="${VYOS_FIRMWARE_NAME}_${GIT_COMMIT}-0_${BUILD_ARCH}" if [ -d ${VYOS_FIRMWARE_DIR} ]; then # remove Debian package folder and deb file from previous runs rm -rf ${VYOS_FIRMWARE_DIR}* @@ -107,7 +110,7 @@ Standards-Version: 4.5.1 Rules-Requires-Root: no Package: ${VYOS_FIRMWARE_NAME} -Architecture: all +Architecture: any Depends: \${misc:Depends} Description: Binary firmware for various drivers in the Linux kernel Firmware blobs assembled from linux-firmware.git for the drivers built @@ -127,6 +130,24 @@ override_dh_auto_build: override_dh_auto_install: mkdir -p \${PACKAGE_BUILD_DIR} cp -a lib \${PACKAGE_BUILD_DIR}/ + +# Firmware blobs must be shipped verbatim. Some of them are valid ELF objects, +# so the binary mangling helpers - which only run for arch-dependent packages - +# would happily strip them or try to resolve library dependencies on them. +override_dh_strip: + @true + +override_dh_dwz: + @true + +override_dh_strip_nondeterminism: + @true + +override_dh_shlibdeps: + @true + +override_dh_makeshlibs: + @true EOF debuild -- cgit v1.2.3