I need to generate a minimal Samba working in a SH4 cpu in a STLinux 2.3 environment. The goal is to have very very simple Samba server running in a STLinux environment. STLinux Kernel has included the CIFS support. Really I'm a newbie in Samba cross-compilation. And obviously I've problems :-( Any help will be appreciated. Thanks :-) 1) First of all I've set some env vars: export PREFIX="sh4-linux" export CC="${PREFIX}-gcc" export CXX="${PREFIX}-g++" export LD="${PREFIX}-ld" export NM="${PREFIX}-nm -B" export AR="${PREFIX}-ar" export RANLIB="${PREFIX}-ranlib" export LN_S="ln -s" export CFLAGS="-g -O2" export PKG_CONFIG_PATH=/opt/STM/STLinux-2.3/devkit/sh4/target/usr/lib/pkgconfig export LD_LIBRARY_PATH=/opt/STM/STLinux-2.3/devkit/sh4/lib export LDFLAGS="-L/opt/STM/STLinux-2.3/devkit/sh4/lib -L/opt/STM/STLinux-2.3/devkit/sh4/lib/gcc/sh4-linux/4.2.4" export CPPFLAGS="-I/opt/STM/STLinux-2.3/devkit/sh4/include -I/opt/STM/STLinux-2.3/devkit/sh4/lib/gcc/sh4-linux/4.2.4/include -I/opt/STM/STLinux-2.3/devkit/sh4/lib/gcc/sh4-linux/4.2.4/incl ude/spp" 2) I've run configure ./configure --host=sh4-linux --target=sh4-linux --without-automount --without-sendfile-support --with-included-popt --with-included-iniparser --disable-cups --without-sys-quotas --without-ads --enable-static=yes --enable-shared=no --prefix=/root/SAMBA/tmp 3) configure stop with error: checking that the C compiler understands -errwarn... cross checking that the C compiler understands -qhalt... cross checking that the C compiler understands negative enum values... configure: error: in `/root/SAMBA/samba-3.5.6/source3': configure: error: cannot run test program while cross compiling See `config.log' for more details. 4) config.log show this: configure:13070: checking that the C compiler understands negative enum values configure:13077: error: in `/root/SAMBA/samba-3.5.6/source3': configure:13080: error: cannot run test program while cross compiling I've read that I need to setup the "config.site" file. I've read documentation but I've not understand how to set it.
Alex
2010-Oct-28 06:58 UTC
[Samba] R: Cross-compile Samba 3.5.6 with STLinux 2.3 (SH4 CPU)
I answer myself. I hope this can be useful. 1) create with a text editor the file config.site and write into it: ------------------config.site----------- samba_cv_CC_NEGATIVE_ENUM_VALUES=yes ---------------------------------------- (I've tested the C code and sh4-linux-gcc supports negative enum) 2) set some env vars: export CONFIG_SITE=/path/to/your/config.site PREFIX="sh4-linux" export CC="${PREFIX}-gcc" export CXX="${PREFIX}-g++" export LD="${PREFIX}-ld" export NM="${PREFIX}-nm -B" export AR="${PREFIX}-ar" export RANLIB="${PREFIX}-ranlib" export LN_S="ln -s" export CFLAGS="-O2" export PKG_CONFIG_PATH=/opt/STM/STLinux-2.3/devkit/sh4/target/usr/lib/pkgconfig export LD_LIBRARY_PATH=/opt/STM/STLinux-2.3/devkit/sh4/lib export LDFLAGS="-L/opt/STM/STLinux-2.3/devkit/sh4/lib -L/opt/STM/STLinux-2.3/devkit/sh4/lib/gcc/sh4-linux/4.2.4" export CPPFLAGS="-I/opt/STM/STLinux-2.3/devkit/sh4/include -I/opt/STM/STLinux-2.3/devkit/sh4/lib/gcc/sh4-linux/4.2.4/include -I/opt/STM/STLinux-2.3/devkit/sh4/lib/gcc/sh4-lin ux/4.2.4/include/spp" export LIBS="-L/opt/STM/STLinux-2.3/devkit/sh4/target/lib -L/opt/STM/STLinux-2.3/devkit/sh4/target/usr/lib" 3) run configure: ./configure --host=sh4-linux --target=sh4-linux \ --disable-fam --disable-avahi --disable-swat --disable-cups --disable-iprint --disable-pie \ --enable-static=no --enable-shared=yes \ --without-ldap --without-ads --with-cifsumount --without-pam \ --without-automount --without-sendfile-support --with-included-popt \ --without-sys-quotas --without-utmp --without-cluster-support --without-acl-support \ --without-winbind --with-included-popt --with-included-iniparser \ --prefix=/usr/local/samba 4) (remember to install gettext package in your i686 distro) make make install 5) strip binaries: sh4-linux-strip /usr/local/samba/bin/* sh4-linux-strip /usr/local/samba/sbin/* That's all Now you can copy /usr/local/samba/* in your SH4 device. Many binaries are not useful: I suggest you to remove them. Remove also man pages Remember to set a user with smbpasswd and create /usr/local/samba/lib/smb.conf This is a simple smb.conf : ----------------smb.conf--------------- [global] workgroup = WORKGROUP netbios name = SH4 security = share deadtime = 60 load printers = no log level = 0 max smbd processes = 6 [movie] path = /media/hdd/movie read only = no guest ok = yes browseable = yes [root_dir] path = / browseable = yes read only = no guest ok = no