[Samba] how to reduce binary size of SAMBA 4 for embeded device

Andrew Bartlett abartlet at samba.org
Sun Aug 6 05:03:21 UTC 2017


On Wed, 2017-08-02 at 17:37 +0800, 袁建鹏 wrote:
> Hi, Bartlett
> 
> I decided to cut some subsystem by myself,
> So I spent several days to study the SAMBA 4 WAF build system and now know the base steps of build.
> but which subsystem can be removed for snmd/nmbd/smbpasswd ?

That is, essentially, your task.  You could compile it under
callcatcher, or use some other symbol dependency tracker to work out
what libraries are linked but not used.

The real problem however is when a binary like smbd links against a
library, a, which uses b.  However often the way that smbd uses a does
not require b, but it remains a useless dependency.  

The classic example of this is also the easiest one to start solving,
which is that smbd links against libndr-standard and libndr-samba-
samba4.  However, most of those libs are not used: sometimes the only
link in is via the ndr_table which lists all our generated IDL by UUID.
 

A re-structure of this code so that we have one library that is just
what a minimal smbd needs, and other for larger tasks like the client
tools and the AD DC, would be quite handy. 

A starting point would be to disable subsystems for a minimal build,
that simply wouldn't compile the unused elements, followed by code
changes to make other currently 'used' elements that are not strictly
needed for the file server alone become unused, then disabled.  

It isn't easy, but it will be worthwhile.

Andrew Bartlett
-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba




More information about the samba mailing list