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 <Henry.Wang@arm.com>
This commit is contained in:
Henry Wang 2020-07-13 10:07:08 +08:00 committed by Sebastien Boeuf
parent dc55e45977
commit e81402e76e

View File

@ -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"