没想到制作方法发布得到如此广泛的关注,看来大家都跟我一样希望制作一个通用性比较好的系统维护工具。经过这几天各位网友的测试反馈,发现NT Loader + Avlgo的方式兼容性不太理想。于是我又换别的启动方式试验。现将试验成功的另外两种方法也一并发布,大家共同试验、探讨。谨以此文抛砖引玉,希望在众人的研究之下,最终能找到一个兼容性比较好的解决方案。
前缘:
很多年以前,那时候软驱还是电脑的必配,维护电脑引导系统也用软盘,我那时候就做了N片启动软盘。后来随着软盘淡出市场,系统维护盘也改用光盘了,例如著名的深山红叶系统维护工具盘,就为我的工作提供了有力的帮助。不过光盘还是存在容易磨花,体积较大等缺点。现在的电脑基本上都支持USB设备启动,U盘可以做成小巧而容易携带的系统维护盘;可重写的存储媒体也为更新提供了方便,再也不用为了升级刻录一堆光盘了。
目标:
对于系统维护来说,WindowsPE不可却少的利器;除此外,有一些问题还是需要启动到DOS环境来解决。所以我的目标就是制作一个DOS/WinPE双启动的系统维护U盘。下次再遇到某电脑系统崩溃的话,从衣袋里面摸出一精致的U盘,启动电脑之后,把问题解决于弹指间。何其潇洒也!
技术背景:
其实,U盘启动电脑,主要是各种引导工具的合理灵活运用,所有的操作和调试,也都是围绕引导工具的安装和配置进行的。我们知道,作为操作系统的主要载体,磁盘一直是最重要的存储媒质。因此基本上所有的OS引导的模式都大致相同,都是由磁盘来装入的。
首先,需要在OS所在磁盘的MBR(主引导记录)扇区写入特定的引导代码,电脑启动后会按照BIOS里面设置的启动顺序轮询对应磁盘的MBR区,如果找到有效的MBR记录,就按照MBR记录的指针去装入OS引导文件,如果OS引导文件正常,就加载对应的操作系统。
因此完成一个操作系统的启动,需要两个必须的步骤:1、MBR引导;2、OS引导。
基于上述基本原理,各种操作系统都有自带的引导器,例如WindowsNT以上系统的NT Loader(NTLDR)、Linux的Lilo、各版本的Grub引导器等等,当然还有一些第三方的多系统引导工具如System Commander等等。
对于我们目前的这个应用,目的是能够在U盘上实现DOS/WinPE双启动,并且具有相对比较好的兼容性。要达到这个目的,就有一些技术要求。首先,方案要能够适应U盘移动存储这种盘符变动的情况;其次,要实现双启动,一般都会用到虚拟盘镜像,也就是引导器需要支持RAMDisk加载各种常见磁盘镜像启动的方式。
虽然U盘具有小巧轻量并且可以反复擦写等诸多优点,但如果要做成启动盘,还存在一些需要解决的问题。最大的问题是:USB启动并没有统一的行业规范。主板制造商不同、BIOS不同,USB引导方式也有差异。作为移动存储设备,主板对U盘的识别不同,会使盘符变化。这些直接导致U盘启动的通用性和兼容性不理想,表现就是在有些电脑上无法引导。这是需要重点解决的问题。
OS选择:
DOS系统选用MS-DOS 7.1;WinPE选用无忧论坛老毛桃的“外置网络、多媒体组件的老九 WinPE 老毛桃最终修改版”。
方案一:NT Loader + AVLDR + Avlgo
MBR用NT Loader引导,在NTLDR引导菜单中设置选项:用AVLDR引导WinPE;而用Avlgo引导DOS;由于Avlgo不支持选单方式多重启动,为了解决不同主板识别U盘的盘符不同的问题,对Avlgo引导配置文件稍作修改,以适应盘符变化的启动需求。
工具准备:
PeToUsb——用来把U盘格式化成NT引导模式;WinImage——用于制作DOS启动软盘镜像;Avlgomgr——用于生成Avlgo引导文件;UltraEdit——用于编辑修改Avlgo的引导文件。
数据准备:
1、PeToUSB是一款免费软件,专门用来把U盘引导区格式化成NTLDR引导代码。启动PeToUSB,从“Destination Driver”栏选择目标U盘,点击下面的“Start”按钮,它询问“Continue”是否继续,点击“是”,弹出一个警告窗口,提示目标盘的所有数据都将会丢失,是否继续?还是选择“是”,然后片刻就完成格式化。
2、用WinImage制作一个2.88M的启动软盘镜像,将MS-DOS 7.1装入镜像,并把常用的DOS工具也放到镜像里面。启动WinImage后,点击最左边的按钮新建一个镜像,这里选择标准格式2.88MB,为的是尽量能多存放一些工具。然后向这个镜像中添加文件,把事先准备好的MS-DOS系统文件从资源管理器里面拖拽到WinImage窗口中。其它DOS工具也这样添加进来。文件添加完毕之后,点击“映像”菜单——“引导扇区属性”,选择“Windows 95/98”并确定,这一步很重要,漏做这一步的话,这个软盘镜像就不能引导电脑了。最后保存成ima格式的镜像文件DOS.ima。
3、先备份好C盘的Boot.ini文件,注意默认状态看不到这个系统、隐藏属性的文件,需要到资源管理器里面“工具”菜单“文件夹选项”当中修改查看方式,取消“隐藏受保护的操作系统文件”复选框,并切换为显示所有文件。启动Avlgomgr,在“虚拟磁盘完整路径”浏览找到刚才用WinImage制作的镜像文件,然后点击“装配”按钮,Avlgomgr自动修改Boot.ini文件,并在目标盘(本例为C盘)生成我们需要的Avldr.bin和Avlgo.sys两个关键文件,把这两个文件拷贝到某处备用。完成以后恢复原C盘的Boot.ini文件。
4、启动UltraEdit,先打开Avldr.bin,在编辑屏右边的ASCⅡ码区域可以找到“AVLGO.SYS”的字符串,把它改成“AVDOS.SYS”,文件另存为Avldr.dos。
5、然后打开Avlgo.sys,在右边ASCⅡ码区域找“(hd0,0)/DOS.IMA”字符串,把它修改成“(fd0)/DOS.IMA”。修改的时候要注意,由于修改后的字符串比修改前的短,为保证文件长度不变,剩下的部分要切换到左边16进制码区域,用“00”填充,这样才能保证文件长度不变。修改完后另存为Avdos.sys。
开始组装:
1、首先,在U盘的根目录用记事本创建一个Boot.ini文件,内容如下:
timeout=30
default=C:\avldr.xpe
C:\avldr.xpe="Windows PE By:LaoMaotao"
C:\avldr.bin="MS-DOS 7.1 form USB-HDD"
C:\avldr.dos="MS-DOS 7.1 from USB-FDD"
完成以后把这个文件的属性修改成 只读/系统/隐藏(可以用DOS命令 attrib +r +s +h boot.ini 修改文件属性)。
这是NT Loader的菜单配置文件,timeout参数设置的是菜单等待时间,如果在设定的时间(本例为30秒)用户没有进行选择,就自动加载default项默认的C:\avldr.xpe,启动WinPE。
小节是菜单中出现的引导选项,第一个就是前面default设置的老毛桃WinPE,双引号里面的是注释行,会显示在引导菜单里面。下面两行分别是为主板识别U盘为USB-HDD和主板识别U盘为USB-FDD两种模式对应的引导项。
2、把硬盘系统的NTLDR和NTDETECT.COM两个文件拷贝到U盘根目录,这是NT Loader引导器的必须文件。
3、把下载到的老毛桃WinPE的ISO文件解压缩到一个临时文件夹,把其中“WINPE安装”文件夹里面的AVLDR.XPE拷贝到U盘的根目录,把“WXPE”文件夹下的 SETUPLDR.BIN 也拷贝到U盘根目录并改文件名为 LDRXPE。把临时文件夹里面的 WINNT.XPE、WINPE.IS_、和“外置程序”文件夹都拷贝到 U 盘的根目录下。做完这一步,U盘就可以引导到WinPE下了。如果启动的时候选第一项“Windows PE By:LaoMaotao”,系统将依照NTLDR------>avldr.xpe------>winnt.xpe------>winpe.is_这个顺序链把电脑启动到Windows PE环境下。
5、把软盘镜像文件DOS.ima拷贝到U盘根目录。
6、把前面生成的Avldr.bin和Avlgo.sys两个文件拷贝到U盘根目录,对照Boot.ini文件可知,这两个文件是对应于菜单中第二行 for USB-HDD模式。如果启动的时候选择第二项“MS-DOS 7.1 form USB-HDD”,系统将依照NTLDR------>avldr.bin------>avlgo.sys------>DOS.ima这个顺序链把电脑启动到MS-DOS环境下。
7、把前面UltraEdit编辑生成的Avldr.dos和Avdos.sys两个文件拷贝到U盘根目录,对照Boot.ini文件可知,这两个文件是对应于菜单中第三行 for USB-FDD模式。如果启动的时候选择第三项“MS-DOS 7.1 form USB-FDD”,系统将依照NTLDR------>avldr.dos------>avdos.sys------>DOS.ima这个顺序链把电脑启动到MS-DOS环境下。
至此DOS/WinPE双启动系统维护U盘制作成功。
方案二:NT Loader + Grub4DOS
因为Avlgo引导器默认是不支持多重配置选单的,所以前面我使用了特殊的方式编辑处理Avlgo的引导配置文件,以期解决U盘启动盘符变动引发的问题。从网友的反馈看,这种方式引导DOS启动软盘镜像,失败率还是比较高。基本上出问题的情况都是NT Loader引导正常,但是到Avlgo的环节出错。因此这套方案,依然保留NT Loader作为MBR引导器,用Grub4DOS来引导OS。
1、给U盘写入NTLDR的MBR,此项工作可以用PeToUSE来完成,也可以用其它方式达成目标。具体操作见方案一。
2、把NT Loader所需的文件NTLDR和NTDETECT.COM拷贝到U盘根目录。
3、编辑NT Loader启动菜单Boot.ini。用任何文本编辑器创建一个Boot.ini文件,内容如下:
timeout=0
default=C:\grldr
C:\grldr="Boot Menu"
Boot.ini菜单各个项目的含义请对照方案一的说明。
4、拷贝Grub4DOS文件,把Grub4DOS里面的grldr拷贝到U盘根目录;在U盘根目录创建一个Boot文件夹,把Grub4DOS的中文字体文件Fonts.tz和菜单背景图片文件Splash.gz拷贝到这个文件夹下。在U盘根目录创建一个grubidx.txt文件,内容无所谓。
5、把DOS软盘镜像文件dos.ima拷贝到U盘的Boot文件夹下。
6、把老毛桃WinPE里面的WINNT.XPE和WINPE.IS_文件拷贝到U盘根目录;把WXPE文件夹下面的SETUPLDR.BIN拷贝到U盘根目录下并更名为LDRXPE,注意没有后缀哦。把“外置程序”文件夹拷贝到U盘根目录。
7、创建Grub引导菜单文件,用任何纯文本编辑器在U盘根目录创建一个Menu.lst文件,内容为:
timeout 30
default 0
splashimage /boot/splash.gz
foreground ffff00
fontfile /boot/fonts.gz
title 启动 WindowsPE
find --set-root /grubidx.txt
chainloader /ldrxpe
title 启动 MS-DOS 7.1
find --set-root /grubidx.txt
map --mem /boot/dos.ima (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)
做完这些,U盘就可以启动了。
菜单项目说明:
第一行设置等待30秒的等待时间;
第二行设置如果30秒用户没有选择,就默认启动第一个引导项目“启动 WindowsPE”;
splashimage项目设置Grub4DOS启动菜单的背景图片,图片路径为/boot/splash.gz;
foreground项设置启动菜单文字颜色为亮黄色;
fontfile项设置中文字体文件为/boot/fonts.gz
下面两个以title开头的小节就是启动菜单的两个启动项,title后面的文字将显示在菜单中;
find --set-root /grubidx.txt这一项是自动搜索grubidx.txt这个事先创建好的特征文件,它只要找到这个文件,就把文件所在的路径设置为根设备,这样就不会被盘符变化困扰了。至于特征文件的内容,那就无所谓了。
chainloader /ldrxpe就是启动WinPE的XPE镜像。
map --mem /boot/dos.ima (fd0)是装入/boot/dos.ima这个软盘镜像,并且虚拟成fd0.
map --hook是让装入的软盘镜像立即加载生效。
rootnoverify (fd0)指定把刚才虚拟的fd0设置为根设备。
本来,Grub4DOS可以直接安装到U盘的根目录,但是我反复尝试了多次,MBR是写进去了,可总是报错无法引导。所以还是用NT Loader做MBR引导器,由于NT Loader不支持加载镜像文件,所以MBR引导成功后,把控制权交给Grub4DOS,由Grub4DOS来加载WinPE的XPE镜像以及MS-DOS的软盘镜像实现启动对应OS的功能。
方案三:MS-DOS 7.1 + Grub4DOS
本来这个方案是我着手制作双启动U盘最早选用的方案,但是在我的华擎845E主板上始终没法使用,所以开始没有发布。这次发布出来供大家测试,看看是不是我那主板的特例。
本方案的MBR由DOS引导,WinPE由Grub4DOS加载启动。相对前面的方案,这个方案制作起来最简单。
1、用HP USE Disk Storage Format Tool把U盘格式化成FAT可引导盘。
2、根据自己的需要,把其它DOS文件和一些DOS工具拷贝到U盘。
3、把老毛桃WinPE里面的WINNT.XPE和WINPE.IS_文件拷贝到U盘根目录;把WXPE文件夹下面的SETUPLDR.BIN拷贝到U盘根目录下并更名为LDRXPE,注意没有后缀哦。把“外置程序”文件夹拷贝到U盘根目录。
4、把NTLDR和ntdetect.com两个文件拷贝到U盘根目录,这是启动XPE格式WinPE镜像必须的文件。
5、把grub.exe和fonts.gz两个Grub4DOS的程序文件和中文字体文件拷贝到U盘根目录。
6、用任何文本编辑器在U盘根目录创建Menu.lst,内容如下:
timeout 0
default 0
fontfile /fonts.gz
title 启动 WindowsPE
find --set-root /grubidx.txt
chainloader /ldrxpe
在U盘根目录创建一个grubidx.txt文件,内容无所谓,作用是配合Menu.lst作为Grub特征文件查找确定根设备。
7、自行编辑Config.sys和Autoexec.bat,构建DOS多重开机选单,加入启动Grub4DOS的项目。要保证启动Grub的时候不装入任何的内存管理程序和其它驱动程序、驻留程序,以免跟Grub4DOS发生冲突。可以简单地在Autoexec.bat里面加入一行:
grub
这样就可以启动Grub4DOS了。当然,由于要实现双启动,所以要把这两个配置文件编辑成多重选单的方式,在需要的时候可以启动对应的配置。我把我的配置文件内容放在下面供参考。
Config.sys内容:
MENUITEM=1,XMS without CD-ROM support
MENUITEM=2,XMS with CD-ROM support
MENUITEM=3,XMS and EMS
MENUITEM=4,DOS real mode(no XMS,no EMS)
MENUITEM=5,Windows PE
MENUDEFAULT=5,30
DEVICE=\HIMEM.SYS /TESTMEM:OFF
DEVICE=\EMM386.EXE NOEMS
INCLUDE=PUB
DEVICE=\HIMEM.SYS /TESTMEM:OFF
DEVICE=\EMM386.EXE NOEMS
DEVICEHIGH=\VIDE-CDD.SYS /D:SSCD001
INCLUDE=PUB
DEVICE=\HIMEM.SYS /TESTMEM:OFF
DEVICE=\EMM386.EXE RAM
INCLUDE=PUB
DOS=HIGH,UMB
FILES=30
BUFFERS=20
STACKS=9,256
LASTDRIVE=Z
FILES=10
BUFFERS=10
LASTDRIVE=Z
Autoexec.bat内容:
@ECHO OFF
PATH=A:\;C:\;A:\Diskgen;C:\DiskGen;A:\DM;C:\DM
GOTO %CONFIG%
:1
GOTO COMMON
:2
LH \SHSUCDX.COM /D:SSCD001
GOTO COMMON
:3
GOTO COMMON
:4
GOTO END
:5
GRUB
:COMMON
LH \SMARTDRV.EXE /X
@ECHO Install mouse driver?
\CHOICE /C:YN Yes,No /T:N,6
IF ERRORLEVEL 2 GOTO END
LH \MOUSE.COM
:END
按照这个配置,启动的时候如果选择第5个项目,或者超过30秒没有做选择自动执行第5个项目,那就经由Autoexec.bat里面对应的语句启动Grub4DOS,然后Grub4DOS会根据Menu.lst的设置启动WinPE。DOS多重启动配置的具体做法,请参考有关资料。
感谢5free和david_ge的帮助!
本文选用的“WinPE 老毛桃最终修改版”可以到无忧论坛或者老毛桃的网盘下载:
http://bbs.wuyou.com/viewthread.php?tid=94087
http://maotao.u.winzheng.com/
附件中Avdos.rar是我制作好的Avlgo引导文件;NTLDR.rar是NT Loader引导器文件;PeToUSB.rar是格式化NTLDR引导盘的工具;Avlgomgr2007.rar是Avlgo装配工具;FixNTBoot.rar是另外一个用来写NT Loader MBR的工具。其它软件由于涉及版权,请自行到网上寻找。
最近在研究DOS/WinPE双启动U盘,开始的时候用Grub for DOS,结果这个东西对USB设备的支持有兼容性问题,搞得有的主板装入WinPE的时候死机。
后来用NTLDR+AVLDR代替Grub for DOS搞定了启动WinPE兼容性问题。
目前的需要解决的问题是如何用NTLDR启动DOS。现在我是把DOS文件放在U盘根目录,已经提取生成了U盘格式化为DOS引导模式的引导扇区文件。但是不知道如何编写Boot.ini文件,是否还需要把DOS系统文件制作成某种镜像?
Unexpectedly, the release of the production method has received such wide attention. It seems that everyone, just like me, hopes to make a relatively universal system maintenance tool. After the test feedback from netizens these days, it was found that the compatibility of the NT Loader + Avlgo method is not ideal. So I tried another boot method. Now I will also release the other two successful test methods for everyone to test and discuss together. I use this article to start a discussion, hoping that under the research of everyone, a relatively good compatibility solution can finally be found.
Previous:
Many years ago, when floppy drives were still a must-have for computers, floppy disks were also used to maintain the computer boot system. I made N pieces of boot floppy disks back then. Later, as floppy disks faded out of the market, system maintenance disks were also changed to CDs. For example, the famous Shenshan Hongye system maintenance tool disk provided strong help for my work. However, CDs still have disadvantages such as being easy to scratch and large in size. Now most computers basically support USB device booting, and USB flash drives can be made into small and easy-to-carry system maintenance disks; rewritable storage media also provide convenience for updates, and there is no need to burn a bunch of CDs for upgrades anymore.
Goal:
For system maintenance, Windows PE is an indispensable tool; in addition, some problems still need to be solved by booting into the DOS environment. So my goal is to make a DOS/WinPE dual-boot system maintenance USB flash drive. Next time when a computer system crashes, I can take out a delicate USB flash drive from my pocket, boot the computer, and solve the problem in a flash. How chic!
Technical background:
In fact, booting a computer from a USB flash drive mainly relies on the reasonable and flexible use of various boot tools. All operations and debugging are also centered around the installation and configuration of boot tools. We know that as the main carrier of the operating system, the disk has always been the most important storage medium. Therefore, basically all OS boot modes are roughly the same, and they are all loaded by the disk.
First, it is necessary to write specific boot code in the MBR (Master Boot Record) sector of the disk where the OS is located. After the computer boots, it will poll the MBR area of the corresponding disk according to the boot sequence set in the BIOS. If a valid MBR record is found, it will load the OS boot file according to the pointer of the MBR record. If the OS boot file is normal, the corresponding operating system will be loaded.
Therefore, to complete the boot of an operating system, two necessary steps are required: 1. MBR boot; 2. OS boot.
Based on the above basic principles, various operating systems have their own built-in boot loaders, such as NTLDR of Windows NT and above systems, Lilo of Linux, Grub boot loaders of various versions, etc. Of course, there are also some third-party multi-system boot tools such as System Commander, etc.
For our current application, the purpose is to be able to achieve dual-boot of DOS/WinPE on a USB flash drive and have relatively good compatibility. To achieve this goal, there are some technical requirements. First, the solution should be able to adapt to the disk letter change situation of USB flash drive mobile storage; second, to achieve dual-boot, a virtual disk image is generally used, that is, the boot loader needs to support the RAMDisk loading method for booting various common disk images.
Although USB flash drives have many advantages such as being small and lightweight and can be rewritten repeatedly, if they are to be made into boot disks, there are still some problems that need to be solved. The biggest problem is that there is no unified industry standard for USB booting. Different motherboard manufacturers and different BIOSs have different USB boot methods. As a mobile storage device, the motherboard's different recognition of USB flash drives will cause the disk letter to change. These directly lead to the poor universality and compatibility of USB flash drive booting, and the performance is that it cannot boot on some computers. This is a key problem to be solved.
OS selection:
The DOS system selects MS-DOS 7.1; the WinPE selects "Lao Maotao's WinPE final modified version with external network and multimedia components" from the Wuyou Forum.
Scheme 1: NT Loader + AVLDR + Avlgo
The MBR is booted by NT Loader. In the NTLDR boot menu, set options: boot WinPE with AVLDR; and boot DOS with Avlgo. Since Avlgo does not support multi-boot in the menu mode, in order to solve the problem of different disk letters recognized by USB flash drives on different motherboards, the Avlgo boot configuration file is slightly modified to adapt to the boot requirements of disk letter changes.
Tool preparation:
PeToUsb - used to format the USB flash drive into the NT boot mode; WinImage - used to make a DOS boot floppy disk image; Avlgomgr - used to generate Avlgo boot files; UltraEdit - used to edit and modify the Avlgo boot file.
Data preparation:
1. PeToUSB is a free software specially used to format the boot area of the USB flash drive into NTLDR boot code. Start PeToUSB, select the target USB flash drive from the "Destination Driver" column, click the "Start" button below, it asks whether to continue with "Continue", click "Yes", a warning window pops up, prompting that all data on the target disk will be lost, whether to continue? Still select "Yes", and then it is completed in a moment.
2. Use WinImage to make a 2.88M boot floppy disk image, load MS-DOS 7.1 into the image, and put common DOS tools into the image. After starting WinImage, click the leftmost button to create a new image, here select the standard format 2.88MB, in order to store as many tools as possible. Then add files to this image, drag the prepared MS-DOS system files from the resource manager to the WinImage window. Other DOS tools are added in the same way. After the files are added, click the "Image" menu - "Boot Sector Properties", select "Windows 95/98" and confirm. This step is very important. If this step is omitted, this floppy disk image cannot boot the computer. Finally, save it as an ima format image file DOS.ima.
3. First back up the Boot.ini file of drive C. Note that this system and hidden attribute file is not visible in the default state. It is necessary to modify the viewing method in the "Tools" menu "Folder Options" in the resource manager, cancel the "Hide protected operating system files" check box, and switch to show all files. Start Avlgomgr, browse and find the just-made image file with WinImage in the "Virtual Disk Full Path", then click the "Assemble" button, Avlgomgr automatically modifies the Boot.ini file, and generates the two key files Avldr.bin and Avlgo.sys we need on the target disk (in this example, drive C), and copy these two files to a place for later use. After completion, restore the original Boot.ini file of drive C.
4. Start UltraEdit, first open Avldr.bin, find the string "AVLGO.SYS" in the ASCII code area on the right of the editing screen, change it to "AVDOS.SYS", and save the file as Avldr.dos.
5. Then open Avlgo.sys, find the string "(hd0,0)/DOS.IMA" in the right ASCII code area, modify it to "(fd0)/DOS.IMA". When modifying, note that since the modified string is shorter than the original one, to ensure that the file length remains unchanged, the remaining part should be switched to the left hexadecimal code area and filled with "00", so that the file length can be ensured to remain unchanged. After modification, save it as Avdos.sys.
Start assembly:
1. First, create a Boot.ini file in the root directory of the USB flash drive with Notepad. The content is as follows:
timeout=30
default=C:\avldr.xpe
C:\avldr.xpe="Windows PE By:LaoMaotao"
C:\avldr.bin="MS-DOS 7.1 form USB-HDD"
C:\avldr.dos="MS-DOS 7.1 from USB-FDD"
After completion, modify the attributes of this file to read-only/system/hidden (you can use the DOS command attrib +r +s +h boot.ini to modify the file attributes).
This is the menu configuration file of NT Loader. The timeout parameter sets the menu waiting time. If the user does not make a selection within the set time (30 seconds in this example), it will automatically load the default item C:\avldr.xpe set by default and start WinPE.
The section is the boot options that appear in the menu. The first one is the Lao Maotao WinPE set by the previous default. The text in double quotes is a comment line and will be displayed in the boot menu. The next two lines are the boot items corresponding to the two modes of the motherboard recognizing the USB flash drive as USB-HDD and USB-FDD respectively.
2. Copy the NTLDR and NTDETECT.COM files of the hard disk system to the root directory of the USB flash drive. These are the necessary files of the NT Loader boot loader.
3. Extract the ISO file of Lao Maotao WinPE downloaded to a temporary folder, copy AVLDR.XPE in the "WINPE Installation" folder to the root directory of the USB flash drive, copy SETUPLDR.BIN in the "WXPE" folder to the root directory of the USB flash drive and rename the file to LDRXPE. Copy WINNT.XPE, WINPE.IS_, and the "External Programs" folder in the temporary folder to the root directory of the U flash drive. After doing this step, the USB flash drive can boot to WinPE. If the first item "Windows PE By:LaoMaotao" is selected during startup, the system will start the computer to the Windows PE environment in the order of NTLDR------>avldr.xpe------>winnt.xpe------>winpe.is_.
5. Copy the floppy disk image file DOS.ima to the root directory of the USB flash drive.
6. Copy the two files Avldr.bin and Avlgo.sys generated earlier to the root directory of the USB flash drive. According to the Boot.ini file, these two files correspond to the second line in the menu for the USB-HDD mode. If the second item "MS-DOS 7.1 form USB-HDD" is selected during startup, the system will start the computer to the MS-DOS environment in the order of NTLDR------>avldr.bin------>avlgo.sys------>DOS.ima.
7. Copy the two files Avldr.dos and Avdos.sys edited and generated by UltraEdit earlier to the root directory of the USB flash drive. According to the Boot.ini file, these two files correspond to the third line in the menu for the USB-FDD mode. If the third item "MS-DOS 7.1 form USB-FDD" is selected during startup, the system will start the computer to the MS-DOS environment in the order of NTLDR------>avldr.dos------>avdos.sys------>DOS.ima.
At this point, the DOS/WinPE dual-boot system maintenance USB flash drive is successfully made.
Scheme 2: NT Loader + Grub4DOS
Because the Avlgo boot loader does not support multi-configuration menu by default, so I used a special method to edit and process the Avlgo boot configuration file earlier, in order to solve the problem of disk letter changes of USB flash drive booting. According to the feedback from netizens, the failure rate of booting the DOS boot floppy disk image in this way is still relatively high. Basically, the situation where the problem occurs is that the NT Loader boot is normal, but an error occurs at the Avlgo link. Therefore, in this solution, NT Loader is still retained as the MBR boot loader, and Grub4DOS is used to boot the OS.
1. Write the MBR of the USB flash drive with NTLDR. This work can be completed with PeToUSE or other methods to achieve the goal. For specific operations, see Scheme 1.
2. Copy the files NTLDR and NTDETECT.COM required by NT Loader to the root directory of the USB flash drive.
3. Edit the NT Loader boot menu Boot.ini. Create a Boot.ini file with any text editor. The content is as follows:
timeout=0
default=C:\grldr
C:\grldr="Boot Menu"
For the meaning of each item in the Boot.ini menu, please refer to the description in Scheme 1.
4. Copy the Grub4DOS file, copy grldr in Grub4DOS to the root directory of the USB flash drive; create a Boot folder in the root directory of the USB flash drive, and copy the Chinese font file Fonts.tz and the menu background image file Splash.gz in Grub4DOS to this folder. Create a grubidx.txt file in the root directory of the USB flash drive. The content is irrelevant.
5. Copy the DOS floppy disk image file dos.ima to the Boot folder of the USB flash drive.
6. Copy the WINNT.XPE and WINPE.IS_ files in Lao Maotao WinPE to the root directory of the USB flash drive; copy SETUPLDR.BIN in the WXPE folder to the root directory of the USB flash drive and rename it to LDRXPE. Note that there is no suffix. Copy the "External Programs" folder to the root directory of the USB flash drive.
7. Create a Grub boot menu file. Use any plain text editor to create a Menu.lst file in the root directory of the USB flash drive. The content is:
timeout 30
default 0
splashimage /boot/splash.gz
foreground ffff00
fontfile /boot/fonts.gz
title 启动 WindowsPE
find --set-root /grubidx.txt
chainloader /ldrxpe
title 启动 MS-DOS 7.1
find --set-root /grubidx.txt
map --mem /boot/dos.ima (fd0)
map --hook
chainloader (fd0)+1
rootnoverify (fd0)
After doing these, the USB flash drive can be booted.
Menu item description:
The first line sets the waiting time of 30 seconds;
The second line sets that if the user does not make a selection within 30 seconds, it will default to starting the first boot item "Start WindowsPE";
The splashimage item sets the background image of the Grub4DOS boot menu. The image path is /boot/splash.gz;
The foreground item sets the boot menu text color to bright yellow;
The fontfile item sets the Chinese font file to /boot/fonts.gz
The following two sections starting with title are the two boot items of the boot menu. The text after title will be displayed in the menu;
find --set-root /grubidx.txt is to automatically search for the previously created feature file grubidx.txt. As long as it finds this file, it will set the path where the file is located as the root device, so as not to be troubled by disk letter changes. As for the content of the feature file, it doesn't matter.
chainloader /ldrxpe is to start the XPE image of WinPE.
map --mem /boot/dos.ima (fd0) is to load the /boot/dos.ima floppy disk image and virtualize it as fd0.
map --hook is to make the loaded floppy disk image take effect immediately.
rootnoverify (fd0) specifies to set the just virtualized fd0 as the root device.
Originally, Grub4DOS can be directly installed in the root directory of the USB flash drive, but I tried many times, the MBR was written in, but it always reported an error and could not boot. So still use NT Loader as the MBR boot loader. Since NT Loader does not support loading image files, after the MBR boot is successful, the control is handed over to Grub4DOS, and Grub4DOS is used to load the XPE image of WinPE and the floppy disk image of MS-DOS to realize the function of booting the corresponding OS.
Scheme 3: MS-DOS 7.1 + Grub4DOS
Originally, this scheme was the earliest scheme I used to make a dual-boot USB flash drive, but it always couldn't be used on my ASRock 845E motherboard, so it wasn't released at the beginning. This time it is released for everyone to test, see if it is a special case of my motherboard.
The MBR of this scheme is booted by DOS, and WinPE is loaded and started by Grub4DOS. Compared with the previous scheme, this scheme is the simplest to make.
1. Use HP USE Disk Storage Format Tool to format the USB flash drive into a FAT bootable disk.
2. Copy other DOS files and some DOS tools to the USB flash drive according to your needs.
3. Copy the WINNT.XPE and WINPE.IS_ files in Lao Maotao WinPE to the root directory of the USB flash drive; copy SETUPLDR.BIN in the WXPE folder to the root directory of the USB flash drive and rename it to LDRXPE. Note that there is no suffix. Copy the "External Programs" folder to the root directory of the USB flash drive.
4. Copy the two files NTLDR and ntdetect.com to the root directory of the USB flash drive. These are the necessary files to start the XPE format WinPE image.
5. Copy the two program files grub.exe and fonts.gz of Grub4DOS and the Chinese font file to the root directory of the USB flash drive.
6. Use any text editor to create Menu.lst in the root directory of the USB flash drive. The content is as follows:
timeout 0
default 0
fontfile /fonts.gz
title 启动 WindowsPE
find --set-root /grubidx.txt
chainloader /ldrxpe
Create a grubidx.txt file in the root directory of the USB flash drive. The content is irrelevant. The function is to cooperate with Menu.lst as a Grub feature file to find and determine the root device.
7. Edit Config.sys and Autoexec.bat by yourself, build a DOS multi-boot menu, and add the item to start Grub4DOS. It is necessary to ensure that no memory management program and other drivers and resident programs are loaded when starting Grub, so as not to conflict with Grub4DOS. You can simply add a line in Autoexec.bat:
grub
In this way, Grub4DOS can be started. Of course, in order to achieve dual-boot, these two configuration files need to be edited into a multi-menu mode, and the corresponding configuration can be started when needed. I put my configuration file content below for reference.
Content of Config.sys:
MENUITEM=1,XMS without CD-ROM support
MENUITEM=2,XMS with CD-ROM support
MENUITEM=3,XMS and EMS
MENUITEM=4,DOS real mode(no XMS,no EMS)
MENUITEM=5,Windows PE
MENUDEFAULT=5,30
DEVICE=\HIMEM.SYS /TESTMEM:OFF
DEVICE=\EMM386.EXE NOEMS
INCLUDE=PUB
DEVICE=\HIMEM.SYS /TESTMEM:OFF
DEVICE=\EMM386.EXE NOEMS
DEVICEHIGH=\VIDE-CDD.SYS /D:SSCD001
INCLUDE=PUB
DEVICE=\HIMEM.SYS /TESTMEM:OFF
DEVICE=\EMM386.EXE RAM
INCLUDE=PUB
DOS=HIGH,UMB
FILES=30
BUFFERS=20
STACKS=9,256
LASTDRIVE=Z
FILES=10
BUFFERS=10
LASTDRIVE=Z
Content of Autoexec.bat:
@ECHO OFF
PATH=A:\;C:\;A:\Diskgen;C:\DiskGen;A:\DM;C:\DM
GOTO %CONFIG%
:1
GOTO COMMON
:2
LH \SHSUCDX.COM /D:SSCD001
GOTO COMMON
:3
GOTO COMMON
:4
GOTO END
:5
GRUB
:COMMON
LH \SMARTDRV.EXE /X
@ECHO Install mouse driver?
\CHOICE /C:YN Yes,No /T:N,6
IF ERRORLEVEL 2 GOTO END
LH \MOUSE.COM
:END
According to this configuration, if the 5th item is selected during startup, or no selection is made within 30 seconds and the 5th item is automatically executed, then Grub4DOS will be started via the corresponding statement in Autoexec.bat, and then Grub4DOS will start WinPE according to the settings of Menu.lst. For the specific practice of the DOS multi-boot configuration, please refer to relevant information.
Thanks to 5free and david_ge for their help!
The "Lao Maotao's WinPE final modified version" selected in this article can be downloaded from the Wuyou Forum or Lao Maotao's network disk:
http://bbs.wuyou.com/viewthread.php?tid=94087
http://maotao.u.winzheng.com/
The Avdos.rar in the attachment is the Avlgo boot file I made; the NTLDR.rar is the NT Loader boot loader file; the PeToUSB.rar is the tool to format the NTLDR boot disk; the Avlgomgr2007.rar is the Avlgo assembly tool; the FixNTBoot.rar is another tool to write the NT Loader MBR. Other software involves copyright, please find it on the Internet by yourself.
Recently, I have been researching the DOS/WinPE dual-boot USB flash drive. At the beginning, I used Grub for DOS, but this thing has compatibility problems with USB device support, causing some motherboards to freeze when loading WinPE.
Later, I used NTLDR+AVLDR to replace Grub for DOS to solve the WinPE compatibility problem.
The current problem to be solved is how to boot DOS with NTLDR. Now I put the DOS files in the root directory of the USB flash drive, and have extracted and generated the boot sector file for formatting the USB flash drive into the DOS boot mode. But I don't know how to write the Boot.ini file, and whether I still need to make the DOS system files into a certain image?