Having been a long time fan of SparkFun, any probably most of us in the Electronics and maker space, have at least at some point, seen Shawn with his bright red bow-tie and wonderful Video content.
Couple weeks ago, I decided to dust of an older Jetson Xavier Nano but stumbled on a post by Shawn featuring a more up to date "Orin Nano". Price wise, the 8GB model was more accessible as I'm still just playing around in the ML space, and it is a decent starter platform.
Since my board was to run the latest Jetpack v6.x I realised (with Shawn's help) I would need to use the SDK Manager approach, and this involves running Ubuntu 22.04 LTS.
You can skip through to the video on my new "spin off" channel called Crusty Engineer.
A few hours later...
Booting of a live CD (sorry, USB stick!) should be easy right? well, not if you're using one that failed many moons ago. Taking over 3 mins and the mouse stuttering lead me to using a working one from my pile of USB drives. Unhappy that I've already wasted time, I then ran into a "
/cow
" doesn't have enough space issue, with cow
being the "/" root path.I remembered I had some spare 2TB SSDs and found a spare StarTech 2.5" USB Dock, and it wasn't too long before I was able to install a fresh copy of Ubuntu 22.04 onto the SSD and, well, I'm composing this very post on this new system.
Installing the SDK Manager
Shawn also has a great post detailing how to set about this process, so I thought I'd would fill in a few hurdles that I ran into. The first one was related to setting about installing the SDK Manager. This was resolved by adding the correct repositories to pull in the
libcanberra-gtk-module
dependency sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe multiverse"
apt update -y
apt install libcanberra-gtk-module
apt --fix-broken install
dpkg --install sdkmanager_2.1.0-11682_amd64.deb
Flashing the Orin Nano board
This proved to be a bit more painful as I was left with a cryptic log
13:11:04.647 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0803 ] tegrasign_v3.py --key None --list mb1_bct_MB1_aligned_sigheader.bct_list.xml --pubkeyhash pub_key.key --sha sha512
13:11:04.647 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0804 ] Assuming zero filled SBK key
13:11:04.647 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS:
13:11:04.809 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0810 ] Warning: pub_key.key is not found
13:11:04.809 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0808 ] tegrahost_v2 --chip 0x23 0 --updatesigheader mb1_bct_MB1_aligned_sigheader.bct.encrypt mb1_bct_MB1_aligned_sigheader.bct.hash zerosbk
13:11:04.809 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0812 ] Info: Skip generating mem_bct because sdram_config is not defined
13:11:04.809 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0812 ] Info: Skip generating mem_bct because sdram_config is not defined
13:11:04.809 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0812 ] Copying signatures
13:11:04.809 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0813 ] tegrahost_v2 --chip 0x23 0 --partitionlayout readinfo_t234_min_prod.xml.bin --updatesig images_list_signed.xml
13:11:04.810 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0851 ] mb1_t234_prod_aligned_sigheader.bin.encrypt filename is from images_list
13:11:04.810 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0852 ] psc_bl1_t234_prod_aligned_sigheader.bin.encrypt filename is from images_list
13:11:04.810 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0852 ] Boot Rom communication
13:11:04.810 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0853 ] tegrarcm_v2 --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
13:11:04.810 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.0855 ] BR_CID: 0x80012344705DE8018000000010020200
13:11:04.810 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS:
13:11:04.810 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS:
13:11:04.964 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.2429 ] Sending bct_br
13:11:04.965 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS:
13:11:15.165 - error: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ 0.3982 ] ERROR: might be timeout in USB write.
13:11:15.165 - info: Event: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS - error is: [ 0.3982 ] ERROR: might be timeout in USB write.
13:11:15.165 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS:
13:11:15.169 - error: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: Error: Return value 3
13:11:15.169 - info: Event: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS - error is: Error: Return value 3
13:11:15.169 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: Command tegrarcm_v2 --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
13:11:15.169 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS:
13:11:15.173 - error: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: --- Error: Reading board information failed.
13:11:15.173 - info: Event: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS - error is: --- Error: Reading board information failed.
13:11:15.174 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS:
13:11:15.174 - error: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: *** ERROR: Parsing boardid failed
13:11:15.174 - info: Event: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS - error is: *** ERROR: Parsing boardid failed
13:11:15.174 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS:
13:11:15.175 - error: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [exec_command]: /bin/bash -c /tmp/tmp_NV_L4T_FLASH_JETSON_LINUX_COMP.mdesilva.sh; [error]: *** ERROR: Parsing boardid failed
13:11:15.175 - info: Event: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS - error is: [exec_command]: /bin/bash -c /tmp/tmp_NV_L4T_FLASH_JETSON_LINUX_COMP.mdesilva.sh; [error]: *** ERROR: Parsing boardid failed
13:11:15.175 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS:
13:11:15.175 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS:
13:11:15.175 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ Component Install Finished with Error ]
13:11:15.176 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [host] [ Disk Avail on Partition : 0.00 B ]
13:11:15.176 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: [ NV_L4T_FLASH_JETSON_LINUX_COMP Install took 11s ]
13:11:15.178 - info: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS:
13:11:15.178 - error: command error code: 11
13:11:15.178 - info: Event: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS - error code is: 1011
13:11:15.178 - error: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS: command terminated with error
13:11:15.178 - info: Event: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS - error is: command terminated with error
13:11:15.180 - info: Event: NV_L4T_FLASH_JETSON_LINUX_COMP@JETSON_ORIN_NANO_TARGETS - install ended - failure
The only clue was that it seemed to have some issue with USB connectivity, and this took a bit of searching and careful reading through, until I spotted this in a forum post
sudo -s
echo -1 > /sys/module/usbcore/parameters/autosuspend
Installing jetson-stats (jtop)
Normally, I reach for
htop
or glances but I stumbled on jtop
, and boy, this is on steroids! Make sure to install this as the info panel is a gold mine of details. Installing CUDA Toolkit
Grab the CUDA toolkit although the commands may need tweaking, later into the future. We need the cross-compiled version to match
aarch64-jetson
to match the architecture of our Orin Nano. wget https://developer.download.nvidia.com/compute/cuda/12.5.1/local_installers/cuda-repo-cross-aarch64-ubuntu2204-12-5-local_12.5.1-1_all.deb
sudo dpkg -i cuda-repo-cross-aarch64-ubuntu2204-12-5-local_12.5.1-1_all.deb
sudo cp /var/cuda-repo-cross-aarch64-ubuntu2204-12-5-local/cuda-*-keyring.gpg /usr/share/keyrings/sudo apt-get updates
udo apt-get -y install cuda-cross-aarch64
Install TensorRT
Start by downloading this from the TensorRT page; for my download I chose the latest version of TensorRT 10.x for
making sure to match your
sudo apt-get install tensorrt nvidia-tensorrt-dev python3-libnvinfer-dev
Mounting Swap
Make sure to follow the setup notes on the Jetson-containers Github repo, to get your SWAP working.
sudo systemctl disable nvzramconfig
sudo fallocate -l 16G /mnt/16GB.swap
sudo mkswap /mnt/16GB.swap
sudo swapon /mnt/16GB.swap
You'll need to append
/mnt/16GB.swap none swap sw 0 0
to the /etc/fstab
file. Make sure you're using sudo
to access this file as it needs write permissions. Success... sort of.
We are now able to run our first example. I know, it's sad to have a heart, love hurts. If only we could digitise our souls, things would be a lot easier, right?
jetson-containers run $(autotag nano_llm) python3 -m nano_llm.chat \
--api=mlc \
--model princeton-nlp/Sheared-LLaMA-2.7B-ShareGPT
>> PROMPT: I have a heart
I'm sorry to hear that you have a heart. It's a vital and essential part of the human body, but it can also be a source of pain and discomfort. Here are some basic facts and information about hearts:
* Hearts are located in the chest and are made up of two main chambers: the left and right ventricles.
* Hearts beat regularly and pump blood throughout the body.
* The heart is an important organ that helps to maintain the body's balance of essential minerals, electrolytes, and water.
* The heart</s>
If you enjoyed reading this, please share and comment below. You can also buy me a beer if you like ([email protected]). P.S. also may be you could help me and share with your network that I'm open for work. You can help by sharing my details with your friends and colleagues, thank you!