基于蓝牙设备的移植

38 篇文章 5 订阅

#!/bin/sh

#移植说明: 基于蓝牙设备的移植。 

#环境
export XROOT=/home/hxs/xroot
export PREFIX=$XROOT
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export HOST=arm-linux
export BUILD=i686-linux


CROSS_COMPILE=/usr/local/arm/3.4.2-multilib-rhel5/bin/arm-linux
export CC=$CROSS_COMPILE-gcc
export CXX=$CROSS_COMPILE-g++
export AR=$CROSS_COMPILE-ar
export RANLIB=$CROSS_COMPILE-ranlib
export NM=$CROSS_COMPILE-nm
export AS=$CROSS_COMPILE-as
export LD=$CROSS_COMPILE-ld
export STRIP=$CROSS_COMPILE-strip
export READELF=$CROSS_COMPILE-readelf
export STRINGS=$CROSS_COMPILE-strings
export SIZE=$CROSS_COMPILE-size
export ADDR2LINE=$CROSS_COMPILE-addr2line

#获取资源
cd /home/hxs/bluez
wget -c http://bluez.sf.net/download/bluez-libs-3.36.tar.gz
wget -c http://bluez.sf.net/download/bluez-utils-3.36.tar.gz
#获取依赖
wget -c http://prdownloads.sourceforge.net/libdnet/libdnet-1.11.tar.gz
wget -c http://dbus.freedesktop.org/releases/dbus/dbus-1.0.3.tar.gz
wget -c http://www.kernel.org/pub/linux/bluetooth/libgdbus-0.2.tar.gz

wget -c http://prdownloads.sourceforge.net/libusb/libusb-0.1.12.tar.gz

wget -c ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.18.tar.bz2
wget -c ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.18.tar.bz2
wget -c ftp://ftp.alsa-project.org/pub/tools/alsa-tools-1.0.18.tar.bz2

wget -c http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.10.12.tar.bz2

wget -c http://people.suug.ch/~tgr/libnl/files/libnl-1.1.tar.gz

wget -c http://www.mega-nerd.com/libsndfile/libsndfile-1.0.10.tar.gz

wget -c http://www.kernel.org/pub/linux/bluetooth/openobex-1.4.tar.gz

#编译 : 必须要编译的项: dbus, gdbus, usb,  (可选附加功能: openobex, sndfil, netlink, gstreamer, alsa-lib)
tar zxf dbus-1.0.3.tar.gz
cd dbus-1.0.3
#修改 configure, 找cannot run test program while cross compiling, 把其下的 { exit; }} 替换成 }
#X11方式
#./configure --prefix=$PREFIX --host=$HOST --build=$BUILD  --with-xml=libxml --with-x --x-libraries=${PREFIX}/lib --x-includes=${PREFIX}/include

#无x-window 支持
./configure --prefix=$PREFIX --host=$HOST --build=$BUILD  --with-xml=libxml
#vi bus/Makefile, 把Wall 后加 -shared
make all; make install;


tar zxf libgdbus-0.2.tar.gz
cd libgdbus

#修改 configure, 找cannot run test program while cross compiling, 把其下的 { exit; }} 替换成 }

DBUS_CFLAGS="-I/home/hxs/xroot/lib/dbus-1.0/include -I/home/hxs/xroot/include/dbus-1.0"
DBUS_LIBS="-L/home/hxs/xroot/lib -ldbus-1"
GLIB_CFLAGS="-I/home/hxs/xroot/lib/glib-2.0/include -I/home/hxs/xroot/include/glib-2.0"
GLIB_LIBS="-L/home/hxs/xroot/lib -lglib-2.0 "
./configure --prefix=$PREFIX --host=$HOST --build=$BUILD

tar zxf libusb-0.1.12.tar.gz
cd libusb-0.1.12
./configure --prefix=$PREFIX --host=$HOST --build=$BUILD
make all; make install;


tar jxf alsa-lib-1.0.18.tar.bz2
cd alsa-lib-1.0.18
./configure --prefix=$PREFIX --host=$HOST --build=$BUILD
make all; make install;


tar zxf openobex-1.4.tar.gz
cd openobex-1.4
BLUETOOTH_CFLAGS="-I/home/hxs/xroot/bluz/include"
BLUETOOTH_LIBS="-L/home/hxs/xroot/lib -lbluetooth"
#vi configure: 找cannot check for file existence when cross compiling, 去掉下面的exit行为 }
./configure --prefix=$PREFIX --host=$HOST --build=$BUILD

#vi lib/Makefile, DEFAULT_INCLUDES = -I. -I$(top_builddir) -I/home/hxs/xroot/bluz/include
make all; make install;

tar zxf libsndfile-1.0.10.tar.gz
cd libsndfile-1.0.10
./configure --prefix=$PREFIX --host=$HOST --build=$BUILD
make all; make install;


tar zxf bluez-libs-3.36.tar.gz
cd bluez-libs-3.36
./configure --prefix=$PREFIX --host=$HOST --build=$BUILD
make all; make install;

tar zxf bluez-utils-3.36.tar.gz
cd bluez-utils-3.36
BLUEZ_CFLAGS="-I/home/hxs/xroot/include"
BLUEZ_LIBS="-L/home/hxs/xroot/lib -lbluetooth "
DBUS_CFLAGS="-I/home/hxs/xroot/lib/dbus-1.0/include -I/home/hxs/xroot/include/dbus-1.0"
DBUS_LIBS="-L/home/hxs/xroot/lib -ldbus-1"
GLIB_CFLAGS="-I/home/hxs/xroot/lib/glib-2.0/include -I/home/hxs/xroot/include/glib-2.0"
GLIB_LIBS="-L/home/hxs/xroot/lib -lglib-2.0 "
USB_CFLAGS="-I/home/hxs/xroot/include"
USB_LIBS="-L/home/hxs/xroot/lib -lusb "
GMODULE_CFLAGS="-I/home/hxs/xroot/include"
GMODULE_LIBS="-L/home/hxs/xroot/lib -Wl,--export-dynamic -lgmodule-2.0 -ldl"
BLUETOOTH_CFLAGS="-I/home/hxs/xroot/bluz/include"
BLUETOOTH_LIBS="-L/home/hxs/xroot/lib -lbluetooth"
./configure --prefix=$PREFIX --host=$HOST --build=$BUILD --enable-all

#出现 undefined reference to '__init_array_start/end' 类似的错误时
#vi tools hcid rfcomm/Makefile  : LDFLAGS =  -pie 却掉 -fpie
make; make install;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值