On Apr 20, 6:40 pm, Antoine Leca <r...@localhost.invalid> wrote:
> James Harris wrote:
> > Four schemes:
>
> > 1. Immediately following the MBR, i.e. from LBA 1 onwards
> > 2. In a separate partition
> > 3. In an EBR
> > 4. In the last sectors of the disk
...
> RPM (
http://www.ranish.com/part/) used a variant of #2: it installs
> itself in a partition which is usually addressed using a specific
> partition entry unusually stored at bytes 1AEh-1BDh, but it could use a
> separate entry for this (and it is even recommended to improve
> compatibility with softwares which erase the code part of the MBR.)
Interesting. So Ranish defined a partition immediately prior to what
is normally the first one - and that partition entry:
* would not be seen as an entry by most utilities
* would occupy space Microsoft used (possibly later) for a disk ID
Perhaps the really bad part about the RPM scheme as you describe it is
that normal disk partitioning utilities would see the space the RPB
code used as unused and may unknowingly allocate something else over
the top of it. Unless it overlaid part of another partition (which has
its own issues) then as far as anything else is concerned the space
RPM used would be seen as free. To put boot code there, therefore,
would be no better that putting the code in an unallocated part of the
disk!
...
> You must accomodate GPT, which is the only standard in town for >2TB
> (and NO, you do NOT want to invent another standard here! please!)
Well, custom OS development is all about breaking new ground so, why
not! ;-)
Seriously, for what we are doing (OS dev) I wouldn't discourage
someone from defining something different. After all, OS dev is all
about breaking new ground. If we wanted to use something that exists
we wouldn't be writing something new. Having said that, however,
there's no need to do something different just for the sake of it. For
me, in this case, existing standards are fine.
Specifically about GPT, from what I have found, MBR and GPT formats
are effectively mutually exclusive even despite the attempt at
compatibility. However, GPT would be a great issue to come back to.
> Note this outright kills the "pure" #1 and #4 schemes:
True, if a disk is set up for GPT it does kill #1 and #4 but then with
GPT the whole disk setup is different so a GPT disk would have
different code in the MBR sector if it had code there at all.
Therefore I would say that schemes #1 and #4 are not killed for a disk
under the MBR system. Does that make sense?
...
> And GPT's (more exactly, EFI's) idea is to go with #2, using a separate
> partition for "pre-boot", preferably FAT since it is the most widely
> compatible thing.
> Just do not repeat IBM's (or Microsoft's) mistake, use 2 FATs.
A pre-boot partition seems to be favoured, for sure, and I would
definitely go with that if it is practical. (I'll explain my
reservations in a separate post.)
As for the comments about using a FAT filesystem:
1. FAT does, IIRC, allow for a block of reserved sectors which would
make an ideal place to store the boot code. But I am not sure I'd want
any other files stored in that partition with the system boot code and
data so it may be best to keep that partition opaque to normal tools.
Not sure.
2. There are copyright issues with, IIRC, support of long file names
in FAT so even if FAT was used it would be good to prohibit long file
names.
...
> > And second, what do you think about the way the well-known boot
> > loaders work? I think each, if not loading the OS it is intended for,
> > will "chain-load" and start the VBR of another partition.
>
> If the boot loader does not load the OS it is intended for, it has a
> limited number of options:
> - chain-load, which is really stepping back once and continue as if that
> OS it is intended for was not there;
> - calling INT 18h (what BBS mandates, but not often done except when
> something goes wrong early, like in MBR code);
> - reset the platform;
> - hang (busy loop.)
There is another issue. ISTM most/all of such boot loaders (which
start code that sits within an OS partition before selecting the OS to
boot) require not just that the code in that partition is not moved
and overwritten but that they are overly tied in with the OS which
occupies that partition.
Say you had a Windows partition, for example, and decided to remove
it. Any boot menu would also go away taking with it any menu options
that the user had defined for other OSes.
This suggests that it would be better for any initial boot code and
data to be stored entirely separately from what is in the normal
partitions.
...
> For example, the Multiboot specification defines it in a way which eases
> a lot the work of the kernel developer (whether multiboot is successful
> is another debate.)
On the criteria above, it fails miserably doesn't it!
In fact I probably don't know enough about it to comment but the
downsides I am thinking of are
1. Multiboot stores code and menu data (whether by design or just in
practice) in an OS partition so that if the OS partition is taken
away, e.g. with fdisk, then the user will lose all other menu options
set up.
2. The sectors storing stage2 are part of a normal filesystem but are
accessed from the MBR by location so that if any of those sectors are
overwritten it will also fail.
> Usually though, the platforms provide some way to load the code from
> some support (ROM, disk or network); PC-BIOS provide the INT 13h
> interface, and expects the code loaded the first sector of the boot
> media to load the rest and to bootstrap: this is the very definition of
> chain-loading!
I'm not sure I follow but I see chain-loading, at least in the context
of PC boot, as a boot manager or some other non-simple piece of boot
code getting control via its own VBR and, rather than going on to boot
the OS it is intended for, it is told by menu choice or similar to
boot another OS so loads and starts that VBR.
The MBR starting the first VBR I don't take as chain loading in the
above context but I can see it being called that.
By the way, you mentioned the network. A pre-OS boot manager would be
a great place to add network boot if it wasn't provided by the BIOS.
Even if it was provided by the BIOS a pre-OS set of PXE or other
routes would be ideal, if the user wanted that.
That said, pre-OS network boot may have some much bigger issues.
AFAIK, the BIOS provides no network device calls and I'm not sure
whether there is a practical way to control network cards in what I
envisage as a boot partition.
James