Skip to content

Commit 44bd2ce

Browse files
committed
Write README
1 parent 54276c5 commit 44bd2ce

File tree

4 files changed

+89
-1
lines changed

4 files changed

+89
-1
lines changed

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,68 @@
11
# buildKernelAndModules
22
Build the Linux Kernel and Modules on board the NVIDIA Jetson Nano Developer Kit
33

4+
These scripts are for JetPack 4.2.1, L4T 32.2
5+
6+
Scripts to help build the 4.9.140 kernel and modules onboard the Jetson Nano Developer Kit Previous versions may be available in releases.
7+
8+
<em><strong>Note:</strong> 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.2. This kernel compiled using this source tree may not work with newer versions or older versions of L4T</em>
9+
10+
As of this writing, the "official" way to build the Jetson Nano 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 Nano, and then compile the kernel and selected modules. The newly compiled kernel can then be installed. We recommend a SD card size of 32GB, 64GB preferred.
11+
12+
The scripts should be run directly after flashing the Jetson, or copying the SD card image from a host PC. There are several scripts:
13+
14+
<strong>getKernelSources.sh</strong>
15+
16+
Downloads the kernel sources for L4T from the NVIDIA website, decompresses them and opens a graphical editor on the .config file. 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
17+
18+
19+
<strong>makeKernel.sh</strong>
20+
21+
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.
22+
23+
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.
24+
25+
<strong>makeKernel.sh</strong>
26+
27+
Compiles the modules using make and then installs them.
28+
29+
<strong>copyImage.sh</strong>
30+
31+
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.
32+
33+
You will want to make a copy of the original Image before the copy, something like:
34+
35+
# Put a copy of the current Image here
36+
$ cp /boot/Image $INSTALL_DIR/Image.orig
37+
$ ./copyImage.sh
38+
$ echo "New Image created and placed in /boot"
39+
40+
41+
<strong>editConfig.sh</strong>
42+
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.
43+
44+
<strong>removeAllKernelSources.sh</strong>
45+
Removes all of the kernel sources and compressed source files. You may want to make a backup of the files before deletion.
46+
47+
<h2>Notes:</h2>
48+
<h3>Make sure to update the micro SD card</h3>
49+
50+
The copyImage.sh script copies the Image to the current device. If you are building the kernel on an external device, for example a USB drive, you will probably want to copy the Image file over to the micro SD card in the micro SD's /boot directory.
51+
Special thanks to Raffaello Bonghi (https://github.com/rbonghi) for jetson_easy scripts.
52+
Special thanks to Shreeyak (https://github.com/Shreeyak) for discussing alternatives to get source directly from NVIDIA git repositories.
53+
Special thanks to Dustin Franklin (https://github.com/dusty-nv/) for how to correctly determine the correct L4T version. (https://github.com/dusty-nv/jetson-inference/blob/7e81381a96c1ac5f57f1728afbfdec7f1bfeffc2/tools/install-pytorch.sh#L296)
54+
55+
Sometimes it is useful to log the builds:
56+
57+
$ command 2>&1 | tee log.txt
58+
59+
so you can go back and catch errors.
60+
61+
### Release Notes
62+
July, 2019
63+
* vL4T32.2
64+
* L4T 32.2 (JetPack 4.2.1)
65+
* Initial Release
66+
67+
468
command 2>&1 | tee log.txt

removeAllKernelSources.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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+

sample-extlinux.conf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
TIMEOUT 30
2+
DEFAULT primary
3+
4+
MENU TITLE p3450-porg eMMC boot options
5+
6+
LABEL primary
7+
MENU LABEL primary kernel
8+
LINUX /boot/Image
9+
INITRD /boot/initrd
10+
APPEND ${cbootargs} rootfstype=ext4 root=/dev/sda1 rw rootwait
11+
12+
LABEL emmc
13+
MENU LABEL primary kernel
14+
LINUX /boot/Image
15+
INITRD /boot/initrd
16+
APPEND ${cbootargs} rootfstype=ext4 root=/dev/mmcblk0p1 rw rootwait

scripts/removeAllKernelSources.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
cd /usr/src
44
rm -r kernel
55
rm -r hardware
6-
rm l4t-sources-32-1-jetson-nano
6+
rm public_sources.tbz2
77

0 commit comments

Comments
 (0)