Installing and booting Windows XP from USB drive

February 3, 2007 04:28:05

When i was started to build a carPC, i was wondering how to put a Windows partition somewhere to protect the HDD from road's vibrations and holes.I thought it was a good idea to run Windows XP off a USB stick that i just plug in when i need it, and boot from it. Thanks to the fantastic research of the people i credited below, finally i made it possible. I wanted an easy guide that allows creating a modified version of the Windows XP CD, for painless and transparent installation to as many systems as you want.

Needed

  • A USB2-compliant Hard disk drive (or a big USB2 stick. In this guide, i used this)
  • An original Windows XP CD
  • WinISO or UltraISO. In this guide, i use the UltraISO
  • The Microsoft CAB SDK
  • A CD-burning software that can handle ISO files.I burn the image with Nero.

Your computer must support booting from USB (view below) To see if your PC supports booting from USB, connect your USB drive to your computer, directly, without a Hub. Then, shut down your computer, disconnect any other hard disk drives from it, and insert your Windows XP CD into the drive.

Start the installation, and proceed to the section where you are allowed to pick a hard drive. If it goes beyond the partition selection, your drive is already fine for booting Windows XP. If not (seems to be the cases with many of the Freecom USB HDDs for example), you will get an error like "Windows is unable to find your drive, partition, data etc.

If you want to install XP to USB Stick, you can't do anything. But if you want to install XP to a USB HDD, this is usually not a big problem. All you need to do is "properly" format the drive. Reboot into your normal Windows, and get this HP tool, and use it to format your HDD completely and choose NTFS format.

How to
Open UltraISO, and select Tools -> Make CD/DVD Image... , and save your CD image.
After the CD dump is done, close and reopen UltraIUSO. Then, open the ISO file you just created using File -> Open.
Now, click the I386 folder, and select the following files (Ctrl key to multi-select)

  • TXTSETUP.SIF
  • DOSNET.INF
  • USB.IN_
  • USBPORT.IN_
  • USBSTOR.IN_

Select Actions -> Extract and put the resulting files into some folder to work on them. Use the Cab SDK to extract the contents of the .IN_ files.

Go to Start -> Run and type cmd. No navigate to the folder you have the files and type these commands:
cabarc x USB.IN
cabarc x USBPORT.IN

cabarc x USBSTOR.IN_

You should end up with three new files in the folder, called:

  • usb.inf
  • usbport.inf
  • usbstor.inf

Now delete the .IN_ files. No you must open the inf files with a text editor to modify them.

File TXTSETUP.SIF
Move the following entries from [InputDevicesSupport.Load] to the [BootBusExtenders.Load] section, as shown here.
[BootBusExtenders.Load]
pci = pci.sys
acpi = acpi.sys
isapnp = isapnp.sys
acpiec = acpiec.sys
ohci1394 = ohci1394.sys
usbehci = usbehci.sys
usbohci = usbohci.sys
usbuhci = usbuhci.sys
usbhub = usbhub.sys
usbstor = usbstor.sys
[InputDevicesSupport.Load]
usbehci = usbehci.sys
usbohci = usbohci.sys
usbuhci = usbuhci.sys
usbhub = usbhub.sys
usbccgp = usbccgp.sys
hidusb = hidusb.sys
serial = serial.sys
serenum = serenum.sys
usbstor = usbstor.sys
... now the same for [BootBusExtenders] and [InputDevicesSupport]
[BootBusExtenders]
pci = "PCI-Bustreiber",files.pci,pci
acpi = "ACPI Plug & Play-Bustreiber",files.acpi,acpi
isapnp = "ISA Plug & Play-Bustreiber",files.isapnp,isapnp
acpiec = "Integrierter ACPI-Controllertreiber",files.none,acpiec
ohci1394 = "IEEE-1394-Bus-OHCI-konformer Anschlusstreiber",files.ohci1394,ohci1394
usbehci = "Erweiterter Hostcontroller",files.usbehci,usbehci
usbohci = "Open Hostcontroller",files.usbohci,usbohci
usbuhci = "Universeller Hostcontroller",files.usbuhci,usbuhci
usbhub = "Standard-USB-Hubtreiber",files.usbhub,usbhub
usbstor = "USB-Speicherklassentreiber",files.usbstor,usbstor
[InputDevicesSupport]
usbehci = "Erweiterter Hostcontroller",files.usbehci,usbehci
usbohci = "Open Hostcontroller",files.usbohci,usbohci
usbuhci = "Universeller Hostcontroller",files.usbuhci,usbuhci
usbhub = "Standard-USB-Hubtreiber",files.usbhub,usbhub
hidusb = "HID-Parser",files.hidusb,hidusb
serial = "Treiber for seriellen Anschluss",files.none,serial
serenum = "Enumerator for seriellen Anschluss",files.none,serenum
usbstor = "USB-Speicherklassentreiber",files.usbstor,usbstor
usbccgp = "USB Generic Parent Driver",files.usbccgp,usbccgp

No insert the following in the [HiveInfs.Fresh] section:
[HiveInfs.Fresh]
AddReg = hivedef.inf,AddReg
AddReg = hivesys.inf,AddReg
AddReg = hivesft.inf,AddReg
AddReg = hivecls.inf,AddReg
AddReg = hiveusd.inf,AddReg
AddReg = dmreg.inf,DM.AddReg
AddReg = usbboot.inf,usbservices
and also in [SourceDisksFiles]
[SourceDisksFiles]
usbboot.inf = 1,,,,,,x,3,,3
bootvid.dll = 1,,,,,,3
,2,0,0,,1,2
kdcom.dll = 1,,,,,,3_,2,0,0,,1,2

Save and close TXTSETUP.SIF.

File DOSNET.INF
Open DOSNET.INF , and change the second [Files] section to look like this:

[Files]
d1,usbboot.inf
d1,_default.pif
d1,12520437.cpx
d1,12520850.cpx 

File usb.inf
Change the bolded lines in the [StandardHub.AddService] and [CommonClassParent.AddService] sections:
[StandardHub.AddService]
DisplayName = %StandardHub.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 0 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%usbhub.sys
LoadOrderGroup = Boot Bus Extender
[CommonClassParent.AddService]
DisplayName = %GenericParent.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 0 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%usbccgp.sys
LoadOrderGroup = Boot Bus Extender

File usbport.inf
Change the bolded lines in the [EHCI.AddService], [OHCI.AddService] , [UHCI.AddService] and [ROOTHUB.AddService] sections:

[EHCI.AddService]
DisplayName = %EHCIMP.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 0 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%usbehci.sys
LoadOrderGroup = Boot Bus Extender
[OHCI.AddService]
DisplayName = %OHCIMP.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 0 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%usbohci.sys
LoadOrderGroup = Boot Bus Extender
[UHCI.AddService]
DisplayName = %UHCIMP.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 0 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%usbuhci.sys
LoadOrderGroup = Boot Bus Extender

[ROOTHUB.AddService]
DisplayName = %ROOTHUB.SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 0 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%usbhub.sys
LoadOrderGroup = Boot Bus Extender
File usbstor.inf
Change / Add the bolded lines in the [USBSTOR.AddService] section
[USBSTOR.AddService]
DisplayName = %USBSTOR.SvcDesc%
ServiceType = 1
StartType = 0
Tag = 3

ErrorControl = 1
ServiceBinary = %12%USBSTOR.SYS
LoadOrderGroup = Boot Bus Extender

File: USBBOOT.INF
Create a new file called USBBOOT.INF in the same directory as your other changed files, and put the following content into it:
[usbservices]
HKLM,"SYSTEMCurrentControlSetServicesUSBSTOR","DisplayName",0x00000000,"USB Mass Storage Driver"
HKLM,"SYSTEMCurrentControlSetServicesUSBSTOR","ErrorControl",0x00010001,1
HKLM,"SYSTEMCurrentControlSetServicesUSBSTOR","Group",0x00000000,"System Reserved"
HKLM,"SYSTEMCurrentControlSetServicesUSBSTOR","ImagePath",0x00020000,"system32DRIVERSUSBSTOR.SYS"
HKLM,"SYSTEMCurrentControlSetServicesUSBSTOR","Start",0x00010001,0
HKLM,"SYSTEMCurrentControlSetServicesUSBSTOR","Type",0x00010001,1
HKLM,"SYSTEMCurrentControlSetServicesusbehci","DisplayName",0x00000000,"USB 2.0 Enhanced Host Controller Miniport Driver"
HKLM,"SYSTEMCurrentControlSetServicesusbehci","ErrorControl",0x00010001,1
HKLM,"SYSTEMCurrentControlSetServicesusbehci","Group",0x00000000,"System Reserved"
HKLM,"SYSTEMCurrentControlSetServicesusbehci","ImagePath",0x00020000,"system32DRIVERSusbehci.sys"
HKLM,"SYSTEMCurrentControlSetServicesusbehci","Start",0x00010001,0
HKLM,"SYSTEMCurrentControlSetServicesusbehci","Type",0x00010001,1
HKLM,"SYSTEMCurrentControlSetServicesusbhub","DisplayName",0x00000000,"USB2 Enabled Hub"
HKLM,"SYSTEMCurrentControlSetServicesusbhub","ErrorControl",0x00010001,1
HKLM,"SYSTEMCurrentControlSetServicesusbhub","Group",0x00000000,"System Reserved"
HKLM,"SYSTEMCurrentControlSetServicesusbhub","ImagePath",0x00020000,"system32DRIVERSusbhub.sys"
HKLM,"SYSTEMCurrentControlSetServicesusbhub","Start",0x00010001,0
HKLM,"SYSTEMCurrentControlSetServicesusbhub","Type",0x00010001,1
HKLM,"SYSTEMCurrentControlSetServicesusbuhci","DisplayName",0x00000000,"Microsoft
USB Universal Host Controller Miniport Driver"
HKLM,"SYSTEMCurrentControlSetServicesusbuhci","ErrorControl",0x00010001,1
HKLM,"SYSTEMCurrentControlSetServicesusbuhci","Group",0x00000000,"System Reserved"
HKLM,"SYSTEMCurrentControlSetServicesusbuhci","ImagePath",0x00020000,"system32DRIVERSusbuhci.sys"
HKLM,"SYSTEMCurrentControlSetServicesusbuhci","Start",0x00010001,0
HKLM,"SYSTEMCurrentControlSetServicesusbuhci","Type",0x00010001,1
HKLM,"SYSTEMCurrentControlSetServicesusbohci","DisplayName",0x00000000,"Microsoft USB Open Host Controller Miniport Driver"
HKLM,"SYSTEMCurrentControlSetServicesusbohci","ErrorControl",0x00010001,1
HKLM,"SYSTEMCurrentControlSetServicesusbohci","Group",0x00000000,"System Reserved"
HKLM,"SYSTEMCurrentControlSetServicesusbohci","ImagePath",0x00020000,"system32DRIVERSusbohci.sys"
HKLM,"SYSTEMCurrentControlSetServicesusbohci","Start",0x00010001,0
HKLM,"SYSTEMCurrentControlSetServicesusbohci","Type",0x00010001,1

Now open the cmd again. Type the following commands:
cabarc n USB.IN usb.inf
cabarc n USBPORT.IN
usbport.inf
cabarc n USBSTOR.IN_ usbstor.inf

The three IN_ files should now exist again. We are finish with modifications.Open your Windows CD image again with UltraISO. Navigate to the I386 folder, and delete the following files from the ISO file.

  • DOSNET.INF
  • TXTSETUP.SIF
  • USB.IN_
  • USBPORT.IN_
  • USBSTOR.IN_

Now save the iso file. Now select "Add Files" and add your changed files, in detail:

  • USBBOOT.INF
  • DOSNET.INF
  • TXTSETUP.SIF
  • USB.IN_
  • USBPORT.IN_
  • USBSTOR.IN_

Save the ISO. You are done. Now you can burn the image.

To test the CD, shut down your computer. Disconnect ANY internal and external hard drives (so Windows cannot find them during installation).

Some computers will have trouble to boot without an internal HDD attached, check in your BIOS and, if possible, remove the HDD from the boot sequence and set the USB Harddisk as the first boot device, and the CDROM as second.

Also, connect your USB Harddrive directly to the computer, without any Hubs in between. Windows should install just fine, with the exceptions noted below.

At the installation, windows will prompt you, as they are "not certified" - This is normal. Just press "yes" a couple of times. Also, upon completion of the install, the system will complain once on the first bootup that the pagefile does not exist.

You can ignore this for now, as Windows will work fine without it.