Skip to content

Commit 8f81ffd

Browse files
committed
oebb: make environment file configurable
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
1 parent 52e9530 commit 8f81ffd

File tree

1 file changed

+31
-49
lines changed

1 file changed

+31
-49
lines changed

oebb.sh

Lines changed: 31 additions & 49 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -33,6 +33,7 @@ PROXYHOST=""
33
OE_BASE=${PWD}
33
OE_BASE=${PWD}
34
# incremement this to force recreation of config files
34
# incremement this to force recreation of config files
35
BASE_VERSION=1
35
BASE_VERSION=1
36+
OE_ENV_FILE=~/.oe/environment-oecore
36

37

37
###############################################################################
38
###############################################################################
38
# SET_ENVIRONMENT() - Setup environment variables for OE development
39
# SET_ENVIRONMENT() - Setup environment variables for OE development
@@ -47,17 +48,17 @@ export BBFETCH2=True
47
# If an env already exists, use it, otherwise generate it
48
# If an env already exists, use it, otherwise generate it
48
#--------------------------------------------------------------------------
49
#--------------------------------------------------------------------------
49

50

50-
if [ -e ~/.oe/environment-oecore ] ; then
51+
if [ -e ${OE_ENV_FILE} ] ; then
51-
. ~/.oe/environment-oecore
52+
. ${OE_ENV_FILE}
52
fi
53
fi
53

54

54
if [ x"${BASE_VERSION}" != x"${SCRIPTS_BASE_VERSION}" ] ; then
55
if [ x"${BASE_VERSION}" != x"${SCRIPTS_BASE_VERSION}" ] ; then
55-
echo "BASE_VERSION mismatch, recreating ~/.oe/environment-oecore"
56+
echo "BASE_VERSION mismatch, recreating ${OE_ENV_FILE}"
56-
rm ~/.oe/environment-oecore
57+
rm ${OE_ENV_FILE}
57
fi
58
fi
58

59

59-
if [ -e ~/.oe/environment-oecore ] ; then
60+
if [ -e ${OE_ENV_FILE} ] ; then
60-
. ~/.oe/environment-oecore
61+
. ${OE_ENV_FILE}
61
else
62
else
62

63

63
mkdir -p ~/.oe/
64
mkdir -p ~/.oe/
@@ -68,11 +69,11 @@ else
68
DISTRO="angstrom-2010.x"
69
DISTRO="angstrom-2010.x"
69
DISTRO_DIRNAME=`echo $DISTRO | sed s#[.-]#_#g`
70
DISTRO_DIRNAME=`echo $DISTRO | sed s#[.-]#_#g`
70

71

71-
echo "export SCRIPTS_BASE_VERSION=${BASE_VERSION}" > ~/.oe/environment-oecore
72+
echo "export SCRIPTS_BASE_VERSION=${BASE_VERSION}" > ${OE_ENV_FILE}
72-
echo "export BBFETCH2=True" >> ~/.oe/environment-oecore
73+
echo "export BBFETCH2=True" >> ${OE_ENV_FILE}
73

74

74-
echo "export DISTRO=\"${DISTRO}\"" >> ~/.oe/environment-oecore
75+
echo "export DISTRO=\"${DISTRO}\"" >> ${OE_ENV_FILE}
75-
echo "export DISTRO_DIRNAME=\"${DISTRO_DIRNAME}\"" >> ~/.oe/environment-oecore
76+
echo "export DISTRO_DIRNAME=\"${DISTRO_DIRNAME}\"" >> ${OE_ENV_FILE}
76

77

77
#--------------------------------------------------------------------------
78
#--------------------------------------------------------------------------
78
# Specify the root directory for your OpenEmbedded development
79
# Specify the root directory for your OpenEmbedded development
@@ -87,27 +88,27 @@ else
87
mkdir -p ${OE_SOURCE_DIR}
88
mkdir -p ${OE_SOURCE_DIR}
88
export OE_BASE
89
export OE_BASE
89

90

90-
echo "export OE_BUILD_DIR=\"${OE_BUILD_DIR}\"" >> ~/.oe/environment-oecore
91+
echo "export OE_BUILD_DIR=\"${OE_BUILD_DIR}\"" >> ${OE_ENV_FILE}
91-
echo "export BUILDDIR=\"${OE_BUILD_DIR}\"" >> ~/.oe/environment-oecore
92+
echo "export BUILDDIR=\"${OE_BUILD_DIR}\"" >> ${OE_ENV_FILE}
92-
echo "export OE_BUILD_TMPDIR=\"${OE_BUILD_TMPDIR}\"" >> ~/.oe/environment-oecore
93+
echo "export OE_BUILD_TMPDIR=\"${OE_BUILD_TMPDIR}\"" >> ${OE_ENV_FILE}
93-
echo "export OE_SOURCE_DIR=\"${OE_SOURCE_DIR}\"" >> ~/.oe/environment-oecore
94+
echo "export OE_SOURCE_DIR=\"${OE_SOURCE_DIR}\"" >> ${OE_ENV_FILE}
94

95

95-
echo "export OE_BASE=\"${OE_BASE}\"" >> ~/.oe/environment-oecore
96+
echo "export OE_BASE=\"${OE_BASE}\"" >> ${OE_ENV_FILE}
96

97

97
#--------------------------------------------------------------------------
98
#--------------------------------------------------------------------------
98
# Include up-to-date bitbake in our PATH.
99
# Include up-to-date bitbake in our PATH.
99
#--------------------------------------------------------------------------
100
#--------------------------------------------------------------------------
100
export PATH=${OE_SOURCE_DIR}/openembedded-core/scripts:${OE_SOURCE_DIR}/bitbake/bin:${PATH}
101
export PATH=${OE_SOURCE_DIR}/openembedded-core/scripts:${OE_SOURCE_DIR}/bitbake/bin:${PATH}
101

102

102-
echo "export PATH=\"${PATH}\"" >> ~/.oe/environment-oecore
103+
echo "export PATH=\"${PATH}\"" >> ${OE_ENV_FILE}
103

104

104
#--------------------------------------------------------------------------
105
#--------------------------------------------------------------------------
105
# Make sure Bitbake doesn't filter out the following variables from our
106
# Make sure Bitbake doesn't filter out the following variables from our
106
# environment.
107
# environment.
107
#--------------------------------------------------------------------------
108
#--------------------------------------------------------------------------
108
export BB_ENV_EXTRAWHITE="MACHINE DISTRO TCLIBC TCMODE GIT_PROXY_COMMAND http_proxy ftp_proxy https_proxy all_proxy ALL_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS"
109
export BB_ENV_EXTRAWHITE="MACHINE DISTRO TCLIBC TCMODE GIT_PROXY_COMMAND http_proxy ftp_proxy https_proxy all_proxy ALL_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS"
109

110

110-
echo "export BB_ENV_EXTRAWHITE=\"${BB_ENV_EXTRAWHITE}\"" >> ~/.oe/environment-oecore
111+
echo "export BB_ENV_EXTRAWHITE=\"${BB_ENV_EXTRAWHITE}\"" >> ${OE_ENV_FILE}
111

112

112
#--------------------------------------------------------------------------
113
#--------------------------------------------------------------------------
113
# Specify proxy information
114
# Specify proxy information
@@ -119,10 +120,10 @@ else
119
export SVN_CONFIG_DIR=${OE_BUILD_DIR}/subversion_config
120
export SVN_CONFIG_DIR=${OE_BUILD_DIR}/subversion_config
120
export GIT_CONFIG_DIR=${OE_BUILD_DIR}/git_config
121
export GIT_CONFIG_DIR=${OE_BUILD_DIR}/git_config
121

122

122-
echo "export http_proxy=\"${http_proxy}\"" >> ~/.oe/environment-oecore
123+
echo "export http_proxy=\"${http_proxy}\"" >> ${OE_ENV_FILE}
123-
echo "export ftp_proxy=\"${ftp_proxy}\"" >> ~/.oe/environment-oecore
124+
echo "export ftp_proxy=\"${ftp_proxy}\"" >> ${OE_ENV_FILE}
124-
echo "export SVN_CONFIG_DIR=\"${SVN_CONFIG_DIR}\"" >> ~/.oe/environment-oecore
125+
echo "export SVN_CONFIG_DIR=\"${SVN_CONFIG_DIR}\"" >> ${OE_ENV_FILE}
125-
echo "export GIT_CONFIG_DIR=\"${GIT_CONFIG_DIR}\"" >> ~/.oe/environment-oecore
126+
echo "export GIT_CONFIG_DIR=\"${GIT_CONFIG_DIR}\"" >> ${OE_ENV_FILE}
126

127

127
config_svn_proxy
128
config_svn_proxy
128
config_git_proxy
129
config_git_proxy
@@ -133,7 +134,7 @@ else
133
#--------------------------------------------------------------------------
134
#--------------------------------------------------------------------------
134
export BBPATH=${OE_BUILD_DIR}:${OE_SOURCE_DIR}/openembedded-core/meta${BBPATH_EXTRA}
135
export BBPATH=${OE_BUILD_DIR}:${OE_SOURCE_DIR}/openembedded-core/meta${BBPATH_EXTRA}
135

136

136-
echo "export BBPATH=\"${BBPATH}\"" >> ~/.oe/environment-oecore
137+
echo "export BBPATH=\"${BBPATH}\"" >> ${OE_ENV_FILE}
137

138

138
#--------------------------------------------------------------------------
139
#--------------------------------------------------------------------------
139
# Reconfigure dash
140
# Reconfigure dash
@@ -143,8 +144,8 @@ else
143
expect -c 'spawn sudo dpkg-reconfigure -freadline dash; send "n\n"; interact;'
144
expect -c 'spawn sudo dpkg-reconfigure -freadline dash; send "n\n"; interact;'
144
fi
145
fi
145

146

146-
echo "There now is a sourceable script in ~/.oe/enviroment. You can do '. ~/.oe/environment-oecore' and run 'bitbake something' without using $0 as wrapper"
147+
echo "There now is a sourceable script in ~/.oe/enviroment. You can do '. ${OE_ENV_FILE}' and run 'bitbake something' without using $0 as wrapper"
147-
fi # if -e ~/.oe/environment-oecore
148+
fi # if -e ${OE_ENV_FILE}
148
}
149
}
149

150

150

151

@@ -184,8 +185,8 @@ function oe_build()
184
fi
185
fi
185

186

186
set_environment
187
set_environment
187-
if [ -e ~/.oe/environment-oecore ] ; then
188+
if [ -e ${OE_ENV_FILE} ] ; then
188-
echo "Using ~/.oe/environment-oecore to setup needed variables. It is recommended to do '. ~/.oe/environment-oecore' and run 'bitbake something' without using $0 as wrapper"
189+
echo "Using ${OE_ENV_FILE} to setup needed variables. It is recommended to do '. ${OE_ENV_FILE}' and run 'bitbake something' without using $0 as wrapper"
189
fi
190
fi
190
cd ${OE_BUILD_DIR}
191
cd ${OE_BUILD_DIR}
191
if [ -z $MACHINE ] ; then
192
if [ -z $MACHINE ] ; then
@@ -230,27 +231,8 @@ function update_oe()
230
###############################################################################
231
###############################################################################
231
function config_oe()
232
function config_oe()
232
{
233
{
233-
#--------------------------------------------------------------------------
234+
234-
# Determine the proper machine name
235+
MACHINE="${CL_MACHINE}"
235-
#--------------------------------------------------------------------------
236-
case ${CL_MACHINE} in
237-
beagle|beagleboard)
238-
MACHINE="beagleboard"
239-
;;
240-
dm6446evm|davinci-evm)
241-
MACHINE="davinci-dvevm"
242-
;;
243-
omap3evm)
244-
MACHINE="omap3evm"
245-
;;
246-
shiva|omap3517-evm)
247-
MACHINE="omap3517-evm"
248-
;;
249-
*)
250-
echo "Unknown machine ${CL_MACHINE}, passing it to OE directly"
251-
MACHINE="${CL_MACHINE}"
252-
;;
253-
esac
254

236

255
#--------------------------------------------------------------------------
237
#--------------------------------------------------------------------------
256
# Write out the OE bitbake configuration file.
238
# Write out the OE bitbake configuration file.
@@ -335,7 +317,7 @@ fi
335
_EOF
317
_EOF
336
chmod +x ${GIT_CONFIG_DIR}/git-proxy.sh
318
chmod +x ${GIT_CONFIG_DIR}/git-proxy.sh
337
export GIT_PROXY_COMMAND=${GIT_CONFIG_DIR}/git-proxy.sh
319
export GIT_PROXY_COMMAND=${GIT_CONFIG_DIR}/git-proxy.sh
338-
echo "export GIT_PROXY_COMMAND=\"\${GIT_CONFIG_DIR}/git-proxy.sh\"" >> ~/.oe/environment-oecore
320+
echo "export GIT_PROXY_COMMAND=\"\${GIT_CONFIG_DIR}/git-proxy.sh\"" >> ${OE_ENV_FILE}
339
fi
321
fi
340
}
322
}
341

323

@@ -392,7 +374,7 @@ echo " $0 update"
392
echo ""
374
echo ""
393
echo " Not recommended, but also possible:"
375
echo " Not recommended, but also possible:"
394
echo " $0 bitbake <bitbake target>"
376
echo " $0 bitbake <bitbake target>"
395-
echo " It is recommended to do '. ~/.oe/environment-oecore' and run 'bitbake something' inside ${BUILDDIR} without using oebb.sh as wrapper"
377+
echo " It is recommended to do '. ${OE_ENV_FILE}' and run 'bitbake something' inside ${BUILDDIR} without using oebb.sh as wrapper"
396
echo ""
378
echo ""
397
echo "You must invoke \"$0 config <machine>\" and then \"$0 update\" prior"
379
echo "You must invoke \"$0 config <machine>\" and then \"$0 update\" prior"
398
echo "to your first bitbake command"
380
echo "to your first bitbake command"

0 commit comments

Comments
 (0)