-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (34 loc) · 1.4 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM ubuntu:latest
ENV PREFIX=/opt/cross
ENV TARGET=i686-elf
ENV PATH=/opt/cross/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Install dependencies
RUN apt-get update -y
RUN apt-get install wget build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo grub-pc-bin nasm git xorriso vim qemu-system -y
WORKDIR ~/
# Download cross-compiler
RUN wget https://ftp.gnu.org/gnu/gcc/gcc-11.3.0/gcc-11.3.0.tar.gz --no-check-certificate \
&& wget https://mirrors.kernel.org/gnu/binutils/binutils-2.38.tar.gz --no-check-certificate
RUN tar -xzf gcc-11.3.0.tar.gz \
&& tar -xzf binutils-2.38.tar.gz
# Build cross compiler
RUN mkdir build-binutils \
&& cd build-binutils \
&& ../binutils-2.38/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror \
&& make \
&& make install
RUN mkdir build-gcc \
&& cd build-gcc \
&& ../gcc-11.3.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers \
&& make all-gcc \
&& make all-target-libgcc \
&& make install-gcc \
&& make install-target-libgcc
# Add to path
ENV PATH=/opt/cross/bin:/opt/cross/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Clean up
RUN rm -rf *
# Later dependencies (So I won't have to rebuild the image every time I add one)
RUN apt-get install -y gdb
VOLUME /avikernel
WORKDIR /avikernel