[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Save/Load environment variable support
From: |
Bean |
Subject: |
Re: [PATCH] Save/Load environment variable support |
Date: |
Sun, 15 Jun 2008 03:03:43 +0800 |
On Sun, Jun 15, 2008 at 2:47 AM, Robert Millan <address@hidden> wrote:
> On Fri, Jun 13, 2008 at 03:07:54PM +0800, Bean wrote:
>> Hi,
>>
>> I separate the save/load environment variable function from my
>> previous patch on environment block. It contains the command
>> save_env/load_env/list_env and tool grub-editenv, but without the
>> kernel patch.
>> --
>> Bean
>
>>
>> diff --git a/commands/loadenv.c b/commands/loadenv.c
>> new file mode 100755
>> index 0000000..970baf3
>> --- /dev/null
>> +++ b/commands/loadenv.c
>> @@ -0,0 +1,250 @@
>> +/* loadenv.c - command to load/save environment variable. */
>
> Is this useful as a standalone command? If we're in a stage in which commands
> can be executed, the same effect could be archieved with the "." command on
> a grub.cfg-like formatted file?
>
> IIRC you explained that this feature could be useful as the basis for
> findroot style search, or to override existing variables like "root", "prefix"
> or "default". In both cases (if I understood correctly) you want it to be run
> automaticaly as the init routine for your module.
>
> However if your code is small enough, maybe it could replace the existing
> use of grub_prefix (I commented this on the other mail), thereby reducing
> kernel size and making it preferable to be part of kernel than a separate
> module. Do you think that's possible?
Hi,
Yes, this is a standalone command, it's used to support persistent
variable. For example, we can archive the result of savedefault using
the following command:
load_env
menuentry aa {
save_env default
}
load_env loads the environment variable from $prefix/grubenv, and
save_env save selected variable to it. grubenv contain a environment
block, so that we can manage it using grub-editenv, just like the
environment block in the kernel.
--
Bean