QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1649|回复: 1

中标普华Live CD中两个主要启动脚本

[复制链接]
发表于 2006-11-12 14:29:25 | 显示全部楼层 |阅读模式
两个主要启动脚本如下
不同于Fanx方式的Live CD制作方式

==================================================
boot目录中initrd.gz中的linuxrc


[code:1]#!/bin/bash

if [ "${INITRD_DBG}" = "x" ]; then set -x; fi

echo "Mounted proc filesystem"
mount -t proc /proc /proc

echo "Mounting sysfs filesystem"
mount -t sysfs none /sys
mount -t tmpfs none /tmp

echo "Creating /dev"
mount -o mode=0755 -t tmpfs none /dev

mkdir /dev/pts
mkdir /dev/shm

modprobe loop
modprobe squashfs
echo "udev starting"
udevstart

mount /dev/cdrom /cdrom


# Make kernel don't mount root fs
echo 0x100 > /proc/sys/kernel/real-root-dev

echo "Mounting root filesystem"
udevstart
mount -t squashfs -oloop,ro /cdrom/NeoShine.sqsh /sysroot
echo "Doing the pivot_root"
cd /sysroot
pivot_root /sysroot /sysroot/initrd
cd /

# Mount a (writeable) ramfs at dev and populate it with nodes:
mount -n -t ramfs initrd_dev /dev

cd /dev
for node in mem kmem null port zero core full ram ptmx tty pty shm cpu input agpgart dri cdrom console; do
    /initrd/sbin/MAKEDEV $node
done

mkdir /dev/shm
mkdir /dev/pts
mount -n -t devpts initrd_devpts /dev/pts

echo "Setting up readonly-root"
/etc/rc.neoshine
[/code:1]
===============================================

NeoShine.sqsh中的/etc/rc.neoshine

[code:1]#!/bin/bash

mount_file() {
        if [ -e ${1} ] && [ -e /livecd/tmpfs${1} ]; then
                mount -n --bind /livecd/tmpfs${1} ${1}
        fi
}

       
echo "Mounting tmpfs on /livecd/tmpfs"
mount -t tmpfs none /livecd/tmpfs

echo "Mounting ramfs on /livecd/ramfs"
mount -t ramfs none /livecd/ramfs
       
echo "Extracting files to /livecd/tmpfs"
           tar --directory /livecd/tmpfs -zxf /livecd/neoshine.tar.gz >/dev/null 2>&1
echo "Binding files from /livecd/tmpfs to their original locations"
mount_file /tmp
chmod a+rwxt /livecd/tmpfs/tmp
       
mount_file /var
       
chmod a+rwxt /livecd/tmpfs/var/tmp

mount_file /root
mount_file /home
mount_file /opt
mount_file /mnt
mount_file /media
mount_file /etc

mount_file /xkb

echo "Moving /etc/rc.d to /livecd/ramfs"
   mv /etc/rc.d /livecd/ramfs/ >/dev/null 2>&1
ln -s /livecd/ramfs/rc.d /etc/rc.d

[/code:1]
 楼主| 发表于 2006-11-12 14:30:30 | 显示全部楼层
两个脚本顺利执行完了以后。。控制权就交给rc.sysinit了。。。正常系统开始启动
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-20 18:29 , Processed in 0.121983 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表