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    bison \
20    bc \
21    build-essential \
22    ca-certificates \
23    debian-ports-archive-keyring \
24    dpkg-dev \
25    flex \
26    gettext \
27    git \
28    libglib2.0-dev \
29    ninja-build \
30    pkg-config \
31    python3
32
33# Add ports and riscv64 architecture
34RUN echo "deb http://ftp.ports.debian.org/debian-ports/ sid main" >> /etc/apt/sources.list
35RUN dpkg --add-architecture riscv64
36
37# Duplicate deb line as deb-src
38RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
39
40RUN apt update && \
41    DEBIAN_FRONTEND=noninteractive eatmydata \
42    apt install -y --no-install-recommends \
43         gcc-riscv64-linux-gnu \
44         libc6-dev-riscv64-cross \
45         libfdt-dev:riscv64 \
46         libffi-dev:riscv64 \
47         libglib2.0-dev:riscv64 \
48         libpixman-1-dev:riscv64
49
50# Specify the cross prefix for this image (see tests/docker/common.rc)
51ENV QEMU_CONFIGURE_OPTS --cross-prefix=riscv64-linux-gnu-
52ENV DEF_TARGET_LIST riscv64-softmmu,riscv64-linux-user
53