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.
- 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.
- Install Windows XP (the normal one) in a VMware session as usual.
- Shut down the XP VMware session.
- 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.
- Boot the Windows XP session.
- 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.
- 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.
- Initialize and format your new disk. It must have an "MBR" format partition table. You probably just want one big partition in NTFS format.
- 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.
- 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.)
- 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.
- 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.
- Assuming your disk image is called XPEmbedded.vmdk, run these
vdk install vdk open 0 XPEmbedded.vmdk /rw /l:mThis 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.
- Generate an XP Embedded image in c:\Windows Embedded Images using the SDK and Target Designer, as usual.
- Using Windows Explorer or whatever, xcopy the files from that directory to m:\.
- Close all windows referring to m:, then unmount the disk with
vdk close 0Because Windows enforces exclusive file locks (grrrr...) you can't use the disk image in VMware until you unmount it.
- Create and boot a new VMware image with XPEmbedded.vmdk as the primary disk.
- Congratulations! If you got this far, you have a brand new XPEmbedded system running in VMware!
- 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?
ssh+2FA to all your machines, anywhere, without opening firewall ports.