BusyBox dynamic linked on uClibc for init?

Laurent Bercot ska-dietlibc at skarnet.org
Thu May 12 06:47:06 UTC 2011

> Can BusyBox be compiled with dynamic link on uClibc as init?
> For now I use static binary.
> For space reasons I'm thinking about dynamic link.

 As Bernhard said, no problem at all.

 (I apologize if you already know the following - I'm writing it just
in case.)
 However, I would really recommand to *think twice* and study your
system *carefully* before changing to dynamic linking "for space reasons".

 * Busybox already saves you a lot of space, both in storage and in RAM,
by packing several utilities into the same binary. Every busybox applet
running on your system is already sharing *a lot* of memory with all the
other ones.
 * The uClibc is well-suited to static linking, i.e. it does not pull
unnecessary bloat into your binaries when you link them statically.

 If your system is similar to most embedded systems out there, then you
only have a small number of processes running at any time. Most likely
you have busybox for small standard services, and a big ugly binary for
for your dedicated application. In that case, dynamic linking will not
do much for you, either for RAM gain or storage space gains.

 Shared libraries and dynamic linking are most useful in the following
 - You are simultaneously running a lot of distinct binaries on your
 - Said distinct binaries have a lot of code in common, for instance
because they share part of their functionalities (think X clients);
 - You can't afford to recompile your whole system when you upgrade
one library.

 Full-fledged GNU/Linux desktop systems are the typical case where
dynamic linking is beneficial (this is one of the reasons why dynamic
linking is so prevalent). Embedded systems, on the other hand, are the
typical case where it is not.

 So, before switching to dynamic linking, make sure you know exactly
what you are doing, and why.


More information about the busybox mailing list