QT6410移植linux-2.6.39 笔记(一)-搭建开发板环境

Author:    eilian

Blog:       http://blog.csdn.net/eilianlau

Copyright:Original

Date:   2011、12、13

1、Hosting environment:VMare ubuntu10.04 

2、Cross-compiling environment:arm-2009q3.tar.bz2

3、Development board:QT6410

4、nanflash:K9F2G08(256M)

5、linux -version:Linux-2.6.39

6、uboot-version: u-boot-2010.06

一、下载并解压内核源码

a)在命令行终端中可以通过下列方式下载,当然用其它下载工具下载

root@bootloader:/home/eilian/development/Android#cd ../Linux

root@bootloader:/home/eilian/development/Linux# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.tar.gz

b)解压源码

root@bootloader:/home/eilian/development/Linux#
root@bootloader:/home/eilian/development/Linux# tar zxvf linux-2.6.39.tar.gz
root@bootloader:/home/eilian/development/Linux# ls
linux-2.6.32.2        
linux-2.6.39        
linux-2.6.36.2         linux-2.6.39.tar.bz2
linux-2.6.36.2.tar.gz  linux-2.6.39.tar.gz

root@bootloader:/home/eilian/development/Linux# cd linux-2.6.39
root@bootloader:/home/eilian/development/Linux/linux-2.6.39# 

c)指定交叉编译器

移植目的让 Linux-2.6.39 可以在QT6410 上运行。首先,使得Linux-2.6.39的缺省目标平台成为ARM 的平台,修改主目录下的Makefile。

用vi打开Makefile,定位到196行,修改如下:

root@bootloader:/home/eilian/development/Linux/linux-2.6.39# vi Makefile

# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
export KBUILD_BUILDHOST := $(SUBARCH)
ARCH        ?= arm
CROSS_COMPILE    ?= arm-linux-

# Architecture as present in compile.h
UTS_MACHINE     := $(ARCH)
SRCARCH     := $(ARCH)

修改完成后退出保存

二、创建目标平台

从smdk6410到qt6410

root@bootloader:/home/eilian/development/Linux/linux-2.6.39#cd arch/arm/mach-s3c64xx

root@bootloader:/home/eilian/development/Linux/linux-2.6.39/arch/arm/mach-s3c64xx#cp mach-smdk6410.c mach-qt6410.c

将mach-mach-qt6410.c文件中的所有smdk6410改成qt6410

root@bootloader:/home/eilian/development/Linux/linux-2.6.39/arch/arm/mach-s3c64xx#vi mach-qt6410.c

   

修改mach-s3c64xx目录下的Makefile和Kconfig 修改如下:

Kconfig:添加如下红色代码

config MACH_SMDK6410
    bool "SMDK6410"
    select CPU_S3C6410
    select SAMSUNG_DEV_ADC
    select S3C_DEV_HSMMC
    select S3C_DEV_HSMMC1
    select S3C_DEV_I2C1
    select SAMSUNG_DEV_IDE
    select S3C_DEV_FB
    select S3C_DEV_RTC
    select SAMSUNG_DEV_TS
    select S3C_DEV_USB_HOST
    select S3C_DEV_USB_HSOTG
    select S3C_DEV_WDT
    select SAMSUNG_DEV_KEYPAD
    select SAMSUNG_DEV_PWM
    select HAVE_S3C2410_WATCHDOG if WATCHDOG
    select S3C64XX_SETUP_SDHCI
    select S3C64XX_SETUP_I2C1
    select S3C64XX_SETUP_IDE
    select S3C64XX_SETUP_FB_24BPP
    select S3C64XX_SETUP_KEYPAD
    help
      Machine support for the Samsung SMDK6410
      
config MACH_QT6410
    bool "QT6410"
    select CPU_S3C6410
    select SAMSUNG_DEV_ADC
    select S3C_DEV_HSMMC
    select S3C_DEV_HSMMC1
    select S3C_DEV_I2C1
    select SAMSUNG_DEV_IDE
    select S3C_DEV_FB
    select S3C_DEV_RTC
    select SAMSUNG_DEV_TS
    select S3C_DEV_USB_HOST
    select S3C_DEV_USB_HSOTG
    select S3C_DEV_WDT
    select SAMSUNG_DEV_KEYPAD
    select SAMSUNG_DEV_PWM
    select HAVE_S3C2410_WATCHDOG if WATCHDOG
    select S3C64XX_SETUP_SDHCI
    select S3C64XX_SETUP_I2C1
    select S3C64XX_SETUP_IDE
    select S3C64XX_SETUP_FB_24BPP
    select S3C64XX_SETUP_KEYPAD
    help
      Machine support for the Samsung QT6410

Makefile:添加如下红色代码

obj-$(CONFIG_MACH_ANW6410)    += mach-anw6410.o
obj-$(CONFIG_MACH_SMDK6400)    += mach-smdk6400.o
obj-$(CONFIG_MACH_SMDK6410)    += mach-smdk6410.o
obj-$(CONFIG_MACH_QT6410)    += mach-qt6410.o
obj-$(CONFIG_MACH_REAL6410)     += mach-real6410.o
obj-$(CONFIG_MACH_MINI6410)     += mach-mini6410.o
obj-$(CONFIG_MACH_NCP)        += mach-ncp.o
obj-$(CONFIG_MACH_HMT)        += mach-hmt.o
obj-$(CONFIG_MACH_SMARTQ)    += mach-smartq.o
obj-$(CONFIG_MACH_SMARTQ5)    += mach-smartq5.o
obj-$(CONFIG_MACH_SMARTQ7)    += mach-smartq7.o


三、About machine Number

打开arch/arm/tools/mach-types文件定位到217行左右,修改如下

at91sam9g20ek        MACH_AT91SAM9G20EK    AT91SAM9G20EK        1624
qt6410        MACH_QT6410        QT6410        1626
u300            MACH_U300        U300            1627


这需要两者相匹配,如果内核的机器码和bootloader 传入的不匹配,就会经常出现下面的错误:
Uncompressing Linux................................................................................................................................. done, booting
the kernel.             不动了

接着修改linux-2.6.39/arch/arm/mach-s3c64xx/qt6410.c定位到文件末尾处

MACHINE_START(S3C6410, "SMDK6410") , 将其修改为
MAC HINE_START(QT6410, "QT6410 development board")
notes:开发板运行后,在命令行终端输入:cat /proc/cpuinfo 可以看到我们添加的开发板信息,当然这个信息可以定制成我们需要的信息

四、配置、编译测试

root@bootloader:/home/eilian/development/Linux/linux-2.6.39#cp arch/arm/configs/s3c6400_defconfig .config
root@bootloader:/home/eilian/development/Linux/linux-2.6.39#make menuconfig

出现下图所示内核配置根菜单

   

 按上下箭头键移动到 System Type,按回车进入该子菜单,如图

   

设置完后退出

root@bootloader:/home/eilian/development/Linux/linux-2.6.39#make uImage

等待若干久后出现

  SYSMAP  .tmp_System.map
  OBJCOPY arch/arm/boot/Image
  Kernel: arch/arm/boot/Image is ready
  AS      arch/arm/boot/compressed/head.o
  GZIP    arch/arm/boot/compressed/piggy.gzip
  AS      arch/arm/boot/compressed/piggy.gzip.o
  CC      arch/arm/boot/compressed/misc.o
  CC      arch/arm/boot/compressed/decompress.o
  SHIPPED arch/arm/boot/compressed/lib1funcs.S
  AS      arch/arm/boot/compressed/lib1funcs.o
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-2.6.39
Created:      Mon Dec 12 20:29:35 2011
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    1266444 Bytes = 1236.76 kB = 1.21 MB
Load Address: 50008000
Entry Point:  50008000
  Image arch/arm/boot/uImage is ready


root@bootloader:/home/eilian/development/Linux/linux-2.6.39#cparch/arm/boot/uImage /tftpboot/

给开发板上电(开发板已烧入uboot)打开超级终端


U-Boot 2010.06 (Dec 12 2011 - 18:39:28) for QT6410
**********************************************
**    u-boot-2010.06                     
**    Updated for QT6410 Board         
**    Version 1.0 (11-12-15)           
**    Author: eilian                   
**    blog: http://blog.csdn.net/eilianlau
**    E-mail: 305075262@qq.com         
**********************************************
CPU:     S3C6410@667MHz
         Fclk = 667MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode)
Board:   QT6410
DRAM:  128 MiB
NAND:  256 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   dm9000
Hit any key to stop autoboot:  0
QT6410# tftp 50018000 uImage
dm9000 i/o: 0x18000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:40:5c:26:0a:5b
operating at unknown: 15 mode
Using dm9000 device
TFTP from server 211.67.217.136; our IP address is 211.67.217.138
Filename 'uImage'.
Load address: 0x50018000
Loading: T #################################################################
         #################################################################
         #################################################################
         #####################################################
done
Bytes transferred = 1266508 (13534c hex)
QT6410# bootm 50018000
## Booting kernel from Legacy Image at 50018000 ...
   Image Name:   Linux-2.6.39
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1266444 Bytes = 1.2 MiB
   Load Address: 50008000
   Entry Point:  50008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.39 (root@bootloader) (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #1 Mon Dec 12 20:29:17 CST 2011
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: QT6410 development board
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=667000000, M=533000000, E=24000000
S3C64XX: HCLK2=266500000, HCLK=133250000, PCLK=66625000
mout_apll: source is fout_apll (1), rate is 667000000
mout_epll: source is epll (1), rate is 24000000
mout_mpll: source is mpll (1), rate is 533000000
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 mout_epll (0), rate is 24000000
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: 32512
Kernel command line: root=/dev/mtdblock2 rootfstype=yaffs2 init=/linuxrc nconsole=tty1 console=ttySAC0,115200
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 127192k/127192k available, 3880k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    DMA     : 0xff600000 - 0xffe00000   (   8 MB)
    vmalloc : 0xc8800000 - 0xf6000000   ( 728 MB)
    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .init : 0xc0008000 - 0xc0022000   ( 104 kB)
      .text : 0xc0022000 - 0xc024dc88   (2224 kB)
      .data : 0xc024e000 - 0xc0271200   ( 141 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... 666.41 BogoMIPS (lpj=3332096)
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 c8808000, channels 0..8
PL080: IRQ 74, at c880c000, 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 65 KHz
s3c-i2c s3c2440-i2c.0: i2c-0: S3C I2C adapter
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

。。。。。。。。。。。。。。第一步到此结束找个时间把uboot的移植过程记录一下


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值