- 论坛徽章:
- 0
|
qq2440 linux初始化过程
/etc/inittab_ ==>> /etc/init.d/rcS ==>> 用户登录界面
||调用此文件夹下的批处理文件
||
/etc/rc.d/init.d
[root@FriendlyARM /etc]# cat inittab_
#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg,
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
# System initialization.
::sysinit:/etc/init.d/rcS
::askfirst:/sbin/getty 115200 console
///////////////////////////////////////////////////////////////
[root@FriendlyARM /etc]# cat init.d/rcS
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel
#
# Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
#
trap ":" INT QUIT TSTP
/sbin/hwclock -s
#SCSI modules
#Input modules
#/sbin/insmod /lib/input.o
#/sbin/insmod /lib/keybdev.o
#/sbin/insmod /lib/mousedev.o
#/sbin/insmod /lib/evdev.o
#Charactor modules
/bin/mknod /dev/pts/0 c 136 0
/bin/ln -s /dev/v4l/video0 /dev/video0
/bin/ln -s /dev/fb/0 /dev/fb0
/bin/ln -s /dev/vc/0 /dev/tty1
/bin/ln -s /dev/sound/dsp /dev/dsp
/bin/ln -s /dev/sound/mixer /dev/mixer
/bin/ln -s /dev/scsi/host0/bus0/target0/lun0/part1 /dev/sda1
/bin/mount -t proc none /proc
/bin/mount -t tmpfs none /tmp
/bin/mount -t tmpfs none /var
/bin/mkdir -p /var/lib
/bin/mkdir -p /var/run
/bin/mkdir -p /var/log
/etc/rc.d/init.d/netd start
echo " " > /dev/vc/0
echo "Starting networking..." > /dev/vc/0
usleep 300000
/etc/rc.d/init.d/httpd start
echo " " > /dev/vc/0
echo "Starting web server..." > /dev/vc/0
usleep 300000
/etc/rc.d/init.d/leds start
echo " " > /dev/vc/0
echo "Starting leds service..." > /dev/vc/0
echo " "
usleep 300000
/sbin/ifconfig lo 127.0.0.1
/sbin/ifconfig eth0 192.168.1.230 up
/sbin/madplay /shanghaitan.mp3 &
/bin/hostname -F /etc/sysconfig/HOSTNAME
///////////////////////////////////////////////////////////////
[root@FriendlyARM init.d]# pwd
/etc/rc.d/init.d
[root@FriendlyARM init.d]# ls
httpd leds netd
[root@FriendlyARM init.d]#
///////////////////////////////////////////////////////////////
[root@FriendlyARM /etc]# cat rc.d/init.d/netd
#!/bin/sh
base=inetd
# See how we were called.
case "$1" in
start)
/usr/sbin/$base
;;
stop)
pid=`/bin/pidof $base`
if [ -n "$pid" ]; then
kill -9 $pid
fi
;;
esac
exit 0
///////////////////////////////////////////////////////////////
#!/bin/sh
base=boa
# See how we were called.
case "$1" in
start)
/sbin/$base
;;
stop)
pid=`/bin/pidof $base`
if [ -n "$pid" ]; then
kill -9 $pid
fi
;;
esac
exit 0
///////////////////////////////////////////////////////////////
[root@FriendlyARM init.d]# cat leds
#!/bin/sh
base=led-player
# See how we were called.
case "$1" in
start)
/sbin/$base &
;;
stop)
pid=`/bin/pidof $base`
if [ -n "$pid" ]; then
kill -9 $pid
fi
;;
esac
exit 0
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/66022/showart_681709.html |
|