第一篇:嵌入式Linux下3G模塊的驅動和應用
嵌入式Linux下3G模塊的驅動和應用
1、開發資源 1.1、硬件資源:
ZTE-mf637u(中國聯通)ZTE-mu351(中國移動)
1.2、軟件資源:
1.2.1、usb-modeswitch-1.1.3 libusb-0.1.12.tar.gz usb-modeswitch-1.1.3.tar.bz2
1.2.2、ppp-2.4.4 libpcap-0.9.8.tar.gz ppp-2.4.4.tar.gz
1.2.3、wvdial 1.2.3.1、wvdial-1.54.0(arm-linux-gcc 3.4.1)zlib-1.2.5.tar.bz2 openssl-0.9.7g.tar.gz openssl-0.9.7g-fix_manpages-1.patch wvstreams-4.0.1.tar.bz2
wvstreams-4.0.1-tcl84-1.patch wvdial-1.54.0.tar.gz 1.2.3.2、wvdial_1.60.4(arm-linux-gcc 4.2.2)zlib-1.2.5.tar.bz2 openssl-0.9.8n.tar.gz openssl-0.9.8n-fix_manpages-1.patch wvstreams-4.6.1.tar.gz wvdial_1.60.4.tar.gz
2、Linux開發環境 2.1、主機環境 2.1.1、主機linux系統
Fedora Core 6
2.1.2、主機編譯環境 2.1.2.1、gcc-v Using built-in specs.Target: i386-redhat-linux Configured with:../configure--prefix=/usr--mandir=/usr/share/man--infodir=/usr/share/info--enable-shared--enable-threads=posix--enable-checking=release--with-system-zlib--enable-__cxa_atexit--disable-libunwind-exceptions--enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada--enable-java-awt=gtk--disable-dssi--enable-plugin--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre--with-cpu=generic--host=i386-redhat-linux Thread model: posix gcc version 4.1.1 20061011(Red Hat 4.1.1-30)
2.1.2.2、/usr/local/arm/3.4.1/bin/arm-linux-gcc-v Reading specs from /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/specs Configured with: /work/crosstool-0.27/build/arm-linux/gcc-3.4.1-glibc-2.3.2/gcc-3.4.1/configure--target=arm-linux--host=i686-host_pc-linux-gnu--prefix=/usr/local/arm/3.4.1--with-headers=/usr/local/arm/3.4.1/arm-linux/include--with-local-prefix=/usr/local/arm/3.4.1/arm-linux--disable-nls--enable-threads=posix--enable-symvers=gnu--enable-__cxa_atexit--enable-languages=c,c++--enable-shared--enable-c99--enable-long-long Thread model: posix gcc version 3.4.1
2.1.2.3、/usr/local/arm/4.2.2/usr/bin/arm-linux-gcc-v Using built-in specs.Target: arm-unknown-linux-gnueabi Configured with: /home/scsuh/workplace/coffee/buildroot-20071011/toolchain_build_arm/gcc-4.2.2/configure--prefix=/usr--build=i386-pc-linux-gnu--host=i386-pc-linux-gnu--target=arm-unknown-linux-gnueabi--enable-languages=c,c++--with-sysroot=/usr/local/arm/4.2.2-eabi/
--with-build-time-tools=/usr/local/arm/4.2.2-eabi//usr/arm-unknown-linux-gnueabi/bin--disable-__cxa_atexit--enable-target-optspace--with-gnu-ld--enable-shared--with-gmp=/usr/local/arm/4.2.2-eabi//gmp--with-mpfr=/usr/local/arm/4.2.2-eabi//mpfr--disable-nls--enable-threads--disable-multilib--disable-largefile--with-arch=armv4t--with-float=soft--enable-cxx-flags=-msoft-float Thread model: posix gcc version 4.2.2
2.2、開發板環境
2.2.1、CES-6410開發平臺
Samsung S3C6410X, ARM1176JZF-S 128MB, Mobile DDR SDRAM USB HOST:一個USB HOST 接口,USB2.0全速(12Mbits/s)
3、Linux應用軟件的編譯 3.1、usb-modeswitch-1.1.3 [root@localhost cdma]# tar xzf libusb-0.1.12.tar.gz [root@localhost cdma]# cp libusb-0.1.12 libusb-0.1.12-arm [root@localhost cdma]# cd libusb-0.1.12-arm [root@localhost libusb-0.1.12-arm]#./configure--prefix=/works/cdma/install--host=arm-linux CC=arm-linux-gcc CXX=arm-linux-g++ [root@localhost libusb-0.1.12-arm]# make [root@localhost libusb-0.1.12-arm]# make install
[root@localhost libusb-0.1.12-arm]# cd..[root@localhost cdma]# tar xjf usb-modeswitch-1.1.3.tar.bz2 [root@localhost cdma]# cp usb-modeswitch-1.1.3 usb-modeswitch-1.1.3-arm [root@localhost cdma]# cd usb-modeswitch-1.1.3-arm [root@localhost usb-modeswitch-1.1.3-arm]# 修改Makefile CC = gcc 改為
CC = arm-linux-gcc CFLAGS +=-Wall-l usb 改為
CFLAGS +=-Wall-l usb-I/works/cdma/install/include-L/works/cdma/install/lib 修改usb_modeswitch.c // readConfigFile(“/etc/usb_modeswitch.setup”);改為
readConfigFile(“/etc/usb_modeswitch.setup”);[root@localhost usb-modeswitch-1.1.3-arm]# make [root@localhost usb-modeswitch-1.1.3-arm]# make install [root@localhost usb-modeswitch-1.1.3-arm]# cd..[root@localhost cdma]#
3.2、ppp-2.4.4 [root@localhost cdma]# tar xzf libpcap-0.9.8.tar.gz [root@localhost cdma]# cp libpcap-0.9.8 libpcap-0.9.8-arm [root@localhost libpcap-0.9.8-arm]#./configure--prefix=/works/cdma/install--host=arm-linux--with-pcap make: *** No rule to make target `pcap-yes.o', needed by `libpcap.a'.Stop.修改Makefile PSRC = pcap-yes.c 改為
PSRC = pcap-linux.c [root@localhost libpcap-0.9.8-arm]# make [root@localhost libpcap-0.9.8-arm]# make install [root@localhost libpcap-0.9.8-arm]# cd..[root@localhost cdma]# tar xzvf ppp-2.4.4.tar.gz [root@localhost cdma]# cd ppp-2.4.4 [root@localhost ppp-2.4.4]#./configure--host=arm-linux vi pppd/Makefile
LIBS +=-lpcap
CFLAGS +=-DPPP_FILTER 改為
LIBS +=-lpcap-L../../libpcap-0.9.8 CFLAGS +=-DPPP_FILTER-I../../libpcap-0.9.8
[root@localhost ppp-2.4.4]# make CC=arm-linux-gcc
3.3、wvdial 3.3.1、wvdial-1.54.0 [root@localhost wvdial-1.54.0]# export PATH=/usr/local/arm/3.4.1/bin:$PATH [root@localhost wvdial-1.54.0]# tar xjf zlib-1.2.5.tar.bz2 [root@localhost wvdial-1.54.0]# cd zlib-1.2.5 [root@localhost zlib-1.2.5]#./configure--prefix=/works/wvdial-1.54.0/install 修改Makefile CC = arm-linux-gcc CPP=arm-linux-gcc-E AR=arm-linux-ar rc RANLIB=arm-linux-ranlib [root@localhost zlib-1.2.5]# make [root@localhost zlib-1.2.5]# make install
[root@localhost wvdial-1.54.0]# tar xzf openssl-0.9.7g.tar.gz [root@localhost wvdial-1.54.0]# cd openssl-0.9.7g [root@localhost openssl-0.9.7g]# patch-Np1-i../openssl-0.9.7g-fix_manpages-1.patch
[root@localhost openssl-0.9.7g]#./Configure--prefix=/works/wvdial-1.54.0/install os/compiler:arm-linux-gcc [root@localhost openssl-0.9.7g]# make [root@localhost openssl-0.9.7g]# make install [root@localhost openssl-0.9.7g]# cd..[root@localhost wvdial-1.54.0]# tar xjf wvstreams-4.0.1.tar.bz2 [root@localhost wvdial-1.54.0]# cd wvstreams-4.0.1 [root@localhost wvstreams-4.0.1]# patch-Np1-i../wvstreams-4.0.1-tcl84-1.patch 修改configure with_openssl=no 改為
with_openssl=yes(有兩處)
[root@localhost wvstreams-4.0.1]#./configure--prefix=/works/wvdial-1.54.0/install--host=arm-linux CFLAGS=-I/works/cdma/install/include LDFLAGS=-L/works/cdma/install/lib/--with-zlib=/works/cdma/zlib-1.2.5--with-openssl=/works/cdma/openssl-0.9.8n--without-dbus--with-pam=no--with-tcl=no--with-qt=no
[root@localhost wvstreams-4.0.1]# make linking libwvutils.so.../usr/lib/libz.so: could not read symbols: Invalid operation collect2: ld returned 1 exit status make: *** [libwvutils.so] Error 1 [root@localhost wvstreams-4.0.1]# arm-linux-gcc-L./xplc-L/works/cdma/install/lib/-L./xplc-L.-g-Wl,-soname,libwvutils.so.4.0-shared-o libwvutils.so utils/strcrypt.o utils/verstring.o utils/wvaudioencoder.o utils/wvbase64.o utils/wvbdbhash.o utils/wvcrash.o utils/wvdiriter.o utils/wvgzip.o utils/wvhashtable.o utils/wvhex.o utils/wvmagiccircle.o utils/wvmatrix.o utils/wvqdbmhash.o utils/wvrateadjust.o utils/wvserialize.o utils/wvshmzone.o utils/wvstringtable.o utils/wvsubproc.o utils/wvtest.o utils/wvwordwrap.o libwvbase.so-lsupc++-lgcc_eh [root@localhost wvstreams-4.0.1]# make [root@localhost wvstreams-4.0.1]# vi wvrules.mk XX_LIBS := $(XX_LIBS)$(shell $(CC)-lsupc++-lgcc_eh 2>&1 | grep-q “undefined reference” && echo “-lsupc++-lgcc_eh”)改為
XX_LIBS := $(XX_LIBS)$(shell $(CC)-lsupc++-lgcc_eh 2>&1 | grep-q “undefined reference” && echo “-lz-lcrypt-lsupc++-lgcc_eh”)[root@localhost wvstreams-4.0.1]# make compiling crypto/wvtripledes.o...crypto/wvtripledes.cc: In member function `virtual bool WvTripleDESEncoder::_encode(WvBuf&, WvBuf&, bool)': crypto/wvtripledes.cc:108: error: cannot convert `const unsigned char*' to `
unsigned char(*)[8]' for argument `1' to `void DES_ecb3_encrypt(unsigned
char(*)[8], unsigned char(*)[8], DES_key_schedule*, DES_key_schedule*,DES_key_schedule*, int)' make: *** [crypto/wvtripledes.o] Error 1 解決方法:
crypto/wvtripledes.cc 修改
#if OPENSSL_VERSION_NUMBER >= 0x0090705FL 改為 #if 0
compiling crypto/wvx509.o...crypto/wvx509.cc: In member function `WvString WvX509Mgr::get_extension(int)': crypto/wvx509.cc:1168: error: invalid conversion from `unsigned char**' to ` const unsigned char**' crypto/wvx509.cc:1171: error: invalid conversion from `unsigned char**' to ` const unsigned char**' make: *** [crypto/wvx509.o] Error 1 解決方法: crypto/wvx509.cc if(method->it)
ext_data = ASN1_item_d2i(NULL, &ext->value->data, ext->value->length, ASN1_ITEM_ptr(method->it));else ext_data = method->d2i(NULL, &ext->value->data, ext->value->length);改為
if(method->it)ext_data = ASN1_item_d2i(NULL,(const unsigned char **)&ext->value->data, ext->value->length, ASN1_ITEM_ptr(method->it));else ext_data = method->d2i(NULL,(const unsigned char **)&ext->value->data, ext->value->length);
compiling streams/wvpam.o...streams/wvpam.cc: In member function `bool WvPam::authenticate(const
WvFastString&, const WvFastString&, const WvFastString&)': streams/wvpam.cc:71: error: `fail' undeclared(first use this function)streams/wvpam.cc:71: error:(Each undeclared identifier is reported only once
for each function it appears in.)make: *** [streams/wvpam.o] Error 1 解決方法:
return fail;改為
return false;
[root@localhost wvstreams-4.0.1]# make install [root@localhost wvstreams-4.0.1]# cp libwvutils.so../install/lib/libwvutils.so.4.0-a [root@localhost wvstreams-4.0.1]# cd..[root@localhost wvdial-1.54.0]# tar xzf wvdial-1.54.0.tar.gz [root@localhost wvdial-1.54.0]# cd wvdial-1.54.0 [root@localhost wvdial-1.54.0]# cp /works/wvdial-1.54.0/install/include/wvstreams/*.h.[root@localhost wvdial-1.54.0]# vi Makefile PREFIX=/usr/local 改為
PREFIX=/works/wvdial-1.54.0/install
PPPDIR=/etc/ppp/peers
改為
PPPDIR=${PREFIX}/etc/ppp/peers
XPATH=..../wvstreams/include $(PKGINC)改為
XPATH=/works/wvdial-1.54.0/install/include/wvstreams
LIBS +=-L../wvstreams-lwvutils-lwvstreams 改為
LIBS +=-L/works/wvdial-1.54.0/install/lib-lwvutils-lwvstreams-lwvbase-lz
[root@localhost wvdial-1.54.0]# vi wvrules.mk 增加
CC = arm-linux-g++ CXX = arm-linux-g++ [root@localhost wvdial-1.54.0]# make [root@localhost wvdial-1.54.0]# make install
3.3.2、wvdial-1.60.4 export PATH=/usr/local/arm/4.2.2-eabi/usr/bin:$PATH tar xjf zlib-1.2.5.tar.bz2
cd zlib-1.2.5./configure--prefix=/works/cdma/install-4.2.2 修改Makefile CC = arm-linux-gcc CPP=arm-linux-gcc-E AR=arm-linux-ar rc LDSHARED=arm-linux-gcc....RANLIB=arm-linux-ranlib make make install
openssl-0.9.8n patch-N-p 1-i../openssl-0.9.8n-fix_manpages-1.patch
./Configure--prefix=/works/cdma/install-4.2.2 os/compiler:arm-linux-gcc make make install
wvstreams-4.6.1 修改configure
with_zlib=no 改為
with_zlib=yes(有兩處)
with_openssl=no 改為
with_openssl=yes(有兩處)
./configure--prefix=/works/cdma/install-4.2.2--host=arm-linux CPPFLAGS=-I/works/cdma/install-4.2.2/include LDFLAGS=-L/works/cdma/zlib-1.2.5-4.2.2 CFLAGS=-I/works/cdma/zlib-1.2.5-4.2.2--with-zlib=/works/cdma/zlib-1.2.5-4.2.2/--with-openssl=/works/cdma/openssl-0.9.8n-4.2.2--without-dbus--with-pam=no--with-tcl=no--with-qt=no--without-valgrind make 如果出現 undefined reference to “EVP_MD_size”錯誤
將出現錯誤的語句 return EVP_MD_size((evp_md_st *)evpmd;改成 return((evp_md_st *)evpmd)->md_size;即可
make install
wvdial-1.60.4 修改Makefile prefix=/usr/local 改為
prefix=/works/cdma/install-4.2.2
PPPDIR=/etc/ppp/peers 改為
PPPDIR=${prefix}/etc/ppp/peers
PC_CFLAGS=$(shell pkg-config--cflags libwvstreams)改為
PC_CFLAGS=-I/works/cdma/install-4.2.2/include/wvstreams
PC_LIBS=$(shell pkg-config--libs libwvstreams)PC_LIBS=-L/works/cdma/install-4.2.2/lib-lwvstreams-lwvutils-lwvbase
修改wvrules.mk WVLINK_CC = gcc
改為
WVLINK_CC = arm-linux-g++ CC = arm-linux-g++ CXX = arm-linux-g++ make make install
4、Linux內核的配置與修改 4.1、linux內核配置 make menuconfig Device Drivers--->
[*] Network device support--->
[*] USB support--->
4.2、linux內核修改 drivers/usb/serial/option.c static struct usb_device_id option_ids[] = { … };在這個數組中添加兩項
{ USB_DEVICE(0x19d2, 0x0031)}, { USB_DEVICE(0x19d2, 0x0034)}, 4.3、linux內核編譯 make zImage make modules5、3G模塊的使用 5.1、加載內核模塊 insmod option.ko insmod cdc-acm.ko
insmod slhc.ko insmod ppp_generic.ko insmod pppox.ko insmod pppoe.ko insmod ppp_synctty.ko insmod ppp_deflate.ko insmod crc-ccitt.ko insmod ppp_async.ko insmod sha1_generic.ko insmod ppp_mppe.ko
5.2、加載USB文件系統
mount-t usbfs usbfs /proc/bus/usb
5.3、ZTE-mf637u(中國聯通)的使用 5.3.1、配置文件/etc/usb_modeswitch.setup # Configuration for the usb-modeswitch package, a mode switching tool for # USB devices providing multiple states or modes # # This file is evaluated by the wrapper script “usb_modeswitch” in /lib/udev # To enable an option, set it to “1”, “yes” or “true”(case doesn't matter)
# Everything else counts as “disable”
# Disable automatic mode switching globally(e.g.to access the original # install storage)
DisableSwitching=0
# Enable logging(results in a extensive report file in /var/log, named # “usb_modeswitch_
EnableLogging=0
# ZTE MF622(aka “Onda MDC502HS”)# ZTE MF626 # ZTE MF628+(tested version from Telia / Sweden)# ZTE MF633 # ZTE MF636(aka “Telstra / BigPond 7.2 Mobile Card”)# ZTE MF637
# # Contributor: Joakim Wennergren and others
DefaultVendor= 0x19d2 DefaultProduct= 0x2000
TargetVendor= 0x19d2 TargetProduct= 0x0031
MessageContent=“******1b******” MessageContent2=“******1b******”
NeedResponse=1
5.3.2、配置文件/etc/wvdial.conf [Dialer Defaults]
Modem = /dev/ttyUSB2
Init1 = ATZ
Init3 = ATE0V1
Init5 = ATS0=0
Init6 = AT+CGDCONT=1,“IP”,“uninet”
Init7 = AT+CFUN=1
Modem Type = USB Modem
Baud = 460800
New PPPD = yes ISDN = 0
Phone = *99***1#
Password = any
Username = any
Stupid Mode = 1
5.3.3 ZTE-mf637u(中國聯通)的操作步驟 5.3.3.1、設置環境變量
export PATH= /works/wvdial-1.54.0/install/bin: /works/cdma/install/bin :$PATH export LD_LIBRARY_PATH= /works/wvdial-1.54.0/install/lib: /works/cdma/install/lib:$LD_LIBRARY_PATH 5.3.3.2、插入ZTE-mf637u(中國聯通)無線網卡 5.3.3.3、等待5秒鐘左右、運行usb-modeswitch-W 5.3.3.4、運行wvdial--> WvDial: Internet dialer version 1.54.0--> Cannot open /dev/ttyUSB2: Cannot get information for serial port.--> Cannot open /dev/ttyUSB2: Cannot get information for serial port.--> Cannot open /dev/ttyUSB2: Cannot get information for serial port.解決:(兩種方法)5.3.3.4.1將wvstreams-4.0.1/streams/wvmodem.cc #if HAVE_LINUX_SERIAL_H 改為
#if 0
5.3.3.4.2.wvstreams-4.0.1的配置命令增加ac_cv_header_linux_serial_h=no 即./configure--prefix=/works/wvdial-1.54.0/install--host=arm-linux CFLAGS=-I/works/cdma/install/include LDFLAGS=-L/works/cdma/install/lib/--with-zlib=/works/cdma/zlib-1.2.5--with-openssl=/works/cdma/openssl-0.9.8n--without-dbus--with-pam=no--with-tcl=no--with-qt=no ac_cv_header_linux_serial_h=no 重新編譯。
5.4、ZTE-mu351(中國移動)的使用 5.4.1、配置文件/etc/wvdial.conf Modem = /dev/ttyACM2 Init1 = ATZ Init3 = ATE0V1 Init5 = ATS0=0 Init6 = AT+CGDCONT=1,“IP”,“cmnet” Init7 = AT+CFUN=1 Modem Type = USB Modem Baud = 460800 New PPPD = yes ISDN = 0 Phone = *99***1#
Password = any Username = any Stupid Mode = 1 5.4.2、ZTE-mu351(中國移動)的操作步驟 5.4.2.1、設置環境變量
export PATH=/root/cdma:$PATH export LD_LIBRARY_PATH=/root/cdma:$LD_LIBRARY_PATH 5.4.2.2、插入ZTE-mu351(中國移動)無線網卡
5.4.2.3、等待5秒鐘左右、運行eject /dev/sr0。(5.3.3.3也可以使用此方法)5.4.2.4、運行wvdial--> WvDial: Internet dialer version 1.54.0--> Initializing modem.--> Sending: ATZ ATZ OK--> Sending: ATE0V1 ATE0V1 OK--> Sending: ATS0=0 OK--> Sending: AT+CGDCONT=1,“IP”,“cmnet”
OK--> Sending: AT+CFUN=1 OK--> Modem initialized.--> Sending: ATDT*99***1#--> Waiting for carrier.NO CARRIER--> No Carrier!Trying again.--> Sending: ATDT*99***1#--> Waiting for carrier.NO CARRIER--> No Carrier!Trying again.--> Sending: ATDT*99***1#--> Waiting for carrier.NO CARRIER--> No Carrier!Trying again.--> Sending: ATDT*99***1#--> Waiting for carrier.NO CARRIER--> No Carrier!Trying again.--> Sending: ATDT*99***1#
--> Waiting for carrier.^MODE: 15 CONNECT 2800000--> Carrier detected.Starting PPP immediately.--> Starting pppd at Mon Aug 16 16:17:15 2010--> pid of pppd: 1364--> Using interface ppp0--> local IP address 10.67.54.108--> remote IP address 192.200.1.21--> primary DNS address 211.136.20.203--> secondary DNS address 211.136.17.107
6、參考資料
http://sourceforge.net/projects/libusb/files/libusb-1.0/ http:// http://#ppp
http://code.google.com/p/wvstreams/downloads/detail?name=wvstreams-4.6.1.tar.gz&can=2&q= http://code.google.com/p/wvstreams/downloads/list
http://ftp.debian.org/debian/pool/main/w/wvdial/ http://code.google.com/p/wvstreams/downloads/list
第二篇:嵌入式linu學習心得
嵌入式Linux學習心得
1、Linux命令
ls:查看目錄-l以列表方式查看;ls –l 與ll的功能一樣 pwd: 查看當前的目錄
cd:改變當前操作目錄cd /直接跳到根目錄 cd..回到上一級目錄 cat: 打印顯示當前文件的內容信息
mkdir:創建目錄
fdisk: 查看硬盤分區信息,-l以列表方式查看
->代表是鏈接文件,類似window下的快捷方式。
cp: 復制命令,例子cp 文件名 /home/dir/
mv: 移動或改名,如mv sonf.confsonf.txt(改名)移動:mv sonf.conf / rm:刪除命令,如rm –f test.c;如刪除目錄rm –fr d
man:查看某個命令的幫助,man 命令
2、各系統目錄的功能
drw—r—w--:d代表是目錄,drw代表當前用戶的權限,r代表組用戶的權限,w代表其它用戶的權限。x代表有執行權限。
/boot/gruff.conf: 啟動引導程序
/dev:brw—rw--:b代表是塊設備。Linux設備有三種,塊設備(b開頭)、字符設備(c開頭)、網絡設備。had代表第一個硬盤,hdb代表第二個硬盤。Hdb2代表第二塊硬盤的第二個分區。3,67代表主設備為3,從設備為67./etc:存放的是系統的配置文件。Inittab文件存放不同啟動方式下必須啟動的進程。Inittab文件中有6個啟動level,wait中對應著6個level的目錄,respawn代表當一個進程被意外終止了,但會自動啟動的進程,如守護進程。rc.d目錄中存放了一個rc.sysinit文件,里面存放系統初始化配置信息。/etc還有一個vsftpd里面存放tcp、ftp的配置。
/home : 用戶目錄,存放用戶的文件,/lib:存放庫文件,后綴為so的文件代表動態鏈接庫。
/lost+found:系統意外終止,存放一些可以找回的文件。
/mnt:掛載外部設備,如掛載光驅:mount –t /dev/cdrom/mnt/cdrom,如
果在雙系統中,要查看windows中D盤的文件,首先應該將D盤的文件映射過來,mount –t /dev/hda2/mnt/windows/d
/opt:用戶安裝的應用程序
/proc:是系統運行的映射,比較重要。里面的文件數字代表進程號。每個進程號目錄下包含進程的基本信息。還有其他信息,如cpuinfo等,內核支持的文件系統filesystem等。系統支持的中斷interrupts,iomen代表內存分配情況。ioport存放IO端口號。還有分區信息,modole信息,狀態信息,版本信息
對于Linux的設備驅動程序,有兩種加載模式,一種是直接加載進linux內核,一種是以模塊的方式加載到內核。
/sbin: 系統管理的一些工具。如poweroff關機工具。
/usr: 安裝系統時很多文件放在此目錄下面,包含一些更新等,include包含的頭文件,lib 是Linux的庫文件,src包含Linux2.4的內核源碼
/var:存放是臨時變量
3、
第三篇:嵌入式linux驅動學習總結
調用gcc: export PATH=$PATH:/usr/local/arm/3.4.1/bin 用gcc編譯:arm-linux-gcc –o run adc.c 查看gcc: arm-linux-gcc –v 配置NFS 安裝NFS Ubuntu上默認是沒有安裝NFS服務器的,首先要安裝NFS服務程序: sudo apt-get install nfs-kernel-server 安裝nfs-kernel-server時,apt會自動安裝nfs-common和portmap 這樣,宿主機就相當于NFS Server 配置NFS(1)配置portmap 方法1: 編輯/etc/default/portmap, 將-i 127.0.0.1 去掉.我用的是第一種方法!但不知道具體什么意思
方法2: $ sudo dpkg-reconfigure portmap , 對Should portmap be bound to the loopback address? 選N.(2)配置/etc/hosts.deny 禁止任何host(主機)能和你的NFS服務器進行NFS連接,加入: ### NFS DAEMONS portmap:ALL lockd:ALL mountd:ALL rquotad:ALL statd:ALL(3)配 置/etc/hosts.allow 允許那些你想要的主機和你的NFS服務器建立連接。下列步驟將允許任何IP地址以192.168.2開頭的主機(連接到NFS服務器上),也可以指定 特定的IP地址,加入: ### NFS DAEMONS portmap: 192.168.1.lockd: 192.168.1.rquotad: 192.168.1.mountd: 192.168.1.statd: 192.168.1./etc/hosts.deny 和 /etc/hosts.allow 設置對portmap的訪問.采用這兩個配置文件有點類似“mask”的意思.現在/etc/hosts.deny中禁止所有用
戶對portmap的訪問.再在/etc/hosts.allow 中允許某些用戶對portmap的訪問.sudo /etc/init.d/portmap restart 重啟portmap daemon.(4)配置/etc/exports NFS掛載目錄及權限由/etc/exports文件定義 比如我要將將我的/opt/FriendlyARM/mini2440/root_nfs目錄讓用戶的IP共享, 則在該文件末尾添加下列語句:
/opt/FriendlyARM/mini2440/root_nfs *(rw,sync,no_root_squash)NFS客戶端能夠共享NFS服務器/opt/FriendlyARM/QQ2440/root_nfs目錄內容.且有讀,寫權限, 并且該用戶進入
/opt/FriendlyARM/mini2440/root_nfs目錄后的身份為root 最好加上sync, 否則 $ sudo exportfs-r 時會給出警告, sync是NFS的默認選項.showmount-e 查看NFS server的export list.若更改了/etc/exports, 運行 sudo exportfs-r 更新
運行 /etc/init.d/nfs-kernel-server restart 重啟nfs服務
(5)測試NFS 可以嘗試一下掛載本地磁盤
我前面開始時已經提到了我的主機IP是192.168.1.101 我現在試把/opt/FriendlyARM/mini2440/root_nfs目錄掛載到/mnt目錄下 mount-t nfs 192.168.1.101:/opt/FriendlyARM/mini2440/root_nfs /mnt 就101和:之間的空格我耗了1個小時
成功的掛載上的話你會在/mnt目錄下看到root_nfs這個文件夾下的內容
Arm9之家賬戶:李向陽85 安裝ncurses
ncurses是字符終端下屏幕控制的基本庫。可能很多新開發的程序都不使用了,不過如果要編譯一些老程序,還經常遇得到。
安裝:ncurses
http://ftp.gnu.org/pub/gnu/ncurses/
./configure--without-debug #以及其它自己需要的參數
make
make install
3,繼續你的make menuconfig。
圖形界面出來了。
允 23:22:22
小允 23:22:31
小允 23:22:40 有用不同的名字的嗎 寂寞沙洲冷 23:22:42 我把drivers下面的Makefile都添加上了 寂寞沙洲冷 23:23:17 叫misc devices 可以吧 小允 23:23:22 2410ADC_driver和2410ADC_FEATURESnengbutongma 小允 23:23:33 這兩個必須一樣 小允 23:23:42 這才是Kconfig的工作原理
第四篇:嵌入式軟件工程師底層驅動內核工程師
嵌入式軟件工程師 嵌入式軟件工程師嵌入式系統是以應用為中心,以計算機技術為基礎,并且軟硬件可裁剪,適用于應用系統對功能、可靠性、成本、體積、功耗有嚴格要求的專用計算機系統。它一般由嵌入式微處理器、外圍硬件設備、嵌入式操作系統以及用戶的應用程序等四個部分組成,用于實現對其他設備的控制、監視或管理等功能。
嵌入式軟件工程師就是編寫嵌入式系統的工程師。
嵌入式軟件工程師待遇
IBM、微軟、華為、Yahoo、聯想、搜狐、亞信、花旗...2010'應屆畢業生就業安置計劃火熱啟動:先實訓后上崗,轉正年薪50000元。
怎樣做個嵌入式軟件工程師
應具備哪些能力,最直接的方法,就是去根據各公司,招聘網站的嵌入式軟件工程師的應聘要求來分析
我幫你總結下:
1.最重要的是C語言編程,以及C++,這個與你讀程,應用,開發項目,做系統移植息息相關;
2.操作系統: LINUX,WINCE等,至少學習過一種,并且還需要對些基礎知識有蠻多的了解;
3.對ARM,FPGA,DSP等這些硬件比較了解。
這是最常規的條件
當然,一些基本素質,像英語能力,或是啥的,也很重要
推薦: 你可以去按照招聘要求分析,也可以按照培訓機構的培訓目的,方向,內容來分析得知,像海同科技就是蠻不錯的嵌入式軟件工程師發展前景分析
嵌入式領域較新,目前發展非常快,很多軟硬件技術出現的時間都不太長(如ARM處理器、嵌入式操作系統、LINUX操作系統),大多數人沒有條件接觸或進入嵌入式行業,更談不上能有機會接受專業人士的指導。因此,踏進這個行業的難度比較大,嵌入式人才稀缺,身價自然也水漲船高。
權威部門統計,我國嵌入式人才缺口每年50萬人左右。根據前程無憂網發布的調查報告,嵌入式軟件開發是未來幾年最熱門和最受歡迎的職業之一,具有10年工作經驗的高級嵌入式工程師年薪在30萬元左右。即使是初級的嵌入式軟件開發人員,平均月薪也達到了3000—5000元,中高級的嵌入式工程師月薪平均超過10000元。做軟件實際上有高下之分,開發語言從機器語言、匯編到C、C++,再到紅透半邊天的Java、C#等,該學哪種呢?為什么有些開發者工資低,而有些開發者千金難求?為什么3年的Java高級程序員薪水僅僅8k-10k,而一個Linux底層C語言程序員兩
年經驗就敢要10k的薪水?
還是門檻,比如月薪15k的Linux嵌入式開發職位,門檻就有 Linux系統、Shell編程、Linux開發環境、C語言、ARM硬件平臺、數據結構、Linux內核、驅動程序等,粗略數數就有8道關口,他需要非常熟悉整個的計算機體系,能做出實際的產品,而Java的開發者卻僅僅是會使用名叫Java的語言工具,始終高高飄在眾多層次之上,開發項目非常快,甚至可以不知道OSI模型,很可能自始至終都是軟件藍領。嵌入式開發本身也有高下之分,至少包含嵌入式應用程序工程師和底層的驅動內核工程師兩種。前者同樣是使用現成工具進行簡單勞動,比如使用J2ME開發小游戲或者進行一些界面開發,而后者是根據芯片具體情況把操作系統(如Linux)移植到上面,同時編寫必要的驅動程序,改寫相應的內核代碼。很顯然后者是一個公司真正的技術核心。而技術核心的工資很可能是其他開發者的數倍。
嵌入式開發突出強制和項目,學習不僅僅是學習幾項技術,而是構建你的知識體系。比如學習嵌入式開發,就要從基礎Linux,C語言,數據結構開始,到ARM,匯編,Linux內核、驅動等,更重要的是更多的項目練習,設計至少5個項目,多達10000行強制核心代碼的編寫可以讓你真正獲得知識。為進入外企或者出國做準備。
未來的幾年內,隨著信息化,智能化,網絡化的發展,嵌入式系統技術也將獲得廣闊的發展空間。美國著名未來學家尼葛洛龐帝99年1月訪華時預言,4~5年后嵌入式智能(電腦)工具將是PC和因特網之后最偉大的發明。我國著名嵌入式系統專家沈緒榜院士98年11月在武漢全國第11次微機學術交流會上發表的《計算機的發展與技術》一文中,對未來10年以嵌入式芯片為基礎的計算機工業進行了科學的闡述和展望。1999年世界電子產品產值已超過12000億美元,2000年達到13000億美元,預計2005年,銷售額將達18000億美元。目前一些先進的PDA在顯示屏幕上已實現漢字寫入、短消息語音發布,日用范圍也將日益廣闊。對于企業專用解決方案,如物流管理、條碼掃描、移動信息采集等,這種小型手持嵌入式系統將發揮巨大的作用。自動控制領域,不僅可以用于ATM機,自動售貨機,工業控制等專用設備,和移動通訊設備結合、GPS、娛樂相結合,嵌入式系統同樣可以發揮巨大的作用。
第五篇:嵌入式Linux應用:概述
Embedded Linux applications: An overview Linux now spans the spectrum of computing applications, including IBM's tiny Linux wrist watch, hand-held devices(PDAs and cell phones), Internet appliances, thin clients, firewalls, industrial robotics, telephony infrastructure equipment, and even cluster-based supercomputers.Let's take a look at what Linux has to offer as an embedded system, and why it's the most attractive option currently available.One.Emergence of embedded systems The computers used to control equipment, otherwise known as embedded systems, have been around for about as long as computers themselves.They were first used back in the late 1960s in communications to control electrome chanical telephone switches.As the computer industry has moved toward ever smaller systems over the past decade or so, embedded systems have moved along with it, providing more capabilities for these tiny machines.Increasingly, these embedded systems need to be connected to some sort of network, and thus require a networking stack, which increases the complexity level and requires more memory and interfaces, as well as, you guessed it, the services of an operating system.Off-the-shelf operating systems for embedded systems began to appear in the late 1970s, and today several dozen viable options are available.Out of these, a few major players have emerged, such as VxWorks, pSOS, Neculeus, and Windows CE.Two.Advantages/disadvantages of using Linux for your embedded system Although most Linux systems run on PC platforms, Linux can also be a reliable workhorse for embedded systems.The popular “back-to-basics” approach of Linux, which makes it easier and more flexible to install and administer than UNIX, is an added advantage for UNIX gurus who already appreciate the operating system because it has many of the same commands and programming interfaces as traditional UNIX.The typical shrink-wrapped Linux system has been packaged to run on a PC, with a
hard disk and tons of memory, much of which is not needed on an embedded system.A fully featured Linux kernel requires about 1 MB of memory.However, the Linux micro-kernel actually consumes very little of this memory, only 100 K on a Pentium CPU, including virtual memory and all core operating system functions.With the networking stack and basic utilities, a complete Linux system runs quite nicely in 500 K of memory on an Intel 386 microprocessor, with an 8-bit bus(SX).Because the memory required is often dictated by the applications needed, such as a Web server or SNMP agent, a Linux system can actually be adapted to work with as little as 256 KB ROM and 512 KB RAM.So it's a lightweight operating system to bring to the embedded market.Another benefit of using an open source operating system like Embedded Linux over a traditional real-time operating system(RTOS), is that the Linux development community tends to support new IP and other protocols faster than RTOS vendors do.For example, more device drivers, such as network interface card(NIC)drivers and parallel and serial port drivers, are available for Linux than for commercial operating systems.The core Linux operating system itself has a fairly simple micro-kernel architecture.Networking and file systems are layered on top of the micro-kernel in modular fashion.Drivers and other features can be either compiled in or added to the kernel at run-time as loadable modules.This provides a highly modular building-block approach to constructing a custom embeddable system, which typically uses a combination of custom drivers and application programs to provide the added functionality.An embedded system also often requires generic capabilities, which, in order to avoid re-inventing the wheel, are built with off-the-shelf programs and drivers, many of which are available for common peripherals and applications.Linux can run on most microprocessors with a wide range of peripherals and has a ready inventory of off-the-shelf applications.Linux is also well-suited for embedded Internet devices, because of its support of multiprocessor systems, which lends it scalability.This capability gives a designer the option of running a real-time application on a dual processor system, increasing total processing power.So you can run a Linux system on one processor while running a GUI, for example, simultaneously on another processor.The one disadvantage to running Linux on an embedded system is that the Linux architecture provides real-time performance through the addition of real-time software modules that run in the kernel space, the portion of the operating system that implements the scheduling policy, hardware-interrupts exceptions and program execution.Since these
real-time software modules run in the kernel space, a code error can impact the entire system's reliability by crashing the operating system, which can be a very serious vulnerability for real-time applications.An off-the-shelf RTOS, on the other hand, is designed from the ground up for real-time performance, and provides reliability through allocating certain processes a higher priority than others when launched by a user as opposed to by system-level processes.Processes are identified by the operating system as programs that execute in memory or on the hard drive.They are assigned a process ID or a numerical identifier so that the operating system may keep track of the programs currently executing and of their associated priority levels.Such an approach ensures a higher reliability(predictability)with the RTOS time than Linux is capable of providing.But all-in-all, it's still a more economical choice.Three.Different types of Embedded Linux systems There are already many examples of Embedded Linux systems;it's safe to say that some form of Linux can run on just about any computer that executes code.The ELKS(Embeddable Linux Kernel Subset)project, for example, plans to put Linux onto a Palm Pilot.Here are a couple of the more well-known small footprint Embedded Linux versions: ETLinux--a complete Linux distribution designed to run on small industrial computers, especially PC/104 modules.LEM--a small(<8 MB)multi-user, networked Linux version that runs on 386s.LOAF--“Linux On A Floppy” distribution that runs on 386s.uClinux--Linux for systems without MMUs.Currently supports Motorola 68K, MCF5206, and MCF5207 ColdFire microprocessors.uLinux--tiny Linux distribution that runs on 386s.ThinLinux--a minimized Linux distribution for dedicated camera servers, X-10 controllers, MP3 players, and other such embedded applications.Software and hardware requirements Several user-interface tools and programs enhance the versatility of the Linux basic kernel.It's helpful to look at Linux as a continuum in this context, ranging from a stripped-down micro-kernel with memory management, task switching and timer services to a full-blown server supporting a complete range of file system and network services.A minimal Embedded Linux system needs just three essential elements:
? ? A boot utility
The Linux micro-kernel, composed of memory management, process An initialization process Drivers for hardware
One or more application processes to provide the needed functionality A file system(perhaps in ROM or RAM)TCP/IP network stack
A disk for storing semi-transient data and swap capability A 32-bit internal CPU(required by all complete Linux systems)management and timing services
?
To doing anything useful while remaining minimal, you also need to add:
? ?
As additional requirements become necessary, you might also want: ? ? ? ?
Four.Hardware platform options Choosing the best hardware can be complex because of internal company politics, prejudices, legacies of other projects, a lack of complete or accurate information, and cost, which should take into account the total product costs and not just the CPU itself.Sometimes a fast, inexpensive CPU can become expensive once bus logic and the delays necessary to make it work with other peripherals are considered.To calculate the necessary speed of a CPU for any given project, start with a realistic view of how fast the CPU needs to run to accomplish a given task and triple it.Also, determine how fast the bus needs to run.If there are secondary buses, such as a PCI bus, consider them also.A slow bus(that is, one that is saturated with DMA traffic)can significantly slow down a fast CPU.Here are some of the best hardware solutions for Embedded Linux applications.Bright Star Engineering: Bright Star Engineering's ipEngine-1 is a credit-card sized single-board computer with Embedded Linux support.It utilizes a PowerPC-based CPU and provides an array of on-board peripherals, including Ethernet, LCD/Video Controller, USB, Serial I/O, and a 16K gate user-configurable FPGA.BSE's Embedded Linux configuration allows Linux to be booted from the ipEngine's on-board 4MB flash memory.Calibri: CalibriTM-133 is a ready-to-use, compact, multipurpose network appliance
that uses Embedded Linux as its operating system.It offers a highly efficient and low-cost solution to firewall, VPN, and routing demands.EmbeddedPlanet: EmbeddedPlanet has created a PostPC-era computer that comes loaded with MontaVista's HardHat Linux.Powered by a PowerPC-based computing engine and matching I/O card, Linux Planet comes in a colorful translucent case with a touchscreen and access to digital and analog I/O.Eurotech: Eurotech provides embedded PC SBC and sponsors ET-Linux, a complete Linux system designed to run on small industrial computers and based on glibc 2.1.2.Microprocess Ingenierie: Microprocess develops, produces, and sells standard and customized products for the industrial and embedded market.Microprocess has a global activity in real-time software and great expertise in systems integration.Its products, like the 740 PowerPC compactPCI board, can be ordered with a standard distribution of Linux or an Embedded Linux version.Moreton Bay: Moreton Bay is releasing their NETtel 2520 and NETtel 2500 range of Linux-based Internet routers.These small, easy-to-connect intelligent router solutions are engineered to offer a simple, secure, and affordable extranet-friendly Virtual Private Network(VPN)for flat networks.The NETtel router family runs an Embedded Linux kernel.A development kit is available;it enables customized code to be stored in flash memory and executed inside the NETtel.The code may contain special encryption or authentication protocols, or some local monitoring script where NETtel is used as a remote control device.Matrix Orbital: This an optional, but not recommended, addition.Matrix Orbital manufactures a line of serial LCDs and VFDs, which many Linux users are including in their embedded systems.The product line ranges from 8x2 to 40x4 character LCDs, 20x2 and 20x4 VFDs, plus a 240x64 graphic LC(128x128 on the way).Communication with the displays is accomplished via either RS232 or I2C, both of which are standard on all of their modules.A comprehensive command set is included in the modules' BIOS.Five.Real-time Embedded Linux applications One of the most important issues with embedded systems is the need for a real-time operating system.The definition of real-time here varies quite a bit.To some people, real-time means responding to an event in the one-microsecond range, to others it is 50 milliseconds.The hardness of real-time also varies quite a bit.Some systems need hard
real-time response, with short deterministic response latencies to events.However, on many systems, when analyzed closely, we see a response time requirement that is actually near real-time.Often the real-time requirement is a tradeoff of time and buffer space.With memory getting cheaper, and CPUs getting faster, near real-time is now more typical than hard real-time and many commercial operating systems that claim to be real-time are far from being hard real-time.Usually, when you get into the detailed design of these systems, there are warnings that the drivers' interrupts and applications must be very carefully designed in order to meet real-time requirements.RT-Linux(Linux with real-time extensions)contains time critical functions to provide precise control over interrupt handling, through the use of an interrupt manager, and does a good job of making sure that critical interrupts get executed when needed.The hardness of this approach depends mostly on the CPU interrupt structure and context-switch hardware support.This approach is sufficient for a large range of real-time requirements.Even without the real-time extensions, Linux does pretty well at keeping up with multiple streams of events.For example, a Linux PC system on a low end Pentium is able to keep multiple 10BaseT interfaces executing effectively, while simultaneously running character-level serial ports at a full 56KBPS without losing any data.Some real-time hardware and software Linux APIs to consider are RTLinux, RTAI, EL, and Linux-SRT.RTLinux is a hard real-time Linux API originally developed at the New Mexico Institute of Technology.RTAI(DIAPM)is a spin-off of the RTLinux real-time API that was developed by programmers at the Department of Aerospace Engineering, Polytechnic Politecnico di Milano(DIAPM).EL/IX is a proposed POSIX-based hard real-time Linux API being promoted by Red Hat.And Linux-SRT is a soft real-time alternative to real-time APIs, which provides performance-enhancing capabilities to any Linux program without requiring that the program be modified or recompiled.See the Resources section later in this article for information on the above and for some Web sites offering different flavors of software extensions, development tools, support, and training courses for the standard Linux operating system.Short deterministic response latencies Some real-time embedded systems need to respond quickly to external events in order to accomplish a specific task.A custom microcontroller embedded inside a missile, for example, needs to respond quickly to external events such as moving targets, weather, humans, etc., before instructing the missile to target a specific object in its surrounding
environment.Short deterministic response latencies mean that the embedded system can determine the time it will take to respond to an external event.Six.Configuration procedures Now let's take a look at how to make LEM, a small, embeddable Linux distribution, which provides both network and X server.You can download this distribution, although it is not essential.You will need a full Linux distribution to build your own Embedded Linux operating system, which will contain everything you need(utilities, sources, compiler, debugger, and documentation).Here is a list of the software that can be used to make LEM: TinyLogin: TinyLogin is a suite of tiny UNIX utilities for handling logging into, being authenticated by, changing one's password for, and otherwise maintaining users and groups on an embedded system.It also provides shadow password support to enhance system security.TinyLogin is, as the name implies, very small, and makes an excellent complement to BusyBox on an embedded System.BusyBox: BusyBox is a multicall binary used to provide a minimal subset of POSIX-style commands and specialized functions.It is geared toward the very small, such as boot floppies, embedded systems, etc.Specifically it is used in the Debian Rescue/Install system(which inspired development on the original BusyBox), the Linux Routeur Project, LEM, lineo, and others.Busybox is being maintained by Erik Andersen.Ash: Ash is a very small Bourne shell.Sysvinit: Sysvinit is the most used init package for Linux.We will use init and the C version of the start-stop-daemon.See the Resources section for more information on these items.Seven.Creating a bootdisk A bootdisk is basically a miniature, self-contained Linux system on a floppy diskette.It can perform many of the same functions that a complete full-size Linux system performs.The following material is based on the Bootdisk-HOWTO(see Resources).Step 1.Bios
All PC systems start the boot process by executing code in ROM(specifically, the BIOS)to load the sector from sector 0, cylinder 0 of the boot drive.The boot drive is usually the
first floppy drive(designated A: in DOS and /dev/fd0 in Linux).The BIOS then tries to execute this sector.On most bootable disks, sector 0, cylinder 0 contains either:
? Code from a boot loader such as LILO, which locates the kernel, loads it, and The start of an operating system kernel, such as Linux executes it to start the boot proper
?
If a Linux kernel has been raw copied to a diskette, a hard drive, or another media, the first sector of the disk will be the first sector of the Linux kernel itself.This first sector will continue the boot process by loading the rest of the kernel from the boot device.Step 2.The boot loader
You will use a boot loader like LILO to operate the boot process.It allows the development and production platforms to co-exist on the same hardware and permits switching from one to the other just by rebooting.The LILO boot loader is loaded by the bios.It then loads kernels or the boot sectors of other operating systems.It also provides a simple command line interface to interactively select the item to boot with its options.See Resources for more information on LILO.Step 3.The kernel
The kernel checks the hardware and mounts the root device and then looks for the init program on the root filesystem and executes it.Step 4.Init Init is the parent of all other processes that will run on your Linux OS.It will watch its child processes and start, stop, re-launch them if needed.Init takes all information from /etc/inittab.Step 5.Inittab The file /etc/inittab/ refers to scripts named /etc/rc...to do the system setup.It also has entries for the getty tool to handle the login process.Step 6.The login process
There is one getty available in the inittab file for each console allowed for the users.Getty will launch /bin/login to verify the user password.Step 7.Creating a new partition
From the LFS-HOWTO(see Resources): Before we can build our new Linux system, we need to have an empty Linux partition on which we can build our new system.If you already have a Linux Native partition available, you can skip this step and the following one.Start the fdisk program(or cfdisk if you prefer that program)with the appropriate hard disk as the option(like /dev/hda if you want to create a new partition on the primary
master IDE disk).Create a Linux Native partition, write the partition table, and exit the(c)fdisk program.If you get the message that you need to reboot your system to ensure that the partition table is updated, then please reboot your system now before continuing.Step 8.Creating an ext2 file system on the new partition
From the LFS-HOWTO(see Resources): To create a new ext2 file system we use the mke2fs command.Give $LFS as the only option, and the file system will be created.From now on I'll refer to this newly created partition as $EMBPART.$EMBPART should be substituted with the partition you have created.Step 9.Mounting the partition
To access the newly created filesystem, you have to mount it.To do this, create an /mnt/hda? directory and type the following at the shell prompt:
mkdir /mnt/hda? mount $EMBPART /mnt/hda? If you created your partition on /dev/hda4 and you mounted it on /mnt/hda4, then you'll need to return to the step where you copied a file to $dollar;EMBPART/usr/sbin, and copy that file to /mnt/hda4/usr/bin.Do this after the last command in Step 14(Copy the file in $EMBPART/usr/sbin).Step 10.Populating the filesystem
The root filesystem must contain everything needed to support a full Linux system.We will build a directory structure not that far from the File Hierarchy Standard(see Resources).Step 11.Directories The mkdir function in the new mounted filesystem creates the following directories: /proc
Directory stub required by the proc filesystem /etc :System configuration file /sbin :Critical System binaries
/bin :Basic binaries considered part of the system /lib :Shared Libraries to provide run-time support /mnt :Mount point for maintenance /usr :Additional utilities and applications
? ? ? ?
cd /mnt/hda?
mkdir bin dev home proc sbin usr boot etc liv mnt root tmp var mkdir-p usr/bin usr/sbin usr/share usr/lib mkdir-p etc/config etc/default etc/init.d etc/rc.boot
? mkdir-p etc/rc0.d etc/rc1.d etc/rc2.d etc/rc3.d etc/rc4.d etc/rc5.d etc/rc6.d etc/rcS.d
/dev :The dev directory is the stub required to perform devices input / output.Each file in this directory may be created using the mknod function.You may save time by directly copying the required dev entries from your desktop Linux, using the following instruction: cp-dpR /dev /mnt Eight.Installing TinyLogin and login dependencies TinyLogin(see the Resources section to install it)will give us the following tools in less than 35Kb:
/bin/addgroup, /bin/adduser, /bin/delgroup, /bin/deluser, /bin/login, /bin/su, /sbin/getty, /sbin/sulogin, /usr/bin/passwd.Please refer to your main distribution doc or man pages for a full description of those commands.Step 12.Configuring TinyLogin
From the TinyLogin README: TinyLogin is modularized to help you build only the components you need, thereby reducing binary size.To turn off unwanted TinyLogin components, simply edit the file tinylogin.def.h and comment out the parts you do not want using C++ style(//)comments.Step 13.Installing TinyLogin After the build is complete, a tinylogin.links file is generated, which is then used by make install to create symlinks to the tinylogin binary for all compiled-in functions.By default, make install will place a symlink forest into pwd /_install unless you have defined the PREFIX environment variable.Step 14.Installing Sysvinit and start-stop 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 start-stop-daemon 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 1.6 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/init.d/rcS # single-user mode.~~:S:wait:/sbin/sulogin # /etc/init.d executes the S and K scripts upon change # 0:halt 1:single-user 2-5:multi-user(5 may be X with xdm or other)6:reboot.l0:0:wait:/etc/init.d/rc 0 l1:1:wait:/etc/init.d/rc 1 l2:2:wait:/etc/init.d/rc 2 l3:3:wait:/etc/init.d/rc 3 l4:4:wait:/etc/init.d/rc 4 l5:5:wait:/etc/init.d/rc 5 l6:6:wait:/etc/init.d/rc 6 # CTRL-ALT-DEL pressed.ca:12345:ctrlaltdel:/sbin/shutdown-t1-r now # Action on special keypress(ALT-UpArrow).kb::kbrequest:/bin/echo “Keyboard Request--edit /etc/inittab to let this work.” # /sbin/mingetty invocations for runlevels.1:2345:respawn:/sbin/getty 9600 tty1 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 command to create the directories: cd $EMBPART/etc mkdir rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d init.d rcS.d rc.boot Go to the unpacked Sysvinit source directory Copy the debian/etc/init.d/rc to:$EMBART/etc/init.d Go to the $EMBPART/etc/init.d/ 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 CTRL-C only in this shell so we can interrupt subprocesses.trap “:” 2 3 20 # Call all parts in order.for i in /etc/rcS.d/S??* do
[!-f “$i” ] && continue
case “$i” in
*.sh)
(trap-2 3 20
.$i start)
;;
*)
$i start
;;
esac done # run the files in /etc/rc.boot [-d /etc/rc.boot ] && run-parts /etc/rc.boot
Copy run-parts from your distro to $EMBPART/bin.Step 18.Adding base scripts
A lot of the commands being used here are UNIX/Linux commands that set, export, etc.paths that are embedded inside of a UNIX shell script. Create a new file reboot containing the following: #!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin echo-n “Rebooting...” reboot-d-f-i Create a new file halt containing the following: #!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin halt-d-f-i-p
Nine.Summary The Linux operating system has a very bright future in the area of embedded applications for anything from Internet appliances to dedicated control systems.Roughly 95% of all newly manufactured microcomputer chips are used for embedded applications.The power, reliability, flexibility, and scalability of Linux, combined with its support for a multitude of microprocessor architectures, hardware devices, graphics support, and communications 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 components have evolved to meet the diverse needs of the markets and applications to which Linux is being adapted.There are small footprint versions and real-time enhanced versions.Despite the origins of Linux as a PC architecture operating system, there are now ports to numerous non-x86 CPUs, with and without memory management units, including PowerPC, ARM, MIPS, 68K, and even microcontrollers.But look out, there's more coming in the near future for many other Information Technology(IT)domains!