-
Notifications
You must be signed in to change notification settings - Fork 2
/
env_setup.sh
68 lines (56 loc) · 2.2 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
#!/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
# Set Target
TARGET=${1}
export KERNELDIR=`readlink -f .`;
export PARENT_DIR=`readlink -f ${KERNELDIR}/..`;
export INITRAMFS_SOURCE=`readlink -f $PARENT_DIR/../ramdisks/$TARGET`;
export INITRAMFS_TMP=${KERNELDIR}/tmp/initramfs_source;
# Kernel
export ARCH=arm64;
export SUB_ARCH=arm;
export KERNEL_CONFIG_LETTUCE="cyanogenmod_lettuce-64_defconfig";
export KERNEL_CONFIG_TOMATO="cyanogenmod_tomato-64_defconfig";
# 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
# Build script
export USER=`whoami`;
export KBUILD_BUILD_USER="NeoBuddy89";
export KBUILD_BUILD_HOST="DragonCore";
# Compiler
export CROSS_COMPILE=$PARENT_DIR/../toolchains/aarch64_aarch64-linux-android-4.9/bin/aarch64-linux-android-;
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 [ ! ${TARGET} == '' ] &&
[ ! -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`;