三、拷贝启动和PE所需要文件到第一分区(BOOT)
文件结构如下:
注:
1.GRLDR文件采用了内置配置菜单(可减少menu.lst文件),推荐使用GRLDR.EXE修改内置菜单,如把GRLDR.EXE与要修改的GRLDR放在同一文件夹内,打开GRLDR.EXE时会自动导入此文件夹里的GRLDR,界面如下:
本人的GRLDR菜单如下:
timeout 10
default 9
color cyan/blue white/magenta
find --set-root /boot/grub/grubhere.id
splashimage /boot/grub/2008.xpm.gz
foreground 0000ff
find --set-root /boot/grub/grubhere.id
fontfile /boot/grub/muifont.gz
title 【0】DOS
find --set-root /boot/grub/grubhere.id
kernel /boot/grub/Memdisk.gz c=80 h=2 s=18 floppy
initrd /boot/dostools/DOS.img
title 【1】GHOST
find --set-root /boot/grub/grubhere.id
kernel /boot/grub/Memdisk.gz c=80 h=2 s=36 floppy
initrd /boot/dostools/GHOST11.img
title 【2】DISKGEN
find --set-root /boot/grub/grubhere.id
kernel /boot/grub/Memdisk.gz c=80 h=2 s=18 floppy
initrd /boot/dostools/DISKGEN.img
title 【3】PASSWORD
find --set-root /boot/grub/grubhere.id
kernel /boot/grub/Memdisk.gz c=80 h=2 s=18 floppy
initrd /boot/dostools/password.img
title 【4】切换到syslinux菜单
find --set-root /boot/grub/grubhere.id
chainloader /boot/grub/syslinux.te
title 【5】启动WindowsPE菜单
find --set-root /boot/grub/grubhere.id
chainloader /boot/PE/bootmgr
title 【6】启动WinPEiso
find --set-root /boot/grub/grubhere.id
map --mem /boot/grub/winpe.iso (hd32)
map --hook
chainloader (hd32)
boot
title 【7】本机硬盘启动
map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,0)
makeactive
chainloader +1
title 【8】重启计算机
reboot
title 【9】关闭计算机
halt
title 【10】Grub命令行
commandline
2.BCD文件,本人是采用一个VBS脚本来生成的,便于修改,脚本如下:
Dim WshShell, FSO
Set WshShell = WScript.CreateObject("WScript.Shell")
Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
WSHShell.run "bcdedit /createstore G:\bcd", 0, TRUE
WSHShell.run "Bcdedit /store G:\bcd /create {bootmgr} /d ""Windows Boot Manager""", 0, TRUE
WSHShell.run "Bcdedit /store G:\bcd /set {bootmgr} device boot", 0, TRUE
WSHShell.run "Bcdedit /store G:\bcd /set {bootmgr} locale ZH-CN", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /timeout 5", 0, TRUE
Set getGUID = WshShell.Exec("bcdedit /store G:\bcd /create /d ""返回SYSLINUX菜单"" /application bootsector")
Do While getGUID.Status = 0
WScript.Sleep 100
Loop
'Fun little set of code to grep out the GUID
strGUID = getGUID.StdOut.ReadAll
arr1GUID = Split(strGUID, "{")
arr2GUID = Split("{"&arr1GUID(1), "}")
strGUID = arr2GUID(0)&"}"
WSHShell.run "bcdedit /store G:\bcd /set "&strGUID&" device boot", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set "&strGUID&" path \boot\Grub\syslinux.te", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set "&strGUID&" locale ZH-CN", 0, TRUE
WSHShell.run "Bcdedit /store G:\bcd /set {bootmgr} displayorder "&strGUID&" /addfirst", 0, TRUE
WSHShell.run "Bcdedit /store G:\bcd /set {bootmgr} default "&strGUID&"", 0, TRUE
Set getGUID = WshShell.Exec("bcdedit /store G:\bcd /create /d ""返回GRUB4DOS菜单"" /application bootsector")
Do While getGUID.Status = 0
WScript.Sleep 100
Loop
'Fun little set of code to grep out the GUID
strGUID = getGUID.StdOut.ReadAll
arr1GUID = Split(strGUID, "{")
arr2GUID = Split("{"&arr1GUID(1), "}")
strGUID = arr2GUID(0)&"}"
WSHShell.run "bcdedit /store G:\bcd /set "&strGUID&" device boot", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set "&strGUID&" path \boot\Grub\grldr.mbr", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set "&strGUID&" locale ZH-CN", 0, TRUE
WSHShell.run "Bcdedit /store G:\bcd /set {bootmgr} displayorder "&strGUID&" /addfirst", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /create {ramdiskoptions}", 0, TRUE
WSHShell.run "Bcdedit /store G:\bcd /set {ramdiskoptions} locale ZH-CN", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set {ramdiskoptions} ramdisksdidevice boot", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set {ramdiskoptions} ramdisksdipath \boot\PE\boot.sdi", 0, TRUE
Set getGUID = WshShell.Exec("bcdedit /store G:\bcd /create /d ""Microsoft Windows PE"" /application OSLOADER")
Do While getGUID.Status = 0
WScript.Sleep 100
Loop
'Fun little set of code to grep out the GUID
strGUID = getGUID.StdOut.ReadAll
arr1GUID = Split(strGUID, "{")
arr2GUID = Split("{"&arr1GUID(1), "}")
ttrGUID = arr2GUID(0)&"}"
WSHShell.run "bcdedit /store G:\bcd /set "&ttrGUID&" device ramdisk=[boot]\boot\PE\boot.wim,{ramdiskoptions}", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set "&ttrGUID&" path \windows\system32\boot\winload.exe", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set "&ttrGUID&" osdevice ramdisk=[boot]\boot\PE\boot.wim,{ramdiskoptions}", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set "&ttrGUID&" locale ZH-CN", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set "&ttrGUID&" systemroot \windows", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set "&ttrGUID&" winpe yes", 0, TRUE
WSHShell.run "bcdedit /store G:\bcd /set "&ttrGUID&" detecthal yes", 0, TRUE
WSHShell.run "Bcdedit /store G:\bcd /set {bootmgr} displayorder "&ttrGUID&" /addfirst", 0, TRUE
新建一个记事本,把上面脚本拷到记事本,文件另存为VBS后缀名,如bcd.vbs,运行bcd.vbs后在G盘根目录下将生成BCD文件,拷到相应目录。注意:前提是有BCDEDIT.EXE文件,XP系统里没有的。VISA和Win7里可以直接运行。
3.SYSLINUX.TE文件的获取:
SYSLINUX.TE文件是用来进行启动菜单切换的,可以从GRUB4DOS和BOOTMGR菜单切换到SYSLINUX菜单。