Thursday, September 18, 2008

HOWTO - Bootable Windows XP System on a USB Flash Drive

I really need to create (or bring back as it turns out) a website for tutorials on random computer-related topics. As it is, this is going on my blog for now, and I'll just crib it or link to it later if I get around to getting a website going again.

I recently had need to create a bootable Windows XP system on a 1 GB USB flash drive. Seemed like it would be pretty simple to me...turns out it isn't. Microsoft likes to mess with the USB driver on boot up which isn't a good thing when you are booting from a USB device.

After looking on the Internet for quite a while, I found a tutorial that helped me accomplish what I needed. The original tutorial I followed is at (http://www.tech-archive.net/Archive/WinXP/microsoft.public.windowsxp.embedded/2005-10/msg00332.html). While I am very thankful to have found this, I thought I could possibly write a more succinct tutorial, and that's what follows here.

Final note - this most likely isn't the best way to do this, or the simplest. It worked for me and might be useful for others, so I think it is worth posting here. I did find another tutorial that might be a more correct way to do this at (http://www.ngine.de/article/id/8). I haven't tried it though, so YMMV.


Initial preparation

  1. Make the intended target USB flash drive installable. See the following section for help with this.
  2. Boot the newly installed XP install from the hard drive.
  3. Disable the pagefile. This is done by opening the system control panel, choosing the advanced tab, clicking the top “settings” button, changing to the advanced tab, clicking the “change” button, and then choosing the “No paging file” option and clicking “Set”.
  4. Insert the intended target USB flash drive, and allow it to be fully detected by XP.

Registry modifications

  1. Backup the HKLM\System registry key before starting (just to be safe).
  2. Import or make the following modifications to 6 registry keys:


[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\usbehci]
"Start"=dword:00000000
"Group"="Boot Bus Extender"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\usbhub]
"Start"=dword:00000000
"Group"="Boot Bus Extender"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\USBSTOR]
"Start"=dword:00000000
"Group"="Boot Bus Extender"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\usbuhci]
"Start"=dword:00000000
"Group"="Boot Bus Extender"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDataba
se\usb#root_hub]
"Service"="usbhub"
"ClassGUID"="{36FC9E60-C465-11CF-8056-444553540000}"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDataba
se\usb#root_hub20]
"ClassGUID"="{36FC9E60-C465-11CF-8056-444553540000}"
"Service"="usbhub"

  1. Create 2 registry keys based on the specific USB flash drive that will be used. Following are 2 examples – the key names will have to be customized for the Pid/Vid and hardware ID of the specific target flash device. The ClassGUID and Service keys should be entered verbatim.


[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDataba
se\USB#Vid_1058&Pid_0300]
"ClassGUID"="{36FC9E60-C465-11CF-8056-444553540000}"
"Service"="usbstor"

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CriticalDeviceDataba
se\USBSTOR#DiskWDC_____WD1600BB-00FTA0_15.0]
"ClassGUID"="{4D36E967-E325-11CE-BFC1-08002BE10318}"
"Service"="disk"

The Pid/Vid for the target USB flash device can be found in HKLM\System\ControlSet001\Enum\USB. Open the subkey for each item until you find the DriverDesc of USB Mass Storage Device, a Service of USBSTOR, and a LocationInformation that matches your specific flash drive.

The hardware ID can be found in HKLM\System\ControlSet001\Enum\USBSTOR. In this example the chosen key would look like:

Disk&Ven_WDC&Produ_WD1600BB-00FTA0&Rev_15.0

Again, find the device that matches your specific flash drive.


The Hardware ID is created as Disk(8)(16)(4) where the values are:

8 digits (in this example WDC_____ ) as the vendor of device
16 digits (in this example WD1600BB-00FTA0_ ) for the device type and
4 digits (in this example 15.0 ) for a version number.

  1. Delete key HKLM\System\MountedDevices.
  2. Delete string value HKLM\System\Setup\SystemPartition
  3. Change HKLM\System\ControlSet001\Services\USBSTOR\Start from 3 to 0.
    (THIS STEP IS IMPORTANT – YOU WILL GET A BLUE SCREEN IF THIS ISN’T CHANGED)
  4. Right-click on the HKLM\System\ControlSet001\Services\USBSTOR key and change the permissions to deny full control to the “System” group.

Preparing the target flash device

This step likely has to be done from another PC, or while booted to a different drive. Otherwise, some files end up being in use.

  1. Copy all files and folders from the completed hard drive to the USB target flash drive. Do not copy the recycled or system volume information folders.
  2. Delete \windows\system32\config\*.sav, *.log, and *.evt.


Adding support for additional USB flash devices

To add additional USB flash drive support to the original hard drive image, follow these steps:

  1. Right-click on the HKLM\System\ControlSet001\Services\USBSTOR key and remove the deny full control to the “System” group attributes that were set in step #7 in the registry section above.
  2. Insert the additional targeted USB flash drive, and allow it to be fully detected by XP as in step #4 of the initial preparation section above.
  3. Follow steps 3-7 of the registry modification section above.


EDIT: It turns out there is more to this than what I have posted. This will be limited to a specific flash drive, not just a certain PID_VID. The image will need to be recreated with each additional flash part that will be used added to the registry for this to not blue screen when moved to a different flash drive. Suck.

Thursday, September 11, 2008

Genius!

I really didn't think I would find much use for the new "Genius" feature in iTunes 8. It seemed like a gimmick, and primarily to push more stuff from the iTunes store in my mind.

However, after playing with it for less than a night I'm pretty happy with it now. I was a bit concerned when my iTunes memory usage climbed to 800 MB while it was first compiling my genius information (and if you still care about privacy of your data it will disturb you as well). After that completed though, it was pretty cool seeing it group together songs from my library based on a given song.

After playing with that for a bit, I decided to turn on the sidebar and let it show songs from the store as well. The related songs portion is only mildly interesting to me -- what I really liked was the list of other songs I might be missing from that same artist.

It was while browsing an artist I happen to have nearly everything ever made, that I noticed something else that I found amusing. It claimed there was a song I didn't have, and that it was on an album that I physically own and had ripped to my library. After being thoroughly stumped for a bit (keep in mind it's the wee hours of the morning, and I have all sound muted), I realized that it was actually a hidden track. It turns out that if you buy the album from iTunes, the last song is broken into 2 separate songs, rather than one long track. Interesting. Also cool - because I now know the title to what was previously an untitled hidden track to me.