2012年5月1日 星期二

[Samba] Samba in Embedded System

Add source into /Porting/Source/APP/Software_Module/Samba/src

Then tell the compile where to compile.



Samba download from http://www.samba.org/



1. Add rule top Makefile

vim UBEE_D3_CableRG\ti\gw\src\Makefile

add the line below

subdir-y += $(TARGET_HOME)/Porting/Source/APP/Software_Module/Samba/src



2. Make sub Makefile

vim UBEE_D3_CableRG/Porting/Source/APP/Software_Module/Samba/src/Makefile



<orange:-



#include $(TARGET_HOME)/TI_Build.make

include $(TARGET_HOME)/.config



PACKAGE_VERSION := samba-3.0.23

PACKAGE_DIR := samba-3.0.23/source

PACKAGE_CONF := \

    --host=$(patsubst %-gcc,%,$(CROSS)gcc) --disable-cups --disable-iprint \

        --prefix=/ --without-ldap --without-ads --enable-shared --disable-pie \

        --cache-file=config.cache --bindir=/usr/bin --sbindir=/sbin \

        --datadir=/nvram/samba --sysconfdir=/etc/samba --localstatedir=/var \

        --libdir=/lib --with-privatedir=/nvram/samba/private --with-configdir=/etc/samba \

        --disable-largefile --enable-swat=no --enable-iprint=no --enable-fam=no --enable-dnssd=no \

        --with-libtalloc=no --with-libtdb=no --with-libnetapi=no --with-libaddns=no \

        --with-acl-support=no samba_cv_CC_NEGATIVE_ENUM_VALUES=yes \

          libreplace_cv_HAVE_GETADDRINFO=no



first_rule: all



all: build



$(CURDIR)/$(PACKAGE_DIR)/Makefile:

    @cd $(CURDIR)/$(PACKAGE_DIR) && CC=$(CROSS)gcc ./configure $(PACKAGE_CONF)



build_lib: $(CURDIR)/$(PACKAGE_DIR)/Makefile

    @$(MAKE) -pie -C $(CURDIR)/$(PACKAGE_DIR) all

  

build: build_lib install_rule



config_rule:





install_rule:

    mkdir -p $(TARGET_HOME)/build/dgwsdk/fs/base_fs/usr/local/samba/var

    mkdir -p $(TARGET_HOME)/build/dgwsdk/fs/base_fs/usr/local/samba/private

    mkdir -p $(TARGET_HOME)/build/dgwsdk/fs/base_fs/usr/local/samba/lib

    cp -af $(PACKAGE_DIR)/bin/smbd $(TARGET_HOME)/build/dgwsdk/fs/base_fs/usr/sbin

    cp -af $(PACKAGE_DIR)/bin/nmbd $(TARGET_HOME)/build/dgwsdk/fs/base_fs/usr/sbin

    cp -af $(PACKAGE_DIR)/bin/smbpasswd $(TARGET_HOME)/build/dgwsdk/fs/base_fs/usr/bin

    cp -af $(PACKAGE_DIR)/bin/mount.cifs $(TARGET_HOME)/build/dgwsdk/fs/base_fs/usr/sbin

    cp -af $(PACKAGE_DIR)/bin/umount.cifs $(TARGET_HOME)/build/dgwsdk/fs/base_fs/usr/sbin



clean_rule:



uninstall_rule:



:->



3. When execute configure (error)

Error 1:

error: cannot run test program while cross compiling error

           checking that the C compiler understands negative enum values... configure: error: in `/root/samba-3.3.3/source':

           configure: error: cannot run test program while cross compiling



configure can't check for cross compile - samba_cv_CC_NEGATIVE_ENUM_VALUES。



            Solution:

            #echo samba_cv_CC_NEGATIVE_ENUM_VALUES=yes>linux.cache

            Add the line (like below) to UBEE_D3_CableRG/Porting/Source/APP/Software_Module/Samba/src/Makefile



            --cache-file=linux.cache



Error 2:

configure: error: cannot run test program while cross compiling错误

            configure: error: in `/root/samba-3.3.3/source':

            configure: error: cannot run test program while cross compiling

            See `config.log' for more details



            Solution 1:

                    if test "$cross_compiling" = yes; then

            { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5

            $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}

            { { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling

            See \`config.log' for more details." >&5

            $as_echo "$as_me: error: cannot run test program while cross compiling

            See \`config.log' for more details." >&2;}

                     }; }  

            #mark this line { (exit 1); exit 1; }; }; }

            else

            cat >conftest.$ac_ext <<_ACEOF

.

            Solution 2:

                    if test "$cross_compiling" = yes; then

            #{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5

            #$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}

            #{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling

            #See \`config.log' for more details." >&5

            #$as_echo "$as_me: error: cannot run test program while cross compiling

            #See \`config.log' for more details." >&2;}

                     }; }  

            #mark this line { (exit 1); exit 1; }; }; }

            #else

            cat >conftest.$ac_ext <<_ACEOF



4. When execute Compile (error) :

../../../src/libgcc/config/libbid/bid_decimal_globals.c: In function

‘__dfp_set_round’:

../../../src/libgcc/config/libbid/bid_decimal_globals.c:34:1: error:

unrecognizable insn:

(call_insn/u 6 5 7 3 (parallel [

            (set (reg:DI 0 ax)

                (call:DI (mem:QI (symbol_ref:DI ("__tls_get_addr")) [0 S1 A8])

                    (const_int 0 [0])))

            (unspec:DI [

                    (symbol_ref:DI ("__bid_IDEC_glbround") [flags

0x10] <var_decl 0x2abaca167000 __bid_IDEC_glbround>)

                ] UNSPEC_TLS_GD)

        ]) ../../../src/libgcc/config/libbid/bid_decimal_globals.c:33 -1

     (expr_list:REG_EH_REGION (const_int -2147483648 [0xffffffff80000000])

        (nil))

    (nil))

../../../src/libgcc/config/libbid/bid_decimal_globals.c:34:1: internal

compiler error: in extract_insn, at recog.c:2109

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.



Solution :

you can take to running a program at high addresses is

to use -pie, which lets you move the program around in

memory.

    Add -pie like below

    @$(MAKE) -pie -C $(CURDIR)/$(PACKAGE_DIR) all



5. Configuration /etc/samba/smb.conf :

<orange:-

#=== Global Settings ===

[global]

        workgroup = MYGROUP

        server string = Samba Server Version %v

        guest account = root

        null passwords = yes

        log file = /var/log/samba/log.%m

        max log size = 50

        security = share # ( 3 setting : user, share, domain )

        passdb backend = tdbsam



        load printers = yes

        cups options = raw



        follow symlinks = yes

        wide links      = yes

        unix extensions = no



        interfaces = lan0 192.168.100.1

#=== Share Definitions ===

[temp]                                   

        comment    = Temporary file space

        path       = /tmp                

        writable   = yes                 

        browseable = yes

        public = yes



[WWW]

        comment    = Temporary file space

        path       = /fss/gw/usr/www/                

        writable   = yes                 

        browseable = yes

        public = yes

:->



6. Add nobody into passwd

vim /etc/passwd

root:x:0:0:root:/:/bin/sh

nobody:x:99:99:Nobody:/:/bin/sh



7. Start Samba

/usr/sbin/nmbd -D

/usr/sbin/smbd -D

0 意見:

張貼留言