orinNano Kernel added other driver, and need to modify the device tree, how do I need to operate

Hello, I am a novice, I use orin Nano development board, I want to add other drivers in the kernel, and I need to modify the device tree, how do I need to operate, how do I need to compile and package after operation. Is there a detailed tutorial?

Refer the below link:

https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/SD/Kernel.html

Thank you for your help, I have carefully read this information, which only has the kernel compilation tutorial, not the relevant configuration of the kernel. CORSS_COMPILE=~/gcc/aarch64–glibc–stable-2022.08-1/bin/ aarch64-buildroot-linux-gnu-menuconfig Go to the kernel configuration screen, check imx412, After compiling with make ARM=arm64 CORSS_COMPILE=~/gcc/aarch64–glibc–stable-2022.08-1/bin/aarch64-buildroot-linux-gnu – j8, After compiling I could not find the imx412.ko file produced by imx412 in the kernel. What else do I need to do?

I am compiling on PC Ubuntu20.04

1 Like

After compilation, were you able to flash it on the Jetson unit?

Refer below link for flashing:

https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/IN/QuickStart.html

I have not yet brushed the machine, but after compiling the kernel, I can not find the driver file after configuring the kernel in the compilation file. Excuse me, am I operating the kernel correctly? Here’s how I manipulate the kernel configuration:

$ tar xf public_sources.tbz ~/nvidia/ ~/nvidia/
$ cd  ~/nvidia/Linux_for_Tegra/source
$ tar xf kernel_src.tbz2
$ tar xf kernel_oot_modules_src.tbz2
$ tar xf nvidia_kernel_display_driver_source.tbz2
cd ~/nvidia//Linux_for_Tegra/source
$ export CROSS_COMPILE=<toolchain-path>/bin/aarch64-buildroot-linux-gnu-
$ make -C kernel
$cd ~/nvidia/Linux_for_Tegra/source/kernel/kernel-jammy-src
$make ARCH=arm64 CROSS_COMPILE=~/nvidia/gcc/bin/aarch64-buildroot-linux-gnu- menuconfig
$make ARCH=arm64 CROSS_COMPILE=~/nvidia/gcc/bin/aarch64-buildroot-linux-gnu- -j8

Which version of linux for tegra you are flashing?

Please provide the link you are following to use the steps mentioned by you.

development environment(PC):Ubuntu 20.04
Version in use: Jetson Linux 36.3

From where did you get these steps?

please provide the link…

Maybe the steps are wrong, this is how I compile and prune kernels for other development boards, just replacing the compiler. Could you please provide the steps of tailoring orin Nano core?

I had already provided the below link in earlier post:
You need to follow these steps for Linux for Tegra 36.3

https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/SD/Kernel.html

Also,
**You can modify your imx412 to ā€œyā€ in the tegra_defconfig file from the below link **

** kernel-5.10/arch/arm64/configs/tegra_defconfig**

to enable the configs and then run nvbuild.sh

Refer the below for more details:

Please make ARCH=arn64 menuconfig where to execute, I this $/Linux_for_Tegra/source error

zynq@ubuntu:~/nvidia/Linux_for_Tegra/source$ make ARCH=arn64 menuconfig
make: *** No rule to make target 'menuconfig'.  Stop.
zynq@ubuntu:~/nvidia/Linux_for_Tegra/source$ cd ./kernel/
zynq@ubuntu:~/nvidia/Linux_for_Tegra/source/kernel$ ls
kernel-jammy-src  Makefile
zynq@ubuntu:~/nvidia/Linux_for_Tegra/source/kernel$ make ARCH=arn64 menuconfig
make: *** No rule to make target 'menuconfig'.  Stop.
zynq@ubuntu:~/nvidia/Linux_for_Tegra/source/kernel$ cd kernel-jammy-src/
zynq@ubuntu:~/nvidia/Linux_for_Tegra/source/kernel/kernel-jammy-src$ make ARCH=arn64 menuconfig
Makefile:623: arch/arn64/Makefile: No such file or directory
make: *** No rule to make target 'arch/arn64/Makefile'.  Stop.
zynq@ubuntu:~/nvidia/Linux_for_Tegra/source/kernel/kernel-jammy-src$ 

Ask make ARCH=arn64 menuconfig where to execute, no matter where to execute will give an error怂

I see some spelling mistake here.

It should be arm64 instead of arn64

zynq@ubuntu:~/nvidia/Linux_for_Tegra/source$ cd ./kernel/kernel-jammy-src/
zynq@ubuntu:~/nvidia/Linux_for_Tegra/source/kernel/kernel-jammy-src$ make ARCH=arm64 menuconfig
zynq@ubuntu:~/nvidia/Linux_for_Tegra/source/kernel/kernel-jammy-src$ cd ..
zynq@ubuntu:~/nvidia/Linux_for_Tegra/source/kernel$ cd ..
zynq@ubuntu:~/nvidia/Linux_for_Tegra/source$ ./nvbuild.sh -o ~/nvidia/out

Then I searched the ~/nvidia/out file and couldn’t find the imx412.ko file.

For this, I think you need to manually go and add entry for inside tegra_defconfig file( in the path kernel-5.10/arch/arm64/configs/tegra_defconfig )
example:

CONFIG_VIDEO_IMX412=y

, before compiling using nvbuild.sh

Refer this link:

https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/AT/JetsonLinuxDevelopmentTools/DebuggingTheKernel.html#modifying-the-kernel-configuration-file

Thanks! imx412.ko was successfully compiled by modifying tegra_defconfig. But why is it not possible to tailor the kernel by ā€œmake ARCH=arm64 menuconfigā€?

1 Like

You should ask NVIdia for that !

Please mark my post as solution so it will be helpful for others.

What if I want to do some kernel tailoring by making ARCH=arm64 menuconfig?

@KevinFFF could you please answer this query

There are 4 steps to update kernel config.

Step 1. Generate base kernel config (.config)
$ cd <Linux_for_Tegra>/sources/kernel/kernel-5.10
$ make ARCH=arm64 defconfig

Step 2. Configure the kernel config in menu and update .config
$ make ARCH=arm64 menuconfig

Step 3. Generate defconfig 
$ make ARCH=arm64 savedefconfig

Step 4. Update defconfig 
$ cp defconfig arch/arm64/configs/defconfig

You can also add the specific kernel config in arch/arm64/configs/defconfig directly.
After boot up, please run the following command to check if it is applied correctly.

 $ zcat /proc/config.gz | grep CONFIG_VIDEO_IMX412
2 Likes