From 0d2820d83c1fd603eae28589deff8e7d85e81f8b Mon Sep 17 00:00:00 2001 From: Christoph Ostarek Date: Thu, 29 Aug 2024 09:37:57 +0000 Subject: [PATCH] Dockerfile.gcc: enable ccache to speedup compilation Signed-off-by: Christoph Ostarek (cherry picked from commit 0a96a05f380cea23a48741999c94e72af057904b) --- Dockerfile.gcc | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Dockerfile.gcc b/Dockerfile.gcc index f0821d8613270..98a6472f99956 100644 --- a/Dockerfile.gcc +++ b/Dockerfile.gcc @@ -98,19 +98,17 @@ RUN if [ -f "/kernel-src/certs/x509.genkey" ]; then \ cp /kernel-src/certs/x509.genkey /kernel-out/certs/x509.genkey; \ fi +RUN make -j$(nproc) mrproper +RUN make O=/kernel-out ${KERNEL_CONFIG} RUN --mount=type=cache,target=/root/.cache/ccache,id=kernel-ccache-${TARGETARCH} \ - ccache -z && \ - echo "Building kernel for ${TARGETARCH} with ARCH=${ARCH} and CROSS_COMPILE=${CROSS_COMPILE}" && \ - make -j$(nproc) mrproper \ - && make O=/kernel-out ${KERNEL_CONFIG} \ - && make O=/kernel-out LOCALVERSION="-${LOCALVERSION}" -j$(nproc) prepare \ - && make O=/kernel-out LOCALVERSION="-${LOCALVERSION}" -j$(nproc) \ - && make O=/kernel-out LOCALVERSION="-${LOCALVERSION}" -j$(nproc) modules \ - && make O=/kernel-out LOCALVERSION="-${LOCALVERSION}" -j$(nproc) modules_install INSTALL_MOD_STRIP=1 \ - INSTALL_MOD_PATH=/tmp/kernel-modules \ - && make O=/kernel-out -j$(nproc) \ + ccache -z \ + && echo "Building kernel for ${TARGETARCH} with ARCH=${ARCH} and CROSS_COMPILE=${CROSS_COMPILE}" \ + && make CC="${CROSS_COMPILE}gcc" O=/kernel-out LOCALVERSION="-${LOCALVERSION}" -j$(nproc) prepare Image modules \ + && make CC="${CROSS_COMPILE}gcc" O=/kernel-out LOCALVERSION="-${LOCALVERSION}" -j$(nproc) modules_install INSTALL_MOD_STRIP=1 \ + INSTALL_MOD_PATH=/tmp/kernel-modules #\ + && make CC="${CROSS_COMPILE}gcc" O=/kernel-out -j$(nproc) \ INSTALL_DTBS_PATH=/tmp/kernel-modules/boot/dtb dtbs_install && \ - ccache -s + ccache -s | tee -a /ccache-stats.txt ADD https://github.com/openzfs/zfs.git#zfs-2.2.2 /tmp/zfs WORKDIR /tmp/zfs @@ -127,9 +125,9 @@ RUN --mount=type=cache,target=/root/.cache/ccache,id=zfs-ccache-${TARGETARCH} \ ./scripts/make_gitrev.sh RUN --mount=type=cache,target=/root/.cache/ccache,id=zfs-ccache-${TARGETARCH} \ - make -C module -j$(nproc) && \ + make CC="${CROSS_COMPILE}gcc" -C module -j$(nproc) && \ make -C module INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=/tmp/kernel-modules install && \ - ccache -s + ccache -s | tee -a /ccache-stats.txt FROM builder as artifacts