欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

samba-3.0.37在Hi3559A上的移植

程序员文章站 2022-05-11 17:29:42
...

0,主机环境

[email protected]:/# lsb_release -a 
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty
[email protected]:/# 
[email protected]:/# aarch64-himix100-linux-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-himix100-linux-gcc
COLLECT_LTO_WRAPPER=/opt/hisi-linux/x86-arm/
aarch64-himix100-linux/host_bin/../libexec/gcc/aarch64-linux-gnu/6.3.0/lto-wrapper
Target: aarch64-linux-gnu 

Thread model: posix
gcc version 6.3.0 (HC&C V100R002C00B012_20180601) 

1,samba-3.0.37下载

https://download.samba.org/pub/samba/

2,补丁参考

http://samba.2283325.n4.nabble.com/Tough-question-errors-while-cross-compiling-to-MIPS-td2469448.html

3,交叉编译

先仔细阅读 configure 配置脚本使用说明

# ./configure --help 
`configure' configures this package to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local/samba]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/samba/bin', `/usr/local/samba/lib' etc.  You can specify
an installation prefix other than `/usr/local/samba' using `--prefix',
for instance `--prefix=$HOME'.

根据步骤2的方法,将修改后的makefile文件放在samba-3.0.37目录下,然后 make 进行配置编译

samba-3.0.37# make 

4,程序测试

开发板上面:
创建工作目录:
mkdir /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

# cat  /usr/local/samba/lib/smb.conf
display charset =UTF-8
unix charset = UTF-8

[global]
interfaces = eth0
workgroup =MYGROUP
server string =Samba
netbios name =myarm
guest account=root
security =share

### sudo chmod 777 /share /// do it first
[share]
path=/share
available=yes
browsable=yes
public=yes
writable=yes

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

在PC中打开 \\192.168.1.230 就可以看到开发板的内容了。

5,板卡端调试

如果 smb没有运行,可以用 smbd -i -d 8 启动smbd,可以打印启动信息,其中-i 是交互模式,-d是打印调试级别。
对照出错提示进行调试。

smbd -i -d 8  

6,相关命令


/usr/local/samba/bin # ./smbd --help 
Usage: smbd [OPTION...]
  -D, --daemon                            Become a daemon (default)
  -i, --interactive                       Run interactive (not a daemon)
  -F, --foreground                        Run daemon in foreground (for
                                          daemontools, etc.)
  --no-process-group                      Don't create a new process group
  -S, --log-stdout                        Log to stdout
  -b, --build-options                     Print build options
  -p, --port=STRING                       Listen on the specified ports
  -P, --profiling-level=PROFILE_LEVEL     Set profiling level

Help options:
  -?, --help                              Show this help message
  --usage                                 Display brief usage message

Common samba options:
  -d, --debuglevel=DEBUGLEVEL             Set debug level
  -s, --configfile=CONFIGFILE             Use alternate configuration file
  -l, --log-basename=LOGFILEBASE          Base name for log files
  -V, --version                           Print version

Build-time configuration overrides:
  --sbindir=SBINDIR                       Path to sbin directory
  --bindir=BINDIR                         Path to bin directory
  --swatdir=SWATDIR                       Path to SWAT installation directory
  --lmhostsfile=LMHOSTSFILE               Path to lmhosts file
  --libdir=LIBDIR                         Path to shared library directory
  --shlibext=SHLIBEXT                     Shared library extension
  --lockdir=LOCKDIR                       Path to lock file directory
  --piddir=PIDDIR                         Path to PID file directory
  --smb-passwd-file=SMB_PASSWD_FILE       Path to smbpasswd file
  --private-dir=PRIVATE_DIR               Path to private data directory
  
/usr/local/samba/bin # ./smbd -b
Build environment:
   Built by:    [email protected]
   Built on:    Thu May 23 00:29:33 PDT 2019
   Built using: aarch64-himix100-linux-gcc
   Build host:  Linux ubuntu 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
   SRCDIR:      /opt/samba-3.0.37/source
   BUILDDIR:    /opt/samba-3.0.37/source

Paths:
   SBINDIR: /usr/local/samba/sbin
   BINDIR: /usr/local/samba/bin
   SWATDIR: /usr/local/samba/swat
   CONFIGFILE: /usr/local/samba/lib/smb.conf
   LOGFILEBASE: /usr/local/samba/var
   LMHOSTSFILE: /usr/local/samba/lib/lmhosts
   LIBDIR: /usr/local/samba/lib
   SHLIBEXT: shared_libraries_disabled
   LOCKDIR: /usr/local/samba/var/locks
   PIDDIR: /usr/local/samba/var/locks
   SMB_PASSWD_FILE: /usr/local/samba/private/smbpasswd
   PRIVATE_DIR: /usr/local/samba/private
   



参考:
1, 嵌入式samba功能的实现,linux下samba的移植 https://blog.csdn.net/ternence_hsu/article/details/70241669
2, 移植Samba-2.2.12到Hi3520 http://blog.chinaunix.net/uid-20682890-id-3483188.html
3, Tough question: errors while cross compiling to MIPS
http://samba.2283325.n4.nabble.com/Tough-question-errors-while-cross-compiling-to-MIPS-td2469448.html

相关标签: samba