linux系统移植实验手册文档格式.docx

上传人:b****5 文档编号:18319106 上传时间:2022-12-15 格式:DOCX 页数:24 大小:29.02KB
下载 相关 举报
linux系统移植实验手册文档格式.docx_第1页
第1页 / 共24页
linux系统移植实验手册文档格式.docx_第2页
第2页 / 共24页
linux系统移植实验手册文档格式.docx_第3页
第3页 / 共24页
linux系统移植实验手册文档格式.docx_第4页
第4页 / 共24页
linux系统移植实验手册文档格式.docx_第5页
第5页 / 共24页
点击查看更多>>
下载资源
资源描述

linux系统移植实验手册文档格式.docx

《linux系统移植实验手册文档格式.docx》由会员分享,可在线阅读,更多相关《linux系统移植实验手册文档格式.docx(24页珍藏版)》请在冰豆网上搜索。

linux系统移植实验手册文档格式.docx

/source/kernel/linux-2.6.14#

exportPATH=$PATH:

/home/linux/crosstool/gcc-3.4.5-glibc-2.3.6/arm-softfloat-linux-gnu/bin:

(动态加载环境变量,终端关闭后,自己所加载的环境变量立即消失)。

或者修改./bashrc文件:

(静态加载环境变量,不随终端的关闭而消失)

/source/kernel/linux-2.6.14#vim~/.bashrc在文件最后添加

再重新登陆:

/source/kernel/linux-2.6.14#su–

下面的所有操作都在上个实验结果的linux2.6.14内核源码目录中,可以参考前面的实验。

(3)添加网卡驱动到内核

将cs8900a.h和cs8900a.c文件拷贝到内核代码目录drivers/net中:

linux@:

/source/kernel/linux-2.6.14$cp/mnt/hgfs/disk/cs8900a.*drivers/net

(4)修改Makefile和Kconfig文件

/source/kernel/linux-2.6.14-$vimdrivers/net/Makefile

在文件中添加:

obj-$(CONFIG_CS8900a)+=cs8900a.o

(5)保存退出,修改Kconfig文件linux@:

/source/kernel/linux-2.6.14-$vimdrivers/net/Kconfig

在以下代码段下面

configDM9000

tristate"

DM9000support"

dependsonARM&

&

NET_ETHERNET

selectCRC32

selectMII

---help---

SupportforDM9000chipset.

Tocompilethisdriverasamodule,chooseMhereandread

<

file:

Documentation/networking/net-modules.txt>

.Themodulewillbe

calleddm9000.

加入以下信息:

configCS8900a

tristate"

CS8900asupport"

(注意开头使用TAB键,下同)

dependsonARM&

NET_ETHERNET

---help---

Supportforcs8900achipset.

Tocompilethisdriverasamodule,chooseMhereandread.

(6)支持启动时挂载devfs

为了内核支持devfs以及在启动时并在/sbin/init运行之前能自动挂载/dev为devfs文

件系统,并且自动创建设备结点,修改fs/Kconfig文件:

/source/kernel/linux-2.6.14#vimfs/Kconfig

找到menu"

Pseudofilesystems"

添加如下语句:

configDEVFS_FS

bool"

/devfilesystemsupport(OBSOLETE)"

defaulty

configDEVFS_MOUNT

Automaticallymountatboot"

dependsonDEVFS_FS

(7)为网卡驱动添加头文件

#touchinclude/asm-arm/arch-s3c2410/smdk2410.h

在文件smdk2410.h中添加如下内容:

#ifndef__ASM_ARCH_SMDK2410_H

#define__ASM_ARCH_SMDK2410_H

#include<

linux/config.h>

#definevSMDK2410_ETH_IO0xE9000000//网卡的虚拟地址

#definepSMDK2410_ETH_IO0x19000000//网卡的物理地址

#defineSMDK2410_ETH_IRQIRQ_EINT9//网卡中断号

#endif

(8)建立网卡地址内存映射

/source/kernel/linux-2.6.14#vimarch/arm/mach-s3c2410/mach-smdk2410.c

添加:

asm/arch-s3c2410/smdk2410.h>

staticstructmap_descsmdk2410_iodesc[]__initdata={

/*nothinghereyet*/

{

vSMDK2410_ETH_IO,pSMDK2410_ETH_IO,SZ_1M,MT_DEVICE}

};

(9)配置内核支持CS8900A网卡

/source/kernel/linux-2.6.14#makemenuconfig

Loadablemodulesupport--->

[*]Enableloadablemodulesupport

[*]Automatickernelmoduleloading

Floatingpointemulation--->

[*]NWFPEmathemulation//增加对NWFPE浮点运算库的支持

Filesystems--->

//针对文件系统的设置

Pseudofilesystems--->

[*]/procfilesystemsupport

[*]Virtualmemoryfilesystemsupport(formershmfs)

[*]/devfilesystemsupport(OBSOLETE)

[*]Automaticallymountatboot(NEW)

NetworkFileSystems--->

<

*>

NFSfilesystemsupport//支持nfs文件系统

[*]RootfilesystemonNFS

DeviceDrivers--->

//配置网卡驱动:

Networkdevicesupport--->

[*]Networkdevicesupport

Ethernet(10or100Mbit)--->

[*]Ethernet(10or100Mbit)

CS8900asupport

保存退出,产生.config文件.

(10)编译内核产生zImage文件,并将arch/arm/boot/zImge拷贝到/tftpboot目录中

(11)拷贝rootfs-.tar.gz到配置了tftp及nfs服务的ubantu7.04环境中

假定/source/rootfs为nfs的服务目录,则:

/source#cprootfs.tar.gz/source

/source#tarzxvfrootfs.tar.gz

在目录/souce/rootfs下存放着一个可用的文件系统(文件系统的实验在后面的实验中会涉及到)。

确保主机端tftp及nfs服务是开启的。

(12)修改内核启动参数

GEC2410#setenvbootcmdtftp30008000zImage\;

go30008000

GEC2410#setenvbootargsroot=nfsnfsroot=192.168.1.23:

/source/rootfsip=192.168

.1.134console=ttySAC0,115200init=/linuxrc

GEC2410#saveenv

(13)启动开发平台,在超级终端观察现象

GEC2410#boot

如果顺利,可以在串口终端显示linux命令行终端了!

实验五Linux-2.6.14内核移植--NandFlash驱动的添加

本实验通过在上个实验结果的linux2.6.14内核上移植NANDFlash驱动,使其可以设别到NANDFlash分区,并可以管理相应的Flash设备。

从而进一步完善系统结构,并通过移植的过程来了解nandflash的移植方法。

1、Ubuntu7.04发行版

在linux2.6.14内核中已经包含了s3c2410的nandflash控制器驱动,但需要做一些配置工作才能正常使用。

(1)指明分区信息,建立分区表

在arch/arm/mach-s3c2410/decs.c文件中,添加分区信息:

#vimarch/arm/mach-s3c2410/devs.c

添加:

linux/mtd/partitions.h>

linux/mtd/nand.h>

asm/arch/nand.h>

staticstructmtd_partitionpartition_info[]={

name:

"

u-boot"

//名称

size:

0x40000,//大小

offset:

0,//偏移量

},{

kernel"

0x001c0000,

0x00040000,

},{

root"

0x02300000,

0x00200000,

user"

0x01B00000,

0x02500000,

}

//加入nandflash分区

structs3c2410_nand_setnandset={

nr_partitions:

4,//nr_partitions为分区数

partitions:

partition_info,//partitions:

partition_info为分区表

(2)建立nandflash硬件支持

structs3c2410_platform_nandsuperlpplatform={

tacls:

0,

twrph0:

30,

twrph1:

sets:

nandset,

nr_sets:

1,

/*这些参数的含义请参看s3c2410的关于NANDFLASH的datasheet*/

(3)加入nandflash芯片支持到nandflash驱动

修改此文件arch/arm/mach-s3c2410/devs.c中的s3c_device_nand结构体变量,添加对dev成员的赋值:

structplatform_devices3c_device_nand={

.name="

s3c2410-nand"

.id=-1,

.num_resources=ARRAY_SIZE(s3c_nand_resource),

.resource=s3c_nand_resource,

//在这添加如下代码:

.dev={

.platform_data=&

superlpplatform

}

/*id有效设备编号,如果只有一个定义为-1,如果有多个则从0开始计算,num_resource定义有几个NANDFLASH芯片资源,resouce定义NANDFLASH芯片资源的首地址。

*/

(4)指定启动时初始化

kernel启动时依据我们对分区的设置进行初始配置,修改

arch/arm/mach-s3c2410/mach-smdk2410.c文件,具体操作如下:

#vimarch/arm/mach-s3c2410/mach-smdk2410.c

修改smdk2410_devices[].指明初始化时包括我们在前面所设置的flash信息

staticstructplatform_device*smdk2410_devices[]__initdata={

s3c_device_usb,

s3c_device_lcd,

s3c_device_wdt,

s3c_device_i2c,

s3c_device_iis,

s3c_device_nand,/*added*/

(5)配置MTD,具体操作如下

/source/kernel/linux-2.6.14#makemenuconfig

MemoryTechnologyDevices(MTD)--->

[*]MTDpartitioningsupport

NANDFlashDeviceDrivers--->

NANDDeviceSupport

NANDFlashsupportforS3C2410/S3C2440SoC

这些选项代表对NANDFLASH的操作。

(6)编译内核,并将arch/arm/boot/zImge烧写到开发板

(7)启动系统,在串口终端输入:

/#cat/proc/mtd

dev:

sizeerasesizename

mtd0:

0004000000004000"

mtd1:

001c000000004000"

mtd2:

0230000000004000"

cramfs"

mtd3:

01b0000000004000"

user_rootfs"

可以看到系统已经可以支持nandflash了。

实验六Linux-2.6.14内核移植--Yaffs2文件系统移植

Yaffs2是一种专门为NANDFlash设计的可读写文件系统,本实验是在前面以上的实验的基础上,加入了对yaffs2的支持,从而进一步完善系统结构,通过移植的过程来了解yaffs2的移植方法。

3、交叉编译器arm-linux-gcc

(1)下载yaffs2源代码,下载地址为:

http:

//www.aleph1.co.uk/cgi-bin/viewcvs.cgi/yaffs2.tar.gz?

view=tar

并假设将源代码放在/source/yaffs2/目录下。

在linux2.6.14源码树中fs目录下建立yaffs2文件夹,把yaffs2源码复制过去。

相关的命令如下:

#mkdiryaffs2

#cdyaffs2/

#cp/source/yaffs/yaffs2/*.h./

#cp/source/yaffs/yaffs2/*.c./

#cp/source/yaffs/yaffs2/Makefile.kernel./Makefile

#cp/source/yaffs/yaffs2/Kconfig./

(2)修改fs目录下的Makefile

#vimMakefile

添加下面一行:

obj-$(CONFIG_YAFFS_FS)+=yaffs2/

(3)修改fs目录下Kconfig:

#vimKconfig

找到下面的代码:

configUFS_FS_WRITE

UFSfilesystemwritesupport(DANGEROUS)"

dependsonUFS_FS&

EXPERIMENTAL

help

SayYhereifyouwanttotrywritingtoUFSpartitions.Thisis

experimental,soyoushouldbackupyourUFSpartitionsbeforehand.

source"

fs/yaffs2/Kconfig"

endmenu

注意:

在Kconfig中添加的选项位置决定了配置内核时选项出现在那个层次目录中,为了保持配置选项目路结构清晰,source"

一定要添加在

menu"

Miscellaneousfilesystems"

………………

之间的位置上,如上所示添加在了endmenu行的上方,作为fs的最后一个选项。

(4)配置内核选项,目的是内核支持Yaffs2文件系统

Miscellaneousfilesystems--->

YAFFS2filesystemsupport

[*]Autoselectyaffs2format

(5)编译内核,重新下载。

在终端下执行:

/#cat/proc/filesystems

nodevsysfs

nodevrootfs

nodevbdev

nodevproc

nodevsockfs

nodevpipefs

nodevfutexfs

nodevtmpfs

nodevinotifyfs

nodeveventpollfs

nodevdevpts

ext2

cramfs

nodevramfs

nodevdevfs

nodevnfs

nodevnfsd

romfs

yaffs

yaffs2

nodevrpc_pipefs

可以看出内核支持了多种文件系统,包括yaffs2。

(6)测试yaffs2文件系统

从nandflash移植实验中可以看出/dev/mtdblock/3是用户分区。

[root@192/]#mount-tyaffs2/dev/mtdblock/3/tmp

顺利的话,就可以在/tmp下,写入文件了。

重新启动、挂载yaffs2后,写入的文件仍然保存在flash上。

 

实验七Linux-2.6.14内核移植--添加USB设备驱动

在GEC2410开发板上进行linux-2.6.14内核的移植,这个部分完成USB设备驱动的添加,完成相应的功能。

(1)配置2.6.14支持u盘

1.

devicedrivers--->

usbsupport--->

<

SupportforHost-sideUSB

OHCIHCDsupport

USBMassStoragesupport

这些配置是对host端和device端的支持.

2.

SCSIdevicesupport--->

SCSIdisksupport

<

SCSIgenericsupport

SCSImediachangersupport

这是对U盘的SCSI类型的支持

3.

filesystem---->

DOS/FAT/NTFilesystems--->

MSDOSfssupport

VFAT(Windows-95)fssupport

(437)DefaultcodepageforFAT

(iso8859-1)DefaultiocharsetforFAT

支持相应的文件系统

4.

PartitionTypes--->

[*]Advancedpartitionselection

[*]PCBIOS(MSDOSpartitiontables)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1