Giter Club home page Giter Club logo

jetson-nano-image-maker's Introduction

Jetson Nano Image

tl;dr; Build sd-card flashable images for Jetson Nano dev kits using Docker and Github Actions.

Problem

After buying a hobby robot and companion Jetson Nano, I wanted to update the base image for my robot and iterate on my robot software. I struggled to find a simple set of instructions and scripts that would let me create my own images and flash them to an SD card from my Mac laptop.

Nvidia privides a set of docs, scripts, and guides from their linux-for-tegra environment but I found these cumbersome to understand and modify. Some of the scripts required a linux environment to even run.

I wanted something simpler. I wanted to be able to iterate on the base image quickly, and when ready, use Github Actions to automatically build a sd-card flash ready image.

Solution

Using Docker and buildx this repository is setup to create arm64 docker images. These images can then be turned into sd-card flashable .img files using the create-image.sh script. This script use nvidia l4t scripts to configure the rootfs with the correct boot files.

Finally, all of this is automatically run with Github actions. After pushing a change to the repo, actions run and produce artifacts with .img files that I can flash to an sd-card.

Here's a screenshot of the artifact ready to download.

ci-artifacts

Once downloaded I can flash the image to the sd card.

balena

Now I'm ready to boot the nano.

Customizing

You can make your own images by forking this repo and modifying the Dockerfile. Your fork will automatically run the forked Github Actions and you'll end up with ready-to-flash images from your changes.

Credentials

The default credentials:

username: jetson
password: jetson

Local Development

One advantage of using Docker to setup the root file system is the ability to iterate locally and test your changes.

Here are a few commands you can use to work locally and make sure everything installs before you push your changes to CI.

Build the rootfs image

docker buildx build --platform linux/arm64 -t jetson-nano-image .

Run the image (without any init system)

docker run -it --rm --user 1000:1000 jetson-nano-image /bin/bash

Run the built image and invoke systemd init to see what runs on startup

docker run -it --rm --cap-add SYS_ADMIN -v /sys/fs/cgroup/:/sys/fs/cgroup:ro jetson-nano-image /sbin/init

Make a flashable image

If you are on linux, you can turn the Docker image into a flashable image

# Export the rootfs image to a folder on your file-system
# Nvidia l4t tools turn this folder into a .img file you can flash
docker export $(docker create --name nano-rootfs --platform linux/arm64 jetson-nano-image) -o rootfs.tar

mkdir -p /tmp/jetson-builder/rootfs
sudo tar --same-owner -xf rootfs.tar -C /tmp/jetson-builder/rootfs

# Create a jetson.img from the `rootfs` you can flash to an SD card
sudo -E ./create-image.sh

Supported boards:

References

This work builds upon the learnings from this great post by pythops:

Additional links

License

MIT

jetson-nano-image-maker's People

Contributors

defunctzombie avatar horzadome avatar sulaimangari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jetson-nano-image-maker's Issues

Are cuda libraries suppose to be installed?

Hello. Thank you for publishing this tool.

Question about the Dockerfile. What are the nvidia-l4t- packages installing? For example nvidia-l4t-cuda. I thought it would be the cuda libraries but I don't see them in the image. Do we install the cuda libraries differently?

Thank you

Kernel Flags

Great tool, thanks for publishing it! It works well for me in your original configuration.

However, I'm interested in doing some testing where I need specific kernel functionality (ex: CONFIG_UPROBES and CONFIG_BPF_EVENTS). I can't quite tell where I could make that sort of customization in this process. Since Docker uses the system kernel, I assume it can't be in the Dockerfile. (although I did try commenting out the NVIDIA-l4t-kernel stuff -- no change). Do you know where I could make that sort of modification? Maybe QEMU?

Thanks!

tegra lib folder wrong nvidia-tegra.conf ld.so path

As the installation title said, the image generation are wrong.

It's not /usr/lib/tegra
Tegra folder it's in /usr/lib/aarch64-linux-gnu/tegra and /usr/lib/aarch64-linux-gnu/tegra-egl

Otherwise any call to X11 or wayland GUI doesn't work will fail.

Jetson Nano with EMMC

Hello. I am interested in building my own custom image for Jetson Nano. Your approach looks very convenient. I wanted to ask if it would also work for the Jetson Nano with EMMC, as mine does not have support for sd cards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.