Transplantation of linux-2.6.35 kernel -- Nandflash driver

Source: Internet
Author: User
Linux-2.6.35 kernel transplantation & mdash; Nandflash driver transplantation Nandflash is the most common external storage device in embedded systems. Here we introduce the Nandflash driver transplantation process. I. porting environment: 1. Ubuntu10.10 release version 2. u-boot.bin3, FS_S5PC100 flat...
Linux-2.6.35 kernel transplantation -- transplantation of Nand flash driver Nand flash is the most common external storage device in embedded systems. Here we introduce the transplantation process of Nand flash driver. A, porting environment: 1, Ubuntu 10.10 release version 2, u-boot.bin3, FS_S5PC100 platform 4, cross compiler: arm-cortex_a8-linux-gnueabi-gcc --------------------------------------------------------------------- 2, porting steps
The kernel of the linux-2.6.35.2 already contains the driver of the nand flash controller of the s3c2410, but we need to correctly configure it before it can work normally.
1, added for the FS_S5PC100 platform on the Nand flash drive copy initi_nand.c license copy regs-nand.h unzip arch/arm/mach-s5pc100/include/mach 2, for the FS_S5PC100 platform on the nand flash device, modify driver/mtd/nand/nand_base.c row 2,812nd www.2cto.com/* Read entire ID string */for (I = 0; I <8; I ++) is/* Read entire ID string */for (I = 0; I <5; I ++)
3. add the kernel configuration option to modify driver/mtd/nand/Kconfig and add the following content: config configure tristate "NAND Flash support for S3C Soc" depends on (arch_s364xx | ARCH_S5P64XX | ARCH_S5PC1XX | ARCH_S5PC100) & MTD_NAND help This enables the NAND flash controller on the S3C. no board specfic support is done by this driver, each board must advertise a platform_device for the driver to attach. config route bool "S3C NAND driver debug" depends on MTD_NAND_S3C help Enable debugging of the S3C NAND driver config route bool "S3C NAND Hardware ECC" depends on Route help www.2cto.com Enable the use of the S3C's internal ECC generator when using NAND. early versons 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, the you will currently not be able to switch to software, as there is no implementation for ECC method used by the S3C modify drivers/mtd/nand/Makefile to add the following content: obj-$ (CONFIG_MTD_NAND_S3C) + = initi_nand.o4, modify platform code modify arch/arm/mach-s5pc100/mach-smdkc100.c add the following content: add header file # if defined (CONFIG_MTD_NAND_S3C) # include # Include # Include # Endif add platform device/** Nand flash Support **/# if defined (CONFIG_MTD_NAND_S3C) static struct mtd_partition s5pc100_nand_part [] = {[0] = {. name = "bootloader ",. size = SZ_1M ,. offset = 0 ,}, [1] = {. name = "kernel ",. offset = MTDPART_OFS_APPEND ,. size = SZ_1M * 3,}, www.2cto.com [2] = {. name = "roorfs ",. offset = MTDPART_OFS_APPEND ,. size = SZ_1M * 100,}, [3] = {. name = "usrfs ",. offset = MTDPART_OFS_APPEND ,. size = MTDPART_SIZ_FULL,},}; struct }_nand_mtd_info s5pc100_nand_mtd_part_info = {. chip_nr = 1 ,. mtd_part_nr = ARRAY_SIZE (s5pc100_nand_part ),. partition = s5pc100_nand_part,}; static struct resource s5pc100_nand_resource [] = {[0] = {. start = 0xE7200000 ,. end = 0xE7200000 + SZ_1M ,. flags = IORESOURCE_MEM, },}; struct platform_device s5pc100_device_nand = {. name = "s5pc100-nand ",. id =-1 ,. num_resources = ARRAY_SIZE (s5pc100_nand_resource ),. resource = s5pc100_nand_resource ,. dev = {. platform_data = & s5pc100_nand_mtd_part_info, },}; # add the platform device list to the smdkc100_device [] struct array: # if defined (CONFIG_MTD_NAND_S3C) & s5pc100_device_nand, # endif www.2cto.com modify arch/arm/plat-samsung/include/plat/nand. h add the following content: struct jx_nand_mtd_info {uint chip_nr; uint mtd_part_nr; struct matd_partition * partition ;}; 5. configure the kernel $ make menuconfig to modify Device Drivers ---> <*> Memory Technology Device (MTD) support ---> [*] MTD partitioning support <*> Caching block device access to MTD devices <*> NAND Device Support ---> <*> NAND Flash support for S3C SoCs [*] S3C NAND Hardware ECC File System ---> Partition Types ---> [*] Advanced partitioin selection [*] pc bios (MSDOS partition tables) support [*] BSD disklabel (FreeBSD partition tables) support kernel 3. Compile the kernel and copy it to $ make zImage www.2cto.com $ cp arch/arm/boot/zImage/tftpboot kernel under tftpboot. 4. test the startup target board and view the system information: # cat/proc/mtddev: size erasesize namemtd0: 00100000 00020000 "bootloader" mtd1: 00300000 00020000 "kernel" mtd2: 00400000 00020000 "rootfs" mtd3: 0f800000 00020000 "usrfs" author lr_ting
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.