使用Bootmgr 引导Ubuntu (非wubi安装)(2)

做Ubuntu 和Windows 的双系统,还是很简单,但是大多都是先安装Windows ,再安装Ubuntu ,最后MBR 里的引导程序是Grub 或者Grub2 ,这样会自动添加Windows 的引导项,以供选择。但是我们平常使用Windows 还是比Ubuntu 要频繁得多的,每次都要这样一次一次的选择,太麻烦了,希望能够用Bootmgr 来引导Ubuntu 。这种想法很早就有了,一直都没能成功,在网络上搜索,都没有找到解决方案。今天看到有人跟我有同样的想法,于是我想再试试看,争取把它解决。想到了使用wubi ,在使用wubi 安装的Ubuntu 中就是由Bootmgr 来引导Ubuntu 的,但是拷贝了wubi的两个关键文件-wubildr和wubildr.mbr,还是不行。觉得问题用该是出在另外一个文件-wubildr.cfg,这个是配置文件,这个文件里面写的是wubi 安装使用的虚拟磁盘root.disk 和swap.disk ,现在我的Ubuntu 是完全安装的,直接使用这个文件肯定不行,必须要进行修改。经过多次修改最终终于获得了成功,活动的主分区的根目录里面有4个启动Ubuntu 的关键文件,以上3个和grub.cfg ,grub.cfg 是Ubuntu 分区的grub 目录拷贝过来的,不需要修改。

wubildr.cfg文件修改后如下:

set show_panic_message=true

set root=(hd0,2)
if [ -e /boot/grub/grub.cfg ]; then
    if configfile /boot/grub/grub.cfg; then
        set show_panic_message=false
    fi
    else
    if [ -e /grub/grub.cfg ]; then
        if configfile /grub/grub.cfg; then
            set show_panic_message=false
        fi
    fi
fi

if [ ${show_panic_message} = true ]; then
    echo "It is not possible to boot from the Ubuntu image."
    echo "Please verify that the Ubuntu installation was not removed."
    echo "If that is not the case, please check that the Windows filesystem"
    echo "is not corrupted: reboot into Windows and run: chkdsk /r"
    echo "Then try again."
fi

修改BCD 文件的命令:

bcdedit /store X:\boot\bcd /set {bootmgr} locale "zh-CN"
bcdedit /store X:\boot\bcd /set {bootmgr} description "Windows 启动管理器"
bcdedit /store X:\boot\bcd /timeout 10
bcdedit /store X:\boot\bcd /set {default} description "Windows 7 PE"
bcdedit /store X:\boot\bcd /set {default} locale "zh-CN"
bcdedit /store X:\boot\bcd /set {memdiag} locale "zh-CN"
bcdedit /store X:\boot\bcd /set {memdiag} description "内存检测工具"
bcdedit /store X:\boot\bcd /create {45c374b2-8460-11df-8950-0024814b7667} /d "Ubuntu 10.10" /application bootsector
bcdedit /store X:\boot\bcd /set {45c374b2-8460-11df-8950-0024814b7667} device boot
bcdedit /store X:\boot\bcd /set {45c374b2-8460-11df-8950-0024814b7667} path \wubildr.mbr
bcdedit /store X:\boot\bcd /displayorder {45c374b2-8460-11df-8950-0024814b7667} /addfirst
bcdedit /store X:\boot\bcd /enum all /v


向磁盘写入主引导:

bootsect /nt60 X: /force /mbr

写入这些之后,一切OK!终于成功了,不容易啊,花了好久才解决!

还有其他方法,可以使用bootice 提取Ubuntu 分区,保存为ubuntu.pbr ,在将它写入引导文件BCD 的,一种万能的方法,但是,并不一定能成功。也可以使用EasyBCD,这种方法简单,但是不透明,对软件的依耐性太高,也不太好。还是自己动手解决是最好的。

linux

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/25681.html