试验5linux内核的裁剪移植_第1页
试验5linux内核的裁剪移植_第2页
试验5linux内核的裁剪移植_第3页
试验5linux内核的裁剪移植_第4页
试验5linux内核的裁剪移植_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、实验5 linux内核的裁剪移植一、实验目的:学习利用menuconfig配置文件进行裁减内核,编译内核并移植到开 发板上。二、实验内容一、开发环境宿主机:ubuntu10.04开发板:tiny6410编译器:4.3.2二、内核移植1 .下载源码ftp:/ftp.kemel.Org/pub/linux/kemel/v2.6/linux-2.6.38.tar.bz2此实验所需的文件放到/home/embedded/11目录下:linux-2.6.38.tar.bz2, yaffs2.tar.bz2s3c_nand.c , s3c_nand_mlc.fo ,nand_base.c ,Kconfig

2、 ,regs-nand.h2 .解压(进入根目录下的/home/poplar/expr4/kernel 目录,解压源码)# cd /home# mkdir poplar/expr4/kernel -p# cd /home/poplar/expr4/kernel# cp /home/embedded/11/linux-2.6.38.tar.bz2 ./tar xvfj /home/poplar/expr4/kernel/linux-2.6.38.tar.bz2 9 rootubuntu: File Edit Vie我 Terminal Helprootubuntui-# cd /home/pop

3、lar/expr4/kernelTOG rootubuntu: /honie/poplar/expr4-/kernelFile Edit View Terminal Helprootubuntu:# cd /honje/poplar/expr4/ker(ielrooWubuntu:/horne/poplrar/expr4/kernel# IsKconf ignandbase S3c_nand. c yaf f s2 >tar. bz2linux-2,6,38Jdr+bw2 regs-nand,h s3c_nand mljf。raot(pLbuntu:/hame/poplar/expr4/

4、kernel# tar xvfj /htHiw/poplar/ExpM/kemwl/UniJxC.E.3E.ta r.bz23.修改架构,编译器(需要在 arm上运行,所以用交叉编译器)解压完进入解压出来的linux-2.6.38目录#cd linux-2.6.38#vi Makefile (或者用 gedit)群,中 rootubuntu: /home/popIar/expr4/kernel/linuK-2.6.3BFile Edit View Terminal HelpI Linux-2H6r38/tools/virtic/virtiQ test xlinux2.6.3&/usr/

5、Unux-2.6.3B/usr/.gitignoreLinux-2.6,3B/usr/KconfigLinux-2.6.3fl/usr7ftekcflielinux-2,6r3&/(jsr/gen init cpio.clinux-2.6.3fl/usr/initramf5_data.SLinux-2.6.3B/vlrt/liniu(*2,6.35/VLrt/kvii/linux-2.6.3B/virt/kvii/KconfigLlnux-2,6« 38/virt/kvn/assigned-dev. clinux*2.6.3B/virt/kvm/async_pf.cUnux

6、2.6.3B/virt/kwasync7pf.hlicux-2. ea/virt/kvm/coalescedmniio. cliinux-2.6.3S/virt/kvm/coalesced_mniiQ. hLinux- 2.6.38/v i rt/kv/eventf d. clinux-2.5.3B/virt/kv/iaapiCxCLinux-2.6.38/vlrr/kvH/ioaplc.hlinux-2.6.38/virt/kvn/iodev.hlinux-2.6.Bfl/virt/kvi/iommu.clinux-2.6.3B/virt/kvm/irq com.clinux-J.e.Ba/

7、virt/kvi/kvmmain.croctubuntu:/hoin&/poplar/expr4/kernel# cdl llnux-2.A.rcotubuntu:/home/poplar/exp r4/kernel/linux-2,6.38# vi Makefile191行改为ARCH?= arm/191 行CROSSCOMPILE?= /usr/local/arm/432/bin/arm-linux-(找到其交叉编译环境,把路径加全)/192行4Applistions. Places电 ?Mon NOV 4. &:13PM 44 ES Q poplar (J)4 * Mak

8、efile (/home/pop I a r/wu/l i nux - 2.6.3S) - geditFile Edit View Search Documents HelpB .Open TjSave 皂,* Undoft* * # *Makefile XWher performing cross compilation for other architectures ARCH shall be set to the target architecture. (5ee arch/* for the poisihilities) arch can be set du ring invocati

9、on of make: make ARCH=ia64Another way is to have ARCH set in the envirorim&nt.The default ABCH is the hast where Tike is executed.CROSS COMPILE specify the prefix used for all executables used during compilation. Only gcc and related bin-utils executablesare prefixed with $(CROSS COMPILE).CROSS

10、COMPILE can be set on the make CROSS COMF1LE=ia64- Linux- Alternatively CF1OS5 COMPILE can A third alternative is to store "make" in the configured kernel Default value for cross compile Note: Some architectures assigncoimnand lineexport KBUILD BUILDHOST := $(SUBARCHIbe set in the environn

11、tent.a setting in .config so that plain build director/ always use that.15 not to prefix executablesCROSS COMPILE in their areh/*/Makefi.UARCHarmCROSS COMPILE 眸 anrTinug# Architecture as dresent in comoile.h4 .生成默认配置文件#cp arch/arm/configs/s3c6400_defconfig.configSystem TypeLinux内核中已经自带了关于我们6410开发板的配

12、置。5 .修改配置项#make menuconfig。,rootubuntu: /home/poplar/expr4/kernel/linux-2«6.J8File Edit View Terminal Helppopla rub u ntu: w/expr4/ kernel /I i nu x - 2,6.3 8$ su rootPassword:rootubuntu : /home/poplar/expr4/kernel/linux-2.6.38# cp arch/arm/configs/s3c649 defconfig .configroo ttaubuntu:/home/po

13、pla r/expr4/ke rnel/linux-2.6.38#? O G ruotubuntu: /home/poplar/expr4/kernel/linux-2.6.3fiFile Edit View Terminal Helppoplarubuntu;-/expr4/kernel/linux-2.6.38$ su rootPassword:rootubdntu:/home/poplar/expr4/kernel/linux-2.6,38# cp arch/arni/configs/5364G0 defconfig .configroot(?ubuntj:/home/poplar/ex

14、pr4/kerneUinux-2H6+38# make menuconfig|System Type->* MINI6410 选上,6 .拷贝 NAND FLASH 驱动到根目录下的 /home/poplar/expr4/kernel 下的linux-2.6.38里相应的文件位置处(以下的文件在实验五文件夹里有)drivers/mtd/nand/s3c_nand.carch/arm/plat-samsung/include/plat/regs-nand.h drivers/mtd/nand/s3c_nand_mlc.fodrivers/mtd/nand/nand_base.cdriver

15、s/mtd/nand/Kconfig执行命令:# cp /home/embedded/11/s3c_nand.c ./drivers/mtd/nand/# cp /home/embedded/11/s3c_nand_mlc.fo ./drivers/mtd/nand/# cp /home/embedded/11/nand_base.c ./drivers/mtd/nand/# cp /home/embedded/11/Kconfig ./drivers/mtd/nand/# cp /home/embedded/11/regs-nand.h ./arch/arm/plat-samsung/inc

16、lude/plat/7修改nand马区动makefile输入指令 #cd drivers/mtd/nand#vi Makefiledrivers/mtd/nand/Makefile 中 20 行增加obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand.o末尾再增加obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand_mlc.fo8.增加相应选项输入指令 #cd /home/poplar/expr4/kemel/linux-2.6.38 #make menuconfigDevice Drivers一><*> Memory Tech

17、nology 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 SamsungS3C SoCs去掉不要选<*> NAN

18、D Flash support for S3C SoC* S3C NAND Hardware ECC三、 添加yaffs2文件系统的支持首先向内核源代码中加入支持yaffs2的源代码】解压 yaffs2.tar.bz2#cd /home/poplar/expr4/kernel#cp /home/embedded/11/yaffs2.tar.bz2 ./#tar xvfj yaffs2.tar.bz2,poplarubuntu: */expr4/kernelFile Edit View Terminal Helppoplarjt)untu:-$ cd /home/poplLar/expr4/ke

19、rnel/ poplarjbuntu:/expr4/kernel$ tar xvfj yaffs2.tar.bz2进入解压出的目录#cd yaffs2。 poplar©ubuntu: */expr4/kernelFile Edit View Terminal Help yaff52/yaffs_packedtags2.c yaffs2/linux-tests/ yaffsZ/linux-tests/initnandsim yaff52/linux-tests/plot_data.sh yaff52/linux-test5/xattrtest.c yaff52/linux-tests/

20、writetest.sh yaff52/linux-tests/mkfiles yaff52/linux-tests/rmount_cycl.ing. sh yaff52/linux-tests/mkdirtree yaffs2/linux-tests/stress_test.sh yaff52/yaffs_yaffs2.h yaffs2/yaffs_checkpt rw.h yaffs2/Kconfig multi yaffs2/yaffs_checkptrw.c yaffs2/yaffs_trace.h yaffs2/yaffspackedtagsl.h yaffs2/yaffs_pack

21、edtags2.h yaffs2/Hakefile yaffs2/yaffsjntdif2.h yaffsZ/yaffsyaffsl.h yaff52/yaffs_mtdifl.h yaffs2/yaffs_gut5.h yaffs2/yaffs_bitmap.h poplarubuntu:/expr4/kerneli cd yaffs2/, poplarubuntu: */expr4/kernellFile Edit View Terminal Helpyaff52/yaffs_packedtags2.c yaff52/linux-tests/yaff52/linux-test5/initn

22、andsim yaffs2/linux-te5ts/plot_data.sh yaff52/linux-tests/rxattrtest. c yaff52/linux-tests/writetest.sh yaffs2/linux-test5/mkflies yaff52/linux-tests/rmount_cycling. sh yaff52/linux-te5ts/mkdirtree yaffs2/linux-tests/5tress_test.sh yaff52/yaffs_yaffs2.h yaffs2/yaffs_checkpt rw.hyaffs2/Kconfig multiy

23、affs2/yaffs_checkptrw.c yaffs2/yaffs_trace.h yaffs2/yaffspackedtagsl.h yaff52/yaffs_packedtags2.h yaffs2/Makefile yaff52/yaffsjntdif2.h yaff52/yaffsyaffsl.h yaff52/yaffsmtdifl.h yaff52/yaffsguts.hyaff52/yaffsbitmap.hpoplarubuntu:/expr4/kernel$ cd yaffs2/执行如下命令./patch-ker.sh c m+内核源码路径# ./patch-ker.s

24、h c m ./linux-2.6.38,。金 poplarubuntu: */expr4/kernel/yaffs2'File Edit View Terminal Help,yaffs2/linux-tests/initnandsimiyaffs2/linux-tests/plot_data.sh,yaffs2/linux-tests/xattrtest.cyaffs2/linux-tests/writetest.shyaffs2/linux-tests/mkfil.esyaffs2/linux-tests/mount_cycling.shyaffs2/linux-tests/mk

25、dirtreeyaffs2/linux-tests/stresstest.shyaffs2/yaffs_yaffs2.hyaffs2/yaffs_checkptrw.hyaffs2/Kconfig_multiyaffs2/yaffs_checkptrw.cyaffs2/yaffs t race.hyafts2/yaftspackedtagsl.hyaffs2/yaffs_packedtags2.hyaffs2/Makefileyaffs2/yaffs_mtdif2.hyaffs2/yaffsyaffsi.hyaffs2/yaffsmtdif1.hyaffs2/yaffs_guts.hyaffs

26、2/yaffs_bitmap.hpoplarubuntu:*/expr4/kernel$ cd yaffs2poplarubuntu:*/expr4/kernel/yaffs2$ ./patch-ker.sh c m /home/poplar/expr4/kerne |l/linux-2.638|然后进入内核源码目录#cd /home/poplar/expr4/kemel/linux-2.6.38* 0 Q poplarubuntu: -/expr4/kernel/yaffs2File Edit View Terminal Helppoplarubuntu:-/expr4/kernel/yaf

27、fs2S cd /home/popUr/expr4/kernel/Unux-2t6t38/|执行 make menuconfigXrootlocalhost:/opt/linux-2«6.38选择 File systems选择 * Miscellaneous filesystems ->rwArrow keys navigate the nenu.<Enter> selects submenus - * *>. Highlightedletters au hotkeys, Pressing <V> includes, <N> exclu

28、des, <M> modularizes features i Press <Esc><Esc> to exit F <?> for Help, </> for Search + Legend: * built - tn excluded <M> nodule < > nodule capableFS file system support read only) (EXPERIMENTAL)-*一ffs2 file systen support S12 yte / page devices*I*I*r i.se

29、 older - style an-NAND data format with pagestatus byte 2648 yte (or larger) / p&ge devicesutoselect yaffs2 format (NEW)isablc yaffs from doing ECC on tags by default orce chunk erase check npty lost and found on boot i5abig yaffs2 block refreshing isable yaffs2 background processingLnable vaffd

30、 xatt鼻uud口rt 一一loornaUAng Flash Filev2 (JFFS2) suBIFS file systen support退出保存四、 添加对UBIFS文件系统的支持1 .配置内核支持UBIFS#make menuconfigDevice Drivers 一Memory Technology Device (MTD) support 一 Enable UBI - Unsorted block images 一2 .配置mtd支持UBI接口File systems 一Miscellaneous filesystems 一UBIFS file system support3

31、 .再次make#make zImage一、 下载到开发板(见实验三操作说明)先将zImage用DNW下载到开发板,然后将开关拨动到nand方式启动,观察超级终端此时启动会出现如下问题如果成功,如下图:usbcore: registered new interface driver usbhidusbhid: USB HID core driverVFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5drivers/rtc/hctosys.c: unable to open rtc device (rtc0)mmc0: mmc_rescan_try_freq: trying to init card at 300000 Hzmmc0: mmc_rescan_try_freq: trying to init card at 200000 HzU

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论