1FROM ubuntu:19.04 2 3# Dependencies to get the git sources and go binaries 4RUN apt-get update && apt-get install -y --no-install-recommends \ 5 ca-certificates \ 6 curl \ 7 git \ 8 rsync \ 9 && apt-get clean \ 10 && rm -rf /var/lib/apt/lists/* 11 12# Get the git sources. If not cached, this takes O(5 minutes). 13WORKDIR /git 14RUN git config --global advice.detachedHead false 15# Linux Kernel: Released 27 Jan 2020 16RUN git clone --branch v5.5 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux 17# GNU C library: Released 01 Feb 2020 (we should try to get a secure way to clone this) 18RUN git clone --branch release/2.31/master --depth 1 git://sourceware.org/git/glibc.git 19 20# Get Go 21ENV GOLANG_VERSION 1.13.7 22ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz 23ENV GOLANG_DOWNLOAD_SHA256 b3dd4bd781a0271b33168e627f7f43886b4c5d1c794a4015abf34e99c6526ca3 24 25RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \ 26 && echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \ 27 && tar -C /usr/local -xzf golang.tar.gz \ 28 && rm golang.tar.gz 29 30ENV PATH /usr/local/go/bin:$PATH 31 32# Linux and Glibc build dependencies and emulator 33RUN apt-get update && apt-get install -y --no-install-recommends \ 34 bison gawk make python3 \ 35 gcc gcc-multilib \ 36 gettext texinfo \ 37 qemu-user \ 38 && apt-get clean \ 39 && rm -rf /var/lib/apt/lists/* 40# Cross compilers (install recommended packages to get cross libc-dev) 41RUN apt-get update && apt-get install -y \ 42 gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi \ 43 gcc-mips-linux-gnu gcc-mips64-linux-gnuabi64 \ 44 gcc-mips64el-linux-gnuabi64 gcc-mipsel-linux-gnu \ 45 gcc-powerpc64-linux-gnu gcc-powerpc64le-linux-gnu \ 46 gcc-riscv64-linux-gnu \ 47 gcc-s390x-linux-gnu gcc-sparc64-linux-gnu \ 48 && apt-get clean \ 49 && rm -rf /var/lib/apt/lists/* 50 51# Let the scripts know they are in the docker environment 52ENV GOLANG_SYS_BUILD docker 53WORKDIR /build 54ENTRYPOINT ["go", "run", "linux/mkall.go", "/git/linux", "/git/glibc"] 55