3 # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 # Copyright (c) 2010 - 2014, 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
54 # Pick a default tool type for a given OS
59 echo Cygwin not fully supported yet.
62 Major
=$
(uname
-r | cut
-f 1 -d '.')
71 echo OvmfPkg requires Snow Leopard or later OS
77 gcc_version
=$
(gcc
-v 2>&1 |
tail -1 |
awk '{print $3}')
101 # Scan command line to override defaults
106 if [ -z "$LAST_ARG" ]; then
120 BUILD_OPTIONS
="$BUILD_OPTIONS $arg"
141 BUILD_OPTIONS
="$BUILD_OPTIONS $arg"
152 if [ -n "$QEMU_COMMAND" ]; then
154 # The user set the QEMU_COMMAND variable. We'll use it to run QEMU.
157 elif [ -x `which qemu-system-i386` ]; then
158 QEMU_COMMAND
=qemu-system-i386
159 elif [ -x `which qemu-system-x86_64` ]; then
160 QEMU_COMMAND
=qemu-system-x86_64
161 elif [ -x `which qemu` ]; then
164 echo Unable to
find QEMU
for IA32 architecture
!
170 if [ -z "$QEMU_COMMAND" ]; then
172 # The user didn't set the QEMU_COMMAND variable.
174 QEMU_COMMAND
=qemu-system-x86_64
178 echo Unsupported processor architecture
: $PROCESSOR
179 echo Only IA32 or X64 is supported
184 if [ -z "$PLATFORMFILE" ]; then
185 PLATFORMFILE
=$WORKSPACE/OvmfPkg
/OvmfPkg
$Processor.dsc
188 if [[ "$RUN_QEMU" == "yes" ]]; then
189 qemu_version
=$
($QEMU_COMMAND -version 2>&1 |
tail -1 |
awk '{print $4}')
190 case $qemu_version in
191 1.
[6-9].
*|
1.
[1-9][0-9].
*|
2.
*.
*)
200 -hd[a-d
]|
-fd[ab
]|
-cdrom)
209 # Uncomment this block for parameter parsing debug
211 #echo RUN_QEMU=$RUN_QEMU
212 #echo BUILD_OPTIONS=$BUILD_OPTIONS
213 #echo BUILDTARGET=$BUILDTARGET
214 #echo TARGET_TOOLS=$TARGET_TOOLS
215 #echo PROCESSOR=$PROCESSOR
216 #echo Remaining for qemu: $*
219 BUILD_ROOT
=$WORKSPACE/Build
/Ovmf
$Processor/"$BUILDTARGET"_
"$TARGET_TOOLS"
220 FV_DIR
=$BUILD_ROOT/FV
221 BUILD_ROOT_ARCH
=$BUILD_ROOT/$PROCESSOR
222 QEMU_FIRMWARE_DIR
=$BUILD_ROOT/QEMU
224 if [[ ! -f `which build` ||
! -f `which GenFv` ]];
226 # build the tools if they don't yet exist. Bin scheme
227 echo Building tools as they are not
in the path
228 make -C $WORKSPACE/BaseTools
229 elif [[ ( -f `which build` ||
-f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source
/C
/bin
]];
231 # build the tools if they don't yet exist. BinWrapper scheme
232 echo Building tools no
$EDK_TOOLS_PATH/Source
/C
/bin directory
233 make -C $WORKSPACE/BaseTools
235 echo using prebuilt tools
239 if [[ "$RUN_QEMU" == "yes" ]]; then
240 if [[ ! -d $QEMU_FIRMWARE_DIR ]]; then
241 mkdir
$QEMU_FIRMWARE_DIR
243 ln -sf $FV_DIR/OVMF.fd
$QEMU_FIRMWARE_DIR/bios.bin
244 if [[ "$ENABLE_FLASH" == "yes" ]]; then
245 QEMU_COMMAND
="$QEMU_COMMAND -pflash $QEMU_FIRMWARE_DIR/bios.bin"
247 QEMU_COMMAND
="$QEMU_COMMAND -L $QEMU_FIRMWARE_DIR"
249 if [[ "$ADD_QEMU_HDA" == "yes" ]]; then
250 QEMU_COMMAND
="$QEMU_COMMAND -hda fat:$BUILD_ROOT_ARCH"
252 QEMU_COMMAND
="$QEMU_COMMAND $*"
253 echo Running
: $QEMU_COMMAND
259 # Build the edk2 OvmfPkg
261 echo Running edk2 build
for OvmfPkg
$Processor
262 build
-p $PLATFORMFILE $BUILD_OPTIONS -a $PROCESSOR -b $BUILDTARGET -t $TARGET_TOOLS -n $THREADNUMBER