On Sat, Mar 22, 2008 at 2:36 PM, Pavel Roskin <[EMAIL PROTECTED]> wrote: > On Fri, 2008-03-21 at 19:31 +0800, Bean wrote: > > Hi, > > > > I'm think about the following implementation, please see if it's all right. > > > > Config information is saved in a file named `defaults' in the grub > > directory, it's format is something like this: > > It would be great not to hardcode the name, or at least make it possible > to override the name.
yes, we can optionally use a filename parameter: load_exports [FILE] save_exports [FILE] It's even better if we don't use hardcode name at all, but due to a bug in lexer, we can't do this: load_exports ${prefix}/defaults it's just not easy to specify a file in the grub directory. > > > > GRUBENV \0 > > key1=value1 \0 > > key2=value2 \0 > > ... > > keyN=valueN \0 \0 > > > > This file should be at least 8192 bytes, this should be ok for most file > system. > > Why this number? Is it to avoid some filesystem issues, like tail > packing? Or is it just to ensure that there is enough space for the > variables? > it's used to avoid tail packing. > > > In grub2, we use load_exports to load global variables, and > > save_exports to save them. For example: > > > > load_exports > > > > menuentry "aa" { > > default=0 > > export default > > save_exports > > } > > It feels too verbose to me. I think "export default=0" could do all > three operations at once. Also, "default" or some other variable should > be set to the menu entry number automatically, so that the entries don't > need to be renumbered every time. > > Currently, the export command of grub2 doesn't support usage like "export default=0", but it's trivial to add this feature. i agree that the menu entry should be set automatically, and perhaps the title is better than plain number. we can store the current menu selection in a global variable like menu_title. > > we can also add a new tool such as grub-editenv to edit the config > > file. > > Maybe I'm too obsessed with safety, but that tool should also check that > the "default" file is located in a place that is safe for GRUB to use. > It's a good idea. -- Bean _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel