u-boot裁减
http://blog.csdn.net/menuconfig/article/details/2276078
u-boot裁減的主要方法是通過(guò)刪除不需要的命令來(lái)減小可執(zhí)行代碼體積。比如說(shuō),如果不需要網(wǎng)絡(luò)相關(guān)的功能,則可以將網(wǎng)絡(luò)相關(guān)的所有命令全部刪除,可以節(jié)約可觀的flash空間。一般u-boot的大小為100k左右,通過(guò)刪除命令(如果刪除網(wǎng)絡(luò)相關(guān)的命令),可以裁減到64k以內(nèi),只保留一些經(jīng)常使用的命令。
另外,如果需要?jiǎng)討B(tài)修改環(huán)境變量,環(huán)境變量還需要單獨(dú)分配一個(gè)flash扇區(qū)用于保存。這樣大約就需要64k+64k的flash空間。如果我們不需要?jiǎng)討B(tài)修改環(huán)境變量,可以省去一個(gè)扇區(qū)的Flash開(kāi)銷(xiāo)。
以下是本人裁減u-boot的基本步驟:
1,刪除除默認(rèn)命令以外的命令:
??? 刪除include/configs/naribf533.h中CONFIG_COMMANDS的定義,直接采樣默認(rèn)的命令。可以將u-boot從108k裁減到79k。
2,刪除其他不需要的命令,只保留常用命令:
通過(guò)修改include/cmd_confdefs.h中的CFG_CMD_NONSTD常量,進(jìn)一步裁減u-boot命令。CFG_CMD_NONSTD為“non-standard”命令,除了這個(gè)常量定義的命令外,其余都是常用命令。我們可以通過(guò)在這個(gè)常量中添加不需要的命令來(lái)減少默認(rèn)命令的數(shù)量。我們這里只保留以下命令,其余全部裁減掉:
??????? - alias for 'help'
autoscr - run script from memory
base??? - print or set address offset
bdinfo?- print Board Info structure
bootm?? - boot application image from memory
cmp???? - memory compare
coninfo - print console devices and information
cp????? - memory copy
crc32?? - checksum calculation
echo??? - echo args to console
erase?? - erase FLASH memory
fl????? - flush a file to FLASH memory
flinfo?- print FLASH memory information
go?? ???- start application at address 'addr'
help??? - print online help
loadb?? - load binary file over serial line (kermit mode)
loads?? - load S-Record file over serial line
loop??? - infinite loop on address range
md????? - memory display
mm????? - memory modify (auto-incrementing)
mtest?? - simple RAM test
mw????? - memory write (fill)
nm????? - memory modify (constant address)
oc????? - over clocking
printenv- print environment variables
protect - enable or disable FLASH write protection
reset?? - Perform RESET of the CPU
run???? - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv?- set environment variables
sleep?? - delay execution for some time
version - print monitor version
最終可以將uboot裁減到63k。
3,修改控制臺(tái)返回信息和環(huán)境變量:
修改環(huán)境變量的存儲(chǔ)扇區(qū)地址,并刪除無(wú)用的環(huán)境變量或相應(yīng)修改成對(duì)應(yīng)于我們開(kāi)發(fā)板的環(huán)境變量。
相應(yīng)修改一些控制臺(tái)返回信息。
4,如果不動(dòng)態(tài)修改環(huán)境變量,建議刪除saveenv命令,以免誤擦除u-boot程序。同時(shí)將內(nèi)核存放地址修改為20010000。
轉(zhuǎn)自 ?http://www.eefocus.com/myspace/blog/show_77755.html
總結(jié)
- 上一篇: u-boot 详细介绍 .
- 下一篇: svn中的分支介绍