Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#38800): https://edk2.groups.io/g/devel/message/38800
Mute This Topic: https://groups.io/mt/31017202/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to