[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
help for new call command - yoshinori requested
From: |
adrian15 |
Subject: |
help for new call command - yoshinori requested |
Date: |
Tue, 10 Jan 2006 13:14:06 +0100 |
Hi Yoshinori (I think you're the only Grub Legacy developer still alive or
not focused completely in grub2 :) )
I am trying to develop a new command called CALL in Grub Legacy.
It would be as the source command in bash scripts. You can call a
configfile and when BACK command is run it returns
back to the previous configfile (the caller one) and continues where it had
left the execution.
WHY?
I need it for complex interaction in Super Grub Disk.
HOW?
That is the question how can it be done... I've worked a bit and I'll give
you ideas I've seen and you tell I'm going the right way or not. Please.
CALL command is very similar to configfile but it should save some
variables for restoring them later.
I don't care where to save the variables but more for knowing which are the
variables I have to backup/restore.
I've found the following candidates:
filename of the configfile, entryno, cur_entry,
(the ones from reset):
count_lines
config_len
menu_len
num_entries
config_entries
menu_entries
BACK COMMAND
The other doubt is the back command.
It's obvious that I have to restore back the variables that I've stored
before.
But I should continue the commands of the caller configfiel where I've left
them... so...
BACK COMMAND - 1
I've seen that you use a command called grub_setjmp and my first idea is to
put a line called:
grub_setjmp(back_point);
just before this while: (in stage2.c)
while (get_line_from_config (cmdline, NEW_HEAPSIZE, ! is_preset))
{
struct builtin *builtin:
/* Get the pointer to the builtin structure. */
builtin = find_command (cmdline);
...
And then in the code I could come back to there with another command called
grub_lng_jmp or something similar
I can't recall it exactly right now.
BACK COMMAND - 2
For the back command I've got another idea which may be more easy to
implement...
It's calling the run_script function in the same way that it is called in
boot_entry: section.
if (run_script (cur_entry, heap))
{
if (fallback_entryno >= 0 )
{
cur_entry = NULL;
but instead of heap you use your saved heap in the position of last command
(well, the end of last command).
A HINT
This call function... I am only going to use it to load config files in the
same disk as the configfile caller and
I will only use it to set variables (Variables are from Adam L... patch)...
I won't do nothing more complex.
I suppose that if don't do anything more complex it will help to make the
back function more simple.
THANK YOU AND END.
That's all. Any hint is welcome.
adrian15
P.D.: Any other Grub Legacy developer help is also accepted. ;)
- help for new call command - yoshinori requested,
adrian15 <=
- Re: help for new call command - yoshinori requested, Yoshinori K. Okuji, 2006/01/11
- Re: help for new call command - yoshinori requested, David Seikel, 2006/01/11
- Re: help for new call command - yoshinori requested, Yoshinori K. Okuji, 2006/01/11
- Re: help for new call command - yoshinori requested, David Seikel, 2006/01/11
- Re: help for new call command - yoshinori requested, Marco Gerards, 2006/01/12
- Re: help for new call command - yoshinori requested, Yoshinori K. Okuji, 2006/01/13
- Re: help for new call command - yoshinori requested, David Seikel, 2006/01/13
- Re: help for new call command - yoshinori requested, Marco Gerards, 2006/01/17