Chinaunix首页 | 论坛 | 博客
  • 博客访问: 947558
  • 博文数量: 175
  • 博客积分: 2788
  • 博客等级: 少校
  • 技术积分: 2060
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-25 12:25
个人简介

知之者不如好之,好之者不如乐之

文章分类

全部博文(175)

文章存档

2016年(1)

2015年(20)

2014年(8)

2013年(68)

2012年(16)

2011年(35)

2010年(1)

2008年(26)

分类: LINUX

2008-08-19 16:46:29

移植部分主要参考:
[精华] s3c2410全线移植linux2.6.14.1 u盘 cs8900a busybox 详细过程

配置系统可以参考:
Linux2.6.14.1内核移植手记   北理小硕的Blog
http://chern.blog.edu.cn/user2/51200/archives/2007/1658311.shtml 
 
主要摘抄移植部分如下:
编译kernel 2.6.14.1
步骤:
1. tar jxvf linux-2.6.14.1.tar.bz2
2. edit source files

A) edit arch/arm/mach-s3c2410/devs.c

1.
/***********add here*************/
#include
#include
#include
/***********end add*************/

2. 要根据自己的BootLoad需要修改该部分:
/*****************************rei1984 add here***************************/
static struct mtd_partition partition_info[] ={
{
name: "vivi", //注意这里的size和offset的位置和vivi的mtd结构的位置
size: 0x00020000,
offset: 0,
}, {
name: "param",
size: 0x00010000,
offset: 0x00020000,
}, {
name: "kernel",
size: 0x00200000,
offset: 0x00030000,
}, {
name: "root",
size: 0x01E00000,
offset: 0x00230000,
/*mask_flags: MTD_WRITEABLE,*/ //查看了许多Blog都没有这句话
}
};

struct s3c2410_nand_set nandset ={
nr_partitions: 4 ,
partitions: partition_info ,
};

struct s3c2410_platform_nand superlpplatform={
tacls:0, //感谢superlp的Blog,没有人不知道superlp的吧!
twrph0:30,
twrph1:0,
sets: &nandset,
nr_sets: 1,
};
/********************************rei1984 end add****************************/

3.
struct platform_device s3c_device_nand = {
.name = "s3c2410-nand",
.id = -1,
.num_resources = ARRAY_SIZE(s3c_nand_resource),
.resource = s3c_nand_resource,
.dev = {
.platform_data = &superlpplatform //***********rei1984 add here***********
}

};


B) edit arch/arm/mach-s3c2410/mach-smdk2410.c

static struct platform_device *smdk2410_devices[] __initdata={
&s3c_device_usb,
...

/*add*/
&s3c_device_nand, // rei1984 add

};


C) edit drivers/mtd/nand/s3c2410.c

s3c2410_nand_init_chip()
/**** chip->eccmode = NAND_ECC_SOFT; **/
chip->eccmode = NAND_ECC_NONE; //disable ECC,不知道现在的内核2.6.20 ECC能用吗?


D) edit /include/linux/mtd/partitions.h
partitions.h文件的最前面加上#include //为什么kernel出现这么低级的错误?网上也讨论的很少,知道的朋友说明一下。


E) edit fs/kconfig //支持devfs,目前2.6.17以后的kernel放弃devfs,需要udev的支持

menu "Pseudo filesystems"
/*add*/
config DEVFS_FS
bool "/dev file system support (OBSOLETE)"
default y

config DEVFS_MOUNT
bool "Automatically mount at boot"
default y
depends on DEVFS_FS
/*end*/

// edit 终于结束了,以下是配置编译kernel

3. edit makefile
ARCH ?= arm //其实修改SUBARCH 也可以,具体查看makefile
CROSS_COMPILE ?=/usr/local/arm/3.4.1/bin/arm-linux- //注意后面的’-’

4. make zImage

Finish !kernel in /root/arm/linux-2.6.14.1/arch/arm/boot
 
 
 
配置部分可以参考:Linux2.6.14.1内核移植手记 
arm@localhost linux2.6.14]$
cp arch/arm/configs/smdk2410_defconfig .config
[arm@localhost linux2.6.14]$
make menuconfig
在smdk2410_defconfig基础上,我所增删的内核配置项如下:
Loadable module support >
[*] Enable loadable module support
[*] Automatic kernel module loading
System Type >
[*] S3C2410 DMA support
Boot options >
Default kernel command string:
noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0,115200
#说明:mtdblock2代表我的第3个flash分区,它是我的rootfs
# console=ttySAC0,115200使kernel启动期间的信息全部输出到串口0上.
# 2.6内核对于串口的命名改为ttySAC0,但这不影响用户空间的串口编程。
# 用户空间的串口编程针对的仍是/dev/ttyS0等
Floating point emulation >
[*] NWFPE math emulation
This is necessary to run most binaries!!!
#接下来要做的是对内核MTD子系统的设置
Device Drivers >
Memory Technology Devices (MTD) >
[*] MTD partitioning support
#支持MTD分区,这样我们在前面设置的分区才有意义
[*] Command line partition table parsing
#支持从命令行设置flash分区信息,灵活
RAM/ROM/Flash chip drivers >
<*> Detect flash chips by Common Flash
Interface (CFI) probe
<*> Detect nonCFI
AMD/JEDECcompatible
flash chips
<*> Support for Intel/Sharp flash chips
<*> Support for AMD/Fujitsu flash chips
<*> Support for ROM chips in bus mapping
NAND Flash Device Drivers >
<*> NAND Device Support
<*> NAND Flash support for S3C2410/S3C2440 SoC
Character devices >
[*] Nonstandard
serial port support
[*] S3C2410 RTC Driver
#接下来做的是针对文件系统的设置,本人实验时目标板上要上的文件系统是cramfs,故做如下配置
File systems >
<> Second extended fs support #去除对ext2的支持
Pseudo filesystems >
[*] /proc file system support
[*] Virtual memory file system support (former shm fs)
[*] /dev file system support (OBSOLETE)
[*] Automatically mount at boot (NEW)
#这里会看到我们前先修改fs/Kconfig的成果,devfs已经被支持上了
Miscellaneous filesystems >
<*> Compressed ROM file system support (cramfs)
#支持cramfs
Network File Systems >
<*> NFS file system support
保存退出,产生.config文件.
.config文件能从提供的2.4.14.1的内核包中找到,文件名为config.back.
1.4.3编译内核
[arm@localhost linux2.6.14]$
make zImage
arm@localhost linux2.6.14]$
cp arch/arm/configs/smdk2410_defconfig .config
[arm@localhost linux2.6.14]$
make menuconfig
在smdk2410_defconfig基础上,我所增删的内核配置项如下:
Loadable module support >
[*] Enable loadable module support
[*] Automatic kernel module loading
System Type >
[*] S3C2410 DMA support
Boot options >
Default kernel command string:
noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0,115200
#说明:mtdblock2代表我的第3个flash分区,它是我的rootfs
# console=ttySAC0,115200使kernel启动期间的信息全部输出到串口0上.
# 2.6内核对于串口的命名改为ttySAC0,但这不影响用户空间的串口编程。
# 用户空间的串口编程针对的仍是/dev/ttyS0等
Floating point emulation >
[*] NWFPE math emulation
This is necessary to run most binaries!!!
#接下来要做的是对内核MTD子系统的设置
Device Drivers >
Memory Technology Devices (MTD) >
[*] MTD partitioning support
#支持MTD分区,这样我们在前面设置的分区才有意义
[*] Command line partition table parsing
#支持从命令行设置flash分区信息,灵活
RAM/ROM/Flash chip drivers >
<*> Detect flash chips by Common Flash
Interface (CFI) probe
<*> Detect nonCFI
AMD/JEDECcompatible
flash chips
<*> Support for Intel/Sharp flash chips
<*> Support for AMD/Fujitsu flash chips
<*> Support for ROM chips in bus mapping
NAND Flash Device Drivers >
<*> NAND Device Support
<*> NAND Flash support for S3C2410/S3C2440 SoC
Character devices >
[*] Nonstandard
serial port support
[*] S3C2410 RTC Driver
#接下来做的是针对文件系统的设置,本人实验时目标板上要上的文件系统是cramfs,故做如下配置
File systems >
<> Second extended fs support #去除对ext2的支持
Pseudo filesystems >
[*] /proc file system support
[*] Virtual memory file system support (former shm fs)
[*] /dev file system support (OBSOLETE)
[*] Automatically mount at boot (NEW)
#这里会看到我们前先修改fs/Kconfig的成果,devfs已经被支持上了
Miscellaneous filesystems >
<*> Compressed ROM file system support (cramfs)
#支持cramfs
Network File Systems >
<*> NFS file system support
保存退出,产生.config文件.
.config文件能从提供的2.4.14.1的内核包中找到,文件名为config.back.
1.4.3编译内核
[arm@localhost linux2.6.14]$
make zImage

做完这些,应该就可以通过cramfs,jffs2等文件系统启动了,加上前面cs8900网卡驱动的移植,应该就可以通过nfs启动系统了;如果没有文件系统,也下载后,也可以看到内核的启动信息。
阅读(1826) | 评论(0) | 转发(1) |
0

上一篇:移植CS8900

下一篇:用Busybox创建文件系统

给主人留下些什么吧!~~