How to clone Jetson Nano SD Card?

Dear Sir,

I have installed certain libraries on my jetson nano board ( Jetpack 4.3 )
I have used 32GB SD card.

I want to make a copy of this sd card which can be used in different nano board (and I don’t need to install the libraries again)

How can I get my custom image ?
Will I do this on my local desktop machine ? or on Nano itself ?

Please help

My answer, FWIW, is there is no safe way to clone an SD card. The ideal way is to customize the Linux_for_Tegra/rootfs (eg, with chroot and qemu-user-static), then run Linux_for_Tegra/apply_binaries.sh and then flash or create a SD card image from that rootfs using either Linux_for_Tegra/flash.sh or the image creation script in Linux_for_Tegra/tools

Linux_for_Tegra in the download paths created by SDK manager or by extracting the BSP tarball. If you want to customize the rootfs, you must also extract the rootfs tarball at the path specified. These files should be extracted on a linux desktop machine.

Please see the developer documentation for detailed instructions on rootfs customization. Chroot is not covered, I believe, but you can ask here if you need help installing a package on the rootfs prior to flash.

The reason it’s not safe to clone an SD card is becuase certain things are set on first boot that must remain unique or you will have network and security issues (eg. identical ssh host keys). This applies to any platform. There are tools that can strip out the unique bits, but none are perfect and none that I know of exist for Tegra.

Hi @mdegans
I am not having a linux desktop, I just have a windows 10 laptop.
I have built an AI software and wish to use it in production. For this, I need to make copies of my sd card.
I am not getting how to do so.
Shall I dual boot my system and install linux and do whatever you are saying or is there any readymade tool available ?
Or shall use pyinstaller to bundle my project ?

I am confused

I am not having a linux desktop, I just have a windows 10 laptop.

A virtual machine will work to master an image using the above documentation. You cannot use it for flashing, but you can make an image, copy it to windows, and flash it with etcher. You can probably use WLS2 for this, multipass, or your own VM solution. The procedure for installing SDK Manager or extracting the tarballs should be the same as on a bare metal Linux machine. Dual Boot is probably the better option, since there is more testing and you can flash directly that way should you obtain a production module.

Or shall use pyinstaller to bundle my project ?

If your project is a python project, I would recommend just making a setup.py as usual, uploading to pypi (or github) and using pip to install and update your software on the deployed machines. How to do this is identical to x86. If you need your software pre-installed, you will still need to go through the above procedure mastering the image. I have never tested pyinstaller on aarch64, but you can try that if you prefer.

I need to make copies of my sd card.
I am not getting how to do so.

So, the idea is you customize the rootfs with chroot and qemu-user-static. This lets you modify the rootfs as if it were running on a Nano, but before the first boot scripts are executed. You use these tools and the scripts provided by Nvidia to master an image, which you then flash onto many cards of any size. Once you’ve either installed SDK Manager or downloaded and extracted the appropriate tarballs on a Linux/machine or VM, let me know and I’ll walk you through installing your software on the rootfs and mastering a .img you can flash with Etcher on any platform.

FYI: the Development kit is not production ready, and I believe the license prohibits it’s use at scale. You must use the production module if you intend to do that. That does require a bare metal linux install (dual boot) since it has no SD card slot and you must flash it directly.

Hi @mdegans, thank you for your reply

  1. I have installed Virtual Machine
  2. I was able to successfully access my sd card from VM Ubuntu 18.04
  3. I ran the command ```
    sudo dd if=/dev/mmcblk1 of=clone_image.bin bs=512
 It created a bin file but it cannot be burned on sd card directly. 

Please guide me how can I create an image file which I could directly burn using balena etcher ( I have no issues of my password being shared )

It would be great if you provide me any tutorial link or we can connect over a video call 
My what's app number:  +918004006979
Gmail:  thecodebugged@gmail.com

Thanks in advance

The inverse, assuming you have a new SD card at mmcblk1 which you are ok with overwriting (first “cd” to the directory of “clone_image.bin”):
sudo dd if=clone_image.bin of=/dev/mmcblk1 bs=512

Incidentally, you could speed this up a bit by using a larger buffer, e.g.:
sudo dd if=clone_image.bin of=/dev/mmcblk1 bs=1M

dd can be used to recover data from a failing drive, and in that cause you’d use a smaller block size, perhaps even down to a byte. Smaller buffers mean less lost during a recovery of failing media, but if the media is good, then you might as well use a larger buffer.

Hi @linuxdev

I want to create an .img file which could be flashed on jetson nano using Balena Etcher.

An image created via dd can be used to flash via Etcher. dd and Etcher do the same thing. You could clone with dd, and restore with Etcher; or you could clone with Etcher, and restore with dd (assuming you have the SD card where you an read it via Etcher). The entire SD card might have a different number, but “/dev/mmcblk1” will refer to an entire image or an entire SD card.

Just to emphasize, the SD will have more than one partition. Creating a clone of the whole SD is just a file of binary data so far as tools are concerned.

@linuxdev
Sorry but I am not able to burn it on SD card ( the .bin file not bootable)
When I am creating the image and trying to burn using etcher, it is showing partition error.

Hi @mdegans
Please help me further

  1. I have installed Virtual Machine
  2. I was able to successfully access my sd card from VM Ubuntu 18.04
  3. I ran the command

sudo dd if=/dev/mmcblk1 of=clone_image.bin bs=512

It created a bin file but it cannot be burned on sd card directly.

Please guide me how can I create an image file which I could directly burn using balena etcher ( I have no issues of

Sorry for the delay. I will make a walkthrough and guide you through in a few hours.

Ok. So you want to master an image that can be flashed onto an SD card of any size with your own software pre-installed? No problem. I’m going to do this with you in this thread rather than write something all at once so others can follow along.

First, let’s prep a VM. You’ve already done this part, but i’ll put this for the benefit of others. I’m going to use multipass since it’s the easiest way I know of to start an Ubuntu VM and works on every platform.

After installing it:

multipass launch -c $(nproc) -d 64G -m 8G -n tegra-image-maker bionic
  • If you’re not on Linux, substitute $(nproc) with the number of cpus on your system.
  • If you don’t have 8G of free memory, 4G will probably work.

That creates a new ubuntu vm with access to all cpus on the system, a 64G disk, 8G of ram, named tegra-image-maker, using ubuntu bionic (18.04). As of writing, bionic is the default anwyay, but this will change.

It may take a while to start the VM.

When it’s done, we can enter it like this:

 $ multipass exec tegra-image-maker bash
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

ubuntu@tegra-image-maker:~$ 

Next, we’ll update the VM.

sudo apt update && sudo apt dist-upgrade -y --autoremove

If you get any interactive menu prompts, select “install the package maintainer’s version”.

Next, let’s install some software we’ll need to build a system image. I will probably forget some stuff here, so i’ll edit this to add things as we discover what’s missing later.

Off the top of my head, for what we’re doing, we probably only need qemu-user-static, so let’s install that. Note: building the kernel will require an arm toolchain, but we’re going to use the pre-compiled kernel and modules by Nvidia.

sudo apt install qemu-user-static binfmt-support

Let me know when you’re caught up @sarthak.srivastava14apr , and we’ll continue.

1 Like

@mdegans
Done till here
What to do now ?

So, I haven’t heard back @sarthak.srivastava14apr (ninja’d) but for the benefit of others (if there are any interested in this), let’s continue. I’m roughly following the guide from nvidia here for flashing, if anybody is curious as to where these instructions are coming from.

So the next step is to download and extract the BSP tarball and the rootfs tarball. This will unpack what SDK manager installs ( only without SDK manager :P ). For platforms other than Nano, or if you’re reading this when 32.4.3 is not the current release, you’ll want to use a different tarballs available here.

downloading:

ubuntu@tegra-image-maker:~$ wget https://developer.nvidia.com/embedded/L4T/r32_Release_v4.3/t210ref_release_aarch64/Tegra210_Linux_R32.4.3_aarch64.tbz2
--2020-07-15 11:13:46--  https://developer.nvidia.com/embedded/L4T/r32_Release_v4.3/t210ref_release_aarch64/Tegra210_Linux_R32.4.3_aarch64.tbz2
Resolving developer.nvidia.com (developer.nvidia.com)... 152.199.0.24
Connecting to developer.nvidia.com (developer.nvidia.com)|152.199.0.24|:443... connected.
HTTP request sent, awaiting response... 302 Found
...
Tegra210_Linux_R32.4.3_aarch 100%[==============================================>] 230.84M  79.8MB/s    in 2.9s    

2020-07-15 11:13:50 (79.8 MB/s) - â saved [242054516/242054516]

ubuntu@tegra-image-maker:~$ wget https://developer.nvidia.com/embedded/L4T/r32_Release_v4.3/t210ref_release_aarch64/Tegra_Linux_Sample-Root-Filesystem_R32.4.3_aarch64.tbz2
--2020-07-15 11:14:00--
...
Tegra_Linux_Sample-Root-File 100%[==============================================>]   1.25G  89.8MB/s    in 16s     

2020-07-15 11:14:17 (80.6 MB/s) - â saved [1342963536/1342963536]

extraction:

ubuntu@tegra-image-maker:~$ tar -xf Tegra210_Linux_R32.4.3_aarch64.tbz2
ubuntu@tegra-image-maker:~$ sudo chown root:root Linux_for_Tegra/rootfs/
ubuntu@tegra-image-maker:~$ sudo rm Linux_for_Tegra/rootfs/README.txt 
ubuntu@tegra-image-maker:~$ cd Linux_for_Tegra/rootfs/
ubuntu@tegra-image-maker:~/Linux_for_Tegra/rootfs$ sudo tar -xpf ../../Tegra_Linux_Sample-Root-Filesystem_R32.4.3_aarch64.tbz2 

Next step will be to mount your sd card, or a live nano, and copy your software into the rootfs. Let me know when you’re ready.

So, the next step it so enter an environment where it’s possible to edit the rootfs. The easiest way to install a python package globally is with either apt-get or pip. Assuming your project is on pypi or GitHub and has a setup.py, it can be installed this way.

First, let’s download a chroot script which will let us enter the rootfs.

ubuntu@tegra-image-maker:~$ git clone https://github.com/mdegans/enter_chroot.git
ubuntu@tegra-image-maker:~$ sudo cp enter_chroot/enter_chroot.sh /usr/bin/

Now that the script is installed, let’s enter the rootfs and run the arch command to test we can execute aarch64 binaries.

ubuntu@tegra-image-maker:~$ sudo enter_chroot.sh Linux_for_Tegra/rootfs/
+ cp /usr/bin/qemu-aarch64-static Linux_for_Tegra/rootfs//usr/bin
+ mount -t sysfs -o ro none Linux_for_Tegra/rootfs//sys
+ mount -t proc -o ro none Linux_for_Tegra/rootfs//proc
+ mount -t tmpfs none Linux_for_Tegra/rootfs//tmp
+ mount -o bind,ro /dev Linux_for_Tegra/rootfs//dev
+ mount -t devpts none Linux_for_Tegra/rootfs//dev/pts
+ mount -o bind,ro /etc/resolv.conf Linux_for_Tegra/rootfs//run/resolvconf/resolv.conf
+ chroot Linux_for_Tegra/rootfs/
root@tegra-image-maker:/# arch
aarch64
root@tegra-image-maker:/# 

You’re now in a “virtual nano” of sorts you can use to install software from apt repositories or from pip as if you were on the device itself. There are some limitations to what you can do (example, using the GPU is not possible), however simple things like apt or pip will usually work fine. As a example, I’m going to install one of my own python packages, mce.

Apt update and apt install pip3 since it’s not installed by default:

Note: sudo is not needed since we’re already root (in fact it may cause warnings/errors in this case).

root@tegra-image-maker:/# apt update
...
144 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@tegra-image-maker:/# apt install python3-pip
...
Setting up python3.6-dev (3.6.9-1~18.04ubuntu1) ...
Setting up libpython3-dev:arm64 (3.6.7-1~18.04) ...
Setting up python3-dev (3.6.7-1~18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

Then install the python package itself, which, since we’re root will install to a system python path.

root@tegra-image-maker:/# pip3 install mce
Collecting mce
  Downloading https://files.pythonhosted.org/packages/cc/34/017ffa686b1e5f1e35e4828400bb406c5d57188c978be86f11512aff833f/mce-0.1.3.tar.gz
Building wheels for collected packages: mce
  Running setup.py bdist_wheel for mce ... done
  Stored in directory: /home/ubuntu/.cache/pip/wheels/65/93/26/6ca68cc28171db6639be1dfd917e2747c8d64e76bbf83d28c9
Successfully built mce
Installing collected packages: mce
Successfully installed mce-0.1.3

Note: If a package is available in the apt repos, you should usually prefer that, since they’re tested to play nice with other system pakages.
Note2: For reasons, pip created a /home/ubuntu folder. that sould be deleted with rm -rf /home/ubuntu (from within the chroot)
Note3: Mce will not actually work for several reasons, (deepstream is not installed and it hasnt’ been updated to work with DS 5.0)

When you’re done, just type exit to exit the chroot.

root@tegra-image-maker:/home# exit
exit
+ umount Linux_for_Tegra/rootfs//sys
+ umount Linux_for_Tegra/rootfs//proc
+ umount Linux_for_Tegra/rootfs//tmp
+ umount Linux_for_Tegra/rootfs//dev/pts
+ umount Linux_for_Tegra/rootfs//dev
+ umount Linux_for_Tegra/rootfs//run/resolvconf/resolv.conf
+ rm Linux_for_Tegra/rootfs//usr/bin/qemu-aarch64-static

@sarthak.srivastava14apr Let me know if that helps, or if you need any help creating a setup.py so you can package and pip install your thing. Alternatively you can just copy your files to a python path of choice, but you won’t be able to as easily uninstall/upgrade your software that way.

Note on apt-get and nvidia software: if you need to apt install any Nvidia software from their apt repos on a custom rootfs (not the one you extracted), you will need to install nvidia’s apt key and create a nvidia sources.list. If anybody is needs help with that, please ask.

Tomorrow, I’ll write a post on mastering a .img from this prepared rootfs. If you’re going to make an image for multple platforms, now might be a good time to tarball up your rootfs since the next step will apply board specific changes to the rootfs. Right now the rootfs should work on any Tegra device. Also, if something goes wrong, you have a backup.

that is a great approach that is defined above;
it is ipmortant, however, to make sure that if an image is taken from the entire sdcard [!not from a single partition], then it will need to be restored to the entire sdcard, not to a partition. Doing otherwise would cause e.g partitioning error. Typically an entire sdcard is something like mmcblk0 and partition is smth. like mmcblk0p1.

somre reference reading

upd: running dd from virtual machine doesn’t seem correct;
ubuntu usblive drive should do better

@Andrey1984

I don’t plan on dd’ing from the VM, but it should work fine so long as a block device is passed through. I wouldn’t trust it without some sort of verification pass (i don’t anyway).

So. The next step once you’ve setup your rootfs the way you like it is to follow these instructions here. to apply binaries (kernel, modules, optional debian packages) to the rootfs. All we have to do at this point is to run apply_binaries.sh:

ubuntu@tegra-image-maker:~/Linux_for_Tegra$ sudo ./apply_binaries.sh 
Using rootfs directory of: /home/ubuntu/Linux_for_Tegra/rootfs
/home/ubuntu/Linux_for_Tegra/nv_tegra/nv-apply-debs.sh
Root file system directory is /home/ubuntu/Linux_for_Tegra/rootfs
Copying public debian packages to rootfs
Start L4T BSP package installation
QEMU binary is not available, looking for QEMU from host system
Found /usr/bin/qemu-aarch64-static
Installing QEMU binary in rootfs
~/Linux_for_Tegra/rootfs ~/Linux_for_Tegra
Installing BSP Debian packages in /home/ubuntu/Linux_for_Tegra/rootfs
Selecting previously unselected package nvidia-l4t-core.
(Reading database ... 122305 files and directories currently installed.)
Preparing to unpack .../nvidia-l4t-core_32.4.3-20200625213809_arm64.deb ...
Pre-installing... skip compatibility checking.
Unpacking nvidia-l4t-core (32.4.3-20200625213809) ...
Setting up nvidia-l4t-core (32.4.3-20200625213809) ...
Selecting previously unselected package jetson-gpio-common.
(Reading database ... 122349 files and directories currently installed.)
Preparing to unpack .../jetson-gpio-common_2.0.8_arm64.deb ...
Unpacking jetson-gpio-common (2.0.8) ...
Selecting previously unselected package python-jetson-gpio.
Preparing to unpack .../python-jetson-gpio_2.0.8_arm64.deb ...
Unpacking python-jetson-gpio (2.0.8) ...
Selecting previously unselected package python3-jetson-gpio.
Preparing to unpack .../python3-jetson-gpio_2.0.8_arm64.deb ...
Unpacking python3-jetson-gpio (2.0.8) ...
Selecting previously unselected package nvidia-l4t-3d-core.
Preparing to unpack .../nvidia-l4t-3d-core_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-3d-core (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-apt-source.
Preparing to unpack .../nvidia-l4t-apt-source_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-apt-source (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-camera.
Preparing to unpack .../nvidia-l4t-camera_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-camera (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-configs.
Preparing to unpack .../nvidia-l4t-configs_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-configs (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-cuda.
Preparing to unpack .../nvidia-l4t-cuda_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-cuda (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-firmware.
Preparing to unpack .../nvidia-l4t-firmware_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-firmware (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-graphics-demos.
Preparing to unpack .../nvidia-l4t-graphics-demos_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-graphics-demos (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-gstreamer.
Preparing to unpack .../nvidia-l4t-gstreamer_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-gstreamer (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-init.
Preparing to unpack .../nvidia-l4t-init_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-init (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-initrd.
Preparing to unpack .../nvidia-l4t-initrd_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-initrd (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-jetson-io.
Preparing to unpack .../nvidia-l4t-jetson-io_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-jetson-io (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-multimedia-utils.
Preparing to unpack .../nvidia-l4t-multimedia-utils_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-multimedia-utils (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-multimedia.
Preparing to unpack .../nvidia-l4t-multimedia_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-multimedia (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-oem-config.
Preparing to unpack .../nvidia-l4t-oem-config_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-oem-config (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-tools.
Preparing to unpack .../nvidia-l4t-tools_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-tools (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-wayland.
Preparing to unpack .../nvidia-l4t-wayland_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-wayland (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-weston.
Preparing to unpack .../nvidia-l4t-weston_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-weston (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-x11.
Preparing to unpack .../nvidia-l4t-x11_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-x11 (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-xusb-firmware.
Preparing to unpack .../nvidia-l4t-xusb-firmware_32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-xusb-firmware (32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-kernel-dtbs.
Preparing to unpack .../nvidia-l4t-kernel-dtbs_4.9.140-tegra-32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-kernel-dtbs (4.9.140-tegra-32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-kernel-headers.
Preparing to unpack .../nvidia-l4t-kernel-headers_4.9.140-tegra-32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-kernel-headers (4.9.140-tegra-32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-kernel.
Preparing to unpack .../nvidia-l4t-kernel_4.9.140-tegra-32.4.3-20200625213809_arm64.deb ...
Unpacking nvidia-l4t-kernel (4.9.140-tegra-32.4.3-20200625213809) ...
Selecting previously unselected package nvidia-l4t-bootloader.
Preparing to unpack .../nvidia-l4t-bootloader_32.4.3-20200625213809_arm64.deb ...
Pre-installing bootloader package, skip flashing
Unpacking nvidia-l4t-bootloader (32.4.3-20200625213809) ...
Setting up jetson-gpio-common (2.0.8) ...
Setting up python-jetson-gpio (2.0.8) ...
Setting up python3-jetson-gpio (2.0.8) ...
Setting up nvidia-l4t-apt-source (32.4.3-20200625213809) ...
Pre-installing... skip changing source list.
Setting up nvidia-l4t-configs (32.4.3-20200625213809) ...
Setting up nvidia-l4t-firmware (32.4.3-20200625213809) ...
Setting up nvidia-l4t-init (32.4.3-20200625213809) ...
Setting up nvidia-l4t-multimedia-utils (32.4.3-20200625213809) ...
Setting up nvidia-l4t-oem-config (32.4.3-20200625213809) ...
Setting up nvidia-l4t-tools (32.4.3-20200625213809) ...
Setting up nvidia-l4t-wayland (32.4.3-20200625213809) ...
Setting up nvidia-l4t-weston (32.4.3-20200625213809) ...
Setting up nvidia-l4t-x11 (32.4.3-20200625213809) ...
Setting up nvidia-l4t-xusb-firmware (32.4.3-20200625213809) ...
Pre-installing xusb firmware package, skip flashing
Setting up nvidia-l4t-kernel (4.9.140-tegra-32.4.3-20200625213809) ...
Setting up nvidia-l4t-bootloader (32.4.3-20200625213809) ...
Pre-installing bootloader package, skip flashing
Setting up nvidia-l4t-3d-core (32.4.3-20200625213809) ...
Setting up nvidia-l4t-cuda (32.4.3-20200625213809) ...
Setting up nvidia-l4t-graphics-demos (32.4.3-20200625213809) ...
Setting up nvidia-l4t-initrd (32.4.3-20200625213809) ...
Setting up nvidia-l4t-jetson-io (32.4.3-20200625213809) ...
Setting up nvidia-l4t-multimedia (32.4.3-20200625213809) ...
Setting up nvidia-l4t-kernel-dtbs (4.9.140-tegra-32.4.3-20200625213809) ...
Setting up nvidia-l4t-kernel-headers (4.9.140-tegra-32.4.3-20200625213809) ...
Unpacking kernel headers...
Setting up nvidia-l4t-camera (32.4.3-20200625213809) ...
Setting up nvidia-l4t-gstreamer (32.4.3-20200625213809) ...
Processing triggers for nvidia-l4t-kernel (4.9.140-tegra-32.4.3-20200625213809) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
~/Linux_for_Tegra
Removing QEMU binary from rootfs
Removing stashed Debian packages from rootfs
L4T BSP package installation completed!
Rename ubuntu.desktop --> ux-ubuntu.desktop
Copying USB device mode filesystem image to /home/ubuntu/Linux_for_Tegra/rootfs
Disabling NetworkManager-wait-online.service
Disable the ondemand service by changing the runlevels to 'K'
Installing extlinux.conf into /boot/extlinux in target rootfs
Success!

Bam. And Nvidia’s kernel, modules, and debian packages get installed using the same techinque as we used above (the script runs dpkg in a chroot). At the above link there are detailed instructions on customizing those bits if you need to.

The last step is to master the card image.

Apparently, python needs to be installed or it’ll complain about a missing “signed” dir so we’ll

sudo apt install python

and finally, to create the image itself:

ubuntu@tegra-image-maker:~/Linux_for_Tegra/tools$ sudo ./jetson-disk-image-creator.sh -o sdcard.img -b jetson-nano -r 200

You’ll find a sdcard.img in the path you ran that script.

If your board revision is not 200, or you have a Xavier NX, you will need to adjust the above command accordingly. Help (currently) is as folows, but if you’re reading this in the future you should check with --help anyway.

ubuntu@tegra-image-maker:~/Linux_for_Tegra/tools$ ./jetson-disk-image-creator.sh --help
********************************************
     Jetson Disk Image Creation Tool     
********************************************
ERROR: This script requires root privilege
Usage:
jetson-disk-image-creator.sh -o <sd_blob_name> -b <board> -r <revision>
        sd_blob_name    - valid file name
        board           - board name. Supported boards are:
                           jetson-nano
                           jetson-xavier-nx-devkit
        revision        - SKU revision number
                           jetson-nano: 100/200/300 for A01/A02/B00
                           jetson-xavier-nx-devkit: default
Example:
jetson-disk-image-creator.sh -o sd-blob.img -b jetson-nano -r 300
jetson-disk-image-creator.sh -o sd-blob.img -b jetson-xavier-nx-devkit

And there you have it. You can copy sdcard.img to your host (or wherever) and flash it on a SD card with Etcher, and it will include your software pre-installed.

1 Like

Hope that helps, @sarthak.srivastava14apr

If you need help customizing the kernel or modules, lmk. There’s another thread that I did on that but it’s a bit out of date.

1 Like