binder-linux icon indicating copy to clipboard operation
binder-linux copied to clipboard

Android Binder for Linux Desktop

About

Goal of this project is to use Android Binder at Linux desktop environment. The most of source code was come from Android Source Repositories(Android 14). But, the source code was modified slightly for Linux dekstop.

Prerequisites to build & run

  1. Kernel 5.16.x is required because of the definition of BINDER_ENABLE_ONEWAY_SPAM_DETECTION.
  2. Linux kernel's Binder must be enabled. https://www.kernel.org/doc/html/latest/admin-guide/binderfs.html
  3. libselinux and libsepol must be installed. http://userspace.selinuxproject.org/
  4. 'libc++' and 'fmt' must be installed too.
  5. CMake is used as a build system.

Prepare

$ cd binder-linux
$ source ./env.sh
$ android_clone

Build

$ m

Mounting binderfs

Please refer following two external documents.

https://www.kernel.org/doc/html/latest/admin-guide/binderfs.html#mounting-binderfs https://wiki.archlinux.org/title/Anbox#Mounting_binderfs

Testing

Change output directory.

$ cout

Create binder device file

$ ./binder_device /dev/binderfs/binder-control binder
$ chmod a+rw /dev/binderfs/binder

Run servicemanager

$ ./binder_sm /dev/binderfs/binder &

Run echo service

$ ./binder_test server &

Run echo client

$ ./binder_test

Install

$ ninja install

Aidl

binder-linux does not support AIDL compiler. Please use the AIDL compiler of Android build tools. https://developer.android.com/studio/releases/build-tools

TODO

Remove unnecesary libraries from build.