始创于2000年 股票代码:831685
咨询热线:0371-60135900 注册有礼 登录
  • 挂牌上市企业
  • 60秒人工响应
  • 99.99%连通率
  • 7*24h人工
  • 故障100倍补偿
您的位置: 网站首页 > 帮助中心>文章内容

ARM上交叉编译蓝牙Bluez

发布时间:  2012/8/27 17:16:26

dbus-1.2.16.tar.gz  download

Bluez交叉编译移植到arm linux .
Version:

Bluez:3.36

Gcc :arm-linux-gcc-3.4.1

所需软件包:

libxml2-2.7.4

dbus1.0.2

glib-2.16.5

bluez-utils-3.36依赖于dbus和glib,而dbus依赖于libxml2,所以编译顺序是libxml,dbus,glib,bluez-utils-3.36.

流程写的简单,其实在我自己的编译过程中出现了无数的问题,只是都简化到配置里面去了,所以configuare一定要配置好.

1.编译bluez-libs-3.36

./configure --host=arm-linux --prefix="$PWD/../release/bluez_libs"
make&make install
没有什么依赖库的问题,直接编译通过.

2.编译libxml2-2.7.4

./configure --prefix="$PWD/../release/bluez_libs" --host=arm-linux
  make
  make install

没有依赖库,顺利通过

3.编译dbus1.0.2

echo ac_cv_have_abstract_sockets=yes>arm-linux.cache
./configure --prefix="$PWD/../release/bluez_libs" --host=arm-linux CC="arm-linux-gcc -I/home/jay/tools/bluez3/release/bluez_libs/include -L/home/jay/tools/bluez3/release/bluez_libs/lib" --cache-file=arm-linux.cache --with-x=no
 --with-xml=libxml PKG_CONFIG_PATH="$PWD/../release/bluez_libs/lib/pkgconfig"
make&make install
顺利通过了

4.编译glib-2.16.5

echo ac_cv_type_long_long=yes>arm-linux.cache
echo glib_cv_stack_grows=no>>arm-linux.cache
echo glib_cv_uscore=no>>arm-linux.cache
echo ac_cv_func_posix_getgrgid_r=yes>>arm-linux.cache
echo ac_cv_func_posix_getpwuid_r=yes>>arm-linux.cache
./configure --prefix="$PWD/../release/bluez_libs" --host=arm-linux CC="arm-linux-gcc -I/home/jay/tools/bluez3/release/bluez_libs/include
-L/home/jay/tools/bluez3/release/bluez_libs/lib" --cache-file=arm-linux.cache PKG_CONFIG_PATH="$PWD/../release/bluez_libs/lib/pkgconfig"
#make
#make install

5.编译bluez-utils-3.36.
./configure --prefix="$PWD/../release/bluez_libs" --host=arm-linux CC="arm-linux-gcc -I/home/jay/tools/bluez3/release/bluez_libs/include -L/home/jay/tools/bluez3/release/bluez_libs/lib -shared" PKG_CONFIG_PATH="$PWD/../release/bluez_libs/lib/pkgconfig" --disable-audio --enable-test

make&make install

如果不追加-shared,会出现很讨厌的__fini_array_start错误.

遇到storage.c:286: error: error: `ENOKEY' undeclared
修改storage.c 增加#define ENOKEY 161

至此bluez编译完毕.


文件系统的制作:

将sbin和bin下的文件复制进文件系统的sbin下面,lib文件需要的有

libbluetooth.so
libbluetooth.so.2  libbluetooth.so.2.11.2

libxml2.so
libxml2.so.2 libxml2.so.2.7.4

libglib-2.0.so
libglib-2.0.so.0 libglib-2.0.so.0.1600.5

libgmodule-2.0.so.0  libgmodule-2.0.so.0.1600.5

前面是软链接,后面是本尊

将etc文件夹复制过去.

最后记得把hcidump(需要另外编译,没有任何难度)复制到sbin,它方便调试的

以下是Leeu我的编译遇到 的问题.

libusb 要用到g++
./configure --prefix=/opt/libs --host=arm-linux CC="arm-none-linux-gnueabi-gcc" CXX=arm-none-linux-gnueabi-g++  

dbus的编译,把下面整个一起执行

USE_ARCH=32 NM=nm CC="arm-none-linux-gnueabi-gcc ${BUILD32}" ./configure --prefix=/opt/libs --host=arm-linux --target=arm-linux     CC="arm-none-linux-gnueabi-gcc -I/opt/libs/include -L/opt/libs/lib" --cache-file=arm-linux.cache --with-x=no
否则会报libtool中 eval的错误

4.编译glib-2.16.5

echo ac_cv_type_long_long=yes>arm-linux.cache
echo glib_cv_stack_grows=no>>arm-linux.cache
echo glib_cv_uscore=no>>arm-linux.cache
echo ac_cv_func_posix_getgrgid_r=yes>>arm-linux.cache
echo ac_cv_func_posix_getpwuid_r=yes>>arm-linux.cache


./configure --prefix=/opt/libs --host=arm-linux CC="arm-none-linux-gnueabi-gcc -I/opt/libs/include -L/opt/libs/lib" --cache-file=arm-linux.cache PKG_CONFIG_PATH=/opt/libs/lib/pkgconfig

#make
#make install

buluz-utils
./configure --prefix=/opt/libs --host=arm-linux CC="arm-none-linux-gnueabi-gcc -I/opt/libs/include -L/opt/libs/lib -shared" PKG_CONFIG_PATH=/opt/libs/lib/pkgconfig --disable-audio
去掉--enable-test
过程会报找不到yacc, flex等命令,安装命令即可

这样就编译好了。


 


本文出自:亿恩科技【www.enkj.com】

服务器租用/服务器托管中国五强!虚拟主机域名注册顶级提供商!15年品质保障!--亿恩科技[ENKJ.COM]

  • 您可能在找
  • 亿恩北京公司:
  • 经营性ICP/ISP证:京B2-20150015
  • 亿恩郑州公司:
  • 经营性ICP/ISP/IDC证:豫B1.B2-20060070
  • 亿恩南昌公司:
  • 经营性ICP/ISP证:赣B2-20080012
  • 服务器/云主机 24小时售后服务电话:0371-60135900
  • 虚拟主机/智能建站 24小时售后服务电话:0371-60135900
  • 专注服务器托管17年
    扫扫关注-微信公众号
    0371-60135900
    Copyright© 1999-2019 ENKJ All Rights Reserved 亿恩科技 版权所有  地址:郑州市高新区翠竹街1号总部企业基地亿恩大厦  法律顾问:河南亚太人律师事务所郝建锋、杜慧月律师   京公网安备41019702002023号
      0
     
     
     
     

    0371-60135900
    7*24小时客服服务热线