找到链接脚本:
-T u-boot.lds 链接脚本
-Text 0xce300000 链接地址
u-boot.lds
OUTPUT_FROMAT(“elf32-littearm”,”elf32-littearm”,”elf32-littearm”);
入口文件:
cpu/s5pv210/start.S
u-boot第一阶段:
bl lowlevel_init.S文件
//定义在lowevle_init.S文件
u-boot_CW210_1.3.4/board/CONCENWIT/CW210
uboot常用命令:
1,打印环境变量
printenv
print
2,设置环境变量
setenv
tarena# setenv bootdelay 10
tarena#set env bootcmd tftp 0x20008000 zImage\;bootm 0x20008000
3,保存环境变量
saveenv
save
tarena# saveenv
4,tftp
tarena#tftp 0x20008000 shell.bin
5,go:执行指定内存地址的二进制代码
tarena#go 0x20008000
6,bootm:用来启动指定内存地址的内核镜像的命令
7,Nand Flash命令
1,擦除 Nand Flash
tarena# nand erase
2,写Nand Flash
tarena#tftp 0x20008000 zImage
tarena# nand write 0x20008000 0x500000 0x500000
将0x20008000地址的内核文件写到Nand Flash从5M开始,写5M
3,读Nand Flash
tarena#setenv nand|read 0x20008000 0x500000 0x500000
tarena#save
从Nand flash的5M开始读,读5M到内存的0x20008000,执行0x20008000处的内核文件
8,reset 重新启动系统
u-boot命令的实现:
1,在source insght 工程中搜索:U_BOOT_CMD
_attribute是GNU C对标C的语法扩展,也是GNUC 的一大特色,可以用于设置函数的属性,变量的属性,类型的属性。
表示将结构体表示放到指定的段;此宏用于修饰命令,通过该属性关键字的修饰,链接器会把该命令结构体放到 .u_boot_cmd这个段中,以便用于命令的查找。unused用于消除警告;
cmd_tbl_t *find_cmd (const char *cmd) 函数中
//下边的for循环就是在命令结构体存储区中,从前到后依次查找是否有匹配的命令
for (cmdtp = &__u_boot_cmd_start;cmdtp != &__u_boot_cmd_end;cmdtp++) {
....
}
bootm 0x20008000
bootm -> do_bottom函数 -> do_bottom_linux ->函数 ->
theKernel(0,2456,0x20000100);
2456:开发板的ID号
0x20000100:uboot传给内核的启动参数的地址
u-boot启动过程:
1,start.S -> 在IRAM中执行
2,lowlevel_init.S -> (底层硬件初始化,移植时应该重点关注)
关闭看门狗
初始化系统时钟
初始化UART
初始化Nand flash
3,回到start.S ->
将整个uboot从Nand flash拷贝到SDRAM中
设置MMU,并开启MMU
建栈
清BSS
ldr pc,__start_armboot绝对跳转到SDRAM继续执行
4,start_armboot函数执行 (与底层硬件有关,移植时应该重点关注)
board_init(DM9000网卡初始化,2456,0x20000100)
dram_init(初始化TPAD的外接物理内存的地址信息)
…..
5,main_loop函数
在bootdelay秒内:
有键盘输入,进入tarena#输入命令,执行命令
无键盘输入,进入自启动模式,获取环境变量
tftp 0x20008000 zImage\;bootm 0x20008000
6,执行bootm命令执行
do_bootm函数
do_bootm_linux函数
theKernel(0,2456,0x20000100);
实现内核的启动。
配置:
make CW210_config
编译:
make
u-boot(ELF)
u-boot.bin

3175

被折叠的 条评论
为什么被折叠?



