forked from JetsonHacksNano/buildKernelAndModules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
editConfig.sh
executable file
·50 lines (44 loc) · 1.33 KB
/
editConfig.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
#!/bin/bash
# Edit the kernel configuration for NVIDIA Jetson Developer Kit
# Copyright (c) 2016-21 Jetsonhacks
# MIT License
SOURCE_TARGET="/usr/src"
KERNEL_RELEASE=$( uname -r | cut -d. -f1-2) # e.g. 4.9
function usage
{
echo "usage: ./editConfig.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 edit kernel configuration."
exit 1
fi
cd "$PROPOSED_SRC_PATH"
sudo make menuconfig