Difference between revisions of "PXE Network Windows Installation"

From Funtoo
Jump to navigation Jump to search
(fixed broken link to PXE network boot server)
(11 intermediate revisions by the same user not shown)
Line 10: Line 10:
#A working Samba server setup
#A working Samba server setup


==Creating the Windows XP Image ==
== Creating the Windows XP Image ==


*In the previous guide, [http://www.funtoo.org/wiki/PXE_network_boot_server PXE Network Boot Server], we used /tftproot as the working directory so we will also use it in this guide for convenience. If you chose to use a different working directory then please apply it where needed in place of the /tftproot we will be going by here.
*In the previous guide, [http://www.funtoo.org/wiki/PXE_network_boot_server PXE Network Boot Server], we used /tftproot as the working directory so we will also use it in this guide for convenience. If you chose to use a different working directory then please apply it where needed in place of the /tftproot we will be going by here.
Line 16: Line 16:
First you will need to create an ISO from your Windows XP installation disc. If you already have the ISO image you may skip this step.  
First you will need to create an ISO from your Windows XP installation disc. If you already have the ISO image you may skip this step.  


<pre> dd if=/dev/sr0 of=/tftproot/winxp.iso </pre> If your cdrom device isn't /dev/sr0 please use the appropriate device in this command.
<console>
###i## dd if=/dev/sr0 of=/tftproot/winxp.iso
</console>
If your cdrom device isn't ''<code>/dev/sr0</code>'' please use the appropriate device in this command.


== Mount the ISO and Prepare Installation Sources ==
== Mount the ISO and Prepare Installation Sources ==
Mount Image to /tftproot/cdrom  
Mount the image to ''<code>/tftproot/cdrom</code>'':
<pre>mkdir /tftproot/cdrom; mount -o loop /tftproot/winxp.iso /tftproot/cdrom </pre>
<console>
Create the new directory for the network installation files and copy the needed files to it
###i## mkdir /tftproot/cdrom; mount -o loop /tftproot/winxp.iso /tftproot/cdrom
<pre> mkdir /tftproot/winxp; cp -R /tftproot/cdrom/i386 /tftproot/winxp/i386</pre>
</console>
Create the new directory for the network installation files and copy the needed files to it:
<console>
###i## mkdir /tftproot/winxp; cp -R /tftproot/cdrom/i386 /tftproot/winxp/i386
</console>
Depending on your CD/DVD copy of windows the directory name may be I386 as opposed to i386, if that is the case you will just need to change the first part of the command, keeping the new directory name i386 - this is going to be very important later on when creating the remap file!
Depending on your CD/DVD copy of windows the directory name may be I386 as opposed to i386, if that is the case you will just need to change the first part of the command, keeping the new directory name i386 - this is going to be very important later on when creating the remap file!
Check the contents of your newly created i386 directory to see if the filenames are in all CAPS or if they are already in lowercase.  
Check the contents of your newly created i386 directory to see if the filenames are in all CAPS or if they are already in lowercase.  
<pre> ls /tftproot/winxp/i386</pre>
<console>
###i## ls /tftproot/winxp/i386
</console>
If you happen to have all UPPERCASE filenames, lets go ahead and run a script to convert it to all lowercase:
If you happen to have all UPPERCASE filenames, lets go ahead and run a script to convert it to all lowercase:
<pre> cd /tftproot/winxp/i386;ls | awk '$0!=tolower($0){printf "mv \"%s\" \"%s\"\n",$0,tolower($0)}' | sh </pre>
<console>
###i## cd /tftproot/winxp/i386;ls | awk '$0!=tolower($0){printf "mv \"%s\" \"%s\"\n",$0,tolower($0)}' | sh
</console>


==Extracting and Modifying the Required Boot Files ==
==Extracting and Modifying the Required Boot Files ==
Install app-arch/cabextract
Install {{Package|app-arch/cabextract}}
<pre>emerge -av app-arch/cabextract</pre>
<console>
###i## emerge app-arch/cabextract
</console>
Extract the prepackaged drivers:
Extract the prepackaged drivers:
<pre>cd /tftproot/winxp/i386;cabextract driver.cab</pre>
<console>
Install support for a large list of network cards
###i## cd /tftproot/winxp/i386;cabextract driver.cab
<pre>
</console>
cd /tftproot/;wget http://downloads.sourceforge.net/project/bootfloppy/pxefiles.tar.gz
Install support for a large list of network cards:
tar zxvf pxefiles.tar.gz; cp pxefiles/drivers/* winxp/i386/
<console>
</pre>
###i## cd /tftproot/;wget http://downloads.sourceforge.net/project/bootfloppy/pxefiles.tar.gz
Copy the BINLSRV /INFParser tools to /tftproot
###i## tar zxvf pxefiles.tar.gz; cp pxefiles/drivers/* winxp/i386/
<pre>
</console>
cp pxefiles/script/* /tftproot/
Copy the BINLSRV /INFParser tools to /tftproot:
</pre>
<console>
###i## cp pxefiles/script/* /tftproot/
</console>
Extract the netboot startrom:
Extract the netboot startrom:
<pre>cd /tftproot; cabextract winxp/i386/startrom.n1_</pre>
<console>
###i## cd /tftproot; cabextract winxp/i386/startrom.n1_
</console>
Fix the startrom for netbooting xp:
Fix the startrom for netbooting xp:
<pre>
<console>
sed -i -e 's/NTLDR/XPLDR/gi' startrom.n12
###i## sed -i -e 's/NTLDR/XPLDR/gi' startrom.n12
mv startrom.n12 winxp.0
###i## mv startrom.n12 winxp.0
</pre>
</console>
Fix XPLDR:
Fix XPLDR:
<pre>
<console>
cabextract winxp/i386/setupldr.ex_
###i## cabextract winxp/i386/setupldr.ex_
sed -i -e 's/winnt\.sif/winxp\.sif/gi' setupldr.exe
###i## sed -i -e 's/winnt\.sif/winxp\.sif/gi' setupldr.exe
sed -i -e 's/ntdetect\.com/ntdetect\.wxp/gi' setupldr.exe
###i## sed -i -e 's/ntdetect\.com/ntdetect\.wxp/gi' setupldr.exe
mv setupldr.exe xpldr
###i## mv setupldr.exe xpldr
cp winxp/i386/ntdetect.com ntdetect.wxp
###i## cp winxp/i386/ntdetect.com ntdetect.wxp
</pre>
</console>


== Creating a remapping file ==
== Creating a remapping file ==
Create the file /tftproot/tftpd.remap and add the following to it:
Create the file <code>/tftproot/tftpd.remap</code> and add the following to it:
<pre>
{{File
|/tftproot/tftpd.remap|<pre>
ri ^[az]: # Remove “drive letters”
ri ^[az]: # Remove “drive letters”
rg \\ / # Convert backslashes to slashes
rg \\ / # Convert backslashes to slashes
Line 96: Line 114:
r ^ntdetect.wxp ntdetect.wxp
r ^ntdetect.wxp ntdetect.wxp
r ^winxp.sif winxp.sif
r ^winxp.sif winxp.sif
</pre>
</pre>}}


==Install/Configure Samba ==
==Install/Configure Samba ==
If you don't already have samba installed then:
If you don't already have {{Package|net-fs/samba}} installed, then:
<pre>
<console>
emerge -av net-fs/samba
###i## emerge -av net-fs/samba
</pre>
</console>
Create a Samba share for your tftp server in /etc/samba/smb.conf *Be sure you have the other required samba settings configured in the file
Create a Samba share for your tftp server in <code>/etc/samba/smb.conf</code>
<pre>
 
{{Note}} Be sure you have the other required samba settings configured in the file
{{File
|/etc/samba/smb.conf|<pre>
[Global]
[Global]
interfaces = lo eth0 wlan0
interfaces = lo eth0 wlan0
Line 117: Line 138:
writable = no
writable = no
guest ok = yes
guest ok = yes
</pre>
</pre>}}
Start Samba:
Start Samba:
<pre>
<console>
/etc/init.d/samba start
###i## /etc/init.d/samba start
</pre>  or if samba has already been started:
</console>   
<pre>
or if samba has already been started:
/etc/init.d/samba restart
<console>
</pre>
###i## /etc/init.d/samba restart
</console>


==Creating a Setup Instruction File==
== Creating a Setup Instruction File ==
Create a the file /tftproot/winxp.sif and add the following, replacing SAMBA_SERVER_IP with the local IP address of your samba server:
Create the file <code>/tftproot/winxp.sif</code> and add the following, replacing <tt>SAMBA_SERVER_IP</tt> with the local IP address of your samba server:
<pre>
{{File
|/tftproot/winxp.sif|<pre>
[data]
[data]
floppyless = "1"
floppyless = "1"
Line 137: Line 160:
LocalSourceOnCD = 1
LocalSourceOnCD = 1
DisableAdminAccountOnDomainJoin = 1
DisableAdminAccountOnDomainJoin = 1
 
[SetupData]
[SetupData]
OsLoadOptions = "/fastdetect"
OsLoadOptions = "/fastdetect"
; Needed for first stage
; Needed for first stage
SetupSourceDevice = "\Device\LanmanRedirector\SAMBA_SERVER_IP\tftproot\winxp"
SetupSourceDevice = "\Device\LanmanRedirector\SAMBA_SERVER_IP\tftproot\winxp"
 
[UserData]
[UserData]
ComputerName = *
ComputerName = *
</pre>
</pre>}}
 
== Editing the pxelinux.cfg/default boot menu ==
== Editing the pxelinux.cfg/default boot menu ==
Edit your boot menu so that it contains the following entry:
Edit your boot menu so that it contains the following entry:
<pre>
<console>
LABEL WinXP
LABEL WinXP
MENU LABEL Install MS Windows XP
MENU LABEL Install MS Windows XP
KERNEL winxp.0
KERNEL winxp.0
</pre>
</console>
== Re-Start all required daemons==
 
== Re-Start all required daemons ==
If the daemon isn't already running use start instead or restart in the following commands
If the daemon isn't already running use start instead or restart in the following commands
<pre>
<console>
/etc/init.d/dnsmasq restart
###i## /etc/init.d/dnsmasq restart
/etc/init.d/in.tftpd restart
###i## /etc/init.d/in.tftpd restart
</pre>
</console>
 
== Modify Binlsrv, update driver cache, and start driver hosting service ==
== Modify Binlsrv, update driver cache, and start driver hosting service ==
Change the BASEPATH= variable at or around line #62 of binlsrv.py so that it is:
Change the BASEPATH= variable at or around line #62 of ''<code>binlsrv.py</code>'' so that it is:
<pre>
{{File
|binlsrv.py|<pre>
BASEPATH='/tftproot/winxp/i386/'
BASEPATH='/tftproot/winxp/i386/'
</pre>
</pre>}}
Generate driver cache
Generate driver cache:
<pre>
<console>
cd /tftproot;./infparser.py winxp/i386/
###i## cd /tftproot;./infparser.py winxp/i386/
</pre>
</console>
Start binlservice
Start binlservice:
<pre>
<console>
./binlsrv.py
###i## ./binlsrv.py
</pre>
</console>


== Booting the client ==  
== Booting the client ==  

Revision as of 19:08, January 15, 2014

Howto use your Funtoo machine to serve a MS Windows installation over the network In this guide we will assume that you have followed the PXE network boot server Wiki article and have a working network/pxe boot setup. As of now this guide will cover Windows XP. Soon it will be expanded to also cover Windows 7.

Prerequisites

  1. A working Funtoo installation
  2. A working PXE Setup (DHCP, TFTP, PXELinux)
  3. app-arch/cabextract
  4. A legitimate copy of Microsoft Windows
  5. Driver for your NIC - Suggested to use a complete driver pack with all major supported NIC hardware for the version of Windows to be installed.
  6. RIS Linux toolkit >=0.4
  7. A working Samba server setup

Creating the Windows XP Image

  • In the previous guide, PXE Network Boot Server, we used /tftproot as the working directory so we will also use it in this guide for convenience. If you chose to use a different working directory then please apply it where needed in place of the /tftproot we will be going by here.

First you will need to create an ISO from your Windows XP installation disc. If you already have the ISO image you may skip this step.

root # dd if=/dev/sr0 of=/tftproot/winxp.iso

If your cdrom device isn't /dev/sr0 please use the appropriate device in this command.

Mount the ISO and Prepare Installation Sources

Mount the image to /tftproot/cdrom:

root # mkdir /tftproot/cdrom; mount -o loop /tftproot/winxp.iso /tftproot/cdrom

Create the new directory for the network installation files and copy the needed files to it:

root # mkdir /tftproot/winxp; cp -R /tftproot/cdrom/i386 /tftproot/winxp/i386

Depending on your CD/DVD copy of windows the directory name may be I386 as opposed to i386, if that is the case you will just need to change the first part of the command, keeping the new directory name i386 - this is going to be very important later on when creating the remap file! Check the contents of your newly created i386 directory to see if the filenames are in all CAPS or if they are already in lowercase.

root # ls /tftproot/winxp/i386

If you happen to have all UPPERCASE filenames, lets go ahead and run a script to convert it to all lowercase:

root # cd /tftproot/winxp/i386;ls | awk '$0!=tolower($0){printf "mv \"%s\" \"%s\"\n",$0,tolower($0)}' | sh

Extracting and Modifying the Required Boot Files

Install No results

root # emerge app-arch/cabextract

Extract the prepackaged drivers:

root # cd /tftproot/winxp/i386;cabextract driver.cab

Install support for a large list of network cards:

root # cd /tftproot/;wget http://downloads.sourceforge.net/project/bootfloppy/pxefiles.tar.gz
root # tar zxvf pxefiles.tar.gz; cp pxefiles/drivers/* winxp/i386/

Copy the BINLSRV /INFParser tools to /tftproot:

root # cp pxefiles/script/* /tftproot/

Extract the netboot startrom:

root # cd /tftproot; cabextract winxp/i386/startrom.n1_

Fix the startrom for netbooting xp:

root # sed -i -e 's/NTLDR/XPLDR/gi' startrom.n12
root # mv startrom.n12 winxp.0

Fix XPLDR:

root # cabextract winxp/i386/setupldr.ex_
root # sed -i -e 's/winnt\.sif/winxp\.sif/gi' setupldr.exe
root # sed -i -e 's/ntdetect\.com/ntdetect\.wxp/gi' setupldr.exe
root # mv setupldr.exe xpldr
root # cp winxp/i386/ntdetect.com ntdetect.wxp

Creating a remapping file

Create the file /tftproot/tftpd.remap and add the following to it:

   
{{{body}}}

Install/Configure Samba

If you don't already have net-fs/samba installed, then:

root # emerge -av net-fs/samba

Create a Samba share for your tftp server in /etc/samba/smb.conf

   Note

{{{1}}}

Be sure you have the other required samba settings configured in the file

   
{{{body}}}

Start Samba:

root # /etc/init.d/samba start

or if samba has already been started:

root # /etc/init.d/samba restart

Creating a Setup Instruction File

Create the file /tftproot/winxp.sif and add the following, replacing SAMBA_SERVER_IP with the local IP address of your samba server:

   
{{{body}}}

Editing the pxelinux.cfg/default boot menu

Edit your boot menu so that it contains the following entry:

LABEL WinXP
	MENU LABEL Install MS Windows XP
	KERNEL winxp.0

Re-Start all required daemons

If the daemon isn't already running use start instead or restart in the following commands

root # /etc/init.d/dnsmasq restart
root # /etc/init.d/in.tftpd restart

Modify Binlsrv, update driver cache, and start driver hosting service

Change the BASEPATH= variable at or around line #62 of binlsrv.py so that it is:

   
{{{body}}}

Generate driver cache:

root # cd /tftproot;./infparser.py winxp/i386/

Start binlservice:

root # ./binlsrv.py

Booting the client

If all is well, you should be able to boot the client choosing to boot from network in the boot options, you should get to your PXELinux bootloader, and see the Install Windows XP option after pressing enter you *should* kick off your XP installation via network!! Congratulations!