[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Control Debian image size



Hi,

Quoting JH (2019-03-03 00:17:06)
> I have been searching build system and distro for my small Linux
> embedded device for many weeks, the device has small resources, about
> 128 MB Flash and 64 MB RAM on imx6, it is a typical embedded system,
> no GUI, no Desktop environment, no multiple user interfaces, the C++
> applications are simply for data transfer and communication using
> TCP/IP, the applications were previously running well on Debian 8
> armhf, so Debian is my first choice, but the Debian image size could
> be a major problem, it could be too large to blow out device resource
> constraints, many people commended me to use OE or Yocto or OpenWrt
> distro which image size seems much smaller than the Debian armhf. Is
> it possible to control / reduce Debian armhf image size by Debian
> build, or isar or some other build bools, to reach the same resource
> requirement level in OE Yocto or OpenWrt?

it is possible to produce a Debian rootfs well below 128 MB in size if you
choose not to install locales, man pages and docs using the --path-exclude dpkg
option:

https://raphaelhertzog.com/2010/11/15/save-disk-space-by-excluding-useless-files-with-dpkg/

An easy way to create a chroot tarball with this option already set is by using
mmdebstrap (shameless plug: I'm the author) like so:

mmdebstrap --variant=apt \
    --dpkgopt='path-exclude=/usr/share/man/*' \
    --dpkgopt='path-include=/usr/share/man/man[1-9]/*' \
    --dpkgopt='path-exclude=/usr/share/locale/*' \
    --dpkgopt='path-include=/usr/share/locale/locale.alias' \
    --dpkgopt='path-exclude=/usr/share/doc/*' \
    --dpkgopt='path-include=/usr/share/doc/*/copyright' \
    --dpkgopt='path-include=/usr/share/doc/*/changelog.Debian.*' \
    unstable > debian-unstable.tar

The resulting tarball debian-unstable.tar is 69M in size. You can find a very
similar example in the mmdebstrap man page. You can go even smaller if you omit
the path-include parts of above command (64M) and even smaller by not
installing apt (49M). You can go even more extreme with the custom variant
which lets you pick exactly the package set you want, ignoring Essential:yes
packages.

Thanks!

cheers, josch

Attachment: signature.asc
Description: signature


Reply to: