经常需要移植各种软件包,标准的做法是使用发行版定制工具,如Yocto,详见Yocto的使用实例。但有些情况下,我们不得不手动去移植。
本文以移植openobex1.3为例,展现了移植的方方面面。
参考:http://blog.csdn.net/hclydao/article/details/51451725
openobex
|
|--bluez-libs
|__bluez-utils
|
|--libusb
|__glib
| |__zlib
| |
| ?//此处视版本而定,有时glib会和dbus互相依赖
|__dbus
|__expat
进入Device Drivers ---> USB support
选中host相关的选项
以及USB Physical Layer drivers子目录下的选项
进入Networking support
<*> Bluetooth subsystem support
进入Networking support ---> Bluetooth subsystem support
<*> RFCOMM protocol support
[*] RFCOMM TTY support
<*> BNEP protocol support
[*] Multicast filter support
[*] Protocol filter support
<*> HIDP protocol support
进入Networking support ---> Bluetooth subsystem support ---> Bluetooth device drivers
<*> HCI USB driver
< > HCI SDIO driver (NEW)
< > HCI UART driver (NEW)
<*> HCI BCM203x USB driver
<*> HCI BPA10x USB driver
< > HCI BlueFRITZ! USB driver (NEW)
< > HCI VHCI (Virtual HCI device) driver (NEW)
< > Marvell Bluetooth driver support
< > Marvell BT-over-SDIO driver
< > Atheros firmware download driver
make distclean
./configure --prefix=/home/xxx/work/tmp_blue --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc
make
make install
make distclean
./configure --prefix=/home/xxx/work/tmp_blue --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc
make
make install
make distclean
export TARGETMACH=arm-linux-gnueabihf
export CROSS=arm-linux-gnueabihf
export CC=${CROSS}-gcc
export LD=${CROSS}-ld
export AS=${CROSS}-as
./configure --prefix=/home/xxx/work/tmp_blue
make
make install
make distclean
sudo apt-get install libglib2.0-dev
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_getpwuid_r=yes>>arm-linux.cache
echo ac_cv_func_posix_getgrgid_r=yes>>arm-linux.cache
./configure --prefix=/home/xxx/work/tmp_blue --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf CC="arm-linux-gnueabihf-gcc -I/home/xxx/work/tmp_blue/include -L/home/xxx/work/tmp_blue/lib" --cache-file=arm-linux.cache
make
make install
在dbus-sysdeps-unix.c中添加
struct ucred
{
pid_t pid; /* PID of sending process. */
uid_t uid; /* UID of sending process. */
gid_t gid; /* GID of sending process. */
};
make distclean
rm arm-linux.cache
echo ac_cv_have_abstract_sockets=yes>arm-linux.cache
./configure --prefix=/home/xxx/work/tmp_blue --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf CC="arm-linux-gnueabihf-gcc -rdynamic -I/home/xxx/work/tmp_blue/include -L/home/xxx/work/tmp_blue/lib" --cache-file=arm-linux.cache --with-x=no --with-xml=expat GLIB_CFLAGS="-pthread -I/home/xxx/work/tmp_blue/include/glib-2.0 -I/home/xxx/work/tmp_blue/lib/glib-2.0/include -L/home/xxx/work/tmp_blue/lib -L/home/xxx/work/tmp_blue/lib/libgio-2.0 -L/home/xxx/work/tmp_blue/lib/libgobject-2.0 -L/home/xxx/work/tmp_blue/lib/libglib-2.0"
make install
make distclean
./configure --prefix=/home/xxx/work/tmp_blue --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf CC="arm-linux-gnueabihf-gcc -I/home/xxx/work/tmp_blue/include -L/home/xxx/work/tmp_blue/lib"
make
make install
make distclean
sudo apt-get install libdbus-1-dev libdbus-glib-1-dev
sudo apt-get install byacc
sudo apt-get install flex
./configure --prefix=/home/xxx/work/tmp_blue --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf CC="arm-linux-gnueabihf-gcc -I/home/xxx/work/tmp_blue/include -I/home/xxx/work/tmp_blue/include/dbus1.0/dbus -I/home/xxx/work/tmp_blue/include/glib-2.0/glib -I/home/xxx/work/tmp_blue/include/glib-2.0 -I/home/xxx/work/tmp_blue/lib/glib-2.0/include -L/home/xxx/work/tmp_blue/lib -lbluetooth -ldbus-1 -lglib-2.0 -lgio-2.0 -lgobject-2.0" BLUEZ_CFLAGS=-I/home/xxx/work/tmp_blue/include/bluetooth BLUEZ_LIBS=-L/home/xxx/work/tmp_blue/lib --disable-audio --enable-serial --enable-test
make distclean
export XROOT=/home/xxx/work/tmp_blue
export PREFIX=$XROOT
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export HOST=arm-linux-gnueabihf
export LD=$HOST-ld
./configure --prefix=$PREFIX --host=$HOST --target=$HOST --with-gnu-ld=$LD BLUETOOTH_CFLAGS="-I/home/xxx/work/tmp_blue/include -I/home/xxx/work/tmp_blue/include/openobex -L/home/xxx/Downloads/now_bluez/openobex-1.3/ircp -L/home/xxx/Downloads/now_bluez/openobex-1.3/app -L/home/xxx/Downloads/now_bluez/openobex-1.3/lib -L/home/xxx/work/tmp_blue/lib" BLUETOOTH_LIBS="-L/home/xxx/work/tmp_blue/lib -lbluetooth" --enable-bluetooth CC="arm-linux-gnueabihf-gcc -I/home/xxx/work/tmp_blue/include -L/home/xxx/work/tmp_blue/lib" CC="arm-linux-gnueabihf-gcc -I/home/xxx/work/tmp_blue/include -I/home/xxx/work/tmp_blue/include/openobex -L/home/xxx/Downloads/now_bluez/openobex-1.3/ircp -L/home/xxx/Downloads/now_bluez/openobex-1.3/app -L/home/xxx/Downloads/now_bluez/openobex-1.3/lib -L/home/xxx/work/tmp_blue/lib" --enable-apps LDFLAGS="-L/home/xxx/Downloads/now_bluez/openobex-1.3/ircp -L/home/xxx/Downloads/now_bluez/openobex-1.3/app -L/home/xxx/Downloads/now_bluez/openobex-1.3/lib -L/home/xxx/work/tmp_blue/lib"
mkdir -p /home/xxx/work/tmp_blue/
ln -s /etc /home/xxx/work/tmp_blue/
ln -s /var /home/xxx/work/tmp_blue/
ln -s /usr/lib /home/xxx/work/tmp_blue/
hciconfig hci0 up
hciconfig hci0 iscan
dbus-daemon --system
hcid -f /etc/bluetooth/hcid.conf -n -d &
sdptool add OPUSH
sdptool brower local
#查看opush的通道号,这里查出来是9
obex_test -b FF:FF:FF:00:00:00 9
s
#当s被输入后手机端发送文件,然后再次按s,即可接收文件
s
hciconfig hci0 up
hciconfig hci0 iscan
dbus-daemon --system
hcid -f /etc/bluetooth/hcid.conf -n -d &
sdptool search 0x1105
#查看手机的opush的通道号,这里查出来是12,
obex_test -b xx:xx:xx:xx:xx:xx 12
c
p /xxx/xxx xxx
联系客服