run custom script when device boots for Android 13

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

run custom script when device boots for Android 13

842件の閲覧回数
Samt07
Contributor III
Hii,
I
am working on i.MX8mm  with Android 13.
I am trying to run my shell script when device boots but i don't understand why it is not working, i have attached log of the problem and have followed the instructions from "https://stackoverflow.com/questions/57370029/run-shell-script-at-boot-in-aosp".
Please let me know where I'm doing wrong

file_contexts
/vendor/bin/mytest2.sh      u:object_r:mytest2_exec:s0
 
mytest2.sh
#!/system/bin/sh
echo 'mytest2'

mytest2.te
type mytest2, domain;
type mytest2_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(mytest2)
allow mytest2 vendor_shell_exec:file rx_file_perms;
allow mytest2 vendor_toolbox_exec:file rx_file_perms;


imx8mm.mk file
PRODUCT_PACKAGES += \
                    $(IMX_DEVICE_PATH)/usb_control \
                    $(IMX_DEVICE_PATH)/hello_world
PRODUCT_COPY_FILES += \
    $(IMX_DEVICE_PATH)/mytest2.sh:vendor/bin/mytest2.sh

init.rc
service mytest2 /vendor/bin/mytest2.sh
    class main
    user root
    group root system
    disabled
    oneshot
on property:sys.boot_completed=1
    start mytest2
 
logcat
/vendor/bin # logcat | grep mytest2
12-02 10:41:00.112  1903  1903 W ls      : type=1400 audit(0.0:103): avc: denied { getattr } for path="/vendor/bin/mytest2.sh" dev="dm-7" ino=143073 scontext=u:r:shell:s0 tcontext=u:object_r:mytest2_exec:s0 tclass=file permissive=0
0 件の賞賛
返信
1 返信

806件の閲覧回数
AldoG
NXP TechSupport
NXP TechSupport

Hello,

You'll need to run this in permissive mode or either dissable SELinux, please have look:
https://source.android.com/docs/security/features/selinux

Best regards/Saludos,
Aldo.

0 件の賞賛
返信