grub4dos 引导PE UBUNTU 修复引导丢失问题

来源:互联网 发布:linux ant安装配置 编辑:程序博客网 时间:2024/04/29 23:31
这几个月一直在装系统,然后就遇到了引导错误的问题了~然后我就郁闷了~
     首先,讲讲grub4dos,这是一个很的工具,可以引导ubuntu的镜像进行安装ubuntu当然其他的镜像也是可以的例如pe。准备工具bootice.exe(引导山区维护的工具),grldr文件,menu.lst.还有u盘一个,    启动bootice.exe->目标磁盘选中你的u盘->主引导记录-》grub4dos->安装/配置->(将禁止引导分区表无效的原住记录(通常。。。。引导扇区)打勾)->写入磁盘    提示你要将grldr和menu.lst拷贝到根目录。。。ok照办~将这两个文件拷贝到u盘根目录下面。    紧接着将ubuntu12.04.iso的镜像拷贝到u盘,还需要将ubuntu的镜像解压到u盘。这实你u盘的根目录下有,ubuntu.iso,ubuntu的解压文件,grldr和menu.lst (注意这边需要将你的iso的名字更为与我的ubuntu.iso相同,这样你就不需要去更 改menu.lst了)    用u盘启动然后选择ubuntu.iso就成功进入引导了。
这是一个ubuntu的安装教程很完整~
点击打开链接
引导pe只需要将u盘内的PE的iso重命名为pe.iso便可以然后就可以启动u盘了(将pe.iso拷贝到u盘)

以下下介绍一下我对memu.lst的修改
引导ubuntu镜像的menu.lst的修改
#title便是标题title Parted Ubuntu2 ISO#导入的镜像在哪里 用map来指引 而(hd0,0)这边指的是你的u盘而此时你的硬盘是hd1了map (hd0,0)/ubuntu.iso (0xff) || map --mem (hd0,5)/ubuntu.iso (0xff)map --hookchainloader (0xff)
如果不小心将引导弄坏了ubuntu引导了只需要按照下面的代码进行增加就可以引导boot了  
title UbuntuOsroot (hd0,5) #这边指示你的根目录为你boot所在的分区#加载内核是/boot/vmli..server-generic的版本   重新在指定你的根分区此时是 用逻辑分区的表示kernel /boot/vmlinuz-3.2.0-32-generic root=/dev/sda6 ro quiet splash#加载img 一样只需要更改你的版本initrd /btitle UbuntuOsbootoot/initrd.img-版本-genericinitrd /boot/initrd.img-3.2.0-32-genericquietsavedefaultboot


我的menu.lst

# This is a sample menu.lst file. You should make some changes to it.# The old install method of booting via the stage-files has been removed.# Please install GRLDR boot strap code to MBR with the bootlace.com# utility under DOS/Win9x or Linux.color blue/green yellow/red white/magenta white/magentatimeout 30## menu border colorcolor border=0xEEFFEE## set vbe modegraphicsmode -1 640 480:800## loading splashimagesplashimage /boot/grub/splashimage.xpm || splashimage /boot/grub/splashimage.bmpdefault /default## Menu AutoNumberwrite 0x8274 0x2001title find and load NTLDR of Windows NT/2K/XP\n find and load NTLDR of Windows NT/2K/XPfallback 1find --set-root --ignore-floppies --ignore-cd /ntldrmap () (hd0)map (hd0) ()map --rehookfind --set-root --ignore-floppies --ignore-cd /ntldrchainloader /ntldrsavedefault --wait=2#iftitle only show when command in [] returns true# set a variable named bootmgr where /bootmgr is found.iftitle [find --set-root --devices=h /bootmgr && call set bootmgr=%@root^%] load BOOTMGR of Windows VISTA/WIN7/WIN2008 on %bootmgr%chainloader %bootmgr%/bootmgrsavedefault --wait=2title find and load CMLDR, the Recovery Console of Windows NT/2K/XPfallback 3find --set-root --ignore-floppies --ignore-cd /cmldrmap () (hd0)map (hd0) ()map --rehookfind --set-root --ignore-floppies --ignore-cd /cmldrchainloader /cmldr###################################################################### write string "cmdcons" to memory 0000:7C03 in 2 steps:###################################################################### step 1. Write 4 chars "cmdc" at 0000:7C03#write 0x7C03 0x63646D63# step 2. Write 3 chars "ons" and an ending null at 0000:7C07#write 0x7C07 0x00736E6F#or.#write --offset=3 (md)0x3e+1 cmdcons#orcalc *0x7c03=0x00736E6F63646D63savedefault --wait=2title find and load IO.SYS of Windows 9x/Mefallback 4find --set-root /io.syschainloader /io.syssavedefault --wait=2# you can also use below commands.# find --set-root chainloader /io.sys# boot# the boot is necessary,# please see "Delimitors or comments between titles" in grub4dos_readme.txt.title UbuntuOs root (hd1,5)   kernel /boot/vmlinuz-3.2.0-32-generic root=/dev/sda6 ro quiet splash initrd /boot/initrd.img-3.2.0-32-generic quiet savedefault boottitle find and boot MicroPE.ISOfallback 6find --set-root /PE.ISOmap /PE.ISO (0xff) || map --mem /PE.ISO (0xff)map --hookchainloader (0xff)savedefault --wait=2title Parted UbuntuD ISOmap (hd0,0)/ubuntu.iso (0xff) || map --mem (hd0,0)/ubuntu.iso (0xff)map --hookchainloader (0xff)savedefault --wait=2title Parted Ubuntu ISOfallback 7find --set-root /ubuntu.isomap /ubuntu.iso (0xff) || map --mem /ubuntu.iso (0xff)map --hookchainloader (0xff)savedefault --wait=2title commandlinecommandlinetitle Systemfind --set-root (hd1,1)/bootmgrchainloader /bootmgrtitle floppy (fd0)chainloader (fd0)+1rootnoverify (fd0)# or use below commands.# rootnoverify (fd0)# chainloader +1title back to dosquittitle rebootreboottitle halthalttitle MAXDOS.IMGfind --set-root --ignore-floppies /boot/MAXDOS.IMGmap --mem /boot/MAXDOS.IMG (fd0)map --hookchainloader (fd0)+1rootnoverify (fd0)
哪里不清楚可以留言嘻嘻