您的位置 首页 硬件

linux-2.6.14移植到S3C2440

现在应该很少使用2614的内核了,但由于项目需要,最近移植了26版本的内核到S3C2440上,并移植了CS8900网卡驱动(网卡驱动移植参考http:

现在应该很少运用2.6.14的内核了,但由于项目需求,最近移植了2.6.版别的内核到S3C2440上,并移植了CS8900网卡驱动(网卡驱动移植参阅http://blog.csdn.net/ce123/article/details/8424399)。之所以移植网卡驱动,是因为yaffs2格局的文件体系一向挂载不成功,发动后的错误信息如下:

Mounted devfs on /dev
Freeing init memory: 92K
Failed to execute /linuxrc. Attempting defaults…
Kernel panic – not syncing: No init found. Try passing init= option to kernel.
这个问题只能先放一下,最终成功挂载nfs。yaffs2格局文件体系的问题今后再深入研究。收拾一下最近做过的东西,怕遗忘了。

1.顶层Makefile的修正

[plain]view plaincopy

print?

  1. ARCH?=arm
  2. CROSS_COMPILE?=arm-linux-

穿插编译器的运用请参阅http://blog.csdn.net/ce123/article/details/8333421

2.修正时钟频率

linux/arch/arm/mach-s3c2410/mach-smdk2440.c
[plain]view plaincopy

print?

  1. staticvoid__initsmdk2440_map_io(void)
  2. {
  3. s3c24xx_init_io(smdk2440_iodesc,ARRAY_SIZE(smdk2440_iodesc));
  4. s3c24xx_init_clocks(12000000);//12M
  5. s3c24xx_init_uarts(smdk2440_uartcfgs,ARRAY_SIZE(smdk2440_uartcfgs));
  6. s3c24xx_set_board(&smdk2440_board);
  7. }

3.修正机器ID

linux/arch/arm/tools/mach-types
s3c2440 ARCH_S3C2440 S3C2440 168
这个值要和uboot中的值对应起来,在uboot的arch/arm/tools/mach-types中有如下界说:
#define MACH_TYPE_S3C2440 168
这两个值相同即可。

4.设置Nand Flash分区

4.1树立Nand Flash分区表

在linux/arch/arm/mach-s3c2410/devs.c中增加
[plain]view plaincopy

print?

  1. #include
  2. #include
  3. #include
  4. /*NANDparititon*/
  5. staticstructmtd_partitionsmdk_default_nand_part[]={
  6. [0]={
  7. .name=”Board_uboot”,
  8. .offset=0x00000000,
  9. .size=0x00080000,
  10. },
  11. [1]={
  12. .name=”Board_kernel”,
  13. .offset=0x00240000,
  14. .size=0x00200000,
  15. },
  16. [2]={
  17. .name=”Board_yaffs2″,
  18. .offset=0x00440000,
  19. .size=0x0FB40000,
  20. }
  21. };

name:代表分区姓名

size:代表flash分区巨细(单位:字节)
offset:代表flash分区的开端地址(相对于0x0的偏移)
区分3个区,别离寄存uboot, kernel和文件体系。

4.2.参加Nand Flash分区

[plain]view plaincopy

print?

  1. staticstructs3c2410_nand_setsmdk_nand_sets[]={
  2. [0]={
  3. .name=”NAND”,
  4. .nr_chips=1,
  5. .nr_partitions=ARRAY_SIZE(smdk_default_nand_part),
  6. .partitions=smdk_default_nand_part,
  7. },
  8. };

nr_partitions: 指明partition_info中界说的分区数目
partitions:分区信息表

4.3.树立Nand Flash芯片支撑

[plain]view plaincopy

print?

  1. staticstructs3c2410_platform_nandsmdk_nand_info={
  2. .tacls=20,
  3. .twrph0=60,
  4. .twrph1=20,
  5. .nr_sets=ARRAY_SIZE(smdk_nand_sets),
  6. .sets=smdk_nand_sets,
  7. };

tacls,twrph0,twrph1的意思见S3C2440的数据手册,这3个值最终会被设置到NFCONF中。
sets:支撑的分区集
nr_set:分区集的个数

4.4.参加Nand Flash芯片支撑到Nand Flash驱动

[plain]view plaincopy

print?

  1. structplatform_devices3c_device_nand={
  2. .name=”s3c2410-nand”,
  3. .id=-1,
  4. .num_resources=ARRAY_SIZE(s3c_nand_resource),
  5. .resource=s3c_nand_resource,
  6. .dev={
  7. .platform_data=&smdk_nand_info
  8. }
  9. };
name:设备称号
id:有用设备编号,假如只要仅有的一个设备为-1,有多个设备从0开端计数.
num_resource:有几个寄存器区
resource:寄存器区数组首地址
dev:支撑的Nand Flash设备

4.5指定发动时初始化

linux/arch/arm/mach-s3c2410/mach-smdk2440.c
[plain]view plaincopy

print?

  1. staticstructplatform_device*smdk2440_devices[]__initdata={
  2. &s3c_device_usb,
  3. &s3c_device_lcd,
  4. &s3c_device_wdt,
  5. &s3c_device_i2c,
  6. &s3c_device_iis,
  7. &s3c_device_nand,//增加
  8. };

5.制止Flash ECC校验

修正drivers/mtd/nand/s3c2410.c 文件s3c2410_nand_init_chip()函数,在该函数体最终加上一条句子:

[plain]view plaincopy

print?

  1. chip->eccmode=NAND_ECC_NONE;

6.支撑devfs

在2.6.14中现已不支撑devfs了,内核装备文件中现已没有了相关的装备挑选,但其代码还保留了。修正fs/Kconfig文件找到menu “Pseudo filesystems”增加如下句子:
[plain]view plaincopy

print?

  1. configDEVFS_FS
  2. bool”/devfilesystemsupport(OBSOLETE)”
  3. dependsonEXPERIMENTAL
  4. help
  5. Thisissupportfordevfs,avirtualfilesystem(like/proc)which
  6. providesthefilesysteminterfacetodevicedrivers,normallyfound
  7. in/dev.Devfsdoesnotdependonmajorandminornumber
  8. allocations.Devicedriversregisterentriesin/devwhichthen
  9. appearautomatically,whichmeansthatthesystemadministratordoes
  10. nothavetocreatecharacterandblockspecialdevicefilesinthe
  11. /devdirectoryusingthemknodcommand(orMAKEDEVscript)anymore.
  12. Thisisworkinprogress.Ifyouwanttousethis,you*must*read
  13. thematerialin,especially
  14. thefileREADMEthere.
  15. Notethatdevfsnolongermanages/dev/pts!IfyouareusingUNIX98
  16. ptys,youwillalsoneedtomountthe/dev/ptsfilesystem(devpts).
  17. Notethatdevfshasbeenobsoletedbyudev,
  18. .
  19. Ithasbeenstrippeddowntoabareminimumandisonlyprovidedfor
  20. legacyinstallationsthatuseitsnamingschemewhichis
  21. unfortunatelydifferentfromthenamesnormalLinuxinstallations
  22. use.
  23. Ifunsure,sayN.
  24. configDEVFS_MOUNT
  25. bool”Automaticallymountatboot”
  26. dependsonDEVFS_FS
  27. help
  28. ThisoptionappearsifyouhaveCONFIG_DEVFS_FSenabled.Setting
  29. thistoYwillmakethekernelautomaticallymountdevfsonto/dev
  30. whenthesystemisbooted,beforetheinitthreadisstarted.
  31. Youcanoverridethiswiththe”devfs=nomount”bootoption.
  32. Ifunsure,sayN.
  33. configDEVFS_DEBUG
  34. bool”Debugdevfs”
  35. dependsonDEVFS_FS
  36. help
  37. IfyousayYhere,thenthe/devfilesystemcodewillgenerate
  38. debuggingmessages.Seethefile
  39. formore
  40. details.
  41. Ifunsure,sayN.
  42. configDEVPTS_FS_XATTR
  43. bool”/dev/ptsExtendedAttributes”
  44. dependsonUNIX98_PTYS
  45. help
  46. Extendedattributesarename:valuepairsassociatedwithinodesby
  47. thekernelorbyusers(seetheattr(5)manualpage,orvisit
  48. fordetails).
  49. Ifunsure,sayN.
  50. configDEVPTS_FS_SECURITY
  51. bool”/dev/ptsSecurityLabels”
  52. dependsonDEVPTS_FS_XATTR
  53. help
  54. Securitylabelssupportalternativeaccesscontrolmodels
  55. implementedbysecuritymoduleslikeSELinux.Thisoption
  56. enablesanextendedattributehandlerforfilesecurity
  57. labelsinthe/dev/ptsfilesystem.
  58. Ifyouarenotusingasecuritymodulethatrequiresusing
  59. extendedattributesforfilesecuritylabels,sayN.
  60. configTMPFS
  61. bool”Virtualmemoryfilesystemsupport(formershmfs)”
  62. help
  63. Tmpfsisafilesystemwhichkeepsallfilesinvirtualmemory.
  64. Everythingintmpfsistemporaryinthesensethatnofileswillbe
  65. createdonyourharddrive.Thefilesliveinmemoryandswap
  66. space.Ifyouunmountatmpfsinstance,everythingstoredthereinis
  67. lost.
  68. Seefordetails.

7.内核裁剪

7.1内核装备文件

将arch/arm/configs/s3c2410_defconfig .config拷到内核目录树根下:
cp arch/arm/configs/s3c2410_defconfig .config
make menuconfig 将s3c2410_defconfig 导入,在s3c2410_defconfig基础上,裁剪内核。

7.2内核选项

Loadable module support >
[*] Enable loadable module support
[*] Automatic kernel module loading

System Type >
[*] S3C2410 DMA support

Floating point emulation >
[*] NWFPE math emulation

接下来要做的是对内核MTD子体系的设置

Device Drivers >
Memory Technology Devices (MTD) >
[*] MTD partitioning support /*支撑MTD分区,这样咱们在前面设置的分区才有含义*/
[*] Command line partition table parsing /*支撑从命令行设置flash分区信息,灵敏*/
RAM/ROM/Flash chip drivers >
<*> Detect flash chips by Common Flash Interface (CFI) probe
<*> Detect nonCFI AMD/JEDECcompatible flash chips
<*> Support for Intel/Sharp flash chips
<*> Support for AMD/Fujitsu flash chips
<*> Support for ROM chips in bus mapping
NAND Flash Device Drivers >
<*> NAND Device Support
<*> NAND Flash support for S3C2410/S3C2440 SoC
Character devices >
[*] Nonstandard serial port support
[*] S3C2410 RTC Driver

接下来做的是针对文件体系的设置

File systems >
<> Second extended fs support #去除对ext2的支撑
Pseudo filesystems >
[*] /proc file system support
[*] Virtual memory file system support (former shm fs)
[*] /dev file system support (OBSOLETE)
[*] Automatically mount at boot (NEW)
这里会看到咱们前先修正fs/Kconfig的效果,devfs现已被支撑上了
Miscellaneous filesystems >
Network File Systems >
<*> NFS file system support

7.3编译

make即可。

8.总结

曾经将linux-2.6.30.4移植S3C2440(http://blog.csdn.net/ce123/article/details/6581248),根本进程很类似。照着这个进程一般都能移植好一个内核,但理解这个进程背面的东西才是王道。

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/qianrushi/yingjian/262394.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部