Chinaunix首页 | 论坛 | 博客
  • 博客访问: 673485
  • 博文数量: 404
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 1237
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-03 10:45
文章分类

全部博文(404)

文章存档

2017年(1)

2016年(27)

2015年(39)

2014年(55)

2013年(66)

2012年(216)

分类: 嵌入式

2014-09-23 22:42:37

原文地址:http://blog.csdn.net/mr_raptor/article/details/8250819

本文章主要针对FS100,S5PC100的Android4.0.4 Yaffs2文件系统移植过程,对于类似Android系统或类似Linux内核(版本高于2.6.35)有参考意义。

本文分两部分:


  1. Nandflash驱动移植
  2. Yaffs2文件系统移植


一、Nandflash驱动移植

由于内核里面没有S5PC100的Nandflash驱动,所以,我们将Nandflash的驱动文件拷贝到内核目录中:

将s3c_nand.c拷贝到:drivers/mtd/nand/中(s3c_nand.c放到了空间共享里了:)。

Nand驱动修改位置:

1. 添加Nand物理地址

@arch/arm/mach-s5pc100/include/mach/map.h

添加如下内容:


  1. // MichaelTang add for Nandflash start
  2. /* NAND flash controller */
  3. #define S5PC1XX_PA_NAND (0xE7200000)
  4. #define S5PC1XX_SZ_NAND SZ_1M
  5. // MichaelTang add for Nandflash end ----



2. 添加一个新的头文件:

@arch/arm/mach-s5pc100/include/mach/nand.h


  1. #ifndef __MACH_NAND_H
  2. #define __MACH_NAND_H
  3. #include
  4. struct s3c_nand_mtd_info {
  5. uint chip_nr;
  6. uint mtd_part_nr;
  7. struct mtd_partition *partition;
  8. };
  9. #endif



3. 修改寄存器头文件


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

在regs-nand.h中添加如下宏:


  1. // MichaelTang add for nand reg start
  2. /* for s3c_nand.c */
  3. #define S3C_NFCONF S3C2410_NFREG(0x00)
  4. #define S3C_NFCONT S3C2410_NFREG(0x04)
  5. #define S3C_NFCMMD S3C2410_NFREG(0x08)
  6. #define S3C_NFADDR S3C2410_NFREG(0x0c)
  7. #define S3C_NFDATA8 S3C2410_NFREG(0x10)
  8. #define S3C_NFDATA S3C2410_NFREG(0x10)
  9. #define S3C_NFMECCDATA0 S3C2410_NFREG(0x14)
  10. #define S3C_NFMECCDATA1 S3C2410_NFREG(0x18)
  11. #define S3C_NFSECCDATA S3C2410_NFREG(0x1c)
  12. #define S3C_NFSBLK S3C2410_NFREG(0x20)
  13. #define S3C_NFEBLK S3C2410_NFREG(0x24)
  14. #define S3C_NFSTAT S3C2410_NFREG(0x28)
  15. #define S3C_NFMECCERR0 S3C2410_NFREG(0x2c)
  16. #define S3C_NFMECCERR1 S3C2410_NFREG(0x30)
  17. #define S3C_NFMECC0 S3C2410_NFREG(0x34)
  18. #define S3C_NFMECC1 S3C2410_NFREG(0x38)
  19. #define S3C_NFSECC S3C2410_NFREG(0x3c)
  20. #define S3C_NFMLCBITPT S3C2410_NFREG(0x40)
  21. #define S3C_NF8ECCERR0 S3C2410_NFREG(0x44)
  22. #define S3C_NF8ECCERR1 S3C2410_NFREG(0x48)
  23. #define S3C_NF8ECCERR2 S3C2410_NFREG(0x4C)
  24. #define S3C_NFM8ECC0 S3C2410_NFREG(0x50)
  25. #define S3C_NFM8ECC1 S3C2410_NFREG(0x54)
  26. #define S3C_NFM8ECC2 S3C2410_NFREG(0x58)
  27. #define S3C_NFM8ECC3 S3C2410_NFREG(0x5C)
  28. #define S3C_NFMLC8BITPT0 S3C2410_NFREG(0x60)
  29. #define S3C_NFMLC8BITPT1 S3C2410_NFREG(0x64)
  30. #define S3C_NFCONF_NANDBOOT (1<<31)
  31. #define S3C_NFCONF_ECCCLKCON (1<<30)
  32. #define S3C_NFCONF_ECC_MLC (1<<24)
  33. #define S3C_NFCONF_ECC_1BIT (0<<23)
  34. #define S3C_NFCONF_ECC_4BIT (2<<23)
  35. #define S3C_NFCONF_ECC_8BIT (1<<23)
  36. #define S3C_NFCONF_TACLS(x) ((x)<<12)
  37. #define S3C_NFCONF_TWRPH0(x) ((x)<<8)
  38. #define S3C_NFCONF_TWRPH1(x) ((x)<<4)
  39. #define S3C_NFCONF_ADVFLASH (1<<3)
  40. #define S3C_NFCONF_PAGESIZE (1<<2)
  41. #define S3C_NFCONF_ADDRCYCLE (1<<1)
  42. #define S3C_NFCONF_BUSWIDTH (1<<0)
  43. #define S3C_NFCONT_ECC_ENC (1<<18)
  44. #define S3C_NFCONT_LOCKTGHT (1<<17)
  45. #define S3C_NFCONT_LOCKSOFT (1<<16)
  46. #define S3C_NFCONT_MECCLOCK (1<<7)
  47. #define S3C_NFCONT_SECCLOCK (1<<6)
  48. #define S3C_NFCONT_INITMECC (1<<5)
  49. #define S3C_NFCONT_INITSECC (1<<4)
  50. #define S3C_NFCONT_nFCE1 (1<<2)
  51. #define S3C_NFCONT_nFCE0 (1<<1)
  52. #define S3C_NFCONT_INITECC (S3C_NFCONT_INITSECC | S3C_NFCONT_INITMECC)
  53. #define S3C_NFSTAT_ECCENCDONE (1<<7)
  54. #define S3C_NFSTAT_ECCDECDONE (1<<6)
  55. #define S3C_NFSTAT_ILEGL_ACC (1<<5)
  56. #define S3C_NFSTAT_RnB_CHANGE (1<<4)
  57. #define S3C_NFSTAT_nFCE1 (1<<3)
  58. #define S3C_NFSTAT_nFCE0 (1<<2)
  59. #define S3C_NFSTAT_Res1 (1<<1)
  60. #define S3C_NFSTAT_READY (1<<0)
  61. #define S3C_NFSTAT_CLEAR ((1<<7) |(1<<6) |(1<<5) |(1<<4))
  62. #define S3C_NFECCERR0_ECCBUSY (1<<31)
  63. // MichaelTang add for nand reg end


4. 修改平台机器代码初始化代码

@arch/arm/mach-s5pc100/mach-smdkc100.c

添加如下内容:



  1. // MichaelTang add for Nand
  2. #include
  3. #include
  4. ...
  5. /* NAND Controller */
  6. static struct resource s5pc_nand_resource[] = {
  7. [0] = {
  8. .start = S5PC1XX_PA_NAND,
  9. .end = S5PC1XX_PA_NAND + S5PC1XX_SZ_NAND - 1,
  10. .flags = IORESOURCE_MEM,
  11. }
  12. };
  13. struct platform_device s5pc_device_nand = {
  14. .name = "s5pc100-nand",
  15. .id = -1,
  16. .num_resources = ARRAY_SIZE(s5pc_nand_resource),
  17. .resource = s5pc_nand_resource,
  18. };
  19. struct mtd_partition s3c_partition_info[] = {
  20. {
  21. .name = "bootloader",
  22. .offset = 0, /* for bootloader */
  23. .size = SZ_1M,
  24. //.mask_flags = MTD_CAP_NANDFLASH,
  25. },
  26. {
  27. .name = "kernel",
  28. .offset = MTDPART_OFS_APPEND,
  29. .size = (4*SZ_1M),
  30. //.mask_flags = MTD_CAP_NANDFLASH,
  31. },
  32. {
  33. .name = "rootfs",
  34. .offset = MTDPART_OFS_APPEND,
  35. .size = MTDPART_SIZ_FULL,
  36. },
  37. };
  38. struct s3c_nand_mtd_info s3c_nand_mtd_part_info = {
  39. .chip_nr = 1,
  40. .mtd_part_nr = ARRAY_SIZE(s3c_partition_info),
  41. .partition = s3c_partition_info,
  42. };
  43. static struct platform_device *smdkc100_devices[] __initdata = {
  44. ....
  45. // Michaeltang add
  46. &s5pc_device_nand,
  47. ....
  48. static void __init smdkc100_machine_init(void)
  49. {
  50. ....
  51. //MichaelTang add for Nand
  52. s5pc_device_nand.dev.platform_data = &s3c_nand_mtd_part_info;
  53. ....
5. 由于新添加了驱动文件,要在menuconfig中添加编译项,并且让修改Makefile来编译驱动文件。


@drivers/mtd/nand/Kconfig

添加Kconfig的编译项


  1. config MTD_NAND_S3C
  2. tristate "NAND Flash support for S3C SoC"
  3. depends on ARCH_S5PC100 && MTD_NAND
  4. help
  5. This enables the NAND flash controller on the S3C.
  6. No board specfic support is done by this driver, each board
  7. must advertise a platform_device for the driver to attach.
  8. config MTD_NAND_S3C_HWECC
  9. bool "S3C NAND Hardware ECC"
  10. depends on MTD_NAND_S3C
  11. help
  12. Enable the use of the S3C's internal ECC generator when
  13. using NAND. Early versions of the chip have had problems with
  14. incorrect ECC generation, and if using these, the default of
  15. software ECC is preferable.
  16. If you lay down a device with the hardware ECC, then you will
  17. currently not be able to switch to software, as there is no
  18. implementation for ECC method used by the S3C


6. 添加驱动编译依赖文件

@drivers/mtd/nand/Makefile

  1. # MichaelTang add for nand start
  2. obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand.o
  3. # MichaelTang add for nand end


7. 执行make menuconfig,将新添加的Nandflash驱动及mtd支持编译到内核中。


选择Kernel编译项:


  1. Device Drivers --->
  2. <*> Memory Technology Device (MTD) support
  3. <*> Caching block device access to MTD devices
  4. 注:用于支持MTD块设备
  5. <*> NAND Device Support --->
  6. <*> NAND Flash support for S3C SoC
  7. [*] S3C NAND Hardware ECC
  8. 注:选择新添加的Nand设备驱动,选择ECC硬件校验



二、Yaffs2文件系统移植

我们的Android文件系统使用YAFFS2文件系统格式,选择对应的支持项:


  1. File systems --->
  2. [*] Miscellaneous filesystems --->
  3. <*> YAFFS2 file system support


注:默认Linux内核里不支持YAFFS2文件系统,我们可以从yaffs的官方网站上去下载其源码,然后给你的内核打上补丁即可:

保存退出,执行make zImage。


常见问题:

问题1:


  1. fs/yaffs2/yaffs_vfs.c: In function 'yaffs_fill_inode_from_obj':
  2. fs/yaffs2/yaffs_vfs.c:1333: error: assignment of read-only member 'i_nlink'
  3. fs/yaffs2/yaffs_vfs.c: In function 'yaffs_unlink':
  4. fs/yaffs2/yaffs_vfs.c:1747: error: decrement of read-only member 'i_nlink'
  5. fs/yaffs2/yaffs_vfs.c: In function 'yaffs_link':
  6. fs/yaffs2/yaffs_vfs.c:1782: error: assignment of read-only member 'i_nlink'
  7. fs/yaffs2/yaffs_vfs.c: In function 'yaffs_rename':
  8. fs/yaffs2/yaffs_vfs.c:1901: error: decrement of read-only member 'i_nlink'


提示错误,说给只读的成员i_nlink赋值,出错代码如下:


  1. inode->i_nlink = yaffs_get_obj_link_count(obj);


查看inode定义在 include/linux/fs.h


  1. ......
  2. /*
  3. * Filesystems may only read i_nlink directly. They shall use the
  4. * following functions for modification:
  5. *
  6. * (set|clear|inc|drop)_nlink
  7. * inode_(inc|dec)_link_count
  8. */
  9. union {
  10. const unsigned int i_nlink;
  11. unsigned int __i_nlink;
  12. };
  13. ......


通过上面的注释可知,我们可以直接读取i_nlink成员,但是不能对其进行修改操作,必须使用(set|clear|inc|drop)_nlink进行修改操作。

于是,将出错的代码处改为:


  1. // MichaelTang modify
  2. set_nlink(inode, yaffs_get_obj_link_count(obj));
  3. //inode->i_nlink = yaffs_get_obj_link_count(obj);



问题2:


  1. fs/yaffs2/yaffs_vfs.c:440: warning: initialization from incompatible pointer type
  2. fs/yaffs2/yaffs_vfs.c:445: warning: initialization from incompatible pointer type
  3. fs/yaffs2/yaffs_vfs.c:447: warning: initialization from incompatible pointer type
  4. fs/yaffs2/yaffs_vfs.c: In function 'yaffs_mtd_put_super':
  5. fs/yaffs2/yaffs_vfs.c:2514: error: 'struct mtd_info' has no member named 'sync'
  6. fs/yaffs2/yaffs_vfs.c:2515: error: 'struct mtd_info' has no member named 'sync'
  7. fs/yaffs2/yaffs_vfs.c: In function 'yaffs_internal_read_super':
  8. fs/yaffs2/yaffs_vfs.c:2702: error: 'struct mtd_info' has no member named 'erase'
  9. fs/yaffs2/yaffs_vfs.c:2703: error: 'struct mtd_info' has no member named 'read'
  10. fs/yaffs2/yaffs_vfs.c:2704: error: 'struct mtd_info' has no member named 'write'
  11. fs/yaffs2/yaffs_vfs.c:2705: error: 'struct mtd_info' has no member named 'read_oob'
  12. fs/yaffs2/yaffs_vfs.c:2706: error: 'struct mtd_info' has no member named 'write_oob'
  13. fs/yaffs2/yaffs_vfs.c:2707: error: 'struct mtd_info' has no member named 'block_isbad'
  14. fs/yaffs2/yaffs_vfs.c:2708: error: 'struct mtd_info' has no member named 'block_markbad'
  15. fs/yaffs2/yaffs_vfs.c:2732: error: 'struct mtd_info' has no member named 'erase'
  16. fs/yaffs2/yaffs_vfs.c:2733: error: 'struct mtd_info' has no member named 'block_isbad'
  17. fs/yaffs2/yaffs_vfs.c:2734: error: 'struct mtd_info' has no member named 'block_markbad'
  18. fs/yaffs2/yaffs_vfs.c:2734: error: 'struct mtd_info' has no member named 'read'
  19. fs/yaffs2/yaffs_vfs.c:2734: error: 'struct mtd_info' has no member named 'write'
  20. fs/yaffs2/yaffs_vfs.c:2736: error: 'struct mtd_info' has no member named 'read_oob'
  21. fs/yaffs2/yaffs_vfs.c:2736: error: 'struct mtd_info' has no member named 'write_oob'
  22. fs/yaffs2/yaffs_vfs.c:2757: error: 'struct mtd_info' has no member named 'erase'
  23. fs/yaffs2/yaffs_vfs.c:2757: error: 'struct mtd_info' has no member named 'read'
  24. fs/yaffs2/yaffs_vfs.c:2757: error: 'struct mtd_info' has no member named 'write'
  25. fs/yaffs2/yaffs_vfs.c:2759: error: 'struct mtd_info' has no member named 'read_oob'
  26. fs/yaffs2/yaffs_vfs.c:2759: error: 'struct mtd_info' has no member named 'write_oob'
  27. make[2]: *** [fs/yaffs2/yaffs_vfs.o] 错误 1
  28. make[1]: *** [fs/yaffs2] 错误 2
  29. make: *** [fs] 错误 2


根据错误信息,mtd_info结构体成员没有对应的:sync、erase、read、write等成员,找到struct mtd_info的定义:

@include/linux/mtd/mtd.h


  1. struct mtd_info {
  2. ......
  3. /*
  4. * Do not call via these pointers, use corresponding mtd_*()
  5. * wrappers instead.
  6. */
  7. // 不要直接通过函数指针的文件调用这些函数,尽量使用对应的mtd_xxx()封装函数替代,
  8. // 如,要调用_sync,则使用其对应的封装函数:mtd_sync().
  9. int (*_erase) (struct mtd_info *mtd, struct erase_info *instr);
  10. int (*_point) (struct mtd_info *mtd, loff_t from, size_t len,
  11. size_t *retlen, void **virt, resource_size_t *phys);
  12. int (*_unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
  13. unsigned long (*_get_unmapped_area) (struct mtd_info *mtd,
  14. unsigned long len,
  15. unsigned long offset,
  16. unsigned long flags);
  17. int (*_read) (struct mtd_info *mtd, loff_t from, size_t len,
  18. size_t *retlen, u_char *buf);
  19. int (*_write) (struct mtd_info *mtd, loff_t to, size_t len,
  20. size_t *retlen, const u_char *buf);
  21. int (*_panic_write) (struct mtd_info *mtd, loff_t to, size_t len,
  22. size_t *retlen, const u_char *buf);
  23. int (*_read_oob) (struct mtd_info *mtd, loff_t from,
  24. struct mtd_oob_ops *ops);
  25. int (*_write_oob) (struct mtd_info *mtd, loff_t to,
  26. struct mtd_oob_ops *ops);
  27. int (*_get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf,
  28. size_t len);
  29. int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from,
  30. size_t len, size_t *retlen, u_char *buf);
  31. int (*_get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf,
  32. size_t len);
  33. int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from,
  34. size_t len, size_t *retlen, u_char *buf);
  35. int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to,
  36. size_t len, size_t *retlen, u_char *buf);
  37. int (*_lock_user_prot_reg) (struct mtd_info *mtd, loff_t from,
  38. size_t len);
  39. int (*_writev) (struct mtd_info *mtd, const struct kvec *vecs,
  40. unsigned long count, loff_t to, size_t *retlen);
  41. void (*_sync) (struct mtd_info *mtd);
  42. int (*_lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
  43. int (*_unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
  44. int (*_is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
  45. int (*_block_isbad) (struct mtd_info *mtd, loff_t ofs);
  46. int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs);
  47. int (*_suspend) (struct mtd_info *mtd);
  48. void (*_resume) (struct mtd_info *mtd);
  49. ......
  50. static inline void mtd_sync(struct mtd_info *mtd)
  51. {
  52. if (mtd->_sync)
  53. mtd->_sync(mtd);
  54. }
  55. ......


由代码及注释可知,mtd_info中成员发生改变是为了让大家使用新的mtd_xxx()封装函数而不使用函数指针。我们有两种方式修改代码:

1>.直接将mtd->sync()的调用,改成mtd->_sync(),这种方式修改简单,也没有问题,但是和新mtd_info的初衷相悖。

2>.将mtd->sync()改成mtd_sync()

修改位置:

@fs/yaffs2/yaffs_vfs.c

@fs/yaffs2/yaffs_mtdif.c

@fs/yaffs2/yaffs_mtdif1.c

@fs/yaffs2/yaffs_mtdif2.c


问题3:


  1. fs/yaffs2/yaffs_vfs.c:2967: error: implicit declaration of function 'd_alloc_root'
  2. fs/yaffs2/yaffs_vfs.c:2967: warning: assignment makes pointer from integer without a cast
  3. make[2]: *** [fs/yaffs2/yaffs_vfs.o] 错误 1
  4. make[1]: *** [fs/yaffs2] 错误 1
  5. make: *** [fs] 错误 1


根据错误信息知,找不到d_alloc_root方法,原因是新的linux内核fs/dcache.c里使用d_make_root函数,所以直接将函数名换下即可。

@fs/yaffs2/yaffs_vfs.c

  1. // MichaelTang modify
  2. root = d_make_root(inode);
  3. //root = d_alloc_root(inode);
  4. yaffs_trace(YAFFS_TRACE_OS, "yaffs_read_super: d_make_root done");
  5. //yaffs_trace(YAFFS_TRACE_OS, "yaffs_read_super: d_alloc_root done");


问题4:


  1. fs/yaffs2/yaffs_vfs.c:2392: error: implicit declaration of function 'get_sb_bdev'
  2. fs/yaffs2/yaffs_vfs.c: At top level:
  3. fs/yaffs2/yaffs_vfs.c:2399: error: unknown field 'get_sb' specified in initializer
  4. fs/yaffs2/yaffs_vfs.c:2399: warning: initialization makes integer from pointer without a cast
  5. fs/yaffs2/yaffs_vfs.c:2423: error: unknown field 'get_sb' specified in initializer


错误信息提示,找不到get_sb_bdev和get_sb。

分析2.6.35前的代码可知,这两个函数是旧内核提供的函数,新内核使用了mount_bdev和mount函数,所以我们做如下代码修改:

第一处,针对yaffs的修改:


  1. // MichaelTang modify start
  2. #if 0
  3. static int yaffs_read_super(struct file_system_type *fs,
  4. int flags, const char *dev_name,
  5. void *data, struct vfsmount *mnt)
  6. {
  7. return get_sb_bdev(fs, flags, dev_name, data,
  8. yaffs_internal_read_super_mtd, mnt);
  9. }
  10. static struct file_system_type yaffs_fs_type = {
  11. .owner = THIS_MODULE,
  12. .name = "yaffs",
  13. .get_sb = yaffs_read_super,
  14. .kill_sb = kill_block_super,
  15. .fs_flags = FS_REQUIRES_DEV,
  16. };
  17. #else
  18. static struct super_block *yaffs_read_super(struct file_system_type *fs,
  19. int flags, const char *dev_name,
  20. void *data)
  21. {
  22. return mount_bdev(fs, flags, dev_name, data,
  23. yaffs_internal_read_super_mtd);
  24. }
  25. static struct file_system_type yaffs_fs_type = {
  26. .owner = THIS_MODULE,
  27. .name = "yaffs",
  28. //.get_sb = yaffs_read_super,
  29. .mount = yaffs_read_super,
  30. .kill_sb = kill_block_super,
  31. .fs_flags = FS_REQUIRES_DEV,
  32. };
  33. #endif
  34. // MichaelTang modify end

第二处,针对Yaffs2的修改:
  1. #ifdef CONFIG_YAFFS_YAFFS2
  2. static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data,
  3. int silent)
  4. {
  5. return yaffs_internal_read_super(2, sb, data, silent) ? 0 : -EINVAL;
  6. }
  7. // MichaelTang modify start
  8. #if 0
  9. static int yaffs2_read_super(struct file_system_type *fs,
  10. int flags, const char *dev_name, void *data,
  11. struct vfsmount *mnt)
  12. {
  13. return get_sb_bdev(fs, flags, dev_name, data,
  14. yaffs2_internal_read_super_mtd, mnt);
  15. }
  16. static struct file_system_type yaffs2_fs_type = {
  17. .owner = THIS_MODULE,
  18. .name = "yaffs2",
  19. .get_sb = yaffs2_read_super,
  20. .kill_sb = kill_block_super,
  21. .fs_flags = FS_REQUIRES_DEV,
  22. };
  23. #else
  24. static struct super_block *yaffs2_read_super(struct file_system_type *fs,
  25. int flags, const char *dev_name,
  26. void *data)
  27. {
  28. return mount_bdev(fs, flags, dev_name, data,
  29. yaffs2_internal_read_super_mtd);
  30. }
  31. static struct file_system_type yaffs2_fs_type = {
  32. .owner = THIS_MODULE,
  33. .name = "yaffs2",
  34. //.get_sb = yaffs2_read_super,
  35. .mount = yaffs2_read_super,
  36. .kill_sb = kill_block_super,
  37. .fs_flags = FS_REQUIRES_DEV,
  38. };
  39. #endif
  40. // MichaelTang modify end


问题5:

error: 'MTD_OOB_AUTO' undeclared

找不到符号MTD_OOB_AUTO,新内核里名字发生了改变:

@include/mtd/mtd-abi.h

MTD_OOB_AUTO -> MTD_OPS_AUTO_OOB

所以源码中所有的位置都改一下即可,共有2个文件使用到:

@fs/yaffs2/yaffs_mtdif1.c

@fs/yaffs2/yaffs_mtdif2.c



可能出的问题:

end_writeback找不到符号

解决方法:end_writeback(inode)改成clear_inode(inode)

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

另:随着Android4.0.4版本的更新,其文件系统体积也直线提升,生成的映像有250M左右,由于S5PC100内存只有256M,所以使用UBOOT烧写时就可能出问题,通过USB或tftp下载的文件系统将Uboot代码覆盖了,我们将uboot的运行地址放到最高的几M处。

假如,默认运行地址为0x27e00000,新运行地址为0x2f000000,S5PC100物理内存空间(0x20000000~0x30000000共256M)。

grep "0x27e00000" -R ./

替换了所有的地址就行了

主要是config.h、smdkc100.h和汇编代码文件中定义的几个和地址搬运有关的宏。



阅读(2053) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~