CTI-L4T/install.sh

138 lines
2.3 KiB
Bash
Raw Normal View History

#!/bin/bash
COMPAT_MAJOR=("32")
COMPAT_MINOR=("2.1")
COMPAT_JETSON=("TX2" "TX2i" "TX2-4G")
CTI_L4T_VER="V004"
#utility functions
chkroot(){
if [ $EUID -ne 0 ]
then
echo "Please run as sudo or root"
exit 1
fi
}
chkhost(){
if [ $( uname -i | grep -c x86) -lt 1 ]; then
echo "This version of the CTI-L4T BSP must be installed on the x86 Host system"
exit 1
fi
}
#check if bsp installed in the correct folder on host machine
chkfolder(){
if [ $(basename $(dirname $(pwd))) != "Linux_for_Tegra" ] || [ $(basename $(pwd)) != "CTI-L4T" ]; then
echo "This BSP should be extracted in the Linux_for_Tegra directory"
echo "of your Jetpack install. This install script must be run from the"
echo "Linux_for_Tegra/CTI-L4T directory"
exit 2
fi
}
install_conf(){
cp -r ./conf/* ..
}
install_dtb(){
cp ./kernel/dtb/* ../kernel/dtb/
}
install_kernel(){
cp ./kernel/*Image ../kernel/
cp ./kernel/kernel_supplements.tbz2 ../kernel/
}
install_bl(){
cp -r ./bl/* ../bootloader/
}
install_rootfs(){
cp -r ./rootfs/* ../rootfs/
}
install_ver_file(){
mkdir -p ../rootfs/etc/cti
echo $CTI_L4T_VER > ../rootfs/etc/cti/CTI-L4T.version
}
print_versions(){
echo "Supported Version Information"
echo " CTI-L4T Board Support Package Version:" $CTI_L4T_VER
echo " Supported Linux for Tegra Release Versions: "
for j in ${COMPAT_MINOR[@]}; do
echo " " $COMPAT_MAJOR"."$j
done
echo " Supported Nvidia Jetson Module Hardware: "
for k in ${COMPAT_JETSON[@]}; do
echo " " $k
done
}
#help functions
usage(){
echo -e " Usage: ./install.sh "
echo -e " Before installing this BSP, please read the included readme.txt"
echo -e " To switch between different products, the TX2/TX2i/TX2-4G will need"
echo -e " to be re-flashed"
echo -e " Below are the compatible L4T versions and board profiles:\n"
print_versions
}
#start
usage
chkroot
chkfolder
tar -pxzf resources.tgz
#install CTI-flash
mv cti-flash.sh ..
chmod +x ../cti-flash.sh
install_conf
install_dtb
install_bl
install_kernel
install_ver_file
pushd ..
./apply_binaries.sh
popd
install_rootfs
# ensure the files finish copying
sync
echo "CTI-L4T-$CTI_L4T_VER Installed!"