]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/build.sh
OvmfPkg/README: Add information about OVMF flash layout
[mirror_edk2.git] / OvmfPkg / build.sh
index 0696999a65e5b66bbf19e21636e2306ea0268f3c..65add5c9e93c3cce222ab0e279586d078662f035 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-# Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
 #
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
@@ -45,6 +45,7 @@ PROCESSOR=X64
 BUILDTARGET=DEBUG
 BUILD_OPTIONS=
 PLATFORMFILE=
+THREADNUMBER=1
 LAST_ARG=
 RUN_QEMU=no
 
@@ -57,18 +58,36 @@ case `uname` in
     echo Cygwin not fully supported yet.
     ;;
   Darwin*)
-      Major=$(uname -r | cut -f 1 -d '.')
-      if [[ $Major == 9 ]]
-      then
+    Major=$(uname -r | cut -f 1 -d '.')
+    case $Major in
+      10)
+        TARGET_TOOLS=XCODE32
+        ;;
+      1[12])
+        TARGET_TOOLS=XCLANG
+        ;;
+       *)
         echo OvmfPkg requires Snow Leopard or later OS
         exit 1
-      else
-        TARGET_TOOLS=XCODE32
-      fi
-      ;;
-  Linux*)
-    TARGET_TOOLS=GCC44
+        ;;
+    esac
     ;;
+  Linux*)
+    gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
+    case $gcc_version in
+      4.5.*)
+        TARGET_TOOLS=GCC45
+        ;;
+      4.6.*)
+        TARGET_TOOLS=GCC46
+        ;;
+      4.[789].*)
+        TARGET_TOOLS=GCC47
+        ;;
+      *)
+        TARGET_TOOLS=GCC44
+        ;;
+    esac
 esac
 
 #
@@ -79,7 +98,7 @@ for arg in "$@"
 do
   if [ -z "$LAST_ARG" ]; then
     case $arg in
-      -a|-b|-t|-p)
+      -a|-b|-t|-p|-n)
         LAST_ARG=$arg
         ;;
       qemu)
@@ -105,6 +124,9 @@ do
       -t)
         TARGET_TOOLS=$arg
         ;;
+      -n)
+        THREADNUMBER=$arg
+        ;;
       *)
         BUILD_OPTIONS="$BUILD_OPTIONS $arg"
         ;;
@@ -117,11 +139,30 @@ done
 case $PROCESSOR in
   IA32)
     Processor=Ia32
-    QEMU_COMMAND=qemu
+    if [ -n "$QEMU_COMMAND" ]; then
+      #
+      # The user set the QEMU_COMMAND variable. We'll use it to run QEMU.
+      #
+      :
+    elif  [ -x `which qemu-system-i386` ]; then
+      QEMU_COMMAND=qemu-system-i386
+    elif  [ -x `which qemu-system-x86_64` ]; then
+      QEMU_COMMAND=qemu-system-x86_64
+    elif  [ -x `which qemu` ]; then
+      QEMU_COMMAND=qemu
+    else
+      echo Unable to find QEMU for IA32 architecture!
+      exit 1
+    fi
     ;;
   X64)
     Processor=X64
-    QEMU_COMMAND=qemu-system-x86_64
+    if [ -z "$QEMU_COMMAND" ]; then
+      #
+      # The user didn't set the QEMU_COMMAND variable.
+      #
+      QEMU_COMMAND=qemu-system-x86_64
+    fi
     ;;
   *)
     echo Unsupported processor architecture: $PROCESSOR
@@ -179,9 +220,8 @@ fi
 if [[ "$RUN_QEMU" == "yes" ]]; then
   if [[ ! -d $QEMU_FIRMWARE_DIR ]]; then
     mkdir $QEMU_FIRMWARE_DIR
-    ln -s $FV_DIR/OVMF.fd $QEMU_FIRMWARE_DIR/bios.bin
-    ln -s $FV_DIR/CirrusLogic5446.rom $QEMU_FIRMWARE_DIR/vgabios-cirrus.bin
   fi
+  ln -sf $FV_DIR/OVMF.fd $QEMU_FIRMWARE_DIR/bios.bin
   if [[ "$ADD_QEMU_HDA" == "yes" ]]; then
     AUTO_QEMU_HDA="-hda fat:$BUILD_ROOT_ARCH"
   else
@@ -197,6 +237,6 @@ fi
 # Build the edk2 OvmfPkg
 #
 echo Running edk2 build for OvmfPkg$Processor
-build -p $PLATFORMFILE $BUILD_OPTIONS -a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS
+build -p $PLATFORMFILE $BUILD_OPTIONS -a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -n $THREADNUMBER
 exit $?