Hello,
I am working on I.MX 8M Plus with Android 11.
I want to bring the Flexcan with I.MX 8m Plus.
In current state Flexcan driver is loaded and I am able to see the can0 node by hitting ifconfig -a.
But to up and run I need to hit "ip link set can0 up type can bitrate 1000000 sample-point 0.75 dbitrate 2000000 dsample-point 0.8 fd on"
To up and run i created below script init.cancfg.sh
#! /vendor/bin/sh
ip link set can0 up type can bitrate 1000000 sample-point 0.75 dbitrate 2000000 dsample-point 0.8 fd on
I am able to copy the .sh in to vendor bin with the help of below command in evk_8mp.mk
PRODUCT_COPY_FILES +=\
device/nxp/common/init/init.cancfg.sh:vendor/bin/init.cancfg.sh
I added below sepolicy in init-cancfg-sh.te
type init-cancfg-sh, domain;
type init-cancfg-sh_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(init-cancfg-sh)
allow init-cancfg-sh vendor_shell_exec:file rx_file_perms;
allow init-cancfg-sh vendor_toolbox_exec:file rx_file_perms;
This sepolicy i added in file_contexts
/vendor/bin/init\.cancfg\.sh u:object_r:init-cancfg-sh_exec:s0
And below is my service init.cancfg.rc :
service init-cancfg-sh /vendor/bin/init.cancfg.sh
class late_start
user root
group root system
oneshot
on property:sys.boot_completed=1
start init-cancfg-sh
My Shell script if working while i am running manually with below logs:
evk_8mp:/ # sh vendor/bin/init.cancfg.sh
[10196.361149][ T1748] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
When it is running from service init-cancfg-sh :
[102.612966][ T1] init: starting service 'init-cancfg-sh'...
[102.622699][ T1] init: Control message: Processed ctl.start for 'init-cancfg-sh' from pid: 1750 (start init-cancfg-sh)
evk_8mp:/ # [102.661876][ T1] init: Service 'init-cancfg-sh' (pid 1751) exited with status 0 oneshot service took 0.041000 seconds in background
[102.674131][ T1] init: Sending signal 9 to service 'init-cancfg-sh' (pid 1751) process group...
[102.683363][ T1] libprocessgroup: Successfully killed process cgroup uid 0 pid 1751 in 0ms
And can0 is not up and Run
Can anyone suggest to bring flexcan on boot up service?
Thanks