原文地址:http://blog.csdn.net/ecbtnrt/article/details/6630160
在这里我们断续前面的故事。
首先看到是调用了函数abortboot,判断是否在规定的时间内按下了键。
如果没有按下就调用bootcmd了,也就是nand read.i c0008000 80000 500000;bootm c0008000,这样直接就可使启动内核了。
要是按下了就读入命令,并查找命令列表中找到相应的命令并执行。
-
void main_loop (void)
-
{
-
-
#if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
-
s = getenv ("bootdelay");
-
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
-
-
debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);
-
-
# ifdef CONFIG_BOOT_RETRY_TIME
-
init_cmd_timeout ();
-
# endif /* CONFIG_BOOT_RETRY_TIME */
-
-
s = getenv ("bootcmd");
-
-
debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "");
-
-
if (bootdelay >= 0 && s && !abortboot (bootdelay)) {
-
# ifdef CONFIG_AUTOBOOT_KEYED
-
int prev = disable_ctrlc(1); /* disable Control C checking */
-
# endif
-
-
# ifndef CFG_HUSH_PARSER
-
run_command (s, 0);
-
# else
-
parse_string_outer(s, FLAG_PARSE_SEMICOLON |
-
FLAG_EXIT_FROM_LOOP);
-
# endif
-
-
# ifdef CONFIG_AUTOBOOT_KEYED
-
disable_ctrlc(prev); /* restore Control C checking */
-
# endif
-
}
-
-
# ifdef CONFIG_MENUKEY
-
if (menukey == CONFIG_MENUKEY) {
-
s = getenv("menucmd");
-
if (s) {
-
# ifndef CFG_HUSH_PARSER
-
run_command (s, 0);
-
# else
-
parse_string_outer(s, FLAG_PARSE_SEMICOLON |
-
FLAG_EXIT_FROM_LOOP);
-
# endif
-
}
-
}
-
#endif /* CONFIG_MENUKEY */
-
#endif /* CONFIG_BOOTDELAY */
-
-
#ifdef CONFIG_AMIGAONEG3SE
-
{
-
extern void video_banner(void);
-
video_banner();
-
}
-
#endif
-
-
FriendlyARMMenu();
-
/*
-
* Main Loop for Monitor Command Processing
-
*/
-
#ifdef CFG_HUSH_PARSER
-
parse_file_outer();
-
/* This point is never reached */
-
for (;;);
-
#else
-
for (;;) {
-
#ifdef CONFIG_BOOT_RETRY_TIME
-
if (rc >= 0) {
-
/* Saw enough of a valid command to
-
* restart the timeout.
-
*/
-
reset_cmd_timeout();
-
}
-
#endif
-
len = readline (CFG_PROMPT);
-
-
flag = 0; /* assume no special flags for now */
-
if (len > 0)
-
strcpy (lastcommand, console_buffer);
-
else if (len == 0)
-
flag |= CMD_FLAG_REPEAT;
-
#ifdef CONFIG_BOOT_RETRY_TIME
-
else if (len == -2) {
-
/* -2 means timed out, retry autoboot
-
*/
-
puts ("\nTimed out waiting for command\n");
-
# ifdef CONFIG_RESET_TO_RETRY
-
/* Reinit board to run initialization code again */
-
do_reset (NULL, 0, 0, NULL);
-
# else
-
return; /* retry autoboot */
-
# endif
-
}
-
#endif
-
-
if (len == -1)
-
puts ("\n");
-
else
-
rc = run_command (lastcommand, flag);
-
-
if (rc <= 0) {
-
/* invalid command or not repeatable, forget it */
-
lastcommand[0] = 0;
-
}
-
}
-
#endif /*CFG_HUSH_PARSER*/
-
}
阅读(1044) | 评论(0) | 转发(0) |