Xavier NX Jetpack 5.1 initrd massflash doesn't work

initrd massflash only ever connects to one device.

It looks like massflash is only supported via initrd. But I would like to ask is there any alternative to massflash without initrd using networking over usb?

Please, I am searching for an explanation of this code from tools/kernel_flash/l4t_initrd_flash_internal.sh:

ping_device()
{
	while IFS=  read -r; do
		netpath=/sys/class/net/${REPLY}
		netserialnumber=$(get_udev_attribute "${netpath}" serial)
		if [ "${netserialnumber}" = "${serialnumber}" ]; then
			echo "${REPLY}" > "${sshcon}"
			ip a add fc00:1:1:"${device_instance}"::1/64 dev "${REPLY}"
			ip a add fe80::2 dev "${REPLY}"
			ip link set dev "${REPLY}" up
		fi
	done < <(ls /sys/class/net)

	if [ -z "$(cat "${sshcon}")" ]; then
		return 1
	fi
	if ! ping6 -c 1 "fe80::1%$(cat "${sshcon}")" > /dev/null 2>&1;
	then
		return 1
	fi
	return 0
}

This bash function must return true in order for the flash process to succeed. It only does so on a single device.

I have looked at the tools/backup_restore/README_backup_restore.txt to look for another way to implement massflash, but this also uses initrd method and will surely suffer from the same problem.

I have ensured udisks2 service is not running by masking it on the system.

Take a look at this behavior:

I made the following change to the above code:

ping_device()
{
	while IFS=  read -r; do
		netpath=/sys/class/net/${REPLY}
		netserialnumber=$(get_udev_attribute "${netpath}" serial)
		if [ "${netserialnumber}" = "${serialnumber}" ]; then
			echo "${REPLY}" > "${sshcon}"
			ip a add fc00:1:1:"${device_instance}"::1/64 dev "${REPLY}"
			ip a add fe80::2 dev "${REPLY}"
			ip link set dev "${REPLY}" up
		fi
	done < <(ls /sys/class/net)

	if [ -z "$(cat "${sshcon}")" ]; then
		return 1
	fi
    echo "Attempting >>ping6 -c 1 "fe80::1%$(cat "${sshcon}")"<<"
	if ! ping6 -c 1 "fe80::1%$(cat "${sshcon}")" > /dev/null 2>&1;
	then
		return 1
	fi
    echo ">>ping6 -c 1 "fe80::1%$(cat "${sshcon}")"<< was a success"
	return 0
}

The top terminal is a failure and the flash succeeds on the bottom.

Notice a few things

  • both terminals show Waiting for device to expose ssh twice. Don’t understand why that is. The function wait_for_ssh() is only called once.
  • the print I added showing the ping6 command shows the identical address fe80::1%usb0 being used. This doesn’t make sense.

It looks like something basic is broken in the logic somewhere near here.

Hi unphased,

Sorry, the only method for massflash is using initrd with Workflow 7: Initrd Massflash of README_initrd_flash.txt currently.

I think the first one is from wait_for_ssh(), the second one is from flash_through_ssh()

What’s the difference between these two results?
Do you modify any logic in the script?
From your code above, it seems only two debug messages added.

No code modifications of course. Just an attempt to figure out what I might do to my host to make the flasher happy.

Just need someone to confirm massflash is in a working state.

There is a small bug in initrd flash script ( l4t_initrd_flash_internal.sh )

	if [ -n "${network}" ]; then
		while IFS=  read -r; do
			netpath=/sys/class/net/${REPLY}
			netserialnumber=$(get_udev_attribute "${netpath}" serial)
			netconfiguration=$(get_udev_attribute "${netpath}" configuration)
			if [[ "${netconfiguration}" =~ RNDIS\+L4T${device_instance}* ]]; then

Can you add a dot to this line in this code snipet

if [[ "${netconfiguration}" =~ RNDIS\+L4T${device_instance}.* ]]; then
2 Likes

Good afternoon,

We are experiencing the same issue with initrd massflash with JetPack 5.1 on Orin NX. Only one device would flash in both our custom PCB and the nVidia Xavier NX devkit with Orin NX inserted.

I made the above code changes to l4t_initrd_flash_internal.sh on lines 456-457 and now it works with more than one device at a time in both our custom carrier board and the Xavier NX devkit.

2 Likes

I can confirm that code change fixed massflash over here as well. Thanks.

@WayneWWW

When trying to perform mass flash with Xavier NX onto NVMe SSD with L4T 5.2 I found that only the first device could connect SSH and subsequent devices would timeout, same as the issue reported in this thread.

We modified /tools/kernel_flash/l4t_initrd_flash_internal.sh to add the missing dot as specified. Then created the mass flash image using this command…

sudo ./tools/kernel_flash/l4t_initrd_flash_internal.sh --external-device nvme0n1p1 -c ./tools/kernel_flash/flash_l4t_nvme.xml --no-flash --massflash 2 --showlogs --network usb0 p3509-0000+p3668-0001-qspi-emmc nvme0n1p1

The image creates successfully with the “internal” initrd flash command.

Then mass flashing of devices works using this command (without “internal” initrd command)…

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --massflash 2 --showlogs --network usb0 p3509-0000+p3668-0001-qspi-emmc nvme0n1p1

regards rapidproto

Hello, can you tell me your specific operation with JetPack 5.1 on Orin NX?I tried every command and still couldn’t

You need to use

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c ./tools/kernel_flash/flash_l4t_nvme.xml --no-flash --massflash 2 --showlogs --network usb0 p3509-0000+p3668-0001-qspi-emmc nvme0n1p1

Also you should turn off your VPN when flashing

Thanks lhoang,

We had a problem where l4t_initrd_flash.sh would not support more than one device SSH connection with massflash option. This thread solved this with an edit to l4t_initrd_flash_internal.sh, so we are using that one instead. Is there a similar bug in l4t_initrd_flash.sh

We found this command will work for Xavier NX on 250GiB SSD (note that edits are also required to line 2 of tools/kernal_flash/flash_l4t_nvme.xml replace value of num_sectors with <size of ssd in bytes / 512>)

Creating the image:

sudo ./tools/kernel_flash/l4t_initrd_flash_internal.sh --external-device nvme0n1p1 -c ./tools/kernel_flash/flash_l4t_nvme.xml -S 232GiB --showlogs --no-flash --massflash 2 --network usb0 p3509-0000+p3668-0001-qspi-emmc nvme0n1p1

Flashing the image using mass flash:

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --massflash 2 --showlogs --network usb0

Now works on multiple devices. Let me know if you see any potential problems with these commands.

For the Orin NX, the same commands will work, just need to change the p3668 to p3767 to match an Orin conf file.

Hi 1598898627

Please refer to this post, same commands should work for Orin.

The inird flash script use the initrd flash internal command underneath

Thanks lhoang, does this mean that it does not matter which one we use.

If initrd_flash_internal and initrd_flash use same initrd utility then why would the initrd_flash_internal work with massflash and the initrd_flash does not.

Technically for this release, it makes no difference. But in the future update, we might make changes to l4t_initrd_flash.sh to do some setup before running l4t_initrd_flash_internal.sh. So I think it is better for you to run the command how we intend for it to be used.

Hi @rapidproto @lhoang
SW:SDK35.2.1 HW:Orin-NX
I have modified l4t_initrd_flash_internal.sh if [[ "${netconfiguration}" =~ RNDIS\+L4T${device_instance}.* ]]; then
and I use l4t_initrd_flash_internal.sh

# to generate mfi image
sudo ./tools/kernel_flash/l4t_initrd_flash_internal.sh --no-flash --external-device nvme0n1p1 -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml --no-systemimg" -c ./tools/kernel_flash/flash_l4t_external.xml --massflash 5 --showlogs --network usb0 p3509-a02+p3767-0000 nvme0n1p1

# to flash into nvme ssd
sudo ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --network usb0 --massflash 2 --showlogs

One of the two devices always fails like the picture.

I used the following command l4t_initrd_flash.sh with the same result, and I was stuck with this problem for a long time

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


sudo ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --network usb0 --massflash 2 --showlogs

if I use

# to generate mfi image
sudo ./tools/kernel_flash/l4t_initrd_flash_internal.sh --no-flash --external-device nvme0n1p1  -c ./tools/kernel_flash/flash_l4t_nvme.xml --massflash 5 --showlogs --network usb0 p3509-a02+p3767-0000 nvme0n1p1

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --network usb0 --massflash 2 --showlogs

and result in fash stage


l

I run command to generate mfi image is in Orin-AGX ubuntu system.
But command to flash into nvme-ssd is in x86 host ubuntu system.

Can you upload full fail log both both devices? Seems like ssh goes through but flash process failed in the middle for one device. Can you try flashing them individually to see if it goes through