linux3.0 nand分区,OK6410(256MRAM2Gnandflash) Linux3.0.1内核移植

这里我主要移植的是增加yaffs2文件系统支持,修改和移植nand驱动。

1.不知道为什么我这yaffs2的补丁打上了就没发现过编译错误,相当顺利啊 呵呵。

附上补丁地址-----------------------------------点击打开链接

修改补丁里patch‐ker.sh 文件。

屏蔽下面这段代码。

# Can we handle this version?

#if [ $VERSION ‐ne 2 ‐o $PATCHLEVEL ‐lt 6 ]

#then

# echo "Cannot patch kernel version $VERSION.$PATCHLEVEL.$SUBLEVEL, must be 2.6.x

or higher"

# exit 1;

#fi

然后直接./patch-ker.sh c m -----(内核源码路径)

2.修改顶层makefile 的arch 和交叉编译器cross_compile

3.复制配置文件smdk6400_defconfig,为smdk6410_defconfig

由于配置文件太长,详见这个下载这个配置文档————————点击打开链接,关于配置的问题就不再提了

4.nand支持部分

修改/file/linuxj/arch/arm/mach-s3c64xx/mach-smdk6410.c 若没有这个文件就复制mach-smdk6400.c

1)添加头文件

#include

#include

#include

2)添加分区配置

/*

* Configuring Nandflash on SMDK6410

*/

struct mtd_partition ok6410_nand_part[] = {

{

.name  = "Bootloader",

.offset  = 0,

.size  = (1 * SZ_1M),

.mask_flags = MTD_CAP_NANDFLASH,

},

{

.name  = "Kernel",

.offset  = (1 * SZ_1M),

.size  = (5*SZ_1M) ,

.mask_flags = MTD_CAP_NANDFLASH,

},

/*

{

.name  = "User",

.offset  = (6 * SZ_1M),

.size  = (120*SZ_1M) ,

},

*/

{

.name  = "File System",

.offset  = MTDPART_OFS_APPEND,

.size  = MTDPART_SIZ_FULL,

}

};

static struct s3c2410_nand_set ok6410_nand_sets[] = {

[0] = {

.name       = "nand",

.nr_chips   = 1,

.nr_partitions  = ARRAY_SIZE(ok6410_nand_part),

.partitions = ok6410_nand_part,

},

};

static struct s3c2410_platform_nand ok6410_nand_info = {

.tacls      = 25,

.twrph0     = 55,

.twrph1     = 40,

.nr_sets    = ARRAY_SIZE(ok6410_nand_sets),

.sets       = ok6410_nand_sets,

};

在platform_device *smdk6410_devices[] __initdata里面添加&s3c_device_nand

#ifdef CONFIG_REGULATOR

&smdk6410_b_pwr_5v,

#endif

&smdk6410_lcd_powerdev,

&smdk6410_smsc911x,

&s3c_device_adc,

&s3c_device_nand,

在smdk6410_machine_init(void)里面添加

s3c_nand_set_platdata(&ok6410_nand_info);

3)nand驱动支持

1.去网上下个开源的S3C_nand.c源码或者到这里下载----------------------点击打开链接

2.当然只这样拷贝了对内核来说不起任何作用,内核根本不会去编译它,所以现在需要

修改drivers/mtd/nand/目录下的配置文件Kconfig和Makfile告知内核来编译s3c_nand.c驱

动程序文件。

在Kconfig中添加如下信息,这样在内核配置的menuconfig中就能看到选项了:

config MTD_NAND_S3C

tristate "NAND support for Samsung S3C"

depends on (ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX) && MTD_NAND

help

This enables the NAND flash controller on the S3C

No board specific support is done by this driver, each board

must advertise a platform_device for the driver to attach.

config MTD_NAND_S3C_DEBUG

bool "S3C NAND driver debug"

depends on MTD_NAND_S3C

help

Enable debugging of the S3C NAND driver

config MTD_NAND_S3C_HWECC

bool "S3C NAND Hardware ECC"

depends on MTD_NAND_S3C

help

Enable the use of the S3C's internal ECC generator when

using NAND. Early versions of the chip have had problems with

incorrect ECC generation, and if using these, the default of

software ECC is preferable.

If you lay down a device with the hardware ECC, then you will

currently not be able to switch to software, as there is no

implementation for ECC method used by the S3C

.3.然后在Makefile中添加如下信息:

obj-$(CONFIG_MTD_NAND_S3C)        += s3c_nand.o

4.因为还没有给6410的nand flash寄存器定义,但是在s3c_nand中使用了,所以编译会有很多未定义错误

主要是在arch/arm/plat-samsung/include/plat/regs-nand.h添加

/* for s3c_nand.c */

#define S3C_NFCONF  S3C2410_NFREG(0x00)

#define S3C_NFCONT  S3C2410_NFREG(0x04)

#define S3C_NFCMMD  S3C2410_NFREG(0x08)

#define S3C_NFADDR  S3C2410_NFREG(0x0c)

#define S3C_NFDATA8  S3C2410_NFREG(0x10)

#define S3C_NFDATA  S3C2410_NFREG(0x10)

#define S3C_NFMECCDATA0  S3C2410_NFREG(0x14)

#define S3C_NFMECCDATA1  S3C2410_NFREG(0x18)

#define S3C_NFSECCDATA  S3C2410_NFREG(0x1c)

#define S3C_NFSBLK  S3C2410_NFREG(0x20)

#define S3C_NFEBLK  S3C2410_NFREG(0x24)

#define S3C_NFSTAT  S3C2410_NFREG(0x28)

#define S3C_NFMECCERR0  S3C2410_NFREG(0x2c)

#define S3C_NFMECCERR1  S3C2410_NFREG(0x30)

#define S3C_NFMECC0  S3C2410_NFREG(0x34)

#define S3C_NFMECC1  S3C2410_NFREG(0x38)

#define S3C_NFSECC  S3C2410_NFREG(0x3c)

#define S3C_NFMLCBITPT  S3C2410_NFREG(0x40)

#define S3C_NF8ECCERR0  S3C2410_NFREG(0x44)

#define S3C_NF8ECCERR1  S3C2410_NFREG(0x48)

#define S3C_NF8ECCERR2  S3C2410_NFREG(0x4c)

#define S3C_NFM8ECC0  S3C2410_NFREG(0x50)

#define S3C_NFM8ECC1  S3C2410_NFREG(0x54)

#define S3C_NFM8ECC2  S3C2410_NFREG(0x58)

#define S3C_NFM8ECC3  S3C2410_NFREG(0x5c)

#define S3C_NFMLC8BITPT0 S3C2410_NFREG(0x60)

#define S3C_NFMLC8BITPT1 S3C2410_NFREG(0x64)

#define S3C_NFCONF_NANDBOOT (1<<31)

#define S3C_NFCONF_ECCCLKCON (1<<30)

#define S3C_NFCONF_ECC_MLC (1<<24)

#define S3C_NFCONF_ECC_1BIT (0<<23)

#define S3C_NFCONF_ECC_4BIT (2<<23)

#define S3C_NFCONF_ECC_8BIT (1<<23)

#define S3C_NFCONF_TACLS(x) ((x)<<12)

#define S3C_NFCONF_TWRPH0(x) ((x)<<8)

#define S3C_NFCONF_TWRPH1(x) ((x)<<4)

#define S3C_NFCONF_ADVFLASH (1<<3)

#define S3C_NFCONF_PAGESIZE (1<<2)

#define S3C_NFCONF_ADDRCYCLE (1<<1)

#define S3C_NFCONF_BUSWIDTH (1<<0)

#define S3C_NFCONT_ECC_ENC (1<<18)

#define S3C_NFCONT_LOCKTGHT (1<<17)

#define S3C_NFCONT_LOCKSOFT (1<<16)

#define S3C_NFCONT_MECCLOCK (1<<7)

#define S3C_NFCONT_SECCLOCK (1<<6)

#define S3C_NFCONT_INITMECC (1<<5)

#define S3C_NFCONT_INITSECC (1<<4)

#define S3C_NFCONT_nFCE1 (1<<2)

#define S3C_NFCONT_nFCE0 (1<<1)

#define S3C_NFCONT_INITECC (S3C_NFCONT_INITSECC | S3C_NFCONT_INITMECC)

#define S3C_NFSTAT_ECCENCDONE (1<<7)

#define S3C_NFSTAT_ECCDECDONE (1<<6)

#define S3C_NFSTAT_BUSY  (1<<0)

#define S3C_NFECCERR0_ECCBUSY (1<<31)

OK移植先告一段落,移植预告 后期主要添加串口驱动 usb驱动

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值