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

yuanjp at hust.edu.cn yuanjp at hust.edu.cn
Sun Jul 30 07:18:57 UTC 2017


Hi Bartlett

as far as I know, lots of soho router still use SAMBA 3
I think the binary size is the main consideration.
does Samba team have a plan for --with-tiny-smbd?
We look forward to it.

From: Andrew Bartlett
Date: 2017-07-30 12:43
To: yuanjp at hust.edu.cn; samba
Subject: Re: [Samba] how to reduce binary size of SAMBA 4 for embeded device
On Sun, 2017-07-30 at 09:29 +0800, yuanjp--- via samba wrote:
> Hi, everyone
>  
> I am migrating Samba 4.6.5 to our new router (BCM4908 SoC).
> the only function we used is sharing files when user plug a USB storage device.
> the previous version of SAMBA we used is 3.6.5, 
> we decided to upgrade to support SMB3 protocol and to benefit from other improvement.
> 
> I have finished the migration work, everything works fine,
> but the only problem is that the binary is very large.
> the banaries we needed is smbpasswd/nmbd/smbd
> 
> the total size of these commands and their dependent libraries after STRIP are:
>     15.5M   samba4_release/
> 
> That is only 1.3M when we use SAMBA 3.6.5. 
> 15.5M is too large, embeded device's ROM is oftenly not too large for cost consideration.
 
 
Thanks Herbert for reaching out to us.
 
I do particularly appreciate that you contacted us rather than just
continuing to run an old Samba version, we have sadly seen too many
devices resort to long-unsupported Samba releases in search of a
smaller binary.
 
I did some work on this a few months back, and while I certainly didn't
get it down to 1.3mb, I did get it down to 13mb for smbd.
 
Have a look at this:
 
https://lists.samba.org/archive/samba-technical/2017-January/118470.html
 
There is much still to do.  What we need to do is offer a --with-tiny-
smbd option, that strips Samba down to the bare components required,
removing things like the domain controller, the print server and the
like, but most importantly the unnecessary PIDL generated code. 
 
Looking at the options you used, ensure you add:
--disable-python
 
(and if your system has MIT krb5)
--with-system-mitkrb5
 
That should make things a little smaller.
 
However, what is really needed is a bit of time from a developer to
iteratively go over the build outputs and work out what can be safely
stripped out from a file-server-only build. 
 
Thanks,
 
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