]>
Commit | Line | Data |
---|---|---|
2ef2b01e | 1 | #!/bin/bash |
1ebd6c11 HT |
2 | # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> |
3 | # This program and the accompanying materials | |
2ef2b01e A |
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 | ||
12 | set -e | |
13 | shopt -s nocasematch | |
14 | ||
15 | function 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 | # | |
9308b78a | 40 | if [ -z "${WORKSPACE:-}" ] |
2ef2b01e A |
41 | then |
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 |
49 | else | |
50 | echo Building from: $WORKSPACE | |
51 | fi | |
52 | ||
53 | # | |
f5df743f | 54 | # Pick a default tool type for a given OS if no toolchain already defined |
2ef2b01e | 55 | # |
9308b78a | 56 | if [ -z "${TARGET_TOOLS:-}" ] |
f5df743f | 57 | then |
58 | case `uname` in | |
59 | CYGWIN*) | |
2ef2b01e A |
60 | TARGET_TOOLS=RVCT31CYGWIN |
61 | ;; | |
f5df743f | 62 | Linux*) |
0b6b57c4 | 63 | if [[ ! -z `locate arm-linux-gnueabi-gcc` ]]; then |
64 | TARGET_TOOLS=ARMLINUXGCC | |
65 | else | |
66 | TARGET_TOOLS=ARMGCC | |
67 | fi | |
2ef2b01e | 68 | ;; |
f5df743f | 69 | Darwin*) |
2ef2b01e A |
70 | Major=$(uname -r | cut -f 1 -d '.') |
71 | if [[ $Major == 9 ]] | |
72 | then | |
73 | # Not supported by this open source project | |
74 | TARGET_TOOLS=XCODE31 | |
75 | else | |
76 | TARGET_TOOLS=XCODE32 | |
77 | fi | |
78 | ;; | |
f5df743f | 79 | esac |
80 | fi | |
2ef2b01e | 81 | |
8c3f387b | 82 | TARGET=DEBUG |
83 | for arg in "$@" | |
84 | do | |
2cbf6d9c | 85 | if [[ $arg == RELEASE ]]; |
86 | then | |
8c3f387b | 87 | TARGET=RELEASE |
88 | fi | |
89 | done | |
90 | ||
91 | BUILD_ROOT=$WORKSPACE/Build/BeagleBoard/"$TARGET"_"$TARGET_TOOLS" | |
2ef2b01e A |
92 | GENERATE_IMAGE=$WORKSPACE/BeagleBoardPkg/Tools/generate_image |
93 | FLASH_BOOT=$BUILD_ROOT/FV/BeagleBoard_EFI_flashboot.fd | |
94 | ||
841f6ba7 | 95 | if [[ ! -e $EDK_TOOLS_PATH/Source/C/bin ]]; |
2ef2b01e A |
96 | then |
97 | # build the tools if they don't yet exist | |
841f6ba7 A |
98 | echo Building tools: $EDK_TOOLS_PATH |
99 | make -C $EDK_TOOLS_PATH | |
2ef2b01e A |
100 | else |
101 | echo using prebuilt tools | |
102 | fi | |
103 | ||
104 | # | |
105 | # Build the edk2 BeagleBoard code | |
106 | # | |
2cbf6d9c | 107 | if [[ $TARGET == RELEASE ]]; then |
9308b78a | 108 | 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 | 109 | else |
9308b78a | 110 | build -p ${WORKSPACE:-}/BeagleBoardPkg/BeagleBoardPkg.dsc -a ARM -t $TARGET_TOOLS -b $TARGET ${1:-} ${2:-} ${3:-} ${4:-} ${5:-} ${6:-} ${7:-} ${8:-} |
2cbf6d9c | 111 | fi |
112 | ||
2ef2b01e A |
113 | |
114 | for arg in "$@" | |
115 | do | |
116 | if [[ $arg == clean ]]; then | |
117 | # no need to post process if we are doing a clean | |
118 | exit | |
119 | elif [[ $arg == cleanall ]]; then | |
841f6ba7 | 120 | make -C $EDK_TOOLS_PATH clean |
2ef2b01e A |
121 | make -C $WORKSPACE/BeagleBoardPkg/Tools clean |
122 | exit | |
123 | ||
124 | fi | |
125 | done | |
126 | ||
127 | ||
128 | # | |
129 | # Build the tool used to patch the FLASH image to work with the Beagle board ROM | |
130 | # | |
131 | if [[ ! -e $GENERATE_IMAGE ]]; | |
132 | then | |
133 | make -C $WORKSPACE/BeagleBoardPkg/Tools | |
134 | fi | |
135 | ||
136 | echo Patching FD to work with BeagleBoard ROM | |
137 | rm -f $FLASH_BOOT | |
138 | ||
139 | # | |
140 | # Ram starts at 0x80000000 | |
0641c540 | 141 | # OMAP 3530 TRM defines 0x80008000 as the entry point |
2ef2b01e A |
142 | # The reset vector is caught by the mask ROM in the OMAP 3530 so that is why this entry |
143 | # point looks so strange. | |
144 | # OMAP 3430 TRM section 26.4.8 has Image header information. (missing in OMAP 3530 TRM) | |
145 | # | |
0641c540 | 146 | $GENERATE_IMAGE -D $WORKSPACE/BeagleBoardPkg/ConfigurationHeader.dat -E 0x80008000 -I $BUILD_ROOT/FV/BEAGLEBOARD_EFI.fd -O $FLASH_BOOT |
2ef2b01e A |
147 | |
148 | echo Creating debugger scripts | |
149 | process_debug_scripts $WORKSPACE/BeagleBoardPkg/Debugger_scripts | |
150 |