Build Kernel and Modules – NVIDIA Jetson TX2

In this article, we cover building the kernel and modules for the NVIDIA Jetson TX2 running L4T 28.2. We also build the CH341 module, which is a USB to serial converter. Looky here:


Note: This article is for intermediate users. You should be familiar with the purpose of the kernel. You should be able to read shell scripts to understand the steps described.

Note: The kernel source must match the version of L4T that has been flashed onto the Jetson. For example, here we use the kernel source for L4T 28.2 with L4T 28.2. Kernel versions are not compatible across releases.

NVIDIA recommends using a host PC when building a kernel from source. See the Linux for Tegra R28.2 web page where you can get the required information about GCC Tool Chain for 64-bit BSP.

If you are building systems which require a large amount of kernel development, that is a good option. For a person like me, it’s a little overkill. Most of the time I just want to compile an extra driver or three as modules to support some extra hardware with the TX2.

Presented here are scripts which download the kernel source on to the Jetson TX2 itself, builds the kernel image and modules, and installs the modules and copies the kernel Image to the boot directory. The video above shows how to select the CH341 module and build it as an external module.


The script files to build the kernel on the Jetson TX2 are available on the JetsonHacks Github account in the buildJetsonTX2 repository.

$ git clone
$ cd buildJetsonTX2Kernel

There are three main scripts. The first script, gets the kernel sources from the NVIDIA developer website, then unpacks the sources into /usr/src/kernel.

$ ./

After the sources are installed, the script opens an editor on the kernel configuration file.

Note: The local version needs to be set to match the release that you are building. For example, if you are building modules for a stock kernel, then the local versions should be -tegra which makes the kernel release name 4.4.38-tegra. If you are building a custom kernel, then you should add your own local version. In the video above, we used -jetsonbotv0.1 which results in 4.4.38-jetsobotv0.1.

Make sure to save the configuration file when done editing. Note that if you want to just compile a module or two for use with a stock kernel, you should set the local version identifier to match the stock version.

The second script,, prepares the kernel and modules for building, and then builds the kernel and modules specified.

$ ./

The modules are then installed in /lib/modules/

The third script,, copies over the newly built Image file into the /boot directory.

$ ./

Note: This is probably overly simplistic. In most development cases, you will want to duplicate the stock kernel Image file, and modify the file /boot/extlinux/extlinux.conf so that you have the option to boot from the the stock image or the newly created image through the serial console. This is in case something, ahem, goes wrong. Because this is related to your specific development needs, this exercise is left to the reader.

Once the images have been copied over to the /boot directory, the machine must be restarted for the new kernel to take effect.

Note: The script simply copies the Image file to the /boot directory of the current device. If you are using an external device such as a SSD as your root directory and still using the eMMC to boot from, you will need to copy the Image file to the /boot directory of the eMMC.


The kernel and module sources, along with the compressed versions of the source, are located in /usr/src

After building the kernel, you may want to save the sources off-board to save some space (they take up about 3GB) You can also save the boot images and modules for later use, and to flash other Jetsons from the PC host.


For a lot of use cases, it makes sense to be able to compile the kernel and add modules from the device itself. Hopefully this article helps along this path.


  • The video above was made directly after flashing the Jetson TX2 with L4T 28.2 using JetPack 3.2.
  • If you encounter the error ‘cannot stat:’ when you run the script, it means that the Image file did not build. You should check for error messages generated in the step.
  • For L4T 28.1, please visit the earlier article which tells you to git checkout vL4T28.1 after cloning the repository.


  1. Hi and thank you for your valuable tools!
    Any idea if this could work on a Jetson TX1 with with L4T 28.2 using JetPack 3.2?

    Thank you!

  2. Hi Jim. Thanks for all workings and sharings. I’m following your instructions step by step to prepare my tx2 board for using at university project. i’ve installed jetpack 3.2 – 28.2 (uname -r => 4.4.38-tegra // there was no -tegra but i’ve added with your config tool) and i want to use ps3 eye cam at the project, but i’m taking error messages after saved kernel configuration tool while i typing “sudo make modules_prepare” then “make: *** no rule to make target ‘modules_prepare’. Stop

    that i understand no working any “make” comment because of no make file found.

    i would glad with your responses

    • It sounds like you are in the wrong directory for building. If you used the script, and if you are not using the ./ script, then you need to be in the /usr/src/kernel/kernel-4.4 directory before running make modules_prepare. Good luck on your build.

  3. hi agin Jim,
    thank you for your guidences. i’ve passed the prev issue but i’ve stucked another line. i’ve executed “sudo make prepare_modules” without any warnings but i’ve taken below messages while i’ve typed “sudo make modules” in same folder

    “rm drivers/mics/mods/mods.dtb drivers/mics/mods/mods.dtb.S
    Building modules, stage 2.
    MODPOST 144 modules
    WARNING: could not open drivers/misc/mods/mods.dtb.S: No such file or directory ”

    and there is no gspca_main.ko file in the /lib/modules/4.4.38-tegra/kernel/drivers/media/usb/gspca folder however there is only one file gspca_ov534.ko file in that folder.

    when i try “sudo insmod gspca_ov534.ko” at gspca folder and occured error like below
    “insmod: ERROR: could not insert module gspca_ov534.ko: File exists”
    and then i try cheese application but there is no webcam.

    i’ve checked lsusb -> device 007 – sony playstation eye already exists
    i need your advices againg thank you

  4. hi,kangalow!
    Thanks a lot for all workings and sharings. I’m following your instructions step by step . i’ve installed jetpack 3.2 –L4t 28.2 . when i ,i get these error message!
    “drivers/soc/built-in.o:/usr/src/kernel/kernel-4.4/drivers/soc/tegra/fuse/fuse-tegra.c:130: first defined here
    scripts/ recipe for target ‘drivers/built-in.o’ failed
    make[1]: *** [drivers/built-in.o] Error 1
    Makefile:958: recipe for target ‘drivers’ failed”
    could u help me? thank u a lot!

  5. After having built a kernel and copied the image, how to roll back to the original one? Can I just delete the image or should I have backed up the original image?

  6. Thank you for your tutorials.
    But in the process I confronted a problem when I ran the command “./”, I did exactly the same thing I don’t know why I have this issue.

    ./scripts/ line 6: cd: /usr/src/kernel/kernel-4.4: No such file or directory

  7. It’s an embarrassing mistake because I can not connect to the nvida website to download the source. I have my VPN installed and solve this problem. Thank you for your reply.

Leave a Reply

Your email address will not be published.