mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-03 11:25:20 +00:00
scripts: aarch64: Reduce source code build in CI
As Linux kernel, edk2, virtiofd, SPDK are all build from source, we need to find a way to reduce the number of source code build. To address this issue, this commit adds a stage that touching a ".built" file to each repo of the source code after a successfully build. By checking if the ".built" file exists, we can determine if there is already an old build. Since the source code repo will be removed and cloned again when we bump the repo hash, the CI will rebuild the repo. Signed-off-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
parent
823a860250
commit
0fa71ddf7e
@ -59,13 +59,16 @@ build_custom_linux() {
|
|||||||
|
|
||||||
checkout_repo "$LINUX_CUSTOM_DIR" "$LINUX_CUSTOM_URL" "$LINUX_CUSTOM_BRANCH"
|
checkout_repo "$LINUX_CUSTOM_DIR" "$LINUX_CUSTOM_URL" "$LINUX_CUSTOM_BRANCH"
|
||||||
|
|
||||||
cp $SRCDIR/resources/linux-config-aarch64 $LINUX_CUSTOM_DIR/.config
|
if [ ! -f "$LINUX_CUSTOM_DIR/.built" ]; then
|
||||||
|
cp $SRCDIR/resources/linux-config-aarch64 $LINUX_CUSTOM_DIR/.config
|
||||||
|
|
||||||
pushd $LINUX_CUSTOM_DIR
|
pushd $LINUX_CUSTOM_DIR
|
||||||
time make -j `nproc`
|
time make -j `nproc`
|
||||||
cp arch/arm64/boot/Image "$WORKLOADS_DIR/" || exit 1
|
cp arch/arm64/boot/Image "$WORKLOADS_DIR/" || exit 1
|
||||||
cp arch/arm64/boot/Image.gz "$WORKLOADS_DIR/" || exit 1
|
cp arch/arm64/boot/Image.gz "$WORKLOADS_DIR/" || exit 1
|
||||||
popd
|
touch .built
|
||||||
|
popd
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
build_edk2() {
|
build_edk2() {
|
||||||
@ -92,33 +95,61 @@ build_edk2() {
|
|||||||
checkout_repo "$EDK2_PLAT_DIR" "$EDK2_PLAT_REPO" master "8227e9e9f6a8aefbd772b40138f835121ccb2307"
|
checkout_repo "$EDK2_PLAT_DIR" "$EDK2_PLAT_REPO" master "8227e9e9f6a8aefbd772b40138f835121ccb2307"
|
||||||
checkout_repo "$ACPICA_DIR" "$ACPICA_REPO" master "b9c69f81a05c45611c91ea9cbce8756078d76233"
|
checkout_repo "$ACPICA_DIR" "$ACPICA_REPO" master "b9c69f81a05c45611c91ea9cbce8756078d76233"
|
||||||
|
|
||||||
pushd "$EDK2_BUILD_DIR"
|
if [[ ! -f "$EDK2_DIR/.built" || \
|
||||||
# Build
|
! -f "$EDK2_PLAT_DIR/.built" || \
|
||||||
make -C acpica -j `nproc`
|
! -f "$ACPICA_DIR/.built" ]]; then
|
||||||
source edk2/edksetup.sh
|
pushd "$EDK2_BUILD_DIR"
|
||||||
make -C edk2/BaseTools -j `nproc`
|
# Build
|
||||||
build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtCloudHv.dsc -b RELEASE -n 0
|
make -C acpica -j `nproc`
|
||||||
cp Build/ArmVirtCloudHv-AARCH64/RELEASE_GCC5/FV/CLOUDHV_EFI.fd "$WORKLOADS_DIR"
|
source edk2/edksetup.sh
|
||||||
popd
|
make -C edk2/BaseTools -j `nproc`
|
||||||
|
build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtCloudHv.dsc -b RELEASE -n 0
|
||||||
|
cp Build/ArmVirtCloudHv-AARCH64/RELEASE_GCC5/FV/CLOUDHV_EFI.fd "$WORKLOADS_DIR"
|
||||||
|
touch "$EDK2_DIR"/.built
|
||||||
|
touch "$EDK2_PLAT_DIR"/.built
|
||||||
|
touch "$ACPICA_DIR"/.built
|
||||||
|
popd
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
build_spdk_nvme() {
|
build_spdk_nvme() {
|
||||||
SPDK_DIR="$WORKLOADS_DIR/spdk"
|
SPDK_DIR="$WORKLOADS_DIR/spdk"
|
||||||
SPDK_REPO="https://github.com/spdk/spdk.git"
|
SPDK_REPO="https://github.com/spdk/spdk.git"
|
||||||
|
SPDK_DEPLOY_DIR="/usr/local/bin/spdk-nvme"
|
||||||
checkout_repo "$SPDK_DIR" "$SPDK_REPO" master "f9c496b8e21a8f499df268818bf8b5d8e2b19f04"
|
checkout_repo "$SPDK_DIR" "$SPDK_REPO" master "f9c496b8e21a8f499df268818bf8b5d8e2b19f04"
|
||||||
|
|
||||||
pushd $SPDK_DIR
|
if [ ! -f "$SPDK_DIR/.built" ]; then
|
||||||
git submodule update --init
|
pushd $SPDK_DIR
|
||||||
apt-get update
|
git submodule update --init
|
||||||
./scripts/pkgdep.sh
|
apt-get update
|
||||||
./configure --with-vfio-user
|
./scripts/pkgdep.sh
|
||||||
chmod +x /usr/local/lib/python3.8/dist-packages/ninja/data/bin/ninja
|
./configure --with-vfio-user
|
||||||
make -j `nproc`
|
chmod +x /usr/local/lib/python3.8/dist-packages/ninja/data/bin/ninja
|
||||||
mkdir /usr/local/bin/spdk-nvme
|
make -j `nproc` || exit 1
|
||||||
cp ./build/bin/nvmf_tgt /usr/local/bin/spdk-nvme
|
touch .built
|
||||||
cp ./scripts/rpc.py /usr/local/bin/spdk-nvme
|
popd
|
||||||
cp -r ./scripts/rpc /usr/local/bin/spdk-nvme
|
fi
|
||||||
popd
|
if [ ! -d "/usr/local/bin/spdk-nvme" ]; then
|
||||||
|
mkdir -p $SPDK_DEPLOY_DIR
|
||||||
|
fi
|
||||||
|
cp "$WORKLOADS_DIR/spdk/build/bin/nvmf_tgt" $SPDK_DEPLOY_DIR/nvmf_tgt
|
||||||
|
cp "$WORKLOADS_DIR/spdk/scripts/rpc.py" $SPDK_DEPLOY_DIR/rpc.py
|
||||||
|
cp -r "$WORKLOADS_DIR/spdk/scripts/rpc" $SPDK_DEPLOY_DIR/rpc
|
||||||
|
}
|
||||||
|
|
||||||
|
build_virtiofsd() {
|
||||||
|
VIRTIOFSD_DIR="$WORKLOADS_DIR/virtiofsd_build"
|
||||||
|
VIRTIOFSD_REPO="https://gitlab.com/virtio-fs/virtiofsd.git"
|
||||||
|
|
||||||
|
checkout_repo "$VIRTIOFSD_DIR" "$VIRTIOFSD_REPO" v1.1.0 "220405d7a2606c92636d31992b5cb3036a41047b"
|
||||||
|
|
||||||
|
if [ ! -f "$VIRTIOFSD_DIR/.built" ]; then
|
||||||
|
pushd $VIRTIOFSD_DIR
|
||||||
|
time cargo build --release
|
||||||
|
cp target/release/virtiofsd "$WORKLOADS_DIR/" || exit 1
|
||||||
|
touch .built
|
||||||
|
popd
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
update_workloads() {
|
update_workloads() {
|
||||||
@ -217,19 +248,7 @@ update_workloads() {
|
|||||||
guestunmount "$FOCAL_OS_RAW_IMAGE_UPDATE_KERNEL_ROOT_DIR"
|
guestunmount "$FOCAL_OS_RAW_IMAGE_UPDATE_KERNEL_ROOT_DIR"
|
||||||
|
|
||||||
# Build virtiofsd
|
# Build virtiofsd
|
||||||
VIRTIOFSD="$WORKLOADS_DIR/virtiofsd"
|
build_virtiofsd
|
||||||
VIRTIOFSD_DIR="virtiofsd_build"
|
|
||||||
if [ ! -f "$VIRTIOFSD" ]; then
|
|
||||||
pushd $WORKLOADS_DIR
|
|
||||||
git clone "https://gitlab.com/virtio-fs/virtiofsd.git" $VIRTIOFSD_DIR
|
|
||||||
pushd $VIRTIOFSD_DIR
|
|
||||||
git checkout v1.1.0
|
|
||||||
time cargo build --release
|
|
||||||
cp target/release/virtiofsd $VIRTIOFSD || exit 1
|
|
||||||
popd
|
|
||||||
rm -rf $VIRTIOFSD_DIR
|
|
||||||
popd
|
|
||||||
fi
|
|
||||||
|
|
||||||
BLK_IMAGE="$WORKLOADS_DIR/blk.img"
|
BLK_IMAGE="$WORKLOADS_DIR/blk.img"
|
||||||
MNT_DIR="mount_image"
|
MNT_DIR="mount_image"
|
||||||
@ -252,10 +271,10 @@ update_workloads() {
|
|||||||
echo "bar" > "$SHARED_DIR/file3" || exit 1
|
echo "bar" > "$SHARED_DIR/file3" || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# checkout and build SPDK NVMe
|
# Checkout and build SPDK NVMe
|
||||||
build_spdk_nvme
|
build_spdk_nvme
|
||||||
|
|
||||||
# Check and build EDK2 binary
|
# Checkout and build EDK2
|
||||||
build_edk2
|
build_edk2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user