# Overwrite the "do_compile" step in order to support AARCH64 targets. COMPATIBLE_HOST='(i.86|x86_64|aarch64).*' do_compile_class-target() { export LFLAGS="${LDFLAGS}" PARALLEL_JOBS="${@ '${PARALLEL_MAKE}'.replace('-j', '-n ')}" OVMF_ARCH="X64" if [ "${TARGET_ARCH}" != "x86_64" ] ; then OVMF_ARCH="IA32" fi if [ "${TARGET_ARCH}" = "aarch64" ] ; then OVMF_ARCH="AARCH64" fi # The build for the target uses BaseTools/Conf/tools_def.template # from ovmf-native to find the compiler, which depends on # exporting HOST_PREFIX. export HOST_PREFIX="${HOST_PREFIX}" # BaseTools/Conf gets copied to Conf, but only if that does not # exist yet. To ensure that an updated template gets used during # incremental builds, we need to remove the copy before we start. rm -f `ls ${S}/Conf/*.txt | grep -v ReadMe.txt` # ${WORKDIR}/ovmf is a well-known location where do_install and # do_deploy will be able to find the files. rm -rf ${WORKDIR}/ovmf mkdir ${WORKDIR}/ovmf OVMF_DIR_SUFFIX="X64" if [ "${TARGET_ARCH}" != "x86_64" ] ; then OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization fi if [ "${TARGET_ARCH}" = "aarch64" ] ; then OVMF_DIR_SUFFIX="AArch64" # Note the different capitalization fi FIXED_GCCVER=$(fixup_target_tools ${GCC_VER}) bbnote FIXED_GCCVER is ${FIXED_GCCVER} if [ "${TARGET_ARCH}" = "aarch64" ] ; then build_dir="${S}/Build/ArmVirtQemu-AARCH64/RELEASE_${FIXED_GCCVER}" bbnote "Building without Secure Boot." rm -rf ${S}/Build/ArmVirtQemu-AARCH64 # If the local BaseTools directory is not found, the EDK_TOOLS_PATH # variable is used to determine the location of the toolchain rm -rf ${S}/BaseTools export EDK_TOOLS_PATH=${WORKDIR}/recipe-sysroot-native/usr/bin/edk2_basetools/BaseTools bash -c "(source ${S}/edksetup.sh; GCC5_AARCH64_PREFIX=aarch64-poky-linux- build -a AARCH64 -p ArmVirtPkg/ArmVirtQemu.dsc -t GCC5 -b RELEASE)" else build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}" bbnote "Building without Secure Boot." rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.fd ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.code.fd ln ${build_dir}/FV/OVMF_VARS.fd ${WORKDIR}/ovmf/ovmf.vars.fd fi ln ${build_dir}/${OVMF_ARCH}/Shell.efi ${WORKDIR}/ovmf/ if ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'true', 'false', d)}; then # See CryptoPkg/Library/OpensslLib/Patch-HOWTO.txt and # https://src.fedoraproject.org/cgit/rpms/edk2.git/tree/ for # building with Secure Boot enabled. bbnote "Building with Secure Boot." rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX ln -sf ${OPENSSL_RELEASE} ${S}/CryptoPkg/Library/OpensslLib/openssl ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${OVMF_SECURE_BOOT_FLAGS} ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.secboot.fd ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.secboot.code.fd ln ${build_dir}/${OVMF_ARCH}/EnrollDefaultKeys.efi ${WORKDIR}/ovmf/ fi } do_install_class-target() { if [ "${TARGET_ARCH}" = "aarch64" ] ; then FIXED_GCCVER=$(fixup_target_tools ${GCC_VER}) build_dir="${S}/Build/ArmVirtQemu-AARCH64/RELEASE_${FIXED_GCCVER}" install -d ${D}/usr/share/qemu install -m 766 ${build_dir}/FV/QEMU_EFI.fd ${D}/usr/share/qemu/AAVMF_CODE.fd install -m 766 ${build_dir}/FV/QEMU_VARS.fd ${D}/usr/share/qemu/AAVMF_VARS.fd else # Content for UEFI shell iso. We install the EFI shell as # bootx64/ia32.efi because then it can be started even when the # firmware itself does not contain it. install -d ${D}/efi/boot install ${WORKDIR}/ovmf/Shell.efi ${D}/efi/boot/boot${@ "ia32" if "${TARGET_ARCH}" != "x86_64" else "x64"}.efi if ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'true', 'false', d)}; then install ${WORKDIR}/ovmf/EnrollDefaultKeys.efi ${D} fi fi } FILES_${PN}_class-target_aarch64 += "/usr/share/qemu/" do_deploy_class-target() { if [ "${TARGET_ARCH}" != "aarch64" ] ; then # For use with "runqemu ovmf". for i in \ ovmf \ ovmf.code \ ovmf.vars \ ${@bb.utils.contains('PACKAGECONFIG', 'secureboot', 'ovmf.secboot ovmf.secboot.code', '', d)} \ ; do qemu-img convert -f raw -O qcow2 ${WORKDIR}/ovmf/$i.fd ${DEPLOYDIR}/$i.qcow2 done fi }