Skip to content

Commit 479023d

Browse files
authored
Merge pull request #3 from jetsonhacks/development
CUDA Development
2 parents d335b90 + 505f84d commit 479023d

14 files changed

+967
-5572
lines changed

applyKernelPatches.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

buildPatchedKernel.sh

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
#!/bin/bash
2+
# Patch the kernel for the Intel Realsense library librealsense on a Jetson TX Development Kit
3+
# Copyright (c) 2016-18 Jetsonhacks
4+
# MIT License
5+
6+
# Error out if something goes wrong
7+
set -e
8+
9+
CLEANUP=true
10+
11+
function usage
12+
{
13+
echo "usage: ./buildPatchedKernel.sh [[-n nocleanup ] | [-h]]"
14+
echo "-n | --nocleanup Do not remove kernel and module sources after build"
15+
echo "-h | --help This message"
16+
}
17+
18+
# Iterate through command line inputs
19+
while [ "$1" != "" ]; do
20+
case $1 in
21+
-n | --nocleanup ) CLEANUP=false
22+
;;
23+
-h | --help ) usage
24+
exit
25+
;;
26+
* ) usage
27+
exit 1
28+
esac
29+
shift
30+
done
31+
32+
33+
34+
INSTALL_DIR=$PWD
35+
# Is this the correct kernel version?
36+
source scripts/jetson_variables.sh
37+
#Print Jetson version
38+
echo "$JETSON_DESCRIPTION"
39+
#Print Jetpack version
40+
echo "Jetpack $JETSON_JETPACK [L4T $JETSON_L4T]"
41+
42+
# Check to make sure we're installing the correct kernel sources
43+
L4TTarget="28.2"
44+
if [ $JETSON_L4T != $L4TTarget ] ; then
45+
# echo "Getting kernel sources"
46+
# sudo ./scripts/getKernelSources.sh
47+
# else
48+
echo ""
49+
tput setaf 1
50+
echo "==== L4T Kernel Version Mismatch! ============="
51+
tput sgr0
52+
echo ""
53+
echo "This repository is for modifying the kernel for L4T "$L4TTarget "system."
54+
echo "You are attempting to modify a L4T "$JETSON_L4T "system."
55+
echo "The L4T releases must match!"
56+
echo ""
57+
echo "There may be versions in the tag/release sections that meet your needs"
58+
echo ""
59+
exit 1
60+
fi
61+
62+
# Is librealsense on the device?
63+
LIBREALSENSE_DIRECTORY=${HOME}/librealsense
64+
LIBREALSENSE_VERSION=v2.10.4
65+
66+
if [ ! -d "$LIBREALSENSE_DIRECTORY" ] ; then
67+
echo "The librealsense repository directory is not available"
68+
read -p "Would you like to git clone librealsense? (y/n) " answer
69+
case ${answer:0:1} in
70+
y|Y )
71+
# clone librealsense
72+
cd ${HOME}
73+
echo "${green}Cloning librealsense${reset}"
74+
git clone https://github.com/IntelRealSense/librealsense.git
75+
cd librealsense
76+
# Checkout version the last tested version of librealsense
77+
git checkout $LIBREALSENSE_VERSION
78+
;;
79+
* )
80+
echo "Kernel patch and build not started"
81+
exit 1
82+
;;
83+
esac
84+
fi
85+
86+
# Is the version of librealsense current enough?
87+
cd $LIBREALSENSE_DIRECTORY
88+
VERSION_TAG=$(git tag -l $LIBREALSENSE_VERSION)
89+
if [ ! $VERSION_TAG ] ; then
90+
echo ""
91+
tput setaf 1
92+
echo "==== librealsense Version Mismatch! ============="
93+
tput sgr0
94+
echo ""
95+
echo "The installed version of librealsense is not current enough for these scripts."
96+
echo "This script needs librealsense tag version: "$LIBREALSENSE_VERSION "but it is not available."
97+
echo "This script uses patches from librealsense on the kernel source."
98+
echo "Please upgrade librealsense before attempting to patch and build the kernel again."
99+
echo ""
100+
exit 1
101+
fi
102+
103+
KERNEL_BUILD_DIR=""
104+
cd $INSTALL_DIR
105+
echo "Ready to patch and build kernel "$JETSON_BOARD
106+
if [ $JETSON_BOARD == "TX2" ] ; then
107+
git clone https://github.com/jetsonhacks/buildJetsonTX2Kernel.git
108+
KERNEL_BUILD_DIR=buildJetsonTX2Kernel
109+
cd $KERNEL_BUILD_DIR
110+
git checkout vL4T28.2r3
111+
elif [ $JETSON_BOARD == "TX1" ] ; then
112+
git clone https://github.com/jetsonhacks/buildJetsonTX1Kernel.git
113+
KERNEL_BUILD_DIR=buildJetsonTX1Kernel
114+
cd $KERNEL_BUILD_DIR
115+
git checkout v1.0-L4T28.2
116+
else
117+
tput setaf 1
118+
echo "==== Build Issue! ============="
119+
tput sgr0
120+
echo "There are no build scripts for this Jetson board"
121+
exit 1
122+
fi
123+
124+
# Get the kernel sources; does not open up editor on .config file
125+
echo "${green}Getting Kernel sources${reset}"
126+
./getKernelSourcesNoGUI.sh
127+
cd ..
128+
echo "${green}Patching and configuring kernel${reset}"
129+
sudo ./scripts/configureKernel.sh
130+
sudo ./scripts/patchKernel.sh
131+
132+
cd $KERNEL_BUILD_DIR
133+
# Make the new Image and build the modules
134+
echo "${green}Building Kernel and Modules${reset}"
135+
./makeKernel.sh
136+
# Now copy over the built image
137+
./copyImage.sh
138+
# Remove buildJetson Kernel scripts
139+
if [ $CLEANUP == true ]
140+
then
141+
echo "Removing Kernel build sources"
142+
./removeAllKernelSources.sh
143+
cd ..
144+
sudo rm -r $KERNEL_BUILD_DIR
145+
else
146+
echo "Kernel sources are in /usr/src"
147+
fi
148+
149+
150+
echo "Please reboot for changes to take effect"
151+

buildPatchedKernelTX2.sh

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)