grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Environment block support for grub2


From: Robert Millan
Subject: Re: [PATCH] Environment block support for grub2
Date: Sat, 31 May 2008 13:39:01 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Sat, May 31, 2008 at 06:54:43PM +0800, Bean wrote:
> 
> The root is assigned in the initialization phraze. Currently, it's
> done this way:
> 
> machine_machine_init -> calculate root device, then set variable
> prefix using root and grub_prefix.
> 
> modules initialization
> 
> grub_set_root_dev -> Use variable prefix to get the root variable.
> 
> Load normal.mod
> 
> As you can see, it first create prefix, then split it to find root. At
> the end of grub_set_root_dev, prefix and root will point to the same
> device. This also make it different to change the root setting in
> findroot, which is run in modules initialization stage. We must split
> prefix to find the root directory, and use the new root to form a new
> prefix. The prefix would later be split again to find root, what a
> mess.
> 
> The new method:
> 
> machine_machine_init -> calculate root device, then set root variable 
> directly.
> 
> Load variable in the environment block
> 
> modules initialization
> 
> findroot
> 
> more modules initialization
> 
> grub_set_root_dev -> Use variable root to get the root prefix.
> 
> Load normal.mod
> 
> The end result would be the same, but the new method is cleaner, and
> allows overwrite of the root and rdir variable using environment block
> and findroot.

I think the method is sound;  what I'm complaining about (and it's not
something specific to your patch) is that we're referring to two different
things by the same name ("root"), and even put them in the same variable.

In the initialization phase, "root" is the device that contains our GRUB
directory.

Afterwards, "root" is the device we're currently accessing (be it for loading
fonts, backgrounds, Linux images, whatever).

If "root" means "just a placeholder for whatever device we're acessing at the
moment", then it would make sense, but in our code (i.e. in the names we're
giving to commands and functions) it's assumed to mean "the device containing
/boot/grub".

So what do we want to do with this?  Should we have different variables for
each thing (and in that case, is "root" for initial stage or for grub.cfg)
or should we use "root" as a placeholder for any path reference, and adjust
our function names etc to reflect that?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)




reply via email to

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