Skip to content

Commit c674687

Browse files
authored
Trim linux headers to LTS kernel versions for 4.x and 5.x and include new LTS versions for 6.x kernels. (#2350)
Summary: Trim linux headers to LTS kernel versions for 4.x and 5.x and include new LTS versions for 6.x kernels. Relevant Issues: #2275, #2344 Type of change: /kind dependency Test Plan: Deploy a vizier on the following platforms and compared pl7 headers vs the new pl8 - [x] Bottlerocket - [x] Amazon Linux - [x] k0s (6.12 kernel) - [x] Google COS - Verified that the new build process via `make prepare` creates similarly sized tar files and has roughly the same files present (some files were missing like .config, Makefile, Module.symvers, Kconfig, compile.h, but not of these are used by the PEM) <details><summary>Bottlerocket /etc/os-release</summary> ``` I20260410 02:06:57.094861 9891 system_info.cc:35] /host/etc/os-release: NAME=Bottlerocket ID=bottlerocket VERSION="1.57.0 (aws-k8s-1.33)" PRETTY_NAME="Bottlerocket OS 1.57.0 (aws-k8s-1.33)" VARIANT_ID=aws-k8s-1.33 VERSION_ID=1.57.0 BUILD_ID=beaadc52 VENDOR_NAME=Bottlerocket HOME_URL="https://github.com/bottlerocket-os/bottlerocket" SUPPORT_URL="https://github.com/bottlerocket-os/bottlerocket/discussions" BUG_REPORT_URL="https://github.com/bottlerocket-os/bottlerocket/issues" DOCUMENTATION_URL="https://bottlerocket.dev" ``` </details> <details><summary>Google COS /etc/os-release</summary> ``` I20260410 01:17:27.298167 14802 system_info.cc:35] /host/etc/os-release: NAME="Container-Optimized OS" ID=cos PRETTY_NAME="Container-Optimized OS from Google" HOME_URL="https://cloud.google.com/container-optimized-os/docs" BUG_REPORT_URL="https://cloud.google.com/container-optimized-os/docs/resources/support-policy#contact_us" GOOGLE_METRICS_PRODUCT_ID=26 KERNEL_COMMIT_ID=46c2d01887bed5038cc2b8bbd801ae2f7985e7f0 GOOGLE_CRASH_ID=Lakitu VERSION=125 VERSION_ID=125 BUILD_ID=19216.104.126 ``` </details> <details><summary>header size comparision</summary> ``` Size Comparison ┌──────────┬────────┬───────────┬─────────┬─────────┐ │ Version │ Arch │ pl8 opt │ pl8 orig │ pl7 │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 4.18.20 │ x86_64 │ 7.6M │ 9.9M │ 7.7M │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 4.18.20 │ arm64 │ 7.3M │ 8.1M │ 7.5M │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 5.10.252 │ x86_64 │ 8.7M │ 12M │ N/A │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 5.10.252 │ arm64 │ 8.4M │ 9.9M │ N/A │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 5.14.21 │ x86_64 │ 8.9M │ 12M │ 8.8M │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 5.14.21 │ arm64 │ 8.6M │ 11M │ 8.8M │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 6.1.167 │ x86_64 │ 9.7M │ 13M │ N/A │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 6.1.167 │ arm64 │ 9.4M │ 12M │ N/A │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 6.6.132 │ x86_64 │ 11M │ 13M │ N/A │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 6.6.132 │ arm64 │ 9.8M │ 13M │ N/A │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 6.12.80 │ x86_64 │ 11M │ 14M │ N/A │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 6.12.80 │ arm64 │ 11M │ 14M │ N/A │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 6.18.21 │ x86_64 │ 12M │ 14M │ N/A │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 6.18.21 │ arm64 │ 11M │ 16M │ N/A │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 6.19.10 │ x86_64 │ 12M │ 14M │ N/A │ ├──────────┼────────┼───────────┼─────────┼─────────┤ │ 6.19.10 │ arm64 │ 12M │ 16M │ N/A │ └──────────┴────────┴───────────┴─────────┴─────────┘ ``` </details> Changelog Message: Update the vizier-pem's prepackaged linux headers to work with newer AMI / cloud images. This fixes an issue where some platforms which don't have linux header packages (like Google COS) wouldn't show protocol tracing data (#2344) --------- Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
1 parent ce0f158 commit c674687

4 files changed

Lines changed: 58 additions & 79 deletions

File tree

bazel/linux_headers.bzl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,17 @@ def linux_headers():
2828
http_file(
2929
name = "linux_headers_merged_x86_64_tar_gz",
3030
urls = [
31-
"https://github.com/pixie-io/dev-artifacts/releases/download/linux-headers%2Fpl7/linux-headers-merged-x86_64-pl7.tar.gz",
32-
"https://storage.googleapis.com/pixie-dev-public/linux-headers/pl7/linux-headers-merged-x86_64-pl7.tar.gz",
31+
"https://github.com/pixie-io/dev-artifacts/releases/download/linux-headers%2Fpl8/linux-headers-merged-x86_64-pl8.tar.gz",
3332
],
34-
sha256 = "e4635db60d7f4139a8fea1b0490a0d0159e1edb9f3272ba2bcf40f8ea933bf93",
33+
sha256 = "07d0393aca727faadd41146585f92e3d9df239d91e2fa985ec55e50dc8526594",
3534
downloaded_file_path = "linux-headers-merged-x86_64.tar.gz",
3635
)
3736
http_file(
3837
name = "linux_headers_merged_arm64_tar_gz",
3938
urls = [
40-
"https://github.com/pixie-io/dev-artifacts/releases/download/linux-headers%2Fpl7/linux-headers-merged-arm64-pl7.tar.gz",
41-
"https://storage.googleapis.com/pixie-dev-public/linux-headers/pl7/linux-headers-merged-arm64-pl7.tar.gz",
39+
"https://github.com/pixie-io/dev-artifacts/releases/download/linux-headers%2Fpl8/linux-headers-merged-arm64-pl8.tar.gz",
4240
],
43-
sha256 = "c2a99ad6462dd1211c4e2f54f7279b7cf526e73918148350ccba988b95ca6115",
41+
sha256 = "75a05de508a7e83204e023ecdbdc2322b42fc812037a253de29c178871db7012",
4442
downloaded_file_path = "linux-headers-merged-arm64.tar.gz",
4543
)
4644

tools/docker/Makefile

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -72,36 +72,26 @@ SYSROOT_CREATOR_IMAGE_TAG := sysroot-creator-$(SYSROOT_REV)
7272
## Linux image parameters
7373
LINUX_HEADER_BUILD_DIR := $(BUILD_DIR)/linux_headers
7474
LINUX_HEADER_ASSETS_BUILD_DIR := $(LINUX_HEADER_BUILD_DIR)/assets
75-
LINUX_KERNEL_VERSIONS := 4.14.309 \
76-
4.15.18 \
77-
4.16.18 \
78-
4.17.19 \
79-
4.18.20 \
80-
4.19.325 \
81-
4.20.17 \
82-
5.0.21 \
83-
5.1.21 \
84-
5.2.21 \
85-
5.3.18 \
86-
5.4.293 \
87-
5.5.19 \
88-
5.6.19 \
89-
5.7.19 \
90-
5.8.18 \
91-
5.9.16 \
92-
5.10.237 \
93-
5.11.22 \
94-
5.12.19 \
95-
5.13.19 \
96-
5.14.21 \
97-
5.15.181 \
98-
5.16.20 \
99-
5.17.15 \
100-
5.18.19 \
101-
5.19.17 \
102-
6.0.19 \
103-
6.1.137 \
104-
6.6.89
75+
# Kernel versions selected to cover major enterprise distros and recent mainline.
76+
# Popular eBPF projects like cilium have moved to 5.10+ as their minimum
77+
# supported kernel version, with an exception for RHEL.
78+
# 4.18.20 - RHEL 8.10
79+
# 5.10.252 - Debian 11 / Amazon Linux 2
80+
# 5.14.21 - RHEL 9
81+
# 6.1.167 - Debian 12 / Amazon Linux 2023
82+
# 6.6.132 - Ubuntu 24.04 LTS
83+
# 6.12.80 - latest LTS
84+
# 6.18.21 - recent mainline
85+
# 6.19.10 - latest mainline
86+
LINUX_KERNEL_VERSIONS := 4.18.20 \
87+
5.10.252 \
88+
5.14.21 \
89+
6.1.167 \
90+
6.6.132 \
91+
6.12.80 \
92+
6.18.21 \
93+
6.19.10
94+
10595

10696
LINUX_HEADER_TEMPLATE := linux-headers-%.tar.gz
10797
LINUX_HEADER_X86_64_TARGETS = $(addprefix $(LINUX_HEADER_ASSETS_BUILD_DIR)/, \
@@ -112,7 +102,6 @@ LINUX_HEADER_ARM64_TARGETS = $(addprefix $(LINUX_HEADER_ASSETS_BUILD_DIR)/, \
112102

113103
LINUX_HEADERS_X86_64_MERGED_FILE := $(LINUX_HEADER_BUILD_DIR)/linux-headers-merged-x86_64-$(LINUX_HEADERS_REV).tar.gz
114104
LINUX_HEADERS_ARM64_MERGED_FILE := $(LINUX_HEADER_BUILD_DIR)/linux-headers-merged-arm64-$(LINUX_HEADERS_REV).tar.gz
115-
LINUX_HEADERS_GS_PATH := gs://pixie-dev-public/linux-headers/$(LINUX_HEADERS_REV)
116105

117106
## NATS image parameters.
118107
NATS_IMAGE_VERSION := 2.9.25
@@ -135,14 +124,13 @@ elasticsearch_image_tag := "gcr.io/pixie-oss/pixie-dev-public/elasticsearch:$(EL
135124

136125
## Linux kernel for qemu/BPF tests.
137126
KERNEL_BUILD_DIR := $(BUILD_DIR)/kernel_build
138-
# 4.19.276, 4.14.304 are the correct versions here, but there is a bug with patch > 255.
139-
KERNEL_BUILD_VERSIONS := 4.14.254 \
140-
4.19.254 \
141-
5.4.254 \
142-
5.10.224 \
143-
5.15.165 \
144-
6.1.106 \
145-
6.8.12
127+
KERNEL_BUILD_VERSIONS := 4.18.20 \
128+
5.10.252 \
129+
5.14.21 \
130+
6.1.167 \
131+
6.6.132 \
132+
6.12.80 \
133+
6.18.21
146134

147135
KERNEL_BUILD_TEMPLATE := linux-build-%.tar.gz
148136
KERNEL_BUILD_TARGETS = $(addprefix $(KERNEL_BUILD_DIR)/, $(patsubst %,$(KERNEL_BUILD_TEMPLATE), $(KERNEL_BUILD_VERSIONS)))
@@ -251,7 +239,6 @@ $(LINUX_HEADERS_ARM64_MERGED_FILE): $(LINUX_HEADER_ARM64_TARGETS)
251239

252240
.PHONY: upload_linux_headers
253241
upload_linux_headers: $(LINUX_HEADERS_X86_64_MERGED_FILE) $(LINUX_HEADERS_ARM64_MERGED_FILE) ## Target to build and upload linux headers image
254-
gsutil cp $^ $(LINUX_HEADERS_GS_PATH)
255242
$(GH_RELEASE_UPLOAD) linux-headers $(LINUX_HEADERS_REV) $^
256243
sha256sum $^
257244

tools/docker/linux_headers_image/Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,10 @@ RUN apt-get install -y -q build-essential \
3131
libssl-dev \
3232
flex \
3333
bison \
34-
kmod \
35-
cpio \
3634
rsync \
3735
wget \
3836
binutils-aarch64-linux-gnu \
3937
gcc-aarch64-linux-gnu \
40-
dwarves \
41-
debhelper \
4238
python3
4339

4440
WORKDIR /configs

tools/docker/linux_headers_image/build_linux_headers.sh

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -49,50 +49,48 @@ mkdir -p "${WORKSPACE}"/src
4949
pushd "${WORKSPACE}"/src || exit
5050

5151
KERN_MAJ=$(echo "${KERN_VERSION}" | cut -d'.' -f1);
52-
KERN_MIN=$(echo "${KERN_VERSION}" | cut -d'.' -f2);
5352
wget -nv http://mirrors.edge.kernel.org/pub/linux/kernel/v"${KERN_MAJ}".x/linux-"${KERN_VERSION}".tar.gz
5453

5554
tar zxf linux-"${KERN_VERSION}".tar.gz
5655

5756
pushd linux-"${KERN_VERSION}" || exit
5857

59-
cp /configs/"${ARCH}" .config
60-
make ARCH="${ARCH}" olddefconfig
61-
make ARCH="${ARCH}" clean
62-
6358
LOCALVERSION="-pl"
6459

65-
DEB_ARCH="${ARCH//x86_64/amd64}"
66-
# binary builds are required for non git trees after linux v6.3 (inclusive).
67-
# The .deb file suffix is also different.
68-
TARGET='bindeb-pkg'
69-
DEB_SUFFIX="-1_${DEB_ARCH}.deb"
70-
if [ "${KERN_MAJ}" -lt 6 ] || { [ "${KERN_MAJ}" -le 6 ] && [ "${KERN_MIN}" -lt 3 ]; }; then
71-
TARGET='deb-pkg'
72-
DEB_SUFFIX="${LOCALVERSION}-1_${DEB_ARCH}.deb"
73-
fi
74-
echo "Building ${TARGET} for ${KERN_VERSION}${LOCALVERSION} (${ARCH})"
60+
cp /configs/"${ARCH}" .config
61+
make ARCH="${ARCH}" olddefconfig
7562

76-
make ARCH="${ARCH}" -j "$(nproc)" "${TARGET}" LOCALVERSION="${LOCALVERSION}"
63+
# Only generate headers — no kernel or module compilation needed.
64+
# 'make prepare' generates include/generated/ and arch/*/include/generated/
65+
# which are the only outputs we package.
66+
echo "Generating headers for ${KERN_VERSION}${LOCALVERSION} (${ARCH})"
67+
make ARCH="${ARCH}" prepare LOCALVERSION="${LOCALVERSION}"
7768

7869
popd || exit
7970
popd || exit
8071

81-
# Extract headers into a tarball
82-
dpkg -x src/linux-headers-"${KERN_VERSION}${LOCALVERSION}_${KERN_VERSION}${DEB_SUFFIX}" .
72+
# Package headers into the same directory structure the old deb-pkg approach produced
73+
# (usr/src/linux-headers-<version><localversion>/{include,arch}).
74+
KERNEL_ARCH="${ARCH//x86_64/x86}"
75+
HEADERS_DIR="usr/src/linux-headers-${KERN_VERSION}${LOCALVERSION}"
76+
77+
mkdir -p "${HEADERS_DIR}/arch"
78+
cp -a "src/linux-${KERN_VERSION}/include" "${HEADERS_DIR}/"
79+
cp -a "src/linux-${KERN_VERSION}/arch/${KERNEL_ARCH}" "${HEADERS_DIR}/arch/"
8380

8481
# Remove broken symlinks
85-
find usr/src/linux-headers-"${KERN_VERSION}${LOCALVERSION}" -xtype l -exec rm {} +
86-
87-
# Remove uneeded files to reduce size
88-
# Keep only:
89-
# - usr/src/linux-headers-x.x.x-pl/include
90-
# - usr/src/linux-headers-x.x.x-pl/arch/${ARCH}
91-
# This reduces the size by a little over 2x.
92-
rm -rf usr/share
93-
find usr/src/linux-headers-"${KERN_VERSION}${LOCALVERSION}" -maxdepth 1 -mindepth 1 ! -name include ! -name arch -type d \
94-
-exec rm -rf {} +
95-
find usr/src/linux-headers-"${KERN_VERSION}${LOCALVERSION}"/arch -maxdepth 1 -mindepth 1 ! -name "${ARCH//x86_64/x86}" -type d -exec rm -rf {} +
82+
find "${HEADERS_DIR}" -xtype l -exec rm {} +
83+
84+
# Remove non-header files from arch/ to reduce size.
85+
# Only headers (.h), Makefiles, Kconfigs, and Kbuilds are needed.
86+
find "${HEADERS_DIR}/arch" -type f \
87+
! -name '*.h' \
88+
! -name 'Makefile' \
89+
! -name 'Kconfig*' \
90+
! -name 'Kbuild*' \
91+
-delete
92+
# Clean up empty directories left behind.
93+
find "${HEADERS_DIR}/arch" -type d -empty -delete
9694

9795
tar zcf linux-headers-"${ARCH}"-"${KERN_VERSION}".tar.gz usr
9896

0 commit comments

Comments
 (0)