L4t_initrd_flash.sh maxes out my memory

flashing a nvme SSD on Xavier AGX floods my memory(host).

I Run the following command, with edited .xml to have the right sector size and size.

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1 -c ./tools/kernel_flash/flash_l4t_nvme.xml -S 400GiB --showlogs --erase-all jetson-agx-xavier-devkit nvme0n1p1

And I get stuck here until oom and it crashes shortly after

[   0.0368 ] Signed file: /home/felix/flash_jetson_stuff/Linux_for_Tegra/bootloader/temp_user_dir/kernel_tegra194-p2888-0001-p2822-0000_sigheader.dtb.encrypt
l4t_sign_image.sh: Generate header for kernel_tegra194-p2888-0001-p2822-0000_sigheader.dtb.encrypt
l4t_sign_image.sh: chip 0x19: add 0x45651 to offset  0x8 in sig file
l4t_sign_image.sh: Generate 16-byte-size-aligned base file for kernel_tegra194-p2888-0001-p2822-0000_sigheader.dtb.encrypt
l4t_sign_image.sh: the signed file is /home/felix/flash_jetson_stuff/Linux_for_Tegra/bootloader/temp_user_dir/kernel_tegra194-p2888-0001-p2822-0000_sigheader.dtb.encrypt
done.
	populating kernel to rootfs... done.
	populating initrd to rootfs... done.
	populating kernel_tegra194-p2888-0001-p2822-0000.dtb to rootfs... done.
Making system.img...

Tried flashing with SDK Manager, got the same issue. Allocated 70GB of host memory, flash only ever reaches 99% done.

It looks like the 400G system image is not very common for jetson flash tool.

Could you try to use some smaller disk space and see if it would get improvement? This “system.img” will change with the “-S” size you input here.

I have a 500gb nvme ssd, what do you suggest i pick?

This is just debug. Not asking to use that size for good.

Try some lower space like 256 or 128G and see if this issue could be bypassed first.

Just to make it easy i picked 8GiB, and i think it worked. However it used like atleast 50GB of memory on my host. system.img.raw is 28gb alone. Is this to be expected?

It also said this…

608 bytes copied, 0,00423923 s, 143 kB/s
Writing kernel-dtb_b partition done
writing item=57, 1:3:CPUBL-CFG, 30600941568, 4096, , , fixed-<reserved>-38, 
[ 50]: l4t_flash_from_kernel: Warning: skip writing CPUBL-CFG partition as no image is specified
writing item=58, 1:3:RP1, 30600945664, 8388608, , , fixed-<reserved>-39, 
[ 50]: l4t_flash_from_kernel: Warning: skip writing RP1 partition as no image is specified
writing item=59, 1:3:RP2, 30609334272, 8388608, , , fixed-<reserved>-40, 
[ 50]: l4t_flash_from_kernel: Warning: skip writing RP2 partition as no image is specified
writing item=60, 1:3:RECROOTFS, 30617722880, 314572800, , , fixed-<reserved>-41, 
[ 50]: l4t_flash_from_kernel: Warning: skip writing RECROOTFS partition as no image is specified
writing item=61, 1:3:UDA, 30932295680, 340418048, , , expand-<reserved>-42, 
[ 50]: l4t_flash_from_kernel: Warning: skip writing UDA partition as no image is specified
writing item=62, 1:3:secondary_gpt, 31272713728, 16896, gpt_secondary_1_3.bin, 16896, fixed-<reserved>-0, 3f534e38dcec92f11641962b89ddcfd613c3b691
[ 50]: l4t_flash_from_kernel: Successfully flash the emmc
[ 50]: l4t_flash_from_kernel: Flashing success
[ 50]: l4t_flash_from_kernel: The device size indicated in the partition layout xml is smaller than the actual size. This utility will try to fix the GPT.

Note: The flash process might have added some nvidia-flash-* connections in
NetworkManager to set up USB ethernet through flashing port (L4t USB Device mode).
You might want to check your NetworkManager configuration if you have some special
configuration.
Reboot target
Run command: sync; { sleep 1; reboot; } >/dev/null & on root@fe80::1%enp57s0u1
Success
Cleaning up...
Log is saved to Linux_for_Tegra/initrdlog/flash_3-1_0_20220125-110306.log

does this mean it flashed my emmc?

I ran this command:
sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1 -c ./tools/kernel_flash/flash_l4t_nvme.xml -S 8GiB --showlogs --erase-all jetson-agx-xavier-devkit nvme0n1p1

Hi,

What is the size you indicate in the xml file (flash_l4t_nvme.xml)?

i have a samsung 980 ssd nvme m2
sector is 512
size is 488315215

Running the same command with 128GiB doesnt work, it floods my host memory. I have about 60-70GB to workwith, which should be plenty i think.

Logs:

[   0.0358 ] Signed file: /home/felix/flash_jetson_stuff/Linux_for_Tegra/bootloader/temp_user_dir/kernel_tegra194-p2888-0001-p2822-0000_sigheader.dtb.encrypt
l4t_sign_image.sh: Generate header for kernel_tegra194-p2888-0001-p2822-0000_sigheader.dtb.encrypt
l4t_sign_image.sh: chip 0x19: add 0x45651 to offset  0x8 in sig file
l4t_sign_image.sh: Generate 16-byte-size-aligned base file for kernel_tegra194-p2888-0001-p2822-0000_sigheader.dtb.encrypt
l4t_sign_image.sh: the signed file is /home/felix/flash_jetson_stuff/Linux_for_Tegra/bootloader/temp_user_dir/kernel_tegra194-p2888-0001-p2822-0000_sigheader.dtb.encrypt
done.
	populating kernel to rootfs... done.
	populating initrd to rootfs... done.
	populating kernel_tegra194-p2888-0001-p2822-0000.dtb to rootfs... done.
Making system.img... 
truncate: failed to truncate 'system.img' at 137438953472 bytes: No space left on device
making system.img with zero fillpattern failed.
Error: Failed to generate images for external device

system.img ended up at 69GB

➜  Linux_for_Tegra du -ah bootloader | grep G               [25/01/22|11:37:36]
69G	bootloader/system.img

Note that whatever your root partition size that the flash process will create a complete image of that size on the host PC before converting it to a sparse image, and then flashing the sparse image. It wouldn’t be unusual for a 500 GB size partition to have a sparse image size of just less than 3 GB, but that would mean the host PC has 503 GB of partition living on it.

The location of the images is in the “Linux_for_Tegra/bootloader/” directory, and file names would be “system.img” (the smaller file) and “system.img.raw” (the 500 GB file for your case). You can safely delete the host PC’s system.img and system.img.raw since it will regenerate at next flash. If you have recursively copied all of the “Linux_for_Tegra/bootloader” content onto an external drive (something significantly larger than 500 GB), and then mount that partition on “Linux_for_Tegra/bootloader” (meaning the new partition replaces the old content while mounted), then you could directly prevent the large files from occupying your PC’s actual original partition and instead distribute to the external drive.

It seems we cannot reproduce this issue.

After using the initrd flash with 200G NVMe drive, the system.img on our side only has 79M…

$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c ./tools/kernel_flash/flash_l4t_nvme.xml -S 200GiB --showlogs jetson-xavier-nx-devkit-emmc nvme0n1p1

Okey, that size seems more reasonable. Here’s more info on what i’m using so maybe you can get some intel from that.

I’m running Ubuntu 18.04.6.

I’m using tools from here, Jetson Linux | NVIDIA Developer.

  • Jetson_Linux_R32.6.1_aarch64.tbz2
  • secureboot_R32.6.1_aarch64.tbz2
  • Tegra_Linux_Sample-Root-Filesystem_R32.6.1_aarch64.tbz2

I apply_binaries and then i edit .xml for nvme, then run initrd flash.

Please list out the commands you use one by one for us to review.

These are in order,

first check

Sector size: cat /sys/block/nvme0n1/queue/hw_sector_size
Size: cat /sys/block/nvme0n1/size

then install deps:

$ sudo apt install libxml2-utils simg2img network-manager abootimg sshpass device-tree-compiler

From Nvidia’s download site, download the files L4T Driver Package (BSP) , Sample Root Filesystem , and, a bit further down, Jetson Platform Fuse Burning and Secure Boot Documentation and Tools . Untar, place sample root in rootfs in Linux_for_tegra.

then sudo ./apply_binaries.sh

edit flash_l4t_nvme.xml with spec retrieved from earlier

set jetson in recovery mode.

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c ./tools/kernel_flash/flash_l4t_nvme.xml -S 230GiB --showlogs --no-flash jetson-xavier nvme0n1p1

then change --no-flash to --flash-only and run again.

I could upload the giant 70gig system.img file somewhere if you want to take a look at it.

Hi felleman,

Can you try below steps?

  1. Change ‘flash_l4t_nvme.xml’ size to bigger, about 250GB and set -S to 230GiB.
  2. Delete images folder from: /Linux_for_Tegra/tools/kernel_flash/images
  3. Run below command:
    $ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c ./tools/kernel_flash/flash_l4t_nvme.xml -S 230GiB --showlogs jetson-xavier nvme0n1p1

I flashed it on another computer with 1TB space, so it works to do 230GB image. But i have a 500gb ssd nvme as well, so now i only have 230GB allocated on that. I would like to have atleast 400gb.

Did you follow the steps as mentioned by carolyuu or you are still using your commands?

I ran without --noflash yes, but I now have a 230GiB size on a 500GB ssd.

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

Have you tried 400GB with the commands we use? Change those parameters from 230G to whatever you want.

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