-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathContainerfile
More file actions
171 lines (154 loc) · 4.27 KB
/
Containerfile
File metadata and controls
171 lines (154 loc) · 4.27 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Container for building System76 Open Firmware
# NOTE: The repository is specified in the image name to make it explicit
# which source is being trusted to provide the image.
ARG CONTAINER_IMAGE="docker.io/library/debian:bookworm-20250520-slim"
ARG COREBOOT_REPO="https://github.com/coreboot/coreboot.git"
ARG COREBOOT_COMMIT="25.03"
ARG SDCC_REPO="https://svn.code.sf.net/p/sdcc/code"
ARG SDCC_REV="14648"
ARG SDCC_VERSION="4.4.0"
ARG RUST_TOOLCHAIN="1.85.0"
# Build coreboot toolchains
FROM ${CONTAINER_IMAGE} as crossgcc-build
ARG COREBOOT_COMMIT
ARG COREBOOT_REPO
WORKDIR /tmp
RUN apt-get --quiet update \
&& apt-get --quiet install --no-install-recommends --assume-yes \
bash \
bison \
bzip2 \
ca-certificates \
curl \
flex \
g++ \
gcc \
git \
gnat \
libssl-dev \
m4 \
make \
patch \
pkgconf \
python-is-python3 \
python3 \
tar \
xz-utils \
zlib1g-dev \
&& apt-get clean
RUN git clone ${COREBOOT_REPO} \
&& cd coreboot \
&& git checkout ${COREBOOT_COMMIT}
RUN make -C coreboot \
CPUS=$(nproc) BUILD_LANGUAGES=ada,c,c++ DEST=/opt/xgcc \
crossgcc-i386 crossgcc-x64 \
&& rm -rf coreboot
# Build SDCC toolchain
FROM ${CONTAINER_IMAGE} as sdcc-build
ARG SDCC_REPO
ARG SDCC_REV
ARG SDCC_VERSION
WORKDIR /tmp
RUN apt-get --quiet update \
&& apt-get --quiet install --no-install-recommends --assume-yes \
autoconf \
automake \
bison \
ca-certificates \
flex \
g++ \
gcc \
libboost-dev \
make \
subversion \
zlib1g-dev \
&& apt-get clean
RUN svn checkout \
--depth infinity \
--revision ${SDCC_REV} \
${SDCC_REPO}/tags/sdcc-${SDCC_VERSION}/sdcc \
sdcc
# Only the MCS-51 port is needed.
RUN cd sdcc \
&& sh ./configure \
--disable-z80-port \
--disable-z180-port \
--disable-r2k-port \
--disable-r2ka-port \
--disable-r3ka-port \
--disable-sm83-port \
--disable-tlcs90-port \
--disable-ez80_z80-port \
--disable-z80n-port \
--disable-ds390-port \
--disable-ds400-port \
--disable-pic14-port \
--disable-pic16-port \
--disable-hc08-port \
--disable-s08-port \
--disable-stm8-port \
--disable-pdk13-port \
--disable-pdk14-port \
--disable-pdk15-port \
--disable-mos6502-port \
--disable-ucsim \
--disable-sdcdb \
--disable-non-free \
--prefix= \
&& make -j $(nproc) \
&& make install DESTDIR=/opt/sdcc
# Set up environment for building firmware-open
FROM ${CONTAINER_IMAGE}
ARG RUST_TOOLCHAIN
COPY --from=crossgcc-build /opt/xgcc /opt/xgcc
COPY --from=sdcc-build /opt/sdcc /opt/sdcc
ENV COREBOOT_COMMIT "${COREBOOT_COMMIT}"
ENV XGCCPATH "/opt/xgcc/bin"
ENV SDCC_PATH "/opt/sdcc"
ENV SDCC_REV "${SDCC_REV}"
ENV SDCC_VERSION "${SDCC_VERSION}"
ENV CARGO_HOME "/root/.cargo"
ENV PATH "$XGCCPATH:$SDCC_PATH/bin:$CARGO_HOME/bin:$PATH"
RUN apt-get --quiet update \
&& apt-get --quiet install --no-install-recommends --assume-yes \
bash \
binutils \
ca-certificates \
ccache \
cmake \
curl \
dosfstools \
g++ \
gcc \
git \
git-lfs \
libc6-dev \
libhidapi-dev \
libnss3-dev \
libssl-dev \
libudev-dev \
make \
mtools \
parted \
pkgconf \
python-is-python3 \
python3 \
shellcheck \
uncrustify \
uuid-dev \
xxd \
&& apt-get clean
# TODO: Use distro rustup package when available (Trixie).
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --no-modify-path --default-toolchain stable
# XXX: rustup 1.27 does not recognize toolchain if preceding option specifies
# a comma separated list as an argument with a space.
# Ref: https://github.com/rust-lang/rustup/issues/4073
RUN rustup toolchain install \
--no-self-update \
--target x86_64-unknown-linux-gnu,x86_64-unknown-uefi \
--profile minimal \
--component=clippy,rustfmt \
${RUST_TOOLCHAIN}
WORKDIR /workspace
CMD ["bash"]