3 # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 # Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
6 # This program and the accompanying materials
7 # are licensed and made available under the terms and conditions of the BSD License
8 # which accompanies this distribution. The full text of the license may be found at
9 # http://opensource.org/licenses/bsd-license.php
11 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 # Setup workspace if it is not set
22 if [ -z "$WORKSPACE" ]
24 echo Initializing workspace
25 if [ ! -e `pwd`/edksetup.sh
]
29 # This version is for the tools in the BaseTools project.
30 # this assumes svn pulls have the same root dir
31 # export EDK_TOOLS_PATH=`pwd`/../BaseTools
32 # This version is for the tools source in edk2
33 export EDK_TOOLS_PATH
=`pwd`/BaseTools
35 source edksetup.sh BaseTools
37 echo Building from
: $WORKSPACE
41 # Configure defaults for various options
53 # Pick a default tool type for a given OS
58 echo Cygwin not fully supported yet.
61 Major
=$
(uname
-r | cut
-f 1 -d '.')
70 echo OvmfPkg requires Snow Leopard or later OS
76 gcc_version
=$
(gcc
-v 2>&1 |
tail -1 |
awk '{print $3}')
94 # Scan command line to override defaults
99 if [ -z "$LAST_ARG" ]; then
110 BUILD_OPTIONS
="$BUILD_OPTIONS $arg"
131 BUILD_OPTIONS
="$BUILD_OPTIONS $arg"
142 if [ -x `which qemu-system-i386` ]; then
143 QEMU_COMMAND
=qemu-system-i386
144 elif [ -x `which qemu-system-x86_64` ]; then
145 QEMU_COMMAND
=qemu-system-x86_64
146 elif [ -x `which qemu` ]; then
149 echo Unable to
find QEMU
for IA32 architecture
!
155 QEMU_COMMAND
=qemu-system-x86_64
158 echo Unsupported processor architecture
: $PROCESSOR
159 echo Only IA32 or X64 is supported
164 if [ -z "$PLATFORMFILE" ]; then
165 PLATFORMFILE
=$WORKSPACE/OvmfPkg
/OvmfPkg
$Processor.dsc
172 -hd[a-d
]|
-fd[ab
]|
-cdrom)
180 # Uncomment this block for parameter parsing debug
182 #echo RUN_QEMU=$RUN_QEMU
183 #echo BUILD_OPTIONS=$BUILD_OPTIONS
184 #echo BUILDTARGET=$BUILDTARGET
185 #echo TARGET_TOOLS=$TARGET_TOOLS
186 #echo PROCESSOR=$PROCESSOR
187 #echo Remaining for qemu: $*
190 BUILD_ROOT
=$WORKSPACE/Build
/Ovmf
$Processor/"$BUILDTARGET"_
"$TARGET_TOOLS"
191 FV_DIR
=$BUILD_ROOT/FV
192 BUILD_ROOT_ARCH
=$BUILD_ROOT/$PROCESSOR
193 QEMU_FIRMWARE_DIR
=$BUILD_ROOT/QEMU
195 if [[ ! -f `which build` ||
! -f `which GenFv` ]];
197 # build the tools if they don't yet exist. Bin scheme
198 echo Building tools as they are not
in the path
199 make -C $WORKSPACE/BaseTools
200 elif [[ ( -f `which build` ||
-f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source
/C
/bin
]];
202 # build the tools if they don't yet exist. BinWrapper scheme
203 echo Building tools no
$EDK_TOOLS_PATH/Source
/C
/bin directory
204 make -C $WORKSPACE/BaseTools
206 echo using prebuilt tools
210 if [[ "$RUN_QEMU" == "yes" ]]; then
211 if [[ ! -d $QEMU_FIRMWARE_DIR ]]; then
212 mkdir
$QEMU_FIRMWARE_DIR
214 ln -sf $FV_DIR/OVMF.fd
$QEMU_FIRMWARE_DIR/bios.bin
215 if [[ "$ADD_QEMU_HDA" == "yes" ]]; then
216 AUTO_QEMU_HDA
="-hda fat:$BUILD_ROOT_ARCH"
220 QEMU_COMMAND
="$QEMU_COMMAND -L $QEMU_FIRMWARE_DIR $AUTO_QEMU_HDA $*"
221 echo Running
: $QEMU_COMMAND
227 # Build the edk2 OvmfPkg
229 echo Running edk2 build
for OvmfPkg
$Processor
230 build
-p $PLATFORMFILE $BUILD_OPTIONS -a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -n $THREADNUMBER