1#
2# Docker cross-compiler target for riscv64
3#
4# Currently the only distro that gets close to cross compiling riscv64
5# images is Debian Sid (with unofficial ports). As this is a moving
6# target we keep the library list minimal and are aiming to migrate
7# from this hack as soon as we are able.
8#
9FROM docker.io/library/debian:sid-slim
10
11# Add ports
12RUN apt update && \
13    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
14    DEBIAN_FRONTEND=noninteractive eatmydata apt update -yy && \
15    DEBIAN_FRONTEND=noninteractive eatmydata apt upgrade -yy
16
17# Install common build utilities
18RUN DEBIAN_FRONTEND=noninteractive eatmydata apt install -yy \
19    bc \
20    build-essential \
21    ca-certificates \
22    debian-ports-archive-keyring \
23    dpkg-dev \
24    gettext \
25    git \
26    ninja-build \
27    pkg-config \
28    python3
29
30# Add ports and riscv64 architecture
31RUN echo "deb http://ftp.ports.debian.org/debian-ports/ sid main" >> /etc/apt/sources.list
32RUN dpkg --add-architecture riscv64
33
34# Duplicate deb line as deb-src
35RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
36
37RUN apt update && \
38    DEBIAN_FRONTEND=noninteractive eatmydata \
39    apt install -y --no-install-recommends \
40         gcc-riscv64-linux-gnu \
41         libc6-dev-riscv64-cross \
42         libffi-dev:riscv64 \
43         libglib2.0-dev:riscv64 \
44         libpixman-1-dev:riscv64
45
46# Specify the cross prefix for this image (see tests/docker/common.rc)
47ENV QEMU_CONFIGURE_OPTS --cross-prefix=riscv64-linux-gnu-
48ENV DEF_TARGET_LIST riscv64-softmmu,riscv64-linux-user
49