Jump to content

How to boot/install from USB key ?


Halfwalker

Recommended Posts

Saved a copy of USB stick bootsector with HDHacker, hexedited it and changed NTLDR to STLDR, saved it on stick as bootsect.dat, rename setupldr.bin to stldr, add in boot.ini

Well, you missed my post here:

http://www.msfn.org/board/index.php?showto...1384&st=218

And the batch I wrote:

http://www.boot-land.net/forums/index.php?showtopic=2362

it does EXACTLY that.

Allowed are ANY 8+3 names, so you can leave SETUPLDR.BIN as is without renaming it. ;)

(You may notice the amount of feedback I received :whistle:, I guess that changing loader in bootsectors is an activity that very few people do)

About the arcpath, I am still thinking about it, the problem may lay with some "unorthodox" Partition tables, see these:

http://www.goodells.net/multiboot/editbini.htm

http://www.goodells.net/multiboot/notes.htm#10

Easiest would probably "assume" that one would use USB install just for installing XP on FIRST PRIMARY partition of FIRST harddisk, as it happens, say, in 99% of cases and operate a manual adjustement for the remaining 1% (like myself) that install to Logical Volumes inside Extended Partition or that install to a non first hard disk.

In this case the batch could ask user if he installed it to first active partition of first disk, and if answered yes write on BOOT.INI a line referencing multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

or otherwise write several lines like:

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

multi(0)disk(0)rdisk(0)partition(2)\WINDOWS

multi(0)disk(0)rdisk(0)partition(3)\WINDOWS

multi(0)disk(0)rdisk(0)partition(4)\WINDOWS

multi(0)disk(0)rdisk(0)partition(5)\WINDOWS

multi(0)disk(0)rdisk(1)partition(1)\WINDOWS

multi(0)disk(0)rdisk(1)partition(2)\WINDOWS

multi(0)disk(0)rdisk(1)partition(3)\WINDOWS

multi(0)disk(0)rdisk(1)partition(4)\WINDOWS

multi(0)disk(0)rdisk(1)partition(5)\WINDOWS

Another idea would be to parse the existing boot.ini lines with:

multi(0)disk(0)rdisk(z)partition(w)\windir

get the rdisk(z) value and just subtract 1 from it, leaving al the rest as is.

What do you think of this last idea, it came to me just as I was writing this post, could it work? :unsure:

If yes, I think I can jolt it down in batch quite easily.....

jaclaz

Link to comment
Share on other sites


Well, you missed my post here:

http://www.msfn.org/board/index.php?showto...1384&st=218

And the batch I wrote:

http://www.boot-land.net/forums/index.php?showtopic=2362

it does EXACTLY that.

Allowed are ANY 8+3 names, so you can leave SETUPLDR.BIN as is without renaming it. ;)

(You may notice the amount of feedback I received :whistle:, I guess that changing loader in bootsectors is an activity that very few people do)

Shame on me :blushing:, my memory is so short, I even downloaded that script when you posted the link here, but completely forgot about it. Yesterday I was reading wimb's ideas and though "why not try this on Xp from USB?" and it worked. Apologies for the ignorance.

About the arcpath...

Another idea would be to parse the existing boot.ini lines with:

multi(0)disk(0)rdisk(z)partition(w)\windir

get the rdisk(z) value and just subtract 1 from it, leaving al the rest as is.

What do you think of this last idea, it came to me just as I was writing this post, could it work? :unsure:

If yes, I think I can jolt it down in batch quite easily.....

jaclaz

I think that should do the trick, we need to change only rdisk, the rest is always OK, however I am not sure what the situation will be on mixed SATA/ATA disks environment.

Mind you when preparing the script to think about a situation when another XP exist, and a second copy is being installed. In this case SETUP will preserve the old lines, will change the default line and add a new one under [operating systems], am I right? In this case will you be able to keep the old line(s) and amend just the 2 new lines?

I haven't had spare time to experiment with CHKBTINI, will do it as soon as I can, it may be just enough to fix boot.ini when run before the end of GUI part.

Link to comment
Share on other sites

Well, you missed my post here:

http://www.msfn.org/board/index.php?showto...1384&st=218

And the batch I wrote:

http://www.boot-land.net/forums/index.php?showtopic=2362

it does EXACTLY that.

Allowed are ANY 8+3 names, so you can leave SETUPLDR.BIN as is without renaming it. ;)

(You may notice the amount of feedback I received :whistle:, I guess that changing loader in bootsectors is an activity that very few people do)

Already sometime ago I tried your script, but was not able to use it.

Link to comment
Share on other sites

The idea came from this post of yours and wimb's posts in 911cd.net about loading io.sys via boot.ini.

Saved a copy of USB stick bootsector with HDHacker, hexedited it and changed NTLDR to STLDR, saved it on stick as bootsect.dat, rename setupldr.bin to stldr, add in boot.ini

c:\bootsect.dat="TXT Setup"

TXT mode worked just fine, GRUB is no longer needed

Good to hear that TXT-mode Setup can be added to boot.ini Menu and that GRUB4DOS is no longer needed.

I have tested it and everything is OK :)

Launching TXT-mode Setup Windows XP via boot.ini has been added

as one of the boot options in my post #5 in 911cd.net

http://www.911cd.net/forums//index.php?showtopic=20036

The MultiBoot USB-stick is becoming more and more versatile

with all the new boot options via boot.ini Menu :thumbup

Regards, wimb

Edited by wimb
Link to comment
Share on other sites

Already sometime ago I tried your script, but was not able to use it.

Well, this does not help much in correcting it (if needed ;)), does it? :unsure:

Can you reply to the original topic on boot-land (as to not clutter this one) and tell me more about the problems you had?

I tested it on two separate machines, and it worked, but since both PC's are my own, they have very similar setups so they do not represent a good test.

@ilko_t

I'll try and see what I can come out with.

About the "already" present lines, it should not be a problem since, if I a not mistaken the "new" entry will be by default the "default" one (pardon me the pun ;) ).

What I mean is, if on First hard disk there is already a "complex"BOOT.INI like this:

[boot Loader]

Timeout=5

Default=multi(0)disk(0)rdisk(0)partition(5)\WINNT

[Operating Systems]

multi(0)disk(0)rdisk(0)partition(5)\WINNT="Microsoft Windows 2000 Professional IT" /fastdetect

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect

multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="Microsoft Windows XP Home Edition" /fastdetect

multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP" /fastdetect

C:\Bootsect.w98="Windows 98 Command Line" /win95

C:\BOOT\FDOS1440.bin="Test boot"

The result when modified by the new install, let's say on first hard disk, partition 3, will be:

[boot Loader]

Timeout=5

Default=multi(0)disk(0)rdisk(z)partition(3)\WINDOWS

[Operating Systems]

multi(0)disk(0)rdisk(0)partition(5)\WINNT="Microsoft Windows 2000 Professional IT" /fastdetect

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect

multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="Microsoft Windows XP Home Edition" /fastdetect

multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP" /fastdetect

C:\Bootsect.w98="Windows 98 Command Line" /win95

C:\BOOT\FDOS1440.bin="Test boot"

multi(0)disk(0)rdisk(z)partition(3)\WINDOWS="Microsoft Windows XP Professional" /fastdetect

And what the batch has to do is to look at the arcpath specified in "Default=" and change just that entry and the corresponding menu one below with same arcpath as follows:

[boot Loader]

Timeout=5

Default=multi(0)disk(0)rdisk(z-1)partition(3)\WINDOWS

[Operating Systems]

multi(0)disk(0)rdisk(0)partition(5)\WINNT="Microsoft Windows 2000 Professional IT" /fastdetect

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect

multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="Microsoft Windows XP Home Edition" /fastdetect

multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP" /fastdetect

C:\Bootsect.w98="Windows 98 Command Line" /win95

C:\BOOT\FDOS1440.bin="Test boot"

multi(0)disk(0)rdisk(z-1)partition(3)\WINDOWS="Microsoft Windows XP Professional" /fastdetect

Am I correct?

What happens with SATA drives?

jaclaz

Link to comment
Share on other sites

Already sometime ago I tried your script, but was not able to use it.

Well, this does not help much in correcting it (if needed ;)), does it? :unsure:

Can you reply to the original topic on boot-land (as to not clutter this one) and tell me more about the problems you had?

I tested it on two separate machines, and it worked, but since both PC's are my own, they have very similar setups so they do not represent a good test.

I have used your script and was able now to use it successfully !

In Boot-land Forum http://www.boot-land.net/forums/index.php?showtopic=2362

is described the solution of the problem I had on first use of the script.

Link to comment
Share on other sites

....And what the batch has to do is to look at the arcpath specified in "Default=" and change just that entry and the corresponding menu one below with same arcpath as follows:
[boot Loader]

Timeout=5

Default=multi(0)disk(0)rdisk(z-1)partition(3)\WINDOWS

[Operating Systems]

multi(0)disk(0)rdisk(0)partition(5)\WINNT="Microsoft Windows 2000 Professional IT" /fastdetect

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect

multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="Microsoft Windows XP Home Edition" /fastdetect

multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP" /fastdetect

C:\Bootsect.w98="Windows 98 Command Line" /win95

C:\BOOT\FDOS1440.bin="Test boot"

multi(0)disk(0)rdisk(z-1)partition(3)\WINDOWS="Microsoft Windows XP Professional" /fastdetect

Am I correct?

What happens with SATA drives?

jaclaz

Yep, that's it.

About SATA drives- if it is a mixed environment- SATA+ATA, USB stick would be listed fisrt when hard drives are detected by TXT Setup, if one plans to install on ATA when SATA is present, SATA disk must be disconnected or controller disabled, and vice versa, if installation is on SATA and IDE (no matter CD or HD) is present it must be disconnected/controler disabled. This might be BIOS dependant.

Therefore SATA/ATA shouldn't matter for script's functionality.

ilko

Link to comment
Share on other sites

Hey guys,

I've been following all the stunning progress you guys have been making here - very impressive! I had one other suggestion though, that might work. If you read uberplay's OEM guide (http://uberplay.org/Documents/oemguide3.html), it demonstrates how it is possible to use sysprep + vistaPE to install any version of windows for which a sysprep exists. Notably, it does a vista-style partitioning system I believe, then simply installs your carefully setup system - you can even integrate all sorts of drivers, hotfixes and programs very easily, and with a faster install time than nlite gives. As vista can easily be installed from a USB disc, I imagine this can? Has anyone tried this?

Wrayal

Link to comment
Share on other sites

Ok, here is the tentative :rolleyes: batch to transform rdisk(z) into rdisk(z-1)

As is, it is a bit complicated by the fact that it is written for debugging, it works with a boot.ini in the same directory as the batch, and, knowing how people love working in directories with spaces in them (why? :unsure:) provides support for them.

Once it has been tested with positive results, it could be simplified as to work with %drive%\BOOT.INI.

@ilko_t

BOOT.INI should always be on C:\BOOT.INI, whatever the hard disk(s) setup is, am I correct?

jaclaz

binifix.zip

Link to comment
Share on other sites

I have been testing binifix.cmd and got:

C:\>binifix.cmd
Drive is C:
Source is "C:\BOOT.INI"
Druk op een toets om door te gaan. . .
DefaultEntry is
EntryDesc is
Timeout is
4==scsi niet verwacht op dit moment.
C:\>

Is not working yet, approach is interesting, will try to find source of problem.

wimb

Edited by wimb
Link to comment
Share on other sites

@jaclaz

I like rdisk(z-1) idea.

This should work in most cases. Tests have to follow.

Strange BIOS, like wanderer's BIOS, may get different results.

I changed one line at binifix.cmd.

rem IF "%%A"=="Default" SET DefaultEntry=%%B
IF /I "%%A"=="default" SET DefaultEntry=%%B

Signature compare Post #34

http://www.msfn.org/board/index.php?s=&amp...st&p=585105

Dosn't signature() contain rdisk(0) already?

Do we habe to change a signature() line?

Nice, your code is already fail safe

ERROR

DefaultEntry is multi(0)disk(0)rdisk(0)partition(1)\WINNT

The rdisk value is ALREADY 0

You don't want me to set it as -1, don't you?

Yes BOOT.INI should always be on C:\BOOT.INI, but it isn't always in real life.

Please read Post #220, boot.ini is seeked at %SystemDrive%. If this fails, drive letters are seeked in decending order.

This support more cases. Of course this may fail at strange machines.

Given a default MS MBR: How to detect the drive letter of primary active partition?

Can you backup a existing boot.ini as e.g. boot.bak?

%date% from Post #220 was a bad idea. This may fail at different languages.

Link to comment
Share on other sites

The line to SET Timeout requires also to be changed by adding /I

IF /I "%%A"=="Timeout" SET Timeout=%%B

But then binifix.cmd does its job OK :)

Due to delims== the EntryDesc misses the last part =optin /fastdetect

Edited by wimb
Link to comment
Share on other sites

@cdob

@wimb

Good work in bug finding guys! :)

I'll try and fix the reported misbehaviour of the batch.

@cdob

Yes, I just added the signature(aabbccdd) syntax as a "proof of concept" that the "logic" in the batch can be adapted to ANY situation, you are right, we can get rid of it in "final" release.

About drive letter, I give as assumed that boot.ini is on the root of the drive, I wasn't sure that, at the time when the batch needs to be run, %systemdrive% represents correctly the latter (and I am still NOT convinced of it, I know I am a bit tough ;)) but as I usually, and from immemorable time, install Windows NT/2K/XP in extended partitions, %systemdrive% does NOT represent the BOOT drive.

I had gathered from the thread that the "definitive" boot.ini is ALWAYS on C:\, boot drive, i.e. First Primary Active Partition of First Hard Disk, no matter where windows is installed, I would like to have a confirm of that, otherwise I think we need to use the batch passing to it a parameter.

Given a default MS MBR: How to detect the drive letter of primary active partition?

No problem if I can access the DosDevices key of the Registry, what I am not sure about is if at the time the batch is meant to run the Registry is accessible (I suppose not) and if the proper entry has already been written to the key.

But, as said, if NO other "strange" setting has been applied, First Primary Active Partition of First Hard Disk, should always be C:\, maybe I can add the drive letter as an optional parameter for the batch (if not supplied willl default to C: ) :unsure:

No prob in adding a BOOT.INI -> BOOT.BAK feature, nice (and safe) idea. :)

@wimb

Can you post an example of line where the "=" sign is used on the left of the "main" "=" sign for description?

Also, are there any cases where more than one "=" sign is used (besides the "main" one)?

I guess I can modify the "tokens=1,2" "to tokens 1,*" or "tokens 1,2,3", but I need one (or more) example(s) to test the behaviour.

jaclaz

Link to comment
Share on other sites

Good job :thumbup.

No problem if I can access the DosDevices key of the Registry, what I am not sure about is if at the time the batch is meant to run the Registry is accessible (I suppose not) and if the proper entry has already been written to the key...
Script could be run at first logon via [GUIRunOnce] along with undoren.cmd, when folders on stick are renamed back to ~LS and ~BT, so it should be OK.
Link to comment
Share on other sites

I modified the script so that the EntryDesc includes the last part =optin /fastdetect

FOR /F "tokens=1,2,3 delims==" %%A in ('TYPE %source%') DO (
IF /I "%%A"=="Default" SET DefaultEntry=%%B
IF "%%A"=="!DefaultEntry!" SET EntryDesc=%%B=%%C
IF /I "%%A"=="Timeout" SET Timeout=%%B
)

This works for simple boot.ini but the script needs more adjustment for boot.ini of BOOTFILES folder

or other complex boot.ini

Edited by wimb
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...