Skip to content

Commit 700fd67

Browse files
committed
Try using the kernel of the runner
1 parent b8c6b7c commit 700fd67

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

build-tools.Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ ARG BASE_IMAGE_SHA=debian:${DEBIAN_FLAVOR}
2323
ARG BASE_IMAGE_SHA=${BASE_IMAGE_SHA/debian:bookworm-slim/debian@$BOOKWORM_SLIM_SHA}
2424
ARG BASE_IMAGE_SHA=${BASE_IMAGE_SHA/debian:bullseye-slim/debian@$BULLSEYE_SLIM_SHA}
2525

26-
# The kernel version which will be used for running the container.
27-
ARG KERNEL_VERSION=6.12.26
28-
2926
FROM $BASE_IMAGE_SHA AS pgcopydb_builder
3027
ARG DEBIAN_VERSION
3128

@@ -89,7 +86,6 @@ RUN if [ "${DEBIAN_VERSION}" = "bookworm" ]; then \
8986

9087
FROM $BASE_IMAGE_SHA AS build_tools
9188
ARG DEBIAN_VERSION
92-
ARG KERNEL_VERSION
9389

9490
# Add nonroot user
9591
RUN useradd -ms /bin/bash nonroot -b /home
@@ -113,6 +109,10 @@ RUN echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/80-retries && \
113109
# 'gdb' is included so that we get backtraces of core dumps produced in
114110
# regression tests
115111
RUN set -e \
112+
&& KERNEL_VERSION="$(uname -r | cut -d'-' -f1 | sed 's/\.0$//')" \
113+
&& echo KERNEL_VERSION=${KERNEL_VERSION} >> /etc/environment \
114+
&& KERNEL_ARCH=$(uname -m | awk '{ if ($1 ~ /^(x86_64|i[3-6]86)$/) print "x86"; else if ($1 ~ /^(aarch64|arm.*)$/) print "aarch"; else print $1 }') \
115+
&& echo KERNEL_ARCH=${KERNEL_ARCH} >> /etc/environment \
116116
&& apt update \
117117
&& apt install -y \
118118
autoconf \
@@ -166,9 +166,12 @@ RUN set -e \
166166
&& git clone --depth 1 --branch v${KERNEL_VERSION} https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git \
167167
&& cd linux \
168168
&& make mrproper \
169+
&& make modules_prepare \
169170
&& make headers_install INSTALL_HDR_PATH=/tmp/kernel-headers \
170171
&& mkdir -p /lib/modules/$(uname -r)/build \
171-
&& cp -r /tmp/kernel-headers/include /lib/modules/$(uname -r)/build/ \
172+
&& cd - \
173+
&& cd /tmp/kernel-headers \
174+
&& cp -a include arch/${KERNEL_ARCH}/include scripts Module.symvers .config Makefile /lib/modules/$(uname -r)/build/ \
172175
&& rm -rf /tmp/kernel-headers \
173176
&& cd - \
174177
&& rm -rf linux

0 commit comments

Comments
 (0)