merge mainline into newreloc
This commit is contained in:
commit
6a82c1b2db
26 changed files with 429 additions and 97 deletions
83
ChangeLog
83
ChangeLog
|
@ -1,3 +1,86 @@
|
|||
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* commands/parttool.c (grub_cmd_parttool): Fix #if !GRUB_NO_MODULES
|
||||
condition.
|
||||
|
||||
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* kern/mm.c (grub_real_malloc): Put magic and size assignment in common
|
||||
part.
|
||||
|
||||
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* kern/mm.c (grub_mm_init_region): Check for region size after aligning
|
||||
pointers.
|
||||
|
||||
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* kern/mm.c (grub_real_malloc): Fix size calculation when extra == 0.
|
||||
|
||||
2010-05-01 Christian Franke <franke@computer.org>
|
||||
|
||||
* util/grub-mkconfig_lib.in (make_system_path_relative_to_its_root):
|
||||
Remove broken Cygwin path conversion.
|
||||
* util/misc.c: [__CYGWIN__] Add include and define.
|
||||
[__CYGWIN__] (get_win32_path): Copy function from getroot.c, modify
|
||||
for Cygwin 1.7.
|
||||
(make_system_path_relative_to_its_root): Simplify loop, replace early
|
||||
return by break.
|
||||
[__CYGWIN__] Add conversion to win32 path.
|
||||
Include "/" case in trailing slash removal.
|
||||
|
||||
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* kern/main.c (grub_load_config): Fix copy-pasted comment.
|
||||
Reported by: Seth Goldberg
|
||||
|
||||
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* commands/help.c (grub_cmd_help): Fix a typo.
|
||||
Reported by: Seth Goldberg
|
||||
|
||||
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* commands/hashsum.c (GRUB_MOD_INIT): Remove duplication of command
|
||||
name and add N_.
|
||||
* commands/i386/pc/drivemap.c (GRUB_MOD_INIT): Likewise.
|
||||
* commands/iorw.c (GRUB_MOD_INIT): Likewise.
|
||||
* commands/password_pbkdf2.c (GRUB_MOD_INIT): Likewise.
|
||||
* commands/regexp.c (GRUB_MOD_INIT): Likewise.
|
||||
* commands/setpci.c (GRUB_MOD_INIT): Likewise.
|
||||
* commands/terminal.c (GRUB_MOD_INIT): Likewise.
|
||||
* efiemu/main.c (GRUB_MOD_INIT): Likewise.
|
||||
* font/font_cmd.c (GRUB_MOD_INIT): Likewise.
|
||||
* kern/corecmd.c (GRUB_MOD_INIT): Likewise.
|
||||
* mmap/mmap.c (GRUB_MOD_INIT): Likewise.
|
||||
* normal/context.c (GRUB_MOD_INIT): Likewise.
|
||||
* normal/main.c (GRUB_MOD_INIT): Likewise.
|
||||
* term/gfxterm.c (GRUB_MOD_INIT): Likewise.
|
||||
* term/serial.c (GRUB_MOD_INIT): Likewise.
|
||||
* term/terminfo.c (GRUB_MOD_INIT): Likewise.
|
||||
|
||||
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* kern/mm.c (grub_real_malloc): Satisfy alignment requirement when
|
||||
extra == 0.
|
||||
|
||||
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* commands/iorw.c: New file.
|
||||
* conf/i386.rmk (pkglib_MODULES): Add iorw.mod.
|
||||
(iorw_mod_SOURCES): New variable.
|
||||
(iorw_mod_CFLAGS): Likewise.
|
||||
(iorw_mod_LDFLAGS): Likewise.
|
||||
|
||||
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Hotkey support
|
||||
|
||||
* include/grub/menu.h (grub_menu_entry): New field 'hotkey'.
|
||||
* normal/main.c (hotkey_aliases): New variable.
|
||||
(grub_normal_add_menu_entry): Parse "--hotkey".
|
||||
* normal/menu_text.c (run_menu): Handle hotkeys.
|
||||
|
||||
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* kern/i386/coreboot/init.c (grub_machine_init): Call
|
||||
|
|
|
@ -24,13 +24,14 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static const struct grub_arg_option options[] = {
|
||||
{"hash", 'h', 0, "Specify hash to use.", "HASH", ARG_TYPE_STRING},
|
||||
{"check", 'c', 0, "Check hash list file.", "FILE", ARG_TYPE_STRING},
|
||||
{"prefix", 'p', 0, "Base directory for hash list.", "DIRECTORY",
|
||||
{"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING},
|
||||
{"check", 'c', 0, N_("Check hash list file."), N_("FILE"), ARG_TYPE_STRING},
|
||||
{"prefix", 'p', 0, N_("Base directory for hash list."), N_("DIRECTORY"),
|
||||
ARG_TYPE_STRING},
|
||||
{"keep-going", 'k', 0, "Don't stop after first error.", 0, 0},
|
||||
{"keep-going", 'k', 0, N_("Don't stop after first error."), 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -249,21 +250,21 @@ GRUB_MOD_INIT(hashsum)
|
|||
options);
|
||||
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"md5sum [-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]",
|
||||
"Compute or check hash checksum.",
|
||||
N_("[-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
N_("Compute or check hash checksum."),
|
||||
options);
|
||||
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"sha256sum [-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]",
|
||||
N_("[-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
"Compute or check hash checksum.",
|
||||
options);
|
||||
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"sha512sum [-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]",
|
||||
"Compute or check hash checksum.",
|
||||
N_("[-c FILE [-p PREFIX]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
N_("Compute or check hash checksum."),
|
||||
options);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
|||
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
|
||||
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
||||
else
|
||||
grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
|
||||
grub_printf ("%s %s %s\n%s\n", _("Usage:"), cmd->name, _(cmd->summary),
|
||||
_(cmd->description));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -403,7 +403,6 @@ GRUB_MOD_INIT (drivemap)
|
|||
grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap;
|
||||
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"drivemap"
|
||||
N_("-l | -r | [-s] grubdev osdisk."),
|
||||
N_("Manage the BIOS drive mappings."),
|
||||
options);
|
||||
|
|
150
commands/iorw.c
Normal file
150
commands/iorw.c
Normal file
|
@ -0,0 +1,150 @@
|
|||
/* memrw.c - command to read / write physical memory */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
|
||||
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{0, 'v', 0, N_("Save read value into variable VARNAME."),
|
||||
N_("VARNAME"), ARG_TYPE_STRING},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
|
||||
{
|
||||
grub_target_addr_t addr;
|
||||
grub_uint32_t value = 0;
|
||||
char buf[sizeof ("XXXXXXXX")];
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
||||
|
||||
addr = grub_strtoul (argv[0], 0, 0);
|
||||
switch (cmd->cmd->name[sizeof ("in") - 1])
|
||||
{
|
||||
case 'l':
|
||||
value = grub_inl (addr);
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
value = grub_inw (addr);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
value = grub_inb (addr);
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmd->state[0].set)
|
||||
{
|
||||
grub_snprintf (buf, sizeof (buf), "%x", value);
|
||||
grub_env_set (cmd->state[0].arg, buf);
|
||||
}
|
||||
else
|
||||
grub_printf ("0x%x\n", value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
||||
{
|
||||
grub_target_addr_t addr;
|
||||
grub_uint32_t value;
|
||||
grub_uint32_t mask = 0xffffffff;
|
||||
|
||||
if (argc != 2 && argc != 3)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
||||
|
||||
addr = grub_strtoul (argv[0], 0, 0);
|
||||
value = grub_strtoul (argv[1], 0, 0);
|
||||
if (argc == 3)
|
||||
mask = grub_strtoul (argv[2], 0, 0);
|
||||
value &= mask;
|
||||
switch (cmd->name[sizeof ("out") - 1])
|
||||
{
|
||||
case 'l':
|
||||
if (mask != 0xffffffff)
|
||||
grub_outl ((grub_inl (addr) & ~mask) | value, addr);
|
||||
else
|
||||
grub_outl (value, addr);
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
if ((mask & 0xffff) != 0xffff)
|
||||
grub_outw ((grub_inw (addr) & ~mask) | value, addr);
|
||||
else
|
||||
grub_outw (value, addr);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
if ((mask & 0xff) != 0xff)
|
||||
grub_outb ((grub_inb (addr) & ~mask) | value, addr);
|
||||
else
|
||||
grub_outb (value, addr);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT(memrw)
|
||||
{
|
||||
cmd_read_byte =
|
||||
grub_register_extcmd ("inb", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||
N_("PORT"), N_("Read byte from PORT."), options);
|
||||
cmd_read_word =
|
||||
grub_register_extcmd ("inw", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||
N_("PORT"), N_("Read word from PORT."), options);
|
||||
cmd_read_dword =
|
||||
grub_register_extcmd ("inl", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||
N_("PORT"), N_("Read dword from PORT."), options);
|
||||
cmd_write_byte =
|
||||
grub_register_command ("outb", grub_cmd_write,
|
||||
N_("PORT VALUE [MASK]"),
|
||||
N_("Write byte VALUE to PORT."));
|
||||
cmd_write_word =
|
||||
grub_register_command ("outw", grub_cmd_write,
|
||||
N_("PORT VALUE [MASK]"),
|
||||
N_("Write word VALUE to PORT."));
|
||||
cmd_write_dword =
|
||||
grub_register_command ("outl", grub_cmd_write,
|
||||
N_("ADDR VALUE [MASK]"),
|
||||
N_("Write dword VALUE to PORT."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(memrw)
|
||||
{
|
||||
grub_unregister_extcmd (cmd_read_byte);
|
||||
grub_unregister_extcmd (cmd_read_word);
|
||||
grub_unregister_extcmd (cmd_read_dword);
|
||||
grub_unregister_command (cmd_write_byte);
|
||||
grub_unregister_command (cmd_write_word);
|
||||
grub_unregister_command (cmd_write_dword);
|
||||
}
|
|
@ -175,7 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
/* Load modules. */
|
||||
#if GRUB_NO_MODULES
|
||||
#if !GRUB_NO_MODULES
|
||||
{
|
||||
const char *prefix;
|
||||
prefix = grub_env_get ("prefix");
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/env.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
|
@ -186,8 +187,8 @@ GRUB_MOD_INIT(password_pbkdf2)
|
|||
{
|
||||
my_mod = mod;
|
||||
cmd = grub_register_command ("password_pbkdf2", grub_cmd_password,
|
||||
"password_pbkdf2 USER PBKDF2_PASSWORD",
|
||||
"Set user password (PBKDF2). ");
|
||||
N_("USER PBKDF2_PASSWORD"),
|
||||
N_("Set user password (PBKDF2). "));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(password_pbkdf2)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <regex.h>
|
||||
|
||||
static grub_err_t
|
||||
|
@ -69,8 +70,8 @@ static grub_command_t cmd;
|
|||
GRUB_MOD_INIT(regexp)
|
||||
{
|
||||
cmd = grub_register_command ("regexp", grub_cmd_regexp,
|
||||
"REGEXP STRING",
|
||||
"Test if REGEXP matches STRING.");
|
||||
N_("REGEXP STRING"),
|
||||
N_("Test if REGEXP matches STRING."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(regexp)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
struct pci_register
|
||||
{
|
||||
|
@ -329,9 +330,9 @@ static grub_extcmd_t cmd;
|
|||
GRUB_MOD_INIT(setpci)
|
||||
{
|
||||
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, GRUB_COMMAND_FLAG_BOTH,
|
||||
"setpci [-s POSITION] [-d DEVICE] [-v VAR] "
|
||||
"[REGISTER][=VALUE[:MASK]]",
|
||||
"Manipulate PCI devices.", options);
|
||||
N_("[-s POSITION] [-d DEVICE] [-v VAR] "
|
||||
"[REGISTER][=VALUE[:MASK]]"),
|
||||
N_("Manipulate PCI devices."), options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(setpci)
|
||||
|
|
|
@ -229,14 +229,14 @@ GRUB_MOD_INIT(terminal)
|
|||
{
|
||||
cmd_terminal_input =
|
||||
grub_register_command ("terminal_input", grub_cmd_terminal_input,
|
||||
"[--append|--remove] "
|
||||
"[TERMINAL1] [TERMINAL2] ...",
|
||||
"List or select an input terminal.");
|
||||
N_("[--append|--remove] "
|
||||
"[TERMINAL1] [TERMINAL2] ..."),
|
||||
N_("List or select an input terminal."));
|
||||
cmd_terminal_output =
|
||||
grub_register_command ("terminal_output", grub_cmd_terminal_output,
|
||||
"[--append|--remove] "
|
||||
"[TERMINAL1] [TERMINAL2] ...",
|
||||
"List or select an output terminal.");
|
||||
N_("[--append|--remove] "
|
||||
"[TERMINAL1] [TERMINAL2] ..."),
|
||||
N_("List or select an output terminal."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(terminal)
|
||||
|
|
|
@ -105,6 +105,12 @@ play_mod_SOURCES = commands/i386/pc/play.c
|
|||
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For iorw.mod.
|
||||
pkglib_MODULES += iorw.mod
|
||||
iorw_mod_SOURCES = commands/iorw.c
|
||||
iorw_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
iorw_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += xnu.mod
|
||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c \
|
||||
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/efiemu/efiemu.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* System table. Two version depending on mode */
|
||||
grub_efi_system_table32_t *grub_efiemu_system_table32 = 0;
|
||||
|
@ -310,15 +311,15 @@ GRUB_MOD_INIT(efiemu)
|
|||
{
|
||||
cmd_loadcore = grub_register_command ("efiemu_loadcore",
|
||||
grub_cmd_efiemu_load,
|
||||
"FILE",
|
||||
"Load and initialize EFI emulator.");
|
||||
N_("FILE"),
|
||||
N_("Load and initialize EFI emulator."));
|
||||
cmd_prepare = grub_register_command ("efiemu_prepare",
|
||||
grub_cmd_efiemu_prepare,
|
||||
0,
|
||||
"Finalize loading of EFI emulator.");
|
||||
N_("Finalize loading of EFI emulator."));
|
||||
cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
|
||||
0,
|
||||
"Unload EFI emulator.");
|
||||
N_("Unload EFI emulator."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(efiemu)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static grub_err_t
|
||||
loadfont_command (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
@ -62,11 +63,11 @@ GRUB_MOD_INIT(font)
|
|||
|
||||
cmd_loadfont =
|
||||
grub_register_command ("loadfont", loadfont_command,
|
||||
"FILE...",
|
||||
"Specify one or more font files to load.");
|
||||
N_("FILE..."),
|
||||
N_("Specify one or more font files to load."));
|
||||
cmd_lsfonts =
|
||||
grub_register_command ("lsfonts", lsfonts_command,
|
||||
0, "List the loaded fonts.");
|
||||
0, N_("List the loaded fonts."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(font)
|
||||
|
|
|
@ -47,6 +47,8 @@ struct grub_menu_entry
|
|||
/* The sourcecode of the menu entry, used by the editor. */
|
||||
const char *sourcecode;
|
||||
|
||||
int hotkey;
|
||||
|
||||
/* The next element. */
|
||||
struct grub_menu_entry *next;
|
||||
};
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <grub/file.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* set ENVVAR=VALUE */
|
||||
static grub_err_t
|
||||
|
@ -178,11 +179,13 @@ void
|
|||
grub_register_core_commands (void)
|
||||
{
|
||||
grub_register_command ("set", grub_core_cmd_set,
|
||||
"[ENVVAR=VALUE]", "Set an environment variable.");
|
||||
N_("[ENVVAR=VALUE]"),
|
||||
N_("Set an environment variable."));
|
||||
grub_register_command ("unset", grub_core_cmd_unset,
|
||||
"ENVVAR", "Remove an environment variable.");
|
||||
N_("ENVVAR"),
|
||||
N_("Remove an environment variable."));
|
||||
grub_register_command ("ls", grub_core_cmd_ls,
|
||||
"[ARG]", "List devices or files.");
|
||||
N_("[ARG]"), N_("List devices or files."));
|
||||
grub_register_command ("insmod", grub_core_cmd_insmod,
|
||||
"MODULE", "Insert a module.");
|
||||
N_("MODULE"), N_("Insert a module."));
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ grub_load_config (void)
|
|||
auto int hook (struct grub_module_header *);
|
||||
int hook (struct grub_module_header *header)
|
||||
{
|
||||
/* Not an ELF module, skip. */
|
||||
/* Not an embedded config, skip. */
|
||||
if (header->type != OBJ_TYPE_CONFIG)
|
||||
return 0;
|
||||
|
||||
|
|
35
kern/mm.c
35
kern/mm.c
|
@ -113,14 +113,14 @@ grub_mm_init_region (void *addr, grub_size_t size)
|
|||
grub_printf ("Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size);
|
||||
#endif
|
||||
|
||||
/* If this region is too small, ignore it. */
|
||||
if (size < GRUB_MM_ALIGN * 2)
|
||||
return;
|
||||
|
||||
/* Allocate a region from the head. */
|
||||
r = (grub_mm_region_t) ALIGN_UP ((grub_addr_t) addr, GRUB_MM_ALIGN);
|
||||
size -= (char *) r - (char *) addr + sizeof (*r);
|
||||
|
||||
/* If this region is too small, ignore it. */
|
||||
if (size < GRUB_MM_ALIGN)
|
||||
return;
|
||||
|
||||
h = (grub_mm_header_t) (r + 1);
|
||||
h->next = h;
|
||||
h->magic = GRUB_MM_FREE_MAGIC;
|
||||
|
@ -185,9 +185,8 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
|
|||
+---------------+ v
|
||||
*/
|
||||
q->next = p->next;
|
||||
p->magic = GRUB_MM_ALLOC_MAGIC;
|
||||
}
|
||||
else if (extra == 0 || p->size == n + extra)
|
||||
else if (align == 1 || p->size == n + extra)
|
||||
{
|
||||
/* There might be alignment requirement, when taking it into
|
||||
account memory block fits in.
|
||||
|
@ -204,10 +203,25 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
|
|||
| alloc, size=n | |
|
||||
+---------------+ v
|
||||
*/
|
||||
|
||||
p->size -= n;
|
||||
p += p->size;
|
||||
p->size = n;
|
||||
p->magic = GRUB_MM_ALLOC_MAGIC;
|
||||
}
|
||||
else if (extra == 0)
|
||||
{
|
||||
grub_mm_header_t r;
|
||||
|
||||
r = p + extra + n;
|
||||
r->magic = GRUB_MM_FREE_MAGIC;
|
||||
r->size = p->size - extra - n;
|
||||
r->next = p->next;
|
||||
q->next = r;
|
||||
|
||||
if (q == p)
|
||||
{
|
||||
q = r;
|
||||
r->next = r;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -241,10 +255,11 @@ grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align)
|
|||
p->size = extra;
|
||||
q->next = r;
|
||||
p += extra;
|
||||
p->size = n;
|
||||
p->magic = GRUB_MM_ALLOC_MAGIC;
|
||||
}
|
||||
|
||||
p->magic = GRUB_MM_ALLOC_MAGIC;
|
||||
p->size = n;
|
||||
|
||||
/* Mark find as a start marker for next allocation to fasten it.
|
||||
This will have side effect of fragmenting memory as small
|
||||
pieces before this will be un-used. */
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#ifndef GRUB_MMAP_REGISTER_BY_FIRMWARE
|
||||
|
||||
|
@ -414,8 +415,8 @@ static grub_command_t cmd;
|
|||
GRUB_MOD_INIT(mmap)
|
||||
{
|
||||
cmd = grub_register_command ("badram", grub_cmd_badram,
|
||||
"ADDR1,MASK1[,ADDR2,MASK2[,...]]",
|
||||
"Declare memory regions as badram.");
|
||||
N_("ADDR1,MASK1[,ADDR2,MASK2[,...]]"),
|
||||
N_("Declare memory regions as badram."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(mmap)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
struct menu_pointer
|
||||
{
|
||||
|
@ -172,7 +173,7 @@ grub_context_init (void)
|
|||
grub_env_export ("prefix");
|
||||
|
||||
export_cmd = grub_register_command ("export", grub_cmd_export,
|
||||
"export ENVVAR", "Export a variable.");
|
||||
N_("ENVVAR"), N_("Export a variable."));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -155,6 +155,17 @@ free_menu_entry_classes (struct grub_menu_entry_class *head)
|
|||
}
|
||||
}
|
||||
|
||||
static struct
|
||||
{
|
||||
char *name;
|
||||
int key;
|
||||
} hotkey_aliases[] =
|
||||
{
|
||||
{"backspace", '\b'},
|
||||
{"tab", '\t'},
|
||||
{"delete", GRUB_TERM_DC}
|
||||
};
|
||||
|
||||
/* Add a menu entry to the current menu context (as given by the environment
|
||||
variable data slot `menu'). As the configuration file is read, the script
|
||||
parser calls this when a menu entry is to be created. */
|
||||
|
@ -171,6 +182,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
|
|||
struct grub_menu_entry_class *classes_head; /* Dummy head node for list. */
|
||||
struct grub_menu_entry_class *classes_tail;
|
||||
char *users = NULL;
|
||||
int hotkey = 0;
|
||||
|
||||
/* Allocate dummy head node for class list. */
|
||||
classes_head = grub_zalloc (sizeof (struct grub_menu_entry_class));
|
||||
|
@ -237,6 +249,32 @@ grub_normal_add_menu_entry (int argc, const char **args,
|
|||
|
||||
continue;
|
||||
}
|
||||
else if (grub_strcmp(arg, "hotkey") == 0)
|
||||
{
|
||||
unsigned j;
|
||||
|
||||
i++;
|
||||
if (args[i][1] == 0)
|
||||
{
|
||||
hotkey = args[i][0];
|
||||
continue;
|
||||
}
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE (hotkey_aliases); j++)
|
||||
if (grub_strcmp (args[i], hotkey_aliases[j].name) == 0)
|
||||
{
|
||||
hotkey = hotkey_aliases[j].key;
|
||||
break;
|
||||
}
|
||||
|
||||
if (j < ARRAY_SIZE (hotkey_aliases))
|
||||
continue;
|
||||
|
||||
failed = 1;
|
||||
grub_error (GRUB_ERR_MENU,
|
||||
"Invalid hotkey: '%s'.", args[i]);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handle invalid argument. */
|
||||
|
@ -293,6 +331,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
|
|||
}
|
||||
|
||||
(*last)->title = menutitle;
|
||||
(*last)->hotkey = hotkey;
|
||||
(*last)->classes = classes_head;
|
||||
if (users)
|
||||
(*last)->restricted = 1;
|
||||
|
@ -666,9 +705,9 @@ GRUB_MOD_INIT(normal)
|
|||
|
||||
/* Register a command "normal" for the rescue mode. */
|
||||
grub_register_command ("normal", grub_cmd_normal,
|
||||
0, "Enter normal mode.");
|
||||
0, N_("Enter normal mode."));
|
||||
grub_register_command ("normal_exit", grub_cmd_normal_exit,
|
||||
0, "Exit from normal mode.");
|
||||
0, N_("Exit from normal mode."));
|
||||
|
||||
/* Reload terminal colors when these variables are written to. */
|
||||
grub_register_variable_hook ("color_normal", NULL, grub_env_write_color_normal);
|
||||
|
|
|
@ -478,6 +478,18 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
|||
goto refresh;
|
||||
|
||||
default:
|
||||
{
|
||||
grub_menu_entry_t entry;
|
||||
int i;
|
||||
for (i = 0, entry = menu->entry_list; i < menu->size;
|
||||
i++, entry = entry->next)
|
||||
if (entry->hotkey == c)
|
||||
{
|
||||
menu_fini ();
|
||||
*auto_boot = 0;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/bitmap_scale.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#define DEFAULT_VIDEO_MODE "auto"
|
||||
#define DEFAULT_BORDER_WIDTH 10
|
||||
|
@ -1187,8 +1188,8 @@ GRUB_MOD_INIT(gfxterm)
|
|||
grub_register_extcmd ("background_image",
|
||||
grub_gfxterm_background_image_cmd,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"[-m (stretch|normal)] FILE",
|
||||
"Load background image for active terminal.",
|
||||
N_("[-m (stretch|normal)] FILE"),
|
||||
N_("Load background image for active terminal."),
|
||||
background_image_cmd_options);
|
||||
}
|
||||
|
||||
|
|
|
@ -616,8 +616,8 @@ GRUB_MOD_INIT(serial)
|
|||
{
|
||||
cmd = grub_register_extcmd ("serial", grub_cmd_serial,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"serial [OPTIONS...]",
|
||||
"Configure serial port.", options);
|
||||
N_("[OPTIONS...]"),
|
||||
N_("Configure serial port."), options);
|
||||
|
||||
/* Set default settings. */
|
||||
serial_settings.port = grub_serial_hw_get_port (0);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <grub/terminfo.h>
|
||||
#include <grub/tparm.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
struct terminfo
|
||||
{
|
||||
|
@ -178,7 +179,7 @@ static grub_command_t cmd;
|
|||
GRUB_MOD_INIT(terminfo)
|
||||
{
|
||||
cmd = grub_register_command ("terminfo", grub_cmd_terminfo,
|
||||
"[TERM]", "Set terminfo type.");
|
||||
N_("[TERM]"), N_("Set terminfo type."));
|
||||
grub_terminfo_set_current ("vt100");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Helper library for grub-mkconfig
|
||||
# Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007,2008,2009,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
|
||||
|
@ -44,21 +44,7 @@ grub_warn ()
|
|||
|
||||
make_system_path_relative_to_its_root ()
|
||||
{
|
||||
path="`${grub_mkrelpath} $1`"
|
||||
|
||||
case "`uname 2>/dev/null`" in
|
||||
CYGWIN*)
|
||||
# Cygwin: Check if regular or emulated mount.
|
||||
if [ -z "$dir" ] || [ "`stat -c %D "$dir/.."`" != 620000 ] ; then
|
||||
# Reached some mount point not below /cygdrive.
|
||||
# GRUB does not know Cygwin's emulated mounts,
|
||||
# convert to Win32 path and remove drive letter.
|
||||
path=`cygpath -m "$path" | sed -n 's,^[A-Za-z]:,,p'`
|
||||
test ! -z "$path" || return 1
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
echo "$path"
|
||||
${grub_mkrelpath} $1
|
||||
}
|
||||
|
||||
is_path_readable_by_grub ()
|
||||
|
|
61
util/misc.c
61
util/misc.c
|
@ -53,6 +53,11 @@
|
|||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <sys/cygwin.h>
|
||||
# define DEV_CYGDRIVE_MAJOR 98
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
|
@ -456,6 +461,27 @@ canonicalize_file_name (const char *path)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#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];
|
||||
if (cygwin_conv_path (CCP_POSIX_TO_WIN_A, path, winpath, sizeof(winpath)))
|
||||
grub_util_error ("cygwin_conv_path() failed");
|
||||
|
||||
int len = strlen (winpath);
|
||||
int offs = (len > 2 && winpath[1] == ':' ? 2 : 0);
|
||||
|
||||
int i;
|
||||
for (i = offs; i < len; i++)
|
||||
if (winpath[i] == '\\')
|
||||
winpath[i] = '/';
|
||||
return xstrdup (winpath + offs);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This function never prints trailing slashes (so that its output
|
||||
can be appended a slash unconditionally). */
|
||||
char *
|
||||
|
@ -521,30 +547,31 @@ make_system_path_relative_to_its_root (const char *path)
|
|||
/* offset == 1 means root directory. */
|
||||
if (offset == 1)
|
||||
{
|
||||
free (buf);
|
||||
len = strlen (buf2);
|
||||
while (buf2[len - 1] == '/' && len > 1)
|
||||
{
|
||||
buf2[len - 1] = '\0';
|
||||
len--;
|
||||
}
|
||||
if (len > 1)
|
||||
return buf2;
|
||||
else
|
||||
{
|
||||
/* This means path given is just a backslash. As above
|
||||
we have to return an empty string. */
|
||||
free (buf2);
|
||||
return xstrdup ("");
|
||||
}
|
||||
/* Include leading slash. */
|
||||
offset = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
free (buf);
|
||||
buf3 = xstrdup (buf2 + offset);
|
||||
free (buf2);
|
||||
|
||||
#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 path = %s\n", buf3);
|
||||
char * temp = get_win32_path (buf3);
|
||||
free (buf3);
|
||||
buf3 = temp;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Remove trailing slashes, return empty string if root directory. */
|
||||
len = strlen (buf3);
|
||||
while (buf3[len - 1] == '/' && len > 1)
|
||||
while (len > 0 && buf3[len - 1] == '/')
|
||||
{
|
||||
buf3[len - 1] = '\0';
|
||||
len--;
|
||||
|
|
Loading…
Reference in a new issue