bluetooth开发(一)------Bluez工具的编译与移植
·
最近处理的事太多了,只能先写一些实践性的文章,理论的理解与阐述等有时间再写吧。
这一片主要是介绍Bluez工具的编译与移植,主要目的是测试内核驱动蓝牙模块是否正常。有些内容会涉及到公司产品,只能等产品发布后才能公布部分博客,最近在整理产品的文档,也算比较忙吧。该部分是在linux下mips架构环境下,经本人验证是可行的。
我用的一些开源包:下载(bluez源码被我改动了,这里涉及到mipsel的兼容问题)
转载请注明:http://blog.csdn.net/wang_zheng_kai
注意:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
在这里只是移植了bluez的工具,它的运行还需要dbus环境的支持,涉及到产品发布问题,后期将会介绍。我自己针对固件的加载和初始化写了一个脚本。
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1 Bluez production process
2
3 (1)Specify the installation path
4 /usr/lib/bluetooth
5
6 (2)Specify the compiler path
7 export PATH=$PATH:/opt/mipseltools-gcc412-glibc261/bin
8
9 (3)Compile expat, alsa, zlib, glib, bluez and openobex
10 root@user-FMVC10C131:/tem/expat-2.0.1# ./configure --prefix=/usr/lib/bluetooth/ --host=mipsel-linux --target=mipsel-linux CC=mipsel-linux-gcc
11 root@user-FMVC10C131:/tem/expat-2.0.1#make
12 root@user-FMVC10C131:/tem/expat-2.0.1#make install
13
14 root@user-FMVC10C131:/tem/zlib-1.2.8# CC=mipsel-linux-gcc ./configure --prefix=/usr/lib/bluetooth
15 root@user-FMVC10C131:/tem/zlib-1.2.8#make
16 root@user-FMVC10C131:/tem/zlib-1.2.8#make install
17
18 root@user-FMVC10C131:/tem/alsa-lib-1.0.27.2# ./configure --host=mipsel-linux --prefix=/usr/lib/bluetooth --enable-shared --disable-python --with-versioned=n
19 root@user-FMVC10C131:/tem/alsa-lib-1.0.27.2#make
20 root@user-FMVC10C131:/tem/alsa-lib-1.0.27.2#make install
21
22 root@user-FMVC10C131:/tem/alsa-utils-1.0.27.2#./configure --host=mipsel-linux --prefix=/usr/lib/bluetooth CPPFLAGS=-I/usr/lib/bluetooth/include LDFLAGS=-L/usr/lib/bluetooth/lib --disable-alsamixer --disable-xmlto --disable-nls
23 root@user-FMVC10C131:/tem/alsa-utils-1.0.27.2#make
24 root@user-FMVC10C131:/tem/alsa-utils-1.0.27.2#make install
25
26 root@user-FMVC10C131:/tem/dbus-1.0.3#echo ac_cv_have_abstract_sockets=yes>mipsel-linux.cache
27 root@user-FMVC10C131:/tem/dbus-1.0.3# ./configure --prefix=/usr/lib/bluetooth --host=mipsel-linux --target=mipsel-linux CC="mipsel-linux-gcc -I/usr/lib/bluetooth/include -L/usr/lib/bluetooth/lib/" --cache-file=mipsel-linux.cache --with-x=no --with-xml=expat
28 root@user-FMVC10C131:/tem/dbus-1.0.3#make
29 root@user-FMVC10C131:/tem/dbus-1.0.3#make install
30
31 root@user-FMVC10C131:/tem/glib-2.24.0# echo ac_cv_type_long_long=yes>mipsel-linux.cache
32 root@user-FMVC10C131:/tem/glib-2.24.0# echo glib_cv_stack_grows=no>>mipsel-linux.cache
33 root@user-FMVC10C131:/tem/glib-2.24.0# echo glib_cv_uscore=no>>mipsel-linux.cache
34 root@user-FMVC10C131:/tem/glib-2.24.0# echo c_cv_func_posix_getpwuid_r=yes>>mipsel-linux.cache
35 root@user-FMVC10C131:/tem/glib-2.24.0# echo ac_cv_func_posix_getpwuid_r=yes>>mipsel-linux.cache
36 root@user-FMVC10C131:/tem/glib-2.24.0# echo ac_cv_func_posix_getgrgid_r=yes>>mipsel-linux.cache
37 root@user-FMVC10C131:/tem/glib-2.24.0# ./configure --prefix=/usr/share/Bluetooth --host=mipsel-linux --target=mipsel-linux CC="mipsel-linux-gcc -I/usr/lib/bluetooth/include -L/usr/lib/bluetooth/lib" --cache-file=mipsel-linux.cache
38 root@user-FMVC10C131:/tem/glib-2.24.0#make
39 root@user-FMVC10C131:/tem/glib-2.24.0#make install
40
41 root@user-FMVC10C131:/tem/bluez-4.95#export PKG_CONFIG_LIBDIR=/usr/lib/bluetooth/lib/pkgconfig
42 root@user-FMVC10C131:/tem/bluez-4.95#./configure --prefix=/usr/lib/bluetooth --host=mipsel-linux --target=mipsel-linux CC=mipsel-linux-gcc CC="mipsel-linux-gcc -I/usr/lib/bluetooth/include -I/home/user/bluez/kernel-3.0.8/include -L/usr/lib/bluetooth/lib" --disable- gstreamer --enable-hid2hci --enable-hidd --enable-alsa --enable-audio --enable-service --enable-tools --enable-serial --enable-input -- enable-static --enable-shared --enable-test--disable-gstreamer --enable-hid2hci --enable-hidd --enable-alsa --enable-audio --enable- service --enable-tools --enable-serial --enable-input --enable-static --enable-shared --enable-test
43 root@user-FMVC10C131:/tem/bluez-4.95#make
44 root@user-FMVC10C131:/tem/bluez-4.95#make install
45
46 root@user-FMVC10C131:/tem/openobex-1.3# ./configure --prefix=/usr/lib/bluetooth/ --host=mipsel-linux CC=mipsel-linux-gcc CFLAGS=-I/usr/lib/bluetooth/include LDFLAGS=-L/usr/lib/bluetooth/lib --enable-apps BLUEZ_LIBS=-lbluetooth
47 root@user-FMVC10C131:/tem/openobex-1.3#make
48 root@user-FMVC10C131:/tem/openobex-1.3#make install
49
50 (4)Copy bin relevant files to the target board /usr/bin
51 Copy sbin relevant files to the target board /usr/sbin
52 Copy lib, var, share the same directory to the target board
自此我们已经做好了bluez的移植,下面我们该介绍,如何搭建dbus环境和执行bluetooth -udev以及解决重启清楚配对信息的操作。(产品发布后,敬请关注)
我将在第四节介绍bluez移植后的的初始化。
日后添加!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
更多推荐
已为社区贡献3条内容
所有评论(0)