partprobe /dev/sdb
mtfs -t ext3 /dev/sdb1
mtfs -t ext3 /dev/sdb2(对分区进行格式化)
mkdir /mnt/boot sysroot
mount /dev/sdb1 /mnt/boot
mount /dev/sdb2 /mnt/sysroot (挂载设备)
grub-install --root-directory=/mnt /dev/sdb (安装grub 它自动找/mnt下的boot)
mkdir /tmp/initrd
cd /tmp/initrd
zcat /boot/initrd-2.6.18-164.el5.img |cpio -id
vim init
mkrootdev -t ext3 -o defaults ,ro sda2
find. |cpio --quiet -H newc -o | gzip -9 -n >/mnt/boot/initrd.gz
cd /tmp/boot/grub
mkdir grub.conf
default=0
timeout=2
title myLinux
root (hd0,0)
kernel /vmlinuz ro root=/dev/sda2
initrd /initrd.gz
cd /mnt/sysroot
mkdir etc proc dev lib sbin bin sys tmp
chmod 1777 tmp
cp /sbin/ls /mnt/sysroot/sbin
cp /bin/bash /mnt/sysroot/bin
ldd /bin/bash
ldd /sbin/ls
cp 库文件到相应的目录下(bin/)共六个
cd /mnt/sysroot/etc
vim inittab
id:3:initdefault:
si::sysinit:/etc/rc.d/rc.sysinit
mkdir /mnt/sysroot/etc/rc.d
cd /mnt/sysroot/etc/rc.d
vim rc.sysinit
#!/bin/bash
echo -e "tWelcome to 33[31mMy33[0m linux"
/bin/bash
chmod u x rc.sysinit
|