public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jordan Justen" <jordan.l.justen@intel.com>
To: devel@edk2.groups.io
Cc: Laszlo Ersek <lersek@redhat.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Jordan Justen <jordan.l.justen@intel.com>
Subject: [PATCH 5/5] OvmfPkg/build.sh: Add a cross compiler prefix for AARCH64/ARM
Date: Wed, 10 Apr 2019 02:34:24 -0700	[thread overview]
Message-ID: <20190410093424.20365-5-jordan.l.justen@intel.com> (raw)
In-Reply-To: <20190410093424.20365-1-jordan.l.justen@intel.com>

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
---
 OvmfPkg/build.sh | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh
index 9d787452b5..e1a708942b 100755
--- a/OvmfPkg/build.sh
+++ b/OvmfPkg/build.sh
@@ -103,9 +103,6 @@ do
   shift
 done
 
-export GCC5_AARCH64_PREFIX=aarch64-linux-gnu-
-export GCC5_ARM_PREFIX=arm-linux-gnueabihf-
-
 if [[ "$ARCH_AARCH64" == "yes" ]]; then
   PROCESSOR=AARCH64
   Processor=AArch64
@@ -138,6 +135,23 @@ else
   BUILD_ROOT_ARCH=X64
 fi
 
+GCC_CROSS_PREFIX=
+gcc_machine=$(gcc -dumpmachine 2>&1 | awk -F - '{print $1}')
+case $gcc_machine in
+  x86_64)
+    case $BUILD_ROOT_ARCH in
+      AARCH64)
+	GCC_CROSS_PREFIX=aarch64-linux-gnu-
+        ;;
+      ARM)
+	GCC_CROSS_PREFIX=arm-linux-gnueabihf-
+        ;;
+    esac
+    ;;
+esac
+
+GCC=${GCC_CROSS_PREFIX}gcc
+
 #
 # Pick a default tool type for a given OS
 #
@@ -169,7 +183,7 @@ if [ -z "$TARGET_TOOLS" ]; then
       esac
       ;;
     Linux*)
-      gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
+      gcc_version=$($GCC -v 2>&1 | tail -1 | awk '{print $3}')
       case $gcc_version in
         [1-3].*|4.[0-7].*)
           echo OvmfPkg requires GCC4.8 or later
@@ -188,6 +202,10 @@ if [ -z "$TARGET_TOOLS" ]; then
   esac
 fi
 
+if [ -n "${GCC_CROSS_PREFIX}" ]; then
+  export ${TARGET_TOOLS}_${BUILD_ROOT_ARCH}_PREFIX=${GCC_CROSS_PREFIX}
+fi
+
 case $PROCESSOR in
   AARCH64)
     if [ -z "$QEMU_COMMAND" ]; then
-- 
2.20.1


  parent reply	other threads:[~2019-04-10  9:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10  9:34 [PATCH 1/5] OvmfPkg/build.sh: Require QEMU 1.6 or newer and always enable flash Jordan Justen
2019-04-10  9:34 ` [PATCH 2/5] OvmfPkg/build.sh: Don't automatically -hda qemu parameter Jordan Justen
2019-04-10  9:34 ` [PATCH 3/5] OvmfPkg/build.sh: Move automatic TARGET_TOOLS detection later Jordan Justen
2019-04-10 15:37   ` [edk2-devel] " Philippe Mathieu-Daudé
2019-04-10 19:56     ` Jordan Justen
2019-04-10  9:34 ` [PATCH 4/5] OvmfPkg/build.sh: Add AARCH64/ARM build and qemu support Jordan Justen
2019-04-10  9:34 ` Jordan Justen [this message]
2019-04-10 14:16 ` [edk2-devel] [PATCH 1/5] OvmfPkg/build.sh: Require QEMU 1.6 or newer and always enable flash Laszlo Ersek
2019-04-10 20:18   ` Jordan Justen
2019-04-11  7:48     ` Laszlo Ersek
2019-04-10 14:45 ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190410093424.20365-5-jordan.l.justen@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox