We are working on Jetson Orin NX based custom board.
We have flashed firmware with l4t_initrd_flash.sh for a custom board in an L4T 35.4.1 environment,
It was found that the script terminated with an error when a specific device was connected to the HostPC.
Write Command
$ ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --massflash 5
/tools/kernel_flash/l4t_initrd_flash_internal.sh \
--usb-instance 1-6 --device-instance 0 --flash-only --external-device nvme0n1p1
-c "tools/kernel_flash/flash_l4t_external.xml" -S 19327352832 dx-u2200+p3767-0000 nvme0n1p1
...
Start flashing device: 1-6, rcm instance: 0, PID: 18253
Log will be saved to Linux_for_Tegra/initrdlog/flash_1-6_0_20240222-141204.log
Ongoing processes: 18253
Ongoing processes:
Flash complete (WITH FAILURES)
real 0m5.080s
user 0m0.584s
sys 0m1.492s
In l4t_initrd_flash_internal.sh, The script searches for a SCSI device to write to.
wait_for_booting()
{
...
while true
do
...
if [ -z "${network}" ] && ls /dev/sd* 1> /dev/null 2>&1; then
echo "enter -z network"
while IFS= read -r -d $'\0'; do
path="$(readlink -f "$REPLY")"
! [ -b "${path}" ] && continue
dev=$(get_udev_attribute "$path" vendor)
model=$(get_udev_attribute "$path" model)
model_id=$(get_udev_attribute "$path" idProduct)
vendor_id=$(get_udev_attribute "$path" idVendor)
...
get_udev_attribute()
{
path=$1
attr=$2
properties=$(flock -w 60 /var/lock/nvidiainitrdflash udevadm info --attribute-walk "$path")
echo "${properties}" | sed -n "0,/^[ ]*ATTRS{$attr}==\"\(.*\)\"\$/s//\1/p" | xargs
}
Search all SCSI devices (/dev/sd*) connected to the HostPC and check if they are created by Jetson, based on the storage information.
The regular expression in get_udev_attribute() could not process the string correctly because it contained a Device Model name “2.5” SATA SSD 3T" containing double quotation marks “” during this process.
It was found that the write script terminated abnormally at the following point.
***************************************
* *
* Step 3: Start the flashing process *
* *
***************************************
xargs: unmatched double quote; by default quotes are special to xargs unless you use the -0 option
Cleaning up...
The SSD information is below.
$ udevadm info --attribute-walk /dev/sda | grep model
ATTRS{model}=="2.5" SATA SSD 3T"
$ sudo smartctl --all /dev/sda
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-5.4.0-150-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model: 2.5" SATA SSD 3TE7
Serial Number: BCA12306010140002
LU WWN Device Id: 5 24693e 001394245
Firmware Version: S20615
User Capacity: 960,197,124,096 bytes [960 GB]
Sector Size: 512 bytes logical/physical
Rotation Rate: Solid State Device
Form Factor: 2.5 inches
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: ACS-2 (minor revision not indicated)
SATA Version is: SATA 3.2, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is: Thu Feb 22 16:43:43 2024 JST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
initrdlogflash_1-6_0_20240222-141204.log (5.4 KB)
Could you fix it so that it is handled correctly even if there are devices that contain double quotes?