-
Notifications
You must be signed in to change notification settings - Fork 8
/
env_setup.sh
70 lines (58 loc) · 2.21 KB
/
env_setup.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
#!/bin/bash
# Colorize and add text parameters
export red=$(tput setaf 1) # red
export grn=$(tput setaf 2) # green
export blu=$(tput setaf 4) # blue
export cya=$(tput setaf 6) # cyan
export txtbld=$(tput bold) # Bold
export bldred=${txtbld}$(tput setaf 1) # red
export bldgrn=${txtbld}$(tput setaf 2) # green
export bldblu=${txtbld}$(tput setaf 4) # blue
export bldcya=${txtbld}$(tput setaf 6) # cyan
export txtrst=$(tput sgr0) # Reset
# location
if [ "${1}" != "" ]; then
export KERNELDIR=`readlink -f ${1}`;
else
export KERNELDIR=`readlink -f .`;
fi;
export PARENT_DIR=`readlink -f ${KERNELDIR}/..`;
export INITRAMFS_SOURCE=`readlink -f $PARENT_DIR/../ramdisks/hammerhead`;
export INITRAMFS_TMP=${KERNELDIR}/tmp/initramfs_source;
# check if parallel installed, if not install
if [ ! -e /usr/bin/parallel ]; then
echo "You must install 'parallel' to continue.";
sudo apt-get install parallel
fi
# check if ccache installed, if not install
if [ ! -e /usr/bin/ccache ]; then
echo "You must install 'ccache' to continue.";
sudo apt-get install ccache
fi
# check if adb installed, if not install
if [ ! -e /usr/bin/adb ]; then
echo "You must install 'adb' to continue.";
sudo apt-get install android-tools-adb
fi
# kernel
export ARCH=arm;
export SUB_ARCH=arm;
export KERNEL_CONFIG="hybrid_hammerhead_defconfig";
# build script
export USER=`whoami`;
export TMPFILE=`mktemp -t`;
export KBUILD_BUILD_USER="NeoBuddy89";
export KBUILD_BUILD_HOST="DragonCore";
# system compiler
export CROSS_COMPILE=$PARENT_DIR/../toolchains/arm-cortex_a15-linux-gnueabihf-linaro_4.9.3-2015.03/bin/arm-cortex_a15-linux-gnueabihf-;
if [ ! -f ${CROSS_COMPILE}gcc ]; then
echo "${bldred}Cannot find GCC compiler ${CROSS_COMPILE}gcc${txtrst}";
echo "${bldcya}Please ensure you have GCC Compiler at path mentioned in env_setup.sh and then you can continue.${txtrst}";
exit 1;
fi
if [ ! -f ${INITRAMFS_SOURCE}/init ]; then
echo "${bldred}Cannot find proper ramdisk at ${INITRAMFS_SOURCE}${txtrst}";
echo "${bldcya}Please ensure you have RAMDISK at path mentioned in env_setup.sh and then you can continue.${txtrst}";
exit 1;
fi
export NUMBEROFCPUS=`grep 'processor' /proc/cpuinfo | wc -l`;