📄 00000006.htm
字号:
sbin: <BR>chroot hwclock ifup insmod modprobe reboot sulogin syslogd <BR>getty ifconfig inetd klogd pivot_root rmmod swapoff telnetd <BR>halt ifdown init lsmod poweroff route swapon <BR>[root@lips fakeroot]# <BR>4.3.2 dev <BR>[root@lips fakeroot]# ls dev/ <BR>console kmem mtdblock1 null random systty tty1 zero <BR>initctl mem mtdblock2 ptmx rtc tty ttyS0 <BR>initrd mtdblock0 mtdblock3 pts shm tty0 ttyS1 <BR>[root@lips fakeroot]# <BR> <BR> <BR> # Basic /dev entries <BR> # Filename, Type, Major, Minor, Permission, Description <BR> <BR> # mem char 1 1 600 Physical memory access <BR> # kmem char 1 2 600 <BR> # null char 1 3 666 Null device <BR> # zero char 1 5 666 Null byte source <BR> # random char 1 8 644 Nondeterministic random number generator <BR> # initrd block 1 250 600 <BR> # tty0 char 4 0 600 Current virtual console <BR> # tty1 char 4 1 600 First virtual console <BR> # ttyS0 char 4 64 600 First UART serial port <BR> # ttyS1 char 4 65 600 Second UART serial port <BR> # tty char 5 0 666 Current TTY device <BR> # console char 5 1 600 System console <BR> # rtc char 10 135 644 Real Time Clock <BR> # ptmx char 5 2 666 UNIX98 PTY master <BR> # mtdblock0 block 31 0 644 MTD <BR> # mtdblock1 block 31 1 644 MTD <BR> # mtdblock2 block 31 0 644 MTD <BR> # mtdblock3 block 31 1 644 MTD <BR> # pts/0 char 136 0 640 UNIX98 PTY slave <BR> # pts/1 char 136 1 640 UNIX98 PTY slave <BR> # initctl FIFO ? ? 600 <BR> # systty -> tty0 <BR> # shm/ <BR> <BR>4.3.3 etc <BR>[root@lips fakeroot]# ls etc/ <BR>fstab hosts issue nsswitch.conf profile rc.d securetty sy <BR>sconfig <BR>group inittab issue.net passwd protocols rpc services <BR>[root@lips fakeroot]# <BR> Etc目录下面存放的是配置文件和脚本。提供少数几个必要的文件即可使系统正 <BR>常运行。至于配置文件的具体内容,可以参考主机(Redhat Linux)中的配置文件 <BR>。其中rc.d是存放脚本的目录,sysconfig目录主要存放了有关网络的配置和脚本。 <BR>保留这些目录结构并非必须的,而仅仅是为了延续Redhat的习惯。 <BR> BusyBox实现的init与SysVinit有较大区别,因此其配置文件inittab相应也要 <BR>做较大改变。 <BR>[root@lips fakeroot]# cat etc/inittab <BR># <BR># inittab This file describes how the INIT process should set up <BR># the system in a certain run-level. <BR># Format: <BR># <id>:<runlevels>:<action>:<process> <BR># <BR># WARNING <BR># The Busybox init is different with SysV init. <BR># <id>: This field has a non-traditional meaning for BusyBox init! <BR># The id field is used by BusyBox init to specify the controlling <BR>tty for <BR># the specified process to run on. The contents of this field are <BR> <BR># appended to "/dev/" and used as-is. <BR># <runlevel>: The runlevels field is completely ignored. <BR># <BR># System initialization. <BR>∶<I>:sysinit:/etc/rc.d/rc.sysinit </I><BR># /bin/sh invocations on selected ttys <BR># Start an "askfirst" shell on the console (whatever that may be) <BR>∶<I>:askfirst:/bin/sh </I><BR># Stuff to do when restarting the init process <BR>∶<I>:restart:/sbin/init </I><BR># Stuff to do before rebooting <BR>∶<I>:ctrlaltdel:/sbin/reboot </I><BR>∶<I>:shutdown:/bin/umount -a -r </I><BR>∶<I>:shutdown:/sbin/swapoff -a </I><BR>[root@lips fakeroot]# <BR> <BR>4.3.4 lib <BR>[root@lips fakeroot]# ls lib/ <BR>libnss_files-2.2.4.so libnss_files.so libnss_files.so.2 modules <BR>[root@lips fakeroot]# <BR> 由于busybox是静态编译的,其运行并不依赖额外的库文件。这里的库文件只有 <BR>一个 libnss_files-2.2.4.so,是为了配合 etc/ nsswitch.conf 而必须的。 <BR> 需要特别注意的是,这个库文件是从前面所准备的交叉编译环境($PREFIX/$T <BR>ARGET/lib,即/root/arm/arm-toolchain/arm-linux/lib)中复制的,而不是从主 <BR>机的/lib中复制。 <BR>[root@lips fakeroot]# cp -dpR $PREFIX/$TARGET/lib/libnss_files* lib <BR>[root@lips fakeroot]# <BR> 另外,modules 目录用来存放系统中可能用到的Linux内核模块。 <BR> <BR>4.3.5 其他 <BR> <BR> <BR> <BR> <BR>5 引导 <BR> <BR>5.1 概述 <BR> 引导器(bootloader)的作用是装入并运行内核,在内核运行的最后阶段会从 <BR>指定位置挂载根文件系统,从而使系统转入正常运行。比如LILO和GRUB都是常见的 <BR>引导器软件。然而这些为主机设计的软件并不适合嵌入式系统,这里我们将要用到 <BR>的是RedBoot. <BR> 在引导目标机之前,首先必须明确两个问题: <BR> 第一,内核映像文件存放在哪里(什么设备)? <BR> 第二,根文件系统存放在哪里(根设备是什么)、文件系统类型是什么? <BR> 主机的内核和根文件系统通常位于磁盘分区(如/dev/hda1),类型为ext2或者 <BR>ext3等。而对于IQ80321来说(或者大多数目标机),没有磁盘这样的大容量存储设 <BR>备,取而代之的是FLASH MEMORY之类的存储器,其容量有限(这里是8MB)。因此对 <BR>产品来说,其内核和根文件系统都位于 FLASH(MTD设备),类型多数采用 jffs2。 <BR> <BR> 将内核写入FLASH的方式有几种,比如通过串口、JTAG接口或者网络。在后面的 <BR>过程中,我们选择的是使用RedBoot通过网络下载内核文件,然后写入FLASH。这时 <BR>,主机需要正确设置TFTP服务器。 <BR> 由于将文件写入FLASH的过程比较繁琐(一般需要借助其他工具或者软件),为 <BR>了便于频繁修改、测试,在软件开发阶段通常把根文件系统存放在主机,目标机通 <BR>过NFS远程挂载根文件系统。 <BR> <BR>5.2 RedBoot <BR> <A HREF="http://sources.redhat.com/redboot/">http://sources.redhat.com/redboot/</A> <BR> <BR>5.2.1 简介 <BR> (参考资料[2]) <BR> RedBoot is an acronym for "Red Hat Embedded Debug and Bootstrap", an <BR>d is the standard embedded system debug/bootstrap environment from Red H <BR>at, replacing the previous generation of debug firmware: CygMon and GDB <BR>stubs. It provides a complete bootstrap environment for a range of embed <BR>ded operating systems, such as embedded Linux and eCos, and includes fac <BR>ilities such as network downloading and debugging. It also provides a si <BR>mple flash file system for boot images. <BR> RedBoot provides a wide set of tools for downloading and executing p <BR>rograms on embedded target systems, as well as tools for manipulating th <BR>e target system’s environment. It can be used for both product developm <BR>ent (debug support) and for end product deployment (flash and network bo <BR>oting). <BR>5.2.2 RedBoot 命令 <BR> RedBoot> help <BR> Manage aliases kept in FLASH memory <BR> alias name [value] <BR> Set/Query the system console baud rate <BR> baudrate [-b <rate>] <BR> Manage machine caches <BR> cache [ON | OFF] <BR> Display/switch console channel <BR> channel [-1|<channel number>] <BR> Compute a 32bit checksum [POSIX algorithm] for a range of memory <BR> cksum -b <location> -l <length> <BR> Display (hex dump) a range of memory <BR> dump -b <location> [-l <length>] [-s] [-1|2|4] <BR> Execute an image - with MMU off <BR> exec [-w timeout] [-b <load addr> [-l <length>]] <BR> [-r <ramdisk addr> [-s <ramdisk length>]] <BR> [-c "kernel command line"] [<entry_point>] <BR> Manage FLASH images <BR> fis {cmds} <BR> Manage configuration kept in FLASH memory <BR> fconfig [-i] [-l] [-n] [-f] [-d] | [-d] nickname [value] <BR> Execute code at a location <BR> go [-w <timeout>] [entry] <BR> Run board diagnostics <BR> diag <BR> Help about help? <BR> help [<topic>] <BR> Set/change IP addresses <BR> ip_address [-l <local_ip_address>] [-h <server_address>] <BR> Load a file <BR> load [-r] [-v] [-d] [-h <host>] [-m <varies>] [-c <channel_number <BR>><I>] </I><BR> [-b <base_address>] <file_name> <BR> Compare two blocks of memory <BR> mcmp -s <location> -d <location> -l <length> [-1|-2|-4] <BR> Fill a block of memory with a pattern <BR> mfill -b <location> -l <length> -p <pattern> [-1|-2|-4] <BR> Network connectivity test <BR> ping [-v] [-n <count>] [-l <length>] [-t <timeout>] [-r <rate>] <BR> [-i <IP_addr>] -h <IP_addr> <BR> Reset the system <BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -