6410内核移植

1.下载源代码:2.6.38

ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.bz2

2.解压缩

tar xvjf  linux-2.6.38.tar.bz2

3.安装交叉编译器

arm-linux-gcc-4.5.1

4.修改配置文件

cp arch/arm/configs/s3c6400_defconfig   .config

5.修改make file中的架构和编译器信息

191行改为   

 ARCH            ?=arm

CROSS_COMPILE   ?= arm-linux-    (找到其交叉编译环境)

-----通过make menuconfig ,修改编译器信息:arm-linux-

>>>>> 出现问题  >>>>>>>>>>>>>>>>>>>>>>>>>

make xxx Is a directory. Stop. 的原因

编译内核时候的一个错误提示
make: ***    arm/kernel.git/arch/arm: Is a directory.  Stop.
这个错误是由在Makefile的 
ARCH?= $(SUBARCH)
这行的后面多了一个空格造成的。
所以,在编辑Makefile时候,每行结尾,一定要确认没有空格,直接是换行。

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

6.make zImage

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

问题1.

Error: unrecognized/unsupported machine ID (r1 = 0x000009d8).


Available machine support:


ID (hex)	NAME

00000887	A&W6410

000004f6	SMDK6400

0000065a	SMDK6410

0000078d	NCP

000008ce	Airgoo-HMT

000009e6	SmartQ 5

000009af	SmartQ 7


Please check your kernel config and/or bootloader.

ERROR: Media attach failed

 解决Error: unrecognized/unsupported machine ID (r1 = 0x000009d8)的方法

进入linux2.6.36内核

vim arch/arm/mach-s3c64xx/mach-smdk6410.c
原始内容:
MACHINE_START(SMDK6410, "SMDK6410")(大概是1001行)
修改后的内容:
MACHINE_START(MINI6410, "MINI6410")

问题2.

CPU:     S3C6410@532MHz
 clk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode) 
Board:   MINI6410
DRAM:    256 MB
Flash:   0 kB
NAND:    2048 MB 
In:      serial
Out:     serial
Err:     serial
MAC: 08:90:90:90:90:90
Hit any key to stop autoboot:  1  0 
NAND read: device 0 offset 0x400000, size 0x500000..... 5242880 bytes read: OK
Boot with zImage
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Linux version 2.6.38 (root@localhost.localdomain) (gcc version 4.5.1 (ctng-1.8.1-FA) ) #4 Wed Feb 6 17:31:03 HKT 2013
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: MINI6410
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=532000000, M=532000000, E=24000000
S3C64XX: HCLK2=266000000, HCLK=133000000, PCLK=66500000
mout_apll: source is fout_apll (1), rate is 532000000
mout_epll: source is epll (1), rate is 24000000
mout_mpll: source is mpll (1), rate is 532000000
mmc_bus: source is mout_epll (0), rate is 24000000
mmc_bus: source is mout_epll (0), rate is 24000000
mmc_bus: source is mout_epll (0), rate is 24000000
usb-bus-host: source is clk_48m (0), rate is 48000000
uclk1: source is dout_mpll (1), rate is 66500000
spi-bus: source is mout_epll (0), rate is 24000000
spi-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
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
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: init=/linuxrc rootfstype=ubifs root=ubi0:FriendlyARM-root ubi.mtd=2 console=ttySAC0,115200 lcd=S70
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: 256940k/256940k available, 5204k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    DMA     : 0xff600000 - 0xffe00000   (   8 MB)
    vmalloc : 0xd0800000 - 0xf6000000   ( 600 MB)
    lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .init : 0xc0008000 - 0xc0021000   ( 100 kB)
      .text : 0xc0021000 - 0xc027d440   (2418 kB)
      .data : 0xc027e000 - 0xc029fbe0   ( 135 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
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop... 530.84 BogoMIPS (lpj=2654208)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
s3c64xx_dma_init: Registering DMA channels
PL080: IRQ 73, at d0808000, channels 0..8
PL080: IRQ 74, at d080c000, channels 8..16
S3C6410: Initialising architecture
bio: create slab <bio-0> at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c.0: slave address 0x10
s3c-i2c s3c2440-i2c.0: bus frequency set to 64 KHz
s3c-i2c s3c2440-i2c.0: i2c-0: S3C I2C adapter
s3c-i2c s3c2440-i2c.1: slave address 0x10
s3c-i2c s3c2440-i2c.1: bus frequency set to 64 KHz
s3c-i2c s3c2440-i2c.1: i2c-1: S3C I2C adapter
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
s3c-fb s3c-fb: window 0: fb 
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 16) is a S3C6400/10
s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 20) is a S3C6400/10
s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 24) is a S3C6400/10
s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 28) is a S3C6400/10
brd: module loaded
loop: module loaded
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
UBI error: ubi_init: UBI error: cannot initialize UBI, error -19
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 79, io mem 0x74300000
s3c2410-ohci s3c2410-ohci: init err (00000000 0000)
ohci_hcd: can't start s3c24xx
s3c2410-ohci s3c2410-ohci: startup error -75
s3c2410-ohci s3c2410-ohci: USB bus 1 deregistered
s3c2410-ohci: probe of s3c2410-ohci failed with error -75
mousedev: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
s3c-sdhci s3c-sdhci.0: clock source 0: hsmmc (133000000 Hz)
s3c-sdhci s3c-sdhci.0: clock source 1: hsmmc (133000000 Hz)
s3c-sdhci s3c-sdhci.0: clock source 2: mmc_bus (24000000 Hz)
mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] using ADMA
mmc0: mmc_rescan_try_freq: trying to init card at 400000 Hz
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
s3c-rtc s3c64xx-rtc: setting system clock to 2000-03-08 03:31:04 UTC (952486264)
VFS: Cannot open root device "ubi0:FriendlyARM-root" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[<c002bc04>] (unwind_backtrace+0x0/0xe4) from [<c01d7634>] (panic+0x50/0x16c)
[<c01d7634>] (panic+0x50/0x16c) from [<c0008ea8>] (mount_block_root+0x238/0x288)
[<c0008ea8>] (mount_block_root+0x238/0x288) from [<c00090e0>] (prepare_namespace+0x88/0x1b4)
[<c00090e0>] (prepare_namespace+0x88/0x1b4) from [<c0008b2c>] (kernel_init+0x108/0x148)
[<c0008b2c>] (kernel_init+0x108/0x148) from [<c0027508>] (kernel_thread_exit+0x0/0x8)


出现该错误是由于:

1.此处需要添加对ubifs的支持:

http://www.52rd.com/Blog/Archive_Thread.asp?SID=65177

2.nandflash驱动没有移植:

最初发现出现问题是nandflash的driver一种无法进入probe,怀疑是platformdevice的名字不对或者被改写了。修改了所能找到的该设备名称的修改点,之后发现依然无法进入。试着在platform总线的match函数中打印出platform_driver_register时总线上的说有设备,发现不但是没有nandflash,在板文件中连同它一起的其他设备也没有,所以怀疑是这些platform_device被注册后又被删除掉了。于是在platform_device_register()和platform_device_unregister()中加入打印信息,再次启动时从打印信息可以看出,当注册到摸个platform_device时,由于资源申请失败,会将前面所注册成功的platform_device都注销掉,因此platform总线也就没有了nandflash。

s3c64xx-pata.0: failed to claim resource 0
------------[ cut here ]------------
WARNING: at drivers/base/core.c:143 device_release+0x80/0x8c()
Device 's3c64xx-adc' does not have a release() function, it is broken and must be fixed.
---[ end trace da227214a82491b7 ]---
------------[ cut here ]------------
WARNING: at drivers/base/core.c:143 device_release+0x80/0x8c()
Device 'smsc911x' does not have a release() function, it is broken and must be fixed.
---[ end trace da227214a82491b8 ]---
------------[ cut here ]------------
WARNING: at drivers/base/core.c:143 device_release+0x80/0x8c()
Device 'platform-lcd.0' does not have a release() function, it is broken and must be fixed.
---[ end trace da227214a82491b9 ]---
------------[ cut here ]------------
WARNING: at drivers/base/core.c:143 device_release+0x80/0x8c()
Device 's3c6400-nand' does not have a release() function, it is broken and must be fixed.
---[ end trace da227214a82491ba ]---
------------[ cut here ]------------
WARNING: at drivers/base/core.c:143 device_release+0x80/0x8c()
Device 'samsung-keypad' does not have a release() function, it is broken and must be fixed.

错误原因: 未找到relese() 释放函数

解决办法:在arch/arm/plat-samsung/dev-nand.c 文件中

static struct resource s3c_nand_resource[] = {
	[0] = {
			.start = S3C_PA_NAND,
			.end = S3C_PA_NAND + SZ_1M-1, // 给最后加上一个 “ - 1” 红色部分
			.flags = IORESOURCE_MEM,
		}		
}
此处修改是因为nandflash资源的结束地址是S3C_PA_NAND+SZ_1M=0x70200000+100000=0x70300000

而另外一个平台设备s3c_cfcon的资源的起始地址s3c_cfcon_resource=0x70300000,二者产生了冲突。


2.2出现空指针:

Unable to handle kernel NULL pointer dereference at virtual address 00000018
pgd = c0004000
[00000018] *pgd=00000000
Internal error: Oops: 5 [#1]
last sysfs file: 
Modules linked in:
CPU: 0    Not tainted  (2.6.38 #15)
PC is at s3c_nand_probe+0x13c/0x4dc
LR is at s3c_nand_probe+0x128/0x4dc
pc : [<c0187730>]    lr : [<c018771c>]    psr: 60000013
sp : cf82de90  ip : 00003f00  fp : 00000000
r10: 00000002  r9 : 00100000  r8 : 00000000
r7 : d0a00000  r6 : c0289f58  r5 : 00000000  r4 : c02d6388
r3 : 00000001  r2 : cf82de84  r1 : c0250e23  r0 : 0000000d
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 00c5387d  Table: 50004008  DAC: 00000015
Process swapper (pid: 1, stack limit = 0xcf82c268)
Stack: (0xcf82de90 to 0xcf82e000)
de80:                                     00000000 00000000 00000000 00000000
dea0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dee0: 00000000 c01d9744 c023b018 c0289f58 c0289f58 c029e3fc c029e3fc 00000000
df00: 00000000 00000000 00000000 c0176844 c0176830 c0175a5c 00000000 c0289f58
df20: c0289f8c c029e3fc 00000000 c0175b6c c029e3fc cf82df40 c0175b0c c0174d30
df40: cf803a48 cf84f4c0 c029e3fc c029e3fc cf8f92a0 c029b278 00000000 c01753dc
df60: c023b029 c023b029 cf82a000 c029e3fc c01eca64 c0027508 c001ab64 00000000
df80: 00000000 c0175db8 00000000 c029e350 c01eca64 c0027508 c001ab64 00000000
dfa0: 00000000 c001aba8 c001d1e8 c001d27c c0027508 c0021500 00000000 c0020000
dfc0: 00000013 000000f5 c029429c c001d1e8 c001d27c c0027508 00000013 00000000
dfe0: 00000000 c0008abc 00000000 00000000 c0008a24 c0027508 ffffffff ffffdfff
[<c0187730>] (s3c_nand_probe+0x13c/0x4dc) from [<c0176844>] (platform_drv_probe+0x14/0x18)
[<c0176844>] (platform_drv_probe+0x14/0x18) from [<c0175a5c>] (driver_probe_device+0xa8/0x158)
[<c0175a5c>] (driver_probe_device+0xa8/0x158) from [<c0175b6c>] (__driver_attach+0x60/0x84)
[<c0175b6c>] (__driver_attach+0x60/0x84) from [<c0174d30>] (bus_for_each_dev+0x4c/0x78)
[<c0174d30>] (bus_for_each_dev+0x4c/0x78) from [<c01753dc>] (bus_add_driver+0xb8/0x238)
[<c01753dc>] (bus_add_driver+0xb8/0x238) from [<c0175db8>] (driver_register+0xa8/0x12c)
[<c0175db8>] (driver_register+0xa8/0x12c) from [<c001aba8>] (s3c_nand_init+0x44/0x74)
[<c001aba8>] (s3c_nand_init+0x44/0x74) from [<c0021500>] (do_one_initcall+0xbc/0x190)
[<c0021500>] (do_one_initcall+0xbc/0x190) from [<c0008abc>] (kernel_init+0x98/0x148)
[<c0008abc>] (kernel_init+0x98/0x148) from [<c0027508>] (kernel_thread_exit+0x0/0x8)
Code: 01a08005 15958014 15953010 03a03001 (e5982018) 

问题原因,没有在mach-smdk6410.c中添加platform_data.

/* Nand flash */
struct mtd_partition mini6410_nand_part[] = {
	{
		.name		= "Bootloader",
		.offset		= 0,
		.size		= (4 * 128 *SZ_1K),
		.mask_flags	= MTD_CAP_NANDFLASH,
	},
	{
		.name		= "Kernel",
		.offset		= (4 * 128 *SZ_1K),
		.size		= (5*SZ_1M) ,
		.mask_flags	= MTD_CAP_NANDFLASH,
	},
	{
		.name		= "File System",
		.offset		= MTDPART_OFS_APPEND,
		.size		= MTDPART_SIZ_FULL,
	}
};

static struct s3c2410_nand_set mini6410_nand_sets[] = {
	[0] = {
		.name       = "nand",
		.nr_chips   = 1,
		.nr_partitions  = ARRAY_SIZE(mini6410_nand_part),
		.partitions = mini6410_nand_part,
	},
};

static struct s3c2410_platform_nand mini6410_nand_info = {
	.tacls      = 25,
	.twrph0     = 55,
	.twrph1     = 40,
	.nr_sets    = ARRAY_SIZE(mini6410_nand_sets),
	.sets       = mini6410_nand_sets,
};

在函数smdk6410_machine_init(void)中添加:

	s3c_nand_set_platdata(&mini6410_nand_info);
同时要加入相应头文件

#include <linux/mtd/partitions.h>
#include <mtd/mtd-abi.h>
#include <plat/nand.h>
避免在编译时出现错误:error: array type has incomplete element type



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值