README.md
1Rust build
2======
3
4Currently, the Rust components are built differently on Android vs Linux. We are
5missing Rust support in our GN toolchain so we currently build the Rust
6libraries as a staticlib and link in C++. This may change in the future once we
7have better support.
8
9For now, you can build all of the Rust code using Cargo.
10
11There are some dependencies:
12* You must have the protobuf-compiler package installed
13* You must have a recent version of Cargo + Rust
14
15You should use `build.py` at the root to do your Rust builds so that it
16correctly points your dependencies towards the vendored crates and sets your
17$CARGO_HOME to the correct location.
18
19### Building `packets` package
20This package depends on `bluetooth_packetgen` and thus simply using
21`cargo build` will fail. Follow the steps below to ensure the dependency is
22found in `$CARGO_HOME/bin`.
23
241. Run `m -j32 bluetooth_packetgen` to compile `bluetooth_packetgen` c++ binary.
252. Change directory to `$CARGO_HOME/bin`.
263. Create a symlink in `$CARGO_HOME/bin` to compiled `bluetooth_packetgen`.
27`ln -s ~/aosp/out/host/linux-x86/bin/bluetooth_packetgen bluetooth_packetgen`
28
29### Enable GD Rust
301. `adb shell device_config put bluetooth INIT_gd_rust true`
312. Restart the device
32