u-boot-2016.01移植(一)
阿新 • • 發佈:2018-11-24
1、瞭解uboot:
閱讀uboot原始碼頂層目錄下的README.TXT可以提取如下資訊:
made to support booting of Linux images. //引導核心程式
make <board_name>_defconfig :see boards.cfg for supported names
check the file doc/README.scrapyard for a list of no longer supported boards
lowlevel_init() : essential init to permit execution to reach board_init_f()
//底層硬體相關的初始化,沒有global_data 和 BSS
board_init_f():set up the machine ready for running board_init_r():
//有global_data,棧位於SRAM,清除bss段
board_init_r() : main execution, common code
//有global_data 和 BSS,主要的執行程式,初始化SDRAM和UART
配置選項:
配置檔案在"include/configs/<board_name>.h" 一般不要使能icache和dcache(configuration option CONFIG_CMD_CACHE)
單板初始化設定:
- CONFIG_BOARD_EARLY_INIT_F: Call board_early_init_f()
- CONFIG_BOARD_EARLY_INIT_R: Call board_early_init_r()
- CONFIG_BOARD_LATE_INIT: Call board_late_init()
- CONFIG_BOARD_POSTCLK_INIT: Call board_postclk_init()
修改原始碼之後要相應地更新<board>/u-boot.lds*
底層硬體相關的配置:
在Makefile中需要配置CROSS_COMPILE 如果uboot沒有支援我們所用的單板 :
1.1、在boards.cfg中為你的單板新增新的配置選項,可以使用已經存在的單板作為參考;
1.2、新建一個目錄以支援你的單板,單板目錄下至少包含Makefilea, <board>.c, flash.c and u-boot.lds;
1.3、為你的單板建立一個新的配置檔案include/configs/<board>.h;
1.4、如果你是移植U-Boot到你的CPU, 也建立一個新的目錄支援你CPU的特定程式
1.5、執行make <board>_defconfig
1.6、make
1.7、除錯並且解決問題
Monitor Commands:
常用的:
md - memory display
mm - memory modify (auto-incrementing)
nm - memory modify (constant address)
mw - memory write (fill)
nand - NAND memory operations (see doc/README.nand)
erase - erase FLASH memory
flinfo - print FLASH memory information
bdinfo - print Board Info structure
iminfo - print header information for application image
coninfo - print console devices and informations
bootm - boot application image from memory
tftpboot- boot image via network using TFTP protocol
and env variables "ipaddr" and "serverip"
(and eventually "gatewayip")
不常用:
cp - memory copy
go - start application at address 'addr'
run - run commands in an environment variable
bootp - boot image via network using BootP/TFTP protocol
bootz - boot zImage from memory
tftpput - upload a file via network using TFTP protocol
rarpboot- boot image via network using RARP/TFTP protocol
diskboot- boot from IDE devicebootd - boot default, i.e., run 'bootcmd'
loads - load S-Record file over serial line
loadb - load binary file over serial line (kermit mode)
cmp - memory compare
crc32 - checksum calculation
i2c - I2C sub-system
sspi - SPI utility commands
base - print or set address offset
printenv- print environment variables
setenv - set environment variables
saveenv - save environment variables to persistent storage
protect - enable or disable FLASH write protection
ide - IDE sub-system
loop - infinite loop on address range
loopw - infinite write loop on address range
mtest - simple RAM test
icache - enable or disable instruction cache
dcache - enable or disable data cache
reset - Perform RESET of the CPU
echo - echo args to console
version - print monitor version
help - print online help
環境變數的設定:
setenv: 設定環境變數
printenv: 列印環境變數
saveenv: 儲存環境變數
設定列表:baudrate、bootdelay、bootcmd、bootargs、bootfile、ipaddr、serverip
uImage format:New uImage format (FIT) 、Old uImage format
引導核心會列印核心相關資訊:
Checking Image at 40100000 ...
Image Name: 2.2.13 for initrd on TQM850L
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 335725 Bytes = 327 kB = 0 MB
Load Address: 00000000
Entry Point: 0000000c
Verifying Checksum ... OK
閱讀uboot原始碼頂層目錄下的README.TXT可以提取如下資訊:
made to support booting of Linux images. //引導核心程式
make <board_name>_defconfig :see boards.cfg for supported names
check the file doc/README.scrapyard for a list of no longer supported boards
lowlevel_init()
//底層硬體相關的初始化,沒有global_data 和 BSS
board_init_f():set up the machine ready for running board_init_r():
//有global_data,棧位於SRAM,清除bss段
board_init_r()
//有global_data 和 BSS,主要的執行程式,初始化SDRAM和UART
配置選項:
配置檔案在"include/configs/<board_name>.h" 一般不要使能icache和dcache(configuration option CONFIG_CMD_CACHE)
單板初始化設定:
- CONFIG_BOARD_EARLY_INIT_F: Call board_early_init_f()
- CONFIG_BOARD_EARLY_INIT_R: Call board_early_init_r()
- CONFIG_BOARD_LATE_INIT: Call board_late_init()
- CONFIG_BOARD_POSTCLK_INIT: Call board_postclk_init()
修改原始碼之後要相應地更新<board>/u-boot.lds*
底層硬體相關的配置:
在Makefile中需要配置CROSS_COMPILE 如果uboot沒有支援我們所用的單板
1.1、在boards.cfg中為你的單板新增新的配置選項,可以使用已經存在的單板作為參考;
1.2、新建一個目錄以支援你的單板,單板目錄下至少包含Makefilea, <board>.c, flash.c and u-boot.lds;
1.3、為你的單板建立一個新的配置檔案include/configs/<board>.h;
1.4、如果你是移植U-Boot到你的CPU, 也建立一個新的目錄支援你CPU的特定程式
1.5、執行make <board>_defconfig
1.6、make
1.7、除錯並且解決問題
Monitor Commands:
常用的:
md - memory display
mm - memory modify (auto-incrementing)
nm - memory modify (constant address)
mw - memory write (fill)
nand - NAND memory operations (see doc/README.nand)
erase - erase FLASH memory
flinfo - print FLASH memory information
bdinfo - print Board Info structure
iminfo - print header information for application image
coninfo - print console devices and informations
bootm - boot application image from memory
tftpboot- boot image via network using TFTP protocol
and env variables "ipaddr" and "serverip"
(and eventually "gatewayip")
不常用:
cp - memory copy
go - start application at address 'addr'
run - run commands in an environment variable
bootp - boot image via network using BootP/TFTP protocol
bootz - boot zImage from memory
tftpput - upload a file via network using TFTP protocol
rarpboot- boot image via network using RARP/TFTP protocol
diskboot- boot from IDE devicebootd - boot default, i.e., run 'bootcmd'
loads - load S-Record file over serial line
loadb - load binary file over serial line (kermit mode)
cmp - memory compare
crc32 - checksum calculation
i2c - I2C sub-system
sspi - SPI utility commands
base - print or set address offset
printenv- print environment variables
setenv - set environment variables
saveenv - save environment variables to persistent storage
protect - enable or disable FLASH write protection
ide - IDE sub-system
loop - infinite loop on address range
loopw - infinite write loop on address range
mtest - simple RAM test
icache - enable or disable instruction cache
dcache - enable or disable data cache
reset - Perform RESET of the CPU
echo - echo args to console
version - print monitor version
help - print online help
環境變數的設定:
setenv: 設定環境變數
printenv: 列印環境變數
saveenv: 儲存環境變數
設定列表:baudrate、bootdelay、bootcmd、bootargs、bootfile、ipaddr、serverip
uImage format:New uImage format (FIT) 、Old uImage format
引導核心會列印核心相關資訊:
Checking Image at 40100000 ...
Image Name: 2.2.13 for initrd on TQM850L
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 335725 Bytes = 327 kB = 0 MB
Load Address: 00000000
Entry Point: 0000000c
Verifying Checksum ... OK