Web lists-archives.com

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




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.

Here is my config options
--cross-compile
--hostcc=cc
--cross-answers=arm.txt
--without-ldap
--without-ads
--disable-gnutls
--without-ad-dc
--without-cluster-support
--without-regedit
--without-gpgme
--without-winbind
--disable-cups
--disable-iprint
--without-pam
--without-quotas
--without-pie
--without-relro
-nopyc
--nopyo
--without-acl-support

We only use the samba as a file server, and use smbpasswd backend, 
all other unused features can be disabled.
is there any other config options I should add to reduce the size?

and when I use ldd to see which shared libaries that smbd depends,
a big list as follows, does smbd use all of them?

ldd sbin/smbd
libpthread.so.0 => /lib/libpthread.so.0 (0xf7086000)
libsamba-util.so.0 => /tmp/samba4/lib/libsamba-util.so.0 (0xf700e000)
libsmbd-base-samba4.so => /tmp/samba4/lib/private/libsmbd-base-samba4.so (0xf6d56000)
libsamba-debug-samba4.so => /tmp/samba4/lib/private/libsamba-debug-samba4.so (0xf6d42000)
libgenrand-samba4.so => /tmp/samba4/lib/private/libgenrand-samba4.so (0xf6d31000)
libtalloc.so.2 => /tmp/samba4/lib/private/libtalloc.so.2 (0xf6d1c000)
libsocket-blocking-samba4.so => /tmp/samba4/lib/private/libsocket-blocking-samba4.so (0xf6d0b000)
libtevent.so.0 => /tmp/samba4/lib/private/libtevent.so.0 (0xf6cf0000)
libsmbregistry-samba4.so => /tmp/samba4/lib/private/libsmbregistry-samba4.so (0xf6cc9000)
libtevent-util.so.0 => /tmp/samba4/lib/libtevent-util.so.0 (0xf6cb7000)
libndr-samba-samba4.so => /tmp/samba4/lib/private/libndr-samba-samba4.so (0xf6ba9000)
libsamba-errors.so.1 => /tmp/samba4/lib/libsamba-errors.so.1 (0xf6ab3000)
libsys-rw-samba4.so => /tmp/samba4/lib/private/libsys-rw-samba4.so (0xf6aa2000)
libsamba3-util-samba4.so => /tmp/samba4/lib/private/libsamba3-util-samba4.so (0xf6a8b000)
libsamba-passdb.so.0 => /tmp/samba4/lib/libsamba-passdb.so.0 (0xf6a46000)
libcliauth-samba4.so => /tmp/samba4/lib/private/libcliauth-samba4.so (0xf6a27000)
libpopt-samba3-samba4.so => /tmp/samba4/lib/private/libpopt-samba3-samba4.so (0xf6a13000)
libauth-samba4.so => /tmp/samba4/lib/private/libauth-samba4.so (0xf69e6000)
libsmbconf.so.0 => /tmp/samba4/lib/libsmbconf.so.0 (0xf697d000)
libsamba-cluster-support-samba4.so => /tmp/samba4/lib/private/libsamba-cluster-support-samba4.so (0xf696c000)
libsamba-sockets-samba4.so => /tmp/samba4/lib/private/libsamba-sockets-samba4.so (0xf694a000)
libsmbd-shim-samba4.so => /tmp/samba4/lib/private/libsmbd-shim-samba4.so (0xf6939000)
libndr-standard.so.0 => /tmp/samba4/lib/libndr-standard.so.0 (0xf6680000)
libsecrets3-samba4.so => /tmp/samba4/lib/private/libsecrets3-samba4.so (0xf6668000)
libsamba-hostconfig.so.0 => /tmp/samba4/lib/libsamba-hostconfig.so.0 (0xf663c000)
libpopt-samba4.so => /tmp/samba4/lib/private/libpopt-samba4.so (0xf6626000)
libc.so.6 => /lib/libc.so.6 (0xf64e8000)
/lib/ld-linux.so.3 (0xf70af000)
libtime-basic-samba4.so => /tmp/samba4/lib/private/libtime-basic-samba4.so (0xf64d7000)
libreplace-samba4.so => /tmp/samba4/lib/private/libreplace-samba4.so (0xf64c6000)
librt.so.1 => /lib/librt.so.1 (0xf64af000)
libprinting-migrate-samba4.so => /tmp/samba4/lib/private/libprinting-migrate-samba4.so (0xf648d000)
libmessages-dgm-samba4.so => /tmp/samba4/lib/private/libmessages-dgm-samba4.so (0xf6476000)
libsamba-security-samba4.so => /tmp/samba4/lib/private/libsamba-security-samba4.so (0xf6450000)
libnetapi.so.0 => /tmp/samba4/lib/libnetapi.so.0 (0xf63f2000)
libsmbd-conn-samba4.so => /tmp/samba4/lib/private/libsmbd-conn-samba4.so (0xf63e0000)
libutil-tdb-samba4.so => /tmp/samba4/lib/private/libutil-tdb-samba4.so (0xf63ce000)
libnpa-tstream-samba4.so => /tmp/samba4/lib/private/libnpa-tstream-samba4.so (0xf63b7000)
libtdb.so.1 => /tmp/samba4/lib/private/libtdb.so.1 (0xf6396000)
liblibsmb-samba4.so => /tmp/samba4/lib/private/liblibsmb-samba4.so (0xf6333000)
libmsrpc3-samba4.so => /tmp/samba4/lib/private/libmsrpc3-samba4.so (0xf6309000)
libserver-id-db-samba4.so => /tmp/samba4/lib/private/libserver-id-db-samba4.so (0xf62f7000)
libdbwrap-samba4.so => /tmp/samba4/lib/private/libdbwrap-samba4.so (0xf62df000)
libiov-buf-samba4.so => /tmp/samba4/lib/private/libiov-buf-samba4.so (0xf62ce000)
libkrb5samba-samba4.so => /tmp/samba4/lib/private/libkrb5samba-samba4.so (0xf62b4000)
libdcerpc-samba-samba4.so => /tmp/samba4/lib/private/libdcerpc-samba-samba4.so (0xf616f000)
libndr.so.0 => /tmp/samba4/lib/libndr.so.0 (0xf614f000)
libutil-reg-samba4.so => /tmp/samba4/lib/private/libutil-reg-samba4.so (0xf613e000)
libcli-spoolss-samba4.so => /tmp/samba4/lib/private/libcli-spoolss-samba4.so (0xf612a000)
libcom_err-samba4.so.0 => /tmp/samba4/lib/private/libcom_err-samba4.so.0 (0xf6118000)
libads-samba4.so => /tmp/samba4/lib/private/libads-samba4.so (0xf60fe000)
libwbclient.so.0 => /tmp/samba4/lib/libwbclient.so.0 (0xf60e3000)
libutil-setid-samba4.so => /tmp/samba4/lib/private/libutil-setid-samba4.so (0xf60d2000)
liblibcli-lsa3-samba4.so => /tmp/samba4/lib/private/liblibcli-lsa3-samba4.so (0xf60bf000)
libcli-smb-common-samba4.so => /tmp/samba4/lib/private/libcli-smb-common-samba4.so (0xf608e000)
libgse-samba4.so => /tmp/samba4/lib/private/libgse-samba4.so (0xf605d000)
libgensec-samba4.so => /tmp/samba4/lib/private/libgensec-samba4.so (0xf603c000)
libdcerpc-binding.so.0 => /tmp/samba4/lib/libdcerpc-binding.so.0 (0xf6015000)
libndr-samba4.so => /tmp/samba4/lib/private/libndr-samba4.so (0xf5f02000)
libCHARSET3-samba4.so => /tmp/samba4/lib/private/libCHARSET3-samba4.so (0xf5ef0000)
libauthkrb5-samba4.so => /tmp/samba4/lib/private/libauthkrb5-samba4.so (0xf5ed3000)
libsmb-transport-samba4.so => /tmp/samba4/lib/private/libsmb-transport-samba4.so (0xf5ebf000)
libsamba-modules-samba4.so => /tmp/samba4/lib/private/libsamba-modules-samba4.so (0xf5ead000)
libasn1util-samba4.so => /tmp/samba4/lib/private/libasn1util-samba4.so (0xf5e99000)
libndr-nbt.so.0 => /tmp/samba4/lib/libndr-nbt.so.0 (0xf5e78000)
libz-samba4.so => /tmp/samba4/lib/private/libz-samba4.so (0xf5e59000)
libsamba-credentials.so.0 => /tmp/samba4/lib/libsamba-credentials.so.0 (0xf5e3b000)
libtdb-wrap-samba4.so => /tmp/samba4/lib/private/libtdb-wrap-samba4.so (0xf5e29000)
libutil-cmdline-samba4.so => /tmp/samba4/lib/private/libutil-cmdline-samba4.so (0xf5e17000)
liblibcli-netlogon3-samba4.so => /tmp/samba4/lib/private/liblibcli-netlogon3-samba4.so (0xf5e03000)
libndr-krb5pac.so.0 => /tmp/samba4/lib/libndr-krb5pac.so.0 (0xf5de9000)
libauth-sam-reply-samba4.so => /tmp/samba4/lib/private/libauth-sam-reply-samba4.so (0xf5dd6000)
libnsl.so.1 => /lib/libnsl.so.1 (0xf5db1000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0xf5d72000)
libtalloc-report-samba4.so => /tmp/samba4/lib/private/libtalloc-report-samba4.so (0xf5d61000)
libmessages-util-samba4.so => /tmp/samba4/lib/private/libmessages-util-samba4.so (0xf5d50000)
libinterfaces-samba4.so => /tmp/samba4/lib/private/libinterfaces-samba4.so (0xf5d3e000)
libserver-role-samba4.so => /tmp/samba4/lib/private/libserver-role-samba4.so (0xf5d2c000)
libmsghdr-samba4.so => /tmp/samba4/lib/private/libmsghdr-samba4.so (0xf5d1b000)
libtrusts-util-samba4.so => /tmp/samba4/lib/private/libtrusts-util-samba4.so (0xf5d08000)
libflag-mapping-samba4.so => /tmp/samba4/lib/private/libflag-mapping-samba4.so (0xf5cf6000)
libcli-cldap-samba4.so => /tmp/samba4/lib/private/libcli-cldap-samba4.so (0xf5ce0000)
libkrb5-samba4.so.26 => /tmp/samba4/lib/private/libkrb5-samba4.so.26 (0xf5c82000)
libasn1-samba4.so.8 => /tmp/samba4/lib/private/libasn1-samba4.so.8 (0xf5c19000)
libaddns-samba4.so => /tmp/samba4/lib/private/libaddns-samba4.so (0xf5c01000)
libwinbind-client-samba4.so => /tmp/samba4/lib/private/libwinbind-client-samba4.so (0xf5bef000)
libgssapi-samba4.so.2 => /tmp/samba4/lib/private/libgssapi-samba4.so.2 (0xf5bbb000)
libcli-nbt-samba4.so => /tmp/samba4/lib/private/libcli-nbt-samba4.so (0xf5ba3000)
libsamdb.so.0 => /tmp/samba4/lib/libsamdb.so.0 (0xf5b80000)
libdl.so.2 => /lib/libdl.so.2 (0xf5b6d000)
libldb.so.1 => /tmp/samba4/lib/private/libldb.so.1 (0xf5b38000)
libsamdb-common-samba4.so => /tmp/samba4/lib/private/libsamdb-common-samba4.so (0xf5b05000)
libldbsamba-samba4.so => /tmp/samba4/lib/private/libldbsamba-samba4.so (0xf5ad4000)
libcli-ldap-common-samba4.so => /tmp/samba4/lib/private/libcli-ldap-common-samba4.so (0xf5abe000)
libheimbase-samba4.so.1 => /tmp/samba4/lib/private/libheimbase-samba4.so.1 (0xf5aaa000)
libhx509-samba4.so.5 => /tmp/samba4/lib/private/libhx509-samba4.so.5 (0xf5a69000)
libhcrypto-samba4.so.5 => /tmp/samba4/lib/private/libhcrypto-samba4.so.5 (0xf5a31000)
libroken-samba4.so.19 => /tmp/samba4/lib/private/libroken-samba4.so.19 (0xf5a18000)
libwind-samba4.so.0 => /tmp/samba4/lib/private/libwind-samba4.so.0 (0xf59e1000)
libresolv.so.2 => /lib/libresolv.so.2 (0xf59bc000)

Regards,
Herbert Yuan
thanks very much.



-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba