merge mainline into mips

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-28 01:05:47 +01:00
commit 742e1f7e72
75 changed files with 534 additions and 768 deletions

170
ChangeLog
View File

@ -1,3 +1,173 @@
2009-12-27 Vladimir Serbinenko <phcoder@gmail.com>
* kern/parser.c (grub_parser_split_cmdline): Don't dereference NULL.
2009-12-27 Vladimir Serbinenko <phcoder@gmail.com>
* normal/menu_text.c (grub_print_message_indented): Prevent
past-the-end-of-array dereference.
2009-12-27 Vladimir Serbinenko <phcoder@gmail.com>
* video/readers/jpeg.c (GRUB_MOD_FINI (grub_cmd_jpegtest)): Rename to ..
(GRUB_MOD_FINI (video_reader_jpeg)): ...this
2009-12-27 Carles Pina i Estany <carles@pina.cat>
* normal/cmdline.c (grub_cmdline_get): Print a space after prompt.
* normal/main.c (grub_normal_read_line): Remove a space from the
default prompt.
2009-12-27 Carles Pina i Estany <carles@pina.cat>
* loader/i386/efi/linux.c (GRUB_MOD_INIT): Improve command summary.
* loader/i386/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/i386/linux.c (GRUB_MOD_INIT): Likewise.
* loader/i386/pc/linux.c (GRUB_MOD_INIT): Likewise.
* loader/powerpc/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/xnu.c (GRUB_MOD_INIT): Likewise.
2009-12-26 Carles Pina i Estany <carles@pina.cat>
* video/readers/jpeg.c (cmd): Declare.
(grub_cmd_jpegtest): Use `grub_command_t' type.
(GRUB_MOD_INIT): Fix arguments passed to `grub_register_command'.
Assign to `cmd'.
(GRUB_MOD_FINI): Use `cmd' to unregister.
* video/readers/png.c (cmd): Declare.
(grub_cmd_pngtest): Use `grub_command_t' type.
(GRUB_MOD_INIT): Fix arguments passed to `grub_register_command'.
Assign to `cmd'.
(GRUB_MOD_FINI): Use `cmd' to unregister.
* video/readers/tga.c (cmd): Declare.
(grub_cmd_tgatest): Use `grub_command_t' type.
(GRUB_MOD_INIT): Fix arguments passed to `grub_register_command'.
Assign to `cmd'.
(GRUB_MOD_FINI): Use `cmd' to unregister.
2009-12-26 Carles Pina i Estany <carles@pina.cat>
* efiemu/main.c (GRUB_MOD_INIT): Fix capitalizations and/or full
stops.
* kern/corecmd.c (grub_register_core_commands): Likewise.
* loader/efi/chainloader.c (GRUB_MOD_INIT): Likewise.
* loader/i386/bsd.c (GRUB_MOD_INIT): Likewise.
* loader/i386/efi/linux.c (GRUB_MOD_INIT): Likewise.
* loader/i386/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/i386/linux.c (GRUB_MOD_INIT): Likewise.
* loader/i386/pc/chainloader.c (GRUB_MOD_INIT): Likewise.
* loader/i386/pc/linux.c (GRUB_MOD_INIT): Likewise.
* loader/multiboot_loader.c (GRUB_MOD_INIT): Likewise.
* loader/powerpc/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
* loader/xnu.c (GRUB_MOD_INIT): Likewise.
* mmap/mmap.c (GRUB_MOD_INIT): Likewise.
* normal/handler.c (insert_handler): Likewise.
* normal/main.c (GRUB_MOD_INIT): Likewise.
* term/gfxterm.c (GRUB_MOD_INIT): Likewise.
2009-12-26 Carles Pina i Estany <carles@pina.cat>
* commands/help.c (grub_cmd_help): Print the command name before the
summary.
(GRUB_MOD_INIT): Remove command name from the summary.
* kern/command.c (GRUB_MOD_INIT): If summary is null assign an empty
string as summary.
* lib/arg.c (find_long): Print the command name before the summary.
* commands/acpi.c (GRUB_MOD_INIT): Remove command name from the
summary.
* commands/blocklist.c (GRUB_MOD_INIT): Likewise.
* commands/cat.c (GRUB_MOD_INIT): Likewise.
* commands/cmp.c (GRUB_MOD_INIT): Likewise.
* commands/configfile.c (GRUB_MOD_INIT): Likewise.
* commands/crc.c (GRUB_MOD_INIT): Likewise.
* commands/date.c (GRUB_MOD_INIT): Likewise.
* commands/echo.c (GRUB_MOD_INIT): Likewise.
* commands/efi/loadbios.c (GRUB_MOD_INIT): Likewise.
* commands/gptsync.c (GRUB_MOD_INIT): Likewise.
* commands/handler.c (GRUB_MOD_INIT): Likewise.
* commands/hdparm.c (GRUB_MOD_INIT): Likewise.
* commands/hexdump.c (GRUB_MOD_INIT): Likewise.
* commands/i386/cpuid.c (GRUB_MOD_INIT): Likewise.
* commands/i386/pc/halt.c (GRUB_MOD_INIT): Likewise.
* commands/i386/pc/play.c (GRUB_MOD_INIT): Likewise.
* commands/i386/pc/pxecmd.c (GRUB_MOD_INIT): Likewise.
* commands/keystatus.c (GRUB_MOD_INIT): Likewise.
* commands/loadenv.c (GRUB_MOD_INIT): Likewise.
* commands/ls.c (GRUB_MOD_INIT): Likewise.
* commands/lspci.c (GRUB_MOD_INIT): Likewise.
* commands/memrw.c (GRUB_MOD_INIT): Likewise.
* commands/minicmd.c (GRUB_MOD_INIT): Likewise.
* commands/parttool.c (GRUB_MOD_INIT): Likewise.
* commands/password.c (GRUB_MOD_INIT): Likewise.
* commands/probe.c (GRUB_MOD_INIT): Likewise.
* commands/read.c (GRUB_MOD_INIT): Likewise.
* commands/search.c (GRUB_MOD_INIT): Likewise.
* commands/sleep.c (GRUB_MOD_INIT): Likewise.
* commands/test.c (GRUB_MOD_INIT): Likewise.
* commands/xnu_uuid.c (GRUB_MOD_INIT): Likewise.
* efiemu/main.c (GRUB_MOD_INIT): Likewise.
* font/font_cmd.c (GRUB_MOD_INIT): Likewise.
* gettext/gettext.c (GRUB_MOD_INIT): Likewise.
* kern/corecmd.c (GRUB_MOD_INIT): Likewise.
* lib/arg.c (GRUB_MOD_INIT): Likewise.
* loader/efi/appleloader.c (GRUB_MOD_INIT): Likewise.
* loader/i386/bsd.c (GRUB_MOD_INIT): Likewise.
* loader/xnu.c (GRUB_MOD_INIT): Likewise.
* mmap/mmap.c (GRUB_MOD_INIT): Likewise.
* term/terminfo.c (GRUB_MOD_INIT): Likewise.
* video/readers/jpeg.c (GRUB_MOD_INIT): Likewise.
* video/readers/png.c (GRUB_MOD_INIT): Likewise.
* video/readers/tga.c (GRUB_MOD_INIT): Likewise.
2009-12-25 Vladimir Serbinenko <phcoder@gmail.com>
Use search command for preliminar UUID search.
* commands/search.c: Split into ...
* commands/search_wrap.c: ...this
* commands/search.c: ...and this.
* commands/search_file.c: New file.
* commands/search_label.c: New file.
* commands/search_uuid.c: New file.
* conf/any-emu.rmk (grub_emu_SOURCES): Remove commands/search.c.
Add commands/search_wrap.c, commands/search_file.c,
commands/search_label.c and commands/search_uuid.c.
* conf/common.rmk (pkglib_MODULES): Remove fs_uuid.mod and fs_file.mod.
(search_mod_SOURCES): Set to commands/search_wrap.c.
(pkglib_MODULES): Add search_fs_file.mod, search_fs_uuid.mod and
search_label.mod.
(search_fs_file_mod_SOURCES): New variable.
(search_fs_file_mod_CFLAGS): Likewise.
(search_fs_file_mod_LDFLAGS): Likewise.
(search_label_mod_SOURCES): Likewise.
(search_label_mod_CFLAGS): Likewise.
(search_label_mod_LDFLAGS): Likewise.
(search_fs_uuid_mod_SOURCES): New variable.
(search_fs_uuid_mod_CFLAGS): Likewise.
(search_fs_uuid_mod_LDFLAGS): Likewise.
(fs_file_mod_SOURCES): Removed.
(fs_file_mod_CFLAGS): Likewise.
(fs_file_mod_LDFLAGS): Likewise.
(fs_uuid_mod_SOURCES): Removed.
(fs_uuid_mod_CFLAGS): Likewise.
(fs_uuid_mod_LDFLAGS): Likewise.
* conf/sparc64-ieee1275.rmk (grub_install_SOURCES):
Set to util/grub-install.in.
* disk/fs_file.c: Removed.
* disk/fs_uuid.c: Likewise.
* include/grub/search.h: New file.
* util/grub-install.in: Handle sparc64.
Create and use load.cfg.
* util/sparc64/ieee1275/grub-install.in: Removed.
2009-12-25 Vladimir Serbinenko <phcoder@gmail.com>
* kern/i386/pc/startup.S (grub_biosdisk_get_diskinfo_int13_extensions):
Ignore return status if CF is cleared.
(grub_biosdisk_get_diskinfo_standard): Likewise.
2009-12-25 Robert Millan <rmh.grub@aybabtu.com>
* term/i386/pc/at_keyboard.c

View File

@ -759,7 +759,7 @@ GRUB_MOD_INIT(acpi)
{
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi,
GRUB_COMMAND_FLAG_BOTH,
"acpi [-1|-2] [--exclude=table1,table2|"
"[-1|-2] [--exclude=table1,table2|"
"--load-only=table1,table2] filename1 "
" [filename2] [...]",
"Load host acpi tables and tables "

View File

@ -110,7 +110,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(blocklist)
{
cmd = grub_register_command ("blocklist", grub_cmd_blocklist,
"blocklist FILE", "Print a block list.");
"FILE", "Print a block list.");
}
GRUB_MOD_FINI(blocklist)

View File

@ -78,7 +78,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(cat)
{
cmd = grub_register_command_p1 ("cat", grub_cmd_cat,
"cat FILE", "Show the contents of a file.");
"FILE", "Show the contents of a file.");
}
GRUB_MOD_FINI(cat)

View File

@ -109,7 +109,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(cmp)
{
cmd = grub_register_command ("cmp", grub_cmd_cmp,
"cmp FILE1 FILE2", "Compare two files.");
"FILE1 FILE2", "Compare two files.");
}
GRUB_MOD_FINI(cmp)

View File

@ -53,15 +53,15 @@ GRUB_MOD_INIT(configfile)
{
cmd_configfile =
grub_register_command ("configfile", grub_cmd_source,
"configfile FILE", "Load another config file.");
"FILE", "Load another config file.");
cmd_source =
grub_register_command ("source", grub_cmd_source,
"source FILE",
"FILE",
"Load another config file without changing context."
);
cmd_dot =
grub_register_command (".", grub_cmd_source,
". FILE",
"FILE",
"Load another config file without changing context."
);
}

View File

@ -57,7 +57,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(crc)
{
cmd = grub_register_command ("crc", grub_cmd_crc,
"crc FILE",
"FILE",
"Calculate the crc32 checksum of a file.");
}

View File

@ -135,7 +135,7 @@ GRUB_MOD_INIT(date)
{
cmd =
grub_register_command ("date", grub_cmd_date,
"date [[year-]month-day] [hour:minute[:second]]",
"[[year-]month-day] [hour:minute[:second]]",
"Command to display/set current datetime.");
}

View File

@ -113,7 +113,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(echo)
{
cmd = grub_register_extcmd ("echo", grub_cmd_echo, GRUB_COMMAND_FLAG_BOTH,
"echo [-e|-n] STRING", "Display a line of text.",
"[-e|-n] STRING", "Display a line of text.",
options);
}

View File

@ -204,7 +204,7 @@ GRUB_MOD_INIT(loadbios)
0, "Fake bios.");
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
"loadbios BIOS_DUMP [INT10_DUMP]",
"BIOS_DUMP [INT10_DUMP]",
"Load bios dump.");
}

View File

@ -240,7 +240,7 @@ GRUB_MOD_INIT(gptsync)
{
(void) mod; /* To stop warning. */
cmd = grub_register_command ("gptsync", grub_cmd_gptsync,
"gptsync DEVICE [PARTITION[+/-[TYPE]]] ...",
"DEVICE [PARTITION[+/-[TYPE]]] ...",
"Fill hybrid MBR of GPT drive DEVICE. "
"specified partitions will be a part "
"of hybrid mbr. Up to 3 partitions are "

View File

@ -95,15 +95,15 @@ GRUB_MOD_INIT(handler)
{
cmd_handler =
grub_register_command ("handler", grub_cmd_handler,
"handler [class [handler]]",
"[class [handler]]",
"List or select a handler.");
cmd_terminal_input =
grub_register_command ("terminal_input", grub_cmd_handler,
"terminal_input [handler]",
"[handler]",
"List or select an input terminal.");
cmd_terminal_output =
grub_register_command ("terminal_output", grub_cmd_handler,
"terminal_output [handler]",
"[handler]",
"List or select an output terminal.");
}

View File

@ -410,7 +410,7 @@ GRUB_MOD_INIT(hdparm)
{
cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm,
GRUB_COMMAND_FLAG_BOTH,
"hdparm [OPTIONS] DISK",
"[OPTIONS] DISK",
"Get/set ATA disk parameters.", options);
}

View File

@ -67,7 +67,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\n%s\b", _("Usage:"), _(cmd->summary),
grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
_(cmd->description));
}
}
@ -96,7 +96,7 @@ GRUB_MOD_INIT(help)
{
cmd = grub_register_extcmd ("help", grub_cmd_help,
GRUB_COMMAND_FLAG_CMDLINE,
N_("help [PATTERN ...]"),
N_("[PATTERN ...]"),
N_("Show a help message."), 0);
}

View File

@ -121,7 +121,7 @@ GRUB_MOD_INIT (hexdump)
{
cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump,
GRUB_COMMAND_FLAG_BOTH,
"hexdump [OPTIONS] FILE_OR_DEVICE",
"[OPTIONS] FILE_OR_DEVICE",
"Dump the contents of a file or memory.",
options);
}

View File

@ -88,7 +88,7 @@ done:
#endif
cmd = grub_register_extcmd ("cpuid", grub_cmd_cpuid, GRUB_COMMAND_FLAG_BOTH,
"cpuid [-l]", "Check for CPU features.", options);
"[-l]", "Check for CPU features.", options);
}
GRUB_MOD_FINI(cpuid)

View File

@ -46,7 +46,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(halt)
{
cmd = grub_register_extcmd ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
"halt [-n]",
"[-n]",
"Halt the system, if possible using APM.",
options);
}

View File

@ -208,7 +208,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(play)
{
cmd = grub_register_command ("play", grub_cmd_play,
N_("play FILE"), N_("Play a tune."));
N_("FILE"), N_("Play a tune."));
}
GRUB_MOD_FINI(play)

View File

@ -41,7 +41,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(pxecmd)
{
cmd = grub_register_command ("pxe_unload", grub_cmd_pxe_unload,
"pxe_unload",
0,
"Unload PXE environment.");
}

View File

@ -70,7 +70,7 @@ GRUB_MOD_INIT(keystatus)
{
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus,
GRUB_COMMAND_FLAG_BOTH,
"keystatus [--shift] [--ctrl] [--alt]",
"[--shift] [--ctrl] [--alt]",
"Check key modifier status.",
options);
}

View File

@ -396,7 +396,7 @@ GRUB_MOD_INIT(loadenv)
cmd_save =
grub_register_extcmd ("save_env", grub_cmd_save_env,
GRUB_COMMAND_FLAG_BOTH,
"save_env [-f FILE] variable_name [...]",
"[-f FILE] variable_name [...]",
"Save variables to environment block file.",
options);
}

View File

@ -260,7 +260,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(ls)
{
cmd = grub_register_extcmd ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
"ls [-l|-h|-a] [FILE]",
"[-l|-h|-a] [FILE]",
"List devices and files.", options);
}

View File

@ -218,7 +218,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(lspci)
{
cmd = grub_register_extcmd ("lspci", grub_cmd_lspci, GRUB_COMMAND_FLAG_BOTH,
"lspci [-i]", "List PCI devices.", options);
"[-i]", "List PCI devices.", options);
}
GRUB_MOD_FINI(lspci)

View File

@ -119,22 +119,22 @@ GRUB_MOD_INIT(memrw)
{
cmd_read_byte =
grub_register_extcmd ("read_byte", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_byte ADDR", "Read byte from ADDR.", options);
"ADDR", "Read byte from ADDR.", options);
cmd_read_word =
grub_register_extcmd ("read_word", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_word ADDR", "Read word from ADDR.", options);
"ADDR", "Read word from ADDR.", options);
cmd_read_dword =
grub_register_extcmd ("read_dword", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_dword ADDR", "Read dword from ADDR.", options);
"ADDR", "Read dword from ADDR.", options);
cmd_write_byte =
grub_register_command ("write_byte", grub_cmd_write,
"write_byte ADDR VALUE [MASK]", "Write byte VALUE to ADDR.");
"ADDR VALUE [MASK]", "Write byte VALUE to ADDR.");
cmd_write_word =
grub_register_command ("write_word", grub_cmd_write,
"write_word ADDR VALUE [MASK]", "Write word VALUE to ADDR.");
"ADDR VALUE [MASK]", "Write word VALUE to ADDR.");
cmd_write_dword =
grub_register_command ("write_dword", grub_cmd_write,
"write_dword ADDR VALUE [MASK]", "Write dword VALUE to ADDR.");
"ADDR VALUE [MASK]", "Write dword VALUE to ADDR.");
}
GRUB_MOD_FINI(memrw)

View File

@ -354,19 +354,19 @@ GRUB_MOD_INIT(minicmd)
{
cmd_cat =
grub_register_command ("cat", grub_mini_cmd_cat,
"cat FILE", "Show the contents of a file.");
"FILE", "Show the contents of a file.");
cmd_help =
grub_register_command ("help", grub_mini_cmd_help,
0, "Show this message.");
cmd_root =
grub_register_command ("root", grub_mini_cmd_root,
"root [DEVICE]", "Set the root device.");
"[DEVICE]", "Set the root device.");
cmd_dump =
grub_register_command ("dump", grub_mini_cmd_dump,
"dump ADDR", "Dump memory.");
"ADDR", "Dump memory.");
cmd_rmmod =
grub_register_command ("rmmod", grub_mini_cmd_rmmod,
"rmmod MODULE", "Remove a module.");
"MODULE", "Remove a module.");
cmd_lsmod =
grub_register_command ("lsmod", grub_mini_cmd_lsmod,
0, "Show loaded modules.");

View File

@ -322,7 +322,7 @@ GRUB_MOD_INIT(parttool)
{
mymod = mod;
cmd = grub_register_command ("parttool", grub_cmd_parttool,
"parttool PARTITION COMMANDS",
"PARTITION COMMANDS",
helpmsg);
}

View File

@ -75,7 +75,7 @@ GRUB_MOD_INIT(password)
{
my_mod = mod;
cmd = grub_register_command ("password", grub_cmd_password,
"password USER PASSWORD",
"USER PASSWORD",
"Set user password (plaintext). "
"Unrecommended and insecure.");
}

View File

@ -150,7 +150,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT (probe)
{
cmd = grub_register_extcmd ("probe", grub_cmd_probe, GRUB_COMMAND_FLAG_BOTH,
"probe [DEVICE]",
"[DEVICE]",
"Retrieve device info.", options);
}

View File

@ -79,7 +79,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(read)
{
cmd = grub_register_command ("read", grub_cmd_read,
"read [ENVVAR]",
"[ENVVAR]",
"Set variable with user input.");
}

View File

@ -25,30 +25,12 @@
#include <grub/device.h>
#include <grub/file.h>
#include <grub/env.h>
#include <grub/extcmd.h>
#include <grub/command.h>
#include <grub/search.h>
#include <grub/i18n.h>
static const struct grub_arg_option options[] =
{
{"file", 'f', 0, N_("Search devices by a file."), 0, 0},
{"label", 'l', 0, N_("Search devices by a filesystem label."), 0, 0},
{"fs-uuid", 'u', 0, N_("Search devices by a filesystem UUID."), 0, 0},
{"set", 's', GRUB_ARG_OPTION_OPTIONAL, N_("Set a variable to the first device found."), "VAR", ARG_TYPE_STRING},
{"no-floppy", 'n', 0, N_("Do not probe any floppy drive."), 0, 0},
{0, 0, 0, 0, 0, 0}
};
enum options
{
SEARCH_FILE,
SEARCH_LABEL,
SEARCH_FS_UUID,
SEARCH_SET,
SEARCH_NO_FLOPPY,
};
static void
search_fs (const char *key, const char *var, int no_floppy, enum options type)
void
FUNC_NAME (const char *key, const char *var, int no_floppy)
{
int count = 0;
char *buf = NULL;
@ -64,7 +46,7 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9')
return 0;
if (type == SEARCH_FILE)
#ifdef DO_SEARCH_FILE
{
grub_size_t len;
char *p;
@ -85,27 +67,29 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
grub_file_close (file);
}
}
else
#else
{
/* type is SEARCH_FS_UUID or SEARCH_LABEL */
/* SEARCH_FS_UUID or SEARCH_LABEL */
grub_device_t dev;
grub_fs_t fs;
int (*compare_fn) (const char *, const char *);
char *quid;
dev = grub_device_open (name);
if (dev)
{
fs = grub_fs_probe (dev);
compare_fn =
(type == SEARCH_FS_UUID) ? grub_strcasecmp : grub_strcmp;
if (fs && ((type == SEARCH_FS_UUID) ? fs->uuid : fs->label))
#ifdef DO_SEARCH_FS_UUID
#define compare_fn grub_strcasecmp
#define read_fn uuid
#else
#define compare_fn grub_strcmp
#define read_fn label
#endif
if (fs && fs->read_fn)
{
if (type == SEARCH_FS_UUID)
fs->uuid (dev, &quid);
else
fs->label (dev, &quid);
fs->read_fn (dev, &quid);
if (grub_errno == GRUB_ERR_NONE && quid)
{
@ -119,6 +103,7 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
grub_device_close (dev);
}
}
#endif
if (found)
{
@ -157,45 +142,42 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
}
static grub_err_t
grub_cmd_search (grub_extcmd_t cmd, int argc, char **args)
grub_cmd_do_search (grub_command_t cmd __attribute__ ((unused)), int argc,
char **args)
{
struct grub_arg_list *state = cmd->state;
const char *var = 0;
if (argc == 0)
return grub_error (GRUB_ERR_INVALID_COMMAND, "no argument specified");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
if (state[SEARCH_SET].set)
var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
if (state[SEARCH_LABEL].set)
search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_LABEL);
else if (state[SEARCH_FS_UUID].set)
search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_FS_UUID);
else if (state[SEARCH_FILE].set)
search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_FILE);
else
return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
FUNC_NAME (args[0], argc == 1 ? 0 : args[1], 0);
return grub_errno;
}
static grub_extcmd_t cmd;
static grub_command_t cmd;
GRUB_MOD_INIT(search)
#ifdef DO_SEARCH_FILE
GRUB_MOD_INIT(search_file)
#elif defined (DO_SEARCH_FS_UUID)
GRUB_MOD_INIT(search_fs_uuid)
#else
GRUB_MOD_INIT(search_fs_label)
#endif
{
cmd =
grub_register_extcmd ("search", grub_cmd_search,
GRUB_COMMAND_FLAG_BOTH,
N_("search [-f|-l|-u|-s|-n] NAME"),
N_("Search devices by file, filesystem label or filesystem UUID."
" If --set is specified, the first device found is"
" set to a variable. If no variable name is"
" specified, \"root\" is used."),
options);
grub_register_command (COMMAND_NAME, grub_cmd_do_search,
"NAME [VARIABLE]",
"Search devices by " SEARCH_TARGET "."
" If VARIABLE is specified, "
"the first device found is set to a variable.");
}
GRUB_MOD_FINI(search)
#ifdef DO_SEARCH_FILE
GRUB_MOD_FINI(search_file)
#elif defined (DO_SEARCH_FS_UUID)
GRUB_MOD_FINI(search_fs_uuid)
#else
GRUB_MOD_FINI(search_fs_label)
#endif
{
grub_unregister_extcmd (cmd);
grub_unregister_command (cmd);
}

5
commands/search_file.c Normal file
View File

@ -0,0 +1,5 @@
#define DO_SEARCH_FILE 1
#define FUNC_NAME grub_search_fs_file
#define COMMAND_NAME "search.file"
#define SEARCH_TARGET "file"
#include "search.c"

5
commands/search_label.c Normal file
View File

@ -0,0 +1,5 @@
#define DO_SEARCH_FS_LABEL 1
#define FUNC_NAME grub_search_label
#define COMMAND_NAME "search.fs_label"
#define SEARCH_TARGET "filesystem label"
#include "search.c"

5
commands/search_uuid.c Normal file
View File

@ -0,0 +1,5 @@
#define DO_SEARCH_FS_UUID 1
#define FUNC_NAME grub_search_fs_uuid
#define COMMAND_NAME "search.fs_uuid"
#define SEARCH_TARGET "filesystem UUID"
#include "search.c"

95
commands/search_wrap.c Normal file
View File

@ -0,0 +1,95 @@
/* search.c - search devices based on a file or a filesystem label */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2007,2008,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/types.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/err.h>
#include <grub/dl.h>
#include <grub/env.h>
#include <grub/extcmd.h>
#include <grub/search.h>
#include <grub/i18n.h>
static const struct grub_arg_option options[] =
{
{"file", 'f', 0, N_("Search devices by a file."), 0, 0},
{"label", 'l', 0, N_("Search devices by a filesystem label."),
0, 0},
{"fs-uuid", 'u', 0, N_("Search devices by a filesystem UUID."),
0, 0},
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
N_("Set a variable to the first device found."), "VAR", ARG_TYPE_STRING},
{"no-floppy", 'n', 0, N_("Do not probe any floppy drive."), 0, 0},
{0, 0, 0, 0, 0, 0}
};
enum options
{
SEARCH_FILE,
SEARCH_LABEL,
SEARCH_FS_UUID,
SEARCH_SET,
SEARCH_NO_FLOPPY,
};
static grub_err_t
grub_cmd_search (grub_extcmd_t cmd, int argc, char **args)
{
struct grub_arg_list *state = cmd->state;
const char *var = 0;
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
if (state[SEARCH_SET].set)
var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
if (state[SEARCH_LABEL].set)
grub_search_label (args[0], var, state[SEARCH_NO_FLOPPY].set);
else if (state[SEARCH_FS_UUID].set)
grub_search_fs_uuid (args[0], var, state[SEARCH_NO_FLOPPY].set);
else if (state[SEARCH_FILE].set)
grub_search_fs_file (args[0], var, state[SEARCH_NO_FLOPPY].set);
else
return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
return grub_errno;
}
static grub_extcmd_t cmd;
GRUB_MOD_INIT(search)
{
cmd =
grub_register_extcmd ("search", grub_cmd_search,
GRUB_COMMAND_FLAG_BOTH,
N_("search [-f|-l|-u|-s|-n] NAME"),
N_("Search devices by file, filesystem label"
" or filesystem UUID."
" If --set is specified, the first device found is"
" set to a variable. If no variable name is"
" specified, \"root\" is used."),
options);
}
GRUB_MOD_FINI(search)
{
grub_unregister_extcmd (cmd);
}

View File

@ -105,7 +105,7 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(sleep)
{
cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
"sleep NUMBER_OF_SECONDS",
"NUMBER_OF_SECONDS",
"Wait for a specified number of seconds.",
options);
}

View File

@ -420,9 +420,9 @@ static grub_command_t cmd_1, cmd_2;
GRUB_MOD_INIT(test)
{
cmd_1 = grub_register_command ("[", grub_cmd_test,
"[ EXPRESSION ]", "Evaluate an expression.");
"EXPRESSION ]", "Evaluate an expression.");
cmd_2 = grub_register_command ("test", grub_cmd_test,
"test EXPRESSION", "Evaluate an expression.");
"EXPRESSION", "Evaluate an expression.");
}
GRUB_MOD_FINI(test)

View File

@ -377,7 +377,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT (xnu_uuid)
{
cmd = grub_register_command ("xnu_uuid", grub_cmd_xnu_uuid,
"xnu_uuid GRUBUUID [VARNAME]",
"GRUBUUID [VARNAME]",
"Transform 64-bit UUID to format "
"suitable for xnu.");
}

View File

@ -8,7 +8,9 @@ util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/echo.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search.c commands/blocklist.c commands/hexdump.c \
commands/search_wrap.c commands/search_file.c \
commands/search_label.c commands/search_uuid.c \
commands/blocklist.c commands/hexdump.c \
lib/hexdump.c commands/halt.c commands/reboot.c \
lib/envblk.c commands/loadenv.c \
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \

View File

@ -381,7 +381,7 @@ scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Commands.
pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \
ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod \
fs_file.mod fs_uuid.mod configfile.mod echo.mod \
configfile.mod echo.mod \
terminfo.mod test.mod blocklist.mod hexdump.mod \
read.mod sleep.mod loadenv.mod crc.mod parttool.mod \
msdospart.mod memrw.mod normal.mod sh.mod \
@ -454,10 +454,27 @@ help_mod_CFLAGS = $(COMMON_CFLAGS)
help_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For search.mod.
search_mod_SOURCES = commands/search.c
search_mod_SOURCES = commands/search_wrap.c
search_mod_CFLAGS = $(COMMON_CFLAGS)
search_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += search_fs_file.mod search_fs_uuid.mod search_label.mod
# For search.mod.
search_fs_file_mod_SOURCES = commands/search_file.c
search_fs_file_mod_CFLAGS = $(COMMON_CFLAGS)
search_fs_file_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For search.mod.
search_label_mod_SOURCES = commands/search_label.c
search_label_mod_CFLAGS = $(COMMON_CFLAGS)
search_label_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For search.mod.
search_fs_uuid_mod_SOURCES = commands/search_uuid.c
search_fs_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
search_fs_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For test.mod.
test_mod_SOURCES = commands/test.c
test_mod_CFLAGS = $(COMMON_CFLAGS)
@ -468,16 +485,6 @@ loopback_mod_SOURCES = disk/loopback.c
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
loopback_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For fs_file.mod
fs_file_mod_SOURCES = disk/fs_file.c
fs_file_mod_CFLAGS = $(COMMON_CFLAGS)
fs_file_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For fs_uuid.mod
fs_uuid_mod_SOURCES = disk/fs_uuid.c
fs_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
fs_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For configfile.mod
configfile_mod_SOURCES = commands/configfile.c
configfile_mod_CFLAGS = $(COMMON_CFLAGS)

View File

@ -93,7 +93,7 @@ grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
sbin_SCRIPTS = grub-install
# For grub-install.
grub_install_SOURCES = util/sparc64/ieee1275/grub-install.in
grub_install_SOURCES = util/grub-install.in
# Modules.
pkglib_MODULES = halt.mod \

View File

@ -1,136 +0,0 @@
/* fs_file.c - Access partition by a file it contains. */
/*
* 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/disk.h>
#include <grub/dl.h>
#include <grub/file.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/partition.h>
static grub_device_t
search_fs_file (const char *key, unsigned long *count)
{
char *filename = NULL;
grub_device_t ret = NULL;
*count = 0;
auto int iterate_device (const char *name);
int iterate_device (const char *name)
{
int len;
grub_file_t file;
(*count)++;
len = grub_strlen (name) + 2 + grub_strlen (key) + 1;
filename = grub_realloc (filename, len);
if (! filename)
return 1;
grub_sprintf (filename, "(%s)%s", name, key);
file = grub_file_open (filename);
if (file)
{
grub_file_close (file);
ret = grub_device_open (name);
return 1;
}
grub_errno = GRUB_ERR_NONE;
return 0;
}
grub_device_iterate (iterate_device);
grub_free (filename);
return ret;
}
static grub_err_t
grub_fs_file_open (const char *name, grub_disk_t disk)
{
grub_device_t dev;
if (grub_strncmp (name, "FILE=", sizeof ("FILE=") - 1))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a FILE virtual volume");
dev = search_fs_file (name + sizeof ("FILE=") - 1, &disk->id);
if (! dev)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching file found");
disk->total_sectors = dev->disk->total_sectors;
disk->has_partitions = 0;
if (dev->disk->partition)
{
disk->partition = grub_malloc (sizeof (*disk->partition));
if (disk->partition)
grub_memcpy (disk->partition, dev->disk->partition,
sizeof (*disk->partition));
}
else
disk->partition = NULL;
disk->data = dev;
return GRUB_ERR_NONE;
}
static void
grub_fs_file_close (grub_disk_t disk)
{
grub_device_t parent = disk->data;
grub_device_close (parent);
}
static grub_err_t
grub_fs_file_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
grub_device_t parent = disk->data;
return parent->disk->dev->read (parent->disk, sector, size, buf);
}
static grub_err_t
grub_fs_file_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, const char *buf)
{
grub_device_t parent = disk->data;
return parent->disk->dev->write (parent->disk, sector, size, buf);
}
static struct grub_disk_dev grub_fs_file_dev = {
.name = "fs_file",
.id = GRUB_DISK_DEVICE_FILE_ID,
.open = grub_fs_file_open,
.close = grub_fs_file_close,
.read = grub_fs_file_read,
.write = grub_fs_file_write,
.next = 0
};
GRUB_MOD_INIT (fs_file)
{
grub_disk_dev_register (&grub_fs_file_dev);
}
GRUB_MOD_FINI (fs_file)
{
grub_disk_dev_unregister (&grub_fs_file_dev);
}

View File

@ -1,149 +0,0 @@
/* fs_uuid.c - Access disks by their filesystem UUID. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2008 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/disk.h>
#include <grub/dl.h>
#include <grub/kernel.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/types.h>
#include <grub/fs.h>
#include <grub/partition.h>
static grub_device_t
search_fs_uuid (const char *key, unsigned long *count)
{
*count = 0;
grub_device_t ret = NULL;
auto int iterate_device (const char *name);
int iterate_device (const char *name)
{
grub_device_t dev;
dev = grub_device_open (name);
if (dev)
{
grub_fs_t fs;
fs = grub_fs_probe (dev);
if (fs && fs->uuid)
{
char *uuid;
(fs->uuid) (dev, &uuid);
if (grub_errno == GRUB_ERR_NONE && uuid)
{
(*count)++;
if (grub_strcasecmp (uuid, key) == 0)
{
ret = dev;
grub_free (uuid);
return 1;
}
grub_free (uuid);
}
}
grub_device_close (dev);
}
grub_errno = GRUB_ERR_NONE;
return 0;
}
grub_device_iterate (iterate_device);
return ret;
}
static grub_err_t
grub_fs_uuid_open (const char *name, grub_disk_t disk)
{
grub_device_t dev;
if (grub_strncmp (name, "UUID=", sizeof ("UUID=")-1))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a UUID virtual volume");
dev = search_fs_uuid (name + sizeof ("UUID=") - 1, &disk->id);
if (! dev)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching UUID found");
disk->total_sectors = dev->disk->total_sectors;
disk->has_partitions = 0;
if (dev->disk->partition)
{
disk->partition = grub_malloc (sizeof (*disk->partition));
if (disk->partition)
grub_memcpy (disk->partition, dev->disk->partition,
sizeof (*disk->partition));
}
else
disk->partition = NULL;
disk->data = dev;
return GRUB_ERR_NONE;
}
static void
grub_fs_uuid_close (grub_disk_t disk __attribute((unused)))
{
grub_device_t parent = disk->data;
grub_device_close (parent);
}
static grub_err_t
grub_fs_uuid_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
grub_device_t parent = disk->data;
return parent->disk->dev->read (parent->disk, sector, size, buf);
}
static grub_err_t
grub_fs_uuid_write (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, const char *buf)
{
grub_device_t parent = disk->data;
return parent->disk->dev->write (parent->disk, sector, size, buf);
}
static struct grub_disk_dev grub_fs_uuid_dev =
{
.name = "fs_uuid",
.id = GRUB_DISK_DEVICE_UUID_ID,
.open = grub_fs_uuid_open,
.close = grub_fs_uuid_close,
.read = grub_fs_uuid_read,
.write = grub_fs_uuid_write,
.next = 0
};
GRUB_MOD_INIT(fs_uuid)
{
grub_disk_dev_register (&grub_fs_uuid_dev);
}
GRUB_MOD_FINI(fs_uuid)
{
grub_disk_dev_unregister (&grub_fs_uuid_dev);
}

View File

@ -328,15 +328,15 @@ GRUB_MOD_INIT(efiemu)
{
cmd_loadcore = grub_register_command ("efiemu_loadcore",
grub_cmd_efiemu_load,
"efiemu_loadcore FILE",
"Load and initialize EFI emulator");
"FILE",
"Load and initialize EFI emulator.");
cmd_prepare = grub_register_command ("efiemu_prepare",
grub_cmd_efiemu_prepare,
"efiemu_prepare",
"Finalize loading of EFI emulator");
0,
"Finalize loading of EFI emulator.");
cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
"efiemu_unload",
"Unload EFI emulator");
0,
"Unload EFI emulator.");
}
GRUB_MOD_FINI(efiemu)

View File

@ -128,7 +128,7 @@ GRUB_MOD_INIT(font_manager)
cmd_loadfont =
grub_register_command ("loadfont", loadfont_command,
"loadfont FILE...",
"FILE...",
"Specify one or more font files to load.");
cmd_lsfonts =
grub_register_command ("lsfonts", lsfonts_command,

View File

@ -347,7 +347,7 @@ GRUB_MOD_INIT (gettext)
grub_gettext_init_ext (lang);
grub_register_command_p1 ("gettext", grub_cmd_translate,
"gettext STRING",
"STRING",
"Translates the string with the current settings.");
/* Reload .mo file information if lang changes. */

26
include/grub/search.h Normal file
View File

@ -0,0 +1,26 @@
/*
* 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/>.
*/
#ifndef GRUB_SEARCH_HEADER
#define GRUB_SEARCH_HEADER 1
void grub_search_fs_file (const char *key, const char *var, int no_floppy);
void grub_search_fs_uuid (const char *key, const char *var, int no_floppy);
void grub_search_label (const char *key, const char *var, int no_floppy);
#endif

View File

@ -37,7 +37,7 @@ grub_register_command_prio (const char *name,
cmd->name = name;
cmd->func = func;
cmd->summary = (summary) ? summary : name;
cmd->summary = (summary) ? summary : "";
cmd->description = description;
cmd->flags = GRUB_COMMAND_FLAG_BOTH;

View File

@ -190,13 +190,13 @@ void
grub_register_core_commands (void)
{
grub_register_command ("set", grub_core_cmd_set,
"set [ENVVAR=VALUE]", "set an environment variable");
"[ENVVAR=VALUE]", "Set an environment variable.");
grub_register_command ("unset", grub_core_cmd_unset,
"unset ENVVAR", "remove an environment variable");
"ENVVAR", "Remove an environment variable.");
grub_register_command ("export", grub_core_cmd_export,
"export ENVVAR", "Export a variable.");
"ENVVAR", "Export a variable.");
grub_register_command ("ls", grub_core_cmd_ls,
"ls [ARG]", "list devices or files");
"[ARG]", "List devices or files.");
grub_register_command ("insmod", grub_core_cmd_insmod,
"insmod MODULE", "insert a module");
"MODULE", "Insert a module.");
}

View File

@ -764,6 +764,11 @@ FUNCTION(grub_biosdisk_get_diskinfo_int13_extensions)
movw %cx, %ax
movw %bx, %ds
int $0x13 /* do the operation */
jc noclean
/* Clean return value if carry isn't set to workaround
some buggy BIOSes. */
xor %ax, %ax
noclean:
movb %ah, %bl /* save return value in %bl */
/* back to protected mode */
DATA32 call real_to_prot
@ -807,6 +812,11 @@ FUNCTION(grub_biosdisk_get_diskinfo_standard)
.code16
movb $0x8, %ah
int $0x13 /* do the operation */
jc noclean2
/* Clean return value if carry isn't set to workaround
some buggy BIOSes. */
xor %ax, %ax
noclean2:
/* check if successful */
testb %ah, %ah
jnz 1f

View File

@ -145,13 +145,16 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
*argc = 0;
do
{
if (! *rd)
if (! rd || !*rd)
{
if (getline)
getline (&rd, 1);
else break;
}
if (!rd)
break;
for (; *rd; rd++)
{
grub_parser_state_t newstate;

View File

@ -107,7 +107,7 @@ find_long (const struct grub_arg_option *options, const char *s, int len)
static void
show_usage (grub_extcmd_t cmd)
{
grub_printf ("%s %s\n", _("Usage:"), _(cmd->cmd->summary));
grub_printf ("%s %s %s\n", _("Usage:"), cmd->cmd->name, _(cmd->cmd->summary));
}
void

View File

@ -208,7 +208,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(appleloader)
{
cmd = grub_register_command ("appleloader", grub_cmd_appleloader,
"appleloader [OPTS]", "Boot legacy system.");
"[OPTS]", "Boot legacy system.");
my_mod = mod;
}

View File

@ -336,7 +336,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(chainloader)
{
cmd = grub_register_command ("chainloader", grub_cmd_chainloader,
0, "load another boot loader");
0, "Load another boot loader.");
my_mod = mod;
}

View File

@ -1280,25 +1280,25 @@ GRUB_MOD_INIT (bsd)
{
cmd_freebsd = grub_register_extcmd ("kfreebsd", grub_cmd_freebsd,
GRUB_COMMAND_FLAG_BOTH,
"kfreebsd FILE", "Load kernel of FreeBSD.",
"FILE", "Load kernel of FreeBSD.",
freebsd_opts);
cmd_openbsd = grub_register_extcmd ("kopenbsd", grub_cmd_openbsd,
GRUB_COMMAND_FLAG_BOTH,
"kopenbsd FILE", "Load kernel of OpenBSD.",
"FILE", "Load kernel of OpenBSD.",
openbsd_opts);
cmd_netbsd = grub_register_extcmd ("knetbsd", grub_cmd_netbsd,
GRUB_COMMAND_FLAG_BOTH,
"knetbsd FILE", "Load kernel of NetBSD.",
"FILE", "Load kernel of NetBSD.",
netbsd_opts);
cmd_freebsd_loadenv =
grub_register_command ("kfreebsd_loadenv", grub_cmd_freebsd_loadenv,
0, "load FreeBSD env");
0, "Load FreeBSD env.");
cmd_freebsd_module =
grub_register_command ("kfreebsd_module", grub_cmd_freebsd_module,
0, "load FreeBSD kernel module");
0, "Load FreeBSD kernel module.");
cmd_freebsd_module_elf =
grub_register_command ("kfreebsd_module_elf", grub_cmd_freebsd_module_elf,
0, "load FreeBSD kernel module (ELF)");
0, "Load FreeBSD kernel module (ELF).");
my_mod = mod;
}

View File

@ -989,9 +989,9 @@ static grub_command_t cmd_linux, cmd_initrd;
GRUB_MOD_INIT(linux)
{
cmd_linux = grub_register_command ("linux", grub_cmd_linux,
0, "load linux");
0, "Load Linux.");
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
0, "load initrd");
0, "Load initrd.");
my_mod = mod;
}

View File

@ -276,9 +276,9 @@ static grub_command_t cmd_linux, cmd_initrd;
GRUB_MOD_INIT(linux)
{
cmd_linux = grub_register_command ("linux", grub_cmd_linux,
0, "load linux");
0, "Load Linux.");
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
0, "load initrd");
0, "Load initrd.");
my_mod = mod;
}

View File

@ -982,9 +982,9 @@ static grub_command_t cmd_linux, cmd_initrd;
GRUB_MOD_INIT(linux)
{
cmd_linux = grub_register_command ("linux", grub_cmd_linux,
0, "load linux");
0, "Load Linux.");
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
0, "load initrd");
0, "Load initrd.");
my_mod = mod;
}

View File

@ -146,7 +146,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(chainloader)
{
cmd = grub_register_command ("chainloader", grub_cmd_chainloader,
0, "load another boot loader");
0, "Load another boot loader.");
my_mod = mod;
}

View File

@ -383,10 +383,10 @@ GRUB_MOD_INIT(linux16)
{
cmd_linux =
grub_register_command ("linux16", grub_cmd_linux,
0, "load linux");
0, "Load Linux.");
cmd_initrd =
grub_register_command ("initrd16", grub_cmd_initrd,
0, "load initrd");
0, "Load initrd.");
my_mod = mod;
}

View File

@ -197,10 +197,10 @@ GRUB_MOD_INIT(multiboot)
{
cmd_multiboot =
grub_register_command ("multiboot", grub_cmd_multiboot_loader,
0, "load a multiboot kernel");
0, "Load a multiboot kernel.");
cmd_module =
grub_register_command ("module", grub_cmd_module_loader,
0, "load a multiboot module");
0, "Load a multiboot module.");
my_mod = mod;
}

View File

@ -349,9 +349,9 @@ static grub_command_t cmd_linux, cmd_initrd;
GRUB_MOD_INIT(linux)
{
cmd_linux = grub_register_command ("linux", grub_cmd_linux,
0, "load a linux kernel");
0, "Load Linux.");
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
0, "load an initrd");
0, "Load initrd.");
my_mod = mod;
}

View File

@ -516,9 +516,9 @@ GRUB_MOD_INIT(linux)
fetch_translations ();
cmd_linux = grub_register_command ("linux", grub_cmd_linux,
0, "load a linux kernel");
0, "Load Linux.");
cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd,
0, "load an initrd");
0, "Load initrd".);
my_mod = mod;
}

View File

@ -1404,21 +1404,21 @@ static grub_command_t cmd_kextdir, cmd_ramdisk, cmd_resume, cmd_splash;
GRUB_MOD_INIT(xnu)
{
cmd_kernel = grub_register_command ("xnu_kernel", grub_cmd_xnu_kernel, 0,
"load a xnu kernel");
"Load XNU image.");
cmd_kernel64 = grub_register_command ("xnu_kernel64", grub_cmd_xnu_kernel64,
0, "load a 64-bit xnu kernel");
0, "Load 64-bit XNU image.");
cmd_mkext = grub_register_command ("xnu_mkext", grub_cmd_xnu_mkext, 0,
"Load XNU extension package.");
cmd_kext = grub_register_command ("xnu_kext", grub_cmd_xnu_kext, 0,
"Load XNU extension.");
cmd_kextdir = grub_register_command ("xnu_kextdir", grub_cmd_xnu_kextdir,
"xnu_kextdir DIRECTORY [OSBundleRequired]",
"Load XNU extension directory");
"DIRECTORY [OSBundleRequired]",
"Load XNU extension directory.");
cmd_ramdisk = grub_register_command ("xnu_ramdisk", grub_cmd_xnu_ramdisk, 0,
"Load XNU ramdisk. "
"It will be seen as md0");
"It will be seen as md0.");
cmd_splash = grub_register_command ("xnu_splash", grub_cmd_xnu_splash, 0,
"Load a splash image for XNU");
"Load a splash image for XNU.");
#ifndef GRUB_UTIL
cmd_resume = grub_register_command ("xnu_resume", grub_cmd_xnu_resume,

View File

@ -414,8 +414,8 @@ static grub_command_t cmd;
GRUB_MOD_INIT(mmap)
{
cmd = grub_register_command ("badram", grub_cmd_badram,
"badram ADDR1,MASK1[,ADDR2,MASK2[,...]]",
"declare memory regions as badram");
"ADDR1,MASK1[,ADDR2,MASK2[,...]]",
"Declare memory regions as badram.");
}
GRUB_MOD_FINI(mmap)

View File

@ -268,14 +268,14 @@ grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
grub_refresh ();
}
plen = grub_strlen (prompt_translated);
plen = grub_strlen (prompt_translated) + sizeof (" ") - 1;
lpos = llen = 0;
buf[0] = '\0';
if ((grub_getxy () >> 8) != 0)
grub_putchar ('\n');
grub_printf ("%s", prompt_translated);
grub_printf ("%s ", prompt_translated);
xpos = plen;
ystart = ypos = (grub_getxy () & 0xFF);

View File

@ -117,7 +117,7 @@ insert_handler (char *name, char *module)
data = 0;
item->cmd = grub_register_command (item->name, grub_handler_cmd, 0,
"Set active handler");
"Set active handler.");
if (! item->cmd)
{
grub_free (data);

View File

@ -546,9 +546,9 @@ static grub_err_t
grub_normal_read_line (char **line, int cont)
{
grub_parser_t parser = grub_parser_get_current ();
char prompt[sizeof("> ") + grub_strlen (parser->name)];
char prompt[sizeof(">") + grub_strlen (parser->name)];
grub_sprintf (prompt, "%s> ", parser->name);
grub_sprintf (prompt, "%s>", parser->name);
while (1)
{
@ -598,7 +598,7 @@ GRUB_MOD_INIT(normal)
/* Register a command "normal" for the rescue mode. */
grub_register_command_prio ("normal", grub_cmd_normal,
0, "Enter normal mode", 0);
0, "Enter normal mode.", 0);
/* Reload terminal colors when these variables are written to. */
grub_register_variable_hook ("color_normal", NULL, grub_env_write_color_normal);

View File

@ -137,8 +137,8 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right)
next_new_line = (grub_uint32_t *) last_position;
while (grub_getstringwidth (current_position, next_new_line) > line_len
|| (*next_new_line != ' ' && next_new_line > current_position &&
next_new_line != last_position))
|| (next_new_line != last_position && *next_new_line != ' '
&& next_new_line > current_position))
{
next_new_line--;
}

View File

@ -960,7 +960,7 @@ GRUB_MOD_INIT(term_gfxterm)
grub_term_register_output ("gfxterm", &grub_video_term);
cmd = grub_register_command ("background_image",
grub_gfxterm_background_image_cmd,
0, "Load background image for active terminal");
0, "Load background image for active terminal.");
}
GRUB_MOD_FINI(term_gfxterm)

View File

@ -178,7 +178,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(terminfo)
{
cmd = grub_register_command ("terminfo", grub_cmd_terminfo,
"terminfo [TERM]", "Set terminfo type.");
"[TERM]", "Set terminfo type.");
grub_terminfo_set_current ("vt100");
}

View File

@ -34,7 +34,7 @@ font=@datadir@/@PACKAGE_TARNAME@/ascii.pf2
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] || [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
else
grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
@ -53,6 +53,8 @@ debug=no
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
disk_module=biosdisk
elif [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
disk_module=
else
disk_module=ata
fi
@ -186,7 +188,7 @@ device_map=${grubdir}/device.map
grub_probe="${grub_probe} --device-map=${device_map}"
# Check if GRUB is installed.
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
set $grub_setup dummy
if test -f "$1"; then
:
@ -248,7 +250,7 @@ done
for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do
cp -f $file ${grubdir} || exit 1
done
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
for file in ${pkglibdir}/*.img ${pkglibdir}/efiemu??.o; do
if test -f $file; then
cp -f $file ${grubdir} || exit 1
@ -291,7 +293,14 @@ fi
modules="$modules $disk_module"
modules="$modules $fs_module $partmap_module $devabstraction_module"
relative_grubdir=`make_system_path_relative_to_its_root ${grubdir}` || exit 1
if [ "x${relative_grubdir}" = "x" ] ; then
relative_grubdir=/
fi
prefix_drive=
config_opt=
if [ "x${devabstraction_module}" = "x" ] ; then
if [ x"${install_device}" != x ]; then
if echo "${install_device}" | grep -qx "(.*)" ; then
@ -312,28 +321,27 @@ if [ "x${devabstraction_module}" = "x" ] ; then
echo "UUID needed with ata mod, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
exit 1
fi
prefix_drive="(UUID=${uuid})"
modules="$modules fs_uuid"
echo "search.fs_uuid ${uuid} root " > ${grubdir}/load.cfg
echo 'set prefix=($root)'"${relative_grubdir}" >> ${grubdir}/load.cfg
config_opt="-c ${grubdir}/load.cfg "
modules="$modules search_fs_uuid"
elif [ "x${grub_drive}" != "x${install_drive}" ] ; then
uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
if [ "x${uuid}" = "x" ] ; then
echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
exit 1
fi
prefix_drive="(UUID=${uuid})"
modules="$modules fs_uuid"
echo "search.fs_uuid ${uuid} root " > ${grubdir}/load.cfg
echo 'set prefix=($root)'"${relative_grubdir}" >> ${grubdir}/load.cfg
config_opt="-c ${grubdir}/load.cfg "
modules="$modules search_fs_uuid"
fi
else
prefix_drive=`$grub_probe --target=drive --device ${grub_device}`
fi
relative_grubdir=`make_system_path_relative_to_its_root ${grubdir}` || exit 1
if [ "x${relative_grubdir}" = "x" ] ; then
relative_grubdir=/
fi
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
$grub_mkimage --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
$grub_mkimage ${config_opt} --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
# Now perform the installation.
$grub_setup ${setup_verbose} ${setup_force} --directory=${grubdir} --device-map=${device_map} \
@ -341,7 +349,7 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
elif [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
$grub_mkimage -f ${font} -d ${pkglibdir} -O elf --output=/boot/grub.elf --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
else
$grub_mkimage -d ${pkglibdir} --output=/boot/multiboot.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
$grub_mkimage ${config_opt} -d ${pkglibdir} --output=/boot/multiboot.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
fi
echo "Installation finished. No error reported."

View File

@ -1,276 +0,0 @@
#! /bin/sh
# Install GRUB on your drive.
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,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/>.
# Initialize some variables.
transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
sbindir=@sbindir@
bindir=@bindir@
libdir=@libdir@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@
platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
rootdir=
grub_prefix=`echo /boot/grub | sed ${transform}`
modules=
install_device=
no_floppy=
force_lba=
recheck=no
debug=no
# Usage: usage
# Print the usage.
usage () {
cat <<EOF
Usage: grub-install [OPTION] install_device
Install GRUB on your drive.
-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--root-directory=DIR install GRUB images under the directory DIR
instead of the root directory
--grub-setup=FILE use FILE as grub-setup
--grub-mkimage=FILE use FILE as grub-mkimage
--grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
--grub-probe=FILE use FILE as grub-probe
--no-floppy do not probe any floppy drive
--recheck probe a device map even if it already exists
INSTALL_DEVICE can be a GRUB device name or a system device filename.
grub-install copies GRUB images into the DIR/boot directory specified by
--root-directory, and uses grub-setup to install grub into the boot
sector.
Report bugs to <bug-grub@gnu.org>.
EOF
}
# Check the arguments.
for option in "$@"; do
case "$option" in
-h | --help)
usage
exit 0 ;;
-v | --version)
echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
--root-directory=*)
rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
--grub-setup=*)
grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;;
--grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--grub-mkdevicemap=*)
grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
--grub-probe=*)
grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
--no-floppy)
no_floppy="--no-floppy" ;;
--recheck)
recheck=yes ;;
# This is an undocumented feature...
--debug)
debug=yes ;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
exit 1
;;
*)
if test "x$install_device" != x; then
echo "More than one install_devices?" 1>&2
usage
exit 1
fi
install_device="${option}" ;;
esac
done
# for make_system_path_relative_to_its_root()
. ${libdir}/grub/grub-mkconfig_lib
if test "x$install_device" = x; then
echo "install_device not specified." 1>&2
usage
exit 1
fi
# If the debugging feature is enabled, print commands.
setup_verbose=
if test $debug = yes; then
set -x
setup_verbose="--verbose"
fi
# Initialize these directories here, since ROOTDIR was initialized.
bootdir=${rootdir}/boot
grubdir=${bootdir}/`echo grub | sed ${transform}`
device_map=${grubdir}/device.map
grub_probe="${grub_probe} --device-map=${device_map}"
# Check if GRUB is installed.
set $grub_setup dummy
if test -f "$1"; then
:
else
echo "$1: Not found." 1>&2
exit 1
fi
set $grub_mkimage dummy
if test -f "$1"; then
:
else
echo "$1: Not found." 1>&2
exit 1
fi
set $grub_mkdevicemap dummy
if test -f "$1"; then
:
else
echo "$1: Not found." 1>&2
exit 1
fi
# Create the GRUB directory if it is not present.
test -d "$bootdir" || mkdir "$bootdir" || exit 1
test -d "$grubdir" || mkdir "$grubdir" || exit 1
# If --recheck is specified, remove the device map, if present.
if test $recheck = yes; then
rm -f $device_map
fi
# Create the device map file if it is not present.
if test -f "$device_map"; then
:
else
# Create a safe temporary file.
test -n "$mklog" && log_file=`$mklog`
$grub_mkdevicemap --device-map=$device_map $no_floppy || exit 1
fi
# Make sure that there is no duplicated entry.
tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \
| sort | uniq -d | sed -n 1p`
if test -n "$tmp"; then
echo "The drive $tmp is defined multiple times in the device map $device_map" 1>&2
exit 1
fi
# Copy the GRUB images to the GRUB directory.
for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img; do
if test -f $file && [ "`basename $file`" != menu.lst ]; then
rm -f $file || exit 1
fi
done
for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do
cp -f $file ${grubdir} || exit 1
done
for file in ${pkglibdir}/*.img; do
cp -f $file ${grubdir} || exit 1
done
# Write device to a variable so we don't have to traverse /dev every time.
grub_device=`$grub_probe --target=device ${grubdir}`
# Create the core image. First, auto-detect the filesystem module.
fs_module=`$grub_probe --target=fs --device ${grub_device}`
if test "x$fs_module" = x -a "x$modules" = x; then
echo "Auto-detection of a filesystem module failed." 1>&2
echo "Please specify the module with the option \`--modules' explicitly." 1>&2
exit 1
fi
# Then the partition map module. In order to support partition-less media,
# this command is allowed to fail (--target=fs already grants us that the
# filesystem will be accessible).
partmap_module=`$grub_probe --target=partmap --device ${grub_device} 2> /dev/null`
# Device abstraction module, if any (lvm, raid).
devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}`
modules="$modules $fs_module $partmap_module $devabstraction_module"
prefix_drive=
if [ "x${devabstraction_module}" = "x" ] ; then
if echo "${install_device}" | grep -qx "(.*)" ; then
install_drive="${install_device}"
else
install_drive="`$grub_probe --target=drive --device ${install_device}`"
fi
grub_drive="`$grub_probe --target=drive --device ${grub_device}`"
# Strip partition number
install_drive="`echo ${install_drive} | sed -e 's/\([^\]\),[0-9]*/\1/g'`"
grub_drive="`echo ${grub_drive} | sed -e 's/\([^\]\),[0-9]*/\1/g'`"
if [ "x${grub_drive}" != "x${install_drive}" ] ; then
uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
if [ "x${uuid}" = "x" ] ; then
echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
exit 1
fi
prefix_drive="(UUID=${uuid})"
modules="$modules fs_uuid"
fi
else
prefix_drive=`$grub_probe --target=drive --device ${grub_device}`
fi
relative_grubdir=`make_system_path_relative_to_its_root ${grubdir}` || exit 1
if [ "x${relative_grubdir}" = "x" ] ; then
relative_grubdir=/
fi
$grub_mkimage --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
# Now perform the installation.
$grub_setup ${setup_verbose} --directory=${grubdir} --device-map=${device_map} \
${install_device} || exit 1
# Prompt the user to check if the device map is correct.
echo "Installation finished. No error reported."
echo "This is the contents of the device map $device_map."
echo "Check if this is correct or not. If any of the lines is incorrect,"
echo "fix it and re-run the script \`grub-install'."
echo
cat $device_map
# Bye.
exit 0

View File

@ -54,6 +54,10 @@ static const grub_uint8_t jpeg_zigzag_order[64] = {
53, 60, 61, 54, 47, 55, 62, 63
};
#ifdef JPEG_DEBUG
static grub_command_t cmd;
#endif
typedef int jpeg_data_unit_t[64];
struct grub_jpeg_data
@ -695,8 +699,8 @@ grub_video_reader_jpeg (struct grub_video_bitmap **bitmap,
#if defined(JPEG_DEBUG)
static grub_err_t
grub_cmd_jpegtest (struct grub_arg_list *state __attribute__ ((unused)),
int argc, char **args)
grub_cmd_jpegtest (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
struct grub_video_bitmap *bitmap = 0;
@ -730,16 +734,16 @@ GRUB_MOD_INIT (video_reader_jpeg)
grub_video_bitmap_reader_register (&jpg_reader);
grub_video_bitmap_reader_register (&jpeg_reader);
#if defined(JPEG_DEBUG)
grub_register_command ("jpegtest", grub_cmd_jpegtest,
GRUB_COMMAND_FLAG_BOTH, "jpegtest FILE",
"Tests loading of JPEG bitmap.", 0);
cmd = grub_register_command ("jpegtest", grub_cmd_jpegtest,
"FILE",
"Tests loading of JPEG bitmap.");
#endif
}
GRUB_MOD_FINI (video_reader_jpeg)
{
#if defined(JPEG_DEBUG)
grub_unregister_command ("jpegtest");
grub_unregister_command (cmd);
#endif
grub_video_bitmap_reader_unregister (&jpeg_reader);
grub_video_bitmap_reader_unregister (&jpg_reader);

View File

@ -73,6 +73,10 @@
#define DEFLATE_HUFF_LEN 16
#ifdef PNG_DEBUG
static grub_command_t cmd;
#endif
struct huff_table
{
int *values, *maxval, *offset;
@ -866,7 +870,7 @@ grub_video_reader_png (struct grub_video_bitmap **bitmap,
#if defined(PNG_DEBUG)
static grub_err_t
grub_cmd_pngtest (struct grub_arg_list *state __attribute__ ((unused)),
grub_cmd_pngtest (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
struct grub_video_bitmap *bitmap = 0;
@ -894,16 +898,16 @@ GRUB_MOD_INIT (video_reader_png)
{
grub_video_bitmap_reader_register (&png_reader);
#if defined(PNG_DEBUG)
grub_register_command ("pngtest", grub_cmd_pngtest,
GRUB_COMMAND_FLAG_BOTH, "pngtest FILE",
"Tests loading of PNG bitmap.", 0);
cmd = grub_register_command ("pngtest", grub_cmd_pngtest,
"FILE",
"Tests loading of PNG bitmap.");
#endif
}
GRUB_MOD_FINI (video_reader_png)
{
#if defined(PNG_DEBUG)
grub_unregister_command ("pngtest");
grub_unregister_command (cmd);
#endif
grub_video_bitmap_reader_unregister (&png_reader);
}

View File

@ -29,6 +29,7 @@
#if defined(TGA_DEBUG)
#define dump_int_field(x) grub_printf( #x " = %d (0x%04x)\n", x, x);
static grub_command_t cmd;
#endif
enum
@ -452,7 +453,7 @@ grub_video_reader_tga (struct grub_video_bitmap **bitmap,
#if defined(TGA_DEBUG)
static grub_err_t
grub_cmd_tgatest (struct grub_arg_list *state __attribute__ ((unused)),
grub_cmd_tgatest (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
struct grub_video_bitmap *bitmap = 0;
@ -480,15 +481,15 @@ GRUB_MOD_INIT(video_reader_tga)
{
grub_video_bitmap_reader_register (&tga_reader);
#if defined(TGA_DEBUG)
grub_register_command ("tgatest", grub_cmd_tgatest, GRUB_COMMAND_FLAG_BOTH,
"tgatest FILE", "Tests loading of TGA bitmap.", 0);
cmd = grub_register_command ("tgatest", grub_cmd_tgatest,
"FILE", "Tests loading of TGA bitmap.");
#endif
}
GRUB_MOD_FINI(video_reader_tga)
{
#if defined(TGA_DEBUG)
grub_unregister_command ("tgatest");
grub_unregister_command (cmd);
#endif
grub_video_bitmap_reader_unregister (&tga_reader);
}