diff --git a/getKernelSources.sh b/getKernelSources.sh index 5e414ba..ef9ecdf 100755 --- a/getKernelSources.sh +++ b/getKernelSources.sh @@ -6,29 +6,6 @@ echo "$JETSON_DESCRIPTION" #Print Jetpack version echo "Jetpack $JETSON_JETPACK [L4T $JETSON_L4T]" -# Check to make sure we're installing the correct kernel sources -L4TTarget="28.2" -if [ $JETSON_L4T == $L4TTarget ] ; then - echo "Getting kernel sources" - sudo ./scripts/getKernelSources.sh -else - echo "" - tput setaf 1 - echo "==== L4T Kernel Version Mismatch! =============" - tput sgr0 - echo "" - echo "This repository branch is for installing the kernel sources for L4T "$L4TTarget - echo "You are attempting to use these kernel sources on a L4T "$JETSON_L4T "system." - echo "The kernel sources do not match their L4T release!" - echo "" - echo "Please git checkout the appropriate kernel sources for your release" - echo " " - echo "You can list the tagged versions." - echo "$ git tag -l" - echo "And then checkout the latest version: " - echo "For example" - echo "$ git checkout v1.0-L4T"$JETSON_L4T - echo "" -fi +sudo ./scripts/getKernelSources.sh diff --git a/scripts/getKernelSources.sh b/scripts/getKernelSources.sh index ec84ba0..a7dd3c3 100755 --- a/scripts/getKernelSources.sh +++ b/scripts/getKernelSources.sh @@ -1,16 +1,113 @@ #!/bin/bash +source jetson_variables.sh + apt-add-repository universe apt-get update apt-get install qt5-default pkg-config -y cd /usr/src -wget -N http://developer.download.nvidia.com/embedded/L4T/r28_Release_v2.0/GA/BSP/tx2_sources.tbz2 -sudo tar -xvf tx2_sources.tbz2 public_release/kernel_src.tbz2 -tar -xvf public_release/kernel_src.tbz2 -# Space is tight; get rid of the compressed kernel source -rm -r public_release -cd kernel/kernel-4.4 -# Go get the default config file; this becomes the new system configuration -zcat /proc/config.gz > .config -# Ready to configure kernel -make xconfig + +# Install the kernel source for L4T + +#Print Jetson version +echo "$JETSON_DESCRIPTION" + +#Pring Jetpack Version +echo "Jetpack $JETSON_JETPACK [L4T $JETSON_L4T]" + +# Set kernel tag to to the version of L4T in system. Reference: http://nv-tegra.nvidia.com/gitweb/?p=linux-t18x.git;a=summary +# Possible kernel tags for TX2: +# tegra-l4t-r28.2.1 +# tegra-l4t-r28.2 +# tegra-l4t-r28.2-rc +# tegra-l4t-r28.1 +# tegra-l4t-r27.1 +#KERNEL_TAG=0 +echo "Jetson L4T is $JETSON_L4T" + +if [ "$JETSON_BOARD" = "TX2i" ] ; then + case $JETSON_L4T in + "28.2.1") + KERNEL_TAG="tegra-l4t-r28.2.1" ;; + "28.2") + KERNEL_TAG="tegra-l4t-r28.2" ;; + *) + KERNEL_TAG="UNKNOWN" ;; + esac +elif [ "$JETSON_BOARD" = "TX2" ] ; then + case $JETSON_L4T in + "28.2.1") + KERNEL_TAG="tegra-l4t-r28.2.1" ;; + "28.2") + KERNEL_TAG="tegra-l4t-r28.2" ;; + "28.1") + KERNEL_TAG="tegra-l4t-r28.1" ;; + "27.1") + KERNEL_TAG="tegra-l4t-r27.1" ;; + *) + KERNEL_TAG="UNKNOWN" ;; + esac +else + # Unknown board + KERNEL_TAG="UNKNOWN" +fi + + +echo "Setting the kernel URL for L4T $KERNEL_TAG" +echo "Getting kernel sources" + +if [ $KERNEL_TAG == "UNKNOWN" ] ; then + echo "An unsupported version of the board or L4T detected! " + sudo ./scripts/getKernelSources.sh +else + + # Note: New Method for getting kernel source. + # For older method, following can be used, but decided to come up with more efficient mode: + # wget -N "https://developer.download.nvidia.com/embedded/L4T/r28_Release_v2.1/public_sources.tbz2?YoszKxkjC1hGlemo-Y1ErDXXvPUeDepDcd8KBvWL29Re9YNC8HZyClKNEEqvIB2r_pxl7GJyusN7ucO-DhysxFqkqLUOyPRpB2qvvefsf7CcJpOnrb0imN2Lkpa8C3K_ItZ0cl3yneR7VQb9L-_wmw" + # Getting from Git via cloning takes way too long, so we download the "snapshots" generated by gitweb. Inspired by source_sync.sh script. + # The snapshot option can be seen here: http://nv-tegra.nvidia.com/gitweb/?p=linux-4.4.git;a=commit;h=d259faa6df3f513591e4246a782f51bb940d09ad + + + SOURCE_INFO=" + kernel/kernel-4.4:linux-4.4.git + kernel/t18x:linux-t18x.git + kernel/nvgpu:linux-nvgpu.git + kernel/nvhost:linux-nvhost.git + kernel/nvmap:linux-nvmap.git + kernel/nvmap-t18x:linux-nvmap-t18x.git + kernel/display:linux-display.git + hardware/nvidia/soc/t18x:device/hardware/nvidia/soc/t18x.git + hardware/nvidia/platform/tegra/common:device/hardware/nvidia/platform/tegra/common.git + hardware/nvidia/platform/t18x/common:device/hardware/nvidia/platform/t18x/common.git + hardware/nvidia/platform/t18x/quill:device/hardware/nvidia/platform/t18x/quill.git + hardware/nvidia/soc/t210:device/hardware/nvidia/soc/t210.git + hardware/nvidia/platform/t210/common:device/hardware/nvidia/platform/t210/common.git + hardware/nvidia/platform/t210/jetson:device/hardware/nvidia/platform/t210/jetson.git + hardware/nvidia/soc/tegra:device/hardware/nvidia/soc/tegra.git + " + NSOURCES=0 + declare -a SOURCE_INFO_PROCESSED + SOURCE_INFO_PROCESSED=($(echo "$SOURCE_INFO")) + NSOURCES=${#SOURCE_INFO_PROCESSED[*]} + + for ((i=0; i < NSOURCES; i++)); do + FOLDER_NAME=$(echo "${SOURCE_INFO_PROCESSED[i]}" | cut -f 1 -d ':') + REPO_URL=$(echo "${SOURCE_INFO_PROCESSED[i]}" | cut -f 2 -d ':') + REPO_NAME=$(echo "${REPO_URL}" | cut -f 1 -d '.') + + mkdir -p "$FOLDER_NAME" + wget -O "$REPO_NAME.tgz" -vr "http://nv-tegra.nvidia.com/gitweb/?p=$REPO_URL;a=snapshot;h=$KERNEL_TAG;sf=tgz" + + tar -xvf "$REPO_NAME.tgz" -C "$FOLDER_NAME" --strip-components 1 + rm "$REPO_NAME.tgz" + + done + + + cd kernel/kernel-4.4 + + # Go get the default config file; this becomes the new system configuration + zcat /proc/config.gz > .config + # Ready to configure kernel + make xconfig +fi diff --git a/scripts/getKernelSourcesNoGUI.sh b/scripts/getKernelSourcesNoGUI.sh index bc01444..7dca28b 100755 --- a/scripts/getKernelSourcesNoGUI.sh +++ b/scripts/getKernelSourcesNoGUI.sh @@ -3,12 +3,55 @@ apt-add-repository universe apt-get update apt-get install pkg-config -y cd /usr/src -wget -N http://developer.download.nvidia.com/embedded/L4T/r28_Release_v2.0/GA/BSP/tx2_sources.tbz2 -sudo tar -xvf tx2_sources.tbz2 public_release/kernel_src.tbz2 -tar -xvf public_release/kernel_src.tbz2 -# Space is tight; get rid of the compressed kernel source -rm -r public_release + +# Note: New Method for getting kernel source. +# For older method, following can be used, but decided to come up with more efficient mode: +# wget -N "https://developer.download.nvidia.com/embedded/L4T/r28_Release_v2.1/public_sources.tbz2?YoszKxkjC1hGlemo-Y1ErDXXvPUeDepDcd8KBvWL29Re9YNC8HZyClKNEEqvIB2r_pxl7GJyusN7ucO-DhysxFqkqLUOyPRpB2qvvefsf7CcJpOnrb0imN2Lkpa8C3K_ItZ0cl3yneR7VQb9L-_wmw" +# Getting from Git via cloning takes way too long, so we download the "snapshots" generated by gitweb. Inspired by source_sync.sh script. +# The snapshot option can be seen here: http://nv-tegra.nvidia.com/gitweb/?p=linux-4.4.git;a=commit;h=d259faa6df3f513591e4246a782f51bb940d09ad + + +SOURCE_INFO=" +kernel/kernel-4.4:linux-4.4.git +kernel/t18x:linux-t18x.git +kernel/nvgpu:linux-nvgpu.git +kernel/nvhost:linux-nvhost.git +kernel/nvmap:linux-nvmap.git +kernel/nvmap-t18x:linux-nvmap-t18x.git +kernel/display:linux-display.git +hardware/nvidia/soc/t18x:device/hardware/nvidia/soc/t18x.git +hardware/nvidia/platform/tegra/common:device/hardware/nvidia/platform/tegra/common.git +hardware/nvidia/platform/t18x/common:device/hardware/nvidia/platform/t18x/common.git +hardware/nvidia/platform/t18x/quill:device/hardware/nvidia/platform/t18x/quill.git +hardware/nvidia/soc/t210:device/hardware/nvidia/soc/t210.git +hardware/nvidia/platform/t210/common:device/hardware/nvidia/platform/t210/common.git +hardware/nvidia/platform/t210/jetson:device/hardware/nvidia/platform/t210/jetson.git +hardware/nvidia/soc/tegra:device/hardware/nvidia/soc/tegra.git +" +NSOURCES=0 +declare -a SOURCE_INFO_PROCESSED +SOURCE_INFO_PROCESSED=($(echo "$SOURCE_INFO")) +NSOURCES=${#SOURCE_INFO_PROCESSED[*]} + +for ((i=0; i < NSOURCES; i++)); do + FOLDER_NAME=$(echo "${SOURCE_INFO_PROCESSED[i]}" | cut -f 1 -d ':') + REPO_URL=$(echo "${SOURCE_INFO_PROCESSED[i]}" | cut -f 2 -d ':') + REPO_NAME=$(echo "${REPO_URL}" | cut -f 1 -d '.') + + mkdir -p "$FOLDER_NAME" + wget -O "$REPO_NAME.tgz" -vr "http://nv-tegra.nvidia.com/gitweb/?p=$REPO_URL;a=snapshot;h=$KERNEL_TAG;sf=tgz" + + tar -xvf "$REPO_NAME.tgz" -C "$FOLDER_NAME" --strip-components 1 + rm "$REPO_NAME.tgz" + +done + + cd kernel/kernel-4.4 + # Go get the default config file; this becomes the new system configuration zcat /proc/config.gz > .config +# Ready to configure kernel + + diff --git a/scripts/jetson_variables.sh b/scripts/jetson_variables.sh index e11ea11..767b05b 100755 --- a/scripts/jetson_variables.sh +++ b/scripts/jetson_variables.sh @@ -6,29 +6,29 @@ # modification, are permitted provided that the following conditions # are met: # -# 1. Redistributions of source code must retain the above copyright +# 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. -# 3. Neither the name of the copyright holder nor the names of its -# contributors may be used to endorse or promote products derived +# 3. Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived # from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# NVIDIA Identify version -# reference: +# NVIDIA Identify version +# reference: # https://devtalk.nvidia.com/default/topic/1014424/jetson-tx2/identifying-tx1-and-tx2-at-runtime/ # https://devtalk.nvidia.com/default/topic/996988/jetson-tk1/chip-uid/post/5100481/#5100481 @@ -53,62 +53,66 @@ if [ -f /etc/nv_tegra_release ]; then JETSON_L4T_STRING=$(head -n 1 /etc/nv_tegra_release) # Load release and revision - JETSON_L4T_RELEASE=$(echo $JETSON_L4T_STRING | cut -f 1 -d ',' | sed 's/\# R//g' | cut -d ' ' -f1) - JETSON_L4T_REVISION=$(echo $JETSON_L4T_STRING | cut -f 2 -d ',' | sed 's/\ REVISION: //g' | cut -d. -f1) + JETSON_L4T_RELEASE=$(echo $JETSON_L4T_STRING | cut -f 1 -d ',' | sed 's,\# R,,' | cut -d ' ' -f 1) + JETSON_L4T_REVISION=$(echo $JETSON_L4T_STRING | cut -f 2 -d ',' | sed 's,\ REVISION: ,,g') # unset variable unset JETSON_L4T_STRING - + # Write Jetson description JETSON_L4T="$JETSON_L4T_RELEASE.$JETSON_L4T_REVISION" # Write version of jetpack installed # https://developer.nvidia.com/embedded/jetpack-archive - if [ "$JETSON_BOARD" = "TX2i" ] ; then + if [ "$JETSON_BOARD" = "TX2i" ] ; then case $JETSON_L4T in - "28.2") + "28.2.1") + JETSON_JETPACK="3.2.1" ;; + "28.2.0") JETSON_JETPACK="3.2" ;; *) JETSON_JETPACK="UNKNOWN" ;; - esac + esac elif [ "$JETSON_BOARD" = "TX2" ] ; then case $JETSON_L4T in - "28.2") + "28.2.1") + JETSON_JETPACK="3.2.1" ;; + "28.2.0") JETSON_JETPACK="3.2" ;; - "28.1") + "28.1.0") JETSON_JETPACK="3.1" ;; - "27.1") + "27.1.0") JETSON_JETPACK="3.0" ;; *) JETSON_JETPACK="UNKNOWN" ;; esac elif [ "$JETSON_BOARD" = "TX1" ] ; then case $JETSON_L4T in - "28.2") + "28.2.0") JETSON_JETPACK="3.2" ;; - "28.1") + "28.1.0") JETSON_JETPACK="3.1" ;; - "24.2.1") + "24.2.1") JETSON_JETPACK="3.0 or 2.3.1" ;; - "24.2") + "24.2.0") JETSON_JETPACK="2.3" ;; - "24.1") + "24.1.0") JETSON_JETPACK="2.2.1 or 2.2" ;; - "23.2") + "23.2.0") JETSON_JETPACK="2.1" ;; - "23.1") + "23.1.0") JETSON_JETPACK="2.0" ;; *) JETSON_JETPACK="UNKNOWN" ;; esac elif [ "$JETSON_BOARD" ="TK1" ] ; then case $JETSON_L4T in - "21.5") + "21.5.0") JETSON_JETPACK="2.3.1 or 2.3" ;; - "21.4") + "21.4.0") JETSON_JETPACK="2.2 or 2.1 or 2.0 or DP 1.2" ;; - "21.3") + "21.3.0") JETSON_JETPACK="DP 1.1" ;; - "21.2") + "21.2.0") JETSON_JETPACK="DP 1.0" ;; *) JETSON_JETPACK="UNKNOWN" ;;