[android]MT6835 Android 关闭selinux方法

Selinux

SELinux is an optional feature of the Linux kernel that provides support to enforce access control security policies to enforce MAC. It is based on the LSM framework.

Working with SELinux on Android -- LineageOS

Android 关闭selinux

MT6835 Android系统默认是开启selinux的,由于selinux限制比较多,所以需要关闭selinux

MT6835 关闭SeLinux方法

软件代码直接关闭

target/system/core/init/selinux.cpp

复制代码
bool IsEnforcing() {
    if (ALLOW_PERMISSIVE_SELINUX) {
        return StatusFromProperty() == SELINUX_ENFORCING;
    }
    return true;
}

修改为

复制代码
bool IsEnforcing() {
    /*if (ALLOW_PERMISSIVE_SELINUX) {
        return StatusFromProperty() == SELINUX_ENFORCING;
    }*/
    return false;
}

mssi/system/core/init/selinux.cpp

复制代码
bool IsEnforcing() {
    if (ALLOW_PERMISSIVE_SELINUX) {
        return StatusFromProperty() == SELINUX_ENFORCING;
    }
    return true;
}

修改为

复制代码
bool IsEnforcing() {
    /*if (ALLOW_PERMISSIVE_SELINUX) {
        return StatusFromProperty() == SELINUX_ENFORCING;
    }*/
    return false;
}

内核配置启动参数

修改BOARD_KERNEL_CMDLINE增加androidboot.selinux = permissive

查看

./target/build/make/core/board_config.mk

_board_strip_readonly_list += BOARD_KERNEL_CMDLINE

INTERNAL_KERNEL_CMDLINE:= $(BOARD_KERNEL_CMDLINE)

发现BOARD_KERNEL_CMDLINE最终赋值给到INTERNAL_KERNEL_CMDLINE

所以我们只需要修改INTERNAL_KERNEL_CMDLINE接口

修改方法

./target/build/make/core/config.mk

复制代码
ifneq ($(BOARD_SUPER_PARTITION_METADATA_DEVICE),super)
INTERNAL_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)
endif

修改为

复制代码
ifneq ($(BOARD_SUPER_PARTITION_METADATA_DEVICE),super)
INTERNAL_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)
endif
INTERNAL_KERNEL_CMDLINE += androidboot.selinux = permissive

./mssi/build/make/core/config.mk

复制代码
# The metadata device must be supplied to init via the kernel command-line.
INTERNAL_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)

修改为

复制代码
# The metadata device must be supplied to init via the kernel command-line.
INTERNAL_KERNEL_CMDLINE += androidboot.selinux = permissive
INTERNAL_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)
相关推荐
爱笑鱼20 分钟前
Handler(四):Handler 卡顿怎么定位?从 Slow delivery 到 Slow dispatch
android
九皇叔叔1 小时前
RHEL9.8 配置本地镜像仓库
android·java·缓存
私人珍藏库1 小时前
[Android] 聊天记录微备份 -聊天记录备份+本地数据备份
android·人工智能·app·软件·多功能
私人珍藏库3 小时前
[Android] PocketPal -本地离线AI助手+大模型部署神器
android·人工智能·app·软件·多功能
listening7773 小时前
HarmonyOS 6.1 跨端实战:用ArkUI-X把电商App同时跑在Android/iOS上
android·ios·harmonyos
爱笑鱼3 小时前
Handler(三):主线程、HandlerThread、Binder 线程到底怎么区分?
android
w139548564223 小时前
鸿蒙实战:报告与雷达图 ReportDao
android·华为·harmonyos·鸿蒙系统
爱笑鱼4 小时前
Handler(二):MessageQueue 为什么不是普通队列?
android
阿巴斯甜4 小时前
Android Studio 新版 Logcat
android
监督者修4 小时前
从零构建 GIS 数据引擎:方案驱动架构的设计与实践
android·架构·kotlin