How to create a distributable image of a SD card for Jetson Nano

Hi,

I have setup a development system for my Jetson and I need to port / create an image of the current setup so that I can flash it into multiple SD cards which can be used in different Jetson Nano boards. Any idea how I can achieve this? I was able to clone the setup but on reading up I saw people mentioning that it is not the ideal way to create a distributable form of the setup (one which will not cause any filesystem / port issues). Any help is much appreciated.

Thanks.

You may try cloning using the same JetPack version for getting image and flashing.
I wouldn’t further comment on that, but you may also onsider using Docker for deploying your software on various L4T releases.

Please use the tool jetson-disk-image-creator.sh from your driver package. If you don’t know what is driver package, better trying sdkmanager first.

Hello @WayneWWW ,
I tried to run the jetson-disk-image-creator.sh from ‘Linux_for_Tegra’ module using sudo privileges, but it failed at ‘making boot image’. Sharing the terminal output below for your reference. Did I miss any step?

sudo ./jetson-disk-image-creator.sh -o sd-blob.img -b jetson-nano -r 300
[sudo] password for ********:


 Jetson Disk Image Creation Tool     

jetson-disk-image-creator.sh - creating signed images
~/Linux_for_Tegra ~/Linux_for_Tegra/tools
###############################################################################

L4T BSP Information:

R32 , REVISION: 5.1

###############################################################################
/home/wipro/Linux_for_Tegra/flash.sh: line 613: ./tegrarcm: cannot execute binary file: Exec format error
Board ID(3448) version(300)
copying bctfile(/home/wipro/Linux_for_Tegra/bootloader/t210ref/BCT/P3448_A00_lpddr4_204Mhz_P987.cfg)… done.
copying bootloader(/home/wipro/Linux_for_Tegra/bootloader/t210ref/cboot.bin)… done.
copying initrd(/home/wipro/Linux_for_Tegra/bootloader/l4t_initrd.img)… done.
populating kernel to rootfs… done.
populating initrd to rootfs… done.
populating /home/wipro/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0000-p3449-0000-b00.dtb to rootfs… done.
Making Boot image… failed.

Also, I’m running these on the jetson nano sd card whose image I need to create. That is okay right? I haven’t created any custom rootfs as of now.

@Honey_Patouceul , Thaks for your reply.

I didn’t understand your first point. Did you meant that I need to use the tools from the same Jetpack version to do the cloning / creating a clone of SD card which can be used in different Nanos?

On your second suggestion, we are thinking of docker too, but as we build more applications on this image we are afraid we might run into some docker dependencies or limitations. So thought we’ll try to see if we can replicate the current setup directly for now.

No, totally not ok. That driver package is for x64 ubuntu host. But not for arm64 device as jetson nano. We tell this info on the sdkmanager webstie.

@WayneWWW , So just to clarify, the only way to run that script is via host computer and through that I can create the image of the SD card?

Yes, our official sdcard image is also using this tool to create from a x64 ubuntu host.

1 Like

Ok thank you @WayneWWW . Really helpful, its clear now. Will close this and choose the solution.

Hello @WayneWWW

As you suggested, I’m trying to run do the flashing using the driver package (I can’t connect the jetson nano to host computer since i only have a micro usb to power it on. So SDK manager can’t be used). So I got the L4T driver package (folder name: Linux_for_Tegra) and upon reading ‘README_Massflash.txt’, i understood that ‘offline’ method is the way to go for me.

My doubt is 1. Is my approach correct? 2. For ‘BOARDID’ parameter in offline method for ‘nvmassflashgen.sh’ file, only ‘jetson-nano-devkit-emmc’ is mentioned. Is this applicable to the sd card version of jetson-nano also?

Edit: Some more info (providing in case if it helps). I ran the following command for my setup (jetson nano SDcard → offline mass flash method. It failed and this is the result from terminal. Can you provide some info on what I’m doing wrong? Should I build anything?

sudo BOARDID=3448 BOARDSKU=0002 FAB=200 FUSELEVEL=fuselevel_production ./nvmassflashgen.sh jetson-nano-devkit-emmc mmcblk0p1

|| Generate Massflash Image in the master host: ||
|| Requires the Jetson connected in RCM mode. ||

Generating massflash command without Jetson device connected:
BOARDID=3448 BOARDSKU=0002 FAB=200 BOARDREV= FUSELEVEL=fuselevel_production
±------------------------------------------------------------------------------
| Step 1: Generate Command File
±------------------------------------------------------------------------------
###############################################################################

L4T BSP Information:

R32 , REVISION: 5.1

###############################################################################
Board ID(3448) version(200)
copying bctfile(/home/cvlab/Documents/Linux_for_Tegra/bootloader/t210ref/BCT/P3448_A00_lpddr4_204Mhz_P987.cfg)… done.
copying bootloader(/home/cvlab/Documents/Linux_for_Tegra/bootloader/t210ref/cboot.bin)… done.
copying initrd(/home/cvlab/Documents/Linux_for_Tegra/bootloader/l4t_initrd.img)… done.
populating kernel to rootfs… done.
populating initrd to rootfs… done.
populating /home/cvlab/Documents/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0002-p3449-0000-a02.dtb to rootfs… done.
Making Boot image… done.
Existing sosfile(/home/cvlab/Documents/Linux_for_Tegra/bootloader/nvtboot_recovery.bin) reused.
copying tegraboot(/home/cvlab/Documents/Linux_for_Tegra/bootloader/t210ref/nvtboot.bin)… done.
copying cpu_bootloader(/home/cvlab/Documents/Linux_for_Tegra/bootloader/t210ref/cboot.bin)… done.
copying bpffile(/home/cvlab/Documents/Linux_for_Tegra/bootloader/t210ref/sc7entry-firmware.bin)… done.
Existing badpagefile(/home/cvlab/Documents/Linux_for_Tegra/bootloader/badpage.bin) reused.
copying wb0boot(/home/cvlab/Documents/Linux_for_Tegra/bootloader/t210ref/warmboot.bin)… done.
Existing tosfile(/home/cvlab/Documents/Linux_for_Tegra/bootloader/tos-mon-only.img) reused.
Existing eksfile(/home/cvlab/Documents/Linux_for_Tegra/bootloader/eks.img) reused.
copying dtbfile(/home/cvlab/Documents/Linux_for_Tegra/kernel/dtb/tegra210-p3448-0002-p3449-0000-a02.dtb)… done.
Copying nv_boot_control.conf to rootfs
sed: can’t read /home/cvlab/Documents/Linux_for_Tegra/rootfs/etc/nv_boot_control.conf: Not a directory
sed: can’t read /home/cvlab/Documents/Linux_for_Tegra/rootfs/etc/nv_boot_control.conf: Not a directory
sed: can’t read /home/cvlab/Documents/Linux_for_Tegra/rootfs/etc/nv_boot_control.conf: Not a directory
sed: can’t read /home/cvlab/Documents/Linux_for_Tegra/rootfs/etc/nv_boot_control.conf: Not a directory
sed: can’t read /home/cvlab/Documents/Linux_for_Tegra/rootfs/etc/nv_boot_control.conf: Not a directory
sed: can’t read /home/cvlab/Documents/Linux_for_Tegra/rootfs/etc/nv_boot_control.conf: Not a directory
sed: can’t read /home/cvlab/Documents/Linux_for_Tegra/rootfs/etc/nv_boot_control.conf: Not a directory
sed: can’t read /home/cvlab/Documents/Linux_for_Tegra/rootfs/etc/nv_boot_control.conf: Not a directory
Making system.img…
/home/cvlab/Documents/Linux_for_Tegra/rootfs/boot/extlinux/extlinux.conf is not found, exiting…
*** ERROR: flashcmd.txt generation failed.

Did you ever prepare the root file system from download center too? it looks like you didn’t do it.

If you cannot understand how to use rootfs, check the quick start guide from download center.

Hello @WayneWWW ,

Thanks for reply and thank you for being patient.

I’m a bit confused. I’ll explain the roadblocks I have now and hopefully you can tell me what I’m doing wrong/what i should be doing.

As you suggested, I went through the the developer docs (on flashing: Tegra Linux Driver ). I followed the steps in SD card flashing and ended up as I’ve mentioned in the previous post. I also noticed that under ‘Flashing for USB’, there is a section which mentions about jetson nano sd card module, on creating a rootfs using a script ‘l4t_payload_updater_t210.py’. But the next step requires it to connect my nano which as I mentioned above, I’m unable to do since I don’t have a jack connector to power up nano.

I’ll summarise my setup. Requirement is to duplicate/clone my SD card environment. For this I can use ‘jetson-disk-image-creator.sh’ script but this needs to be run in host computer (as you mentioned above). I don’t have a jack connector so I’ve inserted the SD card into my host computer (via card reader) and I’m following the ‘Offline’ method mentioned in the ‘README_Massglash.txt’ which was found in ‘Linux_for_Tegra’ fodler which I downloaded in my host computer. The output is what I’ve shared in the last post.

I’m confused on the rootfs creation part (if it is the cause of the error). Should I create a custom rootfs on jetson nano or via host computer with SD card inserted into it? Also, how can I achieve this, creating rootfs? Any info or link which can help me out would be good.

There are two parts that need to prepare on your host.

  1. The tegra linux driver (L4T). Which is in this link.
  1. Another file is the rootfs. We have a sample rootfs here.
  1. For the steps to put this rootfs to your driver package, please refer to quick start guide.

Or actually you don’t need to prepare those things because sdkmanager would prepare one on your host once you use it.

  1. The jetson-disk-image-creator.sh will use the rootfs in (3) to create a system.img. And it will put this system.img to your sdcard image. Thus, if you want to customize something, you can put it into the rootfs. But please be careful that it has to be a arm64 arch binary.
1 Like

Thank you @WayneWWW , this was very helpful. I was able to build the rootfs.

But one step, which I’m facing trouble is that the steps mentioned in the docs are specifically for device (jetson nano, for me) connected to host computer. Now, since I am unable to connect the device and is using the Jetson Nano devkit with SD card, from the ‘README_Massflash.txt’ file I came to conclusion that I have to use the ‘Offline’ method. Problem is in the list of devices in that file (which provides the corresponding values for BOARDID, BOARDSKU, FAB & BOARDREV), only ‘jetson-nano-devkit-emmc’ is present. So my question is, Is it okay to use ‘jetson-nano-devkit-emmc’ for offline creation of Massflash image when my board is Jetson Nano with SD card? Please let me know if you need any further clarification on the question.

Additional info: I created the image using the following command:
sudo BOARDID=3448 BOARDSKU=0002 FAB=200 FUSELEVEL=fuselevel_production ./nvmassflashgen.sh jetson-nano-devkit-emmc mmcblk0p1

My SD card is mounted as ‘mmcblk0p1’ and the additional values are from the ‘README_Massflash.txt’ and for ‘jetson-nano-devkit-emmc’ board. I was able to create the ‘mfi_jetson-nano-devkit-emmc.tbz2’ but the console has info which said ‘4. Connect Jetson boards(jetson-nano-devkit-emmc only) and put them in RCM mode.’ So is it safe to use for flashing this image on SD card? If not, could you tell me how I can create a similar image for SD card mounted or is it even possible?

I really appreciate your time, you’ve been very helpful.

I don’t know whether the create sdcard image script can be used for offline case or not. But following the massflash tool is not correct. We don’t support massflash tool on sdcard based nano.

Please find a power jack for your board.

1 Like

Alright, understood. Thank you @WayneWWW