Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dudo
Last active April 21, 2024 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dudo/4093b5d14f2b003cad507e4f4ac1aa83 to your computer and use it in GitHub Desktop.
Save dudo/4093b5d14f2b003cad507e4f4ac1aa83 to your computer and use it in GitHub Desktop.
Nvidia Orin NX on Ubuntu 22.04 and Jetson 36.2
# From shit-box
# Need to modify the host doing the flashing
sudo vi /etc/default/nfs-kernel-server
RPCMOUNTDOPTS="--manage-gids --no-nfs-version 4"
sudo reboot
sudo apt install -y qemu-user-static
mkdir ~/nvidia
cd ~/nvidia
wget -O bsp.tbz2 -L https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v2.0/release/jetson_linux_r36.2.0_aarch64.tbz2
wget -O rootfs.tbz2 -L https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v2.0/release/tegra_linux_sample-root-filesystem_r36.2.0_aarch64.tbz2
tar -xvpf bsp.tbz2
sudo tar -xvpf rootfs.tbz2 -C Linux_for_Tegra/rootfs/
# Let's modify the kernel before we flash the board. WIP
# cd Linux_for_Tegra/source
# ./source_sync.sh -k -t jetson_36.2
# cd kernel/kernel-jammy-src
# make nconfig
# CONFIG_NET_CLS_BPF=m
# CONFIG_BLK_DEV_THROTTLING=y
# CONFIG_NET_CLS_CGROUP=m
# CONFIG_CGROUP_NET_PRIO=y
# CONFIG_CFS_BANDWIDTH=y
# CONFIG_IP_NF_TARGET_REDIRECT=m
# CONFIG_IP_SET=m
# CONFIG_IP_VS_NFCT=y
# CONFIG_IP_VS_PROTO_TCP=y
# CONFIG_IP_VS_PROTO_UDP=y
# CONFIG_IP_VS_RR=m
# CONFIG_VXLAN=m
# CONFIG_CRYPTO_SEQIV=m
# CONFIG_XFRM_USER=y
# CONFIG_INET_ESP=m
# CONFIG_NETFILTER_XT_TARGET_TPROXY=m
# CONFIG_NETFILTER_XT_MATCH_MARK=m
# CONFIG_NETFILTER_XT_MATCH_SOCKET=m
# make modules
# sudo make modules_install
sed -i 's/cvb_eeprom_read_size = <0x100>/cvb_eeprom_read_size = <0x0>/g' Linux_for_Tegra/bootloader/generic/BCT/tegra234-mb2-bct-misc-p3767-0000.dts
cd ~/nvidia/Linux_for_Tegra
sudo ./apply_binaries.sh
sudo ./tools/l4t_flash_prerequisites.sh
sudo ./tools/l4t_create_default_user.sh --accept-license -u ubuntu -p password -a -n jetson1
sudo vi ./tools/kernel_flash/initrd_flash/nv_enable_remote.sh
222gg
...
echo "${cfg_str:1}" > "${cfg}/strings/0x409/configuration"
echo on > /sys/bus/usb/devices/usb2/power/control # <---- new entry
echo "${udc_dev}" > UDC
...
# Connect shit-box to turing-pi via usb
# From turing-pi
tpi power off
tpi usb -n 4 flash
tpi power -n 4 on
# From shit-box
lsusb
sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 \
-c tools/kernel_flash/flash_l4t_external.xml -p "-c bootloader/generic/cfg/flash_t234_qspi.xml" \
--showlogs --network usb0 --erase-all jetson-orin-nano-devkit internal
ssh ubuntu@xxx.xx.x.x
# From jetson1
sudo apt update
sudo apt -y upgrade
sudo shutdown -h now
# From turing-pi
tpi power -n 4 off
tpi usb -n 4 device
tpi power -n 4 on
@dudo
Copy link
Author

dudo commented Feb 25, 2024

Follow-ups

  • KernelCustomization

    sudo apt install -y curl build-essential bc libssl-dev libncurses-dev pkg-config
    
    cd
    mkdir nvidia
    cd nvidia
    
    wget -O drivers.tbz2 https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v2.0/release/jetson_linux_r36.2.0_aarch64.tbz2
    tar -xvpf drivers.tbz2
    
    cd Linux_for_Tegra/source
    ./source_sync.sh -k -t jetson_36.2
    
    cd kernel/kernel-jammy-src
    make nconfig
    # CONFIG_NET_CLS_BPF=m
    export INSTALL_MOD_PATH=~/nvidia/Linux_for_Tegra/rootfs/
    make modules
    sudo make modules_install
    
    # I can't seem to get the -tegra suffix to take...
    sudo cp -a /lib/modules/5.15.122/. /lib/modules/5.15.122-tegra/
    sudo depmod
  • NVIDIA Container Runtime

    We're not actually installing Docker, but we still need to ensure the container runtime is available.

    distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
    && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
    && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
          sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
          sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
    
    sudo apt update
    sudo apt install -y curl nvidia-container-toolkit python3-pip runc
    
    # jtop
    sudo pip3 install -U jetson-stats
    jtop
    
    sudo reboot
    
    # verify
    nvidia-container-runtime -v
  • NVIDIA CUDA

    sudo apt-key del 7fa2af80
    wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/arm64/cuda-keyring_1.1-1_all.deb
    sudo dpkg -i cuda-keyring_1.1-1_all.deb
    sudo apt update
    sudo apt-get install cuda-toolkit
    sudo apt-get install nvidia-gds
    
    echo 'PATH=/usr/local/cuda/bin${PATH:+:${PATH}}' >> ~/.profile
    echo 'LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.profile
    
    sudo reboot
    
    # verify
    sudo jetson_release -v
    cd ~/nvidia
    git clone https://github.com/NVIDIA/cuda-samples.git
    cd cuda-samples/Samples/1_Utilities/deviceQuery
    sudo make
    ./deviceQuery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment