I have a Samsung S10 5G device that is actually a system-as-root
device. I have rooted it by following the instructions given here.
As the system-as-root
devices have no ramdisk
in boot.img
but in recovery.img
so, I have to always boot the device with a recovery combination to get the root access.
I have an app that requires some SELinux policies to work. I have injected them with the help of sepolicy-inject
using following commands:
sepolicy-inject -s init -t su -c process -p transition -l
sepolicy-inject -s su -t system_file -c file -p entrypoint -l
sepolicy-inject -s init -t su -c process -p rlimitinh -l
sepolicy-inject -s init -t su -c process -p siginh -l
sepolicy-inject -s su -t shell_exec -c file -p read -l
sepolicy-inject -s su -t shell_exec -c file -p execute -l
sepolicy-inject -s su -t shell_exec -c file -p getattr -l
sepolicy-inject -s su -t vendor_toolbox_exec -c file -p execute_no_trans -l
sepolicy-inject -s init -t su -c process -p noatsecure -l
sepolicy-inject -s su -t toolbox_exec -c file -p getattr -l
sepolicy-inject -s su -t toolbox_exec -c file -p execute -l
sepolicy-inject -s su -t system_file -c file -p execute_no_trans -l
sepolicy-inject -s su -t storage_file -c dir -p search -l
sepolicy-inject -s su -t storage_file -c lnk_file -p read -l
sepolicy-inject -s su -t tmpfs -c dir -p search -l
sepolicy-inject -s su -t mnt_user_file -c dir -p search -l
sepolicy-inject -s su -t mnt_user_file -c lnk_file -p read -l
sepolicy-inject -s su -t sdcardfs -c dir -p search -l
sepolicy-inject -s su -t sdcardfs -c file -p append -l
sepolicy-inject -s su -t toolbox_exec -c file -p read -l
sepolicy-inject -s su -t toolbox_exec -c file -p open -l
sepolicy-inject -s su -t sdcardfs -c file -p read -l
sepolicy-inject -s su -t sdcardfs -c file -p write -l
sepolicy-inject -s su -t sdcardfs -c file -p open -l
sepolicy-inject -s su -t media_rw_data_file -c file -p read -l
sepolicy-inject -s su -t media_rw_data_file -c file -p write -l
sepolicy-inject -s su -t media_rw_data_file -c file -p open -l
sepolicy-inject -s su -t media_rw_data_file -c file -p append -l
but after reboot, I need to run this command again as they are not persistent. I don't want to use a key combination on the device to use my app on the root mode of the device. So, I am searching for any way to inject them permanently.
I can think of the following solutions:
- Modify
init.rc
file ofsystem.img
to run these commands but when I have tried to modifyinit.rc
with just adding a comment and flashed it on the device then that comment is lost. Don't know what happens. I have flashed it with all Odin files and within AP file. This AP file is patched by Magisk. - Change the SELinux from enforcing to permissive. I am not sure how can I do it with either root access or Modified ROM Flashing.
Any suggestion?