OSDN Git Service

DO NOT MERGE ANYWHERE LE Connection Parameter Update Callback
[android-x86/system-bt.git] / README.md
1 # Fluoride Bluetooth stack
2
3 ## Building and running on AOSP
4 Just build AOSP - Fluoride is there by default.
5
6 ## Building and running on Linux
7
8 Instructions for Ubuntu, tested on 14.04 with Clang 3.5.0 and 16.10 with Clang
9  3.8.0
10
11 ### Install required libraries
12
13 ```sh
14 sudo apt-get install libevent-dev libc++-dev libc++abi-dev
15 ```
16
17 ### Install build tools
18
19   - Install [ninja](https://ninja-build.org/) build system
20
21 ```sh
22 sudo apt-get install ninja-build
23 ```
24
25 or download binary from https://github.com/ninja-build/ninja/releases
26
27   - Install [gn](https://chromium.googlesource.com/chromium/src/tools/gn/) -
28  meta-build system that generates NinjaBuild files.
29
30 Get sha1 of current version from [here](
31 https://chromium.googlesource.com/chromium/buildtools/+/master/linux64/gn.sha1)
32  and then download corresponding executable:
33
34 ```sh
35 wget -O gn http://storage.googleapis.com/chromium-gn/<gn.sha1>
36 ```
37
38 i.e. if sha1 is "3491f6687bd9f19946035700eb84ce3eed18c5fa" (value from 24 Feb
39  2016) do
40
41 ```sh
42 wget -O gn http://storage.googleapis.com/chromium-gn/3491f6687bd9f19946035700eb84ce3eed18c5fa
43 ```
44
45 Then make binary executable and put it on your PATH, i.e.:
46
47 ```sh
48 chmod a+x ./gn
49 sudo mv ./gn /usr/bin
50 ```
51
52 ### Download source
53
54 ```sh
55 mkdir ~/fluoride
56 cd ~/fluoride
57 git clone https://android.googlesource.com/platform/system/bt
58 ```
59
60 Then fetch third party dependencies:
61
62 ```sh
63 cd ~/fluoride/bt
64 mkdir third_party
65 cd third_party
66 git clone https://github.com/google/googletest.git
67 git clone https://android.googlesource.com/platform/external/libchrome
68 git clone https://android.googlesource.com/platform/external/modp_b64
69 git clone https://android.googlesource.com/platform/external/tinyxml2
70 git clone https://android.googlesource.com/platform/hardware/libhardware
71 ```
72
73 And third party dependencies of third party dependencies:
74
75 ```sh
76 cd fluoride/bt/third_party/libchrome/base/third_party
77 mkdir valgrind
78 cd valgrind
79 curl https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/valgrind.h?format=TEXT | base64 -d > valgrind.h
80 curl https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/memcheck.h?format=TEXT | base64 -d > memcheck.h
81 ```
82
83 NOTE: If system/bt is checked out under AOSP, then create symbolic links instead
84 of downloading sources
85
86 ```
87 cd system/bt
88 mkdir third_party
89 cd third_party
90 ln -s ../../../external/libchrome libchrome
91 ln -s ../../../external/modp_b64 modp_b64
92 ln -s ../../../external/tinyxml2 tinyxml2
93 ln -s ../../../hardware/libhardware libhardware
94 ln -s ../../../external/googletest googletest
95 ```
96
97 ### Generate your build files
98
99 ```sh
100 cd ~/fluoride/bt
101 gn gen out/Default
102 ```
103
104 ### Build
105
106 ```sh
107 cd ~/fluoride/bt
108 ninja -C out/Default all
109 ```
110
111 This will build all targets (the shared library, executables, tests, etc) and
112  put them in out/Default. To build an individual target, replace "all" with the
113  target of your choice, e.g. ```ninja -C out/Default net_test_osi```.
114
115 ### Run
116
117 ```sh
118 cd ~/fluoride/bt/out/Default
119 LD_LIBRARY_PATH=./ ./bluetoothtbd -create-ipc-socket=fluoride
120 ```
121
122 ### Eclipse IDE Support
123
124 1. Follows the Chromium project
125  [Eclipse Setup Instructions](https://chromium.googlesource.com/chromium/src/+/master/docs/linux_eclipse_dev.md)
126  until "Optional: Building inside Eclipse" section (don't do that section, we
127  will set it up differently)
128
129 2. Generate Eclipse settings:
130
131   ```sh
132   cd system/bt
133   gn gen --ide=eclipse out/Default
134   ```
135
136 3. In Eclipse, do File->Import->C/C++->C/C++ Project Settings, choose the XML
137  location under system/bt/out/Default
138
139 4. Right click on the project. Go to Preferences->C/C++ Build->Builder Settings.
140  Uncheck "Use default build command", but instead using "ninja -C out/Default"
141
142 5. Goto Behaviour tab, change clean command to "-t clean"
143