IPB

Welcome Guest ( Log In | Register )

> [操作系统][Linux][u-boot]Uboot在2410板子上移植, 转自“emlinux的个人空间”
猫猫草
post 2007-04-26 12:11:23, Thu
Post #1


猫猫猫
***

Group: Power Cat
Posts: 626
Joined: 2006-12-8
Member No.: 2



1.环境
uboot版本:u-boot-1.1.4
交叉编译器(CROSS-COMPILE)版本:2.95.3
操作系统:Fedora 6

2.步骤
为开发板取名crane2410, 并在u-boot中建立自己的开发板类型
2.1修改Makefile
[uboot@localhost u-boot-1.1.4]$ vi Makefile
#为crane2410建立编译项
crane2410_config : unconfig
@./mkconfig $(@:_config=) arm arm920t crane2410 NULL s3c24x0
各项的意思如下:
arm: CPU的架构(ARCH)
arm920t: CPU的类型(CPU),其对应于cpu/arm920t子目录。
crane2410: 开发板的型号(BOARD),对应于board/crane2410目录。
NULL: 开发者/或经销商(vender)。
s3c24x0: 片上系统(SOC)。
2.2 在board子目录中建立crane2410
[uboot@localhost uboot]#cp rf
board/smdk2410 board/crane2410
[uboot@localhost uboot]#cd board/crane2410
[uboot@localhost crane2410]#mv smdk2410.c crane2410.c
2.3 在include/configs/中建立配置头文件
[uboot@localhost crane2410]#cd ../..
[uboot@localhost uboot]#cp include/configs/smdk2410.h include/configs/crane2410.h
2.4 指定交叉编译工具的路径
[uboot@localhost uboot]#vi ~/.bashrc
export PATH=/usr/local/arm/2.95.3/bin:$PATH
2.5 测试编译能否成功
[uboot@localhost uboot]#make crane2410_config
[uboot@localhost uboot]#make CROSS_COMPILE=arm-linux
若编译成功,则应该在uboot目录下生成u-boot.bin文件,将其烧写到2410板卡里应该能够启动。

常见错误:
1. 在make的过程中,出现:
引用

cc1: invalid option `abi=apcs-gnu'
解决方法:
出错的文件是/cpu/s3c44b0/下的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,))


2. 修改了第一个错误后,继续make,出现了如下的报错:
引用

make[1]: *** No rule to make target `hello_world.srec', needed by `all'. Stop.
make[1]: Leaving directory `/home/mort/src/targa/u-boot/u-boot-TOT/examples'
make: *** [examples] Error 2

解决方法:
修改examples/Makefile
把126行和129行改为:
代码
%.srec: %.o
     %.bin: %.o

继续make

3. 出现
引用

crane2410.a needed by smdk2410.o
解决方法:
修改board/crane2410/Makefile
将28行的
代码
OBJS    := smdk2410.o flash.o

改为
代码
OBJS    := crane2410.o flash.o


继续make

4. 将编译好的u-boot.bin烧写到2410板卡里,启动,通过串口打印消息,虽然能够启动到u-boot的命令行,但有错:
引用

U-Boot 1.1.4 (Mar 7 2007 - 11:15:21)
U-Boot code: 33F80000 -> 33F9873C BSS: -> 33F9C814
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 512 kB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
SMDK2410 #

解决方法:
通过分析u-boot的启动流程,调试代码,得知问题出在cpu/at91rm9200/start.S中。其中有一段代码:
代码
ldr     r0, =_start
        ldr     r1, =0x0
        mov     r2, #16
copyex:
        subs    r2, r2, #1
        ldr     r3, [r0], #4
        str     r3, [r1], #4
        bne     copyex

它的作用是把中断向量表从flash reload到RAM,以提高速度。但是它没有进行remap。故而使得u-boot启动之后无法寻找到环境变量所在的第63扇区。更改如下:
代码
if 0      
        ldr     r0, =_start
        ldr     r1, =0x0
        mov     r2, #16
copyex:
        subs    r2, r2, #1
        ldr     r3, [r0], #4
        str     r3, [r1], #4
        bne     copyex
endif

即把此段代码注释掉。
【或者是在此段前面加上remap部分,不过如果加上remap,则需要把前面的设置svc部分的代码注释掉,否则在u-boot>reset时会进入异常状态。】
此解决方案对u-boot-1.1.1也有效。


以上是本人在移植u-boot中遇到的问题,和上网得到的解决方法。
参考资料有:
1.linux系统移植: linux_mig_release_G4oyxcsIVyIZ.pdf
2. http://www.ednchina.com/blog/seabiscuit/11759/category.aspx
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
3 User(s) are reading this topic (3 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 2024-10-17 05:39