2018-04-24 18:41:18 +03:00
|
|
|
#
|
2021-09-17 19:23:25 +03:00
|
|
|
# Docker cross-compiler target for riscv64
|
2018-04-24 18:41:18 +03:00
|
|
|
#
|
2021-09-17 19:23:25 +03:00
|
|
|
# Currently the only distro that gets close to cross compiling riscv64
|
|
|
|
# images is Debian Sid (with unofficial ports). As this is a moving
|
|
|
|
# target we keep the library list minimal and are aiming to migrate
|
|
|
|
# from this hack as soon as we are able.
|
2018-04-24 18:41:18 +03:00
|
|
|
#
|
2021-09-17 19:23:25 +03:00
|
|
|
FROM docker.io/library/debian:sid-slim
|
|
|
|
|
|
|
|
# Add ports
|
|
|
|
RUN apt update && \
|
|
|
|
DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
|
|
|
|
DEBIAN_FRONTEND=noninteractive eatmydata apt update -yy && \
|
|
|
|
DEBIAN_FRONTEND=noninteractive eatmydata apt upgrade -yy
|
|
|
|
|
|
|
|
# Install common build utilities
|
|
|
|
RUN DEBIAN_FRONTEND=noninteractive eatmydata apt install -yy \
|
2022-09-29 14:41:48 +03:00
|
|
|
bison \
|
2021-09-17 19:23:25 +03:00
|
|
|
bc \
|
|
|
|
build-essential \
|
|
|
|
ca-certificates \
|
|
|
|
debian-ports-archive-keyring \
|
|
|
|
dpkg-dev \
|
2022-09-29 14:41:48 +03:00
|
|
|
flex \
|
2021-09-17 19:23:25 +03:00
|
|
|
gettext \
|
|
|
|
git \
|
2022-09-29 14:41:48 +03:00
|
|
|
libglib2.0-dev \
|
2021-09-17 19:23:25 +03:00
|
|
|
ninja-build \
|
|
|
|
pkg-config \
|
2023-05-11 06:54:19 +03:00
|
|
|
python3 \
|
|
|
|
python3-venv
|
2021-09-17 19:23:25 +03:00
|
|
|
|
|
|
|
# Add ports and riscv64 architecture
|
|
|
|
RUN echo "deb http://ftp.ports.debian.org/debian-ports/ sid main" >> /etc/apt/sources.list
|
|
|
|
RUN dpkg --add-architecture riscv64
|
|
|
|
|
|
|
|
# Duplicate deb line as deb-src
|
|
|
|
RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
|
2018-04-24 18:41:18 +03:00
|
|
|
|
2019-07-23 17:15:27 +03:00
|
|
|
RUN apt update && \
|
|
|
|
DEBIAN_FRONTEND=noninteractive eatmydata \
|
|
|
|
apt install -y --no-install-recommends \
|
2021-09-17 19:23:25 +03:00
|
|
|
gcc-riscv64-linux-gnu \
|
|
|
|
libc6-dev-riscv64-cross \
|
2023-01-24 17:38:24 +03:00
|
|
|
libfdt-dev:riscv64 \
|
2021-09-17 19:23:25 +03:00
|
|
|
libffi-dev:riscv64 \
|
|
|
|
libglib2.0-dev:riscv64 \
|
|
|
|
libpixman-1-dev:riscv64
|
|
|
|
|
|
|
|
# Specify the cross prefix for this image (see tests/docker/common.rc)
|
|
|
|
ENV QEMU_CONFIGURE_OPTS --cross-prefix=riscv64-linux-gnu-
|
|
|
|
ENV DEF_TARGET_LIST riscv64-softmmu,riscv64-linux-user
|
2023-02-28 22:06:48 +03:00
|
|
|
# As a final step configure the user (if env is defined)
|
|
|
|
ARG USER
|
|
|
|
ARG UID
|
|
|
|
RUN if [ "${USER}" ]; then \
|
|
|
|
id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
|