From e81402e76ee8f5e1c06774202274bfb92cbbf4c4 Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Mon, 13 Jul 2020 10:07:08 +0800 Subject: [PATCH] ci: AArch64: Refactor custom linux kernel building strategy As the current AArch64 integration test builds kernel every time, which would take unnecessary time in CI and therefore not ideal. This commit refactors the AArch64 kernel building strategy to: 1. Keep the Linux kernel source code directory instead of deleting it everytime after the kernel is built. 2. In integration test script, check if the Linux kernel source code directory exists. If so use `git fetch && git checkout -f` to keep the source code always updated, else run `git clone` to get the source code. 3. Copy config file in and then compile the kernel. Fixes: https://github.com/cloud-hypervisor/cloud-hypervisor/issues/1444 Signed-off-by: Henry Wang --- scripts/run_integration_tests_aarch64.sh | 27 +++++++++++------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/scripts/run_integration_tests_aarch64.sh b/scripts/run_integration_tests_aarch64.sh index 0e2a3367c..fbf6800eb 100755 --- a/scripts/run_integration_tests_aarch64.sh +++ b/scripts/run_integration_tests_aarch64.sh @@ -104,30 +104,27 @@ PE_IMAGE="$WORKLOADS_DIR/Image" LINUX_CUSTOM_DIR="$WORKLOADS_DIR/linux-custom" build_custom_linux_kernel() { - SRCDIR=$PWD - pushd $WORKLOADS_DIR - time git clone --depth 1 "https://github.com/cloud-hypervisor/linux.git" -b "virtio-fs-virtio-iommu-virtio-mem-5.6-rc4" $LINUX_CUSTOM_DIR - cp $SRCDIR/resources/linux-config-aarch64 $LINUX_CUSTOM_DIR/.config - popd - pushd $LINUX_CUSTOM_DIR time make -j `nproc` cp arch/arm64/boot/Image $WORKLOADS_DIR/Image || exit 1 popd } -if [ ! -f "$PE_IMAGE" ]; then - build_custom_linux_kernel +if [ ! -d "$LINUX_CUSTOM_DIR" ]; then + pushd $WORKLOADS_DIR + time git clone --depth 1 "https://github.com/cloud-hypervisor/linux.git" -b "virtio-fs-virtio-iommu-virtio-mem-5.6-rc4" $LINUX_CUSTOM_DIR + popd + else - SRCDIR=$PWD - if [ "$PE_IMAGE" -ot "$SRCDIR/resources/linux-config-aarch64" ]; then - build_custom_linux_kernel - fi + pushd $LINUX_CUSTOM_DIR + git fetch + git checkout -f + popd fi -if [ -d "$LINUX_CUSTOM_DIR" ]; then - rm -rf $LINUX_CUSTOM_DIR -fi +SRCDIR=$PWD +cp $SRCDIR/resources/linux-config-aarch64 $LINUX_CUSTOM_DIR/.config +build_custom_linux_kernel VIRTIOFSD="$WORKLOADS_DIR/virtiofsd" QEMU_DIR="qemu_build"