2015-03-13 10 views
7

/init.rc और अन्य एंड्रॉइड इनिट भाषा '.आरसी' फाइलों में, 'क्रियाएं' अनुभाग हो सकते हैं जो शुरू होते हैं: 'चालू' जब इनिट प्रक्रिया में कोई ईवेंट होता है तो आदेशों का अनुक्रम निष्पादित करने के लिए। सभी 'ट्रिगर्स' की सूची क्या है? ऐसा लगता है कि 'बूट', 'init', 'fs', 'प्रारंभिक-init' और 'post-fs-data' जैसे कुछ विशिष्ट कीवर्ड ट्रिगर्स दिखाई देते हैं। क्या यह इनकी पूरी सूची है? कोड में कहीं? (कीवर्ड के अलावा चलाता है कुछ अभिव्यक्ति चलाता देखते हैं, नीचे देखें।)सभी एंड्रॉइड इनिट भाषा 'ट्रिगर्स' की सूची क्या है?

कुछ कीवर्ड से चलाता है मैंने देखा है, यह जानना कि कब और अच्छा होगा कि वे क्यों कहा जाता है:

boot 
early-init 
init 
fs 
post-fs-data 
charger 
nonencrypted 

में कीवर्ड के साथ ही, अभिव्यक्ति की exmaples में शामिल हैं:

property:ro.factory.tool=1  -- when a property is set to a value 
device-added-<path> -- Triggered when a node is added when the equipment 
device-removed-<path> -- When the device is removed to add nodes 
service-exited-<name> 

उत्तर

6

नोट: लेखन के समय, सभी लिंक AOSP को इंगित android-5.1.1_r18

ट्रिगर डेवलपर्स (डिवाइस रखरखाव) द्वारा परिभाषित किया जा सकता है, इसलिए हम पूर्ण सूची को खोजने की उम्मीद नहीं कर सकते हैं।

क्रिया platform/system/core/init/init.c में संसाधित action_for_each_trigger() के माध्यम से:

  1. early-init
  2. init
  3. chargerयाlate-init
  4. लेकिन मानते हुए आप सबसे अधिक डिफ़ॉल्ट रूप से AOSP में शामिल उन में रुचि रखते हैं, यहाँ प्रवाह है

यदि charger अंतिम ट्रिगर का सामना करना पड़ा है, तो यह एओएसपी परिभाषित सूची का अंत है। निर्माता यहां से ऑफमोड चार्जिंग के लिए बाद के कार्यों को पूरक कर सकते हैं।

तो late-init पिछले ट्रिगर का सामना करना पड़ा है, तो डिफ़ॉल्ट init.rc एंड्रॉयड में (platform/system/core/rootdir/init.rc) शामिल निम्नलिखित चलाता आरंभ करता है:

# Mount filesystems and start core system services. 
on late-init 
    trigger early-fs 
    trigger fs 
    trigger post-fs 
    trigger post-fs-data 

    # Load properties from /system/ + /factory after fs mount. Place 
    # this in another action so that the load will be scheduled after the prior 
    # issued fs triggers have completed. 
    trigger load_all_props_action 

    # Remove a file to wake up anything waiting for firmware. 
    trigger firmware_mounts_complete 

    trigger early-boot 
    trigger boot 
+0

बहुत बढ़िया उत्तर !! –

+0

[वर्तमान मास्टर (एंड्रॉइड> 6)] के लिए (https://android.googlesource.com/platform/system/core/+/master/init/init.cpp) यह विधि 'am.QueueEventTrigger() '(init) में है फिर से सी ++ को फिर से लिखा जाता है)। – pevik

7

तुम भी वास्तविक फोन पर सूचीबद्ध कर सकते हैं एडीबी के साथ:

adb shell dmesg | grep "processing action" 
[ 4.376074] init: processing action 0x35480 (init) 
[ 4.440537] init: processing action 0x38c58 (init) 
[ 4.450009] init: processing action 0x35708 (early-fs) 
[ 5.531812] init: processing action 0x39c38 (console_init) 
[ 5.575831] init: processing action 0x2de70 (fs) 
[ 5.597799] init: processing action 0x35890 (fs) 
[ 7.089157] init: processing action 0x2df58 (post-fs) 
[ 7.091550] init: processing action 0x38cb8 (post-fs) 
[ 7.091818] init: processing action 0x2e288 (post-fs-data) 
[ 7.100189] init: processing action 0x39c80 (property_service_init) 
[ 7.110080] init: processing action 0x39cc8 (signal_init) 
[ 7.110177] init: processing action 0x39d10 (check_startup) 
[ 7.110248] init: processing action 0x2ea18 (boot) 
[ 7.126205] init: processing action 0x397e0 (boot) 
[ 8.183090] init: processing action 0x39d58 (queue_property_triggers) 
[ 8.183232] init: processing action 0x2f8f8 (nonencrypted) 
[ 8.183810] init: processing action 0x2fd98 (property:ro.debuggable=1) 
[ 8.184463] init: processing action 0x328f8 (property:sys.usb.config=none) 
[ 14.438626] init: processing action 0x2ffd0 (property:sys.sensors=1) 
[ 28.192393] init: processing action 0x31860 (property:sys.boot_completed=1) 
0

वहाँ कुछ खोजशब्दों है कि हर कोई जानता है, लेकिन अगर आप गुण सेट की जाने वाली (और अन्य है कि सामान्य रूप से कर रहे हैं) की एक सूची देखने के लिए चाहते हैं इस aDB कमांड का प्रयास करें:

$ adb shell getprop 
[alsa.mixer.capture.headset]: [Capture] 
[alsa.mixer.capture.master]: [Capture] 
[alsa.mixer.playback.headset]: [Headphone] 
[alsa.mixer.playback.master]: [Playback] 
[alsa.mixer.playback.speaker]: [Playback] 
[back_camera_name]: [ov5640_mipi] 
[back_camera_orient]: [0] 
[camera.disable_zsl_mode]: [1] 
[dalvik.vm.dexopt-flags]: [m=y] 
[dalvik.vm.heapgrowthlimit]: [64m] 
[dalvik.vm.heapmaxfree]: [8m] 
[dalvik.vm.heapminfree]: [512k] 
[dalvik.vm.heapsize]: [384m] 
[dalvik.vm.heapstartsize]: [8m] 
[dalvik.vm.heaptargetutilization]: [0.75] 
[dalvik.vm.jniopts]: [warnonly] 
[dalvik.vm.stack-trace-file]: [/data/anr/traces.txt] 
[debug.egl.hw]: [1] 
[debug.force_rtl]: [0] 
[debug.sf.enable_hgl]: [1] 
[debug.sf.showfps]: [0] 
[dev.bootcomplete]: [1] 
[dhcp.eth0.result]: [failed] 
[front_camera_name]: [ov5642_camera,ov5640_camera] 
[front_camera_orient]: [0] 
[gsm.current.phone-type]: [1] 
[gsm.network.type]: [Unknown] 
[gsm.operator.alpha]: [] 
[gsm.operator.iso-country]: [] 
[gsm.operator.isroaming]: [false] 
[gsm.operator.numeric]: [] 
[gsm.ril.delay]: [15] 
[gsm.sim.state]: [NOT_READY] 
[hwc.enable_dither]: [1] 
[hwc.stretch.filter]: [1] 
[init.svc.adbd]: [running] 
[init.svc.bootanim]: [stopped] 
[init.svc.console]: [running] 
[init.svc.debuggerd]: [running] 
[init.svc.dhcpcd_eth0]: [stopped] 
[init.svc.drm]: [running] 
[init.svc.fuse_extsd]: [running] 
[init.svc.healthd]: [running] 
[init.svc.installd]: [running] 
[init.svc.keystore]: [running] 
[init.svc.media]: [running] 
[init.svc.netd]: [running] 
[init.svc.sdcard]: [running] 
[init.svc.servicemanager]: [running] 
[init.svc.surfaceflinger]: [running] 
[init.svc.ueventd]: [running] 
[init.svc.uim]: [stopped] 
[init.svc.vold]: [running] 
[init.svc.wifi_mac]: [stopped] 
[init.svc.zygote]: [running] 
[media.omxgm.enable-player]: [1] 
[media.omxgm.enable-record]: [1] 
[media.omxgm.enable-scan]: [1] 
[net.bt.name]: [Android] 
[net.change]: [net.qtaguid_enabled] 
[net.hostname]: [android-c49d34ff0fbd9f6] 
[net.qtaguid_enabled]: [1] 
[net.tcp.buffersize.default]: [4096,87380,110208,4096,16384,110208] 
[net.tcp.buffersize.edge]: [4093,26280,35040,4096,16384,35040] 
[net.tcp.buffersize.ethernet]: [524288,2097152,4194304,524288,2097152,4194304] 
[net.tcp.buffersize.evdo]: [4094,87380,262144,4096,16384,262144] 
[net.tcp.buffersize.gprs]: [4092,8760,11680,4096,8760,11680] 
[net.tcp.buffersize.hsdpa]: [4094,87380,262144,4096,16384,262144] 
[net.tcp.buffersize.hspa]: [4094,87380,262144,4096,16384,262144] 
[net.tcp.buffersize.hspap]: [4094,87380,1220608,4096,16384,1220608] 
[net.tcp.buffersize.hsupa]: [4094,87380,262144,4096,16384,262144] 
[net.tcp.buffersize.lte]: [524288,1048576,2097152,262144,524288,1048576] 
[net.tcp.buffersize.umts]: [4094,87380,110208,4096,16384,110208] 
[net.tcp.buffersize.wifi]: [524288,1048576,2097152,262144,524288,1048576] 
[persist.service.bdroid.bdaddr]: [22:22:12:0c:fb:0d] 
[persist.sys.dalvik.vm.lib]: [libdvm.so] 
[persist.sys.profiler_ms]: [0] 
[persist.sys.usb.config]: [mtp,adb] 
[qemu.hw.mainkeys]: [1] 
[ro.FSL_AAC_PARSER]: [1] 
[ro.FSL_ASF_PARSER]: [0] 
[ro.FSL_AVI_PARSER]: [1] 
[ro.FSL_FLAC_PARSER]: [1] 
[ro.FSL_FLV_PARSER]: [1] 
[ro.FSL_MKV_PARSER]: [1] 
[ro.FSL_MPG2_PARSER]: [1] 
[ro.FSL_REAL_PARSER]: [0] 
[ro.adb.secure]: [1] 
[ro.allow.mock.location]: [1] 
[ro.baseband]: [unknown] 
[ro.board.platform]: [imx6] 
[ro.boot.bootdev]: [mmcblk3] 
[ro.boot.hardware]: [freescale] 
[ro.boot.serialno]: [19b80271c6] 
[ro.bootloader]: [unknown] 
[ro.bootmode]: [unknown] 
[ro.build.characteristics]: [tablet] 
[ro.build.date.utc]: [1484264053] 
[ro.build.date]: [Thu Jan 12 17:34:13 CST 2017] 
[ro.build.description]: [nitrogen6x-eng 4.4.3 2.0.1-ga 20160816 dev-keys] 
[ro.build.display.id]: [nitrogen6x-eng 4.4.3 2.0.1-ga 20160816 dev-keys] 
[ro.build.fingerprint]: [boundary/nitrogen6x/nitrogen6x:4.4.3/2.0.1-ga/20160816:eng/dev-keys] 
[ro.build.host]: [fbd-HP-ZBook-15] 
[ro.build.id]: [2.0.1-ga] 
[ro.build.product]: [nitrogen6x] 
[ro.build.tags]: [dev-keys] 
[ro.build.type]: [eng] 
[ro.build.user]: [fbd] 
[ro.build.version.codename]: [REL] 
[ro.build.version.incremental]: [20160816] 
[ro.build.version.release]: [4.4.3] 
[ro.build.version.sdk]: [19] 
[ro.carrier]: [unknown] 
[ro.config.alarm_alert]: [Alarm_Classic.ogg] 
[ro.config.notification_sound]: [OnTheHunt.ogg] 
[ro.crypto.state]: [unencrypted] 
[ro.debuggable]: [1] 
[ro.factorytest]: [0] 
[ro.hardware]: [freescale] 
[ro.kernel.android.checkjni]: [1] 
[ro.opengles.version]: [196608] 
[ro.product.board]: [] 
[ro.product.brand]: [boundary] 
[ro.product.cpu.abi2]: [armeabi] 
[ro.product.cpu.abi]: [armeabi-v7a] 
[ro.product.device]: [nitrogen6x] 
[ro.product.locale.language]: [en] 
[ro.product.locale.region]: [US] 
[ro.product.manufacturer]: [boundary] 
[ro.product.model]: [NITROGEN6X] 
[ro.product.name]: [nitrogen6x] 
[ro.revision]: [405522] 
[ro.ril.wake_lock_timeout]: [300] 
[ro.runtime.firstboot]: [582594834] 
[ro.secure]: [0] 
[ro.serialno]: [19b80271c6] 
[ro.sf.hwrotation]: [0] 
[ro.sf.lcd_density]: [160] 
[ro.tether.denied]: [false] 
[ro.wifi.channels]: [] 
[ro.zygote.disable_gl_preload]: [true] 
[rw.VIDEO_RENDER_NAME]: [video_render.surface] 
[service.bootanim.exit]: [1] 
[sys.boot_completed]: [1] 
[sys.emulated.battery]: [1] 
[sys.interactive]: [active] 
[sys.sysctl.extra_free_kbytes]: [12000] 
[sys.usb.config]: [mtp,adb] 
[sys.usb.state]: [mtp,adb] 
[system_init.startsurfaceflinger]: [0] 
[vold.post_fs_data_done]: [1] 
[wifi.ap.interface]: [wlan0] 
[wifi.interface]: [wlan0] 
[wlan.interface]: [wlan0] 

मैं सीमा डिवाइस के सबरेलाइट बोर्ड पर एंड्रॉइड 4.4.2 चला रहा हूं। Getprop adb कमांड here के लिए लिंक देखें। अधिक जानकारी के लिए यह blog देखें।

0

मुझे पता है कि यह देर हो चुकी है, लेकिन अगर किसी को अभी भी समस्या का सामना करना पड़ रहा है तो मैंने इसका जवाब देने का फैसला किया। प्रारंभिक Init- सेट इनिट और इसके फोर्क किए गए बच्चों के oom_adj सभी init प्रक्रिया के लिए सुरक्षा संदर्भ सेट करें। init- सेटअप वैश्विक वातावरण पर बढ़ते अंक FS- माउंट एमटीडी विभाजन बाद FS- परिवर्तन पर सिस्टम निर्देशिका पर बाद FS-डेटा- की अनुमति पर बनाएं बुनियादी नेटवर्क init, मेमोरी मैनेजमेंट सेवा servicemana - /डेटा फ़ोल्डर और सबफ़ोल्डर बूट पर की अनुमति बदलना जर शुरू प्रणाली प्रबंधक स्थान, ऑडियो, साझा वरीयताओं आदि जैसे सभी देशी सेवाओं का प्रबंधन करने सेवा zygote- एक app_process के रूप में शुरू युग्मनज

उपरोक्त जानकारी के लिए स्रोत http://www.onsandroid.com/2014/10/in-depth-android-boot-sequence-process.html

0

है सबसे इन सभी मानक ट्रिगर्स को खोजने का प्रभावी तरीका system/core/rootdir directory में *.rc फ़ाइलों पर "ट्रिगर" शब्द के लिए एक grep करना है।

grep trigger rootdir/* 
संबंधित मुद्दे