at91sam9260ek的移植
— U-boot(V1.3.4)
关于移植在U-boot文档中这样介绍:
README
If the system board that you have is not listed, then you will need to port U-Boot to your hardware platform. To do this, follow these steps: 1. Add a new configuration option for your board to the toplevel "Makefile" and to the "MAKEALL" script, using the existing entries as examples. Note that here and at many other places boards and other names are listed in alphabetical sort order. Please keep this order. 2. Create a new directory to hold your board specific code. Add any files you need. In your board directory, you will need at least the "Makefile", a "<board>.c", "flash.c" and "u-boot.lds". 3. Create a new configuration file "include/configs/<board>.h" for your board 3. If you're porting U-Boot to a new CPU, then also create a new directory to hold your CPU specific code. Add any files you need. 4. Run "make <board>_config" with your new name. 5. Type "make", and you should get a working "u-boot.srec" file to be installed on your target system. 6. Debug and solve any problems that might arise. [Of course, this last step is much harder than it sounds.]
0. 准备工作
(1) 下载
V1.3.4:ftp://ftp.denx.de/pub/u-boot/u-boot-1.3.4.tar.bz2
补丁: ftp://www.at91.com/pub/uboot/u-boot-1.3.4-exp.5/u-boot-1.3.4-exp.5.diff
(2) 安装
u-boot安装此处省略,详细请参见《制作U-boot ---AT91SAM9260篇》
补丁安装:
a. 拷贝u-boot-1.3.4-exp.5.diff到u-boot-1.3.4
b. # cat u-boot-1.3.4-exp.5.diff |patch -p1
1. 添加开发板
(1) MAKEALL
#########################################################################
## ARM9 Systems
#########################################################################
LIST_ARM9=" \
at91sam9260ek at91sam9261ek at91sam9263ek \
(2) Makefile
#########################################################################
## ARM926EJS Systems
#########################################################################
at91sam9260ek_config : unconfig
@$(MKCONFIG)$(@:_config=) arm arm926ejs at91sam9260ek atmel
at91sam926x
1) arm: CPU架构
2) arm926ejs: CPU型号
3) at91sam9260ek: 开发板名称
4) atmel: 所属厂商
5) at91sam926x: SoC
2. 文件构成
a. 架构
arch-at91sam926x文件夹(u-boot-x.x.x/../include/asm/)
b. CPU
at91sam926x文件夹(u-boot-x.x.x/../cpu/arm926ejs/)
删除LCD和USB支持
lcd.c、lcd_lut.h、usb_ohci.c、usb_ohci.h
删除DM9000物理网卡支持
ether.c
Ln25: #ifndef CONFIG_DRIVER_DM9000 /*SAM9261EK uses DM9000 Phy */
Ln30: #include <dm9161.h>
Ln457: #endif /*CONFIG_DRIVER_DM9000 */
c. 开发板
at91sam9260ek文件夹(u-boot-x.x.x/../board/)
删除DM9000物理网卡
dm9161a.c
d. 开发板配置
at91sam9260ek.h(u-boot-x.x.x/../include/configs/)
#include<cmd_confdefs.h>
à
#include< config_cmd_default.h>
e. Ethernet部分
拷贝at91_net.h到:u-boot-x.x.x/include/
各文件介绍:
1)MII物理寄存器定义:
../include/miipyh.h
2)函数头文件:
../include/at91_net.h
3)函数实现:
../cpu/arm926ejs/at91sam926x/ether.c
f. flash部分
覆盖dataflash.h到:u-boot-1.3.4/include/
覆盖dataflash.c到:u-boot-1.3.4/drivers/mtd/
g. nand部分
1)nand文件夹
拷贝位置:../drivers/mtd/nand
并修改函数名:
DEBUG à MTDDEBUG
2)cmd_nand.c
拷贝至:../common/
并注释掉:
//print_image_hdr(hdr);
h. 中断部分
删除../cpu/arm926ejs/下的interrupts.c,否则会出现多重定义的问题!
3. 宏修改
CFG_*_* --〉 CONFIG_*_*
(1) net
#if(CONFIG_COMMANDS & CFG_CMD_NET)
--〉
#if defined(CONFIG_CMD_NET)
(2) nand
#if(CONFIG_COMMANDS & CFG_CMD_NAND)
--〉
#ifdefined(CONFIG _CMD_NAND)
1)Nand命令
config_cmd_default.h:添加宏定义CONFIG_CMD_NAND;
宏定义来源:config_cmd_all.h