help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bootloader question about GRUB


From: Andrey Borzenkov
Subject: Re: bootloader question about GRUB
Date: Sat, 1 Dec 2012 22:58:42 +0400

В Sun, 2 Dec 2012 00:58:53 +0800
Jomelle Wong <address@hidden> пишет:

> I'm not really sure where to ask this. I reckon it doesn't really belong in
> devel
> or bug reports, so I'll just do it here.
> 
> I've been browsing the stage1.s of what I think is the grub legacy looking
> for inspiration, though I'm not quite good enough to look through
> everything.
> 
> How is it that GRUB doesn't conflict with an existing filesystem given that
> it
> loads things off fixed sectors(for the stage1 at least)? I've looked at the
> stage2
> directory and I don't think that will ever fit on just a single sector.
> 
> Does GRUB try to guess what the existing filesystem is? I don't see any
> hints
> on the config file about the filesystem it is on.
> 

stage1 loads stage2 as block list. It does not know anything about
filesystems nor does it care. It is using absolute disk locations.

stage1 may load so called stage1.5 which supports single filesystem and
can load stage2 by name and not by absolute disk location. In this case
user who installs grub is responsible for using correct stage1.5 that
supports filesystem which contains stage2.

> On installation on a partition bootsector, does it read the MBR partition
> table
> and patch stuff(the long stage2_sector, for example)?
> 

If stage1 is installed in partition, then there is nothing in MBR that
needs patching.

> What if the filesystem doesn't have reserved spaces(reserved sectors for FAT
> would be set to 1, and ext would have no reserved blocks)? Where would the
> rest of GRUB go? Does it patch those fields? But I don't see any hints on
> the
> partition filesystem on the config. Or does GRUB literally store itself on
> fixed
> sectors(outside partitions)? In that case, I go back to my conflict
> question.
> That is, what if every partition has consumed the HDD to the brim. Does it
> adjust the partition table?

If there is free space outside of partitions, you may copy (embed)
stage2 there. Usually it is stage1.5 that is embedded - it is smaller
so it is easier to find space for it. If there is no free space,
absolute disk location of stage2 in filesystem is computed and used to
load it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]