/
env_setup.sh
77 lines (64 loc) · 2.28 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
71
72
73
74
75
76
#!/bin/bash
TARGET=$1
if [ "$TARGET" != "" ]; then
echo "starting your build for $TARGET"
else
echo ""
echo "you need to define your device target!"
echo "example: build_kernel.sh N910C"
exit 1
fi
# location
#if [ "${1}" != "" ]; then
# export KERNELDIR=`readlink -f ${1}`;
#else
export KERNELDIR=`readlink -f .`;
#fi;
export INITRAMFS_VARIANT=`readlink -f $KERNELDIR/../ramdisk_boot_files/$TARGET`;
export PARENT_DIR=`readlink -f ${KERNELDIR}/..`;
export INITRAMFS_SOURCE=`readlink -f $KERNELDIR/../initramfs`;
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' by this script to continue.";
sudo dpkg -i ${KERNELDIR}/utilities/parallel_20120422-1_all.deb
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 xmllint installed, if not install
if [ ! -e /usr/bin/xmllint ]; then
echo "You must install 'xmllint' to continue.";
sudo apt-get install libxml2-utils
fi
# kernel
export ARCH=arm;
export SUB_ARCH=arm;
if [ "$TARGET" = "N910C" ] ; then
export KERNEL_CONFIG="halaszk_trelte_defconfig";
fi;
if [ "$TARGET" = "N910U" ] ; then
export KERNEL_CONFIG="halaszk_trhplte_defconfig";
fi;
# build script
export USER=`whoami`;
export TMPFILE=`mktemp -t`;
# system compiler
#export CROSS_COMPILE=/home/dev/KERNEL/arm-eabi-4.9.x/bin/arm-linux-gnueabihf-
#export CROSS_COMPILE=/home/dev/KERNEL/arm-cortex-linux-gnueabi-linaro_4.9/bin/arm-cortex-linux-gnueabi-
export CROSS_COMPILE=/home/dev/KERNEL/arm-cortex-linux-gnueabi-linaro_5.2/bin/arm-cortex-linux-gnueabi-
#CPU Core
export NUMBEROFCPUS=`grep 'processor' /proc/cpuinfo | wc -l`;
# 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