嵌入式samba功能的实现,linux下samba的移植

来源:互联网 发布:软件生命周期的阶段 编辑:程序博客网 时间:2024/05/07 07:03
1、samba 下载地址:
新版本下载:
https://download.samba.org/pub/samba/
老版本下载:
https://download.samba.org/pub/samba/old-versions/
下载地址:
http://download.chinaunix.net/download/0001000/30.shtml

2、 编译
tar zxf samba-3.0.37.tar.gz
cd samba-3.0.37/source/
先在X86平台上面进行编译测试:
./configure samba_cv_CC_NEGATIVE_ENUM_VALUES=yes
make
会出现下面的错误:
Compiling client/mount.cifs.c
client/mount.cifs.c: In function ‘main’:
client/mount.cifs.c:1068:25: error: ‘PATH_MAX’ undeclared (first use in this function)
resolved_path = malloc(PATH_MAX+1);
解决:
在client/mount.cifs.c中添加limits.h
添加 #include <limits.h>
重新make,通过

再交叉编译arm平台 (编译平台为海思平台 arm-hisiv500-linux-)
./configure CC=arm-hisiv500-linux-gcc LD=arm-hisiv500-linux-ld ranlid=arm-hisiv500-linux-ranlid AR=arm-hisiv500-linux-ar --target=arm-hisiv500-linux --host=i686
会出现下面的错误:
checking for prctl... yes
configure: error: cannot run test program while cross compiling
See `config.log' for more details.
解决办法:
在 cross_compiling=no 的定义位置的下面添加下面一行
test_cross_compiling=no
再修改出现 cannot run test program while cross compiling 位置
修改 if test "$cross_compiling" = yes; then 为 if test "$test_cross_compiling" = yes; then
这样在交叉编译的时候就不会有这个错误了

make
会出现下面的错误:
from lib/time.c:21:
/opt/hisi-linux/x86-arm/arm-hisiv500-linux/target/usr/include/sys/time.h:73:12: note: declared here
Makefile:841: recipe for target 'lib/time.o' failed
修改 lib/time.c 61行中的 GetTimeOfDay 函数,把 gettimeofday(tval); 修改为 gettimeofday(tval,NULL); 即可 (复制上面一行就可以)
make
编译完成(上面的错误在不用版本中不一样,调试了多个版本都有不同的问题,没有时间每个版本测试,这里使用的版本为samba-3.0.37版本)
编译成功 samba-3.0.37/source/bin/smbd

3、开发板上面:
创建工作目录:
mkdir /usr/local /usr/local/samba /usr/local/samba/bin /usr/local/samba/lib /usr/local/samba/private /usr/local/samba/var
在/usr/local/samba/lib创建配置文件:smb.conf
[global]
workgroup = myworkgroup
server string = samba
netbios name =myarm
guest account=root
security =share
interfaces = eth0
[share]
path = /opt/
guest ok=yes
browseable=yes

4、拷贝 samba-3.0.37/source/bin/smbd 到 开发板的 /usr/local/samba/bin 目录下面;
在 /usr/local/samba/bin 目录下面执行 ./smbd -D

在PC中打开 \\192.168.1.230 就可以看到开发板的内容了。
( 在海思 HI3516A 、 HI3519V101 平台测试正常 )



1 0