亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1468 | 回復(fù): 0
打印 上一主題 下一主題

移植內(nèi)核之nandflash驅(qū)動 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2011-12-21 08:41 |只看該作者 |倒序瀏覽
移植內(nèi)核之nandflash驅(qū)動

     這只是作者本人的學(xué)習(xí)筆跡,所以沒有什么格式規(guī)范可言,時間緊迫,盡請諒解。
移植步驟如下:

  1 機(jī)器碼

     為自己的開發(fā)板設(shè)定一個機(jī)器碼,添加在/arch/arm/tools/mach_types文件中

ut6410          MACH_UT6410         UT6410          1626

可以說隨便設(shè)為什么數(shù)字,但是一定要和你uboot include/asm-arm/mach-types.h設(shè)定

的機(jī)器碼匹配

   2 復(fù)制 mach-s3c6410.c

      Cp mach-s3c6410.c mach-ut6410.c

  Mach-ut6410.c要修改的地方很多,會在后面詳細(xì)講解。

  

修改arch/arm/mach-s3c6410/下的Kconfig、Makefile

Vim Kconfig 加入配置選項:

config MACH_UT6410

    bool "UT6410"

    select CPU_S3C6410

    select S3C_DEV_HSMMC

    select S3C_DEV_HSMMC1

    select S3C_DEV_I2C1

    select S3C_DEV_FB

    select S3C_DEV_USB_HOST

    select S3C_DEV_USB_HSOTG

    select S3C6410_SETUP_SDHCI

    select S3C64XX_SETUP_I2C1

    select S3C64XX_SETUP_FB_24BPP

    help

      Machine support for the UT6410, Modified by CJOK

 

Vim Makefile 加入:

 obj-$(CONFIG_MACH_UT6410)   += mach-ut6410.o

 

4 復(fù)制配置文件

   Cp arch/arm/config/s3c6400_defconfig .config

   如果找不到本芯片的配置文件,就找與本芯片型號相近的配置文件

   *****配置文件不對,在編譯的時候可能會出現(xiàn)error!

5 修改mach-ut6410.c

  Vim mach-ut6410.c

  vim命令行輸入:

    %s/smdk6410/ut6410/g

    作用是把smdk6410全部替換為ut6410

 

6 mach-ut6410.c加入nandflash分區(qū)信息以及驅(qū)動

 

加入必要的頭文件

> #include <linux/mtd/mtd.h>

> #include <linux/mtd/nand.h>

> #include <linux/mtd/nand_ecc.h>

> #include <linux/mtd/partitions.h>

> #include <plat/nand.h>

 

加入分區(qū)信息

> /* modified by CJOK */

> static struct mtd_partition ut6410_default_nand_part[] __initdata = {

>   [0] = {

>          .name    = "u-boot",

>          .size       = 0x40000,

>          .offset    = 0,

>   },

>   [1] = {

>          .name    = "kernel",

>          .size       = 0x3c0000,

>          .offset    = 0x40000,

>   },

>   [2] = {

>          .name    = "rootfs",

>          .size       = 0x5000000,

>          .offset    = 0x400000,

>   },

>   [3] = {

>          .name    = "file system",

>          .size       = 0xac00000,

>          .offset    = 0x5400000,

>   },

> };

>

> static struct s3c2410_nand_set ut6410_nand_sets[] __initdata = {

>   [0] = {

>          .name           = "nand",

>          .nr_chips       = 1,

>          .nr_partitions       = ARRAY_SIZE(ut6410_default_nand_part),

>          .partitions     = ut6410_default_nand_part,

>          .flash_bbt     = 1, /* we use u-boot to create a BBT */

>   },

> };

>

> static struct s3c2410_platform_nand ut6410_nand_info __initdata = {

>   .tacls             = 25,         

>   .twrph0         = 55,

>   .twrph1         = 40,

>   .nr_sets = ARRAY_SIZE(ut6410_nand_sets),

>   .sets             = ut6410_nand_sets,

>   .ignore_unset_ecc = 1,

> };

 

Tacls,twrph0,twrph1是根據(jù)S3C6410資料得到,具體怎么得來的,還望高手能指點,

上面的數(shù)據(jù)是參考網(wǎng)友的。

 

在結(jié)構(gòu)體static struct platform_device *ut6410_devices[] __initdata 中加入

&s3c_device_nand,

 

在函數(shù)static void __init ut6410_map_io(void)中加入

s3c_device_nand.dev.platform_data = &ut6410_nand_info;

 

在函數(shù)static void __init ut6410_machine_init(void)中加入

s3c_fb_set_platdata(&ut6410_nand_info);

 

修改:> MACHINE_START(UT6410, "UT6410 modified by CJOK")

 

基本上nandflash就只要添加這么多信息

 

7 配置內(nèi)核

  Make menuconfig ARCH=arm CROSS_COMPILE=arm-linux-

  添加對nandflash的支持:

  Device Drivers  ---> 

     <*> Memory Technology Device (MTD) support  --->

           [*]   MTD partitioning support

           <*>   NAND Device Support  ---> 

                    <*>   NAND Flash support for Samsung S3C SoCs   

           <*>   Caching block device access to MTD devices                

  添加對NFS支持

  [*] Networking support  --->   

        Networking options  --->    

            [*] TCP/IP networking 

            [*]   IP: kernel level autoconfiguration

  選上自己配置的芯片類型

   System Type  ---> 

        [*] UT6410    

   是不是覺得很眼熟,對,就是我們剛剛第3步修改Kconfig得到的

 

8編譯燒寫到開發(fā)板上

  Make zImage CROSS_COMPILE=arm-linux- ARCH=arm

  啟動信息:

   ………………………………………………………………………………………….

   Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":

0x000000000000-0x000000040000 : "u-boot"

0x000000040000-0x000000400000 : "kernel"

0x000000400000-0x000005400000 : "rootfs"

0x000005400000-0x000010000000 : "file system"

mice: PS/2 mouse device common for all mice

i2c /dev entries driver

sdhci: Secure Digital Host Controller Interface driver

sdhci: Copyright(c) Pierre Ossman

TCP cubic registered

VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5

VFS: Cannot open root device "mtdblock2" or unknown-block(31,2)

Please append a correct "root=" boot option; here are the available partitions:

1f00             256 mtdblock0 (driver?)

1f01            3840 mtdblock1 (driver?)

1f02           81920 mtdblock2 (driver?)

1f03          176128 mtdblock3 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)

[<c0029a24>] (unwind_backtrace+0x0/0xd8) from [<c0239064>] (panic+0x40/0x10c)

[<c0239064>] (panic+0x40/0x10c) from [<c0008fec>] (mount_block_root+0x1cc/0x20c)

[<c0008fec>] (mount_block_root+0x1cc/0x20c) from [<c0009280>] (prepare_namespace+0x160/0x1b8)

[<c0009280>] (prepare_namespace+0x160/0x1b8) from [<c00085b8>] (kernel_init+0xd8/0x10c)

[<c00085b8>] (kernel_init+0xd8/0x10c) from [<c0024e14>] (kernel_thread_exit+0x0/0x8)

 

額,出現(xiàn)了KERNEL PANIC,不要緊張

有三種情況:

a   MTD分區(qū)與bootloader不匹配

b   沒有devfs文件系統(tǒng)支持

c   ECC校驗沒有關(guān)閉

 

 

終于看到了分區(qū)信息,nandflash驅(qū)動OK

 

可能遇到的問題:

問題一:

下載到板子上,發(fā)現(xiàn)如下問題,此問題郁悶我最久,

…………………………………..

CPU: Testing write buffer coherency: ok

s3c6400-nand: failed to claim resource 0

WARNING: at drivers/base/core.c:130 device_release+0x70/0x84()

…………………………………………………….

------------[ cut here ]------------

WARNING: at drivers/base/core.c:130 device_release+0x70/0x84()

Device 's3c64xx-rtc' does not have a release() function, it is broken and must be fixed.

Modules linked in:

……………………………………………………….

 

 

解決方法就是修改arch./arm/plat-samsung/dev-nand.c 中的

static struct resource s3c_nand_resource[] = {

    [0] = {

              .start = S3C_PA_NAND,

              .end  = S3C_PA_NAND + SZ_1M -1,

              .flags = IORESOURCE_MEM,

      }

};

.end  = S3C_PA_NAND + SZ_1M-1,  減去一就行了

 

問題二:

……………………………………………………..

end_request: I/O error, dev mtdblock2, sector 16

Buffer I/O error on device mtdblock2, logical block 2

uncorrectable error :

uncorrectable error :

end_request: I/O error, dev mtdblock2, sector 24

Buffer I/O error on device mtdblock2, logical block 3

uncorrectable error :

uncorrectable error :

end_request: I/O error, dev mtdblock2, sector 24

Buffer I/O error on device mtdblock2, logical block 3

List of all partitions:

1f00             256 mtdblock0 (driver?)

1f01            3840 mtdblock1 (driver?)

1f02           81920 mtdblock2 (driver?)

1f03          176128 mtdblock3 (driver?)

No filesystem could mount root, tried:  cramfs

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)

[<c0029974>] (unwind_backtrace+0x0/0xd8) from [<c0244584>] (panic+0x40/0x10c)

[<c0244584>] (panic+0x40/0x10c) from [<c0008fec>] (mount_block_root+0x1cc/0x20c

 

解決辦法:

1、drivers/mtd/nand/s3c2410.c的函數(shù)s3c2410_nand_init_chip中的

NAND_ECC_SOFT修改為NAND_ECC_NONE

2、配置內(nèi)核時,不要選上NAND ECC

 

 





您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP