{"id":78,"date":"2013-03-22T18:33:48","date_gmt":"2013-03-22T17:33:48","guid":{"rendered":"http:\/\/www.gadgetdude.co.uk\/blog\/?p=78"},"modified":"2016-01-16T21:57:07","modified_gmt":"2016-01-16T20:57:07","slug":"network-boot-windows-pe-from-linux","status":"publish","type":"post","link":"https:\/\/www.gadgetdude.co.uk\/blog\/?p=78","title":{"rendered":"Network Boot Windows PE from linux"},"content":{"rendered":"<div style=text-align:left;><a class=\"wpptopdfenh\" target=\"_blank\" rel=\"noindex,nofollow\" href=\"https:\/\/www.gadgetdude.co.uk\/blog\/?p=78&#038;format=pdf\" title=\"Download PDF\"><img alt=\"Download PDF\" src=\"https:\/\/www.gadgetdude.co.uk\/blog\/wp-content\/plugins\/wp-post-to-pdf-enhanced\/asset\/images\/pdf.png\"><\/a><\/div><p>Windows PE ( Preboot Environment ) is a cut down operating system that allows you to install 32-bit and 64-bit versions of Windows on new hardware. This was first introduced with Windows Vista and is now part of Windows 7.<\/p>\n<p>To create a Windows PE environment you need to download the Windows AIK and install it.<br \/>\nOnce installed you should see a \u201cMicrosoft Windows AIK\u201d group in your programs. Open the \u201cDeployment Tools Command Prompt\u201d ( Note : If you are running this on Windows 7 press your right mouse button and run it as an administrator )<br \/>\nCreating a Dual Boot Image ( 32-bit and 64-bit )<br \/>\nIn order to dual boot we need to have the main boot image for both 32-bit and 64-bit systems. To create the 64-bit boot image do the following:<br \/>\n<code>mkdir c:\\Temp<br \/>\ncall copype.cmd AMD64 c:\\Temp\\Boot64<br \/>\ncopy winpe.wim c:\\Temp\\winpe_x64.wim<\/code><br \/>\nNow close the window and open a new \u201cDeployment Tools Command Prompt\u201d.<br \/>\nThis time we will get the 32-bit boot image and the other files needed. To do this use the following commands :<br \/>\ncall copype.cmd x86 C:\\Temp\\Boot<br \/>\ndel \/Q etfsboot.com<br \/>\nmove ISO\\boot\\boot.sdi boot.sdi<br \/>\nrmdir \/S \/Q ISO<br \/>\nimagex \/mount winpe.wim 1 mount<br \/>\ncopy mount\\Windows\\Boot\\PXE\\pxeboot.n12 pxeboot.n12<br \/>\ncopy mount\\Windows\\Boot\\PXE\\bootmgr.exe bootmgr.exe<br \/>\ncopy mount\\Windows\\System32\\bcdedit.exe bcdedit.exe<br \/>\nimagex \/unmount mount<br \/>\nrmdir \/Q mount<br \/>\nren winpe.wim winpe_x86.wim<br \/>\ncopy c:\\Temp\\winpe_x64.wim .\/<br \/>\nWhat this does is to create a 32-bit image, pulls the network boot files and boot editor from that image and finally copies the 64-bit boot file into the same directory.<br \/>\nThe next bit that is needed is to create the BCD file. This has been simplified by using the following batch file. This will give you the option to choose either 32-bit or 64-bit PE environment.<\/p>\n<p>echo *** Creating WinPE BCD (boot configuration data) File<br \/>\nset BCDFILE=BCD<br \/>\nBcdedit -createstore &#8220;%BCDFILE%&#8221;<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -create {ramdiskoptions} -d &#8220;Ramdisk options&#8221;<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set {ramdiskoptions} ramdisksdidevice boot<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set {ramdiskoptions} ramdisksdipath \\Boot\\boot.sdi<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -deletevalue {ramdiskoptions} description<\/p>\n<p>rem 32Bit<br \/>\nfor \/f &#8220;tokens=1-3&#8221; %%a in (&#8216;Bcdedit -store &#8220;%BCDFILE%&#8221; -create -d &#8220;Windows PE 32-Bit&#8221; -application osloader&#8217;) do set guid1=%%c<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid1% systemroot \\Windows<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid1% detecthal Yes<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid1% winpe Yes<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid1% description &#8220;Windows PE 32-Bit&#8221;<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid1% osdevice ramdisk=[boot]\\Boot\\winpe_x86.wim,{ramdiskoptions}<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid1% device ramdisk=[boot]\\Boot\\winpe_x86.wim,{ramdiskoptions}<\/p>\n<p>rem 64Bit<br \/>\nfor \/f &#8220;tokens=1-3&#8221; %%a in (&#8216;Bcdedit -store &#8220;%BCDFILE%&#8221; -create -d &#8220;Windows PE 64-Bit&#8221; -application osloader&#8217;) do set guid2=%%c<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid2% systemroot \\Windows<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid2% detecthal Yes<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid2% winpe Yes<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid2% description &#8220;Windows PE 64-Bit&#8221;<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid2% loadoptions ramdisk=[boot]\\Boot\\winpe_x64.wim,\\&#8221;DISABLE_INTEGRITY_CHECKS&#8221;<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid2% osdevice ramdisk=[boot]\\Boot\\winpe_x64.wim,{ramdiskoptions}<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set %guid2% device ramdisk=[boot]\\Boot\\winpe_x64.wim,{ramdiskoptions}<\/p>\n<p>rem Setup Bootmanager<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -create {bootmgr} -d &#8220;Windows 7 BootManager&#8221;<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set {bootmgr} timeout 10<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -set {bootmgr} displayorder %guid1% %guid2%<br \/>\nBcdedit -store &#8220;%BCDFILE%&#8221; -enum all<br \/>\nThis will create the boot file (BCD) and at the end show you the boot manager configuration.<br \/>\nYou will then have the following files in your Boot directory<br \/>\nBCD BCD.LOG boot.sdi winpe_x64.wim<br \/>\nbcdedit.exe bootmgr.exe pxeboot.n12 winpe_x86.wim<br \/>\nYou can safely delete the file bcdedit.exe as that is not longer needed.<br \/>\nAll the other files need to be copied to your tftp server into a folder called \u201cBoot\u201d ( This is case sensitive ). So on a linux tftp server this will be located in \/tftpboot\/Boot.<\/p>\n<p>Linux TFTP server configuration<br \/>\nAs linux uses \u201c\/\u201d and Windows uses \u201c\\\u201d we need to configure the linux tftp server to substitute the slashes in order for it to work.<br \/>\nFirstly you need to edit the \/etc\/xinetd.d\/tftp file to pass an argument to the server.<br \/>\nThe existing line will probably be<br \/>\nserver_args = -s \/tftpboot<br \/>\nthis needs to be changed to the following<br \/>\nserver_args = -s \/tftpboot -m \/etc\/tftpd.map \u2013vv<br \/>\nNote : The \u201c-vv\u201d at the end is purely for debugging so you can trace what files are downloaded in the linux \/var\/log\/messages file. You can remove this once you are happy everything is all working.<br \/>\nNext you need to create \/etc\/tftpd.map and put the following lines in it<br \/>\n# Convert backslashes to slashes<br \/>\nrg \\\\ \/<br \/>\nOnce you have created the file you need to restart the xinetd daemon typing the following command in as \u201csu\u201d<br \/>\nservice xinetd restart<br \/>\nYour tftp server is now ready to use.<br \/>\nDHCP Boot line<br \/>\nOn your DHCP server you need to tell it which server and what file the system needs to network boot. Usually for a linux network boot you will have the following two lines in the dhcp description<br \/>\nnext-server 143.234.96.47;<br \/>\nfilename &#8220;pxelinux.0&#8221;;<br \/>\nthe first line tells the system which server it needs to network boot from , the second line tells it what it needs to boot.<br \/>\nIn order to boot the Windows PE environment you need to set the filename to boot as this<br \/>\nfilename &#8220;\\\\Boot\\\\pxeboot.n12&#8221;;<br \/>\nThis basically tells the system to boot the file from the \\Boot folder of your tftp server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows PE ( Preboot Environment ) is a cut down operating system that allows you to install 32-bit and 64-bit versions of Windows on new hardware. This was first introduced with Windows Vista and is now part of Windows 7. To create a Windows PE environment you need to download the Windows AIK and install [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[],"_links":{"self":[{"href":"https:\/\/www.gadgetdude.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/78"}],"collection":[{"href":"https:\/\/www.gadgetdude.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gadgetdude.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gadgetdude.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gadgetdude.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78"}],"version-history":[{"count":1,"href":"https:\/\/www.gadgetdude.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":102,"href":"https:\/\/www.gadgetdude.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions\/102"}],"wp:attachment":[{"href":"https:\/\/www.gadgetdude.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gadgetdude.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gadgetdude.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}