tiny6410内核移植

一、开发环境

宿主机:Fedora9.0 ubuntu10.04

开发板:tiny6410

编译器:4.3.2

二、内核移植

1.下载源码

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

linux-2.6.38

2.解压

进入根目录下的/opt目录,解压源码)

 

  tar xvfj /mnt/ubuntu/linux-2.6.38.tar.bz2

3.修改架构,编译器(需要在arm上运行,所以用交叉编译器)

解压完进入解压出来的linux-2.6.38目录

#vi  Makefile (或者用gedit

191行改为   

 ARCH            ?=arm

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

4.生成默认配置文件

#cparch/arm/configs/s3c6400_defconfig   .config

Linux内核中已经自带了关于我们6410开发板的配置。

5.修改配置项

#make menuconfig

 

Generalsetup->(/usr/4.5.1/bin/arm-linux-) Cross-compiler tool prefix    我将编译器解压到了/opt/Friendly/toolschain/4.5.1/bin目录如果第三步中以修改“CROSS.complier ? = arm-linux-”此项,这步可以不作

SystemType->[*] MINI6410  选上,

 

 

 

6.拷贝NAND FLASH驱动

drivers/mtd/nand/s3c_nand.c

     arch/arm/plat-samsung/include/plat/regs-nand.h 覆盖掉

 drivers/mtd/nand/s3c_nand_mlc.fo

   drivers/mtd/nand/nand_base.c  

7修改nand驱动makefile

    drivers/mtd/nand/Makefile20行增加

obj-$(CONFIG_MTD_NAND_S3C)            +=s3c_nand.o

末尾再增加

S3C_NAND_MLC_SRC= $(shell ls drivers/mtd/nand/s3c_nand_mlc.c 2>/dev/null)

ifeq($(S3C_NAND_MLC_SRC),)

obj-$(CONFIG_MTD_NAND_S3C)            +=s3c_nand_mlc.fo

else

obj-$(CONFIG_MTD_NAND_S3C)            +=s3c_nand_mlc.o

endif

8.增加相应选项

make menuconfig

  Device Drivers---> 

            <*> Memory Technology Device (MTD) support  --->

                            [*]   MTD partitioning support

                              [*]    Command line partition table parsing 

                            <*>   Direct char device access to MTD devices 

                            <*>  Caching block device access to MTD devices

                            <*>  NAND Device Support  --->

                                       <>   NAND Flash support for Samsung S3C SoCs  去掉不要选

                                          <*>  NAND Flash support for S3C SoC  

                                           [*]    S3C NAND Hardware ECC

 

 

 

9.编译

make  zImage

如果顺利通过则出现如下信息:

      OBJCOPYarch/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

 Building modules, stage 2.

下载到开发板中

Make后生成的内核文件(zimage)在/arch/arm/boot/

 

此时启动会出现如下问题

usbcore: registered new interface driverusbhid

usbhid: USB HID core driver

VFP support v0.3: implementor 41architecture 1 part 20 variant b rev 5

drivers/rtc/hctosys.c: unable to openrtc device (rtc0)

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:

1f00            4096 mtdblock0  (driver?)

1f01            8192 mtdblock1  (driver?)

1f02         2084864 mtdblock2  (driver?)

Kernel panic - not syncing: VFS: Unable tomount root fs on unknown-block(0,0)

[](unwind_backtrace+0x0/0xe4) from [] (panic+0x50/0x16c)

[] (panic+0x50/0x16c)from [] (mount_block_root+0x238/0x288)

[](mount_block_root+0x238/0x288) from [] (prepare_namespace+0x88/0x1b4)

[](prepare_namespace+0x88/0x1b4) from [](kernel_init+0x108/0x148)

[](kernel_init+0x108/0x148) from [] (kernel_thread_exit+0x0/0x8)

OK                 //在此卡住不动了

其中红色部分表示找不着系统文件,因为tiny6410的系统文件为ubifs格式,所以下面我们要将ubifs系统文件驱动移植到内核中

三、   添加yaffs2文件系统的支持

首先向内核源代码中加入支持yaffs2的源代码

解压yaffs2.tar.bz2  这个源码要比较高版本的,其他就没有要求了

进入解压出的目录

执行如下命令

./patch-ker.sh   c    m   +内核源码路径

然后进入内核源码目录

执行

Make menuconfig

选择File systems

选择   [*] Miscellaneous filesystems --->  

选择上<*>   yaffs2 file system support以及与yaffs2相关选项。

退出保存

重新编译 make zImage

然后烧写到开发板中即可。

四、   添加对UBIFS文件系统的支持

1.配置内核支持UBIFS

Device Drivers --->

Memory Technology Device(MTD) support --->

UBI - Unsorted blockimages --->

Enable UBI

2.配置mtd支持UBI接口

File systems --->

Miscellaneous filesystems--->

UBIFS file system support

3.再次Make

#make zImage

一、       下载到开发板

如果成功,如下图:

usbcore:registered new interface driver usbhid

usbhid:USB HID core driver

VFPsupport v0.3: implementor 41 architecture 1 part 20 variant b rev 5

drivers/rtc/hctosys.c:unable to open rtc device (rtc0)

mmc0:mmc_rescan_try_freq: trying to init card at 300000 Hz

mmc0:mmc_rescan_try_freq: trying to init card at 200000 Hz

UBIFS:recovery needed

usb1-1: new full speed USB device using s3c2410-ohci and address 2

mmc0:mmc_rescan_try_freq: trying to init card at 100000 Hz

UBIFS:recovery completed

UBIFS: mounted UBI device 0, volume 0, name"FriendlyARM-root"

UBIFS: file system size:  2061287424 bytes (2012976 KiB, 1965 MiB, 1997 LEBs)

UBIFS:journal size:       12517376 bytes (12224KiB, 11 MiB, 13 LEBs)

UBIFS:media format:       w4/r0 (latest isw4/r0)

UBIFS:default compressor: lzo

UBIFS:reserved for root:  0 bytes (0 KiB)

VFS: Mounted root (ubifs filesystem) on device 0:10.

hwclock: can't open '/dev/misc/rtc': Nosuch file or directory

[01/Jan/1970:00:00:18 +0000] boa.c:173 -unable to create socket: Function not implemented

                       

opendevice leds: No such file or directory

/usr/sbin/alsactl: load_state:1610: Nosoundcards found...

                       

ifconfig: socket: Function not implemented

Try to bring eth0 interface up......cat:can't open'/sys/class/net/eth0/address':No such file or directory

ifconfig: socket: Function notimplemented

route: socket: Function not implemented

Done

 

 

你可能感兴趣的:(tiny6410内核移植)