ch32v-template/Dockerfile

53 lines
1.1 KiB
Docker
Raw Permalink Normal View History

2022-11-26 05:18:20 +00:00
# syntax=docker/dockerfile:1
2022-11-26 01:20:14 +00:00
FROM ubuntu:kinetic
ARG uid
ARG gid
2023-01-03 17:33:55 +00:00
ARG tag=2023.01.03
2022-11-26 01:20:14 +00:00
CMD /bin/bash
RUN apt-get update && apt-get install -y \
2022-11-26 05:18:20 +00:00
autoconf \
automake \
autotools-dev \
curl \
python3 \
libmpc-dev \
libmpfr-dev \
libgmp-dev \
libncurses5-dev \
gawk \
build-essential \
bison \
flex \
texinfo \
gperf \
libtool \
patchutils \
bc \
zlib1g-dev \
libexpat-dev \
git \
meson \
nano
2022-11-26 01:20:14 +00:00
2022-11-26 05:18:20 +00:00
RUN git clone https://github.com/riscv-collab/riscv-gnu-toolchain /build
WORKDIR /build
RUN git checkout ${tag}
# Patch the build to include the gdb TUI, this makes debugging inside docker
# much nicer
RUN sed -i.bak 's/--disable-gprof/--disable-gprof --enable-tui/' Makefile.in
2022-11-26 01:20:14 +00:00
RUN ./configure --prefix=/usr/local \
--with-arch=rv32gc --with-abi=ilp32d --with-abi=ilp32 && \
make -j $(nproc) && \
make install && \
2022-11-26 05:18:20 +00:00
rm -rf /build
2022-11-26 01:20:14 +00:00
RUN apt-get install -y cmake
2022-11-26 01:20:14 +00:00
# groupadd will fail if the GID already exists, as is the case for macOS hosts
# where "staff" is gid 20. That's ok. We just need the group to exist.
RUN groupadd --gid ${gid} usergrp ; \
useradd -ms /bin/bash --uid ${uid} --gid ${gid} user
USER user
WORKDIR /project