Subscribe to feed

Using VMware to Build and Run XP Embedded

XP Embedded Studio isn’t actually a horrible application at it’s core.  Now, the user interface and documentation are God-awful, which is why I’m writing this post.  As you saw in my last two entries, I’ve been working with XPe for the last few days, and there has been plenty of frustration to go along with it.  What should have been a fifteen minute task wound up taking several days.  However, one week and a few dozen BSODs later, I present this how to:

The idea here is to use VMware to not only run, but create your XPe images, though you could easily do the development in your host environment with only minor changes to these directions.

Step 1: Prepare your development environment

First, let’s get the virtual machines set up.  You’ll need at least two, one for doing the development, and another to test the image.  The first image is just a regular Windows XP virtual machine.  I already had a Windows XP Pro virtual machine that I use on a daily basis, so I just used that.  You’ll need to set up the Windows XP Embedded development environment.  If you don’t already have it, you can download a 30 day evaluation copy from Microsoft.

Now, go ahead and create the second virtual machine, which you will use to run your XPe image.  Create a new VM in VMware and choose Windows XP Professional as the Guest OS. (Note: If you are using WS 6.5 or later, you don’t want to use easy install.  Choose to install the guest OS later.)  I selected some pretty basic specs for the VM:

  • Memory: 256MB
  • Processors: 1
  • Hard Disk (IDE 0:0): 512MB

It doesn’t take much to run XPe, and those listed specs should be fine unless you’ll be putting a lot of data on the image.

Now that your VM is created, you need to add it’s hard drive to your original XP VM.  Make sure your XP VM is shut down, then open the Virtual Machine Settings dialog and click Add.  Choose to add a new Hard Disk, and when prompted, choose to add an existing virtual disk.  Navigate to your XP Embedded Virtual Machine and choose the vmdk associated with it.  After it has been added, open the Advanced properties for that disk and make it Independent and Persistent.

Step 2: Load a profile of your virtual hardware

This was the part that gave me grief.  Fortunately for you, you can benefit from my experience.  You need a profile of the hardware you will be running XPe on so that XPe knows which drivers to load.

Step 2a: The easy way

I have prepared a component for Windows XPe that will automatically load in a set of generic drivers that are capable of running on VMware virtual hardware version 6, which is the version used in Workstation 6.0.  If you are using Workstation 6.5, it uses version 7 of VMware’s virtual hardware.  Chances are you’ll still be able to use my component, and you should definately try it.

Download my XPe VMware Component

You’ll need to install the .sld file using the Component Database Manager.

If you ultimately wind up with an unbootable XPe image, you’ll want to come back and perform the steps in 2b, but for now, proceed to step 3.

Step 2b: The not-so-easy way

So, you need to create your own profile for your virtual machine.  First, you’ll want to create a third VM.  Again, it should be Windows XP Professional, and the hardware should be as similar to your XPe VM as possible, though you’ll need more hard drive space.  I wound up needing about 1.5GB of disk space for this step, but it wouldn’t be a bad idea to allocate more just in case.

Install Windows XP Professional (Professional is important here) on the new virtual machine.  It’s very important that you DO NOT install VMware tools on this VM (This gave me trouble during my experimenting).  This means that if you’re using VMware 6.5 or later, you need to install the OS manually and not use Easy Install. (Note: You don’t need to bother activating this VM if you don’t want to, you’ll only need it for a minute.)

Once you have a vanilla installation of XP Pro up and running, you’ll need some of the XPe tools.  Go back to that link I posted near the beginning of this post and download and run the XPe downloader again.  This time, you only need the Windows XP Embedded SP1 Tools package, which is around 7 MB.

Let that download and start(You may get a warning, ignore it), then choose to Browse the CD.  Open the fodler named XPE and look for a file named TAP.EXE (Or probably just TAP, as XP will hide the file extensions by default).  Double-click it and it will run, leaving behind a file named devices.pmq in that same directory.  Now you need to get that pmq file back to your original XP VM where you’re doing the XPe development.  I just opened Internet Explorer and Gmailed it to myself.  Once you have the pmq file, you don’t need this extra VM anymore and you can delete it.

Back in your original VM, grab your devices.pmq file and put it somewhere on the hard drive.  Now open Microsoft Component Designer and choose File > Import and open devices.pmq.  Go through the import process, then if you want you can give your component a name and other info.  Finally, save the component as a *.sld file and then import that sld using the Component Database Manager.  Now your component should be available when building XPe images.

Step 3: Create the Image

Open the XPe Target Designer and start a new project.  On the left hand side of the window, you should see a list of components, including the VMware hardware profile that you either downloaded from me or created yourself.  Double click it to add it to the project.

Now, press F5 to perform a dependency check.  It will run through and automatically add most of the needed components, but it will need your input on a few of them.  If you are using my profile, you should wind up with 6 errors, which will be displayed at the bottom of the screen.  For each item, double click the icon next to it to see the list of available components that will satisfy that dependency.  Choose the components that best suit your need, but for a standard set up, I recommend using the following whenever they come up as options:

  • NT Loader
  • FAT
  • Windows Logon

After all of the dependencies are taken care of, it’s time to… run another dependency check!  For some reason, Microsoft doesn’t do recursive dependency checking here.  Press F5 again, and wait for it to finish.  At this point there should be one more error, the shell.  Handle this one just like the last set.  For a standard set up, I’d recommend just using the Explorer Shell.

Continue to run dependency checks until it comes back with no errors.

You’re almost there.  At this point, it’s a good idea to save your work.

Step 4: Prepare the virtual disk

Open up XP’s built in disk manager and find your XPe VM’s hard drive that you attached to your original XP VM.  Make sure it is initialized, then partition and format the entire disk as FAT32.

You’ll also need to make sure that the partition is marked as bootable.  You can do this however you like, I booted the VM to an Ubuntu Live CD and used the built in partition editor.

Step 5: Build XP Embedded

Back in the Target Designer, you need to build the XPe image.  To do this, press F7.  For build type, choose Release.  For Destination, enter the path where your XPe VM’s is mounted, for example, D: or E:.  Note that it will be mounted at C: in XPe.  Finally, press Build.  If all goes well, you will get no errors, and maybe a warning or two.

Step 6: Run it

Only one VM can access a particular vmdk at a time, so you’ll want to suspend your XP VM now.  Once that’s done, switch over to your XPe VM and power it on.  If you’ve done everything correctly, you should be a Windows XP Embedded loading screen, then the First Boot Assistant, after which it will boot into your embedded environment.

Congratulations! You now have a minimal XPe system that is capable of running on virtual hardware.  In order to add additional components to your XPe image, shut down the VM and resume your original XP VM.  Modify the image as you see fit, then reformat the target disk and build again.  There shouldn’t be a need to mark the partition as bootable again.

If your XPe image crashed, you’ll need to do some debugging.  If you were using my pre-made profile, go back to Step 2b and create a profile yourself.  This should be guaranteed to work, but if not, I’d start by checking for information on MSDN.  If your image is crashing with a BSOD, try Googling the error number and seeing what you get.

9 Responses to “Using VMware to Build and Run XP Embedded”

  1. Thanks for posting this… following your instructions I was able to get a VM running with XPe on it for testing our product without having to learn all about building XPe.

    BTW, I was able to dispense with the XP image for development by using the vmware-mount (http://www.vmware.com/download/eula/diskmount_ws_v55.html) utility. The only caveat was the vmdk had to be formatted fat32 first — which I did with an existing Win2003 vm I already had

  2. Thanks. It’s very useful article.
    I’ve created VM successfully with NTFS as well.

  3. can we use VMWare Workstation 5.5 to create Windows XPe VM image?

  4. I’m not sure, I never tried it with a version lower than 6.0. I don’t see why not, though.

  5. HI Zach Tibbitts:
    can you attach the picture ,I use the VM,but creat failed,because i’m a novice,Thank you !
    And how can copy the image file to the HDisk for VM!

  6. I don’t have any screenshots, as it was almost a year ago that I wrote this. Getting the HD image over to the new VM shouldn’t be a problem though, as you create the image on your host machine, and then connect it to each VM as it’s needed.

  7. Zack – Great article – much better than anything I found on MSDN. It still took me a few days to figure things out, but I was able to create a VM of XPe. Your article was a huge help

    I still have one problem though. I’ve created several VM’s of XPe at this point, but they all have a problem – any setting changes to the OS or programs that I install aren’t persisting after I reboot. I end up right back at square one with a clean XPe image after the reboot.

    I’ve played around with the Snapshot settings, but it really hasn’t made any difference. I experienced similar things when I converted a couple of physical machines with XPe to VMs as well. I’m really stumped on this one.

  8. @BA70 I’m honestly not sure, that might just be the nature of XPe.

  9. I figured it out. When I was adding components I guess I didn’t know what everything was. One of the components I added was EWF (Enhanced Write Filter). I eventually had to disable EWF due to a conflict with NTLDR, but it looks as though disabling still caused an issue.

    I created a fresh slx file and now the issue is resolved.

    Thanks again for the great article.

Leave a Reply

You must be logged in to post a comment.