tests: Build EDK2 for AArch64 integration test

This commit added support for building the edk2 binary dedicated
for the Cloud Hypervisor (CLOUDHV_EFI.fd).

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
Henry Wang 2021-04-26 13:51:33 +08:00 committed by Xin Wang
parent 88fda7c305
commit 3cb2b72e92
2 changed files with 71 additions and 1 deletions

View File

@ -37,9 +37,13 @@ RUN apt-get update \
socat \
dosfstools \
cpio \
python \
python3 \
python3-setuptools \
ntfs-3g \
openvswitch-switch-dpdk \
python3-distutils \
uuid-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

View File

@ -8,9 +8,73 @@ export BUILD_TARGET=${BUILD_TARGET-aarch64-unknown-linux-gnu}
WORKLOADS_DIR="$HOME/workloads"
WORKLOADS_LOCK="$WORKLOADS_DIR/integration_test.lock"
EDK2_BUILD_DIR="$WORKLOADS_DIR/edk2_build"
mkdir -p "$WORKLOADS_DIR"
build_edk2() {
EDK2_REPO="https://github.com/cloud-hypervisor/edk2.git"
EDK2_DIR="edk2"
EDK2_BRANCH="ch-aarch64"
EDK2_PLAT_REPO="https://github.com/tianocore/edk2-platforms.git"
EDK2_PLAT_DIR="edk2-platforms"
ACPICA_REPO="https://github.com/acpica/acpica.git"
ACPICA_DIR="acpica"
export WORKSPACE="$EDK2_BUILD_DIR"
export PACKAGES_PATH="$WORKSPACE/$EDK2_DIR:$WORKSPACE/$EDK2_PLAT_DIR"
export IASL_PREFIX="$WORKSPACE/acpica/generate/unix/bin/"
cd "$WORKLOADS_DIR"
if [ ! -d "$WORKSPACE" ]; then
mkdir -p "$WORKSPACE"
fi
pushd "$WORKSPACE"
# Check whether the local HEAD commit same as the remote HEAD or not. Remove the folder if they are different.
if [ -d "$EDK2_DIR" ]; then
pushd $EDK2_DIR
git fetch
EDK2_LOCAL_HEAD=$(git rev-parse HEAD)
EDK2_REMOTE_HEAD=$(git rev-parse remotes/origin/$EDK2_BRANCH)
popd
if [ "$EDK2_LOCAL_HEAD" != "$EDK2_REMOTE_HEAD" ]; then
# If EDK2 code is out of date, remove and rebuild all
rm -rf "$EDK2_DIR"
rm -rf "$EDK2_PLAT_DIR"
rm -rf "$ACPICA_DIR"
fi
fi
if [ ! -d "$EDK2_DIR" ]; then
time git clone --depth 1 "$EDK2_REPO" -b "$EDK2_BRANCH" "$EDK2_DIR"
pushd $EDK2_DIR
git submodule update --init
popd
fi
if [ ! -d "$EDK2_PLAT_DIR" ]; then
time git clone --depth 1 "$EDK2_PLAT_REPO" -b master "$EDK2_PLAT_DIR"
fi
if [ ! -d "$ACPICA_DIR" ]; then
time git clone --depth 1 "$ACPICA_REPO" -b master "$ACPICA_DIR"
fi
make -C "$ACPICA_DIR"/
source edk2/edksetup.sh
make -C edk2/BaseTools
build -a AARCH64 -t GCC5 -p ArmVirtPkg/ArmVirtCloudHv.dsc -b RELEASE
cp Build/ArmVirtCloudHv-AARCH64/RELEASE_GCC5/FV/CLOUDHV_EFI.fd "$WORKLOADS_DIR"
echo "Info: build UEFI successfully"
popd
}
update_workloads() {
cp scripts/sha1sums-aarch64 $WORKLOADS_DIR
@ -176,6 +240,9 @@ update_workloads() {
echo "foo" > "$SHARED_DIR/file1"
echo "bar" > "$SHARED_DIR/file3" || exit 1
fi
# Check and build EDK2 binary
build_edk2
}
process_common_args "$@"
@ -241,7 +308,6 @@ echo "Integration test on FDT finished with result $RES."
if [ $RES -eq 0 ]; then
# Test with EDK2 + ACPI
cargo build --all --release $features_build_acpi --target $BUILD_TARGET
RES=$?
echo "Integration test on UEFI & ACPI finished with result $RES."
fi