-
Notifications
You must be signed in to change notification settings - Fork 0
/
set-oe-env
90 lines (74 loc) · 2.24 KB
/
set-oe-env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/sh
## OpenEmbedded environment setup script for Rabbit project
##
## Before starting a build from a build shell; cd to the directory holding
## this file and then source the file:
##
## $ . set-oe-env
##
## Or, to update existing sub-repo clones to latest revision:
##
## $ PULL=1 . set-oe-env
## Meta data versions to use (branch name or commit sha) ##
RELBRANCH=master
POKY_VER=$RELBRANCH
META_OPENEMBEDDED_VER=$RELBRANCH
META_FREESCALE_VER=$RELBRANCH
META_FREESCALE_3RDPARTY_VER=$RELBRANCH
## Set TOPDIR, DL_DIR and DL_MIRROR ##
TOPDIR=$(readlink -f .)
[ -z "$DOWNLOADS" ] && DOWNLOADS="../downloads"
DL_DIR=$(readlink -f $DOWNLOADS)
if [ ! -d $DL_DIR ]; then
echo "Error: Downloads directory '$DL_DIR' missing!"
return 1
fi
[ -z "$DL_MIRROR" ] && DL_MIRROR="file://$(readlink -f ../../dlmirror)"
export TOPDIR DL_DIR DL_MIRROR
## Create an empty build directory ##
BDIR=$TOPDIR/build
if [ ! -d $BDIR ]; then
echo "Creating a build directory..."
mkdir $BDIR
fi
## Auto check-out used layers ##
clone_repo () {
repo_url="$1"
checkout="$2"
repo_name=$(basename "${repo_url}" ".git")
echo "Checking for $checkout of $repo_name"
if [ ! -d "$repo_name" ]; then
git clone -nq "$repo_url" "$repo_name"
if [ $? -ne 0 ]; then
echo "Error: Failed to clone $repo_url"
return 1
fi
cd "$repo_name"
else
cd "$repo_name"
git fetch
fi
git checkout -q "$checkout"
if [ $? -ne 0 ]; then
echo "Error: Failed to check out $checkout of $repo_name"
return 1
fi
[ "$PULL" == "1" ] && git pull
cd - > /dev/null
return 0
}
clone_repo git://git.yoctoproject.org/poky.git $POKY_VER || return 1
clone_repo git://git.openembedded.org/meta-openembedded $META_OPENEMBEDDED_VER || return 1
clone_repo https://github.com/Freescale/meta-freescale $META_FREESCALE_VER || return 1
clone_repo https://github.com/Freescale/meta-freescale-3rdparty $META_FREESCALE_3RDPARTY_VER || return 1
## Source the OE-core supplied environment setup script ##
echo "Processing OE-core internal setup..."
OEROOT=$TOPDIR/poky
. $OEROOT/scripts/oe-buildenv-internal
if [ $? -ne 0 ]; then
echo "Error: OE-core setup script failed!"
return 1
fi
## Add to the BitBake environment awareness ##
export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE TOPDIR DL_DIR DL_MIRROR"
echo "Setup complete!"