diff options
| author | 2024-10-11 23:33:45 +0000 | |
|---|---|---|
| committer | 2024-12-09 22:46:06 +0000 | |
| commit | c9365dd09594fac145f1b45e858b686f56db5e23 (patch) | |
| tree | 64e5bf906d5c093d2224156a52d819d4f28c9223 | |
| parent | 9f3b42033855b2e8bee95871bf04172bd74fe22e (diff) | |
Build var to use vendor binder for trusty compile
Adding a trusty makefile build variable to select
which type of binder compile to use for trusty.
By default it will use vendor binder, but it can
be set to use system binder itself. This will be
use for trusty in system VMs.
Bug: 274779230
Test: manual tests using trusty VMs
Change-Id: Id8b6828867b0b4e8844d71e7e3ed4233c6b7afcd
| -rw-r--r-- | libs/binder/rust/src/lib.rs | 4 | ||||
| -rw-r--r-- | libs/binder/trusty/rules.mk | 14 | ||||
| -rw-r--r-- | libs/binder/trusty/rust/binder_ndk_sys/rules.mk | 7 | ||||
| -rw-r--r-- | libs/binder/trusty/rust/rules.mk | 8 |
4 files changed, 27 insertions, 6 deletions
diff --git a/libs/binder/rust/src/lib.rs b/libs/binder/rust/src/lib.rs index 1b24b0a1e1..e08a76312d 100644 --- a/libs/binder/rust/src/lib.rs +++ b/libs/binder/rust/src/lib.rs @@ -104,7 +104,7 @@ mod proxy; mod service; #[cfg(not(any(trusty, android_ndk)))] mod state; -#[cfg(not(any(android_vendor, android_ndk, android_vndk)))] +#[cfg(not(any(android_vendor, android_ndk, android_vndk, trusty)))] mod system_only; use binder_ndk_sys as sys; @@ -125,7 +125,7 @@ pub use service::{ pub use service::{get_interface, get_service}; #[cfg(not(any(trusty, android_ndk)))] pub use state::{ProcessState, ThreadState}; -#[cfg(not(any(android_vendor, android_vndk, android_ndk)))] +#[cfg(not(any(android_vendor, android_vndk, android_ndk, trusty)))] pub use system_only::{delegate_accessor, Accessor, AccessorProvider, ConnectionInfo}; /// Binder result containing a [`Status`] on error. diff --git a/libs/binder/trusty/rules.mk b/libs/binder/trusty/rules.mk index 5e38ad0d0c..dd9d4d12ee 100644 --- a/libs/binder/trusty/rules.mk +++ b/libs/binder/trusty/rules.mk @@ -64,14 +64,24 @@ MODULE_EXPORT_INCLUDES += \ MODULE_EXPORT_INCLUDES += \ $(LIBBINDER_DIR)/ndk/include_cpp \ +ifeq (false,$(call TOBOOL,$(USE_SYSTEM_BINDER))) +BINDER_EXTRA_COMPILE_FLAGS := \ + -D__ANDROID_VENDOR__ \ + -D__ANDROID_VNDK__ \ + +else +BINDER_EXTRA_COMPILE_FLAGS := \ + -DANDROID_PLATFORM \ + +endif + MODULE_EXPORT_COMPILEFLAGS += \ -DBINDER_RPC_SINGLE_THREADED \ -DBINDER_ENABLE_LIBLOG_ASSERT \ -DBINDER_DISABLE_NATIVE_HANDLE \ -DBINDER_DISABLE_BLOB \ -DBINDER_NO_LIBBASE \ - -D__ANDROID_VENDOR__ \ - -D__ANDROID_VNDK__ \ + $(BINDER_EXTRA_COMPILE_FLAGS) # libbinder has some deprecated declarations that we want to produce warnings # not errors diff --git a/libs/binder/trusty/rust/binder_ndk_sys/rules.mk b/libs/binder/trusty/rust/binder_ndk_sys/rules.mk index 2aaa061ddf..56d711efae 100644 --- a/libs/binder/trusty/rust/binder_ndk_sys/rules.mk +++ b/libs/binder/trusty/rust/binder_ndk_sys/rules.mk @@ -30,9 +30,14 @@ MODULE_LIBRARY_DEPS += \ trusty/user/base/lib/trusty-sys \ MODULE_RUSTFLAGS += \ - --cfg 'android_vendor' \ --cfg 'trusty' \ +ifeq (false,$(call TOBOOL,$(USE_SYSTEM_BINDER))) +MODULE_RUSTFLAGS += \ + --cfg 'android_vendor' \ + +endif + MODULE_BINDGEN_SRC_HEADER := $(LIBBINDER_DIR)/rust/sys/BinderBindings.hpp # Add the flags from the flag file diff --git a/libs/binder/trusty/rust/rules.mk b/libs/binder/trusty/rust/rules.mk index e622b22246..acd74d2c86 100644 --- a/libs/binder/trusty/rust/rules.mk +++ b/libs/binder/trusty/rust/rules.mk @@ -32,9 +32,15 @@ MODULE_LIBRARY_DEPS += \ trusty/user/base/lib/trusty-sys \ MODULE_RUSTFLAGS += \ - --cfg 'android_vendor' \ --cfg 'trusty' \ +ifeq (false,$(call TOBOOL,$(USE_SYSTEM_BINDER))) +MODULE_RUSTFLAGS += \ + --cfg 'android_vendor' \ + +endif + + # Trusty does not have `ProcessState`, so there are a few # doc links in `IBinder` that are still broken. MODULE_RUSTFLAGS += \ |