资源描述:
《U-Boot启动引导内核分析(三)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、U-Boot启动引导内核分析(三)2011-03-2309:20:51
2、分类:默认分类
3、标签:
4、字号大中小订阅do_bootm_linux()函数位于lib_arm/Bootm.c文件中,主要流程分析如下:voiddo_bootm_linux(cmd_tbl_t*cmdtp,intflag,intargc,char*argv[],bootm_headers_t*images){ulonginitrd_start,initrd_end;ulongep=0;bd_t*bd=gd->bd;char*s;i
5、ntmachid=bd->bi_arch_number;void(*theKernel)(intzero,intarch,uintparams);intret;#ifdefCONFIG_CMDLINE_TAGchar*commandline=getenv("bootargs");#endif/*findkernelentrypoint*/if(images->legacy_hdr_valid){ep=image_get_ep(&images->legacy_hdr_os_copy);#ifdefin
6、ed(CONFIG_FIT)}elseif(images->fit_uname_os){ret=fit_image_get_entry(images->fit_hdr_os,images->fit_noffset_os,&ep);if(ret){puts("Can'tgetentrypointproperty!");gotoerror;}#endif}else{puts("Couldnotfindkernelentrypoint!");gotoerror;}theKernel=(void(*
7、)(int,int,uint))ep;s=getenv("machid");if(s){machid=simple_strtoul(s,NULL,16);printf("Usingmachid0x%xfromenvironment",machid);}ret=boot_get_ramdisk(argc,argv,images,IH_ARCH_ARM,&initrd_start,&initrd_end);if(ret)gotoerror;show_boot_progress(15);debug("
8、##TransferringcontroltoLinux(ataddress%08lx)...",(ulong)theKernel);#ifdefined(CONFIG_SETUP_MEMORY_TAGS)
9、
10、defined(CONFIG_CMDLINE_TAG)
11、
12、defined(CONFIG_INITRD_TAG)
13、
14、defined(CONFIG_SERIAL_TAG)
15、
16、defined(CONFIG_REVISION_TAG)
17、
18、defined(CONFIG_LCD)
19、
20、def
21、ined(CONFIG_VFD)/*初始化TAG结构体开始*/setup_start_tag(bd);#ifdefCONFIG_SERIAL_TAGsetup_serial_tag(¶ms);#endif#ifdefCONFIG_REVISION_TAGsetup_revision_tag(¶ms);#endif#ifdefCONFIG_SETUP_MEMORY_TAGS/*设置RAM参数*/setup_memory_tags(bd);#endif#ifdefCONFIG_CMDLI
22、NE_TAGsetup_commandline_tag(bd,commandline);#endif#ifdefCONFIG_INITRD_TAGif(initrd_start&&initrd_end)setup_initrd_tag(bd,initrd_start,initrd_end);#endif#ifdefined(CONFIG_VFD)
23、
24、defined(CONFIG_LCD)setup_videolfb_tag((gd_t*)gd);#endif/*初始化TAG结构体结束*/setup_
25、end_tag(bd);#endif/*weassumethatthekernelisinplace*/printf("Startingkernel...");#ifdefCONFIG_USB_DEVICE{externvoidudc_disconnect(void);udc_disconnect();}#endifcleanup_before_linux();/*将控制权交给内核,让内核自解压启动*//*传给KERNEL的参数:(structtag*)b