forked from jetsonhacks/buildJetsonTX2Kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeKernel.sh
executable file
·51 lines (45 loc) · 1.33 KB
/
makeKernel.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
#!/bin/bash
# Make the kernel for NVIDIA Jetson TX2 Developer Kit
# Copyright (c) 2016-20 Jetsonhacks
# MIT License
SOURCE_TARGET="/usr/src"
KERNEL_RELEASE="4.9"
function usage
{
echo "usage: ./makeKernel.sh [[-d directory ] | [-h]]"
echo "-d | --directory Directory path to parent of kernel"
echo "-h | --help This message"
}
# Iterate through command line inputs
while [ "$1" != "" ]; do
case $1 in
-d | --directory ) shift
SOURCE_TARGET=$1
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
LAST="${SOURCE_TARGET: -1}"
if [ $LAST != '/' ] ; then
SOURCE_TARGET="$SOURCE_TARGET""/"
fi
# Check to see if source tree is already installed
PROPOSED_SRC_PATH="$SOURCE_TARGET""kernel/kernel-"$KERNEL_RELEASE
echo "Proposed source path: ""$PROPOSED_SRC_PATH"
if [ ! -d "$PROPOSED_SRC_PATH" ]; then
tput setaf 1
echo "==== Cannot find kernel source! =============== "
tput sgr0
echo "The kernel source does not appear to be installed at: "
echo " ""$PROPOSED_SRC_PATH"
echo "Unable to start making kernel."
exit 1
fi
export SOURCE_TARGET
# E Option carries over environment variables
sudo -E ./scripts/makeKernel.sh