1. 下载u-boot源码包:
--------------------------------------
http://sourceforge.net/project/showfiles.php?group_id=65938&package_id=63695
# wget -c ftp://ftp.denx.de/pub/u-boot/u-boot-1.1.5.tar.bz2
2. u-boot的编译
--------------------------------------
注: 交叉编译器选择3.3.2
# cd u-boot-1.1.5
2.1 修改u-boot源码使其支持nand flash启动
2.2 u-boot向内核传递machine ID(修改cmd_boot.c)
2.4 修改Bug 2 (1.1.6不需要关注这里)
# make sbc2410x_config
# make
编译完成后,可以得到u-boot各种格式的映像文件和符号表
# ls -lh u-boot*
u-boot.bin 118K u-boot映像原始的二进制格式
u-boot 448K u-boot映像的ELF格式
u-boot.srec 354K u-boot映像的S-Record格式
u-boot.map 52K u-boot映像的符号表
u-boot的3种映像格式都可以烧写到Flash中,但需要看加载器能否识别这些格式。一般u-boot.bin最为常用,直接按照二进制格式下载,并且按照绝对地址烧写到Flash中就可以了。u-boot和u-boot.srec格式映像都自带定位信息。
3. -用Jflash烧写u-boot到nand flash
Bug 1
cc1: error: invalid option `abi=apcs-gnu'
------------------------------------------------------------------
1)改用GCC为arm-linux-gcc-3.4.1.tar.bz2即可. 或者:
2)出错的文件是/cpu/arm920t/下的config.mk:
将
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
改成:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu),)
Bug 2
make[1]: *** 没有规则可以创建“all”需要的目标“hello_world.srec”。 停止。
------------------------------------------------------------------
make[1]: Leaving directory `/home/a-ki/at91rm9200/u-boot-1.1.4/examples'
make: *** [examples] 错误 2
在网上查了查,有人说是make 3.81的一个BUG!
http://blackfin.uclinux.org/gf/project/u-boot/tracker/?action =TrackerItemEdit&tracker_item_id=1324
可以简单的改一个目录examples下的Makefile来解决:
vi examples/Makefile
#SREC = hello_world.srec
#BIN = hello_world.bin hello_world
SREC = hello_world.o
BIN = hello_world.o hello_world
Bug 3
软浮点soft-float问题(R_ARM_PLT32 __div0)
------------------------------------------------------------------
lib_arm/_udivsi3.S:67: relocation truncated to fit: R_ARM_PLT32 __div0
lib_arm/_umodsi3.S:79: relocation truncated to fit: R_ARM_PLT32 __div0
使用3.3.2交叉编译器,即可成功编译