summaryrefslogtreecommitdiff
path: root/scripts/package-build/linux-kernel
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/package-build/linux-kernel')
-rw-r--r--scripts/package-build/linux-kernel/README.md5
-rwxr-xr-xscripts/package-build/linux-kernel/build-kernel.sh11
-rwxr-xr-xscripts/package-build/linux-kernel/build.py14
3 files changed, 23 insertions, 7 deletions
diff --git a/scripts/package-build/linux-kernel/README.md b/scripts/package-build/linux-kernel/README.md
index 56ef649b..b1172f32 100644
--- a/scripts/package-build/linux-kernel/README.md
+++ b/scripts/package-build/linux-kernel/README.md
@@ -10,6 +10,11 @@ VyOS runs on a custom Linux Kernel. The version built is pinned by
repository holds the build scripts used to build the custom Kernel for
x86_64/amd64 and arm64, plus all required out-of-tree modules.
+The resulting Kernel release is `<kernel_version>-<kernel_revision>-<kernel_flavor>`,
+e.g. `6.18.60-1-vyos`. `kernel_revision` is a VyOS internal number: bump it when
+rebuilding the same upstream version with additional patches (e.g. security
+fixes) and reset it to 1 when `kernel_version` changes.
+
VyOS does not utilize the build in Intel Kernel drivers for its NICs as those
Kernels sometimes lack features e.g. configurable receive-side-scaling queues.
On the other hand we ship additional not mainlined features as WireGuard VPN.
diff --git a/scripts/package-build/linux-kernel/build-kernel.sh b/scripts/package-build/linux-kernel/build-kernel.sh
index dea71aa9..14817b06 100755
--- a/scripts/package-build/linux-kernel/build-kernel.sh
+++ b/scripts/package-build/linux-kernel/build-kernel.sh
@@ -27,8 +27,15 @@ if [ -z "${KERNEL_FLAVOR}" ]; then
exit 1
fi
+if [ -z "${KERNEL_REVISION}" ]; then
+ echo "E: KERNEL_REVISION is not set, run via ./build.py so it can be passed from data/defaults.toml"
+ exit 1
+fi
+
KERNEL_VERSION=$(make kernelversion)
-KERNEL_SUFFIX=-${KERNEL_FLAVOR}
+# VyOS internal revision, e.g. 6.18.60-1-vyos - bumped when rebuilding the same
+# upstream version with additional patches
+KERNEL_SUFFIX=-${KERNEL_REVISION}-${KERNEL_FLAVOR}
echo "I: Generate Kernel config"
ARCH=$(dpkg --print-architecture)
@@ -131,7 +138,7 @@ EOF
echo "I: Build Debian Kernel package"
touch .scmversion
-make bindeb-pkg BUILD_TOOLS=1 LOCALVERSION=${KERNEL_SUFFIX} KDEB_PKGVERSION=${KERNEL_VERSION}-1 -j $(getconf _NPROCESSORS_ONLN)
+make bindeb-pkg BUILD_TOOLS=1 LOCALVERSION=${KERNEL_SUFFIX} KDEB_PKGVERSION=${KERNEL_VERSION}-${KERNEL_REVISION} -j $(getconf _NPROCESSORS_ONLN)
# Back to the old Kernel build-scripts directory
cd $CWD
diff --git a/scripts/package-build/linux-kernel/build.py b/scripts/package-build/linux-kernel/build.py
index 295f44b9..fa19b97d 100755
--- a/scripts/package-build/linux-kernel/build.py
+++ b/scripts/package-build/linux-kernel/build.py
@@ -137,7 +137,8 @@ def build_package(package: dict, dependencies: list,
# Execute the build command
if package['build_cmd'] == 'build_kernel':
- source_dir = build_kernel(package['kernel_version'], package['kernel_flavor'])
+ source_dir = build_kernel(package['kernel_version'], package['kernel_revision'],
+ package['kernel_flavor'])
if linux_kernel_tarball is not None:
linux_kernel_tarball.clear()
linux_kernel_tarball['package_name'] = package['name']
@@ -191,7 +192,7 @@ def merge_dicts(defaults, package):
return {**defaults, **package}
-def build_kernel(kernel_version, kernel_flavor) -> str:
+def build_kernel(kernel_version, kernel_revision, kernel_flavor) -> str:
"""Build the Linux kernel"""
source_dir = 'linux' # Git source repo name - preferred over TAR
if not os.path.exists(source_dir):
@@ -205,9 +206,12 @@ def build_kernel(kernel_version, kernel_flavor) -> str:
source_dir = f'linux-{kernel_version}'
os.symlink(source_dir, 'linux')
- # kernel_flavor is only known here (merged from data/defaults.toml); pass it down
- # via the environment so build-kernel.sh doesn't need to re-read defaults.toml itself.
- run(['./build-kernel.sh'], check=True, env={**os.environ, 'KERNEL_FLAVOR': kernel_flavor})
+ # kernel_revision and kernel_flavor are only known here (merged from data/defaults.toml);
+ # pass them down via the environment so build-kernel.sh doesn't need to re-read
+ # defaults.toml itself.
+ run(['./build-kernel.sh'], check=True, env={**os.environ,
+ 'KERNEL_REVISION': kernel_revision,
+ 'KERNEL_FLAVOR': kernel_flavor})
return(source_dir)