TI OMAP Bootloader Project 关于启动过程

以下wiki详细讲解了启动过程

http://omappedia.org/wiki/Bootloader_Project


http://omappedia.org/wiki/OMAP3_U-Boot_TODO



Bootloader Project

Contents

  [hide]
  • 1 OMAP U-boot
  • 2 OMAP Boot Sequence
    • 2.1 First Stage Boot
    • 2.2 Second Stage Boot
  • 3 Bootloader Overview
    • 3.1 Accessing Uboot source
    • 3.2 Building Uboot
    • 3.3 U-boot config files
    • 3.4 Accessing X-loader source
    • 3.5 Building Xloader for GP
    • 3.6 X-loader config files
    • 3.7 Building Xloader for EMU
  • 4 Flashing
  • 5 Upstreaming U-boot

[edit]OMAP U-boot

Das U-Boot is the bootloader typically used on OMAP development platform.

X-Loader is a tiny first stage minimal bootloader which loads up u-boot as explained by this wiki.

Developer Reference: OMAP3 U-Boot TODO things for mainline U-boot Support.

[edit]OMAP Boot Sequence

The OMAP processor follows a 2 stage boot process. The first stage is loaded into the internal static RAM by the ROM code. Because the internal static RAM is very small (64k), the first stage loader is needed to initialize memory and enough of the peripheral devices to access and load the second stage loader into main memory. It is the job of the second stage loader to initialize the remaining hardware and prepare the system for kernel boot.(detail documentation available from TI, see the Initialization chapter of the Technical Documents/OMAP34xx on this page)


[edit]First Stage Boot

The internal ROM Code will attempt to boot from several different peripherals including but not limited to: Serial(UART3), SD Card(MMC1 and MMC2), Nand and USB. The order in which the peripherals are attempted is determine by a set of GPIO configuration pins referred to as SYS_BOOT. The default SYS_BOOT configuration for the Zoom2 appears to be: USB, Serial(UART3), SD Card(MM1), and NAND flash.

The documentation of SYS_BOOT can be found on TI website -- Technical Documents/OMAP34xx Multimedia Device.

The 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

Or use this tool: omap34xx-boot-order

TI OMAP Bootloader Project 关于启动过程_第1张图片


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 sram if no errors are detected. UART3 is the only uart for which the ROM will attempt to load from.

SD Card Boot

Assuming there was no answer from the host during serial boot, 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"(x-load binary with a header containing the memory location to load the file 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 Boot

Assuming the SD Card boot was unable to complete successfully, 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.

[edit]Second Stage Boot

The second stage of the boot is done by the x-loader installed from the first stage. There are different versions of the x-loader corresponding to each of the devices that can be loaded from. It is the job of the x-loader to transfer the 2nd stage loader into main memory. Usually you will use the x-loader that corresponds to the type of boot you are attempting - i.e. you would use the serial x-loader for a serial boot and the nand x-loader for a nand boot. However, you don't have to. For example, you could flash the serial x-loader into the nand. The rom will load from nand and transfer control to the x-loader which will wait for the 2nd stage to be downloaded from the serial port.

Serial Boot

The serial 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.


TI OMAP Bootloader Project 关于启动过程_第2张图片

SD Card Boot

The SDCard 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.


TI OMAP Bootloader Project 关于启动过程_第3张图片


NAND Boot

The nand x-loader expects u-boot to be loaded at the 5th sector (offset 0x00800000). It transfers the image from nand into main memory and transfers control to it.


TI OMAP Bootloader Project 关于启动过程_第4张图片

[edit]Bootloader Overview

Bootloader project contains information regarding the building and flashing procedures for uboot and xloader. These two items are necessary to bring up the zoom2's environment.

Why two bootloaders? The first bootloader, x-loader, is a stripped down version of u-boot designed to run in the on-chip sram of the zoom2. 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. The following steps will build the bootloaders:


  • Ensure that "git" has been installed within the host system. Git is available for download at git-scm.com. For more details on installing and using git please see this wiki page.
  • Ensure that CodeSourcery ARM Compiler has been installed in the host system. Visit Support_Tools/Cross_Compilers for further information.


[edit]Accessing Uboot source

  • Clone Uboot
# mkdir bootloader
# cd bootloader
# git clone git://git.omapzoom.org/repo/u-boot.git

[edit]Building Uboot

# cd <path_to_u-boot>
# make distclean
# make CROSS_COMPILE=arm-none-linux-gnueabi- omap3430zoom2_config
# make CROSS_COMPILE=arm-none-linux-gnueabi-

Note: If you get "cmd_voltage.c:27: error: inline function 'voltage_info' cannot be declared weak" try an older GCC (CSL 2008q3-72 seems ok) Note: Step above is building for a Zoom2. To build for other boards use respective config from the below table.

U-boot config files

Board config file
4460SDP omap4430sdp_config
4430SDP omap4430sdp_config
3430SDP omap3430sdp_config
3630SDP omap3630sdp_config
3430LDP omap3430labrador_config
Zoom2 omap3430zoom2_config
Zoom3 omap3630zoom3_config
2430sdp omap2430sdp_config
2420h4 omap2420h4_config


  • u-boot.bin is located in <path_to_u-boot>

[edit]Accessing X-loader source

  • Clone X-loader master for OMAP3
# cd bootloader
# git clone  git://git.omapzoom.org/repo/x-loader.git 
  • X-loader for OMAP44xx
# cd bootloader/x-load
# git checkout --track -b omap4_dev origin/omap4_dev
# git pull {to be on latest commit ID } 

[edit]Building Xloader for GP

Warning: u-boot needs to be built before x-loader.

# cd <path_to_x-boot>
# make distclean
# make CROSS_COMPILE=arm-none-linux-gnueabi- omap3430zoom2_config
# make CROSS_COMPILE=arm-none-linux-gnueabi- ift
* Build x-loader for OMAP4460
# cd <path_to_x-boot>
# make sure you are on omap4_dev branch
# make distclean
# make CROSS_COMPILE=arm-none-linux-gnueabi- omap4460sdp_config
# make CROSS_COMPILE=arm-none-linux-gnueabi- ift

Note: Step above is building for Zoom2 and for Zoom1(LDP). For other boards use respective config file from below tables

X-loader config files

Board config file
4460SDP omap4460sdp_config
4430SDP 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, use "omap3430labradordownload_config"

  • MLO is located in <path_to_x-loader>

[edit]Building Xloader for EMU

Warning: Build x-load.bin using correct config file for 4430/4460 .

Warning: Download mshield-dk lite .

  • create x-load.bin for OMAP44xx <same procedure for GP/EMU/HS>
  • For OMAP4430 ES2.0 EMU/HS
# cd mshield-dk-root-folder
# ./generate_MLO OMAP4430 ES2.0 x-load.bin
# MLO will be located in root mshield-dk folder
  • For OMAP4430 ES2.1 EMU/HS
# cd mshield-dk-root-folder
# ./generate_MLO OMAP4430 ES2.1 x-load.bin
# MLO will be located in root mshield-dk folder
  • For OMAP4430 ES2.2 EMU/HS
# cd mshield-dk-root-folder
# ./generate_MLO OMAP4430 ES2.2 x-load.bin
# MLO will be located in root mshield-dk folder
  • For OMAP4430 ES2.3 EMU/HS
# cd mshield-dk-root-folder
# ./generate_MLO OMAP4430 ES2.3 x-load.bin
# MLO will be located in root mshield-dk folder
  • For OMAP4460 ES1.0 EMU/HS
# cd mshield-dk-root-folder
# ./generate_MLO OMAP4460 ES1.0 x-load.bin
# MLO will be located in root mshield-dk folder

[edit]Flashing

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 Uimage-flasher which is a combination of uImage+initramfs along with g_file_storage.ko. This solution lets the PandaBoard export its SD card over the USB.

[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


你可能感兴趣的:(TI OMAP Bootloader Project 关于启动过程)