Build Kernel

Hi,
I am trying to build a linux kernel for the first time. I did follow the instructions on how to build the kernel, but I am missing something.

I am using my Ubuntu x86 machine and the cross compilation toolchain to build the kernel r36.3 jetson pack 6.

After downloading the sources manually and setting up my workspace I modify the config of the kernel to enable gs_usb module (I need CAN over USB):

./scripts/config --file "arch/arm64/configs/defconfig" --module CONFIG_CAN_GS_USB

I launch the compilation make -C kernel and I see at the end:

================================================================================
Kernel Image: ....../nvidia/Kernel/Linux_for_Tegra/source/kernel/kernel-jammy-src/arch/arm64/boot/Image
Kernel sources compiled successfully.

I found that file kernel/kernel-jammy-src/.config updates after compilation. Here I confirmed:
CONFIG_CAN_GS_USB=m

In folder kernel/kernel-jammy-src/arch/arm64/boot/ I see the 40 MB Image file:

$ du -h kernel/kernel-jammy-src/arch/arm64/boot/Image
40M	kernel/kernel-jammy-src/arch/arm64/boot/Image

I build the modules and DTBs as described in the documentation

$ make modules 
..............building........
================================================================================
Display driver compiled successfully.
================================================================================
$ make dtbs
================================================================================
DTBs compiled successfully.
================================================================================

So far so good, I think. As a rookie I may have skipped a step, please correct me if I did a mistake.

Here are my questions:

  1. I build the kernel image on my laptop using cross-compilation, how do I flash the image to my jetson nano orin?
  2. In the documentation there is the option Sync the sources using Git. and the script source_sync.sh is mentioned. Where can I find such script?

Thank you in advance,

Hello @Nexus8,

Great job getting to compile everything manually!
I would suggest you create a script so that you can run those steps easier, and sometimes you might just need to compile either kernel, DTB or modules, so you can just update that part. Splitting those stems might improve your development process.

Now, with regards to your 2 questions.
I believe both of them will be answered by downloading the NVIDIA SDK Manager, and then using it to download the JP you want to build.

I understand you want to build from source, however, by using the SDK manager, you will not only download the JP itself, but also a complete environment with a bunch of helper tools for your development.

For instance, you will get the flash script and the source_sync script, which you need to find the answer of your 2 questions.

Please let me know if that helps.

And also, don’t hesitate to reach back if you run into any other issues or have any other questions.

regards,
Andrew
support@proventusnova.com

Hello,
Thanks for your reply. You are correct, the SDK manager is the solution. The thing that I was missing was to connect my Jetson to my computer during the installation procedure, only then the JP install shows up.

Unfortunately, the script source_sync.sh was not working. The cloning was failing:

fatal: read error: Connection timed out

I switched wifi.
Thanks

Hello again,

I managed to do all the compilation process as described on Nvidia’s documentation. Once I get the the flash step something does not work:

sudo ./flash.sh -r jetson-orin-nano-devkit nvme0n1p1
.........
# Target Board Information:
# Name: jetson-orin-nano-devkit, Board Family: generic, SoC: Tegra 234, 
# OpMode: production, Boot Authentication: NS, 
# Disk encryption: disabled ,
###############################################################################

[   0.0453 ] Reading fuses
[   0.0464 ] tegrarcm_v2 --chip 0x23 0 --ismb2applet
[   0.0471 ] File rcm_state open failed
[   0.0476 ] ERROR: failed to read rcm_state
[   0.0476 ] 
[   0.0491 ] tegrasign_v3.py --key None --getmode mode.txt

.... ....
[ 52823.1009 ] tegrarcm_v2 --chip 0x23 0 --ismb2applet
[ 53837.9075 ] tegrarcm_v2 --chip 0x23 0 --ismb2
[ 54854.7167 ] tegrarcm_v2 --chip 0x23 0 --ismb2applet
[ 55869.5236 ] tegrarcm_v2 --chip 0x23 0 --ismb2
[ 56886.3328 ] tegrarcm_v2 --chip 0x23 0 --ismb2applet
[ 57901.1396 ] tegrarcm_v2 --chip 0x23 0 --ismb2
[ 58917.9489 ] tegrarcm_v2 --chip 0x23 0 --ismb2applet
[ 59932.7555 ] tegrarcm_v2 --chip 0x23 0 --ismb2
[ 60949.5647 ] tegrarcm_v2 --chip 0x23 0 --ismb2applet
[ 61964.3714 ] tegrarcm_v2 --chip 0x23 0 --ismb2
Error: None of the bootloaders are running on device. Check the UART log.
Failed flashing generic.

I have connected pins 9 and 10 of the board. Do you have any suggestions, please?