Containerfile (1894B)
1 # test/libc/musl/Containerfile — produces a static musl aarch64 sysroot 2 # tarball on stdout. Pinned to Alpine 3.20.10 + musl 1.2.5. 3 # 4 # Usage (driven by test/libc/musl/extract.sh): 5 # podman build --platform linux/arm64 -f Containerfile -t kit-musl-sysroot . 6 # podman run --rm kit-musl-sysroot > sysroot.tar 7 # 8 # The image's ENTRYPOINT writes a tar of /sysroot to stdout. The extract 9 # script unpacks it into build/musl-sysroot/ on the host. 10 FROM docker.io/arm64v8/alpine:3.20.10 11 12 # musl-dev: Scrt1.o, crt1.o, crti.o, crtn.o, libc.a + headers under /usr/include. 13 # Plus the dynamic linker / libc.so used by the dynamic-link variant of the 14 # harness (in musl, /lib/ld-musl-aarch64.so.1 *is* libc — same file). 15 # linux-headers: kernel uapi (linux/*, asm/*, asm-generic/*) — used by syscall 16 # definitions in the musl headers. 17 # Note: we deliberately do NOT pull clang's compiler-rt or libgcc — the 18 # soft-float / TF / 128-bit-int helpers (__extenddftf2 etc.) come from 19 # our own rt/ build (build/rt/aarch64-linux/libkit_rt.a). 20 RUN apk add --no-cache musl-dev linux-headers 21 22 # Stage the artifacts the linker needs into one tree so the host extract 23 # is a single tar pipe. 24 RUN mkdir -p /sysroot/lib /sysroot/include \ 25 && cp /usr/lib/crt1.o /sysroot/lib/ \ 26 && cp /usr/lib/Scrt1.o /sysroot/lib/ \ 27 && cp /usr/lib/rcrt1.o /sysroot/lib/ \ 28 && cp /usr/lib/crti.o /sysroot/lib/ \ 29 && cp /usr/lib/crtn.o /sysroot/lib/ \ 30 && cp /usr/lib/libc.a /sysroot/lib/ \ 31 && cp /usr/lib/libssp_nonshared.a /sysroot/lib/ \ 32 && cp /lib/ld-musl-aarch64.so.1 /sysroot/lib/ \ 33 && ln -s ld-musl-aarch64.so.1 /sysroot/lib/libc.so \ 34 && cp -r /usr/include/. /sysroot/include/ 35 36 # Pin the build for cache reuse and reproducibility audits. 37 RUN echo "alpine 3.20.10 musl 1.2.5-r3" > /sysroot/PROVENANCE \ 38 && uname -m >> /sysroot/PROVENANCE 39 40 ENTRYPOINT ["sh", "-c", "tar -C /sysroot -cf - ."]