Android Pオープン起動プロセスinit log
3674 ワード
先日プロジェクトをしたのは、initで出会ったことです.rc on property:initを追加します.svc.bootanim=running、triggerはできませんが、on property:sysを使用します.boot_completed=1ですがtriggerできます.
Init logを開き、起動log debugの上記の問題原因をキャプチャします.
1.printkを追加する.devkmsg=onからcmdlineへ、initプロセスのlogをkernel logに出力
BOARD_KERNEL_CMDLINE += printk.devkmsg=on
2.android bootを追加します.selinux=permissiveからcmdlineへ、selinux権限を閉じます
BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
3.起動中のdmesgを捕まえる
4.logによる位置決めコード
5.上記のコードは、trigger属性を返すにはIsActionableProperty関数が必要です.logを通じて初歩的な原因を見つけました.では、どのようにしてtrueを返すことができますか?「ro.actionable_compatible_property.enabled」属性値をfalseに変更します.これにより、CTSの問題が発生し、 は使用できません. kExportedActionablePropertiesリストにinitを追加する.svc.bootanimプロパティ-CTS/VTSの問題はまだ測定されていません.修正は を取ることができます. Debugにより、Android Pにはホワイトリストのようなメカニズムが追加されており、kExportedActionablePropertiesリストのpropertyのみがinit.rcトリガ.この部分のもっと詳しいソース分析はこの子供靴を参考にすることができて、よく書けています.Android P on property属性はtriggerフロー分析できません
# Trigger
on property:init.svc.bootanim=running
write /dev/kmsg "Service bootanim running "
# Trigger
on property:sys.boot_completed=1
write /dev/kmsg "system boot completed "
Init logを開き、起動log debugの上記の問題原因をキャプチャします.
1.printkを追加する.devkmsg=onからcmdlineへ、initプロセスのlogをkernel logに出力
BOARD_KERNEL_CMDLINE += printk.devkmsg=on
2.android bootを追加します.selinux=permissiveからcmdlineへ、selinux権限を閉じます
BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
3.起動中のdmesgを捕まえる
[ 19.167112] [<6>][1, init]init: Parsing file /vendor/etc/init/hw/init.target.rc...
[ 19.177005] [<6>][1, init]init: /vendor/etc/init/hw/init.target.rc: 234: ParseTriggers() failed: unexported property tigger found: init.svc.bootanim
4.logによる位置決めコード
Result ParsePropertyTrigger(conststd::string& trigger, Subcontext* subcontext,
std::map<:string std::string="">* property_triggers) {
conststaticstd::stringprop_str("property:");
std::stringprop_name(trigger.substr(prop_str.length()));
size_tequal_pos = prop_name.find('=');
if (equal_pos == std::string::npos) {
return Error() << "property trigger found without matching '='";
}
std::stringprop_value(prop_name.substr(equal_pos + 1));
prop_name.erase(equal_pos);
if (!IsActionableProperty(subcontext, prop_name)) {//init.svc.bootanim ,
// log
return Error() << "unexported property tigger found: " << prop_name;
}if (auto [it, inserted] = property_triggers->emplace(prop_name, prop_value); !inserted) {
return Error() << "multiple property triggers found for same property";
}
return Success();
}
// init.svc.bootanim
boolIsActionableProperty(Subcontext* subcontext, conststd::string& prop_name) {
staticboolenabled = GetBoolProperty("ro.actionable_compatible_property.enabled", false);
if (subcontext == nullptr || !enabled) {
return true;
}
if (kExportedActionableProperties.count(prop_name) == 1) {
return true;
}for (constauto& prefix : kPartnerPrefixes) {
if (android::base::StartsWith(prop_name, prefix)) {
return true;
}
}
return false; // init.svc.bootanim false
}
5.上記のコードは、trigger属性を返すにはIsActionableProperty関数が必要です.logを通じて初歩的な原因を見つけました.では、どのようにしてtrueを返すことができますか?
diff --git a/init/stable_properties.h b/init/stable_properties.h
index 0956a4a..0e3a20c 100644
--- a/init/stable_properties.h
+++ b/init/stable_properties.h
@@ -33,6 +33,7 @@ static const std::set<:string> kExportedActionableProperties = {
"init.svc.console",
"init.svc.mediadrm",
"init.svc.surfaceflinger",
+ "init.svc.bootanim", //add
"init.svc.zygote",
"persist.bluetooth.btsnoopenable",
"persist.sys.crash_rcu",