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