Skip to content

Commit ad993f4

Browse files
committed
fix(installer): extract kernel source to separate dir
Move the kernel source tree from the build volume to a separate path so the extracted tree survives Docker layer caching while keeping the build volume for the downloaded tarball only.
1 parent e78a608 commit ad993f4

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎tools/installer-kernel/build.sh‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,16 @@ else
5757
echo ">>> downloading linux ${LINUX_VERSION}"
5858
wget -4 -q "https://cdn.kernel.org/pub/linux/kernel/${series}/${tarball}"
5959
fi
60-
if [ -d "linux-${LINUX_VERSION}" ] && [ -f "linux-${LINUX_VERSION}/scripts/Kbuild.include" ]; then
61-
echo ">>> reusing existing source tree linux-${LINUX_VERSION}"
60+
61+
BUILD_TREE="/tmp/linux-${LINUX_VERSION}"
62+
if [ -d "${BUILD_TREE}" ] && [ -f "${BUILD_TREE}/scripts/Kbuild.include" ]; then
63+
echo ">>> reusing existing source tree ${BUILD_TREE}"
6264
else
63-
rm -rf "linux-${LINUX_VERSION}"
64-
tar xf "$tarball"
65+
rm -rf "${BUILD_TREE}"
66+
echo ">>> extracting to ${BUILD_TREE}"
67+
tar xf "$tarball" -C /tmp
6568
fi
66-
cd "linux-${LINUX_VERSION}"
69+
cd "${BUILD_TREE}"
6770

6871
echo ">>> configuring (defconfig + kernel.config + ${PROFILE} profile) for ${ARCH}"
6972
make ARCH="$KERNEL_ARCH" defconfig

0 commit comments

Comments
 (0)