-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.sh
executable file
·134 lines (107 loc) · 5.11 KB
/
configure.sh
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
# Source environment variables common between linux and the docker
source "${SCRIPT_DIR}/yocto.env"
# Source common functions and environment variables.
source "${SCRIPT_DIR}/common.env"
# Git URLs for Yocto Poky and Xilinx BSP
POKY_URL="https://github.com/nsat/poky.git"
POKY_SHA="3b8dc3a88e28546100a6b0b2f2cc37f44e619371"
OE_URL="https://github.com/nsat/meta-openembedded.git"
OE_SHA="be79b8b111a968efdbe5e1482d0c246d0b24763e"
XILINX_URL="https://github.com/nsat/meta-xilinx.git"
XILINX_SHA="5fccc46503e468ed024185ed032891799a31db58"
ADI_URL="https://github.com/nsat/meta-adi.git"
ADI_BRANCH="2018_R2"
ADI_SHA="ff56b3d8f34dd558895645da0894937de5a878e4"
# Git branch name for Yocto
YOCTO_BRANCH="sumo"
# Enters build directory
cd_build
# usage: clone_or_update directory git_url git_branch git_sha depth
# param1: directory to checkout to
# param2: url of git repository
# param3: branch of git repository to fetch/clone
# param4: sha to checkout
# param5: optional depth to pull, default full clone/fetch
function clone_or_update() {
pwd
dir=$1
url=$2
branch=$3
sha=$4
if [ -z "$5" ]; then
depth=""
else
depth="--depth $5"
fi
echo "dir - $dir"
echo "url - $url"
echo "branch - $branch"
echo "sha - $sha"
echo "depth - $depth"
if [ ! -d $dir ]; then
echo "$dir does not exist - cloning"
git clone $url --branch $branch $depth $dir
fi
pushd $dir &>/dev/null || error "Couldn't enter $dir"
if ! (git checkout $sha); then
echo "git checkout $sha failed - fetching..."
if ! (git fetch $depth origin $branch && git checkout $sha); then
echo "git fetch $depth origin $branch && git checkout $sha failed"
return 1
fi
fi
# Simple check for dirty files, not comprehensive
if [ "$(git diff --shortstat 2>/dev/null)" != "" ]; then
warn "$dir is dirty"
fi
popd &>/dev/null || error "Couldn't pop $dir"
return 0
}
# Clone Yocto Poky or verify that it already exists
print_step "Cloning Yocto Poky"
clone_or_update poky ${POKY_URL} ${YOCTO_BRANCH} ${POKY_SHA} 100 || error "Failed to get correct POKY version"
# Enter poky directory
pushd poky &>/dev/null || error "Couldn't enter poky directory"
# Clone meta-oe or verify that it already exists
print_step "Cloning meta-openembedded"
clone_or_update meta-openembedded ${OE_URL} ${YOCTO_BRANCH} ${OE_SHA} 200 \
|| error "Failed to get correct meta-oe version"
# Clone meta-xilinx or verify that it already exists
print_step "Cloning meta-xilinx"
clone_or_update meta-xilinx ${XILINX_URL} ${YOCTO_BRANCH} ${XILINX_SHA} 100 \
|| error "Failed to get correct meta-xilinx version"
# Clone meta-adi or verify that it already exists
print_step "Cloning meta-adi"
clone_or_update meta-adi ${ADI_URL} ${ADI_BRANCH} ${ADI_SHA} 100 \
|| error "Failed to get correct meta-adi version"
echo "SCRIPT_DIR - $SCRIPT_DIR"
# Link Spire-specific layers into poky directory
ln -sfn "${SCRIPT_DIR}/meta-spire" "${LEMDIG_BUILD_DIR}/poky/" || error "Couldn't create link to meta-spire"
ln -sfn "${SCRIPT_DIR}/meta-lemdig2" "${LEMDIG_BUILD_DIR}/poky/" || error "Couldn't create link to meta-lemdig2"
ln -sfn "${SCRIPT_DIR}/meta-lemsdr" "${LEMDIG_BUILD_DIR}/poky/" || error "Couldn't create link to meta-lemsdr"
# Make Yocto build directory and setup configuration symlinks
mkdir -p "${LEMDIG_BUILD_DIR}/poky/build/conf/include" || error "Couldn't create conf directory"
ln -sfn "${SCRIPT_DIR}/conf/include/profile.inc" "${LEMDIG_BUILD_DIR}/poky/build/conf/include/profile.inc" || error "Couldn't link to profile.inc"
ln -sfn "${SCRIPT_DIR}/conf/site.conf" "${LEMDIG_BUILD_DIR}/poky/build/conf/site.conf" || error "Couldn't link to site.conf"
ln -sfn "${SCRIPT_DIR}/conf/local.conf" "${LEMDIG_BUILD_DIR}/poky/build/conf/local.conf" || error "Couldn't link to local.conf"
ln -sfn "${SCRIPT_DIR}/conf/bblayers.conf" "${LEMDIG_BUILD_DIR}/poky/build/conf/bblayers.conf" || error "Couldn't link to bblayers.conf"
# Populate auto.conf Bitbake configuration file
autoconf_path="${LEMDIG_BUILD_DIR}/poky/build/conf/auto.conf"
echo "# Automatically generated by lemdig/scripts/configure.sh; do not edit." > "${autoconf_path}"
echo "SPIRE_AIR_DIR = \"${SCRIPT_DIR}\"" >> "${autoconf_path}"
echo "AIR_BUILD_SIG = \"${AIR_BUILD_SIG:-Unspecified}\"" >> "${autoconf_path}"
echo "SSTATE_DIR = \"${YOCTO_SSTATE_DIR}\"" >> "${autoconf_path}"
echo "DL_DIR = \"${YOCTO_DL_DIR}\"" >> "${autoconf_path}"
if [ -n "${YOCTO_SSTATE_MIRRORS}" ]; then
echo "SSTATE_MIRRORS = \"${YOCTO_SSTATE_MIRRORS}\"" >> "${autoconf_path}"
fi
# manifest.bb variables
PAYLOAD_VERSION_PATH="/lemdig/meta-spire/classes/$LEMDIG_PROFILE/VERSION"
echo "PAYLOAD_NAME=\"$LEMDIG_PROFILE\"" >> ${autoconf_path}
echo "YOCTO_BRANCH=\"$YOCTO_BRANCH\"" >> ${autoconf_path}
echo "GIT_COMMIT=\"$(git rev-parse HEAD)\"" >> ${autoconf_path}
echo "PAYLOAD_VERSION=\"$(<$PAYLOAD_VERSION_PATH)\"" >> ${autoconf_path}
# fpga-dto-util.bb
echo "LEMDIG_FPGA_DTO_DIR=\"$LEMDIG_FPGA_DTO_DIR\"" >> ${autoconf_path}