4.3. 让u-boot-1.3.4支持TFTP服务
对/include/configs/YF2410.h进行正确的网络配置,可使u-boot-1.3.4支持TFTP服务,从而可通过TFTP协议在开发主机与开发板之间传输文件。具体修改如清单20所示,测试结果参见清单21。
清单20 对u-boot进行网络配置
--------------------------------------------------------------------------------
[root@lxf u-boot-1.3.4]# cd include/configs/
[root@lxf configs]# vi YF2410.h
//修改下列网络配置为
#define CONFIG_IPADDR 135.1.2.150 //开发板的IP地址
#define CONFIG_SERVERIP 135.1.2.192 //TFTP服务器的IP地址
--------------------------------------------------------------------------------
重新编译u-boot,把u-boot.bin烧写到NOR FLASH上, 启动u-boot就可以支持tftp传输,具体操作如清单21所示。
清单21 测试u-boot对tftp传输的支持
--------------------------------------------------------------------------------
[root@lxf configs]# cd ..
[root@lxf include]# cd ..
[root@lxf u-boot-1.3.4]# make
...
[root@lxf u-boot-1.3.4]# cp u-boot.bin /tftpboot/
//把u-boot烧写到NOR FLASH上
YF2410-I>erase 0x0
Erasing flash at 0x00000000
Erasing flash passed
YF2410-I>erase 0x20000
Erasing flash at 0x00020000
Erasing flash passed
YF2410-I>erase 0x40000
Erasing flash at 0x00040000
Erasing flash passed
YF2410-I>erase 0x60000
Erasing flash at 0x00060000
Erasing flash passed
YF2410-I>prog 0x0 u-boot.bin bin
Programming u-boot.bin , please wait ....
Programming flash passed
YF2410-I>go 0x0
//在minicom下查看与操作
U-Boot 1.3.4 (Aug 27 2008 - 16:21:43)
DRAM: 64 MB
Flash: 4 MB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
SMDK2410 # tftp 30008000 u-boot.bin
TFTP from server 135.1.2.192; our IP address is 135.1.2.150
Filename 'u-boot.bin'.
Load address: 0x30008000
Loading: #########
done
Bytes transferred = 131308 (200ec hex)
SMDK2410 #
--------------------------------------------------------------------------------
TFTP功能测试结果正确。
4.4. 其它配置修改
u-boot支持很多配置选项,通过激活或修改这些选项可以对u-boot进行灵活定制。一些修改示例如清单22所示。
清单22 配置选项修改示例
--------------------------------------------------------------------------------
//修改提示符
#define CFG_PROMPT "YF2410 # " /* Monitor Command Prompt*/
//修改启动命令,可从NOR FLASH 0x80000地址处自启动uImage格式的内核。
#define CONFIG_BOOTCOMMAND "bootm 80000"
--------------------------------------------------------------------------------
4.5. 让u-boot-1.3.4支持NAND FLASH
4.5.1. 对NAND Flash的支持
修改/include/configs/YF2410.h,添加与NAND FLASH相关的配置项,让u-boot-1.3.4支持NAND FLASH,具体操作参见清单23,测试结果参见清单24。
清单23 添加与NAND FLASH相关的配置项
--------------------------------------------------------------------------------
//激活与NAND FLASH操作相关的命令
#define CONFIG_CMD_NAND
//配置NAND FLASH驱动的必要参数
#ifdef CONFIG_CMD_NAND
#define CFG_NAND_BASE 0x4E000000
#define CFG_MAX_NAND_DEVICE 1 /* Max number of NAND devices */
#endif
--------------------------------------------------------------------------------
清单24 测试u-boot对NAND FLASH的支持
U-Boot 1.3.4 (Aug 27 2008 - 17:20:42)
DRAM: 64 MB
Flash: 4 MB
NAND: 64 MiB //NAND FLASH的大小识别正确
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
SMDK2410 # nand bad
Device 0 bad blocks:
0041c000
00820000
SMDK2410 # nand info
Device 0: NAND 64MiB 3,3V 8-bit, sector size 16 KiB
SMDK2410 # nand
Usage:
nand - NAND sub-system
测试结果正确,配置成功,现在可以对 NAND Flash进行操作。
4.5.2. 去除u-boot启动的Warning信息
把u-boot的环境变量通过saveenv命令保存到NOR FLASH上就可以去除启动的Warning信息,具体操作参见清单25,测试结果见清单26。
清单25 通过saveenv命令把环境变量保存到NOR FLASH上
--------------------------------------------------------------------------------
U-Boot 1.3.4 (Aug 27 2008 - 17:20:42)
DRAM: 64 MB
Flash: 4 MB
NAND: 64 MiB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
SMDK2410 # saveenv
Saving Environment to Flash...
. done
Un-Protected 1 sectors
Erasing Flash...
Erase sector 2 at start addr 0x00040000 done
Erased 1 sectors
Writing to Flash... done
. done
Protected 1 sectors
SMDK2410 #
--------------------------------------------------------------------------------
清单26 测试启动的Warning信息
--------------------------------------------------------------------------------
U-Boot 1.3.4 (Aug 27 2008 - 17:20:42)
DRAM: 64 MB
Flash: 4 MB
NAND: 64 MiB
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
SMDK2410 #
--------------------------------------------------------------------------------
已成功去除启动的Warning信息。
