From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: jordan.l.justen@intel.com) Received: from mga04.intel.com (mga04.intel.com []) by groups.io with SMTP; Wed, 10 Apr 2019 02:35:30 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2019 02:35:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,332,1549958400"; d="scan'208";a="222175350" Received: from askirtik-mobl1.amr.corp.intel.com (HELO jljusten-skl.amr.corp.intel.com) ([10.254.188.249]) by orsmga001.jf.intel.com with ESMTP; 10 Apr 2019 02:35:29 -0700 From: "Jordan Justen" To: devel@edk2.groups.io Cc: Laszlo Ersek , Ard Biesheuvel , Jordan Justen Subject: [PATCH 4/5] OvmfPkg/build.sh: Add AARCH64/ARM build and qemu support Date: Wed, 10 Apr 2019 02:34:23 -0700 Message-Id: <20190410093424.20365-4-jordan.l.justen@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190410093424.20365-1-jordan.l.justen@intel.com> References: <20190410093424.20365-1-jordan.l.justen@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Signed-off-by: Jordan Justen --- OvmfPkg/build.sh | 72 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh index 812441b9b1..9d787452b5 100755 --- a/OvmfPkg/build.sh +++ b/OvmfPkg/build.sh @@ -35,6 +35,8 @@ fi # Configure defaults for various options # +ARCH_AARCH64=no +ARCH_ARM=no ARCH_IA32=no ARCH_X64=no BUILDTARGET=DEBUG @@ -71,12 +73,14 @@ do else case $LAST_ARG in -a) - if [[ x"$arg" != x"IA32" && x"$arg" != x"X64" ]]; then - echo Unsupported processor architecture: $arg - echo Only IA32 or X64 is supported - exit 1 - fi - eval ARCH_$arg=yes + case $arg in + AARCH64|ARM|IA32|X64) + eval ARCH_$arg=yes + ;; + *) + echo Unsupported processor architecture: $arg + exit 1 + esac ;; -b) BUILDTARGET=$arg @@ -99,7 +103,22 @@ do shift done -if [[ "$ARCH_IA32" == "yes" && "$ARCH_X64" == "yes" ]]; then +export GCC5_AARCH64_PREFIX=aarch64-linux-gnu- +export GCC5_ARM_PREFIX=arm-linux-gnueabihf- + +if [[ "$ARCH_AARCH64" == "yes" ]]; then + PROCESSOR=AARCH64 + Processor=AArch64 + BUILD_OPTIONS="$BUILD_OPTIONS -a $PROCESSOR" + PLATFORM_BUILD_DIR=ArmVirtQemu-$PROCESSOR + BUILD_ROOT_ARCH=$PROCESSOR +elif [[ "$ARCH_ARM" == "yes" ]]; then + PROCESSOR=ARM + Processor=Arm + BUILD_OPTIONS="$BUILD_OPTIONS -a $PROCESSOR" + PLATFORM_BUILD_DIR=ArmVirtQemu-$PROCESSOR + BUILD_ROOT_ARCH=$PROCESSOR +elif [[ "$ARCH_IA32" == "yes" && "$ARCH_X64" == "yes" ]]; then PROCESSOR=IA32X64 Processor=Ia32X64 BUILD_OPTIONS="$BUILD_OPTIONS -a IA32 -a X64" @@ -170,6 +189,22 @@ if [ -z "$TARGET_TOOLS" ]; then fi case $PROCESSOR in + AARCH64) + if [ -z "$QEMU_COMMAND" ]; then + # + # The user didn't set the QEMU_COMMAND variable. + # + QEMU_COMMAND=qemu-system-aarch64 + fi + ;; + ARM) + if [ -z "$QEMU_COMMAND" ]; then + # + # The user didn't set the QEMU_COMMAND variable. + # + QEMU_COMMAND=qemu-system-aarch64 + fi + ;; IA32) if [ -n "$QEMU_COMMAND" ]; then # @@ -203,7 +238,14 @@ case $PROCESSOR in esac if [ -z "$PLATFORMFILE" ]; then - PLATFORMFILE=$WORKSPACE/OvmfPkg/OvmfPkg$Processor.dsc + case $PROCESSOR in + AARCH64|ARM) + PLATFORMFILE=$WORKSPACE/ArmVirtPkg/ArmVirtQemu.dsc + ;; + *) + PLATFORMFILE=$WORKSPACE/OvmfPkg/OvmfPkg$Processor.dsc + ;; + esac fi if [[ "$RUN_QEMU" == "yes" ]]; then @@ -263,8 +305,15 @@ fi if [[ "$RUN_QEMU" == "yes" ]]; then - FIRMWARE_IMAGE=$FV_DIR/OVMF.fd - QEMU_COMMAND="$QEMU_COMMAND -pflash $FIRMWARE_IMAGE" + case $PROCESSOR in + AARCH64|ARM) + FIRMWARE_IMAGE="-bios $FV_DIR/QEMU_EFI.fd" + ;; + *) + FIRMWARE_IMAGE="-pflash $FV_DIR/OVMF.fd" + ;; + esac + QEMU_COMMAND="$QEMU_COMMAND $FIRMWARE_IMAGE" echo Running: $QEMU_COMMAND "$@" $QEMU_COMMAND "$@" exit $? @@ -273,7 +322,6 @@ fi # # Build the edk2 OvmfPkg # -echo Running edk2 build for OvmfPkg$Processor +echo Running edk2 build for $PROCESSOR $PLATFORMFILE build -p $PLATFORMFILE $BUILD_OPTIONS -b $BUILDTARGET -t $TARGET_TOOLS -n $THREADNUMBER exit $? - -- 2.20.1