From 1d3ca4bf2d2ce0817483880c5dccc8de60b79259 Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Tue, 2 May 2023 13:03:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=A0=E8=BD=BD=E6=96=B0?= =?UTF-8?q?=E7=89=88=E5=86=85=E6=A0=B8=E7=9A=84binder=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LoadingBinder/load.cpp | 13 +++++++++++++ LoadingBinder/load.sh | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 LoadingBinder/load.cpp create mode 100644 LoadingBinder/load.sh diff --git a/LoadingBinder/load.cpp b/LoadingBinder/load.cpp new file mode 100644 index 0000000..18511b4 --- /dev/null +++ b/LoadingBinder/load.cpp @@ -0,0 +1,13 @@ +#include +using namespace std; +int main(){ + // 检查是否是 root 用户 + if(system("[[ `whoami` == root ]]")){ + cout << "这不是 root 账户,失败!"; + return 1; + } + system("modprobe binder_linux"); + system("mkdir /dev/binderfs"); + system("mount -t binder binder /dev/binderfs"); + return 0; +} \ No newline at end of file diff --git a/LoadingBinder/load.sh b/LoadingBinder/load.sh new file mode 100644 index 0000000..21d1378 --- /dev/null +++ b/LoadingBinder/load.sh @@ -0,0 +1,7 @@ +#!/bin/bash +if [[ `whoami` != root ]]; then + echo 这不是 root 用户,结束 + exit 1 +modprobe binder_linux +mkdir /dev/binderfs +mount -t binder binder /dev/binderfs \ No newline at end of file