创建自定义 Windows PE 映像的过程
一、准备
到微软下载AIK,并安装。我用的是6001.18000.080118-1840-kb3aik_cn.iso
二、创建自定义 Windows PE 映像的过程
0、使用copype.cmd创建本地 Windows PE 构建环境
copype.cmd x86 c:\winpe_x86
1、使用 ImageX 将基本映像 (Winpe.wim) 应用到本地共享目录。例如,
imagex /apply WinPE.wim 1 C:\myWinPE
2、使用 peimg /list 命令查看已安装和可安装的程序包。例如,
peimg /list C:\myWinPE\Windows
3、使用 peimg /install 命令相应添加驱动程序、程序包和语言包。例如,添加 HTA 程序包的命令如下:
peimg /install=WinPE-HTA-Package C:\myWinPE\Windows
4、复制要包括在映像中的任何其他文件或工具。例如,
C:\myWinPE\Program Files\myapp\myapp.exe.
5、添加设备驱动程序
peimg /inf=<path> c:\winpe_x86\mount\Windows
6、使用 peimg /prep 命令准备映像。此命令将删除未为最终映像指定的任何程序包和语言包。例如,
peimg /prep c:\myWinPE\Windows
7、使用 ImageX 捕获新的可启动映像。例如,
imagex /boot /compress max /capture c:\myWinPE c:\boot.wim "My Winpe Image"
8、把c:"winpe_x86"ISO"sources"boot.wim用上步生成的c:"boot.wim替换掉
9、生成光盘镜像文件
oscdimg -n -bc:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c:\mywinpe.iso
10、可以用daemon加载mywinpe.iso,然后用vmware试一下。注意vmware虚拟机的内存要512M,如果
是256M就启动不了了。
三、下面是实际命令行拷贝
Updating path to include peimg, cdimage, imagex
C:\Program Files\Windows AIK\Tools\PETools\
C:\Program Files\Windows AIK\Tools\PETools\..\x86
C:\Program Files\Windows AIK\Tools\PETools>copype.cmd x86 d:\winpe_x86
===================================================
Creating Windows PE customization working directory
d:\winpe_x86
===================================================
已复制 1 个文件。
已复制 1 个文件。
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\bcd
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\boot.sdi
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\bootfix.bin
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\etfsboot.com
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\fonts\chs_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\fonts\cht_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\fonts\jpn_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\fonts\kor_boot.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\boot\fonts\wgl4_boot.ttf
复制了 9 个文件
C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\bcd
C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\fonts\chs_boot
.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\fonts\cht_boot
.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\fonts\jpn_boot
.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\fonts\kor_boot
.ttf
C:\Program Files\Windows AIK\Tools\PETools\x86\EFI\microsoft\boot\fonts\wgl4_boo
t.ttf
复制了 6 个文件
已复制 1 个文件。
已复制 1 个文件。
Success
Updating path to include peimg, cdimage, imagex
C:\Program Files\Windows AIK\Tools\PETools\
C:\Program Files\Windows AIK\Tools\PETools\..\x86
D:\winpe_x86>imagex /apply winpe.wim 1 d:\mywinpe
ImageX Tool for Windows
Copyright (C) Microsoft Corp. All rights reserved.
Progress: 0%
Error restoring image.
D:\winpe_x86>mkdir d:\mywinpe
D:\winpe_x86>imagex /apply winpe.wim 1 d:\mywinpe
ImageX Tool for Windows
Copyright (C) Microsoft Corp. All rights reserved.
Progress: 100%
Successfully applied image.
D:\winpe_x86>xcopy /e d:\FileZilla "d:\mywinpe\Program Files\FileZilla"
目标 D:\mywinpe\Program Files\FileZilla 是文件名
还是目录名
(F = 文件,D = 目录)? d
D:\FileZilla\dbghelp.dll
D:\FileZilla\FileZilla.chm
D:\FileZilla\FileZilla.exe
D:\FileZilla\FileZilla.pdb
D:\FileZilla\FileZilla.xml
D:\FileZilla\FzGSS.dll
D:\FileZilla\FzResBu.dll
D:\FileZilla\FzResCh.dll
D:\FileZilla\FzResChs.dll
D:\FileZilla\FzResDe.dll
D:\FileZilla\FzResEs.dll
D:\FileZilla\FzResFr.dll
D:\FileZilla\FzResHu.dll
D:\FileZilla\FzResIt.dll
D:\FileZilla\FzResJp.dll
D:\FileZilla\FzResKr.dll
D:\FileZilla\FzResNor.dll
D:\FileZilla\FzResPo.dll
D:\FileZilla\FzResRu.dll
D:\FileZilla\FzSFtp.exe
D:\FileZilla\GPL.html
D:\FileZilla\legal.htm
D:\FileZilla\libeay32.dll
D:\FileZilla\puttylicense.html
D:\FileZilla\readme.htm
D:\FileZilla\ssleay32.dll
D:\FileZilla\Trusted Certs.dat
复制了 27 个文件
D:\winpe_x86>peimg /inf=d:\intel_pro1000_123_vista32\PRO1000\Win32 d:\mywinpe\Windows
Windows 预安装环境映像安装工具
版权所有 (C) Microsoft Corp。保留所有权利。
正在安装 INF 程序包: d:\intel_pro1000_123_vista32\PRO1000\Win32
PEIMG 无法完成操作,状态代码为 0x800f0003。
D:\winpe_x86>peimg /inf=d:\intel_pro1000_123_vista32\PRO1000\Win32\e1e6032.INF
Windows 预安装环境映像安装工具
版权所有 (C) Microsoft Corp。保留所有权利。
未指定 Windows PE 映像。请使用 /image=
使用 /? 显示用法信息。
D:\winpe_x86>peimg /inf=d:\intel_pro1000_123_vista32\PRO1000\Win32\e1e6032.INF d:\mywinpe\Windows
Windows 预安装环境映像安装工具
版权所有 (C) Microsoft Corp。保留所有权利。
正在安装 INF 程序包: d:\intel_pro1000_123_vista32\PRO1000\Win32\e1e6032.INF
PEIMG 已成功完成操作。
D:\winpe_x86>peimg /inf=d:\intel_pro1000_123_vista32\PRO1000\Win32\e1g6032.inf d:\mywinpe\Windows
Windows 预安装环境映像安装工具
版权所有 (C) Microsoft Corp。保留所有权利。
正在安装 INF 程序包: d:\intel_pro1000_123_vista32\PRO1000\Win32\e1g6032.inf
PEIMG 已成功完成操作。
D:\winpe_x86>peimg /prep d:\mywinpe\Windows
Windows 预安装环境映像安装工具
版权所有 (C) Microsoft Corp。保留所有权利。
/prep 命令将永久修改 Windows PE 映像,因此不能再对其进行
服务。这意味着以下各项操作:
- 安装或卸载可选功能
- 应用修补程序或其他服务程序包
- 安装语言包
将无法在准备好的映像上执行。
若要继续,请输入“yes”。任何其他输入都将退出该程序。
是否继续? yes
[==========================100.0%==========================]
PEIMG 已成功完成操作。
D:\winpe_x86>imagex /boot /compress max /capture d:\mywinpe d:\boot.wim "WinPE"
ImageX Tool for Windows
Copyright (C) Microsoft Corp. All rights reserved.
Files/folders excluded from image capture by default:
\WINDOWS\CSC
\RECYCLER
\$Recycle.Bin\*
\System Volume Information
\pagefile.sys
\hiberfil.sys
\$ntfs.log
Progress: 100%
Successfully imaged d:\mywinpe
D:\winpe_x86>copy d:\boot.wim d:\winpe_x86\ISO\sources\
改写 d:\winpe_x86\ISO\sources\boot.wim 吗? (Yes/No/All): yes
已复制 1 个文件。
D:\winpe_x86>oscdimg -n -bd:\winpe_x86\etfsboot.com d:\winpe_x86\ISO d:\mywinpe.iso
OSCDIMG 2.54 CD-ROM and DVD-ROM Premastering Utility
Copyright (C) Microsoft, 1993-2007. All rights reserved.
Licensed only for producing Microsoft authorized content.
Scanning source tree
Scanning source tree complete (17 files in 8 directories)
Computing directory information complete
Image file is 160000000 bytes
Writing 17 files in 8 directories to d:\mywinpe.iso
100% complete
Final image file is 160000000 bytes
Done.
D:\winpe_x86>dir d:\mywinpe.iso
驱动器 D 中的卷是 Software
卷的序列号是 DC18-0AD8
d:\ 的目录
2008-08-21 12:21 160,000,000 mywinpe.iso
1 个文件 160,000,000 字节
0 个目录 22,609,256,448 可用字节
D:\winpe_x86>
四、关于多的WinPE方面知识,请参阅AIK的帮助,上面说的很详细。
五、图像shell(下面内容来自M$)
Winpeshl.ini 可控制是否将自定义外壳程序加载到 Windows PE 而不是默认的“命令提示符”窗口。若要加载自定义外壳程序,请创建一个名为 Winpeshl.ini 的文件,然后将它放在自定义 Windows PE 映像的 %SYSTEMROOT%"System32 中。该 .ini 文件必须包含以下部分和项:
[LaunchApp]
AppPath = %SYSTEMDRIVE%"myshell.exe
[LaunchApps]
%SYSTEMDRIVE%"mydir"application1.exe, -option1 -option2
application2.exe, -option1 -option2
将 AppPath 项设置为外壳应用程序的路径。该路径可以是完全限定路径,您也可以使用环境变量(例如 %SYSTEMROOT%"System32"Myshell.exe)来表示该路径。AppPath 项不支持命令行选项。
使用 [LaunchApps] 部分运行带命令行选项的应用程序。应用程序按照列出的顺序运行;应用程序的名称及其选项以逗号分隔。
当退出“命令提示符”窗口或自定义外壳应用程序时,Windows PE 将重新启动。
重要事项:
不要编辑 Setupreg.hiv 的 HKEY_LOCAL_MACHINE"SYSTEM"Setup 注册表项中的 CmdLine 值来启动外壳应用程序。CmdLine 的值可调用 Winpeshl.exe,Winpeshl.exe 会执行很多函数,包括调用 Windows PE 中的默认“命令提示符”窗口或您的自定义外壳应用程序。
六、其他
http://hi.baidu.com/chenfen/blog/item/a98dd8bf49b8830f18d81f77.html
http://www.msfn.org/board/lofiversion/index.php/t73692.html
http://digi.it.sohu.com/20070515/n250033092.shtml