Linux 3.3.0移植到S3C6410开发板上


     这里仅仅是移植成功内核,可以挂载文件系统运行,至于驱动会陆续添加。

     第一步:到内核官网上下载最新的内核,我下载的是linux-3.3-rc3.tar.bz2。

     第二步:解压内核,进入arch/arm/mach-s3c64xx目录下,看到不少6410的板级文件,我们这里选择mini6410开开展工作,在目录下将mach-mini6410.c文件复制一份,命名为:mach-jfj6410.c。这里我们将文件里面关于mini6410的字样都修改为jfj6410.但是这里要注意,MACHINE_START(JFJ6410, "JFJ6410")这里的JFJ6410要使用大写,稍候说明为什么。大家都知道在一个目录下添加了文件后,都应该修改当前目录下的Kconfig和Makefile两个文件,这是Linux系统编译的要求。至于怎么修改,仔细看一下文件内容我相信大家都知道。

            Kconfig文件是进行make menuconfig时出现的配置选项,这里我们添加了自己的板级文件肯定要添加配置选项。内容可以复制MINI6410的。如下:           

[plain]

  1. config MACH_JFJ6410  
  2.     bool "JFJ6410"  
  3.     select CPU_S3C6410  
  4.     select S3C_DEV_HSMMC  
  5.     select S3C_DEV_HSMMC1  
  6.     select S3C64XX_SETUP_SDHCI  
  7.     select S3C_DEV_USB_HOST  
  8.     select S3C_DEV_NAND  
  9.     select S3C_DEV_FB  
  10.     select S3C64XX_SETUP_FB_24BPP  
  11.     select SAMSUNG_DEV_ADC  
  12.     select SAMSUNG_DEV_TS  
  13.     help  
  14.       Machine support for the JFJKJ JFJ6410  
           这里你应该能够看出之前为什么要在那个地方单独使用大写了吧,就是为了保持一致。

          Makefile文件就是说明要编译的文件,以及编译的规则,这里显然就是要编译我们自己的板级文件mach-jfj6410.c,具体如下:

[plain]

  1. obj-$(CONFIG_MACH_JFJ6410)      += mach-jfj6410.o  
        第三步:配置内核,make menuconfig。这里我是使用内核自带的s3c6400_defconfig文件进行修改的,这样比较简单,呵呵。基本去掉了大部分的驱动,留下了串口驱动和NAND驱动。

       第四步:编译make zImage。呵呵,这样就生成了我们需要的内核。

       第五步:烧写,测试内核。因为我们是测试内核,所以U-Boot以及根文件系统都是使用之前的,这里没有移植yaffs,所以我目前使用cramfs格式的文件系统。

       启动开发板后出现了如下的错误:

[html]

  1. end_request: I/O error, dev mtdblock2, sector 0  
  2. FAT: unable to read boot sector  
  3. VFS: Cannot open root device "mtdblock2" or unknown-block(31,2)  
  4. Please append a correct "root=" boot option; here are the available partitions:  
  5. 1f00        192 mtdblock0 (driver?)  
  6. 1f01       1856 mtdblock1 (driver?)  
  7. 1f02      30720 mtdblock2 (driver?)  
  8. 1f03      32768 mtdblock3 (driver?)  
  9. Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)  
       后来上网查了很久才发现是驱动的问题。U-boot使用软件ECC,我们在配置NAND驱动的时候提示是否选择使用NAND硬件ECC,我试了一下,无论你选不选都出现这个问题,我才发现,它的配置包含三重含义,选中--->使用硬件ECC;不选--->使用NAND的软件ECC(和U-Boot的软件ECC不是一回事);而我们这里需要的是不使用NAND的ECC,也就是禁止,不然就会和U-Boot冲突,出现上面的错误。要禁止NAND的ECC,我们修改drivers/mtd/nand/s3c2410.c这个文件,在845行的地方。

      源代码为:                      

[html]

  1. chip->ecc.mode = NAND_ECC_SOFT;  
      修改为:

[html]

  1. chip->ecc.mode   = NAND_ECC_NONE;  
      这就是当我们不选中的时候,不是使用NAND的软件ECC,而是不使用NAND的ECC。

      再次编译内核,烧写后正常运行,打印的信息如下:

[html]

  1. Starting kernel ...  
  2.   
  3. Uncompressing Linux... done, booting the kernel.  
  4. Booting Linux on physical CPU 0  
  5. Linux version 3.3.0-rc3 (chenlong12580@chenlong12580) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #4 Mon Feb 13 14:58:00 CST 2012  
  6. CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387d  
  7. CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache  
  8. Machine: JFJ6410  
  9. Memory policy: ECC disabled, Data cache writeback  
  10. CPU S3C6410 (id 0x36410101)  
  11. S3C24XX Clocks, Copyright 2004 Simtec Electronics  
  12. camera: no parent clock specified  
  13. S3C64XX: PLL settings, A=532000000M=532000000E=24000000  
  14. S3C64XX: HCLK2=266000000HCLK=133000000PCLK=66500000  
  15. mout_apll: source is fout_apll (1), rate is 532000000  
  16. mout_epll: source is epll (1), rate is 24000000  
  17. mout_mpll: source is mpll (1), rate is 532000000  
  18. usb-bus-host: source is clk_48m (0), rate is 48000000  
  19. audio-bus: source is mout_epll (0), rate is 24000000  
  20. audio-bus: source is mout_epll (0), rate is 24000000  
  21. audio-bus: source is mout_epll (0), rate is 24000000  
  22. irda-bus: source is mout_epll (0), rate is 24000000  
  23. camera: no parent clock specified  
  24. CPU: found DTCM0 8k @ 00000000, not enabled  
  25. CPU: moved DTCM0 8k to fffe8000, enabled  
  26. CPU: found DTCM1 8k @ 00000000, not enabled  
  27. CPU: moved DTCM1 8k to fffea000, enabled  
  28. CPU: found ITCM0 8k @ 00000000, not enabled  
  29. CPU: moved ITCM0 8k to fffe0000, enabled  
  30. CPU: found ITCM1 8k @ 00000000, not enabled  
  31. CPU: moved ITCM1 8k to fffe2000, enabled  
  32. Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024  
  33. Kernel command line: root=/dev/mtdblock2 rootfstype=cramfs console=ttySAC0,115200  
  34. PID hash table entries: 1024 (order: 0, 4096 bytes)  
  35. Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)  
  36. Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)  
  37. Memory: 256MB256MB = 256MB total  
  38. Memory: 257500k/257500k available, 4644k reserved, 0K highmem  
  39. Virtual kernel memory layout:  
  40.     vector  : 0xffff0000 - 0xffff1000   (   4 kB)  
  41.     DTCM    : 0xfffe8000 - 0xfffec000   (  16 kB)  
  42.     ITCM    : 0xfffe0000 - 0xfffe4000   (  16 kB)  
  43.     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)  
  44.     vmalloc : 0xd0800000 - 0xff000000   ( 744 MB)  
  45.     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)  
  46.     modules : 0xbf000000 - 0xc0000000   (  16 MB)  
  47.       .text : 0xc0008000 - 0xc01d90b8   (1861 kB)  
  48.       .init : 0xc01da000 - 0xc01f5000   ( 108 kB)  
  49.       .data : 0xc01f6000 - 0xc0216a40   ( 131 kB)  
  50.        .bss : 0xc0217024 - 0xc0246c58   ( 192 kB)  
  51. SLUB: Genslabs=13HWalign=32Order=0-3, MinObjects=0CPUs=1Nodes=1  
  52. NR_IRQS:246  
  53. VIC @f6000000: id 0x00041192, vendor 0x41  
  54. VIC @f6010000: id 0x00041192, vendor 0x41  
  55. Console: colour dummy device 80x30  
  56. Calibrating delay loop... 528.79 BogoMIPS (lpj=2643968)  
  57. pid_max: default: 32768 minimum: 301  
  58. Mount-cache hash table entries: 512  
  59. CPU: Testing write buffer coherency: ok  
  60. Setting up static identity map for 0x5015e320 - 0x5015e37c  
  61. gpiochip_add: registered GPIOs 38 to 53 on device: GPF  
  62. gpiochip_add: registered GPIOs 74 to 89 on device: GPI  
  63. gpiochip_add: registered GPIOs 91 to 102 on device: GPJ  
  64. gpiochip_add: registered GPIOs 161 to 176 on device: GPO  
  65. gpiochip_add: registered GPIOs 178 to 192 on device: GPP  
  66. gpiochip_add: registered GPIOs 194 to 202 on device: GPQ  
  67. gpiochip_add: registered GPIOs 144 to 159 on device: GPN  
  68. gpiochip_add: registered GPIOs 0 to 7 on device: GPA  
  69. gpiochip_add: registered GPIOs 9 to 15 on device: GPB  
  70. gpiochip_add: registered GPIOs 17 to 24 on device: GPC  
  71. gpiochip_add: registered GPIOs 26 to 30 on device: GPD  
  72. gpiochip_add: registered GPIOs 32 to 36 on device: GPE  
  73. gpiochip_add: registered GPIOs 55 to 61 on device: GPG  
  74. gpiochip_add: registered GPIOs 137 to 142 on device: GPM  
  75. gpiochip_add: registered GPIOs 63 to 72 on device: GPH  
  76. gpiochip_add: registered GPIOs 104 to 119 on device: GPK  
  77. gpiochip_add: registered GPIOs 121 to 135 on device: GPL  
  78. jfj6410: Option string jfj6410=0  
  79. jfj6410: selected LCD display is 480x272  
  80. S3C6410: Initialising architecture  
  81. bio: create slab <bio-0> at 0  
  82. io scheduler noop registered  
  83. io scheduler deadline registered  
  84. io scheduler cfq registered (default)  
  85. start plist test  
  86. end plist test  
  87. Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled  
  88. s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 69) is a S3C6400/10  
  89. console [ttySAC0] enabled  
  90. s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 70) is a S3C6400/10  
  91. s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 71) is a S3C6400/10  
  92. s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 72) is a S3C6400/10  
  93. brd: module loaded  
  94. loop: module loaded  
  95. S3C24XX NAND Driver, (c) 2004 Simtec Electronics  
  96. s3c24xx-nand s3c6400-nand: Tacls=4, 30ns Twrph0=8 60ns, Twrph1=6 45ns  
  97. s3c24xx-nand s3c6400-nand: System booted from NAND  
  98. s3c24xx-nand s3c6400-nand: NAND ECC disabled  
  99. NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)  
  100. NAND_ECC_NONE selected by board driver. This is not recommended!  
  101. Scanning device for bad blocks  
  102. Bad eraseblock 1050 at 0x000008340000  
  103. Bad eraseblock 1076 at 0x000008680000  
  104. Bad eraseblock 1211 at 0x000009760000  
  105. Bad eraseblock 1949 at 0x00000f3a0000  
  106. Creating 4 MTD partitions on "nand":  
  107. 0x000000000000-0x000000100000 : "Bootloader"  
  108. 0x000000100000-0x000000600000 : "Kernel"  
  109. 0x000000600000-0x000007e00000 : "User"  
  110. 0x000007e00000-0x000010000000 : "File System"  
  111. mousedev: PS/2 mouse device common for all mice  
  112. VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5  
  113. VFS: Mounted root (cramfs filesystem) readonly on device 31:2.  
  114. Freeing init memory: 108K  
  115. mount: mounting none on /proc/bus/usb failed: No such file or directory  
  116. hwclock: can't open '/dev/misc/rtc': No such file or directory  
  117. depmod: chdir(3.3.0-rc3): No such file or directory  
  118. [01/Jan/1970:00:00:07 +0000] boa.c:173 - unable to create socket: Function not implemented  
  119.                           
  120. open device leds: No such file or directory  
  121. /usr/sbin/alsactl: load_state:1610: No soundcards found...  
  122.                           
  123. ifconfig: socket: Function not implemented  
  124. Try to bring eth0 interface up......cat: can't open '/sys/class/net/eth0/address': No such file or directory  
  125. ifconfig: socket: Function not implemented  
  126. route: socket: Function not implemented  
  127. /etc/init.d/ifconfig-eth0: line 6: can't create /etc/resolv.conf: Read-only file system  
  128. Done  
  129.   
  130. Please press Enter to activate this console.   
  131. [root@JFJ6410 /]# ls  
  132. bin      etc      lib      mnt      proc     sbin     tmp      var  
  133. dev      home     linuxrc  opt      root     sys      usr      www  
  134. [root@www.bkjia.com /]#   

相关内容