Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Containerize builds #463

Open
crawfxrd opened this issue Aug 18, 2023 · 1 comment
Open

Containerize builds #463

crawfxrd opened this issue Aug 18, 2023 · 1 comment
Assignees

Comments

@crawfxrd
Copy link
Member

crawfxrd commented Aug 18, 2023

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:

We only need crossgcc-i386 and crossgcc-x64, so we should build our own image to minimize the size.

@crawfxrd
Copy link
Member Author

crawfxrd commented Sep 22, 2023

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).

@crawfxrd crawfxrd self-assigned this Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant