2009-05-16 Bean <bean123ch@gmail.com>
* include/grub/kernel.h (grub_module_header_types): Add type OBJ_TYPE_CONFIG. * kern/main.c (grub_load_config): New function. (grub_main): Call grub_load_config to read boot config. * grub-mkimage (generate_image): New parameter config_path. (options): New option --config. (main): Parse --config option, and pass it to generate_image.
This commit is contained in:
parent
5cb5c9c210
commit
5e898c9d71
4 changed files with 70 additions and 4 deletions
19
kern/main.c
19
kern/main.c
|
@ -74,6 +74,24 @@ grub_load_modules (void)
|
|||
grub_module_iterate (hook);
|
||||
}
|
||||
|
||||
static void
|
||||
grub_load_config (void)
|
||||
{
|
||||
auto int hook (struct grub_module_header *);
|
||||
int hook (struct grub_module_header *header)
|
||||
{
|
||||
/* Not an ELF module, skip. */
|
||||
if (header->type != OBJ_TYPE_CONFIG)
|
||||
return 0;
|
||||
|
||||
grub_parser_execute ((char *) header +
|
||||
sizeof (struct grub_module_header));
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_module_iterate (hook);
|
||||
}
|
||||
|
||||
/* Write hook for the environment variables of root. Remove surrounding
|
||||
parentheses, if any. */
|
||||
static char *
|
||||
|
@ -153,6 +171,7 @@ grub_main (void)
|
|||
grub_register_rescue_parser ();
|
||||
grub_register_rescue_reader ();
|
||||
|
||||
grub_load_config ();
|
||||
grub_load_normal_mode ();
|
||||
grub_reader_loop (0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue