公板SMDK2410(S3C2410,不支持NAND FLASH)----à
蓝板SBC2410(S3C2410,添加了对NANDFLASH支持)---à
MINI2440(S3C2440,针对S3C2410与S3C2440的差异进行更改)
一、准备工作:
1、 建立工作目录
mkdir /root/build_uboot
cd /root/build_uboot
2、 把下载的源码拷贝到该目录,解压
# tar -zxvf u-boot-201003.tar.gz
二、修改文件
1、修改顶层 Makefile
在sbc2410x_config: unconfig
@$(MKCONFIG) $(@:_config=) arm arm920tsbc2410x NULL s3c24x0
后添加:
mini2440_config: unconfig
@$(MKCONFIG) $(@:_config=) armarm920t mini2440 NULL s3c24x0 (注意:如果写作者名,则下面是board/作者名/mini2440)
2、(1)在/board子目录中建立自己的开发板board/mini2440目录
cp -r board/sbc2410x board/mini2440
(2) 将sbc2410.c更名为mini2440.c
(3). /mini2440/Makefile
COBJS :=nand_read.o sbc2410.o 改为 flash.o COBJS := nand_read.o mini2440.o flash.o
(4)在./mini2440/mini2440.c 中,把所有SBC2410X替换为 MINI2440
3、/include/configs/
(1)把sbc2410x.h复制一份为mini2440.h
(2)把下面:
#define CONFIG_S3C2410 1 /* specifically a SAMSUNG S3C2410 SoC */
#define CONFIG_SBC2410X 1 /* on a friendly-arm SBC-2410X Board */
#define CONFIG_SBC2410X_LED 1
#define CONFIG_SYS_PROMPT "[u-boot@SBC2410X]# " /* Monitor Command Prompt */
改为:
#define CONFIG_S3C2440 1 /* specifically a SAMSUNG S3C2410 SoC */
#define CONFIG_MINI2440 1 /* on a friendly-arm SBC-2410X Board */
#define CONFIG_MINI2440_LED 1
#define CONFIG_SYS_PROMPT "[u-boot@MINI2440]# " /* Monitor Command Prompt */
4、对start.s
(1) #if defined(CONFIG_SBC2410X_LED)
改为:#if defined(CONFIG_MINI2440_LED)
(2)下面针对2410与2440的不同作修改。找到S3C2410的宏开关“CONFIG_SBC2410X_LED”,有3个,逐个对其内容修改:
((1)) # ifdefined(CONFIG_S3C2410)
ldr r1,=0x7ff
ldr r0, =INTSUBMSK
str r1, [r0]
# endif
复制一份,并修改为:
#if defined(CONFIG_S3C2440)
ldr r1, =0x7fff
ldr r0, =INTSUBMSK
str r1, [r0]
#endif
((2)) #ifdefined(CONFIG_S3C2410)
/* FCLK:HCLK:PCLK = 1:2:4 */
/* default FCLK is 120 MHz ! */
ldr r0, =CLKDIVN
mov r1, #3
str r1, [r0]
mrc p15, 0, r1, c1, c0, 0
orr r1, r1, #0xc0000000
mcr p15, 0, r1, c1, c0, 0 /*write ctrl register tekkaman*/
mov r1, #CLK_CTL_BASE /* tekkaman*/
mov r2, #MDIV_200
add r2, r2, #PSDIV_200
str r2, [r1, #0x04]
#endif
复制一份,并修改为:
#if defined(CONFIG_S3C2440)
/*FCLK:HCLK:PCLK = 1:4:8 */
ldr r0, =CLKDIVN
mov r1, #5
str r1, [r0]
mrc p15,0, r1, c1, c0, 0
orr r1, r1, #0xc0000000
mcr p15, 0, r1, c1, c0, 0
mov r1, #CLK_CTL_BASE
mov r2, #MDIV_405
add r2, r2, #PSDIV_405
str r2, [r1, #0x04] /* MPLLCON */
#endif
((3)) 把下面代码中宏CONFIG_S3C2410改为CONFIG_S3C2440
#ifdef CONFIG_S3C2410
/* Offset */
#define oNFCONF 0x00
#define oNFCONT 0x04
#define oNFCMD 0x08
#define oNFSTAT 0x20
。。。
5、/cpu/arm920t/u-boot.lds
把board/sbc2410x/lowlevel_init.o (.text)
board/sbc2410x/nand_read.o (.text)
改为: board/mini2440/lowlevel_init.o (.text)
board/mini2440/nand_read.o (.text)
6、/lib_arm/board.c
3个地方出现CONFIG_SBC2410X_LED,改为:CONFIG_MINI2440_LED
三、 编译源代码
#cd u-boot-2010.03
#make distclean (清除源码树)
把编译器arm-linux-gcc-4.3.2.tgz放到/usr/local/arm/并解压。并确保解压后得到/use/local/arm/4.3.2目录。
#export PATH=/usr/local/arm/4.3.2/bin:$PATH (也可以写进~/.bashrc 或者是/etc/profile文件中)
#make ARCH=arm CROSS_COMPILE=/usr/local/arm/4.3.2/bin/arm-linux-mini2440_config 配置
#make ARCH=arm CROSS_COMPILE=/usr/local/arm/4.3.2/bin/arm-linux-all 编译
四、 烧写FLASH
最终生成的u-boot.bin可以通过supervivi菜单项里的"[a] Absolute User Application"选项 + DNW工具下载到NAND Flash中。
#printenv
#setenv serverip192.169.41.203----tftp服务器的IP地址---PC WINDOWS的IP
#setenv ipaddr192.169.41.55
#saveenv
#ping 192.169.41.203