How can I create a custom JetPack image without Jetson HW?

Hi,

I’m trying to create a custom JetPack image, in which my software is pre-installed in root file system.
I would like to continuously create new image every-time my software gets updated using CircleCI (so I cannot plug Jetson Nano HW while creating the custom image).

I tried two ways:

1. Copy partitions (failing to boot)

  1. Create an empty image:

dd if=/dev/zero bs=1M count=$(expr 14 \* 1024) > root.img

  1. Download https://developer.download.nvidia.com/assets/embedded/downloads/jetson-nano-sd-card-image/jetpack-4.4-ga/jetson-nano-developer-kit-sd-card-image.zip and unzip it.

  2. Create 14 partitions original JetPack (sd-blob-b01.img) has.

    # APP
    parted -s root.img unit s mkpart primary – $(gdisk -l sd-blob-b01.img |grep APP |awk ‘{print $2}’) -34
    parted -s root.img unit s name 1 APP

    # TBC
    parted -s root.img unit s mkpart primary – $(gdisk -l sd-blob-b01.img |grep TBC |awk ‘{print $2 " " $3}’)
    parted -s root.img unit s name 2 TBC

  3. Byte-to-byte copy 13 non-root partitions.

    # TBC
    offset=$(gdisk -l sd-blob-b01.img |grep TBC |awk ‘{print $2}’) ; size=$(gdisk -l sd-blob-b01.img |grep TBC |awk ‘{print $3 - $2}’) ; dd conv=notrunc bs=512 skip=$offset count=$size seek=$offset if=sd-blob-b01.img of=root.img

    # RP1
    offset=$(gdisk -l sd-blob-b01.img |grep RP1 |awk ‘{print $2}’) ; size=$(gdisk -l sd-blob-b01.img |grep RP1 |awk ‘{print $3 - $2}’) ; dd conv=notrunc bs=512 skip=$offset count=$size seek=$offset if=sd-blob-b01.img of=root.img

  4. Loopback mount root filesystem (APP) and format it as ext4.

    LOOPBACK=$(losetup -f -P --show root.img)
    mkfs.ext4 -j APP ${LOOPBACK}p1
    mkdir -p /mnt/my-jetpack
    mount ${LOOPBACK}p1 -o rw /mnt/my-jetpack/

  5. Mount root filesystem of original image (sd-blob-b01.img) and copy all contents into root.img.

    LOOPBACK2=$(losetup -f -P --show sd-blob-b01.img)
    mkdir -p /mnt/orig-jetpack
    mount ${LOOPBACK2}p1 -o rw /mnt/orig-jetpack/
    cp -Rp /mnt/orig-jetpack/* /mnt/jetpack/

  6. Write root.img into SD card using Etcher.

This card does not boot Ubuntu GUI unfortunatelly.

2. Using L4T Driver Package and Sample Root Filesystem. (Succeeding in boot)

Plug my Jetson Nano Developer Kit (recovery mode) via USB.

Use https://developer.nvidia.com/embedded/L4T/r32_Release_v4.3/t210ref_release_aarch64/Tegra210_Linux_R32.4.3_aarch64.tbz2 and copy my software in rootfs, then ./flash.sh.

Resulting SD card successfully boots.
However, I cannot apply this way because I would like to use standard CircleCI.

Any help?

Sorry that we are not familiar with CircleCI. Maybe other forum users can share their experience.

@WayneWWW Sorry for confusing you.

CircleCI is not important part of my question.
My question is “how can I create a custom JetPack image with normal Linux environment (without Jetson HW)?”.

Hi,

Generally we use the tool “jetson-disk-image-creator.sh” under Linux_for_Tegra/tools.

Thanks!
I’ll have a look into it.

Does “jetson-disk-image-creator.sh” support Jetson Nano Developer Kit B01 (SKU revision number may 400)?

% sudo ./tools/jetson-disk-image-creator.sh -o my-sd-blob.img -b jetson-nano -r 400
********************************************
     Jetson Disk Image Creation Tool
********************************************
Incorrect Revision - Supported revisions - 100, 200, 300
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

yes, it supports.

I succeeded in booting my Jetson Nano Developer Kit B01 using a custom image created via command:

sudo ./tools/jetson-disk-image-creator.sh -o my-sd-blob.img -b jetson-nano -r 300

Thank you for your help.

1 Like