一:编译xboot
在android目录下执行如下脚本进行编译:
./mk -x

二:烧写xboot
使用xboot烧写脚本烧写。

三:xboot如何在串口终端输出打印信息
xboot的终端输出可以选择LCD或者串口,如果是LCD,则直接显示在LCD上,如果是串
口,则可通过PC机的串口监测工具显示出来。
在xboot_main函数的do_system_cfg函数中,以下语句用于设置终端输出位置:
if(! console_stdio_load(“/etc/console.xml”))
{
if(! console_stdio_load(“/romdisk/etc/console.xml”))
LOG_E(“can not setting the standard console”);
}
在console_stdio_load函数中,调用xml_get函数从console.xml文件中获得stdin,
stdout以及stderr的输出位置。因此,我们直接设置xboot/src/romdisk/etc/console.xml
中的内容即可。
默认的设置如下:
<?xml version=”1.0″ encoding=”UTF-8″?>
<console>
<stdin name=”input”/>
<stdout name=”fb”/>
<stderr name=”fb”/>
</console>
这时,串口调试信息为关闭状态,输出信息直接输出到LCD上。

四:xboot模式选择
在xboot_main函数中,进行一系列初始化之后,会进入一个while(1)死循环,进而通过xboot_get_mode
函数判断当前的工作模式,再跳转到相应的模式。
在mode.c中,默认定义xboot_mode=MODE_NORMAL,故正常情况下,会调用run_normal_mode函数执行。
用户可以通过按住menu键开机,进入MODE_MENU模式。
在xboot/src/arch/arm/mach-mpad.c中,mach_mpad_init函数会在do_initcalls函数调用时得到
执行,register_machine函数通过如下语句判断开机时是否有menu键按下,进而确认启动模式:
if(__machine->misc.getmode)
xboot_set_mode(__machine->misc.getmode());
__machine->misc.getmode()在mach-mpad.c中,代码如下:
static enum mode mach_getmode(void)
{
/* set GPH2_0 intput and pull up */
writel(S5PV210_GPH2CON, (readl(S5PV210_GPH2CON) & ~(0xf<<0)) | (0×0<<0));
writel(S5PV210_GPH2PUD, (readl(S5PV210_GPH2PUD) & ~(0×3<<0)) | (0×2<<0));

if((readl(S5PV210_GPH2DAT) & (0×1<<0)) == 0)
return MODE_MENU;
return MODE_NORMAL;
}

五:xboot的开机LOGO更改

六:xboot的按键驱动
在xboot/src/arch/arm/mach-mpad/gpio-button.c中,描述了xboot中的按键模型,注意,xboot中的相关
驱动都很类似于内核驱动。在探测函数button_probe中,初始化了六个按键用到的GPIO相关寄存器,最后调用内核
的API函数setup_timer和mod_timer,设置回调函数为button_timer_function,设置定时器过期时间为100ms,
之后,每隔100ms将会调用函数button_timer_function检测是否有按键按下。一旦有按键按下,将会上传相应的键
值。

posted on 2012-09-24 12:09  EM_C  阅读(2545)  评论(0编辑  收藏  举报