I’m trying to get the correct steps to compile a working real-time kernel for my Jetson NX and I want to compile a networking module (8821cu) on-board eventually.
As reference I’m following the instructions here (Kernel Customization — Jetson Linux Developer Guide documentation) and the commands posted here (No display with PREEMPT_RT patches) that are sometimes linked in other similar threads.
The commands are the same but the last one, where I use:
sudo tools/l4t_create_default_user.sh -u nvidia -p nvidia -a -n nvidia-desktop --accept-license
sudo ./flash.sh --no-flash p3449-0000+p3668-0001-qspi-emmc mmcblk0p1
sudo ./flash.sh -r p3449-0000+p3668-0001-qspi-emmc mmcblk0p1
I’m cross-compiling the kernel and modules from a Ubuntu 20.04 host and I’m using the toolchain 2020.08 (9.3.0).
I extracted the sources (manually-downloading-and-expanding-kernel-sources) and Sample_Rootfs + L4T from the website.
Before installing modules, rootf/lib/modules/ doesn’t exist, as expected.
When I run sudo ./apply_binaries.sh it installs all the NVIDIA packages and also some modules in rootfs/lib/modules/5.10.104-tegra/ (without rt).
gorgo@razer:/media/gorgo/PopOS/home/gorgo/NX_5_1_HYAI/Linux_for_Tegra$ ls -la rootfs/lib/modules/5.10.104-tegra/
total 2012
drwxr-xr-x 4 root root 4096 mar 28 15:02 .
drwxr-xr-x 3 root root 4096 mar 28 15:02 …
lrwxrwxrwx 1 root root 69 gen 25 03:33 build → /usr/src/linux-headers-5.10.104-tegra-ubuntu20.04_aarch64/kernel-5.10
drwxr-xr-x 3 root root 4096 mar 28 15:02 extra
drwxr-xr-x 9 root root 4096 mar 28 15:02 kernel
-rw-r–r-- 1 root root 507529 mar 28 15:02 modules.alias
Later with
cd $ROOT/Linux_for_Tegra/source/public/kernel_out
sudo make INSTALL_MOD_PATH=$ROOT/Linux_for_Tegra/rootfs O= modules_install
It installs the modules in rootfs/lib/modules/5.10.104-rt63-tegra/. (with rt)
gorgo@razer:/media/gorgo/PopOS/home/gorgo/NX_5_1_HYAI/Linux_for_Tegra$ ls -la rootfs/lib/modules/5.10.104-rt63-tegra/
total 2016
drwxr-xr-x 3 root root 4096 mar 28 15:04 .
drwxr-xr-x 4 root root 4096 mar 28 15:04 …
lrwxrwxrwx 1 root root 82 mar 28 15:04 build → /media/gorgo/PopOS/home/gorgo/NX_5_1_HYAI/Linux_for_Tegra/source/public/kernel_out
drwxr-xr-x 9 root root 4096 mar 28 15:04 kernel
-rw-r–r-- 1 root root 515446 mar 28 15:04 modules.alias
-rw-r–r-- 1 root root 506829 mar 28 15:04 modules.alias.bin
-rw-r–r-- 1 root root 27993 mar 28 15:04 modules.builtin
-rw-r–r-- 1 root root 50452 mar 28 15:04 modules.builtin.alias.bin
-rw-r–r-- 1 root root 30390 mar 28 15:04 modules.builtin.bin
-rw-r–r-- 1 root root 166915 mar 28 15:04 modules.builtin.modinfo
-rw-r–r-- 1 root root 84507 mar 28 15:04 modules.dep
-rw-r–r-- 1 root root 134914 mar 28 15:04 modules.dep.bin
-rw-r–r-- 1 root root 187 mar 28 15:04 modules.devname
-rw-r–r-- 1 root root 45918 mar 28 15:04 modules.order
-rw-r–r-- 1 root root 829 mar 28 15:04 modules.softdep
-rw-r–r-- 1 root root 202723 mar 28 15:04 modules.symbols
-rw-r–r-- 1 root root 252534 mar 28 15:04 modules.symbols.bin
lrwxrwxrwx 1 root root 90 mar 28 15:04 source → /media/gorgo/PopOS/home/gorgo/NX_5_1_HYAI/Linux_for_Tegra/source/public/kernel/kernel-5.10
I find it strange that build and source point to a local folder, differently from the build folder in 5.10.104-tegra. Why?
Flash log file:
flashLog.log (80.5 KB)
Once the flash is done, the NX boots with some errors you see in the screen below:
After booting I can access to the NX via SSH (and via GUI as well):
nvidia@nvidia-desktop:~$ uname -a
Linux nvidia-desktop 5.10.104-rt63-tegra #1 SMP PREEMPT Tue Mar 28 11:28:03 +04 2023 aarch64 aarch64 aarch64 GNU/Linux
nvidia@nvidia-desktop:~$ lsmod
Module Size Used by
fuse 131072 3
lzo_rle 16384 16
lzo_compress 16384 1 lzo_rle
zram 32768 4
realtek 24576 1
loop 40960 1
nvgpu 2760704 43
snd_soc_tegra186_asrc 40960 1
snd_soc_tegra186_dspk 20480 2
snd_soc_tegra210_ope 36864 1
snd_soc_tegra186_arad 28672 2 snd_soc_tegra186_asrc
snd_soc_tegra210_iqc 16384 0
snd_soc_tegra210_mvc 20480 2
snd_soc_tegra210_afc 20480 6
snd_soc_tegra210_mixer 49152 1
snd_soc_tegra210_admaif 131072 1
snd_soc_tegra210_dmic 20480 4
snd_soc_tegra210_adx 32768 4
snd_soc_tegra210_amx 36864 4
snd_soc_tegra_pcm 16384 1 snd_soc_tegra210_admaif
snd_soc_tegra210_i2s 24576 6
snd_soc_tegra210_sfc 61440 4
aes_ce_blk 36864 0
crypto_simd 24576 1 aes_ce_blk
cryptd 32768 1 crypto_simd
aes_ce_cipher 20480 1 aes_ce_blk
ghash_ce 28672 0
sha2_ce 20480 0
sha256_arm64 28672 1 sha2_ce
sha1_ce 20480 0
pwm_fan 24576 0
snd_soc_tegra_machine_driver 16384 0
snd_soc_spdif_tx 16384 0
leds_gpio 16384 0
snd_hda_codec_hdmi 61440 4
snd_soc_tegra210_adsp 774144 1
snd_soc_tegra_utils 32768 3 snd_soc_tegra210_admaif,snd_soc_tegra_machine_driver,snd_soc_tegra210_adsp
snd_hda_tegra 16384 0
max77620_thermal 16384 0
ina3221 24576 0
snd_soc_simple_card_utils 24576 1 snd_soc_tegra_utils
snd_hda_codec 135168 2 snd_hda_codec_hdmi,snd_hda_tegra
snd_soc_tegra210_ahub 1245184 3 snd_soc_tegra210_ope,snd_soc_tegra210_sfc
nvadsp 118784 1 snd_soc_tegra210_adsp
tegra_bpmp_thermal 16384 0
tegra210_adma 28672 2 snd_soc_tegra210_admaif,snd_soc_tegra210_adsp
snd_hda_core 94208 3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_tegra
userspace_alert 16384 0
nv_imx219 20480 0
spi_tegra114 32768 0
binfmt_misc 24576 1
nvmap 217088 263 nvgpu
ip_tables 36864 0
x_tables 53248 1 ip_tables
build and source are still linking to my host machine:
nvidia@nvidia-desktop:~$ ls -larth /usr/lib/modules/5.10.104-rt63-tegra/build
lrwxrwxrwx 1 root root 82 Mar 28 2023 /usr/lib/modules/5.10.104-rt63-tegra/build → /media/gorgo/PopOS/home/gorgo/NX_5_1_HYAI/Linux_for_Tegra/source/public/kernel_out
nvidia@nvidia-desktop:~$ ls -larth /usr/lib/modules/5.10.104-rt63-tegra/source
lrwxrwxrwx 1 root root 90 Mar 28 2023 /usr/lib/modules/5.10.104-rt63-tegra/source → /media/gorgo/PopOS/home/gorgo/NX_5_1_HYAI/Linux_for_Tegra/source/public/kernel/kernel-5.10
I updated/upgraded the packets.
I rebooted and then I cloned the 8821cu repo in my home directory.
Now the repo install-driver.sh fails when it looks for the kernel headers:
#check to see if the correct header files are installed
if [ ! -d “/lib/modules/$(uname -r)/build” ]; then
echo “Your kernel header files aren’t properly installed.”
echo “Please consult your distro documentation or user support forums.”
echo “Once the header files are properly installed, please run "sudo ./${SCRIPT_NAME}"”
exit 1
fi
As said above, my build link is broken.
I cannot neither compile it by sources for the same reason:
nvidia@nvidia-desktop:~/8821cu-20210916$ make
make ARCH=arm64 CROSS_COMPILE= -C /lib/modules/5.10.104-rt63-tegra/build M=/home/nvidia/8821cu-20210916 modules
make[1]: *** /lib/modules/5.10.104-rt63-tegra/build: No such file or directory. Stop.
make: *** [Makefile:2501: modules] Error 2
In the documentation (Kernel Customization — Jetson Linux Developer Guide documentation) > Preparing to Build External Kernel Modules you claim to use /usr/src/linux-headers-$(uname -r)-ubuntu20.04_aarch64 but it doesn’t exist. /usr/src/linux-headers-5.10.104-tegra-ubuntu20.04_aarch64/ exists.
What’s missing here?
Thank you for the support!