Skip to content
This repository
Newer
Older
100755 356 lines (301 sloc) 11.795 kb
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
1 #!/bin/bash
2
3 # Original script done by Don Darling
4 # Later changes by Koen Kooi and Brijesh Singh
5
6 # Revision history:
7 # 20090902: download from twice
8 # 20090903: Weakly assign MACHINE and DISTRO
9 # 20090904: * Don't recreate local.conf is it already exists
10 # * Pass 'unknown' machines to OE directly
11 # 20090918: Fix /bin/env location
12 # Don't pass MACHINE via env if it's not set
13 # Changed 'build' to 'bitbake' to prepare people for non-scripted usage
14 # Print bitbake command it executes
15 # 20091012: Add argument to accept commit id.
16 # 20091202: Fix proxy setup
17
18 ###############################################################################
19 # User specific vars like proxy servers
20 ###############################################################################
21
22 #PROXYHOST=wwwgate.ti.com
23 #PROXYPORT=80
6a439748 » koenkooi
2010-03-19 oebb: generate sourceable env file
24 PROXYHOST=""
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
25
26 ###############################################################################
27 # OE_BASE - The root directory for all OE sources and development.
28 ###############################################################################
29 OE_BASE=${PWD}
30
31 ###############################################################################
32 # SET_ENVIRONMENT() - Setup environment variables for OE development
33 ###############################################################################
34 function set_environment()
35 {
6a439748 » koenkooi
2010-03-19 oebb: generate sourceable env file
36
37 #--------------------------------------------------------------------------
38 # If an env already exists, use it, otherwise generate it
39 #--------------------------------------------------------------------------
40 if [ -e ~/.oe/environment ] ; then
41 . ~/.oe/environment
42 else
43
44 mkdir -p ~/.oe/
45
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
46 #--------------------------------------------------------------------------
47 # Specify distribution information
48 #--------------------------------------------------------------------------
49 DISTRO="angstrom-2008.1"
50 DISTRO_DIRNAME=`echo $DISTRO | sed s#[.-]#_#g`
51
6a439748 » koenkooi
2010-03-19 oebb: generate sourceable env file
52 echo "export DISTRO=\"${DISTRO}\"" > ~/.oe/environment
53 echo "export DISTRO_DIRNAME=\"${DISTRO_DIRNAME}\"" >> ~/.oe/environment
54
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
55 #--------------------------------------------------------------------------
56 # Specify the root directory for your OpenEmbedded development
57 #--------------------------------------------------------------------------
58 OE_BUILD_DIR=${OE_BASE}/build
59 OE_BUILD_TMPDIR="${OE_BUILD_DIR}/tmp-${DISTRO_DIRNAME}"
60 OE_SOURCE_DIR=${OE_BASE}/sources
61 mkdir -p ${OE_BUILD_DIR}
62 mkdir -p ${OE_SOURCE_DIR}
63 export OE_BASE
64
6a439748 » koenkooi
2010-03-19 oebb: generate sourceable env file
65 echo "export OE_BASE=\"${OE_BASE}\"" >> ~/.oe/environment
66
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
67 #--------------------------------------------------------------------------
68 # Include up-to-date bitbake in our PATH.
69 #--------------------------------------------------------------------------
70 export PATH=${OE_SOURCE_DIR}/bitbake/bin:${PATH}
71
6a439748 » koenkooi
2010-03-19 oebb: generate sourceable env file
72 echo "export PATH=\"${PATH}\"" >> ~/.oe/environment
73
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
74 #--------------------------------------------------------------------------
75 # Make sure Bitbake doesn't filter out the following variables from our
76 # environment.
77 #--------------------------------------------------------------------------
78 export BB_ENV_EXTRAWHITE="MACHINE DISTRO http_proxy ftp_proxy no_proxy GIT_PROXY_COMMAND"
79
6a439748 » koenkooi
2010-03-19 oebb: generate sourceable env file
80 echo "export BB_ENV_EXTRAWHITE=\"${BB_ENV_EXTRAWHITE}\"" >> ~/.oe/environment
81
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
82 #--------------------------------------------------------------------------
83 # Specify proxy information
84 #--------------------------------------------------------------------------
6a439748 » koenkooi
2010-03-19 oebb: generate sourceable env file
85 if [ "x$PROXYHOST" != "x" ] ; then
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
86 export http_proxy=http://${PROXYHOST}:${PROXYPORT}/
87 export ftp_proxy=http://${PROXYHOST}:${PROXYPORT}/
88
89 export SVN_CONFIG_DIR=${OE_BUILD_DIR}/subversion_config
90 export GIT_CONFIG_DIR=${OE_BUILD_DIR}/git_config
91
6a439748 » koenkooi
2010-03-19 oebb: generate sourceable env file
92 echo "export http_proxy=\"${http_proxy}\"" >> ~/.oe/environment
93 echo "export ftp_proxy=\"${ftp_proxy}\"" >> ~/.oe/environment
94 echo "export SVN_CONFIG_DIR=\"${SVN_CONFIG_DIR}\"" >> ~/.oe/environment
95 echo "export GIT_CONFIG_DIR=\"${GIT_CONFIG_DIR}\"" >> ~/.oe/environment
96
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
97 config_svn_proxy
98 config_git_proxy
99 fi
100
101 #--------------------------------------------------------------------------
102 # Set up the bitbake path to find the OpenEmbedded recipes.
103 #--------------------------------------------------------------------------
104 export BBPATH=${OE_BUILD_DIR}:${OE_SOURCE_DIR}/org.openembedded.dev${BBPATH_EXTRA}
6a439748 » koenkooi
2010-03-19 oebb: generate sourceable env file
105
106 echo "export BBPATH=\"${BBPATH}\"" >> ~/.oe/environment
107
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
108 #--------------------------------------------------------------------------
109 # Reconfigure dash
110 #--------------------------------------------------------------------------
111 if [ $(readlink /bin/sh) = "dash" ] ; then
112 sudo dpkg-reconfigure dash
113 fi
6a439748 » koenkooi
2010-03-19 oebb: generate sourceable env file
114 fi # if -e ~/.oe/environment
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
115 }
116
117
118 ###############################################################################
119 # UPDATE_ALL() - Make sure everything is up to date
120 ###############################################################################
121 function update_all()
122 {
123 set_environment
124 update_bitbake
125 update_oe
126 }
127
128
129 ###############################################################################
130 # OE_BUILD() - Build an OE package or image
131 ###############################################################################
132 function oe_build()
133 {
134 set_environment
135 cd ${OE_BUILD_DIR}
136 if [ -z $MACHINE ] ; then
137 echo "Executing: bitbake" $*
138 bitbake $*
139 else
140 echo "Executing: MACHINE=${MACHINE} bitbake" $*
141 MACHINE=${MACHINE} bitbake $*
142 fi
143 }
144
145
146 ###############################################################################
147 # OE_CONFIG() - Configure OE for a target
148 ###############################################################################
149 function oe_config()
150 {
151 set_environment
152 config_oe
153 }
154
155
156 ###############################################################################
157 # UPDATE_BITBAKE() - Update Bitbake distribution
158 ###############################################################################
159 function update_bitbake()
160 {
6a439748 » koenkooi
2010-03-19 oebb: generate sourceable env file
161 if [ "x$PROXYHOST" != "x" ] ; then
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
162 config_git_proxy
163 fi
164
165 if [ ! -d ${OE_SOURCE_DIR}/bitbake ]; then
166 echo Checking out bitbake
167 git clone git://git.openembedded.net/bitbake ${OE_SOURCE_DIR}/bitbake
168 cd ${OE_SOURCE_DIR}/bitbake && git checkout -b 1.8 origin/1.8
169 else
170 cd ${OE_SOURCE_DIR}/bitbake && git pull --rebase
171 fi
172 }
173
174
175 ###############################################################################
176 # UPDATE_OE() - Update OpenEmbedded distribution.
177 ###############################################################################
178 function update_oe()
179 {
180 config_git_proxy
181
182 if [ ! -d ${OE_SOURCE_DIR}/org.openembedded.dev ]; then
183 echo Checking out OpenEmbedded
184 git clone "git://git.openembedded.net/openembedded" ${OE_SOURCE_DIR}/org.openembedded.dev
185 cd ${OE_SOURCE_DIR}/org.openembedded.dev
dea6d19e » koenkooi
2010-03-19 oebb: clean up variables and local.conf
186 if [ ! -r ${OE_COMMIT_ID} ];
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
187 then
dea6d19e » koenkooi
2010-03-19 oebb: clean up variables and local.conf
188 echo "Checkout commit id: ${OE_COMMIT_ID}"
189 git checkout -b install ${OE_COMMIT_ID}
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
190 else
191 git checkout -b org.openembedded.dev origin/org.openembedded.dev
192 fi
193 else
194 echo Updating OpenEmbedded
195 cd ${OE_SOURCE_DIR}/org.openembedded.dev
196 git pull --rebase
197 fi
198 }
199
200
201 ###############################################################################
202 # CONFIG_OE() - Configure OpenEmbedded
203 ###############################################################################
204 function config_oe()
205 {
206 #--------------------------------------------------------------------------
207 # Determine the proper machine name
208 #--------------------------------------------------------------------------
209 case ${CL_MACHINE} in
ab79e042 » jadonk
2010-03-08 Added aliases for the proper board names.
210 beagle|beagleboard)
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
211 MACHINE="beagleboard"
212 ;;
ab79e042 » jadonk
2010-03-08 Added aliases for the proper board names.
213 dm6446evm|davinci-evm)
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
214 MACHINE="davinci-dvevm"
215 ;;
216 omap3evm)
217 MACHINE="omap3evm"
218 ;;
ab79e042 » jadonk
2010-03-08 Added aliases for the proper board names.
219 shiva|omap3517-evm)
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
220 MACHINE="omap3517-evm"
221 ;;
222 *)
223 echo "Unknown machine ${CL_MACHINE}, passing it to OE directly"
224 MACHINE="${CL_MACHINE}"
225 ;;
226 esac
227
228 #--------------------------------------------------------------------------
229 # Write out the OE bitbake configuration file.
230 #--------------------------------------------------------------------------
231 mkdir -p ${OE_BUILD_DIR}/conf
232
233 # There's no need to rewrite local.conf when changing MACHINE
234 if [ ! -e ${OE_BUILD_DIR}/conf/local.conf ]; then
235 cat > ${OE_BUILD_DIR}/conf/local.conf <<_EOF
236 # Where to store sources
237 DL_DIR = "${OE_BUILD_DIR}/downloads"
238
239 INHERIT += "rm_work"
240
241 # Which files do we want to parse:
242 BBFILES := "${OE_SOURCE_DIR}/org.openembedded.dev/recipes/*/*.bb"
243 BBMASK = ""
244
245 # What kind of images do we want?
246 IMAGE_FSTYPES += "tar.bz2"
247
dea6d19e » koenkooi
2010-03-19 oebb: clean up variables and local.conf
248 # Make use of SMP:
249 # PARALLEL_MAKE specifies how many concurrent compiler threads are spawned per bitbake process
250 # BB_NUMBER_THREADS specifies how many concurrent bitbake tasks will be run
251 #PARALLEL_MAKE = "-j2"
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
252 BB_NUMBER_THREADS = "2"
253
254 DISTRO = "${DISTRO}"
255 MACHINE ?= "${MACHINE}"
256
257 # Set TMPDIR instead of defaulting it to $pwd/tmp
258 TMPDIR = "${OE_BUILD_TMPDIR}"
259
260 # Go through the Firewall
261 #HTTP_PROXY = "http://${PROXYHOST}:${PROXYPORT}/"
262
263 _EOF
264 fi
265 }
266
267 ###############################################################################
268 # CONFIG_SVN_PROXY() - Configure subversion proxy information
269 ###############################################################################
270 function config_svn_proxy()
271 {
272 if [ ! -f ${SVN_CONFIG_DIR}/servers ]
273 then
274 mkdir -p ${SVN_CONFIG_DIR}
275 cat >> ${SVN_CONFIG_DIR}/servers <<_EOF
276 [global]
277 http-proxy-host = ${PROXYHOST}
278 http-proxy-port = ${PROXYPORT}
279 _EOF
280 fi
281 }
282
283
284 ###############################################################################
285 # CONFIG_GIT_PROXY() - Configure GIT proxy information
286 ###############################################################################
287 function config_git_proxy()
288 {
289 if [ ! -f ${GIT_CONFIG_DIR}/git-proxy.sh ]
290 then
291 mkdir -p ${GIT_CONFIG_DIR}
292 cat > ${GIT_CONFIG_DIR}/git-proxy.sh <<_EOF
293 if [ -x /bin/env ] ; then
294 exec /bin/env corkscrew ${PROXYHOST} ${PROXYPORT} \$*
295 else
296 exec /usr/bin/env corkscrew ${PROXYHOST} ${PROXYPORT} \$*
297 fi
298 _EOF
299 chmod +x ${GIT_CONFIG_DIR}/git-proxy.sh
300 fi
301 export GIT_PROXY_COMMAND=${GIT_CONFIG_DIR}/git-proxy.sh
302 }
303
304
305 ###############################################################################
306 # Build the specified OE packages or images.
307 ###############################################################################
308 if [ $# -gt 0 ]
309 then
310 if [ $1 = "update" ]
311 then
312 shift
313 if [ ! -r $1 ]; then
314 if [ $1 == "commit" ]
315 then
316 shift
dea6d19e » koenkooi
2010-03-19 oebb: clean up variables and local.conf
317 OE_COMMIT_ID=$1
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
318 fi
319 fi
320 update_all
321 exit 0
322 fi
323
324 if [ $1 = "bitbake" ]
325 then
326 shift
327 oe_build $*
328 exit 0
329 fi
330
331 if [ $1 = "config" ]
332 then
333 shift
334 CL_MACHINE=$1
335 shift
336 oe_config $*
337 exit 0
338 fi
339 fi
340
341 # Help Screen
342 echo ""
343 echo "Usage: $0 config <machine>"
344 echo " $0 update"
345 echo " $0 bitbake <bitbake target>"
346 echo ""
347 echo "You must invoke \"$0 config <machine>\" and then \"$0 update\" prior"
348 echo "to your first bitbake command"
349 echo ""
350 echo "The <machine> argument can be one of the following"
ab79e042 » jadonk
2010-03-08 Added aliases for the proper board names.
351 echo " beagleboard: BeagleBoard"
352 echo " davinci-evm: DM6446 EVM"
353 echo " omap3evm: OMAP35x EVM"
dea6d19e » koenkooi
2010-03-19 oebb: clean up variables and local.conf
354 echo " am3517-evm: AM3517 (Shiva) EVM"
f984361a » koenkooi
2010-03-08 Add first setup script, imported from TI wiki
355 echo ""
356 echo "Other machines are valid as well, but listing those would make this message way too long"
Something went wrong with that request. Please try again.