Containerfile.rv64 (1960B)
1 # test/libc/glibc/Containerfile.rv64 — produces a glibc riscv64 2 # sysroot tarball on stdout. Pinned to Debian trixie (Debian 13); 3 # riscv64 was promoted to an official Debian architecture in trixie, 4 # so it's the first stable-ish release with libc6-dev available 5 # through the standard apt path. 6 # 7 # Companion to ./Containerfile (aarch64). See that file for the 8 # design notes on what gets staged and why; arch-specific differences: 9 # - riscv64/debian base, trixie release 10 # - multi-arch dir riscv64-linux-gnu 11 # - runtime loader is /lib/ld-linux-riscv64-lp64d.so.1 12 FROM docker.io/riscv64/debian:trixie-slim 13 14 RUN apt-get update \ 15 && apt-get install -y --no-install-recommends \ 16 libc6-dev \ 17 linux-libc-dev \ 18 && rm -rf /var/lib/apt/lists/* 19 20 RUN set -eux; \ 21 mkdir -p /sysroot/lib /sysroot/include; \ 22 cd /usr/lib/riscv64-linux-gnu; \ 23 cp Scrt1.o crti.o crtn.o libc_nonshared.a /sysroot/lib/; \ 24 cp -L /lib/riscv64-linux-gnu/libc.so.6 /sysroot/lib/libc.so.6; \ 25 cp -L /lib/riscv64-linux-gnu/libm.so.6 /sysroot/lib/libm.so.6; \ 26 cp -L /lib/ld-linux-riscv64-lp64d.so.1 /sysroot/lib/ld-linux-riscv64-lp64d.so.1; \ 27 # On Debian trixie, linux-libc-dev stages the uapi asm headers under 28 # /usr/lib/linux/uapi/<arch>/asm and symlinks them from 29 # /usr/include/<multiarch>/asm/. A plain `cp -r` preserves the 30 # symlinks and they end up broken in the sysroot because 31 # /usr/lib/linux is not copied. Use -L to dereference symlinks so 32 # the extracted tree is self-contained — bookworm (the aa64 33 # variant) ships real files, so this is rv64/trixie-specific. 34 cp -rL /usr/include/. /sysroot/include/ 35 36 RUN set -eux; \ 37 { \ 38 echo "debian trixie-slim glibc $(dpkg-query -W -f='${Version}' libc6-dev)"; \ 39 echo "linux-libc-dev $(dpkg-query -W -f='${Version}' linux-libc-dev)"; \ 40 uname -m; \ 41 } > /sysroot/PROVENANCE 42 43 ENTRYPOINT ["sh", "-c", "tar -C /sysroot -cf - ."]