Giter Site home page Giter Site logo

buildjetsontx2kernel's Introduction

buildJetsonTX2Kernel

Deprecated

For versions of L4T newer than L4T 32.3, please see jetson-linux-build https://github.com/jetsonhacks/jetson-linux-build

README

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.

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.

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.

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.

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:

getKernelSources.sh

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

makeKernel.sh

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.

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.

makeModules.sh

Compiles the modules using make and then installs them.

copyImage.sh

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.

You will want to make a copy of the original Image before the copy, something like:

$ cp /boot/Image $INSTALL_DIR/Image.orig
$ ./copyImage.sh
$ echo "New Image created and placed in /boot"

editConfig.sh

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.

removeAllKernelSources.sh

Removes all of the kernel sources and compressed source files. You may want to make a backup of the files before deletion.

Notes:

Make sure to update the eMMC

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.

Special thanks to Raffaello Bonghi (https://github.com/rbonghi) for jetson_easy scripts. Special thanks to Shreeyak (https://github.com/Shreeyak) for discussing alternatives to get source directly from NVIDIA git repositories. Special thanks to Alexander Rashed (@alexrashed on Github) for vL4T32.1.0 release

Release Notes

January, 2020

  • vL4T32.3.1
  • L4T 32.3.1 (JetPack 4.3)

May, 2019

  • vL4T32.1.0
  • L4T 32.1.0 (JetPack 4.2)

July, 2018

  • vL4T28.2.1
  • L4T 28.2.1 (JetPack 3.2.1)
  • Fix issue with scripts jetson_variables to determine L4T version. ** Special thanks to Shreeyak (https://github.com/Shreeyak)
  • Refactored scripts/getKernelSources and getKernelSourcesNoGUI

April, 2018

  • vL4T28.2r3
  • L4T 28.2 (JetPack 3.2)
  • Add removeAllKernelSources.sh
  • Add checks to make sure kernel version matches L4T release

April, 2018

  • vL4T28.2r2
  • L4T 28.2 (JetPack 3.2)
  • Add getKernelSourcesNoGUI.sh for cases where the user does not want to edit the .config file through a GUI.

March, 2018

  • vL4T28.2
  • L4T 28.2 (JetPack 3.2 DP)
  • Removed patches for make file cleanup

July, 2017

  • vL4T28.1
  • L4T 28.1 (JetPack 3.1)

March, 2017

  • vL4T27.1
  • L4T 27.1 (JetPack 3.0)
  • Developers Preview

License

MIT License

Copyright (c) 2017-2020 Jetsonhacks Portions Copyright (c) 2015-2018 Raffaello Bonghi (jetson_easy)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

buildjetsontx2kernel's People

Contributors

alexrashed avatar compiaffe avatar jetsonhacks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

buildjetsontx2kernel's Issues

Advice on version mismatch does not match version number

Advice on version mismatch does not match actual version numbers.
In the files:
getKernelSources.sh
getKernelSourcesNoGUI.sh

For example
$ git checkout v1.0-L4T28.1

Actual Tag number:
vL4T28.1

Detail example below:

This repository branch is for installing the kernel sources for L4T 28.2
You are attempting to use these kernel sources on a L4T 28.1 system.
The kernel sources do not match their L4T release!

Please git checkout the appropriate kernel sources for your release

You can list the tagged versions.
$ git tag -l
And then checkout the latest version:
For example
$ git checkout v1.0-L4T28.1

nvidia@tegra-ubuntu:~/buildJetsonTX2Kernel/buildJetsonTX2Kernel$ git tag -l
vL4T27.1
vL4T28.1
vL4T28.2
vL4T28.2r2
vL4T28.2r3

L4T 32.2.1 support

Hello,

Is there any chance of releasing a version that works with the L4T 32.2.1 (Kernel 4.9.140)?

Thanks

Issue with running makeKernel.sh

I get these errors:

In file included from drivers/../../t18x/drivers/cpuidle/cpuidle-tegra18x.c:37:0:
include/../../kernel/irq/internals.h: In function ‘irqd_set_move_pending’:
include/../../kernel/irq/internals.h:160:3: error: ‘struct irq_data’ has no member named ‘state_use_accessors’
  d->state_use_accessors |= IRQD_SETAFFINITY_PENDING;
   ^
include/../../kernel/irq/internals.h: In function ‘irqd_clr_move_pending’:
include/../../kernel/irq/internals.h:165:3: error: ‘struct irq_data’ has no member named ‘state_use_accessors’
  d->state_use_accessors &= ~IRQD_SETAFFINITY_PENDING;
   ^
include/../../kernel/irq/internals.h: In function ‘irqd_clear’:
include/../../kernel/irq/internals.h:170:3: error: ‘struct irq_data’ has no member named ‘state_use_accessors’
  d->state_use_accessors &= ~mask;
   ^
include/../../kernel/irq/internals.h: In function ‘irqd_set’:
include/../../kernel/irq/internals.h:175:3: error: ‘struct irq_data’ has no member named ‘state_use_accessors’
  d->state_use_accessors |= mask;
   ^
include/../../kernel/irq/internals.h: In function ‘irqd_has_set’:
include/../../kernel/irq/internals.h:180:10: error: ‘struct irq_data’ has no member named ‘state_use_accessors’
  return d->state_use_accessors & mask;
          ^
drivers/../../t18x/drivers/cpuidle/cpuidle-tegra18x.c: In function ‘suspend_all_device_irqs’:
drivers/../../t18x/drivers/cpuidle/cpuidle-tegra18x.c:283:3: error: too few arguments to function ‘__disable_irq’
   __disable_irq(desc);
   ^
In file included from drivers/../../t18x/drivers/cpuidle/cpuidle-tegra18x.c:37:0:
include/../../kernel/irq/internals.h:65:13: note: declared here
 extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
             ^
drivers/../../t18x/drivers/cpuidle/cpuidle-tegra18x.c: In function ‘resume_all_device_irqs’:
drivers/../../t18x/drivers/cpuidle/cpuidle-tegra18x.c:311:3: error: too few arguments to function ‘__enable_irq’
   __enable_irq(desc);
   ^
In file included from drivers/../../t18x/drivers/cpuidle/cpuidle-tegra18x.c:37:0:
include/../../kernel/irq/internals.h:66:13: note: declared here
 extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
             ^
drivers/../../t18x/drivers/cpuidle/cpuidle-tegra18x.c: In function ‘denver_idle_write’:
drivers/../../t18x/drivers/cpuidle/cpuidle-tegra18x.c:348:9: error: implicit declaration of function ‘tick_program_event’ [-Werror=implicit-function-declaration]
         tick_program_event(sleep, true);
         ^
cc1: some warnings being treated as errors
scripts/Makefile.build:261: recipe for target 'drivers/../../t18x/drivers/cpuidle/cpuidle-tegra18x.o' failed
make[3]: *** [drivers/../../t18x/drivers/cpuidle/cpuidle-tegra18x.o] Error 1
scripts/Makefile.build:406: recipe for target 'drivers/../../t18x/drivers/cpuidle' failed
make[2]: *** [drivers/../../t18x/drivers/cpuidle] Error 2
scripts/Makefile.build:406: recipe for target 'drivers/../../t18x/drivers' failed
make[1]: *** [drivers/../../t18x/drivers] Error 2
Makefile:958: recipe for target 'drivers' failed
make: *** [drivers] Error 2

After this. copyImage won't work. It says:

cp: cannot stat 'arch/arm64/boot/zImage': No such file or directory
cp: cannot stat 'arch/arm64/boot/Image': No such file or directory

updating device tree

Hello,

Does these scripts update device tree files? how can I add a device to the device tree of jetson?

Thanks,

Packaging kernel?

I've generated my own kernel, enabling and compiling all the modules I need for my day-to-day operations. If I were to package the kernel (so setting up a board doesn't take that long), do you know which files should I put in?

I'm just asking since the root filesystem of the TX2 is kind of special 😄

make error

Hello!

I found this error when compiling make:

drivers/net/wireless/bcmdhd_pcie/dhd_linux.c:8512:40: note: each undeclared identifier is reported only once for each function it appears in
scripts/Makefile.build:261: recipe for target 'drivers/net/wireless/bcmdhd_pcie/dhd_linux.o' failed
make[4]: *** [drivers/net/wireless/bcmdhd_pcie/dhd_linux.o] Error 1
scripts/Makefile.build:406: recipe for target 'drivers/net/wireless/bcmdhd_pcie' failed
make[3]: *** [drivers/net/wireless/bcmdhd_pcie] Error 2
scripts/Makefile.build:406: recipe for target 'drivers/net/wireless' failed
make[2]: *** [drivers/net/wireless] Error 2
scripts/Makefile.build:406: recipe for target 'drivers/net' failed
make[1]: *** [drivers/net] Error 2
Makefile:973: recipe for target 'drivers' failed
make: *** [drivers] Error 2
Make did not successfully build
Please fix issues and retry build

Thanks in advance!

Jetpack4.4, failed to boot after building kernel

hi, JetPack 4.4 is used on TX2. I hope TX2 to support SCTP. Then I have to build kernel for SCTP.
When I reboot , I got the errors flashing on the black screen. Now I stop here and can not enter the Ubuntu 18.04. Could anyone help with this??

What I did is as follows. Is it correct??
1\ downloads source code from website, public_sources.tzb2.
2\ unzip the source:
tar -xvf public_sources.tzb2 split the first directory
tar -xvf kernel_sources.tzb2
3\ copy the original .config to /usr/src/kernel/kernel-4.9/ and edit it ( set all parameters related to SCTP yes, there are three that are set)
4\ make and install
sudo make -j5 Image
sudo make modules
sudo make modules_install
5\ backup the /boot/Image to Image-original
copy the new Image to /boot
6\ reboot
0806_1

When I plug the keyboard and mouse in USB port. The boot error is:
0806_2

IMX274 Camera with kernel build

I am trying to build the kernel to activate CP210x USB converter drivers, and have already installed a custom kernel build for Leopard Images IMX274 cameras. After building the kernel with these scripts, the Cameras no longer work. I am new to kernel building, so I don't really understand what is going wrong, that's why I really like your scripts, here. I have attached the instructions that came with the cameras. Is there a way to bring in the settings that I currently have set when building the kernel, or is there something else that I can do to make this work?

IMX274_R28.1_TX2_NV_20171027.txt

kernel source code for L4T28.1

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.1 with L4T 28.1. Kernel versions are not compatible across releases.

I don't want to update my L4T, how can I download the kernel source for the version of L4T28.1??

error in "makeKernel.sh"

thanks you!
4.9.140 kernel and modules onboard the Jetson TX2 (L4T 32.3.1, JetPack 4.3):

/usr/src/kernel/nvidia/drivers/net/ethernet/nvidia/pcie/tegra_vnet.c:975:11: error: ‘msg.msg_id’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
else if (msg.msg_id == CTRL_MSG_LINK_DOWN_ACK)
^
cc1: all warnings being treated as errors
scripts/Makefile.build:335: recipe for target 'drivers/net/ethernet/nvidia/pcie/tegra_vnet.o' failed

lspci does not show any PCI devices

Thanks a lot for providing a simple way to flash the TX2. I followed your instructions according to this article, and now lspci does not show any devices. I did not do anything to stray from the tutorial, aside from applying a patch. I tried reflashing using your method, without the patch, and it seems unable to recover the lspci functionality. Any guidance is appreciated. Thanks!

How to copy image to eMMC?

The end of the instructions say to "copy the Image file over to the eMMC in the eMMC's /boot directory." How do you do that? Do you have to flash the TX2?

Is that needed when using the TX2 development kit?

wlan device not found

I managed to build the TX2 kernel onto SSD but I'm unable to get any WIFI network detection:

$ iwconfig
lo    no wireless extensions.
dummy0    no wireless extensions.
tunl0     no wireless extensions.
eth0    no wireless extensions.


$ sudo ifconfig wlan0 up
[sudo] password for nvidia:
wlan0: ERROR while getting interface flags: No such device


$ sudo ifconfig wlan0 scan
command failed: No such device (-19)

Any suggestions on how to get this working?

drivers

Hello,

Great tutorial, but I think this could be missing a key item, make tegra18_defconfig before doing the menu config. While the built image works fine, adding this line will build all of the necessary drivers for things like the libargus SDK, CUDA, etc.

e.g.
`
sudo apt-install pkg-config qt5-default -y
cd /usr/src/kernel/kernel-4.4
make tegra18_defconfig
make xconfig
'

patching / compiling kernel with Auvidea J20 CSI camera module support, missing files..

Hi,
I have patched the kernel source (jetpack 3.2) to include the Auvidea J20 module, selected and enabled it in xconfig.

But while compiling it looks for this files and cant find them:

+#include <media/v4l2-chip-ident.h>
+#include <media/camera_common.h>
+#include <media/soc_camera.h>

drivers/media/i2c/j20.c:32:35: fatal error: media/v4l2-chip-ident.h: No such file or directory

I can manually locate and copy the camera_common.h and soc_camera.h, but those again wants a lot of other header files that are suppose to be in media/

The v4l2-chip-ident.h is no where to be found, but i am sure i am doing something wrong, i should-en need to locate this files should i ?

I am compiling the kernel directly on the TX2 like this description:
https://github.com/jetsonhacks/buildJetsonTX2Kernel

I have also downloaded the kernel sources on my Ubuntu machine just in case there was some difference between building on the TX2 or a Ubuntu pc, but the v4l2-chip-ident.h is still no where to be found, going crazy here :)

how to compile device tree blobs?

Hi, jetsonhacks!
I find that the makeKernel.sh would not make dtbs.
If we want to compile device tree and update it,

would adding "make dtbs" in the makeKernel.sh and "sudo cp /arch/arm64/boot/dts/xxxxx.dtb /boot/" in copyKernel.sh files work this out?

Is there a version suitable for jetpack4.5?

I use the latest Jetpack4.5, but it seems that the latest version only supports jetpack4.3. Can I release the latest version of support? Or what should I do if I want to modify the kernel or device tree?
Thanks!

Can I use this for TX2i?

Hi JetsonHacks,

I am trying to get wifi working on the TX2i and I am struggling with it. Do you know if these scripts work in the TX2i?

Thanks

Readme mistake or script bug?

Readme says about getKernelSources.sh:

Downloads the kernel sources for L4T from the NVIDIA website, decompresses them and opens a graphical editor on the .config file.

But this doesn't happen for me (master, TX2, L4T 32.3.1). Is is expected behavior (then Readme should be fixed) or bug?

In scripts/getKernelSources.sh I see that it calls scripts/config but graphical tool doesn't appear.

TX2:cudatooktik erro

Version: 9.0
DashedVersion: 9-0
1
starting sudo daemon
sudo /mnt/hgfs/jetpack//_installer/sudo_daemon -installer=3493 -d=/mnt/hgfs/jetpack//_installer/tmp
[sudo] password for nxt001:

/mnt/hgfs/jetpack//_installer/run_command -c="dpkg -i --force-overwrite /mnt/hgfs/jetpack/jetpack_download/cuda-repo-ubuntu1604-9-0-local_9.0.252-1_amd64.deb; apt-key add /var/cuda-repo-9-0-local/*.pub; apt-get update; apt-get install -y --force-yes cuda-toolkit-9-0; dpkg --add-architecture arm64;apt-get update; apt-get -y --force-yes install cuda-toolkit-9-0 cuda-cross-aarch64-9-0" -d=/mnt/hgfs/jetpack//_installer/tmp -l=/mnt/hgfs/jetpack/_installer/logs//cuda_host_9.0.log
open /mnt/hgfs/jetpack//_installer/tmp/jetpackfifo_req: no such file or directory

install directory:l=/mnt/hgfs/jetpack/_installer/logs//cuda_host_9.0.log
why:open /mnt/hgfs/jetpack//_installer/tmp/jetpackfifo_req: no such file or directory
have another '/' in /jetpack//_installer/
cause : no such file or directory???

building kernel filled all free disk space

i ran your scripts and they took about 3GB of disk space.
That was all i need, now my jetson has no free disk space anymore.

Where did this space go? the folder where i executed it is very small. where are the 3GB?

Please help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.