问题描述
我需要在 Android 启动序列中尽早停止强制执行 SE Linux。
我读过“selinux=0”的内核参数会阻止这个。它没有:
smarc_mx8mq:/ # cat /proc/cmdline
selinux=0 console=ttymxc2,115200 earlycon=imxuart,0x30880000,115200 init=/init video=HDMI-A-1:1080x1920-32@60 androidboot.console=ttymxc0 androidboot.hardware=freescale androidboot.fbTileSupport=enable cma=1280M androidboot.primary_display=imx-drm firmware_class.path=/vendor/firmware transparent_hugepage=never loop.max_part=7 buildvariant=eng ...
smarc_mx8mq:/ # getenforce
Enforcing
我该怎么做才能完全阻止 SE Linux 从启动序列开始执行? (我可以拥有 root shell 访问权限,并且可以更改内核配置或 AOSP 构建的任何其他部分。)
解决方法
我该怎么做才能完全阻止 SE Linux 从启动序列开始执行? (我可以拥有 root shell 访问权限,并且可以更改内核配置或 AOSP 构建的任何其他部分。)
我在 BoardConfig.mk
中通过设置关闭 selinux:
BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
然后在构建和目标闪烁后cat /proc/cmdline
显示androidboot.selinux=permissive
:
hikey960:/ # cat /proc/cmdline
androidboot.hardware=hikey960 firmware_class.path=/vendor/firmware loglevel=15 efi=noruntime
overlay_mgr.overlay_dt_entry=hardware_cfg_enable_android_fstab androidboot.selinux=permissive
,
解决方案是使用 androidboot.selinux=permissive
而不是 selinux=0
。
我读到 androidboot.selinux=disabled
也可以使用。