merge mainline to newenv

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-22 14:14:28 +01:00
commit 0866ec655e
60 changed files with 664 additions and 215 deletions

186
ChangeLog
View file

@ -1,3 +1,189 @@
2009-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* commands/lspci.c (grub_pci_classes): Add "USB Controller".
(options): New variable.
(iospace): Likewise.
(grub_lspci_iter): List IO spaces if "-i" was given.
(grub_cmd_lspci): Parse options.
(GRUB_MOD_INIT(lspci)): Use extcmd.
(GRUB_MOD_FINI(lspci)): Likewise.
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* util/grub.d/30_os-prober.in (osx_entry): Remove non POSIX compliant
`function' keyword.
Patch by Tony Mancill <tmancill@debian.org>.
2009-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* bus/usb/uhci.c (grub_uhci_transfer): Set a limit transaction time.
(grub_uhci_portstatus): Likewise.
(grub_uhci_portstatus): Add necessary delay.
* bus/usb/usbhub.c (grub_usb_hub_add_dev): Fix loop-break condition.
2009-12-21 Carles Pina i Estany <carles@pina.cat>
* commands/acpi.c (options): Fix capitalizations and/or full stops.
(GRUB_MOD_INIT): Likewise.
* commands/boot.c (GRUB_MOD_INIT): Likewise.
* commands/cmp.c (grub_cmd_cmp): Improve the help message.
* commands/echo.c (options): Fix capitalizations and/or full stops.
* commands/efi/loadbios.c (enable_rom_area): Likewise.
(enable_rom_area): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/gptsync.c (GRUB_MOD_INIT): Likewise.
* commands/halt.c (GRUB_MOD_INIT): Improve the help message.
* commands/handler.c (GRUB_MOD_INIT): Likewise.
* commands/hdparm.c (options): Fix capitalizations and/or full stops.
* commands/hexdump.c (options): Likewise.
* commands/i386/cpuid.c (options): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/i386/pc/drivemap.c (options): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/i386/pc/halt (options): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/i386/pc/play.c (GRUB_MOD_INIT): Likewise.
* commands/i386/pc/pxecmd.c (options): Likewise.
* commands/i386/pc/vbetest.c (GRUB_MOD_INIT): Likewise.
* commands/ieee1275/suspend.c (GRUB_MOD_INIT): Likewise.
* commands/keystatus.c (options): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/loadenv.c (options): Likewise.
* commands/ls.c (options): 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 (helpmsg): Likewise.
* commands/probe.c (options): Likewise.
* commands/read.c (GRUB_MOD_INIT): Likewise.
* commands/reboot.c (GRUB_MOD_INIT): Likewise.
* commands/search.c (options): Likewise.
* commands/sleep.c (options): Likewise.
* commands/test.c (GRUB_MOD_INIT): Likewise.
* commands/true.c (GRUB_MOD_INIT): Likewise.
* commands/usbtest.c (GRUB_MOD_INIT): Likewise.
* commands/videotest.c (GRUB_MOD_INIT): Likewise.
* lib/arg.c (help_options): Likewise.
* Makefile.in ($(srcdir)/po/$(PACKAGE).pot): Pass -ctranslate to
`$(XGETTEXT)'.
* po/POTFILES: Add `commands/loadenv.c'.
2009-12-21 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrescue.in (process_input_dir): Copy `*.lst' files
instead of specifying them explicit.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* NEWS: Add grub-probe support for GNU/Hurd.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* NEWS: gettext was added after 1.97.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/msdos_partition.h: New file (based on
include/grub/msdos_partition.h).
* util/mkisofs/mkisofs.c (use_protective_msdos_label): New variable.
(OPTION_PROTECTIVE_MSDOS_LABEL): New macro.
(ld_options, main): Recognize --protective-msdos-label.
* util/mkisofs/mkisofs.h (use_protective_msdos_label): New declaration.
* util/mkisofs/write.c: Include `"msdos_partition.h"'.
(padblock_write): If `use_protective_msdos_label' is set, patch a
protective DOS-style label in the output image.
* util/grub-mkrescue.in: Use --protective-msdos-label.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-mkrescue.in: Do not zero-pad image for BIOS-based disk
boot.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/mkisofs.c (use_embedded_boot, boot_image_embed): New
variables.
(ld_options, main): Recognize `--embedded-boot'.
* util/mkisofs/mkisofs.h (use_embedded_boot, boot_image_embed): New
declarations.
* util/mkisofs/write.c (PADBLOCK_SIZE): New variable.
(padblock_size): Use `PADBLOCK_SIZE' instead of hardcoding 16.
(padblock_write): Likewise. Rewrite to support embedded boot image.
* util/grub-mkrescue.in: When building i386-pc images, embed core.img
for BIOS-based disk boot instead of only ElTorito.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-mkrescue.in: Remove `configfile' and `sh' from i386-pc
build (not needed for bootstrap).
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-mkrescue.in: Remove `memdisk', `tar' and `search' modules
from i386-pc build (not needed for bootstrap).
Rewrite a pair of strings.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* normal/main.c (grub_normal_reader_init): Set left margin back to 3.
2009-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* video/i386/pc/vbe.c (grub_video_vbe_fini): Set 'last_set_mode'.
2009-12-21 Andreas Born <futur.andy@googlemail.com>
* kern/env.c (grub_env_context_open): Mark exported variable for
reexport.
2009-12-21 Andreas Born <futur.andy@googlemail.com>
* kern/env.c (grub_env_export): Create nonexistent variables before
exporting.
2009-12-20 Carles Pina i Estany <carles@pina.cat>
* include/grub/auth.h: Include `<grub/i18n.h>'.
(GRUB_GET_PASSWORD): Gettextizze string.
* include/grub/normal.h (STANDARD_MARGIN): New macro, moved from
menu_text.c.
(grub_utf8_to_ucs4_alloc): Fix indentation.
(grub_print_ucs4): Likewise.
(grub_getstringwidth): Likewise.
(print_message_indented): New declaration.
* normal/auth.c: Include `<grub/i18n.h>'.
(grub_auth_check_authentication): Gettexttize string.
* normal/cmdline.c: Include `<grub/i18n.h>'.
(grub_cmdline_get): Gettextizze.
* normal/color.c: Include `<grub/i18n.h>'.
(grub_parse_color_name_pair): Gettexttize strings.
* normal/main.c (grub_normal_reader_init): Cleanup gettexttized
string (use `print_message_indented').
* normal/menu_text.c (STANDARD_MARGIN): Moved from here to
`include/grub/normal.h'.
(print_message_indented): Renamed to ...
(grub_print_message_indented): ... this. Remove `static' qualifer (now
used in normal/main.c).
(print_message): Use `grub_print_message_indented' instead of
`print_message_indented'.
(print_timeout): Likewise.
* normal/misc.c: Include `<grub/term.h>' and `<grub/i18n.h>'.
(grub_normal_print_device_info): Gettexttize strings.
* po/POTFILES: Add `auth.c', `color.c' and `misc.c'.
2009-12-20 Vladimir Serbinenko <phcoder@gmail.com>
* kern/parser.c (grub_parser_split_cmdline): Fix incorrect counting
of arguments. Return number of tokens and not arguments. All users
updated.
2009-12-20 Vladimir Serbinenko <phcoder@gmail.com>
* util/i386/pc/grub-setup.c (setup): Don't install on non-GPT,
non-MSDOS paritions.
2009-12-19 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/types.h (UNUSED): Removed since it conflicts with

View file

@ -484,8 +484,8 @@ genkernsyms.sh: genkernsyms.sh.in config.status
$(SHELL) ./config.status
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ --keyword=N_
cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o $@ -f $< --keyword=_ --keyword=N_
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell
$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot
$(MSGMERGE) -U $@ $^

6
NEWS
View file

@ -1,7 +1,11 @@
New in 1.97 - :
New in 1.98:
* Add grub-probe support for GNU/Hurd.
* Add support for gettext.
New in 1.97:
* Add support for loading XNU (MacOS X kernel).
* ACPI override support.

View file

@ -23,7 +23,6 @@
#include <grub/usb.h>
#include <grub/usbtrans.h>
#include <grub/pci.h>
#include <grub/cpu/pci.h>
#include <grub/i386/io.h>
#include <grub/time.h>
@ -435,6 +434,7 @@ grub_uhci_transfer (grub_usb_controller_t dev,
grub_uhci_td_t td_prev = NULL;
grub_usb_err_t err = GRUB_USB_ERR_NONE;
int i;
grub_uint64_t endtime;
/* Allocate a queue head for the transfer queue. */
qh = grub_alloc_qh (u, GRUB_USB_TRANSACTION_TYPE_CONTROL);
@ -483,6 +483,7 @@ grub_uhci_transfer (grub_usb_controller_t dev,
/* Wait until either the transaction completed or an error
occurred. */
endtime = grub_get_time_ms () + 1000;
for (;;)
{
grub_uhci_td_t errtd;
@ -534,6 +535,13 @@ grub_uhci_transfer (grub_usb_controller_t dev,
updated. */
grub_dprintf ("uhci", "transaction fallthrough\n");
}
if (grub_get_time_ms () > endtime)
{
err = GRUB_USB_ERR_STALL;
grub_dprintf ("uhci", "transaction timed out\n");
goto fail;
}
grub_cpu_idle ();
}
grub_dprintf ("uhci", "transaction complete\n");
@ -573,6 +581,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
struct grub_uhci *u = (struct grub_uhci *) dev->data;
int reg;
unsigned int status;
grub_uint64_t endtime;
grub_dprintf ("uhci", "enable=%d port=%d\n", enable, port);
@ -595,6 +604,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
status = grub_uhci_readreg16 (u, reg);
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
grub_dprintf ("uhci", "reset completed\n");
grub_millisleep (10);
/* Enable the port. */
grub_uhci_writereg16 (u, reg, enable << 2);
@ -602,7 +612,10 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
grub_dprintf ("uhci", "waiting for the port to be enabled\n");
while (! (grub_uhci_readreg16 (u, reg) & (1 << 2)));
endtime = grub_get_time_ms () + 1000;
while (! (grub_uhci_readreg16 (u, reg) & (1 << 2)))
if (grub_get_time_ms () > endtime)
return grub_error (GRUB_ERR_IO, "UHCI Timed out");
status = grub_uhci_readreg16 (u, reg);
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);

View file

@ -48,7 +48,7 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
if (! grub_usb_devs[i])
break;
}
if (grub_usb_devs[i])
if (i == 128)
{
grub_error (GRUB_ERR_IO, "Can't assign address to USB device");
return NULL;
@ -60,6 +60,7 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
| GRUB_USB_REQTYPE_TARGET_DEV),
GRUB_USB_REQ_SET_ADDRESS,
i, 0, 0, NULL);
dev->addr = i;
dev->initialized = 1;
grub_usb_devs[i] = dev;

View file

@ -36,23 +36,23 @@
static const struct grub_arg_option options[] = {
{"exclude", 'x', 0,
"Don't load host tables specified by comma-separated list",
"Don't load host tables specified by comma-separated list.",
0, ARG_TYPE_STRING},
{"load-only", 'n', 0,
"Load only tables specified by comma-separated list", 0, ARG_TYPE_STRING},
{"v1", '1', 0, "Expose v1 tables", 0, ARG_TYPE_NONE},
{"v2", '2', 0, "Expose v2 and v3 tables", 0, ARG_TYPE_NONE},
{"oemid", 'o', 0, "Set OEMID of RSDP, XSDT and RSDT", 0, ARG_TYPE_STRING},
"Load only tables specified by comma-separated list.", 0, ARG_TYPE_STRING},
{"v1", '1', 0, "Expose v1 tables.", 0, ARG_TYPE_NONE},
{"v2", '2', 0, "Expose v2 and v3 tables.", 0, ARG_TYPE_NONE},
{"oemid", 'o', 0, "Set OEMID of RSDP, XSDT and RSDT.", 0, ARG_TYPE_STRING},
{"oemtable", 't', 0,
"Set OEMTABLE ID of RSDP, XSDT and RSDT", 0, ARG_TYPE_STRING},
"Set OEMTABLE ID of RSDP, XSDT and RSDT.", 0, ARG_TYPE_STRING},
{"oemtablerev", 'r', 0,
"Set OEMTABLE revision of RSDP, XSDT and RSDT", 0, ARG_TYPE_INT},
"Set OEMTABLE revision of RSDP, XSDT and RSDT.", 0, ARG_TYPE_INT},
{"oemtablecreator", 'c', 0,
"Set creator field of RSDP, XSDT and RSDT", 0, ARG_TYPE_STRING},
"Set creator field of RSDP, XSDT and RSDT.", 0, ARG_TYPE_STRING},
{"oemtablecreatorrev", 'd', 0,
"Set creator revision of RSDP, XSDT and RSDT", 0, ARG_TYPE_INT},
{"no-ebda", 'e', 0, "Don't update EBDA. May fix failures or hangs on some"
" BIOSes but makes it ineffective with OS not receiving RSDP from GRUB",
"Set creator revision of RSDP, XSDT and RSDT.", 0, ARG_TYPE_INT},
{"no-ebda", 'e', 0, "Don't update EBDA. May fix failures or hangs on some."
" BIOSes but makes it ineffective with OS not receiving RSDP from GRUB.",
0, ARG_TYPE_NONE},
{0, 0, 0, 0, 0, 0}
};
@ -763,7 +763,7 @@ GRUB_MOD_INIT(acpi)
"--load-only=table1,table2] filename1 "
" [filename2] [...]",
"Load host acpi tables and tables "
"specified by arguments",
"specified by arguments.",
options);
}

View file

@ -186,7 +186,7 @@ GRUB_MOD_INIT(boot)
{
cmd_boot =
grub_register_command ("boot", grub_cmd_boot,
0, "boot an operating system");
0, "Boot an operating system.");
}
GRUB_MOD_FINI(boot)

View file

@ -40,7 +40,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
if (argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
grub_printf ("Compare `%s' and `%s':\n", args[0],
grub_printf ("Compare file `%s' with `%s':\n", args[0],
args[1]);
file1 = grub_gzfile_open (args[0], 1);
@ -49,7 +49,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
goto cleanup;
if (grub_file_size (file1) != grub_file_size (file2))
grub_printf ("Differ in size: %llu [%s], %llu [%s]\n",
grub_printf ("Files differ in size: %llu [%s], %llu [%s]\n",
(unsigned long long) grub_file_size (file1), args[0],
(unsigned long long) grub_file_size (file2), args[1]);
else
@ -76,7 +76,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
{
if (buf1[i] != buf2[i])
{
grub_printf ("Differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n",
grub_printf ("Files differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n",
(unsigned long long) (i + pos), buf1[i], args[0],
buf2[i], args[1]);
goto cleanup;

View file

@ -23,8 +23,8 @@
static const struct grub_arg_option options[] =
{
{0, 'n', 0, "do not output the trailing newline", 0, 0},
{0, 'e', 0, "enable interpretation of backslash escapes", 0, 0},
{0, 'n', 0, "Do not output the trailing newline.", 0, 0},
{0, 'e', 0, "Enable interpretation of backslash escapes.", 0, 0},
{0, 0, 0, 0, 0, 0}
};

View file

@ -46,7 +46,7 @@ enable_rom_area (void)
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
if (*rom_ptr != BLANK_MEM)
{
grub_printf ("ROM image present.\n");
grub_printf ("ROM image is present.\n");
return 0;
}
@ -63,7 +63,7 @@ enable_rom_area (void)
*rom_ptr = 0;
if (*rom_ptr != 0)
{
grub_printf ("Can\'t enable rom area.\n");
grub_printf ("Can\'t enable ROM area.\n");
return 0;
}
@ -201,7 +201,7 @@ static grub_command_t cmd_fakebios, cmd_loadbios;
GRUB_MOD_INIT(loadbios)
{
cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
0, "fake bios.");
0, "Fake bios.");
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
"loadbios BIOS_DUMP [INT10_DUMP]",

View file

@ -246,7 +246,7 @@ GRUB_MOD_INIT(gptsync)
"of hybrid mbr. Up to 3 partitions are "
"allowed. TYPE is an MBR type. "
"+ means that partition is active. "
"Only one partition can be active");
"Only one partition can be active.");
}
GRUB_MOD_FINI(gptsync)

View file

@ -35,8 +35,8 @@ static grub_command_t cmd;
GRUB_MOD_INIT(halt)
{
cmd = grub_register_command ("halt", grub_cmd_halt,
0, "halts the computer. This command does not"
" work on all firmware.");
0, "Halts the computer. This command does not"
" work on all firmware implementations.");
}
GRUB_MOD_FINI(halt)

View file

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

View file

@ -26,27 +26,27 @@
#include <grub/extcmd.h>
static const struct grub_arg_option options[] = {
{"apm", 'B', 0, "set Advanced Power Management\n"
"(1=low, ..., 254=high, 255=off)",
{"apm", 'B', 0, "Set Advanced Power Management\n"
"(1=low, ..., 254=high, 255=off).",
0, ARG_TYPE_INT},
{"power", 'C', 0, "check power mode", 0, ARG_TYPE_NONE},
{"security-freeze", 'F', 0, "freeze ATA security settings until reset",
{"power", 'C', 0, "Check power mode.", 0, ARG_TYPE_NONE},
{"security-freeze", 'F', 0, "Freeze ATA security settings until reset.",
0, ARG_TYPE_NONE},
{"health", 'H', 0, "check SMART health status", 0, ARG_TYPE_NONE},
{"aam", 'M', 0, "set Automatic Acoustic Management\n"
"(0=off, 128=quiet, ..., 254=fast)",
{"health", 'H', 0, "Check SMART health status.", 0, ARG_TYPE_NONE},
{"aam", 'M', 0, "Set Automatic Acoustic Management\n"
"(0=off, 128=quiet, ..., 254=fast).",
0, ARG_TYPE_INT},
{"standby-timeout", 'S', 0, "set standby timeout\n"
"(0=off, 1=5s, 2=10s, ..., 240=20m, 241=30m, ...)",
{"standby-timeout", 'S', 0, "Set standby timeout\n"
"(0=off, 1=5s, 2=10s, ..., 240=20m, 241=30m, ...).",
0, ARG_TYPE_INT},
{"standby", 'y', 0, "set drive to standby mode", 0, ARG_TYPE_NONE},
{"sleep", 'Y', 0, "set drive to sleep mode", 0, ARG_TYPE_NONE},
{"identify", 'i', 0, "print drive identity and settings",
{"standby", 'y', 0, "Set drive to standby mode.", 0, ARG_TYPE_NONE},
{"sleep", 'Y', 0, "Set drive to sleep mode.", 0, ARG_TYPE_NONE},
{"identify", 'i', 0, "Print drive identity and settings.",
0, ARG_TYPE_NONE},
{"dumpid", 'I', 0, "dump contents of ATA IDENTIFY sector",
{"dumpid", 'I', 0, "Dump contents of ATA IDENTIFY sector.",
0, ARG_TYPE_NONE},
{"smart", -1, 0, "disable/enable SMART (0/1)", 0, ARG_TYPE_INT},
{"quiet", 'q', 0, "do not print messages", 0, ARG_TYPE_NONE},
{"smart", -1, 0, "Disable/enable SMART (0/1).", 0, ARG_TYPE_INT},
{"quiet", 'q', 0, "Do not print messages.", 0, ARG_TYPE_NONE},
{0, 0, 0, 0, 0, 0}
};

View file

@ -26,9 +26,9 @@
#include <grub/extcmd.h>
static const struct grub_arg_option options[] = {
{"skip", 's', 0, "skip offset bytes from the beginning of file.", 0,
{"skip", 's', 0, "Skip offset bytes from the beginning of file.", 0,
ARG_TYPE_INT},
{"length", 'n', 0, "read only length bytes", 0, ARG_TYPE_INT},
{"length", 'n', 0, "Read only LENGTH bytes.", 0, ARG_TYPE_INT},
{0, 0, 0, 0, 0, 0}
};

View file

@ -33,7 +33,7 @@
static const struct grub_arg_option options[] =
{
{"long-mode", 'l', 0, "check for long mode flag (default)", 0, 0},
{"long-mode", 'l', 0, "Check for long mode flag (default).", 0, 0},
{0, 0, 0, 0, 0, 0}
};
@ -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);
"cpuid [-l]", "Check for CPU features.", options);
}
GRUB_MOD_FINI(cpuid)

View file

@ -33,9 +33,9 @@ static grub_uint32_t *const int13slot = UINT_TO_PTR (4 * 0x13);
/* Remember to update enum opt_idxs accordingly. */
static const struct grub_arg_option options[] = {
{"list", 'l', 0, "show the current mappings", 0, 0},
{"reset", 'r', 0, "reset all mappings to the default values", 0, 0},
{"swap", 's', 0, "perform both direct and reverse mappings", 0, 0},
{"list", 'l', 0, "Show the current mappings.", 0, 0},
{"reset", 'r', 0, "Reset all mappings to the default values.", 0, 0},
{"swap", 's', 0, "Perform both direct and reverse mappings.", 0, 0},
{0, 0, 0, 0, 0, 0}
};
@ -404,7 +404,7 @@ GRUB_MOD_INIT (drivemap)
GRUB_COMMAND_FLAG_BOTH,
"drivemap"
" -l | -r | [-s] grubdev osdisk",
"Manage the BIOS drive mappings",
"Manage the BIOS drive mappings.",
options);
drivemap_hook =
grub_loader_register_preboot_hook (&install_int13_handler,

View file

@ -23,7 +23,7 @@
static const struct grub_arg_option options[] =
{
{"no-apm", 'n', 0, "do not use APM to halt the computer", 0, 0},
{"no-apm", 'n', 0, "Do not use APM to halt the computer.", 0, 0},
{0, 0, 0, 0, 0, 0}
};
@ -47,7 +47,7 @@ GRUB_MOD_INIT(halt)
{
cmd = grub_register_extcmd ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
"halt [-n]",
"Halt the system, if possible using APM",
"Halt the system, if possible using APM.",
options);
}

View file

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

View file

@ -25,9 +25,9 @@
static const struct grub_arg_option options[] =
{
{"info", 'i', 0, "show PXE information.", 0, 0},
{"bsize", 'b', 0, "set PXE block size", 0, ARG_TYPE_INT},
{"unload", 'u', 0, "unload PXE stack.", 0, 0},
{"info", 'i', 0, "Show PXE information.", 0, 0},
{"bsize", 'b', 0, "Set PXE block size.", 0, ARG_TYPE_INT},
{"unload", 'u', 0, "Unload PXE stack.", 0, 0},
{0, 0, 0, 0, 0, 0}
};

View file

@ -168,7 +168,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(vbetest)
{
cmd = grub_register_command ("vbetest", grub_cmd_vbetest,
0, "Test VESA BIOS Extension 2.0+ support");
0, "Test VESA BIOS Extension 2.0+ support.");
}
GRUB_MOD_FINI(vbetest)

View file

@ -39,7 +39,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(ieee1275_suspend)
{
cmd = grub_register_command ("suspend", grub_cmd_suspend,
0, "Return to Open Firmware prompt");
0, "Return to Open Firmware prompt.");
}
GRUB_MOD_FINI(ieee1275_suspend)

View file

@ -24,9 +24,9 @@
static const struct grub_arg_option options[] =
{
{"shift", 's', 0, "check Shift key", 0, 0},
{"ctrl", 'c', 0, "check Control key", 0, 0},
{"alt", 'a', 0, "check Alt key", 0, 0},
{"shift", 's', 0, "Check Shift key.", 0, 0},
{"ctrl", 'c', 0, "Check Control key.", 0, 0},
{"alt", 'a', 0, "Check Alt key.", 0, 0},
{0, 0, 0, 0, 0, 0}
};
@ -71,7 +71,7 @@ GRUB_MOD_INIT(keystatus)
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus,
GRUB_COMMAND_FLAG_BOTH,
"keystatus [--shift] [--ctrl] [--alt]",
"Check key modifier status",
"Check key modifier status.",
options);
}

View file

@ -29,7 +29,7 @@
static const struct grub_arg_option options[] =
{
{"file", 'f', 0, "specify filename", 0, ARG_TYPE_PATHNAME},
{"file", 'f', 0, "Specify filename.", 0, ARG_TYPE_PATHNAME},
{0, 0, 0, 0, 0, 0}
};

View file

@ -33,9 +33,9 @@
static const struct grub_arg_option options[] =
{
{"long", 'l', 0, "show a long list with more detailed information", 0, 0},
{"human-readable", 'h', 0, "print sizes in a human readable format", 0, 0},
{"all", 'a', 0, "list all files", 0, 0},
{"long", 'l', 0, "Show a long list with more detailed information.", 0, 0},
{"human-readable", 'h', 0, "Print sizes in a human readable format.", 0, 0},
{"all", 'a', 0, "List all files.", 0, 0},
{0, 0, 0, 0, 0, 0}
};

View file

@ -20,7 +20,7 @@
#include <grub/pci.h>
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/command.h>
#include <grub/extcmd.h>
struct grub_pci_classname
{
@ -84,6 +84,7 @@ static const struct grub_pci_classname grub_pci_classes[] =
{ 11, 0x30, "MIPS Processor" },
{ 11, 0x40, "Co-Processor" },
{ 11, 0x80, "Unknown Processor" },
{ 12, 3, "USB Controller" },
{ 12, 0x80, "Serial Bus Controller" },
{ 13, 0x80, "Wireless Controller" },
{ 14, 0, "I2O" },
@ -114,12 +115,21 @@ grub_pci_get_class (int class, int subclass)
return 0;
}
static const struct grub_arg_option options[] =
{
{"iospace", 'i', 0, "show I/O spaces", 0, 0},
{0, 0, 0, 0, 0, 0}
};
static int iospace;
static int NESTED_FUNC_ATTR
grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
{
grub_uint32_t class;
const char *sclass;
grub_pci_address_t addr;
int reg;
grub_printf ("%02x:%02x.%x %04x:%04x", grub_pci_get_bus (dev),
grub_pci_get_device (dev), grub_pci_get_function (dev),
@ -143,27 +153,75 @@ grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
grub_printf ("\n");
if (iospace)
{
reg = 4;
while (reg < 10)
{
grub_uint64_t space;
addr = grub_pci_make_address (dev, reg);
space = grub_pci_read (addr);
reg++;
if (space == 0)
continue;
switch (space & GRUB_PCI_ADDR_SPACE_MASK)
{
case GRUB_PCI_ADDR_SPACE_IO:
grub_printf ("\tIO space %d at 0x%llx\n", (reg - 1) - 4,
(unsigned long long)
(space & GRUB_PCI_ADDR_IO_MASK));
break;
case GRUB_PCI_ADDR_SPACE_MEMORY:
if ((space & GRUB_PCI_ADDR_MEM_TYPE_MASK)
== GRUB_PCI_ADDR_MEM_TYPE_64)
{
addr = grub_pci_make_address (dev, reg);
space |= ((grub_uint64_t) grub_pci_read (addr)) << 32;
reg++;
grub_printf ("\t64-bit memory space %d at 0x%016llx [%s]\n",
(reg - 2) - 4, (unsigned long long)
(space & GRUB_PCI_ADDR_MEM_MASK),
space & GRUB_PCI_ADDR_MEM_PREFETCH
? "prefetchable" : "non-prefetchable");
}
else
grub_printf ("\t32-bit memory space %d at 0x%016llx [%s]\n",
(reg - 1) - 4, (unsigned long long)
(space & GRUB_PCI_ADDR_MEM_MASK),
space & GRUB_PCI_ADDR_MEM_PREFETCH
? "prefetchable" : "non-prefetchable");
break;
}
}
}
return 0;
}
static grub_err_t
grub_cmd_lspci (grub_command_t cmd __attribute__ ((unused)),
grub_cmd_lspci (grub_extcmd_t cmd,
int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
{
iospace = cmd->state[0].set;
grub_pci_iterate (grub_lspci_iter);
return GRUB_ERR_NONE;
}
static grub_command_t cmd;
static grub_extcmd_t cmd;
GRUB_MOD_INIT(lspci)
{
cmd = grub_register_command ("lspci", grub_cmd_lspci,
0, "List PCI devices");
cmd = grub_register_extcmd ("lspci", grub_cmd_lspci, GRUB_COMMAND_FLAG_BOTH,
"lspci [-i]", "List PCI devices.", options);
}
GRUB_MOD_FINI(lspci)
{
grub_unregister_command (cmd);
grub_unregister_extcmd (cmd);
}

View file

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

View file

@ -354,28 +354,28 @@ GRUB_MOD_INIT(minicmd)
{
cmd_cat =
grub_register_command ("cat", grub_mini_cmd_cat,
"cat FILE", "show the contents of a file");
"cat FILE", "Show the contents of a file.");
cmd_help =
grub_register_command ("help", grub_mini_cmd_help,
0, "show this message");
0, "Show this message.");
cmd_root =
grub_register_command ("root", grub_mini_cmd_root,
"root [DEVICE]", "set the root device");
"root [DEVICE]", "Set the root device.");
cmd_dump =
grub_register_command ("dump", grub_mini_cmd_dump,
"dump ADDR", "dump memory");
"dump ADDR", "Dump memory.");
cmd_rmmod =
grub_register_command ("rmmod", grub_mini_cmd_rmmod,
"rmmod MODULE", "remove a module");
"rmmod MODULE", "Remove a module.");
cmd_lsmod =
grub_register_command ("lsmod", grub_mini_cmd_lsmod,
0, "show loaded modules");
0, "Show loaded modules.");
cmd_exit =
grub_register_command ("exit", grub_mini_cmd_exit,
0, "exit from GRUB");
0, "Exit from GRUB.");
cmd_clear =
grub_register_command ("clear", grub_mini_cmd_clear,
0, "clear the screen");
0, "Clear the screen.");
}
GRUB_MOD_FINI(minicmd)

View file

@ -34,9 +34,9 @@ static struct grub_parttool *parts = 0;
static int curhandle = 0;
static grub_dl_t mymod;
static char helpmsg[] =
"perform COMMANDS on partition.\n"
"Perform COMMANDS on partition.\n"
"Use \"parttool PARTITION help\" for the list "
"of available commands";
"of available commands.";
int
grub_parttool_register(const char *part_name,

View file

@ -34,12 +34,12 @@
static const struct grub_arg_option options[] =
{
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
"set a variable to return value", "VAR", ARG_TYPE_STRING},
{"driver", 'd', 0, "determine driver", 0, 0},
{"partmap", 'p', 0, "determine partition map type", 0, 0},
{"fs", 'f', 0, "determine filesystem type", 0, 0},
{"fs-uuid", 'u', 0, "determine filesystem UUID", 0, 0},
{"label", 'l', 0, "determine filesystem label", 0, 0},
"Set a variable to return value.", "VAR", ARG_TYPE_STRING},
{"driver", 'd', 0, "Determine driver.", 0, 0},
{"partmap", 'p', 0, "Determine partition map type.", 0, 0},
{"fs", 'f', 0, "Determine filesystem type.", 0, 0},
{"fs-uuid", 'u', 0, "Determine filesystem UUID.", 0, 0},
{"label", 'l', 0, "Determine filesystem label.", 0, 0},
{0, 0, 0, 0, 0, 0}
};

View file

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

View file

@ -35,7 +35,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(reboot)
{
cmd = grub_register_command ("reboot", grub_cmd_reboot,
0, "Reboot the computer");
0, "Reboot the computer.");
}
GRUB_MOD_FINI(reboot)

View file

@ -29,11 +29,11 @@
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},
{"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}
};

View file

@ -27,8 +27,8 @@
static const struct grub_arg_option options[] =
{
{"verbose", 'v', 0, "verbose countdown", 0, 0},
{"interruptible", 'i', 0, "interruptible with ESC", 0, 0},
{"verbose", 'v', 0, "Verbose countdown.", 0, 0},
{"interruptible", 'i', 0, "Interruptible with ESC.", 0, 0},
{0, 0, 0, 0, 0, 0}
};
@ -106,7 +106,7 @@ GRUB_MOD_INIT(sleep)
{
cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
"sleep NUMBER_OF_SECONDS",
"Wait for a specified number of seconds",
"Wait for a specified number of seconds.",
options);
}

View file

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

View file

@ -43,10 +43,10 @@ GRUB_MOD_INIT(true)
{
cmd_true =
grub_register_command ("true", grub_cmd_true,
0, "do nothing, successfully");
0, "Do nothing, successfully.");
cmd_false =
grub_register_command ("false", grub_cmd_false,
0, "do nothing, unsuccessfully");
0, "Do nothing, unsuccessfully.");
}
GRUB_MOD_FINI(true)

View file

@ -195,7 +195,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(usbtest)
{
cmd = grub_register_command ("usb", grub_cmd_usbtest,
0, "Test USB support");
0, "Test USB support.");
}
GRUB_MOD_FINI(usbtest)

View file

@ -178,7 +178,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(videotest)
{
cmd = grub_register_command ("videotest", grub_cmd_videotest,
0, "Test video subsystem");
0, "Test video subsystem.");
}
GRUB_MOD_FINI(videotest)

View file

@ -19,10 +19,11 @@
#define GRUB_AUTH_HEADER 1
#include <grub/err.h>
#include <grub/i18n.h>
/* Macros for indistinguishibility. */
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get ("Enter password: ", \
#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get (N_("Enter password:"), \
string, len, \
'*', 0, 0)

View file

@ -30,6 +30,9 @@
/* The maximum size of a command-line. */
#define GRUB_MAX_CMDLINE 1600
/* The standard left and right margin for some messages. */
#define STANDARD_MARGIN 6
/* The type of a completion item. */
enum grub_completion_type
{
@ -74,11 +77,13 @@ void grub_parse_color_name_pair (grub_uint8_t *ret, const char *name);
/* Defined in `menu_text.c'. */
void grub_wait_after_message (void);
int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
grub_uint32_t **last_position);
grub_uint32_t **last_position);
void grub_print_ucs4 (const grub_uint32_t * str,
const grub_uint32_t * last_position);
const grub_uint32_t * last_position);
grub_ssize_t grub_getstringwidth (grub_uint32_t * str,
const grub_uint32_t * last_position);
const grub_uint32_t * last_position);
void grub_print_message_indented (const char *msg, int margin_left,
int margin_right);
/* Defined in `handler.c'. */
void read_handler_list (void);

View file

@ -142,7 +142,7 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
*(bp++) = *val;
}
*argc = 1;
*argc = 0;
do
{
if (! *rd)
@ -188,12 +188,16 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
state = newstate;
}
} while (state != GRUB_PARSER_STATE_TEXT && !check_varstate (state));
*(bp++) = '\0';
/* A special case for when the last character was part of a
variable. */
add_var (GRUB_PARSER_STATE_TEXT);
if (bp != buffer && *(bp - 1))
{
*(bp++) = '\0';
(*argc)++;
}
/* Reserve memory for the return values. */
args = grub_malloc (bp - buffer);
@ -219,8 +223,6 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
bp++;
}
(*argc)--;
return 0;
}

View file

@ -35,9 +35,12 @@ grub_rescue_parse_line (char *line, grub_reader_getline_t getline)
if (grub_parser_split_cmdline (line, getline, &n, &args) || n < 0)
return grub_errno;
if (n == 0)
return GRUB_ERR_NONE;
/* In case of an assignment set the environment accordingly
instead of calling a function. */
if (n == 0 && grub_strchr (line, '='))
if (n == 1 && grub_strchr (line, '='))
{
char *val = grub_strchr (args[0], '=');
val[0] = 0;
@ -56,7 +59,7 @@ grub_rescue_parse_line (char *line, grub_reader_getline_t getline)
cmd = grub_command_find (name);
if (cmd)
{
(cmd->func) (cmd, n, &args[1]);
(cmd->func) (cmd, n - 1, &args[1]);
}
else
{

View file

@ -30,9 +30,9 @@
static const struct grub_arg_option help_options[] =
{
{"help", SHORT_ARG_HELP, 0,
"display this help and exit", 0, ARG_TYPE_NONE},
"Display this help and exit.", 0, ARG_TYPE_NONE},
{"usage", SHORT_ARG_USAGE, 0,
"display the usage of this command and exit", 0, ARG_TYPE_NONE},
"Display the usage of this command and exit.", 0, ARG_TYPE_NONE},
{0, 0, 0, 0, 0, 0}
};

View file

@ -23,6 +23,7 @@
#include <grub/env.h>
#include <grub/normal.h>
#include <grub/time.h>
#include <grub/i18n.h>
struct grub_auth_user
{
@ -237,7 +238,7 @@ grub_auth_check_authentication (const char *userlist)
return GRUB_ERR_NONE;
}
if (!grub_cmdline_get ("Enter username: ", login, sizeof (login) - 1,
if (!grub_cmdline_get (N_("Enter username:"), login, sizeof (login) - 1,
0, 0, 0))
goto access_denied;

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007 Free Software Foundation, Inc.
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,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
@ -26,6 +26,7 @@
#include <grub/disk.h>
#include <grub/file.h>
#include <grub/env.h>
#include <grub/i18n.h>
static char *kill_buf;
@ -193,6 +194,7 @@ grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
auto void cl_delete (unsigned len);
auto void cl_print (int pos, int c);
auto void cl_set_pos (void);
const char *prompt_translated = _(prompt);
void cl_set_pos (void)
{
@ -266,14 +268,14 @@ grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
grub_refresh ();
}
plen = grub_strlen (prompt);
plen = grub_strlen (prompt_translated);
lpos = llen = 0;
buf[0] = '\0';
if ((grub_getxy () >> 8) != 0)
grub_putchar ('\n');
grub_printf ("%s", prompt);
grub_printf ("%s", prompt_translated);
xpos = plen;
ystart = ypos = (grub_getxy () & 0xFF);
@ -334,7 +336,7 @@ grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
if (restore)
{
/* Restore the prompt. */
grub_printf ("\n%s%s", prompt, buf);
grub_printf ("\n%s %s", prompt_translated, buf);
xpos = plen;
ystart = ypos = (grub_getxy () & 0xFF);
}

View file

@ -20,6 +20,7 @@
#include <grub/mm.h>
#include <grub/normal.h>
#include <grub/term.h>
#include <grub/i18n.h>
/* Borrowed from GRUB Legacy */
static char *color_list[16] =
@ -76,7 +77,7 @@ grub_parse_color_name_pair (grub_uint8_t *ret, const char *name)
bg_name = grub_strchr (fg_name, '/');
if (bg_name == NULL)
{
grub_printf ("Warning: syntax error (missing slash) in `%s'\n", fg_name);
grub_printf_ (N_("Warning: syntax error (missing slash) in `%s'\n"), fg_name);
grub_wait_after_message ();
goto free_and_return;
}
@ -85,13 +86,13 @@ grub_parse_color_name_pair (grub_uint8_t *ret, const char *name)
if (parse_color_name (&fg, fg_name) == -1)
{
grub_printf ("Warning: invalid foreground color `%s'\n", fg_name);
grub_printf_ (N_("Warning: invalid foreground color `%s'\n"), fg_name);
grub_wait_after_message ();
goto free_and_return;
}
if (parse_color_name (&bg, bg_name) == -1)
{
grub_printf ("Warning: invalid background color `%s'\n", bg_name);
grub_printf_ (N_("Warning: invalid background color `%s'\n"), bg_name);
grub_wait_after_message ();
goto free_and_return;
}

View file

@ -409,13 +409,16 @@ grub_normal_do_completion (char *buf, int *restore,
if (grub_parser_split_cmdline (buf, 0, &argc, &argv))
return 0;
current_word = argv[argc];
if (argc == 0)
current_word = "";
else
current_word = argv[argc - 1];
/* Determine the state the command line is in, depending on the
state, it can be determined how to complete. */
cmdline_state = get_state (buf);
if (argc == 0)
if (argc == 1 || argc == 0)
{
/* Complete a command. */
if (grub_command_iterate (iterate_command))
@ -485,13 +488,15 @@ grub_normal_do_completion (char *buf, int *restore,
goto fail;
}
grub_free (argv[0]);
if (argc != 0)
grub_free (argv[0]);
grub_free (match);
return ret;
}
fail:
grub_free (argv[0]);
if (argc != 0)
grub_free (argv[0]);
grub_free (match);
grub_errno = GRUB_ERR_NONE;

View file

@ -84,6 +84,7 @@ grub_env_context_open (int export)
grub_env_context_close ();
return grub_errno;
}
grub_env_export (var->name);
grub_register_variable_hook (var->name, var->read_hook, var->write_hook);
}
}
@ -135,8 +136,16 @@ grub_env_export (const char *name)
struct grub_env_var *var;
var = grub_env_find (name);
if (var)
var->global = 1;
if (! var)
{
grub_err_t err;
err = grub_env_set (name, "");
if (err)
return err;
var = grub_env_find (name);
}
var->global = 1;
return GRUB_ERR_NONE;
}

View file

@ -522,12 +522,21 @@ grub_normal_reader_init (void)
grub_normal_init_page ();
grub_setcursor (1);
grub_printf_ (N_("\
[ Minimal BASH-like line editing is supported. For the first word, TAB\n\
lists possible command completions. Anywhere else TAB lists possible\n\
device/file completions.%s ]\n\n"),
reader_nested ? " ESC at any time exits." : "");
const char *msg = _("Minimal BASH-like line editing is supported. For "
"the first word, TAB lists possible command completions. Anywhere "
"else TAB lists possible device or file completions. %s");
const char *msg_esc = _("ESC at any time exits.");
char *msg_formatted = grub_malloc (sizeof (char) * (grub_strlen (msg) +
grub_strlen(msg_esc) + 1));
grub_sprintf (msg_formatted, msg, reader_nested ? msg_esc : "");
grub_print_message_indented (msg_formatted, 3, STANDARD_MARGIN);
grub_puts ("\n");
grub_free (msg_formatted);
return 0;
}

View file

@ -31,8 +31,6 @@
entry failing to boot. */
#define DEFAULT_ENTRY_ERROR_DELAY_MS 2500
#define STANDARD_MARGIN 6
static grub_uint8_t grub_color_menu_normal;
static grub_uint8_t grub_color_menu_highlight;
@ -106,8 +104,8 @@ grub_getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position)
return width;
}
static void
print_message_indented (const char *msg, int margin_left, int margin_right)
void
grub_print_message_indented (const char *msg, int margin_left, int margin_right)
{
int line_len;
line_len = GRUB_TERM_WIDTH - grub_getcharwidth ('m') *
@ -206,7 +204,7 @@ print_message (int nested, int edit)
if (edit)
{
grub_putchar ('\n');
print_message_indented (_("Minimum Emacs-like screen editing is \
grub_print_message_indented (_("Minimum Emacs-like screen editing is \
supported. TAB lists completions. Press Ctrl-x to boot, Ctrl-c for a \
command-line or ESC to return menu."), STANDARD_MARGIN, STANDARD_MARGIN);
}
@ -220,11 +218,11 @@ entry is highlighted.\n");
grub_sprintf (msg_translated, msg, (grub_uint32_t) GRUB_TERM_DISP_UP,
(grub_uint32_t) GRUB_TERM_DISP_DOWN);
grub_putchar ('\n');
print_message_indented (msg_translated, STANDARD_MARGIN, STANDARD_MARGIN);
grub_print_message_indented (msg_translated, STANDARD_MARGIN, STANDARD_MARGIN);
grub_free (msg_translated);
print_message_indented (_("Press enter to boot the selected OS, \
grub_print_message_indented (_("Press enter to boot the selected OS, \
\'e\' to edit the commands before booting or \'c\' for a command-line.\n"), STANDARD_MARGIN, STANDARD_MARGIN);
if (nested)
@ -403,7 +401,7 @@ print_timeout (int timeout, int offset)
grub_malloc (sizeof (char) * grub_strlen (msg) + 5);
grub_sprintf (msg_translated, msg, timeout);
print_message_indented (msg_translated, 3, 0);
grub_print_message_indented (msg_translated, 3, 0);
int posx;
posx = grub_getxy() >> 8;

View file

@ -1,7 +1,7 @@
/* misc.c - miscellaneous functions */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2007,2008 Free Software Foundation, Inc.
* 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
@ -24,6 +24,8 @@
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/datetime.h>
#include <grub/term.h>
#include <grub/i18n.h>
/* Print the information on the device NAME. */
grub_err_t
@ -34,13 +36,20 @@ grub_normal_print_device_info (const char *name)
p = grub_strchr (name, ',');
if (p)
grub_printf ("\tPartition %s: ", name);
{
grub_putchar ('\t');
grub_printf_ (N_("Partition %s:"), name);
grub_putchar (' ');
}
else
grub_printf ("Device %s: ", name);
{
grub_printf_ (N_("Device %s:"), name);
grub_putchar (' ');
}
dev = grub_device_open (name);
if (! dev)
grub_printf ("Filesystem cannot be accessed");
grub_printf ("%s", _("Filesystem cannot be accessed"));
else if (dev->disk)
{
grub_fs_t fs;
@ -51,7 +60,7 @@ grub_normal_print_device_info (const char *name)
if (fs)
{
grub_printf ("Filesystem type %s", fs->name);
grub_printf_ (N_("Filesystem type %s"), fs->name);
if (fs->label)
{
char *label;
@ -59,7 +68,7 @@ grub_normal_print_device_info (const char *name)
if (grub_errno == GRUB_ERR_NONE)
{
if (label && grub_strlen (label))
grub_printf (", Label %s", label);
grub_printf_ (N_("- Label %s"), label);
grub_free (label);
}
grub_errno = GRUB_ERR_NONE;
@ -72,8 +81,8 @@ grub_normal_print_device_info (const char *name)
if (grub_errno == GRUB_ERR_NONE)
{
grub_unixtime2datetime (tm, &datetime);
grub_printf (", Last modification time %d-%02d-%02d "
"%02d:%02d:%02d %s",
grub_printf_ (N_("- Last modification time %d-%02d-%02d "
"%02d:%02d:%02d %s"),
datetime.year, datetime.month, datetime.day,
datetime.hour, datetime.minute, datetime.second,
grub_get_weekday_name (&datetime));
@ -95,13 +104,13 @@ grub_normal_print_device_info (const char *name)
}
}
else if (! dev->disk->has_partitions || dev->disk->partition)
grub_printf ("Unknown filesystem");
grub_printf ("%s", _("Unknown filesystem"));
else
grub_printf ("Partition table");
grub_printf ("%s", _("Partition table"));
grub_device_close (dev);
}
grub_printf ("\n");
grub_putchar ('\n');
return grub_errno;
}

View file

@ -1,4 +1,6 @@
# List of files which contain translatable strings.
commands/loadenv.c
util/i386/pc/grub-mkimage.c
util/i386/pc/grub-setup.c
@ -11,6 +13,9 @@ util/mkisofs/rock.c
util/mkisofs/tree.c
util/mkisofs/write.c
normal/auth.c
normal/color.c
normal/main.c
normal/menu_entry.c
normal/menu_text.c
normal/misc.c

View file

@ -94,8 +94,7 @@ process_input_dir ()
platform="$2"
mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform}
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
${input_dir}/*.lst; do
if test -f "$file"; then
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
fi
@ -128,7 +127,7 @@ fi
# build coreboot core.img
if test -e "${coreboot_dir}" ; then
echo "Generates coreboot"
echo "Enabling coreboot support ..."
memdisk_img=`mktemp`
memdisk_dir=`mktemp -d`
mkdir -p ${memdisk_dir}/boot/grub
@ -155,14 +154,17 @@ EOF
grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
fi
# build eltorito core.img
# build BIOS core.img
if test -e "${pc_dir}" ; then
echo "Generates eltorito"
echo "Enabling BIOS support ..."
core_img=`mktemp`
grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
memdisk tar search iso9660 configfile sh \
biosdisk
iso9660 biosdisk
cat ${pc_dir}/cdboot.img ${core_img} > ${iso9660_dir}/boot/grub/i386-pc/eltorito.img
embed_img=`mktemp`
cat ${pc_dir}/boot.img ${core_img} > ${embed_img}
rm -f ${core_img}
modules="$(cat ${pc_dir}/partmap.lst) ${modules}"
@ -172,11 +174,14 @@ if test -e "${pc_dir}" ; then
echo "source /boot/grub/grub.cfg") \
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table"
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table \
--embedded-boot ${embed_img}"
fi
# build iso image
grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r ${iso9660_dir} ${source}
grub-mkisofs ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} ${source}
rm -rf ${iso9660_dir}
rm -f ${embed_img}
exit 0

View file

@ -37,7 +37,7 @@ if [ -z "${OSPROBED}" ] ; then
exit 0
fi
function osx_entry {
osx_entry {
cat << EOF
menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" {
EOF

View file

@ -356,8 +356,12 @@ setup (const char *dir,
goto unable_to_embed;
}
grub_partition_iterate (dest_dev->disk, (strcmp (dest_partmap, "part_msdos") ?
find_usable_region_gpt : find_usable_region_msdos));
if (strcmp (dest_partmap, "part_msdos") == 0)
grub_partition_iterate (dest_dev->disk, find_usable_region_msdos);
else if (strcmp (dest_partmap, "part_gpt") == 0)
grub_partition_iterate (dest_dev->disk, find_usable_region_gpt);
else
grub_util_error (_("No DOS-style partitions found"));
if (embed_region.end == embed_region.start)
{

View file

@ -90,6 +90,8 @@ int extension_record_size = 0;
/* These variables are associated with command line options */
int use_eltorito = 0;
int use_eltorito_emul_floppy = 0;
int use_embedded_boot = 0;
int use_protective_msdos_label = 0;
int use_boot_info_table = 0;
int use_RockRidge = 0;
int use_Joliet = 0;
@ -100,17 +102,18 @@ int rationalize = 0;
int generate_tables = 0;
int print_size = 0;
int split_output = 0;
char * preparer = PREPARER_DEFAULT;
char * publisher = PUBLISHER_DEFAULT;
char * appid = APPID_DEFAULT;
char * copyright = COPYRIGHT_DEFAULT;
char * biblio = BIBLIO_DEFAULT;
char * abstract = ABSTRACT_DEFAULT;
char * volset_id = VOLSET_ID_DEFAULT;
char * volume_id = VOLUME_ID_DEFAULT;
char * system_id = SYSTEM_ID_DEFAULT;
char * boot_catalog = BOOT_CATALOG_DEFAULT;
char * boot_image = BOOT_IMAGE_DEFAULT;
char *preparer = PREPARER_DEFAULT;
char *publisher = PUBLISHER_DEFAULT;
char *appid = APPID_DEFAULT;
char *copyright = COPYRIGHT_DEFAULT;
char *biblio = BIBLIO_DEFAULT;
char *abstract = ABSTRACT_DEFAULT;
char *volset_id = VOLSET_ID_DEFAULT;
char *volume_id = VOLUME_ID_DEFAULT;
char *system_id = SYSTEM_ID_DEFAULT;
char *boot_catalog = BOOT_CATALOG_DEFAULT;
char *boot_image = BOOT_IMAGE_DEFAULT;
char *boot_image_embed = NULL;
int volume_set_size = 1;
int volume_sequence_number = 1;
@ -197,6 +200,8 @@ struct ld_option
#define OPTION_VERSION 173
#define OPTION_PROTECTIVE_MSDOS_LABEL 174
static const struct ld_option ld_options[] =
{
{ {"all-files", no_argument, NULL, 'a'},
@ -209,6 +214,10 @@ static const struct ld_option ld_options[] =
'\0', N_("FILE"), N_("Set Bibliographic filename"), ONE_DASH },
{ {"copyright", required_argument, NULL, OPTION_COPYRIGHT},
'\0', N_("FILE"), N_("Set Copyright filename"), ONE_DASH },
{ {"embedded-boot", required_argument, NULL, 'G'},
'G', N_("FILE"), N_("Set embedded boot image name"), TWO_DASHES },
{ {"protective-msdos-label", no_argument, NULL, OPTION_PROTECTIVE_MSDOS_LABEL },
'\0', NULL, N_("Patch a protective DOS-style label in the image"), TWO_DASHES },
{ {"eltorito-boot", required_argument, NULL, 'b'},
'b', N_("FILE"), N_("Set El Torito boot image name"), ONE_DASH },
{ {"eltorito-catalog", required_argument, NULL, 'c'},
@ -719,10 +728,16 @@ int FDECL2(main, int, argc, char **, argv){
use_eltorito++;
boot_image = optarg; /* pathname of the boot image on cd */
if (boot_image == NULL)
{
fprintf (stderr, _("Required boot image pathname missing\n"));
exit (1);
}
error (1, 0, _("Required boot image pathname missing"));
break;
case 'G':
use_embedded_boot = 1;
boot_image_embed = optarg; /* pathname of the boot image on host filesystem */
if (boot_image_embed == NULL)
error (1, 0, _("Required boot image pathname missing"));
break;
case OPTION_PROTECTIVE_MSDOS_LABEL:
use_protective_msdos_label = 1;
break;
case 'c':
use_eltorito++;

View file

@ -296,6 +296,8 @@ extern struct iso_directory_record root_record;
extern struct iso_directory_record jroot_record;
extern int use_eltorito;
extern int use_embedded_boot;
extern int use_protective_msdos_label;
extern int use_eltorito_emul_floppy;
extern int use_boot_info_table;
extern int use_RockRidge;
@ -438,20 +440,21 @@ extern char * extension_record;
extern int extension_record_extent;
extern int n_data_extents;
/* These are a few goodies that can be specified on the command line, and are
/* These are a few goodies that can be specified on the command line, and are
filled into the root record */
extern char * preparer;
extern char * publisher;
extern char * copyright;
extern char * biblio;
extern char * abstract;
extern char * appid;
extern char * volset_id;
extern char * system_id;
extern char * volume_id;
extern char * boot_catalog;
extern char * boot_image;
extern char *preparer;
extern char *publisher;
extern char *copyright;
extern char *biblio;
extern char *abstract;
extern char *appid;
extern char *volset_id;
extern char *system_id;
extern char *volume_id;
extern char *boot_catalog;
extern char *boot_image;
extern char *boot_image_embed;
extern int volume_set_size;
extern int volume_sequence_number;

View file

@ -0,0 +1,75 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2004,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MSDOS_PARTITION_H
#define MSDOS_PARTITION_H 1
#include <stdint.h>
/* The signature. */
#define MSDOS_PARTITION_SIGNATURE ((0xaa << 8) | 0x55)
/* This is not a flag actually, but used as if it were a flag. */
#define MSDOS_PARTITION_TYPE_HIDDEN_FLAG 0x10
/* The partition entry. */
struct msdos_partition_entry
{
/* If active, 0x80, otherwise, 0x00. */
uint8_t flag;
/* The head of the start. */
uint8_t start_head;
/* (S | ((C >> 2) & 0xC0)) where S is the sector of the start and C
is the cylinder of the start. Note that S is counted from one. */
uint8_t start_sector;
/* (C & 0xFF) where C is the cylinder of the start. */
uint8_t start_cylinder;
/* The partition type. */
uint8_t type;
/* The end versions of start_head, start_sector and start_cylinder,
respectively. */
uint8_t end_head;
uint8_t end_sector;
uint8_t end_cylinder;
/* The start sector. Note that this is counted from zero. */
uint32_t start;
/* The length in sector units. */
uint32_t length;
} __attribute__ ((packed));
/* The structure of MBR. */
struct msdos_partition_mbr
{
/* The code area (actually, including BPB). */
uint8_t code[446];
/* Four partition entries. */
struct msdos_partition_entry entries[4];
/* The signature 0xaa55. */
uint16_t signature;
} __attribute__ ((packed));
#endif

View file

@ -21,11 +21,10 @@
along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <string.h>
#include <stdlib.h>
#include "config.h"
#include "mkisofs.h"
#include "iso9660.h"
#include <time.h>
#include <errno.h>
@ -37,6 +36,10 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "mkisofs.h"
#include "iso9660.h"
#include "msdos_partition.h"
#ifdef __SVR4
extern char * strdup(const char *);
@ -1344,6 +1347,9 @@ int FDECL1(oneblock_size, int, starting_extent)
/*
* Functions to describe padding block at the start of the disc.
*/
#define PADBLOCK_SIZE 16
static int FDECL1(pathtab_size, int, starting_extent)
{
path_table[0] = starting_extent;
@ -1357,7 +1363,7 @@ static int FDECL1(pathtab_size, int, starting_extent)
static int FDECL1(padblock_size, int, starting_extent)
{
last_extent += 16;
last_extent += PADBLOCK_SIZE;
return 0;
}
@ -1420,17 +1426,45 @@ static int FDECL1(dirtree_cleanup, FILE *, outfile)
static int FDECL1(padblock_write, FILE *, outfile)
{
char buffer[2048];
int i;
char *buffer;
memset(buffer, 0, sizeof(buffer));
buffer = e_malloc (2048 * PADBLOCK_SIZE);
memset (buffer, 0, 2048 * PADBLOCK_SIZE);
for(i=0; i<16; i++)
if (use_embedded_boot)
{
xfwrite(buffer, 1, sizeof(buffer), outfile);
FILE *fp = fopen (boot_image_embed, "rb");
if (! fp)
error (1, errno, _("Unable to open %s"), boot_image_embed);
fread (buffer, 2048 * PADBLOCK_SIZE, 1, fp);
}
last_extent_written += 16;
if (use_protective_msdos_label)
{
struct msdos_partition_mbr *mbr = (void *) buffer;
memset (mbr->entries, 0, sizeof(mbr->entries));
/* Some idiotic BIOSes refuse to boot if they don't find at least
one partition with active bit set. */
mbr->entries[0].flag = 0x80;
/* Doesn't really matter, as long as it's non-zero. It seems that
0xCD is used elsewhere, so we follow suit. */
mbr->entries[0].type = 0xcd;
/* Start immediately (sector 1). */
mbr->entries[0].start = 1;
/* We don't know yet. Let's keep it safe. */
mbr->entries[0].length = UINT32_MAX;
mbr->signature = MSDOS_PARTITION_SIGNATURE;
}
xfwrite (buffer, 1, 2048 * PADBLOCK_SIZE, outfile);
last_extent_written += PADBLOCK_SIZE;
return 0;
}

View file

@ -356,6 +356,7 @@ grub_video_vbe_fini (void)
if (status != GRUB_VBE_STATUS_OK)
/* TODO: Decide, is this something we want to do. */
return grub_errno;
last_set_mode = initial_vbe_mode;
/* TODO: Free any resources allocated by driver. */
grub_free (vbe_mode_list);