Skip to content

Commit 7169c6a

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 <pctammela@gmail.com>
1 parent 2f931d9 commit 7169c6a

File tree

6 files changed

+66
-13
lines changed

6 files changed

+66
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM ubuntu:23.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 sh /install-musl.sh aarch64

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ FROM ubuntu:23.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-arm-linux-gnueabihf qemu-user
5+
gcc-arm-linux-gnueabihf qemu-user \
6+
xz-utils patch rsync
67

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

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ FROM ubuntu:23.10
33
RUN dpkg --add-architecture i386
44
RUN apt-get update
55
RUN apt-get install -y --no-install-recommends \
6-
gcc-multilib make libc6-dev git curl ca-certificates libc6-i386
6+
gcc-multilib make libc6-dev git curl ca-certificates libc6-i386 \
7+
xz-utils patch rsync
78

89
COPY install-musl.sh /
910
RUN sh /install-musl.sh i686

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

Lines changed: 2 additions & 1 deletion
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 sh /install-musl.sh s390x

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ FROM ubuntu:23.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 sh /install-musl.sh x86_64

ci/install-musl.sh

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,62 @@ 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+
{
83+
echo "printf \"\$source\" > alpine-source"
84+
# shellcheck disable=SC2028
85+
echo "printf \"\$_kernver\n\" > alpine-kernver"
86+
# shellcheck disable=SC2028
87+
echo "printf \"\$pkgver\n\" > alpine-pkgver"
88+
# shellcheck disable=SC2028
89+
echo "printf \"\$sha512sums\n\" > alpine-sha512sums"
90+
} >> APKBUILD.vars
91+
sh APKBUILD.vars
92+
93+
kernel_version=$(tr -d "[:space:]" < alpine-kernver)
94+
pkg_version=$(tr -d "[:space:]" < alpine-pkgver)
95+
96+
urls=$(grep -o 'https.*' alpine-source)
97+
kernel=""
98+
patch=""
99+
for url in $urls; do
100+
base=$(basename "$url")
101+
curl --retry 5 -L "$url" > "$base"
102+
case $base in
103+
linux-*) kernel=$base;;
104+
patch-*) patch=$base;;
105+
esac
106+
done
107+
108+
# Double check checksums
109+
grep "$kernel" alpine-sha512sums >> sha-check
110+
grep "$patch" alpine-sha512sums >> sha-check
111+
sha512sum -c sha-check
112+
113+
# Extract, apply patches, compile and install headers
114+
tar -xf "$kernel"
115+
cd "linux-$kernel_version"
116+
if [ "$pkg_version" != "$kernel_version" ]; then
117+
unxz -c < "../$patch" | patch -p1
118+
fi
119+
for p in ../*.patch; do
120+
patch -p1 < "$p"
121+
done
122+
make headers_install ARCH="${kernel_arch}" INSTALL_HDR_PATH="/musl-${musl_arch}"
75123
)
76-
rm -rf kernel-headers-${kernel_header_ver}
124+
125+
rm -rf aports

0 commit comments

Comments
 (0)