elenna's profile๑۩ﺴ 猪猪艾美丽的学习乐园BlogListsGuestbook Tools Help

Blog


    March 11

    grub4dos---加载双系统中的linux!

    1.进windows,下载、解压grub for dos。

    2.安装grub4dos。复制grldr到c:\,修改boot.ini文件,在最后一行添加c:\grub="GRUB"。引号里面的内容可以随便写,它的作用主要是开机后windows引导菜单里显示的内容。如果看不到boot.ini文件,去掉查看->文件夹选项->隐藏系统保护文件和选中“显示所有文件”。

    3.重启系统,在windows的启动引导菜单里,选择“GRUB”,系统完全交由grub控制。grub的功能还是很强的,可以直接从FAT、minix、FFS、ext2或ReiserFS分区读取Linux内核。这就意味着无论怎样它总能找到内核。这时会出现一个grub>提示符(进入grub后选择command line),其实它引导内核的步骤跟GNU grub是一样的。

    4.手动加载Linux(所有命令均在grub>提示符下输入,使用tab键自动填补命令)

    help命令可用于查看grub的所有命令格式。

    cat (hd[0-n],y)/etc/fstab用于查看分区情况,以找到linux所在分区即分区类型为ext2。输入(hd0,2)意味着linux在第一个硬盘的第三个分区上。

    首先键入root(hd0,2)用于设置包含操作系统内核的根设备。

    然后键入kernel /boot/vmlinuz-xxx ro root=/dev/hda3(或root=LABEL=/)。kernel命令用于装载内核映像文件,vmlinuz-xxx是你内核文件的名字。后面的root=/dev/hda3表示内核文件所在的磁盘分区,ro表示以只读方式打开内核文件。

    然后键入initrd /boot/initrd.img-xxx。initrd.img-xxx是一个镜像文件,类似ramdisk,把一段程序打包到img里。它的作用是在没有mount /分区以前,虚拟出一个/,然后执行其根目录下的一个脚本"linuxrc",做一些挂载scsi驱动类似的事情,如果你的磁盘并不是scsi磁盘的话,这步并不是必须的。

    最后键入boot,引导进入linux。

    5.将新的grub装入mbr。以root的身份登录,运行grub-install /dev/hda3,或者键入grub,然后在提示符下键入root (hd0,2),setup (hd0),把mbr的控制权抢回来了!

    6.将windows加入grub启动菜单。root权限,修改/boot/grub/menu.lst。加入以下内容:

    title Microsoft Windows XP Professional
    root (hd0,0)
    savedefault
    makeactive
    chainloader +1

    参考:http://hi.baidu.com/opthome/blog/item/09ef04124bd18e55f919b80c.html

    grub命令行用法 http://hi.baidu.com/realxfliu/blog/item/f6fe14e96463b83fb90e2d35.html

     

    PS:另一种方案---windows下安装grubfordos后, 拷贝原linux系统/boot/grub/menu.lst到c:\下(需要在重新安装windows前保存)。但我采用这种方案时,在kernel、initrd后的savedefault命令出错,估计要修改menu.1st,去掉savedefault命令。

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    No namewrote:

    Amberdigital Branch,Southern Stars Enterprises Co is specializing in the development and manufacturing of advertisement screens, LCD digital signage and LCD signages. Established in 1996, we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.

    amberdigital Contact Us
    Southern Stars Enterprises Co (Hong Kong Office)
    Add:3 Fl, No.2, Lane 2, Kam Tsin Tsuen, Sheung Shui, Hong Kong
    Tel:+852 2681 4099
    Fax:+852 2681 4586

    Southern Stars Enterprises Co (Shenzhen Office)
    Add:DE, 16/F, Building 2, Nanguo Tower, Sungang Road, Shenzhen, China
    Tel:+86 755 2592 9100
    Fax:+86 755 2592 7171

    E-mail:sstar@netvigator.com
    website:www.amberdigital.com.hk
    alibaba:amberdigital.en.alibaba.com[aiggcecacgcge

    Aug. 18

    Trackbacks

    The trackback URL for this entry is:
    http://elennatuzi.spaces.live.com/blog/cns!1A9FD94426AD53B!385.trak
    Weblogs that reference this entry
    • None