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

Add src-buildkit and src bake targets to retrieve qemu sources w/ and w/o patches #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ ARG QEMU_REPO=https://github.com/qemu/qemu
# xx is a helper for cross-compilation
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.1.1 AS xx

FROM --platform=$BUILDPLATFORM ${ALPINE_BASE} AS src
FROM --platform=$BUILDPLATFORM ${ALPINE_BASE} AS src-clone
RUN apk add --no-cache git patch

WORKDIR /src
ARG QEMU_VERSION
ARG QEMU_REPO
RUN git clone $QEMU_REPO && cd qemu && git checkout $QEMU_VERSION
RUN mkdir qemu && cd qemu && git init && git fetch --depth 1 $QEMU_REPO $QEMU_VERSION && git checkout FETCH_HEAD
COPY patches patches
# QEMU_PATCHES defines additional patches to apply before compilation
ARG QEMU_PATCHES=cpu-max
Expand Down Expand Up @@ -56,6 +56,9 @@ RUN <<eof
scripts/git-submodule.sh update ui/keycodemapdb tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc slirp
eof

FROM scratch AS src
COPY --from=src-clone /src/qemu/ /

FROM --platform=$BUILDPLATFORM ${ALPINE_BASE} AS base
RUN apk add --no-cache git clang lld python3 llvm make ninja pkgconfig glib-dev gcc musl-dev perl bash
COPY --from=xx / /
Expand All @@ -74,7 +77,7 @@ ARG TARGETPLATFORM
# QEMU_TARGETS sets architectures that emulators are built for (default all)
ARG QEMU_VERSION QEMU_TARGETS
ENV AR=llvm-ar STRIP=llvm-strip
RUN --mount=target=.,from=src,src=/src/qemu,rw --mount=target=./install-scripts,src=scripts \
RUN --mount=target=.,from=src,rw --mount=target=./install-scripts,src=scripts \
TARGETPLATFORM=${TARGETPLATFORM} configure_qemu.sh && \
make -j "$(getconf _NPROCESSORS_ONLN)" && \
make install && \
Expand Down
12 changes: 12 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,15 @@ target "archive" {
target "archive-all" {
inherits = ["archive", "all-arch"]
}

target "src" {
inherits = ["mainline"]
target = "src"
output = ["./qemu"]
}

target "src-buildkit" {
inherits = ["buildkit"]
target = "src"
output = ["./qemu"]
}