Skip to content

Commit

Permalink
Android.mk : Patching selinux policies required for Magisk
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hmtheboy154 committed Jan 30, 2022
1 parent 5636bee commit 9ff32be
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 $(<D))) $(TARGET_INSTALLER_OUT) | zstd -9 > $@
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
Expand All @@ -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 $(<D))) $(TARGET_INSTALLER_OUT) | zstd -9 > $@
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
Expand Down

0 comments on commit 9ff32be

Please sign in to comment.