Jesuslovesme 2011-03-18
一、u-boot基本常用命令
1. 基本环境设置
setenv serverip 192.168.1.115
setenv ipaddr 192.168.1.211
setenv gatewayip 192.168.1.1
setenv ethaddr 1E:23:37:48:5A:6B
setenv bootargs root=/dev/mtdblock2 rootfstype=yaffs init=/linuxrc mem=64M console=ttySAC0,115200
setenv bootcmd nand read 30008000 80000 200000 \; bootm
saveenv
2. 烧写Boot
tftp 30008000 u-boot-tq.bin
nand erase 0 60000
nand write 30008000 0 60000
3. 加载内核
tftp 30008000 zImage.img
bootm
4. 烧写rootfs
(1)如果是256MB的Nand Flash,使用如下命令烧写:
tftp 30008000 root_tq2440.yaffs2
nand erase 480000 FB60000
nand write.yaffs 30008000 480000 $(filesize)
(2)如果是64MB的Nand Flash,使用如下命令烧写:
tftp 30008000 root_tq2440.yaffs2
nand erase 480000 3B60000
nand write.yaffs 30008000 480000 $(filesize)
5. 烧写内核
tftp 30008000 zImage.img
nand erase 80000 400000
nand write 30008000 80000 200000
6. 使用nfs配置:
setenv bootargs root=nfs nfsroot=192.168.1.115:/source/rootfs ip=192.168.1.211 console=ttySAC0,115200 init=/linuxrc mem=64M
二、Linux 2.6.32.10在tq2440开发板上的移植
明确相关板级配置:
(1) CPU -- s3c2440, 外部晶振12M
(2) SDRAM -- 64MB
(3) Nand Flash -- 64MB[K9F1208] 或 256MB[K9F2G08]
(4) 网卡 -- DM9000, 映射在BANK4
0. 外部晶振频率修改
static void __init smdk2440_map_io(void)
{
s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
s3c24xx_init_clocks(16934400);
s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
}
=》
static void __init smdk2440_map_io(void)
{
s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
s3c24xx_init_clocks(12000000); //修改为12M
s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
}
1.修改nand flash分区:
arch/arm/plat-s3c24xx/common-smdk.c
(1)如果是256MB的Nand,按如下修改 [256MB -- 0x10000000]
/* NAND parititon from 2.4.18-swl5 */
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "BootLoader",
.size = 0x00060000, /* 3 Blocks -- 384K*/
.offset = 0,
},
[1] = {
.name = "Kernel",
.size = 0x00400000, /* 32 Blocks -- 4MB */
.offset = 0x00080000,
},
[2] = {
.name = "Rootfs",
.size = 0x0FB80000, /* 251MB + 512KB*/
.offset = 0x00480000,
}
};
如果是256MB的Nand,使用uboot擦出分区命令如下:
//Erase Kernel Partition
nand erase 80000 400000
//Erase Rootfs Partition
nand erase 480000 FB80000
(2) 如果是64MB的Nand,按如下修改 [64MB -- 0x4000000]
/* NAND parititon from 2.4.18-swl5 */
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "BootLoader",
.size = 0x00060000, /* 24 Blocks -- 384K*/
.offset = 0,
},
[1] = {
.name = "Kernel",
.size = 0x00400000, /* 256 Blocks -- 4MB */
.offset = 0x00080000,
},
[2] = {
.name = "Rootfs",
.size = 0x03B80000, /* 59MB + 512KB*/
.offset = 0x00480000,
}
};
如果是64MB的Nand,使用uboot擦出分区命令如下:
//Erase Kernel Partition
nand erase 80000 400000
//Erase Rootfs Partition
nand erase 480000 3B80000
2. yaffs2补丁:
./patch-ker.sh c ../linux-2.6.32.10
3. DM9000网络驱动移植
(1)
arch/arm/mach-s3c2440/mach-smdk2440.c
增加
#include <linux/dm9000.h>
/* DM9000 */
static struct resource s3c_dm9k_resource[] = {
[0] = {
.start = S3C2410_CS4,
.end = S3C2410_CS4 + 3,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = S3C2410_CS4 + 4,
.end = S3C2410_CS4 + 4 + 3,
.flags = IORESOURCE_MEM,
},
[2] = {
.start = IRQ_EINT7,
.end = IRQ_EINT7,
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
}
};
static struct dm9000_plat_data s3c_dm9k_platdata = {
.flags = DM9000_PLATF_16BITONLY,
};
struct platform_device s3c_device_dm9000 = {
.name = "dm9000",
.id = 0,
.num_resources = ARRAY_SIZE(s3c_dm9k_resource),
.resource = s3c_dm9k_resource,
.dev = {
.platform_data = &s3c_dm9k_platdata,
}
};
(2)
static struct platform_device *smdk2440_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
#ifdef CONFIG_DM9000
&s3c_device_dm9000,
#endif
};