【无标题】linux平台蓝牙协议栈Bluez的移植

交叉编译并移植蓝牙协议栈bluez 。

交叉编译并移植bluez,网上已有很多相关教程,需要根据教程下载很多包,交叉编译过程中会遇到编译报错,或者包依赖错误等问题,这里将交叉编译成功的bluez的整套代码及编译配置过程贴出来,供大家参考!

bluez代码:https://download.csdn.net/download/u013301596/65256824icon-default.png?t=LA92https://download.csdn.net/download/u013301596/65256824

这里以fsl平台交叉工具链编译为例,你可以配置自己的编译工具链。

交叉编译过程简单记录如下:

Cross-compiler:
fsl-imx-x11-glibc-x86_64-fsl-image-qt5-cortexa9hf-vfp-neon-toolchain-3.14.52-1.1.0.sh

Install the compiler:
$chmod 777 fsl-imx-x11-glibc-x86_64-fsl-image-qt5-cortexa9hf-vfp-neon-toolchain-3.14.52-1.1.0.sh
$./fsl-imx-x11-glibc-x86_64-fsl-image-qt5-cortexa9hf-vfp-neon-toolchain-3.14.52-1.1.0.sh
Follow the prompts to enter the tool chain directory(the default is /opt/fsl-imx-x11/)

Import the environment Var for the cross-compile tools:
$source /opt/fsl-imx-x11/3.14.52-1.1.0/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi

1,Compile bluez-hcidump

bluez-hcidump-configure:
        cd bluez/bluez-hcidump && ./configure \
        --host=arm-linux                          \
        --prefix=$(INSTALLDIR)/bluez-hcidump

bluez-hcidump:
        make -C bluez/bluez-hcidump
bluez-hcidump-clean:
        make -C bluez/bluez-hcidump clean
bluez-hcidump-install:
        make -C bluez/bluez-hcidump install
bluez-hcidump-distclean:
        make -C bluez/bluez-hcidump distclean


2,Compile openobex_ln
openobex-configure:
        if [ ! -e "bluez/openobex_ln/mybuild" ] ; then mkdir bluez/openobex_ln/mybuild;fi
        cd bluez/openobex_ln/mybuild && ../configure            \
        --enable-usb                                            \
        --disable-irda                                          \
        --enable-apps                                           \
        --enable-bluetooth                                      \
        --prefix=                                               \
        --target=arm-poky-linux-gnueabi --host=arm-poky-linux-gnueabi --build=x86_64-linux

openobex:
        cd bluez/openobex_ln/mybuild &&  make  

openobex-clean:
        rm -rf bluez/openobex_ln/mybuild

openobex-install:
        cd bluez/openobex_ln/mybuild && \
        make DESTDIR=$(TOP)/lib_install install
        cd bluez/openobex_ln/mybuild && make DESTDIR=$(INSTALLDIR)/bluez install
openobex-distclean:
        rm -rf bluez/openobex_ln/mybuild

3,Compile obexftp_ln
(SDKTARGETSYSROOT=/opt/fsl-imx-x11/3.14.52-1.1.0/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi)

obexftp-configure:
        if [ ! -e "bluez/obexftp_ln/configure" ] ; then         \
                cd bluez/obexftp_ln && aclocal --force -I m4;   \
                libtoolize --copy --force;                      \
                autoconf --force;                               \
                autoheader --force;                             \
                automake --add-missing --copy --force-missing;  \
        fi
        cd bluez/obexftp_ln &&  ./configure \
                                --disable-python                            \
                --target=arm-poky-linux-gnueabi --host=arm-poky-linux-gnueabi --build=x86_64-linux  \
                --with-sysroot=${SDKTARGETSYSROOT}                                                      \
                OPENOBEX_CFLAGS="-I$(TOP)/lib_install/usr/local/include" \
                OPENOBEX_LIBS="$(TOP)/lib_install/usr/local/lib/libopenobex.la"   \
                --disable-builddocs     \
                --disable-perl          \
                --disable-ruby          \
                --disable-tcl           \
                --without-libiconv-prefix   \
                --disable-dependency-tracking   \
                --disable-swig
obexftp:
        cd bluez/obexftp_ln &&  make
obexftp-clean:
        cd bluez/obexftp_ln && make clean
obexftp-distclean:
        cd bluez/obexftp_ln && make distclean
        rm -rf bluez/obexftp_ln/build
obexftp-install:
        install -d $(INSTALLDIR)/obexftp/usr/sbin
        install -d $(INSTALLDIR)/obexftp/usr/lib
        install -D $(TOP)/bluez/obexftp_ln/apps/.libs/obexftp $(INSTALLDIR)/obexftp/usr/sbin
        install -D $(TOP)/bluez/obexftp_ln/apps/.libs/obexftpd $(INSTALLDIR)/obexftp/usr/sbin
        install -D $(TOP)/bluez/obexftp_ln/obexftp/.libs/libobexftp.so.0.3.0 $(INSTALLDIR)/obexftp/usr/lib
        install -D $(TOP)/bluez/obexftp_ln/multicobex/.libs/libmulticobex.so.1 $(INSTALLDIR)/obexftp/usr/lib
        install -D $(TOP)/bluez/obexftp_ln/bfb/.libs/libbfb.so.0.0.5 $(INSTALLDIR)/obexftp/usr/lib

4,Compile bluez
bluez-configure:
        cd bluez/bluez && ./configure \
        --with-sysroot=${SDKTARGETSYSROOT} \
        --target=arm-poky-linux-gnueabi --host=arm-poky-linux-gnueabi --build=x86_64-linux \
        --enable-usb                    \
        --enable-tools                  \
        --enable-bccmd                  \
        --enable-dfutool                \
        --enable-test                   \
        --enable-hidd                   \
        --enable-hid2hci                \
        --enable-datafiles              \
        --enable-alsa                   \
        --enable-pand

bluez:
        cd bluez/bluez && make
bluez-clean:
        make  -C bluez/bluez clean
bluez-distclean:
        make -C bluez/bluez distclean
        rm -f bluez/bluez/test/agent
bluez-install:
        make DESTDIR=$(INSTALLDIR)/bluez -C bluez/bluez install
        make DESTDIR=$(TOP)/lib_install -C bluez/bluez install
        mkdir -p $(INSTALLDIR)/bluez/sbin && install -D $(TOP)/bluez/bluez/src/bluetoothd $(INSTALLDIR)/bluez/sbin/
        rm -rf $(INSTALLDIR)/bluez/var
        rm -rf $(INSTALLDIR)/bluez/include
        rm -rf $(INSTALLDIR)/bluez/usr/local/include
        cp -rvf $(INSTALLDIR)/bluez/usr/local/* $(INSTALLDIR)/bluez
        rm -rf $(INSTALLDIR)/bluez/usr/local

TO finish these,the bluez will be installed into the INSTALLDIR directory.Then just copy it to the board.

 

蓝牙协议栈bluez是用于在Linux系统上支持蓝牙功能的开源软件项目。对于蓝牙协议栈移植和开发,以下是一些关键点: 1. 移植蓝牙协议栈移植通常需要适配特定的硬件平台或操作系统。移植的关键在于理解目标平台的硬件特性和操作系统的API,并根据这些特性进行相应的修改。从硬件层面,可能需要针对不同的蓝牙芯片进行驱动程序的开发或移植。从操作系统层面,需要根据操作系统的内核和接口规范进行适配,确保蓝牙协议栈能够正确地与操作系统进行通信。 2. 开发:蓝牙协议栈bluez的开发需要理解蓝牙协议的基本原理和相关规范。开发人员需要掌握Linux系统编程和网络编程的相关知识,并深入了解蓝牙协议栈的各个层级和模块。在蓝牙协议栈的开发过程中,可能需要进行协议栈的扩展、功能的优化或新特性的添加。开发人员需要进行代码的编写、调试和测试,并确保新开发的功能与蓝牙协议栈的其他部分相互兼容。 3. 调试和问题解决:在蓝牙协议栈移植和开发过程中,可能会遇到各种问题和挑战。调试是解决这些问题的关键步骤之一,开发人员需要使用适当的工具和技术,如调试器、日志和追踪功能来定位和排除问题。在解决问题时,需要仔细查看相关文档、设计规范和代码实现,并通过分析日志和跟踪信息来理解问题的来源并提供解决方案。 总之,蓝牙协议栈bluez移植和开发需要掌握蓝牙协议的基础知识,具备Linux系统编程经验,了解硬件和操作系统的特性,并运用合适的调试和问题解决技术来确保蓝牙协议栈能够在目标平台上正确运行和提供所需的功能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

沫沫罗

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值