Rootfs size optimization on TX2 som board on SDK32.4.3

i am using SDK 32.4.3 and compiled system.img has size of 6GB,i have to also create recovery image,how i can reduce this rootfs size.

what packages can be removed so that our image size can be reduced also for recovery image what minimal package i can keep.

Any help will be appreciated.

That’s a pretty difficult question. I will suggest that this is a case of long and difficult trial and error, but you can keep anything boot related. Mostly this is an “Ubuntu” question and not related to the hardware, but you would have to be careful to not to remove anything with a package name of “nvidia-l4t-...” unless you know you don’t need this.

Probably for a rescue image you would not need “nvidia-l4t-cuda”, or some others not related to boot, so having the package name start with “nvidia-l4t-...” means look very closely.

You can list all packages with “dpkg -l”. You can create a log of the content with “dpkg -l 2>&1 | tee log_dpkg.txt” (creates “log_dpkg.txt”).

One small candidate are the packages you can “sudo apt-get autoremove”. These are packages which were installed as a dependency, but are no longer needed as a dependency. This doesn’t necessarily mean you don’t still need them, but it does mean the package was never installed by direct request, and nothing is known to need these. Most of the time it means you don’t need them.

Any “doc” man page is a candidate for removal. If you have a log:
grep -i doc log_dpkg.txt

Also, you would normally run an “apt update” prior to working on packages. This is still true, but once you are sure you have done working on packages, you could run “sudo apt-get clean” and remove a lot of cached content. The packages themselves are not gone, but the side effects of storing them for install is cleaned up.

Assuming you have the man page installed (at least on the host PC), see “man dpkg”, “man apt”, and “man apt-get”.