Skip to content

Commit acc75e7

Browse files
committed
ci: update musl headers to Linux 6.6
Update the musl headers in CI to use alpine-linux instead of sabotage-linux. Alpine also uses musl but follows the linux stable releases, providing more up-to-date headers. Signed-off-by: Pedro Tammela <[email protected]>
1 parent 63cf6a1 commit acc75e7

File tree

6 files changed

+66
-14
lines changed

6 files changed

+66
-14
lines changed

ci/docker/aarch64-unknown-linux-musl/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM ubuntu:24.10
22

33
RUN apt-get update && apt-get install -y --no-install-recommends \
44
gcc make libc6-dev git curl ca-certificates \
5-
gcc-aarch64-linux-gnu qemu-user
5+
gcc-aarch64-linux-gnu qemu-user xz-utils patch rsync
66

77
COPY install-musl.sh /
88
RUN /install-musl.sh aarch64

ci/docker/arm-unknown-linux-musleabihf/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
55
/etc/apt/sources.list && \
66
apt-get update && apt-get install -y --no-install-recommends \
77
gcc make libc6-dev git curl ca-certificates \
8-
gcc-arm-linux-gnueabihf qemu-user
8+
gcc-arm-linux-gnueabihf qemu-user xz-utils patch rsync
99

1010
COPY install-musl.sh /
1111
RUN /install-musl.sh arm

ci/docker/i686-unknown-linux-musl/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
FROM ubuntu:23.10
22

3-
43
# FIXME(time): we are using an EOL release because 24.04 changes to 64-bit time
54
RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \
65
/etc/apt/sources.list && \
76
dpkg --add-architecture i386 && \
87
apt-get update && apt-get install -y --no-install-recommends \
9-
gcc-multilib make libc6-dev git curl ca-certificates libc6-i386
8+
gcc-multilib make libc6-dev git curl ca-certificates libc6-i386 \
9+
xz-utils patch rsync
1010

1111
COPY install-musl.sh /
1212
RUN /install-musl.sh i686

ci/docker/s390x-unknown-linux-musl/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
44
curl ca-certificates \
55
gcc \
66
gcc-s390x-linux-gnu \
7-
qemu-user
7+
qemu-user \
8+
xz-utils patch rsync
89

910
COPY install-musl.sh /
1011
RUN /install-musl.sh s390x

ci/docker/x86_64-unknown-linux-musl/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ FROM ubuntu:24.10
22

33
RUN apt-get update
44
RUN apt-get install -y --no-install-recommends \
5-
gcc make libc6-dev git curl ca-certificates
5+
gcc make libc6-dev git curl ca-certificates \
6+
xz-utils patch rsync
67

78
COPY install-musl.sh /
89
RUN /install-musl.sh x86_64

ci/install-musl.sh

+58-8
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,63 @@ esac
6464
cd ..
6565
rm -rf "$musl"
6666

67-
# Download, configure, build, and install musl-sanitized kernel headers:
68-
kernel_header_ver="4.19.88"
69-
curl --retry 5 -L \
70-
"https://github.com/sabotage-linux/kernel-headers/archive/v${kernel_header_ver}.tar.gz" |
71-
tar xzf -
67+
# Download, configure, build, and install musl-sanitized kernel headers.
68+
69+
# Alpine follows stable kernel releases, 3.20 uses Linux 6.6 headers.
70+
alpine_version=3.20
71+
alpine_git=https://gitlab.alpinelinux.org/alpine/aports
72+
73+
# This routine piggybacks on: https://git.alpinelinux.org/aports/tree/main/linux-headers?h=3.20-stable
74+
git clone -n --depth=1 --filter=tree:0 -b "${alpine_version}-stable" "$alpine_git"
7275
(
73-
cd "kernel-headers-${kernel_header_ver}"
74-
make ARCH="${kernel_arch}" prefix="/musl-${musl_arch}" install -j4
76+
cd aports
77+
git sparse-checkout set --no-cone main/linux-headers
78+
git checkout
79+
80+
cd main/linux-headers
81+
cp APKBUILD APKBUILD.vars
82+
cat <<- EOF >> APKBUILD.vars
83+
echo "\$source" > alpine-source
84+
echo "\$_kernver" > alpine-kernver
85+
echo "\$pkgver" > alpine-pkgver
86+
echo "\$sha512sums" > alpine-sha512sums
87+
EOF
88+
89+
# Retrieve all the variables
90+
sh APKBUILD.vars
91+
92+
cat APKBUILD.vars
93+
94+
kernel_version=$(tr -d "[:space:]" < alpine-kernver)
95+
pkg_version=$(tr -d "[:space:]" < alpine-pkgver)
96+
97+
urls=$(grep -o 'https.*' alpine-source)
98+
kernel=""
99+
patch=""
100+
for url in $urls; do
101+
base=$(basename "$url")
102+
curl --retry 5 -L "$url" > "$base"
103+
case $base in
104+
linux-*) kernel=$base;;
105+
patch-*) patch=$base;;
106+
esac
107+
# Check if file is known
108+
grep -o "$base" alpine-sha512sums
109+
done
110+
111+
# Double check checksums
112+
sha512sum -c alpine-sha512sums
113+
114+
# Extract, apply patches, compile and install headers
115+
tar -xf "$kernel"
116+
cd "linux-$kernel_version"
117+
if [ "$pkg_version" != "$kernel_version" ]; then
118+
unxz -c < "../$patch" | patch -p1
119+
fi
120+
for p in ../*.patch; do
121+
patch -p1 < "$p"
122+
done
123+
make headers_install ARCH="${kernel_arch}" INSTALL_HDR_PATH="/musl-${musl_arch}"
75124
)
76-
rm -rf kernel-headers-${kernel_header_ver}
125+
126+
rm -rf aports

0 commit comments

Comments
 (0)