mirror of
https://github.com/google/comprehensive-rust.git
synced 2024-12-15 06:20:32 +02:00
More speaker notes about Android (#1501)
Helps with https://github.com/google/comprehensive-rust/issues/1083
This commit is contained in:
parent
6de9413ac3
commit
d2aab63d15
@ -1,10 +1,25 @@
|
||||
# Welcome to Rust in Android
|
||||
|
||||
Rust is supported for native platform development on Android. This means that
|
||||
you can write new operating system services in Rust, as well as extending
|
||||
existing services.
|
||||
Rust is supported for system software on Android. This means that
|
||||
you can write new services, libraries, drivers or even firmware in Rust
|
||||
(or improve existing code as needed).
|
||||
|
||||
> We will attempt to call Rust from one of your own projects today. So try to
|
||||
> find a little corner of your code base where we can move some lines of code to
|
||||
> Rust. The fewer dependencies and "exotic" types the better. Something that
|
||||
> parses some raw bytes would be ideal.
|
||||
|
||||
<details>
|
||||
|
||||
The speaker may mention any of the following given the increased use of Rust
|
||||
in Android:
|
||||
|
||||
- Service example: [DNS over HTTP](https://security.googleblog.com/2022/07/dns-over-http3-in-android.html)
|
||||
|
||||
- Libraries: [Rutabaga Virtual Graphics Interface](https://crosvm.dev/book/appendix/rutabaga_gfx.html)
|
||||
|
||||
- Kernel Drivers: [Binder](https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-0-08ba9197f637@google.com/)
|
||||
|
||||
- Firmware: [pKVM firmware](https://security.googleblog.com/2023/10/bare-metal-rust-in-android.html)
|
||||
|
||||
</details>
|
||||
|
@ -3,7 +3,7 @@
|
||||
The Android build system (Soong) supports Rust via a number of modules:
|
||||
|
||||
| Module Type | Description |
|
||||
|-------------------|----------------------------------------------------------------------------------------------------|
|
||||
| ----------------- | -------------------------------------------------------------------------------------------------- |
|
||||
| `rust_binary` | Produces a Rust binary. |
|
||||
| `rust_library` | Produces a Rust library, and provides both `rlib` and `dylib` variants. |
|
||||
| `rust_ffi` | Produces a Rust C library usable by `cc` modules, and provides both static and shared variants. |
|
||||
@ -14,3 +14,21 @@ The Android build system (Soong) supports Rust via a number of modules:
|
||||
| `rust_bindgen` | Generates source and produces a Rust library containing Rust bindings to C libraries. |
|
||||
|
||||
We will look at `rust_binary` and `rust_library` next.
|
||||
|
||||
<details>
|
||||
|
||||
Additional items speaker may mention:
|
||||
|
||||
- cargo is not optimized for multi-language repos, and also downloads packages from the internet.
|
||||
|
||||
- For compliance and performance, Android must have crates in-tree. It must also interop with C/C++/Java code. Soong fills that gap.
|
||||
|
||||
- Soong has many similarities to Bazel, which is the open-source variant of Blaze (used in google3).
|
||||
|
||||
- There is a plan to transition [Android](https://source.android.com/docs/setup/build/bazel/introduction), [ChromeOS](https://chromium.googlesource.com/chromiumos/bazel/), and [Fuchsia](https://source.android.com/docs/setup/build/bazel/introduction) to Bazel.
|
||||
|
||||
- Learning Bazel-like build rules is useful for all Rust OS developers.
|
||||
|
||||
- Fun fact: Data from Star Trek is a Soong-type Android.
|
||||
|
||||
</details>
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Setup
|
||||
|
||||
We will be using an Android Virtual Device to test our code. Make sure you have
|
||||
access to one or create a new one with:
|
||||
We will be using a Cuttlefish Android Virtual Device to test our code. Make sure you
|
||||
have access to one or create a new one with:
|
||||
|
||||
```shell
|
||||
source build/envsetup.sh
|
||||
@ -11,3 +11,13 @@ acloud create
|
||||
|
||||
Please see the [Android Developer
|
||||
Codelab](https://source.android.com/docs/setup/start) for details.
|
||||
|
||||
<details>
|
||||
|
||||
Key points:
|
||||
|
||||
- Cuttlefish is a reference Android device designed to work on generic Linux desktops. MacOS support is also planned.
|
||||
|
||||
- The Cuttlefish system image maintains high fidelity to real devices, and is the ideal emulator to run many Rust use cases.
|
||||
|
||||
</details>
|
||||
|
Loading…
Reference in New Issue
Block a user