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
#include
變數名,預編譯常數等都以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
_config.
Example:
cd u-boot
make TQM82L_config
對于Cogent platform,則需要make cogent_mpc8xx_config.
Configuration Options:
Configuration取決于board和CPU類別,其資訊在include/configs/ .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”
“ .c”和“flash.c”及“u-boot.lds”
(3) 執行“make _config”
(4) 執行“make”,則會生成“u-boot.srec” image
(5) Debug and test
留言列表