173 lines
3.2 KiB
Bash
Executable File
173 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
COMPAT_MAJOR=("32")
|
|
COMPAT_MINOR=("4.4")
|
|
|
|
COMPAT_JETSON=("TX2" "TX2i" "TX2-4G")
|
|
|
|
CTI_L4T_VER="V003"
|
|
|
|
|
|
#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
|
|
|
|
}
|
|
|
|
update_debsrc_list(){
|
|
if [ -f ../rootfs/etc/apt/sources.list.d/nvidia-l4t-apt-source.list ]; then
|
|
echo "Suppressing nvidia-l4t-apt-source"
|
|
if ! type sed > /dev/null; then
|
|
mv ../rootfs/etc/apt/sources.list.d/nvidia-l4t-apt-source.list ../rootfs/etc/apt/sources.list.d/nvidia-l4t-apt-source.list.old
|
|
else
|
|
sed -i 's/^/#/' ../rootfs/etc/apt/sources.list.d/nvidia-l4t-apt-source.list
|
|
fi
|
|
fi
|
|
}
|
|
|
|
|
|
install_extra(){
|
|
cp ./extra/*.deb ../nv_tegra/l4t_deb_packages/
|
|
#cp ./extra/*.asc ../rootfs/etc/apt/trusted.gpg.d/
|
|
cp ./extra/*.list ../rootfs/etc/apt/sources.list.d/
|
|
}
|
|
|
|
install_key(){
|
|
cp -f ./key/* ../rootfs/etc/apt/trusted.gpg.d/
|
|
}
|
|
|
|
install_conf(){
|
|
|
|
cp -rf ./conf/* ../
|
|
|
|
}
|
|
|
|
install_dtb(){
|
|
cp ./kernel/dtb/* ../kernel/dtb/
|
|
|
|
}
|
|
|
|
install_kernel(){
|
|
# remove old debs
|
|
rm ../kernel/*.deb
|
|
|
|
# copy kernel debs
|
|
cp ./kernel/*.deb ../kernel
|
|
cp ./kernel/*Image ../kernel
|
|
cp ./kernel/kernel_supplements.tbz2 ../kernel/
|
|
}
|
|
|
|
|
|
install_bl(){
|
|
if [ "$(ls -A ./bl)" ]; then
|
|
cp -r ./bl/* ../bootloader/
|
|
fi
|
|
|
|
}
|
|
|
|
install_rootfs(){
|
|
if [ "$(ls -A ./rootfs)" ]; then
|
|
cp -r ./rootfs/* ../rootfs/
|
|
fi
|
|
}
|
|
|
|
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 to be re-flashed"
|
|
echo -e " Ensure to extract clean rootfs\n"
|
|
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_bl
|
|
|
|
install_dtb
|
|
|
|
install_kernel
|
|
|
|
install_ver_file
|
|
|
|
install_extra
|
|
|
|
pushd ..
|
|
|
|
./apply_binaries.sh
|
|
|
|
popd
|
|
|
|
|
|
# ensure the files finish copying
|
|
sync
|
|
|
|
echo "CTI-L4T-$CTI_L4T_VER Installed!"
|