Skip to content
Snippets Groups Projects
Select Git revision
  • b984481807b3880cfba56f5d6273b5349fbca359
  • main default protected
  • initilize-and-use-uart-transmitter
3 results

Dockerfile

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Dockerfile 2.24 KiB
    FROM docker.io/debian:bookworm AS toolchain
    RUN apt update && apt upgrade -y
    RUN apt install -y \
      build-essential \
      git autoconf \
      automake \
      autotools-dev \
      libncurses5-dev \
      gperf \
      bison \
      flex \
      texinfo \
      help2man \
      gawk \
      wget \
      subversion \
      bzip2 \
      libtool-bin \
      unzip
    RUN mkdir -p /ctng
    WORKDIR /ctng
    # crosstool-ng doesn't want to run as root
    RUN useradd -ms /bin/bash builder
    RUN chown -R builder:builder /ctng
    USER builder
    RUN git clone https://github.com/crosstool-ng/crosstool-ng
    WORKDIR /ctng/crosstool-ng
    COPY no-ulimit.patch .
    RUN git apply no-ulimit.patch
    RUN ./bootstrap && \
      ./configure --enable-local && \
      make -j$(nproc)
    RUN ./ct-ng riscv32-unknown-elf
    RUN ./ct-ng build
    
    
    FROM docker.io/debian:bookworm AS qemu
    RUN apt update && apt upgrade -y
    RUN apt install -y \
      build-essential \
      git \
      python3 python3-pip python3-venv \
      python3-sphinx \
      libglib2.0-dev \
      libfdt-dev \
      libpixman-1-dev \
      zlib1g-dev \
      ninja-build \
      libnfs-dev \
      libiscsi-dev
    RUN mkdir -p /qemu
    WORKDIR /qemu
    RUN git clone https://git.imp.fu-berlin.de/projekt-telematik-ss23-qemu/risc-v-qemu.git && \
       cd risc-v-qemu && \
       git checkout esp32_c3_bringup && \
       mkdir -p build && cd build && \
       ../configure --prefix=/usr/local/ --target-list=riscv32-softmmu && \
       make -j$(nproc) && \
       make install
    
    
    FROM docker.io/debian:bookworm AS bootrom
    RUN apt update && apt upgrade -y
    RUN apt install -y ca-certificates wget
    RUN cd /tmp && \
      wget https://github.com/espressif/esp-rom-elfs/releases/download/20230320/esp-rom-elfs-20230320.tar.gz && \
      tar -xvf esp-rom-elfs-20230320.tar.gz && \
      mkdir -p /bootrom && \
      cp /tmp/esp32c3_rev3_rom.elf /bootrom/
      
    
    
    FROM docker.io/debian:bookworm AS final
    # Install qemu's runtime deps
    RUN apt update && apt upgrade -y
    RUN apt install -y libpixman-1-0 libfdt1 libglib2.0-0 libiscsi7 libnfs13
    # Install additional developer tools
    RUN apt install -y gdb-multiarch make
    COPY --from=qemu /usr/local /usr/local
    COPY --from=toolchain /home/builder/x-tools/riscv32-unknown-elf/* /usr/local/bin/
    # Install boot ROM for board
    COPY --from=bootrom /bootrom /bootrom
    # Converting this from the ELF requires a patched esptool, so just copy it from our repo
    COPY esp32c3_rev3_rom.bin /bootrom
    
    WORKDIR /work