]> git.proxmox.com Git - mirror_edk2.git/blame - BeagleBoardPkg/build.sh
Update USB init code to do a softreset.
[mirror_edk2.git] / BeagleBoardPkg / build.sh
CommitLineData
2ef2b01e
A
1#!/bin/bash
2# Copyright (c) 2008 - 2009, Apple, Inc. All rights reserved.
3# All rights reserved. This program and the accompanying materials
4# are licensed and made available under the terms and conditions of the BSD License
5# which accompanies this distribution. The full text of the license may be found at
6# http://opensource.org/licenses/bsd-license.php
7#
8# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10#
11
12set -e
13shopt -s nocasematch
14
15function process_debug_scripts {
16 if [[ -d $1 ]]; then
17 for filename in `ls $1`
18 do
19 sed -e "s@ZZZZZZ@$BUILD_ROOT@g" -e "s@WWWWWW@$WORKSPACE@g" \
20 "$1/$filename" \
21 > "$BUILD_ROOT/$filename"
22
23 #For ARMCYGWIN, we have to change /cygdrive/c to c:
24 if [[ $TARGET_TOOLS == RVCT31CYGWIN ]]
25 then
26 mv "$BUILD_ROOT/$filename" "$BUILD_ROOT/$filename"_temp
27 sed -e "s@/cygdrive/\(.\)@\1:@g" \
28 "$BUILD_ROOT/$filename"_temp \
29 > "$BUILD_ROOT/$filename"
30 rm -f "$BUILD_ROOT/$filename"_temp
31 fi
32 done
33 fi
34}
35
36
37#
38# Setup workspace if it is not set
39#
40if [ -z "$WORKSPACE" ]
41then
42 echo Initializing workspace
43 cd ..
841f6ba7 44# Uses an external BaseTools project
1096a48f 45# export EDK_TOOLS_PATH=`pwd`/../BaseTools
841f6ba7 46# Uses the BaseTools in edk2
1096a48f 47 export EDK_TOOLS_PATH=`pwd`/BaseTools
2ef2b01e
A
48 source edksetup.sh BaseTools
49else
50 echo Building from: $WORKSPACE
51fi
52
53#
54# Pick a default tool type for a given OS
55#
56case `uname` in
57 CYGWIN*)
58 TARGET_TOOLS=RVCT31CYGWIN
59 ;;
60 Linux*)
61 # Not tested
62 TARGET_TOOLS=ELFGCC
63 ;;
64 Darwin*)
65 Major=$(uname -r | cut -f 1 -d '.')
66 if [[ $Major == 9 ]]
67 then
68 # Not supported by this open source project
69 TARGET_TOOLS=XCODE31
70 else
71 TARGET_TOOLS=XCODE32
72 fi
73 ;;
74esac
75
8c3f387b 76TARGET=DEBUG
77for arg in "$@"
78do
2cbf6d9c 79 if [[ $arg == RELEASE ]];
80 then
8c3f387b 81 TARGET=RELEASE
82 fi
83done
84
85BUILD_ROOT=$WORKSPACE/Build/BeagleBoard/"$TARGET"_"$TARGET_TOOLS"
2ef2b01e
A
86GENERATE_IMAGE=$WORKSPACE/BeagleBoardPkg/Tools/generate_image
87FLASH_BOOT=$BUILD_ROOT/FV/BeagleBoard_EFI_flashboot.fd
88
841f6ba7 89if [[ ! -e $EDK_TOOLS_PATH/Source/C/bin ]];
2ef2b01e
A
90then
91 # build the tools if they don't yet exist
841f6ba7
A
92 echo Building tools: $EDK_TOOLS_PATH
93 make -C $EDK_TOOLS_PATH
2ef2b01e
A
94else
95 echo using prebuilt tools
96fi
97
98#
99# Build the edk2 BeagleBoard code
100#
2cbf6d9c 101if [[ $TARGET == RELEASE ]]; then
ca3ad58b 102 build -p $WORKSPACE/BeagleBoardPkg/BeagleBoardPkg.dsc -a ARM -t $TARGET_TOOLS -b $TARGET -D DEBUG_TARGET=RELEASE $2 $3 $4 $5 $6 $7 $8
2cbf6d9c 103else
104 build -p $WORKSPACE/BeagleBoardPkg/BeagleBoardPkg.dsc -a ARM -t $TARGET_TOOLS -b $TARGET $1 $2 $3 $4 $5 $6 $7 $8
105fi
106
2ef2b01e
A
107
108for arg in "$@"
109do
110 if [[ $arg == clean ]]; then
111 # no need to post process if we are doing a clean
112 exit
113 elif [[ $arg == cleanall ]]; then
841f6ba7 114 make -C $EDK_TOOLS_PATH clean
2ef2b01e
A
115 make -C $WORKSPACE/BeagleBoardPkg/Tools clean
116 exit
117
118 fi
119done
120
121
122#
123# Build the tool used to patch the FLASH image to work with the Beagle board ROM
124#
125if [[ ! -e $GENERATE_IMAGE ]];
126then
127 make -C $WORKSPACE/BeagleBoardPkg/Tools
128fi
129
130echo Patching FD to work with BeagleBoard ROM
131rm -f $FLASH_BOOT
132
133#
134# Ram starts at 0x80000000
135# OMAP 3530 TRM defines 0x80008208 as the entry point
136# The reset vector is caught by the mask ROM in the OMAP 3530 so that is why this entry
137# point looks so strange.
138# OMAP 3430 TRM section 26.4.8 has Image header information. (missing in OMAP 3530 TRM)
139#
140$GENERATE_IMAGE -D $WORKSPACE/BeagleBoardPkg/ConfigurationHeader.dat -E 0x80008208 -I $BUILD_ROOT/FV/BEAGLEBOARD_EFI.fd -O $FLASH_BOOT
141
142echo Creating debugger scripts
143process_debug_scripts $WORKSPACE/BeagleBoardPkg/Debugger_scripts
144