分类: LINUX
2008-07-12 09:31:39
1. 目录结构
------------------------------
|-- bin
| |-- insmod
| |-- lvm
| |-- modprobe -> /sbin/nash
| `-- nash
|-- dev
| |-- console
| |-- mapper
| |-- null
| |-- ptmx
| |-- ram -> ram1
| |-- ram0
| |-- ram1
| |-- rtc
| |-- systty
| |-- tty
| |-- tty0
| |-- tty1
| |-- tty10
| |-- tty11
| |-- tty12
| |-- tty2
| |-- tty3
| |-- tty4
| |-- tty5
| |-- tty6
| |-- tty7
| |-- tty8
| |-- tty9
| |-- ttyS0
| |-- ttyS1
| |-- ttyS2
| |-- ttyS3
| `-- zero
|-- etc
| `-- lvm
| `-- lvm.conf
|-- init
|-- lib
| |-- dm-mirror.ko
| |-- dm-mod.ko
| |-- dm-snapshot.ko
| |-- dm-zero.ko
| |-- ehci-hcd.ko
| |-- ext3.ko
| |-- jbd.ko
| |-- mptbase.ko
| |-- mptscsih.ko
| |-- mptspi.ko
| |-- ohci-hcd.ko
| |-- scsi_mod.ko
| |-- scsi_transport_spi.ko
| |-- sd_mod.ko
| `-- uhci-hcd.ko
|-- proc
|-- sbin -> bin
|-- sys
`-- sysroot
--------------------------------
2. init脚本内容如下:
--------------------------------
#!/bin/nash
mount -t proc /proc /proc
setquiet
echo Mounting proc filesystem
echo Mounting sysfs filesystem
mount -t sysfs /sys /sys
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
mkdir /dev/shm
mkdir /dev/mapper
echo Creating initial device nodes
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
mknod /dev/console c 5 1
mknod /dev/ptmx c 5 2
mknod /dev/rtc c 10 135
mknod /dev/tty0 c 4 0
mknod /dev/tty1 c 4 1
mknod /dev/tty2 c 4 2
mknod /dev/tty3 c 4 3
mknod /dev/tty4 c 4 4
mknod /dev/tty5 c 4 5
mknod /dev/tty6 c 4 6
mknod /dev/tty7 c 4 7
mknod /dev/tty8 c 4 8
mknod /dev/tty9 c 4 9
mknod /dev/tty10 c 4 10
mknod /dev/tty11 c 4 11
mknod /dev/tty12 c 4 12
mknod /dev/ttyS0 c 4 64
mknod /dev/ttyS1 c 4 65
mknod /dev/ttyS2 c 4 66
mknod /dev/ttyS3 c 4 67
echo Setting up hotplug.
hotplug
echo Creating block device nodes.
mkblkdevs
echo "Loading uhci-hcd.ko module"
insmod /lib/uhci-hcd.ko
echo "Loading ohci-hcd.ko module"
insmod /lib/ohci-hcd.ko
echo "Loading ehci-hcd.ko module"
insmod /lib/ehci-hcd.ko
mount -t usbfs /proc/bus/usb /proc/bus/usb
echo "Loading jbd.ko module"
insmod /lib/jbd.ko
echo "Loading ext3.ko module"
insmod /lib/ext3.ko
echo "Loading scsi_mod.ko module"
insmod /lib/scsi_mod.ko
echo "Loading sd_mod.ko module"
insmod /lib/sd_mod.ko
echo "Loading scsi_transport_spi.ko module"
insmod /lib/scsi_transport_spi.ko
echo "Loading mptbase.ko module"
insmod /lib/mptbase.ko
echo "Loading mptscsih.ko module"
insmod /lib/mptscsih.ko
echo "Loading mptspi.ko module"
insmod /lib/mptspi.ko
echo "Loading dm-mod.ko module"
insmod /lib/dm-mod.ko
echo "Loading dm-mirror.ko module"
insmod /lib/dm-mirror.ko
echo "Loading dm-zero.ko module"
insmod /lib/dm-zero.ko
echo "Loading dm-snapshot.ko module"
insmod /lib/dm-snapshot.ko
echo Waiting for driver initialization.
stabilized --hash --interval 250 /proc/scsi/scsi
echo Making device-mapper control node
mkdmnod
mkblkdevs
echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure VolGroup00
resume /dev/VolGroup00/LogVol01
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/VolGroup00/LogVol00
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init.
switchroot