Transplantation of BlueZ

Source: Internet
Author: User
A period of time ago, both in the porting of BlueZ library files and tool base to arm of the Development Board, now the entire set of equipment has been basically completed. The kernel is the Development Board of its own 2.6.13, from the 2.4.6 version has been in the kernel with BlueZ support, I want to do is, into the networking subkeys, build-in Bluetooth subsystem support. The following L2CAP protocol support and SCO links support selected, Bluetooth device drivers is about whether you use USB bluetooth or serial Bluetooth, depending on your needs to choose. HCI vhci (Virtual HCI device) driver is a virtualized HCI interface that allows you to test your Bluetooth application without using a Bluetooth device. Save exit, make. Compile a new kernel image file.

Now start porting the BlueZ library files and toolset. The version used is bluez-lib-3.36 and bluez-utils-3.36. ARM-LINUX-GCC version for the 3.3.2 kernel version for kernel-2.6.13 compilation kernel and root file system to use the same version of the Cross compilation tool, otherwise the compiled command could not execute, there is a segment error.

Configure, the Configure script specifies the installation directory for make install,--prefix= can be configured, and the individual feels or does not use this option. This will generally install to/usr under, (see the source code of the install file), so the compilation must not make Isntall after completion. Otherwise, the software of the host system will be overwritten. The advantage of this is that your target system directory structure is very clear, such as/usr/bin under the user's executable file. Under/ETC are the configuration file directories for each software. The temporary files of the software are stored in/tmp, log information/var. So I just compile the executable or library file and manually copy it to the target board in the response directory. But the premise is that you need to know which files to copy and where they are. One is through the install file. Another stupid method is to compile two times, first specify--prefix=, compile and install, view all need those files as well as their location, the second time do not use--prefix= only compile not installed, and refer to the first manual copy.

Two compilation also has the advantage that when the source package is dependent on other source packages, you can use the generated. pc file to replace the host system's. pc file, which facilitates the compilation of other packages. The specific principle and use method please refer to the usage of pkg-config. Http://linux.chinaunix.net/bbs/archiver/tid-1058530.html

Of course, you can also use configure's other options to customize your directory structure,--Bindir &--exec-prefix=prefix, and so on. Specific reference to--HELP help.

now post the errors that are encountered in the compilation:

1. Compile bluez-libs-3.36

[mystic@moolenaar]$./configure--host=arm-linux CC=ARM-LINUX-GCC

Make compiles through. Copy the bluez.pc files generated after make to the/usr/lib/pkgconfig directory, but do the PC version of BLUEZ.PC backup. So that the BlueZ is restored after the cross compilation. This bluez.pc to use

Copy bluez.pc to Usr/lib/pkgconfig

2. Compile bluez-utils-3.36, lack of D-bus

[mystic@moolenaar]$./configure--host=arm-linux

Checking Pkg-config is at least version 0.9.0 ... Yes

Checking for BlueZ ... yes

Checking for GLIB ... no

Checking for gmodule ... no

Checking for Dlopen in-ldl ... yes

Checking for DBUS ... no

Configure:error:d-bus Library is required

Bluez-utils needs D-bus package support, download D-bus source code compilation installation. Some of the other source packs required by Bluez-utils will be posted at the end. (including the version number used)

3. Compile D-bus,can not run test program while cross compiling

[mystic@moolenaar]$./configure--host=arm-linux--prefix=/bluez/dbus CC=ARM-LINUX-GCC

Checking for Getpeereid ... no

Checking abstract socket namespace ... configure:error:cannot run test program while cross compiling

"Config.log ' for more details."

Execute./configure to run some test programs in the host system, because it is a cross compilation so this test will not pass. But no problem, we can specify the Cache-file file to screen out the test program when configure, the same problem will be encountered when compiling the glib package below.

Processing method:

Execute under the source package root directory

[mystic@moolenaar]$ echo Ac_cv_have_abstract_sockets=yes > Arm-linux.cache

[mystic@moolenaar]$./configure--host=arm-linux--prefix=/bluez/dbus CC=ARM-LINUX-GCC--cache-file=arm-linux.cache

After/configure passed, execute make, and the following error occurred:

MAKE[2]: * * * [CONFIG-LOADER-LIBXML.O] Error 1

MAKE[2]: Leaving directory '/3.3.2/dbus-1.0.2/bus '

MAKE[1]: * * * [all-recursive] Error 1

MAKE[1]: Leaving directory '/3.3.2/dbus-1.0.2 '

Make: * * * [ALL] Error 2

The XML library is missing and the copy Libxml-2.0.pc/usr/lib/pkgconfig is available after downloading the compiled installation.

4. Compile Dbus,cannot find-lx11

[mystic@moolenaar]$ Make

Arm-linux/bin/ld:cannot find-lx11

Collect2:ld returned 1 exit status

MAKE[2]: * * * [Dbus-launch] Error 1

MAKE[2]: Leaving directory '/3.3.2/dbus-1.0.2/tools '

MAKE[1]: * * * [all-recursive] Error 1

MAKE[1]: Leaving directory '/3.3.2/dbus-1.0.2 '

Make: * * * [ALL] Error 2

x Server is not required on the Development Board. Configure directly shielded.

[mystic@moolenaar]$./configure--host=arm-linux--prefix=/bluez/dbus CC=ARM-LINUX-GCC--cache-file=arm-linux.cache --without-x 5. Compile bluez-utils, missing macro definition

Bridge.c:82:error: ' SIOCBRADDBR ' undeclared (in the This function)

Bridge.c:82:error: (Each undeclared identifier are reported only once

Bridge.c:82:error:for each function it appears in.)

bridge.c:in function ' Bridge_remove ':

Bridge.c:100:error: ' Siocbrdelbr ' undeclared (in the This function)

bridge.c:in function ' Bridge_add_interface ':

Bridge.c:126:error: ' Siocbraddif ' undeclared (in the This function)

MAKE[2]: * * * [Bridge.lo] Error 1

MAKE[2]: Leaving directory '/3.3.2/bluez-utils-3.36/network '

MAKE[1]: * * * [all-recursive] Error 1

MAKE[1]: Leaving directory '/3.3.2/bluez-utils-3.36 '

Make: * * * [ALL] Error 2

Add the following macro definition to the bluez-utils-3.36/network/bridge.h:

#define SIOCBRADDBR 0x89a0

#define SIOCBRDELBR 0X89A1

#define SIOCBRADDIF 0X89A2

#define SIOCBRDELIF 0X89A3

6. Compile Bluez-utils

[mystic@moolenaar]$ Make

Storage.c-fpic-dpic-o. LIBS/STORAGE.O

storage.c:in function ' Encrypt_link ':

Storage.c:286:error: ' Enokey ' undeclared (in the This function)

Storage.c:286:error: (Each undeclared identifier are reported only once

Storage.c:286:error:for each function it appears in.)

MAKE[2]: * * * [Storage.lo] Error 1

MAKE[2]: Leaving directory '/3.3.2/bluez-utils-3.36/input '

MAKE[1]: * * * [all-recursive] Error 1

MAKE[1]: Leaving directory '/3.3.2/bluez-utils-3.36 '

Make: * * * [ALL] Error 2

Add a macro definition to bluez-utils-3.36/input/storage.c

#define Enokey Eacces

Also encounter the missing audio module error, my Bluetooth does not use audio, so in./configure also directly--disable-audio.

other source packages that are dependent on bluez-utils-3.36:

[glib must use after version 2.14. When compiling the Utils package, the G_timeout_add_seconds function is defined later in this version]

dbus-1.0.2

glib-2.14.4

libxml2-2.6.11

libsndfile-1.0.17

libusb-0.1.12

Original: http://blog.sina.com.cn/s/blog_75a598c40100qfmg.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.