Embedded ARM Linux Bluetooth File Transfer and Transplantation
Currently, Bluetooth technology is mature, especially for mobile phones and PCs.
This article mainly describes Bluetooth file Transmission Based on Embedded ARM Linux.
Currently, Linux kernel 2.6.x has been integrated with the bluez Bluetooth driver. For kernel version 2.4, download and install the bluez Bluetooth driver from the official bluez website.
Http://www.bluez.org/download/
This is based on the 2.6 kernel. For 2.4, download bluez and install it. With the bluez Bluetooth driver, you also need to install the bluez-libs Library and the bluez-utils tool.
Bluetooth File Transfer Application Development is divided into two parts: on PC and on arm.
Configuration in Linux
Fedora 9
Kernel version 2.6.25
GCC: 4.0.0
There are always many problems when using a new kernel version for embedded development. 2.6.11 kernel is suitable for embedded development.
First, install the bluez-libs library and bluez-utils tool on the PC.
1. Download bluez-libs and bluez-utils from the official bluez website.
Http://www.bluez.org/download/
I downloaded bluez-libs-3.36 and bluez-utils-3.36.
2. Compile the Linux kernel of the PC
# Cd/usr/src/kernels/2.6.25-14. fc9.i686/<br/> # Make menuconfig <br/> networking --> <br/> <m> Bluetooth Subsystem Support --> <br/> <m> L2CAP protocl support <br /> <m> SCO links support <br/> <m> RFCOMM protocol support <br/> [*] RFCOMM tty support <br/> <m> benp protocol support <br /> [*] multicast Filter support <br/> [*] protocol filter support <br/> <m> cmtp protocol support <br/> <m> hidp protocol support <br /> Bluetooth devices drivers --> <br/> <m> hci usb driver
3. Install libs and utils.
Libs and bluez have to be installed normally by installing Linux software.
Install libs
# Tar xzvf bluez-libs-3.36.tar.gz <br/> # cd bluez-libs-2.25 <br/> #./configure <br/> # Make <br/> # make install
Note: If you use fedora 9 or the kernel version 2.6.25 or later, some files or parameters are not defined when utils is installed.
2. Port the libs library and utils tool to the arm Development Board.
My Development Board Configuration:
Linux Kernel: 2.6.29)
Arm-Linux-GCC: 4.3.2
I put all the compressed packages under/opt/ARM/. What I will talk about below is for this directory. You can select a directory based on your preferences.
1. Install the cross-compilation tool arm-Linux-gcc
# Tar xzvf arm-Linux-gcc/usr/local <br/> # vi/root /. bashrc <br/> #. bashrc </P> <p> # user specific aliases and functions </P> <p> alias Rm = 'rm-I '<br/> alias CP = 'cp-I '<br/> alias mv = 'mv-I' </P> <p> # source Global definitions <br/> If [-F/etc/bashrc]; then <br/>. /etc/bashrc <br/> fi </P> <p> export Path = $ path:/usr/local/ARM/4.3.2/bin
2. decompress, compile, and configure the kernel.
Because I used the kernel source code that comes with the Development Board CD, I don't need to modify the makefile in the source code. If you download the kernel source code from the Internet, you need to modify the makefile during compilation. Need
# Tar xzvf linux-2.6.29 <br/> # cd linux-2.6.29 <br/> # Make menuconfig
When configuring the kernel, add the Bluetooth configuration.
Then begin to cross-compile the kernel.
# Make zimage
3. Port bluez-libs.
Create a folder to install libs, and then perform cross-compilation and installation. The process is as follows:
I put all the installation packages under/opt/arm. You can select the installation packages as needed.
The cross-compiled libs library and utils are installed in/opt/ARM/libs and/opt/ARM/utils respectively.
# Cd/opt/ARM <br/> # mkdir libs <br/> # tar xzvf bluez-libs-2.25.tar.gz <br/> # cd bluez-libs-2.25 <br/> #. /configure -- prefix =/home/Libs -- target = arm-Linux cc = "arm-Linux-GCC" -- Build = arm-Linux -- Host = arm-Linux <br/> # vi config. h <br/> Add the following content: <br/> # ifndef uchar_max <br/> # define uchar_max 256 <br/> # endif </P> <p> # ifndef ushrt_max <br/> # define ushrt_max 65536 <br/> # endif </P> <p> # ifndef path_max <br/> # define path_max 4095 <br/> # endif
Then, WQ is saved.
Enter
# Cd/opt/ARM/bluez-libs-2.25 <br/> # export pkg_config_path =/usr/lib/pkgconfig <br/> # Make <br/> # make install
Cross-compile utils tool.
# Cd/opt/ARM <br/> # tar xzvf bluez-utils-2.25 <br/> # cd bluez-utils-2.25 <br/> #. /configure -- prefix =/opt/ARM/utils -- includedir =/opt/ARM/libs/include -- libdir =/opt/ARM/libs/lib -- With-bluez =/OPT /ARM/Libs -- disable-test -- disable-cups -- disable-pcima -- Host = arm-Linux -- target = arm-Linux -- Build = i686 cc = "arm-Linux-gcc "<br/> then modify config. h <br/> # cd/opt/ARM/utils/<br/> # vi config. h <br/> in config. add the following content to the end of H </P> <p> ifndef uchar_max <br/> define uchar_max 256 <br/> endif </P> <p> ifndef ushrt_max <br/> define ushrt_max 65536 <br/> endif </P> <p> ifndef path_max <br/> define path_max 4095 <br/> endif <br/> and then save <br/> # pwd <br/>/opt/ARM/utils <br/> # Make <br/> # make install
Because there is a passcode or pin during Bluetooth pairing. when bluetooth device a sends a connection request to Bluetooth device B, A wants B to send a pair password. Only when B sends the same pair password to a will a connection be established. The sending password is configured through/utils/etc/Bluetooth/hcid. conf.
# Vi/utils/etc/Bluetooth/hcid. conf
By now, both the libs and utils tools have ended. The required libs library and utils tools are all under/opt/ARM/libs and/safeguard/ARM/utils.
The next step is to redo the file system.
Copy the file system compressed package of the Development Board CD to/opt/arm.
# Cd/opt/ARM <br/> # tar xzvf root.tar.gz <br/> # CD .. <br/> # cd libs <br/> # ls <br/> include Lib .. (There are other directories or folders) <br/> # cd lib <br/> # PWD <br/>/opt/ARM/libs/lib <br/> copy all the files under this lib to the above for pressurization. in/usr/lib and/usr/local/lib. <Br/> # cd/safeguard/ARM/utils <br/> # ls <br/> bin sbin etc <br/> copy all the files in BIN and sbin here the unzipped File System/usr/bin,/usr/sbin <br/> # CD .. <br/> # CD etc <br/> # PWD <br/>/opt/ARM/utils/etc <br/> # cp-Rif Bluetooth/opt/ARM/root /etc
Copyright statement:
Reprinted Article please indicate the original source http://blog.csdn.net/feiyinzilgd/archive/2010/02/09/5303149.aspx
Contact tan Haiyan or go to tan Haiyan's personal homepage to leave a message.