Initrd update on Orin NX

Hi! I want to load kernel & initrd to RAM on Orin NX 16GB. The reason is

  • because I don’t have full rootfs ready yet (another person is working on it)
  • also I want to be able to quickly iterate on kernel changes, without full reflash.

I see that when calling l4t_initrd in RCM mode, boot.img (Android Boot Image) is loaded into RAM and this is what I want.

I’m running this script:

echo "Build kernel & initrd... "
# (use our buildsystem to create Image and initrd)

# Linux_for_Tegra location: use user's env variable L4T_PATH if there's no provided argument

echo "Copy kernel..."
cp ./build/kernel-l4t/sources/kernel/kernel-jammy-src/arch/arm64/boot/Image "$L4T_PATH/kernel/"
cp ./build/kernel-l4t/sources/kernel/kernel-jammy-src/arch/arm64/boot/dts/nvidia/*.dtb $L4T_PATH/Jetson_Linux_R36.4.0_aarch64/Linux_for_Tegra/kernel/dtb/
echo "Extract initrd and include it in recovery.img..."
gunzip --suffix=img -k ./build/initrd_normal_dev.gz -f
# Use abootimg to replace initrd.img inside recovery.img,
# as flashing scripts picks it up from there:
# see l4t_initrd_flash_internal.sh: generate_flash_initrd()
sudo abootimg -u "$L4T_PATH/bootloader/recovery.img" -r ./build/initrd_normal_dev

# Don't flash QSPI, only ask for flashing external (SD card) but purposefully fail it, to be able to use initrd loaded to RAM -> quickest iteration cycle
sudo "$L4T_PATH/tools/kernel_flash/l4t_initrd_flash.sh" --external-only --flash-only --network usb0 -k APP --external-device dummy-should-fail -c tools/kernel_flash//flash_l4t_t234_nvme.xml jetson-orin-nano-devkit dummy-should-fail

And getting this result:
rcm-boot-initrd.log (6.8 KB)

At this point initrd shell is running, and I’m happy.

However, where should I place my initrd & kernel to be loaded on device? Right now I’m getting some different initrd loaded, and I can’t figure out how to load my compiled initrd.

I also tried updating contents of bootloader/l4t_initrd.img, as it’s the file that is modified if you run ./tools/l4t_update_initrd.sh, but these changes were not visible on device when I ran ./tools/kernel_flash/l4t_initrd_flash.sh.

  1. Which initrd should I update to see changes on device?
  2. Also where to put dtb to see it updated on device?

Hi,

One question to confirm:
What is your jetpack version?

Please refer to this doc to update initrd

Thanks

Hi! I’m using Jetpack 6.1 and BSP 36.4.

Thank you for the link.
However, my question is: where is the initrd file located, precisely the initrd that will be first loaded to Orin during l4t_initrd_flash.sh?

Some questions to confirm:
Since your initd shell is running, which means your own compiled initrd.img is loaded in ram.
How do you verify that your compiled l4t_initrd.img is not loaded in device?

Thanks

How do you verify that your compiled l4t_initrd.img is not loaded in device?

I made some modifications, like additional directories and files in the initrd. My goal is to put there some new kernel modules so I can test them with Orin before the rootfs is available (e.g. camera drivers for IMX296).

However, these changes are not reflected when I ls -l in the initrd loaded on device.
Maybe apart from updating bootloader/l4t_initrd.img, I need to include the new directories in some script for them to be included in the initrd?

For example, these “test” files/directories are visible in the l4t_initrd.img, but not on device.

~/orin/Jetson_Linux_R36.4.0_aarch64/Linux_for_Tegra$ zcat bootloader/l4t_initrd.img | cpio -itv | grep test
-rw-rw-r--   1 root     root            0 Dec 18 22:16 test1
drwxrwxr-x   2 root     root            0 Dec 18 22:16 test2
-rwxr-xr-x   1 root     root        34992 Dec 18 22:13 usr/bin/test

Hi,
some example you could follow:
Following command execute in your Orin NX

  • Follow the doc provided.
  • edit your /boot/extlinux/extlinux.conf
    • change INITRD /boot/initrd to INITRD /boot/l4t_initrd.img
  • reboot
  • Noticed: Please add the backup kernel if your custom initrd crash the system

Thanks

Thank you! Is it possible to modify extlinux.conf in Linux_for_Tegra directory and use it for flashing? Or I need to do it on device, after having mounted rootfs?

Currently I can only boot to initrd, and from there, the /boot is unavailable:

bash-5.1# ls /
bin  etc   initrd_flash.cfg  mnt   qspi  run   sys  usr
dev  init  lib		     proc  root  sbin  tmp  var

I think extlinux.conf doesn’t impact which initrd is booted. When using RCM boot (like I’m doing here) it should only depend on which (kernel + initrd) is packaged into a Android Boot Image boot.img. So we just need to figure out the correct initrd file / Android Boot Image file to update.

Hi,

Please refer to this doc
https://docs.nvidia.com/jetson/archives/r36.4/DeveloperGuide/SD/Bootloader/UEFI.html#dtb-support

You can check your L4T Boot Mode mode from
UEFI Device Manager->Nvidia Configuration->L4T Configuration

If your L4T Boot Mode is ExtLinux, the initrd will load from your file path of extlinux.conf

Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.