From 46d83ed1462e521ce356aec48ef980dbf84cff80 Mon Sep 17 00:00:00 2001 From: heppen Date: Thu, 29 Jun 2023 19:02:09 +0800 Subject: [PATCH] =?UTF-8?q?README=E4=B8=AD=E6=B7=BB=E5=8A=A0=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E4=BD=BF=E7=94=A8binder=E7=9A=84=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 75 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 61 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 2a8c3da..bdffe2a 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,72 @@ # communication_ipc -#### 介绍 -The inter-process communication (IPC) and remote procedure call (RPC) mechanisms are used to implement cross-process communication. +## 介绍 -#### 软件架构 -软件架构说明 +openEuler 内核中存在开启 binder(边缘版本的树莓派)和未开启 binder(服务器版本等)两种情况。在未开启 binder 的场景下,本仓库提供将 binder 编译成 ko 的方式,插入该 ko 文件即可开启 binder 功能。 +说明:`openEuler-22.03-LTS-SP2` 分支下,本仓库主要存储 binder 的 rpm 包制作文件。 -#### 安装教程 +## 安装 -1. xxxx -2. xxxx -3. xxxx +1. 判断运行环境的内核是否开启 binder + ```shell + cat /boot/config-$(uname -r) | grep CONFIG_ANDROID_BINDER_IPC=y + ``` + 如果有 `CONFIG_ANDROID_BINDER_IPC=y` 输出,说明内核已经开启 binder,只需 [挂载 binderfs 来使用 binder](#挂载-binderfs-来使用-binder);否则,[插入 ko 文件 来使用 binder](#插入-ko-文件来使用-binder) -#### 使用说明 +### 挂载 binderfs 来使用 binder -1. xxxx -2. xxxx -3. xxxx +1. 检查环境中是否已有 `/dev/binder` 文件,如果已有,则无需再做任何操作,binder 已经是可使用状态。 -#### 参与贡献 +1. 如果环境还没有 `/dev/binder` 文件,通过以下命令来生成,进而让 binder 处于可使用状态。 + ```shell + mkdir /dev/binderfs + sudo mount -t binder binder /dev/binderfs + sudo ln -s /dev/binderfs/binder /dev/binder + ``` + +### 插入 ko 文件来使用 binder + +1. 下载本仓库 `openEuler-22.03-LTS-SP2` 分支的内容 + ```shell + git clone -b openEuler-22.03-LTS-SP2 https://gitee.com/src-openeuler/communication_ipc.git + ``` + +1. 安装编译需要的软件包 + ```shell + sudo dnf install make patch tar gcc kernel-devel + ``` + +1. 进入 communication_ipc 目录,解压源码包,并打上 patch + ```shell + cd communication_ipc + tar zxvf binder-openEuler-22.03-LTS-SP2.tar.gz + cd binder + patch -p1 < ../0001-Adapt-binder-as-a-kernel-module.patch + ``` + +1. 编译生成 binder_linux.ko + ```shell + make -j4 + ``` + +1. 插入 binder_linux.ko + ```shell + insmod binder_linux.ko + ``` + 插入 ko 文件之后,即可看到 `/dev/binder` 文件已生成,此时 binder 功能已可用。 + +**说明: 使用 `rmmod binder_linux` 命令卸载插入的 binder 可能会导致操作系统重启!!!,如果有重要业务在运行请勿直接卸载。** + +## 常用问题 + +1. 编译 binder 的时候,报错找不到 `/lib/modules/xxx` 目录 + + 原因:当前环境的 `kernel-devel` 包和实际系统 kernel 版本不一致。 + + 解决:修改 Makefile 中的 `KERNEL_SRC` 变量的值中 `$(uname -r)` 改成 kernel-devel 的版本号。 + +## 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 @@ -27,7 +74,7 @@ The inter-process communication (IPC) and remote procedure call (RPC) mechanisms 4. 新建 Pull Request -#### 特技 +## 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -- Gitee