当前烧写:
fs:
nfs 30000000 192.168.1.17:/work/nfs_root/first_fs_mdev.yaffs2 //这里不能使用nfs挂载,只能直接烧写
nand erase.part root //原因是:内核还不支持dm9000c
nand write.yaffs 30000000 260000 $filesize
kernel:
nfs 30000000 192.168.1.17:/work/nfs_root/uImage_new //使用uboot对dm9000的支持,这里可以使用uboot的nfs斧王
bootm 30000000
移植内核linux-3.4.2对dm9000c的支持,目的是用nfs挂载根文件系统
1. 编译
2. 解决错误
2.1 头文件不对:去掉或者改名
2.2 宏不对:改名或者使用新宏
2.3 有些函数不用了:改名或者使用新函数
当前内核里面有dm9000,启动内核和根文件系统后
1、设置ip
#ifconfig eth0 192.168.1.3
#ping 192.168.1.17
ping通服务器后,挂机文件系统的方法是:
mount -t nfs -o nolock,vers=2 192.168.1.17:/work/nfs_root/fs_mini_mdev_new /mnt
mini2440已经支持了自带的dm9000
其入口函数是:
platform_driver_register(&dm9000_driver);
platform_driver dm9000_driver = {
dm9000_probe
platform_device mini2440_device_eth
platform_device *mini2440_devices[]
platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
数组mini2440_devices[]被注册到内核里面了
我们使用的mach-smdk2440里面没有
/* DM9000AEP 10/100 ethernet controller */
static struct resource mini2440_dm9k_resource[] = {
[0] = {
.start = MACH_MINI2440_DM9K_BASE,
.end = MACH_MINI2440_DM9K_BASE + 3,
.flags = IORESOURCE_MEM
},
[1] = {
.start = MACH_MINI2440_DM9K_BASE + 4,
.end = MACH_MINI2440_DM9K_BASE + 7,
.flags = IORESOURCE_MEM
},
[2] = {
.start = IRQ_EINT7,
.end = IRQ_EINT7,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
}
};
/*
* The DM9000 has no eeprom, and it's MAC address is set by
* the bootloader before starting the kernel.
*/
static struct dm9000_plat_data mini2440_dm9k_pdata = {
.flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};
static struct platform_device mini2440_device_eth = {
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(mini2440_dm9k_resource),
.resource = mini2440_dm9k_resource,
.dev = {
.platform_data = &mini2440_dm9k_pdata,
},
};
所以在mach-smdk2440.c里面添加:
//add by Flinn for dm9000
#define MACH_smdk2440_DM9K_BASE (S3C2410_CS4 + 0x300)
/* DM9000AEP 10/100 ethernet controller */
static struct resource smdk2440_dm9k_resource[] = {
[0] = {
.start = MACH_smdk2440_DM9K_BASE,
.end = MACH_smdk2440_DM9K_BASE + 3,
.flags = IORESOURCE_MEM
},
[1] = {
.start = MACH_smdk2440_DM9K_BASE + 4,
.end = MACH_smdk2440_DM9K_BASE + 7,
.flags = IORESOURCE_MEM
},
[2] = {
.start = IRQ_EINT7,
.end = IRQ_EINT7,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
}
};
/*
* The DM9000 has no eeprom, and it's MAC address is set by
* the bootloader before starting the kernel.
*/
static struct dm9000_plat_data smdk2440_dm9k_pdata = {
.flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};
static struct platform_device smdk2440_device_eth = {
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(smdk2440_dm9k_resource),
.resource = smdk2440_dm9k_resource,
.dev = {
.platform_data = &smdk2440_dm9k_pdata,
},
};
编译出错:
arch/arm/mach-s3c24xx/mach-smdk2440.c:186: error: variable 'smdk2440_dm9k_pdata' has initializer but incomplete type
因为缺少头文件
#include <linux/dm9000.h>