如何启用Android L MR1 5.1的启动图

时间:2015-12-18 01:29:56

标签: android performance

我正在调查android第一次启动,并希望启用启动图,但我总是失败,下面是我做了什么,有人可以帮助我吗?

因为bootchart服务早于/ data partition mount启动,所以每次bootchart都无法初始化。 来自内核日志的失败消息是:bootcharting init failure

所以为了确保bootchart init成功,我已经改变了相关的代码。这个解决方案在Android L中运行良好,但在Android L MR1中失败了。 实施以下变更后手机继续重启;在我禁用selinux后,首先打开手机屏幕。

init/bootchart.c
/* called to setup bootcharting */
int   bootchart_init( void )
{
    int  ret;
    char buff[4];
    int  timeout = 0, count = 0;

    buff[0] = 0;

+    /* wait until /data mounted */
+    struct stat datadir;
+    if(stat("/data/bootchart-start", &datadir) == -1) {
+    ERROR("Bootchart, /data/bootchart-start not exists\n");
+    return -1;
+    }
    proc_read( LOG_STARTFILE, buff, sizeof(buff) );
    if (buff[0] != 0) {
        timeout = atoi(buff);
    }
init/init.c
static int bootchart_init_action(int nargs, char **args)
{
    bootchart_count = bootchart_init();
    if (bootchart_count < 0) {
        ERROR("bootcharting init failure\n");
+   queue_builtin_action(bootchart_init_action, "bootchart_init");
    } else if (bootchart_count > 0) {
        NOTICE("bootcharting started (period=%d ms)\n", bootchart_count*BOOTCHART_POLLING_MS);
    } else {
        NOTICE("bootcharting ignored\n");
    }
rootdir/init.rc
on post-fs-data
    # We chown/chmod /data again so because mount is run as root + defaults
    chown system system /data
    chmod 0771 /data
    # We restorecon /data in case the userdata partition has been reset.
    restorecon /data

+    write /data/bootchart-start 600
    # Avoid predictable entropy pool. Carry over entropy from previous boot.
    copy /data/system/entropy.dat /dev/urandom
/system/core/init/Android.mk

+ INIT_BOOTCHART :=true
ifeq ($(strip $(INIT_BOOTCHART)),true)
LOCAL_SRC_FILES += bootchart.c
LOCAL_CFLAGS    += -DBOOTCHART=1
endif

是否有人在Android L MR1上启用了bootchart?你怎么能改变代码? 我怎么能修改代码以确保在挂载/ data / partition之后运行bootchart init?

提前谢谢!这对我来说非常严重。

1 个答案:

答案 0 :(得分:0)

我能够通过此init.rc启用首次引导的引导图:

on post-fs-data
    # We chown/chmod /data again so because mount is run as root + defaults
    chown system system /data
    chmod 0771 /data
    # We restorecon /data in case the userdata partition has been reset.
    restorecon /data

    # start debuggerd to make debugging early-boot crashes easier.
    start debuggerd
    start debuggerd64

    # Make sure we have the device encryption key.
    start vold
    installkey /data

    # Start bootcharting as soon as possible after the data partition is
    # mounted to collect more data.
    mkdir /data/bootchart 0755 shell shell
    # if you need to enable bootchart uncomment next line
    # Old Android
    # write /data/bootchart-start 120 
    # Android > 7.0
    # write /data/bootchart/start 120 
    bootchart_init