real6410移植linux2.6.39.4内核(1)-内核移植环境的搭建及测试

经过几天的失败经历,以及逐渐对内核移植步骤的了解,现在我想实现的内容很简单,就是仅仅把一个
新的内核(我这里是官网下载的2.6.39.4内核)在开发板上面跑起来,也可以叫他裸跑,意思就是说什么驱
动都不带只要内核能启动就行了,说是很简单的但是我却重重遇到困难,刚开始我对移植内核点都不了解。
虽然编译每次都能成功。但是下载内核后,总是运行在Uncompressing Linux... done, booting the kernel,
然后就停住咯。经过网上查阅很多资料,但是还是未能解决这个问题,就这样就用掉了2天时间,后来我就
想不能就这样耗下去撒,然后今天就将内核重新解压、重新编译、果然,内核启动了………………

下面是详细的过程:

1.安装虚拟机8.0+Ubuntu11.04:
安装后请使用ROOT用户登录。
2.首先从官网下载内核:
我下载的是 linux-2.6.39.4.tar.bz。
3.解压内核:
将下载的内核复制到root目录下面,进入Ubuntu的终端,输入解压指令
#tar xvfj linux-2.6.39.4.tar.bz2
然后等待解压完成ls即可看到内核目录如下:
root@yifan:~# ls
arm-2008q3          Downloads               Pictures   yifan_driver
arm-2008q3.tar.bz2  linux-2.6.39.4          Public
Desktop             linux-2.6.39.4.tar.bz2  Templates
Documents           Music                   Videos
root@yifan:~# ^C
root@yifan:~# cd linux-2.6.39.4
root@yifan:~/linux-2.6.39.4# ls
arch           drivers   Kbuild       mm                 samples     usr
block          firmware  Kconfig      Module.symvers     scripts     virt
COPYING        fs        kernel       net                security    vmlinux
CREDITS        include   lib          README             sound       vmlinux.o
crypto         init      MAINTAINERS  REPORTING-BUGS     System.map
Documentation  ipc       Makefile     s3c6400_defconfig  tools
root@yifan:~/linux-2.6.39.4# 
4.拷贝源码提供的默认配置文件:
将arch/arm/configs/s3c6400_defconfig拷贝至内核根目录,然后修改根目录中的Makefile文件的195和196行,修改如下
ARCH = arm
CROSS_COMPILE = arm-linux-
然后运行root@yifan:~/linux-2.6.39.4# make s3c6400_defconfig 即可使用默认配置
5.修改内核中的机器识别码:
在/arch/arm/tools/mach-types.h,搜索real6410,将其机器码改为1626,并将smdk6410的机器码改为2990
目的是与u-boot中的机器码一致,也可一修改uboot中的机器码/include/configs/smdk6410.h 因为real官方使用的是默认SMDK6410。
6.然后我就开始编译下载镜像DNW信息如下:
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Error: unrecognized/unsupported machine ID (r1 = 0x0000065a).
Available machine support:
ID (hex) NAME
00000887 A&W6410
000004f6 SMDK6400
00000b54 SMDK6410
0000078d NCP
000008ce Airgoo-HMT
000009e6 SmartQ 5
000009af SmartQ 7
Please check your kernel config and/or bootloader.
当我看到这个的时候我瞬间高兴了,因为困惑我多久的问题(就是文章开始提出的停留在Uncompressing Linux... done, booting the kernel.)没有了,哈哈,新的问题一看就明白了,就是内核机器码与U-BOOT的不匹配,乍一想刚刚不是改了机器码的嘛,怎么回事呢!
经过思考发现默认的6410配置里并没有选用rela6410这个配置(前几天总结的经验),然后操作如下:
root@yifan:~/linux-2.6.39.4# make menuconfig
然后进入在System Type-->
其中的***Syetem MMU ***
中并没有选择REAL6410而选择了下面的
ID (hex) NAME
00000887 A&W6410
000004f6 SMDK6400
00000b54 SMDK6410
0000078d NCP
000008ce Airgoo-HMT
000009e6 SmartQ 5
000009af SmartQ 7
然后我将其他的都N了只选择了REAL6410保存后从新编译。
7.内核启动成功:
然后把从新编译的镜像下载进开发板DNW的输出信息如下:
Starting kernel ...


Uncompressing Linux... done, booting the kernel.
Linux version 2.6.39.4 (root@yifan) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #2 Thu Mar 22 11:20:32 CST 2012
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: REAL6410
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: 56896
Kernel command line: noinitrd console=ttySAC0 ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs init=/init video=fb:WX4300F mem=224M ppp=none
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: 224MB = 224MB total
Memory: 224564k/224564k available, 4812k reserved, 0K highmem
Virtual kernel memory layout:
vector  : 0xffff0000 - 0xffff1000   (   4 kB)
fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
DMA     : 0xff600000 - 0xffe00000   (   8 MB)
vmalloc : 0xce800000 - 0xf6000000   ( 632 MB)
lowmem  : 0xc0000000 - 0xce000000   ( 224 MB)
modules : 0xbf000000 - 0xc0000000   (  16 MB)
 .init : 0xc0008000 - 0xc0022000   ( 104 kB)
 .text : 0xc0022000 - 0xc025ee00   (2292 kB)
 .data : 0xc0260000 - 0xc027ffc0   ( 128 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... 528.79 BogoMIPS (lpj=2643968)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
REAL6410: Option string real6410=0
REAL6410: selected LCD display is 480x272
s3c64xx_dma_init: Registering DMA channels
PL080: IRQ 73, at ce808000, channels 0..8
PL080: IRQ 74, at ce80c000, 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
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 = 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
...
由于该内核没有任何驱动就在这里停住了,后续将逐一移植必要驱动。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值