Jump to content

How to boot/install from USB key ?


Halfwalker

Recommended Posts

title Phase 1 WinXP Text Mode Setup

map --read-only (hd0) (hd1)

map --hook

find --set-root /ntldrstp

chainloader /ntldrstp

savedefault 1

sets root (hd0,0), instead of the proper (hd1,0) as ntldrstp is found on both places, that's why I use root (hd1,0), then chainloader /ntldrstp should be fine, instead of chainloader (hd1,0)/ntldrstp

For now I am interested why the same menu.lst did not work on the laptop, I will try to explain it again.

On the laptop if I use the following:

itle Phase 1 WinXP Text Mode Setup

map --read-only (hd0) (hd1)

map --hook

root (hd1,0)

chainloader (hd1,0)/ntldrstp

savedefault 1

it causes laptop to restart, the same way as if NTDETECT.COM is not found in the root. Same entries work just fine on the desktop and result in proper BOOT.INI later like
signature(de33eaf8)disk(0)rdisk(0)partition(1)\WINDOWS

If I use

title Phase 1 WinXP Text Mode Setup

rootnoverify (hd0,0)

chainloader /ntldrstp

on the laptop SETUP starts fine, but cannot confirm whether BOOT.INI will be correct, a lot has to be backed up before I can make tests.

If I use it on my desktop PC, SETUP goes fine, but ends up with incorrect BOOT.INI, pointing to

multi(0)disk(0)rdisk(1)partition(1)\WINDOWS
giving hal.dll is missing, note it does NOT use signature(....) this time.

So we have either to find out why it doesn't work on the laptop, or just find a way to correct BOOT.INI after the final phase of TXT SETUP, when I beleive it's created. With rdisk(1) in boot.ini mapping is not possible, because as I saw in \system32\$winnt$.inf it will look for the installation files on disk(1)

[data]

unattendedinstall=no

floppylessbootpath=\Device\HardDisk1\partition1

producttype=winnt

standardserverupgrade=no

win31upgrade=no

sourcepath=\device\harddisk1\partition1\$win_nt$.~ls

This file was the same with both variants of menu.lst. It seems ntldr, setupldr.bin and the TXT mode setup at some point "ignore" GRUB disk mapping in different way and/or stage.

So, why does the laptop reboot ?

Link to comment
Share on other sites


as ntldrstp is found on both places,

Well, who put ntldrstp on the HD? :blink:

However in this case (on the stick that is prepared before) one can use another file, such as menu.lst, or in "find --set-root" command or directly a "special" marker file, simply open notepad, and save the file as USBOOTME.1ST on the stick.....,"find --set-root /USBOOTME.1ST" will not possibly get the "wrong" root. ;)

For now I am interested why the same menu.lst did not work on the laptop

hmmm, it is possible that the laptop BIOS has some incompatibilities with grub4dos. :wacko:

What happens on the laptop with the "alternate method":

title Phase 1 WinXP Text Mode Setup

map (hd0) (hd1)

map (hd1) (hd0)

root (hd0)

chainloader /ntldr

savedefault 0

You can try, issuing single command lines from the command line, one by one, grub4dos in this case is more "verbose" and one can hopefully pinpoint the single command that causes an error.

jaclaz

Link to comment
Share on other sites

Well, who put ntldrstp on the HD?
GRUB disk mapping i suppose :) If single mapping is used file is found on both drives, if double mapping is used it appears only on the correct drive. But double mapping doesn't work, have a look at the RED quotes in my previous post.

This disk mapping in GRUB is really interesting, as I mentioned it appears that when we do single mapping, we "fool" setupldr.bin and/or ntdetect.com which drive is which, but in later stage this is corrected. In GUI mode thi doesn't work the same way.

It also seems that map (hd0) (hd1) results in same information aviable on both drives, like a "virtual" copy or image, at the same time contents of hd1 are not aviable, thats why for the GUI mode double mapping is needed.

I did try single command in GRUB, actually I use that the most and apply changes later in menu.lst, in my tests set--root /ntldrstp did not do the trick, so I prefer to use

.....

root (hd1,0)

chainloader (hd1,0)/ntldrstp

.....

About the laptop- I was using 2GB Buffalo stick, tried to use 1GB Lexar and using the very same menu.lst (with single mapping) worked :thumbup

Thats where the long Dietmar's thread will comes handy :), I beleive setupldr.bin, ntdetect.com and txtsetup.sif must be written first, before copiyng the other files, may be the laptop BIOS can't see the needed files if they are written too late, but that cause no problems to the AN7 bios. Or it just the USB stick size which matters. However on the Lexar I had an old Nlited installation, not the same "pure" as on the Buffalo.

I will test that later today, fingers crossed :)

Edited by ilko_t
Link to comment
Share on other sites

Yep. if the image is somehow doubled, the fond --set-root won't work, as devices are scanned in order....

A lot of info is coming out from your experiments, I'll have to study it a bit and do some more tests myself...continue reporting... :thumbup

jaclaz

Link to comment
Share on other sites

Well, the same version of GRUB and the final menu.lst worked on another desktop, testing with older/newer versions of GRUB gave result.

The one I was using 0.4.3 - 2007-03-16 was causing troubles on the Dell laptops, I tested it on Inspiron 6000 and 6400.

Both 0.4.2 - 2006-11-26 and 0.4.3 - 2007-04-12 (latest available) worked just fine with the 2GB Buffalo stick on the Dells :) :)

In a next post, if nothings wrong shows until then, I will summarize all the steps.

Link to comment
Share on other sites

So we have either to find out why it doesn't work on the laptop, or just find a way to correct BOOT.INI after the final phase of TXT SETUP, when I beleive it's created. With rdisk(1) in boot.ini mapping is not possible, because as I saw in \system32\$winnt$.inf it will look for the installation files on disk(1)

Problem might be if the destination drive is formatted as NTFS, one could put up a triple boot on the stick with DOS files and this utility:

EditBINI™

This utility will allow you to edit \BOOT.INI in an NTFS partition from DOS or Win9x.

http://www.terabyteunlimited.com/utilities.html

But if the path to the drive is wrongly hardcoded into $winnt$.inf, one would need to use NTFS4DOS, which is free for PERSONAL USE only:

http://www.free-av.com/antivirclassic/avira_ntfs4dos.html

to access the NTFS drive from DOS.

Personally, besides licensing problems for Commercial users, I always prefer the simpler solution so I guess the above could only be an "extreme" workaround, if nothing else work.

I didn't get if you completed the install and if you got with the

[data]

unattendedinstall=no

floppylessbootpath=\Device\HardDisk1\partition1

producttype=winnt

standardserverupgrade=no

win31upgrade=no

sourcepath=\device\harddisk1\partition1\$win_nt$.~ls

the correct C:\ letter on the hard disk (without migrate.inf).

I guess that the setup re-scan the systems and gets again the "HardDisk0" and "HardDisk1" directly from Bios, bypassing the "temporary patch" made by grub4dos.

In a couple VM I tried, the

TXT mode
map (hd0) (hd1)
map (hd1) (hd0)
map --hook
....

works allright, most probably one could prepare instead of a pair of menu entries, several pairs, to allow for "strange" BIOS behaviour...

jaclaz

Link to comment
Share on other sites

I can confirm that

color black/cyan yellow/cyan

timeout 10

default /default

title Phase 1 WinXP Text Mode Setup

map --read-only (hd0) (hd1)

map --hook

root (hd1,0)

chainloader (hd1,0)/ntldrstp

savedefault 1

title Phase 2 WinXP GUI Mode Setup

map (hd1) (hd0)

map --hook

root (hd0,0)

chainloader (hd0,0)+1

savedefault 0

worked fine for the TXT mode on 5 machines - 2 Dell Inspiron Laptops, 1 Dell Dimmension 5150, 1 ABIT AN7 motherboard and 1 Asus P4R800-V motherboard. The problem with the Dell Laptops was in the version of GRUB I was using - 0.4.3 - 2007-03-16. This was causing PC to reboot when TXT Setup was chosen and single disk mapping was performed. The most recent version 0.4.3 - 2007-04-12 and the previous stable version 0.4.2 - 2006-11-26 worked fine on the same Laptops.

The GUI part I finished only on the AN7 PC and all was fine, proper drive letters, boot.ini etc. Later on I will test the whole process on the ASUS PC.

In the migrate.inf I left just these entries, this was enough hard drive to get every time C, and the USB stick D during the SETUP and the make USB stick read-only during the first stage:

[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

May be just the line HKLM,"SYSTEM\ControlSet001\Control\StorageDevicePolicies","WriteProtect",%REG_DWORD%,1 is enough to set read-only mode for the USB storage, but I haven't tested it.

The rest is just as cdob suggested.

If no mapping is made for the TXT mode, on the ABIT AN7 machine it results in incorrect boot.ini pointing to rdisk(1), instead of the proper rdisk(0).

Tests in Vmware or QEMU wouldn't be relevant, because of the lack of USB boot. If the USB image is used as HD1 XP setup will handle it later during the process in different way than the USB stick.

In GRUB mapping I found that single

map (hd0) (hd1)

map --hook

results contents of hd0 to be accessible from both hd0 and hd1, for example NTLDRSTP will be found on both drives. Contents of hd1 are not accessible and could be used when we are not interested in the contents of hd1.
map (hd1) (hd0)

map--hook

does the opposite, the contents of hd0 are this time not accessible, but contents of hd1 are found on both hd0 and hd1. For example NTLDRSTP won't be found from GRUB neither on hd0 nor on hd1 if it was originally on hd0, whereas NTLDR, originally on hd1 will be found on both hd0 and hd1.

During the TXT setup "map (hd0) (hd1)" will be preserved I think up until the last stage, when scanning for partitions and writing the new boot.ini, when the installer finds the new XP installation on hd0, or it scans only fixed drives? No clues why it works this way.

If double mapping is used

map (hd0) (hd1)

map (hd1) (hd0)

map --hook

this will "swap" the two hard disks, giving access to the contents of both using the new disk number. If we use double mapping, which logically seems the proper one, XP TXT setup complains about missing txtsetup.sif. Why starting it from second hard drive causes that I don't know. Double mapping could be used for the GUI part, when we need XP to be on hd0 and the source files on hd1, but is not needed since the XP installer at some point rescans or resets this information.

Another idea- wouldn't it be better to use a similar to the XP CD approach for the default boot order, to make the hard drive default with 10-15 secs time-out as the TXT mode is used only once, but the hard drive will have to be booted at least twice (or more for custom installation).

edit: we also need to undo the write-protected mode for USB once install is completed, how do we do that?

Edited by ilko_t
Link to comment
Share on other sites

Another idea- wouldn't it be better to use a similar to the XP CD approach for the default boot order, to make the hard drive default with 10-15 secs time-out as the TXT mode is used only once, but the hard drive will have to be booted at least twice (or more for custom installation).

Yes, that would be nice, but right now I have no idea on how to do it, unless we cycle to another

menu.lst through the "config-file" command, but I cannot see at the moment how to conditionally do that.

If I remember right, there is a feature like this in "Linux" grub, that uses variables, there is this guy, Adrian Raulete, that made this "Grub superdisk" or something like that. It uses this feature to make a very complex multilevel boot menu but last time I played with grub4dos it didn't have this feature, or at least I wasn't able to make it work. I'll have a look at the idea and see if something comes out.

edit: we also need to undo the write-protected mode for USB once install is completed, how do we do that?

Well, that should be the easiest thing, it should just be a Reg file merged at the end of GUI setup or, if you prefer, on first "real boot" of the newly installed OS.

I am not an expert at all on this but in one or the other "unattended" sections of the board there is info for this.

Maybe cdob might help on this particular thing.

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

Here is a quick guide how I proceeded with 100% success on ATA hard drives.

1. Format the USB stick, I used HP USB Format tool, because XP format was reported as incorrect in GRUB.

2. Install GRUB MBR on the stick, the quickest way I found is by GRUBINST_GUI for WIN

3. Get the latest GRUB4DOS and copy GRLDR to the USB root.

Create MENU.LST in USB root

color black/cyan yellow/cyan

timeout 15

default 1

title Phase 1 WinXP Text Mode Setup

map --read-only (hd0) (hd1)

map --hook

root (hd1,0)

chainloader /ntldrstp

title Phase 2 WinXP GUI Mode Setup

map (hd1) (hd0)

map --hook

rootnoverify (hd0)

chainloader +1

This way the default entry is GUI mode, TXT mode must be selected manually. With these GUI entries XP can be installed and booted later from another partition on the hard drive, not only from the first.

4. Backup your current BOOT.INI and in the XP setup folder \I386 run

winnt32 /makelocalsource /noreboot
after it's finished restore BOOT.INI

5. Copy two new folders in 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"

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 you can preserve your USB storage drive letter keeping the relevant entries in migrate.inf. Note your current USB drive letter and find the line (mine is set to U)
HKLM,"SYSTEM\MountedDevices","\DosDevices\U:",0x00030001,\

5c,00,3f,00,3f,00,5c,00,53,00,54,00,4f,00,52,00,41,00,47,00,45,00,23,00,52,\

00,65,00,6d,00,6f,00,76,00,61,00,62,00,6c,00,65,00,4d,00,65,00,64,00,69,00,\

61,00,23,00,37,00,26,00,31,00,34,00,39,00,31,00,63,00,63,00,33,00,34,00,26,\

00,30,00,26,00,52,00,4d,00,23,00,7b,00,35,00,33,00,66,00,35,00,36,00,33,00,\

30,00,64,00,2d,00,62,00,36,00,62,00,66,00,2d,00,31,00,31,00,64,00,30,00,2d,\

00,39,00,34,00,66,00,32,00,2d,00,30,00,30,00,61,00,30,00,63,00,39,00,31,00,\

65,00,66,00,62,00,38,00,62,00,7d,00

, I found that it's not needed. [strings] must be present.

7. Create:

undoUSBWP.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies]

"WriteProtect"="0"

and

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 place them in $WIN_NT$.~LS\i386

8. Copy TXTSETUP.SIF, SETUPLDR.BIN and NTDETECT.COM from \$WIN_NT$.~BT to root of USB stick. Delete BOOTSECT.DAT (necessary?) and rename SETUPLDR.BIN to NTLDRSTP, or modify the relevant entries in MENU.LST

9. Add the following lines to TXTSETUP.SIF

[sourceDisksFiles].....

.....

hiveOEM.inf = 100,,,,,,_x,,3,3

undoUSBWP.reg = 100,,,,,,_x,2,0,0

....

....

[HiveInfs.Fresh]

AddReg = hiveOEM.inf,AddReg

10. If you use unattended mode for the setup make sure you delete the whole [unattend] section, otherwise you won't be able to use System Restore and SETUP will not prompt on which partition to install.

I used BTS mass-storage drivers pack, with KTD option and Nlited fully unattended installation, to keep Nlite options copy the relevant entries from the original WINNT.SIF to the new one, don't forget to delete the whole [unattended] section. [Data] section do not modify except UseSignatures="no". Also copy $OEM$ to \$WIN_NT$.~LS\i386 and OEM (BTS scripts) to the root of USB stick.

Thanks a lot to porear and jaclaz :)

All credits for the most important part- how to write- protect the USB flash go to cdob, many thanks :)

edit: Forgot to mention that removing write-protect mode after GUI is finished is also done in steps 6 and 7.

edit2: some typos corrected, txtsetup.sif

Edited by ilko_t
Link to comment
Share on other sites

On ATA drives I had success on all 3 different machines, but on SATA drives it went nowhere. The SATA drive appears after the USB stick when SETUP detects disk configuration. I've tried different mapping in GRUB to no avail, no mapping at all, and preserving the USB drive letter. In every occasion SATA drive was recognized after USB:

satago2.jpg

On ATA drives it looks like that:

idehd6.jpg

Continuing installation when SATA drive is second cause XP boot sector and NTLDR/BOOT.INI being written to the USB stick, corrupting the partition table, then SETUP complains about damaged drive D (or U when old mounted devices was used) and a new boot from the stick is not possible. Repairing GRUB MBR fixes boot, but some files are missing. This was tested on 2 different SATA controllers, Sil2112r and SIS Sata. No IDE drives were attached, only one SATA disk.

Any ideas? May be Dietmar's way of installing XP directly on USB and a separate driver for the USB storage could help, I am going to study this option further.

BTW while studying BTS KTD method I noticed the usage of presetup.cmd, which is launched in GUI mode right before anything else. So another way to write-protect the USB during GUI part could be a single line like REG ..... or regedit ... if it's available at that stage. Any ideas when postsetup.cmd is launched? Google returns no results.

edit: About the long wait at T-1- if we find a way to rename the 2 folders on USB, at lets say T-20 or after installing devices, where source files are no longer needed and make post- setup script renaming them back, this may "fool" setup to stop looking for them and avoid the long wait. If anyone has an idea which method could be used for this purpose would be great.

Edited by ilko_t
Link to comment
Share on other sites

Continuing installation when SATA drive is second cause XP boot sector and NTLDR/BOOT.INI being written to the USB stick, corrupting the partition table,

(hopefully) some ideas to solve this part of the problem:

I doubt that partition table gets corrupt.

The MBR code is replaced, that's all.

It should be quite easy to work around the problem (from the beginning, INSTEAD of your step #2):

1) DO NOT install grdr.mbr

2) Install normally the XP MBR and bootsector (i.e. do nothing, the HP utility will do it)

3) add to root of the stick GRLDR

4) add to root of the stick NTLDR

5) Add to root of the stick a BOOT.INI like this:

[Boot Loader] 
Timeout=10
Default=C:\GRLDR
[Operating Systems]
C:\GRLDR="Start GRUB"

This way grub4dos is chainloaded through "normal" NTLDR.

Also, you don't need to rename setupldr.bin to ntldrstp.

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

Continuing installation when SATA drive is second cause XP boot sector and NTLDR/BOOT.INI being written to the USB stick, corrupting the partition table,

(hopefully) some ideas to solve this part of the problem:

I doubt that partition table gets corrupt.

The MBR code is replaced, that's all.

I thought the same, but the fact is when this happens SETUP starts complaining corrupted drive U (the USB stick) and cannot continue install. If I fix GRUB MBR and reboot GRUB complains about invalid or unrecognized partition table but still is able to find SETUPLDR.BIN, the problem is that SETUP complains about missing files, at least 10-20 files are reported as missing. May be it just partly corrupted of something because of the different ways it's formated and the way SETUP sees USB stick, because of the read-only switch in GRUB, or because of the GRUB mapping, you may have better explanation. Actually its not because of drive mapping in GRUB, I remember that I tested with no mapping at all, simply invoking setupldr.bin and MBR got corrupted again.
It should be quite easy to work around the problem (from the beginning, INSTEAD of your step #2):

1) DO NOT install grdr.mbr

2) Install normally the XP MBR and bootsector (i.e. do nothing, the HP utility will do it)

3) add to root of the stick GRLDR

4) add to root of the stick NTLDR

5) Add to root of the stick a BOOT.INI like this:

[Boot Loader] 
Timeout=10
Default=C:\GRLDR
[Operating Systems]
C:\GRLDR="Start GRUB"

This way grub4dos is chainloaded through "normal" NTLDR.

Also, you don't need to rename setupldr.bin to ntldrstp.

jaclaz

This is an option, but SETUP will still place its boot files on the USB stick, as it's seen as the first hard drive and the first active partition, not on the hard drive. If stick is already with NT MBR this may prevent file corruption, but then we well have to place BOOT.INI and NTLDR on the hard drive and also work on the GRUB mapping and invoking the GUI part. Another option is in BOOT.INI to make second entry pointing to the hard drive, thus we can invoke the GUI part from BOOT.INI instead of GRUB. Also a small script or manual copy of NTLDR and a proper boot.ini to the hard drive will be needed.

A way I can think of is somehow to force TXT SETUP to see USB stick as second drive, or removable if it is not seen as such, this will make it place the needed boot files on the hard drive, either by driver or by relevant registry entries placed by migrate.inf.

I rename setupldr.bin because on second partition I intend to place Bart PE files and/or working XP to experiment and it's easier to manage partitions and drive mapping in GRUB, if one intends to use stick solely for XP install it's not needed.

Edited by ilko_t
Link to comment
Share on other sites

Different user have different needs.

I consider USB WinXP installation as a emergency solution.

This should work at different machines, manually parts are allowed.

My menu.lst part is pretty dump

title boot /$WIN_NT$.~BT/setupldr.bin
chainloader /$WIN_NT$.~BT/setupldr.bin

As known, this gives a broken boot.ini pointing to rdisk(1).

A "map (hd0) (hd1)" use fixed hdN numbers.

At different machines both source and target may use different hdN numbers.

E.g. a internal card reader may result in different hdN numbers.

And different BIOS use different USB boot handling.

A new unkown machine may get different results to previous experience.

That's not a general solution.

A general working unattended solution would be nice.

In the meantime I use a manually workarround:

I knew false boot.ini entries from the past and will recognice this in future.

I manually edit boot.ini at first reboot.

$winnt$.inf was not edited, false entries are there still.

Recovery console, PE and Knoppix are at this USB stick anyway.

I din't used unattended feature to remove USB write protection.

At first windows boot, I opened regedit.exe and deleted StorageDevicePolicies.

A idea, NOT tested: 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

;remove WriteProtect USB at first windows boot
HKLM,"Software\Microsoft\Windows\CurrentVersion\RunOnce","Remove_WriteProtect",,"reg.exe delete HKLM\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies /f"

;set OEM drivers at USB U:
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion","DevicePath",0x00020002,"%SystemRoot%\inf;U:\OEM_driver\int1;U:\OEM_driver\vga1"

ilko_t's winnt.inf [GuiRunOnce] remove WriteProtect makes more sense.

Some fun:

title boot (hd1,0)/$WIN_NT$.~BT/setupldr.bin
map --read-only (hd0) (hd1)
map --hook
root (hd1,0)
chainloader (hd1,0)/$WIN_NT$.~BT/setupldr.bin
savedefault 1

Setup is started, textmode does work, first reboot fails.

Broken boot.ini: multi(0)disk(0)rdisk(2)partition(1)\WINDOWS2

Recognice rdisk(2), that's not rdisk(1).

A second USB stick was attached too.

Idea: second USB stick was hd1, internal harddisk hd2.

After removing second USB stick, grub4dos fails: Error 27: Disk read error.

There is a internal SATA ACHI hd with NTFS partitions.

Neither at second second USB stick not hard disk is a /$WIN_NT$.~BT/setupldr.bin.

/$WIN_NT$.~BT/setupldr.bin exist once at hole machine.

chainloader (hd1,0)/ntldr_bt give Error 27 too.

Second USB stick inserted again:

map --read-only (hd0) (hd2)
map --hook
root (hd2,0)
chainloader (hd2,0)/$WIN_NT$.~BT/setupldr.bin

Setupldr.bin is loaded, however ntdetect failed.

At the other hand boot.ini signature(de33eaf8) indicates:

Windows setup detected some strange environment and use a fall back settings.

Requested settings ask grub4dos to build a insane mapping: two hds mapped to the same hdX.

That's a broken design. Contrary this may work at all machines or fail at some machines.

I like a fixed USB drive letter still, compare OEM drivers at USB U:

So I created a first version to extract MountedDevices setting.

Copy MkMigratgeInf.cmd to <USB drive>\$WIN_NT$.~BT\MkMigratgeInf.cmd and launch it. This USB drive is mapped to DosDevices U:.

A MIGRATE.INF.TXT is created, open it and read file. Rename file to migrate.inf.

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

A XP default reg.exe is expected.

By the way:

A RAM loaded PE image read file \I386\system32\migrate.inf.

Another untesed idea: use migrate.inf for general settings

Create tow similar PE, small registry changes.

Two setupldr.bin: one calls migrate.inf, another calls migrat2.inf.

Link to comment
Share on other sites

Interesting results :)

I wouldn't think of installing with 2 sticks inserted, exactly because of the GRUB mapping.

Tested your script for migrate.inf resulted in correct entries, however may be adding the write-protect entries will be handy, so we'd have a completed migrate.inf.

About the boot.ini signatures- I agree that it shouldn't be made this way, but as far as I tested it on different machines it worked fine, at least creating boot.ini pointing to the right place.

If we don't use mapping we end up with boot.ini to be modified, an idea how to do it automatically is to place NTLDR and boot.ini on the USB stick, pointing to the hard drive partition with the new installation, invoke NTLDR from GRUB, and at some stage during the GUI part copy NTLDR, NTDETECT.COM and a generic BOOT.INI to the root (if SATA disk is used), and edit BOOT.INI. Presetup.cmd will do the job in this case.

Bootcfg.exe behaves in different way in recovery console and XP environment, how it will work during GUI is to be tested. May be a cmd script would also do the work (I am not into this part at all) or another tool like bootpart may do it for us. Still searching for an automated solution to edit boot.ini, a program or script, started by presetup.cmd.

With SATA disks I still have no luck at all- if it's not a "native" controller, SATA disks are listed as second, after USB stick and SETUP places boot files on the stick rewriting the boot sector. With 2 sticks I tested- Buffalo 2GB and Lexar 1GB when formated by XP I can't boot NTLDR- "disk error, press any key to restart..". If I format it with HP utility they both boot fine, but when TXT setup rewrites boot sector it corrupts some files and makes next boot impossible. Format in Fat16 and 32 makes no difference. Manually editing the stick geometry using methods suggested by jaclaz will be of no use, as I beleive TXT setup will still place its boot sector on the wrong place considering the way it sees USB stick.

I am currently searching for solution how to list USB after non-native SATA if that's possible at all, may be something in txtsetup.sif will help, or driver loaded along with the other SATA/SCSI drivers, but the information I find is quite limited.

Haven't found out yet when exactly postsetup.cmd is launched, may be it will help to rename the source folders temporary avoiding the long wait at T-1. At first boot we rename source folders back. If anyone knows what else could be used to launch cmd script after T-20 or T-15, when setup files are no longer needed, please help :)

A little offtopic- another way I am working on is also much quicker and universal- USB stick carrying an image of (not necessary) sysprep-ed "generic" XP installations. Different HALs are no issue, 0x7B BSOD is resolved by the relevant CriticalDevicesDatabase entries with the corresponding drivers and services. Intelppm service, causing BSOD on some AMD machines is disabled in advance.

Regards, Ilko_t

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...