Android平台启动初始化"ANDROID"字样修改(linux部分的启动界面,补充6.0版本代码)

Android平台启动初始化"ANDROID"字样修改(linux部分的启动界面)

4.4版本修改方式如下:

在启动代码system/core/init/init.c中将下面的代码修改msg变量的部分,即可在开机时显示所修改的内容,一般为了开机的简约,这段代码通常被屏蔽掉。

if(load_565rle_image(INIT_IMAGE_FILE) ) {
fd =open("/dev/tty0", O_WRONLY);
if (fd >=0) {
constchar *msg;
msg= "\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n" // console is 40cols x 30 lines
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
" A N D R O I D ";//需要修改的地方
write(fd, msg, strlen(msg));
close(fd);
}
}

重新进行源码的编译,启动Android系统即可。

转载来源:https://blog.csdn.net/sunjing_/article/details/60138331

6.0修改方式如下:

由4.4延伸出6.0的修改方式

源码:system/core/init/init.cpp

修改前代码:

static int console_init_action(int nargs, char **args)
{
    char console[PROP_VALUE_MAX];
    if (property_get("ro.boot.console", console) > 0) {
        snprintf(console_name, sizeof(console_name), "/dev/%s", console);
    }

    int fd = open(console_name, O_RDWR | O_CLOEXEC);
    if (fd >= 0)
        have_console = 1;
    close(fd);

    fd = open("/dev/tty0", O_WRONLY | O_CLOEXEC);
    if (fd >= 0) {
        const char *msg;
            msg = "\n"
        "\n"
        "\n"
        "\n"
        "\n"
        "\n"
        "\n"  // console is 40 cols x 30 lines
        "\n"
        "\n"
        "\n"
        "\n"
        "\n"
        "\n"
        "\n"
        "             A N D R O I D ";
        write(fd, msg, strlen(msg));
        close(fd);
    }

    return 0;
}

修改后代码:

static int console_init_action(int nargs, char **args)
{
    char console[PROP_VALUE_MAX];
    if (property_get("ro.boot.console", console) > 0) {
        snprintf(console_name, sizeof(console_name), "/dev/%s", console);
    }

    int fd = open(console_name, O_RDWR | O_CLOEXEC);
    if (fd >= 0)
        have_console = 1;
    close(fd);

    fd = open("/dev/tty0", O_WRONLY | O_CLOEXEC);
    if (fd >= 0) {
        const char *msg;
            msg = "";
        write(fd, msg, strlen(msg));
        close(fd);
    }

    return 0;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值