samba-3.0.37在Hi3559A上的移植

0,主機環境

root@ubuntu:/# lsb_release -a 
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty
root@ubuntu:/# 
root@ubuntu:/# 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:    root@ubuntu
   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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章