merge mainline into newreloc
This commit is contained in:
commit
c6fb51295b
35 changed files with 414 additions and 394 deletions
79
ChangeLog
79
ChangeLog
|
@ -1,3 +1,82 @@
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* boot/i386/qemu/boot.S: Add a missing .code16.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Use LBIO on coreboot.
|
||||||
|
|
||||||
|
* conf/i386-coreboot.rmk (kernel_img_SOURCES): Change
|
||||||
|
kern/i386/multiboot_mmap.c to kern/i386/coreboot/mmap.c.
|
||||||
|
* include/grub/i386/coreboot/memory.h (GRUB_LINUXBIOS_MEMBER_LINK):
|
||||||
|
New declaration.
|
||||||
|
* kern/i386/coreboot/init.c (grub_machine_init): Don't call
|
||||||
|
grub_machine_mmap_init on coreboot.
|
||||||
|
* kern/i386/coreboot/mmap.c (grub_linuxbios_table_iterate): Handle
|
||||||
|
GRUB_LINUXBIOS_MEMBER_LINK.
|
||||||
|
(grub_machine_mmap_iterate): Fix declaration.
|
||||||
|
* kern/i386/coreboot/startup.S: Don't save mbi location on coreboot.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Split coreboot and multiboot ports.
|
||||||
|
|
||||||
|
* conf/i386-multiboot.rmk: New file.
|
||||||
|
* configure.ac: Add multiboot port.
|
||||||
|
* include/grub/i386/multiboot/boot.h: New file.
|
||||||
|
* include/grub/i386/multiboot/console.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/init.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/kernel.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/loader.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/memory.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/serial.h: Likewise.
|
||||||
|
* include/grub/i386/multiboot/time.h: Likewise.
|
||||||
|
* include/grub/multiboot.h: Add GRUB_MACHINE_MULTIBOOT to ifdef.
|
||||||
|
* loader/multiboot.c: Likewise.
|
||||||
|
* loader/multiboot_mbi2.c: Likewise.
|
||||||
|
* util/grub-mkrescue.in: Generate multiboot rescue.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/parser.c (grub_parser_execute): Cope with read-only config.
|
||||||
|
|
||||||
|
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Merge handling of input and output terminals. Fix a hang.
|
||||||
|
|
||||||
|
* commands/terminal.c (abstract_terminal): New struct.
|
||||||
|
(handle_command): New function. Based on grub_cmd_terminal_input.
|
||||||
|
(grub_cmd_terminal_input): Use handle_command.
|
||||||
|
(grub_cmd_terminal_output): Use handle_command.
|
||||||
|
|
||||||
|
2010-05-01 BVK Chaitanya <bvk.groups@gmail.com>
|
||||||
|
|
||||||
|
Fix comment handling.
|
||||||
|
|
||||||
|
* tests/grub_script_comments.in: New testcase.
|
||||||
|
* conf/tests.rmk: Rules for new testcase.
|
||||||
|
* script/yylex.l: Updated flex rules.
|
||||||
|
|
||||||
|
2010-04-28 Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||||
|
|
||||||
|
* docs/grub.texi (play): Document that zero pitches produce rests.
|
||||||
|
* commands/i386/pc/play.c (grub_cmd_play): Call 'grub_file_open' only
|
||||||
|
if argc is 1.
|
||||||
|
|
||||||
|
2010-04-27 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* conf/x86-efi.rmk (linux_mod_SOURCES): Write explicitly to avoid
|
||||||
|
autogen issues.
|
||||||
|
|
||||||
|
2010-04-26 Christian Franke <franke@computer.org>
|
||||||
|
|
||||||
|
* include/grub/util/getroot.h (grub_get_prefix): Remove prototype.
|
||||||
|
* util/getroot.c [__CYGWIN__] (get_win32_path): Remove function.
|
||||||
|
(grub_get_prefix): Remove function.
|
||||||
|
* util/grub-emu.c (main): Replace grub_get_prefix () call by
|
||||||
|
make_system_path_relative_to_its_root ().
|
||||||
|
* util/sparc64/ieee1275/grub-setup.c (main): Likewise.
|
||||||
|
|
||||||
2010-04-24 Christian Franke <franke@computer.org>
|
2010-04-24 Christian Franke <franke@computer.org>
|
||||||
|
|
||||||
* Makefile.in (TARGET_LDFLAGS): Add -static-libgcc.
|
* Makefile.in (TARGET_LDFLAGS): Add -static-libgcc.
|
||||||
|
|
|
@ -63,5 +63,8 @@ VARIABLE(grub_core_entry_addr)
|
||||||
*right here* and this is why we need this kludge. */
|
*right here* and this is why we need this kludge. */
|
||||||
|
|
||||||
. = GRUB_BOOT_MACHINE_SIZE - 16
|
. = GRUB_BOOT_MACHINE_SIZE - 16
|
||||||
|
|
||||||
|
.code16
|
||||||
|
|
||||||
jmp _start
|
jmp _start
|
||||||
. = GRUB_BOOT_MACHINE_SIZE
|
. = GRUB_BOOT_MACHINE_SIZE
|
||||||
|
|
|
@ -177,16 +177,20 @@ static grub_err_t
|
||||||
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int argc, char **args)
|
int argc, char **args)
|
||||||
{
|
{
|
||||||
grub_file_t file;
|
|
||||||
|
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required");
|
||||||
|
|
||||||
file = grub_file_open (args[0]);
|
if (argc == 1)
|
||||||
if (file)
|
|
||||||
{
|
{
|
||||||
struct note buf;
|
struct note buf;
|
||||||
grub_uint32_t tempo;
|
grub_uint32_t tempo;
|
||||||
|
grub_file_t file;
|
||||||
|
|
||||||
|
file = grub_file_open (args[0]);
|
||||||
|
|
||||||
|
if (! file)
|
||||||
|
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
|
||||||
|
|
||||||
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
|
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,32 +26,43 @@
|
||||||
struct grub_term_autoload *grub_term_input_autoload = NULL;
|
struct grub_term_autoload *grub_term_input_autoload = NULL;
|
||||||
struct grub_term_autoload *grub_term_output_autoload = NULL;
|
struct grub_term_autoload *grub_term_output_autoload = NULL;
|
||||||
|
|
||||||
|
struct abstract_terminal
|
||||||
|
{
|
||||||
|
struct abstract_terminal *next;
|
||||||
|
const char *name;
|
||||||
|
grub_err_t (*init) (void);
|
||||||
|
grub_err_t (*fini) (void);
|
||||||
|
};
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
handle_command (int argc, char **args, struct abstract_terminal **enabled,
|
||||||
int argc, char **args)
|
struct abstract_terminal **disabled,
|
||||||
|
struct grub_term_autoload *autoloads,
|
||||||
|
const char *active_str,
|
||||||
|
const char *available_str)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
grub_term_input_t term;
|
struct abstract_terminal *term;
|
||||||
struct grub_term_autoload *aut;
|
struct grub_term_autoload *aut;
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
grub_puts_ (N_ ("Active input terminals:"));
|
grub_puts_ (active_str);
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
for (term = *enabled; term; term = term->next)
|
||||||
grub_printf ("%s ", term->name);
|
grub_printf ("%s ", term->name);
|
||||||
grub_printf ("\n");
|
grub_printf ("\n");
|
||||||
grub_puts_ (N_ ("Available input terminals:"));
|
grub_puts_ (available_str);
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
for (term = *disabled; term; term = term->next)
|
||||||
grub_printf ("%s ", term->name);
|
grub_printf ("%s ", term->name);
|
||||||
/* This is quadratic but we don't expect mode than 30 terminal
|
/* This is quadratic but we don't expect mode than 30 terminal
|
||||||
modules ever. */
|
modules ever. */
|
||||||
for (aut = grub_term_input_autoload; aut; aut = aut->next)
|
for (aut = autoloads; aut; aut = aut->next)
|
||||||
{
|
{
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
for (term = *disabled; term; term = term->next)
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
if (grub_strcmp (term->name, aut->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (!term)
|
if (!term)
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
for (term = *enabled; term; term = term->next)
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
if (grub_strcmp (term->name, aut->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (!term)
|
if (!term)
|
||||||
|
@ -74,11 +85,11 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int again = 0;
|
int again = 0;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
for (term = *disabled; term; term = term->next)
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (term == 0)
|
if (term == 0)
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
for (term = *enabled; term; term = term->next)
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (term)
|
if (term)
|
||||||
|
@ -86,7 +97,7 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||||
if (again)
|
if (again)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||||
args[i]);
|
args[i]);
|
||||||
for (aut = grub_term_input_autoload; aut; aut = aut->next)
|
for (aut = autoloads; aut; aut = aut->next)
|
||||||
if (grub_strcmp (args[i], aut->name) == 0)
|
if (grub_strcmp (args[i], aut->name) == 0)
|
||||||
{
|
{
|
||||||
grub_dl_t mod;
|
grub_dl_t mod;
|
||||||
|
@ -107,7 +118,7 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
for (term = *disabled; term; term = term->next)
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (term)
|
if (term)
|
||||||
|
@ -115,10 +126,8 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||||
GRUB_AS_LIST (term));
|
grub_list_push (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
@ -128,27 +137,25 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
for (term = *enabled; term; term = term->next)
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (term)
|
if (term)
|
||||||
{
|
{
|
||||||
if (!term->next && term == grub_term_inputs)
|
if (!term->next && term == *enabled)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
"can't remove the last terminal");
|
"can't remove the last terminal");
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
|
grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
if (term->fini)
|
if (term->fini)
|
||||||
term->fini ();
|
term->fini ();
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
FOR_DISABLED_TERM_INPUTS(term)
|
for (term = *disabled; term; term = term->next)
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (term)
|
if (term)
|
||||||
|
@ -156,193 +163,64 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||||
GRUB_AS_LIST (term));
|
grub_list_push (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_INPUTS(term)
|
|
||||||
{
|
{
|
||||||
|
struct abstract_terminal *next;
|
||||||
|
for (term = *enabled; term; term = next)
|
||||||
|
{
|
||||||
|
next = term->next;
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
break;
|
break;
|
||||||
if (i == argc)
|
if (i == argc)
|
||||||
{
|
{
|
||||||
if (!term->next && term == grub_term_inputs)
|
if (!term->next && term == *enabled)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
"can't remove the last terminal");
|
"can't remove the last terminal");
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
|
grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
if (term->fini)
|
if (term->fini)
|
||||||
term->fini ();
|
term->fini ();
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
|
||||||
GRUB_AS_LIST (term));
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
int argc, char **args)
|
||||||
|
{
|
||||||
|
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, next);
|
||||||
|
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, name);
|
||||||
|
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, init);
|
||||||
|
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, fini);
|
||||||
|
return handle_command (argc, args,
|
||||||
|
(struct abstract_terminal **) &grub_term_inputs,
|
||||||
|
(struct abstract_terminal **) &grub_term_inputs_disabled,
|
||||||
|
grub_term_input_autoload,
|
||||||
|
N_ ("Active input terminals:"),
|
||||||
|
N_ ("Available input terminals:"));
|
||||||
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int argc, char **args)
|
int argc, char **args)
|
||||||
{
|
{
|
||||||
int i;
|
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, next);
|
||||||
grub_term_output_t term;
|
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, name);
|
||||||
struct grub_term_autoload *aut;
|
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, init);
|
||||||
|
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, fini);
|
||||||
if (argc == 0)
|
return handle_command (argc, args, (struct abstract_terminal **) &grub_term_outputs,
|
||||||
{
|
(struct abstract_terminal **) &grub_term_outputs_disabled,
|
||||||
grub_puts_ (N_ ("Active output terminals:"));
|
grub_term_output_autoload,
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
N_ ("Active output terminals:"),
|
||||||
grub_printf ("%s ", term->name);
|
N_ ("Available output terminals:"));
|
||||||
grub_printf ("\n");
|
|
||||||
grub_puts_ (N_ ("Available output terminals:"));
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
grub_printf ("%s ", term->name);
|
|
||||||
/* This is quadratic but we don't expect mode than 30 terminal
|
|
||||||
modules ever. */
|
|
||||||
for (aut = grub_term_output_autoload; aut; aut = aut->next)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
|
||||||
break;
|
|
||||||
if (!term)
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (term->name, aut->name) == 0)
|
|
||||||
break;
|
|
||||||
if (!term)
|
|
||||||
grub_printf ("%s ", aut->name);
|
|
||||||
}
|
|
||||||
grub_printf ("\n");
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--append") == 0
|
|
||||||
|| grub_strcmp (args[0], "--remove") == 0)
|
|
||||||
i++;
|
|
||||||
|
|
||||||
if (i == argc)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
|
|
||||||
|
|
||||||
for (; i < argc; i++)
|
|
||||||
{
|
|
||||||
int again = 0;
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term == 0)
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
break;
|
|
||||||
if (again)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
|
||||||
args[i]);
|
|
||||||
for (aut = grub_term_output_autoload; aut; aut = aut->next)
|
|
||||||
if (grub_strcmp (args[i], aut->name) == 0)
|
|
||||||
{
|
|
||||||
grub_dl_t mod;
|
|
||||||
mod = grub_dl_load (aut->modname);
|
|
||||||
if (mod)
|
|
||||||
grub_dl_ref (mod);
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!aut)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
|
||||||
args[i]);
|
|
||||||
again = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--append") == 0)
|
|
||||||
{
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
{
|
|
||||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grub_strcmp (args[0], "--remove") == 0)
|
|
||||||
{
|
|
||||||
for (i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
{
|
|
||||||
if (!term->next && term == grub_term_outputs)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"can't remove the last terminal");
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
if (term->fini)
|
|
||||||
term->fini ();
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
FOR_DISABLED_TERM_OUTPUTS(term)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (term)
|
|
||||||
{
|
|
||||||
if (term->init && term->init () != GRUB_ERR_NONE)
|
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
{
|
|
||||||
for (i = 0; i < argc; i++)
|
|
||||||
if (grub_strcmp (args[i], term->name) == 0)
|
|
||||||
break;
|
|
||||||
if (i == argc)
|
|
||||||
{
|
|
||||||
if (!term->next && term == grub_term_outputs)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
|
||||||
"can't remove the last terminal");
|
|
||||||
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
if (term->fini)
|
|
||||||
term->fini ();
|
|
||||||
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
|
||||||
GRUB_AS_LIST (term));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_command_t cmd_terminal_input, cmd_terminal_output;
|
static grub_command_t cmd_terminal_input, cmd_terminal_output;
|
||||||
|
|
|
@ -8,7 +8,7 @@ pkglib_PROGRAMS += kernel.img
|
||||||
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
kern/i386/misc.S \
|
kern/i386/misc.S \
|
||||||
kern/i386/coreboot/init.c \
|
kern/i386/coreboot/init.c \
|
||||||
kern/i386/multiboot_mmap.c \
|
kern/i386/coreboot/mmap.c \
|
||||||
kern/i386/halt.c \
|
kern/i386/halt.c \
|
||||||
kern/main.c kern/device.c \
|
kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
|
|
74
conf/i386-multiboot.rmk
Normal file
74
conf/i386-multiboot.rmk
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
# -*- makefile -*-
|
||||||
|
|
||||||
|
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
|
|
||||||
|
# Images.
|
||||||
|
|
||||||
|
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
||||||
|
|
||||||
|
pkglib_PROGRAMS += kernel.img
|
||||||
|
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
|
kern/i386/misc.S \
|
||||||
|
kern/i386/coreboot/init.c \
|
||||||
|
kern/i386/multiboot_mmap.c \
|
||||||
|
kern/i386/halt.c \
|
||||||
|
kern/main.c kern/device.c \
|
||||||
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
|
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||||
|
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||||
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
|
kern/generic/rtc_get_time_ms.c \
|
||||||
|
kern/generic/millisleep.c \
|
||||||
|
kern/env.c \
|
||||||
|
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
||||||
|
symlist.c
|
||||||
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
|
||||||
|
|
||||||
|
sbin_SCRIPTS += grub-install
|
||||||
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
|
||||||
|
bin_SCRIPTS += grub-mkrescue
|
||||||
|
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||||
|
|
||||||
|
# Modules.
|
||||||
|
pkglib_MODULES = linux.mod aout.mod halt.mod datetime.mod mmap.mod
|
||||||
|
|
||||||
|
# For mmap.mod.
|
||||||
|
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
||||||
|
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For linux.mod.
|
||||||
|
linux_mod_SOURCES = loader/i386/linux.c
|
||||||
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For halt.mod.
|
||||||
|
halt_mod_SOURCES = commands/halt.c
|
||||||
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For aout.mod.
|
||||||
|
aout_mod_SOURCES = loader/aout.c
|
||||||
|
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For bsd.mod
|
||||||
|
pkglib_MODULES += bsd.mod
|
||||||
|
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
|
||||||
|
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For datetime.mod
|
||||||
|
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
include $(srcdir)/conf/i386.mk
|
||||||
|
include $(srcdir)/conf/common.mk
|
|
@ -68,6 +68,9 @@ grub_script_final_semicolon_SOURCES = tests/grub_script_final_semicolon.in
|
||||||
check_SCRIPTS += grub_script_dollar
|
check_SCRIPTS += grub_script_dollar
|
||||||
grub_script_dollar_SOURCES = tests/grub_script_dollar.in
|
grub_script_dollar_SOURCES = tests/grub_script_dollar.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_comments
|
||||||
|
grub_script_comments_SOURCES = tests/grub_script_comments.in
|
||||||
|
|
||||||
# List of tests to execute on "make check"
|
# List of tests to execute on "make check"
|
||||||
# SCRIPTED_TESTS = example_scripted_test
|
# SCRIPTED_TESTS = example_scripted_test
|
||||||
# SCRIPTED_TESTS += example_grub_script_test
|
# SCRIPTED_TESTS += example_grub_script_test
|
||||||
|
@ -83,6 +86,7 @@ SCRIPTED_TESTS += grub_script_if
|
||||||
SCRIPTED_TESTS += grub_script_blanklines
|
SCRIPTED_TESTS += grub_script_blanklines
|
||||||
SCRIPTED_TESTS += grub_script_final_semicolon
|
SCRIPTED_TESTS += grub_script_final_semicolon
|
||||||
SCRIPTED_TESTS += grub_script_dollar
|
SCRIPTED_TESTS += grub_script_dollar
|
||||||
|
SCRIPTED_TESTS += grub_script_comments
|
||||||
|
|
||||||
# dependencies between tests and testing-tools
|
# dependencies between tests and testing-tools
|
||||||
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
|
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
|
||||||
|
|
|
@ -102,6 +102,7 @@ case "$target_cpu"-"$platform" in
|
||||||
i386-efi) ;;
|
i386-efi) ;;
|
||||||
x86_64-efi) ;;
|
x86_64-efi) ;;
|
||||||
i386-pc) ;;
|
i386-pc) ;;
|
||||||
|
i386-multiboot) ;;
|
||||||
i386-coreboot) ;;
|
i386-coreboot) ;;
|
||||||
i386-linuxbios) platform=coreboot ;;
|
i386-linuxbios) platform=coreboot ;;
|
||||||
i386-ieee1275) ;;
|
i386-ieee1275) ;;
|
||||||
|
@ -136,6 +137,7 @@ esac
|
||||||
|
|
||||||
case "$platform" in
|
case "$platform" in
|
||||||
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
|
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
|
||||||
|
multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;;
|
||||||
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
|
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
|
||||||
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
|
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
|
||||||
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
|
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
|
||||||
|
|
|
@ -1379,7 +1379,8 @@ pitch and duration pairs.
|
||||||
If the arguments are a series of numbers, play the inline tune.
|
If the arguments are a series of numbers, play the inline tune.
|
||||||
|
|
||||||
The tempo is the base for all note durations. 60 gives a 1-second base, 120
|
The tempo is the base for all note durations. 60 gives a 1-second base, 120
|
||||||
gives a half-second base, etc. Pitches are Hz.
|
gives a half-second base, etc. Pitches are Hz. Set pitch to 0 to produce
|
||||||
|
a rest.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp);
|
||||||
char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
|
char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
|
||||||
grub_efi_device_path_t *
|
grub_efi_device_path_t *
|
||||||
EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
|
EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
|
||||||
grub_err_t EXPORT_FUNC (grub_efi_finish_boot_services) (grub_size_t *outbuf_size, void *outbuf,
|
grub_err_t EXPORT_FUNC (grub_efi_finish_boot_services) (grub_efi_uintn_t *outbuf_size, void *outbuf,
|
||||||
grub_efi_uintn_t *map_key,
|
grub_efi_uintn_t *map_key,
|
||||||
grub_efi_uintn_t *efi_desc_size,
|
grub_efi_uintn_t *efi_desc_size,
|
||||||
grub_efi_uint32_t *efi_desc_version);
|
grub_efi_uint32_t *efi_desc_version);
|
||||||
|
|
|
@ -44,8 +44,9 @@ typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
|
||||||
|
|
||||||
struct grub_linuxbios_table_item
|
struct grub_linuxbios_table_item
|
||||||
{
|
{
|
||||||
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0
|
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0x00
|
||||||
#define GRUB_LINUXBIOS_MEMBER_MEMORY 1
|
#define GRUB_LINUXBIOS_MEMBER_MEMORY 0x01
|
||||||
|
#define GRUB_LINUXBIOS_MEMBER_LINK 0x11
|
||||||
grub_uint32_t tag;
|
grub_uint32_t tag;
|
||||||
grub_uint32_t size;
|
grub_uint32_t size;
|
||||||
};
|
};
|
||||||
|
|
1
include/grub/i386/multiboot/boot.h
Normal file
1
include/grub/i386/multiboot/boot.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/boot.h>
|
1
include/grub/i386/multiboot/console.h
Normal file
1
include/grub/i386/multiboot/console.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/console.h>
|
1
include/grub/i386/multiboot/init.h
Normal file
1
include/grub/i386/multiboot/init.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/init.h>
|
1
include/grub/i386/multiboot/kernel.h
Normal file
1
include/grub/i386/multiboot/kernel.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/kernel.h>
|
1
include/grub/i386/multiboot/loader.h
Normal file
1
include/grub/i386/multiboot/loader.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/loader.h>
|
1
include/grub/i386/multiboot/memory.h
Normal file
1
include/grub/i386/multiboot/memory.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/memory.h>
|
1
include/grub/i386/multiboot/serial.h
Normal file
1
include/grub/i386/multiboot/serial.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/serial.h>
|
1
include/grub/i386/multiboot/time.h
Normal file
1
include/grub/i386/multiboot/time.h
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include <grub/i386/coreboot/time.h>
|
|
@ -53,7 +53,7 @@ grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize,
|
||||||
grub_uint32_t grub_get_multiboot_mmap_count (void);
|
grub_uint32_t grub_get_multiboot_mmap_count (void);
|
||||||
grub_err_t grub_multiboot_set_video_mode (void);
|
grub_err_t grub_multiboot_set_video_mode (void);
|
||||||
|
|
||||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
|
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||||
#include <grub/i386/pc/vbe.h>
|
#include <grub/i386/pc/vbe.h>
|
||||||
#define GRUB_MACHINE_HAS_VGA_TEXT 1
|
#define GRUB_MACHINE_HAS_VGA_TEXT 1
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -26,7 +26,6 @@ enum grub_dev_abstraction_types {
|
||||||
};
|
};
|
||||||
|
|
||||||
char *grub_guess_root_device (const char *dir);
|
char *grub_guess_root_device (const char *dir);
|
||||||
char *grub_get_prefix (const char *dir);
|
|
||||||
int grub_util_get_dev_abstraction (const char *os_dev);
|
int grub_util_get_dev_abstraction (const char *os_dev);
|
||||||
char *grub_util_get_grub_dev (const char *os_dev);
|
char *grub_util_get_grub_dev (const char *os_dev);
|
||||||
const char *grub_util_check_block_device (const char *blk_dev);
|
const char *grub_util_check_block_device (const char *blk_dev);
|
||||||
|
|
|
@ -147,7 +147,7 @@ grub_efi_free_pages (grub_efi_physical_address_t address,
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_efi_finish_boot_services (grub_size_t *outbuf_size, void *outbuf,
|
grub_efi_finish_boot_services (grub_efi_uintn_t *outbuf_size, void *outbuf,
|
||||||
grub_efi_uintn_t *map_key,
|
grub_efi_uintn_t *map_key,
|
||||||
grub_efi_uintn_t *efi_desc_size,
|
grub_efi_uintn_t *efi_desc_size,
|
||||||
grub_efi_uint32_t *efi_desc_version)
|
grub_efi_uint32_t *efi_desc_version)
|
||||||
|
|
|
@ -102,7 +102,9 @@ grub_machine_init (void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GRUB_MACHINE_MULTIBOOT
|
||||||
grub_machine_mmap_init ();
|
grub_machine_mmap_init ();
|
||||||
|
#endif
|
||||||
grub_machine_mmap_iterate (heap_init);
|
grub_machine_mmap_iterate (heap_init);
|
||||||
|
|
||||||
grub_tsc_init ();
|
grub_tsc_init ();
|
||||||
|
|
|
@ -57,13 +57,23 @@ signature_found:
|
||||||
(long) table_header->size);
|
(long) table_header->size);
|
||||||
for (; table_item->size;
|
for (; table_item->size;
|
||||||
table_item = (grub_linuxbios_table_item_t) ((long) table_item + (long) table_item->size))
|
table_item = (grub_linuxbios_table_item_t) ((long) table_item + (long) table_item->size))
|
||||||
|
{
|
||||||
|
if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK
|
||||||
|
&& check_signature ((grub_linuxbios_table_header_t) (grub_addr_t)
|
||||||
|
*(grub_uint64_t *) (table_item + 1)))
|
||||||
|
{
|
||||||
|
table_header = (grub_linuxbios_table_header_t) (grub_addr_t)
|
||||||
|
*(grub_uint64_t *) (table_item + 1);
|
||||||
|
goto signature_found;
|
||||||
|
}
|
||||||
if (hook (table_item))
|
if (hook (table_item))
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
grub_err_t
|
||||||
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
|
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
|
||||||
{
|
{
|
||||||
mem_region_t mem_region;
|
mem_region_t mem_region;
|
||||||
|
|
|
@ -66,10 +66,12 @@ multiboot_header:
|
||||||
.long -0x1BADB002 - MULTIBOOT_MEMORY_INFO
|
.long -0x1BADB002 - MULTIBOOT_MEMORY_INFO
|
||||||
|
|
||||||
codestart:
|
codestart:
|
||||||
|
#ifdef GRUB_MACHINE_MULTIBOOT
|
||||||
cmpl $MULTIBOOT_BOOTLOADER_MAGIC, %eax
|
cmpl $MULTIBOOT_BOOTLOADER_MAGIC, %eax
|
||||||
jne 0f
|
jne 0f
|
||||||
movl %ebx, EXT_C(startup_multiboot_info)
|
movl %ebx, EXT_C(startup_multiboot_info)
|
||||||
0:
|
0:
|
||||||
|
#endif
|
||||||
|
|
||||||
/* initialize the stack */
|
/* initialize the stack */
|
||||||
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %esp
|
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %esp
|
||||||
|
|
|
@ -249,12 +249,11 @@ grub_parser_execute (char *source)
|
||||||
}
|
}
|
||||||
|
|
||||||
p = grub_strchr (source, '\n');
|
p = grub_strchr (source, '\n');
|
||||||
if (p)
|
|
||||||
*p = 0;
|
|
||||||
|
|
||||||
*line = grub_strdup (source);
|
|
||||||
if (p)
|
if (p)
|
||||||
*p = '\n';
|
*line = grub_strndup (source, p - source);
|
||||||
|
else
|
||||||
|
*line = grub_strdup (source);
|
||||||
source = p ? p + 1 : 0;
|
source = p ? p + 1 : 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
struct grub_relocator *grub_multiboot_relocator = NULL;
|
struct grub_relocator *grub_multiboot_relocator = NULL;
|
||||||
grub_uint32_t grub_multiboot_payload_eip;
|
grub_uint32_t grub_multiboot_payload_eip;
|
||||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
|
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||||
#define DEFAULT_VIDEO_MODE "text"
|
#define DEFAULT_VIDEO_MODE "text"
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_VIDEO_MODE "auto"
|
#define DEFAULT_VIDEO_MODE "auto"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/video.h>
|
#include <grub/video.h>
|
||||||
|
|
||||||
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
|
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
|
||||||
#include <grub/i386/pc/vbe.h>
|
#include <grub/i386/pc/vbe.h>
|
||||||
#define HAS_VGA_TEXT 1
|
#define HAS_VGA_TEXT 1
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -112,9 +112,9 @@ typedef size_t yy_size_t;
|
||||||
%option extra-type="struct grub_parser_param*"
|
%option extra-type="struct grub_parser_param*"
|
||||||
|
|
||||||
BLANK [ \t]
|
BLANK [ \t]
|
||||||
COMMENT ^[ \t]*#.*$
|
COMMENT #.*$
|
||||||
|
|
||||||
CHAR [^|&$;<> \t\n\'\"\\]
|
CHAR [^{}|&$;<> \t\n\'\"\\]
|
||||||
DIGITS [[:digit:]]+
|
DIGITS [[:digit:]]+
|
||||||
NAME [[:alpha:]_][[:alnum:][:digit:]_]*
|
NAME [[:alpha:]_][[:alnum:][:digit:]_]*
|
||||||
|
|
||||||
|
|
28
tests/grub_script_comments.in
Normal file
28
tests/grub_script_comments.in
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#! @builddir@/grub-shell-tester
|
||||||
|
#
|
||||||
|
# Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# GRUB is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# GRUB is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
echo a###b
|
||||||
|
echo a# #b
|
||||||
|
|
||||||
|
echo #
|
||||||
|
echo \#
|
||||||
|
|
||||||
|
echo '#'
|
||||||
|
echo "#"
|
||||||
|
|
||||||
|
echo '\#'
|
||||||
|
echo "\#"
|
|
@ -79,103 +79,6 @@ xgetcwd (void)
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
|
||||||
/* Convert POSIX path to Win32 path,
|
|
||||||
remove drive letter, replace backslashes. */
|
|
||||||
static char *
|
|
||||||
get_win32_path (const char *path)
|
|
||||||
{
|
|
||||||
char winpath[PATH_MAX];
|
|
||||||
cygwin_conv_to_full_win32_path (path, winpath);
|
|
||||||
|
|
||||||
int len = strlen (winpath);
|
|
||||||
if (len > 2 && winpath[1] == ':')
|
|
||||||
{
|
|
||||||
len -= 2;
|
|
||||||
memmove (winpath, winpath + 2, len + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < len; i++)
|
|
||||||
if (winpath[i] == '\\')
|
|
||||||
winpath[i] = '/';
|
|
||||||
return xstrdup (winpath);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char *
|
|
||||||
grub_get_prefix (const char *dir)
|
|
||||||
{
|
|
||||||
char *saved_cwd;
|
|
||||||
char *abs_dir, *prev_dir;
|
|
||||||
char *prefix;
|
|
||||||
struct stat st, prev_st;
|
|
||||||
|
|
||||||
/* Save the current directory. */
|
|
||||||
saved_cwd = xgetcwd ();
|
|
||||||
|
|
||||||
if (chdir (dir) < 0)
|
|
||||||
grub_util_error ("cannot change directory to `%s'", dir);
|
|
||||||
|
|
||||||
abs_dir = xgetcwd ();
|
|
||||||
strip_extra_slashes (abs_dir);
|
|
||||||
prev_dir = xstrdup (abs_dir);
|
|
||||||
|
|
||||||
if (stat (".", &prev_st) < 0)
|
|
||||||
grub_util_error ("cannot stat `%s'", dir);
|
|
||||||
|
|
||||||
if (! S_ISDIR (prev_st.st_mode))
|
|
||||||
grub_util_error ("`%s' is not a directory", dir);
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
if (chdir ("..") < 0)
|
|
||||||
grub_util_error ("cannot change directory to the parent");
|
|
||||||
|
|
||||||
if (stat (".", &st) < 0)
|
|
||||||
grub_util_error ("cannot stat current directory");
|
|
||||||
|
|
||||||
if (! S_ISDIR (st.st_mode))
|
|
||||||
grub_util_error ("current directory is not a directory???");
|
|
||||||
|
|
||||||
if (prev_st.st_dev != st.st_dev || prev_st.st_ino == st.st_ino)
|
|
||||||
break;
|
|
||||||
|
|
||||||
free (prev_dir);
|
|
||||||
prev_dir = xgetcwd ();
|
|
||||||
prev_st = st;
|
|
||||||
}
|
|
||||||
|
|
||||||
strip_extra_slashes (prev_dir);
|
|
||||||
prefix = xmalloc (strlen (abs_dir) - strlen (prev_dir) + 2);
|
|
||||||
prefix[0] = '/';
|
|
||||||
strcpy (prefix + 1, abs_dir + strlen (prev_dir));
|
|
||||||
strip_extra_slashes (prefix);
|
|
||||||
|
|
||||||
if (chdir (saved_cwd) < 0)
|
|
||||||
grub_util_error ("cannot change directory to `%s'", dir);
|
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
|
||||||
if (st.st_dev != (DEV_CYGDRIVE_MAJOR << 16))
|
|
||||||
{
|
|
||||||
/* Reached some mount point not below /cygdrive.
|
|
||||||
GRUB does not know Cygwin's emulated mounts,
|
|
||||||
convert to Win32 path. */
|
|
||||||
grub_util_info ("Cygwin prefix = %s", prefix);
|
|
||||||
char * wprefix = get_win32_path (prefix);
|
|
||||||
free (prefix);
|
|
||||||
prefix = wprefix;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
free (saved_cwd);
|
|
||||||
free (abs_dir);
|
|
||||||
free (prev_dir);
|
|
||||||
|
|
||||||
grub_util_info ("prefix = %s", prefix);
|
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
|
|
@ -242,7 +242,7 @@ main (int argc, char *argv[])
|
||||||
if (strcmp (root_dev, "host") == 0)
|
if (strcmp (root_dev, "host") == 0)
|
||||||
dir = xstrdup (dir);
|
dir = xstrdup (dir);
|
||||||
else
|
else
|
||||||
dir = grub_get_prefix (dir);
|
dir = make_system_path_relative_to_its_root (dir);
|
||||||
prefix = xmalloc (strlen (root_dev) + 2 + strlen (dir) + 1);
|
prefix = xmalloc (strlen (root_dev) + 2 + strlen (dir) + 1);
|
||||||
sprintf (prefix, "(%s)%s", root_dev, dir);
|
sprintf (prefix, "(%s)%s", root_dev, dir);
|
||||||
free (dir);
|
free (dir);
|
||||||
|
|
|
@ -99,6 +99,28 @@ struct image_target_desc image_targets[] =
|
||||||
.mod_gap = GRUB_KERNEL_I386_COREBOOT_MOD_GAP,
|
.mod_gap = GRUB_KERNEL_I386_COREBOOT_MOD_GAP,
|
||||||
.mod_align = GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN
|
.mod_align = GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "i386-multiboot",
|
||||||
|
.voidp_sizeof = 4,
|
||||||
|
.bigendian = 0,
|
||||||
|
.id = IMAGE_COREBOOT,
|
||||||
|
.flags = PLATFORM_FLAGS_NONE,
|
||||||
|
.prefix = GRUB_KERNEL_I386_COREBOOT_PREFIX,
|
||||||
|
.data_end = GRUB_KERNEL_I386_COREBOOT_DATA_END,
|
||||||
|
.raw_size = 0,
|
||||||
|
.total_module_size = TARGET_NO_FIELD,
|
||||||
|
.kernel_image_size = TARGET_NO_FIELD,
|
||||||
|
.compressed_size = TARGET_NO_FIELD,
|
||||||
|
.section_align = 1,
|
||||||
|
.vaddr_offset = 0,
|
||||||
|
.install_dos_part = TARGET_NO_FIELD,
|
||||||
|
.install_bsd_part = TARGET_NO_FIELD,
|
||||||
|
.link_addr = GRUB_KERNEL_I386_COREBOOT_LINK_ADDR,
|
||||||
|
.elf_target = EM_386,
|
||||||
|
.link_align = 4,
|
||||||
|
.mod_gap = GRUB_KERNEL_I386_COREBOOT_MOD_GAP,
|
||||||
|
.mod_align = GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "i386-pc",
|
.name = "i386-pc",
|
||||||
.voidp_sizeof = 4,
|
.voidp_sizeof = 4,
|
||||||
|
|
|
@ -30,7 +30,7 @@ target_cpu=@target_cpu@
|
||||||
native_platform=@platform@
|
native_platform=@platform@
|
||||||
pkglib_DATA="@pkglib_DATA@"
|
pkglib_DATA="@pkglib_DATA@"
|
||||||
|
|
||||||
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot
|
multiboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-multiboot
|
||||||
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
|
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
|
||||||
efi32_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-efi
|
efi32_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-efi
|
||||||
efi64_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/x86_64-efi
|
efi64_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/x86_64-efi
|
||||||
|
@ -124,8 +124,8 @@ process_input_dir ()
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "${override_dir}" = "" ] ; then
|
if [ "${override_dir}" = "" ] ; then
|
||||||
if test -e "${coreboot_dir}" ; then
|
if test -e "${multiboot_dir}" ; then
|
||||||
process_input_dir ${coreboot_dir} coreboot
|
process_input_dir ${multiboot_dir} multiboot
|
||||||
fi
|
fi
|
||||||
if test -e "${pc_dir}" ; then
|
if test -e "${pc_dir}" ; then
|
||||||
process_input_dir ${pc_dir} pc
|
process_input_dir ${pc_dir} pc
|
||||||
|
@ -138,12 +138,12 @@ if [ "${override_dir}" = "" ] ; then
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
process_input_dir ${override_dir} ${native_platform}
|
process_input_dir ${override_dir} ${native_platform}
|
||||||
coreboot_dir=
|
multiboot_dir=
|
||||||
pc_dir=
|
pc_dir=
|
||||||
efi32_dir=
|
efi32_dir=
|
||||||
efi64_dir=
|
efi64_dir=
|
||||||
case "${target_cpu}-${native_platform}" in
|
case "${native_platform}" in
|
||||||
i386-coreboot) coreboot_dir=${override_dir} ;;
|
i386-multiboot) multiboot_dir=${override_dir} ;;
|
||||||
i386-pc) pc_dir=${override_dir} ;;
|
i386-pc) pc_dir=${override_dir} ;;
|
||||||
i386-efi) efi32_dir=${override_dir} ;;
|
i386-efi) efi32_dir=${override_dir} ;;
|
||||||
x86_64-efi) efi64_dir=${override_dir} ;;
|
x86_64-efi) efi64_dir=${override_dir} ;;
|
||||||
|
@ -154,28 +154,28 @@ fi
|
||||||
iso_uuid=$(date -u +%Y-%m-%d-%H-%M-%S-00)
|
iso_uuid=$(date -u +%Y-%m-%d-%H-%M-%S-00)
|
||||||
grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
|
grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
|
||||||
|
|
||||||
# build coreboot core.img
|
# build multiboot core.img
|
||||||
if test -e "${coreboot_dir}" ; then
|
if test -e "${multiboot_dir}" ; then
|
||||||
echo "Enabling coreboot support ..."
|
echo "Enabling multiboot support ..."
|
||||||
memdisk_img=`mktemp "$MKTEMP_TEMPLATE"`
|
memdisk_img=`mktemp "$MKTEMP_TEMPLATE"`
|
||||||
memdisk_dir=`mktemp -d "$MKTEMP_TEMPLATE"`
|
memdisk_dir=`mktemp -d "$MKTEMP_TEMPLATE"`
|
||||||
mkdir -p ${memdisk_dir}/boot/grub
|
mkdir -p ${memdisk_dir}/boot/grub
|
||||||
|
|
||||||
modules="$(cat ${coreboot_dir}/partmap.lst) ${modules}"
|
modules="$(cat ${multiboot_dir}/partmap.lst) ${modules}"
|
||||||
cat << EOF > ${memdisk_dir}/boot/grub/grub.cfg
|
cat << EOF > ${memdisk_dir}/boot/grub/grub.cfg
|
||||||
search --fs-uuid --set ${iso_uuid}
|
search --fs-uuid --set ${iso_uuid}
|
||||||
set prefix=(\${root})/boot/grub/${target_cpu}-coreboot
|
set prefix=(\${root})/boot/grub/${target_cpu}-multiboot
|
||||||
source \$prefix/grub.cfg
|
source \$prefix/grub.cfg
|
||||||
EOF
|
EOF
|
||||||
(for i in ${modules} ; do
|
(for i in ${modules} ; do
|
||||||
echo "insmod $i"
|
echo "insmod $i"
|
||||||
done ; \
|
done ; \
|
||||||
echo "source /boot/grub/grub.cfg") \
|
echo "source /boot/grub/grub.cfg") \
|
||||||
> ${iso9660_dir}/boot/grub/i386-coreboot/grub.cfg
|
> ${iso9660_dir}/boot/grub/i386-multiboot/grub.cfg
|
||||||
|
|
||||||
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
|
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
|
||||||
rm -rf ${memdisk_dir}
|
rm -rf ${memdisk_dir}
|
||||||
grub-mkimage -O i386-coreboot -d ${coreboot_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
|
grub-mkimage -O i386-multiboot -d ${multiboot_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
|
||||||
memdisk tar search iso9660 configfile sh \
|
memdisk tar search iso9660 configfile sh \
|
||||||
ata at_keyboard
|
ata at_keyboard
|
||||||
rm -f ${memdisk_img}
|
rm -f ${memdisk_img}
|
||||||
|
|
|
@ -634,7 +634,8 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
find_dest_dev (&ginfo, argv);
|
find_dest_dev (&ginfo, argv);
|
||||||
|
|
||||||
ginfo.prefix = grub_get_prefix (ginfo.dir ? : DEFAULT_DIRECTORY);
|
ginfo.prefix = make_system_path_relative_to_its_root (ginfo.dir ?
|
||||||
|
: DEFAULT_DIRECTORY);
|
||||||
|
|
||||||
check_root_dev (&ginfo);
|
check_root_dev (&ginfo);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue