【正文】
ts you need, thereby reducing binary size. To turn off unwanted TinyLogin ponents, simply edit the file and ment out the parts you do not want using C++ style (//) ments. Step 13. Installing TinyLogin After the build is plete, a file is generated, which is then used by make install to create symlinks to the tinylogin binary for all piledin functions. By default, make install will place a symlink forest into pwd /_install unless you have defined the 10 PREFIX environment variable. Step 14. Installing Sysvinit and startstop daemon After the kernel is done loading, it tries to run the init program to finalize the boot process. Now: 1. Unpack the Sysvinit archive 2. Go to the src directory 3. Copy the init executable in $EMBPART/sbin The Sysvinit package also offers a C version of the startstopdaemon in the contrib directory. 1. Compile it 2. Copy the file in $EMBPART/usr/sbin Step 15. Configuring Sysvinit Sysvinit needs a configuration file named inittab, which should be placed in $EMBPART/etc. Here is the one used in the LEM distribution: /etc/inittab: init(8) configuration. $Id: inittab,v 1997/01/30 15:03:55 miquels Exp $ Modified for LEM 2/99 by Sebastien HUET default rl. id:2:initdefault: first except in emergency (b) mode. si::sysinit:/etc/ singleuser mode. ~~:S:wait:/sbin/sulogin /etc/ executes the S and K scripts upon change 0:halt 1:singleuser 25:multiuser (5 may be X with xdm or other) 6:reboot. l0:0:wait:/etc/l1:1:wait:/etc/l2:2:wait:/etc/l3:3:wait:/etc/l4:4:wait:/etc/l5:5:wait:/etc/l6:6:wait:/etc/ CTRLALTDEL pressed. ca:12345:ctrlaltdel:/sbin/shutdown t1 r now Action on special keypress (ALTUpArrow). kb::kbrequest:/bin/echo Keyboard Requestedit /etc/inittab to let this work. /sbin/mingetty invocations for runlevels. 1:2345:respawn:/sbin/getty 9600 tty1 11 2:23:respawn:/sbin/getty 9600 tty2 3:23:respawn:/sbin/getty tty3 you may add console there 4:23:respawn:/sbin/getty tty4 Step 16. Creating initial boot scripts As seen in the inittab file, Sysvinit needs additional scripts in its own directories. Step 17. Creating the necessary directories and base files Use the following mand to create the directories: cd $EMBPART/etc mkdir Go to the unpacked Sysvinit source directory Copy the debian/etc/:$EMBART/etc/ Go to the $EMBPART/etc/Create a new file rcS like those in LEM: !/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin runlevel=S prevlevel=N umask 022 export PATH runlevel prevlevel /etc/default/rcS export VERBOSE Trap CTRLC only in this shell so we can interrupt subprocesses. trap : 2 3 20 Call all parts in order. for i in /etc/* do [ ! f $i ] amp。 continue case $i in *.sh) ( trap 2 3 20 . $i start ) 。 esac done run the files in /etc/ [ d /etc/ ] amp。 runparts /etc/ Copy runparts from your distro to $EMBPART/bin. Step 18. Adding base scripts A lot of the mands being used here are UNIX/Linux mands that set, export, etc. paths that are embedded inside of a UNIX shell script. !reboot Create a new file reboot containing the following: !/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin echo n Rebooting... reboot d f i !halt Create a new file halt containing the following: !/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin halt d f i p !mountfs Nine. Summary The Linux operating system has a very bright future in the area of embedded applications for anything from Inter appliances to dedicated control systems. Roughly 95% of all newly manufactured microputer chips are used for embedded applications. The power, reliability, flexibility, and scalability of Linux, bined with its support for a multitude of microprocessor architectures, hardware devices, graphics support, and munications protocols have established Linux as an increasingly popular software platform for a vast array of projects and products. Because Linux is openly and freely available in source form, many variations and configurations of Linux and its supporting software ponents have evolved to meet the diverse needs of the markets and applications to which Linux is being adapted. There are small footprint versions and realtime enhanced versions. Despite the origins of Linux as 13 a PC architecture operating system, there are now ports to numerous nonx86 CPUs, with and without memory management units, including PowerPC, ARM, MIPS, 68K, and even microcontrollers. But look out, there39。讓我們看一下 Linux 用作嵌入式系統(tǒng)需要提供哪些功能,以及它在目前可用的選擇中最具吸引力的原因所在。它們最初于六十年代晚期在通訊中被用于控制機電電話交換機。漸漸地,就需要把這些嵌入式系統(tǒng)連接到某種網(wǎng)絡(luò)上,因而也就產(chǎn)生了對網(wǎng)絡(luò)棧的要求,這提高了系統(tǒng)的復(fù)雜程度并要求更多的存儲器和接口,還有,您猜對了,操作系統(tǒng)的服務(wù)。其中,一些主要的競爭者開始嶄露頭角,比如, VxWorks、 pSOS、 Neculeus 和 Windows CE。 Linux 流行的“ backtobasics”方法使得它的安裝和管理比 UNIX 更加簡單靈活,這對于那些 UNIX 專家們來說又是一個優(yōu)點,他們已經(jīng)因為 Linux 中有許多命令和編程接口同傳統(tǒng)的 UNIX 一樣而賞識它了。一個功能完備的 Linux 內(nèi)核要求大約 1 MB 內(nèi)存。只要有 500 K 的內(nèi)存,一個有網(wǎng)絡(luò)棧和基本實用程序的完全的 Linux 系統(tǒng)就可以在一臺 8 位總線( SX)的 Intel 386 微處理器上運行的很好了。因此它是一個瞄準(zhǔn)嵌入式市場的輕量級操作系統(tǒng) 。例如,用于 Linux 的設(shè)備驅(qū)動程序要比用于商業(yè)操作系統(tǒng)的設(shè)備驅(qū)動程序多,如網(wǎng)絡(luò)接口卡( NIC)驅(qū)動程序以及并口和串口驅(qū)動程序。網(wǎng)絡(luò)和文件系統(tǒng)以模塊形式置于微內(nèi)核的上層。這為構(gòu)造定制的可嵌入 系統(tǒng)提供了高度模塊化的構(gòu)件方法。 嵌入式系統(tǒng)也常常要求通用的功能,為了避免重復(fù)勞動,這些功能的實現(xiàn)運用了許多現(xiàn)成的程序和驅(qū)動程序,它們可以用于公共外設(shè)和應(yīng)用。 Linux 用于嵌入式的因特網(wǎng)設(shè)備也是很合適的,原因是它支持多處理器系統(tǒng),該特性使 Linux 具有了伸縮性。例如,您可以在一個處理器運行 GUI,同時在另一個處理器上運行 Linux 系統(tǒng)。而這些模塊運行的內(nèi)核空間正是操作系統(tǒng)實現(xiàn)調(diào)度策略、硬件中斷異常和執(zhí)行程序的部分。 另一方面,現(xiàn)成的 RTOS 完全是為實時性能而設(shè)計的,它通過在由用戶而非系統(tǒng)級進程啟動時分配給某個進程以高于其它進程的優(yōu)先級的方式來實現(xiàn)可靠性。給他們指定進程 ID 或者數(shù)字標(biāo)識符為的是讓操作系統(tǒng)跟蹤正在執(zhí)行的程序和這些程序的相關(guān)聯(lián)的優(yōu)先等級。但最重要的,這還是一種更加經(jīng)濟的選擇。例如, ELKS(可嵌入 Linux 內(nèi)核子集)方案計劃在 Palm Pilot 上使用 Lin