Here is the edited guide for Windows XP SP2, on 2k/2k3 should work too.
1. Format stick using
PEtoUSB or any other utility of your choice, which makes it bootable with 2k/XP boot sector
2. Copy
NTDETECT.COM,
NTLDR to root and create
BOOT.INI
BOOT.INI
[Boot Loader]
Timeout=15
Default=multi(0)disk(0)rdisk(1)partition(1)\WINDOWS
[Operating Systems]
c:\grldr="Start GRUB"
multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="GUI Setup" /FASTDETECT
If you are going to install on another partition/disk amend entries to reflect that.
Make sure you can boot from stick and reach the menu.
3. Get the
latest GRUB4DOS and copy
GRLDR to the USB root. If you have any issues use the last stable version. Create in USB stick root
MENU.LST
color black/cyan yellow/cyan
timeout 15
default 0
title Phase 1 WinXP Text Mode Setup
chainloader (hd0,0)/setupldr.bin
4. Backup your local
BOOT.INI and in the XP setup folder
\I386 run
winnt32 /makelocalsource /noreboot
after it's finished restore
BOOT.INI you backed up.
5. Copy two new folders onto the USB stick root -
$WIN_NT$.~BT and
$WIN_NT$.~LS
6. In
\$WIN_NT$.~BT modify
WINNT.SIF
[data]
msdosinitiated="1"
floppyless="1"
AutoPartition="0"
UseSignatures="no"
InstallDir="\WINDOWS"
winntupgrade="no"
win9xupgrade="no"
[GuiRunOnce]
"regedit /s %systemdrive%\windows\system32\undoUSBWP.reg"
"%systemdrive%\windows\system32\BOOTFLS.CMD"
and
MIGRATE.INF
[Version]
Signature = "$Windows NT$"
[Addreg]
HKLM,"SYSTEM\MountedDevices",,0x00000010
HKLM,"SYSTEM\ControlSet001\Control\StorageDevicePolicies","WriteProtect",%REG_DWORD%,1
[Strings]
;Handy macro substitutions (non-localizable)
REG_SZ = 0x00000000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
REG_MULTI_SZ = 0x00010000
REG_SZ_APPEND = 0x00010008
REG_EXPAND_SZ = 0x00020000
If you wish to preserve your USB storage drive letter use
CDOB's script to create MIGRATE.INF, don't forget to add the above entries :
MkMigratgeInf.cmd
@echo off
REM MkMigratgeInf.cmd v0.01
REM created by cdob
setlocal EnableExtensions
set Drive=%~d1
if %Drive%.==. set Drive=%~d0
set FileName=%~2
if %FileName%.==. set FileName=MIGRATE.INF.TXT
set MigrateDrive=U:
if not %~d3.==. set MigrateDrive=%~d3
set Value=
FOR /F "skip=2 tokens=1-2*" %%a IN ('reg query HKLM\System\MountedDevices /v \DosDevices\%Drive%') DO set Value=%%c
if %Value%.==. (echo drive settings %Drive% not found & goto :EOF)
set MigrateStr=%Value:~0,2%
set count=2
:begin_parse
call :exec set MidStr=%%Value:~%count%,2%%
if %MidStr%.==. goto :exit_parse
set MigrateStr=%MigrateStr%,%MidStr%
set /a count+=2
goto begin_parse
:exit_parse
(echo [Version]
echo Signature = "$Windows NT$"
echo.
echo [Addreg]
echo HKLM,"SYSTEM\MountedDevices","\DosDevices\%MigrateDrive%",0x00030001,\
echo %MigrateStr%)>%FileName%
goto :EOF
:exec
%*
goto :EOF
7. Create a folder
BOOTFILES in USB stick root, and copy
NTDETECT.COM,
NTLDR and create there your custom
BOOT.INI, which will be copied on hard disk later, during the first logon. Set them system, hidden and read-only in advance.
BOOT.INI
[boot loader]
timeout=15
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Professional 0 1" /noexecute=optin /fastdetect
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="XP Professional 0 2" /noexecute=optin /fastdetect
multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="XP Professional 0 3" /noexecute=optin /fastdetect
multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="XP Professional 1 1" /noexecute=optin /fastdetect
multi(0)disk(0)rdisk(1)partition(2)\WINDOWS="XP Professional 1 2" /noexecute=optin /fastdetect
multi(0)disk(0)rdisk(1)partition(3)\WINDOWS="XP Professional 1 3" /noexecute=optin /fastdetect
8. Create:
undoUSBWP.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies]
"WriteProtect"="0"
hiveOEM.inf
[Version]
Signature = "$Windows NT$"
DriverVer=07/01/2001,5.1.2600.2180
[AddReg]
;WriteProtect USB
HKLM,"SYSTEM\CurrentControlSet\Control\StorageDevicePolicies","WriteProtect",0x10001,1
and
BOOTFLS.CMD
@echo off
SET TAGFILE=\BOOTFILES
FOR %%h IN (C D E F G H I J K L M N O P Q R S T U V W X Y) DO IF EXIST "%%h:%TAGFILE%" SET USBDRIVE=%%h:
xcopy %USBDRIVE%\bootfiles\*.* %SYSTEMDRIVE%\ /y /h /r /k
exit
and place them in
$WIN_NT$.~LS\i386
9. Copy
TXTSETUP.SIF and
SETUPLDR.BIN from
\$WIN_NT$.~BT to root of USB stick and add the following lines to
TXTSETUP.SIF
[SourceDisksFiles].....
.....
hiveOEM.inf = 100,,,,,,_x,,3,3
undoUSBWP.reg = 100,,,,,,_x,2,0,0
BOOTFLS.CMD = 100,,,,,,_x,2,0,0
....
....
[HiveInfs.Fresh]
AddReg = hiveOEM.inf,AddReg
[HiveInfs.Upgrade]
AddReg = hiveOEM.inf,AddReg
--------
Install XP and leave stick plugged in until after the first logon screen.
Notes:
1. If you use an answer file when launching WINNT32.EXE make sure you delete the whole [Unattend] section in WINNT.SIF, otherwise you won't be able to use System Restore and SETUP will not prompt on which partition to install.
2. If you use BTS mass storage DP method 2 and
repair install then include the following line in \$WIN_NT$.~LS\I386\
PRESETUP.CMD
DEL /F %systemroot%\system32\setupold.exe
or GUI Setup stops at start, complaining about fake setup being executed.
3. If during TEXT MODE your usb stick is listed first when SETUP searches for disks , above SATA/SCSI disks, disable in BIOS IDE channels including the ones with CDROM/DVD attached or disconnect them, this should fix the order. Do not continue install if stick is listed first, this will corrupt files and MBR on it.
------------------------------------
All credits for the most important part- how to write- protect the USB flash go to
cdob
Many thanks to
jaclaz,
wimb and
porear
This post has been edited by ilko_t: 28 May 2007 - 05:48 PM