Tasty, nutritious

...part of this complete breakfast
Everything here is my opinion. I do not speak for your employer.
March 2007
April 2007

2007-03-10 »

Installing Windows XP Embedded in a VMware Session

It's incredibly difficult to find concise, reliable steps for doing this anywhere on the Internet. There are bad instructions, long instructions, and misleading instructions, but nothing that pulls it all together in one place. To my stunned amazement, most people doing Windows XP Embedded seem to do it by actually installing it on their own workstation and rebooting over and over. Honestly!

Seeing as that's completely insane, here are the most concise steps I can come up with for installing it in VMware instead.

  1. Install the XP Embedded SDK on your non-virtual workstation as usual so it runs at maximum speed (which isn't very fast). Alternatively, do it in a VMware session, and you can skip the following step.
  2. Install Windows XP (the normal one) in a VMware session as usual.
  3. Shut down the XP VMware session.
  4. Create a new VMware disk image that you'll use for your XPEmbedded disk. Add it as the second disk of the XP system you created above.
  5. Boot the Windows XP session.
  6. While you're here, run the XPEmbedded SDK's TAP.EXE tool (not TA.EXE!!) and grab a copy of the generated devices.pmq file. You'll need this for building VMware-compatible appliances with the SDK.
  7. In Start | Control Panel | Admin Tools | Computer Management | Storage | Disk Management, you'll find the super-secret disk management tool that replaces old, reliable fdisk and format. Open it.
  8. Initialize and format your new disk. It must have an "MBR" format partition table. You probably just want one big partition in NTFS format.
  9. DEAR GOD, DON'T FORGET TO MAKE THE PARTITION ACTIVE! Sorry for screaming, but I just wasted about four hours on that because the Windows MBR, in all its cleverness, just says nothing and tells the BIOS to boot from elsewhere if you don't do it right. Trivia: at this step, Windows writes an MBR to the partition table sector, and a boot sector to the partition you created. The boot sector is designed to load ntldr, which handles the rest of the boot process.
  10. Shut down the XP VMware session. You now have a blank disk image with a valid boot sector. Reconfigure VMware to stop talking to that disk image, then move the disk image out of the way. (Don't do it the other way around! If you do, VMware tends to freak out and get hard to fix.)
  11. Make a copy of that virtual disk and keep it off to the side. You can use it over and over again as a source of new bootable virtual disks, without having to annoyingly format them by hand in Windows each time. It should be highly compressible at this point, so feel free to check it into Subversion and use it as part of your automated build process.
  12. Download VDK, the unofficial but handy VMware virtual disk loopback driver for Windows. It's a bit buggy (which is why you can't do the above steps without VMware itself), but it works well with disks that are already formatted. Note: vdk.exe doesn't work in a Cygwin shell for some reason. You have to run it from plain cmd.exe.
  13. Assuming your disk image is called XPEmbedded.vmdk, run these commands:
      vdk install
      vdk open 0 XPEmbedded.vmdk /rw /l:m
    
    This mounts your virtual disk as drive m: on your real workstation. BEWARE: if you have an XPEmbedded.vmdk in the current directory, vdk will use it even if you give the full path to a different XPEmbedded.vmdk. So even though it's good to keep the a copy of the empty one around, it's safest to use a completely different filename for it, not just a different directory. I wasted a couple of hours on this problem too.
  14. Generate an XP Embedded image in c:\Windows Embedded Images using the SDK and Target Designer, as usual.
  15. Using Windows Explorer or whatever, xcopy the files from that directory to m:\.
  16. Close all windows referring to m:, then unmount the disk with
      vdk close 0
    
    Because Windows enforces exclusive file locks (grrrr...) you can't use the disk image in VMware until you unmount it.
  17. Create and boot a new VMware image with XPEmbedded.vmdk as the primary disk.
  18. Congratulations! If you got this far, you have a brand new XPEmbedded system running in VMware!
  19. Install UniConf for Windows to configure your virtual Windows sytem from its host machine. Oops, did I say that out loud?

Organizing the world's information

It's kind of ironic that while Google's mission is to "organize the world's information," I don't really need to organize my own information anymore. I just dump my notes into this journal, call it a blog, and use Google to look it up later in case I need it. Perhaps the overall global level of information sanity is a constant?

I'm CEO at Tailscale, where we make network problems disappear.

Why would you follow me on twitter? Use RSS.

apenwarr on gmail.com