`l4t_initrd_flash.sh` from r35.4.1

How up to date is the documentation for l4_initrd_flash.sh? (Specifically, Linux_for_Tegra/tools/kernel_flash/README_initrd_flash.txt)

I’ve managed to get it to work for the basic case, but some of the other “workflows” in the document have various problems.

For example, trying “workflow 12” - trying to write to a USB drive which sounds like (given the --direct flag) it should actually write to a drive on the host, I get an error related to APPSIZE when I try writing with the following command line:

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --direct sdb -c ./tools/kernel_flash/flash_l4t_external_olyns.xml --external-device sda1 -S 80GiB jetson-xavier-nx-devkit-emmc sda1

I get this error:

[   0.6655 ] tegraparser_v2 --generategpt --pt flash.xml.bin
[   0.6658 ] End sector for APP, expected at: 122159070, actual: 0
Error: Return value 4
Command tegraparser_v2 --generategpt --pt flash.xml.bin
Error: /home/riz/testing/jetson_top_r35.4.1/Linux_for_Tegra/bootloader/signed/flash.idx is not found
Error: failed to relocate images to /home/riz/testing/jetson_top_r35.4.1/Linux_for_Tegra/tools/kernel_flash/images
Cleaning up...

… I tried replacing APPSIZE in the .xml file with no change in behavior. Is this stuff documented better somewhere? In the README, for example, in “Workflow 3” it says:

To flash to an externally connected storage device, you need to create your own
partition config xml file for the external device. For information about how to
do this, see the 'External Storage Device Partition' section in the developer
guide.

… there is no “External Storage Device Partition” in the Developer Guide for r35.4.1 that I can tell - at least searching that phrase didn’t reveal one. What section should I be looking at?

+j

Hi,

I think you need to either take out the -S option, or specify the sector size of the disk in flash_l4t_external.xml like:

<device type=“external” instance=“0” sector_size=“512” num_sectors=“62521344”>

I actually wound up having to do both things, but it seems to have worked.

Thanks!

I should also ask, though - how do I increase the APPSIZE? I had to set the “size” parameter of the APP partition back to APPSIZE (from 85899345920) in order to get this to work, and I wound up with a 14GB partition instead of the 80GB one I was hoping for. I feel close, here, but the documentation is a bit all over the place, and it’s hard to figure out the right place to set this stuff.

The APP partition should automatically get enlarged to the maximum upon boot, and please just leave everything unmodified and try again with:

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device sda1 -c ./tools/kernel_flash/flash_l4t_external.xml --showlogs --network usb0 jetson-xavier-nx-devkit-emmc sda1

Can you help me understand why you’re asking me to try with everything unmodified and using that command line? My goal here is to further understand the process so I can adapt it to my particular needs, and “just do what I wrote” doesn’t really help with that.

Usually, I would just read the scripts to understand how things are being used, but in this case the scripts are written in a way that makes understanding the underlying steps very difficult - which, I get, is part of the point, but I am going to keep trying to understand nevertheless :)

For example, in the commandline you wrote, it’s not clear - is the USB drive i’m trying to write expected to be connected to the Xavier NX? I would vastly prefer to write USB drives directly on the host computer, or if that’s not recommended then to at least understand why not.

Also, your suggestion of “leave everything unmodified” - the only thing I’ve modified at this point is changing NUM_SECTORS to be the actual number of sectors of my disk…

Finally, “The APP partition should automatically get expanded to the maximum upon boot” is not correct - I suspect that may be the case with some of the OEM tools which expect the user to connect keyboard and mouse and configure everything post-boot; I’m configuring a separate configuration flow which removes the need for all that. If the “initrd flash” process can’t be configured to support setting the APP partition size, why even have it as an option? I can certainly change my tools to resize the partition after its creation (it does seem to get created at the end of the disk) and resize the file system on the parition, but it sure would be easier to have it happen when the USB disk is being written initially…

Hi,

Yes, the device has to be connected to the host PC.
If you prefer to do it directly on the host PC, then you should check this:
https://docs.nvidia.com/jetson/archives/r35.4.1/DeveloperGuide/text/SD/FlashingSupport.html#to-set-up-a-flash-drive-manually-for-booting
It’s basically manually passing the parameters of the device to the flashing script.

Yes, the resize of the APP partition is done with some scripts during OEM config upon initial boot.
The logic is that the partition layout file for flashing external devices (flash_l4t_external.xml) is by default for 64GB, as you can see with the num_sectors=“119537664”, so because you specify the size of the APP partition to be 80GB, you also have to specify the sector size, or it will exceed the limit of 64GB. Or you just leave them both unmodified, and let the resize script do the work.

OK. Hopefully you have given me enough clues to accomplish what I want - thanks for your help.

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