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;
}