u-boot-2010.03的移植
【实验目的】
了解U-boot-2010.03的代码结构及移植方法。
【实验环境】
1、 Ubuntu 10.10发行版
2、 u-boot-2010.03
3、 FS2410平台
4、 交叉编译器 arm-none-linux-gnueabi-gcc
【实验步骤】
说明:后面实验中的命令行提示符是($)则为主机命令(主机上执行)
1、 建立自己的平台
1、 下载源码
我们可以在下面这个网站上下载最新的和以前任一版本的uboot
我们这里使用的是u-boot-2010.03.tar.bz2
2、 解压uboot源码
$ tar jxvf u-boot-2010.03.tar.bz2
3、 进入到uboot源码
$ cd u-boot-2010.03
4、 添加FS2410平台信息
我们关心的班级相关内容文件或目录
u-boot-2010.03/Makefile
u-boot-2010.03/cpu/arm920t/start.S
u-boot-2010.03/board/Samsung/smdk2410
u-boot-2010.03/lib_arm
u-boot-2010.03/include/configs/smdk2410.h
smdk2410是s3c2410的标准板,我们在smdk2410的基础上做FS2410的移植
$ cd board/samsung/
$ cp smdk2410 fs2410 –a
$ cd fs2410
$ mv smdk2410.c fs2410.c
$ vim Makefile
修改
COBJS := smdk2410.o flash.o
为
COBJS := fs2410.o flash.o
$ cd include/configs
$ cp smdk2410.h fs2410.h
修改u-boot顶层目录下的Makefile,按照smdk2410的内容添加fs2410的内容
$ vim Makefile
在
smdk2410_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 samsung s3c24x0
下添加:
fs2410_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t fs2410 samsung s3c24x0
修改编译器
在
ifeq ($(HOSTARCH, $(ARCH))
CROSS_COMPILE ?=
endif
下添加:
ifeq (arm, $(ARCH))
CROSS_COMPILE ?= arm-none-linux-gnueabi-
endif
5、 编译u-boot-2010.03
$ make distclean
$ make fs2410_config
$ make
这个时候我们就可以得到一个u-boot.bin也就是我们的目标文件,但是这个文件通常情况下是不能够正常工作的,我们还需要对u-boot源代码进行进一步的修改。
2、 针对我们的FS2410平台进行进一步的修改
1、 u-boot源码中的中断屏蔽位
在s3c2410中有11个子中断屏蔽位代码里只有10个
修改cpu/arm920t/start.S
修改
# if defined(CONFIG_S3C2410)
ldr r1, =0x3ff
ldr r0, =INTSUBMSK
str r1, [r0]
# endif
为:
# if defined(CONFIG_S3C2410)
ldr r1, =0x7ff
ldr r0, =INTSUBMSK
str r1, [r0]
# endif
2、 修改配置文件include/configs/fs2410.h
1) 命令行提示符的修改:
#define CONFIG_SYS_PROMPT "SMDK2410 # "
改成:
#define CONFIG_SYS_PROMPT "fs2410 # "
2) 网络参数设置
修改
#define CONFIG_ETHADDR 08:00:3e:26:0a:5b
#define CONFIG_NETMASK 255.255.255.0
#define CONFIG_IPADDR 10.0.0.110
#define CONFIG_SERVERIP 10.0.0.1
为
#define CONFIG_ETHADDR 11:22:33:44:55:66
#define CONFIG_NETMASK 255.255.255.0
#define CONFIG_IPADDR 192.168.7.222
#define CONFIG_SERVERIP 192.168.7.223
3) 内核加载地址的修改
修改
#define CONFIG_SYS_LOAD_ADDR 0x33000000
改成:
#define CONFIG_SYS_LOAD_ADDR 0x30008000
4) Nand功能添加
对照include/config_cmd_default.h和include/config_cmd_all.h添加我们需要的相应功能。
Nand的功能的添加
#define CONFIG_CMD_NAND /* NAND support*/
#if defined(CONFIG_CMD_NAND)
#define CONFIG_SYS_MAX_NAND_DEVICE 1
#define CONFIG_SYS_NAND_BASE 0x4E000000
#define CONFIG_NAND_S3C2410
#define STACK_BASE 0x33f00000
#define STACK_SIZE 0x8000
/* Nand Flash */
#define CONFIG_MTD_NAND_VERIFY_WRITE 1