Tuesday, May 6

Building an HTPC: Software

We left the building of our HTPCs in dire need of something to run on it. Now usually installing the OS would be an easy step - we would just whack a CD or DVD installer into the drive and sit back. However, since we didn't have any kind of DVD drive getting something on our HTPCs turned out to be a project in itself.

The problem itself is platform agnostic - all the candidate OS's (XP, Vista and Ubuntu) expected to be installed off a disc, with ISOs available for each that resulted in something that is bootable. Since we had limited options (just Ethernet and USB really), whichever OS we actually chose wouldn't just go on by themselves.

We (arbitrarily for now) settled on Vista. Our first attempt was to copy all of the files on the DVD to a USB stick after which we attached it to the HTPC. Although the stick itself was detected by the BIOS, it complained it not being bootable and hung. Unfortunately just copying the install files wasn't going to work.

Using an existing XP install we then used the disk management utility to both make the stick's partition primary (it was already) and to activate it - something I recalled was used to set which partition the BIOS should boot from. Retrying this in the HTPC got further than before except now we were getting a "missing NTLDR" error. Still at least we were getting somewhere!

Turning to my pocket drive instead, I lifted the necessary files from my existing XP install, blindly hoping that there would be nothing more for the HTPC to complain about. This turned out to be in vain as the BIOS now searched for an XP install that didn't exist. In the meantime, however, I noticed a file called BOOTMGR amongst the Vista install DVD's files. A quick Google showed this as the direct replacement for NTLDR, and it finally occurred to me that something on the pocket drive was telling the BIOS to look for the latter - something probably set while "activating" it in the previous attempt. If that was the case, all I had to do was to figure out how to activate it Vista-style.

I didn't have any existing Vista installations handy, and rather than visit a friend's house to use theirs I searched for a tool that would do it instead. It turned out that the application needed was called bootsect.exe and was freely available from Microsoft. It was at this point that I messed up a bit - I downloaded an AMD64, thinking that was the version relevant to me. Of course it wouldn't run on my x86 XP installation, but I incorrectly concluded that bootsect.exe in general was a Vista only app.

Faced with this apparent chicken-and-egg situation, I begun to consider other options. The solution of installing Vista over the LAN was nixed as being too long and convoluted, while just finding a spare DVD drive and connecting it to the HTPC temporarily for the install was becoming more and more appealing.

In passing, a friend suggested that I look into using Windows PE. The PE stands for Preinstallation Environment, this being a stripped down version of Windows used to run native tasks (like installing Windows proper). It all sounded vaguely relevant to what I was doing, so I looked into it further and downloaded the Windows Automated Installation Kit that included Windows PE.

It was all a bit of a red herring really. Since Windows PE was just another OS, I was faced with exactly the same problem - I had a bootable CD, with no way to transfer its magical self-booting properties to the pocket drive. If I knew how to do that then I would have just applied the procedure to the original DVD install in the first place.

It hit me that since WAIK was designed to create Vista installs, and that it was itself running on my XP machine, that it could do what bootsect.exe was supposed to. I actually got more than that, since checking the PETools directory under WAIK resulted in me finding an x86 compatible version of bootsect.exe.

Running bootsect.exe /nt60 P: did exactly what I wanted it to do. My pocket drive would now tell any BIOS booting it to look for the available BOOTMGR, and after booting the HTPC with it connected I finally managed to kick off an install of Vista.