1.下载内核源码,供内核模块编译

apt install linux-source -y

2.拷贝ashmem和binder源码。

git clone https://git.bughz.com/bughz/anbox-modules.git
cd anbox-modules
cp anbox.conf /etc/modules-load.d/
cp 99-anbox.rules /lib/udev/rules.d/
cp -rT ashmem /usr/src/anbox-ashmem-1
cp -rT binder /usr/src/anbox-binder-1

3.使用dkms进行编译和安装。

apt install dkms -y
dkms install anbox-ashmem/1
dkms install anbox-binder/1

4.将ko模块安装到内核,binder_linux模块需要带参数。

modprobe ashmem_linux
modprobe binder_linux num_devices=254
lsmod | grep -e ashmem_linux -e binder_linux
chmod 777 /dev/ashmem /dev/binder*

5.若ashmem和binder的属性权限不是下列命令显示的,请用chmod添加权限。

ls -alh /dev/binder* /dev/ashmem
crwxrwxrwx 1 root root  10, 55 Oct 22 10:47 /dev/ashmem
crwxrwxrwx 1 root root 511,  0 Oct 22 10:47 /dev/binder0
crwxrwxrwx 1 root root 511,  0 Oct 22 10:47 /dev/binder1
....