Use alternate DTB for initrd flash

I am trying to get initrd flashing working with my custom carrier board. I did not implement USB OTG into my design on the flashing port but its not something I can easily change now. I can flash fine with the standard script, but since the initrd flash method requires device mode support, I cant get it to work normally. We need this for the mass flashing features and to be able to load the OS on to NVME.
My dtb has been set up so that the port is in OTG mode with dummy GPIO pins used for the ID and vbus detection. These pins are both pulled low. Setting both pins to active high results in host mode and active low in device mode. I have confirmed that it works in both modes. Here is the dt snippet of the USB configuration:

		ports {
			usb2-0 {
				mode = "otg";
				status = "okay";
				//nvidia,oc-pin = <0>;
				vbus-supply = <&vbus_0_reg>;
				connector {
					compatible = "gpio-usb-b-connector", "usb-b-connector";
					/* These are dummy gpios with int pd enabled. Present on int connector J11 as GPIO28/17*/
					vbus-gpio = <&tegra_main_gpio TEGRA234_MAIN_GPIO(H, 1) GPIO_ACTIVE_HIGH>;
					id-gpio = <&tegra_main_gpio TEGRA234_MAIN_GPIO(P, 4) GPIO_ACTIVE_HIGH>;
					label = "micro-USB";
					type = "micro";
					//able-connected-on-boot = "USB_ROLE_DEVICE";

If I modify my dtb so that the port is always in device mode, it will flash but now that port cant be used as a host port. I have now created two dtbs, one is the standard DTB with the port in host mode, and another initrdflash dtb with it in device mode. I want to modify the initrd flashing scripts to use the initrdflash dtb only for the RCM boot, but flash the standard dtb. I could also convert this to an overlay if that is easier.

I modified the generate_rcm_bootcmd() function in to add an extra option for an external DTB but it causes an unhandled exception right after the UEFI exits. The serial debug log is attached.

	local cmd
	local cmdarg=
	if [ -n "${OVERRIDE_RCM_DTB}" ] && [ -f "${OVERRIDE_RCM_DTB}" ]; then
		cmdarg+="-d \"${OVERRIDE_RCM_DTB}\" "

serialdebug.log (27.1 KB)

Am I going about this the right way or is there a cleaner way to do this? Modifying the hardware to support an ID pin is not an option.


What you are doing is right, but you don’t need to modify initrd flash script.

It is a 2-step flash as you said.

Below is just an example. You need to change the board config to what you need.

step 1, there is a “–no-flash” parameter in initrd flash. Use this one to create a package that includes the dtb that will be running on your board.

sudo ./tools/kernel_flash/ --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_external.xml -p “-c bootloader/t186ref/cfg/flash_t234_qspi.xml --no-systemimg” --network usb0 --no-flash board_config1 external

For example, board_config1.conf shall include the dtb that can run on your board.

Step 2, you need to use another board_config2 that contains the dtb which has ability to enable device mode and flash package from step1 to your board.

sudo ./tools/kernel_flash/ --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_external.xml -p “-c bootloader/t186ref/cfg/flash_t234_qspi.xml --no-systemimg” --network usb0 --use-backup-image board_config2 external

Thanks, glad to know this is possible.
I am still getting the unhandled exception in EL3 error though. Any ideas on what the cause might be? Once I figure out what is going on with the unhandled exception this should work. I started with a fresh L4T.

Side note - it appears the quotes you used are unicode quotes, when i pasted that into my terminal the command didnt run properly, replacing with standard ascii quotes fixed it.

I didn’t mean that you should copy it. You need to modify each parameter by yourself.

BTW, please also share your flash log and boot up log.

I copied the commands and edited them, just a future note for anyone else who tries this.

These are the flash commands I used.
Stage 1
sudo ./tools/kernel_flash/ --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_external.xml -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml --no-systemimg" --network usb0 --no-flash jetson-agx-orin-xxx-32GB-base external
Stage 2
sudo ./tools/kernel_flash/ --external-device nvme0n1p1 -c tools/kernel_flash/flash_l4t_external.xml -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml --no-systemimg" --network usb0 --use-backup-image jetson-agx-orin-xxx-initrdflash external

Here are the requested logs:
flash-stage1.log (223.3 KB)
flash-stage2.log (84.1 KB)
stage2bootup.log (32.2 KB)

Basically, you are doing same thing as this post.

Could you make sure your dtb can get flashed and boot up the board by using first? Just for debug.

I can flash both configs using without any issues. usb device mode works with the initrd config and I can see it detecting on the host computer.

This is now solved. I had PCIe C6 (unsupported) turned on and the UEFI doesnt seem to like it, but works in other situations. Disabling C6 in the initrdflash dtb let me flash using the commands above.

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