diff options
Diffstat (limited to 'scripts/compile-edk2.sh')
-rwxr-xr-x | scripts/compile-edk2.sh | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/scripts/compile-edk2.sh b/scripts/compile-edk2.sh new file mode 100755 index 0000000..d940381 --- /dev/null +++ b/scripts/compile-edk2.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +# args +arch="$1" +cross="$2" + +# figure gcc version, set cross build prefix vars +gccver=$(${cross}gcc --version \ + | awk '{ print $3; exit}' \ + | cut -d. -f1,2 \ + | tr -d ".") +case "$gccver" in +4*) # nothing, keep "4x" + ;; +5* | 6* | 7*) + gccver=5 + ;; +esac +toolchain="GCC$gccver" + +eval "export GCC${gccver}_IA32_PREFIX=${cross}" +eval "export GCC${gccver}_X64_PREFIX=${cross}" +eval "export GCC${gccver}_ARM_PREFIX=${cross}" +eval "export GCC${gccver}_AARCH64_PREFIX=${cross}" + +# what we are going to build? +case "$arch" in +i386) + efiarch="IA32" + project="OvmfPkg/OvmfPkgIa32.dsc" + match="OvmfIa32/*/FV/OVMF*.fd" + ;; +x86_64) + efiarch="X64" + project="OvmfPkg/OvmfPkgX64.dsc" + match="OvmfX64/*/FV/OVMF*.fd" + ;; +arm | aarch64) + efiarch="$(echo $arch | tr 'a-z' 'A-Z')" + project="ArmVirtPkg/ArmVirtQemu.dsc" + match="ArmVirtQemu-${efiarch}/*/FV/QEMU_*.fd" + ;; +esac + +# setup edk2 build environment +cd repos/edk2 +source ./edksetup.sh --reconfig +bopts="" +bopts="$bopts -t $toolchain" +bopts="$bopts -D HTTP_BOOT_ENABLE" +bopts="$bopts -a $efiarch" +bopts="$bopts -p $project" + +# go build everything +make -C BaseTools || exit 1 +build $bopts || exit 1 + +# copy over results +dest="../../blobs/edk2-${arch}" +mkdir -p "$dest" +cp -v Build/${match} "$dest" |