-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·111 lines (90 loc) · 2.73 KB
/
build.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
#!/bin/bash
# Get location of this script. This is different to the current working directory, which could be anywhere!
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# Load the environment variables
source ${SCRIPT_DIR}/install.env
# Load the external utility scripts
source ${SCRIPT_DIR}/scripts/textutils.sh
source ${SCRIPT_DIR}/scripts/spinner.sh
source ${SCRIPT_DIR}/scripts/cmdutils.sh
source ${SCRIPT_DIR}/scripts/build_functions.sh
# Load the setup scripts, which do all the hard work
source ${SCRIPT_DIR}/scripts/setup_functions.sh
# INSTALL good flag
INSTALLGOOD=1
# Check that the variables we need are set
if [[ -z "${INSTALLDIR}" ]]; then
echo "Couldn't find \$INSTALLDIR value."
INSTALLGOOD=0
fi
if [[ -z "${CROSS_COMPILE}" ]]; then
echo "Couldn't find \$CROSS_COMPILE value."
INSTALLGOOD=0
fi
if [[ -z "${LOCALVERSION}" ]]; then
echo "Couldn't find \$LOCALVERSION value."
INSTALLGOOD=0
fi
if [[ -z "${TEGRA_KERNEL_OUT}" ]]; then
echo "Couldn't find \$TEGRA_KERNEL_OUT value."
INSTALLGOOD=0
fi
# If the install was not good, quit
if [[ ${INSTALLGOOD} -eq 0 ]]; then
echo "Please run setup.sh"
exit 1
fi
# Check that our source folder exists
if [ ! -d "${INSTALLDIR}/Linux_for_Tegra/source/public/kernel/kernel-4.9" ]
then
echo "Could not find kernel source folder."
echo "Expected to find it at:"
echo "\t${INSTALLDIR}/Linux_for_Tegra/source/public/kernel/kernel-4.9"
exit 1
fi
# Go to the directory
cd "${INSTALLDIR}/Linux_for_Tegra/source/public/kernel/kernel-4.9"
title "Novacarrier: Kernel DTB Compilation Tool"
prompt "[IMPORTANT] Apply novacarrier-specific kernel changes?\nThese are stored in the /dts/ folder.\nSee build_functions.sh for the copy direction. ${BOLD}[Y/n]${END} "
case "$REPLY" in
"")
apply_nova_dts
;;
[yY][eE][sS]|[yY])
apply_nova_dts
;;
*)
;;
esac
setup_make
prompt "Would you like build the kernel Device Tree Binaries now? ${BOLD}[Y/n]${END} "
case "$REPLY" in
"")
compile_dtbs
;;
[yY][eE][sS]|[yY])
compile_dtbs
;;
*)
echo "Not compiling."
exit 0
;;
esac
prompt "Would you like install the compiled Device Tree Binaries, so they can be flashed? ${BOLD}[Y/n]${END} "
case "$REPLY" in
"")
install_dtbs
;;
[yY][eE][sS]|[yY])
install_dtbs
;;
*)
;;
esac
# Copy image to the kernel image install dir for flash.sh
# $TEGRA_KERNEL_OUT/arch/arm64/boot/Image
# Copy dtbs to the kernel install dir for flash.sh
# $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/
echo "DONE!"
# Copy modules to the rootfs
# sudo make ARCH=arm64 O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=<top>/Linux_for_Tegra/rootfs/