Table of Contents

Adding a gPXE ROM image directly into a VMware virtual machine

Overview

While most all other deployment methods will work well for VMware or any other hypervisor for booting your VM with gPXE, adding a ROM image directly to your VM's configuration file avoids the obscurity encountered when chainloading gPXE from a mounted CD ISO or Floppy image file, and likewise avoids the overhead, complexity, and potential modification of your infrastructure that's required to chainload gPXE from the VM's existing PXE ROM. Furthermore, while any VM whose host that can access the ROM file can share it to avoid large numbers of duplicate ROM files in your datastore, you can also embed scripts into individual ROM files as you add them to a VM, removing the need for you to configure advanced DHCP options on a per-client basis or maintain and secure a centralized script repository.

Not only is using a ROM one of the fastest methods of loading and booting from gPXE on either a physical or virtual machine, adding a ROM in this fashion adds gPXE directly to your VM's BIOS boot order, and when compared to the PXE chainloading, CD, floppy, or USB based methods it is quite possibly the most secure and concise deployment method available right now.

gPXE as a boot option in VMware Workstation

Implementation

Here, we're going to manually edit the VM's configuration file to:

Acquire the binary ROM image file

> Option 1 (Easier): Use a pre-built binary from ROM-o-Matic


A screenshot of the data you'd fill out in ROM-o-Matic Acquire a pre-built ROM from gPXE's ROM-o-Matic for the Intel E1000 NIC. The VENdor and DEVice ID codes for the E1000 are 8086 (signifying Intel's PCI Vendor code) and 100f (for the Device code).

  1. Output format: ROM binary (flashable) image (.rom)
  2. NIC type: e1000_82540
  3. PCI Vendor Code: 8086
  4. PCI Device Code: 100f
gpxe-1.0.0+-8086100f.rom

> Option 2 (Advanced): Compile the binary ROM from source


Building from source is obviously more complicated. However, if you have a Linux machine and are comfortable building from source code, follow the instructions here to download the gPXE source.

user@user-ubuntu:~/gpxe-1.0.0+$ cd gpxe/src/
user@user-ubuntu:~/gpxe-1.0.0+/gpxe/src$ make bin/8086100f.rom 
   ....build process output....
[FINISH] bin/8086100f.rom
rm bin/8086100f.rom.bin bin/8086100f.rom.zbin bin/8086100f.rom.zinfo
user@user-ubuntu:~/gpxe-1.0.0+/gpxe/src$
user@user-ubuntu:/home/user/gpxe-1.0.0+/gpxe/src# cp bin/8086100f.rom /home/user/Virtual\ Machines/WinXP/

Once you've copied the ROM image file to your VM directory, skip to the section on editing the .vmx file below.

Locating the VM's .vmx configuration file

Now we need to locate and edit the configuration file for the VM we wish to add the gPXE ROM image to.

VMware Workstation showing the location of our target VM's .vmx configuration file.

D:\Virtual Machines\Windows XP Professional PicoTest

vmx-file.jpg

Note: If you don't see a file ending in .vmx like the example above, but instead see a bunch of files with identical names and no “.xxx” on the end, your operating system may be set to hide file extensions.
To turn on display of file extensions in Windows Vista or newer, follow the steps here. In Windows XP or earlier, follow this guide instead.

Copy the ROM image to the VM directory

Now, you need to copy the ROM image so that it resides in the same directory as as your .vmx file.

rom-copied.jpg

Editing the .vmx file

Now we need to open the .vmx file in your text editor of choice. Unfortunately for us, .vmx files are set to open with VMware Workstation by default, so, if you're using Windows, you need to right click the .vmx file and click “Open With…”.
If a sub-menu comes up from clicking “Open With”, click “Choose Default Program…“
open-with-dialog.jpg
In the “Open With” dialog that appears, select Notepad (or your favorite text editor) from the list. You may have to expand the “Other Programs” section to find it. After you select Notepad from the list, if you do not desire manual editing of .vmx files to be the default behavior when you double click on them, uncheck the “Always use the selected program to open this kind of file” box at the bottom-left of the dialog.
open-with-notepad-selected.jpg

Once your text editor opens, take a look at the information you see in the .vmx file. You are going to add lines to the file, and they can go anywhere in the file, so if you like, just go to the last line and press Enter to insert another line. If you'd like to keep things neater, you can find the lines that reference ethernet0 and insert them there.

ethernet0.virtualDev = "e1000"
e1000bios.filename = "gpxe-1.0.0+-8086100f.rom"

Note: The text “gpxe-1.0.0+-8086100f.rom” corresponds to the file that you downloaded from ROM-o-matic and then copied to the VM's folder in the above steps. Your ROM's filename will likely be slightly different.

Example of edited .vmx file

Finishing up

Go back into VMware Workstation and start up your VM. You can press the ESC key during POST to bring up the boot menu and/or enter the VM's BIOS. If gPXE shows up as a boot option, you're done!

gPXE as a boot option in VMware Workstation

Congratulations, and enjoy your ROM-Based installation of gPXE!

Drivers

Most modern operating systems (Windows Vista/Server 2008 and newer and more recent versions of various Linux distros) include drivers for the Intel E1000 series NICs by default. However, if your guest OS is 32 bit Windows XP or Windows Server 2003, you may need to download additional driver files from Intel's web site here.

Considerations

The downside to this method when compared with PXE chainloading is that it does require you to change the NIC in your VM. If you have any application or service running in that VM where a NIC “swap” would be a problem, you may want to consider a less disruptive method of introducing gPXE into your environment. It is worth pointing out that, considering the poor native driver support offered to PCNET32 or VMXNET NICs at this time, a PXE chainload that utilizes the UNDI driver is the best bet in those situations, but overhauling your DHCP/ProxyDHCP deployment might likely be a more time consuming task than reinstalling a VM's NIC.

Performing this procedure may cause VMware to generate a new MAC address for the virtual NIC. You can permanently assign a MAC address either via the Workstation GUI (right click your VM, click “Settings” and select your network adapter) or by changing lines in the .vmx configuration file.

Notes for Advanced users