Jetson/FAQ/BSP/RootFS Reduction

From eLinux.org
Jump to: navigation, search

How to reduce disk usage on Jetson platform

Jetson platform files system is based on ubuntu sample file system. Some Nvidia platform related binaries (BSP related) are added to support platform basic function. Jetson SDK Components including CUDA, cuDNN, TensorRT, OpenCV, VisionWorks, DeepStream and multimedia API provide AI related support.

This page breaks down Nvidia platform related binaries and Jetson SDK Component, so user can remove unused files to save space. A command to list all installed ubuntu packages by size is also provided for user to remove unused package based on needs.

Nvidia platform related binaries breakdown

Below is a breakdown of Nvidia platform related binaries.

 /
 ├── boot (43M)           Image(kernel binary), dtb and extlinux.conf. All are not used by Xavier, Image and extlinux.conf are used by Nano, TX1 and TX2
 ├── etc (536K)           Nvidia specified config file. DO NOT touch
 ├── lib
 │   ├── firmware (4.3M)  Firmwares used by platform. DO NOT touch
 │   ├── modules (47M)    Modules(.ko) used by platform. Can delete some based on needs
 │   └── systemd (32K)    Nvidia specified config file. DO NOT touch
 ├── opt
 │   └── nvidia  (17M)    Jetson gpio python lib and usb device mode service. Can delete based on needs
 ├── usr
 │   ├── bin (356K)       Nvidia speficied tools. DO NOT touch
 │   ├── lib (130M)       Nvidia speficied libs. DO NOT touch
 │   ├── sbin (2M)        Nvidia speficied tools. DO NOT touch
 │   ├── share (2.5M)     Nvidia specified boot logo, license, icon, etc. DO NOT touch
 │   └── src (234M)       Linux header files and grahics demos. Can delete based on needs
 └── var
     └── nvidia (188K)    Placeholder for nvcam. Can delete based on needs

Jetson SDK Components

Based on Jetson OS, Jetson SDK Components, including CUDA, cuDNN, TensorRT, OpenCV, VisionWorks, MultiMedia API and DeepStream, are installed by sdkmanager(or jetpack tool for older version). MultiMedia API is installed by tbz2 package while others are installed by deb package.

Both Jetson SDK libs(both static and dynamic libs) and sample code are installed and sample code can be deleted to save space. And if user's application is dynamicly linked to these libs, all static libs can be deleted.

After Jetson SDK Components are installed, run below commands can remove all deb files.

 sudo apt clean    # clean debs in /var/cache/apt/archives
 sudo rm /etc/apt/sources.list.d/*        # remove /var/cudaxxxx, /var/visonworksxxxx from apt source list
 sudo rm /var/cuda-repo-10-0-local-10.0.326/ /var/visionworks-repo/ /var/visionworks-sfm-repo/ /var/visionworks-tracking-repo/ -rf     # remove nvidia's debs

Below table list all Jetson SDK Components brief breakdown.

CUDA

Elememt Path Size
sample /usr/local/cuda/samples 198M
dynamic lib /usr/local/cuda/targets/aarch64-linux/lib/*.so* 723M
static lib /usr/local/cuda/targets/aarch64-linux/lib/*.a 898M
doc /usr/local/cuda/doc 231M

cuDNN

Elememt Path Size
sample /usr/src/cudnn_samples_v7 11M
dynamic lib /usr/lib/aarch64-linux-gnu/libcudnn*.so* 367M
static lib /usr/lib/aarch64-linux-gnu/libcudnn*.a 358M

TensorRT

Elememt Path Size
sample /usr/src/tensorrt 783M
dynamic lib /usr/lib/aarch64-linux-gnu/libnvcaffe_parser*.so*
/usr/lib/aarch64-linux-gnu/libnvinfer*.so*
/usr/lib/aarch64-linux-gnu/libnvonnxparser*.so*
/usr/lib/aarch64-linux-gnu/libnvparsers*.so*
156M
static lib /usr/lib/aarch64-linux-gnu/libnvcaffe_parser*.a
/usr/lib/aarch64-linux-gnu/libnvinfer*.a
/usr/lib/aarch64-linux-gnu/libnvonnxparser*.a
/usr/lib/aarch64-linux-gnu/libnvparsers*.a
172M
doc /usr/share/doc/libnvinfer* 24K

OpenCV

Elememt Path Size
sample /usr/share/OpenCV 11M
dynamic lib /usr/lib/libopencv*.so* 19M

VisionWorks

Elememt Path Size
sample /usr/share/visionworks*
~/VisionWorks-SFM*Samples
131M
dynamic lib /usr/lib/libvisionworks*.so* 28M
doc /usr/share/doc/libvisionworks* 352K

DeepStream

Elememt Path Size
sample /opt/nvidia/deepstream/deepstream*/samples 205M
dynamic lib /opt/nvidia/deepstream/deepstream*/lib 52M
doc /opt/nvidia/deepstream/deepstream*/doc 16K

MultiMedia API

Path Size
/usr/src/tegra_multimedia_api 107M

Remove installed deb packages

Run below command can remove all cached .deb file.

 sudo apt clean

Run below command can remove all non-required installed packages.

 sudo apt autoremove

Below command can list all install deb packages by size. User can remove the undesired packages by hand to save space.

 dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -rn

Example

Remove all deb installation packages

 sudo apt clean
 sudo rm /etc/apt/sources.list.d/*
 sudo rm -rf /var/cuda-repo-10-0-local-10.0.326/ /var/visionworks-repo/ /var/visionworks-sfm-repo/ /var/visionworks-tracking-repo

Remove ubuntu-desktop and the accessories

 sudo apt-get purge gnome-shell
 sudo apt-get purge docker*
 sudo apt-get purge chromium-browser thunderbird fonts-noto-cjk  libreoffice-common  containerd  snapd
 sudo apt-get remove --purge python* libpython*
 sudo apt-get purge libwebkit2gtk-4.0-37  libqt5webkit5  ubuntu-wallpapers-bionic freepats  libreoffice-writer libicu60  libreoffice-calc vim-runtime libflite1  libperl5.26 libmozjs-52-0 humanity-icon-theme samba-libs  iso-codes kwin-data perl-modules-5.26 light-themes libjavascriptcoregtk-4.0-18 chromium-browser-l10n
 sudo apt-get purge libvisionworks libvisionworks-sfm-dev libvisionworks-sfm-repo
 sudo apt-get autoremove

Remove some source code and sample code

 cd /usr/src && sudo rm -rf cudnn_samples_v7 linux-headers-4.9.140-tegra-ubuntu18.04_aarch64 linux-headers-4.9.140-tegra-linux_x86_64  tensorrt nvidia
 rm -rf /home/nvidia/VisionWorks-SFM-0.90-Samples