Friday, June 10, 2011

How to install and boot Windows on an external (USB) hard drive

Please read this guide from start to finish before doing anything

1) Does your computer support booting from USB?

Usually, if it's an option in your BIOS boot sequence menu, the answer to this is yes. If it's not there then the answer is probably no. However, proceed and see what happens.

2) Confirming the "Bootability" of your USB-Drive
Shut down your computer
Connect your USB drive directly to one of your USB ports on your computer, without using a Hub
Disconnect any other hard disk drives (internally) from it
Turn on your computer. Confirm that Bios is set to start from CD
Insert your original 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 bla". This is usually not a big problem. All you need to do is "properly" format the drive with the NTFS file system. After this, the drives are recognized as valid installation devices by the Windows XP installer. There has been no success reported in using the FAT32 file system for such purposes.

3) Dumping the original Windows Setup CD into an ISO File

Pretty easy one. Simply open WinISO or your ISO program of choice, and select Actions -> Make ISO from CDROM, and save your CD image to a convenient place on your hard disk drive.

4) Extracting the files we need to work on

After the Windows ISO image is done, close and reopen WinISO.(or the program of your choice) Then, open the ISO file you just created using File -> Open.
Now, click the I386 folder, and select the following files (hold down Ctrl key to multi-select)
TXTSETUP.SIF
DOSNET.INF
USB.IN_
USBPORT.IN_
USBSTOR.IN_
Select Actions -> Extract and put the resulting files into a folder on your C: drive. I usually put the files into a new folder called primary (ie C:\primary)


5) Unpacking IN_ files

Use the Cab SDK program from http://support.microsoft.com/kb/310618 and install the tools directly on your C: drive..I install the tools into C:\cabsdk and would recommend you to do the same..This program is meant to be ran from a cmd window..so click start-->run-->cmd and press enter. In the command window, if you installed cabsdk to the folder mentioned above "C:\cabsdk" type the following: cd C:\cabsdk\bin then press enter. and now your command prompt should look like this...
C:\cabsdk\BIN

(The following assumes you saved the files you extraced from the iso file to "C:\primary")..
Next you will want to unpack the .IN_ files by typing in the cmd window:.. cabarc x C:\primary\USB.IN_ then press enter. Repeat this process until you have done it for USB.IN_ USBPORT.IN_ and USBSTOR.IN_ you will then have the following inf files in the BIN directory of the cabsdk folder.
usb.inf
usbport.inf
usbstor.inf
Close the Command window.
5-A) Create a new folder on your C:\ drive:
Name it edited then move the following files from the BIN folder in the cabsdk directory to the folder named edited on your C: drive:
usb.inf
usbport.inf
usbstor.inf
5-B) Copy the following files:
Copy the following files from C:\primary to C:\edited
TXTSETUP.SIF
DOSNET.INF


6) Editing the files
This is the main job. i ll also try to explain a bit whats happening. Use a simple Texteditor... Notepad is the one you want to use. The find uitlity (Ctrl F) Will be your best friend through this process. Also take your time with editing the files. Double..no..triple check everything as you go. There is no harm in being sure you have completed each step correctly.

6-A) TXTSETUP.SIF
This file is loaded on the initial install step by the Windows XP CD installer. In this file, we will change the way Windows treats USB devices during system setup -- the default is to only treat them as input devices during installation -- we will change this to include mass storage driver support (which needs to be loaded into the installer much earlier in order to work).

First, move the following bolded entries from [InputDevicesSupport.Load] to the [BootBusExtenders.Load] section , exactly as shown here.. Note: Delete the bolded lines from [InputDevicesSupport.Load] after you have moved them to [BootBusExtenders.Load]

[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 move the bolded entries from [InputDevicesSupport] to [BootBusExtenders] Note: Delete the bolded lines from [InputDevicesSupport]
after you have moved them to [BootBusExtenders]

[BootBusExtenders]
pci = "PCI Bus Driver",files.pci,pci
acpi = "ACPI Plug & Play Bus Driver",files.acpi,acpi
isapnp = "ISA Plug & Play Bus Driver",files.isapnp,isapnp
acpiec = "ACPI Embedded Controller Driver",files.none,acpiec
ohci1394 = "IEEE 1394 Bus OHCI Compliant Port Driver",files.ohci1394,ohci1394
usbehci = "Enhanced Host Controller",files.usbehci,usbehci
usbohci = "Open Host Controller",files.usbohci,usbohci
usbuhci = "Universal Host Controller",files.usbuhci,usbuhci
usbhub = "Generic USB Hub Driver",files.usbhub,usbhub
usbstor = "USB Storage Class Driver",files.usbstor,usbstor

[InputDevicesSupport]
usbehci = "Enhanced Host Controller",files.usbehci,usbehci
usbohci = "Open Host Controller",files.usbohci,usbohci
usbuhci = "Universal Host Controller",files.usbuhci,usbuhci
usbhub = "Generic USB Hub Driver",files.usbhub,usbhub
hidusb = "Human Interface Parser",files.hidusb,hidusb
serial = "Serial Port Driver",files.none,serial
serenum = "Serial Port Enumerator",files.none,serenum
usbstor = "USB Storage Class Driver",files.usbstor,usbstor
usbccgp = "USB Generic Parent Driver",files.usbccgp,usbccgp


Next, we also have to write several keys into the registry. Convieniently, the txtsetup.sif allows you to specify files that are parsed and instered into the registry at install time. Insert the following in the [HiveInfs.Fresh] section: Make sure the entries are lined up

[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

Finally, save and close TXTSETUP.SIF. We are done with it.

6-B) DOSNET.INF
Now, open DOSNET.INF , and change the second [Files] section (yes there are 2 sections called [Files]) to look like this:

[Files]
d1,usbboot.inf
d1,_default.pif
d1,12520437.cpx
d1,12520850.cpx
Save and close DOSNET.INF

6-C) usb.inf

Change the bolded lines in the [StandardHub.AddService] and [CommonClassParent.AddService] sections to resemble the ones below:

[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

No comments:

Post a Comment