grub-devel
[Top][All Lists]
Advanced

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

Re: How to getting normal mode?


From: Pavel Roskin
Subject: Re: How to getting normal mode?
Date: Fri, 27 Feb 2009 13:38:12 -0500

On Sat, 2009-02-28 at 01:28 +0800, liu Aleaxander wrote:
> Hi, all.
> 
> I'm reading the grub source code. and found  i got no idea how the
> grub getting into the normal mode.
> 
> in file kern/main.c
> /* Load the normal mode module.  */
>   grub_load_normal_mode ();
>   
>   /* Enter the rescue mode.  */
>   grub_enter_rescue_mode ();
> 
> I think the grub_load_normal_mode() function just will load the
> normal.mod if find. but i have no idea how to execute it even though
> the function's comment said execute the normal mode if possible.

When a module is loaded, a function declared with GRUB_MOD_INIT will be
executed.  In case of normal.mod, the init function can be found in
normal/main.c.  That would register the "normal" command.  It would not
enter the normal mode by itself.

> As i excepted, the above function will not lead the grub getting into
> normal mode, so it execute the next function grub_enter_rescue_mode.
> Yeah, i have no doubt it wouldn't go there.
>
> Then, we are in rescue mode. and in the function's entry, it also will
> try to getting into normal mode by invoke the function
> attemp_normal_mode. 

Yes, if the "normal" command is registered, it would be executed.  That
would activate the normal mode.

> while this function is simple too.  it just found the normal mode from
> the rescue command list, if found, execute it's cmd function. Yeah,
> that's clear, but the things are, there are no such normal cmd in the
> rescue command list, then how can the grub get into the normal mode?

It means that loading normal.mod failed, so the "normal" command wasn't
registered.  You can try loading the "normal" module manually by running
"insmod normal".  Then you can run "normal" manually.  The list of the
registered commands in the rescue mode can be viewed by running "help".

I suggest that you run "set" and look at the "prefix" variable.  It
should point to the directory where the modules are located.  "ls" will
show the filesystems as seen by GRUB, so you can check if the modules
are indeed there and you have the necessary filesystem drivers.

-- 
Regards,
Pavel Roskin




reply via email to

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