2013年10月15日 星期二

Cross compile bluez for ARM

下載與解壓縮toolschain:
http://www.friendlyarm.net/dl.php?file=arm-linux-gcc-4.4.3.tgz
$ sudo tar xvf ~/arm-linux-gcc-4.4.3.tgz -C /
設定環境變數:
$ export PATH=/opt/FriendlyARM/toolschain/4.4.3/bin:$PATH
$ export CROSS_COMPILE=arm-none-linux-gnueabi-
$ export ARCH=arm
編譯BlueZ 2.25:
下載與編譯bluez-libs:
$ mkdir bluez-2.25
$ cd bluez-2.25
$ wget http://bluez.sf.net/download/bluez-libs-2.25.tar.gz
$ tar zxvf bluez-libs-2.25.tar.gz
$ cd bluez-libs-2.25
$ ./configure --host=arm-none-linux-gnueabi --prefix=/home/renee/myfs/rootfs \
--enable-shared=no --enable-static=yes
$ make
$ make install
下載與編譯bluez-utils:
$ wget http://bluez.sf.net/download/bluez-utils-2.25.tar.gz
$ tar zxvf bluez-utils-2.25.tar.gz
$ cd bluez-utils-2.25
$ ./configure --host=arm-none-linux-gnueabi --prefix=/home/renee/myfs/rootfs \
LDFLAGS=-L"/home/renee/myfs/rootfs/lib" CFLAGS="--static"
$ make
$ make install
編譯過程有下面錯誤訊息:
error: 'USHRT_MAX' undeclared (first use in this function)
error: 'PATH_MAX' undeclared (first use in this function)
請在下面每一檔案加入這一行『 #include <limits.h> 』:
./bluez-2.25/bluez-utils-2.25/tools/hciattach.c
./bluez-2.25/bluez-utils-2.25/tools/hciconfig.c
./bluez-2.25/bluez-utils-2.25/sdpd/request.c
./bluez-2.25/bluez-utils-2.25/hidd/sdp.c
./bluez-2.25/bluez-libs-2.25/src/sdp.c
編譯BlueZ 3.36:
下載與編譯bluez-libs:
$ mkdir bluez-3.36
$ cd bluez-3.36
$ wget http://bluez.sf.net/download/bluez-libs-3.36.tar.gz
$ tar zxvf bluez-libs-3.36.tar.gz
$ cd bluez-libs-3.36
$ ./configure --host=arm-none-linux-gnueabi --prefix=/home/renee/myfs/rootfs \
--enable-shared=no --enable-static=yes
$ make
$ make install
$ cd ..
下載與編譯expat:
$ wget http://pkgs.fedoraproject.org/repo/pkgs/expat/expat-2.1.0.tar.gz/dd7dab7a5fea97d2a6a43f511449b7cd/expat-2.1.0.tar.gz
$ tar zxvf expat-2.1.0.tar.gz
$ cd expat-2.1.0
$ ./configure --host=arm-none-linux-gnueabi --prefix=/home/renee/myfs/rootfs \
--enable-shared=no --enable-static=yes
$ make
$ make install
$ cd ..
下載與編譯dbus:
$ sudo apt-get install pkg-config
$ wget http://dbus.freedesktop.org/releases/dbus/dbus-1.7.4.tar.gz
$ tar zxvf dbus-1.7.4.tar.gz
$ cd dbus-1.7.4
$ export PKG_CONFIG_LIBDIR=/home/renee/myfs/rootfs/lib/pkgconfig
$ echo ac_cv_have_abstract_sockets=yes > arm-linux.cache
$ ./configure --host=arm-none-linux-gnueabi --prefix=/home/renee/myfs/rootfs \
CC="arm-none-linux-gnueabi-gcc -L/home/renee/myfs/rootfs/lib -I/home/renee/myfs/rootfs/include -lexpat" \
--cache-file=arm-linux.cache
$ make
$ make install
$ cd ..
下載與編譯bluez-utils:
$ wget http://bluez.sf.net/download/bluez-utils-3.36.tar.gz
$ tar zxvf bluez-utils-3.36.tar.gz
$ cd bluez-utils-3.36
$ ./configure --prefix=/home/renee/myfs/rootfs --host=arm-none-linux-gnueabi \
CC="arm-none-linux-gnueabi-gcc -L/home/renee/myfs/rootfs/lib -I/home/renee/myfs/rootfs/include"
$ make
$ make install

沒有留言:

張貼留言