Re: [edk2-devel] [PATCH 3/5] OvmfPkg/build.sh: Move automatic TARGET_TOOLS detection later

2019-04-10 Thread Jordan Justen
On 2019-04-10 08:37:22, Philippe Mathieu-Daudé wrote:
> Hi Jordan,
> 
> On 4/10/19 11:34 AM, Jordan Justen wrote:
> > If we are building for a non-native ARM, then we may need to select a
> > cross-compiler based on the -a paramter.
> 
> I am sorry but I am non-native English and I have hard time to
> understand your comment.
> 
> OVMF targets x86 hardware, which is obviously not ARM.

>From OvmfPkg/README:

"The Open Virtual Machine Firmware (OVMF) project aims to support
firmware for Virtual Machines using the edk2 code base."

This doesn't appear to indicate any particular architecture or VMM.
Nevertheless, ArmVirtPkg was created, so in effect, you are correct.

> And I'm not aware of another target architecture. Are you talking
> about the host where you build?

I mean the target. The patch looks for something like "-a AARCH64" on
the command line. If found, we try to build ArmVirtPkg/ArmVirtQemu.dsc
instead of OVMF.

It's a bit of a hack in that it will try to build the dsc from another
package. But, OvmfPkg/build.sh is a little more generic than one might
expect. For example, when I want to build MdeModulePkg, I usually just
run:

OvmfPkg/build.sh -p MdeModulePkg/MdeModulePkg.dsc

I find it convenient that the script sets up the build environment
automatically, and after the script is done, no changes persist in my
shell's environment.

> I am trying your series on a Aarch64 host but I fail at passing the
> correct cross gcc. I set GCC5_IA32_PREFIX, GCC5_X64_PREFIX and GCC5_BIN
> env vars, but the build script still run '"gcc"' instead of my cross one.
> 
> A more generic comment regarding your series: how do you use this script?

Yeah, you are right. The comments could be better. I'll try to improve
them.

Basically, these changes let me build ArmVirtPkg/ArmVirtQemu.dsc on
x86_64 Linux by simply added "-a AARCH64" or "-a ARM" parameteres to
this script. It also helped setup the qemu command line. Here are the
4 commands I used on x86_64 Linux to build and run ArmVirtPkg:

$ OvmfPkg/build.sh -a AARCH64

$ OvmfPkg/build.sh -a AARCH64 qemu -m 1024 -cpu cortex-a57 -M virt -net none

$ OvmfPkg/build.sh -a ARM

$ OvmfPkg/build.sh -a ARM qemu -m 1024 -cpu cortex-a15 -M virt -net none

I think the script might be usable on an ARM based build systems as
well, but it might require further tweaks. Ideally, if the build
system was AARCH64 based, then:

* OvmfPkg/build.sh: (with no params) would cause AARCH64 ArmVirtPkg to
  be built using a native compiler.

* OvmfPkg/build.sh -a ARM: would cause ARM ArmVirtPkg to be built
  using a cross compiler.

* OvmfPkg/build.sh -a X64: would cause X64 OVMF to be built using a
  cross compiler.

-Jordan

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

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



Re: [edk2-devel] [PATCH 3/5] OvmfPkg/build.sh: Move automatic TARGET_TOOLS detection later

2019-04-10 Thread Philippe Mathieu-Daudé
Hi Jordan,

On 4/10/19 11:34 AM, Jordan Justen wrote:
> If we are building for a non-native ARM, then we may need to select a
> cross-compiler based on the -a paramter.

I am sorry but I am non-native English and I have hard time to
understand your comment.

OVMF targets x86 hardware, which is obviously not ARM. And I'm not aware
of another target architecture.  Are you talking about the host where
you build?

I am trying your series on a Aarch64 host but I fail at passing the
correct cross gcc. I set GCC5_IA32_PREFIX, GCC5_X64_PREFIX and GCC5_BIN
env vars, but the build script still run '"gcc"' instead of my cross one.

A more generic comment regarding your series: how do you use this script?

Thanks,

Phil.

> Signed-off-by: Jordan Justen 
> ---
>  OvmfPkg/build.sh | 99 +---
>  1 file changed, 51 insertions(+), 48 deletions(-)
> 
> diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh
> index 217abae683..812441b9b1 100755
> --- a/OvmfPkg/build.sh
> +++ b/OvmfPkg/build.sh
> @@ -40,58 +40,11 @@ ARCH_X64=no
>  BUILDTARGET=DEBUG
>  BUILD_OPTIONS=
>  PLATFORMFILE=
> +TARGET_TOOLS=
>  THREADNUMBER=1
>  LAST_ARG=
>  RUN_QEMU=no
>  
> -#
> -# Pick a default tool type for a given OS
> -#
> -TARGET_TOOLS=MYTOOLS
> -case `uname` in
> -  CYGWIN*)
> -echo Cygwin not fully supported yet.
> -;;
> -  Darwin*)
> -Major=$(uname -r | cut -f 1 -d '.')
> -# Major is Darwin version, not OS X version.
> -# OS X Yosemite 10.10.2 returns 14.
> -case $Major in
> -  [156789])
> -echo OvmfPkg requires OS X Snow Leopard 10.6 or newer OS
> -exit 1
> -;;
> -  10)
> -TARGET_TOOLS=XCODE32
> -;;
> -  1[12])
> -TARGET_TOOLS=XCLANG
> -;;
> -   *)
> -# Mavericks and future assume XCODE5 (clang + lldb)
> -TARGET_TOOLS=XCODE5
> -;;
> -esac
> -;;
> -  Linux*)
> -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
> -exit 1
> -;;
> -  4.8.*)
> -TARGET_TOOLS=GCC48
> -;;
> -  4.9.*|6.[0-2].*)
> -TARGET_TOOLS=GCC49
> -;;
> -  *)
> -TARGET_TOOLS=GCC5
> -;;
> -esac
> -esac
> -
>  #
>  # Scan command line to override defaults
>  #
> @@ -166,6 +119,56 @@ else
>BUILD_ROOT_ARCH=X64
>  fi
>  
> +#
> +# Pick a default tool type for a given OS
> +#
> +if [ -z "$TARGET_TOOLS" ]; then
> +  TARGET_TOOLS=MYTOOLS
> +  case `uname` in
> +CYGWIN*)
> +  echo Cygwin not fully supported yet.
> +  ;;
> +Darwin*)
> +  Major=$(uname -r | cut -f 1 -d '.')
> +  # Major is Darwin version, not OS X version.
> +  # OS X Yosemite 10.10.2 returns 14.
> +  case $Major in
> +[156789])
> +  echo OvmfPkg requires OS X Snow Leopard 10.6 or newer OS
> +  exit 1
> +  ;;
> +10)
> +  TARGET_TOOLS=XCODE32
> +  ;;
> +1[12])
> +  TARGET_TOOLS=XCLANG
> +  ;;
> + *)
> +  # Mavericks and future assume XCODE5 (clang + lldb)
> +  TARGET_TOOLS=XCODE5
> +  ;;
> +  esac
> +  ;;
> +Linux*)
> +  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
> +  exit 1
> +  ;;
> +4.8.*)
> +  TARGET_TOOLS=GCC48
> +  ;;
> +4.9.*|6.[0-2].*)
> +  TARGET_TOOLS=GCC49
> +  ;;
> +*)
> +  TARGET_TOOLS=GCC5
> +  ;;
> +  esac
> +  esac
> +fi
> +
>  case $PROCESSOR in
>IA32)
>  if [ -n "$QEMU_COMMAND" ]; then
> 

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

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



[edk2-devel] [PATCH 3/5] OvmfPkg/build.sh: Move automatic TARGET_TOOLS detection later

2019-04-10 Thread Jordan Justen
If we are building for a non-native ARM, then we may need to select a
cross-compiler based on the -a paramter.

Signed-off-by: Jordan Justen 
---
 OvmfPkg/build.sh | 99 +---
 1 file changed, 51 insertions(+), 48 deletions(-)

diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh
index 217abae683..812441b9b1 100755
--- a/OvmfPkg/build.sh
+++ b/OvmfPkg/build.sh
@@ -40,58 +40,11 @@ ARCH_X64=no
 BUILDTARGET=DEBUG
 BUILD_OPTIONS=
 PLATFORMFILE=
+TARGET_TOOLS=
 THREADNUMBER=1
 LAST_ARG=
 RUN_QEMU=no
 
-#
-# Pick a default tool type for a given OS
-#
-TARGET_TOOLS=MYTOOLS
-case `uname` in
-  CYGWIN*)
-echo Cygwin not fully supported yet.
-;;
-  Darwin*)
-Major=$(uname -r | cut -f 1 -d '.')
-# Major is Darwin version, not OS X version.
-# OS X Yosemite 10.10.2 returns 14.
-case $Major in
-  [156789])
-echo OvmfPkg requires OS X Snow Leopard 10.6 or newer OS
-exit 1
-;;
-  10)
-TARGET_TOOLS=XCODE32
-;;
-  1[12])
-TARGET_TOOLS=XCLANG
-;;
-   *)
-# Mavericks and future assume XCODE5 (clang + lldb)
-TARGET_TOOLS=XCODE5
-;;
-esac
-;;
-  Linux*)
-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
-exit 1
-;;
-  4.8.*)
-TARGET_TOOLS=GCC48
-;;
-  4.9.*|6.[0-2].*)
-TARGET_TOOLS=GCC49
-;;
-  *)
-TARGET_TOOLS=GCC5
-;;
-esac
-esac
-
 #
 # Scan command line to override defaults
 #
@@ -166,6 +119,56 @@ else
   BUILD_ROOT_ARCH=X64
 fi
 
+#
+# Pick a default tool type for a given OS
+#
+if [ -z "$TARGET_TOOLS" ]; then
+  TARGET_TOOLS=MYTOOLS
+  case `uname` in
+CYGWIN*)
+  echo Cygwin not fully supported yet.
+  ;;
+Darwin*)
+  Major=$(uname -r | cut -f 1 -d '.')
+  # Major is Darwin version, not OS X version.
+  # OS X Yosemite 10.10.2 returns 14.
+  case $Major in
+[156789])
+  echo OvmfPkg requires OS X Snow Leopard 10.6 or newer OS
+  exit 1
+  ;;
+10)
+  TARGET_TOOLS=XCODE32
+  ;;
+1[12])
+  TARGET_TOOLS=XCLANG
+  ;;
+ *)
+  # Mavericks and future assume XCODE5 (clang + lldb)
+  TARGET_TOOLS=XCODE5
+  ;;
+  esac
+  ;;
+Linux*)
+  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
+  exit 1
+  ;;
+4.8.*)
+  TARGET_TOOLS=GCC48
+  ;;
+4.9.*|6.[0-2].*)
+  TARGET_TOOLS=GCC49
+  ;;
+*)
+  TARGET_TOOLS=GCC5
+  ;;
+  esac
+  esac
+fi
+
 case $PROCESSOR in
   IA32)
 if [ -n "$QEMU_COMMAND" ]; then
-- 
2.20.1


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

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