qemu: Improve cache build
Add arguments and files as needed, if only of them
changes the build will start from the change and
not from scratch.
# SPDX-License-Identifier: Apache-2.0
from ubuntu:20.04
-ARG QEMU_DESTDIR
-ARG QEMU_REPO
-# commit/tag/branch
-ARG QEMU_VERSION
-ARG QEMU_TARBALL
-ARG PREFIX
WORKDIR /root/qemu
@@ -55,7 +49,13 @@ RUN apt-get --no-install-recommends install -y \
rsync \
zlib1g-dev
+ARG QEMU_REPO
+
RUN cd .. && git clone "${QEMU_REPO}" qemu
+
+# commit/tag/branch
+ARG QEMU_VERSION
+
RUN git checkout "${QEMU_VERSION}"
RUN git clone https://github.com/qemu/capstone.git capstone
RUN git clone https://github.com/qemu/keycodemapdb.git ui/keycodemapdb
@@ -63,7 +63,6 @@ RUN git clone https://github.com/qemu/keycodemapdb.git ui/keycodemapdb
ADD scripts/configure-hypervisor.sh /root/configure-hypervisor.sh
ADD qemu /root/kata_qemu
ADD scripts/apply_patches.sh /root/apply_patches.sh
-ADD static-build /root/static-build
RUN echo "Apply patches for base version"
RUN stable_branch=$(cat VERSION | awk 'BEGIN{FS=OFS="."}{print $1 "." $2 ".x"}') && \
@@ -72,10 +71,15 @@ RUN stable_branch=$(cat VERSION | awk 'BEGIN{FS=OFS="."}{print $1 "." $2 ".x"}')
RUN echo "Apply patches for specific qemu version"
RUN /root/apply_patches.sh "/root/kata_qemu/patches/tag_patches/${QEMU_VERSION}"
+ARG PREFIX
ARG BUILD_SUFFIX
RUN PREFIX="${PREFIX}" /root/configure-hypervisor.sh -s "kata-qemu${BUILD_SUFFIX}" | xargs ./configure \
--with-pkgversion="kata-static${BUILD_SUFFIX}"
RUN make -j$(nproc)
+ARG QEMU_DESTDIR
RUN make install DESTDIR="${QEMU_DESTDIR}"
+ARG QEMU_TARBALL
+ADD static-build/scripts/qemu-build-post.sh /root/static-build/scripts/qemu-build-post.sh
+ADD static-build/qemu.blacklist /root/static-build/qemu.blacklist
RUN /root/static-build/scripts/qemu-build-post.sh
