Bootloader Project





From OMAPpedia





Jump to: navigation, search



Contents

[hide]

1 OMAP Bootloader Overview


2 OMAP Boot Sequence


2.1 SYSBOOT Pins


2.2 First Stage Boot


2.3 Second Stage Boot


3 x-loader overview


4 u-boot overview


5 Building the Bootloaders


5.1 u-boot


5.1.1 Downloading u-boot source


5.1.2 Building u-boot


5.1.3 u-boot config files


5.2 x-loader


5.2.1 Accessing x-loader source


5.2.2 Building x-loader


5.2.3 x-loader config files


6 Flashing


7 Upstreaming U-boot

[edit] OMAP Bootloader Overview

There are several stages of bootloaders that perform different levels of initialization on an OMAP platform, in order to eventually load and run the filesystem. This figure shows the booting sequence of the ROM code, x-loader, u-boot,
and kernel, with each stage performing enough configuration in order to load and execute the next.

The Bootloader Project covers specifically the x-loader and the u-boot: a code overview, and how to obtain and build the code.

Why are there two bootloaders? The first bootloader, x-loader, is a stripped-down version of the u-boot, designed to run in OMAP's small on-chip SRAM. It initializes the main off-chip memory of the system and other necessary device
drivers, and then loads the larger bootloader for Linux, u-boot.

[edit] OMAP Boot Sequence

Detailed documentation on the OMAP boot sequence is available in the OMAP TRM, Initialization chapter. The TRMs for multiple OMAP platforms (OMAP4430, OMAP4460, OMAP34xx, etc) are available here:
http://www.ti.com/general/docs/wtbu/wtbudocumentcenter.tsp?templateId=6123&navigationId=12037

[edit] SYSBOOT Pins

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:

# devmem2 0x480022f0 b                             /dev/mem opened.  Memory mapped at address 0x40020000.  Value at address 0x480022F0 (0x400202f0): 0x2F  

For OMAP34xx, there is also a tool to show the boot order:
omap34xx-boot-order

[edit] First Stage Boot

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.

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.)

[edit] Second Stage Boot

It is the job of the x-loader to transfer the 2nd stage loader into main memory, which we call the u-boot. Typically both the x-loader and u-boot come from the same storage medium. For example, typically if the x-loader is transferred
via USB, the u-boot will also be transferred via USB, and if the x-loader is transferred via SD card, the u-boot will also be transferred via SD card. However, this is not required. For example, you could flash the serial x-loader into the NAND. The ROM code
will load the x-loader from NAND and transfer control to the x-loader, which will wait for the u-boot to be downloaded from the serial port.

Serial Boot

In the case of loading both the u-boot over the serial port, the x-loader waits for the host to initiate a kermit connection to reliably transfer large files into main memory. Once the file transfer is completed successfully, control
is transfered.

SD Card Boot

In the case of loading the u-boot via the SD card, the SD card x-loader looks for a FAT32 partition on the first MMC controller and scans the top level directory for a file named "u-boot.bin". It then transfers the file into main
memory and transfers control to it.

NAND / eMMC Boot

In the case of a u-boot stored in NAND, the x-loader expects the u-boot to be located at the 5th sector (offset 0x00800000). It transfers the image from NAND into main memory and transfers control to it. In the case of a u-boot stored
in eMMC, the x-loader expects the u-boot to be located at the offset 0x200.

[edit] x-loader overview

The x-loader is a small first stage bootloader derived from the u-boot base code. It is loaded into the internal static RAM by the OMAP ROM code. Due to the small size of the internal static RAM, the x-loader is stripped down to the
essentials. The x-loader configures the pin muxing, clocks, DDR, and serial console, so that it can access and load the second stage bootloader (u-boot) into the DDR. This figure shows the code flow in the x-loader, beginning in start.S.

[edit] u-boot overview

The u-boot is a second stage bootloader that is loaded by the x-loader into DDR. It comes from
Das U-Boot. The u-boot can perform CPU dependent and board dependent initialization and configuration not done in the x-loader. The u-boot also includes fastboot functionality for partitioning
and flashing the eMMC. The u-boot runs on the Master CPU (CPU ID 0), which is responsible for the initialization and booting; at the same time, the Slave CPU (CPU ID 1) is held in the “wait for event” state. This figure shows the code flow in the u-boot, beginning
in start.S.

[edit] Building the Bootloaders

The following steps will build the x-loader and u-boot.

Note: In order to build the x-loader or u-boot, it is recommended that you use the omappedia Release Notes page corresponding to the platform you are using (Blaze, Blaze Tablet, Panda, or Zoom) and follow the instructions for that
release: http://www.omappedia.com/wiki/Release_Notes In general, the instructions will be very similar with the following exceptions:

The commit ID used to pull the code from the u-boot and x-loader git trees varies based on the release. It is recommended that you use the correct commit ID corresponding to your release, as this is how the validation is performed.


The config file used to setup the configuration when building the u-boot and x-loader varies based on the platform you are using. See the tables below.

Also, ensure that you have installed the pre-requisite packages for building the bootloaders, namely Git and the CodeSourcery ARM Compiler. These instructions are included in the omappedia Release Notes corresponding to your release.
You can also find the information here:

Git is available for download at git-scm.com. For more details on installing and using git please see this wiki page.

For the CodeSourcery ARM Compiler, visit Support_Tools/Cross_Compilers for further information.

[edit] u-boot

[edit] Downloading u-boot source

Clone the u-boot git tree and checkout the source code corresponding to this release:

# mkdir u-boot  # cd u-boot  # git clone git://git.omapzoom.org/repo/u-boot.git  # git checkout <<commit_ID_for_uboot_in_this_release>>  

[edit] Building u-boot

Make the u-boot source code using the correct config file depending on your platform:

# cd u-boot  # make distclean  # make CROSS_COMPILE=arm-none-linux-gnueabi- <<config_file_depending_on_your_platform>>  # make CROSS_COMPILE=arm-none-linux-gnueabi-  

u-boot config files

Board config file
44xx Blaze Tablet omap44XXtablet_config
44xx Blaze omap4430sdp_config
3430SDP omap3430sdp_config
3630SDP omap3630sdp_config
3430LDP omap3430labrador_config
Zoom2 omap3430zoom2_config
Zoom3 omap3630zoom3_config
2430sdp omap2430sdp_config
2420h4 omap2420h4_config

The resulting u-boot.bin is located in the top-level of your u-boot directory.

[edit] x-loader

[edit] Accessing x-loader source

Clone the x-loader git tree and checkout the source code corresponding to this release:

# cd x-loader  # git clone  git://git.omapzoom.org/repo/x-loader.git   # git checkout <<commit_ID_for_xloader_in_this_release>>  

[edit] Building x-loader

Make the x-loader source code using the correct config file depending on your platform:

# cd x-loader  # make distclean  # make CROSS_COMPILE=arm-none-linux-gnueabi- <<config_file_depending_on_your_platform>>  # make CROSS_COMPILE=arm-none-linux-gnueabi- ift  

x-loader config files

Board config file
44xx Blaze Tablet omap44XXtablet_config
44xx Blaze omap4430sdp_config
3430SDP omap3430sdp_config
3630SDP omap3630sdp_config
3630SDP 1GB omap3630sdp_1G_config
3430LDP omap3430labrador_config
Zoom2 omap3430zoom2_config
Zoom3 omap3630zoom3_config
2430sdp omap2430sdp_config
2420h4 omap2420h4_config

To build x-loader to boot over a serial connection for OMAP3, use "omap3430labradordownload_config"

The resulting MLO is located in the top-level of your x-loader directory.

Note: If you are using an HS (High Security) OMAP device, an extra step is required. First, build x-load.bin using the steps above. Then, download the MShield signing tool and use the commands below. Contact your TI representative
to get access to this tool.

# cd mshield-dk-root-folder  # ./generate_MLO <<OMAP type>> x-load.bin  

For example, for an ES2.3 OMAP4430 device, use the command:

# ./generate_MLO OMAP4430 ES2.3 x-load.bin  

The resulting MLO is located in the top-level of your mshield-dk directory.

[edit] Flashing

Refer to Android_Fastboot to review flashing methods for Blaze and Blaze Tablet using Fastboot.

Refer to Zoom Flashing to review flashing methods for Zoom1/Zoom2/Zoom3.

Refer to 3630SDP Flashing to review flashing methods for 3630SDP board.

Refer to eMMC Boot to review flashing and boot methods from eMMC device.

Refer to [[1]] for a USB downloader for PandaBoard.

[edit] Upstreaming U-boot

U-boot upstreaming is being carried out as a separate project. Please refer to the following link for more details.

U-boot Upstreaming Project

Bootloader Project的更多相关文章

  1. QEMU 模拟运行 VxWorks 6.6

    QEMU 模拟运行 VxWorks 6.6 项目简介 本项目是在 Windows 系统编译运行 X86 平台 VxWorks 6.6 系统,使用的模拟软件是 qemu for Windows Host ...

  2. make 实例 二 V56

    ######################################################################### # # Makefile used for buil ...

  3. make 实例 一 3463

    ######################################################################### # # Makefile used for buil ...

  4. 嵌入式Linux系统Bootloader启动调试技术(回想)

    嵌入式系统搭建过程中,对于系统平台搭建project师最初的一步一般是移植Bootloader ,当然移植有几个级别,通常最常见的是參考的EVM 的硬件有了改动(如更改了FLASH ,更改了SDRAM ...

  5. 智能家居项目(2):项目project框架的搭建

    项目管理器: Linux中的项目管理器"make"有些类似于windows中的Visual C++里的"project",它是一种控制编译或者反复编译软件的工具 ...

  6. AVR之BOOTLOADER技术详解(转)

    源:http://blog.csdn.net/zhenhua10/article/details/6442412 ATmega128具备引导加载支持的用户程序自编程功能(In-System Progr ...

  7. 豹哥嵌入式讲堂:ARM开发之文件详解(3)- project文件

    大家好,我是豹哥,猎豹的豹,犀利哥的哥.今天豹哥给大家讲的是嵌入式开发里的project文件. 前面两节课里,豹哥分别给大家介绍了嵌入式开发中的两种典型input文件:source文件.linker文 ...

  8. 高通平台的bootloader过程【转】

    ====================基本知识=======================LK是(L)ittle (K)ernel的缩写.高通平台android普遍采用LK作为其bootloade ...

  9. [国嵌笔记][028][Bootloader设计蓝图]

    Bootloader的作用就是启动Linux内核 U-Boot简介 1.U-Boot是用于多种嵌入式CPU(ARM.x86.MIPS等)的bootloader程序,U-Boot不仅支持嵌入式Linux ...

随机推荐

  1. 【转】How to append current date and timestamp to filename in shell script

    $ date +"FORMAT" now=$(date +"%Y-%m-%d-%S") filename="my_program.$now.log&q ...

  2. python 编写简单的setup.py

    学习python也已经有一段时间了,发现python作为脚本语言一个很重要的特点就是简单易用,而且拥有巨多的第三方库,几乎方方面面的库都有,无论你处于哪个行业,想做什么工作,几乎都能找到对应的第三方库 ...

  3. 用ASOS建立自定义的OpenID 服务(一)-----------简介

    翻译文章 原文地址 这一系列共包括9个部分,这是第一部分,下面是英文原文地址: Introduction Choosing the right flow(s) Registering the midd ...

  4. Storm 对 0.10.x 版 Kafka之commit offsets

    由于 0.10.x 版 Kafka 与 0.8.x 版有很大的变化,这种变化对下游 Storm 有非常大的影响,0.10.x 版的 Kafka 不但增加了权限管理的功能,而且还将 simple 和 h ...

  5. 所不为人知的Python装饰器

    装饰器可以说是Python中非常重要的特性之一.有些人要么从没使用过装饰器,要么就是对装饰器的使用一知半解.也有些人觉得装饰器很简单:"装饰器不就是那些把函数作为参数并输出一个函数的函数&q ...

  6. BZOJ 2754: [SCOI2012]喵星球上的点名 [后缀数组+暴力]

    2754: [SCOI2012]喵星球上的点名 Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 1906  Solved: 839[Submit][St ...

  7. BZOJ 1845: [Cqoi2005] 三角形面积并 [计算几何 扫描线]

    1845: [Cqoi2005] 三角形面积并 Time Limit: 3 Sec  Memory Limit: 64 MBSubmit: 1151  Solved: 313[Submit][Stat ...

  8. 前端系列之JavaScript基础知识概述

    ​微信公众号:compassblog 欢迎关注,欢迎转发,互相学习,共同进步! 有任何问题,请后台留言联系! 1.什么是JavaScript (1).JavaScript是web上一种功能强大的编程语 ...

  9. char数组中除去某个元素

    /* 本程序说明: char数组中除去某个元素(其实就是strcpy源码的变形) */ #include <iostream> #include <cassert> #incl ...

  10. [Python Study Notes]文件操作

    文件操作 对文件操作流程 打开文件,可添加filepath打开某绝对路径下的文件,得到文件句柄并赋值给一个变量 通过句柄对文件进行操作 关闭文件 # The_author = 'liu66' # -* ...