歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Linux 3.3.0移植到S3C6410開發板上

Linux 3.3.0移植到S3C6410開發板上

日期:2017/3/1 10:32:22   编辑:Linux編程
這裡僅僅是移植成功內核,可以掛載文件系統運行,至於驅動會陸續添加。

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