加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

6410 nandflash 移植

发布时间:2020-12-15 18:08:26 所属栏目:百科 来源:网络整理
导读:原文地址:http://www.arm9home.net/read.php?tid-14196-fpage-2.html 1、下载linux-2.6.38的源码, ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.bz2 2、解压 tar xvfj /mnt/ubuntu/linux-2.6.38.tar.bz2 -C . 3、 在工作目录下初始化代码

原文地址:http://www.arm9home.net/read.php?tid-14196-fpage-2.html

1、下载linux-2.6.38的源码,ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.bz2

2、解压 tar xvfj /mnt/ubuntu/linux-2.6.38.tar.bz2 -C .

3、在工作目录下初始化代码库(创建代码库):

git init

再在/home/git_res当前目录下使用命令把当前目录下所有文件提交到临时区域:

git add –A

再把刚才添加的所有文件提交到代码库中:

git commit –m “initial”

4、vi Makefile?????? 191行改为????ARCH?????????????= arm
5、cp arch/arm/configs/s3c6400_defconfig .config
6、make menuconfig

General setup->(/usr/4.5.1/bin/arm-linux-) Cross-compiler tool prefix????我将编译器解压到了/usr/4.5.1目录
?????? System Type->[*] MINI6410?? 选上,其他的可以去掉,不确定的可以参考友善之臂的

7.这样编译出来的内核是可以被uboot引导的,然后是增加nand flash支持
vi arch/arm/mach-s3c64xx/mach-mini6410.c

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

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/nand_base.c文件
修改方法如下,“-”就是要去掉的内容,“+”就是要增加的内容,@@后面的是行号,
嫌麻烦的的直接将drivers/mtd/nand/nand_base.c拷过来覆盖掉

8.修改Kconfig和Makefile

1》然后修改drivers/mtd/nand/Kconfig和drivers/mtd/nand/Makefile文件
在drivers/mtd/nand/Kconfig??238行增加
config MTD_NAND_S3C
。。。。。。
config MTD_NAND_S3C_DEBUG
configMTD_NAND_S3C_HWECC
2》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
3》然后再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

编译出来了,只要出现正常内核分区就说明nand 驱动可以用了,若想看见文件系统,请看连载二NFS。


--------------------------------------------------------------------------------------------------------

VFS: Cannot open root device "ubi0:FriendlyARM-root" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00            4096 mtdblock0  (driver?)
1f01            8192 mtdblock1  (driver?)
1f02         2084864 mtdblock2  (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[<c002ac04>] (unwind_backtrace+0x0/0xe4) from [<c01aad10>] (panic+0x50/0x16c)
[<c01aad10>] (panic+0x50/0x16c) from [<c0008ea8>] (mount_block_root+0x238/0x288)
[<c0008ea8>] (mount_block_root+0x238/0x288) from [<c00090e0>] (prepare_namespace+0x88/0x1b4)
[<c00090e0>] (prepare_namespace+0x88/0x1b4) from [<c0008b2c>] (kernel_init+0x108/0x148)
[<c0008b2c>] (kernel_init+0x108/0x148) from [<c0026508>] (kernel_thread_exit+0x0/0x8)


 
 
配置内核支持UBIFS

make menuconfig
Device Drivers ?--->
<*> Memory Technology Device (MTD) support ?--->
<*> ? Enable UBI - Unsorted block images ?---> ?
配置mtd支持UBI接口
File systems ?--->?
[*] Miscellaneous filesystems ?--->
<*> ? UBIFS file system support?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读