zoukankan      html  css  js  c++  java
  • 基于Tiny 6410的内核移植 (NAND FLASH 、UBIFS篇)

     

     

    一、环境

    1、开发板

    Tiny6410  NAND: 2G  RAM: 256M  MLC

    2、操作系统

    Ubuntu10

    3、交叉工具编译链

    arm-linux-gcc-4.5.1

     

    二、下载内核源码包

    linux-2.6.38

     

    三、解压内核

    tar  –jxvf  linux-2.6.38.tar.bz2 

    我解压的的路径是: 

     

     

    四、NAND FLASH移植

    1、修改Makefile

     vim  Makefile

     将约191行改为:   

    ARCH  ?   =   arm 

    CROSS_COMPILE  ?  =  arm-linux-    

     

    2cp  arch/arm/configs/s3c6400_defconfig  .config

       忽略这一步的话,后面会找不到System Type

     

    3make  menuconfig

     

    4、添加交叉工具编译链的目录

    General setup  --->

    (/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-) Cross-compiler too

      System Type  --->

    [*] MINI6410    (其余的可以去掉)

     

     

    这样编译出来的内核是可以被uboot引导的,然后是增加nand flash支持

    vi arch/arm/mach-s3c64xx/mach-mini6410.c
    117
    struct mtd_partition mini6410_nand_part[] = {
    {
    .name = "Bootloader",
    .offset = 0,
    .size = (4 * 128 *SZ_1K),
    .mask_flags = MTD_CAP_NANDFLASH,
    },
    {
    .name = "Kernel",
    .offset = (4 * 128 *SZ_1K),
    .size = (5*SZ_1M) ,
    .mask_flags = MTD_CAP_NANDFLASH,
    },
    {
    .name = "File System",
    .offset = MTDPART_OFS_APPEND,
    .size = MTDPART_SIZ_FULL,
    }
    }; //update at 2011-8-26 经过测试发现,这里改完后根本不起作用,甚至将整个注释也无妨,估计分区已经固死在后面的s3c_nand_mlc.fo中

     

     

    拷贝友善光盘的NDND FLASH 驱动

    drivers/mtd/nand/s3c_nand.c

    arch/arm/plat-samsung/include/plat/regs-nand.h

    drivers/mtd/nand/s3c_nand_mlc.fo

     

    然后修改drivers/mtd/nand/Kconfig和drivers/mtd/nand/Makefile文件

    drivers/mtd/nand/Kconfig  238行增加(注意:进格要用Tab键)

     

    config MTD_NAND_S3C
    tristate "NAND Flash support for S3C SoC"
    depends on (ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX) && 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 MTD_NAND_S3C_DEBUG
    bool "S3C NAND driver debug"
    depends on MTD_NAND_S3C
    help
    Enable debugging of the S3C NAND driver

    configMTD_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


    drivers/mtd/nand/Makefile中20行增加
    obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand.o

    末尾再增加
    S3C_NAND_MLC_SRC = $(shell ls drivers/mtd/nand/s3c_nand_mlc.c 2>/dev/null)
    ifeq ($(S3C_NAND_MLC_SRC),)
    obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand_mlc.fo
    else
    obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand_mlc.o
    endif

    然后再make menuconfig
    Device Drivers--->
    <*> Memory Technology Device (MTD) support --->
    [*] MTD partitioning support
    [*] Command line partition table parsing
    <*> Direct char device access to MTD devices
    <*> Caching block device access to MTD devices
    <*> NAND Device Support --->
    < > NAND Flash support for Samsung S3C SoCs 去掉不要选
    <*> NAND Flash support for S3C SoC
    [*] S3C NAND Hardware ECC

    make zImage

     

    五、内核添加UBIFS

    1、配置内核支持UBIFS

    Device Drivers  --->

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

    <*>   Enable UBI - Unsorted block images  --->

    2、配置MTD支持UBI接口

    File systems  --->

    [*] Miscellaneous filesystems  --->

    <*>   UBIFS file system support

    3make

    4、下载测试

     

     

    只要出现正常内核分区就说明nand 驱动可以用了。

  • 相关阅读:
    .NET Web应用配置本地IIS(实现Visual Studio离线运行与调试)
    Windows10 IIS Web服务器安装配置
    Visual Studio 2022 Preview设置简体中文
    nlp中各中文预训练模型的输入和输出
    numpy和Pytorch对应的数据类型
    Zookeeper入门看这篇就够了
    做一个有温度的程序员
    Apollo 配置中心详细教程
    浅析 DDD 领域驱动设计
    把之前CompletableFuture留下的坑给填上。
  • 原文地址:https://www.cnblogs.com/luxiaolai/p/2985144.html
Copyright © 2011-2022 走看看