Samba smaller: 8.2mb smbd

Andrew Bartlett abartlet at samba.org
Thu Nov 21 22:33:17 UTC 2019


On Fri, 2019-11-15 at 14:44 +1300, Andrew Bartlett wrote:
> On Fri, 2019-11-15 at 14:34 +1300, Andrew Bartlett via samba-
> technical
> wrote:
> > For some reason I had another go at this, and have things down to
> > 11.1MB.
> > 
> > This is NOT FOR PRODUCTION USE, because I have to cut out some
> > important things, but the idea is to prove that by reducing the
> > linkage
> > to the ndr-table subsystem, we can avoid bringing in unused code to
> > eg
> > parse drsuapi.
> > 
> > Anyone wanting to take this further will need to work out how to
> > get
> > the appropriate interface tables for the specific pipes we need to
> > use
> > internally.  It would also be very worthwhile working to understand
> > why
> > we depend on what is left, and seeing if we can trim that some
> > more. 
> > 
> > I used:
> 
> By not building all the modules, I was able to reduce it to 10.4mb.
> 
> CFLAGS="-DSAMBA_SMALLER -O2 -flto -fwhole-program " LDFLAGS="-O2
> -flto
> -fwhole-program " ./configure --bundled-
> libraries=talloc,tdb,pytdb,ldb,pyldb,tevent,pytevent --with-static-
> modules='!FORCED' --with-shared-modules='!FORCED' --nonshared-
> binary=smbtorture,smbd/smbd --with-system-mitkrb5 --without-ad-dc --
> without-ads --disable-python && ./buildtools/bin/waf --
> targets=smbd/smbd
> 
> If any vendors wish to work with me to make this production, so that
> they can upgrade to a modern Samba version in constrained
> environments,
> please do be in touch, as I would be very glad to work with you!

I continue to be fascinated by the idea of making a small smbd really
work (and so ease embedded vendors of Samba 3.x), so I got it down to
8.2mb with:

CFLAGS='-DMAX_DEBUG_LEVEL=1 -D__location__=__FILE__ -DSAMBA_SMALLER -O2 -flto -fwhole-program' LDFLAGS="-O2 -flto -fwhole-program " ./configure --bundled-libraries=talloc,tdb,pytdb,ldb,pyldb,tevent,pytevent --with-static-modules='!FORCED' --with-shared-modules='!FORCED' --nonshared-binary=smbtorture,smbd/smbd --with-system-mitkrb5 --without-ad-dc --without-ads --disable-python --without-ldap && ./buildtools/bin/waf --targets=smbd/smbd

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








More information about the samba-technical mailing list