在niosII中移植linux系统.doc_第1页
在niosII中移植linux系统.doc_第2页
在niosII中移植linux系统.doc_第3页
在niosII中移植linux系统.doc_第4页
在niosII中移植linux系统.doc_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

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

文档简介

移植全过程我们采用的方法,是在windows下进行sopc builder的设计,在linux进行uclinux的内核的编译,以及交叉编译环境的建立。从而产生uClinux的镜像文件(机器码流)。需要准备的文件:A、nios2gcc.tar.bz2(交叉编译环境的linux安装文件,可以是其他格式的)。 B、uclinux-dist20060803(uclinux内核文件,可以是别的版本) C、uclinux-dist20060803-nios2-diff.tar.bz2(目前没有明白为什么要有这个文件,没有还不行)一:交叉编译环境的建立1、把nios2gcc.tar.bz2放在目录:/usr/local/src里面,将nios2gcc.tar.bz2解压进/opt/nios2目录下(这个默认的,不用进行目录操作)rootlocalhostsrc#tar-jxvfnios2gcc.tar.bz2-C/2、设定交叉编译器的路径:rootlocalhostsrc#vi/.bash_profile修改bash_profile的內容如下所示,加上/opt/nios2/bin路径#.bash_profile#Getthealiasesandfunctionsif-f/.bashrc;then./.bashrcfi#UserspecificenvironmentandstartupprogramsPATH=$PATH:$HOME/bin:/opt/nios2/binexportPATHunsetUSERNAME3、执行下面一条命令,使设置的路径有效rootlocalhostsrc#source/.bash_profile注:这里你可以进行一下测试。看看你的交叉编译环境是否已经建成,也可以略过不做。方法:rootlocalhostsrc#nios2-linux-uclibc-gccvReadingspecsfrom/opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/specsConfiguredwith:/root/buildroot/toolchain_build_nios2/gcc-3.4.6/configure-prefix=/opt/nios2-build=i386-pc-linux-gnu-host=i386-pc-linux-gnu-target=nios2-linux-uclibc-enable-languages=c-enable-shared-disable-_cxa_atexit-enable-target-optspace-with-gnu-ld-disable-nls-enable-threads-disable-multilib-enable-cxx-flags=-staticThreadmodel:posixgccversion3.4.6二:编译uclinux内核1、 把uclinux-dist20060803放进/usr/local/src,解压缩。 rootlocalhostsrc#tar-zxvfuClinux-dist-20070130.tar.tar如果你是在linux系统下(意思是指不是虚拟机),硬盘够大的话,就不应该有问题出现。解压缩之后,一般应该接近1.9G大小。2、 给uclinux打补丁 把 Clinux kernel patch for Nios II:uClinux-dist-20070130-nios2-02.7z到/usr/local/src/uClinux-dist。安裝Clinux kernel patch for Nios IIrootlocalhostsrc#cduClinux-distrootlocalhostuClinux-dist#gunzip-cuClinux-dist-20070130-nios2-02.diff.gz|patch-p0出现以下的结果就表明,补丁打成功。patchingfilevendors/Altera/nios2nommu/config.archpatchingfilevendors/Altera/nios2nommu/config.linux-2.6.xpatchingfilelib/libpng/Makefilepatchingfilelinux-2.6.x/include/asm-nios2nommu/ide.hpatchingfilelinux-2.6.x/include/linux/elf-em.hpatchingfilelinux-2.6.x/usr/Makefilepatchingfilelinux-2.6.x/arch/nios2nommu/kernel/vmlinux.lds.Spatchingfilelinux-2.6.x/arch/nios2nommu/drivers/Kconfigpatchingfilelinux-2.6.x/arch/nios2nommu/drivers/altcf.cpatchingfilelinux-2.6.x/arch/nios2nommu/drivers/pci/Kconfigpatchingfilelinux-2.6.x/arch/nios2nommu/drivers/pci/pci-auto.cpatchingfilelinux-2.6.x/arch/nios2nommu/drivers/pci/pci.cpatchingfilelinux-2.6.x/arch/nios2nommu/drivers/pci/Makefilepatchingfilelinux-2.6.x/arch/nios2nommu/drivers/spi.cpatchingfilelinux-2.6.x/arch/nios2nommu/drivers/Makefilepatchingfilelinux-2.6.x/drivers/mtd/maps/altera.cpatchingfilelinux-2.6.x/drivers/mtd/maps/Kconfigpatchingfilelinux-2.6.x/drivers/net/Kconfigpatchingfilelinux-2.6.x/drivers/net/Makefilepatchingfilelinux-2.6.x/drivers/net/dm9ks.cpatchingfilelinux-2.6.x/drivers/net/open_eth.cpatchingfilelinux-2.6.x/drivers/net/dm9000.cpatchingfilelinux-2.6.x/drivers/net/Space.cpatchingfilelinux-2.6.x/drivers/net/smc91x.cpatchingfilelinux-2.6.x/drivers/net/smc911x.cpatchingfilelinux-2.6.x/drivers/net/mtip1000.cpatchingfilelinux-2.6.x/drivers/usb/Kconfigpatchingfilelinux-2.6.x/drivers/usb/host/Kconfigpatchingfilelinux-2.6.x/drivers/usb/host/isp1362-hcd.cpatchingfilelinux-2.6.x/drivers/usb/host/Makefilepatchingfilelinux-2.6.x/drivers/usb/host/isp1362.hpatchingfilelinux-2.6.x/drivers/usb/Makefilepatchingfilelinux-2.6.x/drivers/ide/ide.cpatchingfileuser/microwin/src/fonts/X6x13.cpatchingfileuser/microwin/src/demos/nxroach/Makefilepatchingfileuser/microwin/src/demos/nanox/nxterm.cpatchingfileuser/microwin/src/demos/nanox/nterm.cpatchingfileuser/microwin/src/demos/nxkbd/keynum.cpatchingfileuser/microwin/src/demos/nxkbd/keyctrl.cpatchingfileuser/microwin/src/demos/nxkbd/keyshft.cpatchingfileuser/microwin/src/Makefile.rulespatchingfileuser/microwin/src/drivers/kbd_ttyscan.cpatchingfileuser/microwin/src/drivers/scr_fb.cpatchingfileuser/microwin/src/drivers/mou_ser.cpatchingfileuser/ftpd/ftpcmd.cpatchingfileuser/ftpd/Makefile出现的顺序可能不同,出现类似的画面,就应该没有问题。三、进行内核配置(基本都是默认配置) 需要注意的是:里面的每一步,都应该和界面的配置一致。如果有后面make时,有什么error,最好回来仔细检查一下这些默认配置(这些网上找的)。rootlocalhostuClinux-dist#makemenuconfig在Vendor/Product Selection如下設定在Kernel/Library/Defaults Selection如下設定最後選存檔Step 6:將SOPC Builder設定檔system_0.ptf複製到/usr/local/srcStep 7:根據DE2硬體配置設定make filerootlocalhostuClinux-dist#makevendor_hwselect SYSPTF=/usr/local/src/system_0.ptf最後會有選擇動作,分別選擇 1 (CPU_0),1 (cfi_flash_0),2 (sdram)。-PleaseselectwhichCPUyouwishtobuildthekernelagainst:(1)cpu_0-Class:altera_nios2Type:fVersion:7.071Selection:1-Pleaseselectadevicetouploadthekernelto:(1)cfi_flash_0Class:altera_avalon_cfi_flashSize:4194304bytesSelection:1-Pleaseselectadevicetoexecutekernelfrom:(1)sram_0Class:sram_16bit_512kSize:524288bytes(2)sdram_0Class:altera_avalon_new_sdram_controllerSize:8388608bytes(3)epcs_controllerClass:altera_avalon_epcs_flash_controllerSize:2048bytesSelection:2最後成功的結果如下所示-SummaryusingPTF:/usr/local/src/system_0.ptfCPU:cpu_0Devicetouploadto:cfi_flash_0Programmemorytoexecutefrom:sdram_0-Settingswrittento/usr/local/src/uClinux-dist/linux-2.6.x/arch/nios2nommu/hardware.mkmake3:Leavingdirectory/usr/local/src/uClinux-dist/linux-2.6.xmake2:Leavingdirectory/usr/local/src/uClinux-dist/vendors/Altera/nios2nommumake1:Leavingdirectory/usr/local/src/uClinux-dist/vendorsStep 8:建立romfs資料夾,過程會有錯誤訊息,可忽略。rootlocalhostuClinux-dist#makeromfsStep 9:編譯Clinux核心rootlocalhostuClinux-dist#makeStep 10:產生imagerootlocalhostuClinux-dist#make linux image最後會在/usr/local/src/uClinux-dist/linux-2.6.x/arch/nios2nommu/boot/下找到zImage注意:zImage文件是make时,就已经产生,那个只是一个初步的,没有bootloader的文件,如果你想使你的uClinux在硬件上运行,必须进行make linux image这条命令,从而加上bootloader。四:将uClinux写入硬件1、 把你的.ptf文件对应的.sof文件和生成的镜像文件zImage一起放在altera72nios2edsexamples下。2、 启动altera的command shell。开始-程序-altera-nios2 EDS-mand shell3、 先进行硬件配置(注意必须先在quartus中把.sof文件烧进去) SOPCBuilder$nios2-configure-sofDE2_NIOS.sof执行结果:SearchingforSOFfile:in.DE2_NIOS.sofInfo:*Info:RunningQuartusIIProgrammerInfo:Command:quartus_pgm-no_banner-mode=jtag-op;DE2_NIOS.sofInfo:UsingprogrammingcableUSB-BlasterUSB-0Info:StartedProgrammeroperationatMonJun0903:01:452008Info:Configuringdeviceindex1Info:Device1containsJTAGIDcode0x020B40DDInfo:Configurationsucceeded-1device(s)configuredInfo:Successfullyperformedoperation(s)Info:EndedProgrammeroperationatMonJun0903:01:462008Info:QuartusIIProgrammerwassuccessful.0errors,0warningsInfo:Allocated54megabytesofmemoryduringprocessingInfo:Processingended:MonJun0903:01:462008Info:Elapsedtime:00:00:024、 把zImage下到sdram里面 SOPCBuilder$nios2-download -g zImage执行的结果:UsingcableUSB-BlasterUSB-0,device1,instance0x00Pausingtargetprocessor:OKInitializingCPUcache(ifpresent)OKDownloaded1197KBin14.4s(83.1KB/s)VerifiedOKStartingprocessorataddress0x00D000005、 启动uClinux SOPCBuilder$nios2-terminal执行结果:UncompressingLinuxOk,bootingthekernel.Linuxversion2.6.19-uc1(rootlocalhost.localdomain)(gccversion3.4.6)#2PREMPTSunJun823:28:30CST2008uClinux/NiosIIAlteraNiosIIsupport(C)2004MicrotronixDatacomLtd.Built1zonelists.Totalpages:2032Kernelcommandline:PIDhashtableentries:32(order:5,128bytes)Dentrycachehashtableentries:1024(order:0,4096bytes)Inode-cachehashtableentries:1024(order:0,4096bytes)Memoryavailable:5956k/8192kRAM,0k/0kROM(1465kkernelcode,680kdata)Mount-cachehashtableentries:512NET:Registeredprotocolfamily16NET:Registeredprotocolfamily2IProutecachehashtableentries:1024(order:0,4096bytes)TCPestablishedhashtableentries:1024(order:0,4096bytes)TCPbindhashtableentries:1024(order:0,4096bytes)TCP:Hashtablesconfigured(established1024bind1024)TCPrenoregisteredioschedulernoopregisteredioschedulerdeadlineregistered(default)Ser

温馨提示

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

评论

0/150

提交评论