Deploy Windows from Linux TFTP server using PXE

# apt-get install tftpd-hpa

# apt-get install dhcp3-server

# apt-get install samba

# apt-get install cabextract

# apt-get install syslinux

# apt-get install wget

We might also want some other packages for debugging:

# apt-get install tftp-hpa

# apt-get install ethereal

# apt-get install smbclient

# cd

# wget http://oss.netfarm.it/guides/ris-linux.tar.gz

# tar xvfz ris-linux.tar.gz

# cp –a ris-linux/* /usr/local/bin

Configuring DHCP

subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.100 192.168.0.200; option broadcast-address 192.168.0.255; option routers 192.168.0.17; option domain-name-servers 192.168.0.17; option domain-name “lab2.local”; option subnet-mask 255.255.255.0; allow bootp;

host lab2-18

{ hardware ethernet 00:01:02:03:04:05; fixed-address 192.168.0.18; server-name “192.168.0.17”; next-server 192.168.0.17; filename “startrom.0”; } }

Configuring TFTP

/etc/default/tftpd-hpa:

RUN_DAEMON=”yes”

OPTIONS=”-l -s /tftpboot -m /etc/tftpd-hpa.rules -vvv”

/etc/tftpd-hpa.rules

rg \\ /

The Boot Files

# mkdir /tftpboot

# cd /tftpboot

# mount /media/cdrom

# cabextract /media/cdrom/I386/STARTROM.N1

# ln –sf startrom.n12 startrom.0

We need the NTLDR and NTDETECT.COM files as well:

# cp /media/cdrom/I386/SETUPLDR.BIN /tftpboot/ntldr

# fixloader.py /tftpboot/ntldr

# cp /media/cdrom/I386/NTDETECT.COM /tftpboot/ntdetect.com

/tftpboot/winnt.sif

[SetupData]

OsLoadOptions = “/fastdetect /minint”

SetupSourceDevice =

“\Device\LanmanRedirector\server\share\path

[UserData]

ComputerName = WindowsPE

In the SetupSourceDevice line, be sure to specify the server name, share name and path name. For example: SetupSourceDevice = “\Device\LanmanRedirector\lab2-17\RemInst\winpe”

Configuring Samba

/etc/samba/smb.conf

[global]

oplocks = false

level2 oplocks = false

encrypt passwords = true

passdb backend = tdbsam guest

obey pam restrictions = yes

guest account = nobody

invalid users = root

socket options = TCP_NODELAY

null passwords = true

[RemInst]

path = /tftpboot

browsable = true

read only = Yes

guest ok = Yes

[images]

path = /images

browsable = true

read only = Yes

guest ok = Yes

Copying the WinPE Files

# mkdir /tftpboot/winpe

# cp –a /media/cdrom/* /tftpboot/winpe

Starting the BINL Server

This uses the BINL server found in the ris-linux.tar.gz file. First you need to fix the case of some of the files in the OSD image. Edit the /usr/local/bin/fixup-repository.sh and point the REP variable at /tftpboot/winpe. Then run it.

# fixup-repository.sh

Then we need to generate a driver database. This is equivalent to the .PNF files that RIS uses. Unfortunately, as it stands, the script does not correctly deal with newer, IA64-enabled drivers. We need to make a couple of changes. There are two lines in the file that look like this:

if check[-1].startswith(‘nt’): They need to read like this.

if check[-1].startswith(‘ntx86’): Then run it:

# cd /usr/local/bin

# ./infparser.py /tftpboot/winpe/i386/inf

With the OSD image we used in the example, the result of running the command was: “Compiled 733 drivers”. Now you can run the BINL server:

# /usr/local/bin/binlsrv.py

Leave a Reply