xref: /openbmc/qemu/tests/docker/dockerfiles/debian-riscv64-cross.docker (revision 2b5e0c9ff8299bbfa1a6b0c9cac385adb733152a)
1e100a967SAlex Bennée#
25c24acf3SAlex Bennée# Docker cross-compiler target for riscv64
3e100a967SAlex Bennée#
45c24acf3SAlex Bennée# Currently the only distro that gets close to cross compiling riscv64
55c24acf3SAlex Bennée# images is Debian Sid (with unofficial ports). As this is a moving
65c24acf3SAlex Bennée# target we keep the library list minimal and are aiming to migrate
75c24acf3SAlex Bennée# from this hack as soon as we are able.
8e100a967SAlex Bennée#
95c24acf3SAlex BennéeFROM docker.io/library/debian:sid-slim
105c24acf3SAlex Bennée
115c24acf3SAlex Bennée# Add ports
125c24acf3SAlex BennéeRUN apt update && \
135c24acf3SAlex Bennée    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
145c24acf3SAlex Bennée    DEBIAN_FRONTEND=noninteractive eatmydata apt update -yy && \
155c24acf3SAlex Bennée    DEBIAN_FRONTEND=noninteractive eatmydata apt upgrade -yy
165c24acf3SAlex Bennée
175c24acf3SAlex Bennée# Install common build utilities
185c24acf3SAlex BennéeRUN DEBIAN_FRONTEND=noninteractive eatmydata apt install -yy \
193de61b98SAnton Johansson    bison \
205c24acf3SAlex Bennée    bc \
215c24acf3SAlex Bennée    build-essential \
225c24acf3SAlex Bennée    ca-certificates \
235c24acf3SAlex Bennée    debian-ports-archive-keyring \
245c24acf3SAlex Bennée    dpkg-dev \
253de61b98SAnton Johansson    flex \
265c24acf3SAlex Bennée    gettext \
275c24acf3SAlex Bennée    git \
283de61b98SAnton Johansson    libglib2.0-dev \
295c24acf3SAlex Bennée    ninja-build \
305c24acf3SAlex Bennée    pkg-config \
315c24acf3SAlex Bennée    python3
325c24acf3SAlex Bennée
335c24acf3SAlex Bennée# Add ports and riscv64 architecture
345c24acf3SAlex BennéeRUN echo "deb http://ftp.ports.debian.org/debian-ports/ sid main" >> /etc/apt/sources.list
355c24acf3SAlex BennéeRUN dpkg --add-architecture riscv64
365c24acf3SAlex Bennée
375c24acf3SAlex Bennée# Duplicate deb line as deb-src
385c24acf3SAlex BennéeRUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
39e100a967SAlex Bennée
4098808c3dSPhilippe Mathieu-DaudéRUN apt update && \
4198808c3dSPhilippe Mathieu-Daudé    DEBIAN_FRONTEND=noninteractive eatmydata \
4298808c3dSPhilippe Mathieu-Daudé    apt install -y --no-install-recommends \
43e100a967SAlex Bennée         gcc-riscv64-linux-gnu \
445c24acf3SAlex Bennée         libc6-dev-riscv64-cross \
45*2b5e0c9fSThomas Huth         libfdt-dev:riscv64 \
465c24acf3SAlex Bennée         libffi-dev:riscv64 \
475c24acf3SAlex Bennée         libglib2.0-dev:riscv64 \
485c24acf3SAlex Bennée         libpixman-1-dev:riscv64
495c24acf3SAlex Bennée
505c24acf3SAlex Bennée# Specify the cross prefix for this image (see tests/docker/common.rc)
515c24acf3SAlex BennéeENV QEMU_CONFIGURE_OPTS --cross-prefix=riscv64-linux-gnu-
525c24acf3SAlex BennéeENV DEF_TARGET_LIST riscv64-softmmu,riscv64-linux-user
53