Dynamic DTB/DTBO loading

Hello, I am completely new to world of embedded and I would like to learn more by developing for Nvidia Jetson AGX Orin.

I have few modules which have unique value written in EEPROM by I2C. Those modules use the same connection interface but need a different Device trees/drivers in order to function.

I would like to be able to “hot-swap” those modules, identify them and load their appropriate DTBOs based on their IDs stored in EEPROMs before booting into the kernel. Sample scenario:

  • Shut down Orin AGX
  • Swap the module
  • Turn on the Orin AGX
  • Read EEPROM of module and pass proper DTB/DTBO to kernel

I have been instructed to use Cboot scripts in order to accomplish that with I2C and fdt. But since Orin AGX uses UEFI with the newest BSP I don’t know how to approach this.

I’ve been reading this documentation and noticed that some camera modules have IDs in board_config property which in my understanding differentiate different cameras.

What is the recommended way to implement such “hot-swap on boot” behavior on Nvidia Jetson AGX with JetPack 5.1.2 (UEFI)?

Thank you in advance!

Hi RPAnimation,

Are you using the devkit or custom board for AGX Orin?
What’s your Jetpack version in use?

Could you help to clarify your use case more clearly?
Do you mean the dtb in use is determined by the content in EEPROM?

That’s precisely what I meant.

Sorry, since I’m not familiar with the topic, I didn’t know how to put it into the right words.

You should select the correct board config to flash your board rather than determined by the EEPROM.

Or you could just check the board config in use.
For AGX Orin, you could check jetson-agx-orin-devkit.conf.

You could check the following contents that using the different dtb according to the board SKU.

	# Select the Base DTB based on SKU
	if [ "${board_sku}" = "0000" ] || [ "${board_sku}" = "0001" ] ||
		[ "${board_sku}" = "0002" ]; then
	elif [ "${board_sku}" = "0004" ]; then
	elif [ "${board_sku}" = "0005" ]; then
		echo "Error: Unrecognized module SKU ${board_sku}";
		exit 1;

Is that what you need?

I don’t want to re-flash the board every time I change the module. I would like to be able to swap a module and a proper DTB should be passed to the kernel based on the value in EEPROM read by I2C. I want to achieve something similar to this: Using the U-Boot Extension Board Manager – BeagleBone Boards Example.

I was thinking of making a user space program which reads I2C and loads proper DTBOs/Drivers, but I wonder if it’s possible to do it before kernel is loaded, just like Extension Board Manager feature in U-Boot.

How does one write something similar on Jetson platform which uses UEFI instead of U-Boot?

You may need to know the boot flow first that the board would boot from bootloader → kernel → user space.
For your case, you could only implement that logic in bootloader.

For AGX Orin platform, we use UEFI as bootloader.

As my understanding, current UEFI is dtb driven, which means it would not read EEPROM before reading dtb.
and the kenel image/dtb will also be written in the partition during flash.

I’ve not seen any user having this requirement like yours.
May I know what’s your use case to swap different modules on the board?
What modules do you have?

I thought that kernel supported that with CONFIG_OF_CONFIGFS=y flag and appending an overlay in /sys/kernel/config/device-tree/overlays/. My idea was to read the EEPROM, correlate the board ID with DTBOs/kernel modules and hot-load them at runtime. Would that work on Jetson AGX?

I have custom modules that use the same interface but enable different functionality (e.g. different camera interfaces).

The use case would be having an end user swapping/plugging in/plugging out those modules depending the need. Let’s say at some point there is a need for a particular module with different functionality than the current one. The end user would just swap those modules and all necessary configuration would be loaded without flashing the BSP onto the board.

Do you have modules other than AGX Orin?

Where’s your EEPROM?
Do you mean that switching the modules w/o power off the board…?

Overlay dtb is used to append to the original dtb.
In your case, I have no idea to read EEPROM before loading the dtb.

Yes, those modules were custom made and are other than AGX ORIN. By modules I mean circuit boards that implement functionality such as HDMI IN (CSI) and FPDLinkIII. Custom BSP variant was already written on top of JetPack and all of those devices have their respective BSP/drivers loaded.

The EEPROM of each module is connected to the AGX Orin via I2C interface. All of the modules are powered by 3V3, 5V rails from the AGX Orin itself. So their power is dependent on the board.

I would like to swap the modules when the board is off. Then subsequently boot, run a program which reads EEPROMs, appends appropriate DTBOs and load necessary drivers at runtime.

My goal would to be read the EEPROM with I2C library (just basic values that identify a module) and apply the DTBO at runtime to the original DTB depending on which module has been detected.

Do you mean that you have some custom modules running with Jetpack but they are not Jetson module?

Then you should find somewhere to run this process, but your kernel has loaded the dtb during boot up. So, you should also build some custom drivers as loadable module and load them manually after overlay dtbo applied.

Yes, circuit boards connected through various interfaces of AGX Orin.

Does that mean that application of DTBO overlay at runtime (with method mentioned before) is be possible on Orin AGX platform?

After having a guarantee that hardware is configured properly with DTBO, loading an appropriate driver should be straightforward.

We would suggest reading EEPROM and applying overlay dtbo in UEFI and then loading kernel.

Is it possible to execute EFI Shell Scripts on Orin AGX? Is adding UEFI application image to boot option a good idea?

Yes, you could enter EFI shell through UEFI menu.

For your case, it would be a better solution, but you should need to know how to write an application for those tasks in UEFI.

I think this should be a good place to start: https://github.com/NVIDIA/edk2-nvidia/wiki/ComponentList. There are some drivers for I2C and DTB libraries. If you know of additional resources that would be useful for this particular case, please link them.

Thank you for your help and patience!

1 Like

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