nios linux2-linux-uclibc-...

(转郭任前辈)uClinux驱动开发入门
我的图书馆
(转郭任前辈)uClinux驱动开发入门
下面还是从"linux Device Driver"中经典的hello开始:
cd linux-2.6.x/drivers/misc/
在drivers/misc下 vi hello.c
#include linux/init.h&#include linux/module.h&MODULE_LICENSE("Dual BSD/GPL");static int hello_init(void){printk(KERN_ALERT "Hello, world\n");return 0;}static void hello_exit(void){printk(KERN_ALERT "Goodbye, cruel world\n");}module_init(hello_init);module_exit(hello_exit);
在drivers/misc/Kconfig中,在"menuconfig"中添加以下代码:
config HELLOtristate "example hello module"helpEnable example hello module.
在drivers/misc/Makefile中添加:
obj-$(CONFIG_HELLO) += hello.o
在内核配置中打开如下选项:
Loadable module support --&[*] Enable loadable module support[*] Module unloadingDevice Drivers --&Misc devices ---&example hello module[/quote]
In apps selection of uClinux-dist,Busybox --&
[*] insmod[*] insmod: lsmod[*] insmod: modprobe[*] insmod: rmmod[ ] insmod: Pre 2.1 kernel modules[ ] insmod: 2.1 - 2.4 kernel modules[*] insmod: 2.6 and above kernel modules[ ] insmod: Model version checks[ ] insmod: Support tainted module checking with new kernels
然后make,make linux image,hello.ko会在romfs/lib/modules目录下
用modprobe hello测试。
注意要保证最早的make成功
* 下面介绍如何单独编译hello.ko
在上面的编译成功后,以后就可以单独进行编译了:
在drivers/misc/下执行:
make ARCH=nios2nommu CROSS_COMPILE=nios2-linux-uclibc- -C
../../linux-2.6.x M=`pwd` modules
nios2-linux-uclibc-strip -R .comment -R .note -g --strip-unneeded
接下来,你可以使用NFS,通过网络直接进行,insmod hello,rmmod hello
TA的最新馆藏[转]&
喜欢该文的人也喜欢uClinux在Nios II嵌入式平台上的移植研究 - 嵌入式操作系统 - 电子工程世界网
uClinux在Nios II嵌入式平台上的移植研究
10:19:09来源: 微计算机信息 关键字:&&&&&&
1. Nios II嵌入式处理器
&&&&& Nios II是运行在FPGA上的五级流水线、单指令的RISC处理器,它专门针对Altera的可编程逻辑器件及片上可编程的设计思想做了相应的优化。作为一种可配置的精减的RISC处理器,它可以与用户自定义逻辑结合构成SOPC系统,并下载到Altera的可编程器件中。32位的Nios II软核,结合外部闪存以及大容量存储器,可以构成一个功能强大的32位嵌入式处理器系统。此外,利用Altera提供的IDE(Integrated development environment)开发工具 可以方便的在调试模式下调试处理器,提高开发的速度。
&&&&& 作者使用Cyclone II版Nios II应用开发板Nios-DEVKIT-2C35 作为移植实现的平台,开发板主要包括Cyclone II EP2C35器件、EPM7128AE CPLD配置控制逻辑、存储器、串行配置连接器、FPGA和CPLD的JTAG接口等。
2.1. uClinux嵌入式操作系统
&&&&& uClinux是Linux的一个嵌入式版本,它经过小型化改造,形成了一个高度优化、代码紧凑的嵌入式Linux,并保留了Linux的大多数优点。最新的2.6版本在内核主体中加入了提高中断性能和调度响应时间的改进,其中有三个最显著的改进:采用可抢占内核、更加有效的调度算法以及同步性的提高 。
2.1.1. uClinux操作系统的移植
&&&&& uClinux源代码绝大部分都是使用的C语言,只有那些直接与处理其硬件相关的代码如开关CPU中断等操作才采用汇编语言编写,因此uClinux具有很好的移植性。一般来说,uClinux的移植大致分为三类:
&&&&& 1) 结构层次的移植。如果待移植的处理器结构不同于任何已经支持的处理器结构,则需要修改linux/arch目录下的相关处理器结构的文件。uClinux内核代码的大部分是独立于处理器和其体系结构的,但是其最底层的代码也是特定于各个系统的。他们的中断处理上下文、内存维护、任务上下文和初始化过程都是独特的。对一个新型的体系,其下层程序可以模仿与其相似的体系程序编写。
&&&&& 2) 平台层次的移植。待移植处理器是某种uClinux已支持体系的分支处理器,即如果待移植的处理器是基于Nios II内核的,而Nios II内核已经被uClinux支持,则需要在相关体系结构目录platform下建立相应目录并编写相应代码,这些代码主要是跟踪程序(实现用户程序到内核函数的接口等功能)、中断控制调度程序和内存初始化程序等。
&&&&& 3) 板级移植。如果所用处理器(如Cyclone II版本系列)已经被uClinux支持的话,就只需要板级移植了。板级移植需要修改或添加linux/arch/Nios2nommu/scripts目录中的文件,该目录中主要是与具体硬件平台相关的配置,可以利用Nios II自带的SOPC Builder软件生成具体平台对应的配置文件。
&&&&& 对于uClinux已经支持的硬件架构,移植的过程相对较为简单,主要考虑修改与硬件开发平台相关的具体因素,如内存大小、外围设备的配置等。一般现在做的大部分移植都是平台层次移植和板级移植。
2.1.2. initramfs文件系统
&&&&& 作者使用的uClinux 2.6操作系统中,用initramfs文件系统取代了以前的romfs文件系统。
&&&&& 1. romfs文件系统。romfs文件系统是在uClinux 2.4以及之前版本广泛用到的文件系统,这种文件系统相对于一般的ext2/ext3文件系统要求更少的空间。romfs文件系统不支持动态擦写保存,对于系统需要动态保存的数据采用虚拟RAM盘的方法进行处理(RAM盘采用ext2/ext3文件系统)。
&&&&& 2. initramfs文件系统[2]。initramfs是在2.5版本内核中引入的技术,它的基本思想是:在内核镜像中附加一个cpio包,cpio包中包含了一个小型的文件系统,当内核启动时,内核将cpio包解开,并且将其中包含的文件系统作为初始的根文件系统,内核中的一部分初始化代码会放到这个文件系统中作为用户层进程来执行。这样带来的明显的好处是精简了内核的初始化代码,例如寻找真正的启动盘、启动时的网络***、ACPI的***等,这些代码都可以从内核中移出,把它们都转移到用户空间完成,这样使得开发者在用户层就可以定制自己的启动过程,而不需要去修改内核代码,使定制启动过程变得更加容易。
2.2. 开发环境的建立
&&&&& 1. 建立交叉编译环境。可以在uClinux官方网站下载支持Nios II的交叉编译开发工具包,包括Nios2-linux-uclibc-gcc、Nios2-linux-uclibc-ld、Nios2-linux-uclibc-objdump等。
&&&&&&***好交叉编译工具包后,要在宿主PC上的Linux系统的环境变量中(一般修改~/.bash_profile文件),添加对Nios II交叉编译环境的支持,这样在以后的开发中,就可以正常编译在Nios II嵌入式平台下运行的程序了。
&&&&& 2. 内核的下载和烧写。在最初的调试中,是通过JTAG把内核下载到开发板,Nios II平台的硬件逻辑也是通过JTAG烧进开发板,等到最后硬件逻辑测试没有问题,以及uClinux操作系统调试运行正常后,就可以制作带bootloader的内核,烧入flash中。
2.3. 引导程序
&&&&& 引导程序(即bootloader)就是在操作系统内核运行之前运行的一段小程序,它在硬件复位后首先被执行。主要工作是初始化硬件设备、建立内存空间的映射图,从而将系统的软硬环境带到一个合适的状态,以便为最终调用操作系统内核准备合适的环境。通常引导程序严重地依赖于硬件,每种CPU体系结构都用不同的启动代码。此外,引导程序还依赖于具体的嵌入式板级设备的配置,如硬件地址分配,RAM芯片类型等。bootloader担负着初始化硬件和引导操作系统的双重责任,也是在特定硬件平台操作系统移植至关重要的一步。
&&&&& 对于作者使用的Nios II应用开发板,引导程序主要完成以下几项工作:
&&&&& 1) 矢量表初始化。
&&&&& 2) 初始化硬件(I/O口和控制器、存储器、时钟)。
&&&&& 3) 将操作系统内核从Flash指定位置拷贝到RAM中。
&&&&& 4) 软件初始化:建立堆栈和初始化数据段,建立C的运行环境。
&&&&& 5) 让CPU转入RAM中指定的位置(即操作系统内核)开始执行。
&&&&& 其中,第二步主要初始化处理器的一些控制或状态寄存器、时钟、I/O口、RAM等这些内核必须用到的设备。第三步中uClinux内核加载可以直接从flash某个地址开始逐句执行或者加载到内存中运行。作者采用的是后一种方法,即先把flash中的操作系统内核全部复制到内存中,再从内存中运行操作系统,因为内核大小一共不到1.5M字节,从flash复制到RAM中花的时间很少(几百毫秒),很快就会完成,该方法也比较容易实现。
&&&&& 图1是作者的bootloader运行的主要流程:
2.4 uClinux操作系统映像的构建
&&&&& 引导程序执行完毕后,处理器就开始执行真正的操作系统,操作系统内核的运行跟开发板的硬件配置有着紧密的联系。只有正确的配置操作系统内核,它才会正确利用硬件资源。由于2.6版本的uClinux已经支持了Nios II处理器,所以移植过程主要是板级移植。
&&&&& 首先,利用Nios II的配套开发软件Quartus II新建一个工程,用SOPC builder设计好自己的硬件逻辑,编译后会生成两个跟硬件平台相对应的硬件逻辑的文件,其中,*.sof文件是烧入开发板中并运行于其中的硬件逻辑,另外一个*.ptf文件是用于生成跟硬件平台相适应的uClinux内核。
&&&&& 然后,在宿主PC的Linux环境下,把*.ptf文件通过相关命令导入内核配置中,硬件平台的配置内容就会在linux/arch/Nios2nommu/scripts文件夹下生成,接着就可以通过make menuconfig 命令配置uClinux操作系统内核,具体相关选项的选择,要跟自己的硬件平台相同。最后,在配置好内核后,就可以直接编译生成uClinux操作系统内核映像文件,把*.sof文件通过JTAG烧入开发板中,把内核映像文件通过JTAG烧入SDRAM中,一个uClinux操作系统就可以在Nios II开发板上运行起来了。
&&&&& 图2是正确配置uClinux内核后的操作系统启动信息,打印信息是通过串口输出到屏幕上的:图2&&uClinux启动界面
&&&&& 至此,一个简单的uClinux操作系统在Nios II嵌入式平台上移植完成,这个操作系统经过裁减,去掉了Linux内核中一些不是必须的功能,但是具有一个Linux操作系统的几乎所有的特征。接下来,就可以在建好的开发环境中,开发在此平台上运行的程序了。
&&&&& Altera的Nios II软核处理器性能超过200DMIPS,在Altera FPGA中实现仅需35美分,并且开发者能从无限的系统配置组合中选择满足性能和成本目标的方案,而不必为系统级设计考虑采用ASIC。并且,Nios II处理器还具有完善的软件开发套件。
&&&&& 此嵌入式平台最终应用于有线数字电视接收系统,主要完成对加密数字电视传输流的实时接收和解扰工作,在实际的测试中,uClinux 2.6操作系统运行良好并且稳定,完全能胜任此类工作。本项目产生经济效益800万元。
&&&&& 本文作者创新点:在Nios II嵌入式平台上,实现了最新的uClinux 2.6嵌入式操作系统的移植,并对移植过程中的关键部分进行分析,对在Nios II嵌入式平台上的嵌入式系统移植有一定的指导和参考价值。
关键字:&&&&&&
编辑:王丕涛 引用地址:
本网站转载的所有的文章、图片、音频视频文件等资料的版权归版权所有人所有,本站采用的非本站原创文章及图片等内容无法一一联系确认版权者。如果本网所选内容的文章作者及编辑认为其作品不宜公开自由传播,或不应无偿使用,请及时通过电子邮件或***通知我们,以迅速采取适当措施,避免给双方造成不必要的经济损失。
关注eeworld公众号快捷获取更多信息
关注eeworld服务号享受更多官方福利
热门关键词
大学堂最新课程
汇总了TI汽车信息娱乐系统方案、优质音频解决方案、汽车娱乐系统和仪表盘参考设计相关的文档、视频等资源
热门资源推荐
频道白皮书
何立民专栏
北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。&&|&& &&|&& &&|&&
最新nios2架构uclinux的过程
13:05:02 && 阅读:6878&&
&Nios2 uClinux. branch &test-nios2& , per .
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./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
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-.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& ?
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-.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 /outgoing/nios2-linux-.tar
(SHA1SUM bb851bc6ccdcfad9340252a nios2-linux-.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-.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.&
linux-2.6: the Linux kernel source, which is stock Linux kernel plus Nios2 specific patches. The current version is v2.6.26-rc6.
uClinux-dist: the uClinux userspace libraries and applications. We will build uClinux here.
binutils, gcc3, elf2flt, insight: the gnu tools.
uClibc: the main userspace libraries, which is smaller that glibc. please note, newlib doesn't support Nios2 uClinux.
u-boot: a powerful boot loader and monitor,&DasUBoot&.
We will proceed to build the toolchain. If you don't want or fail to build it yourself, you may use the prebuild&BinaryToolchain.
此文章是本人验证并整理后发布,转贴的朋友请注明出处:/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)
(sha1sum eae7c2981aacddaab507566& nios2gcc-.tar.bz2)&
Open a terminal. Run as root or use sudo,
sudo tar jxf&&-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.
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-.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,
(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)
Downloaded 1272KB in 7.7s (165.1KB/s)
Verified OK&&&&&&&&&&&&&&&&&&&&&&&&&
Starting processor at address 0x
# 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: 3k 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)&
[*] Customize Kernel Settings&&&&&== to change kernel config
[*] Customize Vendor/User Settings& &== to change user apps config
[ ] 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,
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: KiB)& TX bytes: 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
/& boa -d &&&# start httpd with cgi-demo
/& 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
MemTotal:&&&&&&&& 6520 kB
MemFree:&&&&&&&&& 4340 kB
Buffers:&&&&&&&&&&&& 0 kB
& 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.
&1: netstat -a
&3: ntpdate pool.ntp.org
&6: inetd &
&7: ifconfig
&8: dhcpcd &
& 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
后参与讨论
阅读:1825
阅读:2297
阅读:2993

参考资料

 

随机推荐