|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| android/ | | 03-May-2024 | - | 298,637 | 224,757 |
| apex/ | | 03-May-2024 | - | 3,185 | 3,136 |
| floss/ | | 03-May-2024 | - | 1,370 | 1,022 |
| framework/ | | 03-May-2024 | - | 60,913 | 34,291 |
| pandora/ | | 03-May-2024 | - | 1,814 | 1,570 |
| service/ | | 03-May-2024 | - | 5,779 | 4,523 |
| sysprop/ | | 03-May-2024 | - | 96 | 78 |
| system/ | | 03-May-2024 | - | 749,059 | 508,668 |
| tools/ | | 03-May-2024 | - | 40,693 | 31,216 |
| .clang-format | D | 03-May-2024 | 808 | 25 | 22 |
| .gitignore | D | 03-May-2024 | 82 | 10 | 9 |
| .style.yapf | D | 03-May-2024 | 115 | 6 | 5 |
| Android.bp | D | 03-May-2024 | 1.7 KiB | 70 | 66 |
| AndroidTestTemplate.xml | D | 03-May-2024 | 2.3 KiB | 46 | 29 |
| BUILD.gn | D | 03-May-2024 | 1.1 KiB | 33 | 29 |
| Cargo.toml | D | 03-May-2024 | 764 | 25 | 22 |
| CleanSpec.mk | D | 03-May-2024 | 2.4 KiB | 54 | 2 |
| EventLogTags.logtags | D | 03-May-2024 | 1.3 KiB | 39 | 37 |
| METADATA | D | 03-May-2024 | 39 | 4 | 3 |
| MODULE_LICENSE_APACHE2 | D | 03-May-2024 | 0 | | |
| NOTICE | D | 03-May-2024 | 11.1 KiB | 203 | 169 |
| OWNERS | D | 03-May-2024 | 275 | 13 | 10 |
| OWNERS_automotive | D | 03-May-2024 | 58 | 4 | 3 |
| OWNERS_chromeos | D | 03-May-2024 | 111 | 8 | 6 |
| PREUPLOAD.cfg | D | 03-May-2024 | 836 | 22 | 18 |
| README.md | D | 03-May-2024 | 6 KiB | 182 | 141 |
| TEST_MAPPING | D | 03-May-2024 | 4 KiB | 221 | 220 |
| build.py | D | 03-May-2024 | 27 KiB | 815 | 602 |
| rustfmt.toml | D | 03-May-2024 | 93 | 6 | 4 |
README.md
1# Fluoride Bluetooth stack
2
3## Building and running on AOSP
4Just build AOSP - Fluoride is there by default.
5
6## Building and running on Linux
7
8Instructions for a Debian based distribution:
9* Debian Bullseye or newer
10* Ubuntu 20.10 or newer
11* Clang-11 or Clang-12
12* Flex 2.6.x
13* Bison 3.x.x (tested with 3.0.x, 3.2.x and 3.7.x)
14
15You'll want to download some pre-requisite packages as well. If you're currently
16configured for AOSP development, you should have most required packages.
17Otherwise, you can use the following apt-get list or use the `--run-bootstrap`
18option on `build.py` (see below) to get a list of packages missing on your
19system:
20
21```sh
22sudo apt-get install repo git-core gnupg flex bison gperf build-essential \
23 zip curl zlib1g-dev gcc-multilib g++-multilib \
24 x11proto-core-dev libx11-dev libncurses5 \
25 libgl1-mesa-dev libxml2-utils xsltproc unzip liblz4-tool libssl-dev \
26 libc++-dev libevent-dev \
27 flatbuffers-compiler libflatbuffers1 openssl \
28 libflatbuffers-dev libtinyxml2-dev \
29 libglib2.0-dev libevent-dev libnss3-dev libdbus-1-dev \
30 libprotobuf-dev ninja-build generate-ninja protobuf-compiler \
31 libre2-9 debmake \
32 llvm libc++abi-dev \
33 libre2-dev libdouble-conversion-dev
34```
35
36You will also need a recent-ish version of Rust and Cargo. Please follow the
37instructions on [Rustup](https://rustup.rs/) to install a recent version.
38
39### Download source
40
41```sh
42mkdir ~/fluoride
43cd ~/fluoride
44git clone https://android.googlesource.com/platform/packages/modules/Bluetooth
45```
46
47### Using --run-bootstrap on build.py
48
49`build.py` is the helper script used to build Fluoride for Linux (i.e. Floss).
50It accepts a `--run-bootstrap` option that will set up your build staging
51directory and also make sure you have all required system packages to build
52(should work on Debian and Ubuntu). You will still need to build some unpackaged
53dependencies (like libchrome, modp_b64, googletest, etc).
54
55To use it:
56```sh
57./build.py --run-bootstrap
58```
59
60This will install your bootstrapped build environment to `~/.floss`. If you want
61to change this, just pass in `--bootstrap-dir` to the script.
62
63### Build dependencies
64
65The following third-party dependencies are necessary but currently unavailable
66via a package manager. You may have to build these from source and install them
67to your local environment.
68
69* libchrome
70* modp_b64
71
72We provide a script to produce debian packages for those components. Please
73see the instructions in build/dpkg/README.txt for more details.
74
75```sh
76cd system/build/dpkg
77mkdir -p outdir/{modp_b64,libchrome}
78
79# Build and install modp_b64
80pushd modp_b64
81./gen-src-pkg.sh $(readlink -f ../outdir/modp_b64)
82popd
83sudo dpkg -i outdir/modp_b64/*.deb
84
85# Build and install libchrome
86pushd libchrome
87./gen-src-pkg.sh $(readlink -f ../outdir/libchrome)
88popd
89sudo dpkg -i outdir/libchrome/*.deb
90```
91
92The googletest packages provided by Debian/Ubuntu (libgmock-dev and
93libgtest-dev) do not provide pkg-config files, so you can build your own
94googletest using the steps below:
95
96```sh
97git clone https://github.com/google/googletest.git -b release-1.10.0
98cd googletest # Main directory of the cloned repository.
99mkdir build # Create a directory to hold the build output.
100cd build
101cmake .. # Generate native build scripts for GoogleTest.
102sudo make install -DCMAKE_INSTALL_PREFIX=/usr
103
104# Optional steps if pkgconfig isn't installed to desired location
105# Modify the source (/usr/lib/x86_64-linux-gnu) and target (/usr/lib) based on
106# your local installation.
107for f in $(ls /usr/lib/x86_64-linux-gnu/pkgconfig/{gtest,gmock}*); do \
108 ln -sf $f /usr/lib/pkgconfig/$(basename $f);
109done
110```
111
112### Rust dependencies
113
114**Note**: Handled by `--run-bootstrap` option.
115
116Run the following to install Rust dependencies:
117```
118cargo install cxxbridge-cmd
119```
120
121### Stage your build environment
122
123**Note**: Handled by `--run-bootstrap` option.
124
125For host build, we depend on a few other repositories:
126* [Platform2](https://chromium.googlesource.com/chromiumos/platform2/)
127* [Rust crates](https://chromium.googlesource.com/chromiumos/third_party/rust_crates/)
128* [Proto logging](https://android.googlesource.com/platform/frameworks/proto_logging/)
129
130Clone these all somewhere and create your staging environment.
131```sh
132export STAGING_DIR=path/to/your/staging/dir
133mkdir ${STAGING_DIR}
134mkdir -p ${STAGING_DIR}/external
135ln -s $(readlink -f ${PLATFORM2_DIR}/common-mk) ${STAGING_DIR}/common-mk
136ln -s $(readlink -f ${PLATFORM2_DIR}/.gn) ${STAGING_DIR}/.gn
137ln -s $(readlink -f ${RUST_CRATE_DIR}) ${STAGING_DIR}/external/rust
138ln -s $(readlink -f ${PROTO_LOG_DIR}) ${STAGING_DIR}/external/proto_logging
139```
140
141### Build
142
143We provide a build script to automate building assuming you've staged your build
144environment already as above. At this point, make sure you have all the
145pre-requisites installed (i.e. bootstrap option and other dependencies above) or
146you will see failures. In addition, you may need to set a `--libdir=` if your
147libraries are not stored in `/usr/lib` by default.
148
149
150```sh
151./build.py
152```
153
154This will build all targets to the output directory at `--bootstrap-dir` (which
155defaults to `~/.floss`). You can also build each stage separately (if you want
156to iterate on something specific):
157
158* prepare - Generate the GN rules
159* tools - Generate host tools
160* rust - Build the rust portion of the build
161* main - Build all the C/C++ code
162* test - Build all targets and run the tests
163* clean - Clean the output directory
164
165You can choose to run only a specific stage by passing an arg via `--target`.
166
167Currently, Rust builds are a separate stage that uses Cargo to build. See
168[gd/rust/README.md](gd/rust/README.md) for more information. If you are
169iterating on Rust code and want to add new crates, you may also want to use the
170`--no-vendored-rust` option (which will let you use crates.io instead of using
171a pre-populated vendored crates repo).
172
173### Run
174
175By default on Linux, we statically link libbluetooth so you can just run the
176binary directly. By default, it will try to run on hci0 but you can pass it
177--hci=N, where N corresponds to /sys/class/bluetooth/hciN.
178
179```sh
180$OUTPUT_DIR/debug/btadapterd --hci=$HCI INIT_gd_hci=true
181```
182