@@ -23,9 +23,6 @@ ARG BASE_IMAGE_SHA=debian:${DEBIAN_FLAVOR}
23
23
ARG BASE_IMAGE_SHA=${BASE_IMAGE_SHA/debian:bookworm-slim/debian@$BOOKWORM_SLIM_SHA}
24
24
ARG BASE_IMAGE_SHA=${BASE_IMAGE_SHA/debian:bullseye-slim/debian@$BULLSEYE_SLIM_SHA}
25
25
26
- # The kernel version which will be used for running the container.
27
- ARG KERNEL_VERSION=6.12.26
28
-
29
26
FROM $BASE_IMAGE_SHA AS pgcopydb_builder
30
27
ARG DEBIAN_VERSION
31
28
@@ -89,7 +86,6 @@ RUN if [ "${DEBIAN_VERSION}" = "bookworm" ]; then \
89
86
90
87
FROM $BASE_IMAGE_SHA AS build_tools
91
88
ARG DEBIAN_VERSION
92
- ARG KERNEL_VERSION
93
89
94
90
# Add nonroot user
95
91
RUN useradd -ms /bin/bash nonroot -b /home
@@ -113,6 +109,10 @@ RUN echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/80-retries && \
113
109
# 'gdb' is included so that we get backtraces of core dumps produced in
114
110
# regression tests
115
111
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 \
116
116
&& apt update \
117
117
&& apt install -y \
118
118
autoconf \
@@ -166,9 +166,12 @@ RUN set -e \
166
166
&& git clone --depth 1 --branch v${KERNEL_VERSION} https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git \
167
167
&& cd linux \
168
168
&& make mrproper \
169
+ && make modules_prepare \
169
170
&& make headers_install INSTALL_HDR_PATH=/tmp/kernel-headers \
170
171
&& 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/ \
172
175
&& rm -rf /tmp/kernel-headers \
173
176
&& cd - \
174
177
&& rm -rf linux
0 commit comments