Vous êtes sur la page 1sur 6

How to Automatically Install FreeBSD Using WDS and PXELINUX IRTNOG

Skip to content. | Skip to


navigation

Site Map

Accessibility

Contact
Search Site

Search

Advanced
Search

IRTNOG
Sections

Home

About Us
Legal Notices
News
Events

Personal

Log in
tools

You are here: Home Documentation How-tos How to Automatically Install FreeBSD Using WDS
and PXELINUX
Document

Actions

How to Automatically Install FreeBSD Using WDS


and PXELINUX
This How-to applies to: FreeBSD 6.x, Windows Server 2003, Windows SBS 2003
The FreeBSD installation diskettes or "boot-only" CD can be converted into a hard disk image and booted via
PXE using the PXELINUX and MEMDISK utilities. The boot loader and images can then be hosted by a
Microsoft Windows Deployment Services (WDS) or Remote Installation Services (RIS) installation. Further
customizations are possible, such as unattended installation and local distribution of the installation files.
The examples are based on FreeBSD/i386 6.2-RELEASE and Microsoft Windows Small Business Server 2003
R2 Service Pack 2. For additional background information, see the following web sites:

Convert FreeBSD ISO image for PXE bootstrap


PXELINUX and Microsoft RIS
MEMDISK documentation
Booting FreeBSD via PXE
Network-, Memory-, and File-Backed File Systems

Limitations
http://web.irtnog.org/doc/how-to/freebsd-install-pxe-wds (1 of 6) [12/4/2009 5:22:14 PM]

How to Automatically Install FreeBSD Using WDS and PXELINUX IRTNOG

Windows Deployment Services must be running in "Legacy" or "Mixed" mode.


A method for adding the PXELINUX boot loader as a WDS boot image is not known at this time. For
instructions on how to configure WDS in one of these modes, see the Windows Deployment Services
Update Step-by-Step Guide for Windows Server 2003. Note that this requires the addition of a RISetup
image (e.g., Windows XP) to the WDS server via the "Windows Deployment Services Legacy" wizard
prior to authorizing and configuring WDS with the "Windows Deployment Services" management
console. This image can be removed from server after adding the FreeBSD RISetup image.
Change the default boot program if not using any Windows PE boot images.
If WDS is running in mixed mode and there are no Windows PE boot images, PXE clients will return a
"file not found" error because the default boot program "boot\x86\pxeboot.com" is missing. Either
change the default boot program to "OSChooser\i386\startrom.com" in the WDS server properties
(which is the legacy RIS boot program), or add a Windows PE boot image (which you can find in the
Windows Automated Installation Kit).
FreeBSD's pxeboot should not be used.
The pxeboot loader obtains all of its configuration information from DHCP, conflicts with the DHCP
settings required by WDS/RIS. (It would be nice if pxeboot could be hacked to pass the hostname and
domain administrator credentials from the RIS environment to the FreeBSD installer.)
MEMDISK must be called with the "noedd" option.
Enhanced disk device support appears to be incompatible with the FreeBSD boot loader, based on the
authors experience (limited to testing the boot code in FreeBSD/i386 6.2-RELEASE).
Proper drive geometry calculations are necessary.
If the correct geometry is not specified when attaching the hard disk image as an md-style block
device, fdisk and disklabel may not guess the correct geometry. This will cause these tools to
misrepresent the total size of the disk image, which can cause problems for newfs, the boot loader, and
MEMDISK.
The hard disk image is not available once FreeBSD boots.
The image, along with the MEMDISK program, its INT 13h and INT 15h BIOS hooks, and the entire PXE/
UNDI stack, are deleted from memory once the FreeBSD kernel starts up and transitions to enhanced
mode. In order to include additional tools or utilities with the FreeBSD installation program, one must
modify the "mfsroot" image (similar to the Linux initrd), which is located inside of the hard disk image.

Modifications to the "RemInst" Share Point


Once RIS or WDS is installed and configured, create the following folders in the "RemInst" share point with
commands similar to the following (e.g., German users would have to use "Setup\German\Images\FreeBSD"
etc.):
mkdir
mkdir
mkdir
mkdir

Setup\English\Images\FreeBSD
Setup\English\Images\FreeBSD\i386
Setup\English\Images\FreeBSD\i386\templates
Setup\English\Images\FreeBSD\i386\pxelinux.cfg

Next, create the file "Setup\English\Images\FreeBSD\i386\templates\freebsd62.sif". Use the following for its
contents:
[RemoteInstall]
http://web.irtnog.org/doc/how-to/freebsd-install-pxe-wds (2 of 6) [12/4/2009 5:22:14 PM]

How to Automatically Install FreeBSD Using WDS and PXELINUX IRTNOG

Repartition = Yes
UseWholeDisk = Yes
[OSChooser]
Description ="FreeBSD/i386 6.2-RELEASE"
Help ="Automatically installs FreeBSD/i386 6.2-RELEASE without prompting the user
for input."
LaunchFile = "%INSTALLPATH%\%MACHINETYPE%\pxelinux.0"
ImageType = Flat
Version = "6.2 (0)"

Scripting the Installation


TBD.

The Hard Disk Image


These instructions create the hard disk image from the boot floppy set included with the FreeBSD release, as
Advertisements
this minimizes the image size (and thus minimizing the amount of data that must be transferred during the
PXE boot process). The procedure for creating the image is based loosely (and somewhat blindly) on the boot
floppy set creation procedure used by the FreeBSD "make release" process. Execute the following Bourne
shell commands while logged into the "root" user account on a FreeBSD workstation (or copy the commands
to a file and execute them using the Bourne shell).

Navigation

Home

Members

Documentation

FAQs

How-tos

Download the boot floppy set using commands similar to the following (change ARCH, RELEASE, or BASE as
appropriate):
ARCH=$1; shift;
if [ "x${ARCH}" = "x" ];
then ARCH="`uname -m`";
fi
RELEASE=$1; shift; if [ "x${RELEASE}" = "x" ]; then RELEASE="`uname -r`"; fi
BASE="ftp://ftp.freebsd.org/pub/FreeBSD/releases/${ARCH}/${RELEASE}/floppies"
fetch "${BASE}/boot.flp"
i=1; while (fetch "${BASE}/kern${i}.flp"); do i=`expr $i + 1`; done

How to
Automatically
Install
Extract the contents of the boot floppy set using the following commands:
FreeBSD
Using WDS ## create some working directories
mkdir data
and
mkdir mnt
PXELINUX
## extract contents of boot floppy

MD=`mdconfig -a -t vnode -f boot.flp`


Tutorials
mount /dev/${MD} mnt

cp -R mnt/* data
Links
umount /dev/${MD}
mdconfig -d -u ${MD}
Technical Support
## extract contents of kernel floppies
i=1
Tips and Tricks (old)
while ([ -e "kern${i}.flp" ])
do

http://web.irtnog.org/doc/how-to/freebsd-install-pxe-wds (3 of 6) [12/4/2009 5:22:14 PM]

How to Automatically Install FreeBSD Using WDS and PXELINUX IRTNOG

Software

News

Events

MD=`mdconfig -a -t vnode -f "kern${i}.flp`


mount /dev/${MD} mnt
cp -R mnt/* data
umount /dev/${MD}
mdconfig -d -u ${MD}
i=`expr ${i} + 1`
done
Reconstruct the split kernel image with the following commands:
cat data/kernel.gz.boot data/kernel.gz.?? > data/kernel.gz
rm data/kernel.gz.*
Remove the diskette prompt prior to loading the "acpi.ko" module with the following commands:
grep -v acpi_before data/boot/loader.conf > loader.conf.new
mv loader.conf.new data/boot/loader.conf

Optional:
Add the customized installation script (plus any supporting files) to
the "mfsroot" image with the following commands:
TBD.
Calculate the size of the new hard disk image, being careful to round up to align with cylinder/track/sector
boundaries:
FLPSIZ=`du -sk data | awk '{print $1}'`
FLPSIZ=`expr ${FLPSIZ} \* 1024`
IMGSIZ=0
i=0
while ([ ${FLPSIZ} -gt ${IMGSIZ} ])
do
i=`expr ${i} + 2`
IMGSIZ=`expr ${i} \* 16 \* 63 \* 512`
done
CYL=${i}
TRK=16
# heads per cylinder
SEC=63
# sectors per head
SECSIZ=512
# bytes per sector
Also calculate the number of inodes needed in the new file system with the following commands:
NUMFILES=`find data | wc -l`
NUMINODS=`expr ${FLPSIZ} \/ ${NUMFILES}`
Create and mount the new hard disk image with the following commands:
http://web.irtnog.org/doc/how-to/freebsd-install-pxe-wds (4 of 6) [12/4/2009 5:22:14 PM]

How to Automatically Install FreeBSD Using WDS and PXELINUX IRTNOG

dd if=/dev/zero of=pxeboot.img bs=${IMGSIZ} count=1


MD=`mdconfig -a -t vnode -f pxeboot.img -y ${TRK} -x ${SEC} -S ${SECSIZ}`
fdisk -BIv /dev/${MD}
disklabel -w -B /dev/${MD} auto
newfs -O1 -i ${NUMINODS} -b 4096 -f 512 -o space -m 0 -n /dev/${MD}a
mount /dev/${MD}a mnt
Copy the boot files over to the image with the following command:
cp -R data/* mnt
Dismount and compress the image with the following commands:
umount mnt
mdconfig -d -u ${MD}
gzip -9 pxeboot.img
Copy the file "pxeboot.img.gz" to the directory "Setup\English\FreeBSD\i386" on the RIS/WDS server.

PXELINUX and MEMDISK


PXELINUX downloads MEMDISK plus the hard disk image created above, loads them both together into
memory, and runs MEMDISK. MEMDISK hooks BIOS interrupts 13h (disk access) and 15h (memory info) and
uses the image to emulate the first BIOS floppy drive or hard disk drive, as appropriate. Then it runs the
contents of the image's boot sector. The real-mode boot program uses the BIOS I/O routines to continue
loading itself from what it thinks is a real hard disk image, before transitioning to the operating system
kernel. In this example, the boot program is the FreeBSD BTX loader, and the kernel is FreeBSD/i386 6.2RELEASE.
To complete the configuration of the RIS/WDS boot image, install SYSLINUX. First, download the latest
version of SYSLINUX (which includes PXELINUX and MEMDISK) from www.kernel.org (version 3.36 at the time
this was written). Next, extract the files "pxelinux.0" and "memdisk\memdisk", and copy them to the
directory "Setup\English\Images\FreeBSD\i386" on the RIS/WDS server. Finally, create the file "Setup\English
\Images\FreeBSD\i386\pxelinux.cfg\default". Use the following for its contents:
DEFAULT memdisk initrd=pxeboot.img.gz harddisk noedd
PROMPT 0
NOESCAPE 1

Testing
At this point, you should be able to perform a PXE boot from another server or workstation, select "FreeBSD/
i386 6.2-RELEASE" from the RIS boot menu, and launch the FreeBSD sysinstall program (or your scripted
installation). Bear in mind that this will reset the domain account of that server or workstation.
by Matthew X. Economou last modified 2007-10-02 09:41
http://web.irtnog.org/doc/how-to/freebsd-install-pxe-wds (5 of 6) [12/4/2009 5:22:14 PM]

How to Automatically Install FreeBSD Using WDS and PXELINUX IRTNOG

Log in to add comments

Use of this system constitutes consent to security monitoring and testing.


All activity is logged with your IP address and other individually identifying information (if available).
Unless otherwise specified, except for members' directories this work is licensed under a Creative
Commons Attribution-ShareAlike 3.0 License.
The Plone CMS Open Source Content Management System is Copyright 2000-2009 by the Plone
Foundation et al.
Plone and the Plone logo are registered trademarks of the Plone Foundation. Distributed under the GNU
GPL license.
Powered by Plone CMS, the Open Source Content Management System
This site conforms to the following standards:

Section 508
WCAG
Valid XHTML
Valid CSS
Usable in any browser

http://web.irtnog.org/doc/how-to/freebsd-install-pxe-wds (6 of 6) [12/4/2009 5:22:14 PM]

Vous aimerez peut-être aussi