Orin-Nano: l4t_initrd_flash.sh: how to create a smaller image like demo-image?

Hi,

I recently start using Orin-Nano.

I can flash demo-image to my 32GB SD card by balena-etcher.
And demo-image is 22GB.

I found this in QuickStart:

I can run l4t_initrd_flash.sh flash into nvme(120G),
but failed on others storage that smaller than 64GB.

Even I use the -S <size>GiB to smaller the system.img.raw.

# first time 
joezhang@home:~/workspace/TEV-Jetson_Jetpack_script/Orin-Nano_TEK-ORIN_2023-07-27/Linux_for_Tegra$ ls -la bootloader/system.img.raw 
-rwxr-xr-x 1 root root 59055800320  七  28 16:07 bootloader/system.img.raw

# -S 25GiB
joezhang@home:~/workspace/TEV-Jetson_Jetpack_script/Orin-Nano_TEK-ORIN_2023-07-27/Linux_for_Tegra$ ls -la bootloader/system.img.raw 
-rwxr-xr-x 1 root root 26843545600  七  28 16:33 bootloader/system.img.raw

But still got this error:
- the xml indicates the gpt is larger than the device storage

How to create a flash-able system.img that can put into 32GB SD card?

Hi,

then you may try to modify Linux_for_Tegra/tools/kernel_flash/flash_l4t_external.xml, and adjust the num_sectors entry according to the size of your SD card. It’s calculated by GB10241024*1024/512, and you can see the default value 119537664 is for storage devices that are 57GB or larger.

Hi,

I modify the num_sectors of flash_l4t_external.xml.
But still got the same message.

Seems like I need to modify others part, too?

What’s the value now?

I set to 30GB for 32GB sd card.
<device type="external" instance="0" sector_size="512" num_sectors="62914560">

Then how about a little less, like 28GB or 26GB?
I think you may not be really getting 30GB out of a 32GB SD card.

Hi,

set to 25GB
<device type="external" instance="0" sector_size="512" num_sectors="52428800">

$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device mmcblk1p1 \
	-c tools/kernel_flash/flash_l4t_external.xml -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml" \
	  --showlogs --network usb0 jetson-orin-nano-devkit mmcblk1p1

error log

[   4.5960 ] Using ramcode 0
[   4.5961 ] Disabled BPMP dtb trim, using default dtb
[   4.5961 ] 
[   4.6035 ] tegrahost_v2 --chip 0x23 0 --align mem_rcm_aligned.bct
[   4.6160 ] tegrahost_v2 --chip 0x23 0 --magicid MEM0 --ratchet_blob ratchet_blob.bin --appendsigheader mem_rcm_aligned.bct zerosbk
[   4.6202 ] adding BCH for mem_rcm_aligned.bct
[   4.6708 ] tegrasign_v3.py --key None --list mem_rcm_aligned_sigheader.bct_list.xml --pubkeyhash pub_key.key --sha sha512
[   4.6716 ] Assuming zero filled SBK key
[   4.6780 ] Warning: pub_key.key is not found
[   4.6388 ] tegrahost_v2 --chip 0x23 0 --updatesigheader mem_rcm_aligned_sigheader.bct.encrypt mem_rcm_aligned_sigheader.bct.hash zerosbk
[   4.6426 ] Copying signatures
[   4.6447 ] tegrahost_v2 --chip 0x23 0 --partitionlayout flash.xml.bin --updatesig images_list_signed.xml
[   4.6481 ] tegraparser_v2 --generategpt --pt flash.xml.bin
[   4.6496 ] End sector for APP, expected at: 52428766, actual: 0
Error: Return value 4
Command tegraparser_v2 --generategpt --pt flash.xml.bin
Error: /home/joezhang/workspace/TEV-Jetson_Jetpack_script/Orin-Nano_TEK-ORIN_2023-07-31/Linux_for_Tegra/bootloader/signed/flash.idx is not found
Error: failed to relocate images to /home/joezhang/workspace/TEV-Jetson_Jetpack_script/Orin-Nano_TEK-ORIN_2023-07-31/Linux_for_Tegra/tools/kernel_flash/images
Cleaning up...

flash_orin-nano_25GB.txt (154.6 KB)

Does pre-formatting the SD card as a single ext4 partition help?

I tried and found nothing change.

Hi,

I just found -S 20GiB working on my device with a 32GB SD card.
Please give it a try.

Really? Please give me the full command with
Linux_for_Tegra/tools/kernel_flash/l4t_initrd_flash.sh

And what number you gave to Linux_for_Tegra/tools/kernel_flash/flash_l4t_external.xml?

I would try it out!

Hi,

please try like this:

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device mmcblk1p1 -S 20GiB   -c tools/kernel_flash/flash_l4t_external.xml -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml"   --showlogs --network usb0 jetson-orin-nano-devkit internal

For the sector size, you may get the correct value by reading it on your host PC with the command

sudo fdisk -l /dev/xxx

(62521344 in my case)

tools/kernel_flash/flash_l4t_external.xml => num_sectors="52428800"

$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device mmcblk1p1 \
       -S 20GiB -c tools/kernel_flash/flash_l4t_external.xml -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml" \
       --showlogs --network usb0 jetson-orin-nano-devkit internal

Thanks~~

It works on all of my 32GB sd card.

1 Like

One more question,

If I create the image first:

$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device mmcblk1p1 \
     -S 20GiB --no-flash \
     -c tools/kernel_flash/flash_l4t_external.xml -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml" \
     --showlogs --network usb0 jetson-orin-nano-devkit internal

than run flash-only

$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device mmcblk1p1 \
     -S 20GiB --flash-only \
     -c tools/kernel_flash/flash_l4t_external.xml -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml" \
     --showlogs --network usb0 jetson-orin-nano-devkit internal

It will never work (this is why I failed before.)
(flash-only.log see the attachment.)

joezhang@home:~/workspace/TEV-Jetson_Jetpack_script/Orin-Nano_TEK-ORIN_2023-07-31/Linux_for_Tegra$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device mmcblk1p1 -S 20GiB --flash-only -c tools/kernel_flash/flash_l4t_external.xml -p "-c bootloader/t186ref/cfg/flash_t234_qspi.xml" --showlogs --network usb0 jetson-orin-nano-devkit internal
[sudo] password for joezhang: 
/home/joezhang/workspace/TEV-Jetson_Jetpack_script/Orin-Nano_TEK-ORIN_2023-07-31/Linux_for_Tegra/tools/kernel_flash/l4t_initrd_flash_internal.sh --network usb0 --usb-instance 1-2.2.3 --device-instance 0 --flash-only --external-device mmcblk1p1 -c "tools/kernel_flash/flash_l4t_external.xml" -S 20GiB --network usb0 jetson-orin-nano-devkit internal
**********************************************
*                                            *
*  Step 1: Build the flashing environment    *
*                                            *
**********************************************
Create flash environment 0
/home/joezhang/workspace/TEV-Jetson_Jetpack_script/Orin-Nano_TEK-ORIN_2023-07-31/Linux_for_Tegra/bootloader /home/joezhang/workspace/TEV-Jetson_Jetpack_script/Orin-Nano_TEK-ORIN_2023-07-31/Linux_for_Tegra
/home/joezhang/workspace/TEV-Jetson_Jetpack_script/Orin-Nano_TEK-ORIN_2023-07-31/Linux_for_Tegra
Finish creating flash environment 0.
****************************************************
*                                                  *
*  Step 2: Boot the device with flash initrd image *
*                                                  *
****************************************************
/home/joezhang/workspace/TEV-Jetson_Jetpack_script/Orin-Nano_TEK-ORIN_2023-07-31/Linux_for_Tegra/temp_initrdflash/bootloader0 /home/joezhang/workspace/TEV-Jetson_Jetpack_script/Orin-Nano_TEK-ORIN_2023-07-31/Linux_for_Tegra
./tegraflash.py --bl uefi_jetson_with_dtb_sigheader.bin.encrypt --bct br_bct_BR.bct --securedev  --bldtb tegra234-p3767-0000-p3768-0000-a0.dtb --applet rcm_2_encrypt.rcm --applet_softfuse rcm_1_encrypt.rcm --cmd "rcmboot"  --cfg secureflash.xml --chip 0x23 --mb1_bct mb1_bct_MB1_sigheader.bct.encrypt --mem_bct mem_rcm_sigheader.bct.encrypt --mb1_cold_boot_bct mb1_cold_boot_bct_MB1_sigheader.bct.encrypt --mb1_bin mb1_t234_prod_aligned_sigheader.bin.encrypt --psc_bl1_bin psc_bl1_t234_prod_aligned_sigheader.bin.encrypt --mem_bct_cold_boot mem_coldboot_sigheader.bct.encrypt  --bins "psc_fw pscfw_t234_prod_sigheader.bin.encrypt; mts_mce mce_flash_o10_cr_prod_sigheader.bin.encrypt; mb2_applet applet_t234_sigheader.bin.encrypt; mb2_bootloader mb2_t234_with_mb2_cold_boot_bct_MB2_sigheader.bin.encrypt; xusb_fw xusb_t234_prod_sigheader.bin.encrypt; dce_fw display-t234-dce_sigheader.bin.encrypt; nvdec nvdec_t234_prod_sigheader.fw.encrypt; bpmp_fw bpmp_t234-TE990M-A1_prod_sigheader.bin.encrypt; bpmp_fw_dtb tegra234-bpmp-3767-0000-a02-3509-a02_with_odm_sigheader.dtb.encrypt; sce_fw camera-rtcpu-sce_sigheader.img.encrypt; rce_fw camera-rtcpu-t234-rce_sigheader.img.encrypt; ape_fw adsp-fw_sigheader.bin.encrypt; spe_fw spe_t234_sigheader.bin.encrypt; tos tos-optee_t234_sigheader.img.encrypt; eks eks_t234_sigheader.img.encrypt; kernel boot0.img; kernel_dtb tegra234-p3767-0000-p3768-0000-a0.dtb"    --secondary_gpt_backup  --bct_backup  --boot_chain A  --instance 1-2.2.3
Welcome to Tegra Flash
version 1.0.0
Type ? or help for help and q or quit to exit
Use ! to execute system commands
 

 Entering RCM boot

[   0.0495 ] mb1_t234_prod_aligned_sigheader.bin.encrypt filename is from --mb1_bin
[   0.0495 ] psc_bl1_t234_prod_aligned_sigheader.bin.encrypt filename is from --psc_bl1_bin
[   0.0495 ] rcm boot with presigned binaries
[   0.0506 ] tegrarcm_v2 --instance 1-2.2.3 --new_session --chip 0x23 0 --uid --download bct_br br_bct_BR.bct --download mb1 mb1_t234_prod_aligned_sigheader.bin.encrypt --download psc_bl1 psc_bl1_t234_prod_aligned_sigheader.bin.encrypt --download bct_mb1 mb1_bct_MB1_sigheader.bct.encrypt
[   0.0516 ] BR_CID: 0x80012344705DE503280000000AFE0240
[   0.0629 ] Sending bct_br
[   0.0734 ] Sending mb1
[   0.0739 ] Sending psc_bl1
[   0.0834 ] Sending bct_mb1
[   0.0895 ] Generating blob for T23x
[   0.0917 ] tegrahost_v2 --chip 0x23 0 --generateblob blob.xml blob.bin
[   0.0926 ] The number of images in blob is 18
[   0.0930 ] blobsize is 73431535
[   0.0931 ] Added binary blob_uefi_jetson_with_dtb_sigheader.bin.encrypt of size 3182656
[   0.1388 ] Added binary blob_pscfw_t234_prod_sigheader.bin.encrypt of size 375168
[   0.1394 ] Added binary blob_mce_flash_o10_cr_prod_sigheader.bin.encrypt of size 190592
[   0.1398 ] Added binary blob_applet_t234_sigheader.bin.encrypt of size 277312
[   0.1401 ] Not supported type: mb2_applet
[   0.1402 ] Added binary blob_mb2_t234_with_mb2_cold_boot_bct_MB2_sigheader.bin.encrypt of size 437984
[   0.1407 ] Added binary blob_xusb_t234_prod_sigheader.bin.encrypt of size 164352
[   0.1411 ] Added binary blob_display-t234-dce_sigheader.bin.encrypt of size 9097216
[   0.1460 ] Added binary blob_nvdec_t234_prod_sigheader.fw.encrypt of size 294912
[   0.1475 ] Added binary blob_bpmp_t234-TE990M-A1_prod_sigheader.bin.encrypt of size 1048000
[   0.1482 ] Added binary blob_tegra234-bpmp-3767-0000-a02-3509-a02_with_odm_sigheader.dtb.encrypt of size 138880
[   0.1485 ] Added binary blob_camera-rtcpu-sce_sigheader.img.encrypt of size 166304
[   0.1490 ] Added binary blob_camera-rtcpu-t234-rce_sigheader.img.encrypt of size 537952
[   0.1495 ] Added binary blob_adsp-fw_sigheader.bin.encrypt of size 400960
[   0.1500 ] Added binary blob_spe_t234_sigheader.bin.encrypt of size 270336
[   0.1505 ] Added binary blob_tos-optee_t234_sigheader.img.encrypt of size 1064752
[   0.1512 ] Added binary blob_eks_t234_sigheader.img.encrypt of size 9232
[   0.1517 ] Added binary blob_boot0.img of size 55429120
[   0.1852 ] Added binary blob_tegra234-p3767-0000-p3768-0000-a0.dtb of size 344703
[   0.2396 ] tegrarcm_v2 --instance 1-2.2.3 --chip 0x23 0 --pollbl --download bct_mem mem_rcm_sigheader.bct.encrypt --download blob blob.bin
[   0.2406 ] BL: version 0.32.0.0-t234-54845784-57325615 last_boot_error: 0
[   0.3187 ] Sending bct_mem
[   0.3457 ] Sending blob
[   0.4456 ] ERROR: might be timeout in USB write.
Error: Return value 3
Command tegrarcm_v2 --instance 1-2.2.3 --chip 0x23 0 --pollbl --download bct_mem mem_rcm_sigheader.bct.encrypt --download blob blob.bin
Cleaning up...

flash-only.log (226.8 KB)

We may also need to check the UART log.

[0020.826] I> MB1 (version: 0.32.0.0-t234-54845784-57325615)
[0020.831] I> t234-A01-1-Silicon (0x12347) Prod
[0020.836] I> Boot-mode : Coldboot
[0020.839] I> Emulation: 
[0020.841] I> Entry timestamp: 0x00000000
[0020.845] I> last_boot_error: 0x0
[0020.848] I> BR-BCT: preprod_dev_sign: 0
[0020.852] I> rst_source: 0x0, rst_level: 0x0
[0020.856] I> Task: Bootchain select WAR set (0x5000ba65)
[0020.861] I> Task: Enable SLCG (0x5000bab1)
[0020.865] I> Task: CRC check (0x5001ea19)
[0020.869] I> Task: Initialize MB2 params (0x5000cb51)
[0020.875] I> MB2-params @ 0x40060000
[0020.878] I> Task: Crypto init (0x5001d981)
[0020.882] I> Task: Secure debug controls (0x5000c0a9)
[0020.887] I> Task: strap war set (0x5000ba2d)
[0020.891] I> Task: Initialize SOC Therm (0x5001bd35)
[0020.896] I> Task: Program NV master stream id (0x5000c05d)
[0020.901] I> Task: Verify boot mode (0xd4820f1)
[0020.907] I> Task: Alias fuses (0x5001095d)
[0020.912] W> FUSE_ALIAS: Fuse alias on production fused part is not supported.
[0020.919] I> Task: Print SKU type (0x5000f5f1)
[0020.924] I> FUSE_OPT_CCPLEX_CLUSTER_DISABLE = 0x000001c8
[0020.929] I> FUSE_OPT_GPC_DISABLE = 0x00000002
[0020.933] I> FUSE_OPT_TPC_DISABLE = 0x000000f0
[0020.937] I> FUSE_OPT_DLA_DISABLE = 0x00000003
[0020.942] I> FUSE_OPT_PVA_DISABLE = 0x00000001
[0020.946] I> FUSE_OPT_NVENC_DISABLE = 0x00000001
[0020.950] I> FUSE_OPT_NVDEC_DISABLE = 0x00000000
[0020.955] I> FUSE_OPT_FSI_DISABLE = 0x00000001
[0020.959] I> FUSE_OPT_EMC_DISABLE = 0x0000000c
[0020.963] I> FUSE_BOOTROM_PATCH_VERSION = 0x7
[0020.968] I> FUSE_PSCROM_PATCH_VERSION = 0x7
[0020.972] I> FUSE_OPT_ADC_CAL_FUSE_REV = 0x2
[0020.976] I> FUSE_SKU_INFO_0 = 0xd5
[0020.979] I> FUSE_OPT_SAMPLE_TYPE_0 = 0x3 PS 
[0020.983] I> FUSE_PACKAGE_INFO_0 = 0x2
[0020.987] I> SKU: Prod
[0020.989] I> Task: Boost clocks (0x500148a1)
[0020.993] I> Initializing PLLC2 for AXI_CBB.
[0020.997] I> AXI_CBB : src = 35, divisor = 0
[0021.001] I> Task: Voltage monitor (0x50014b49)
[0021.006] I> VMON: Vmon re-calibration and fine tuning done
[0021.011] I> Task: UPHY init (0x5000d065)
[0021.017] I> HSIO UPHY init done
[0021.020] E> Skipping GBE UPHY config
[0021.024] I> Task: Boot device init (0x50000be9)
[0021.028] I> Boot_device: RCM
[0021.031] I> USB configuration success
[0021.035] I> Task: TSC init (0x50020a4d)
[0021.039] I> Task: Load membct (0x50011fe9)
[0021.043] I> RAM_CODE 0x4000021
[0021.046] I> Loading MEMBCT 
[0021.049] I> Slot: 0
[0021.051] I> Binary[0] block-0 (partition size: 0x40000)
[0021.056] I>  get_binary_info: Binary name: MEM-BCT-0
[0021.061] I> Size of crypto header is 8192
[0021.065] I> BCH load address is : 0x40050000
[0021.069] I> Size of crypto header is 8192
[0021.073] I> BCH of MEM-BCT-0 read from storage
[0021.078] I> BCH address is : 0x40050000
[0021.082] I> MEM-BCT-0 header integrity check is success
[0021.087] I> Binary magic in BCH component 0 is MEM0
[0021.091] I> component binary type is 0
[0021.098] I> MEM-BCT-0 binary is read from storage
[0021.103] I> MEM-BCT-0 binary integrity check is success
[0021.108] I> Binary MEM-BCT-0 loaded successfully at 0x40040000 (0xe580)
[0021.115] I> RAM_CODE 0x4000021
[0021.120] I> RAM_CODE 0x4000021
[0021.124] I> Task: Load Page retirement list (0x500115b1)
[0021.129] I> Task: SDRAM params override (0x50011fc5)
[0021.134] I> Task: Save mem-bct info (0x50014fa1)
[0021.139] I> Task: Carveout allocate (0x50015005)
[0021.143] I> ECC region[0]: Start:0x0, End:0x0
[0021.148] I> ECC region[1]: Start:0x0, End:0x0
[0021.152] I> ECC region[2]: Start:0x0, End:0x0
[0021.156] I> ECC region[3]: Start:0x0, End:0x0
[0021.160] I> ECC region[4]: Start:0x0, End:0x0
[0021.165] I> Non-ECC region[0]: Start:0x80000000, End:0x80000000
[0021.171] I> Non-ECC region[1]: Start:0x0, End:0x0
[0021.175] I> Non-ECC region[2]: Start:0x0, End:0x0
[0021.180] I> Non-ECC region[3]: Start:0x0, End:0x0
[0021.184] I> Non-ECC region[4]: Start:0x0, End:0x0
[0021.195] E> BL_CARVEOUT: Failed to allocate memory of size 0x8000000 for CO:31.
[0021.202] C> Task 0x0 failed (err: 0x49490003)
[0021.206] E> Top caller module: BL_CARVEOUT, error module: BL_CARVEOUT, reason: 0x03, aux_info: 0x00
[0021.215] C> Boot Info Table status dump :
1
[0021.219] I> Busy Spin

after a min it will start reboot.

Your case looks similar to this one.

So please check if the flashing script uses the correct dtb file with no-flash.
Make sure either the board is connected and put into force recovery mode, or manually pass

BOARDID= FAB= BOARDSKU= BOARDREV=

to the flashing script.

Thanks!

I would refer that issue to solve my problem.

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