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

本文详细介绍如何使用fsl平台交叉工具链进行蓝牙协议栈bluez的交叉编译与移植,包括bluez-hcidump、openobex_ln、obexftp_ln及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.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

沫沫罗

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

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

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

打赏作者

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

抵扣说明:

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

余额充值