vivi linux2.6移植笔记
来源:互联网 发布:返利网是淘宝客吗 编辑:程序博客网 时间:2024/05/24 07:21
一、实验目的:
实验箱原OS为Linux 2.4,现在移植Linux2.6内核到开发板。其它硬件资源驱动暂时不考虑。
二、实验资源
硬件资源
CPU
SamsungS3C2410A
Nandflash
SamsungK9D1208V0M 64M
RAM
64M
软件资源
bootloader
vivi
Linuxkernel
三、实验前的准备
1、vivi源代码
2、Linux kernel 源代码。到http://www.kernel.org下载,我用的是2.6.18.8。
3、Linux开发环境,CROSStoolchain2.95.2(用来编译vivi)和4.0.0(用来编译内核)
四、实验步骤
1、修改bootloader
修改arch/s3c2410/smdk.c
NAND flash 原分区为:
文件
地址空间
标志
存储空间
vivi
0x00000000
0x00020000
o
128k=0x00020000
param
0x00020000
0x00030000
o
64k=0x00010000
kernel
0x00030000
0x00130000
o
1m=0x00100000
root
0x00130000
0x00330000
4
2m=0x00200000
user
0x00330000
0x04000000
8
59m+832k
由于2.6内核编译后的压缩镜像,经常超过1m,需将NAND flash改为:
文件
地址空间
标志
存储空间
vivi
0x00000000
0x00020000
o
128k=0x00020000
param
0x00020000
0x00030000
o
64k=0x00010000
kernel
0x00030000
0x00300000
o
2m+832k=0x002d0000
root
0x00300000
0x00600000
4
3m=0x00300000
user
0x00600000
0x04000000
8
48m=0x03000000
要达到此目的,需要修改arch/s3c2410/smdk.c文件中的default_mtd_partitions[]。修改后的内容为:
mtd_partition_tdefault_mtd_partitions[] = {
{
name:"vivi",
offset:0,
size:0x00020000,
//vivi size 128kmodifyed by Eric
flag:0
}, {
name:"param",
offset:0x00020000,
size:0x00010000,
//param size64k
flag:0
}, {
name:"kernel",
offset:0x00030000,
size:0x002d0000,
//kernel size2m+832k
flag:0
}, {
name:"root",
offset:0x00300000,
size:0x00300000,
//root size3m
flag:MF_BONFS
}, {
name:"user",
offset:0x00600000,
size:0x03000000,
//user size48m
flag:MF_JFFS2
}
};
由于在2.4内核中串口ttyS0,在2.6内核中改为ttySAC0,需要将此文件中的linux_cmd[]改为:
//byEric
char linux_cmd[] ="noinitrd root=/dev/bon/3 init=/linuxrc console=ttySAC0console=tty0";
其中:
noinitrd:不使用initrd文件
root=/dev/bon/3:代表nandflash的第4个分区,作为rootfs
init=/linuxrc:启动初始化文件位置
console=ttySAC0:控制台使用串口1
console=tty0:控制台使用终端1
修改好此文件后,配置编译vivi
配置编译vivi
在交叉编译前需要修改vivi根目录下的Makefile文件中的相关设置
(1)将CROSS_COMPILE指向交叉编译器路径。由于vivi用4.0.0交叉编译器,编译出错,需选择用2.95.2或2.95.3交叉编译器
我的是:CROSS_COMPILE=…../toolchain/2.95.2/bin/arm-linux-
(2)将ARM_GCC_LIB指向链接时使用的标准文件库路径,一般和CROSS_COMPILE在同一上层目录中
我的是:ARM_GCC_LIB=…../toolchain/2.95.2/lib/gcc-lib/arm-linux/2.95.2
(3)将LINUX_INCLUDE_DIR指向linux内核头文件所在路径
我的是:LINUX_INCLUDE_DIR=…../kernel/linux-2.6.18.8/include
设置好Makefile文件后,开始编译vivi,步骤很简单:
$make distclean
$makemenuconfig//我在此处运行时出错,显示lxtemp.c未找到,最后改到root用户后,恢复正常
$make
编译好后,在vivi根目录下出现vivi文件:)
2、Linux2.6内核移植
修改Makefile文件
修改内核根目录下的Makefile文件,指明交叉编译器
找到ARCH和CROSS_COMPILE,修改为:
ARCH ?=arm
CROSS_COMPILE?=/opt/eldk/usr/bin/arm-linux-
设置flash分区
修改arch/arm/mach-s3c2410/devs.c文件
添加如下内容:
#include<linux/mtd/partitions.h>
#include<linux/mtd/nand.h>
#include<asm/arch/nand.h>
……………………………
static structmtd_partition partition_info[]={
{
name:"vivi",
size:0x00020000,
offset:0x00000000
},{
name:"param",
size:0x00010000,
offset:0x00020000
},{
name:"kernel",
size:0x002d0000,
offset:0x00030000
},{
name:"root",
size:0x0030000,
offset:0x00300000
},{
name:"user",
size:0x03000000,
offset:0x00600000
}
};
static structs3c2410_nand_set nandset = {
nr_partitions:5,
partitions:partition_info,
};
static structs3c2410_platform_nand superlpplatform = {
tacls:0,
twrph0:30,
twrph1:0,
sets:&nandset,
nr_sets:1,
};
static struct resources3c_nand_resource[] = {
[0] ={
.start =S3C2410_PA_NAND,
.end = S3C2410_PA_NAND+ S3C24XX_SZ_NAND - 1,
.flags =IORESOURCE_MEM,
}
};
struct platform_devices3c_device_nand = {
.name ="s3c2410-nand",
.id =-1,
.num_resources =ARRAY_SIZE(s3c_nand_resource),
.resource =s3c_nand_resource,
.dev ={
.platform_data =&superlpplatform
}
};
修改arch/arm/mach-s3c2410/mach-smdk2410.c
指定启动时初始化分区,使上面的修改生效。找到*smdk2410_devices[]__initdata
Static structplatform_device *smdk2410_devices[]__initdata ={
…….
…….
&s3c_device_iis,
&s3c_device_nand,
}
修改drivers/mtd/nand/s3c2410.c禁止flashECC校验
找到s3c2410_nand_init_chip()函数,在该函数体最后加上:
chip->ecc.mode =NAND_ECC_NONE;
配置内核
修改fs/Kconfig,支持启动时挂载devfs
$vim fs/Kconfig
找到menu “Pseudo filesystem”
在其中添加:
config DEVFS_FS
bool “/dev file system support(OBSOLETE)”
default y
config DEVFS_MOUNT
bool “Automatically mount atboot”
default y
depends on DEVFS_FS
(2)配置内核产生.config文件
为简化配置内核文件的复杂度,先复制到arch/arm/configs/smdk2410_defconfig到内核根目录下。
$cp arch/arm/configs/smdk2410_defconfig.config
$make menuconfig
增删的内核配置选项如下:
Loadable modulesuport--->
[*]Enable loadable modulesuport
[*]Automatic kernel moduleloading
System Type--->[*]S3C2410DMA suport
Boot options --->Defaultkernel command string:
noinitrd root=/dev/mtdblock3init=/linuxrc console=ttySAC0,115200
mtdblock3 代表第四个flash分区,为root分区
Floating pointemulation---->
[*]NWFPE math emulation
#MTD子系统的配置
DeviceDrivers--->
Memory TechnologyDevices(MTD)--->
............................................
[*]MTD partitioning support
[*]Command line partition tableparsing
............................................
[*]RAM/ROM/Flash chipdrivers-->
<*>Detectflash chip by Common Flash Interface(CFI) prob
<*>Detectnon-CFI AMD/JEDEC-compatible flash chip
<*>Supportfor Intel/Sharp flash chip
<*>Supportfor AMD/Fujitsu flash chip
<*>Supportfor ROM chip in bus mapping
NAND Flash DeviceDrivers--->
................................
<*>NANDDevice Support
<*>NANDFlash support foe S3C2410/S3C2440 Soc
Characterdevices--->
.............................
[*]Non-standard serial portsupport
[*]S3C2410 RTC Driver
Filesystems--->
<>Secondextended fs support #去除ext2支持
Pseudofilesystems--->
[*]Virtual memory file systemsupport(former shm fs)
[*]/dev file systemsupport(OBSOLETE)
[*]Automatically mount atboot(NEW)
Miscellaneousfilesystems--->
............................
<*>JFFS2
<*>cramfs
.............................
Network FileSystems---->
<*>NFS filesystem support
保存退出
编译内核
$make zImage
烧写flash
烧写方法见:.................不再赘述:)
- vivi linux2.6移植笔记
- 移植vivi引导linux2.6.14.7内核修改的地方
- Linux2.6内核移植笔记(一)
- 移植vivi
- vivi移植
- vivi移植
- vivi移植
- linux2.6移植
- linux2.6_yaffs2移植
- Linux2.6内核的vivi分区及内核MTD分区
- Linux2.6内核的vivi分区及内核MTD分区
- Linux2.6内核的vivi分区及内核MTD分区
- Linux2.6内核的vivi分区及内核MTD分区
- Linux2.6移植:DM9000驱动
- Linux2.6移植:DM9000驱动 .
- Linux2.6移植:DM9000驱动
- Linux2.6移植:DM9000驱动
- 成功移植linux2.6.38内核到TQ2440 …
- Copy_from&to_user详解 转载
- copy_to_user,copy_from_use…
- 在oracle数据库中插入含有&符号的字符串
- IAR for ARM 6.20 完美破解
- minicom的使用方法
- vivi linux2.6移植笔记
- Arm-linux下USB摄像头的视频…
- EditPlus3注册码
- 程序员修身养性的十大原则
- 献给我的爱机——google nexus s
- 【C语言】动态分配内存、voi…
- qt moc笔记
- Ubuntu下切换登录管理器
- 毕业生自我鉴定