firmware-open
firmware-open copied to clipboard
Containerize builds
Investigate using containers for building the project, potentially even using them for local development.
coreboot has some Dockerfiles for building images and publishes them on Docker Hub:
- https://github.com/coreboot/coreboot/tree/24.02/util/docker
- https://hub.docker.com/u/coreboot
We only need crossgcc-i386 and crossgcc-x64, so we should build our own image to minimize the size.
Example minimal Containerfile:
ARG CONTAINER_IMAGE="debian:12.2"
ARG COREBOOT_REPO="https://github.com/coreboot/coreboot.git"
ARG COREBOOT_COMMIT="4.21"
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
RUN git clone ${COREBOOT_REPO} && \
cd coreboot && \
git checkout ${COREBOOT_COMMIT}
RUN make -C coreboot CPUS=$(nproc) DEST=/opt/xgcc crossgcc-i386 && \
make -C coreboot CPUS=$(nproc) DEST=/opt/xgcc crossgcc-x64 && \
rm -rf coreboot
FROM ${CONTAINER_IMAGE}
COPY --from=crossgcc-build /opt/xgcc /opt/xgcc
ENV XGCCPATH "/opt/xgcc/bin"
ENV PATH "$XGCCPATH:$PATH"
RUN apt-get --quiet update && \
apt-get --quiet install --no-install-recommends --assume-yes \
bash \
ca-certificates \
curl \
git \
git-lfs \
make
WORKDIR /workspace
This could be used as-is, as it covers the most time spent for setting up the toolchains. scripts/_build/edk2.sh would need to be updated to handle path change (done in #489).