From 9ff32be219e65b08f3cbd2e20629e1df3dabe218 Mon Sep 17 00:00:00 2001 From: hmtheboy154 Date: Sun, 30 Jan 2022 14:05:39 +0000 Subject: [PATCH] Android.mk : Patching selinux policies required for Magisk This is a requirement for Project Kokoro (https://github.com/supremegamers/kokoro), in order to make Magisk working correctly we have to patch selinux policies using magiskpolicy tool, also adding some file_contexts line. We will hook the process after install.img creation --- Android.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Android.mk b/Android.mk index e2bb9bc7..a6c373c2 100644 --- a/Android.mk +++ b/Android.mk @@ -71,6 +71,10 @@ else $(INSTALL_RAMDISK): $(wildcard $(LOCAL_PATH)/install/*/* $(LOCAL_PATH)/install/*/*/*/*) $(INSTALLER_BIN) | $(MKBOOTFS) $(if $(TARGET_INSTALL_SCRIPTS),mkdir -p $(TARGET_INSTALLER_OUT)/scripts; $(ACP) -p $(TARGET_INSTALL_SCRIPTS) $(TARGET_INSTALLER_OUT)/scripts) $(MKBOOTFS) $(dir $(dir $( $@ + echo '/dev/magisk(/.*)? u:object_r:magisk_file:s0' | tee -a $(PRODUCT_OUT)/system/vendor/etc/selinux/vendor_file_contexts + echo '/data/adb/magisk(/.*)? u:object_r:magisk_file:s0' | tee -a $(PRODUCT_OUT)/system/vendor/etc/selinux/vendor_file_contexts + vendor/supremegamers/kokoro/magiskpolicy --load $(PRODUCT_OUT)/system/vendor/etc/selinux/precompiled_sepolicy --save $(PRODUCT_OUT)/system/vendor/etc/selinux/precompiled_sepolicy --magisk 'allow magisk * * *' + vendor/supremegamers/kokoro/magiskpolicy --load $(PRODUCT_OUT)/system/vendor/etc/selinux/precompiled_sepolicy --save $(PRODUCT_OUT)/system/vendor/etc/selinux/precompiled_sepolicy --magisk "allow * magisk_file lnk_file *" endif #~ endif @@ -86,6 +90,10 @@ else $(INSTALL_RAMDISK): $(wildcard $(LOCAL_PATH)/install/*/* $(LOCAL_PATH)/install/*/*/*/*) $(INSTALLER_BIN) | $(MKBOOTFS) $(if $(TARGET_INSTALL_SCRIPTS),mkdir -p $(TARGET_INSTALLER_OUT)/scripts; $(ACP) -p $(TARGET_INSTALL_SCRIPTS) $(TARGET_INSTALLER_OUT)/scripts) $(MKBOOTFS) $(dir $(dir $( $@ + echo '/dev/magisk(/.*)? u:object_r:magisk_file:s0' | tee -a $(PRODUCT_OUT)/system/vendor/etc/selinux/vendor_file_contexts + echo '/data/adb/magisk(/.*)? u:object_r:magisk_file:s0' | tee -a $(PRODUCT_OUT)/system/vendor/etc/selinux/vendor_file_contexts + vendor/supremegamers/kokoro/magiskpolicy --load $(PRODUCT_OUT)/system/vendor/etc/selinux/precompiled_sepolicy --save $(PRODUCT_OUT)/system/vendor/etc/selinux/precompiled_sepolicy --magisk 'allow magisk * * *' + vendor/supremegamers/kokoro/magiskpolicy --load $(PRODUCT_OUT)/system/vendor/etc/selinux/precompiled_sepolicy --save $(PRODUCT_OUT)/system/vendor/etc/selinux/precompiled_sepolicy --magisk "allow * magisk_file lnk_file *" endif endif