forked from RobertCNelson/bb.org-overlays
-
Notifications
You must be signed in to change notification settings - Fork 176
/
dtc-overlay.sh
executable file
·61 lines (49 loc) · 1.22 KB
/
dtc-overlay.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
#!/bin/sh -e
DIR="$PWD"
check_dpkg () {
LC_ALL=C dpkg --list | awk '{print $2}' | grep "^${pkg}" >/dev/null || deb_pkgs="${deb_pkgs}${pkg} "
}
dtc_git_build () {
project="dtc"
server="https://git.kernel.org/pub/scm/utils/dtc/dtc.git"
if [ ! -d ${HOME}/git/ ] ; then
mkdir -p ${HOME}/git/ || true
fi
if [ ! -f ${HOME}/git/${project}/.git/config ] ; then
git clone ${server} ${HOME}/git/${project}/
fi
cd ${HOME}/git/${project}/
make clean
git checkout master -f
git pull || true
if [ ! "x${git_tag}" = "x" ] ; then
test_for_branch=$(git branch --list ${git_tag}-build)
if [ "x${test_for_branch}" != "x" ] ; then
git branch ${git_tag}-build -D
fi
git checkout ${git_tag} -b ${git_tag}-build
fi
make clean
make PREFIX=/usr/local/ CC=gcc CROSS_COMPILE= all
echo "Installing into: /usr/local/bin/"
sudo make PREFIX=/usr/local/ install
sudo ln -sf /usr/local/bin/dtc /usr/bin/dtc
echo "dtc: `/usr/bin/dtc --version`"
}
unset deb_pkgs
pkg="bison"
check_dpkg
pkg="build-essential"
check_dpkg
pkg="flex"
check_dpkg
pkg="git"
check_dpkg
if [ "${deb_pkgs}" ] ; then
echo "Installing: ${deb_pkgs}"
sudo apt-get update
sudo apt-get -y install ${deb_pkgs}
sudo apt-get clean
fi
git_tag="v1.4.7"
dtc_git_build