原文地址 : http://omappedia.org/wiki/Bootloader_Project
The internal ROM Code can attempt to boot from several different peripheral and memory devices, including, but not limited to: Serial (UART3), SD Card, eMMC, NAND, and USB. The order in which these devices are searched for a valid first-stage booting image (x-loader) is determine by a set of GPIO configuration pins referred to as SYSBOOT. The TRM includes a table that shows the booting device list that each combination of the SYSBOOT pins refers to.
The SYSBOOT value can be read from physical address 0x480022f0, either using JTAG, or if you have linux running, use devmem2:
固化在芯片的程序可以从多种介质上启动,配置SYSBOOT Pins修改启动顺序。For example, the SYSBOOT pins could be set such that booting device list consists of 1) serial (UART3), 2) SD card (MMC1), and 3) NAND flash. In this case, the ROM code would first look for a valid x-loader over the serial port, then in the SD card, then in the NAND flash. Whenever it finds a valid x-loader, it proceeds with execution of that binary.
Serial Boot
For serial boot, a simple ID is written out of the serial port. If the host responds correctly within a short window of time, the ROM will read from the serial port and transfer the data to the internal SRAM. Control is passed to the start of SDRAM if no errors are detected. UART3 is the only uart for which the ROM will attempt to load from.
SD Card Boot
If MMC is included in the booting device list, the ROM looks for an SD Card on the first MMC controller. If a card is found, the ROM then looks for the first FAT32 partition within the partition table. Once the partition is found, the root directory is scanned for a special signed file called "MLO" (which is the x-loader binary with a header containing the memory location to load the file to and the size of the file). Assuming all is well with the file, it is transfered into the internal SRAM and control is passed to it. Both MMC1 and MMC2 can be used for booting.
如果MMC在启动设备列表中,ROM 通过1号MMC控制器寻找SD卡,如何识别到SD卡,在SD卡的第一个FAT32分区上寻租MLO文件,如果MLO文件存在,将其复制到内部SRAM中并启动MLO程序。
NAND / eMMC Boot
If NAND is included in the booting device list, the ROM attempts to load the first sector of NAND. If the sector is bad, corrupt, or blank, the ROM will try the next sector (up to 4) before exiting. Once a good sector is found, the ROM transfers the contents to SRAM and transfers control to it. (The same steps are performed for eMMC if eMMC is included in the booting device list instead of NAND.)
x-loader是一个运行在内部SRAM的程序,它负责外部pin、DDR、串口等设备的初始化,并将二级引导程序(例如u boot)复制到DDR中执行。
U boot是二级引导程序,它运行在主CPU(CPU ID 为0)上,从CPU(CPU ID 为1)被挂起。
编译x-loader 和 U boot
http://omappedia.org/wiki/Android_Panda_Build_Source#Building_the_kernel_from_source
git clone git://git.linaro.org/boot/u-boot-linaro-stable.git
cd u-boot-linaro-stable.git
make CROSS_COMPILE=arm-none-linux-gnueabi- omap4_panda
# Replace the CROSS_COMPILE with the name of your compiler
After the compile is done you should see two files named MLO and u-boot.img. u-boot.img is same as u-boot.bin with some header information. Copy the MLO file as MLO in the boot partition of the SD and copy the u-boot.img as u-boot.bin in the boot partition of the SD card.
(将MLO u-boot.bin复制到SD 的第一个FAT32分区,我的pandaboard是 Pandaboard ES Rev B1,使用上诉方法可以正常引导linux kernel)