Here is an update to my last post. I made a small patch to include Bluez in the Buildroot build system. The bug with attached patch is on the Buildroot Bugzilla. When applied to your buildroot you can activate Bluez under
Package Selection for the target → Hardware handling / blockdevices and filesystem maintenance → bluez.
Is it working for you? Let me know if you have any problems with it.
Update: This post should be obsoleted by this one.
One optional target for our FALTER project (an autonomous UAV) is to have Bluetooth onboard to be able to get live telemetry data from it and possibly also for mission data up-/downloads.
For this we needed to cross compile Bluez for our Buildroot based Linux image. As it took me some time to figure out how to get it working, I think it might be helpful to others to post it here, because it’s not really hard to do, if you just know about the preconditions.
The problem is that Bluez uses pkg-config to find out where some libraries are. However the toolchain libraries are compiled with a prefix like
/usr (the /usr on the target device) but you need Bluez to compile against something like
/path/to/your/toolchain/usr. Pkg-config supports this through the
PKG_CONFIG_SYSROOT_DIR environment variable, which was introduced in version 0.23.
So the most important thing to know is you need pkg-config 0.23. Version 0.22, that still comes with Ubuntu 10.04 (Alpha 3 as of now) is not enough! There’s a bug report for Debian to include the newer version since Apr 2008, but it seems nothing has happened yet. Fortunately someone already packaged it, get it here, or use my precompiled package (for Ubuntu 10.04 amd64).
Our target device is a x86-based embedded board, so we compile for i586. Of course you need to change this appropriately for your architecture.
You need to tell pkg-config, where your cross toolchain libs are with two environment variables:
$ export PKG_CONFIG_SYSROOT_DIR=<path_to_buildroot>/build_i586/staging_dir
$ export PKG_CONFIG_LIBDIR=$PKG_CONFIG_SYSROOT_DIR/usr/lib/pkgconfig
Then configure for cross compiling (note the –host option):
$ ./configure --prefix=/usr --sysconfdir=/etc --host=i586-linux
You are then ready to build with
make and can install it with
make install DESTDIR=<your_target_fs>.
I will probably try to write a patch to get this into the Buildroot buid system in the next days.