请问如何在BCD上添加grub2启动项
本帖最后由 lbw2007 于 2016-8-7 09:02 编辑最近安装了linux,本以为BIOS+MBR的启动方式能简单一些,万万没想到找不到grub2的启动内核文件(core.img之类的),而且将grub2从mbr复制到linux所在分区的pbr上也无法启动(不是很懂,难道是将分区表信息复制过来了?)
也尝试过用grub4dos引导,但是grub4dos提示无法挂载分区,也无法搜索到ext3分区内部的文件,不知道为什么。
从来没玩过linux引导,现在是一头雾水,正在用着linux安装过程中自动创建的grub2双启动菜单。
启动方式为Legacy Boot,linux为Fedora 19。最近有几个朋友在研究grub2,哪位大神能提供一点线索?
贴出linux的boot目录中所有文件
http://bbs.wuyou.net/forum.php?mod=attachment&aid=MjM2MjgyfDdhYjI1MmVkfDE0NTA3NTgyNzJ8NTAyMzE0fDM3MzYzOA%3D%3D&noupdate=yes
linux全部都安装在逻辑分区里面,用bootice查看EBR信息除了分区起始位置和55AA剩下的都为0。要不是mbr里面清清楚楚写着GRUB2我都怀疑它到底是什么引导了……
而且一旦用bootice重新配置GRUB2就会造成无法启动。说明至少主启动程序还在前62个扇区内,而且和bootice的grub2不一样。 本帖最后由 lbw2007 于 2015-12-23 11:37 编辑
功夫不负有心人,成功了,
在这里分享给像我一样的小白:
一开始的思路是错的,忽略了core.img,直接去引导core.img是最简单最直接的。只是文件夹和文件名称被改了就把我给难住了,很失败……
现在我的引导方式是grub4dos——grub2。
菜单如下:
root (hd0,4)
kernel /grub2/i386-pc/core.img
boot
接下来的工作是想办法直接用grub4dos去引导vmlinuz,之前一直失败。
在此也感谢楼上们的帮助! linux系统俺不懂。。。
给不了大师您什么帮助。。。
唯一的帮助就是人工置顶一次 。。。
本帖最后由 寒风飘过 于 2015-12-22 02:50 编辑
切换自如 你BPR没保存好。以前我做的时候 win的引导死活切换不到G2。G4D SYSLINUX都成功。
不好意思哈误导你了 我的是bootmgr加载不了syslinux syslinux才是需要pbr的,你的引导代码有误,自己检查下。 寒风飘过 发表于 2015-12-22 02:58
不好意思哈误导你了 我的是bootmgr加载不了syslinux syslinux才是需要pbr的,你的引导代码有误, ...
你好,你的意思是即使是grub2也是要通过PBR进行启动的是吗,但是我通过xorboot直接加载PBR无效啊?通过grldr加载甚至连分区都无法挂载。
grub2以前我也用过,但是从来没有引导过linux。
感谢说明!根据你的思路回去研究一下PBR 2011kenfance 发表于 2015-12-22 11:16
你好,这个是我grub2里面的全部文件,请问加载哪一个?
暂时先不考虑UEFI启动。这是boot/grub2文件夹下的所有文件
请大家帮帮忙,也不一定非要grub2启动,
grub4dos、xorboot、bootmgr都可以接受。但是现在确实无从下手 这是grub2.conf的双启菜单:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="${saved_entry}"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
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 load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
terminal_output console
set timeout=5
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Fedora, with Linux 3.9.5-301.fc19.x86_64' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.9.5-301.fc19.x86_64-advanced-e8b9a034-22ef-4e21-b0b1-0902d59f9a9a' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 --hint='hd0,msdos5'cde6e1dd-3deb-4b52-bdea-94c6cbbff683
else
search --no-floppy --fs-uuid --set=root cde6e1dd-3deb-4b52-bdea-94c6cbbff683
fi
linux /vmlinuz-3.9.5-301.fc19.x86_64 root=/dev/mapper/fedora_bogon-root ro rd.md=0 rd.dm=0 rd.lvm.lv=fedora_bogon/root vconsole.keymap=usrd.luks=0 vconsole.font=latarcyrheb-sun16 rd.lvm.lv=fedora_bogon/swap rhgb quiet
initrd /initramfs-3.9.5-301.fc19.x86_64.img
}
menuentry 'Fedora, with Linux 0-rescue-7725dfc225d14958a625ddaaaea5962b' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-0-rescue-7725dfc225d14958a625ddaaaea5962b-advanced-e8b9a034-22ef-4e21-b0b1-0902d59f9a9a' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos5'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5 --hint='hd0,msdos5'cde6e1dd-3deb-4b52-bdea-94c6cbbff683
else
search --no-floppy --fs-uuid --set=root cde6e1dd-3deb-4b52-bdea-94c6cbbff683
fi
linux /vmlinuz-0-rescue-7725dfc225d14958a625ddaaaea5962b root=/dev/mapper/fedora_bogon-root ro rd.md=0 rd.dm=0 rd.lvm.lv=fedora_bogon/root vconsole.keymap=usrd.luks=0 vconsole.font=latarcyrheb-sun16 rd.lvm.lv=fedora_bogon/swap rhgb quiet
initrd /initramfs-0-rescue-7725dfc225d14958a625ddaaaea5962b.img
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###
### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows 8 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-0003-5C78' {
insmod part_msdos
insmod fat
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'0003-5C78
else
search --no-floppy --fs-uuid --set=root 0003-5C78
fi
drivemap -s (hd0) ${root}
chainloader +1
}
menuentry 'Windows 8 (loader) (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-chain-000A37880008179F' {
insmod part_msdos
insmod ntfs
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 --hint='hd0,msdos2'000A37880008179F
else
search --no-floppy --fs-uuid --set=root 000A37880008179F
fi
drivemap -s (hd0) ${root}
chainloader +1
}
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.Simply type the
# menu entries you want to add after this comment.Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f$prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ### 2011kenfance 发表于 2015-12-22 14:01
你要从网上下载G2LDR,G2LDR.MBR两个文件放在根目录
其实我想问的重点是下一步:
G2LDR.MBR去引导哪一个文件?我的PBR是空的(至少我在分区表中看不到) 2011kenfance 发表于 2015-12-22 11:16
可以分享一下这个BCD文件吗? G2LDR.MBR引导的是g2ldr 寒风飘过 发表于 2015-12-22 02:40
切换自如 你BPR没保存好。以前我做的时候 win的引导死活切换不到G2。G4D SYSLINUX都成功。
...
一直不上线吗?求分享你这个PE(包括BCD文件在内)的模板,如果能整个PE分享就再好不过了。
页:
[1]