From 94aef1ab52304cf64ac328c5ac4ee516ec60761c Mon Sep 17 00:00:00 2001 From: Jianyong Wu Date: Thu, 11 Aug 2022 17:00:22 +0800 Subject: [PATCH] fw/arm64: speed up installation of UEFI image Building UEFI image from source take at least 5 min. We can build it once and save it as backup then copy the UEFI image there to cancel the build in the following UEFI image installation. Fixes: #5022 Signed-off-by: Jianyong Wu --- .ci/aarch64/install_rom_aarch64.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.ci/aarch64/install_rom_aarch64.sh b/.ci/aarch64/install_rom_aarch64.sh index f51a11178..caf6deea4 100755 --- a/.ci/aarch64/install_rom_aarch64.sh +++ b/.ci/aarch64/install_rom_aarch64.sh @@ -23,6 +23,7 @@ TOOLCHAIN_PREFIX="${TOOLCHAIN_ARCHIVE_PREFIX}/bin/aarch64-none-elf-" TOOLCHAIN_SOURCE_URL="https://developer.arm.com/-/media/Files/downloads/gnu-a/${TOOLCHAIN_VERSION}/binrel/${TOOLCHAIN_ARCHIVE}" export EDK2_WORKSPACE=$(mktemp -d) +BACKUP_EFI_DIR=$HOME/backup #tag or commit id of source code EDK2_REPO_TAG_ID="edk2-stable202202" @@ -36,6 +37,7 @@ INSTALL_PATH="${DESTDIR:-}${PREFIX}/share/kata-containers" EFI_NAME="QEMU_EFI.fd" EFI_DEFAULT_DIR="${EDK2_WORKSPACE}/qemu-efi-aarch64" EFI_DEFAULT_PATH="${EFI_DEFAULT_DIR}/${EFI_NAME}" +BACKUP_EFI="${BACKUP_EFI_DIR}/${EFI_NAME}" FLASH0_NAME="kata-flash0.img" FLASH1_NAME="kata-flash1.img" @@ -130,6 +132,11 @@ main() exit 0 fi + if [ -f "${BACKUP_EFI}" ]; then + [ ! -d "${EFI_DEFAULT_DIR}" ] && mkdir -p "${EFI_DEFAULT_DIR}" + cp "${BACKUP_EFI}" "${EFI_DEFAULT_PATH}" + fi + #There maybe something wrong with the qemu efi download from linaro #Just build it from source code until the issue is fixed if [ ! -e "${EFI_DEFAULT_PATH}" ]; then @@ -143,6 +150,10 @@ main() prepare_uefi_flash install_uefi_flash "${EDK2_WORKSPACE}/${FLASH0_NAME}" "${EDK2_WORKSPACE}/${FLASH1_NAME}" + # Save EFI file to backup dir + [ ! -d "${BACKUP_EFI_DIR}" ] && mkdir -p "${BACKUP_EFI_DIR}" + [ ! -f "${BACKUP_EFI}" ] && cp "${QEMU_EFI_BUILD_PATH}" "${BACKUP_EFI_DIR}" + echo "Info: install uefi rom image successfully" clean_up }