static int console_init_action(int nargs, char **args) { int fd; char tmp[PROP_VALUE_MAX]; if (console[0]) { snprintf(tmp, sizeof(tmp), "/dev/%s", console); console_name = strdup(tmp); } fd = open(console_name, O_RDWR); if (fd >= 0) have_console = 1; close(fd); /*add by jszeng,init hdmi or other display devices,so can see the android logo on hdmi or other display devices*/ init_initdisplay(); //if( load_565rle_image(INIT_IMAGE_FILE) ) { if( load_argb8888_image(INIT_IMAGE_FILE) ) { fd = open("/dev/tty0", O_WRONLY); 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) { int fd; if (console[0]) { snprintf(console_name, sizeof(console_name), "/dev/%s", console); } fd = open(console_name, O_RDWR); if (fd >= 0) have_console = 1; close(fd); // 加载启动log图像文件 // if( load_565rle_image(INIT_IMAGE_FILE) ) { if( strcmp(bootmode, "charger") && load_argb8888_image(INIT_IMAGE_FILE) ) { fd = open("/dev/tty0", O_WRONLY); // 这里打开了当前的显示终端 if (fd >= 0) { // 大于零不是说打开成功吗?怎么还显示Android字样? const char *msg; // 这里别人的注释是:如果没有这张图片就显示Android字样 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; }
int do_dispe2fsck(int nargs,char **args) { int child; int ret; int status; int currstate; int pipe_fd; int exit_cycle = 0; struct cmdpacket cpt = {0}; if (access(PIPE_NAME,F_OK)==-1){ if(mkfifo(PIPE_NAME,O_CREAT|O_RDWR|0666)!=0){ ERROR("create e2fsck pipe error!\n"); return 0; } } child = fork(); if (child > 0) { //execl("/system/bin/logwrapper","/system/bin/logwrapper","/system/bin/e2fsck","-y",args[1], NULL); return 0; }else if(child == 0 ){ pipe_fd=open(PIPE_NAME,O_RDONLY|O_NONBLOCK); if (pipe_fd==-1){ ERROR("open e2fsck pipe error\n"); return 0; } ERROR("start e2fsck listening..."); while (!exit_cycle) { ret = waitpid(-1,&status,WNOHANG); if(child == ret){ exit_cycle=1; } ret = read(pipe_fd,&cpt,sizeof(cpt)); if(ret!=sizeof(cpt)){ sleep(1); continue; } switch(cpt.cmd){ case C_IN_START: ERROR("C_IN_START"); ERROR("path = %s",cpt.message); break; case C_IN_NEEDFIX: ERROR("C_IN_NEEDFIX"); load_argb8888_image("/needfix.rle"); break; case C_IN_PROCESS: ERROR("C_IN_PROCESS"); break; case C_IN_FINISH: ERROR("C_IN_FINISH"); exit_cycle=1; break; default: ERROR("undefined commond"); break; } } close(pipe_fd); unlink(PIPE_NAME); ERROR("e2fsck %s ok", args[1]); }else{ ERROR("fork error"); } return 1; }