由于本人现在想在DE0 上跑Linux,参考了一下资料,供大家参考:
内容几乎都一样,各种版本,不知到底是谁是原创,所以都列出来了;
引用网址;http://www.dz3w.com/eda/fpga/0078811.html
nios2架构uclinux(nios2-linux-20080619开发包)的过程
最近在论坛上有一些朋友提出我上传的”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的话,根据实际情况选择)
选择sdram如下图(在这里我选择的是1即ddr_sdram_0,其它根据实际情况)
十三. 编译内核和应用
[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
十九. 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)
引用网址:http://blog.csdn.net/jiahaojie1984/archive/2009/04/03/4046890.aspx
安装NiosuClinux开发环境
(文/贾毫杰)
一、前期准备工作
首先,你必须安装Linux操作系统,而且还得有一些必要的软件包,现在你可以使用以下命令检验你的软件包是否齐全。
(1)以root权限登录进入系统:
如果你的操作系统是Fedora,RHEL,Centos
执行sudo yum install git-core make gcc ncurses-devel bison byacc flex gawk gettext ccache zlib-devel gtk2-devel lzo-devel
如果你的操作系统是Suse
执行sudo zypper install git-core make gcc ncurses-devel bison byacc flex gawk gettext ccache zlib-devel lzo-devel
如果你的操作系统是Debian/Ubuntu,
执行sudo apt-get update
sudo apt-get install git-core make gcc ncurses-dev bison flex gawk gettext ccache zlib1g-dev libx11-dev texinfo lzo-dev
注意:如果Ubuntu不能找到lzo-dev软件包,请试一下lzo-dev2.
(2)检验你的git版本
执行git --version,如果你的版本低于1.5.3.x,请更新至最新版本。
(3)在Ubuntu操作系统下,你还需要检验默认Shell是否为“bash”
执行ls -l /bin/sh
应该显示"/bin/sh -> bash"
否则执行以下命令将默认shell改为bash
sudo rm /bin/sh
sudo ln -s bash /bin/sh
二、下载并解压必要的文件
1.确保你有至少5G的空余硬盘空间,然后使用wget来下载nios2-linux-20080619.tar 压缩文件,如果你已经有了nios2-linux-20080619.tar文件,请直接看第2步。
执行wget ftp://ftp.altera.com/outgoing/nios2-linux-20080619.tar可以下载得到压缩软件包。
注意:最好不要使用Windows ftp下载,因为这可能会损害文件。
2.将nios2-linux-20080619.tar放在你的工作目录下,如/home/jiahaojie/
执行tar xf <路径>nios2-linux-20080619.tar # 解压软件包会得到一个nios2-linux文件夹
cd nios2-linux # 进入目录
ls # 查看文件
显示如下:
binutils gcc3 README uClibc use_http_for_update
checkout insight toolchain-build uClinux-dist
elf2flt linux-2.6 u-boot update
3.检查源文件
执行./checkout
到此为止,基于Nios2的uClinux源文件和其他工具软件已准备好了。
三、安装交叉编译工具链
交叉编译工具链是用来
交叉编译工具链的源文件已经包含在nios2-linux/toolchain-build中,你可以自己编译得到可用的二进制文件;如果你不愿麻烦,也可以从网上得到已经编译好的工具链,然后解压并安装在你的机器上,这样就能直接使用了。如果您有二进制的交叉编译工具链压缩文件(nios2gcc-20080203.tar.bz2这是最新的版本),请直接看第3步。
1.编译交叉编译工具链,这可能需要花费几个小时,如果你不愿麻烦,可以下载别人已经编译好的交叉编译工具链(http://nioswiki.jot.com/WikiHome/OperatingSystems/%C2%B5Clinux/BinaryToolchain/nios2gcc.tar.bz2?cacheTime=1167890021825)
执行cd toolchain-build
git clean -f -x -d #如果第一次不成功,重新开始最好执行这一步,清除编译过程中产生的中间文件
make gcc elf2flt #这一步可能需要花费几个小时
cd ..
请看第2步
2.修改.bash_profile文件(如果是Debian/Ubuntu修改~/.profile文件)
执行 gedit ~/.bash_profile #以图形方式打开.bash_profile文件
在~/.bash_profile或~/.profile文件的最后一行添加PATH=$PATH:/home/jiahaojie/nios2-linux/toolchain-build/build/nios2/bin,目的是把nios2/bin也加入到当前用户环境变量中,也只会对当前用户生效。
执行source ~/.bash_profile #使设置生效
然后跳过第3、4步,执行第5步,检验一下编译是否成功
注意:.bash_profile是隐藏文件,可以使用"ls -a"查看,使用"gedit .bash_profile"可以在图形界面下修改该文件。
3.如果你有已经编译好的二进制交叉编译工具链,请从这一步开始。
将nios2gcc-20080203.tar.bz2文件放到工作目录下(如/home/jiahaojie/)
执行su -i #获得你的root权限
tar jxf /home/jia/nios2gcc-20080203.tar.bz2 -C / #解压并安装nios2gcc,安装目录会在/opt/nios2下
请看第4步
4.修改.bash_profile文件(如果是Debian/Ubuntu修改~/.profile文件)
执行 gedit ~/.bash_profile #以图形方式打开.bash_profile文件
在~/.bash_profile或~/.profile文件的最后一行添加PATH=$PATH:/opt/nios2/bin,目的是把nios2/bin也加入到当前用户环境变量中,也只会对当前用户生效。
执行source ~/.bash_profile #使设置生效
请看第5步
5.最后执行nios2-linux-uclibc-gcc -v #测试一下,至此nios2交叉编译工具安装结束,可以在uClinux中使用了
执行结果如下:
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
现在,NiosuClinux开发环境就完全建立起来了,下一步你就可以使用这个开发环境定制属于自己的uClinux操作系统了。
引用网址:http://blog.ednchina.com/chong_lang/234427/message.aspx
此文章是本人验证并整理后发布, 转贴的朋友请注明出处:http://blog.ednchina.com/chong_lang/
Here we will setup the source to build Nios2 uClinux. branch "test-nios2" , per 20080619.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
If you already have the toolchain and working uClinux-dist git repo, then you can skip the "new install" below and go to the second half, "Distro upgrade".
New install
You must have a Linux desktop with software development packages. Login as root or use sudo to install these packages.
On Fedora, RHEL, CentOS:
(for RHEL or CentOS, please add epel repository, How to use EPEL)
sudo rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
sudo yum install git-all make gcc ncurses-devel bison byacc flex \
gawk gettext ccache zlib-devel gtk2-devel lzo-devel
On Suse:
sudo zypper install git-core make gcc ncurses-devel bison byacc \
flex gawk gettext ccache zlib-devel lzo-devel
On Debian/Ubuntu:
sudo apt-get update
sudo apt-get install git-core make gcc ncurses-dev bison flex gawk \
gettext ccache zlib1g-dev libx11-dev texinfo liblzo2-dev
(If Ubuntu/Debian can't find the liblzo2-dev package search for equivalent. This is needed for the MTD tools package.)
Please check your git version with "git --version". If it is older than 1.5.3.x, please update to the latest.
Default GCC compiler version for Ubuntu 9.04 is 4.3.3. To have successful build of toolchain from nios2-linux-20080619.tar - install GCC 4.1 and make appropriate symlinks for gcc and g++.
On Ubuntu, check if the default shell is "bash"
ls -l /bin/sh
This should give "/bin/sh -> bash",
Otherwise, change it with,
sudo rm /bin/sh
sudo ln -s bash /bin/sh
followed by a logout and log back in again.
As root, check if you have "cc" which is a symlink to "gcc" ?
which gcc
gcc -v
which cc
cc -v
if not,
cd /usr/bin
ln -s gcc cc
Make sure you have 5GB or more free disk space. Please use wget to download the tar file nios2-linux-20080619.tar , 842MB. Best thanks to Altera's kindly hosting these files. Please verify the sha1sum after download.
(but don't use Windows ftp, it corrupt the files)
wget ftp://ftp.altera.com/outgoing/nios2-linux-20080619.tar
(SHA1SUM bb851b5494b4ae5c6ccdcfa5625b0f4d9340252a nios2-linux-20080619.tar)
We use "git" to keep the source. You make check out GitServer later. The git database inside the tar file was compressed, so we don't do compression on the tar file.
You can build in any working directory as a user account, eg. in your home (say /home/hippo). The tar file contains a nios2-linux dir.
tar xf <path_to>nios2-linux-20080619.tar # untar the package
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
# check out the source
./checkout
Now the source files for the Nios2 uClinux and gnutools are ready.
We will proceed to build the toolchain. If you don't want or fail to build it yourself, you may use the prebuild BinaryToolchain.
此文章是本人验证并整理后发布,转贴的朋友请注明出处:http://blog.ednchina.com/chong_lang/
BinaryToolchain
Table of contents
No headers
Attached are binary of the tools to run on Linux PC and root fs from buildroot. You can use it to compile kernel and apps.
Login as a user account on Linux PC, eg, hippo. The user home dir will be /home/hippo, short form as ~/ .
Use wget to download the cross tools (69MB). Best thanks to Altera's kindly hosting these files. (but don't use Windows ftp, it corrupt the files)
wget ftp://ftp.altera.com/outgoing/nios2g...080203.tar.bz2
(sha1sum 6873249d8eae7c2981aac6791f044ddaab507566 nios2gcc-20080203.tar.bz2)
Open a terminal. Run as root or use sudo,
sudo tar jxf nios2gcc-20080203.tar.bz2 -C /
The cross gcc tools was expected to be installed in /opt/nios2 dir. But you may install in any other dirs. Then setup the PATH for the cross gcc, you can add a line at the end of file ~/.bash_profile (or ~/.profile on Debian/Ubuntu) ( the file is hidden, you have to use "ls -a" to find it . For "gedit" use open Location, and enter the file name)
PATH=$PATH:/opt/nios2/bin
After you change the .bash_profile or .profile, you need to logout and login again. So that it will be in the PATH when you login.
Check with,
echo $PATH
It should display like this, with nios2 path at the end,
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/nios2/bin
To verify the cross gcc, try out,
nios2-linux-uclibc-gcc -v
It should display the info,
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
Then try build kernel and apps as in the uClinuxDist.
Table of contents
1. 1. update git to the latest
This page is about building the kernel and apps using uClinux-dist sources.
If you have any problems, please post over on the Nios forum.
(This is different from the very old buildroot guide approach. DO NOT MIX UP)
Before you begin:
Follow instructions at InstallNios2Linux to download nios2-linux-20080616.tar and check out the source code.
Older version does NOT apply to the procedures described here.
In uClinux-dist dir, perform the menuconfig. DO NOT cd linux-2.6.x
cd uClinux-dist
make menuconfig
In the menuconfig, make sure it is selected as follows:
Vendor/Product Selection ---> # select
--- Select the Vendor you wish to target
Vendor (Altera) ---> # should have default to Altera
--- Select the Product you wish to target
Altera Products (nios2) ---> # should have defaulted to nios2
Kernel/Library/Defaults Selection ---> # select
--- Kernel is linux-2.6.x
Libc Version (None) ---> # should default to None - very important.
[*] Default all settings (lose changes) # select
[ ] Customize Kernel Settings
[ ] Customize Vendor/User Settings
[ ] Update Default Vendor Settings
Then <exit> <exit> <yes>
DO NOT change any other setting until first successful boot.
Run vendor_hwselect to setup the memory and io port address map of your Nios II board (see LinuxHwselect for details) . Select the nios2 cpu and sdram.
(still in uClinux-dist dir, DO NOT cd linux-2.6.x)
# You must give the absolute path to ptf, no spaces allowed in the path.
make vendor_hwselect SYSPTF="/path"_to_your_hardware_project/your_system.ptf
Compile kernel and apps,
make
(this will take a while)
If you have errors, you can get cleaner messages by building in searial instead of in parallel:
NON_SMP_BUILD=1 make
The compressed kernel is stored in the images folder, it is called zImage and is in ELF format. You can follow TryOutuClinux to run the new zImage.
In case you want a real clean restart, use "git clean",
git clean -f -x -d
Below is the the start up message of an Altera NEEK dev board.
# nios2-download -g images/zImage
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
____ _ _
/ __| ||_|
_ _| | | | _ ____ _ _ _ _
| | | | | | || | _ \| | | |\ \/ /
| |_| | |__| || | | | | |_| |/
| ___\____|_||_|_| |_|\____|\_/\_/
| |
|_|
For further information check:
http://www.uclinux.org/
Execution Finished, Exiting
Sash command shell (version 1.1.1)
/>
Now, you can config uClinux-dist for costmize kernel and select your apps. I enabled only SMC91C111 and DM9000 Ethernet device drivers for Altera dev board in default config, you should enable your EtherNet driver in kernel config otherwise. see LinuxConfig for kernel config items.
Still in uClinux-dist dir, DO NOT cd linux-2.6.x
make menuconfig
Kernel/Library/Defaults Selection --->
(linux-2.6.x) Kernel Version
(None) Libc Version
[ ] Default all settings (lose changes)
[ ] Update Default Vendor Settings
Then <exit> <exit> <yes> .
It will enter kernel config first, then it will enter user apps config, you can select more apps.
After you change config,
make
You may want to now run your own program on the uClinux system.
An example Hello World program is here: CompileHello
There are more example programs linked under Then More Fun here: μClinux
Here is more usage about uClinux,
/> ifconfig eth0 192.168.1.85 # staic ip
/> route add default gw 192.168.1.254 # gateway
/> ifconfig
eth0 Link encap:Ethernet HWaddr 00:07:ED:00:00:00
inet addr:192.168.1.85 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2260 (2.2 KiB) TX bytes:2854 (2.7 KiB)
Interrupt:8
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
/> inetd & # start inetd to invoke telnetd and ftpd services
[22]
/> boa -d & # start httpd with cgi-demo
[23]
/> netstat -a # show network services
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:http *:* LISTEN
tcp 0 0 *:ftp *:* LISTEN
tcp 0 0 *:telnet *:* LISTEN
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
/> free
MemTotal: 6520 kB
MemFree: 4340 kB
Buffers: 0 kB
/> ps
PID PORT STAT SIZE SHARED %CPU COMMAND
1 S 147K 0K 2.8 /init
2 S 0K 0K 0.0 ksoftirqd/0
3 S 0K 0K 0.0 events/0
4 S 0K 0K 0.0 khelper
5 S 0K 0K 0.0 kthread
6 S 0K 0K 0.0 kblockd/0
7 S 0K 0K 0.0 pdflush
8 S 0K 0K 0.0 pdflush
9 S 0K 0K 0.0 kswapd0
10 S 0K 0K 0.0 aio/0
17 R 147K 0K 0.3 -/bin/sh
19 S 147K 0K 0.2 dhcpcd
22 S 95K 0K 0.1 inetd
23 S 275K 0K 0.4 boa
/>
ftpd usage, user : ftp, password: <anything> , dir : /home/ftp
boa and cgi usage, dir : /home/httpd
You can check what is in busybox, by running "busybox" on uClinux.
You can check what is in sash, by "help" .
We use initramfs instead of the default romfs . The initramfs is generated from romfs dir and the dev file in vendors/Altera/nios2/romfs_list . See InitramfsUpdate .
The simplified "init" program will run etc/rc and etc/inittab during startup.
If you want to customize startup, eg inet servers and eth config, you should update the files vendors/Altera/nios2/ rc and inittab.
We arrange to minimize the memory usage. We use sash as default shell, it is smaller than busybox and take less memory. We include some standalone networking servers, such as inetd and telnetd. We build some networking utility into busybox, such as ifconfig,route,netstat,telnet,wget..etc. We don't use sh in busybox, and don't use servers in busybox as it takes a lot of memory.
You may use the simple history in sash. Use "h" to list history. Use "!<d>" , d="1"..20, to recall one of the history, eg "!3" for the 3rd cmd line.
Use control-H for backspace.
/> h
1: netstat -a
2: date
3: ntpdate pool.ntp.org
4: date
5: boa &
6: inetd &
7: ifconfig
8: dhcpcd &
9: free
10: ps
/> !10
PID PORT STAT SIZE SHARED %CPU COMMAND
1 S 147K 0K 1.7 /init
2 S 0K 0K 0.0 ksoftirqd/0
3 S 0K 0K 0.0 events/0
4 S 0K 0K 0.0 khelper
5 S 0K 0K 0.0 kthread
6 S 0K 0K 0.0 kblockd/0
7 S 0K 0K 0.0 pdflush
8 S 0K 0K 0.0 pdflush
9 S 0K 0K 0.0 kswapd0
10 S 0K 0K 0.0 aio/0
11 S 0K 0K 0.0 mtdblockd
18 R 147K 0K 0.1 /bin/sh
19 S 147K 0K 0.0 dhcpcd
22 S 95K 0K 0.0 inetd
23 S 275K 0K 0.0 boa
/>
文章评论(0条评论)
登录后参与讨论