Jump to content











Photo
- - - - -

MakeBS.cmd ALPHA RELEASE


  • Please log in to reply
42 replies to this topic

#1 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 08 June 2007 - 09:06 PM

LATEST RELEASE is BETA 0.10, here:
http://www.boot-land...opic=2362&st=30

Following one of cdob's hint here:
http://www.msfn.org/...o...1384&st=197

By the way: did you opened KB310994 floppy image? Bootsector loads setupldr.bin.


I put together a small batch file to perform a copy of current bootsector of a partition (FAT16 or FAT32, NT/2K/XP/2003 "standard" bootsector invoking NTLDR) and to modify this copy as to load ANOTHER loader, for example SETUPLDR.BIN, thus making this copy "chainloadable" from NTLDR through a BOOT.INI entry.

The .cmd is attached here, I would like members that like to experiment to try it, the batch in itself is safe as it simply does a backup of your current bootsector to a file BackupBS.ori in the root of the same drive, then makes a copy of it, modifying the latter as to invoke another bootsector; optionally it adds a suitable entry in BOOT.INI.

There is NO help file, but if you run the batch in any directory without parameters or with /? as parameter it will display in the console window detailed usage info and links for the "inner engine" aka the dsfo.exe part of the DSFOK toolkit.

Since the "ALPHA" status of the release, the use and testing of the batch is suggested ONLY to
individuals that can be refeered to as:

Now there's a frood who really knows where his towel is.

with, additionally, a decent knowledge of booting/multibooting in the DOS/NT/WINDOWS world.

I sincerely regret, mainly due to cdob's idea being posted a few days AFTER it :thumbup: , not having been able to release this for Towel's day:
http://en.wikipedia.org/wiki/Towel_Day
but since I stand by the fact that "real" Towel Day is June 22, if some other member can help me in the testing/debugging, it could be possible to release a BETA or maybe even a FINAL version just in time for that date.

This application, if hopefully proven to be working, is particularly dedicated to our good spacesurfer, so that maybe he will stop going through half the internet suggesting to rename something to something else. :thumbup: :thumbup:

Anyway, should it be working properly or not, please do report your experience, suggestions, etc., and of course, the most important thing, have fun :thumbup:.

:1st:

jaclaz

Attached Files



#2 wimb

wimb

    Platinum Member

  • Developer
  • 3756 posts
  • Interests:Boot and Install from USB
  •  
    Netherlands

Posted 10 July 2007 - 07:19 PM

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

At first I made the mistake to add dsfo.exe to the folder containing MakeBS.cmd and I got then:
"" string NOT found in drive R: bootsector
Program aborted - wrong filesystem or bootsector type

But then I realised that possibly more files of dsfok folder were needed
and then I placed MakeBS.cmd inside the dsfok folder, so that it is working now for me.

Thank you for this handy script :1st:

#3 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 24 July 2007 - 02:26 PM

Updated MakeBS.cmd to take care of FAT12 bootsectors too.

jaclaz

Attached Files



#4 ilko

ilko

    Silver Member

  • Advanced user
  • 500 posts
  •  
    Bulgaria

Posted 03 August 2007 - 05:05 PM

Hi jaclaz, great job with the script :)

Script run from custom folder, dsfo.exe only(NOT from folder GUI in archive) in the same folder.
Lexar 1GB USB stick, with XP SP2 Setup files on it and setupldr.bin in root, stick is seen as fixed using Hitachi driver.

Formated stick from XP SP2 in FAT and run the script makeBS E:\setupldr.bin /A "TXT Setup"- stick booted to boot.ini, if choose "TXT Setup" I get blank screen with blinking cursor, nothing else.
Run the script again with normal NTLDR as an option, instead of setupldr.bin- boot.ini gets reloaded, in short- XP SP2 setupldr.bin didn't like to be called that way or a problem with the geometry?

Rename setupldr.bin to ntldr- Setup loads fine.
XP SP2 files used. Used setupldr.bin from 2003 SP1- no more hangs, Setup loads fine.

Same setup- format FAT32 from XP this time- choose TXT Setup- Setup loads just fine using setupldr.bin from XP SP2.

Same setup- format stick using PeToUSB in FAT16X- everything works fine.
If you are interested I have backup of MBRs and bootsectors for the 3 different setups.

Just ideas if anyone has troubles with XP boot loader/Setupldr.bin and USB sticks.

An idea about the script- could you make it the option A to be accebted in small letters as well? Took me a while to figure out it must be capital letter. :yahoo:

ilko

#5 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 03 August 2007 - 06:07 PM

@ilko

Yes please, zip all MBR and bootsectors together and attach them in this thread, I'll have a look at them, most probably there is a "glitch" of some kind in the batch.

By the way, OT, but not much :), I just found the way to load SETUPLDR.BIN to get to Recovery Console directly (without using NTLDR and the /CMDCONS switch in BOOT.INI) and guess what?
It's NTLDR that modifies on the fly the bootsector :yahoo: , so I intend to add this possibility (pre-modify the bootsector) to the batch, in the same occasion I will try and fix the problem you had.

jaclaz

#6 thunn

thunn

    Silver Member

  • .script developer
  • 531 posts
  • Location:Brooklyn, New York
  • Interests:computers<br />mechanics<br />distortion<br /><br />
  •  
    United States

Posted 04 August 2007 - 05:47 AM

thank you for the batch scripts, jaclaz.

#7 ilko

ilko

    Silver Member

  • Advanced user
  • 500 posts
  •  
    Bulgaria

Posted 04 August 2007 - 12:40 PM

@ilko

Yes please, zip all MBR and bootsectors together and attach them in this thread, I'll have a look at them, most probably there is a "glitch" of some kind in the batch.

Jaclaz, my bad, it's nothing to do with the script, it works just fine.
It's possibly about buggy setupldr.bin from XP SP2, or what is most likely it's place on the stick- i.e. copied right after format, along with ntldr, boot.ini, txtsetup.sif and ntdetect.com, then the rest of the files.
In short- all boot files must be copied to the stick right after the format, including the custom bootloader, which the bootsector will be patched for.
Not sure if this limitation applies only for FAT16 or in general.
I am still testing, will post results when done.

By the way, OT, but not much :), I just found the way to load SETUPLDR.BIN to get to Recovery Console directly (without using NTLDR and the /CMDCONS switch in BOOT.INI) and guess what?
It's NTLDR that modifies on the fly the bootsector :yahoo: , so I intend to add this possibility (pre-modify the bootsector) to the batch, in the same occasion I will try and fix the problem you had.

jaclaz

This is very interesting, could you post more details, good finding :)

#8 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 04 August 2007 - 01:18 PM

Version 003 attached.

Introduced the /I switch on IF checks for parameters, now /A or /a will be accepted as well.
Minor fixes

On second thought, I will make another batch, reusing much of the code, but specific for the Recovery Console bootsector, as not to mix two different things.

@ilko
Yes, bootfiles need to be at the beginning of the partition, if they are copied after a certain address they cannot be found by the bootsector, this applies to CD's too.

About the Recovery Console trick it is actually very simple (once you know it :)).
Normally when you install a Recovery Console, it would add an entry in BOOT.INI like:

C:\CMDCONS\BOOTSECT.DAT="Recovery Console" /cmdcons

I.e. a custom bootsector invoking SETUPLDR.BIN is chainloaded, and a parameter /cmdcons is passed.
I thought that the /cmdcons parameter was a SETUPLDR.BIN one and lost a couple of days trying to replicate it's behaviour chainloading through grub4dos or using the bootsector directly and using WINNT.SIF, until I found out that it is really a NTLDR parameter that makes it "patch on the fly" the bootsector, changing a few bytes at the beginning of it (the OS field) as follows:
NORMAL bootsect.dat:
Offset	  0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F



00000000   EB 3C 90 4D 53 44 4F 53  35 2E 30 00 02 08 01 00   ë<&#65533;MSDOS5.0.....
to
PATCHED bootsect.dat:
Offset	  0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F



00000000   EB 3C 90 63 6D 64 63 6F  6E 73 00 00 02 08 01 00   ë<cmdcons......

Now, the even more interesting thing is that the /rollback parameter:
http://support.micro...kb/312569/en-us
which is NOT listed here:
http://www.microsoft...on/bootini.mspx
appears to be working much in the same way, cannot say what it could be useful for, but I am going to experiment a bit with it too. :yahoo:

jaclaz

Attached Files



#9 ilko

ilko

    Silver Member

  • Advanced user
  • 500 posts
  •  
    Bulgaria

Posted 29 August 2007 - 08:19 PM

Hi,

Any ideas why would NTLDR patch bootsecor.dat?

About MakeBS.cmd- is it possible to make it usable with NTFS?

ilko

#10 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 30 August 2007 - 04:55 PM

Any ideas why would NTLDR patch bootsecor.dat?

My guess? :loleverybody:

In 1998 a guy at MS, working on the new Recovery Console feature of Windows 2000, sent a note to another guy developing the NTLDR.
The note was lost in a breakdown of the internal server (MS Exchange? :w00t: :w00t:)
Two weeks before the official launch of windows 2000, someone noticed that there was no simple way to load Recovery Console when installed to HD, but since the time was not enough to develop and test a proper solution (and document it), and since Recovery Console was already finished, whilst NTLDR was still in the works, a "quick and dirty" hack was applied to respect schedule.
Once the product was delivered, the first guy, or the second one, or both, changed their jobs and the "hack" remained in the source code, and was kept in later releases (XP/2003).
No documentation was ever produced about this feature, as noone but the two guys, that by the way never met personally, knows about it.

DISCLAIMER:
The above work is purely fictional and satirical in nature and should not be interpreted as a factual record of events.
Any names of characters, companies and products used in the story are purely coincidental and/or cited for mere entertainment purposes.
No persons, animals, furry little creatures from Alpha Centauri were harmed during the writing of this story.


About MakeBS.cmd- is it possible to make it usable with NTFS?

Yes, I think it's just a matter of adding to the batch the right "addresses" to search for, but I have to check them.

Give me a few days and I'll try and add the feature.

jaclaz

#11 ilko

ilko

    Silver Member

  • Advanced user
  • 500 posts
  •  
    Bulgaria

Posted 30 August 2007 - 07:40 PM

:loleverybody:
Your guess seems quites reasonable and so realistic that I though for a second you were one of the guys, or someone working nearby them.

:w00t:

#12 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 01 September 2007 - 05:20 PM

Ok find attached two new files:
MakeBS004.zip is version 0.04, actually just 0.03 with a nasty bug corrected (I introduced it while putting the /I switch for ilko's request of /A /a :loleverybody:)

MakeBS005.zip is a "not so quick but still reallly dirty" hack to test what happens with NTFS.

To EVERYONE but ilko, DO NOT use 0.05!

I really cannot say if it will work, there is no "NTLDR" string for the boot file in the first 512 bytes (first sector), but here is a Unicode "NTLDR" string in the second one.

My usual reference for this kind of stuff, the Starman's realm:
http://thestarman.pc...ry.com/asm/mbr/
is not (yet) complete on this topic:
http://thestarman.pc.../mbr/NTFSBR.htm
http://thestarman.pc...m/mbr/NTLDR.htm

So I made the .cmd:
1) detect NTFS bootrecord
2) create the backup of the entire NTFS $boot, i.e. 16 sectors=8.192 bytes
3) change the "NTLDR" string to the new loader name, that MUST BE 5 characters long and with no extension (it seems there is simply no space for anything longer, maybe one will need a code relocation to get more characters)


jaclaz

Attached Files



#13 ilko

ilko

    Silver Member

  • Advanced user
  • 500 posts
  •  
    Bulgaria

Posted 09 September 2007 - 08:38 PM

Hi,

Some tests with makeBS5- NTLDR copied to root as XPLDR, Grub4Dos GRLDR there too. Run script for both of them, BOOT.INI did NOT get changed, added entries manually, the new bootsectors are fine, bootable via NTLDR/BOOT.INI and Grub4Dos.

Result from makebs.cmd:

A file named BackupBS.ori already exists on drive c:
Are you sure you want to overwrite it?
[Please enter YES in capital letters to confirm]Overwrite=YES
...
Current bootsector of drive c:\ backed up to c:\BackupBS.ori
...
...
...
...
"NTLDR" string NOT found in drive c: bootsector
...
FAT=NTFS NTFS=3
Press any key to continue . . .
This partition is NTFS formatted.
Though no harm will be made to your existing partition bootsector
this is a new, even more experimental feature, introduced in
version 0.04 ALPHA, the resulting bootsector won't be 512 bytes
but rather 8.192 bytes long (16 sectors).
Whether this bootsector will be chainloadable/usable by other
bootloaders or utilities
Press any key to continue . . .
GRLDR
...
New bootsector c:\GRLDR.bs created succesfully
...


Will test it further when re-assemble my main computer, willing to test it how behaves with Vista's bootmgr.

Regards,
ilko

#14 ilko

ilko

    Silver Member

  • Advanced user
  • 500 posts
  •  
    Bulgaria

Posted 10 September 2007 - 04:17 AM

:loleverybody:

In VMWare, 2 partitions- Vista on first, XP on second. Replaced Vista bootsector with XP one. In C: had GRLDR, NTLDR renamed to XPLDR, bootmgr renamed to VSLDR.
Used makeBS5 to create patched bootsectors for those, added entries in BOOT.INI manually, all patched bootsectors worked fine and can be loaded. Now we can start Vista using NTLDR :w00t: It's very common scenario users on dual boot systems (XP/Vista) to reinstall XP and lose Vista's boot, sometimes if an old image is used it might be a bit tricky for unexperienced users to fix it.
Adding Vista in BOOT.INI- " C:\bootmgr="Vista" " doesn't work.

Something little funny for me- start with NTLDR, load GRLDR.bs, type "chainloader /vsldr.bs" then "boot" and it goes back to the BOOT.INI entries, NTLDR is invoked instead of VSLDR (bootmgr). Same happens when instead of GRLDR.bs load VSLDR.bs, then from Vista's loader attempt to load GRLDR.bs or any of the other patched bootsectords, it just goes back to NTLDR/BOOT.INI menu. If from Grub4Dos chainload BOOTMGR directly it works.

In short- if bootsectors are loaded twice via different loaders, the second attempt seems to go back to the original bootloader, no matter what bootsector is called.

Jaclaz, please have a look why script doesn't add the entries to BOOT.INI, that seems to be the only issue for now.

Regards,
ilko

#15 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 11 September 2007 - 09:14 AM

Yep, as Microsoft guys would have put it, it was "by design".

Since I was not 100% sure it would have worked, I simply added a "fork" for NTFS with some redundant code.

Now that I know that the "main" part works from NTFS I'll integrate it in a more proper way.

EDIT:
Version 0.06 attached
- The add entry feature has been restored for NTFS partitions
- Some corrected error handling
- Deletion of temp files fixed
- Some (minor) polishing

If everything works, the script needs just some more polishing, and will be ready for more features. SUGGESTIONS?:loleverybody:

jaclaz

Attached Files



#16 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 12 September 2007 - 05:07 PM

@jaclaz

My suggestion is to add support for Vista-type bootsector (bootmgr), similar to "bootsect /nt60".

#17 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 12 September 2007 - 06:02 PM

@jaclaz

My suggestion is to add support for Vista-type bootsector (bootmgr), similar to "bootsect /nt60".


Well, maybe a little out of the scope of the app. :loleverybody:

This app does not "create" a bootsector, it simply changes the name of the loader invoked, without touching the bootsector code or data, what is wrong in using bootsect /nt60 ?

jaclaz

#18 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 13 September 2007 - 08:12 AM

OK sorry I misunderstand the utility functions.

#19 ilko

ilko

    Silver Member

  • Advanced user
  • 500 posts
  •  
    Bulgaria

Posted 20 September 2007 - 10:09 PM

Hi,
Done the same tests, booted with no issues from boot.ini Vista, XP, Grub4Dos on NTFS partitions.
Suggestion- once a backup of the original bootsector is made, next backups could be something like backup.grldr.ori, backup.ntldr.ori, backup.vsldr.ori end so on, instead of typing YES every time, or if it's easy compare current bootsector with the backup and if are the same do not prompt for new backups.
As for other suggestions- are you planning to add other features like writing bootsectors/MBRs, extending the scope of this script or stick with this functionality?

#20 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 22 September 2007 - 10:51 AM

Hi,
Done the same tests, booted with no issues from boot.ini Vista, XP, Grub4Dos on NTFS partitions.

Good :loleverybody:, so it works also for Vista loader without problems? :w00t:

Suggestion- once a backup of the original bootsector is made, next backups could be something like backup.grldr.ori, backup.ntldr.ori, backup.vsldr.ori end so on, instead of typing YES every time, or if it's easy compare current bootsector with the backup and if are the same do not prompt for new backups.

The suggestion is interesting, though I don't like the idea to deviate from 8.3 naming standard, as you might never know if access with DOS will ever be needed.
What I could do:
1) Create a "per-session" folder with date/time
2) Put the backups there

But yes, I guess that the idea of only prompting if the backup is different is better.
Though I haven't checked, most probably I will need to create a temporary file to do the comparison.
I'll try making the changes shortly.

As for other suggestions- are you planning to add other features like writing bootsectors/MBRs, extending the scope of this script or stick with this functionality?

No, I actually am writing a separate batch for MBR handling, that, to paraphrase Shakespeare, King Lear (2.4.305-9) :
http://shakespeare.a...s/a/revenge.htm

I will do such a thing,---
What it is, yet I know not, but it shall be the terror of the MBR

:w00t:

Once I get this done, I'll try to make another batch to manage bootsectors, possibly including in it the features we have now in MakeBS.cmd.

jaclaz

#21 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 01 October 2007 - 11:39 AM

MakeBS.cmd 0.07 ALPHA attached.

Now it:
- creates BackupBS.ori if no such file exists in Root of drive (no prompt)
- if it finds a BackupBS.ori file, it checks whether it's contents are the same of current bootsector and:
- if file is identical to current bootsector skips the creation of the BackupBS.ori (no prompt)
- if file is different prompts for overwriting (as before)

jaclaz

Attached Files



#22 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 03 April 2008 - 10:50 AM

I am trying to understand what are the functional differences between Jaclaz's makebs.cmd versus Bart's mkbt.exe (and in less extent MS Vista bootsect.exe).

Is there one-size-fits-all utility ? :thumbsup:

#23 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 11 April 2008 - 02:16 PM

@jaclaz

Can makebs change the boot sector of given drive I: to MS-DOS boot sector (loading io.sys, msdos.sys etc...) ?
bootsect.exe is handy to change between ntldr (NT/XP) and bootmgr (Vista), but how about MS-DOS/Win9x ?

Thank you.

#24 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 11 April 2008 - 04:32 PM

@jaclaz

Can makebs change the boot sector of given drive I: to MS-DOS boot sector (loading io.sys, msdos.sys etc...) ?
bootsect.exe is handy to change between ntldr (NT/XP) and bootmgr (Vista), but how about MS-DOS/Win9x ?

Thank you.


Not "as is", but it is a feature that it is possible to create, or add, using the MAKEBS.CMD and MBRBATCH.CMD as "example/skeleton".

What current makebs does is just:
1) take EXISTING bootsector
2) change the name of the loader
3) rewrite the bootsector

What you want is:
1) get "somewhere" an alternate bootsector
2) extract from existing bootsector just the partition data and volume number
3) rewrite the bootsector

As long as we are talking of the partition you booted from, this can be done by BOOTPART by Gilles Vollant:
http://www.winimage.com/bootpart.htm

Bootpart can do what you need/want entirely by itself if run under DOS, or can create a bootsector file to be later used by dsfo/dsfi to write it to the Logical Drive.

Bootpart stores internally a number of botsectors (English ones), a more general "native" solution should extract these bootsectors from FreeDOS, DOS, win9x/ME or 2K/XP system files, in order to have the same ones as if a "format" was performed from the "native" language corresponding Operating System, which would of course need that the final user would add the needed files to the working directory or however point the batch to them.

All in all, since the advent of grub4dos and it's direct system files chainloading, the easiest solution remains bootpart.
Since any DOS/FreeDOS/Win9X can only boot from First Active Partition on First Hard Disk, it is easy, even when for any reason you are working from a non-first hard disk or partition, to boot to it using grub4dos mapping and direct chainloading and then use bootpart from it.

Read this:
http://forum.winimag...topic.php?t=276

jaclaz

#25 ktp

ktp

    Silver Member

  • Advanced user
  • 773 posts

Posted 11 April 2008 - 05:17 PM

@jaclaz
Thank you very much for your explanations (and for your time wroting them down).
I found your following explanation really worthwhile:

All in all, since the advent of grub4dos and it's direct system files chainloading


This phrase is really synthethic and helps me now to understand better grub4dos. I always used grub4dos
without really having the "theory" behind it. It appears for me as a very powerful boot manager, and in fact
a boot loader too, and in fact is not depending on existing boot sector on a given partition.

So I can just simply chainload io.sys to get booting under DOS without requiring to change the partition boot sector.

This explains also:
Master bootloader (mbldr) http://sourceforge.net/projects/mbldr/ on contrary can boot partitions, but cannot chainload.
This is why mbldr cannot boot for example Mac OS X. but grub4dos or bootmgr (Vista) can chainload chain0 (or tboot) to boot
MAC OS X.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users