Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Tammela <[email protected]>
  • Loading branch information
tammela committed Sep 13, 2024
1 parent 2c0250f commit 941f4f2
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 12 deletions.
2 changes: 1 addition & 1 deletion ci/docker/aarch64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:23.10

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

COPY install-musl.sh /
RUN sh /install-musl.sh aarch64
Expand Down
3 changes: 2 additions & 1 deletion ci/docker/arm-unknown-linux-musleabihf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ FROM ubuntu:23.10

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates \
gcc-arm-linux-gnueabihf qemu-user
gcc-arm-linux-gnueabihf qemu-user \
xz-utils patch rsync

COPY install-musl.sh /
RUN sh /install-musl.sh arm
Expand Down
3 changes: 2 additions & 1 deletion ci/docker/i686-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ FROM ubuntu:23.10
RUN dpkg --add-architecture i386
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc-multilib make libc6-dev git curl ca-certificates libc6-i386
gcc-multilib make libc6-dev git curl ca-certificates libc6-i386 \
xz-utils patch rsync

COPY install-musl.sh /
RUN sh /install-musl.sh i686
Expand Down
3 changes: 2 additions & 1 deletion ci/docker/s390x-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates \
gcc \
gcc-s390x-linux-gnu \
qemu-user
qemu-user \
xz-utils patch rsync

COPY install-musl.sh /
RUN sh /install-musl.sh s390x
Expand Down
3 changes: 2 additions & 1 deletion ci/docker/x86_64-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ FROM ubuntu:23.10

RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates
gcc make libc6-dev git curl ca-certificates \
xz-utils patch rsync

COPY install-musl.sh /
RUN sh /install-musl.sh x86_64
Expand Down
59 changes: 52 additions & 7 deletions ci/install-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,57 @@ cd ..
rm -rf $MUSL

# Download, configure, build, and install musl-sanitized kernel headers:
KERNEL_HEADER_VER="4.19.88"
curl --retry 5 -L \
"https://github.com/sabotage-linux/kernel-headers/archive/v${KERNEL_HEADER_VER}.tar.gz" | \
tar xzf -
#KERNEL_HEADER_VER="4.19.88"
#curl --retry 5 -L \
# "https://github.com/sabotage-linux/kernel-headers/archive/v${KERNEL_HEADER_VER}.tar.gz" | \
# tar xzf -
#(
# cd kernel-headers-${KERNEL_HEADER_VER}
# make ARCH="${kernel_arch}" prefix="/musl-${musl_arch}" install -j4
#)
#rm -rf kernel-headers-${KERNEL_HEADER_VER}

git clone -n --depth=1 --filter=tree:0 -b 3.20-stable https://gitlab.alpinelinux.org/alpine/aports
(
cd kernel-headers-${KERNEL_HEADER_VER}
make ARCH="${kernel_arch}" prefix="/musl-${musl_arch}" install -j4
cd aports
git sparse-checkout set --no-cone main/linux-headers
git checkout
cd main/linux-headers
cp APKBUILD APKBUILD.source
cp APKBUILD APKBUILD.sha512
{
echo "printf \"\$source\""
# shellcheck disable=SC2028
echo "printf \"\$_kernver\n\""
# shellcheck disable=SC2028
echo "printf \"\$pkgver\n\""
} >> APKBUILD.source
echo "printf \"\$sha512sums\"" >> APKBUILD.sha512
KERNEL_VER=$(bash APKBUILD.source | tail -2 | head -1 | tr -d "[:space:]")
PKGVER=$(bash APKBUILD.source | tail -1 | tr -d "[:space:]")
urls=$(bash APKBUILD.source | grep -o 'https.*')
kernel=""
patch=""
for url in $urls; do
base=$(basename "$url")
curl --retry 5 -L "$url" > "$base"
case $base in
linux-*) kernel=$base;;
patch-*) patch=$base;;
esac
done
bash APKBUILD.sha512 | grep "$kernel" >> sha-check
bash APKBUILD.sha512 | grep "$patch" >> sha-check
sha512sum -c sha-check
tar -xf "$kernel"
cd "linux-$KERNEL_VER"
if [ "$PKGVER" != "$KERNEL_VER" ]; then
unxz -c < "../$patch" | patch -p1
fi
for p in ../*.patch; do
patch -p1 < "$p"
done
make headers_install ARCH="${kernel_arch}" INSTALL_HDR_PATH="/musl-${musl_arch}"
)
rm -rf kernel-headers-${KERNEL_HEADER_VER}

rm -rf aports

0 comments on commit 941f4f2

Please sign in to comment.