uboot参数区中的bootargs如何传给内核呢?
2012-12-22 20:00
363 查看
平台:STi7162
uboot版本:uboot 1.3.1(st已做过修改)
st平台的内存首地址是0x80000000,此地址不是固定的,不同类型的芯片是不同的,比如samsung的arm920t是0x30000000。uboot提供两种工作模式:一是启动加载模式(start loading),一是下载模式(downloading)。工作在启动加载模式时,uboot会自动执行bootcmd命令,比如:bootcmd=“nand read 0x100000 0x80000000 0x300000; bootm 0x80000000”
》CRC校验image head struct的64个字节的正确性
》根据镜像头中指定的压缩类型(比如gzip),把kernel解压到指定的位置hdr->ih_load(0x80800000)
》调用来自lib_sh/sh_linux.c中的函数do_bootm_linux( . . . ),启动内核
do_bootm_linux
{
》从参数去中获取环境变量bootargs的值
char *commandline = getenv("bootargs");
》从image head struct中获取kernel的入口地址
void (*theKernel)(void); // 函数指针
theKernel = (void (*) (void)) ntohl (hdr->ih_ep);
》从image head struct中获取kernel的指定存储参数的地址
ulong param;
param = ntohl (hdr->ih_load);
》把commandline拷贝到约定好的COMMAND_LINE地址
strcpy (COMMAND_LINE, commandline);
》最后,执行kernel的入口函数,把控制权交给kernel
/* now, finally, we pass control to the kernel itself ... */
theKernel();
}
uboot版本:uboot 1.3.1(st已做过修改)
st平台的内存首地址是0x80000000,此地址不是固定的,不同类型的芯片是不同的,比如samsung的arm920t是0x30000000。uboot提供两种工作模式:一是启动加载模式(start loading),一是下载模式(downloading)。工作在启动加载模式时,uboot会自动执行bootcmd命令,比如:bootcmd=“nand read 0x100000 0x80000000 0x300000; bootm 0x80000000”
1、uboot首先把内核镜像拷贝到内存地址为0x80000000的地方,然后执行bootm 0x80000000命令
bootm命令来自 common/cmd_bootm.c文件,完成的功能有》CRC校验image head struct的64个字节的正确性
》根据镜像头中指定的压缩类型(比如gzip),把kernel解压到指定的位置hdr->ih_load(0x80800000)
》调用来自lib_sh/sh_linux.c中的函数do_bootm_linux( . . . ),启动内核
2、接下来,分析do_bootm_linux函数的执行流程
传给kernel的命令行参数地址是宏定义 #define COMMAND_LINE ((char *)(param+0x100))do_bootm_linux
{
》从参数去中获取环境变量bootargs的值
char *commandline = getenv("bootargs");
》从image head struct中获取kernel的入口地址
void (*theKernel)(void); // 函数指针
theKernel = (void (*) (void)) ntohl (hdr->ih_ep);
》从image head struct中获取kernel的指定存储参数的地址
ulong param;
param = ntohl (hdr->ih_load);
》把commandline拷贝到约定好的COMMAND_LINE地址
strcpy (COMMAND_LINE, commandline);
》最后,执行kernel的入口函数,把控制权交给kernel
/* now, finally, we pass control to the kernel itself ... */
theKernel();
}
3、uboot加载kernel后内存使用情况
相关文章推荐
- uboot参数区中的bootargs如何传给内核
- 如何修改bootargs参数使u-boot从网络引导内核
- uboot如何向内核传递参数
- 如何修改bootargs参数使u-boot从网络引导内核
- UBOOT之源码分析——向内核传送参数过程分析
- 分析uboot是如何启动内核的
- 分析uboot是如何启动内核的 .
- uboot如何启动内核?
- 分析uboot是如何启动内核的
- linux2.6内核,如何指定内核启动参数
- U-Boot如何为内核设置启动参数(转)
- 分析uboot是如何启动内核的
- uboot内核参数的传递与内核解析uboot传递的内核参数
- 如何在Linux上通过grub添加内核参数
- uboot启动参数设置和内核引导方法总结
- U-Boot如何为内核设置启动参数--转帖
- 内核查看uboot传递的参数简单方法
- 如何实现uboot和linux之间的参数传递
- bootargs--内核启动参数介绍
- start kernel 之后没有任何输出与uboot无法将bootargs传入内核的调查方法与解决之道