How to flash kernel-dtb and kernel module without make system.img and rootfs?

Hi,
This is my environment:
Hardware: Jetson Orin NX 8GB SOM + customized carried board
Software: JetPack 5.1.1 L4T 35.3.1
I flash the hole system use this command and works ok:

sudo ./tools/kernel_flash/l4t_initrd_flash.sh \
  --external-device nvme0n1p1 \
  -c tools/kernel_flash/flash_l4t_external.xml \
  -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml" \
  --showlogs  \
  --network usb0 \
  p3509-a02+p3767-0000 nvme0n1p1

Now I want to flash individual partition, such as kernel-dtb or kernel module.
I use this command: (reference to README_initrd_flash.txt:Workflow 9: Flash inidividual partition)

sudo ./tools/kernel_flash/l4t_initrd_flash.sh \
 --external-device nvme0n1p1 \
 -c ./tools/kernel_flash/flash_l4t_external.xml \
 -k kernel-dtb \
 --external-only --network usb0 --showlogs \
 p3509-a02+p3767-0000 nvme0n1p1

But it will rebuild system.img everytime, which cost me a lot of time.

Do we have any convenient way to flash more faster?

Hi,

If I recall correctly flashing to an externel NVMe drive is somewhat limited by the available tools (this is a recent feature in the BSP). I know that flash.sh can handle flashing just the kernel image or kernel device tree (without the need of rebuilding whole file system image) using the integrated eMMC but I am not sure about an external storage drive use case. Still you could try taking a look at this documentation: Flashing Support — Jetson Linux Developer Guide documentation

Update: here it is another thread of someone who reported it was able to flash their NVMe drive with flash.sh. It may be worth checking it:Jetpack-5.0.2 - Failed to flash NVMe with custom dtb and kernel's Image

Hope this info helps,

Jafet Chaves,
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

Hi, jchaves,
Thank for you reply, but I didn’t find effective way to flash kernel-dtb individually in the link you provide.
Reference to this link, flash.sh cannot flash data to external devices.

My environment is :Jetson Orin NX 8GB SOM + customized carried board.
And I flash kernel+ rootfs to the NVME device ,which attach on the carried board .

Can u give me some useful command how to update kernel-dtb to NVME device with l4t_initrd_flash.sh?

Hi, DavenLLL,
Unfortunately, I find a pity solution :

Can you give any suggetion how to use dd to update kernel-dtb?
Because it means I will waste a lot of time to debug my kernel driver if we don’t have a convenient method.

Hi,

In newer releases of L4T, kernel dtb is loaded from rootfs by default, and there is no need to flash the kernel-dtb partition. You can just replace the file indicated by the FDT entry in /boot/ext/extlinux.conf.

1 Like

That method is great, finally works well !

But I have another question, which was mentioned in the title at the beginning.
How to update kernel module and flash it?
I have search in the forums, and this is my method:

TOOLCHAIN_DIR=$PWD/l4t-gcc
KERNEL_PATH=$PWD/source/public/kernel/kernel-5.10/
OUTPATH=$PWD/source/public/kernel_out

export CROSS_COMPILE_AARCH64_PATH=$TOOLCHAIN_DIR
export CROSS_COMPILE_AARCH64=$TOOLCHAIN_DIR/bin/aarch64-buildroot-linux-gnu-

mkdir -p $OUTPATH

make -C $KERNEL_PATH ARCH=arm64 LOCALVERSION=-tegra CROSS_COMPILE=${CROSS_COMPILE_AARCH64} O=$OUTPATH tegra_defconfig
make -C $KERNEL_PATH ARCH=arm64 LOCALVERSION=-tegra CROSS_COMPILE=${CROSS_COMPILE_AARCH64} O=$OUTPATH -j8 --output-sync=target Image
make -C $KERNEL_PATH ARCH=arm64 LOCALVERSION=-tegra CROSS_COMPILE=${CROSS_COMPILE_AARCH64} O=$OUTPATH -j8 --output-sync=target dtbs
  
  
make -C $KERNEL_PATH ARCH=arm64 LOCALVERSION=-tegra CROSS_COMPILE=${CROSS_COMPILE_AARCH64} O=$OUTPATH -j8 --output-sync=target modules
make -C $OUTPATH ARCH=arm64 LOCALVERSION=-tegra O=$OUTPATH INSTALL_MOD_PATH=$OUTPATH modules_install -j8

sudo rsync -azPu  $OUTPATH/lib/modules/5.10.104-tegra rootfs/lib/modules/


cp source/public/kernel_out/arch/arm64/boot/dts/nvidia/* kernel/dtb -rf
cp source/public/kernel_out/arch/arm64/boot/Image kernel/
sudo cp source/public/kernel_out/drivers/gpu/nvgpu/nvgpu.ko rootfs/usr/lib/modules/5.10.104-tegra/kernel/drivers/gpu/nvgpu/nvgpu.ko

But after flash it, HDMI become black screen, is there any problem with my command?

1 Like

Hi,

can you try if building display drivers fixes the black screen issue?
https://docs.nvidia.com/jetson/archives/r35.3.1/DeveloperGuide/text/SD/Kernel/KernelCustomization.html#to-build-display-kernel-modules

You may also need to run sudo depmod -a through UART after flashing.

Hi, DaveYYY,
Thank you for your prompt reply,
I have built display drivers success and replace these three .ko before I create this topic:

$ ls -l rootfs/lib/modules/5.10.104-tegra/extra/opensrc-disp
total 24256
-rw-r--r-- 1 root root  5196104 6月   1 17:49 nvidia-drm.ko
-rw-r--r-- 1 root root 16707944 6月   1 17:49 nvidia.ko
-rw-r--r-- 1 root root  2926056 6月   1 17:49 nvidia-modeset.ko

In addition, “depmod -a” output nothing.

Can you check if the drivers are loaded correctly with lsmod?
What does xrandr give you?

Last, if you have our official DevKit carrier board, see if the display works with it when flashed with the default BSP.

Hi, this is the result:
lsmod

root@tegra-ubuntu:~# lsmod
Module                  Size  Used by
nvidia_modeset       1142784  4
fuse                  131072  3
lzo_rle                16384  16
lzo_compress           16384  1 lzo_rle
zram                   32768  4
ramoops                28672  0
reed_solomon           20480  1 ramoops
loop                   40960  1
snd_soc_tegra210_iqc    16384  0
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_mvc    20480  2
snd_soc_tegra210_admaif   131072  1
snd_soc_tegra210_afc    20480  6
snd_soc_tegra_pcm      16384  1 snd_soc_tegra210_admaif
snd_soc_tegra210_mixer    49152  1
snd_soc_tegra210_dmic    20480  4
snd_soc_tegra210_adx    32768  4
snd_soc_tegra210_amx    36864  4
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
r8168                 479232  0
ghash_ce               28672  0
sha2_ce                20480  0
cdc_acm                36864  0
sha256_arm64           28672  1 sha2_ce
snd_hda_codec_hdmi     61440  1
snd_soc_tegra_machine_driver    16384  0
snd_soc_tegra210_adsp   774144  1
sha1_ce                20480  0
snd_soc_tegra_utils    32768  3 snd_soc_tegra210_admaif,snd_soc_tegra_machine_driver,snd_soc_tegra210_adsp
snd_hda_tegra          16384  0
snd_soc_simple_card_utils    24576  1 snd_soc_tegra_utils
snd_soc_spdif_tx       16384  0
snd_hda_codec         135168  2 snd_hda_codec_hdmi,snd_hda_tegra
nvadsp                118784  1 snd_soc_tegra210_adsp
snd_soc_tegra210_ahub  1273856  3 snd_soc_tegra210_ope,snd_soc_tegra210_sfc
snd_hda_core           94208  3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_tegra
userspace_alert        16384  0
tegra_bpmp_thermal     16384  0
tegra210_adma          28672  2 snd_soc_tegra210_admaif,snd_soc_tegra210_adsp
nv_imx219              20480  0
r8169                  94208  0
nvidia               1466368  9 nvidia_modeset
spi_tegra114           32768  0
realtek                24576  1
binfmt_misc            24576  1
ina3221                24576  0
pwm_fan                24576  0
nvgpu                2777088  22
nvmap                 221184  133 nvgpu
ip_tables              36864  0
x_tables               53248  1 ip_tables

xrand

root@tegra-ubuntu:~# xrandr 
Can't open display 

Before I update the kernel and flash , HDMI display is fine.

So the same custom board works fine with your monitor if there is no change applied to the kernel code?
Can you share the hardware design of your carrier board, and what changes you make in device trees?

Maybe also dmesg logs after the device boots into black screen.

My kernel didn’t change anything ,just add a symbol.

+++ b/hardware/nvidia/platform/t23x/p3768/kernel-dts/tegra234-p3767-0001-p3509-a02.dts
@@ -21,5 +21,5 @@
        nvidia,dtsfilename = __FILE__;
        nvidia,dtbbuildtime = __DATE__, __TIME__;
        compatible = "nvidia,p3509-0000+p3767-0001", "nvidia,p3767-0001", "nvidia,tegra234", "nvidia,tegra23x";
-       model = "NVIDIA Orin NX Developer Kit";
+       model = "NVIDIA Orin NX Developer Kit Seavo";
 };

After careful check ,
I find only when starting for the first time after flashing,
will happened the HDMI not display.
And reboot the system,HDMI can display normal.
This is the log:
dmesg.log (60.6 KB)
Xorg.0.log (12.5 KB)

So you think it’s working properly now?
Your dmesg log looks fine.

Actually, yes,
But I want to check why the first time boot HDMI cannnot display,
the default sdk do not have this problem.
can you help me do some analysis?

What do you get from UART when the display does not work?

Uart didnt output any error log, and at this step, I think the log is similar to the dmesg log.
uart log.txt (56.6 KB)

And I have provide the HDMI black screen log here.

Did you still see the UEFI logo? Or it stayed all black?

It’s strange that the logo only appears for 1 or 2 seconds and then display the GUI desktop. So it means in the UEFI and kernel, it stayed all black.
The same goes for the default SDK.

Are you talking about if you change the kernel dtb symbol name and run initrd flash and it will lead to this in first boot ?

If the xorg log is a valid one, then there is no monitor connected/detected to the board so driver does not respond.