Bootstrap

android4.2 shell脚本示例

举例:

想在系统启动后执行初始化can参数的命令:

shell脚本如下:

#!/system/bin/sh
ip link set can0 up type can bitrate 250000

命名该脚本文件为"can0shell",将该脚本拷贝到/system/etc/目录


然后在init.rc文件中添加如下代码:

service can0shell /system/bin/sh /system/etc/can0shell
    user root
    group root
    disabled
    oneshot

on property:sys.boot_completed=1
    start can0shell

;