merge mainline into multiterm

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-01-07 21:34:43 +01:00
commit 44fcb2bc59
6 changed files with 42 additions and 20 deletions

View file

@ -1,3 +1,21 @@
2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
* include/multiboot.h (MULTIBOOT_UNSUPPORTED): Moved from here ...
* loader/i386/multiboot.c (UNSUPPORTED_FLAGS): ... to here. Update
all users.
2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
2010-01-07 Vladimir Serbinenko <phcoder@gmail.com>
Fix breakage introduced with previous commit.
* normal/dyncmd.c (read_command_list): Avoid unregistering kernel
commands.
* normal/handler.c (read_handler_list): Revert part of previous commit
affecting this file.
* normal/main.c (read_lists): Move read_handler_list() call back to ...
(grub_normal_execute): ... here.
2010-01-07 Robert Millan <rmh.grub@aybabtu.com> 2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
Merge prefix-redefinition-fix branch. Merge prefix-redefinition-fix branch.

View file

@ -31,9 +31,6 @@
/* This should be in %eax. */ /* This should be in %eax. */
#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002 #define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
/* The bits in the required part of flags field we don't support. */
#define MULTIBOOT_UNSUPPORTED 0x0000fffc
/* Alignment of multiboot modules. */ /* Alignment of multiboot modules. */
#define MULTIBOOT_MOD_ALIGN 0x00001000 #define MULTIBOOT_MOD_ALIGN 0x00001000

View file

@ -27,6 +27,9 @@
* - APM table * - APM table
*/ */
/* The bits in the required part of flags field we don't support. */
#define UNSUPPORTED_FLAGS 0x0000fffc
#include <grub/loader.h> #include <grub/loader.h>
#include <grub/machine/loader.h> #include <grub/machine/loader.h>
#include <grub/multiboot.h> #include <grub/multiboot.h>
@ -261,7 +264,7 @@ grub_multiboot (int argc, char *argv[])
goto fail; goto fail;
} }
if (header->flags & MULTIBOOT_UNSUPPORTED) if (header->flags & UNSUPPORTED_FLAGS)
{ {
grub_error (GRUB_ERR_UNKNOWN_OS, grub_error (GRUB_ERR_UNKNOWN_OS,
"unsupported flag: 0x%x", header->flags); "unsupported flag: 0x%x", header->flags);

View file

@ -79,14 +79,22 @@ read_command_list (void)
if (file) if (file)
{ {
char *buf = NULL; char *buf = NULL;
grub_command_t ptr, last = 0, next;
/* Override previous commands.lst. */ /* Override previous commands.lst. */
while (grub_command_list) for (ptr = grub_command_list; ptr; ptr = next)
{ {
grub_command_t tmp; next = ptr->next;
tmp = grub_command_list->next; if (ptr->func == grub_dyncmd_dispatcher)
grub_free (grub_command_list); {
grub_command_list = tmp; if (last)
last->next = ptr->next;
else
grub_command_list = ptr->next;
grub_free (ptr);
}
else
last = ptr;
} }
for (;; grub_free (buf)) for (;; grub_free (buf))

View file

@ -135,6 +135,7 @@ void
read_handler_list (void) read_handler_list (void)
{ {
const char *prefix; const char *prefix;
static int first_time = 1;
const char *class_name; const char *class_name;
auto int iterate_handler (grub_handler_t handler); auto int iterate_handler (grub_handler_t handler);
@ -161,6 +162,11 @@ read_handler_list (void)
return 0; return 0;
} }
/* Make sure that this function does not get executed twice. */
if (! first_time)
return;
first_time = 0;
prefix = grub_env_get ("prefix"); prefix = grub_env_get ("prefix");
if (prefix) if (prefix)
{ {
@ -176,16 +182,6 @@ read_handler_list (void)
if (file) if (file)
{ {
char *buf = NULL; char *buf = NULL;
/* Override previous handler.lst. */
while (grub_handler_class_list)
{
grub_handler_class_t tmp;
tmp = grub_handler_class_list->next;
grub_free (grub_handler_class_list);
grub_handler_class_list = tmp;
}
for (;; grub_free (buf)) for (;; grub_free (buf))
{ {
char *p; char *p;

View file

@ -441,7 +441,6 @@ read_lists (struct grub_env_var *var __attribute__ ((unused)),
{ {
read_command_list (); read_command_list ();
read_fs_list (); read_fs_list ();
read_handler_list ();
read_crypto_list (); read_crypto_list ();
read_terminal_list (); read_terminal_list ();
return val ? grub_strdup (val) : NULL; return val ? grub_strdup (val) : NULL;
@ -455,6 +454,7 @@ grub_normal_execute (const char *config, int nested, int batch)
grub_menu_t menu = 0; grub_menu_t menu = 0;
read_lists (NULL, NULL); read_lists (NULL, NULL);
read_handler_list ();
grub_register_variable_hook ("prefix", NULL, read_lists); grub_register_variable_hook ("prefix", NULL, read_lists);
grub_command_execute ("parser.grub", 0, 0); grub_command_execute ("parser.grub", 0, 0);