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