无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站广告联系 微信:wuyouceo QQ:184822951
查看: 3610|回复: 4

[讨论] 请问,有没有人会用grub2呢

[复制链接]
发表于 2012-3-14 11:45:08 | 显示全部楼层 |阅读模式
最近,下了grub2但是不知道怎样用,
我下载的是完整版本的,包含全部模块。


我在虚拟磁盘VHD中安装了grub2的引导代码,
但是在配置grub.cfg方面出现问题了。
请大家指教一下。
如何使grub2能引导iso,img



http://115.com/file/anmyhtrx(18.7M)


我把/boot/grub.cfg的内容贴出来:——————————————


if [ -s /boot/grub/grubenv ]; then
  have_grubenv=true
  load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
  saved_entry=${prev_saved_entry}
  save_env saved_entry
  prev_saved_entry=
  save_env prev_saved_entry
fi
if terminal_input console ; then true ; else
  # For backward compatibility with versions of terminal.mod that don't
  # understand terminal_input
  terminal console
fi
if terminal_output console ; then true ; else
  # For backward compatibility with versions of terminal.mod that don't
  # understand terminal_output
  terminal console
fi
if [ ${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
menuentry "Search and boot ubuntu (/boot/grub/core.img)" {
  insmod ext2
  insmod reiserfs
  insmod xfs
  insmod jfs
  search --set -f /boot/grub/core.img
  multiboot /boot/grub/core.img
}
menuentry "ubuntu install" {
  insmod ext2
  insmod reiserfs
  insmod xfs
  insmod jfs
  linux /vmlinuz boot=casper iso-scan/filename=/ubuntu-11.10-desktop-amd64.iso ro quiet splash locale=zh_CN.UTF-8
}
menuentry "Search and boot ubuntu (/grub/core.img)" {
  insmod ext2
  insmod reiserfs
  insmod xfs
  insmod jfs
  search --set -f /grub/core.img
  multiboot /grub/core.img
}
menuentry "Search and boot Windows 7" {
  insmod ntfs
  search --set -f /bootmgr
  chainloader +1
}
menuentry "Search and boot Windows XP" {
  insmod ntfs
  insmod fat
  search --set -f /ntldr
  drivemap -s (hd0) ${root}
  chainloader +1
}
menuentry "REBOOT" {
reboot
}
menuentry "HALT" {
halt
}


————————————————————————
以上的内容,就是grub.cfg的内容了,
请大家指教一下。如果修改它,


使它能够在ntfs分区上,引导PE.iso,maxdos.img

[ 本帖最后由 2012-sn 于 2012-3-14 12:01 编辑 ]
发表于 2012-3-14 16:43:33 | 显示全部楼层
grub2引导的光盘怎么没有?
回复

使用道具 举报

发表于 2012-3-15 00:24:58 | 显示全部楼层
grub24dos.
回复

使用道具 举报

发表于 2012-3-15 18:39:00 | 显示全部楼层
相关路径修改下

if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function recordfail {
  set recordfail=1
  if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}

function load_video {
  insmod vbe
  insmod vga
}

insmod part_msdos
insmod ntfs
set root=(hd0,msdos1)
if loadfont /boot/grub2/unicode.pf2 ; then
  set gfxmode=800x600
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
#insmod part_msdos
#insmod ntfs
#set root=(hd0,msdos1)
set theme=/boot/grub2/themes/grub2/theme.txt
insmod gfxmenu
insmod png
#insmod part_msdos
#insmod ntfs
#set root=(hd0,msdos1)
set locale_dir=($root)/boot/grub2/locale
set lang=zh
insmod gettext
if [ "${recordfail}" = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi

#insmod part_msdos
#insmod ntfs
#set root=(hd0,msdos1)
insmod tga
if background_image /usr/share/images/grub/Fly-Angel.tga ; then
  set color_normal=black/black
  set color_highlight=magenta/black
else
  set menu_color_normal=white/black
  set menu_color_highlight=black/light-gray
fi
# 以下是每个菜单的写法,可以自行参考资料增减或编辑******************************
menuentry "启动Ubuntu LiveCD模式"  --class ubuntu {
        insmod ntfs
        search --no-floppy --fs-uuid --set=root 0858A5AC58A59948
        loopback loop /system/linux/ubuntu-11.10-desktop-i386.iso
        linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/system/linux/ubuntu-11.10-desktop-i386.iso locale=zh_CN.UTF-8 splash
        initrd (loop)/casper/initrd.lz
}
menuentry "进入grub4dos菜单(示例)" --class windows  {
        linux16 /Boot/grub/grub.exe --config-file=/menu.lst   
}


# 菜单结尾     ********************************************************
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###


### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
回复

使用道具 举报

 楼主| 发表于 2012-3-16 22:26:49 | 显示全部楼层

回复 #4 yjq635 的帖子

谢谢了,
我还是自己编译吧。
加上,论坛里面一位兄弟的bean大神的cd补丁。

[ 本帖最后由 2012-sn 于 2012-3-17 16:17 编辑 ]
回复

使用道具 举报

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

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-4-19 05:09

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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