Linux配置PXE Server启动WinPE3.0环境推荐

PXE Server就是DHCP+TFTP服务,如果想使用Server上的文件,可以加入FTP或Samba等服务。我用经常用的是PXE启动WinPE环境,在Linux 中再加入Samba服务。WinPE中用net use 把共享映射到WinPE下。就可以使用Server上的文件了。

下面Linux PXE是我在VirtualBox上RHEL6系统上配置的。

1.配置Linux DHCP Server

以下是dhcpd.conf配置文件:这里只是简单给出必须的配置项。ddns-update-style interim;ignore client-updates;allow booting;allow bootp;class pxeclients {match if substring(option vendor-class-identifier, 0, 9) = PXEClient next-server 192.168.56.254;filename pxeboot.0 subnet 192.168.56.0 netmask 255.255.255.0 {option routers 192.168.56.1;range dynamic-bootp 192.168.56.10 192.168.56.250;default-lease-time 600;max-lease-time 7200;下图是我的DHCP配置文件内容:红色方框中的参数是必须的,一个都不能少。

2.配置Linux下的tftp Server(1)创建remap文件,/tftpboot/tftpd.remap。该文件内容如下:必须加入这一行:rg \\ /(2)编辑/etc/xinitd.d/tftp文件。service tftpsocket_type = dgramprotocol = udpwait = yesuser = rootserver = /usr/sbin/in.tftpdserver_args = -u nobody -s /tftpboot -m /tftpboot/tftpd.remap -vvvdisable = noper_source = 11cps = 100 2flags = IPv4下图是我的xinitd方式启动TFTP的配置内容:

3.启动各服务#service dhcpd restart#service xinetd restart4.创建BCD启动文件(摘自微软官方)在此步骤中,将使用 BCDEdit 工具创建 BCD 存储。BCDEdit 工具只能在 Windows7 计算机或 Windows PE 环境中运行。BCDEdit 工具位于 \Windows\System32 目录中。1.在 Windows 7 计算机或 Windows PE 环境中,使用 BCDEdit 工具创建一个 BCD 存储。例如,Bcdedit -createstore c:\BCD2.创建 RAMDISK 设置。例如,Bcdedit -store c:\BCD -create {ramdiskoptions} /d Ramdisk options Bcdedit -store c:\BCD -set {ramdiskoptions} ramdisksdidevicebootBcdedit -store c:\BCD -set {ramdiskoptions} ramdisksdipath\boot\boot.sdi3.(可选)创建内核调试程序设置。例如,Bcdedit -store c:\BCD -create {dbgsettings} /d Debugger settings Bcdedit -store c:\BCD -set {dbgsettings} debugtype serialBcdedit -store c:\BCD -set {dbgsettings} baudrate 115200Bcdedit -store c:\BCD -set {dbgsettings} debugport 14.为 Windows PE 映射创建 OSLoader 设置。例如,Bcdedit -store c:\BCD -create /d MyWinPE Boot Image /application osloader 如果 s 命令成功,则计算机将返回 GUID 值。下列示例将此值指代为 guid1。Bcdedit -store c:\BCD -set {guid1} systemroot \WindowsBcdedit -store c:\BCD -set {guid1} detecthal YesBcdedit -store c:\BCD -set {guid1} winpe YesBcdedit -store c:\BCD -set {guid1} osdevice ramdisk=[boot]\Boot\boot.wim,{ramdiskoptions}Bcdedit -store c:\BCD -set {guid1} device ramdisk=[boot]\Boot\boot.wim,{ramdiskoptions}5.创建 BOOTMGR 设置。例如,Bcdedit -store c:\BCD -create {bootmgr} /d Windows BootManager /inherit {dbgsettings}Bcdedit -store c:\BCD -set {bootmgr} timeout 30Bcdedit -store c:\BCD -displayorder {guid1} {guid2}其中,guid1、guid2 等等是每个 .wim 文件条目对应的 GUIDS。我所使用的BCDEDIT命令如下:我把创建出来的BCD文件保存在D:\BCD这个目录下。bcdedit /createstore d:\BCD\BCDbcdedit /store D:\BCD\BCD /create {ramdiskoptions} /d Ramdisk options bcdedit /store D:\BCD\BCD /set {ramdiskoptions} ramdisksdidevice bootbcdedit /store D:\BCD\BCD /set {ramdiskoptions} ramdisksdipath \Boot\boot.sdibcdedit /store D:\BCD\BCD /create /d WinPE 3.0 32bit /application osloader 得到IDset id={ac1ab259-21dd-11e0-aee8-b8ac6fc4f993} 例如是这个IDbcdedit /store D:\BCD\BCD /set %id% systemroot \windowsbcdedit /store D:\BCD\BCD /set %id% detecthal Yesbcdedit /store D:\BCD\BCD /set %id% winpe Yesbcdedit /store D:\BCD\BCD /set %id% osdevice ramdisk=[boot]\Boot\boot32.wim,{ramdiskoptions}bcdedit /store D:\BCD\BCD /set %id% device ramdisk=[boot]\Boot\boot32.wim,{ramdiskoptions}bcdedit /store D:\BCD\BCD /create {bootmgr} /d Windows Boot Manager bcdedit /store D:\BCD\BCD /set {bootmgr} nointegritychecks yes bcdedit /store D:\BCD\BCD /set {bootmgr} timeout 0bcdedit /store D:\BCD\BCD /default %id%bcdedit /store D:\BCD\BCD /displayorder %id%下图是我的BCD文件中的内容:

还可以做成多启动,例如WinPE 32BIT和WinPE 64BIT。只需要用BCDEDIT命令修改BCD文件即可。网有很多说要修改bootmgr.exe文件的二进制内容,又说要去掉其中的MD5验证功能等,都是错误的,根本不用那么麻烦。我们只需要修改BCD文件就可以了。而Windows中提供了一个非常强大的命令来修改它,就是BCDEDIT这个命令。5.把WINPE3.0文件放到Linux TFTP Server /tftpboot 目录下。创建Boot目录#Mkdir /tftpboot/Boot把BCD、boot.sdi、boot.wim、front目录放到 /tftpboot/Boot/ 目录把pxeboot.0、bootmgr.exe、tftpd.remap放到 /tftpboot/ 目录其中tftpd.remap这个文件非常重要,这是把windows下的 \ 映射成Linux下的 / ,否则在加载BCD文件的时候就会出错,出现找不到BCD文件的提示。下图是我的/tftpboot/目录下的内容:

从网络启动,启动画面如下:

至于WinPE3.0如何制作,这种简单的问题就不用说了,用AIK或OPK就可以制作一个干净的WinPE了。bootmgr.exe/boot.sdi/boot.wim/pxeboot.0可以从AIK或OPK中获得。其中pxeboot.0就是pxebootn12.com的改名。

以后有时间我会把这部份完善。

呼唤你前往另一个地方,过上另一种生活。

Linux配置PXE Server启动WinPE3.0环境推荐

相关文章:

你感兴趣的文章:

标签云: