RE: Re: Bootsector loader

Eric Auer <[email protected]> Fri, 1 Nov 2002 22:35:36 +0100 (MET)
Newsgroups gmane.os.freedos.devel
Message-ID <[email protected]>
Hi Wolf, thanks for the efforts, but I think I will change to another
great idea for the boot menu:


 *** the META KERNEL ***

The idea is:
- use undelete syssave boot x:msdos.bot
  or some other tool to save the MS DOS boot sector to a file
- use sys to write a FreeDOS boot sector to your drive, and let sys
  save a copy to another file, freedos.bot
- copy /b metakern + msdos.bot + freedos.bot metakern.sys
- ren kernel.sys fdkernel.sys
- ren metakern.sys kernel.sys
- reboot :-)

MetaKern is going to be a small binary building block that gets loaded
like the kernel. It excepts its last 1024 bytes to be 2 boot sectors,
and knows how to patch the FreeDOS one of them to load "fdkernel.sys"
instead of "kernel.sys". It displays a list of the primary partitions,
plus the entries "MS Dos/Windows" and "FreeDOS". If you select either
of the last two, it will load the appropriate boot sector into RAM, patch
it in the FreeDOS case, and run it. If you select either of the primary
partitions, it will load the MBR into RAM, patch the partition table so
that the selected partition is the one marked as active (in RAM) and run
the MBR.

I think MetaKern should be very easy to implement: The only sector that
it needs to read is the MBR (no LBA needed, no geometry calc needed), as
everything else is part of metakern.sys and got loaded by the FreeDOS
bootsector. You need some little "display the menu and allow the user to
press a key" interface (optionally with highlighting and cursor keys...)
and some simple "load to 0:7c00 and patch" routines.

The MetaKern will - of course - get overwritten at some time after handing
over control to the MBR or one of the two stored boot sectors. So it does
not consume valuxable RAM, it is no TSR or driver, I mean.

I think it would be best to implement this in a few lines of Assembly
language, but if you are telling me that it is better to do it in C, or
if you get so enthousiastic that you just write it right away, please
tell me. Otherwise I will try to write it myself in the next weeks or so.
Any feedback is welcome.

Eric