Chinaunix首页 | 论坛 | 博客
  • 博客访问: 380626
  • 博文数量: 149
  • 博客积分: 25
  • 博客等级: 民兵
  • 技术积分: 220
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-27 14:53
文章分类

全部博文(149)

文章存档

2016年(3)

2015年(2)

2014年(144)

我的朋友

分类: LINUX

2014-10-09 15:14:57

1.修改主目录下Makefile:

ARCH ?= $(SUBARCH)
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)改为:

ARCH ?= arm
CROSS_COMPILE ?= /usr/local/arm/4.5.1/bin/arm-linux-

2.arch/arm/mach-s3c64xx目录下

    2.1 拷贝个mach-mini6410.c重命名为mach-ok6410.c并修改其内容:

          2.1.1 把所有mini6410字样都替换为ok6410,注意是小写

          2.1.2 把所有MINI6410字样都替换为OK6410,注意是大写

          2.1.3 修改static struct mtd_partition ok6410_nand_part                  
/*          

 [0] = {
 .name = "uboot",
.size = SZ_1M,
.offset = 0,
},
[1] = {
.name = "kernel",
.size = SZ_2M,
.offset = SZ_1M,
},
[2] = {
.name = "rootfs",
.size = MTDPART_SIZ_FULL,
.offset = SZ_1M + SZ_2M,
},*/

改为
{
.name = "Bootloader",
.offset = 0,
.size = (2 * SZ_1M),
.mask_flags = MTD_CAP_NANDFLASH,
},
{
.name = "Kernel",
.offset = (2 * SZ_1M),
.size = (5*SZ_1M) ,
.mask_flags = MTD_CAP_NANDFLASH,
},
{
.name = "File System",
.offset = (7 * SZ_1M),
.size = (200*SZ_1M) ,
},
{
.name = "User",
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL,
}

         2.2修改Kconfig文件,参照Mini6410的配置,加入OK6410如下:

config MACH_OK6410
bool "OK6410"
select CPU_S3C6410
select S3C_DEV_HSMMC
select S3C_DEV_HSMMC1
select S3C64XX_SETUP_SDHCI
select S3C_DEV_USB_HOST
select S3C_DEV_NAND
select S3C_DEV_FB
select S3C64XX_SETUP_FB_24BPP
select SAMSUNG_DEV_ADC
select SAMSUNG_DEV_TS
help
Machine support for the FORLINX OK6410

       2.3 修改Makefile文件,参照MINI6410,加入OK6410如下:

obj-$(CONFIG_MACH_OK6410)        += mach-ok6410.o

3. 修改arch/arm/tools/mach-types文件,加入OK6410的mach-type,这个必须和U-BOOT中的MACH-TYPE一致,这里选用smdk6410的mach-type:1626。如下:

ok6410 MACH_OK6410 OK6410 1626

4.回到主目录下执行Make menuconfig

  root@ubuntu:/home/my# cd linux-3.6.7/
  root@ubuntu:/home/my/linux-3.6.7# make menuconfig    

配置如下:

      4.1 先选择Load an Alternate Configuration File,输入arch/arm/configs/s3c6400_defconfig 

      4.2 选择General Setup,打开Cross_compiler tool perfix,输入

             /usr/local/arm/4.5.1/bin/arm-linux- 

      4.3选择System Type,取消SMDK6400 ,A&W6410,SMDK6410等平台,只选择OK6410

      4.4 选择Save an Alternate Configuration File,保存为.config然后退出。

5.回到主目录下执行make zImage生成zImage文件

6.回到主目录下执行make uImage生成uImage文件

   uImage文件是u boot 所支持的文件格式。

       6.1 拷贝u-boot-2012.10/tools/目录下的mkimage文件到主机/usr/bin目录下

       6.2 修改Entry_Point问题,参考另一篇文章:

 Linux3.6.7中Make uImage的load address 和 Entry Point相同的问题 

       6.3 回到主目录下执行make uImage生成uImage文件

 7. 把uImage烧写到NAND中运行,NAND flash放置程序的结构如下:

    0000 0000 ---0020 0000 大小2M 放置uboot

    0020 0000 ---0070 0000 大小5M 放置uImage

    0070 0000 ---0CF0 0000 大小200M 放置 rootfs

    结果如下:

   NAND read: device 0 offset 0x200000, size 0x500000

5242880 bytes read: OK

## Booting kernel from Legacy Image at 50008000 ...

Image Name: Linux-3.6.7

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 1476616 Bytes = 1.4 MiB

Load Address: 50008000

Entry Point: 50008040

Verifying Checksum ... OK

XIP Kernel Image ... OK

OK


Starting kernel ...


Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.6.7 (root@ubuntu) (gcc version 4.5.1 (ctng-1.8.1-FA) ) #1 Mon Dec 3 15:54:25 CST 2012
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: OK6410
Memory policy: ECC disabled, Data cache writeback
CPU S3C6410 (id 0x36410101)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
camera: no parent clock specified
S3C64XX: PLL settings, A=533000000, M=533000000, E=24000000
S3C64XX: HCLK2=266500000, HCLK=133250000, PCLK=66625000
mout_apll: source is fout_apll (1), rate is 533000000
mout_epll: source is epll (1), rate is 24000000
mout_mpll: source is mpll (1), rate is 533000000
usb-bus-host: source is clk_48m (0), rate is 48000000
audio-bus: source is mout_epll (0), rate is 24000000
audio-bus: source is mout_epll (0), rate is 24000000
audio-bus: source is mout_epll (0), rate is 24000000
irda-bus: source is mout_epll (0), rate is 24000000
camera: no parent clock specified
CPU: found DTCM0 8k @ 00000000, not enabled
CPU: moved DTCM0 8k to fffe8000, enabled
CPU: found DTCM1 8k @ 00000000, not enabled
CPU: moved DTCM1 8k to fffea000, enabled
CPU: found ITCM0 8k @ 00000000, not enabled
CPU: moved ITCM0 8k to fffe0000, enabled
CPU: found ITCM1 8k @ 00000000, not enabled
CPU: moved ITCM1 8k to fffe2000, enabled
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
Kernel command line: noinitrd root=/dev/mtdblock2 rootfstype=yaffs2 init=/linuxrc console=ttySAC0,115200
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 256MB = 256MB total
Memory: 256784k/256784k available, 5360k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
DTCM : 0xfffe8000 - 0xfffec000 ( 16 kB)
ITCM : 0xfffe0000 - 0xfffe4000 ( 16 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc02818ac (2535 kB)
.init : 0xc0282000 - 0xc029cb54 ( 107 kB)
.data : 0xc029e000 - 0xc02c7f20 ( 168 kB)
.bss : 0xc02c8024 - 0xc02f9064 ( 197 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:246
VIC @f6000000: id 0x00041192, vendor 0x41
VIC @f6010000: id 0x00041192, vendor 0x41
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
Console: colour dummy device 80x30
Calibrating delay loop... 353.89 BogoMIPS (lpj=1769472)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x501dd240 - 0x501dd29c
DMA: preallocated 256 KiB pool for atomic coherent allocations
OK6410: Option string ok6410=0
OK6410: selected LCD display is 480x272
s3c64xx_dma_init: Registering DMA channels
PL080: IRQ 73, at d0846000, channels 0..8
PL080: IRQ 74, at d0848000, channels 8..16
S3C6410: Initialising architecture
bio: create slab at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
start plist test
end plist test
s3c-fb s3c-fb: window 0: fb
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 69) is a S3C6400/10
console [ttySAC0] enabled
s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 70) is a S3C6400/10
s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 71) is a S3C6400/10
s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 72) is a S3C6400/10
brd: module loaded
loop: module loaded
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c6400-nand: Tacls=4, 30ns Twrph0=8 60ns, Twrph1=6 45ns
s3c24xx-nand s3c6400-nand: System booted from NAND
s3c24xx-nand s3c6400-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3V 8-bit), page size: 4096, OOB size: 218
No oob scheme defined for oobsize 218
------------[ cut here ]------------
kernel BUG at drivers/mtd/nand/nand_base.c:3278!
Internal error: Oops - BUG: 0 [#1] ARM
Modules linked in:
CPU: 0 Not tainted (3.6.7 #1)
PC is at nand_scan_tail+0x580/0x67c
LR is at nand_scan_tail+0x580/0x67c
pc : [] lr : [] psr: 60000013
sp : cf82fe98 ip : 00000001 fp : cf80a210
r10: c0181530 r9 : c0181524 r8 : 00000001
r7 : 00000000 r6 : cfa2fa80 r5 : cf80a000 r4 : cf80a210
r3 : c02ae464 r2 : c02ae464 r1 : 20000093 r0 : 00000025
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 00c5387d Table: 50004008 DAC: 00000017
Process swapper (pid: 1, stack limit = 0xcf82e268)
Stack: (0xcf82fe98 to 0xcf830000)
fe80: cf80a000 cf854300
fea0: cfa2fa80 c01816fc 00000000 cfa2f9c0 cf827fc0 00000000 c02f8900 c02f88f8
fec0: c02f8900 c02ad1ac c02ad178 c02c48e8 c029c8b8 c0295ce0 00000000 c01658a0
fee0: c0165888 c0164634 00000000 c02ad178 c02c48e8 c02ad1ac 00000000 00000049
ff00: c0295ce0 c0164844 c02c48e8 cf82ff18 c01647b8 c0162f3c cf803878 cf8238e0
ff20: c02c48e8 c02c48e8 c02c1288 cfa2f9c0 00000000 c0163e60 c0250c40 c02c48e8
ff40: c02c48e8 c02c8040 cf82e000 00000000 00000049 c0164d68 00000000 c0298b6c
ff60: c02c8040 cf82e000 00000000 00000049 c0295ce0 c0008704 c02af678 00000000
ff80: c026fb28 c0295ce0 00000049 c0035fac c0253f3c c026f698 00000006 00000006
ffa0: c02af678 c0298b6c 00000006 c0298b4c c02c8040 00000049 c029c8b8 c0282168
ffc0: 00000000 c0282840 00000006 00000006 c0282168 00000000 00000000 c0282758
ffe0: c000f10c 00000013 00000000 00000000 00000000 c000f10c ffffffff ffffffff
[] (nand_scan_tail+0x580/0x67c) from [] (s3c24xx_nand_probe+0x1c0/0x480)
[] (s3c24xx_nand_probe+0x1c0/0x480) from [] (platform_drv_probe+0x18/0x1c)
[] (platform_drv_probe+0x18/0x1c) from [] (driver_probe_device+0x7c/0x200)
[] (driver_probe_device+0x7c/0x200) from [] (__driver_attach+0x8c/0x90)
[] (__driver_attach+0x8c/0x90) from [] (bus_for_each_dev+0x54/0x80)
[] (bus_for_each_dev+0x54/0x80) from [] (bus_add_driver+0x170/0x240)
[] (bus_add_driver+0x170/0x240) from [] (driver_register+0x78/0x144)
[] (driver_register+0x78/0x144) from [] (do_one_initcall+0x34/0x180)
[] (do_one_initcall+0x34/0x180) from [] (kernel_init+0xe8/0x1b0)
[] (kernel_init+0xe8/0x1b0) from [] (kernel_thread_exit+0x0/0x8)
Code: 0a000003 e1a01003 e59f00e4 eb017dbe (e7f001f2)
---[ end trace 707c2cde67d9c275 ]---
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

内核启动了,但由于NAND驱动的问题使得内核初始化没有完成。接下来就是要改NAND驱动了。














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