Build Kernel and Modules – NVIDIA Jetson TX2

Note: This article has been updated. Please see the L4T 28.1 build article.

This article covers building a kernel for L4T 27.1. If you are trying to build a kernel for L4T 27.1, you will need to checkout the vL4T27.1 version after cloning the buildJetsonTX2Kernel.git repository. Note that this is different than the steps followed in the video.

In this article, we cover building the kernel onboard the NVIDIA Jetson TX2. Looky here:

Background and Motivation

Note: This article is for intermediate users, and the methods within are somewhat experimental. You should be familiar with the purpose of the kernel. You should be able to read shell scripts to understand the steps described.

With the advent of the new Jetson TX2 running L4T 27.1 with the 4.14 kernel, NVIDIA recommends using a host PC when building a system from source. See the Linux for Tegra R27.1 web page where you can get the required GCC 4.8.5 Tool Chain for 64-bit BSP.

The boot load sequence is more sophisticated on the Jetson TX2 in comparison to the TX1. In addition to the Uboot boot loader, there are additional loaders for hardware support. The previously mentioned tool chain is useful in building those features.

If you are building systems which require generating the entirety of Jetson TX2 system, those are good options. 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. What to do, what to do …

Hack of course! With a little bit of coffee and swearing I was able to compile the kernel with modules on a Jetson TX2 itself.


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
# For L4T 27.1, do the following:
$ git checkout vL4T27.1

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. In the video, the local version of the kernel is set. The stock kernel uses -tegra as its local version identifier. 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 second script,, fixes up the makefiles so that the source can be compiled on the Jetson, 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 and zImage files into the /boot directory.

$ ./

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


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. Note that it is new, and not thoroughly tested at this point. Use it at your own risk.


  • The video above was made directly after flashing the Jetson TX2 with L4T 27.1 using JetPack 3.0.
  • 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.


  1. Hi Jim

    I’m trying to compile the Kernel for a TX1 using the Jetpack 3.0, will this scripts will work or shall I use the ones you did on the Kernel build for TX1 (but this are not Jetpack 3.0

  2. Thanks a lot for your great content and this video! It helped me to finally get my rplidar working on the Jetson TX2 (the cp2102-driver was missing).

  3. I put a TX2 SOM (which you can get from Arrow now) on a TX1 Jetson carrier board and am getting significantly enough different error messages during a kernel compile to lead me to believe that these boards are subtly incompatible. I can give you specifics if you want, but I wanted to know if this was expected. Who would buy a SOM if it was? JTX2s are pretty much the same price anyhow.

  4. I get a error when I run the command ‘./’:
    cp: cannot stat ‘arch/arm64/boot/zImage’: No such file or directory
    cp: cannot stat ‘arch/arm64/boot/Image’: No such file or directory

    But I success in before two step.

  5. Before and after building the kernel I get the same error when running tensorflow:

    stream_executor/cuda/] failed call to cuInit: CUDA_ERROR_NO_DEVICE
    I tensorflow/stream_executor/cuda/] kernel driver does not appear to be running on this host (jet): /proc/driver/nvidia/version does not exist
    W tensorflow/compiler/xla/service/] platform CUDA present but no visible devices found

    But I am able to build and run the NVIDIA samples. Is there some cuda device driver install I’m missing? I don’t see anything like that in the kernel config.

      • This turned out to be a permissions problem. I made a new user and the account needed to be in the ‘video’ group. The error message really threw me off.

        • Interesting. When people ask questions on this website, I’m always tempted to just say “It must be a permissions problem”. That seems to be the cause of 80% of the issues reported.

  6. Hey thanks for all your help and tutorials. Its awesome.

    While doing this after i ./ I get error “Could not find Qt via plg-config
    Makefile:531: recipe for target ‘xconfig’ failed
    Make: ***[xconfig] Error 2

  7. I ran this script EXACTLY as directed on the video and the web page and everything seemed to go well. However, after reboot, my wired ethernet refuses to cooperate. Switching on the wifi worked but of course it is considerably slower than wired. Any ideas what I did wrong and/or how to correct it? Reflash everything from scratch yet again? If so, running this kernel modification will probably yield the same result. Help, someone, please!

    • Hi David,
      I’ve never seen this error, so I am unable to offer any help. You could try:
      apt-get remove –purge resolveconf
      apt-get install –reinstall resolvconf
      but it’s all just guess work on my part. You’ll have to use JetPack to flash your machine again.

  8. Forgot to mention it is a TX2 and in preparation for using realsense R200.

    Error message is: active connection removed before it was initialized. Web searches give answers all over the place but none mention the kernel having been rebuilt.

  9. Hi Jim,
    Nice work! Thanks for sharing your knowledge.
    I have one big question:
    Assuming I have followed your procedures.
    I need to build my own driver for IMX290 image sensor, my plan is to copy the existing IMX sensor driver and edit it to work for IMX290. Question: I just need to run the and to compile and run my driver? Am I correct? Or is there any other things to do? Sorry I am still new to linux systems. Thanks

    • I have not built any camera drivers. My understanding is that there are some other things you need to do in order to get them to work in addition to compiling the module. The steps in this article will build the module and kernel, which will probably one of the steps. You should ask if others have any experience with this sensor on the NVIDIA Jetson TX2 forum:

      Thanks for reading!

  10. Ran the getKernelSources script and got:
    gzip: /proc/config.gz: No such file or directory
    HOSTCC scripts/basic/fixdep
    CHECK qt
    SHIPPED scripts/kconfig/

  11. Is there a file at /proc/config.gz
    I just opened up a brand new system today. After flashing with JetPack 3.0, I built the kernel using these scripts and did not encounter any issues. Is this a fresh system you are working from?

  12. hi Jim, all,
    I run a TX2, and boot on SSD
    I followed all the process, renaming kernel “-elpimous-V1.0”
    after rebooting, “uname -r” tells me 4.4.15-tegra

    saving modifs in file was ok, no errors on the 3 .sh execution.

    But at start, it doesn’t load my kernel !!

    Is the problem due to my SSD boot ?
    Any help, please friends

  13. Hello,
    I didn’t have success. Now, I know why and I send…

    [u]Add module on kernel[/u]:

    [b]Board [/b]: Jetson TX2
    [b]Boot [/b]: SSD
    [b]Howto [/b]:

    –> just after the command : ./,

    Image is finished, ready to read… But,
    Image is on a wrong directory (on the SSD Disk !!!)
    You must put it on the TX2 board 32Go disk !

    backup image in board disk :
    sudo cp /media/nvidia/xxxxxx/boot/Image/media/nvidia/xxxxxx/boot/Image_backup

    sudo cp /boot/Image/media/nvidia/xxxxxx/boot/Image

    sudo reboot



  14. Success. Thanks for writing this post.

    I noticed that the /boot directory on my Jetson TX2 did not have a zImage – so when installing a new kernel, I refrained from copying zImage and just copied Image. This appeared to work fine – the board booted into the new kernel without issue.

    • You’re welcome, I am glad you found it useful. I believe that there were some changes since the TX1, the zImage doesn’t appear on the TX2. Since this is a “Developer Preview” version, I’m going to wait to see what the next release brings. Thanks for reading!

  15. Hi Jim,
    Thanks for all your videos.

    I received the following error when I was making the Kernel.

    rm: invalid option — ‘0’
    Try ‘rm –help’ for more information.
    Makefile:1137: recipe for target ‘_modinst_’ failed
    make: *** [_modinst_] Error 1

    Is there a way I can fix this error? Thanks!

  16. I got this error :

    nvidia@tegra-ubuntu:~/buildJetsonTX2Kernel$ ./
    cp: cannot stat ‘arch/arm64/boot/Image’: No such file or directory

    • The message means that the Image is not there, probably because it did not build correctly. If you are building for JetPack 3.0/L4T 27.1 you must use the tag version vL4T27.1 in the buildJetsonTX2Kernel repository. The master is for the new JetPack 3.1/L4T 28.1 version. Thanks for reading!

          • sorry for that i didn’t provide my information enough
            i install my TX2 with the film
            and then i want to create a kernel to it
            so i follow the film
            and i also change the branch from master to tag vL4T27.1
            i did
            $ git clone
            $ cd buildJetsonTX2Kernel
            and i didn’t do your suggestion
            $ git checkout vL4T27.1
            i just do like the film to the following step
            i create a new local version
            but in the part of usb setting
            i point ‘USB CP210x family with UART Bridge controller’
            to make my radia sensor work
            and i type
            it’s ok until now
            but when i type
            the terminal show
            cp: cannot stat ‘arch/arm64/boot/Image’: No such file or directory

            i will do the additional step that you suggestion
            $ git checkout vL4T27.1
            before ‘./’
            the film didn’t do this step , it’s necessary?

            thank you very much

          • The video is from March, 2017. Since then there has been a new release to L4T 28.1 (JetPack 3.1). The repository has been updated to reflect the new version. However, a tagged version vL4T27.1 was created so that if you have L4T 27.1 you can use those scripts. Therefore you have to checkout those scripts. Hope this helps.

  17. Hi
    Thanks for your great tutorial,
    one question here:

    If I flashed my jetson TX2 board with latest jetpack 3.1,
    do I need to modified any of the scripts or settings to keep match to it?
    Or the script will figure it out to load the match kernel.

    my “$rname -r” returns “4.4.38-tegra” which is different from the demo you showed in the video.

    Finally, from the above discussion, you mentioned that I have to make sure the kernel on SSD and eMMC are consistent. How can I do that?

    Thanks for your help!

  18. Try to enable KVM in TX2. Following the instruction, but failed.

    in xconfig file, I choose Virusualization option with KVM support.

    during step, it reports errors.

    include/linux/irqchip/arm-gic.h: Assembler messages:
    include/linux/irqchip/arm-gic.h:100: Error: unknown mnemonic `enum’ — `enum domain_gic_pm_event{‘
    include/linux/irqchip/arm-gic.h:101: Error: unknown mnemonic `mod_domain_power_on’ — `mod_domain_power_on,’
    include/linux/irqchip/arm-gic.h:102: Error: unknown mnemonic `mod_domain_power_off’ — `mod_domain_power_off’
    include/linux/irqchip/arm-gic.h:103: Error: junk at end of line, first unrecognized character is `}’
    scripts/ recipe for target ‘arch/arm64/kvm/vgic-v2-switch.o’ failed
    make[1]: *** [arch/arm64/kvm/vgic-v2-switch.o] Error 1
    Makefile:973: recipe for target ‘arch/arm64/kvm’ failed
    make: *** [arch/arm64/kvm] Error 2

Leave a Reply

Your email address will not be published.