Samba porting to embedded devices

Source: Internet
Author: User

Part of the content from: http://blog.csdn.net/zh98jm/article/details/6104691

First on a piece of samba's grab-bag diagram:


The data should be smb/cifs the two protocols.

The SMB (Server message Block) communication protocol is a protocol developed by Microsoft (Microsoft) and Intel (Intel) in 1987, primarily as a communications protocol for the Microsoft Network, but Microsoft does not open the protocol. While the Microsoft Windows platform occupies a major position on personal computers, Samba was born to share files with Microsoft platform, and the Samba project was reverse engineered (like a black box). To provide a free software that is compatible with SMB software so that it can be used by non-Microsoft operating systems.

To understand the origins of the above, there is no need to cross-examine the difference between Samba and FTP. FTP is mainly uploaded to download, rather than open, on the Mac FTP requires Third-party software, and samba is not, Samba is equivalent to join the LAN, in the windows of the Network Neighborhood can even see it, but the problem is that samba is too bulky.

The transplant was samba-3.0.23.tar.gz.

At the same time tried the samba-4.1.11.tar.gz,samba-3.6.3.tar.gz,samba-3.5.9.tar.gz, but these have failed to compile, due to time and energy reasons did not continue to study.

All the information about Samba is here: http://www.samba.org/, there are packages to download, but I prefer to download from here: http://download.chinaunix.net/download/0001000/30.shtml.

Originally prepared to direct the source into the project compiled, but Bitbake's compilation environment is really too troublesome, add 5 compile related files, modify 2 compile-related files still failed to transplant, have to abandon this method, then compile and then throw the generated executable file into the root file system.

The first step is to set the environment variable.

View environment variables: Echo $PATH
Temporarily add
1:export Path=/usr/local/webserver/mysql/bin: $PATH
The 2nd way to permanently add:
# Vim/etc/profile
At the end, add:
Export path= "/usr/local/webserver/mysql/bin: $PATH"

The path to/usr/local/webserver/mysql/bin is the path of the project's cross-compilation tool.

The second step, into the source directory, run configure.

Run configure need to take some parameters, and mine is this:

./configure CC=ARM-OE-LINUX-GNUEABI-GCC ld=arm-oe-linux-gnueabi-ld Ar=arm-oe-linux-gnueabi-ar--target= Arm-oe-linux--host=arm-oe-linux-gnueabi Samba_cv_cc_negative_enum_values=yes

The general arm chip of the Cross compilation tool is ARM-LINUX-GCC, so to Cc=arm-linux-gcc,ar can be in the GCC directory--target--host can write the cross-compilation tool GCC front part.

Step three, make

At this point will be wrong, this is the most depressing, a perfect open source package why will the error. This should actually be very common, perfect is not there, at this time to modify the source code it, open source is to let people modify the source code.

Modify the source code according to the error message. If TIME.C reported a mistake, then replace the TIME.C 60 lines with gettimeofday (tval,null);

At this time for the convenience of the back, can also be in include/config.h, plus #define HAVE_IFACE_IFCONF 1

If there are other errors, according to the error information to modify the source code, do not know how to modify the Internet search, the Internet can not find the version, this is my transplant ideas.

When it is done, it is found that there are many generated files under \samba-3.0.23\source\bin, in which SMBD,NMBD is required.

The fourth step, the configuration file smb.conf, a service program most important is the configuration file.

Too many configuration items do not introduce themselves online search, feeling very complex. My configuration file is as follows:

[Global]
Workgroup = Workgroup
Server string =  Samba
NetBIOS name = Samba Security
= Share
Guest account = root
[Homes]
Path =/
available = yes
browsable = yes public
= yes
writable = yes
guest ok = Ye S

The fifth step, import smbd,nmbd,smb.conf These three files into the embedded board, specifically according to the project characteristics of each platform operation.

The main is to create the following four directories:

/usr/local/samba/bin
/usr/local/samba/private
/usr/local/samba/lib

/usr/local/samba/var

And then it's OK:

./usr/local/samba/bin/smbd-d
./usr/local/samba/bin/nmbd-d

At this point you may find that some libraries are missing, and then you'll find them thrown into the/usr/local/samba/lib

As my error: Smbd:error while loading shared libraries:libpopt.so.0:cannot open Shared object file:no such file or directory

Then find libpopt.so.0, very lucky in the compilation project found, thrown into the file system, finished.

\\192.168.1.1 can be opened for sharing.

If you set boot Samba on, you can open the Samba share content directly \\192.168.1.1.

Finally add a sentence: Smbd-i-D 8 starts SMB, you can print startup information, where-I is interactive mode, and-D is the print debug level.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.