summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsdc <taras@vyos.io>2023-04-26 01:49:54 +0300
committerzsdc <taras@vyos.io>2023-04-26 01:49:54 +0300
commit8f78333e6dcfe04a1a5f518d325e15dc1f92c4a4 (patch)
treee715f0541239ddb505d273c62e918a824f35298b
parentbd9b3b3f6e7f6ca54c3c41065ec82f545adc73ae (diff)
downloadvyos-build-8f78333e6dcfe04a1a5f518d325e15dc1f92c4a4.tar.gz
vyos-build-8f78333e6dcfe04a1a5f518d325e15dc1f92c4a4.zip
ice: T5182: added build for Intel ICE driver
This commit adds a build task for an out-of-tree Intel ICE driver for E810 Ethernet Controllers.
-rw-r--r--docker/Dockerfile5
-rw-r--r--packages/linux-kernel/Jenkinsfile16
-rwxr-xr-xpackages/linux-kernel/build-intel-ice.py76
3 files changed, 97 insertions, 0 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 1416ae04..487bf0a8 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -649,6 +649,11 @@ RUN apt-get update && apt-get install -y \
RUN gem install public_suffix -v 4.0.7
RUN gem install --no-document fpm
+# debmake: a native Debian tool for preparing sources for packaging
+RUN apt-get update && apt-get install -y \
+ debmake \
+ python3-debian
+
# Allow password-less 'sudo' for all users in group 'sudo'
RUN echo -e "vyos_bld\tALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/vyos_bld && \
chmod a+s /usr/sbin/useradd /usr/sbin/groupadd
diff --git a/packages/linux-kernel/Jenkinsfile b/packages/linux-kernel/Jenkinsfile
index 75fb99fb..d7b6d36d 100644
--- a/packages/linux-kernel/Jenkinsfile
+++ b/packages/linux-kernel/Jenkinsfile
@@ -236,6 +236,22 @@ pipeline {
}
}
}
+ stage('Intel ICE driver') {
+ when {
+ beforeOptions true
+ beforeAgent true
+ anyOf {
+ changeset pattern: "**/packages/linux-kernel/*"
+ changeset pattern: "**/data/defaults.json"
+ triggeredBy cause: "UserIdCause"
+ }
+ }
+ steps {
+ dir(env.BASE_DIR) {
+ sh "./build-intel-ice.py"
+ }
+ }
+ }
}
}
// This stage should not be run in the parallel section as it will call "make"
diff --git a/packages/linux-kernel/build-intel-ice.py b/packages/linux-kernel/build-intel-ice.py
new file mode 100755
index 00000000..0975c343
--- /dev/null
+++ b/packages/linux-kernel/build-intel-ice.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+
+from json import loads as json_loads
+from requests import get
+from pathlib import Path
+from subprocess import run
+
+# define variables
+DRIVER_VERSION: str = '1.11.14'
+DRIVER_URL: str = f'https://downloads.sourceforge.net/project/e1000/ice%20stable/{DRIVER_VERSION}/ice-{DRIVER_VERSION}.tar.gz'
+DRIVER_ARCHIVE: str = f'ice-{DRIVER_VERSION}.tar.gz'
+DRIVER_DIR: str = f'vyos-drivers-intel-ice-{DRIVER_VERSION}'
+
+# find kernel version ans source path
+default_file: str = Path('../../data/defaults.json').read_text()
+KERNEL_VER: str = json_loads(default_file).get('kernel_version')
+KERNEL_SRC: str = Path.cwd().as_posix() + '/linux'
+
+# download driver
+driver_archive = Path(DRIVER_ARCHIVE)
+driver_archive.write_bytes(get(DRIVER_URL).content)
+
+# prepare sources
+debmake_cmd = [
+ 'debmake', '-e', 'support@vyos.io', '-f', 'VyOS Support', '-p',
+ 'vyos-drivers-intel-ice', '-a', DRIVER_ARCHIVE
+]
+run(debmake_cmd)
+
+# fix build rules
+build_rules_text = f'''#!/usr/bin/make -f
+# config
+export KSRC := {KERNEL_SRC}
+INSTALL_DIR := debian/vyos-drivers-intel-ice
+DRIVER := ice
+KVER := {KERNEL_VER}-amd64-vyos
+KSRC_INSTALL := /lib/modules/${{KVER}}/build/
+INTEL_DIR := updates/drivers/net/ethernet/intel
+# DDP variables
+DDP_PKG_ORIGIN := $(shell ls ddp/${{DRIVER}}-[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\.pkg 2>/dev/null)
+DDP_PKG_NAME := $(shell basename ${{DDP_PKG_ORIGIN}} 2>/dev/null)
+DDP_PKG_DEST_PATH := ${{INSTALL_DIR}}/lib/firmware/updates/intel/${{DRIVER}}/ddp
+DDP_PKG_DEST := ${{DDP_PKG_DEST_PATH}}/${{DDP_PKG_NAME}}
+DDP_PKG_LINK := ${{DRIVER}}.pkg
+
+# main packaging script based on dh7 syntax
+%:
+ dh $@
+
+override_dh_auto_clean:
+ cd src && \
+ make clean
+
+override_dh_auto_build:
+ cd src && \
+ make all
+
+override_dh_auto_install:
+ # DDP
+ install -D -m 644 ${{DDP_PKG_ORIGIN}} ${{DDP_PKG_DEST}}
+ (cd ${{DDP_PKG_DEST_PATH}} && ln -sf ${{DDP_PKG_NAME}} ${{DDP_PKG_LINK}})
+ install -D -m 644 ddp/LICENSE ${{DDP_PKG_DEST_PATH}}/LICENSE
+ # module
+ install -D -m 644 src/${{DRIVER}}.ko ${{INSTALL_DIR}}/lib/modules/${{KVER}}/${{INTEL_DIR}}/ice/${{DRIVER}}.ko
+ # AUX
+ install -D -m 644 src/intel_auxiliary.ko ${{INSTALL_DIR}}/lib/modules/${{KVER}}/${{INTEL_DIR}}/auxiliary/intel_auxiliary.ko
+ install -D -m 644 src/Module.symvers ${{INSTALL_DIR}}/lib/modules/${{KVER}}/extern-symvers/intel_auxiliary.symvers
+ install -D -m 644 src/linux/auxiliary_bus.h ${{INSTALL_DIR}}/${{KSRC_INSTALL}}/include/linux/auxiliary_bus.h
+
+'''
+bild_rules = Path(f'{DRIVER_DIR}/debian/rules')
+bild_rules.write_text(build_rules_text)
+
+# build a package
+debuild_cmd = ['debuild']
+run(debuild_cmd, cwd=DRIVER_DIR)