├── LICENSE
├── README.md
├── copyImage.sh
├── editConfig.sh
├── getKernelSources.sh
├── makeKernel.sh
├── makeModules.sh
├── removeAllKernelSources.sh
└── scripts
├── copyImage.sh
├── getKernelSources.sh
├── makeKernel.sh
├── makeModules.sh
└── removeAllKernelSources.sh
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017-20 Jetsonhacks
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # buildJetsonTX2Kernel
2 |
3 | ## Deprecated
4 |
5 | For versions of L4T newer than L4T 32.3, please see **jetson-linux-build** https://github.com/jetsonhacks/jetson-linux-build
6 |
7 | ## README
8 | Scripts to help build the 4.9.140 kernel and modules onboard the Jetson TX2 (L4T 32.3.1, JetPack 4.3). For previous versions, visit the 'tags' section.
9 |
10 | Note: The kernel source version must match the version of firmware flashed on the Jetson. For example, the source for the 4.9.140 kernel here is matched with L4T 32.3.1. This kernel compiled using this source tree will not work with newer versions or older versions of L4T, only 32.3.1.
11 |
12 | Note: You will probably only use these scripts to build and install modules. Even though there are scripts provided to build and copy the new kernel to the boot directory of the device, there is no effect. In newer versions of L4T, the kernel Image is actually signed and stored in a different partition on disk. The copyImage.sh script is legacy. In order to place the newly created Image, you will need to copy it to the correct place on the host and flash the eMMC. It is probably easier to build it on the host in the first place. The flash process on the host signs the Image, and copies it to the appropriate partition.
13 |
14 | As of this writing, the "official" way to build the Jetson TX2 kernel is to use a cross compiler on a Linux PC. This is an alternative which builds the kernel onboard the Jetson itself. These scripts will download the kernel source to the Jetson TX2, and then compile the kernel and selected modules. The newly compiled kernel can then be installed. The kernel sources and build objects consume ~3GB.
15 |
16 | These scripts are for building the kernel for the 64-bit L4T 32.3.1 (Ubuntu 18.04 based) operating system on the NVIDIA Jetson TX2. The scripts should be run directly after flashing the Jetson with L4T 32.3.1 from a host PC. There are six scripts:
17 |
18 | getKernelSources.sh
19 |
20 | Downloads the kernel sources for L4T from the NVIDIA website and decompresses them. Note that this also sets the .config file to the current system, and also sets the local version to the current local version, i.e., -tegra
21 |
22 | makeKernel.sh
23 |
24 | Compiles the kernel using make. The script commands make the kernel Image file. Installing the Image file on to the system is a separate step. Note that the make is limited to the Image and modules.
25 |
26 | The other parts of the kernel build, such as building the device tree, require that the result be 'signed' and flashed from the the NVIDIA tools on a host PC.
27 |
28 | makeModules.sh
29 |
30 | Compiles the modules using make and then installs them.
31 |
32 | copyImage.sh
33 |
34 | Copies the Image file created by compiling the kernel to the /boot directory. Note that while developing you will want to be more conservative than this: You will probably want to copy the new kernel Image to a different name in the boot directory, and modify /boot/extlinux/extlinux.conf to have entry points at the old image, or the new image. This way, if things go sideways you can still boot the machine using the serial console.
35 |
36 | You will want to make a copy of the original Image before the copy, something like:
37 |
38 | ```
39 | $ cp /boot/Image $INSTALL_DIR/Image.orig
40 | $ ./copyImage.sh
41 | $ echo "New Image created and placed in /boot"
42 | ```
43 |
44 | editConfig.sh
45 |
46 | Edit the .config file located in /usr/src/kernel/kernel-4.9 This file must be present (from the getKernelSources.sh script) before launching the file. Note that if you change the local version, you will need to make both the kernel and modules and install them.
47 |
48 | removeAllKernelSources.sh
49 |
50 | Removes all of the kernel sources and compressed source files. You may want to make a backup of the files before deletion.
51 |
52 |
53 |
Notes:
54 | Make sure to update the eMMC
55 |
56 | The copyImage.sh script copies the Image to the current device. If you are building the kernel on an external device, for example a SSD, you will probably want to copy the Image file over to the eMMC in the eMMC's /boot directory. The Jetson will usually try to boot from the eMMC before switching to a different device. Study the boot sequence of the Jetson to properly understand which Image file is being used.
57 |
58 |
59 | Special thanks to Raffaello Bonghi (https://github.com/rbonghi) for jetson_easy scripts.
60 | Special thanks to Shreeyak (https://github.com/Shreeyak) for discussing alternatives to get source directly from NVIDIA git repositories.
61 | Special thanks to Alexander Rashed (@alexrashed on Github) for vL4T32.1.0 release
62 |
63 | ### Release Notes
64 |
65 | January, 2020
66 | * vL4T32.3.1
67 | * L4T 32.3.1 (JetPack 4.3)
68 |
69 | May, 2019
70 | * vL4T32.1.0
71 | * L4T 32.1.0 (JetPack 4.2)
72 |
73 | July, 2018
74 | * vL4T28.2.1
75 | * L4T 28.2.1 (JetPack 3.2.1)
76 | * Fix issue with scripts jetson_variables to determine L4T version.
77 | ** Special thanks to Shreeyak (https://github.com/Shreeyak)
78 | * Refactored scripts/getKernelSources and getKernelSourcesNoGUI
79 |
80 | April, 2018
81 | * vL4T28.2r3
82 | * L4T 28.2 (JetPack 3.2)
83 | * Add removeAllKernelSources.sh
84 | * Add checks to make sure kernel version matches L4T release
85 |
86 | April, 2018
87 | * vL4T28.2r2
88 | * L4T 28.2 (JetPack 3.2)
89 | * Add getKernelSourcesNoGUI.sh for cases where the user does not want to edit the .config file through a GUI.
90 |
91 | March, 2018
92 | * vL4T28.2
93 | * L4T 28.2 (JetPack 3.2 DP)
94 | * Removed patches for make file cleanup
95 |
96 | July, 2017
97 | * vL4T28.1
98 | * L4T 28.1 (JetPack 3.1)
99 |
100 | March, 2017
101 | * vL4T27.1
102 | * L4T 27.1 (JetPack 3.0)
103 | * Developers Preview
104 |
105 |
106 | ## License
107 | MIT License
108 |
109 | Copyright (c) 2017-2020 Jetsonhacks
110 | Portions Copyright (c) 2015-2018 Raffaello Bonghi (jetson_easy)
111 |
112 | Permission is hereby granted, free of charge, to any person obtaining a copy
113 | of this software and associated documentation files (the "Software"), to deal
114 | in the Software without restriction, including without limitation the rights
115 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
116 | copies of the Software, and to permit persons to whom the Software is
117 | furnished to do so, subject to the following conditions:
118 |
119 | The above copyright notice and this permission notice shall be included in all
120 | copies or substantial portions of the Software.
121 |
122 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
123 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
124 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
125 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
126 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
127 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
128 | SOFTWARE.
129 |
--------------------------------------------------------------------------------
/copyImage.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | sudo ./scripts/copyImage.sh
3 |
--------------------------------------------------------------------------------
/editConfig.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Edit the kernel configuration for NVIDIA Jetson TX2 Development Kit
3 | # Copyright (c) 2016-20 Jetsonhacks
4 | # MIT License
5 |
6 | SOURCE_TARGET="/usr/src"
7 | KERNEL_RELEASE="4.9"
8 |
9 | function usage
10 | {
11 | echo "usage: ./editConfig.sh [[-d directory ] | [-h]]"
12 | echo "-d | --directory Directory path to parent of kernel"
13 | echo "-h | --help This message"
14 | }
15 |
16 | # Iterate through command line inputs
17 | while [ "$1" != "" ]; do
18 | case $1 in
19 | -d | --directory ) shift
20 | SOURCE_TARGET=$1
21 | ;;
22 | -h | --help ) usage
23 | exit
24 | ;;
25 | * ) usage
26 | exit 1
27 | esac
28 | shift
29 | done
30 |
31 | LAST="${SOURCE_TARGET: -1}"
32 | if [ $LAST != '/' ] ; then
33 | SOURCE_TARGET="$SOURCE_TARGET""/"
34 | fi
35 |
36 | # Check to see if source tree is already installed
37 | PROPOSED_SRC_PATH="$SOURCE_TARGET""kernel/kernel-"$KERNEL_RELEASE
38 | echo "Proposed source path: ""$PROPOSED_SRC_PATH"
39 | if [ ! -d "$PROPOSED_SRC_PATH" ]; then
40 | tput setaf 1
41 | echo "==== Cannot find kernel source! =============== "
42 | tput sgr0
43 | echo "The kernel source does not appear to be installed at: "
44 | echo " ""$PROPOSED_SRC_PATH"
45 | echo "Unable to edit kernel configuration."
46 | exit 1
47 | fi
48 |
49 | cd "$PROPOSED_SRC_PATH"
50 | sudo make menuconfig
51 |
--------------------------------------------------------------------------------
/getKernelSources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Get the kernel source for NVIDIA Jetson Nano Developer Kit, L4T
3 | # Copyright (c) 2016-2020 Jetsonhacks
4 | # MIT License
5 |
6 | JETSON_MODEL="TX2"
7 | L4T_TARGET="32.3.1"
8 | SOURCE_TARGET="/usr/src"
9 | KERNEL_RELEASE="4.9"
10 |
11 | #Get the Board Model
12 | JETSON_BOARD="UNKNOWN"
13 |
14 | if [ -f /sys/module/tegra_fuse/parameters/tegra_chip_id ]; then
15 | JETSON_BOARD=$(case $(cat /sys/module/tegra_fuse/parameters/tegra_chip_id) in
16 | 64)
17 | echo TK1 ;;
18 | 33)
19 | echo Nano/TX1 ;;
20 | 24)
21 | echo TX2 ;;
22 | 25)
23 | echo AGX Xavier ;;
24 | esac)
25 | JETSON_DESCRIPTION="NVIDIA Jetson $JETSON_BOARD"
26 | fi
27 | echo "Jetson Model: "$JETSON_BOARD
28 |
29 | JETSON_L4T=""
30 |
31 | # Starting with L4T 32.2, the recommended way to find the L4T Release Number
32 | # is to use dpkg
33 | # L4T 32.3.1, NVIDIA added back /etc/nv_tegra_release
34 | function check_L4T_version()
35 | {
36 | if [ -f /etc/nv_tegra_release ]; then
37 | JETSON_L4T_STRING=$(head -n 1 /etc/nv_tegra_release)
38 | JETSON_L4T_RELEASE=$(echo $JETSON_L4T_STRING | cut -f 2 -d ' ' | grep -Po '(?<=R)[^;]+')
39 | JETSON_L4T_REVISION=$(echo $JETSON_L4T_STRING | cut -f 2 -d ',' | grep -Po '(?<=REVISION: )[^;]+')
40 | JETSON_L4T_VERSION=$JETSON_L4T_RELEASE.$JETSON_L4T_REVISION
41 |
42 | else
43 | echo "$LOG Reading L4T version from \"dpkg-query --show nvidia-l4t-core\""
44 |
45 | JETSON_L4T_STRING=$(dpkg-query --showformat='${Version}' --show nvidia-l4t-core)
46 | # For example: 32.2.1-20190812212815
47 | JETSON_L4T_VERSION=$(echo $JETSON_L4T_STRING | cut -d '-' -f 1)
48 | JETSON_L4T_RELEASE=$(echo $JETSON_L4T_VERSION | cut -d '.' -f 1)
49 | # # operator remove prefix in string operations in bash script. Don't forget . eg "32."
50 | JETSON_L4T_REVISION=${JETSON_L4T_VERSION#$JETSON_L4T_RELEASE.}
51 | fi
52 | echo "$LOG Jetson BSP Version: L4T R$JETSON_L4T_VERSION"
53 |
54 | }
55 |
56 | echo "Getting L4T Version"
57 | check_L4T_version
58 | JETSON_L4T="$JETSON_L4T_VERSION"
59 |
60 | function usage
61 | {
62 | echo "usage: ./getKernelSources.sh [[-d directory ] | [-h]]"
63 | echo "-h | --help This message"
64 | }
65 |
66 | # Iterate through command line inputs
67 | while [ "$1" != "" ]; do
68 | case $1 in
69 | -d | --directory ) shift
70 | SOURCE_TARGET=$1
71 | ;;
72 | -h | --help ) usage
73 | exit
74 | ;;
75 | * ) usage
76 | exit 1
77 | esac
78 | shift
79 | done
80 |
81 | red=`tput setaf 1`
82 | green=`tput setaf 2`
83 | reset=`tput sgr0`
84 | # e.g. echo "${red}The red tail hawk ${green}loves the green grass${reset}"
85 |
86 | LAST="${SOURCE_TARGET: -1}"
87 | if [ $LAST != '/' ] ; then
88 | SOURCE_TARGET="$SOURCE_TARGET""/"
89 | fi
90 |
91 | INSTALL_DIR=$PWD
92 |
93 | # Error out if something goes wrong
94 | set -e
95 |
96 | # Check to make sure we're installing the correct kernel sources
97 | # Determine the correct kernel version
98 | # The KERNEL_BUILD_VERSION is the release tag for the JetsonHacks buildKernel repository
99 | KERNEL_BUILD_VERSION=master
100 | if [ "$JETSON_BOARD" == "$JETSON_MODEL" ] ; then
101 | if [ $JETSON_L4T == "$L4T_TARGET" ] ; then
102 | KERNEL_BUILD_VERSION=$L4T_TARGET
103 | else
104 | echo ""
105 | tput setaf 1
106 | echo "==== L4T Kernel Version Mismatch! ============="
107 | tput sgr0
108 | echo ""
109 | echo "This repository is for modifying the kernel for a L4T "$L4T_TARGET "system."
110 | echo "You are attempting to modify a L4T "$JETSON_MODEL "system with L4T "$JETSON_L4T
111 | echo "The L4T releases must match!"
112 | echo ""
113 | echo "There may be versions in the tag/release sections that meet your needs"
114 | echo ""
115 | exit 1
116 | fi
117 | else
118 | tput setaf 1
119 | echo "==== Jetson Board Mismatch! ============="
120 | tput sgr0
121 | echo "Currently this script works for the $JETSON_MODEL."
122 | echo "This processor appears to be a $JETSON_BOARD, which does not have a corresponding script"
123 | echo ""
124 | echo "Exiting"
125 | exit 1
126 | fi
127 |
128 | # Check to see if source tree is already installed
129 | PROPOSED_SRC_PATH="$SOURCE_TARGET""kernel/kernel-"$KERNEL_RELEASE
130 | echo "Proposed source path: ""$PROPOSED_SRC_PATH"
131 | if [ -d "$PROPOSED_SRC_PATH" ]; then
132 | tput setaf 1
133 | echo "==== Kernel source appears to already be installed! =============== "
134 | tput sgr0
135 | echo "The kernel source appears to already be installed at: "
136 | echo " ""$PROPOSED_SRC_PATH"
137 | echo "If you want to reinstall the source files, first remove the directories: "
138 | echo " ""$SOURCE_TARGET""kernel"
139 | echo " ""$SOURCE_TARGET""hardware"
140 | echo "then rerun this script"
141 | exit 1
142 | fi
143 |
144 | export SOURCE_TARGET
145 | # -E preserves environment variables
146 | sudo -E ./scripts/getKernelSources.sh
147 |
148 |
149 |
--------------------------------------------------------------------------------
/makeKernel.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Make the kernel for NVIDIA Jetson TX2 Developer Kit
3 | # Copyright (c) 2016-20 Jetsonhacks
4 | # MIT License
5 |
6 | SOURCE_TARGET="/usr/src"
7 | KERNEL_RELEASE="4.9"
8 |
9 | function usage
10 | {
11 | echo "usage: ./makeKernel.sh [[-d directory ] | [-h]]"
12 | echo "-d | --directory Directory path to parent of kernel"
13 | echo "-h | --help This message"
14 | }
15 |
16 | # Iterate through command line inputs
17 | while [ "$1" != "" ]; do
18 | case $1 in
19 | -d | --directory ) shift
20 | SOURCE_TARGET=$1
21 | ;;
22 | -h | --help ) usage
23 | exit
24 | ;;
25 | * ) usage
26 | exit 1
27 | esac
28 | shift
29 | done
30 |
31 | LAST="${SOURCE_TARGET: -1}"
32 | if [ $LAST != '/' ] ; then
33 | SOURCE_TARGET="$SOURCE_TARGET""/"
34 | fi
35 |
36 | # Check to see if source tree is already installed
37 | PROPOSED_SRC_PATH="$SOURCE_TARGET""kernel/kernel-"$KERNEL_RELEASE
38 | echo "Proposed source path: ""$PROPOSED_SRC_PATH"
39 | if [ ! -d "$PROPOSED_SRC_PATH" ]; then
40 | tput setaf 1
41 | echo "==== Cannot find kernel source! =============== "
42 | tput sgr0
43 | echo "The kernel source does not appear to be installed at: "
44 | echo " ""$PROPOSED_SRC_PATH"
45 | echo "Unable to start making kernel."
46 | exit 1
47 | fi
48 |
49 | export SOURCE_TARGET
50 | # E Option carries over environment variables
51 | sudo -E ./scripts/makeKernel.sh
52 |
--------------------------------------------------------------------------------
/makeModules.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Make kernel modules for NVIDIA Jetson TX2 Developer Kit
3 | # Copyright (c) 2016-20 Jetsonhacks
4 | # MIT License
5 |
6 | SOURCE_TARGET="/usr/src"
7 | KERNEL_RELEASE="4.9"
8 |
9 | function usage
10 | {
11 | echo "usage: ./makeModules.sh [[-d directory ] | [-h]]"
12 | echo "-d | --directory Directory path to parent of kernel"
13 | echo "-h | --help This message"
14 | }
15 |
16 | # Iterate through command line inputs
17 | while [ "$1" != "" ]; do
18 | case $1 in
19 | -d | --directory ) shift
20 | SOURCE_TARGET=$1
21 | ;;
22 | -h | --help ) usage
23 | exit
24 | ;;
25 | * ) usage
26 | exit 1
27 | esac
28 | shift
29 | done
30 |
31 | LAST="${SOURCE_TARGET: -1}"
32 | if [ $LAST != '/' ] ; then
33 | SOURCE_TARGET="$SOURCE_TARGET""/"
34 | fi
35 |
36 | # Check to see if source tree is already installed
37 | PROPOSED_SRC_PATH="$SOURCE_TARGET""kernel/kernel-"$KERNEL_RELEASE
38 | echo "Proposed source path: ""$PROPOSED_SRC_PATH"
39 | if [ ! -d "$PROPOSED_SRC_PATH" ]; then
40 | tput setaf 1
41 | echo "==== Cannot find kernel source! =============== "
42 | tput sgr0
43 | echo "The kernel source does not appear to be installed at: "
44 | echo " ""$PROPOSED_SRC_PATH"
45 | echo "Unable to start making kernel."
46 | exit 1
47 | fi
48 |
49 | export SOURCE_TARGET
50 | # E Option carries over environment variables
51 | sudo -E ./scripts/makeModules.sh
52 |
--------------------------------------------------------------------------------
/removeAllKernelSources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Remove all of the kernel sources that were downloaded and built during the kernel build process
3 | # Note that this will also remove the possibly changed .config file in:
4 | # /usr/src/kernel/kernel-4.9
5 | echo "Removing All Kernel Sources"
6 | sudo ./scripts/removeAllKernelSources.sh
7 | echo "Kernel sources removed"
8 |
--------------------------------------------------------------------------------
/scripts/copyImage.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cd /usr/src/kernel/kernel-4.9
3 | # On the stock Jetson TX2 install, there is no zImage in the boot directory
4 | # So we just copy the Image file over
5 | # If the zImage is needed, you must either
6 | # $ make zImage
7 | # or
8 | # $ make
9 | # Both of these commands must be executed in /usr/src/kernel/kernel-4.9
10 | # sudo cp arch/arm64/boot/zImage /boot/zImage
11 | # Note that if you are compiling on an external device, like a SSD, you should probably
12 | # copy this over to the internal eMMC if that is where the Jetson boots
13 | sudo cp arch/arm64/boot/Image /boot/Image
14 |
15 |
16 |
--------------------------------------------------------------------------------
/scripts/getKernelSources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Get Kernel sources for NVIDIA Jetson TX2
3 | apt-add-repository universe
4 | apt-get update
5 | apt-get install pkg-config -y
6 | # We use 'make menuconfig' to edit the .config file; install dependencies
7 | apt-get install libncurses5-dev -y
8 | echo "Installing kernel sources in: ""$SOURCE_TARGET"
9 | if [ ! -d "$SOURCE_TARGET" ]; then
10 | # Target directory does not exist; create
11 | echo "Creating directory: ""$SOURCE_TARGET"
12 | mkdir -p "$SOURCE_TARGET"
13 | fi
14 |
15 | cd "$SOURCE_TARGET"
16 | echo "$PWD"
17 |
18 | wget -N https://developer.nvidia.com/embedded/dlc/r32-3-1_Release_v1.0/Sources/T186/public_sources.tbz2
19 | # l4t-sources is a tbz2 file
20 | tar -xvf public_sources.tbz2 Linux_for_Tegra/source/public/kernel_src.tbz2 --strip-components=3
21 | tar -xvf kernel_src.tbz2
22 | # Space is tight; get rid of the compressed kernel source
23 | rm -r kernel_src.tbz2
24 | cd kernel/kernel-4.9
25 | # Go get the default config file; this becomes the new system configuration
26 | zcat /proc/config.gz > .config
27 | # Make a backup of the original configuration
28 | cp .config config.orig
29 | # Default to the current local version
30 | KERNEL_VERSION=$(uname -r)
31 | # For L4T 32.3 the kernel is 4.9.140-tegra ;
32 | # Everything after '4.9.140' is the local version
33 | # This removes the suffix
34 | LOCAL_VERSION=${KERNEL_VERSION#$"4.9.140"}
35 | # Should be "-tegra"
36 | bash scripts/config --file .config \
37 | --set-str LOCALVERSION $LOCAL_VERSION
38 |
39 |
--------------------------------------------------------------------------------
/scripts/makeKernel.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Builds modules and installs them
3 | # Assumes that the .config file is available in /proc/config.gz
4 | # Added check to see if make builds correctly; retry once if not
5 |
6 | echo "Source Target: "$SOURCE_TARGET
7 |
8 | MAKE_DIRECTORY="$SOURCE_TARGET"kernel/kernel-4.9
9 |
10 | cd "$SOURCE_TARGET"kernel/kernel-4.9
11 | # make prepare
12 | # Get the number of CPUs
13 | NUM_CPU=$(nproc)
14 |
15 | # Make the kernel Image
16 | time make -j$(($NUM_CPU - 1)) Image
17 | if [ $? -eq 0 ] ; then
18 | echo "Image make successful"
19 | echo "Image file is here: "
20 | echo "$SOURCE_TARGET""kernel/kernel-4.9/arch/arm64/boot/Image"
21 | else
22 | # Try to make again; Sometimes there are issues with the build
23 | # because of lack of resources or concurrency issues
24 | echo "Make did not build " >&2
25 | echo "Retrying ... "
26 | # Single thread this time
27 | make Image
28 | if [ $? -eq 0 ] ; then
29 | echo "Image make successful"
30 | echo "Image file is here: "
31 | echo "$SOURCE_TARGET""kernel/kernel-4.9/arch/arm64/boot/Image"
32 | else
33 | # Try to make again
34 | echo "Make did not successfully build" >&2
35 | echo "Please fix issues and retry build"
36 | exit 1
37 | fi
38 | fi
39 |
40 |
41 |
--------------------------------------------------------------------------------
/scripts/makeModules.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Builds modules and installs them
3 | # Assumes that the .config file is available in /proc/config.gz
4 | # Added check to see if make builds correctly; retry once if not
5 |
6 | echo "Source Target: "$SOURCE_TARGET
7 |
8 | MAKE_DIRECTORY="$SOURCE_TARGET"kernel/kernel-4.9
9 |
10 | cd "$SOURCE_TARGET"kernel/kernel-4.9
11 | # Get the number of CPUs
12 | NUM_CPU=$(nproc)
13 |
14 | # Make the kernel Image
15 | time make -j$(($NUM_CPU - 1)) modules
16 | if [ $? -eq 0 ] ; then
17 | echo "Modules make successful"
18 | else
19 | # Try to make again; Sometimes there are issues with the build
20 | # because of lack of resources or concurrency issues
21 | echo "Make did not build " >&2
22 | echo "Retrying ... "
23 | # Single thread this time
24 | make modules
25 | if [ $? -eq 0 ] ; then
26 | echo "Module make successful"
27 | else
28 | # Try to make again
29 | echo "Make did not successfully build modules" >&2
30 | echo "Please fix issues and retry build"
31 | exit 1
32 | fi
33 | fi
34 |
35 | make modules_install
36 |
37 |
38 |
--------------------------------------------------------------------------------
/scripts/removeAllKernelSources.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Remove the kernel source and compressed files
3 | cd /usr/src
4 | rm -r kernel
5 | rm -r hardware
6 | rm public_sources.tbz2
7 |
8 |
--------------------------------------------------------------------------------