Chinaunix首页 | 论坛 | 博客
  • 博客访问: 627146
  • 博文数量: 110
  • 博客积分: 3808
  • 博客等级: 中校
  • 技术积分: 1930
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-15 14:32
个人简介

声的伟大!

文章分类

全部博文(110)

文章存档

2014年(1)

2013年(2)

2012年(12)

2011年(81)

2010年(14)

分类: LINUX

2011-05-13 18:53:12

#周折几次......

1.首先安装所需服务,dhcp tftp syslinux
emerge -qv dhcp
emerge -qv tftp-hpa
emerge syslinux

2.配置dhcp服务器,编辑/etc/dhcp/dhcpd.conf文件
ddns-uptage-style interim;
ignore-client-updates;

subnet 192.168.197.0 netmask 255.255.255.0 {
    range 192.168.197.10 192.168.197.200;
    
    filename "pxelinux.0";
    next-server 192.168.197.130;
  }

3.编辑/etc/conf.d/in.tftpd文件,将INTFTPD_PATH="/tftproot/"启用

4.挂载CD,到/mnt/cdrom
isolinux/gentoo
isolinux/gentoo.igz
image.squashfs

5.mkdir /tftproot
cp /mnt/cdrom/isolinux/gentoo /tftproot

mkdir tmpdir
cd tmpdir
cp /mnt/cdrom/isolinux/gentoo.igz ./
cp /mnt/cdrom/image.squashfs ./

mkdir gentoo.dir
cd gentoo.dir
zcat ../gentoo.igz |cpio -idv
mkdir mnt
mkdir mnt/cdrom
cp ../image.squashfs mnt/cdrom

接下来,编辑init脚本,参考文档http://blog.dastrup.com/?p=12
修改的补丁文件如下所示:我们手动修改。

--- init        2008-03-22 01:10:58.000000000 -0600
+++ init        2008-03-22 01:14:27.000000000 -0600
@@ -283,11 +283,6 @@
                [ ! -e ${NEW_ROOT}/dev/tty1 ] && mknod ${NEW_ROOT}/dev/tty1 c 4 1
        fi    

-       if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ]
-       then
-               bootstrapCD
-       fi
-
        if [ "${REAL_ROOT}" = '' ]
        then
                echo -n -e "${WARN}>>${NORMAL}${BOLD} No bootable medium found. Waiting for new devices"
@@ -387,7 +382,7 @@
                else
                        bad_msg "Block device ${REAL_ROOT} is not a valid root device..."
                        REAL_ROOT=""
-                       got_good_root=0
+                       got_good_root=1
                fi
        done    

@@ -489,7 +484,6 @@
                fi
        fi    

-       cache_cd_contents
        # Setup the loopback mounts    

        if [ "${LOOPTYPE}" = 'normal' ]
@@ -503,7 +497,7 @@
        elif [ "${LOOPTYPE}" = 'squashfs' ]
        then
                good_msg 'Mounting squashfs filesystem'
-               mount -t squashfs -o loop,ro ${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP} ${NEW_ROOT}/mnt/livecd
+               mount -t squashfs -o loop,ro /mnt/cdrom/${LOOPEXT}${LOOP} ${NEW_ROOT}/mnt/livecd    

                test_success 'Mount filesystem'
                FS_LOCATION='mnt/livecd'


6.我们重新封装
find . -print |cpio -H newc -o --quiet > ../gentoo.igz
cd ..

cp gentoo.igz /tftproot
cp /usr/share/syslinux/pxelinux.0 /tftproot
cd /tftproot
mkdir pxelinux.cfg
cd pxelinux.cfg
编辑default文件,我们手动创建,加入以下内容:
default gentoo
timeout 150
prompt 0
kernel gentoo
append initrd=gentoo.igz root=/dev/ram0 init=/linuxrc loop=/image.squashfs looptype=squashfs cdroot=1 real_root=/

完成了...



阅读(1913) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

网络安全服务2011-05-19 08:59:06

牛```