OSDN Git Service

Remove unused "cmn_ble_vsc_cb"; causing extended scan to not start
[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 15.10 with GCC 5.2.1.
9
10 ### Install required libraries
11
12 ```sh
13 sudo apt-get install libevent-dev
14 ```
15
16 ### Install build tools
17
18   - Install [ninja](https://ninja-build.org/) build system
19
20 ```sh
21 sudo apt-get install ninja-build
22 ```
23
24 or download binary from https://github.com/ninja-build/ninja/releases
25
26   - Install [gn](https://chromium.googlesource.com/chromium/src/tools/gn/) -  meta-build system that generates NinjaBuild files.
27
28 Get sha1 of current version from [here](
29 https://chromium.googlesource.com/chromium/buildtools/+/master/linux64/gn.sha1) and then download corresponding executable:
30
31 ```sh
32 wget -O gn http://storage.googleapis.com/chromium-gn/<gn.sha1>
33 ```
34
35 i.e. if sha1 is "3491f6687bd9f19946035700eb84ce3eed18c5fa" (value from 24 Feb 2016) do
36
37 ```sh
38 wget -O gn http://storage.googleapis.com/chromium-gn/3491f6687bd9f19946035700eb84ce3eed18c5fa
39 ```
40
41 Then make binary executable and put it on your PATH, i.e.:
42
43 ```sh
44 chmod a+x ./gn
45 sudo mv ./gn /usr/bin
46 ```
47
48 ### Download source
49
50 ```sh
51 mkdir ~/fluoride
52 cd ~/fluoride
53 git clone https://android.googlesource.com/platform/system/bt
54 ```
55
56 Then fetch third party dependencies:
57
58 ```sh
59 cd ~/fluoride/bt
60 mkdir third_party
61 cd third_party
62 git clone https://github.com/google/googletest.git
63 git clone https://android.googlesource.com/platform/external/libchrome
64 git clone https://android.googlesource.com/platform/external/modp_b64
65 git clone https://android.googlesource.com/platform/external/tinyxml2
66 ```
67
68 And third party dependencies of third party dependencies:
69
70 ```sh
71 cd fluoride/bt/third_party/libchrome/base/third_party
72 mkdir valgrind
73 cd valgrind
74 curl https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/valgrind.h?format=TEXT | base64 -d > valgrind.h
75 curl https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/memcheck.h?format=TEXT | base64 -d > memcheck.h
76 ```
77
78 Fluoride currently has dependency on some internal Android projects, which also need to be downloaded. This will be removed in future:
79
80 ```sh
81 cd ~/fluoride
82 git clone https://android.googlesource.com/platform/system/core
83 git clone https://android.googlesource.com/platform/hardware/libhardware
84 git clone https://android.googlesource.com/platform/system/media
85 ```
86
87 ### Configure your build
88 We need to configure some paths to make the build successful. Run:
89
90 ```sh
91 cd ~/fluoride/bt
92 gn args out/Default
93 ```
94
95 This will prompt you to fill the contents of your "out/Default/args.gn" file. Make it look like below. Replace "/home/job" with path to your home directory, and don't use "~" in build arguments:
96
97 ```sh
98 # Build arguments go here. Examples:
99 #   is_component_build = true
100 #   is_debug = false
101 # See "gn args <out_dir> --list" for available build arguments.
102
103 libhw_include_path = "/home/job/fluoride/libhardware/include"
104 core_include_path = "/home/job/fluoride/core/include"
105 audio_include_path = "/home/job/fluoride/media/audio/include"
106 ```
107
108 Then generate your build files by calling
109
110 ```sh
111 cd ~/fluoride/bt
112 gn gen out/Default
113 ```
114
115 ### Build
116
117 ```sh
118 cd ~/fluoride/bt
119 ninja -C out/Default all
120 ```
121
122 This will build all targets (the shared library, executables, tests, etc) and put them in out/Default. To build an individual target, replace "all" with the target of your choice, e.g. ```ninja -C out/Default net_test_osi```.
123
124 ### Run
125
126 ```sh
127 cd ~/fluoride/bt/out/Default
128 LD_LIBRARY_PATH=./ ./bluetoothtbd -create-ipc-socket=fluoride
129 ```