宿主机:ubuntu10.04
目标机:fl2440
交叉编译器:arm-linux-gcc-3.4.1
交叉编译器路径:/usr/local/arm/3.4.1
要移植的内核版本:linux-2.6.33.19
<1>移植yaffs2驱动
yaffs下载地址:http://www.aleph1.co.uk/cgi-bin/viewcvs.cgi
tar zxvf yaffs2.tar.gz
cd yaffs2
./patch-ker.sh c /linux-2.6.33.19
<2>修改机器码
s3c2410 ARCH_S3C2410 S3C2410 193 删掉
s3c2440 ARCH_S3C2440 S3C2440 362
修改为
s3c2440 ARCH_S3C2440 S3C2440 193
<3> 指定编译器
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
<4>增加devfs文件器支持
找到 menu "Pseudo filesystems"
大概在105行
config DEVFS_FS
bool "/dev file system support (OBSOLETE)"
default y
config DEVFS_MOUNT
bool "Automatically mount at boot"
default y
depends on DEVFS_FS
<5>修改晶振频率
arch/arm/mach-s3c2440/mach-smdk2440.c
s3c24xx_init_clocks(12000000);
<6>修改MTD分区
arch/arm/plat-s3c24xx/common-smdk.c
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "boot",
.size = 0x00020000,
.offset = 0
},
[1] = {
.name = "bootParam",
.size = 0x00060000,
.offset = 0x00020000,
},
[2] = {
.name = "Kernel",
.size = 0x00300000,
.offset = 0x00500000,
},
[3] = {
.name = "fs_yaffs",
.size = 0x03c00000,
.offset = 0x00800000,
},
[4] = {
.name = "eboot",
.size = 0x00080000,
.offset = 0x04400000,
},
[5] = {
.name = "WINCE",
.size = 0x03b80000,
.offset = 0x04480000,
}
};
<7>关闭ECC校验
drivers/mtd/nand/s3c2410.c
chip->ecc.mode = NAND_ECC_NONE;
<8>修改nandflash驱动,支持K9F1G08的nandflash
修改drivers/mtd/nand下面的nand_bbt.c文件:
static struct nand_bbt_descr largepage_memorybased = {
.options = 0,
.offs = 0,
.len = 1, // 原数值为2,支持2K每页的flash修改为1。K9F1G08,K9F2G08是2k每页的flash
.pattern = scan_ff_pattern
};
static struct nand_bbt_descr largepage_flashbased = {
.options = NAND_BBT_SCAN2NDPAGE,
.offs = 0,
.len = 1, //原数值为2,支持2K每页的flash修改为1。K9F1G08,K9F2G08是2k每页的flash
.pattern = scan_ff_pattern
};
<9>开始配置内核
make s3c2410_defconfig
去掉S3C2400 Machines、S3C2410 Machines、S3C2412 Machines、S3C2442 Machines的所有选项,否则会报错。如果现在编译内核,下载到开发板中,内核就可以正常启动了。呵呵,有了雏形,咱们继续移植设备驱动
<10>支持RTC
arch/arm/mach-s3c2440/mach-smdk2440.c
static struct platform_device *smdk2440_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&s3c_device_rtc,
};
<11>移植UDA1341
arch/arm/mach-s3c2440/mach-smdk2440.c
添加头文件
#include 添加代码 static struct s3c24xx_uda134x_platform_data s3c24xx_uda134x_data = { static struct platform_device s3c24xx_uda134x = { 把设备添加到平台当中 static struct platform_device *smdk2440_devices[] __initdata = { <12>移植DM9000 修改 drivers/net/dm9000.c 文件 #include 在dm9000_probe 函数开始增加: unsigned char ne_def_eth_mac_addr[]={0x00,0x12,0x34,0x56,0x80,0x49}; 在这个函数的最后需要修改: if (!is_valid_ether_addr(ndev->dev_addr)) { 2. 修改arch/arm/mach-s3c2440/mach-smdk2440.c,添加设备 static struct platform_device *smdk2440_devices[] __initdata = { &s3c_device_rtc, 3. 修改 arch/arm/plat-s3c24xx/devs.c #include static struct resource s3c_dm9000_resource[] = {
#include
.l3_clk = S3C2410_GPB(4),
.l3_data = S3C2410_GPB(3),
.l3_mode = S3C2410_GPB(2),
.model = UDA134X_UDA1341,
};
.name = "s3c24xx_uda134x",
.dev = {
.platform_data = &s3c24xx_uda134x_data,
}
};
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&s3c_device_rtc,
&s3c24xx_uda134x,
};
#include
#include
static void *bwscon;
static void *gpfcon;
static void *extint0;
static void *intmsk;
#define BWSCON (0x48000000)
#define GPFCON (0x56000050)
#define EXTINT0 (0x56000088)
#define INTMSK (0x4A000008)
bwscon=ioremap_nocache(BWSCON,0x0000004);
gpfcon=ioremap_nocache(GPFCON,0x0000004);
extint0=ioremap_nocache(EXTINT0,0x0000004);
intmsk=ioremap_nocache(INTMSK,0x0000004);
writel(readl(bwscon)|0xc0000,bwscon);
writel( (readl(gpfcon) & ~(0x3 << 14)) | (0x2 << 14), gpfcon);
writel( readl(gpfcon) | (0x1 << 7), gpfcon); // Disable pull-up
writel( (readl(extint0) & ~(0xf << 28)) | (0x4 << 28), extint0); //rising edge
writel( (readl(intmsk)) & ~0x80, intmsk);
mac_src = "chip";
for (i = 0; i < 6; i++)
//ndev->dev_addr[i] = ior(db, i+DM9000_PAR);
ndev->dev_addr[i] = ne_def_eth_mac_addr[i];
}
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&s3c24xx_uda134x,
&s3c_device_dm9000,
};
[0] = {
.start = S3C24XX_PA_DM9000,
.end = S3C24XX_PA_DM9000+ 0x3,
.flags = IORESOURCE_MEM
},
[1]={
.start = S3C24XX_PA_DM9000 + 0x4, //CMD pin is A2
.end = S3C24XX_PA_DM9000 + 0x4 + 0x7c,
.flags = IORESOURCE_MEM
},
[2] = {
.start = IRQ_EINT7,
.end = IRQ_EINT7,
.flags = IORESOURCE_IRQ
},
};
相关文章