U-BOOT源码分析及移植
{
}
19)设置CS8900的MAC地址。
cs8900_get_enetaddr (gd->bd->bi_enetaddr);
20)初始化以太网。
eth_initialize(gd->bd);//bd中已经IP,MAC已经初始化
21)main_loop ();定义于common/main.c
至此所有初始化工作已经完毕。main_loop在标准转入设备中接受命令行,然后分析,查找,执行。
关于U-boot中命令相关的编程:
1、命令相关的函数和定义
@main_loop:这个函数里有太多编译选项,对于smdk2410,去掉所有选项后等效下面的程序
void main_loop()
{
static char lastcommand[CFG_CBSIZE] = { 0, };
int len;
int rc = 1;
int flag;
char *s;
int bootdelay;
s = getenv ("bootdelay"); //自动启动内核等待延时
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);
s = getenv ("bootcmd"); //取得环境中设置的启动命令行
debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "");

