From 063e925fb0370f2753f5122f8dacb26d67ce7713 Mon Sep 17 00:00:00 2001 From: phcoder Date: Tue, 22 Sep 2009 09:27:59 +0200 Subject: [PATCH 01/21] split search --- commands/search.c | 101 ++++++++++++++++---------------------- conf/common.rmk | 20 +++++++- conf/i386-coreboot.rmk | 2 +- conf/i386-efi.rmk | 2 +- conf/i386-ieee1275.rmk | 2 +- conf/i386-pc.rmk | 2 +- conf/powerpc-ieee1275.rmk | 2 +- conf/sparc64-ieee1275.rmk | 2 +- conf/x86_64-efi.rmk | 2 +- 9 files changed, 66 insertions(+), 69 deletions(-) diff --git a/commands/search.c b/commands/search.c index 0cfd0ebbc..60b5bbf04 100644 --- a/commands/search.c +++ b/commands/search.c @@ -27,27 +27,8 @@ #include #include -static const struct grub_arg_option options[] = - { - {"file", 'f', 0, "search devices by a file", 0, 0}, - {"label", 'l', 0, "search devices by a filesystem label", 0, 0}, - {"fs-uuid", 'u', 0, "search devices by a filesystem UUID", 0, 0}, - {"set", 's', GRUB_ARG_OPTION_OPTIONAL, "set a variable to the first device found", "VAR", ARG_TYPE_STRING}, - {"no-floppy", 'n', 0, "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; @@ -63,7 +44,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; @@ -84,27 +65,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) { @@ -118,6 +101,7 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type) grub_device_close (dev); } } +#endif if (found) { @@ -156,45 +140,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 SEARCH_FILE +GRUB_MOD_INIT(search_file) +#elif defined (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, - "search [-f|-l|-u|-s|-n] NAME", - "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, + COMMAND_NAME " 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 SEARCH_FILE +GRUB_MOD_FINI(search_file) +#elif defined (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); } diff --git a/conf/common.rmk b/conf/common.rmk index e18dd1052..9c8ac078d 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -363,7 +363,8 @@ 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 \ + ls.mod cmp.mod cat.mod help.mod search_file.mod \ + search_fs_uuid.mod search_fs_label.mod search.mod loopback.mod \ fs_file.mod fs_uuid.mod configfile.mod echo.mod \ terminfo.mod test.mod blocklist.mod hexdump.mod \ read.mod sleep.mod loadenv.mod crc.mod parttool.mod \ @@ -437,10 +438,25 @@ 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) +# For search.mod. +search_file_mod_SOURCES = commands/search_file.c +search_file_mod_CFLAGS = $(COMMON_CFLAGS) +search_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_uuid_mod_SOURCES = commands/search_uuid.c +search_uuid_mod_CFLAGS = $(COMMON_CFLAGS) +search_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For test.mod. test_mod_SOURCES = commands/test.c test_mod_CFLAGS = $(COMMON_CFLAGS) diff --git a/conf/i386-coreboot.rmk b/conf/i386-coreboot.rmk index 09ec7787c..79c36eec1 100644 --- a/conf/i386-coreboot.rmk +++ b/conf/i386-coreboot.rmk @@ -108,7 +108,7 @@ 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_file.c commands/search_label.c commands/search_uuid.c commands/search_wrap.c commands/blocklist.c commands/hexdump.c \ commands/gptsync.c commands/probe.c commands/xnu_uuid.c \ commands/password.c commands/keystatus.c \ lib/hexdump.c commands/i386/cpuid.c \ diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk index 99ab06f64..c9a412aaf 100644 --- a/conf/i386-efi.rmk +++ b/conf/i386-efi.rmk @@ -36,7 +36,7 @@ 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/help.c \ commands/handler.c commands/ls.c commands/test.c \ - commands/search.c commands/hexdump.c lib/hexdump.c \ + commands/search_file.c commands/search_label.c commands/search_uuid.c commands/search_wrap.c commands/hexdump.c lib/hexdump.c \ commands/halt.c commands/reboot.c commands/keystatus.c \ commands/i386/cpuid.c \ commands/password.c \ diff --git a/conf/i386-ieee1275.rmk b/conf/i386-ieee1275.rmk index 4b640de49..6b15b1473 100644 --- a/conf/i386-ieee1275.rmk +++ b/conf/i386-ieee1275.rmk @@ -62,7 +62,7 @@ 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_file.c commands/search_label.c commands/search_uuid.c commands/search_wrap.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 \ diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index bf8fbfb9d..87364223c 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -120,7 +120,7 @@ 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_file.c commands/search_label.c commands/search_uuid.c commands/search_wrap.c commands/blocklist.c commands/hexdump.c \ lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c \ lib/envblk.c commands/loadenv.c \ commands/gptsync.c commands/probe.c commands/xnu_uuid.c \ diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index ee7f9ec27..df594cfd0 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -42,7 +42,7 @@ grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ 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/help.c \ - commands/search.c commands/handler.c commands/test.c \ + commands/search_file.c commands/search_label.c commands/search_uuid.c commands/search_wrap.c commands/handler.c commands/test.c \ commands/ls.c commands/blocklist.c commands/hexdump.c \ lib/hexdump.c commands/halt.c commands/reboot.c \ lib/envblk.c commands/loadenv.c \ diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk index 62e951a5e..936d4818a 100644 --- a/conf/sparc64-ieee1275.rmk +++ b/conf/sparc64-ieee1275.rmk @@ -100,7 +100,7 @@ grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \ 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/help.c \ - commands/search.c commands/handler.c commands/test.c \ + commands/search_file.c commands/search_label.c commands/search_uuid.c commands/search_wrap.c commands/handler.c commands/test.c \ commands/ls.c commands/blocklist.c commands/hexdump.c \ lib/hexdump.c commands/halt.c commands/reboot.c \ lib/envblk.c commands/loadenv.c \ diff --git a/conf/x86_64-efi.rmk b/conf/x86_64-efi.rmk index 934cd7284..a17cd5928 100644 --- a/conf/x86_64-efi.rmk +++ b/conf/x86_64-efi.rmk @@ -34,7 +34,7 @@ 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/help.c \ commands/handler.c commands/ls.c commands/test.c \ - commands/search.c commands/hexdump.c lib/hexdump.c \ + commands/search_file.c commands/search_label.c commands/search_uuid.c commands/search_wrap.c commands/hexdump.c lib/hexdump.c \ commands/halt.c commands/reboot.c \ commands/i386/cpuid.c \ commands/password.c commands/keystatus.c \ From dab7cb49133a6a2eac0d39f6403b4eac388d012e Mon Sep 17 00:00:00 2001 From: phcoder Date: Tue, 22 Sep 2009 09:29:32 +0200 Subject: [PATCH 02/21] missed files --- commands/search_file.c | 5 +++ commands/search_label.c | 5 +++ commands/search_uuid.c | 5 +++ commands/search_wrap.c | 81 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+) create mode 100644 commands/search_file.c create mode 100644 commands/search_label.c create mode 100644 commands/search_uuid.c create mode 100644 commands/search_wrap.c diff --git a/commands/search_file.c b/commands/search_file.c new file mode 100644 index 000000000..265220001 --- /dev/null +++ b/commands/search_file.c @@ -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" diff --git a/commands/search_label.c b/commands/search_label.c new file mode 100644 index 000000000..0047b0e8c --- /dev/null +++ b/commands/search_label.c @@ -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" diff --git a/commands/search_uuid.c b/commands/search_uuid.c new file mode 100644 index 000000000..9767d6501 --- /dev/null +++ b/commands/search_uuid.c @@ -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" diff --git a/commands/search_wrap.c b/commands/search_wrap.c new file mode 100644 index 000000000..35cce3f5e --- /dev/null +++ b/commands/search_wrap.c @@ -0,0 +1,81 @@ +/* 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 . + */ + +static const struct grub_arg_option options[] = + { + {"file", 'f', 0, "search devices by a file", 0, 0}, + {"label", 'l', 0, "search devices by a filesystem label", 0, 0}, + {"fs-uuid", 'u', 0, "search devices by a filesystem UUID", 0, 0}, + {"set", 's', GRUB_ARG_OPTION_OPTIONAL, "set a variable to the first device found", "VAR", ARG_TYPE_STRING}, + {"no-floppy", 'n', 0, "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, + "search [-f|-l|-u|-s|-n] NAME", + "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); +} From d6cb87a6351caef982c897523ee8171a1542be60 Mon Sep 17 00:00:00 2001 From: phcoder Date: Tue, 22 Sep 2009 09:31:18 +0200 Subject: [PATCH 03/21] remove fs_*.c --- conf/common.rmk | 12 +--- disk/fs_file.c | 136 ------------------------------------------- disk/fs_uuid.c | 149 ------------------------------------------------ 3 files changed, 1 insertion(+), 296 deletions(-) delete mode 100644 disk/fs_file.c delete mode 100644 disk/fs_uuid.c diff --git a/conf/common.rmk b/conf/common.rmk index 9c8ac078d..1dc13159c 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -365,7 +365,7 @@ scsi_mod_LDFLAGS = $(COMMON_LDFLAGS) pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \ ls.mod cmp.mod cat.mod help.mod search_file.mod \ search_fs_uuid.mod search_fs_label.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 lua.mod \ @@ -467,16 +467,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) diff --git a/disk/fs_file.c b/disk/fs_file.c deleted file mode 100644 index e09568250..000000000 --- a/disk/fs_file.c +++ /dev/null @@ -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 . - */ - -#include -#include -#include -#include -#include -#include - -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); -} diff --git a/disk/fs_uuid.c b/disk/fs_uuid.c deleted file mode 100644 index 6901dbacf..000000000 --- a/disk/fs_uuid.c +++ /dev/null @@ -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 . - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -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); -} From afba34eb21c649c8874b3ba58cad990a08557fbe Mon Sep 17 00:00:00 2001 From: phcoder Date: Tue, 22 Sep 2009 09:38:12 +0200 Subject: [PATCH 04/21] use search_fs_uuid --- util/i386/pc/grub-install.in | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/util/i386/pc/grub-install.in b/util/i386/pc/grub-install.in index 8ceb811dd..78500766c 100644 --- a/util/i386/pc/grub-install.in +++ b/util/i386/pc/grub-install.in @@ -271,6 +271,7 @@ modules="$modules $disk_module" modules="$modules $fs_module $partmap_module $devabstraction_module" prefix_drive= +config= if [ "x${devabstraction_module}" = "x" ] ; then if echo "${install_device}" | grep -qx "(.*)" ; then install_drive="${install_device}" @@ -289,16 +290,16 @@ 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" + config="search_fs_uuid ${uuid} root" + 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" + config="search_fs_uuid ${uuid} root" + modules="$modules search_fs_uuid" fi else prefix_drive=`$grub_probe --target=drive --device ${grub_device}` @@ -309,14 +310,20 @@ if [ "x${relative_grubdir}" = "x" ] ; then relative_grubdir=/ fi +config_opt= +echo $config > ${grubdir}/load.cfg +if [ x$config != x ]; then + config_opt="-c $config " +fi + if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then - $grub_mkimage --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1 + $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} \ ${install_device} || 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 # Prompt the user to check if the device map is correct. From 81faaf6c56735499e7e3ab3236103fd17c25bad2 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 9 Nov 2009 23:51:01 +0100 Subject: [PATCH 05/21] 2009-11-09 Vladimir Serbinenko * kern/i386/pc/startup.S (grub_biosdisk_get_diskinfo_int13_extensions): Ignore return status if CF is cleared. --- kern/i386/pc/startup.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kern/i386/pc/startup.S b/kern/i386/pc/startup.S index da3624c89..83f0b4ef8 100644 --- a/kern/i386/pc/startup.S +++ b/kern/i386/pc/startup.S @@ -776,6 +776,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 From b8baeed9eef7543e78e25ca9861544e9909c8e05 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 9 Nov 2009 23:59:59 +0100 Subject: [PATCH 06/21] ChangeLog --- ChangeLog.lbafix | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 ChangeLog.lbafix diff --git a/ChangeLog.lbafix b/ChangeLog.lbafix new file mode 100644 index 000000000..add35fb83 --- /dev/null +++ b/ChangeLog.lbafix @@ -0,0 +1,5 @@ +2009-11-09 Vladimir Serbinenko + + * kern/i386/pc/startup.S (grub_biosdisk_get_diskinfo_int13_extensions): + Ignore return status if CF is cleared. + From 7f4f3f581ce36c66644df68e7107466540e690ab Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 22 Nov 2009 12:22:19 +0100 Subject: [PATCH 07/21] Unify grub-install.in for sparc64 with i386-ieee1275 --- util/grub-install.in | 10 +- util/sparc64/ieee1275/grub-install.in | 276 -------------------------- 2 files changed, 6 insertions(+), 280 deletions(-) delete mode 100644 util/sparc64/ieee1275/grub-install.in diff --git a/util/grub-install.in b/util/grub-install.in index a004b2d11..a18a530a1 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -32,7 +32,7 @@ platform=@platform@ pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}` grub_setup=${sbindir}/`echo grub-setup | sed ${transform}` -if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then +if [ "${target_cpu}-${platform}" = "i386-pc" || "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}` else grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}` @@ -51,6 +51,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 @@ -177,7 +179,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 : @@ -239,7 +241,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 @@ -316,7 +318,7 @@ if [ x$config != x ]; then config_opt="-c $config " fi -if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then +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. diff --git a/util/sparc64/ieee1275/grub-install.in b/util/sparc64/ieee1275/grub-install.in deleted file mode 100644 index a03869cb3..000000000 --- a/util/sparc64/ieee1275/grub-install.in +++ /dev/null @@ -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 . - -# 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}` - -# for make_system_path_relative_to_its_root() -. ${libdir}/grub/grub-mkconfig_lib - -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 -} - -# 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 - -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 From 937d332db3d491b2d1018519a84d54dec454a8f3 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 22 Nov 2009 13:15:49 +0100 Subject: [PATCH 08/21] compile and configuration fixes --- commands/search.c | 2 +- commands/search_wrap.c | 12 ++++++++++++ conf/common.rmk | 17 +++++++++-------- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/commands/search.c b/commands/search.c index 60b5bbf04..e885391cf 100644 --- a/commands/search.c +++ b/commands/search.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include void FUNC_NAME (const char *key, const char *var, int no_floppy) diff --git a/commands/search_wrap.c b/commands/search_wrap.c index 35cce3f5e..d28bb744e 100644 --- a/commands/search_wrap.c +++ b/commands/search_wrap.c @@ -17,6 +17,14 @@ * along with GRUB. If not, see . */ +#include +#include +#include +#include +#include +#include +#include + static const struct grub_arg_option options[] = { {"file", 'f', 0, "search devices by a file", 0, 0}, @@ -36,6 +44,10 @@ enum options SEARCH_NO_FLOPPY, }; +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); + static grub_err_t grub_cmd_search (grub_extcmd_t cmd, int argc, char **args) { diff --git a/conf/common.rmk b/conf/common.rmk index 00830e54d..f27c837b8 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -370,8 +370,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_file.mod \ - search_fs_uuid.mod search_fs_label.mod search.mod loopback.mod \ + ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod \ configfile.mod echo.mod \ terminfo.mod test.mod blocklist.mod hexdump.mod \ read.mod sleep.mod loadenv.mod crc.mod parttool.mod \ @@ -449,10 +448,12 @@ 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_file_mod_SOURCES = commands/search_file.c -search_file_mod_CFLAGS = $(COMMON_CFLAGS) -search_file_mod_LDFLAGS = $(COMMON_LDFLAGS) +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 @@ -460,9 +461,9 @@ search_label_mod_CFLAGS = $(COMMON_CFLAGS) search_label_mod_LDFLAGS = $(COMMON_LDFLAGS) # For search.mod. -search_uuid_mod_SOURCES = commands/search_uuid.c -search_uuid_mod_CFLAGS = $(COMMON_CFLAGS) -search_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS) +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 From 4996893238fd3a2314aac73c856381cc09cacf5d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 23 Nov 2009 21:15:44 +0100 Subject: [PATCH 09/21] definition fixes --- commands/search.c | 9 ++--- commands/search_wrap.c | 5 +-- include/grub/search.h | 26 ++++++++++++++ po/ca.po | 81 +----------------------------------------- 4 files changed, 33 insertions(+), 88 deletions(-) create mode 100644 include/grub/search.h diff --git a/commands/search.c b/commands/search.c index e885391cf..fc73b550e 100644 --- a/commands/search.c +++ b/commands/search.c @@ -26,6 +26,7 @@ #include #include #include +#include void FUNC_NAME (const char *key, const char *var, int no_floppy) @@ -153,9 +154,9 @@ grub_cmd_do_search (grub_command_t cmd __attribute__ ((unused)), int argc, static grub_command_t cmd; -#ifdef SEARCH_FILE +#ifdef DO_SEARCH_FILE GRUB_MOD_INIT(search_file) -#elif defined (SEARCH_FS_UUID) +#elif defined (DO_SEARCH_FS_UUID) GRUB_MOD_INIT(search_fs_uuid) #else GRUB_MOD_INIT(search_fs_label) @@ -169,9 +170,9 @@ GRUB_MOD_INIT(search_fs_label) " set to a variable."); } -#ifdef SEARCH_FILE +#ifdef DO_SEARCH_FILE GRUB_MOD_FINI(search_file) -#elif defined (SEARCH_FS_UUID) +#elif defined (DO_SEARCH_FS_UUID) GRUB_MOD_FINI(search_fs_uuid) #else GRUB_MOD_FINI(search_fs_label) diff --git a/commands/search_wrap.c b/commands/search_wrap.c index d28bb744e..8bb26cd0c 100644 --- a/commands/search_wrap.c +++ b/commands/search_wrap.c @@ -24,6 +24,7 @@ #include #include #include +#include static const struct grub_arg_option options[] = { @@ -44,10 +45,6 @@ enum options SEARCH_NO_FLOPPY, }; -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); - static grub_err_t grub_cmd_search (grub_extcmd_t cmd, int argc, char **args) { diff --git a/include/grub/search.h b/include/grub/search.h new file mode 100644 index 000000000..e8f9db285 --- /dev/null +++ b/include/grub/search.h @@ -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 . + */ + +#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 diff --git a/po/ca.po b/po/ca.po index 3f9b0ac32..7c1025fdc 100644 --- a/po/ca.po +++ b/po/ca.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: GNU GRUB\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-11-19 00:16+0100\n" +"POT-Creation-Date: 2009-11-23 21:07+0100\n" "PO-Revision-Date: 2009-11-17 12:26+0100\n" "Last-Translator: Robert Millan \n" "Language-Team: None \n" @@ -22,30 +22,10 @@ msgstr "" msgid "cannot compress the kernel image" msgstr "" -#: util/i386/pc/grub-mkimage.c:117 -#, c-format -msgid "the size of memory disk is 0x%x" -msgstr "" - -#: util/i386/pc/grub-mkimage.c:124 -#, c-format -msgid "the size of config file is 0x%x" -msgstr "" - -#: util/i386/pc/grub-mkimage.c:132 -#, c-format -msgid "the total module size is 0x%x" -msgstr "" - #: util/i386/pc/grub-mkimage.c:138 msgid "prefix is too long" msgstr "" -#: util/i386/pc/grub-mkimage.c:199 -#, c-format -msgid "the core size is 0x%x" -msgstr "" - #: util/i386/pc/grub-mkimage.c:206 msgid "the core image is too big" msgstr "" @@ -89,20 +69,10 @@ msgstr "" msgid "cannot open %s" msgstr "" -#: util/i386/pc/grub-setup.c:162 -#, c-format -msgid "the first sector is <%llu,%u,%u>" -msgstr "" - #: util/i386/pc/grub-setup.c:166 msgid "The first sector of the core file is not sector-aligned" msgstr "" -#: util/i386/pc/grub-setup.c:176 -#, c-format -msgid "saving <%llu,%u,%u> with the segment 0x%x" -msgstr "" - #: util/i386/pc/grub-setup.c:180 msgid "Non-sector-aligned data is found in the core file" msgstr "" @@ -126,11 +96,6 @@ msgstr "" msgid "The size of `%s' is too large" msgstr "" -#: util/i386/pc/grub-setup.c:247 -#, c-format -msgid "setting the root device to `%s'" -msgstr "" - #: util/i386/pc/grub-setup.c:261 #, c-format msgid "Unable to identify a filesystem in %s; safety check can't be performed" @@ -149,11 +114,6 @@ msgstr "" msgid "No DOS-style partitions found" msgstr "" -#: util/i386/pc/grub-setup.c:325 -#, c-format -msgid "dos partition is %d, bsd partition is %d" -msgstr "" - #: util/i386/pc/grub-setup.c:330 util/i386/pc/grub-setup.c:355 msgid "" "Attempting to install GRUB to a partitionless disk. This is a BAD idea." @@ -185,11 +145,6 @@ msgstr "" msgid "Your embedding area is unusually small. core.img won't fit in it." msgstr "" -#: util/i386/pc/grub-setup.c:381 -#, c-format -msgid "the core image will be embedded at sector 0x%llx" -msgstr "" - #: util/i386/pc/grub-setup.c:418 msgid "" "Embedding is not possible, but this is required when the root device is on a " @@ -217,30 +172,6 @@ msgstr "" msgid "attempting to read the core image `%s' from GRUB again" msgstr "" -#: util/i386/pc/grub-setup.c:449 -#, c-format -msgid "" -"succeeded in opening the core image but the size is different (%d != %d)" -msgstr "" - -#: util/i386/pc/grub-setup.c:453 -#, c-format -msgid "succeeded in opening the core image but cannot read %d bytes" -msgstr "" - -#: util/i386/pc/grub-setup.c:476 -msgid "succeeded in opening the core image but the data is different" -msgstr "" - -#: util/i386/pc/grub-setup.c:487 -msgid "couldn't open the core image" -msgstr "" - -#: util/i386/pc/grub-setup.c:490 -#, c-format -msgid "error message = %s" -msgstr "" - #: util/i386/pc/grub-setup.c:498 #, c-format msgid "Cannot read `%s' correctly" @@ -258,11 +189,6 @@ msgstr "" msgid "Failed to read the rest sectors of the core image" msgstr "" -#: util/i386/pc/grub-setup.c:544 -#, c-format -msgid "opening the core image `%s'" -msgstr "" - #: util/i386/pc/grub-setup.c:547 #, c-format msgid "Cannot open `%s'" @@ -310,11 +236,6 @@ msgstr "" msgid "Invalid root device `%s'" msgstr "" -#: util/i386/pc/grub-setup.c:766 -#, c-format -msgid "guessing the root device failed, because of `%s'" -msgstr "" - #: util/i386/pc/grub-setup.c:768 msgid "Cannot guess the root device. Specify the option ``--root-device''." msgstr "" From 20f1afd41afa3db3b00c7c9398a4cdcd67cfde75 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 25 Nov 2009 22:34:35 +0100 Subject: [PATCH 10/21] Fixed various script issues. Thanks fezie for testing. --- util/grub-install.in | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/util/grub-install.in b/util/grub-install.in index a18a530a1..5118e6e56 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -32,7 +32,7 @@ platform=@platform@ 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}" = "sparc64-ieee1275" ] ; then +if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}` else grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}` @@ -179,7 +179,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" || "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then +if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then set $grub_setup dummy if test -f "$1"; then : @@ -241,7 +241,7 @@ done for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do cp -f $file ${grubdir} || exit 1 done -if [ "${target_cpu}-${platform}" = "i386-pc" || "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; 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 @@ -272,8 +272,14 @@ devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}` 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= +config_opt= + if [ "x${devabstraction_module}" = "x" ] ; then if echo "${install_device}" | grep -qx "(.*)" ; then install_drive="${install_device}" @@ -292,7 +298,9 @@ 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 - config="search_fs_uuid ${uuid} root" + 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}`" @@ -300,25 +308,16 @@ if [ "x${devabstraction_module}" = "x" ] ; then echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2 exit 1 fi - config="search_fs_uuid ${uuid} root" + 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 - -config_opt= -echo $config > ${grubdir}/load.cfg -if [ x$config != x ]; then - config_opt="-c $config " -fi - -if [ "${target_cpu}-${platform}" = "i386-pc" || "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then +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. From 6ee8daeead5859a956dc9f919b4bb612627eb072 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 27 Nov 2009 13:38:01 +0100 Subject: [PATCH 11/21] Second part of the LBA fix --- ChangeLog.lbafix | 1 + kern/i386/pc/startup.S | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog.lbafix b/ChangeLog.lbafix index add35fb83..ec9737e9c 100644 --- a/ChangeLog.lbafix +++ b/ChangeLog.lbafix @@ -2,4 +2,5 @@ * kern/i386/pc/startup.S (grub_biosdisk_get_diskinfo_int13_extensions): Ignore return status if CF is cleared. + (grub_biosdisk_get_diskinfo_standard): Likewise. diff --git a/kern/i386/pc/startup.S b/kern/i386/pc/startup.S index 83f0b4ef8..a81795b22 100644 --- a/kern/i386/pc/startup.S +++ b/kern/i386/pc/startup.S @@ -824,6 +824,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 From 03157a273d846d04d724857eee0b538f0ef191ca Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sat, 12 Dec 2009 00:10:38 +0000 Subject: [PATCH 12/21] util/sparc64/ieee1275/grub-install.in was meant to be removed --- conf/sparc64-ieee1275.rmk | 2 +- util/sparc64/ieee1275/grub-install.in | 276 -------------------------- 2 files changed, 1 insertion(+), 277 deletions(-) delete mode 100644 util/sparc64/ieee1275/grub-install.in diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk index d19e927a5..32723b635 100644 --- a/conf/sparc64-ieee1275.rmk +++ b/conf/sparc64-ieee1275.rmk @@ -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 \ diff --git a/util/sparc64/ieee1275/grub-install.in b/util/sparc64/ieee1275/grub-install.in deleted file mode 100644 index 5cfb858d7..000000000 --- a/util/sparc64/ieee1275/grub-install.in +++ /dev/null @@ -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 . - -# 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 -} - -# 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 From fdcdbb6633160bffffd65679dd7dbf2f19ff8e91 Mon Sep 17 00:00:00 2001 From: carles Date: Sat, 26 Dec 2009 00:50:59 +0100 Subject: [PATCH 13/21] 2009-12-26 Carles Pina i Estany * 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 strig 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. --- ChangeLog | 54 +++++++++++++++++++++++++++++++++++++++ commands/acpi.c | 2 +- commands/blocklist.c | 2 +- commands/cat.c | 2 +- commands/cmp.c | 2 +- commands/configfile.c | 6 ++--- commands/crc.c | 2 +- commands/date.c | 2 +- commands/echo.c | 2 +- commands/efi/loadbios.c | 2 +- commands/gptsync.c | 2 +- commands/handler.c | 6 ++--- commands/hdparm.c | 2 +- commands/help.c | 4 +-- commands/hexdump.c | 2 +- commands/i386/cpuid.c | 2 +- commands/i386/pc/halt.c | 2 +- commands/i386/pc/play.c | 2 +- commands/i386/pc/pxecmd.c | 2 +- commands/keystatus.c | 2 +- commands/loadenv.c | 2 +- commands/ls.c | 2 +- commands/lspci.c | 2 +- commands/memrw.c | 12 ++++----- commands/minicmd.c | 8 +++--- commands/parttool.c | 2 +- commands/password.c | 2 +- commands/probe.c | 2 +- commands/read.c | 2 +- commands/search.c | 2 +- commands/sleep.c | 2 +- commands/test.c | 4 +-- commands/xnu_uuid.c | 2 +- efiemu/main.c | 6 ++--- font/font_cmd.c | 2 +- gettext/gettext.c | 2 +- kern/command.c | 2 +- kern/corecmd.c | 10 ++++---- lib/arg.c | 2 +- loader/efi/appleloader.c | 2 +- loader/i386/bsd.c | 6 ++--- loader/xnu.c | 2 +- mmap/mmap.c | 2 +- term/terminfo.c | 2 +- video/readers/jpeg.c | 2 +- video/readers/png.c | 2 +- video/readers/tga.c | 2 +- 47 files changed, 122 insertions(+), 68 deletions(-) diff --git a/ChangeLog b/ChangeLog index c10251569..82b2ab6ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,57 @@ +2009-12-26 Carles Pina i Estany + + * 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 + strig 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 Use search command for preliminar UUID search. diff --git a/commands/acpi.c b/commands/acpi.c index 6bf9f696b..ce4e2db36 100644 --- a/commands/acpi.c +++ b/commands/acpi.c @@ -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 " diff --git a/commands/blocklist.c b/commands/blocklist.c index 51a91e2d7..3c9ef3a58 100644 --- a/commands/blocklist.c +++ b/commands/blocklist.c @@ -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) diff --git a/commands/cat.c b/commands/cat.c index 1a2374360..9d0373b3a 100644 --- a/commands/cat.c +++ b/commands/cat.c @@ -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) diff --git a/commands/cmp.c b/commands/cmp.c index 8a4b4158b..bdd8ff82d 100644 --- a/commands/cmp.c +++ b/commands/cmp.c @@ -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) diff --git a/commands/configfile.c b/commands/configfile.c index 852932216..d1fe9169e 100644 --- a/commands/configfile.c +++ b/commands/configfile.c @@ -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." ); } diff --git a/commands/crc.c b/commands/crc.c index 6b4b1d1b5..a6c17caf0 100644 --- a/commands/crc.c +++ b/commands/crc.c @@ -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."); } diff --git a/commands/date.c b/commands/date.c index 1d609642e..7197b066e 100644 --- a/commands/date.c +++ b/commands/date.c @@ -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."); } diff --git a/commands/echo.c b/commands/echo.c index c9daf62f1..4d5a59df3 100644 --- a/commands/echo.c +++ b/commands/echo.c @@ -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); } diff --git a/commands/efi/loadbios.c b/commands/efi/loadbios.c index 877b5da17..de975c724 100644 --- a/commands/efi/loadbios.c +++ b/commands/efi/loadbios.c @@ -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."); } diff --git a/commands/gptsync.c b/commands/gptsync.c index 8315faa53..b5fe0b8ed 100644 --- a/commands/gptsync.c +++ b/commands/gptsync.c @@ -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 " diff --git a/commands/handler.c b/commands/handler.c index d65a703e4..09b8ff5d0 100644 --- a/commands/handler.c +++ b/commands/handler.c @@ -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."); } diff --git a/commands/hdparm.c b/commands/hdparm.c index 458a447c7..fbcd7f6a8 100644 --- a/commands/hdparm.c +++ b/commands/hdparm.c @@ -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); } diff --git a/commands/help.c b/commands/help.c index c24540cef..9f0ee7528 100644 --- a/commands/help.c +++ b/commands/help.c @@ -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); } diff --git a/commands/hexdump.c b/commands/hexdump.c index 727deecbf..771cde34d 100644 --- a/commands/hexdump.c +++ b/commands/hexdump.c @@ -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); } diff --git a/commands/i386/cpuid.c b/commands/i386/cpuid.c index 8097e7372..b1752ca89 100644 --- a/commands/i386/cpuid.c +++ b/commands/i386/cpuid.c @@ -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) diff --git a/commands/i386/pc/halt.c b/commands/i386/pc/halt.c index befd58804..c2e22882f 100644 --- a/commands/i386/pc/halt.c +++ b/commands/i386/pc/halt.c @@ -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); } diff --git a/commands/i386/pc/play.c b/commands/i386/pc/play.c index 86c0674a4..96d9f6df5 100644 --- a/commands/i386/pc/play.c +++ b/commands/i386/pc/play.c @@ -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) diff --git a/commands/i386/pc/pxecmd.c b/commands/i386/pc/pxecmd.c index b2c99c4e2..1d4fb6a4d 100644 --- a/commands/i386/pc/pxecmd.c +++ b/commands/i386/pc/pxecmd.c @@ -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."); } diff --git a/commands/keystatus.c b/commands/keystatus.c index 0a4667645..4f82550be 100644 --- a/commands/keystatus.c +++ b/commands/keystatus.c @@ -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); } diff --git a/commands/loadenv.c b/commands/loadenv.c index ac5064df9..6ee4d204a 100644 --- a/commands/loadenv.c +++ b/commands/loadenv.c @@ -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); } diff --git a/commands/ls.c b/commands/ls.c index 6eaa1d59e..4b1500398 100644 --- a/commands/ls.c +++ b/commands/ls.c @@ -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); } diff --git a/commands/lspci.c b/commands/lspci.c index fbade98c1..63e60abe0 100644 --- a/commands/lspci.c +++ b/commands/lspci.c @@ -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) diff --git a/commands/memrw.c b/commands/memrw.c index de3ac38e1..8e9c3db11 100644 --- a/commands/memrw.c +++ b/commands/memrw.c @@ -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) diff --git a/commands/minicmd.c b/commands/minicmd.c index 9e06fa5de..47b57e3ed 100644 --- a/commands/minicmd.c +++ b/commands/minicmd.c @@ -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."); diff --git a/commands/parttool.c b/commands/parttool.c index 473652cec..62fe5ad2b 100644 --- a/commands/parttool.c +++ b/commands/parttool.c @@ -322,7 +322,7 @@ GRUB_MOD_INIT(parttool) { mymod = mod; cmd = grub_register_command ("parttool", grub_cmd_parttool, - "parttool PARTITION COMMANDS", + "PARTITION COMMANDS", helpmsg); } diff --git a/commands/password.c b/commands/password.c index 710283b3d..d9b31f962 100644 --- a/commands/password.c +++ b/commands/password.c @@ -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."); } diff --git a/commands/probe.c b/commands/probe.c index fb196275f..7de1c1d34 100644 --- a/commands/probe.c +++ b/commands/probe.c @@ -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); } diff --git a/commands/read.c b/commands/read.c index 270b7bd77..5f4451a72 100644 --- a/commands/read.c +++ b/commands/read.c @@ -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."); } diff --git a/commands/search.c b/commands/search.c index 33102da89..01e83739b 100644 --- a/commands/search.c +++ b/commands/search.c @@ -165,7 +165,7 @@ GRUB_MOD_INIT(search_fs_label) { cmd = grub_register_command (COMMAND_NAME, grub_cmd_do_search, - COMMAND_NAME " NAME [VARIABLE]", + "NAME [VARIABLE]", "Search devices by " SEARCH_TARGET "." " If VARIABLE is specified, " "the first device found is set to a variable."); diff --git a/commands/sleep.c b/commands/sleep.c index 9207b60a7..eb9aeb510 100644 --- a/commands/sleep.c +++ b/commands/sleep.c @@ -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); } diff --git a/commands/test.c b/commands/test.c index 84b4279ea..8d1e24859 100644 --- a/commands/test.c +++ b/commands/test.c @@ -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) diff --git a/commands/xnu_uuid.c b/commands/xnu_uuid.c index 85c0e9ce4..31e69ad13 100644 --- a/commands/xnu_uuid.c +++ b/commands/xnu_uuid.c @@ -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."); } diff --git a/efiemu/main.c b/efiemu/main.c index f6d7b2e4c..3ec707ef3 100644 --- a/efiemu/main.c +++ b/efiemu/main.c @@ -328,14 +328,14 @@ GRUB_MOD_INIT(efiemu) { cmd_loadcore = grub_register_command ("efiemu_loadcore", grub_cmd_efiemu_load, - "efiemu_loadcore FILE", + "FILE", "Load and initialize EFI emulator"); cmd_prepare = grub_register_command ("efiemu_prepare", grub_cmd_efiemu_prepare, - "efiemu_prepare", + 0, "Finalize loading of EFI emulator"); cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload, - "efiemu_unload", + 0, "Unload EFI emulator"); } diff --git a/font/font_cmd.c b/font/font_cmd.c index 0402b8d77..98216ae44 100644 --- a/font/font_cmd.c +++ b/font/font_cmd.c @@ -62,7 +62,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, diff --git a/gettext/gettext.c b/gettext/gettext.c index c48b5fd95..3472b2fb8 100644 --- a/gettext/gettext.c +++ b/gettext/gettext.c @@ -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. */ diff --git a/kern/command.c b/kern/command.c index 9b3c92b9b..477240d57 100644 --- a/kern/command.c +++ b/kern/command.c @@ -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; diff --git a/kern/corecmd.c b/kern/corecmd.c index 03944f2df..5ea052d38 100644 --- a/kern/corecmd.c +++ b/kern/corecmd.c @@ -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"); } diff --git a/lib/arg.c b/lib/arg.c index bc1af1938..6a7bb8beb 100644 --- a/lib/arg.c +++ b/lib/arg.c @@ -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 diff --git a/loader/efi/appleloader.c b/loader/efi/appleloader.c index 94d501bcf..a7c2183ab 100644 --- a/loader/efi/appleloader.c +++ b/loader/efi/appleloader.c @@ -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; } diff --git a/loader/i386/bsd.c b/loader/i386/bsd.c index 620c4bbf3..ead7ed1f8 100644 --- a/loader/i386/bsd.c +++ b/loader/i386/bsd.c @@ -1280,15 +1280,15 @@ 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, diff --git a/loader/xnu.c b/loader/xnu.c index 85d2882b6..1954d4b65 100644 --- a/loader/xnu.c +++ b/loader/xnu.c @@ -1412,7 +1412,7 @@ GRUB_MOD_INIT(xnu) 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]", + "DIRECTORY [OSBundleRequired]", "Load XNU extension directory"); cmd_ramdisk = grub_register_command ("xnu_ramdisk", grub_cmd_xnu_ramdisk, 0, "Load XNU ramdisk. " diff --git a/mmap/mmap.c b/mmap/mmap.c index 7598cf501..3dc44c24e 100644 --- a/mmap/mmap.c +++ b/mmap/mmap.c @@ -414,7 +414,7 @@ static grub_command_t cmd; GRUB_MOD_INIT(mmap) { cmd = grub_register_command ("badram", grub_cmd_badram, - "badram ADDR1,MASK1[,ADDR2,MASK2[,...]]", + "ADDR1,MASK1[,ADDR2,MASK2[,...]]", "declare memory regions as badram"); } diff --git a/term/terminfo.c b/term/terminfo.c index e5328d06b..fc22fe850 100644 --- a/term/terminfo.c +++ b/term/terminfo.c @@ -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"); } diff --git a/video/readers/jpeg.c b/video/readers/jpeg.c index 460a52872..0c3d00bef 100644 --- a/video/readers/jpeg.c +++ b/video/readers/jpeg.c @@ -731,7 +731,7 @@ GRUB_MOD_INIT (video_reader_jpeg) grub_video_bitmap_reader_register (&jpeg_reader); #if defined(JPEG_DEBUG) grub_register_command ("jpegtest", grub_cmd_jpegtest, - GRUB_COMMAND_FLAG_BOTH, "jpegtest FILE", + GRUB_COMMAND_FLAG_BOTH, "FILE", "Tests loading of JPEG bitmap.", 0); #endif } diff --git a/video/readers/png.c b/video/readers/png.c index c2008aeb2..908672a2e 100644 --- a/video/readers/png.c +++ b/video/readers/png.c @@ -895,7 +895,7 @@ 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", + GRUB_COMMAND_FLAG_BOTH, "FILE", "Tests loading of PNG bitmap.", 0); #endif } diff --git a/video/readers/tga.c b/video/readers/tga.c index 277458fa8..c5ff99cfe 100644 --- a/video/readers/tga.c +++ b/video/readers/tga.c @@ -481,7 +481,7 @@ 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); + "FILE", "Tests loading of TGA bitmap.", 0); #endif } From 864ba2bbca2b52675e24f77ec026222ec19887e5 Mon Sep 17 00:00:00 2001 From: carles Date: Sat, 26 Dec 2009 11:01:33 +0100 Subject: [PATCH 14/21] 2009-12-27 Carles Pina i Estany * 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. --- ChangeLog | 21 +++++++++++++++++++++ efiemu/main.c | 6 +++--- kern/corecmd.c | 8 ++++---- loader/efi/chainloader.c | 2 +- loader/i386/bsd.c | 6 +++--- loader/i386/efi/linux.c | 4 ++-- loader/i386/ieee1275/linux.c | 4 ++-- loader/i386/linux.c | 4 ++-- loader/i386/pc/chainloader.c | 2 +- loader/i386/pc/linux.c | 4 ++-- loader/multiboot_loader.c | 4 ++-- loader/powerpc/ieee1275/linux.c | 4 ++-- loader/sparc64/ieee1275/linux.c | 4 ++-- loader/xnu.c | 10 +++++----- mmap/mmap.c | 2 +- normal/handler.c | 2 +- normal/main.c | 2 +- term/gfxterm.c | 2 +- 18 files changed, 56 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82b2ab6ac..f309d3cb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2009-12-27 Carles Pina i Estany + + * 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 * commands/help.c (grub_cmd_help): Print the command name before the diff --git a/efiemu/main.c b/efiemu/main.c index 3ec707ef3..a3cfdb5b5 100644 --- a/efiemu/main.c +++ b/efiemu/main.c @@ -329,14 +329,14 @@ GRUB_MOD_INIT(efiemu) cmd_loadcore = grub_register_command ("efiemu_loadcore", grub_cmd_efiemu_load, "FILE", - "Load and initialize EFI emulator"); + "Load and initialize EFI emulator."); cmd_prepare = grub_register_command ("efiemu_prepare", grub_cmd_efiemu_prepare, 0, - "Finalize loading of EFI emulator"); + "Finalize loading of EFI emulator."); cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload, 0, - "Unload EFI emulator"); + "Unload EFI emulator."); } GRUB_MOD_FINI(efiemu) diff --git a/kern/corecmd.c b/kern/corecmd.c index 5ea052d38..3e508cd2c 100644 --- a/kern/corecmd.c +++ b/kern/corecmd.c @@ -190,13 +190,13 @@ void grub_register_core_commands (void) { grub_register_command ("set", grub_core_cmd_set, - "[ENVVAR=VALUE]", "set an environment variable"); + "[ENVVAR=VALUE]", "Set an environment variable."); grub_register_command ("unset", grub_core_cmd_unset, - "ENVVAR", "remove an environment variable"); + "ENVVAR", "Remove an environment variable."); grub_register_command ("export", grub_core_cmd_export, "ENVVAR", "Export a variable."); grub_register_command ("ls", grub_core_cmd_ls, - "[ARG]", "list devices or files"); + "[ARG]", "List devices or files."); grub_register_command ("insmod", grub_core_cmd_insmod, - "MODULE", "insert a module"); + "MODULE", "Insert a module."); } diff --git a/loader/efi/chainloader.c b/loader/efi/chainloader.c index 9c833e9b9..559c3f52a 100644 --- a/loader/efi/chainloader.c +++ b/loader/efi/chainloader.c @@ -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; } diff --git a/loader/i386/bsd.c b/loader/i386/bsd.c index ead7ed1f8..ca60b0be9 100644 --- a/loader/i386/bsd.c +++ b/loader/i386/bsd.c @@ -1292,13 +1292,13 @@ GRUB_MOD_INIT (bsd) 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; } diff --git a/loader/i386/efi/linux.c b/loader/i386/efi/linux.c index d0b218b08..0b82ff807 100644 --- a/loader/i386/efi/linux.c +++ b/loader/i386/efi/linux.c @@ -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; } diff --git a/loader/i386/ieee1275/linux.c b/loader/i386/ieee1275/linux.c index 97f9a8216..0a76a67b0 100644 --- a/loader/i386/ieee1275/linux.c +++ b/loader/i386/ieee1275/linux.c @@ -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; } diff --git a/loader/i386/linux.c b/loader/i386/linux.c index 805ec7962..9ea456b0d 100644 --- a/loader/i386/linux.c +++ b/loader/i386/linux.c @@ -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; } diff --git a/loader/i386/pc/chainloader.c b/loader/i386/pc/chainloader.c index 2e3b24fee..27dda4f4f 100644 --- a/loader/i386/pc/chainloader.c +++ b/loader/i386/pc/chainloader.c @@ -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; } diff --git a/loader/i386/pc/linux.c b/loader/i386/pc/linux.c index 9e2543e62..0e7336214 100644 --- a/loader/i386/pc/linux.c +++ b/loader/i386/pc/linux.c @@ -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; } diff --git a/loader/multiboot_loader.c b/loader/multiboot_loader.c index 37b33302a..24c0c5eac 100644 --- a/loader/multiboot_loader.c +++ b/loader/multiboot_loader.c @@ -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; } diff --git a/loader/powerpc/ieee1275/linux.c b/loader/powerpc/ieee1275/linux.c index 9d755450e..f03c10ad8 100644 --- a/loader/powerpc/ieee1275/linux.c +++ b/loader/powerpc/ieee1275/linux.c @@ -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 a linux kernel."); cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, - 0, "load an initrd"); + 0, "Load an initrd."); my_mod = mod; } diff --git a/loader/sparc64/ieee1275/linux.c b/loader/sparc64/ieee1275/linux.c index 820110847..92836e7eb 100644 --- a/loader/sparc64/ieee1275/linux.c +++ b/loader/sparc64/ieee1275/linux.c @@ -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 a linux kernel."); cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, - 0, "load an initrd"); + 0, "Load an initrd".); my_mod = mod; } diff --git a/loader/xnu.c b/loader/xnu.c index 1954d4b65..114f3f213 100644 --- a/loader/xnu.c +++ b/loader/xnu.c @@ -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 a xnu kernel."); cmd_kernel64 = grub_register_command ("xnu_kernel64", grub_cmd_xnu_kernel64, - 0, "load a 64-bit xnu kernel"); + 0, "Load a 64-bit xnu kernel."); 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, "DIRECTORY [OSBundleRequired]", - "Load XNU extension directory"); + "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, diff --git a/mmap/mmap.c b/mmap/mmap.c index 3dc44c24e..874a238b2 100644 --- a/mmap/mmap.c +++ b/mmap/mmap.c @@ -415,7 +415,7 @@ GRUB_MOD_INIT(mmap) { cmd = grub_register_command ("badram", grub_cmd_badram, "ADDR1,MASK1[,ADDR2,MASK2[,...]]", - "declare memory regions as badram"); + "Declare memory regions as badram."); } GRUB_MOD_FINI(mmap) diff --git a/normal/handler.c b/normal/handler.c index eb19f912f..b44dc7a68 100644 --- a/normal/handler.c +++ b/normal/handler.c @@ -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); diff --git a/normal/main.c b/normal/main.c index e8dfb182b..17e21566d 100644 --- a/normal/main.c +++ b/normal/main.c @@ -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); diff --git a/term/gfxterm.c b/term/gfxterm.c index 3e8a081fc..fa19a5d85 100644 --- a/term/gfxterm.c +++ b/term/gfxterm.c @@ -956,7 +956,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) From c541b01a66f9f46dbed815154f4dcdf25781db3d Mon Sep 17 00:00:00 2001 From: carles Date: Sat, 26 Dec 2009 12:06:35 +0100 Subject: [PATCH 15/21] 2009-12-27 Carles Pina i Estany * 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. --- ChangeLog | 18 ++++++++++++++++++ video/readers/jpeg.c | 18 +++++++++++------- video/readers/png.c | 14 +++++++++----- video/readers/tga.c | 9 +++++---- 4 files changed, 43 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index f309d3cb0..8f44663a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2009-12-27 Carles Pina i Estany + + * 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-27 Carles Pina i Estany * efiemu/main.c (GRUB_MOD_INIT): Fix capitalizations and/or full diff --git a/video/readers/jpeg.c b/video/readers/jpeg.c index 0c3d00bef..e7b69a208 100644 --- a/video/readers/jpeg.c +++ b/video/readers/jpeg.c @@ -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, "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) +GRUB_MOD_FINI (grub_cmd_jpegtest) { #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); diff --git a/video/readers/png.c b/video/readers/png.c index 908672a2e..4e16bf27e 100644 --- a/video/readers/png.c +++ b/video/readers/png.c @@ -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, "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); } diff --git a/video/readers/tga.c b/video/readers/tga.c index c5ff99cfe..d720141e1 100644 --- a/video/readers/tga.c +++ b/video/readers/tga.c @@ -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, - "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); } From 82f3e4125fdcd611689e4e3bd51e5967524bc373 Mon Sep 17 00:00:00 2001 From: carles Date: Sat, 26 Dec 2009 12:08:22 +0100 Subject: [PATCH 16/21] Fix two dates and one typo in ChangeLog. --- ChangeLog | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f44663a0..08f7bfb3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2009-12-27 Carles Pina i Estany +2009-12-26 Carles Pina i Estany * video/readers/jpeg.c (cmd): Declare. (grub_cmd_jpegtest): Use `grub_command_t' type. @@ -16,7 +16,7 @@ Assign to `cmd'. (GRUB_MOD_FINI): Use `cmd' to unregister. -2009-12-27 Carles Pina i Estany +2009-12-26 Carles Pina i Estany * efiemu/main.c (GRUB_MOD_INIT): Fix capitalizations and/or full stops. @@ -43,7 +43,7 @@ summary. (GRUB_MOD_INIT): Remove command name from the summary. * kern/command.c (GRUB_MOD_INIT): If summary is null assign an empty - strig as summary. + 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. From 714af9b9e4d5a0ff99325d58b414438e670c42d2 Mon Sep 17 00:00:00 2001 From: carles Date: Sun, 27 Dec 2009 00:36:59 +0100 Subject: [PATCH 17/21] 2009-12-27 Carles Pina i Estany * 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. --- ChangeLog | 10 ++++++++++ loader/i386/efi/linux.c | 2 +- loader/i386/ieee1275/linux.c | 2 +- loader/i386/linux.c | 2 +- loader/i386/pc/linux.c | 2 +- loader/powerpc/ieee1275/linux.c | 4 ++-- loader/sparc64/ieee1275/linux.c | 4 ++-- loader/xnu.c | 4 ++-- 8 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08f7bfb3c..07dbb52fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-12-27 Carles Pina i Estany + + * 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 * video/readers/jpeg.c (cmd): Declare. diff --git a/loader/i386/efi/linux.c b/loader/i386/efi/linux.c index 0b82ff807..1c256e377 100644 --- a/loader/i386/efi/linux.c +++ b/loader/i386/efi/linux.c @@ -989,7 +989,7 @@ 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."); my_mod = mod; diff --git a/loader/i386/ieee1275/linux.c b/loader/i386/ieee1275/linux.c index 0a76a67b0..b577de964 100644 --- a/loader/i386/ieee1275/linux.c +++ b/loader/i386/ieee1275/linux.c @@ -276,7 +276,7 @@ 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."); my_mod = mod; diff --git a/loader/i386/linux.c b/loader/i386/linux.c index 9ea456b0d..899216783 100644 --- a/loader/i386/linux.c +++ b/loader/i386/linux.c @@ -982,7 +982,7 @@ 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."); my_mod = mod; diff --git a/loader/i386/pc/linux.c b/loader/i386/pc/linux.c index 0e7336214..b93754559 100644 --- a/loader/i386/pc/linux.c +++ b/loader/i386/pc/linux.c @@ -383,7 +383,7 @@ 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."); diff --git a/loader/powerpc/ieee1275/linux.c b/loader/powerpc/ieee1275/linux.c index f03c10ad8..7996a22f6 100644 --- a/loader/powerpc/ieee1275/linux.c +++ b/loader/powerpc/ieee1275/linux.c @@ -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; } diff --git a/loader/sparc64/ieee1275/linux.c b/loader/sparc64/ieee1275/linux.c index 92836e7eb..3af93df7d 100644 --- a/loader/sparc64/ieee1275/linux.c +++ b/loader/sparc64/ieee1275/linux.c @@ -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; } diff --git a/loader/xnu.c b/loader/xnu.c index 114f3f213..f3ae3888a 100644 --- a/loader/xnu.c +++ b/loader/xnu.c @@ -1404,9 +1404,9 @@ 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, From 64fd18edbc8b10be53dd4fe2462bf29cb8b1e18e Mon Sep 17 00:00:00 2001 From: carles Date: Sun, 27 Dec 2009 00:43:21 +0100 Subject: [PATCH 18/21] 2009-12-27 Carles Pina i Estany * 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. --- ChangeLog | 6 ++++++ normal/cmdline.c | 4 ++-- normal/main.c | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07dbb52fe..ebeb7ca93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-12-27 Carles Pina i Estany + + * 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 * loader/i386/efi/linux.c (GRUB_MOD_INIT): Improve command summary. diff --git a/normal/cmdline.c b/normal/cmdline.c index 6d74e6e69..19b83951a 100644 --- a/normal/cmdline.c +++ b/normal/cmdline.c @@ -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); diff --git a/normal/main.c b/normal/main.c index 17e21566d..23de7e238 100644 --- a/normal/main.c +++ b/normal/main.c @@ -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) { From 3e74249c4c98463dac5541c232e8864bbc6ee11a Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 27 Dec 2009 22:21:48 +0100 Subject: [PATCH 19/21] 2009-12-27 Vladimir Serbinenko * video/readers/jpeg.c (GRUB_MOD_FINI (grub_cmd_jpegtest)): Rename to .. (GRUB_MOD_FINI (video_reader_jpeg)): ...this --- ChangeLog | 5 +++++ video/readers/jpeg.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ebeb7ca93..68be8cfe6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-27 Vladimir Serbinenko + + * 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 * normal/cmdline.c (grub_cmdline_get): Print a space after prompt. diff --git a/video/readers/jpeg.c b/video/readers/jpeg.c index e7b69a208..3c3ac33bb 100644 --- a/video/readers/jpeg.c +++ b/video/readers/jpeg.c @@ -740,7 +740,7 @@ GRUB_MOD_INIT (video_reader_jpeg) #endif } -GRUB_MOD_FINI (grub_cmd_jpegtest) +GRUB_MOD_FINI (video_reader_jpeg) { #if defined(JPEG_DEBUG) grub_unregister_command (cmd); From 9c8739a456e7031a605f19ef0504687d853b894c Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 27 Dec 2009 22:32:52 +0100 Subject: [PATCH 20/21] 2009-12-27 Vladimir Serbinenko * normal/menu_text.c (grub_print_message_indented): Prevent past-the-end-of-array dereference. --- ChangeLog | 5 +++++ normal/menu_text.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68be8cfe6..b6d1f02cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-12-27 Vladimir Serbinenko + + * normal/menu_text.c (grub_print_message_indented): Prevent + past-the-end-of-array dereference. + 2009-12-27 Vladimir Serbinenko * video/readers/jpeg.c (GRUB_MOD_FINI (grub_cmd_jpegtest)): Rename to .. diff --git a/normal/menu_text.c b/normal/menu_text.c index 4f2dfb78e..bac15f32b 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -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--; } From c181849b95d42134d9bcb08ade43525ed58024cc Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 28 Dec 2009 01:02:21 +0100 Subject: [PATCH 21/21] 2009-12-27 Vladimir Serbinenko * kern/parser.c (grub_parser_split_cmdline): Don't dereference NULL. --- ChangeLog | 4 ++++ kern/parser.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b6d1f02cc..70e24ef15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-12-27 Vladimir Serbinenko + + * kern/parser.c (grub_parser_split_cmdline): Don't dereference NULL. + 2009-12-27 Vladimir Serbinenko * normal/menu_text.c (grub_print_message_indented): Prevent diff --git a/kern/parser.c b/kern/parser.c index 006d67da7..dd4608ba9 100644 --- a/kern/parser.c +++ b/kern/parser.c @@ -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;