提交 746e47cb 编写于 作者: Z zhong_ning

modify l2 init

Signed-off-by: Nzhong_ning <zhong_ning@hoperun.com>
上级 754d3970
...@@ -141,6 +141,21 @@ if (defined(ohos_lite)) { ...@@ -141,6 +141,21 @@ if (defined(ohos_lite)) {
part_name = "init" part_name = "init"
} }
group("startup_init") {
deps = [
":init",
":init_etc",
":updaterueventd",
"//base/startup/init_lite/interfaces/innerkits/socket:libsocket",
"//base/startup/init_lite/services/param:getparam",
"//base/startup/init_lite/services/param:paramclient",
"//base/startup/init_lite/services/param:paramservice",
"//base/startup/init_lite/services/param:setparam",
"//base/startup/init_lite/services/reboot:reboot",
]
}
# init etc files group
ohos_prebuilt_etc("init.cfg") { ohos_prebuilt_etc("init.cfg") {
source = "//base/startup/init_lite/services/etc/init.cfg" source = "//base/startup/init_lite/services/etc/init.cfg"
part_name = "init" part_name = "init"
...@@ -167,26 +182,18 @@ if (defined(ohos_lite)) { ...@@ -167,26 +182,18 @@ if (defined(ohos_lite)) {
} }
ohos_prebuilt_etc("init.Hi3516DV300.usb.cfg") { ohos_prebuilt_etc("init.Hi3516DV300.usb.cfg") {
source = "//device/hisilicon/hi3516dv300/build/rootfs/init.Hi3516DV300.usb.cfg" source =
"//device/hisilicon/hi3516dv300/build/rootfs/init.Hi3516DV300.usb.cfg"
part_name = "init" part_name = "init"
} }
group("init_etc") {
group("startup_init") {
deps = [ deps = [
":init",
":init.cfg",
":passwd",
":init.Hi3516DV300.cfg", ":init.Hi3516DV300.cfg",
":init.Hi3516DV300.usb.cfg",
":init.cfg",
":init.usb.cfg", ":init.usb.cfg",
":init.usb.configfs.cfg", ":init.usb.configfs.cfg",
":init.Hi3516DV300.usb.cfg", ":passwd",
":updaterueventd",
"//base/startup/init_lite/services/param:getparam",
"//base/startup/init_lite/services/param:paramclient",
"//base/startup/init_lite/services/param:paramservice",
"//base/startup/init_lite/services/param:setparam",
"//base/startup/init_lite/services/reboot:reboot",
"//base/startup/init_lite/interfaces/innerkits/socket:libsocket",
] ]
} }
} }
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
"start vndservicemanager" "start vndservicemanager"
] ]
}, { }, {
"name" : "property:sys.boot_from_charger_mode=1", "name" : "param:sys.boot_from_charger_mode=1",
"condition" : "sys.boot_from_charger_mode=1", "condition" : "sys.boot_from_charger_mode=1",
"cmds" : [ "cmds" : [
"trigger post-init" "trigger post-init"
...@@ -467,7 +467,7 @@ ...@@ -467,7 +467,7 @@
"cmds" : [ "cmds" : [
] ]
}, { }, {
"name" : "property:sys.init_log_level=*", "name" : "param:sys.init_log_level=*",
"condition" : "sys.init_log_level=*", "condition" : "sys.init_log_level=*",
"cmds" : [ "cmds" : [
] ]
...@@ -476,7 +476,7 @@ ...@@ -476,7 +476,7 @@
"cmds" : [ "cmds" : [
] ]
}, { }, {
"name" : "property:vold.decrypt=trigger_load_persist_props", "name" : "param:vold.decrypt=trigger_load_persist_props",
"condition" : "vold.decrypt=trigger_load_persist_props", "condition" : "vold.decrypt=trigger_load_persist_props",
"cmds" : [ "cmds" : [
"load_persist_params load_persist_params", "load_persist_params load_persist_params",
...@@ -484,48 +484,48 @@ ...@@ -484,48 +484,48 @@
"start logd-reinit" "start logd-reinit"
] ]
}, { }, {
"name" : "property:vold.decrypt=trigger_post_fs_data", "name" : "param:vold.decrypt=trigger_post_fs_data",
"condition" : "vold.decrypt=trigger_post_fs_data", "condition" : "vold.decrypt=trigger_post_fs_data",
"cmds" : [ "cmds" : [
"trigger post-fs-data", "trigger post-fs-data",
"trigger zygote-start" "trigger zygote-start"
] ]
}, { }, {
"name" : "property:vold.decrypt=trigger_restart_min_framework", "name" : "param:vold.decrypt=trigger_restart_min_framework",
"condition" : "vold.decrypt=trigger_restart_min_framework", "condition" : "vold.decrypt=trigger_restart_min_framework",
"cmds" : [ "cmds" : [
] ]
}, { }, {
"name" : "property:vold.decrypt=trigger_restart_framework", "name" : "param:vold.decrypt=trigger_restart_framework",
"condition" : "vold.decrypt=trigger_restart_framework", "condition" : "vold.decrypt=trigger_restart_framework",
"cmds" : [ "cmds" : [
"setparam service.bootanim.exit 0", "setparam service.bootanim.exit 0",
"start bootanim" "start bootanim"
] ]
}, { }, {
"name" : "property:vold.decrypt=trigger_shutdown_framework", "name" : "param:vold.decrypt=trigger_shutdown_framework",
"condition" : "vold.decrypt=trigger_shutdown_framework", "condition" : "vold.decrypt=trigger_shutdown_framework",
"cmds" : [ "cmds" : [
] ]
}, { }, {
"name" : "property:sys.boot_completed=1", "name" : "param:sys.boot_completed=1",
"condition" : "sys.boot_completed=1", "condition" : "sys.boot_completed=1",
"cmds" : [ "cmds" : [
] ]
}, { }, {
"name" : "property:sys.sysctl.extra_free_kbytes=*", "name" : "param:sys.sysctl.extra_free_kbytes=*",
"condition" : "sys.sysctl.extra_free_kbytes=*", "condition" : "sys.sysctl.extra_free_kbytes=*",
"cmds" : [ "cmds" : [
"write /proc/sys/vm/extra_free_kbytes ${sys.sysctl.extra_free_kbytes}" "write /proc/sys/vm/extra_free_kbytes ${sys.sysctl.extra_free_kbytes}"
] ]
}, { }, {
"name" : "property:sys.sysctl.tcp_def_init_rwnd=*", "name" : "param:sys.sysctl.tcp_def_init_rwnd=*",
"condition" : "sys.sysctl.tcp_def_init_rwnd=*", "condition" : "sys.sysctl.tcp_def_init_rwnd=*",
"cmds" : [ "cmds" : [
"write /proc/sys/net/ipv4/tcp_default_init_rwnd ${sys.sysctl.tcp_def_init_rwnd}" "write /proc/sys/net/ipv4/tcp_default_init_rwnd ${sys.sysctl.tcp_def_init_rwnd}"
] ]
}, { }, {
"name" : "property:security.perf_harden=0", "name" : "param:security.perf_harden=0",
"condition" : "security.perf_harden=0", "condition" : "security.perf_harden=0",
"cmds" : [ "cmds" : [
"write /proc/sys/kernel/perf_event_paranoid 1", "write /proc/sys/kernel/perf_event_paranoid 1",
...@@ -534,13 +534,13 @@ ...@@ -534,13 +534,13 @@
"write /proc/sys/kernel/perf_event_mlock_kb ${debug.perf_event_mlock_kb:-516}" "write /proc/sys/kernel/perf_event_mlock_kb ${debug.perf_event_mlock_kb:-516}"
] ]
}, { }, {
"name" : "property:security.perf_harden=1", "name" : "param:security.perf_harden=1",
"condition" : "security.perf_harden=1", "condition" : "security.perf_harden=1",
"cmds" : [ "cmds" : [
"write /proc/sys/kernel/perf_event_paranoid 3" "write /proc/sys/kernel/perf_event_paranoid 3"
] ]
}, { }, {
"name" : "property:ro.debuggable=1", "name" : "param:ro.debuggable=1",
"condition" : "ro.debuggable=1", "condition" : "ro.debuggable=1",
"cmds" : [ "cmds" : [
"chmod 0773 /data/misc/trace", "chmod 0773 /data/misc/trace",
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"setparam sys.usb.configfs 0" "setparam sys.usb.configfs 0"
] ]
}, { }, {
"name" : "property:sys.usb.config=none && property:sys.usb.configfs=0", "name" : "param:sys.usb.config=none && param:sys.usb.configfs=0",
"condition" : "sys.usb.config=none && sys.usb.configfs=0", "condition" : "sys.usb.config=none && sys.usb.configfs=0",
"cmds" : [ "cmds" : [
"stop adbd", "stop adbd",
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=adb && property:sys.usb.configfs=0", "name" : "param:sys.usb.config=adb && param:sys.usb.configfs=0",
"condition" : "sys.usb.config=adb && sys.usb.configfs=0", "condition" : "sys.usb.config=adb && sys.usb.configfs=0",
"cmds" : [ "cmds" : [
"write /sys/class/android_usb/android0/enable 0", "write /sys/class/android_usb/android0/enable 0",
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=accessory && property:sys.usb.configfs=0", "name" : "param:sys.usb.config=accessory && param:sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory && sys.usb.configfs=0", "condition" : "sys.usb.config=accessory && sys.usb.configfs=0",
"cmds" : [ "cmds" : [
"write /sys/class/android_usb/android0/enable 0", "write /sys/class/android_usb/android0/enable 0",
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=accessory,adb && property:sys.usb.configfs=0", "name" : "param:sys.usb.config=accessory,adb && param:sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=0", "condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=0",
"cmds" : [ "cmds" : [
"write /sys/class/android_usb/android0/enable 0", "write /sys/class/android_usb/android0/enable 0",
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=audio_source && property:sys.usb.configfs=0", "name" : "param:sys.usb.config=audio_source && param:sys.usb.configfs=0",
"condition" : "sys.usb.config=audio_source && sys.usb.configfs=0", "condition" : "sys.usb.config=audio_source && sys.usb.configfs=0",
"cmds" : [ "cmds" : [
"write /sys/class/android_usb/android0/enable 0", "write /sys/class/android_usb/android0/enable 0",
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=0", "name" : "param:sys.usb.config=audio_source,adb && param:sys.usb.configfs=0",
"condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=0", "condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=0",
"cmds" : [ "cmds" : [
"write /sys/class/android_usb/android0/enable 0", "write /sys/class/android_usb/android0/enable 0",
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=0", "name" : "param:sys.usb.config=accessory,audio_source && param:sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=0", "condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=0",
"cmds" : [ "cmds" : [
"write /sys/class/android_usb/android0/enable 0", "write /sys/class/android_usb/android0/enable 0",
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=0", "name" : "param:sys.usb.config=accessory,audio_source,adb && param:sys.usb.configfs=0",
"condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=0", "condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=0",
"cmds" : [ "cmds" : [
"write /sys/class/android_usb/android0/enable 0", "write /sys/class/android_usb/android0/enable 0",
...@@ -106,42 +106,42 @@ ...@@ -106,42 +106,42 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.typec.mode=dfp", "name" : "param:sys.usb.typec.mode=dfp",
"condition" : "sys.usb.typec.mode=dfp", "condition" : "sys.usb.typec.mode=dfp",
"cmds" : [ "cmds" : [
"write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}", "write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}",
"setparam sys.usb.typec.state ${sys.usb.typec.mode}" "setparam sys.usb.typec.state ${sys.usb.typec.mode}"
] ]
}, { }, {
"name" : "property:sys.usb.typec.mode=ufp", "name" : "param:sys.usb.typec.mode=ufp",
"condition" : "sys.usb.typec.mode=ufp", "condition" : "sys.usb.typec.mode=ufp",
"cmds" : [ "cmds" : [
"write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}", "write /sys/class/dual_role_usb/otg_default/mode ${sys.usb.typec.mode}",
"setparam sys.usb.typec.state ${sys.usb.typec.mode}" "setparam sys.usb.typec.state ${sys.usb.typec.mode}"
] ]
}, { }, {
"name" : "property:sys.usb.typec.data_role=device", "name" : "param:sys.usb.typec.data_role=device",
"condition" : "sys.usb.typec.data_role=device", "condition" : "sys.usb.typec.data_role=device",
"cmds" : [ "cmds" : [
"write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}", "write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}",
"setparam sys.usb.typec.state ${sys.usb.typec.data_role}" "setparam sys.usb.typec.state ${sys.usb.typec.data_role}"
] ]
}, { }, {
"name" : "property:sys.usb.typec.data_role=host", "name" : "param:sys.usb.typec.data_role=host",
"condition" : "sys.usb.typec.data_role=host", "condition" : "sys.usb.typec.data_role=host",
"cmds" : [ "cmds" : [
"write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}", "write /sys/class/dual_role_usb/otg_default/data_role ${sys.usb.typec.data_role}",
"setparam sys.usb.typec.state ${sys.usb.typec.data_role}" "setparam sys.usb.typec.state ${sys.usb.typec.data_role}"
] ]
}, { }, {
"name" : "property:sys.usb.typec.power_role=source", "name" : "param:sys.usb.typec.power_role=source",
"condition" : "sys.usb.typec.power_role=source", "condition" : "sys.usb.typec.power_role=source",
"cmds" : [ "cmds" : [
"write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}", "write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}",
"setparam sys.usb.typec.state ${sys.usb.typec.power_role}" "setparam sys.usb.typec.state ${sys.usb.typec.power_role}"
] ]
}, { }, {
"name" : "property:sys.usb.typec.power_role=sink", "name" : "param:sys.usb.typec.power_role=sink",
"condition" : "sys.usb.typec.power_role=sink", "condition" : "sys.usb.typec.power_role=sink",
"cmds" : [ "cmds" : [
"write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}", "write /sys/class/dual_role_usb/otg_default/power_role ${sys.usb.typec.power_role}",
......
{ {
"jobs" : [{ "jobs" : [{
"name" : "property:sys.usb.config=none && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=none && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=none && sys.usb.configfs=1", "condition" : "sys.usb.config=none && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/UDC \"none\"", "write /config/usb_gadget/g1/UDC \"none\"",
...@@ -16,19 +16,19 @@ ...@@ -16,19 +16,19 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:init.svc.adbd=stopped", "name" : "param:init.svc.adbd=stopped",
"condition" : "init.svc.adbd=stopped", "condition" : "init.svc.adbd=stopped",
"cmds" : [ "cmds" : [
"setparam sys.usb.ffs.ready 0" "setparam sys.usb.ffs.ready 0"
] ]
}, { }, {
"name" : "property:sys.usb.config=adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=adb && sys.usb.configfs=1", "condition" : "sys.usb.config=adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"start adbd" "start adbd"
] ]
}, { }, {
"name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=adb && sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"adb\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"adb\"",
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=mtp && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=mtp && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=mtp && sys.usb.configfs=1", "condition" : "sys.usb.config=mtp && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"mtp\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"mtp\"",
...@@ -46,13 +46,13 @@ ...@@ -46,13 +46,13 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=mtp,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=mtp,adb && sys.usb.configfs=1", "condition" : "sys.usb.config=mtp,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"start adbd" "start adbd"
] ]
}, { }, {
"name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=mtp,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=mtp,adb && sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=mtp,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"mtp_adb\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"mtp_adb\"",
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=ptp && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=ptp && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=ptp && sys.usb.configfs=1", "condition" : "sys.usb.config=ptp && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"ptp\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"ptp\"",
...@@ -71,13 +71,13 @@ ...@@ -71,13 +71,13 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=ptp,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=ptp,adb && sys.usb.configfs=1", "condition" : "sys.usb.config=ptp,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"start adbd" "start adbd"
] ]
}, { }, {
"name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=ptp,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=ptp,adb && sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=ptp,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"ptp_adb\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"ptp_adb\"",
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=accessory && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=accessory && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory && sys.usb.configfs=1", "condition" : "sys.usb.config=accessory && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory\"",
...@@ -96,13 +96,13 @@ ...@@ -96,13 +96,13 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=accessory,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=1", "condition" : "sys.usb.config=accessory,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"start adbd" "start adbd"
] ]
}, { }, {
"name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=accessory,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,adb && sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_adb\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_adb\"",
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=audio_source && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=audio_source && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=audio_source && sys.usb.configfs=1", "condition" : "sys.usb.config=audio_source && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"audiosource\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"audiosource\"",
...@@ -121,13 +121,13 @@ ...@@ -121,13 +121,13 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=audio_source,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=1", "condition" : "sys.usb.config=audio_source,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"start adbd" "start adbd"
] ]
}, { }, {
"name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=audio_source,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=audio_source,adb && sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=audio_source,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"audiosource_adb\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"audiosource_adb\"",
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=accessory,audio_source && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=1", "condition" : "sys.usb.config=accessory,audio_source && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_audiosource\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_audiosource\"",
...@@ -147,13 +147,13 @@ ...@@ -147,13 +147,13 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=accessory,audio_source,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1", "condition" : "sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"start adbd" "start adbd"
] ]
}, { }, {
"name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=accessory,audio_source,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=accessory,audio_source,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_audiosource_adb\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"accessory_audiosource_adb\"",
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=midi && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=midi && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=midi && sys.usb.configfs=1", "condition" : "sys.usb.config=midi && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"midi\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"midi\"",
...@@ -173,13 +173,13 @@ ...@@ -173,13 +173,13 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=midi,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=midi,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=midi,adb && sys.usb.configfs=1", "condition" : "sys.usb.config=midi,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"start adbd" "start adbd"
] ]
}, { }, {
"name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=midi,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=midi,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=midi,adb && sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=midi,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"midi_adb\"", "write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration \"midi_adb\"",
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=rndis && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=rndis && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=rndis && sys.usb.configfs=1", "condition" : "sys.usb.config=rndis && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"mkdir /config/usb_gadget/g1/functions/rndis.gs4", "mkdir /config/usb_gadget/g1/functions/rndis.gs4",
...@@ -199,13 +199,13 @@ ...@@ -199,13 +199,13 @@
"setparam sys.usb.state ${sys.usb.config}" "setparam sys.usb.state ${sys.usb.config}"
] ]
}, { }, {
"name" : "property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.config=rndis,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.config=rndis,adb && sys.usb.configfs=1", "condition" : "sys.usb.config=rndis,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"start adbd" "start adbd"
] ]
}, { }, {
"name" : "property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1", "name" : "param:sys.usb.ffs.ready=1 && param:sys.usb.config=rndis,adb && param:sys.usb.configfs=1",
"condition" : "sys.usb.ffs.ready=1 && sys.usb.config=rndis,adb && sys.usb.configfs=1", "condition" : "sys.usb.ffs.ready=1 && sys.usb.config=rndis,adb && sys.usb.configfs=1",
"cmds" : [ "cmds" : [
"mkdir /config/usb_gadget/g1/functions/rndis.gs4", "mkdir /config/usb_gadget/g1/functions/rndis.gs4",
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "trigger_checker.h" #include "trigger_checker.h"
#define LABEL "Trigger" #define LABEL "Trigger"
#define TRIGGER_AREA_SPACE 1024*64 #define TRIGGER_AREA_SPACE 1024*128
#define TRIGGER_EXECUTE_QUEUE 64 #define TRIGGER_EXECUTE_QUEUE 64
#define BUFFER_SIZE 256 #define BUFFER_SIZE 256
#define CHECK_INDEX_VALID(workSpace, index) \ #define CHECK_INDEX_VALID(workSpace, index) \
...@@ -196,22 +196,11 @@ static u_int32_t AddTrigger(TriggerWorkSpace *workSpace, int type, const char *n ...@@ -196,22 +196,11 @@ static u_int32_t AddTrigger(TriggerWorkSpace *workSpace, int type, const char *n
static int GetTriggerIndex(const char *type) static int GetTriggerIndex(const char *type)
{ {
if (strncmp("param", type, strlen("param")) == 0) { if (strncmp("param:", type, strlen("param:")) == 0) {
return TRIGGER_PROPERTY; return TRIGGER_PROPERTY;
} else {
return TRIGGER_BOOT;
} }
static const char *triggerType[] = {
"pre-init", "boot", "early-init", "init", "early-init", "late-init", "post-init",
"early-fs", "post-fs", "late-fs", "post-fs-data",
"nonencrypted",
"firmware_mounts_complete",
"load_persist_params_action"
};
for (size_t i = 0; i < sizeof(triggerType) / sizeof(char*); i++) {
if (strncmp(triggerType[i], type, strlen(triggerType[i])) == 0) {
return TRIGGER_BOOT;
}
}
return TRIGGER_BOOT;
} }
static int CheckBootTriggerMatch(TriggerNode *trigger, void *content, u_int32_t contentSize) static int CheckBootTriggerMatch(TriggerNode *trigger, void *content, u_int32_t contentSize)
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "uv.h" #include "uv.h"
#define LABEL "Trigger" #define LABEL "Trigger"
#define MAX_TRIGGER_COUNT_RUN_ONCE 10 #define MAX_TRIGGER_COUNT_RUN_ONCE 20
#define SYS_POWER_CTRL "sys.powerctrl=" #define SYS_POWER_CTRL "sys.powerctrl="
static TriggerWorkSpace g_triggerWorkSpace = {}; static TriggerWorkSpace g_triggerWorkSpace = {};
......
...@@ -33,9 +33,16 @@ ...@@ -33,9 +33,16 @@
#include "init_adapter.h" #include "init_adapter.h"
#include "init_cmds.h" #include "init_cmds.h"
#include "init_log.h" #include "init_log.h"
#ifndef OHOS_LITE
#include "init_param.h"
#endif
#include "init_perms.h" #include "init_perms.h"
#include "init_service_socket.h" #include "init_service_socket.h"
#include "init_utils.h" #include "init_utils.h"
#include "securec.h"
#ifndef OHOS_LITE
#include "sys_param.h"
#endif
#define CAP_NUM 2 #define CAP_NUM 2
#define WAIT_MAX_COUNT 10 #define WAIT_MAX_COUNT 10
...@@ -144,7 +151,10 @@ int ServiceStart(Service *service) ...@@ -144,7 +151,10 @@ int ServiceStart(Service *service)
INIT_LOGE("start service failed! null ptr.\n"); INIT_LOGE("start service failed! null ptr.\n");
return SERVICE_FAILURE; return SERVICE_FAILURE;
} }
if (service->pid > 0) {
INIT_LOGI("service : %s had started already.\n", service->name);
return SERVICE_SUCCESS;
}
if (service->attribute & SERVICE_ATTR_INVALID) { if (service->attribute & SERVICE_ATTR_INVALID) {
INIT_LOGE("start service %s invalid.\n", service->name); INIT_LOGE("start service %s invalid.\n", service->name);
return SERVICE_FAILURE; return SERVICE_FAILURE;
...@@ -220,6 +230,13 @@ int ServiceStart(Service *service) ...@@ -220,6 +230,13 @@ int ServiceStart(Service *service)
} }
service->pid = pid; service->pid = pid;
#ifndef OHOS_LITE
char paramName[PARAM_NAME_LEN_MAX] = {0};
if (snprintf_s(paramName, PARAM_NAME_LEN_MAX, PARAM_NAME_LEN_MAX - 1, "init.svc.%s", service->name) < 0) {
INIT_LOGE("snprintf_s paramName error %d \n", errno);
}
SystemWriteParam(paramName, "running");
#endif
return SERVICE_SUCCESS; return SERVICE_SUCCESS;
} }
...@@ -240,7 +257,13 @@ int ServiceStop(Service *service) ...@@ -240,7 +257,13 @@ int ServiceStop(Service *service)
INIT_LOGE("stop service %s pid %d failed! err %d.\n", service->name, service->pid, errno); INIT_LOGE("stop service %s pid %d failed! err %d.\n", service->name, service->pid, errno);
return SERVICE_FAILURE; return SERVICE_FAILURE;
} }
#ifndef OHOS_LITE
char paramName[PARAM_NAME_LEN_MAX] = {0};
if (snprintf_s(paramName, PARAM_NAME_LEN_MAX, PARAM_NAME_LEN_MAX - 1, "init.svc.%s", service->name) < 0) {
INIT_LOGE("snprintf_s paramName error %d \n", errno);
}
SystemWriteParam(paramName, "stopping");
#endif
INIT_LOGI("stop service %s, pid %d.\n", service->name, service->pid); INIT_LOGI("stop service %s, pid %d.\n", service->name, service->pid);
return SERVICE_SUCCESS; return SERVICE_SUCCESS;
} }
...@@ -291,12 +314,19 @@ void ServiceReap(Service *service) ...@@ -291,12 +314,19 @@ void ServiceReap(Service *service)
return; return;
} }
service->pid = -1;
#ifndef OHOS_LITE
char paramName[PARAM_NAME_LEN_MAX] = {0};
if (snprintf_s(paramName, PARAM_NAME_LEN_MAX, PARAM_NAME_LEN_MAX - 1, "init.svc.%s", service->name) < 0) {
INIT_LOGE("snprintf_s paramName error %d \n", errno);
}
SystemWriteParam(paramName, "stopped");
#endif
if (service->attribute & SERVICE_ATTR_INVALID) { if (service->attribute & SERVICE_ATTR_INVALID) {
INIT_LOGE("ServiceReap service %s invalid.\n", service->name); INIT_LOGE("ServiceReap service %s invalid.\n", service->name);
return; return;
} }
service->pid = -1;
// stopped by system-init itself, no need to restart even if it is not one-shot service // stopped by system-init itself, no need to restart even if it is not one-shot service
if (service->attribute & SERVICE_ATTR_NEED_STOP) { if (service->attribute & SERVICE_ATTR_NEED_STOP) {
service->attribute &= (~SERVICE_ATTR_NEED_STOP); service->attribute &= (~SERVICE_ATTR_NEED_STOP);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册