Kobnar
2007-01-02, 01:24 PM CST
Hacking a Windows XP CD for installation on a USB Hard Drive
a guide for Linux-only users
Credits and a Note: This guide was taken (almost completely) from "Installing and booting Windows XP from USB drive" (http://www.ngine.de/index.jsp?pageid=4176) created by 'emanuel' at "http://www.ngine.de/". If you have Windows on your system, I would advise going there (why use this when you can use the original). Among the names in his credits are some people who go by 'mkiaer', 'Dietmar' and 'sisal' who, apparently, did most of the research regarding making an NT based windows boot from a USB drive. They did the research, he did the guide and I copied most of it here and made minor adaptations so that it can be done from a purely Linux system instead of one with Windows (not much work at all on my end but this is *really* handy). Thanks SO MUCH to these people -- they made this possible.
Another Note: I use GnomeBaker for disc burning and normally I would use kISO for disc editing however kISO currently does not maintain a disk's boot information so this guide will cover using magicISO run in Wine for the disc extraction and editing.
The Final Note: I will throw in my experience and might leave some other stuff out as well. I posted this because doing this kind of thing is very useful to a Linux user and in my opinion the community can benefit greatly from a guide like this. I have done this before with a 7200rpm removable hard-drive and it worked perfectly for everything I did (games, PS, video, etc...).
The Warning: This, like anything fun, can totally screw up your system. Be careful and know what you are doing at all times. Also, don't break the law. Don't steal XP (even though you also shouldn't have to pay for it) and don't steal any ISO editing software. Oh yeah, have fun.
Before we Begin:
First: Ensure that the computer you want to use this on supports booting from a USB 2.0 device. Most modern motherboards and BIOS's support this feature but... you know... check anyways. Also, ensure that there are no usb-hubs between your drive and the motherboard. Some usb-hubs interfere with the bootablility of a device and it sucks to have that interfere. Also, some USB ports on computers and laptops go through a hub that you might not know about so select the most direct port you can.
Second: Obtain a USB 2.0 disk device on which you will install Windows (7200+rpm Removable HDD or a large enough (?) USB Stick will suffice). Note: As far as my understanding supports, the USB installed Windows will not be “hot-swappable” with other systems (I haven't tried it myself to verify, I'm sure windows would freak).
Third: Obtain a Windows XP installation Disk. I used an under-the-table corporate copy of XP that was up to date with SP2 and recent security patches.
Fourth: Obtain a copy of ISO editing and burning software capable of creating an ISO image from a disc, extracting files from the ISO image, inserting files to an ISO image, maintaining a disc's boot information and burning an ISO. To do that, obtain Wine (http://www.winehq.com/site/download) ('# yum install wine*' in terminal) and magicISO (http://www.magiciso.com/). Note: The original guide suggests WinISO (http://www.winiso.com/) or you could get another program like ISOedit (http://www.freedownloadscenter.com/Utilities/File_Maintenance_and_Repair_Utilities/IsoEdit.html) however I find magicISO to work the best in Wine.
Fifth: Obtain the Microsoft CAB SDK (http://download.microsoft.com/download/platformsdk/cab/2.0/w98nt42kmexp/en-us/Cabsdk.exe). This will be used to extract files from CAB archives on the disk. Use Wine to run the Cabsdk.exe and extract the files to a familiar directory (eg:"~/working_directory/cabsdk/").
The Theory (as I understand it): We are going to make the Windows XP cd load the USB drivers before the installation and set it to recognize USB disk devices as storage so that it can install thereupon.
The Guide:
1) Create ISO image from original WinXP disk
Within magicISO:
[Tools] -> [Make ISO From CD/DVDrom]
2) Extract the necessary files
Using magicISO open the *.iso file of the WindowsXP install disc.
In the upper right hand explorer, navigate to the i386 directory.
Locate the files.
Right click and select "Extract".
Extract the files to your working directory.
* TXTSETUP.SIF
* DOSNET.INF
* USB.IN_
* USBPORT.IN_
* USBSTOR.IN_
3) Unpack IN_ files
Use the Cab SDK for extracting the contents of the .IN_ files. Each of them contains
exactly one .inf file. To use the Cab SDK you will need to navigate to the folder containing
the extracted files from the "Cabsdk.exe". I copied the binaries to my working directory to
make commands easier. If you are unsure how to use the Cab SDK, here is an example
command line: "wine cabarc.exe x USBSTOR.IN_". After extracting all of the archives you
should end up with three new files in the folder, called:
* usb.inf
* usbport.inf
* usbstor.inf
You can now delete the .IN_ files.
4) Edit Files
Open the files with any text editing software such asGedit, Kwrite or nano (whichever you prefer).
- - - -4a) 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)." - emanuel
First, move the marked entries from [InputDevicesSupport.Load] to the section , as shown here:
[InputDevicesSupport.Load]
[B]usbehci = usbehci.sys <=remove from here
usbohci = usbohci.sys
usbuhci = usbuhci.sys
usbhub = usbhub.sys
usbccgp = usbccgp.sys
hidusb = hidusb.sys
serial = serial.sys
serenum = serenum.sys
usbstor = usbstor.sys
pci = pci.sys
acpi = acpi.sys
isapnp = isapnp.sys
acpiec = acpiec.sys
ohci1394 = ohci1394.sys
[B]usbehci = usbehci.sys <=add to here
usbohci = usbohci.sys
usbuhci = usbuhci.sys
usbhub = usbhub.sys
usbstor = usbstor.sys
... now the same for and [InputDevicesSupport]:
InputDevicesSupport]
hidusb = "Human Interface Parser",files.hidusb,hidusb
serial = "Serial Port Driver",files.none,serial
serenum = "Serial Port Enumerator",files.none,serenum
usbccgp = "USB Generic Parent Driver",files.usbccgp,usbccgp
[B]usbehci = "Enhanced Host Controller",files.usbehci,usbehci <=remove from here
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
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
[B]usbehci = "Enhanced Host Controller",files.usbehci,usbehci <=add to here
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
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:
[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
[...]
Finally, save and close TXTSETUP.SIF. We are done with it.
a guide for Linux-only users
Credits and a Note: This guide was taken (almost completely) from "Installing and booting Windows XP from USB drive" (http://www.ngine.de/index.jsp?pageid=4176) created by 'emanuel' at "http://www.ngine.de/". If you have Windows on your system, I would advise going there (why use this when you can use the original). Among the names in his credits are some people who go by 'mkiaer', 'Dietmar' and 'sisal' who, apparently, did most of the research regarding making an NT based windows boot from a USB drive. They did the research, he did the guide and I copied most of it here and made minor adaptations so that it can be done from a purely Linux system instead of one with Windows (not much work at all on my end but this is *really* handy). Thanks SO MUCH to these people -- they made this possible.
Another Note: I use GnomeBaker for disc burning and normally I would use kISO for disc editing however kISO currently does not maintain a disk's boot information so this guide will cover using magicISO run in Wine for the disc extraction and editing.
The Final Note: I will throw in my experience and might leave some other stuff out as well. I posted this because doing this kind of thing is very useful to a Linux user and in my opinion the community can benefit greatly from a guide like this. I have done this before with a 7200rpm removable hard-drive and it worked perfectly for everything I did (games, PS, video, etc...).
The Warning: This, like anything fun, can totally screw up your system. Be careful and know what you are doing at all times. Also, don't break the law. Don't steal XP (even though you also shouldn't have to pay for it) and don't steal any ISO editing software. Oh yeah, have fun.
Before we Begin:
First: Ensure that the computer you want to use this on supports booting from a USB 2.0 device. Most modern motherboards and BIOS's support this feature but... you know... check anyways. Also, ensure that there are no usb-hubs between your drive and the motherboard. Some usb-hubs interfere with the bootablility of a device and it sucks to have that interfere. Also, some USB ports on computers and laptops go through a hub that you might not know about so select the most direct port you can.
Second: Obtain a USB 2.0 disk device on which you will install Windows (7200+rpm Removable HDD or a large enough (?) USB Stick will suffice). Note: As far as my understanding supports, the USB installed Windows will not be “hot-swappable” with other systems (I haven't tried it myself to verify, I'm sure windows would freak).
Third: Obtain a Windows XP installation Disk. I used an under-the-table corporate copy of XP that was up to date with SP2 and recent security patches.
Fourth: Obtain a copy of ISO editing and burning software capable of creating an ISO image from a disc, extracting files from the ISO image, inserting files to an ISO image, maintaining a disc's boot information and burning an ISO. To do that, obtain Wine (http://www.winehq.com/site/download) ('# yum install wine*' in terminal) and magicISO (http://www.magiciso.com/). Note: The original guide suggests WinISO (http://www.winiso.com/) or you could get another program like ISOedit (http://www.freedownloadscenter.com/Utilities/File_Maintenance_and_Repair_Utilities/IsoEdit.html) however I find magicISO to work the best in Wine.
Fifth: Obtain the Microsoft CAB SDK (http://download.microsoft.com/download/platformsdk/cab/2.0/w98nt42kmexp/en-us/Cabsdk.exe). This will be used to extract files from CAB archives on the disk. Use Wine to run the Cabsdk.exe and extract the files to a familiar directory (eg:"~/working_directory/cabsdk/").
The Theory (as I understand it): We are going to make the Windows XP cd load the USB drivers before the installation and set it to recognize USB disk devices as storage so that it can install thereupon.
The Guide:
1) Create ISO image from original WinXP disk
Within magicISO:
[Tools] -> [Make ISO From CD/DVDrom]
2) Extract the necessary files
Using magicISO open the *.iso file of the WindowsXP install disc.
In the upper right hand explorer, navigate to the i386 directory.
Locate the files.
Right click and select "Extract".
Extract the files to your working directory.
* TXTSETUP.SIF
* DOSNET.INF
* USB.IN_
* USBPORT.IN_
* USBSTOR.IN_
3) Unpack IN_ files
Use the Cab SDK for extracting the contents of the .IN_ files. Each of them contains
exactly one .inf file. To use the Cab SDK you will need to navigate to the folder containing
the extracted files from the "Cabsdk.exe". I copied the binaries to my working directory to
make commands easier. If you are unsure how to use the Cab SDK, here is an example
command line: "wine cabarc.exe x USBSTOR.IN_". After extracting all of the archives you
should end up with three new files in the folder, called:
* usb.inf
* usbport.inf
* usbstor.inf
You can now delete the .IN_ files.
4) Edit Files
Open the files with any text editing software such asGedit, Kwrite or nano (whichever you prefer).
- - - -4a) 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)." - emanuel
First, move the marked entries from [InputDevicesSupport.Load] to the section , as shown here:
[InputDevicesSupport.Load]
[B]usbehci = usbehci.sys <=remove from here
usbohci = usbohci.sys
usbuhci = usbuhci.sys
usbhub = usbhub.sys
usbccgp = usbccgp.sys
hidusb = hidusb.sys
serial = serial.sys
serenum = serenum.sys
usbstor = usbstor.sys
pci = pci.sys
acpi = acpi.sys
isapnp = isapnp.sys
acpiec = acpiec.sys
ohci1394 = ohci1394.sys
[B]usbehci = usbehci.sys <=add to here
usbohci = usbohci.sys
usbuhci = usbuhci.sys
usbhub = usbhub.sys
usbstor = usbstor.sys
... now the same for and [InputDevicesSupport]:
InputDevicesSupport]
hidusb = "Human Interface Parser",files.hidusb,hidusb
serial = "Serial Port Driver",files.none,serial
serenum = "Serial Port Enumerator",files.none,serenum
usbccgp = "USB Generic Parent Driver",files.usbccgp,usbccgp
[B]usbehci = "Enhanced Host Controller",files.usbehci,usbehci <=remove from here
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
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
[B]usbehci = "Enhanced Host Controller",files.usbehci,usbehci <=add to here
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
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:
[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
[...]
Finally, save and close TXTSETUP.SIF. We are done with it.