- Overview
![](https://i-blog.csdnimg.cn/blog_migrate/8ec942d78eb0c110e085674d026eaf19.png)
- Linux device driver model
a new device object:/sys/devices/virtual/misc/binder/
device file/dev/binder
VFS operations
drivers\staging\android\binder.c
init:binder_init ->misc_register ->device_create
bind_open:create a new binder_proc, add to binder_procs, link to filp->private_data
binder_mmap:详见 mmap进行内存映射的原理1.在用户虚拟地址空间中寻找空闲的满足要求的一段连续的虚拟地址空间,为映射做准备(由内核mmap系统调用完成)2. 建立虚拟地址空间(第一部中建立的地址空间)和文件或设备的物理地址之间的映射(设备驱动完成)()
bind_ioctl()for service manager: BINDER_SET_CONTEXT_MGR, create a new binder_nodebind_ioctl(, BINDER_WRITE_READ, )write/read data
- insight source code
refer to mediaserviceframeworks\av\media\mediaserver\Main_mediaserver.cpp
![]()
to define a service![]()
refer:
<Understanding the Linux Kernel>