diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-05-12 06:07:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-12 06:07:48 +0200 |
| commit | d98030b937e45adc600a542edcf892ef2fa86ab3 (patch) | |
| tree | 1a52ca32486189f279e3e063673425685d62476f | |
| parent | b0810fb7930534e97dbd7a69417ec24ceed78163 (diff) | |
| parent | f3a221bf83c58f43059386f00237e0f00818de25 (diff) | |
| download | vyos-build-d98030b937e45adc600a542edcf892ef2fa86ab3.tar.gz vyos-build-d98030b937e45adc600a542edcf892ef2fa86ab3.zip | |
Merge pull request #1185 from c-po/intel-oot
Kernel: T6847: update Intel Out-Of-Tree drivers for IGB, IXGBE, I40e, ICE and IAVF
19 files changed, 601 insertions, 42 deletions
diff --git a/data/architectures/amd64.toml b/data/architectures/amd64.toml index 09a9de93..e8edcd18 100644 --- a/data/architectures/amd64.toml +++ b/data/architectures/amd64.toml @@ -7,6 +7,9 @@ packages = [ "vyos-intel-qat", "vyos-intel-ixgbe", "vyos-intel-ixgbevf", + "vyos-intel-i40e", + "vyos-intel-ice", + "vyos-intel-iavf", "vyos-ipt-netflow", "intel-microcode", "amd64-microcode" diff --git a/scripts/package-build/linux-kernel/build-intel-nic.sh b/scripts/package-build/linux-kernel/build-intel-nic.sh index da391a22..2289659f 100755 --- a/scripts/package-build/linux-kernel/build-intel-nic.sh +++ b/scripts/package-build/linux-kernel/build-intel-nic.sh @@ -46,7 +46,7 @@ if [ -d $PATCH_DIR ]; then fi echo "I: Compile Kernel module for Intel ${DRIVER_NAME} driver" -make KSRC=${KERNEL_DIR} INSTALL_MOD_PATH=${DEBIAN_DIR} INSTALL_FW_PATH=${DEBIAN_DIR} -j $(getconf _NPROCESSORS_ONLN) -C src install +make KSRC=${KERNEL_DIR} BUILD_KERNEL=${KERNEL_VERSION}${KERNEL_SUFFIX} INSTALL_MOD_PATH=${DEBIAN_DIR} INSTALL_FW_PATH=${DEBIAN_DIR} -j $(getconf _NPROCESSORS_ONLN) -C src install if [ "x$?" != "x0" ]; then exit 1 diff --git a/scripts/package-build/linux-kernel/build-intel-qat.sh b/scripts/package-build/linux-kernel/build-intel-qat.sh index e393a4bc..ba4dcefb 100755 --- a/scripts/package-build/linux-kernel/build-intel-qat.sh +++ b/scripts/package-build/linux-kernel/build-intel-qat.sh @@ -110,17 +110,17 @@ fpm --input-type dir --output-type deb --name vyos-intel-${DRIVER_NAME} \ --depends linux-image-${KERNEL_VERSION}${KERNEL_SUFFIX} \ --license "GPL2" -C ${DEBIAN_DIR} --after-install ${DEBIAN_POSTINST} -# echo "I: Cleanup ${DRIVER_NAME} source" -# cd ${CWD} -# if [ -e ${DRIVER_FILE} ]; then -# rm -f ${DRIVER_FILE} -# fi -# if [ -d ${DRIVER_DIR} ]; then -# rm -rf ${DRIVER_DIR} -# fi -# if [ -d ${DEBIAN_DIR} ]; then -# rm -rf ${DEBIAN_DIR} -# fi -# if [ -f ${DEBIAN_POSTINST} ]; then -# rm -f ${DEBIAN_POSTINST} -# fi +echo "I: Cleanup ${DRIVER_NAME} source" +cd ${CWD} +if [ -e ${DRIVER_FILE} ]; then + rm -f ${DRIVER_FILE} +fi +if [ -d ${DRIVER_DIR} ]; then + rm -rf ${DRIVER_DIR} +fi +if [ -d ${DEBIAN_DIR} ]; then + rm -rf ${DEBIAN_DIR} +fi +if [ -f ${DEBIAN_POSTINST} ]; then + rm -f ${DEBIAN_POSTINST} +fi diff --git a/scripts/package-build/linux-kernel/build.py b/scripts/package-build/linux-kernel/build.py index 605a2194..e73b2519 100755 --- a/scripts/package-build/linux-kernel/build.py +++ b/scripts/package-build/linux-kernel/build.py @@ -144,11 +144,7 @@ def build_package(package: dict, dependencies: list) -> None: create_tarball(f'{package["name"]}-{package["commit_id"]}', f'{package["name"]}') elif package['build_cmd'] == 'build_intel_qat': build_intel_qat() - elif package['build_cmd'] == 'build_intel_igb': - build_intel(package['name'], package['commit_id'], package['scm_url']) - elif package['build_cmd'] == 'build_intel_ixgbe': - build_intel(package['name'], package['commit_id'], package['scm_url']) - elif package['build_cmd'] == 'build_intel_ixgbevf': + elif package['build_cmd'] in ['build_intel_nic']: build_intel(package['name'], package['commit_id'], package['scm_url']) elif package['build_cmd'] == 'build_mellanox_ofed': build_mellanox_ofed() diff --git a/scripts/package-build/linux-kernel/config/51-bridge.config b/scripts/package-build/linux-kernel/config/51-bridge.config index 4204ae70..7217df41 100644 --- a/scripts/package-build/linux-kernel/config/51-bridge.config +++ b/scripts/package-build/linux-kernel/config/51-bridge.config @@ -3,8 +3,7 @@ # # Software 802.1D / 802.1Q bridge driver used by VyOS # "interfaces bridge". STP (Spanning Tree Protocol) and LLC -# are auto-selected by net/bridge/Kconfig when CONFIG_BRIDGE -# is enabled, so they don't need to be listed here explicitly. +# are auto-selected by net/bridge/Kconfig # ebtables / bridge-netfilter rules live in 20-netfilter.config. # diff --git a/scripts/package-build/linux-kernel/config/57-openvpn.config b/scripts/package-build/linux-kernel/config/57-openvpn.config index 2de2e7e4..c139b047 100644 --- a/scripts/package-build/linux-kernel/config/57-openvpn.config +++ b/scripts/package-build/linux-kernel/config/57-openvpn.config @@ -3,7 +3,7 @@ # # In-kernel OpenVPN dataplane used by VyOS # "interfaces openvpn" when the kernel offload is available. -# The userspace daemon uses /dev/net/tun (CONFIG_TUN) which +# The userspace daemon uses /dev/net/tun which # stays in the per-arch defconfig. # diff --git a/scripts/package-build/linux-kernel/config/arm64/vyos_defconfig b/scripts/package-build/linux-kernel/config/arm64/vyos_defconfig index 3afde45c..a4b03f3b 100644 --- a/scripts/package-build/linux-kernel/config/arm64/vyos_defconfig +++ b/scripts/package-build/linux-kernel/config/arm64/vyos_defconfig @@ -1832,12 +1832,9 @@ CONFIG_IGB_HWMON=y CONFIG_IGBVF=m # CONFIG_IXGBE is not set # CONFIG_IXGBEVF is not set -CONFIG_I40E=m -# CONFIG_I40E_DCB is not set -CONFIG_IAVF=m -CONFIG_I40EVF=m -CONFIG_ICE=m -CONFIG_ICE_SWITCHDEV=y +# CONFIG_I40E is not set +# CONFIG_I40EVF is not set +# CONFIG_ICE is not set # CONFIG_FM10K is not set CONFIG_IGC=m CONFIG_JME=m @@ -5674,7 +5671,6 @@ CONFIG_OBJAGG=m CONFIG_GENERIC_IOREMAP=y CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y -CONFIG_PLDMFW=y CONFIG_DEBUG_MISC=y diff --git a/scripts/package-build/linux-kernel/config/x86/vyos_defconfig b/scripts/package-build/linux-kernel/config/x86/vyos_defconfig index 7631bf28..22eb3271 100644 --- a/scripts/package-build/linux-kernel/config/x86/vyos_defconfig +++ b/scripts/package-build/linux-kernel/config/x86/vyos_defconfig @@ -1717,13 +1717,9 @@ CONFIG_IGB_DCA=y CONFIG_IGBVF=m # CONFIG_IXGBE is not set # CONFIG_IXGBEVF is not set -CONFIG_I40E=m -# CONFIG_I40E_DCB is not set -CONFIG_IAVF=m -CONFIG_I40EVF=m -CONFIG_ICE=m -CONFIG_ICE_SWITCHDEV=y -CONFIG_ICE_HWTS=y +# CONFIG_I40E is not set +# CONFIG_I40EVF is not set +# CONFIG_ICE is not set # CONFIG_FM10K is not set CONFIG_IGC=m CONFIG_JME=m @@ -4631,8 +4627,6 @@ CONFIG_PARMAN=m CONFIG_OBJAGG=m # end of Library routines -CONFIG_PLDMFW=y - # CONFIG_DEBUG_MISC is not set # diff --git a/scripts/package-build/linux-kernel/package.toml b/scripts/package-build/linux-kernel/package.toml index ffed8b39..085c4074 100644 --- a/scripts/package-build/linux-kernel/package.toml +++ b/scripts/package-build/linux-kernel/package.toml @@ -38,19 +38,37 @@ build_cmd = "build_intel_qat" name = "igb" commit_id = "v5.19.10" scm_url = "https://github.com/intel/ethernet-linux-igb" -build_cmd = "build_intel_igb" +build_cmd = "build_intel_nic" [[packages]] name = "ixgbe" commit_id = "v6.3.6" scm_url = "https://github.com/intel/ethernet-linux-ixgbe" -build_cmd = "build_intel_ixgbe" +build_cmd = "build_intel_nic" [[packages]] name = "ixgbevf" commit_id = "v5.2.2" scm_url = "http://github.com/intel/ethernet-linux-ixgbevf" -build_cmd = "build_intel_ixgbevf" +build_cmd = "build_intel_nic" + +[[packages]] +name = "i40e" +commit_id = "v2.28.16" +scm_url = "http://github.com/intel/ethernet-linux-i40e" +build_cmd = "build_intel_nic" + +[[packages]] +name = "ice" +commit_id = "v2.5.4" +scm_url = "http://github.com/intel/ethernet-linux-ice" +build_cmd = "build_intel_nic" + +[[packages]] +name = "iavf" +commit_id = "v4.13.20" +scm_url = "http://github.com/intel/ethernet-linux-iavf" +build_cmd = "build_intel_nic" [[packages]] name = "jool" diff --git a/scripts/package-build/linux-kernel/patches/i40e/0001-kcompat-have-auxiliary-device-id-when-mod-devicetable-has-it.patch b/scripts/package-build/linux-kernel/patches/i40e/0001-kcompat-have-auxiliary-device-id-when-mod-devicetable-has-it.patch new file mode 100644 index 00000000..3326dd79 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/i40e/0001-kcompat-have-auxiliary-device-id-when-mod-devicetable-has-it.patch @@ -0,0 +1,23 @@ +From: Christian Breunig <christian@breunig.cc> +Date: Sun, 3 May 2026 20:18:00 +0000 +Subject: [PATCH 1/3] kcompat: HAVE_AUXILIARY_DEVICE_ID when mod_devicetable has it + +--- + src/kcompat-generator.sh | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/src/kcompat-generator.sh ++++ b/src/kcompat-generator.sh +@@ -58,9 +58,10 @@ function gen-aux() { + fi + gen HAVE_AUXILIARY_DRIVER_INT_REMOVE if string "$HAVE_AUX_INT_REMOVE" equals 1 + +- # generate HAVE_AUXILIARY_DEVICE_ID only for cases when it's disabled in .config ++ # Whenever mod_devicetable.h defines struct auxiliary_device_id, vendor ++ # auxiliary_bus.h must not redefine it (true for CONFIG_AUXILIARY_BUS=y as well). + HAVE_AUX_DEV_ID=0 +- if ! config_has CONFIG_AUXILIARY_BUS && check struct auxiliary_device_id in "$mh" ; then ++ if check struct auxiliary_device_id in "$mh" ; then + HAVE_AUX_DEV_ID=1 + fi + gen HAVE_AUXILIARY_DEVICE_ID if string "$HAVE_AUX_DEV_ID" equals 1 diff --git a/scripts/package-build/linux-kernel/patches/i40e/0002-auxiliary-bus-type-callback-prototypes.patch b/scripts/package-build/linux-kernel/patches/i40e/0002-auxiliary-bus-type-callback-prototypes.patch new file mode 100644 index 00000000..76a92576 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/i40e/0002-auxiliary-bus-type-callback-prototypes.patch @@ -0,0 +1,73 @@ +From: Christian Breunig <christian@breunig.cc> +Date: Sun, 3 May 2026 19:44:00 +0000 +Subject: [PATCH 3/3] auxiliary: align bus callbacks with kernel prototypes + +--- + src/auxiliary.c | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +--- a/src/auxiliary.c ++++ b/src/auxiliary.c +@@ -7,6 +7,7 @@ + #include <linux/init.h> + #include <linux/slab.h> + #include <linux/module.h> ++#include <linux/version.h> + #include <linux/pm_domain.h> + #include <linux/pm_runtime.h> + #include <linux/string.h> +@@ -31,7 +32,7 @@ static const struct auxiliary_device_id *auxiliary_match_id(const struct auxilia + return NULL; + } + +-static int auxiliary_match(struct device *dev, struct device_driver *drv) ++static int auxiliary_match_common(struct device *dev, struct device_driver *drv) + { + struct auxiliary_device *auxdev = to_auxiliary_dev(dev); + struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv); +@@ -39,7 +40,23 @@ static int auxiliary_match(struct device *dev, struct device_driver *drv) + return !!auxiliary_match_id(auxdrv->id_table, auxdev); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0) ++static int auxiliary_match(struct device *dev, const struct device_driver *drv) ++{ ++ return auxiliary_match_common(dev, (struct device_driver *)drv); ++} ++#else ++static int auxiliary_match(struct device *dev, struct device_driver *drv) ++{ ++ return auxiliary_match_common(dev, drv); ++} ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) ++static int auxiliary_uevent(const struct device *dev, struct kobj_uevent_env *env) ++#else + static int auxiliary_uevent(struct device *dev, struct kobj_uevent_env *env) ++#endif + { + const char *name, *p; + +@@ -78,7 +95,11 @@ static int auxiliary_bus_probe(struct device *dev) + return ret; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) ++static void auxiliary_bus_remove(struct device *dev) ++#else + static int auxiliary_bus_remove(struct device *dev) ++#endif + { + struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); + struct auxiliary_device *auxdev = to_auxiliary_dev(dev); +@@ -87,7 +108,9 @@ static int auxiliary_bus_remove(struct device *dev) + auxdrv->remove(auxdev); + dev_pm_domain_detach(dev, true); + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) + return 0; ++#endif + } + + static void auxiliary_bus_shutdown(struct device *dev) diff --git a/scripts/package-build/linux-kernel/patches/i40e/0003-check_aux_bus-full-ksrc-and-canonical-auxiliary-header.patch b/scripts/package-build/linux-kernel/patches/i40e/0003-check_aux_bus-full-ksrc-and-canonical-auxiliary-header.patch new file mode 100644 index 00000000..01ef8efb --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/i40e/0003-check_aux_bus-full-ksrc-and-canonical-auxiliary-header.patch @@ -0,0 +1,76 @@ +--- a/scripts/check_aux_bus ++++ b/scripts/check_aux_bus +@@ -58,7 +58,14 @@ exit_not_found_failure() { exit 3; } + + find_aux_bus_inc() + { +- aux_bus_inc=$(find -L ${ksrc} -name "auxiliary_bus.h") ++ # Prefer the main tree include (VyOS/kernel build trees may also contain ++ # packaged headers under debian/; an unbounded `find` then returns multiple ++ # paths and `[ -f "$aux_bus_inc" ]` fails, forcing needless OOT auxiliary). ++ if [ -f "${ksrc}/${LINUX_INCLUDE_DIR}/auxiliary_bus.h" ]; then ++ aux_bus_inc="${ksrc}/${LINUX_INCLUDE_DIR}/auxiliary_bus.h" ++ else ++ aux_bus_inc=$(find -L "${ksrc}" -name "auxiliary_bus.h" -print -quit) ++ fi + msg "auxiliary_bus.h location: ${aux_bus_inc}" + } + +@@ -101,28 +108,36 @@ find_kernel_source() + + find_config_file() + { +- # only search for kernel .config file if build_kernel is pointing +- # in the same tree as ksrc (see not about ksrc and build_kernel +- # both set in the scripts header comment) +- if [[ "$ksrc" != *"/lib/modules/${build_kernel}"* ]]; then +- msg "ksrc=$ksrc not the same as location generated from build_kernel=\"/lib/modules/${build_kernel}\", not searching for kernel .config file" +- else +- kbuild_dir="/lib/modules/${build_kernel}/build" ++ kconfig="" + ++ # Installed-modules layout: autoconf under /lib/modules/${build_kernel}/build ++ if [ -n "${build_kernel}" ] && [[ "$ksrc" == *"/lib/modules/${build_kernel}"* ]]; then ++ kbuild_dir="/lib/modules/${build_kernel}/build" + file_locations=(${kbuild_dir}/include/generated/autoconf.h \ + ${kbuild_dir}/include/linux/autoconf.h \ + /boot/bmlinux.autoconf.h) +- + for file in "${file_locations[@]}"; do +- if [ -f ${file} ]; then ++ if [ -f "${file}" ]; then + kconfig=${file} + break + fi + done +- +- if [ -z ${kconfig} ]; then ++ if [ -z "${kconfig}" ]; then + msg "Kernel config file not found at any of the expected locations." + fi ++ return ++ fi ++ ++ # Full source tree as --ksrc (e.g. VyOS KERNEL_DIR): read generated autoconf ++ for file in "${ksrc}/include/generated/autoconf.h" "${ksrc}/include/linux/autoconf.h"; do ++ if [ -f "${file}" ]; then ++ kconfig=${file} ++ msg "Using kernel config from ${kconfig}" ++ break ++ fi ++ done ++ if [ -z "${kconfig}" ]; then ++ msg "Kernel config file not found under ${ksrc}; will probe auxiliary_bus.h only." + fi + } + +@@ -131,7 +146,8 @@ get_config_auxiliary_bus() + # CONFIG_AUXILIARY_BUS=0 corresponds to CONFIG_AUXILIARY_BUS=n + # CONFIG_AUXILIARY_BUS=1 corresponds to CONFIG_AUXILIARY_BUS=y + # CONFIG_AUXILIARY_BUS= corresponds to CONFIG_AUXILIARY_BUS not available in the kernel +- CONFIG_AUXILIARY_BUS=$(grep CONFIG_AUXILIARY_BUS ${kconfig} | awk -F" " '{print $3}') ++ # Match the core symbol only (avoid CONFIG_AUXILIARY_BUS_MODULE, etc.) ++ CONFIG_AUXILIARY_BUS=$(grep -E '^#define CONFIG_AUXILIARY_BUS[[:space:]]' "${kconfig}" | awk '{print $3}') + msg "CONFIG_AUXILIARY_BUS=${CONFIG_AUXILIARY_BUS}" + } + diff --git a/scripts/package-build/linux-kernel/patches/i40e/0004-i40e_client-use-ida_alloc-ida_free.patch b/scripts/package-build/linux-kernel/patches/i40e/0004-i40e_client-use-ida_alloc-ida_free.patch new file mode 100644 index 00000000..2dbdc5a7 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/i40e/0004-i40e_client-use-ida_alloc-ida_free.patch @@ -0,0 +1,37 @@ +From: Christian Breunig <christian@breunig.cc> +Date: Sun, 3 May 2026 20:18:00 +0000 +Subject: [PATCH 2/3] i40e_client: use ida_alloc and ida_free + +--- + src/i40e_client.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/src/i40e_client.c ++++ b/src/i40e_client.c +@@ -288,7 +288,7 @@ static void i40e_auxiliary_dev_release(struct device *dev) + struct i40e_auxiliary_device *i40e_aux_dev = + container_of(aux_dev, struct i40e_auxiliary_device, aux_dev); + +- ida_simple_remove(&i40e_client_ida, aux_dev->id); ++ ida_free(&i40e_client_ida, aux_dev->id); + kfree(i40e_aux_dev); + } + +@@ -311,7 +311,7 @@ static int i40e_register_auxiliary_dev(struct i40e_info *ldev, const char *name) + aux_dev->dev.release = i40e_auxiliary_dev_release; + ldev->aux_dev = aux_dev; + +- ret = ida_simple_get(&i40e_client_ida, 0, 0, GFP_KERNEL); ++ ret = ida_alloc(&i40e_client_ida, GFP_KERNEL); + if (ret < 0) { + kfree(i40e_aux_dev); + return ret; +@@ -321,7 +321,7 @@ static int i40e_register_auxiliary_dev(struct i40e_info *ldev, const char *name) + + ret = auxiliary_device_init(aux_dev); + if (ret < 0) { +- ida_simple_remove(&i40e_client_ida, aux_dev->id); ++ ida_free(&i40e_client_ida, aux_dev->id); + kfree(i40e_aux_dev); + return ret; + } diff --git a/scripts/package-build/linux-kernel/patches/iavf/0001-kcompat-have-auxiliary-device-id-when-mod-devicetable-has-it.patch b/scripts/package-build/linux-kernel/patches/iavf/0001-kcompat-have-auxiliary-device-id-when-mod-devicetable-has-it.patch new file mode 100644 index 00000000..3326dd79 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/iavf/0001-kcompat-have-auxiliary-device-id-when-mod-devicetable-has-it.patch @@ -0,0 +1,23 @@ +From: Christian Breunig <christian@breunig.cc> +Date: Sun, 3 May 2026 20:18:00 +0000 +Subject: [PATCH 1/3] kcompat: HAVE_AUXILIARY_DEVICE_ID when mod_devicetable has it + +--- + src/kcompat-generator.sh | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/src/kcompat-generator.sh ++++ b/src/kcompat-generator.sh +@@ -58,9 +58,10 @@ function gen-aux() { + fi + gen HAVE_AUXILIARY_DRIVER_INT_REMOVE if string "$HAVE_AUX_INT_REMOVE" equals 1 + +- # generate HAVE_AUXILIARY_DEVICE_ID only for cases when it's disabled in .config ++ # Whenever mod_devicetable.h defines struct auxiliary_device_id, vendor ++ # auxiliary_bus.h must not redefine it (true for CONFIG_AUXILIARY_BUS=y as well). + HAVE_AUX_DEV_ID=0 +- if ! config_has CONFIG_AUXILIARY_BUS && check struct auxiliary_device_id in "$mh" ; then ++ if check struct auxiliary_device_id in "$mh" ; then + HAVE_AUX_DEV_ID=1 + fi + gen HAVE_AUXILIARY_DEVICE_ID if string "$HAVE_AUX_DEV_ID" equals 1 diff --git a/scripts/package-build/linux-kernel/patches/iavf/0002-auxiliary-bus-type-callback-prototypes.patch b/scripts/package-build/linux-kernel/patches/iavf/0002-auxiliary-bus-type-callback-prototypes.patch new file mode 100644 index 00000000..76a92576 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/iavf/0002-auxiliary-bus-type-callback-prototypes.patch @@ -0,0 +1,73 @@ +From: Christian Breunig <christian@breunig.cc> +Date: Sun, 3 May 2026 19:44:00 +0000 +Subject: [PATCH 3/3] auxiliary: align bus callbacks with kernel prototypes + +--- + src/auxiliary.c | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +--- a/src/auxiliary.c ++++ b/src/auxiliary.c +@@ -7,6 +7,7 @@ + #include <linux/init.h> + #include <linux/slab.h> + #include <linux/module.h> ++#include <linux/version.h> + #include <linux/pm_domain.h> + #include <linux/pm_runtime.h> + #include <linux/string.h> +@@ -31,7 +32,7 @@ static const struct auxiliary_device_id *auxiliary_match_id(const struct auxilia + return NULL; + } + +-static int auxiliary_match(struct device *dev, struct device_driver *drv) ++static int auxiliary_match_common(struct device *dev, struct device_driver *drv) + { + struct auxiliary_device *auxdev = to_auxiliary_dev(dev); + struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv); +@@ -39,7 +40,23 @@ static int auxiliary_match(struct device *dev, struct device_driver *drv) + return !!auxiliary_match_id(auxdrv->id_table, auxdev); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0) ++static int auxiliary_match(struct device *dev, const struct device_driver *drv) ++{ ++ return auxiliary_match_common(dev, (struct device_driver *)drv); ++} ++#else ++static int auxiliary_match(struct device *dev, struct device_driver *drv) ++{ ++ return auxiliary_match_common(dev, drv); ++} ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) ++static int auxiliary_uevent(const struct device *dev, struct kobj_uevent_env *env) ++#else + static int auxiliary_uevent(struct device *dev, struct kobj_uevent_env *env) ++#endif + { + const char *name, *p; + +@@ -78,7 +95,11 @@ static int auxiliary_bus_probe(struct device *dev) + return ret; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) ++static void auxiliary_bus_remove(struct device *dev) ++#else + static int auxiliary_bus_remove(struct device *dev) ++#endif + { + struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); + struct auxiliary_device *auxdev = to_auxiliary_dev(dev); +@@ -87,7 +108,9 @@ static int auxiliary_bus_remove(struct device *dev) + auxdrv->remove(auxdev); + dev_pm_domain_detach(dev, true); + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) + return 0; ++#endif + } + + static void auxiliary_bus_shutdown(struct device *dev) diff --git a/scripts/package-build/linux-kernel/patches/iavf/0003-check_aux_bus-full-ksrc-and-canonical-auxiliary-header.patch b/scripts/package-build/linux-kernel/patches/iavf/0003-check_aux_bus-full-ksrc-and-canonical-auxiliary-header.patch new file mode 100644 index 00000000..01ef8efb --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/iavf/0003-check_aux_bus-full-ksrc-and-canonical-auxiliary-header.patch @@ -0,0 +1,76 @@ +--- a/scripts/check_aux_bus ++++ b/scripts/check_aux_bus +@@ -58,7 +58,14 @@ exit_not_found_failure() { exit 3; } + + find_aux_bus_inc() + { +- aux_bus_inc=$(find -L ${ksrc} -name "auxiliary_bus.h") ++ # Prefer the main tree include (VyOS/kernel build trees may also contain ++ # packaged headers under debian/; an unbounded `find` then returns multiple ++ # paths and `[ -f "$aux_bus_inc" ]` fails, forcing needless OOT auxiliary). ++ if [ -f "${ksrc}/${LINUX_INCLUDE_DIR}/auxiliary_bus.h" ]; then ++ aux_bus_inc="${ksrc}/${LINUX_INCLUDE_DIR}/auxiliary_bus.h" ++ else ++ aux_bus_inc=$(find -L "${ksrc}" -name "auxiliary_bus.h" -print -quit) ++ fi + msg "auxiliary_bus.h location: ${aux_bus_inc}" + } + +@@ -101,28 +108,36 @@ find_kernel_source() + + find_config_file() + { +- # only search for kernel .config file if build_kernel is pointing +- # in the same tree as ksrc (see not about ksrc and build_kernel +- # both set in the scripts header comment) +- if [[ "$ksrc" != *"/lib/modules/${build_kernel}"* ]]; then +- msg "ksrc=$ksrc not the same as location generated from build_kernel=\"/lib/modules/${build_kernel}\", not searching for kernel .config file" +- else +- kbuild_dir="/lib/modules/${build_kernel}/build" ++ kconfig="" + ++ # Installed-modules layout: autoconf under /lib/modules/${build_kernel}/build ++ if [ -n "${build_kernel}" ] && [[ "$ksrc" == *"/lib/modules/${build_kernel}"* ]]; then ++ kbuild_dir="/lib/modules/${build_kernel}/build" + file_locations=(${kbuild_dir}/include/generated/autoconf.h \ + ${kbuild_dir}/include/linux/autoconf.h \ + /boot/bmlinux.autoconf.h) +- + for file in "${file_locations[@]}"; do +- if [ -f ${file} ]; then ++ if [ -f "${file}" ]; then + kconfig=${file} + break + fi + done +- +- if [ -z ${kconfig} ]; then ++ if [ -z "${kconfig}" ]; then + msg "Kernel config file not found at any of the expected locations." + fi ++ return ++ fi ++ ++ # Full source tree as --ksrc (e.g. VyOS KERNEL_DIR): read generated autoconf ++ for file in "${ksrc}/include/generated/autoconf.h" "${ksrc}/include/linux/autoconf.h"; do ++ if [ -f "${file}" ]; then ++ kconfig=${file} ++ msg "Using kernel config from ${kconfig}" ++ break ++ fi ++ done ++ if [ -z "${kconfig}" ]; then ++ msg "Kernel config file not found under ${ksrc}; will probe auxiliary_bus.h only." + fi + } + +@@ -131,7 +146,8 @@ get_config_auxiliary_bus() + # CONFIG_AUXILIARY_BUS=0 corresponds to CONFIG_AUXILIARY_BUS=n + # CONFIG_AUXILIARY_BUS=1 corresponds to CONFIG_AUXILIARY_BUS=y + # CONFIG_AUXILIARY_BUS= corresponds to CONFIG_AUXILIARY_BUS not available in the kernel +- CONFIG_AUXILIARY_BUS=$(grep CONFIG_AUXILIARY_BUS ${kconfig} | awk -F" " '{print $3}') ++ # Match the core symbol only (avoid CONFIG_AUXILIARY_BUS_MODULE, etc.) ++ CONFIG_AUXILIARY_BUS=$(grep -E '^#define CONFIG_AUXILIARY_BUS[[:space:]]' "${kconfig}" | awk '{print $3}') + msg "CONFIG_AUXILIARY_BUS=${CONFIG_AUXILIARY_BUS}" + } + diff --git a/scripts/package-build/linux-kernel/patches/ice/0001-kcompat-have-auxiliary-device-id-when-mod-devicetable-has-it.patch b/scripts/package-build/linux-kernel/patches/ice/0001-kcompat-have-auxiliary-device-id-when-mod-devicetable-has-it.patch new file mode 100644 index 00000000..3326dd79 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/ice/0001-kcompat-have-auxiliary-device-id-when-mod-devicetable-has-it.patch @@ -0,0 +1,23 @@ +From: Christian Breunig <christian@breunig.cc> +Date: Sun, 3 May 2026 20:18:00 +0000 +Subject: [PATCH 1/3] kcompat: HAVE_AUXILIARY_DEVICE_ID when mod_devicetable has it + +--- + src/kcompat-generator.sh | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/src/kcompat-generator.sh ++++ b/src/kcompat-generator.sh +@@ -58,9 +58,10 @@ function gen-aux() { + fi + gen HAVE_AUXILIARY_DRIVER_INT_REMOVE if string "$HAVE_AUX_INT_REMOVE" equals 1 + +- # generate HAVE_AUXILIARY_DEVICE_ID only for cases when it's disabled in .config ++ # Whenever mod_devicetable.h defines struct auxiliary_device_id, vendor ++ # auxiliary_bus.h must not redefine it (true for CONFIG_AUXILIARY_BUS=y as well). + HAVE_AUX_DEV_ID=0 +- if ! config_has CONFIG_AUXILIARY_BUS && check struct auxiliary_device_id in "$mh" ; then ++ if check struct auxiliary_device_id in "$mh" ; then + HAVE_AUX_DEV_ID=1 + fi + gen HAVE_AUXILIARY_DEVICE_ID if string "$HAVE_AUX_DEV_ID" equals 1 diff --git a/scripts/package-build/linux-kernel/patches/ice/0002-auxiliary-bus-type-callback-prototypes.patch b/scripts/package-build/linux-kernel/patches/ice/0002-auxiliary-bus-type-callback-prototypes.patch new file mode 100644 index 00000000..76a92576 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/ice/0002-auxiliary-bus-type-callback-prototypes.patch @@ -0,0 +1,73 @@ +From: Christian Breunig <christian@breunig.cc> +Date: Sun, 3 May 2026 19:44:00 +0000 +Subject: [PATCH 3/3] auxiliary: align bus callbacks with kernel prototypes + +--- + src/auxiliary.c | 25 ++++++++++++++++++++++++- + 1 file changed, 24 insertions(+), 1 deletion(-) + +--- a/src/auxiliary.c ++++ b/src/auxiliary.c +@@ -7,6 +7,7 @@ + #include <linux/init.h> + #include <linux/slab.h> + #include <linux/module.h> ++#include <linux/version.h> + #include <linux/pm_domain.h> + #include <linux/pm_runtime.h> + #include <linux/string.h> +@@ -31,7 +32,7 @@ static const struct auxiliary_device_id *auxiliary_match_id(const struct auxilia + return NULL; + } + +-static int auxiliary_match(struct device *dev, struct device_driver *drv) ++static int auxiliary_match_common(struct device *dev, struct device_driver *drv) + { + struct auxiliary_device *auxdev = to_auxiliary_dev(dev); + struct auxiliary_driver *auxdrv = to_auxiliary_drv(drv); +@@ -39,7 +40,23 @@ static int auxiliary_match(struct device *dev, struct device_driver *drv) + return !!auxiliary_match_id(auxdrv->id_table, auxdev); + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0) ++static int auxiliary_match(struct device *dev, const struct device_driver *drv) ++{ ++ return auxiliary_match_common(dev, (struct device_driver *)drv); ++} ++#else ++static int auxiliary_match(struct device *dev, struct device_driver *drv) ++{ ++ return auxiliary_match_common(dev, drv); ++} ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) ++static int auxiliary_uevent(const struct device *dev, struct kobj_uevent_env *env) ++#else + static int auxiliary_uevent(struct device *dev, struct kobj_uevent_env *env) ++#endif + { + const char *name, *p; + +@@ -78,7 +95,11 @@ static int auxiliary_bus_probe(struct device *dev) + return ret; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) ++static void auxiliary_bus_remove(struct device *dev) ++#else + static int auxiliary_bus_remove(struct device *dev) ++#endif + { + struct auxiliary_driver *auxdrv = to_auxiliary_drv(dev->driver); + struct auxiliary_device *auxdev = to_auxiliary_dev(dev); +@@ -87,7 +108,9 @@ static int auxiliary_bus_remove(struct device *dev) + auxdrv->remove(auxdev); + dev_pm_domain_detach(dev, true); + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) + return 0; ++#endif + } + + static void auxiliary_bus_shutdown(struct device *dev) diff --git a/scripts/package-build/linux-kernel/patches/ice/0003-check_aux_bus-full-ksrc-and-canonical-auxiliary-header.patch b/scripts/package-build/linux-kernel/patches/ice/0003-check_aux_bus-full-ksrc-and-canonical-auxiliary-header.patch new file mode 100644 index 00000000..01ef8efb --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/ice/0003-check_aux_bus-full-ksrc-and-canonical-auxiliary-header.patch @@ -0,0 +1,76 @@ +--- a/scripts/check_aux_bus ++++ b/scripts/check_aux_bus +@@ -58,7 +58,14 @@ exit_not_found_failure() { exit 3; } + + find_aux_bus_inc() + { +- aux_bus_inc=$(find -L ${ksrc} -name "auxiliary_bus.h") ++ # Prefer the main tree include (VyOS/kernel build trees may also contain ++ # packaged headers under debian/; an unbounded `find` then returns multiple ++ # paths and `[ -f "$aux_bus_inc" ]` fails, forcing needless OOT auxiliary). ++ if [ -f "${ksrc}/${LINUX_INCLUDE_DIR}/auxiliary_bus.h" ]; then ++ aux_bus_inc="${ksrc}/${LINUX_INCLUDE_DIR}/auxiliary_bus.h" ++ else ++ aux_bus_inc=$(find -L "${ksrc}" -name "auxiliary_bus.h" -print -quit) ++ fi + msg "auxiliary_bus.h location: ${aux_bus_inc}" + } + +@@ -101,28 +108,36 @@ find_kernel_source() + + find_config_file() + { +- # only search for kernel .config file if build_kernel is pointing +- # in the same tree as ksrc (see not about ksrc and build_kernel +- # both set in the scripts header comment) +- if [[ "$ksrc" != *"/lib/modules/${build_kernel}"* ]]; then +- msg "ksrc=$ksrc not the same as location generated from build_kernel=\"/lib/modules/${build_kernel}\", not searching for kernel .config file" +- else +- kbuild_dir="/lib/modules/${build_kernel}/build" ++ kconfig="" + ++ # Installed-modules layout: autoconf under /lib/modules/${build_kernel}/build ++ if [ -n "${build_kernel}" ] && [[ "$ksrc" == *"/lib/modules/${build_kernel}"* ]]; then ++ kbuild_dir="/lib/modules/${build_kernel}/build" + file_locations=(${kbuild_dir}/include/generated/autoconf.h \ + ${kbuild_dir}/include/linux/autoconf.h \ + /boot/bmlinux.autoconf.h) +- + for file in "${file_locations[@]}"; do +- if [ -f ${file} ]; then ++ if [ -f "${file}" ]; then + kconfig=${file} + break + fi + done +- +- if [ -z ${kconfig} ]; then ++ if [ -z "${kconfig}" ]; then + msg "Kernel config file not found at any of the expected locations." + fi ++ return ++ fi ++ ++ # Full source tree as --ksrc (e.g. VyOS KERNEL_DIR): read generated autoconf ++ for file in "${ksrc}/include/generated/autoconf.h" "${ksrc}/include/linux/autoconf.h"; do ++ if [ -f "${file}" ]; then ++ kconfig=${file} ++ msg "Using kernel config from ${kconfig}" ++ break ++ fi ++ done ++ if [ -z "${kconfig}" ]; then ++ msg "Kernel config file not found under ${ksrc}; will probe auxiliary_bus.h only." + fi + } + +@@ -131,7 +146,8 @@ get_config_auxiliary_bus() + # CONFIG_AUXILIARY_BUS=0 corresponds to CONFIG_AUXILIARY_BUS=n + # CONFIG_AUXILIARY_BUS=1 corresponds to CONFIG_AUXILIARY_BUS=y + # CONFIG_AUXILIARY_BUS= corresponds to CONFIG_AUXILIARY_BUS not available in the kernel +- CONFIG_AUXILIARY_BUS=$(grep CONFIG_AUXILIARY_BUS ${kconfig} | awk -F" " '{print $3}') ++ # Match the core symbol only (avoid CONFIG_AUXILIARY_BUS_MODULE, etc.) ++ CONFIG_AUXILIARY_BUS=$(grep -E '^#define CONFIG_AUXILIARY_BUS[[:space:]]' "${kconfig}" | awk '{print $3}') + msg "CONFIG_AUXILIARY_BUS=${CONFIG_AUXILIARY_BUS}" + } + |
