当前位置: 首页 > news >正文

【转】nios II架构uclinux的过程

【转】nios II架构uclinux的过程
时间:2009-07-31   来源:   作者:   点击: 1216   字体大小:【 大 中 小】
前言:
 最近在论坛上有一些朋友提出我上传的”nios2架构uclinux(nios2-linux-20080619开发包)的过程”是英文版的不好读.碰巧我最近整理资料就把架构过程重新整理了一篇.便于朋友参考. 对于英语阅读能力比较好的朋友建议参考我整理的英文版.内容比较详细.由于作者水平有限,在整理过程中难免会出现一些错误,望朋友们批评并指正.转贴的朋友请注明出处 http://blog.ednchina.com/chong_lang/   (本博客正在完善中欢迎交流学习)

开发环境:
在vmware 中安装centos5.2操作系统(在网上下载安装CentOS-5 2-i386-bin-DVD )
本人所使用的开发板为: altera公司的ep2c35f672c6n
宿主机windows开发平台为: windows xp sp3
在宿主机上安装的linux开发平台为centos5.2  内核为: vmlinuz-2.6.18 
开发工具为:quartus7.2

安装过程
Ok! 现在开始niosii架构uclinux过程
首先要在centos下挂载window 下的一个共享目录便于centos与宿主机传送文件,不会挂载的朋友google 一下linux 下mount命令的使用

在centos操作系统上我的开发目录设在了/home/zhaozhilei
[root@localhost ~]# cd /home/zhaozhilei

安装架构uclinux时所需要的库
[root@localhost zhaozhilei]# sudo yum install git-all make gcc ncurses-devel bison byacc flex
gawk gettext ccache zlib-devel gtk2-devel lzo-devel

一.下载uclinux开发包
[root@localhost zhaozhilei]#wget ftp://ftp.altera.com/outgoing/nios2-linux-20080619.tar

二.解压nios2-linux-20080619.tar
[root@localhost zhaozhilei]# tar xf nios2-linux-20080619.tar 

三.进入nios2-linux目录
[root@localhost zhaozhilei]# cd nios2-linux
ls   # see what's in
binutils  gcc3       README           uClibc        use_http_for_update
checkout  insight    toolchain-build  uClinux-dist
elf2flt   linux-2.6  u-boot           update

四.检查文件是否齐全
[root@localhost nios2-linux]#./checkout

五.下载交叉编译工具
[root@localhost nios2-linux]# cd ..
[root@localhost zhaozhilei]# wget ftp://ftp.altera.com/outgoing/nios2g...080203.tar.bz2

六.解压文件
[root@localhost zhaozhilei]#sudo tar jxf nios2gcc-20080203.tar.bz2 -C /

七.添加PATH路径
[root@localhost zhaozhilei]#cd
[root@localhost ~]# vim ./bash_profile
添加:PATH=$PATH:/opt/nios2/bin (红颜色部分是要添加的部分)

八.检查是否加入PATH
[root@localhost ~]#echo $PATH
结果应为:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/nios2/bin

十.检查交叉编译环境是否安装成功
[root@localhost ~]#nios2-linux-uclibc-gcc –v
结果应为:
Reading specs from /opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/specs
Configured with: /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=-static
Thread model: posix
gcc version 3.4.6

十一. 编译内核和应用,进入到uclinux-dist目录
[root@localhost ~i]#cd /home/zhaozhilei/nios2-linux
[root@localhost nios2-linux]#cd uClinux-dist
[root@localhost uClinux-dist]#make menuconfig
确保选择以下内容
Vendor/Product Selection --->             
    --- Select the Vendor you wish to target
        Vendor (Altera)  --->             
    --- Select the Product you wish to target 
        Altera Products (nios2)   --->   

Kernel/Library/Defaults Selection --->    
    --- Kernel is linux-2.6.x
        Libc Version (None)  --->        
    [*] Default all settings (lose changes)
    [ ] Customize Kernel Settings 
    [ ] Customize Vendor/User Settings 
    [ ] Update Default Vendor Settings 

注意:在成功引导uclinux之前不要改变上面任何设置
然后 <exit> <exit> <yes>

十二 .编译硬件配置选择相应的cpu 和sdrma
[root@localhost uClinux-dist]#make vendor_hwselect SYSPTF=/配件配置目录/your_system.ptf
选择cpu出现如下图(如果是多cpu的话,根据实际情况选择)
 3110420KR7.jpg 
选择sdram如下图(在这里我选择的是1即ddr_sdram_0,其它根据实际情况)
 3110513W606.jpg

十三. 编译内核和应用
[root@localhost  uClinux-dis]# make        (需要编译一段时间)

十四. 将 zImage文件copy到宿主机上
[root@localhost yanfa]# cp ./ images/zImage  你挂载的目录

十五. 在宿主机上(windows)打开nios ii eds 7.2 command  shell
开始->程序->altera-> nios ii eds 7.2->nios ii eds 7.2 command  shell

十六.下载你的sof文件到目标板
311055131L8.jpg 

十七. 下载zImage 到目标板
31105645T17.jpg 

十八. 打开nios终端
31105H62B1.jpg 

十九. uclinux正确启动时应出现如下信息
Using cable "USB-Blaster [USB 2-1.2]", device 1, instance 0x00
Pausing target processor: OK
Initializing CPU cache (if present)
OK
Downloaded 1272KB in 7.7s (165.1KB/s)
Verified OK                         
Starting processor at address 0x00500000
# nios2-terminal
nios2-terminal: connected to hardware target using JTAG UART on cable
nios2-terminal: "USB-Blaster [USB 2-1.2]", device 1, instance 0
nios2-terminal: (Use the IDE stop button or Ctrl-C to terminate)

Uncompressing Linux... Ok, booting the kernel.
Linux version 2.6.26-rc6 (hippo@darkstar) (gcc version 3.4.6) #2 PREEMPT Mon Jun 16 14:30:09 CST 2008

uClinux/Nios II
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 8128
Kernel command line: 
PID hash table entries: 128 (order: 7, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory available: 30136k/2333k RAM, 0k/0k ROM (1552k kernel code, 781k data)
Mount-cache hash table entries: 512
net_namespace: 180 bytes
NET: Registered protocol family 16
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
NET: Registered protocol family 1
io scheduler noop registered
io scheduler deadline registered (default)
ttyJ0 at MMIO 0x8009340 (irq = 8) is a Altera JTAG UART
console [ttyJ0] enabled
ttyS0 at MMIO 0x8008e00 (irq = 7) is a Altera UART
dm9000 Ethernet Driver, V1.30
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
Freeing unused kernel memory: 572k freed (0x1b8000 - 0x246000)
Shell invoked to run file: /etc/rc
Command: hostname uClinux
Command: mount -t proc proc /proc
Command: mount -t sysfs sysfs /sys
Command: mount -t usbfs none /proc/bus/usb
mount: mounting none on /proc/bus/usb failed: No such file or directory
Command: mkdir /var/tmp
Command: mkdir /var/log
Command: mkdir /var/run
Command: mkdir /var/lock
Command: mkdir /var/empty
Command: ifconfig lo 127.0.0.1
Command: route add -net 127.0.0.0 netmask 255.0.0.0 lo
Command: cat /etc/motd
Welcome to
          ____ _  _
         /  __| ||_|                 
    _   _| |  | | _ ____  _   _  _  _ 
   | | | | |  | || |  _ | | | | / /
   | |_| | |__| || | | | | |_| |/    
   |  ___\____|_||_|_| |_|\____|\_/\_/
   | |
   |_|

呵呵, 恭喜你成功运行了uclinux操作系统现在你可以根据自己的喜好从新配置内核啦!!如下操作:

从新回到虚拟机下的uclinux-dist目录下
[root@localhost uclinux-dist]#make menuconfig
Kernel/Library/Defaults Selection --->
(linux-2.6.x) Kernel Version 
(None) Libc Version 
[ ] Default all settings (lose changes) 
[*] Customize Kernel Settings    
[*] Customize Vendor/User Settings 
[ ] Update Default Vendor Settings 

Then <exit> <exit> <yes> .

以下可以根据自己的喜好配置内核这里不再叙述

小提示: 在配置内核的过程中如果有朋友在编译内核加入iptables 时若出现如下错误:
include/linux/netfilter_ipv4/ip_tables.h:18:28: linux/compiler.h: No such file or directory
make[3]: *** [iptables.o] 错误 1
make[3]: Leaving directory `/usr/local/yanfa/nios2-linux/uClinux-dist/user/iptables'
make[2]: *** [iptables] 错误 2
make[2]: Leaving directory `/usr/local/yanfa/nios2-linux/uClinux-dist/user'
make[1]: *** [all] 错误 2
make[1]: Leaving directory `/usr/local/yanfa/nios2-linux/uClinux-dist/user'
make: *** [subdirs] 错误 1
解决方法:
把/usr/home/zhaozhilei/nios2-linux/uClinux-dist/user/iptables/include/linux/netfilter_ipv4 中的 ip_tables.h中的#include <linux/compiler.h> 注解掉可解决编译uclinux_dist内核时出现的加载iptables 的错误

posted on 2011-03-03 22:23  Neddy11 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/Neddy/archive/2011/03/03/1970361.html

相关文章:

  • 开发人员学Linux(4):使用JMeter对网站和数据库进行压力测试
  • 项目选题报告
  • [转载]精益求精Sybase数据库标题大包括-6
  • Android基础:SQLites数据库事物处理的优越性
  • DB2 9 利用斥地(733 测验)认证指南,第 9 部分: 用户定义的例程(2)
  • JS区别IE6、IE7、IE8之间的方法
  • 基础算法10:过滤器(Filter)对指定路径不进行过滤
  • Asp.net用户多次登录问题
  • 如何应对被地下的Oracle口令加密算法(1)
  • Haproxy+Keepalived+Jboss集群实施架构一例
  • Solaris10下载、安设和设置装备摆设(2)
  • 深入浅出多线程系列之六:事件驱动异步模式(EAP,WebClient,BackgroundWorker)
  • 小本领: 一条下令装配 Firefox 3 Beta 3
  • 因子得分
  • 红旗桌面版本最新使用要领和标题解答100例-1
  • CentOS学习笔记 - 12. Nginx搭建Centos7.5远程repo
  • IE报vuex requires a Promise polyfill in this browser问题解决
  • JAVA SE 6 GC调优笔记
  • PHP变量
  • Solarized Scheme
  • VirtualBox 安装过程中出现 Running VMs found 错误的解决过程
  • Vue.js-Day01
  • 笨办法学C 练习34:动态数组
  • 互联网大裁员:Java程序员失工作,焉知不能进ali?
  • 利用jquery编写加法运算验证码
  • 使用 5W1H 写出高可读的 Git Commit Message
  • 新手搭建网站的主要流程
  • AI又要和人类“对打”,Deepmind宣布《星战Ⅱ》即将开始 ...
  • Android开发者必备:推荐一款助力开发的开源APP
  • 基于django的视频点播网站开发-step3-注册登录功能 ...
  • 智能情侣枕Pillow Talk,倾听彼此的心跳
  • ​低代码平台的核心价值与优势
  • #if和#ifdef区别
  • #Linux(make工具和makefile文件以及makefile语法)
  • #Linux杂记--将Python3的源码编译为.so文件方法与Linux环境下的交叉编译方法
  • #每天一道面试题# 什么是MySQL的回表查询
  • ()、[]、{}、(())、[[]]命令替换
  • (22)C#传智:复习,多态虚方法抽象类接口,静态类,String与StringBuilder,集合泛型List与Dictionary,文件类,结构与类的区别
  • (4.10~4.16)
  • (delphi11最新学习资料) Object Pascal 学习笔记---第8章第5节(封闭类和Final方法)
  • (env: Windows,mp,1.06.2308310; lib: 3.2.4) uniapp微信小程序
  • (react踩过的坑)Antd Select(设置了labelInValue)在FormItem中initialValue的问题
  • (草履虫都可以看懂的)PyQt子窗口向主窗口传递参数,主窗口接收子窗口信号、参数。
  • (附源码)ssm智慧社区管理系统 毕业设计 101635
  • (附源码)小程序儿童艺术培训机构教育管理小程序 毕业设计 201740
  • (四)搭建容器云管理平台笔记—安装ETCD(不使用证书)
  • (原创) cocos2dx使用Curl连接网络(客户端)
  • (转)visual stdio 书签功能介绍
  • .CSS-hover 的解释
  • .mat 文件的加载与创建 矩阵变图像? ∈ Matlab 使用笔记
  • .NET 4.0中的泛型协变和反变
  • .NET Micro Framework 4.2 beta 源码探析
  • .NET/C# 使用 ConditionalWeakTable 附加字段(CLR 版本的附加属性,也可用用来当作弱引用字典 WeakDictionary)
  • .NET6 开发一个检查某些状态持续多长时间的类
  • .NET的微型Web框架 Nancy