移植linphone到FriendlyARM-smart210
虚拟机使用:Ubuntu 12.04
交叉工具链使用:arm-linux-gcc4.5.1,这个编译器是友善之臂提供的
嵌入式linux版本:3.0.8
将编译器添加到环境变量中:
gedit /etc/profile 在最后一行加入export PATH=/usr/local/arm/4.5.1/bin:$PATH
更新环境变量:
source /etc/profile
查看arm编译器版本:
arm-linux-gcc -v
根据项目需求,移植一个只有语音功能的linphone(无需界面与视频)
linphone移植需要依赖其他库:
libogg-1.3.0.tar.gz http://freecode.com/projects/libogg
speex-1.2rc1.tar.gz http://www.speex.org/downloads/
libosip2-3.3.0.tar.gz http://ftp.gnu.org/gnu/osip/
libeXosip2-3.3.0.tar.gz http://download.savannah.gnu.org/releases/exosip/ (与libosip2使用同一版本)
readline-6.2.tar.gz(如未加此库,会出现linphonecsh无法注册到服务器的问题)
linphone-3.2.0.tar.gz http://download.savannah.gnu.org/releases/linphone/
设置好交叉编译器环境变量
创建目录 /home/linphone/build,/home/linphone/arm_target,/home/linphone/sources
将所有安装包放入/home/linphone/sources,并解压到该文件夹下
tar -zxvf libogg-1.3.0.tar.gz
tar -zxvf readline-6.2.tar.gz
tar -zxvf libosip2-3.3.0.tar.gz
tar -zxvf libeXosip2-3.3.0.tar.gz
tar -zxvf linphone-3.2.0.tar.gz
交叉编译libogg
mkdir /home/linphone/build/libogg
cd /home/linphone/build/libogg
../../sources/libogg-1.3.0/configure --prefix=/home/linphone/arm_target CC=arm-linux-gcc --host=arm-linux --enable-static --disable-shared
make
make install(一般情况下没有错误发生)
交叉编译speex
mkdir /home/linphone/build/speex
cd /home/linphone/build/speex
../../sources/speex-1.2rc1/configure --host=arm-linux --prefix=/home/linphone/arm_target --enable-static --disable-shared --with-ogg=/home/linphone/arm_target/
CC=arm-linux-gcc(加上此语句在config过程中会抱错,所以暂时去掉此语句)
make
make install (一般情况下没有错误发生)
交叉编译libosip2
mkdir /home/linphone/build/libosip2
cd /home/linphone/build/libosip2
../../sources/libosip2-3.3.0/configure CC=arm-linux-gcc --host=arm-linux--prefix=/home/linphone/arm_target --enable-shared --disable-static
make (一般情况下没有错误发生)
make install
交叉编译libeXosip2
mkdir /home/linphone/build/libeXosip2
cd /home/linphone/build/libeXosip2
../../sources/libeXosip2-3.3.0/configure CC=arm-linux-gcc --host=arm-linux --prefix=/home/linphone/arm_target --enable-shared --disable-static PKG_CONFIG_PATH=/home/linphone/arm_target/lib/pkgconfig/
make
make install (libeXosip2版本需要与libosip2的版本一直,否则编译不通过)
交叉编译readline (一般情况下没有错误发生)
mkdir /home/linphone/build/readline
cd /home/linphone/build/readline
../../sources/readline-6.2/configure --host=arm-linux --prefix=/home/linphone/arm_target --with-gnu-ld --disable-static
make
make install
交叉编译linphone
mkdir /home/linphone/build/linphone
cd /home/linphone/build/linphone
../../sources/linphone-3.2.0/configure --host=arm-linux --disable-static --prefix=/home/linphone/arm_target --enable-alsa=yes --disable-glib --with-osip=/home/linphone/arm_target --with-speex=/home/linphone/arm_target SPEEX_CFLAGS="-I/home/linphone/arm_target/include" SPEEX_LIBS="-L/home/linphone/arm_target/lib -lspeex -lspeexdsp" OSIP_CFLAGS="-I/home/linphone/arm_target/include" OSIP_LIBS="-L/home/linphone/arm_target/lib -leXosip2 -losipparser2" --disable-video --disable-gtk_ui PKG_CONFIG_PATH=/home/linphone/arm_target/lib/pkgconfig/ READLINE_CFLAGS="-I/home/linphone/arm_target/include" READLINE_LIBS="-L/home/linphone/arm_target/lib"
make
make install
注意:之前使用libeXosip2-4.0.0,编译linphone会报一堆错误,果断改用3.3.0版本,问题就没出现了,编译到后面出现config.h中的宏定义重复定义,只需在该文件中把相应的宏定义注释就解决了。
mount -t nfs -o nolock 192.168.2.133:/root/workspace /tmp
如果挂载后传输文件时出现:nfs: server 192.168.2.133 not responding, still trying的错误,可能是因为nfs-udp方式传输不稳定造成,使用以下语句挂载:
mount -t nfs -o intr,nolock,rsize=1024,wsize=1024 192.168.2.133:/root/workspace /tmp
挂载后要注意虚拟机ubuntu12.04中/etc/exports指定的共享文件目录为/root/workspace,因此要先把/home/linphone/arm_target目录拷贝到此共享目录中,再将arm_target/bin里的linphonec linphonecsh拷贝到开发板文件系统的/usr/local/bin,之后在开发板终端里运行这两个程序.
缺少库则从arm_target/lib拷贝到开发板的/usr/local/lib,如果arm_target/lib中没有需要的库文件,则从交叉工具链/usr/local/arm/4.5.1/中寻找.
开发板测试
1.以windows下的sip server 2008为服务器(linphonecsh在windows下可注册成功,在linux下的asterisk不能注册成功):
linphonecsh init
linphonecsh register --host IP --username user --password passwd
linphonecsh register --host 192.168.2.12 --username1002 --password1002
linphonecsh generic 'autoanswer enable'
linphonecsh generic 'soundcard use 1'
linphonecsh generic 'soundcard use /dev/dsp'
linphonecsh generic "proxy list"
linphonecsh dial "sip:1001@192.168.2.12"
linphonecsh hangup
linphonecsh exit
2.以linux下的asterisk为服务器(linphonec可注册成功):
./linphonec
linphonec>proxy add
指定sip服务器 sip:1003@192.168.2.134 回车
指定本终端identity sip:1003@192.168.2.134 回车
注册超期时间 600 回车
linphonec> call 1001 呼叫另一终端
linphonec> terminate 退出linphone
linphonec使用参考:
Linphonec is a terminal based version of linphone that reads commands from the user prompt.
Example:
Start linphonec in a terminal
$ linphonec
Ready
Warning: video is disabled in linphonec, use -V or -C or -D to enable.
Place an outgoing call
linphonec> call sip:594305005@someproxy.net
Alternatively, if someproxy.net is your default proxy configuration (entered via 'proxy add' command), you call simply like this
linphonec> call 594305005
Terminate a call
linphonec> terminate
At any time you can list available commands using 'help':
linphonec> help
Commands are:
---------------------------
help Print commands help
call Call a SIP uri
chat Chat with a SIP uri
terminate Terminate the current call
answer Answer a call
autoanswer Show/set auto-answer mode
proxy Manage proxies
soundcard Manage soundcards
webcam Manage webcams
staticpic Manage static pictures when nowebcam
ipv6 Use IPV6
refer Refer the current call to the specified destination.
nat Set nat address
stun Set stun server address
firewall Set firewall policy
call-logs Calls history
friend Manage friends
play play from a wav file
record record to a wav file
quit Exit linphonec
register Register in one line to a proxy
unregister Unregister from default proxy
duration Print duration in seconds of the last call.
status Print various status information
ports Network ports configuration
speak Speak a sentence using espeak TTS engine
codec Audio codec configuration
vcodec Video codec configuration
ec Echo cancellation
mute Mute microphone and suspend voice transmission.
unmute Unmute microphone and resume voice transmission.
nortp-on-a Set the rtp_no_xmit_on_audio_mute configuration parameter
---------------------------
Type 'help <ltcommand>' for more details.
——————————————————————————————————————————————
经过测试,运行linphone导致arm linux无法重启,可试下一下步骤
cd /
kill -9 linphonec的pid
reboot