U-BOOT之ReadMe
U-boot是基于PowerPC, ARM, MIPS等多种处理器上的bootloader,可以安装在boot ROM中,用于初始化或者测试硬件,或者用于装载和运行应用程序。
where we come from
- start from 8xxrom sources
- create PPCBoot project (http://sourceforge.net/projects/ppcboot)
- clean up code
- make it easier to add custom boards
- make it possibile to add other [PowerPC] CPUs
- extend functions, especially:
* Provide extended interface to Linux boot loader
* S-Record download
* network boot
* PCMCIA / CompactFlash / ATA disk /SCSI … boot
-
create ARMBoot project (http://sourceforge.net/projects/armboot)
-
add other CPU families(starting with ARM)
-
create U-Boot project (http://sourceforge.net/projects/u-boot)
Names and Spelling:
文件名以u-boot为开头,例如
#include <asm/u-boot.h>
#include <asm-ppc/u-boot.h>
变量名,预编译常数等都以u_boot或者U_BOOT开头,例如
U_BOOT_VERSION u_boot_logo
IH_OS_U_BOOT u_boot_hush_start
Versioning:
U-Boot
版本信息由
version, sub-version
和
patchlevel
组成。例如
”U-Boot-2.34.5”
表示
version “2”, sub-version “34”,
和
patchlevel “4”.
对于正式的发布版本来说,
patchlevel
总为“
0”
.
Directory Hierarchy:
- board Board dependent files
- common Misc architecture independent functions
- cpu CPU specific files
- 74xx_7xx Files specific to Freescale MPC74xx and 7xx CPUs
- arm720t Files specific to ARM 720 CPUs
- arm920t Files specific to ARM 920 CPUs
- at91rm9200 Files specific to Atmel AT91RM9200 CPU
- imx Files specific to Freescale MC9328 i.MX CPUs
- s3c24x0 Files specific to Samsung S3C24X0 CPUs
- arm925t Files specific to ARM 925 CPUs
- arm926ejs Files specific to ARM 926 CPUs
- arm1136 Files specific to ARM 1136 CPUs
- i386 Files specific to i386 CPUs
- ixp Files specific to Intel Xscale IXP CPUs
- mcf52x2 Files specific to Freescale ColdFire MCF52x2 CPUs
- mips Files specific to MIPS CPUs
- mpc5xx Files specific to Freescale MPC5xx CPUs
- mpc5xxx Files specific to Freescale MPC5xxx CPUs
- mpc8xx Files specific to Freescale MPC8xx CPUs
- mpc8220 Files specific to Freescale MPC8220 CPUs
- mpc824x Files specific to Freescale MPC824x CPUs
- mpc8260 Files specific to Freescale MPC8260 CPUs
- nios Files specific to Altera NIOS CPUs
- nios2 Files specific to Altera Nios-II CPUs
- ppc4xx Files specific to AMCC PowerPC 4xx CPUs
- pxa Files specific to Intel Xscale PXA CPUs
- s3c4bb0 Files specific to Samsung S3C44B0 CPUs
- sa1100 Files specific to Intel StrongARM SA1100 CPUs
- disk Code for disk drive partition handling
- doc Documentation
-
drivers Commonly used device drivers
-
dtt Digital Thermometer and Thermostat drivers
-
examples Example code for standalone applications, etc
-
include Header Files
-
lib_arm File generic to ARM architecture
-
lib_generic File generic to all architecture
-
lib_i386 File generic to i386 architecture
- lib_m68k File generic to m68k architecture
- lib_mips File generic to MIPS architecture
- lib_nios File generic to NIOS architecture
- lib_ppc File generic to PowerPC architecture
- net Networking code
- post Power On Self Test
- rtc Real Time Clock drivers
- tools Tools to build S-Record or U-Boot images, etc
Software Configuration:
Configuration _OPTIONS_:
由用户指定,以
CONFIG_
开头
Configuration_SETTINGS_:
跟具体硬件相关,以
CFG_
对于已经支持的
board
,已有默认的
configuration,
故需要直接
make
即可,
make
<board_name>_config.
Example:
cd u-boot
make TQM82L_config
对于
Cogent platform
,则需要
make cogent_mpc8xx_config.
Configuration Options:
Configuration
取决于
board
和
CPU
类型,其信息在
include/configs/<board_name>.h
中,例如
include/configs/TQM823L.h
需要指定如下:
- CPU Types:
例如
CONFIG_MPC860
- Board Type:
例如
CONFIG_PCIPPC2
-
CPU Module Type:(
如果定义了
CONFIG_COGENT),
例如
CONFIG_CMA286_60_OLD
-
Motherboard Type:(
如果定义了
CONFIG_COGENT)
例如
CONFIG_CMA101
-
Motherboard I/O Modules: (
如果定义了
CONFIG_COGENT),
例如
CONGIG_
CMA302
-
Board flavour
-
MPC824x Family Member
-
8xx CPU options
-
859/866/865 CPU options
-
Linux Kernel Interface:
-
Serial Ports
-
Console Interface
-
Console Baudrate
-
Interrupt driven serial port input
-
Console UART Number
-
Boot Delay
-
Autoboot Command
-
Pre-Boot Commands
-
Serial Download Echo Mode
-
Kgdb Serial Baudrate
-
Monitor Functions
-
Watchdog
-
U-Boot Version
-
Real-Time Clock
-
Timestamp Support
-
Partition Support
-
IDE Reset method
-
ATAPI support
-
LBA48 support
-
SCSI support
-
NETWORK support(PCI and others)
-
USB support
-
MMC support
-
Journaling Flash filesystem support
-
Keyboard support
-
Video support
-
Keyboard support
-
LCD support
-
Splash Screen Support
-
Gzip compressed BMP image support
-
Compression support
-
MII/PHY support
-
Ethernet address
-
IP address
-
Server IP address
-
Boot Recovery mode
-
DHCP Advanded options
-
CDP options
-
Status LED
-
CAN support
-
I2C support
-
SPI support
-
FPGA support
-
Configuration management
-
Vendor Parameter protection
-
Protected RAM
-
Error Recovery
-
Command Interpreter
-
Default Environment
-
DataFlash Support
-
SystemACE Support
-
TFTP Fixed UDP Port
-
Show boot progress
Modem Support:
-
Modem support enable: CONFIG_MODEM_SUPPORT
-
RTS/CTS Flow control enable: CONFIG_HWFLOW
-
Modem debug support
-
Interrupt support(PPC): interrupt_init()
和
timer_interrupt()
对于所有
PPC
结构来说都是通用的。其中,
interrupt_init()
调用
interrupt_init_cpu()
对特定
CPU
进行初始化。在
interrupt_init_cpu()
中,应设定合适的
decrement_count
值。
timer_interrupt()
调用
timer_interrupt_cpu()
处理特定的
CPU
定时。如果板上有
watchdog/status_led
等,在
timer_interrupt()
后有效。
-
General
Configuration Settings:
-
CFG_LONGHELP
-
CFG_PROMPT
-
CFG_CBSIZE
-
CFG_PBSIZE
-
CFG_MAXARGS
-
CFG_BARGSIZE
-
CFG_BAUDRATE_TABLE
-
CFG_CONSOLE_INFO_QUITE
-
CFG_CONSOLE_IS_IN_ENV
-
CFG_CONSOLE_ENV_OVERWRITE
-
CFG_MEMTEST_START, CFG_MEMTEST_END
-
CFG_ALT_MEMTEST
-
CFG_MEMTEST_SCRATCH
-
CFG_TFTP_LOADADDR
-
CFG_LOADS_BAUD_CHANGE
-
CFG_SDRAM_BASE
-
CFG_MBIO_BASE
-
CFG_FLASH_BASE
-
CFG_MONITOR_BASE
-
CFG_MONITOR_LEN
-
CFG_MALLOC_LEN
-
CFG_BOOTMAPSZ
-
CFG_MAX_FLASH_BANKS
-
CFG_MAX_FLASH_SECT
-
CFG_FLASH_ERASE_TOUT
-
CFG_FLASH_WRITE_TOUT
-
CFG_FLASH_LOCK_TOUT
-
CFG_FLASH_UNLOCK_TOUT
-
CFG_FLASH_PROTECTION
-
CFG_DIRECT_FLASH_TFTP
-
CFG_FLASH_CFI
-
CFG_FLASH_CFI_DRIVER
-
CFG_FLASH_QUIET_TEST
-
CFG_RX_ETH_BUFFER
-
CFG_ENV_IS_IN_FLASH
-
CFG_ENV_IS_IN_NVRAM
-
CFG_ENV_IS_IN_EEPROM
-
CFG_ENV_IS_IN_NAND
-
CFG_SPI_INIT_OFFSET
-
CFG_FAULT_ECHO_LINK_DOWN
Low Level (hardware related) configuration options:
-
CFG_CACHELINE_SIZE
-
CFG_DEFAULT_IMMR
-
Floppy Disk Support
-
CFG_IMMR: Internal Memory
的物理地址
-
CFG_INIT_RAM_ADDR
:可用于初时数据或堆栈的存储起始地址
-
CFG_GBL_DATA_OFFSET
:在由
CFG_INIT_RAM_ADDR
定义的存储器中初始化数据的偏移
-
CFG_SIUMCR
:
SIU Module Configuration
-
CFG_SYPCR
:
System Protection Control
-
CFG_TBSCR
:
Time Base Status and Control
-
CFG_PISCR
:
Periodic interrupt status and control
-
CFG_PLPRCR
:
PLL, Low-Power, and Reset Control Register
-
CFG_SCCR
:
System Clock and reset Control Register
-
CFG_OR_TIMING_SDRAM
-
CFG_MAMR_PTA
-
CFG_DER
:
Debug event register
-
FLASH_BASE0_PRELIM, FLASH_BASE1_PRELIM, CFG_REMAP_OR_AM,
-
CFG_PRELIM_OR_AM, CFG_OR_TIMING_FLASH, CFG_OR0_REMAP,
CFG_OR0_PRELIM, CFG_BR0_PRELIM, CFG_OR1_REMAP, CFG_OR1_PRELIM, CFG_BR1_PRELIM
:
Memory Controller Definitions
:
BR0/1 and OR0/1(FLASH)
- SDRAM_BASE2_PRELIM, SDRAM_BASE3_PRELIM, SDRAM_MAX_SIZE,
CFG_OR_TIMING_SDRAM, CFG_OR2_PRELIM, CFG_BR2_PRELIM,
CFG_OR3_PRELIM, CFG_BR3_PRELIM:Memory Controller Definitions:BR2/3 and OR2/3(SDRAM)
- CFG_MAMR_PTA, CFG_MPTPR_2BK_4K, CFG_MPTPR_1BK_4K, CFG_MPTPR_2BK_8K, CFG_MPTPR_1BK_8K, CFG_MAMR_8COL, CFG_MAMR_9COL:Machine Mode Register and Memory Periodic Timer Prescaler definitions(SDRAM timing)
-
CFG_I2C_UCODE_PATCH, CFG_I2C_DPMEM_OFFSET [0x1FC0]
-
CFG_SPI_UCODE_PATCH, CFG_SPI_DPMEM_OFFSET [0x1FC0]:
-
CFG_USE_OSCCLK
-
CFG_CPM_POST_WORD_ADDR,CFG_PCI_SLV_MEM_LOCAL, CFG_PCI_SLV_MEM_BUS, CFG_PICMR0_MASK_ATTRIB, CFG_PCI_MSTR0_LOCAL, CFG_PCIMSK0_MASK, CFG_PCI_MSTR1_LOCAL, CFG_PCIMSK1_MASK, CFG_PCI_MSTR_MEM_LOCAL, CFG_PCI_MSTR_MEM_BUS,
CFG_CPU_PCI_MEM_START,CFG_PCI_MSTR_MEM_SIZE, CFG_POCMR0_MASK_ATTRIB, CFG_PCI_MSTR_MEMIO_LOCAL, CFG_PCI_MSTR_MEMIO_BUS, CPU_PCI_MEMIO_START,
CFG_PCI_MSTR_MEMIO_SIZE, CFG_POCMR1_MASK_ATTRIB, CFG_PCI_MSTR_IO_LOCAL, CFG_PCI_MSTR_IO_BUS, CFG_CPU_PCI_IO_START, CFG_PCI_MSTR_IO_SIZE, CFG_POCMR2_MASK_ATTRIB
-
CONFIG_ETHER_ON_FEC
-
CONFIG_FEC[12]_PHY
-
CONFIG_FEC[12]_PHY_NORXERR
-
CONFIG_RMII
-
CONFIG_CRC32_VERIFY
-
CONFIG_LOOPW
-
CONFIG_MX_CYCLIC
-
CONFIG_SKIP_LOWLEVEL_INIT
CONFIG_SKIP_RELOCATE_UBOOT
Buildin the Software:
U-BOOT已经在native PPC环境和交叉环境中测试过,包括在LinuxPPC 2000, RedHat Linux on x86, Solaries 2.6 on SPARC及NetBSD 1.5 on x86。
如果不是使用native PPC environment,那么则需要具有交叉编译工具如前缀“powerpc-linux-”等编译器,链接器,elf文件分析器等工具。这是需要重新定义Makefile中的CROSS_COMPILE。例如:CROSS_COMPILE = ppc_4xx-,此外,还需要制定U-Boot为特定的board type。
make NAME_CONFIG
最后,运行
make all
来生成U-Boot images。生成的image包括:
u-boot.bin 是raw binary image
u-boot 是ELF格式的image
u-boot.srec 是Motorola(FreeScale)的s-records format
此外,还需要注意,与GNU mkae不同,在NetBSD下应该使用"gmake"
U-Boot的移植
如果使用的platform不存在,则需要将U-BOOT进行移植。步骤如下:
(
1
) 为使用的board为Makefile和MAKEALL添加新的configuration option。
( 2 ) 为使用的board新建一个新的目录,该目录下至少应该包含“Makefile”
“ < board > .c”和“flash.c”及“u - boot.lds”
( 3 ) 运行“make < board > _config”
( 4 ) 运行“make”,则会生成“u - boot.srec” image
( 5 ) Debug and test
( 2 ) 为使用的board新建一个新的目录,该目录下至少应该包含“Makefile”
“ < board > .c”和“flash.c”及“u - boot.lds”
( 3 ) 运行“make < board > _config”
( 4 ) 运行“make”,则会生成“u - boot.srec” image
( 5 ) Debug and test