Android 根文件系统启动分析
2010-05-08 18:36:00 来源:WEB开发网核心提示:/*打开console,如果cmdline中没有指定的console则打开默认的/dev/console*/ if (console[0]) { snprintf(tmp, sizeof(tmp), "/dev/%s", console); console_name = strdup(tmp); }
/*打开console,如果cmdline中没有指定的console则打开默认的/dev/console*/ 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);
/*读取/initlogo.rle(一张位图),如果成功则在/dev/graphics/fb0 显示Logo,如果失败则将/dev/tty0
*设为TEXT模式并打开/dev/tty0,输出文本ANDROID(本人修改为Zhao Rui Jia做为启动项目的修改)。 */ if(
load_565rle_image(INIT_IMAGE_FILE) ) { fd = open("/dev/tty0", O_WRONLY); if (fd
>= 0) { const char *msg; msg = "
" "
" "
" "
" "
" "
" "
" // console
is 40 cols x 30 lines "
" "
" "
" "
" "
" "
" "
" /*" A N D R O I D ";*/
" z h a o R u i J i a"; write(fd, msg, strlen(msg)); close(fd); } } /* 判断cmdline
中的??,并设置属性系统中的参数: * 1、 如果 bootmode为 * - factory,设置ro.factorytest值为1 * -
factory2,设置ro.factorytest值为2 * - 其他的韵ro.factorytest值?0 *
2、如果有serialno参数,则设置ro.serialno,否则为"" * 3、如果有bootmod参数,则设置ro.bootmod,否则为"unknown"
* 4、如果有baseband参数,则设置ro.baseband,否则为"unknown" *
5、如果有carrier参数,则设置ro.carrier,否则为"unknown" *
6、如果有bootloader参数,则设置ro.bootloader,否则为"unknown" *
7、通过全局变量(前面从/proc/cpuinfo中提取的)设置ro.hardware和ro.version。 */ if (qemu[0])
import_kernel_cmdline(1); if (!strcmp(bootmode,"factory"))
property_set("ro.factorytest", "1"); else if (!strcmp(bootmode,"factory2"))
property_set("ro.factorytest", "2"); else property_set("ro.factorytest", "0");
property_set("ro.serialno", serialno[0] ? serialno : "");
property_set("ro.bootmode", bootmode[0] ? bootmode : "unknown");
property_set("ro.baseband", baseband[0] ? baseband : "unknown");
property_set("ro.carrier", carrier[0] ? carrier : "unknown");
property_set("ro.bootloader", bootloader[0] ? bootloader : "unknown");
property_set("ro.hardware", hardware); snprintf(tmp, PROP_VALUE_MAX, "%d",
revision); property_set("ro.revision", tmp); /*执行所有触发标识为init的action。*/
[]
更多精彩
赞助商链接