Chinaunix首页 | 论坛 | 博客
  • 博客访问: 924068
  • 博文数量: 63
  • 博客积分: 568
  • 博客等级: 中士
  • 技术积分: 3435
  • 用 户 组: 普通用户
  • 注册时间: 2012-10-05 11:44
文章分类
文章存档

2016年(4)

2015年(6)

2014年(3)

2013年(27)

2012年(23)

分类: 嵌入式

2015-11-07 12:40:34

之前遇到的比较简单的处理器比如一些ARM9和MIPS处理器启动过程都是SOC中内置了一段ROM,ROM在CPU启动时会做相应的初始化,并读取SPI Flash或者NAND Flash的前一个block,这个block包含uboot的第一阶段。之后跳转到uboot中执行uboot的启动过程。

树莓派没有Flash片子,直接从SD卡启动,并且SD卡被格式成了文件系统,kernel都放在了文件系统上,启动过程是如何的呢?从google上找到一篇介绍树莓派启动过程的文章,
  1. When the Raspberry Pi is first turned on, the ARM core is off, and the GPU core is on. At this point the SDRAM is disabled.
  2. The GPU starts executing the first stage bootloader, which is stored in ROM on the SoC. The first stage bootloader reads the SD card, and loads the second stage bootloader (bootcode.bin) into the L2 cache, and runs it.
  3. bootcode.bin enables SDRAM, and reads the third stage bootloader (loader.bin) from the SD card into RAM, and runs it.
  4. loader.bin reads the GPU firmware (start.elf).
  5. start.elf reads config.txt, cmdline.txt and kernel.img

loader.bin doesn't do much. It can handle .elf files, and so is needed to load start.elf at the top of memory (ARM uses SDRAM from address zero). There is a plan to add elf loading support to bootcode.bin, which would make loader.bin unnecessary, but it's a low priority (I guess it might save you 100ms on boot).


大致流程是
GPU启动,执行ROM        -------->      bootcode.bin 初始化SDRAM, 读取SD中loader.bin 到SDRAM ------->loader.bin 读取start.elf
(load bootcode.bin into L2 cache)

基本上start.elf才是最后load kernel的代码部分。

loader.bin其实做的事情不多,但是它能够解析elf文件结构,如果把这部分功能集成到bootcode.bin中,loader.bin的这个步骤就可以省略了。

阅读(2641) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~