- 16
- 0
- 约1.23万字
- 约 4页
- 2015-09-26 发布于重庆
- 举报
Uboot启动流程分析(四)
U-boot启动流程 (Linux内核)的分析 (四)
在上一篇中分析到u-Boot启动Linux内核的函数do_bootm_linux,这一篇则着重分析,U-boot是如果一步一步启动内核的。
我们可以看到在,start_armboot()函数的最后,在一个无限循环中调用了函数main_loop(),该函数在common/main.c文件中被定义,我们可以看到下面
的一段代码:
#if defined (CONFIG_BOOTDELAY) (CONFIG_BOOTDELAY 0)
s getenv (bootdelay); //得到环境变量中bootdelay
bootdelay s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY ;
debug (### main_loop entered: bootdelay=%d\n\n, bootdelay);
如果定义了CONFIG_BOOTDELAY,则在没有CONFIG_BOOTDELAY秒中,串口上没有输入,则会进行自动的引导Linux内核。也就是执行bootcmd命令。
#ifdef CONFIG_BOOTCOUNT_LIMIT //启动次数的限制功能,如果到达一定次数,将不能启动u-boot.
if (bootlimit (bootcount bootlimit)) {//检查是否超出启动次数限制
printf (Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n,
(unsigned)bootlimit);
s getenv (altbootcmd) ;//启动延时
}
else
#endif /* CONFIG_BOOTCOUNT_LIMIT */
s getenv (bootcmd);// 获得启动参数
debug (### main_loop: bootcmd=\%s\\n, s ? s : UNDEFINED);
// 这里如果bootdelay大于0,并且中间没有被中断的话,执行命令行参数
if (bootdelay 0 s !abortboot (bootdelay)) {
# ifdef CONFIG_AUTOBOOT_KEYED
int prev disable_ctrlc (1); /* disable Control C checking */
# endif
# ifndef CONFIG_SYS_HUSH_PARSER
run_command (s, 0); //运行启动的命令行,例如 可以使用tftp命令
# else
parse_string_outer (s, FLAG_PARSE_SEMICOLON |
FLAG_EXIT_FROM_LOOP);
# endif
到这里我们就可以看到是怎么调用设置的命令行参数的,在这里还要使用到bootm命令,先来看看bootm命令的实现,在common/cmd_bootm.c
#define CONFIG_BOOTM_LINUX 1
#define CONFIG_BOOTM_NETBSD 1
#define CONFIG_BOOTM_RTEMS 1
#ifdef CONFIG_BOOTM_LINUX
extern boot_os_fn do_bootm_linux ;
#endif
#ifdef CONFIG_BOOTM_NETBSD
static boot_os_fn do_bootm_
您可能关注的文档
- Some Notes Concerning the Dynamics of Noncommutative Lumps Corresponding to Nontrivial Vacu.pdf
- Some professional words(财经类专业英语).doc
- Some Simple Arithmetic on How Income Inequality and Economic Growth Matter by.pdf
- SONPCR扩增抗禾谷孢囊线虫基因LRR区及序列分析.pdf
- SOP液相色谱岗位分析方法性能标准其他要求和步骤.doc
- SOMKmeans两阶段聚类算法及其应用.pdf
- soundforge的使用说明.doc
- Spark Streaming 对数据流的“批处理”不是“流处理”的五大理由.doc
- Spatiotemporal Dynamics of Broad Area Semiconductor Lasers and its Characterization.pdf
- Spectral Analysis of Central Stars of PNe Interacting with the Interstellar Medium.pdf
- UCOSII内核扩充时间片轮转调度算法的设计.pdf
- UCfber在钢筋混凝土截面弯矩_曲率计算中的应用.pdf
- uclinux在ARMSYS上的使用说明书.pdf
- UIColor,CGColor,CIColor三者的区别和联系.doc
- UG二次开发中数据库的建立方法.pdf
- Ultraquantum Dynamics.pdf
- UITextField的使用.pdf
- UL黄卡和塑料性能的说明.doc
- Unbounded Thread–Creation in Dynamic Pointer Programs Extended Abstract.pdf
- Uncertainty Optimization for Robust Dynamic Optical Flow Estimation.pdf
原创力文档

文档评论(0)