diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-05-07 16:58:35 +0200 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-05-08 22:42:37 +0200 |
| commit | 6b962b7043b26260500e98d882e3ee1c165627c2 (patch) | |
| tree | bd2960f0ef616b3ab5c426ecd1b2f98c5dd1fb8c /scripts/package-build/linux-kernel | |
| parent | 446990644bf2e84e8f508855bef2c444b0758083 (diff) | |
| download | vyos-build-6b962b7043b26260500e98d882e3ee1c165627c2.tar.gz vyos-build-6b962b7043b26260500e98d882e3ee1c165627c2.zip | |
Kernel: T6847: add Intel I40E out-of-tree Kernel driver with custom patches
The current version of the Intel i40e driver does not compile with a recent
LTS Kernel due to missing internal Kernel API adjustments in the Intel driver.
This commit contains custom patches to make the driver build.
Diffstat (limited to 'scripts/package-build/linux-kernel')
9 files changed, 220 insertions, 10 deletions
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.py b/scripts/package-build/linux-kernel/build.py index 605a2194..2b4927eb 100755 --- a/scripts/package-build/linux-kernel/build.py +++ b/scripts/package-build/linux-kernel/build.py @@ -144,11 +144,8 @@ 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_igb', 'build_intel_ixgbe', 'build_intel_ixgbevf', + 'build_intel_i40e']: 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/arm64/vyos_defconfig b/scripts/package-build/linux-kernel/config/arm64/vyos_defconfig index 3afde45c..7f7d1d58 100644 --- a/scripts/package-build/linux-kernel/config/arm64/vyos_defconfig +++ b/scripts/package-build/linux-kernel/config/arm64/vyos_defconfig @@ -1832,8 +1832,7 @@ 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_I40E is not set CONFIG_IAVF=m CONFIG_I40EVF=m CONFIG_ICE=m diff --git a/scripts/package-build/linux-kernel/config/x86/vyos_defconfig b/scripts/package-build/linux-kernel/config/x86/vyos_defconfig index 7631bf28..0b9cbb24 100644 --- a/scripts/package-build/linux-kernel/config/x86/vyos_defconfig +++ b/scripts/package-build/linux-kernel/config/x86/vyos_defconfig @@ -1717,8 +1717,7 @@ 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_I40E is not set CONFIG_IAVF=m CONFIG_I40EVF=m CONFIG_ICE=m diff --git a/scripts/package-build/linux-kernel/package.toml b/scripts/package-build/linux-kernel/package.toml index ffed8b39..834f97c2 100644 --- a/scripts/package-build/linux-kernel/package.toml +++ b/scripts/package-build/linux-kernel/package.toml @@ -53,6 +53,12 @@ scm_url = "http://github.com/intel/ethernet-linux-ixgbevf" build_cmd = "build_intel_ixgbevf" [[packages]] +name = "i40e" +commit_id = "v2.28.16" +scm_url = "http://github.com/intel/ethernet-linux-i40e" +build_cmd = "build_intel_i40e" + +[[packages]] name = "jool" commit_id = "" scm_url = "" 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; + } |
