diff --git a/ChangeLog b/ChangeLog
index e594931e1..588c035ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,427 @@
-2009-12-23 Felix Zielcke <fzielcke@z-51.de>
+2009-12-29  Robert Millan  <rmh.grub@aybabtu.com>
+
+	* configure.ac: Check for TARGET_CFLAGS initialization before we
+	initialize it ourselves (sigh).
+	Move a few modifications to TARGET_CFLAGS to be unconditional
+	(extra warning flags, loop alignment, i386 CPU extensions, GCC 4.4
+	eh_frame)
+
+	* gettext/gettext.c (grub_gettext_delete_list): Add `void' argument.
+	* term/i386/pc/at_keyboard.c
+	(keyboard_controller_wait_untill_ready): Likewise.
+	(keyboard_controller_led): Rename `led_status' paramter to avoid
+	name conflict.
+
+2009-12-28  Carles Pina i Estany  <carles@pina.cat>
+
+	* normal/misc.c (grub_normal_print_device_info): Add spaces and double
+	quotes.
+
+2009-12-27  Vladimir Serbinenko  <phcoder@gmail.com>
+
+	* kern/parser.c (grub_parser_split_cmdline): Don't dereference NULL.
+
+2009-12-27  Vladimir Serbinenko  <phcoder@gmail.com>
+
+	* normal/menu_text.c (grub_print_message_indented): Prevent
+	past-the-end-of-array dereference.
+
+2009-12-27  Vladimir Serbinenko  <phcoder@gmail.com>
+
+	* video/readers/jpeg.c (GRUB_MOD_FINI (grub_cmd_jpegtest)): Rename to ..
+	(GRUB_MOD_FINI (video_reader_jpeg)): ...this
+
+2009-12-27  Carles Pina i Estany  <carles@pina.cat>
+
+	* normal/cmdline.c (grub_cmdline_get): Print a space after prompt.
+	* normal/main.c (grub_normal_read_line): Remove a space from the
+	default prompt.
+
+2009-12-27  Carles Pina i Estany  <carles@pina.cat>
+
+	* loader/i386/efi/linux.c (GRUB_MOD_INIT): Improve command summary.
+	* loader/i386/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
+	* loader/i386/linux.c (GRUB_MOD_INIT): Likewise.
+	* loader/i386/pc/linux.c (GRUB_MOD_INIT): Likewise.
+	* loader/powerpc/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
+	* loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
+	* loader/xnu.c (GRUB_MOD_INIT): Likewise.
+
+2009-12-26  Carles Pina i Estany  <carles@pina.cat>
+
+	* video/readers/jpeg.c (cmd): Declare.
+	(grub_cmd_jpegtest): Use `grub_command_t' type.
+	(GRUB_MOD_INIT): Fix arguments passed to `grub_register_command'.
+	Assign to `cmd'.
+	(GRUB_MOD_FINI): Use `cmd' to unregister.
+	* video/readers/png.c (cmd): Declare.
+	(grub_cmd_pngtest): Use `grub_command_t' type.
+	(GRUB_MOD_INIT): Fix arguments passed to `grub_register_command'.
+	Assign to `cmd'.
+	(GRUB_MOD_FINI): Use `cmd' to unregister.
+	* video/readers/tga.c (cmd): Declare.
+	(grub_cmd_tgatest): Use `grub_command_t' type.
+	(GRUB_MOD_INIT): Fix arguments passed to `grub_register_command'.
+	Assign to `cmd'.
+	(GRUB_MOD_FINI): Use `cmd' to unregister.
+
+2009-12-26  Carles Pina i Estany  <carles@pina.cat>
+
+	* efiemu/main.c (GRUB_MOD_INIT): Fix capitalizations and/or full
+	stops.
+	* kern/corecmd.c (grub_register_core_commands): Likewise.
+	* loader/efi/chainloader.c (GRUB_MOD_INIT): Likewise.
+	* loader/i386/bsd.c (GRUB_MOD_INIT): Likewise.
+	* loader/i386/efi/linux.c (GRUB_MOD_INIT): Likewise.
+	* loader/i386/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
+	* loader/i386/linux.c (GRUB_MOD_INIT): Likewise.
+	* loader/i386/pc/chainloader.c (GRUB_MOD_INIT): Likewise.
+	* loader/i386/pc/linux.c (GRUB_MOD_INIT): Likewise.
+	* loader/multiboot_loader.c (GRUB_MOD_INIT): Likewise.
+	* loader/powerpc/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
+	* loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT): Likewise.
+	* loader/xnu.c (GRUB_MOD_INIT): Likewise.
+	* mmap/mmap.c (GRUB_MOD_INIT): Likewise.
+	* normal/handler.c (insert_handler): Likewise.
+	* normal/main.c (GRUB_MOD_INIT): Likewise.
+	* term/gfxterm.c (GRUB_MOD_INIT): Likewise.
+
+2009-12-26  Carles Pina i Estany  <carles@pina.cat>
+
+	* commands/help.c (grub_cmd_help): Print the command name before the
+	summary.
+	(GRUB_MOD_INIT): Remove command name from the summary.
+	* kern/command.c (GRUB_MOD_INIT): If summary is null assign an empty
+	string as summary.
+	* lib/arg.c (find_long): Print the command name before the summary.
+	* commands/acpi.c (GRUB_MOD_INIT): Remove command name from the
+	summary.
+	* commands/blocklist.c (GRUB_MOD_INIT): Likewise.
+	* commands/cat.c (GRUB_MOD_INIT): Likewise.
+	* commands/cmp.c (GRUB_MOD_INIT): Likewise.
+	* commands/configfile.c (GRUB_MOD_INIT): Likewise.
+	* commands/crc.c (GRUB_MOD_INIT): Likewise.
+	* commands/date.c (GRUB_MOD_INIT): Likewise.
+	* commands/echo.c (GRUB_MOD_INIT): Likewise.
+	* commands/efi/loadbios.c (GRUB_MOD_INIT): Likewise.
+	* commands/gptsync.c (GRUB_MOD_INIT): Likewise.
+	* commands/handler.c (GRUB_MOD_INIT): Likewise.
+	* commands/hdparm.c (GRUB_MOD_INIT): Likewise.
+	* commands/hexdump.c (GRUB_MOD_INIT): Likewise.
+	* commands/i386/cpuid.c (GRUB_MOD_INIT): Likewise.
+	* commands/i386/pc/halt.c (GRUB_MOD_INIT): Likewise.
+	* commands/i386/pc/play.c (GRUB_MOD_INIT): Likewise.
+	* commands/i386/pc/pxecmd.c (GRUB_MOD_INIT): Likewise.
+	* commands/keystatus.c (GRUB_MOD_INIT): Likewise.
+	* commands/loadenv.c (GRUB_MOD_INIT): Likewise.
+	* commands/ls.c (GRUB_MOD_INIT): Likewise.
+	* commands/lspci.c (GRUB_MOD_INIT): Likewise.
+	* commands/memrw.c (GRUB_MOD_INIT): Likewise.
+	* commands/minicmd.c (GRUB_MOD_INIT): Likewise.
+	* commands/parttool.c (GRUB_MOD_INIT): Likewise.
+	* commands/password.c (GRUB_MOD_INIT): Likewise.
+	* commands/probe.c (GRUB_MOD_INIT): Likewise.
+	* commands/read.c (GRUB_MOD_INIT): Likewise.
+	* commands/search.c (GRUB_MOD_INIT): Likewise.
+	* commands/sleep.c (GRUB_MOD_INIT): Likewise.
+	* commands/test.c (GRUB_MOD_INIT): Likewise.
+	* commands/xnu_uuid.c (GRUB_MOD_INIT): Likewise.
+	* efiemu/main.c (GRUB_MOD_INIT): Likewise.
+	* font/font_cmd.c (GRUB_MOD_INIT): Likewise.
+	* gettext/gettext.c (GRUB_MOD_INIT): Likewise.
+	* kern/corecmd.c (GRUB_MOD_INIT): Likewise.
+	* lib/arg.c (GRUB_MOD_INIT): Likewise.
+	* loader/efi/appleloader.c (GRUB_MOD_INIT): Likewise.
+	* loader/i386/bsd.c (GRUB_MOD_INIT): Likewise.
+	* loader/xnu.c (GRUB_MOD_INIT): Likewise.
+	* mmap/mmap.c (GRUB_MOD_INIT): Likewise.
+	* term/terminfo.c (GRUB_MOD_INIT): Likewise.
+	* video/readers/jpeg.c (GRUB_MOD_INIT): Likewise.
+	* video/readers/png.c (GRUB_MOD_INIT): Likewise.
+	* video/readers/tga.c (GRUB_MOD_INIT): Likewise.
+
+2009-12-25  Vladimir Serbinenko  <phcoder@gmail.com>
+
+	Use search command for preliminar UUID search.
+
+	* commands/search.c: Split into ...
+	* commands/search_wrap.c: ...this
+	* commands/search.c: ...and this.
+	* commands/search_file.c: New file.
+	* commands/search_label.c: New file.
+	* commands/search_uuid.c: New file.
+	* conf/any-emu.rmk (grub_emu_SOURCES): Remove commands/search.c.
+	Add commands/search_wrap.c, commands/search_file.c,
+	commands/search_label.c and commands/search_uuid.c.
+	* conf/common.rmk (pkglib_MODULES): Remove fs_uuid.mod and fs_file.mod.
+	(search_mod_SOURCES): Set to commands/search_wrap.c.
+	(pkglib_MODULES): Add search_fs_file.mod, search_fs_uuid.mod and
+	search_label.mod.
+	(search_fs_file_mod_SOURCES): New variable.
+	(search_fs_file_mod_CFLAGS): Likewise.
+	(search_fs_file_mod_LDFLAGS): Likewise.
+	(search_label_mod_SOURCES): Likewise.
+	(search_label_mod_CFLAGS): Likewise.
+	(search_label_mod_LDFLAGS): Likewise.
+	(search_fs_uuid_mod_SOURCES): New variable.
+	(search_fs_uuid_mod_CFLAGS): Likewise.
+	(search_fs_uuid_mod_LDFLAGS): Likewise.
+	(fs_file_mod_SOURCES): Removed.
+	(fs_file_mod_CFLAGS): Likewise.
+	(fs_file_mod_LDFLAGS): Likewise.
+	(fs_uuid_mod_SOURCES): Removed.
+	(fs_uuid_mod_CFLAGS): Likewise.
+	(fs_uuid_mod_LDFLAGS): Likewise.
+	* conf/sparc64-ieee1275.rmk (grub_install_SOURCES):
+	Set to util/grub-install.in.
+	* disk/fs_file.c: Removed.
+	* disk/fs_uuid.c: Likewise.
+	* include/grub/search.h: New file.
+	* util/grub-install.in: Handle sparc64.
+	Create and use load.cfg.
+	* util/sparc64/ieee1275/grub-install.in: Removed.
+
+2009-12-25  Vladimir Serbinenko  <phcoder@gmail.com>
+
+	* kern/i386/pc/startup.S (grub_biosdisk_get_diskinfo_int13_extensions):
+	Ignore return status if CF is cleared.
+	(grub_biosdisk_get_diskinfo_standard): Likewise.
+
+2009-12-25  Robert Millan  <rmh.grub@aybabtu.com>
+
+	* term/i386/pc/at_keyboard.c
+	(keyboard_controller_wait_untill_ready): New function.
+	(grub_keyboard_controller_write, grub_keyboard_controller_read)
+	(keyboard_controller_led): Use keyboard_controller_wait_untill_ready()
+	for keyboard polling, rather than duplicate the same loop.  This
+	saves a few bytes in code size.
+
+2009-12-25  Vladimir Serbinenko  <phcoder@gmail.com>
+
+	Support for (pxe[:server[:gateway]]) syntax and
+	use environment variable for PXE.
+
+	* commands/i386/pc/pxecmd.c (options): Removed.
+	(print_ip): Removed.
+	(grub_cmd_pxe): Removed
+	(grub_cmd_pxe_unload): New function.
+	* fs/i386/pc/pxe.c (grub_pxe_disk_data): New structure.
+	(grub_pxe_your_ip): Made static.
+	(grub_pxe_default_server_ip): Likewise.
+	(grub_pxe_default_gateway_ip): Likewise.
+	(grub_pxe_blksize): Likewise.
+	(parse_ip): New function.
+	(grub_pxe_open): Support server and gateway specification.
+	(grub_pxe_close): Free disk->data.
+	(grub_pxefs_open): Use disk->data.
+	(grub_pxefs_read): Likewise.
+	(grub_env_write_readonly): New function.
+	(set_mac_env): Likewise.
+	(set_env_limn_ro): Likewise.
+	(parse_dhcp_vendor): Likewise.
+	(grub_pxe_detect): Set the environment variables.
+	(set_ip_env): New function.
+	(write_ip_env): Likewise.
+	(grub_env_write_pxe_default_server): Likewise.
+	(grub_env_write_pxe_default_gateway): Likewise.
+	(grub_env_write_pxe_blocksize): Likewise.
+	(GRUB_MOD_INIT(pxe)): Set environment variables.
+	* include/grub/i386/pc/pxe.h (grub_pxe_mac_addr): Rename to ...
+	(grub_pxe_mac_addr_t): ... this. All users updated.
+	(grub_pxe_your_ip): Removed.
+	(grub_pxe_server_ip): Likewise.
+	(grub_pxe_gateway_ip): Likewise.
+	(grub_pxe_blksize): Likewise.
+
+2009-12-25  Carles Pina i Estany  <carles@pina.cat>
+
+	* commands/help.c: Include `<grub/i18n.h>'.
+	(grub_cmd_help): Gettextizze.
+	(GRUB_MOD_INIT): Likewise.
+	* commands/i386/pc/play.c: Include `<grub/i18n.h>'.
+	(GRUB_MOD_INIT): Gettextizze.
+	* commands/search.c: Include `<grub/i18n.h>'.
+	(options): Gettextizze.
+	(GRUB_MOD_INIT): Gettextizze.
+	* lib/arg.c: Include `<grub/i18n.h>'.
+	(help_options): Gettextizze.
+	(find_long): Likewise.
+	(grub_arg_show_help): Likewise.
+	* normal/dyncmd.c: Include `<grub/i18n.h>'.
+	(read_command_list): Gettextizze.
+	* po/POTFILES: Add `commands/i386/pc/play.c', `commands/search.c',
+	`commands/help.c', `lib/arg.c' and `normal/dyncmd.c'.
+
+2009-12-25  Robert Millan  <rmh.grub@aybabtu.com>
+
+	* include/grub/i386/at_keyboard.h (NUM_LOCK, SCROLL_LOCK): New macros.
+	* term/i386/pc/at_keyboard.c (KEYBOARD_STATUS_NUM_LOCK)
+	(KEYBOARD_LED_SCROLL, KEYBOARD_LED_NUM, KEYBOARD_LED_CAPS): New macros.
+	(led_status): New variable.
+	(keyboard_controller_led): New function.
+	(grub_at_keyboard_getkey_noblock): Handle num lock and scroll lock,
+	update led status for caps lock, num lock and scroll lock.
+
+2009-12-25  Felix Zielcke <fzielcke@z-51.de>
+
+	* util/hostdisk.c (open_device): Fix a comment.
+
+2009-12-24  Robert Millan  <rmh.grub@aybabtu.com>
+
+	* util/grub-install.in (host_os): New variable.
+	* util/i386/efi/grub-install.in (host_os): Likewise.
+
+2009-12-24  Robert Millan  <rmh.grub@aybabtu.com>
+
+	* util/mkisofs/write.c (padblock_write): Abort when given an
+	excedingly large embed image, instead of silently truncating it.
+
+2009-12-24  Robert Millan  <rmh.grub@aybabtu.com>
+
+	* include/multiboot.h: Indentation fixes.
+
+2009-12-24  Robert Millan  <rmh.grub@aybabtu.com>
+
+	* include/multiboot.h (struct multiboot_aout_symbol_table)
+	(struct multiboot_elf_section_header_table): New structure
+	declarations (stolen from GRUB Legacy).
+	(struct multiboot_info): Replace opaque `syms' with a.out and ELF
+	table information.
+
+	(multiboot_aout_symbol_table_t, multiboot_elf_section_header_table_t)
+	(multiboot_info_t, multiboot_memory_map_t, multiboot_module_t): New
+	type aliases.
+
+2009-12-24  Robert Millan  <rmh.grub@aybabtu.com>
+
+	* include/multiboot.h: Make comments src2texi-friendly.
+
+2009-12-24  Robert Millan  <rmh.grub@aybabtu.com>
+
+	For consistency with [multiboot]/docs/boot.S.
+
+	* include/multiboot.h (MULTIBOOT_MAGIC): Rename from this ...
+	(MULTIBOOT_HEADER_MAGIC): ... to this.  Update all users.
+	(MULTIBOOT_MAGIC2): Rename from this ...
+	(MULTIBOOT_BOOTLOADER_MAGIC): ... to this.  Update all users.
+
+2009-12-24  Robert Millan  <rmh.grub@aybabtu.com>
+
+	* include/multiboot.h: Remove `<grub/types.h>'.
+	(multiboot_uint16_t, multiboot_uint32_t, multiboot_uint64_t): New
+	types.  Update all users.
+
+2009-12-25  Carles Pina i Estany  <carles@pina.cat>
+
+	* commands/efi/loadbios.c: Capitalize acronyms, replace `could not' by
+	`couldn't' and `can not' by `cannot'.
+	* commands/i386/pc/drivemap.c: Likewise.
+	* disk/ata.c: Likewise.
+	* disk/ieee1275/nand.c: Likewise.
+	* fs/affs.c: Likewise.
+	* fs/fat.c: Likewise.
+	* fs/hfs.c: Likewise.
+	* fs/hfsplus.c: Likewise.
+	* fs/iso9660.c: Likewise.
+	* fs/jfs.c: Likewise.
+	* fs/minix.c: Likewise.
+	* fs/reiserfs.c: Likewise.
+	* fs/sfs.c: Likewise.
+	* fs/udf.c: Likewise.
+	* fs/ufs.c: Likewise.
+	* fs/xfs.c: Likewise.
+	* loader/powerpc/ieee1275/linux.c: Likewise.
+	* loader/sparc64/ieee1275/linux.c: Likewise.
+	* util/grub-probe.c: Likewise.
+	* util/misc.c: Likewise.
+
+2009-12-24  Carles Pina i Estany  <carles@pina.cat>
+
+	* bus/usb/usbhub.c: Fix capitalization, fullstop and newlines in
+	grub_errno calls.
+	* commands/acpi.c: Likewise.
+	* commands/blocklist.c: Likewise.
+	* commands/efi/loadbios.c: Likewise.
+	* commands/i386/pc/drivemap.c: Likewise.
+	* commands/loadenv.c: Likewise.
+	* commands/memrw.c: Likewise.
+	* commands/password.c: Likewise.
+	* commands/videotest.c: Likewise.
+	* disk/ata.c: Likewise.
+	* disk/ata_pthru.c: Likewise.
+	* disk/dmraid_nvidia.c: Likewise.
+	* disk/ieee1275/nand.c: Likewise.
+	* disk/ieee1275/ofdisk.c: Likewise.
+	* disk/loopback.c: Likewise.
+	* disk/lvm.c: Likewise.
+	* disk/mdraid_linux.c: Likewise.
+	* disk/raid.c: Likewise.
+	* disk/raid6_recover.c: Likewise.
+	* disk/scsi.c: Likewise.
+	* efiemu/main.c: Likewise.
+	* efiemu/mm.c: Likewise.
+	* efiemu/pnvram.c: Likewise.
+	* efiemu/symbols.c: Likewise.
+	* font/font.c: Likewise.
+	* fs/cpio.c: Likewise.
+	* fs/hfsplus.c: Likewise.
+	* fs/iso9660.c: Likewise.
+	* fs/jfs.c: Likewise.
+	* fs/minix.c: Likewise.
+	* fs/ntfs.c: Likewise.
+	* fs/ntfscomp.c: Likewise.
+	* fs/reiserfs.c: Likewise.
+	* fs/ufs.c: Likewise.
+	* fs/xfs.c: Likewise.
+	* gettext/gettext.c: Likewise.
+	* include/grub/auth.h: Likewise.
+	* kern/elf.c: Likewise.
+	* kern/file.c: Likewise.
+	* kern/ieee1275/init.c: Likewise.
+	* kern/ieee1275/mmap.c: Likewise.
+	* kern/ieee1275/openfw.c: Likewise.
+	* kern/powerpc/dl.c: Likewise.
+	* kern/sparc64/dl.c: Likewise.
+	* lib/arg.c: Likewise.
+	* loader/i386/bsd.c: Likewise.
+	* loader/i386/bsdXX.c: Likewise.
+	* loader/i386/efi/linux.c: Likewise.
+	* loader/i386/efi/xnu.c: Likewise.
+	* loader/i386/ieee1275/linux.c: Likewise.
+	* loader/i386/linux.c: Likewise.
+	* loader/i386/multiboot.c: Likewise.
+	* loader/i386/pc/linux.c: Likewise.
+	* loader/i386/pc/multiboot2.c: Likewise.
+	* loader/i386/xnu.c: Likewise.
+	* loader/ieee1275/multiboot2.c: Likewise.
+	* loader/macho.c: Likewise.
+	* loader/machoXX.c: Likewise.
+	* loader/multiboot2.c: Likewise.
+	* loader/multiboot_loader.c: Likewise.
+	* loader/powerpc/ieee1275/linux.c: Likewise.
+	* loader/sparc64/ieee1275/linux.c: Likewise.
+	* loader/xnu.c: Likewise.
+	* loader/xnu_resume.c: Likewise.
+	* mmap/i386/pc/mmap.c: Likewise.
+	* normal/menu_viewer.c: Likewise.
+	* partmap/acorn.c: Likewise.
+	* partmap/amiga.c: Likewise.
+	* partmap/apple.c: Likewise.
+	* script/lexer.c: Likewise.
+	* term/gfxterm.c: Likewise.
+	* term/i386/pc/serial.c: Likewise.
+	* term/i386/pc/vga.c: Likewise.
+	* term/ieee1275/ofconsole.c: Likewise.
+	* term/terminfo.c: Likewise.
+	* video/bitmap.c: Likewise.
+	* video/efi_gop.c: Likewise.
+	* video/efi_uga.c: Likewise.
+	* video/fb/video_fb.c: Likewise.
+	* video/i386/pc/vbe.c: Likewise.
+	* video/readers/tga.c: Likewise.
+	* video/video.c: Likewise.
+
+2009-12-23  Felix Zielcke <fzielcke@z-51.de>
 
 	* commands/i386/pc/drivemap.c: Remove all trailing whitespace.
 	* commands/lspci.c: Likewise.
@@ -51,7 +474,7 @@
 	* video/efi_gop.c (grub_video_gop_get_bitmask): Fix off-by-one in mask
 	size counting.
 
-2009-12-22 Felix Zielcke <fzielcke@z-51.de>
+2009-12-22  Felix Zielcke <fzielcke@z-51.de>
 
 	* util/grub-mkrescue.in (pkglib_DATA): Set to @pkglib_DATA@.
 	* genmk.rb (class SCRIPT): Modify the target file instead of source.
@@ -69,11 +492,11 @@
 	(grub_cmd_read): Restructure for readability. Support "-v" option.
 	(grub_cmd_write): Restructure for readability.
 
-2009-12-22 Felix Zielcke <fzielcke@z-51.de>
+2009-12-22  Felix Zielcke <fzielcke@z-51.de>
 
 	* genmk.rb (class SCRIPT): Prepend #{src} path with $(srcdir).
 
-2009-12-22 Felix Zielcke <fzielcke@z-51.de>
+2009-12-22  Felix Zielcke <fzielcke@z-51.de>
 
 	* genmk.rb (class SCRIPT): Use sed to substitute @pkglib_DATA@
 	with the actual contents of the correspondending make variable.
@@ -81,7 +504,7 @@
 	(process_input_dir): Copy all $pkglib_DATA files instead of explicitly
 	specifying `*.lst' and `efiemu??.o'
 
-2009-12-22 Felix Zielcke <fzielcke@z-51.de>
+2009-12-22  Felix Zielcke <fzielcke@z-51.de>
 
 	* util/grub.d/30_os-prober.in (osx_entry): Add round brackets
 	after function name.
@@ -97,7 +520,7 @@
 	(GRUB_MOD_INIT(lspci)): Use extcmd.
 	(GRUB_MOD_FINI(lspci)): Likewise.
 
-2009-12-22 Felix Zielcke <fzielcke@z-51.de>
+2009-12-22  Felix Zielcke <fzielcke@z-51.de>
 
 	* util/grub.d/30_os-prober.in (osx_entry): Remove non POSIX compliant
 	`function' keyword.
@@ -157,7 +580,7 @@
 	`$(XGETTEXT)'.
 	* po/POTFILES: Add `commands/loadenv.c'.
 
-2009-12-21 Felix Zielcke <fzielcke@z-51.de>
+2009-12-21  Felix Zielcke <fzielcke@z-51.de>
 
 	* util/grub-mkrescue.in (process_input_dir): Copy `*.lst' files
 	instead of specifying them explicit.
@@ -470,7 +893,7 @@
 	(grub_vbe_get_video_mode): Use 'last_set_mode' if get_mode fails.
 	(grub_video_vbe_setup): Don't check for reserved flag.
 
-2009-12-17 Felix Zielcke <fzielcke@z-51.de>
+2009-12-17  Felix Zielcke <fzielcke@z-51.de>
 
 	* gendistlist.sh: Use POSIX compliant `!' instead of `-not' in
 	the `find' command.
@@ -483,7 +906,7 @@
 	(grub_hfs_fs): New value .uuid.
 	* include/grub/hfs.h (grub_hfs_sblock): New field 'num_serial'.
 
-2009-12-14 Felix Zielcke <fzielcke@z-51.de>
+2009-12-14  Felix Zielcke <fzielcke@z-51.de>
 
 	Fix a segfault with parsing unknown long options.
 
@@ -493,7 +916,7 @@
 
 	* include/grub/misc.h (grub_puts): New declaration.
 	(grub_puts_): Likewise.
-	* kern/mis.c (grub_puts): New definition.
+	* kern/misc.c (grub_puts): New definition.
 	(grub_puts_): Likewise.
 
 2009-12-13  Robert Millan  <rmh.grub@aybabtu.com>
@@ -632,11 +1055,11 @@
 	* include/grub/pciutils.h: New file.
 	* util/pci.c: Likewise.
 
-2009-12-11 Felix Zielcke <fzielcke@z-51.de>
+2009-12-11  Felix Zielcke <fzielcke@z-51.de>
 
 	* util/misc.c: Don't include <errno.h> twice.
 
-2009-12-10 Felix Zielcke <fzielcke@z-51.de>
+2009-12-10  Felix Zielcke <fzielcke@z-51.de>
 
 	* disk/i386/pc/biosdisk.c (grub_biosdisk_open): Show the disk
 	name in an error message.
@@ -732,7 +1155,7 @@
 	* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Recognize
 	anything even prefixed with 'cdrom' as a cdrom.
 
-2009-12-06 Felix Zielcke <fzielcke@z-51.de>
+2009-12-06  Felix Zielcke <fzielcke@z-51.de>
 
 	* util/misc.c (make_system_path_relative_to_its_root): Correctly cope with
 	mount points.
@@ -948,7 +1371,7 @@
 	($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po)): Rewrite as ...
 	(po/%.po): ... this.
 
-2009-11-26 Felix Zielcke <fzielcke@z-51.de>
+2009-11-26  Felix Zielcke <fzielcke@z-51.de>
 
 	* util/i386/efi/grub-mkimage.c: Include "progname.h".
 	(main): Use `program_name' instead of nonexistent `progname'.
diff --git a/boot/i386/pc/lnxboot.S b/boot/i386/pc/lnxboot.S
index c51741d42..43d170c6e 100644
--- a/boot/i386/pc/lnxboot.S
+++ b/boot/i386/pc/lnxboot.S
@@ -185,7 +185,7 @@ real_code_2:
 	call	LOCAL(move_memory)
 
 	/* Check for multiboot signature.  */
-	cmpl	$MULTIBOOT_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
+	cmpl	$MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
 	jz	1f
 
 	movl	(ramdisk_image - start), %esi
diff --git a/bus/usb/usbhub.c b/bus/usb/usbhub.c
index a22ca60c2..523abf93e 100644
--- a/bus/usb/usbhub.c
+++ b/bus/usb/usbhub.c
@@ -50,7 +50,7 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
     }
   if (i == 128)
     {
-      grub_error (GRUB_ERR_IO, "Can't assign address to USB device");
+      grub_error (GRUB_ERR_IO, "can't assign address to USB device");
       return NULL;
     }
 
diff --git a/commands/acpi.c b/commands/acpi.c
index c9acf5abe..ce4e2db36 100644
--- a/commands/acpi.c
+++ b/commands/acpi.c
@@ -277,7 +277,7 @@ grub_acpi_create_ebda (void)
     {
       grub_mmap_unregister (mmapregion);
       return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-			 "Couldn't find suitable spot in EBDA");
+			 "couldn't find suitable spot in EBDA");
     }
 
   /* Remove any other RSDT. */
@@ -551,7 +551,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
 		      grub_free (exclude);
 		      grub_free (load_only);
 		      return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-					 "Couldn't allocate table");
+					 "couldn't allocate table");
 		    }
 		  grub_memcpy (table_dsdt, dsdt, dsdt->length);
 		}
@@ -578,7 +578,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
 	      grub_free (exclude);
 	      grub_free (load_only);
 	      return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-				 "Couldn't allocate table structure");
+				 "couldn't allocate table structure");
 	    }
 	  table->size = curtable->length;
 	  table->addr = grub_malloc (table->size);
@@ -587,7 +587,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
 	    {
 	      free_tables ();
 	      return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-				 "Couldn't allocate table");
+				 "couldn't allocate table");
 	    }
 	  table->next = acpi_tables;
 	  acpi_tables = table;
@@ -674,7 +674,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
 	    {
 	      free_tables ();
 	      return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-				 "Couldn't allocate table structure");
+				 "couldn't allocate table structure");
 	    }
 
 	  table->size = size;
@@ -709,7 +709,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
     {
       free_tables ();
       return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-			 "Couldn't allocate space for ACPI tables");
+			 "couldn't allocate space for ACPI tables");
     }
 
   setup_common_tables ();
@@ -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 b457b7c39..3c9ef3a58 100644
--- a/commands/blocklist.c
+++ b/commands/blocklist.c
@@ -87,7 +87,7 @@ grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
 
   if (! file->device->disk)
     return grub_error (GRUB_ERR_BAD_DEVICE,
-		       "this command is available only for disk devices.");
+		       "this command is available only for disk devices");
 
   if (file->device->disk->partition)
     part_start = grub_partition_get_start (file->device->disk->partition);
@@ -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 d7ad42690..de975c724 100644
--- a/commands/efi/loadbios.c
+++ b/commands/efi/loadbios.c
@@ -160,7 +160,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
   int size;
 
   if (argc == 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "No rom image specified");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no ROM image specified");
 
   if (argc > 1)
     {
@@ -169,7 +169,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
 	return grub_errno;
 
       if (file->size != 4)
-	grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid int10 dump size");
+	grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid int10 dump size");
       else
 	grub_file_read (file, (void *) 0x40, 4);
 
@@ -184,7 +184,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
 
   size = file->size;
   if ((size < 0x10000) || (size > 0x40000))
-    grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid bios dump size");
+    grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid bios dump size");
   else if (enable_rom_area ())
     {
       grub_file_read (file, (void *) VBIOS_ADDR, size);
@@ -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 c18ec6b83..9f0ee7528 100644
--- a/commands/help.c
+++ b/commands/help.c
@@ -21,6 +21,7 @@
 #include <grub/misc.h>
 #include <grub/term.h>
 #include <grub/extcmd.h>
+#include <grub/i18n.h>
 
 static grub_err_t
 grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
@@ -38,13 +39,14 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
 	  (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
 	{
 	  char description[GRUB_TERM_WIDTH / 2];
-	  int desclen = grub_strlen (cmd->summary);
+	  const char* summary_translated = _(cmd->summary);
+	  int desclen = grub_strlen (summary_translated);
 
 	  /* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled
 	     with the description followed by spaces.  */
 	  grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1);
 	  description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
-	  grub_memcpy (description, cmd->summary,
+	  grub_memcpy (description, summary_translated,
 		       (desclen < GRUB_TERM_WIDTH / 2 - 1
 			? desclen : GRUB_TERM_WIDTH / 2 - 1));
 
@@ -65,8 +67,8 @@ 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 ("Usage: %s\n%s\b", cmd->summary,
-			     cmd->description);
+		grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
+			     _(cmd->description));
 	    }
 	}
       return 0;
@@ -94,8 +96,8 @@ GRUB_MOD_INIT(help)
 {
   cmd = grub_register_extcmd ("help", grub_cmd_help,
 			      GRUB_COMMAND_FLAG_CMDLINE,
-			      "help [PATTERN ...]",
-			      "Show a help message.", 0);
+			      N_("[PATTERN ...]"),
+			      N_("Show a help message."), 0);
 }
 
 GRUB_MOD_FINI(help)
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/drivemap.c b/commands/i386/pc/drivemap.c
index 7d1420eea..adef57576 100644
--- a/commands/i386/pc/drivemap.c
+++ b/commands/i386/pc/drivemap.c
@@ -308,7 +308,7 @@ install_int13_handler (int noret __attribute__ ((unused)))
 						GRUB_MACHINE_MEMORY_RESERVED,
 						GRUB_MMAP_MALLOC_LOW);
   if (! handler_base)
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Could not reserve "
+    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't reserve "
 		       "memory for the int13h handler");
 
   /* Copy int13h handler bundle to reserved area.  */
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 6020b825a..96d9f6df5 100644
--- a/commands/i386/pc/play.c
+++ b/commands/i386/pc/play.c
@@ -27,6 +27,7 @@
 #include <grub/machine/time.h>
 #include <grub/cpu/io.h>
 #include <grub/command.h>
+#include <grub/i18n.h>
 
 #define BASE_TEMPO 120
 
@@ -207,7 +208,7 @@ static grub_command_t cmd;
 GRUB_MOD_INIT(play)
 {
   cmd = grub_register_command ("play", grub_cmd_play,
-			       "play FILE", "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 1817898c9..1d4fb6a4d 100644
--- a/commands/i386/pc/pxecmd.c
+++ b/commands/i386/pc/pxecmd.c
@@ -1,7 +1,7 @@
 /* pxe.c - command to control the pxe driver  */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2008  Free Software Foundation, Inc.
+ *  Copyright (C) 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
@@ -21,79 +21,31 @@
 #include <grub/err.h>
 #include <grub/misc.h>
 #include <grub/machine/pxe.h>
-#include <grub/extcmd.h>
-
-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},
-    {0, 0, 0, 0, 0, 0}
-  };
-
-static void
-print_ip (grub_uint32_t ip)
-{
-  int i;
-
-  for (i = 0; i < 3; i++)
-    {
-      grub_printf ("%d.", ip & 0xFF);
-      ip >>= 8;
-    }
-  grub_printf ("%d", ip);
-}
+#include <grub/command.h>
 
 static grub_err_t
-grub_cmd_pxe (grub_extcmd_t cmd, int argc __attribute__ ((unused)),
-	      char **args __attribute__ ((unused)))
+grub_cmd_pxe_unload (grub_command_t cmd __attribute__ ((unused)),
+		     int argc __attribute__ ((unused)),
+		     char **args __attribute__ ((unused)))
 {
-  struct grub_arg_list *state = cmd->state;
-
   if (! grub_pxe_pxenv)
     return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no pxe environment");
 
-  if (state[1].set)
-    {
-      int size;
-
-      size = grub_strtoul (state[1].arg, 0, 0);
-      if (size < GRUB_PXE_MIN_BLKSIZE)
-        size = GRUB_PXE_MIN_BLKSIZE;
-      else if (size > GRUB_PXE_MAX_BLKSIZE)
-        size = GRUB_PXE_MAX_BLKSIZE;
-
-      grub_pxe_blksize = size;
-    }
-
-  if (state[0].set)
-    {
-      grub_printf ("blksize : %d\n", grub_pxe_blksize);
-      grub_printf ("client ip  : ");
-      print_ip (grub_pxe_your_ip);
-      grub_printf ("\nserver ip  : ");
-      print_ip (grub_pxe_server_ip);
-      grub_printf ("\ngateway ip : ");
-      print_ip (grub_pxe_gateway_ip);
-      grub_printf ("\n");
-    }
-
-  if (state[2].set)
-    grub_pxe_unload ();
+  grub_pxe_unload ();
 
   return 0;
 }
 
-static grub_extcmd_t cmd;
+static grub_command_t cmd;
 
 GRUB_MOD_INIT(pxecmd)
 {
-  cmd = grub_register_extcmd ("pxe", grub_cmd_pxe, GRUB_COMMAND_FLAG_BOTH,
-			      "pxe [-i|-b|-u]",
-			      "Command to control the PXE device.", options);
+  cmd = grub_register_command ("pxe_unload", grub_cmd_pxe_unload,
+			       0,
+			       "Unload PXE environment.");
 }
 
 GRUB_MOD_FINI(pxecmd)
 {
-  grub_unregister_extcmd (cmd);
+  grub_unregister_command (cmd);
 }
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 c10dd0e27..6ee4d204a 100644
--- a/commands/loadenv.c
+++ b/commands/loadenv.c
@@ -328,7 +328,7 @@ grub_cmd_save_env (grub_extcmd_t cmd, int argc, char **args)
     }
 
   if (! argc)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "No variable is specified");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no variable is specified");
 
   file = open_envblk_file ((state[0].set) ? state[0].arg : 0);
   if (! file)
@@ -396,7 +396,7 @@ GRUB_MOD_INIT(loadenv)
   cmd_save =
     grub_register_extcmd ("save_env", grub_cmd_save_env,
 			  GRUB_COMMAND_FLAG_BOTH,
-			  "save_env [-f FILE] variable_name [...]",
+			  "[-f FILE] variable_name [...]",
 			  "Save variables to environment block file.",
 			  options);
 }
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 eada1d232..8e9c3db11 100644
--- a/commands/memrw.c
+++ b/commands/memrw.c
@@ -41,7 +41,7 @@ grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
   char buf[sizeof ("XXXXXXXX")];
 
   if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
 
   addr = grub_strtoul (argv[0], 0, 0);
   switch (cmd->cmd->name[sizeof ("read_") - 1])
@@ -78,7 +78,7 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
   grub_uint32_t mask = 0xffffffff;
 
   if (argc != 2 && argc != 3)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
 
   addr = grub_strtoul (argv[0], 0, 0);
   value = grub_strtoul (argv[1], 0, 0);
@@ -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 0e048797e..d9b31f962 100644
--- a/commands/password.c
+++ b/commands/password.c
@@ -53,7 +53,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
   char *pass;
 
   if (argc != 2)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Two arguments expected.");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments expected");
 
   pass = grub_strdup (args[1]);
   if (!pass)
@@ -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 2907daa9f..01e83739b 100644
--- a/commands/search.c
+++ b/commands/search.c
@@ -25,29 +25,12 @@
 #include <grub/device.h>
 #include <grub/file.h>
 #include <grub/env.h>
-#include <grub/extcmd.h>
+#include <grub/command.h>
+#include <grub/search.h>
+#include <grub/i18n.h>
 
-static const struct grub_arg_option options[] =
-  {
-    {"file",		'f', 0, "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 +46,7 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
 	name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9')
       return 0;
 
-    if (type == SEARCH_FILE)
+#ifdef DO_SEARCH_FILE
       {
 	grub_size_t len;
 	char *p;
@@ -84,27 +67,29 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
 	    grub_file_close (file);
 	  }
       }
-    else
+#else
       {
-	/* type is SEARCH_FS_UUID or SEARCH_LABEL */
+	/* SEARCH_FS_UUID or SEARCH_LABEL */
 	grub_device_t dev;
 	grub_fs_t fs;
-	int (*compare_fn) (const char *, const char *);
 	char *quid;
 
 	dev = grub_device_open (name);
 	if (dev)
 	  {
 	    fs = grub_fs_probe (dev);
-	    compare_fn =
-	      (type == SEARCH_FS_UUID) ? grub_strcasecmp : grub_strcmp;
 
-	    if (fs && ((type == SEARCH_FS_UUID) ? fs->uuid : fs->label))
+#ifdef DO_SEARCH_FS_UUID
+#define compare_fn grub_strcasecmp
+#define read_fn uuid
+#else
+#define compare_fn grub_strcmp
+#define read_fn label
+#endif
+
+	    if (fs && fs->read_fn)
 	      {
-		if (type == SEARCH_FS_UUID)
-		  fs->uuid (dev, &quid);
-		else
-		  fs->label (dev, &quid);
+		fs->read_fn (dev, &quid);
 
 		if (grub_errno == GRUB_ERR_NONE && quid)
 		  {
@@ -118,6 +103,7 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
 	    grub_device_close (dev);
 	  }
       }
+#endif
 
     if (found)
       {
@@ -156,45 +142,42 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
 }
 
 static grub_err_t
-grub_cmd_search (grub_extcmd_t cmd, int argc, char **args)
+grub_cmd_do_search (grub_command_t cmd __attribute__ ((unused)), int argc,
+		    char **args)
 {
-  struct grub_arg_list *state = cmd->state;
-  const char *var = 0;
-
   if (argc == 0)
-    return grub_error (GRUB_ERR_INVALID_COMMAND, "no argument specified");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
 
-  if (state[SEARCH_SET].set)
-    var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
-
-  if (state[SEARCH_LABEL].set)
-    search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_LABEL);
-  else if (state[SEARCH_FS_UUID].set)
-    search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_FS_UUID);
-  else if (state[SEARCH_FILE].set)
-    search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_FILE);
-  else
-    return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
+  FUNC_NAME (args[0], argc == 1 ? 0 : args[1], 0);
 
   return grub_errno;
 }
 
-static grub_extcmd_t cmd;
+static grub_command_t cmd;
 
-GRUB_MOD_INIT(search)
+#ifdef DO_SEARCH_FILE
+GRUB_MOD_INIT(search_file)
+#elif defined (DO_SEARCH_FS_UUID)
+GRUB_MOD_INIT(search_fs_uuid)
+#else
+GRUB_MOD_INIT(search_fs_label)
+#endif
 {
   cmd =
-    grub_register_extcmd ("search", grub_cmd_search,
-			  GRUB_COMMAND_FLAG_BOTH,
-			  "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,
+			   "NAME [VARIABLE]",
+			   "Search devices by " SEARCH_TARGET "."
+			   " If VARIABLE is specified, "
+			   "the first device found is set to a variable.");
 }
 
-GRUB_MOD_FINI(search)
+#ifdef DO_SEARCH_FILE
+GRUB_MOD_FINI(search_file)
+#elif defined (DO_SEARCH_FS_UUID)
+GRUB_MOD_FINI(search_fs_uuid)
+#else
+GRUB_MOD_FINI(search_fs_label)
+#endif
 {
-  grub_unregister_extcmd (cmd);
+  grub_unregister_command (cmd);
 }
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..2891d85d7
--- /dev/null
+++ b/commands/search_wrap.c
@@ -0,0 +1,95 @@
+/* search.c - search devices based on a file or a filesystem label */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005,2007,2008,2009  Free Software Foundation, Inc.
+ *
+ *  GRUB is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  GRUB is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <grub/types.h>
+#include <grub/misc.h>
+#include <grub/mm.h>
+#include <grub/err.h>
+#include <grub/dl.h>
+#include <grub/env.h>
+#include <grub/extcmd.h>
+#include <grub/search.h>
+#include <grub/i18n.h>
+
+static const struct grub_arg_option options[] =
+  {
+    {"file",		'f', 0, N_("Search devices by a file."), 0, 0},
+    {"label",		'l', 0, N_("Search devices by a filesystem label."),
+     0, 0},
+    {"fs-uuid",		'u', 0, N_("Search devices by a filesystem UUID."),
+     0, 0},
+    {"set",		's', GRUB_ARG_OPTION_OPTIONAL,
+     N_("Set a variable to the first device found."), "VAR", ARG_TYPE_STRING},
+    {"no-floppy",	'n', 0, N_("Do not probe any floppy drive."), 0, 0},
+    {0, 0, 0, 0, 0, 0}
+  };
+
+enum options
+  {
+    SEARCH_FILE,
+    SEARCH_LABEL,
+    SEARCH_FS_UUID,
+    SEARCH_SET,
+    SEARCH_NO_FLOPPY,
+ };
+
+static grub_err_t
+grub_cmd_search (grub_extcmd_t cmd, int argc, char **args)
+{
+  struct grub_arg_list *state = cmd->state;
+  const char *var = 0;
+
+  if (argc == 0)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
+
+  if (state[SEARCH_SET].set)
+    var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
+
+  if (state[SEARCH_LABEL].set)
+    grub_search_label (args[0], var, state[SEARCH_NO_FLOPPY].set);
+  else if (state[SEARCH_FS_UUID].set)
+    grub_search_fs_uuid (args[0], var, state[SEARCH_NO_FLOPPY].set);
+  else if (state[SEARCH_FILE].set)
+    grub_search_fs_file (args[0], var, state[SEARCH_NO_FLOPPY].set);
+  else
+    return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
+
+  return grub_errno;
+}
+
+static grub_extcmd_t cmd;
+
+GRUB_MOD_INIT(search)
+{
+  cmd =
+    grub_register_extcmd ("search", grub_cmd_search,
+			  GRUB_COMMAND_FLAG_BOTH,
+			  N_("search [-f|-l|-u|-s|-n] NAME"),
+			  N_("Search devices by file, filesystem label"
+			     " or filesystem UUID."
+			     " If --set is specified, the first device found is"
+			     " set to a variable. If no variable name is"
+			     " specified, \"root\" is used."),
+			  options);
+}
+
+GRUB_MOD_FINI(search)
+{
+  grub_unregister_extcmd (cmd);
+}
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/videotest.c b/commands/videotest.c
index 15525524b..e27552510 100644
--- a/commands/videotest.c
+++ b/commands/videotest.c
@@ -71,7 +71,7 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
   sanssmall = grub_font_get ("Helvetica 8");
   fixed = grub_font_get ("Fixed 20");
   if (! sansbig || ! sans || ! sanssmall || ! fixed)
-    return grub_error (GRUB_ERR_BAD_FONT, "No font loaded.");
+    return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
 
   glyph = grub_font_get_glyph (fixed, '*');
   grub_font_draw_glyph (glyph, color, 200 ,0);
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/conf/any-emu.rmk b/conf/any-emu.rmk
index fb97de0a0..c7b2e014c 100644
--- a/conf/any-emu.rmk
+++ b/conf/any-emu.rmk
@@ -8,7 +8,9 @@ util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
 grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c	\
 	commands/configfile.c commands/echo.c commands/help.c		\
 	commands/handler.c commands/ls.c commands/test.c 		\
-	commands/search.c commands/blocklist.c commands/hexdump.c	\
+	commands/search_wrap.c commands/search_file.c			\
+	commands/search_label.c commands/search_uuid.c			\
+	commands/blocklist.c commands/hexdump.c				\
 	lib/hexdump.c commands/halt.c commands/reboot.c			\
 	lib/envblk.c commands/loadenv.c					\
 	commands/gptsync.c commands/probe.c commands/xnu_uuid.c		\
diff --git a/conf/common.rmk b/conf/common.rmk
index 1ed30a404..4fd005777 100644
--- a/conf/common.rmk
+++ b/conf/common.rmk
@@ -381,7 +381,7 @@ scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
 # Commands.
 pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod	\
 	ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod	\
-	fs_file.mod fs_uuid.mod configfile.mod echo.mod		\
+	configfile.mod echo.mod		\
 	terminfo.mod test.mod blocklist.mod hexdump.mod		\
 	read.mod sleep.mod loadenv.mod crc.mod parttool.mod	\
 	msdospart.mod memrw.mod normal.mod sh.mod 		\
@@ -454,10 +454,27 @@ help_mod_CFLAGS = $(COMMON_CFLAGS)
 help_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For search.mod.
-search_mod_SOURCES = commands/search.c
+search_mod_SOURCES = commands/search_wrap.c
 search_mod_CFLAGS = $(COMMON_CFLAGS)
 search_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
+pkglib_MODULES += search_fs_file.mod search_fs_uuid.mod search_label.mod
+
+# For search.mod.
+search_fs_file_mod_SOURCES = commands/search_file.c
+search_fs_file_mod_CFLAGS = $(COMMON_CFLAGS)
+search_fs_file_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+# For search.mod.
+search_label_mod_SOURCES = commands/search_label.c
+search_label_mod_CFLAGS = $(COMMON_CFLAGS)
+search_label_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+# For search.mod.
+search_fs_uuid_mod_SOURCES = commands/search_uuid.c
+search_fs_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
+search_fs_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 # For test.mod.
 test_mod_SOURCES = commands/test.c
 test_mod_CFLAGS = $(COMMON_CFLAGS)
@@ -468,16 +485,6 @@ loopback_mod_SOURCES = disk/loopback.c
 loopback_mod_CFLAGS = $(COMMON_CFLAGS)
 loopback_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
-# For fs_file.mod
-fs_file_mod_SOURCES = disk/fs_file.c
-fs_file_mod_CFLAGS = $(COMMON_CFLAGS)
-fs_file_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
-# For fs_uuid.mod
-fs_uuid_mod_SOURCES = disk/fs_uuid.c
-fs_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
-fs_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
 # For configfile.mod
 configfile_mod_SOURCES = commands/configfile.c
 configfile_mod_CFLAGS = $(COMMON_CFLAGS)
diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk
index 4e90a4d35..9d020a84f 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/configure.ac b/configure.ac
index 6560d3e31..3cac421e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,6 +44,11 @@ AC_CANONICAL_TARGET
 # Program name transformations
 AC_ARG_PROGRAM
 
+# Optimization flag.  Allow user to override.
+if test "x$TARGET_CFLAGS" = x; then
+  TARGET_CFLAGS="$TARGET_CFLAGS -Os"
+fi
+
 case "$target_cpu" in
   i[[3456]]86)	target_cpu=i386 ;;
   sparc)	target_cpu=sparc64 ;;
@@ -242,60 +247,45 @@ CPPFLAGS="$TARGET_CPPFLAGS"
 LDFLAGS="$TARGET_LDFLAGS"
 LIBS=""
 
-if test "x$TARGET_CFLAGS" = x; then
-  # debug flags.
-  TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
-                 -Wundef -Wstrict-prototypes -g"
+# debug flags.
+TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
+               -Wundef -Wstrict-prototypes -g"
 
-  # optimization flags.
-  AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [
-    CFLAGS=-Os
+# Force no alignment to save space on i386.
+if test "x$target_cpu" = xi386; then
+  AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
+    CFLAGS="$CFLAGS -falign-loops=1"
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
-		      [grub_cv_cc_Os=yes],
-		      [grub_cv_cc_Os=no])
+        [grub_cv_cc_falign_loop=yes],
+	[grub_cv_cc_falign_loop=no])
   ])
-  if test "x$grub_cv_cc_Os" = xyes; then
-    TARGET_CFLAGS="$TARGET_CFLAGS -Os"
+
+  if test "x$grub_cv_cc_falign_loop" = xyes; then
+    TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
   else
-    TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
+    TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
   fi
 
-  # Force no alignment to save space on i386.
-  if test "x$target_cpu" = xi386; then
-    AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
-      CFLAGS="$CFLAGS -falign-loops=1"
-      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
-		        [grub_cv_cc_falign_loop=yes],
-			[grub_cv_cc_falign_loop=no])
-    ])
+  # Some toolchains enable these features by default, but they need
+  # registers that aren't set up properly in GRUB.
+  TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
+fi
 
-    if test "x$grub_cv_cc_falign_loop" = xyes; then
-      TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
-    else
-      TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
-    fi
+# By default, GCC 4.4 generates .eh_frame sections containing unwind
+# information in some cases where it previously did not. GRUB doesn't need
+# these and they just use up vital space. Restore the old compiler
+# behaviour.
+AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+      [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
+      [grub_cv_cc_fno_dwarf2_cfi_asm=no])
+  CFLAGS="$SAVE_CFLAGS"
+])
 
-    # Some toolchains enable these features by default, but they need
-    # registers that aren't set up properly in GRUB.
-    TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
-  fi
-
-  # By default, GCC 4.4 generates .eh_frame sections containing unwind
-  # information in some cases where it previously did not. GRUB doesn't need
-  # these and they just use up vital space. Restore the old compiler
-  # behaviour.
-  AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
-    SAVE_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
-		      [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
-		      [grub_cv_cc_fno_dwarf2_cfi_asm=no])
-    CFLAGS="$SAVE_CFLAGS"
-  ])
-
-  if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
-    TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
-  fi
+if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
+  TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
 fi
 
 grub_apple_target_cc
diff --git a/disk/ata.c b/disk/ata.c
index af8c87180..864ae9488 100644
--- a/disk/ata.c
+++ b/disk/ata.c
@@ -281,7 +281,7 @@ grub_ata_identify (struct grub_ata_device *dev)
       else
 	/* Other Error.  */
 	return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
-			   "device can not be identified");
+			   "device cannot be identified");
     }
 
   grub_ata_pio_read (dev, info, GRUB_DISK_SECTOR_SIZE);
@@ -520,7 +520,7 @@ grub_ata_setaddress (struct grub_ata_device *dev,
 	    || cylinder > dev->cylinders
 	    || head > dev->heads)
 	  return grub_error (GRUB_ERR_OUT_OF_RANGE,
-			     "sector %d can not be addressed "
+			     "sector %d cannot be addressed "
 			     "using CHS addressing", sector);
 
 	grub_ata_regset (dev, GRUB_ATA_REG_DISK, (dev->device << 4) | head);
@@ -675,7 +675,7 @@ grub_ata_open (const char *name, grub_disk_t disk)
     }
 
   if (! dev)
-    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
+    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
 
   if (dev->atapi)
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not an ATA harddisk");
@@ -775,7 +775,7 @@ grub_atapi_read (struct grub_scsi *scsi,
 
       /* Count of last transfer may be uneven.  */
       if (! (0 < cnt && cnt <= size - nread && (! (cnt & 1) || cnt == size - nread)))
-	return grub_error (GRUB_ERR_READ_ERROR, "Invalid ATAPI transfer count");
+	return grub_error (GRUB_ERR_READ_ERROR, "invalid ATAPI transfer count");
 
       /* Read the data.  */
       grub_ata_pio_read (dev, buf + nread, cnt);
@@ -821,7 +821,7 @@ grub_atapi_open (const char *name, struct grub_scsi *scsi)
   grub_dprintf ("ata", "opening ATAPI dev `%s'\n", name);
 
   if (! devfnd)
-    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "No such ATAPI device");
+    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no such ATAPI device");
 
   scsi->data = devfnd;
 
diff --git a/disk/ata_pthru.c b/disk/ata_pthru.c
index 70d4f3a78..f52725a49 100644
--- a/disk/ata_pthru.c
+++ b/disk/ata_pthru.c
@@ -30,7 +30,7 @@ grub_ata_pass_through (grub_disk_t disk,
 {
   if (disk->dev->id != GRUB_DISK_DEVICE_ATA_ID)
     return grub_error (GRUB_ERR_BAD_DEVICE,
-		       "Device not accessed via ata.mod");
+		       "device not accessed via ata.mod");
 
   struct grub_ata_device *dev = (struct grub_ata_device *) disk->data;
 
diff --git a/disk/dmraid_nvidia.c b/disk/dmraid_nvidia.c
index ed89854b3..3e4ae33be 100644
--- a/disk/dmraid_nvidia.c
+++ b/disk/dmraid_nvidia.c
@@ -107,7 +107,7 @@ grub_dmraid_nv_detect (grub_disk_t disk, struct grub_raid_array *array)
 
   if (sb.version != NV_VERSION)
     return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-                       "Unknown version: %d.%d", sb.version);
+                       "unknown version: %d.%d", sb.version);
 
   switch (sb.array.raid_level)
     {
@@ -129,7 +129,7 @@ grub_dmraid_nv_detect (grub_disk_t disk, struct grub_raid_array *array)
 
     default:
       return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-                         "Unsupported RAID level: %d", sb.array.raid_level);
+                         "unsupported RAID level: %d", sb.array.raid_level);
     }
 
   array->name = NULL;
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 <http://www.gnu.org/licenses/>.
- */
-
-#include <grub/disk.h>
-#include <grub/dl.h>
-#include <grub/file.h>
-#include <grub/misc.h>
-#include <grub/mm.h>
-#include <grub/partition.h>
-
-static grub_device_t
-search_fs_file (const char *key, unsigned long *count)
-{
-  char *filename = NULL;
-  grub_device_t ret = NULL;
-  *count = 0;
-
-  auto int iterate_device (const char *name);
-  int iterate_device (const char *name)
-  {
-    int len;
-    grub_file_t file;
-
-    (*count)++;
-
-    len = grub_strlen (name) + 2 + grub_strlen (key) + 1;
-    filename = grub_realloc (filename, len);
-    if (! filename)
-      return 1;
-
-    grub_sprintf (filename, "(%s)%s", name, key);
-    file = grub_file_open (filename);
-    if (file)
-      {
-	grub_file_close (file);
-	ret = grub_device_open (name);
-	return 1;
-      }
-
-    grub_errno = GRUB_ERR_NONE;
-    return 0;
-  }
-
-  grub_device_iterate (iterate_device);
-  grub_free (filename);
-
-  return ret;
-}
-
-static grub_err_t
-grub_fs_file_open (const char *name, grub_disk_t disk)
-{
-  grub_device_t dev;
-
-  if (grub_strncmp (name, "FILE=", sizeof ("FILE=") - 1))
-    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a FILE virtual volume");
-
-  dev = search_fs_file (name + sizeof ("FILE=") - 1, &disk->id);
-  if (! dev)
-    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching file found");
-
-  disk->total_sectors = dev->disk->total_sectors;
-  disk->has_partitions = 0;
-  if (dev->disk->partition)
-    {
-      disk->partition = grub_malloc (sizeof (*disk->partition));
-      if (disk->partition)
-	grub_memcpy (disk->partition, dev->disk->partition,
-		     sizeof (*disk->partition));
-    }
-  else
-    disk->partition = NULL;
-
-  disk->data = dev;
-
-  return GRUB_ERR_NONE;
-}
-
-static void
-grub_fs_file_close (grub_disk_t disk)
-{
-  grub_device_t parent = disk->data;
-  grub_device_close (parent);
-}
-
-static grub_err_t
-grub_fs_file_read (grub_disk_t disk, grub_disk_addr_t sector,
-		   grub_size_t size, char *buf)
-{
-  grub_device_t parent = disk->data;
-  return parent->disk->dev->read (parent->disk, sector, size, buf);
-}
-
-static grub_err_t
-grub_fs_file_write (grub_disk_t disk, grub_disk_addr_t sector,
-		    grub_size_t size, const char *buf)
-{
-  grub_device_t parent = disk->data;
-  return parent->disk->dev->write (parent->disk, sector, size, buf);
-}
-
-static struct grub_disk_dev grub_fs_file_dev = {
-  .name = "fs_file",
-  .id = GRUB_DISK_DEVICE_FILE_ID,
-  .open = grub_fs_file_open,
-  .close = grub_fs_file_close,
-  .read = grub_fs_file_read,
-  .write = grub_fs_file_write,
-  .next = 0
-};
-
-GRUB_MOD_INIT (fs_file)
-{
-  grub_disk_dev_register (&grub_fs_file_dev);
-}
-
-GRUB_MOD_FINI (fs_file)
-{
-  grub_disk_dev_unregister (&grub_fs_file_dev);
-}
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 <http://www.gnu.org/licenses/>.
- */
-
-#include <grub/disk.h>
-#include <grub/dl.h>
-#include <grub/kernel.h>
-#include <grub/misc.h>
-#include <grub/mm.h>
-#include <grub/types.h>
-
-#include <grub/fs.h>
-#include <grub/partition.h>
-
-static grub_device_t
-search_fs_uuid (const char *key, unsigned long *count)
-{
-  *count = 0;
-  grub_device_t ret = NULL;
-
-  auto int iterate_device (const char *name);
-  int iterate_device (const char *name)
-    {
-      grub_device_t dev;
-
-      dev = grub_device_open (name);
-      if (dev)
-	{
-	  grub_fs_t fs;
-
-	  fs = grub_fs_probe (dev);
-	  if (fs && fs->uuid)
-	    {
-	      char *uuid;
-
-	      (fs->uuid) (dev, &uuid);
-	      if (grub_errno == GRUB_ERR_NONE && uuid)
-		{
-		  (*count)++;
-
-		  if (grub_strcasecmp (uuid, key) == 0)
-		    {
-		      ret = dev;
-		      grub_free (uuid);
-		      return 1;
-		    }
-		  grub_free (uuid);
-		}
-	    }
-
-	  grub_device_close (dev);
-	}
-
-      grub_errno = GRUB_ERR_NONE;
-      return 0;
-    }
-
-  grub_device_iterate (iterate_device);
-
-  return ret;
-}
-
-static grub_err_t
-grub_fs_uuid_open (const char *name, grub_disk_t disk)
-{
-  grub_device_t dev;
-
-  if (grub_strncmp (name, "UUID=", sizeof ("UUID=")-1))
-    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a UUID virtual volume");
-
-  dev = search_fs_uuid (name + sizeof ("UUID=") - 1, &disk->id);
-  if (! dev)
-    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching UUID found");
-
-  disk->total_sectors = dev->disk->total_sectors;
-  disk->has_partitions = 0;
-  if (dev->disk->partition)
-    {
-      disk->partition = grub_malloc (sizeof (*disk->partition));
-      if (disk->partition)
-	grub_memcpy (disk->partition, dev->disk->partition,
-		     sizeof (*disk->partition));
-    }
-  else
-    disk->partition = NULL;
-
-  disk->data = dev;
-
-  return GRUB_ERR_NONE;
-}
-
-static void
-grub_fs_uuid_close (grub_disk_t disk __attribute((unused)))
-{
-  grub_device_t parent = disk->data;
-  grub_device_close (parent);
-}
-
-static grub_err_t
-grub_fs_uuid_read (grub_disk_t disk, grub_disk_addr_t sector,
-		   grub_size_t size, char *buf)
-{
-  grub_device_t parent = disk->data;
-  return parent->disk->dev->read (parent->disk, sector, size, buf);
-}
-
-static grub_err_t
-grub_fs_uuid_write (grub_disk_t disk, grub_disk_addr_t sector,
-		    grub_size_t size, const char *buf)
-{
-  grub_device_t parent = disk->data;
-  return parent->disk->dev->write (parent->disk, sector, size, buf);
-}
-
-static struct grub_disk_dev grub_fs_uuid_dev =
-  {
-    .name = "fs_uuid",
-    .id = GRUB_DISK_DEVICE_UUID_ID,
-    .open = grub_fs_uuid_open,
-    .close = grub_fs_uuid_close,
-    .read = grub_fs_uuid_read,
-    .write = grub_fs_uuid_write,
-    .next = 0
-  };
-
-GRUB_MOD_INIT(fs_uuid)
-{
-  grub_disk_dev_register (&grub_fs_uuid_dev);
-}
-
-GRUB_MOD_FINI(fs_uuid)
-{
-  grub_disk_dev_unregister (&grub_fs_uuid_dev);
-}
diff --git a/disk/ieee1275/nand.c b/disk/ieee1275/nand.c
index 37427f884..a9ed553cf 100644
--- a/disk/ieee1275/nand.c
+++ b/disk/ieee1275/nand.c
@@ -67,7 +67,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
     } args;
 
   if (! grub_strstr (name, "nand"))
-    return  grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Not a nand device");
+    return  grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a NAND device");
 
   data = grub_malloc (sizeof (*data));
   if (! data)
@@ -76,7 +76,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
   grub_ieee1275_open (name, &dev_ihandle);
   if (! dev_ihandle)
     {
-      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
+      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
       goto fail;
     }
 
@@ -89,7 +89,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
 
   if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
     {
-      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't get block size");
+      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't get block size");
       goto fail;
     }
 
@@ -102,7 +102,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
 
   if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
     {
-      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't get disk size");
+      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't get disk size");
       goto fail;
     }
 
@@ -172,7 +172,7 @@ grub_nand_read (grub_disk_t disk, grub_disk_addr_t sector,
       args.result = 1;
 
       if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
-        return grub_error (GRUB_ERR_READ_ERROR, "Read error");
+        return grub_error (GRUB_ERR_READ_ERROR, "read error");
 
       ofs = 0;
       size -= len;
diff --git a/disk/ieee1275/ofdisk.c b/disk/ieee1275/ofdisk.c
index a33d729e3..c2a3a2c3a 100644
--- a/disk/ieee1275/ofdisk.c
+++ b/disk/ieee1275/ofdisk.c
@@ -175,7 +175,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
   grub_ieee1275_open (op->devpath, &dev_ihandle);
   if (! dev_ihandle)
     {
-      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
+      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
       goto fail;
     }
 
@@ -184,20 +184,20 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
 
   if (grub_ieee1275_finddevice (op->devpath, &dev))
     {
-      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't read device properties");
+      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't read device properties");
       goto fail;
     }
 
   if (grub_ieee1275_get_property (dev, "device_type", prop, sizeof (prop),
 				  &actual))
     {
-      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't read the device type");
+      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't read the device type");
       goto fail;
     }
 
   if (grub_strcmp (prop, "block"))
     {
-      grub_error (GRUB_ERR_BAD_DEVICE, "Not a block device");
+      grub_error (GRUB_ERR_BAD_DEVICE, "not a block device");
       goto fail;
     }
 
@@ -244,12 +244,12 @@ grub_ofdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
 		      (int) (pos >> 32), (int) pos & 0xFFFFFFFFUL, &status);
   if (status < 0)
     return grub_error (GRUB_ERR_READ_ERROR,
-		       "Seek error, can't seek block %llu",
+		       "seek error, can't seek block %llu",
 		       (long long) sector);
   grub_ieee1275_read ((grub_ieee1275_ihandle_t) (unsigned long) disk->data,
 		      buf, size * 512UL, &actual);
   if (actual != actual)
-    return grub_error (GRUB_ERR_READ_ERROR, "Read error on block: %llu",
+    return grub_error (GRUB_ERR_READ_ERROR, "read error on block: %llu",
 		       (long long) sector);
 
   return 0;
diff --git a/disk/loopback.c b/disk/loopback.c
index 29805182e..c877dd8af 100644
--- a/disk/loopback.c
+++ b/disk/loopback.c
@@ -56,7 +56,7 @@ delete_loopback (const char *name)
       break;
 
   if (! dev)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "Device not found");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "device not found");
 
   /* Remove the device from the list.  */
   *prev = dev->next;
@@ -167,7 +167,7 @@ grub_loopback_open (const char *name, grub_disk_t disk)
       break;
 
   if (! dev)
-    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
+    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
 
   file = grub_file_open (dev->filename);
   if (! file)
diff --git a/disk/lvm.c b/disk/lvm.c
index 126b49439..8d0c75a6d 100644
--- a/disk/lvm.c
+++ b/disk/lvm.c
@@ -95,7 +95,7 @@ grub_lvm_open (const char *name, grub_disk_t disk)
     }
 
   if (! lv)
-    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Unknown LVM device %s", name);
+    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown LVM device %s", name);
 
   disk->has_partitions = 0;
   disk->id = lv->number;
@@ -188,7 +188,7 @@ grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
 			  size << GRUB_DISK_SECTOR_BITS, buf);
   else
     err = grub_error (GRUB_ERR_UNKNOWN_DEVICE,
-		      "Physical volume %s not found", pv->name);
+		      "physical volume %s not found", pv->name);
 
   return err;
 }
@@ -263,7 +263,7 @@ grub_lvm_scan_device (const char *name)
   if (dlocn->offset)
     {
       grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-		  "We don't support multiple LVM data areas");
+		  "we don't support multiple LVM data areas");
 
       goto fail;
     }
@@ -290,7 +290,7 @@ grub_lvm_scan_device (const char *name)
       || (grub_le_to_cpu32 (mdah->version) != GRUB_LVM_FMTT_VERSION))
     {
       grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-		  "Unknown LVM metadata header");
+		  "unknown LVM metadata header");
       goto fail2;
     }
 
diff --git a/disk/mdraid_linux.c b/disk/mdraid_linux.c
index 79363d143..d29803719 100644
--- a/disk/mdraid_linux.c
+++ b/disk/mdraid_linux.c
@@ -295,7 +295,7 @@ superblock_0_90:
 
   if (sb.major_version != 0 || sb.minor_version != 90)
     return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-		       "Unsupported RAID version: %d.%d",
+		       "unsupported RAID version: %d.%d",
 		       sb.major_version, sb.minor_version);
 
   /* FIXME: Check the checksum.  */
@@ -307,7 +307,7 @@ superblock_0_90:
   if (sb.level != 0 && sb.level != 1 && sb.level != 4 &&
       sb.level != 5 && sb.level != 6 && sb.level != 10)
     return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-		       "Unsupported RAID level: %d", sb.level);
+		       "unsupported RAID level: %d", sb.level);
 
   array->name = NULL;
   array->number = sb.md_minor;
diff --git a/disk/raid.c b/disk/raid.c
index b88741744..07ae606b9 100644
--- a/disk/raid.c
+++ b/disk/raid.c
@@ -123,7 +123,7 @@ grub_raid_open (const char *name, grub_disk_t disk)
     }
 
   if (!array)
-    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Unknown RAID device %s",
+    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown RAID device %s",
                        name);
 
   disk->has_partitions = 1;
@@ -265,7 +265,7 @@ grub_raid_read (grub_disk_t disk, grub_disk_addr_t sector,
                       }
                     else
                       err = grub_error (GRUB_ERR_READ_ERROR,
-                                        "disk missing.");
+                                        "disk missing");
 
                     k++;
                     if (k == array->total_devs)
diff --git a/disk/raid6_recover.c b/disk/raid6_recover.c
index 7bbf8eaef..ed0e92523 100644
--- a/disk/raid6_recover.c
+++ b/disk/raid6_recover.c
@@ -157,7 +157,7 @@ grub_raid6_recover (struct grub_raid_array *array, int disknr, int p,
 
       if (! array->device[q])
         {
-          grub_error (GRUB_ERR_READ_ERROR, "Not enough disk to restore");
+          grub_error (GRUB_ERR_READ_ERROR, "not enough disk to restore");
           goto quit;
         }
 
@@ -176,7 +176,7 @@ grub_raid6_recover (struct grub_raid_array *array, int disknr, int p,
 
       if ((! array->device[p]) || (! array->device[q]))
         {
-          grub_error (GRUB_ERR_READ_ERROR, "Not enough disk to restore");
+          grub_error (GRUB_ERR_READ_ERROR, "not enough disk to restore");
           goto quit;
         }
 
diff --git a/disk/scsi.c b/disk/scsi.c
index d0e248511..21b888559 100644
--- a/disk/scsi.c
+++ b/disk/scsi.c
@@ -337,14 +337,14 @@ grub_scsi_read (grub_disk_t disk, grub_disk_addr_t sector,
       unsigned spb = scsi->blocksize >> GRUB_DISK_SECTOR_BITS;
       if (! (spb != 0 && (scsi->blocksize & GRUB_DISK_SECTOR_SIZE) == 0))
 	return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-			   "Unsupported SCSI block size");
+			   "unsupported SCSI block size");
 
       grub_uint32_t sector_mod = 0;
       sector = grub_divmod64 (sector, spb, &sector_mod);
 
       if (! (sector_mod == 0 && size % spb == 0))
 	return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-			   "Unaligned SCSI read not supported");
+			   "unaligned SCSI read not supported");
 
       size /= spb;
     }
diff --git a/efiemu/main.c b/efiemu/main.c
index 05787284d..a3cfdb5b5 100644
--- a/efiemu/main.c
+++ b/efiemu/main.c
@@ -214,7 +214,7 @@ grub_efiemu_load_file (const char *filename)
     {
       grub_file_close (file);
       grub_efiemu_unload ();
-      return grub_error (grub_errno, "Couldn't init memory management");
+      return grub_error (grub_errno, "couldn't init memory management");
     }
 
   grub_dprintf ("efiemu", "mm initialized\n");
@@ -328,15 +328,15 @@ GRUB_MOD_INIT(efiemu)
 {
   cmd_loadcore = grub_register_command ("efiemu_loadcore",
 					grub_cmd_efiemu_load,
-				       "efiemu_loadcore FILE",
-				       "Load and initialize EFI emulator");
+				       "FILE",
+				       "Load and initialize EFI emulator.");
   cmd_prepare = grub_register_command ("efiemu_prepare",
 				       grub_cmd_efiemu_prepare,
-				       "efiemu_prepare",
-				       "Finalize loading of EFI emulator");
+				       0,
+				       "Finalize loading of EFI emulator.");
   cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
-				      "efiemu_unload",
-				      "Unload  EFI emulator");
+				      0,
+				      "Unload  EFI emulator.");
 }
 
 GRUB_MOD_FINI(efiemu)
diff --git a/efiemu/mm.c b/efiemu/mm.c
index 8b0322942..6099a14ee 100644
--- a/efiemu/mm.c
+++ b/efiemu/mm.c
@@ -67,7 +67,7 @@ grub_efiemu_add_to_mmap (grub_uint64_t start, grub_uint64_t size,
 		      * sizeof (grub_efi_memory_descriptor_t));
       if (!efiemu_mmap)
 	return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-			   "Not enough space for memory map");
+			   "not enough space for memory map");
     }
 
   /* Fill slot*/
@@ -622,7 +622,7 @@ grub_efiemu_mm_do_alloc (void)
   if (!efiemu_mmap)
     {
       grub_efiemu_unload ();
-      return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Couldn't initialize mmap");
+      return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't initialize mmap");
     }
 
   if ((err = efiemu_alloc_requests ()))
diff --git a/efiemu/pnvram.c b/efiemu/pnvram.c
index 7af01c055..e58fce84e 100644
--- a/efiemu/pnvram.c
+++ b/efiemu/pnvram.c
@@ -78,8 +78,8 @@ unescape (char *in, char *out, char *outmax, int *len)
       }
   if (dptr == outmax)
     return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-		       "Too many NVRAM variables for reserved variable space."
-		       " Try increasing EfiEmu.pnvram.size.");
+		       "too many NVRAM variables for reserved variable space."
+		       " Try increasing EfiEmu.pnvram.size");
   *len = dptr - out;
   return 0;
 }
@@ -132,8 +132,8 @@ nvram_set (void * data __attribute__ ((unused)))
     if (nvramptr - nvram + sizeof (struct efi_variable) > nvramsize)
       {
 	grub_error (GRUB_ERR_OUT_OF_MEMORY,
-		    "Too many NVRAM variables for reserved variable space."
-		    " Try increasing EfiEmu.pnvram.size.");
+		    "too many NVRAM variables for reserved variable space."
+		    " Try increasing EfiEmu.pnvram.size");
 	return 1;
       }
 
@@ -173,7 +173,7 @@ nvram_set (void * data __attribute__ ((unused)))
 
     if (len < 0)
       {
-	grub_error (GRUB_ERR_BAD_ARGUMENT, "Broken UTF-8 in variable name\n");
+	grub_error (GRUB_ERR_BAD_ARGUMENT, "broken UTF-8 in variable name");
 	return 1;
       }
 
diff --git a/efiemu/symbols.c b/efiemu/symbols.c
index 5b9b2aec7..4fc546b59 100644
--- a/efiemu/symbols.c
+++ b/efiemu/symbols.c
@@ -222,7 +222,7 @@ grub_efiemu_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
 
   /* Ensure that we are called only once */
   if (*ptv_relocated)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "EfiEmu is already relocated.");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "EfiEmu is already relocated");
   *ptv_relocated = 1;
 
   /* Correct addresses using information supplied by grub */
diff --git a/font/font.c b/font/font.c
index a81291916..44827a9a1 100644
--- a/font/font.c
+++ b/font/font.c
@@ -210,7 +210,7 @@ open_section (grub_file_t file, struct font_file_section *section)
   else if (retval < 0)
     {
       grub_error (GRUB_ERR_BAD_FONT,
-                  "Font format error: can't read section name");
+                  "font format error: can't read section name");
       return 1;
     }
 
@@ -225,7 +225,7 @@ open_section (grub_file_t file, struct font_file_section *section)
   else if (retval < 0)
     {
       grub_error (GRUB_ERR_BAD_FONT,
-                  "Font format error: can't read section length");
+                  "font format error: can't read section length");
       return 1;
     }
 
@@ -259,7 +259,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
   if ((sect_length % FONT_CHAR_INDEX_ENTRY_SIZE) != 0)
     {
       grub_error (GRUB_ERR_BAD_FONT,
-                  "Font file format error: character index length %d "
+                  "font file format error: character index length %d "
                   "is not a multiple of the entry size %d",
                   sect_length, FONT_CHAR_INDEX_ENTRY_SIZE);
       return 1;
@@ -294,7 +294,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
       if (i != 0 && entry->code <= last_code)
         {
           grub_error (GRUB_ERR_BAD_FONT,
-                      "Font characters not in ascending order: %u <= %u",
+                      "font characters not in ascending order: %u <= %u",
                       entry->code, last_code);
           return 1;
         }
@@ -357,7 +357,7 @@ read_section_as_short (struct font_file_section *section, grub_int16_t *value)
   if (section->length != 2)
     {
       grub_error (GRUB_ERR_BAD_FONT,
-                  "Font file format error: section %c%c%c%c length "
+                  "font file format error: section %c%c%c%c length "
                   "is %d but should be 2",
                   section->name[0], section->name[1],
                   section->name[2], section->name[3],
@@ -403,7 +403,7 @@ grub_font_load (const char *filename)
   if (grub_memcmp (section.name, section_names_file, 4) != 0)
     {
       grub_error (GRUB_ERR_BAD_FONT,
-                  "Font file format error: 1st section must be FILE");
+                  "font file format error: 1st section must be FILE");
       goto fail;
     }
 
@@ -413,7 +413,7 @@ grub_font_load (const char *filename)
   if (section.length != 4)
     {
       grub_error (GRUB_ERR_BAD_FONT,
-                  "Font file format error (file type ID length is %d "
+                  "font file format error (file type ID length is %d "
                   "but should be 4)", section.length);
       goto fail;
     }
@@ -431,7 +431,7 @@ grub_font_load (const char *filename)
 
   if (grub_memcmp (magic, pff2_magic, 4) != 0)
     {
-      grub_error (GRUB_ERR_BAD_FONT, "Invalid font magic %x %x %x %x",
+      grub_error (GRUB_ERR_BAD_FONT, "invalid font magic %x %x %x %x",
                   magic[0], magic[1], magic[2], magic[3]);
       goto fail;
     }
@@ -558,7 +558,7 @@ grub_font_load (const char *filename)
       || font->descent == 0)
     {
       grub_error (GRUB_ERR_BAD_FONT,
-                  "Invalid font file: missing some required data.");
+                  "invalid font file: missing some required data");
       goto fail;
     }
 
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/fs/affs.c b/fs/affs.c
index cfe7d579b..de20fbca1 100644
--- a/fs/affs.c
+++ b/fs/affs.c
@@ -182,14 +182,14 @@ grub_affs_mount (grub_disk_t disk)
   /* Make sure this is an affs filesystem.  */
   if (grub_strncmp ((char *) (data->bblock.type), "DOS", 3))
     {
-      grub_error (GRUB_ERR_BAD_FS, "not an affs filesystem");
+      grub_error (GRUB_ERR_BAD_FS, "not an AFFS filesystem");
       goto fail;
     }
 
   /* Test if the filesystem is a OFS filesystem.  */
   if (! (data->bblock.flags & GRUB_AFFS_FLAG_FFS))
     {
-      grub_error (GRUB_ERR_BAD_FS, "ofs not yet supported");
+      grub_error (GRUB_ERR_BAD_FS, "OFS not yet supported");
       goto fail;
     }
 
@@ -231,7 +231,7 @@ grub_affs_mount (grub_disk_t disk)
     }
   if (-checksum != checksumr)
     {
-      grub_error (GRUB_ERR_BAD_FS, "affs blocksize could not be determined");
+      grub_error (GRUB_ERR_BAD_FS, "AFFS blocksize couldn't be determined");
       goto fail;
     }
   blocksize++;
@@ -248,7 +248,7 @@ grub_affs_mount (grub_disk_t disk)
 
  fail:
   if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
-    grub_error (GRUB_ERR_BAD_FS, "not an affs filesystem");
+    grub_error (GRUB_ERR_BAD_FS, "not an AFFS filesystem");
 
   grub_free (data);
   grub_free (rootblock);
diff --git a/fs/cpio.c b/fs/cpio.c
index 3f3a3d1a0..852c4dcd8 100644
--- a/fs/cpio.c
+++ b/fs/cpio.c
@@ -88,7 +88,7 @@ grub_cpio_find_file (struct grub_cpio_data *data, char **name,
 	return grub_errno;
 
       if (hd.magic != MAGIC_BCPIO)
-	return grub_error (GRUB_ERR_BAD_FS, "Invalid cpio archive");
+	return grub_error (GRUB_ERR_BAD_FS, "invalid cpio archive");
 
       data->size = (((grub_uint32_t) hd.filesize_1) << 16) + hd.filesize_2;
 
@@ -130,7 +130,7 @@ grub_cpio_find_file (struct grub_cpio_data *data, char **name,
 	}
 
       if (grub_memcmp (hd.magic, MAGIC_USTAR, sizeof (MAGIC_USTAR) - 1))
-	return grub_error (GRUB_ERR_BAD_FS, "Invalid tar archive");
+	return grub_error (GRUB_ERR_BAD_FS, "invalid tar archive");
 
       if ((*name = grub_strdup (hd.name)) == NULL)
 	return grub_errno;
diff --git a/fs/fat.c b/fs/fat.c
index ab84ee49a..8a0fc0292 100644
--- a/fs/fat.c
+++ b/fs/fat.c
@@ -338,7 +338,7 @@ grub_fat_mount (grub_disk_t disk)
  fail:
 
   grub_free (data);
-  grub_error (GRUB_ERR_BAD_FS, "not a fat filesystem");
+  grub_error (GRUB_ERR_BAD_FS, "not a FAT filesystem");
   return 0;
 }
 
diff --git a/fs/hfs.c b/fs/hfs.c
index 493455054..4dd1e3131 100644
--- a/fs/hfs.c
+++ b/fs/hfs.c
@@ -365,7 +365,7 @@ grub_hfs_mount (grub_disk_t disk)
   if (grub_hfs_find_node (data, (char *) &key, data->cat_root,
 			  0, (char *) &dir, sizeof (dir)) == 0)
     {
-      grub_error (GRUB_ERR_BAD_FS, "can not find the hfs root directory");
+      grub_error (GRUB_ERR_BAD_FS, "cannot find the HFS root directory");
       goto fail;
     }
 
@@ -379,7 +379,7 @@ grub_hfs_mount (grub_disk_t disk)
   grub_free (data);
 
   if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
-    grub_error (GRUB_ERR_BAD_FS, "not a hfs filesystem");
+    grub_error (GRUB_ERR_BAD_FS, "not a HFS filesystem");
 
   return 0;
 }
diff --git a/fs/hfsplus.c b/fs/hfsplus.c
index 71910330f..9310b6502 100644
--- a/fs/hfsplus.c
+++ b/fs/hfsplus.c
@@ -502,7 +502,7 @@ grub_hfsplus_mount (grub_disk_t disk)
  fail:
 
   if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
-    grub_error (GRUB_ERR_BAD_FS, "not a hfsplus filesystem");
+    grub_error (GRUB_ERR_BAD_FS, "not a HFS+ filesystem");
 
   grub_free (data);
   return 0;
@@ -653,7 +653,7 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree,
 				  btree->nodesize, (char *) node) <= 0)
 	{
 	  grub_free (node);
-	  return grub_error (GRUB_ERR_BAD_FS, "Couldn't read i-node.");
+	  return grub_error (GRUB_ERR_BAD_FS, "couldn't read i-node");
 	}
 
       nodedesc = (struct grub_hfsplus_btnode *) node;
diff --git a/fs/i386/pc/pxe.c b/fs/i386/pc/pxe.c
index 4bab45d35..03385b3e3 100644
--- a/fs/i386/pc/pxe.c
+++ b/fs/i386/pc/pxe.c
@@ -1,7 +1,7 @@
 /* pxe.c - Driver to provide access to the pxe filesystem  */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2008  Free Software Foundation, Inc.
+ *  Copyright (C) 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,7 @@
 #include <grub/file.h>
 #include <grub/misc.h>
 #include <grub/bufio.h>
+#include <grub/env.h>
 
 #include <grub/machine/pxe.h>
 #include <grub/machine/memory.h>
@@ -33,11 +34,17 @@
 #define SEGOFS(x)	((SEGMENT(x) << 16) + OFFSET(x))
 #define LINEAR(x)	(void *) (((x >> 16) <<4) + (x & 0xFFFF))
 
+struct grub_pxe_disk_data
+{
+  grub_uint32_t server_ip;
+  grub_uint32_t gateway_ip;
+};
+
 struct grub_pxenv *grub_pxe_pxenv;
-grub_uint32_t grub_pxe_your_ip;
-grub_uint32_t grub_pxe_server_ip;
-grub_uint32_t grub_pxe_gateway_ip;
-int grub_pxe_blksize = GRUB_PXE_MIN_BLKSIZE;
+static grub_uint32_t grub_pxe_your_ip;
+static grub_uint32_t grub_pxe_default_server_ip;
+static grub_uint32_t grub_pxe_default_gateway_ip;
+static unsigned grub_pxe_blksize = GRUB_PXE_MIN_BLKSIZE;
 
 static grub_file_t curr_file = 0;
 
@@ -56,24 +63,83 @@ grub_pxe_iterate (int (*hook) (const char *name))
   return 0;
 }
 
+static grub_err_t
+parse_ip (const char *val, grub_uint32_t *ip, const char **rest)
+{
+  grub_uint32_t newip = 0;
+  unsigned long t;
+  int i;
+  const char *ptr = val;
+
+  for (i = 0; i < 4; i++)
+    {
+      t = grub_strtoul (ptr, (char **) &ptr, 0);
+      if (grub_errno)
+	return grub_errno;
+      if (t & ~0xff)
+	return grub_error (GRUB_ERR_OUT_OF_RANGE, "Invalid IP.");
+      newip >>= 8;
+      newip |= (t << 24);
+      if (i != 3 && *ptr != '.')
+	return grub_error (GRUB_ERR_OUT_OF_RANGE, "Invalid IP.");
+      ptr++;
+    }
+  *ip = newip;
+  if (rest)
+    *rest = ptr - 1;
+  return 0;
+}
+
 static grub_err_t
 grub_pxe_open (const char *name, grub_disk_t disk)
 {
-  if (grub_strcmp (name, "pxe"))
-      return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a pxe disk");
+  struct grub_pxe_disk_data *data;
+
+  if (grub_strcmp (name, "pxe") != 0
+      && grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) != 0)
+    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a pxe disk");
+
+  data = grub_malloc (sizeof (*data));
+  if (!data)
+    return grub_errno;
+
+  if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0)
+    {
+      const char *ptr;
+      grub_err_t err;
+
+      ptr = name + sizeof ("pxe:") - 1;
+      err = parse_ip (ptr, &(data->server_ip), &ptr);
+      if (err)
+	return err;
+      if (*ptr == ':')
+	{
+	  err = parse_ip (ptr + 1, &(data->server_ip), 0);
+	  if (err)
+	    return err;
+	}
+      else
+	data->gateway_ip = grub_pxe_default_gateway_ip;
+    }
+  else
+    {
+      data->server_ip = grub_pxe_default_server_ip;
+      data->gateway_ip = grub_pxe_default_gateway_ip;
+    }
 
   disk->total_sectors = 0;
-  disk->id = (unsigned long) "pxe";
+  disk->id = (unsigned long) data;
 
   disk->has_partitions = 0;
-  disk->data = 0;
+  disk->data = data;
 
   return GRUB_ERR_NONE;
 }
 
 static void
-grub_pxe_close (grub_disk_t disk __attribute((unused)))
+grub_pxe_close (grub_disk_t disk)
 {
+  grub_free (disk->data);
 }
 
 static grub_err_t
@@ -125,6 +191,7 @@ grub_pxefs_open (struct grub_file *file, const char *name)
       struct grub_pxenv_tftp_open c2;
     } c;
   struct grub_pxe_data *data;
+  struct grub_pxe_disk_data *disk_data = file->device->disk->data;
   grub_file_t file_int, bufio;
 
   if (curr_file != 0)
@@ -133,8 +200,8 @@ grub_pxefs_open (struct grub_file *file, const char *name)
       curr_file = 0;
     }
 
-  c.c1.server_ip = grub_pxe_server_ip;
-  c.c1.gateway_ip = grub_pxe_gateway_ip;
+  c.c1.server_ip = disk_data->server_ip;
+  c.c1.gateway_ip = disk_data->gateway_ip;
   grub_strcpy ((char *)&c.c1.filename[0], name);
   grub_pxe_call (GRUB_PXENV_TFTP_GET_FSIZE, &c.c1);
   if (c.c1.status)
@@ -184,6 +251,7 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
 {
   struct grub_pxenv_tftp_read c;
   struct grub_pxe_data *data;
+  struct grub_pxe_disk_data *disk_data = file->device->disk->data;
   grub_uint32_t pn, r;
 
   data = file->data;
@@ -203,8 +271,8 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
       if (curr_file != 0)
         grub_pxe_call (GRUB_PXENV_TFTP_CLOSE, &o);
 
-      o.server_ip = grub_pxe_server_ip;
-      o.gateway_ip = grub_pxe_gateway_ip;
+      o.server_ip = disk_data->server_ip;
+      o.gateway_ip = disk_data->gateway_ip;
       grub_strcpy ((char *)&o.filename[0], data->filename);
       o.tftp_port = grub_cpu_to_be16 (GRUB_PXE_TFTP_PORT);
       o.packet_size = grub_pxe_blksize;
@@ -272,6 +340,99 @@ static struct grub_fs grub_pxefs_fs =
     .next = 0
   };
 
+static char *
+grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)),
+			 const char *val __attribute__ ((unused)))
+{
+  return NULL;
+}
+
+static void
+set_mac_env (grub_uint8_t *mac_addr, grub_size_t mac_len)
+{
+  char buf[(sizeof ("XX:") - 1) * mac_len + 1];
+  char *ptr = buf;
+  unsigned i;
+
+  for (i = 0; i < mac_len; i++)
+    {
+      grub_sprintf (ptr, "%02x:", mac_addr[i] & 0xff);
+      ptr += (sizeof ("XX:") - 1);
+    }
+  if (mac_len)
+    *(ptr - 1) = 0;
+  else
+    buf[0] = 0;
+
+  grub_env_set ("net_pxe_mac", buf);
+  /* XXX: Is it possible to change MAC in PXE?  */
+  grub_register_variable_hook ("net_pxe_mac", 0, grub_env_write_readonly);
+}
+
+static void
+set_env_limn_ro (const char *varname, char *value, grub_size_t len)
+{
+  char c;
+  c = value[len];
+  value[len] = 0;
+  grub_env_set (varname, value);
+  value[len] = c;
+  grub_register_variable_hook (varname, 0, grub_env_write_readonly);
+}
+
+static void
+parse_dhcp_vendor (void *vend, int limit)
+{
+  grub_uint8_t *ptr, *ptr0;
+
+  ptr = ptr0 = vend;
+
+  if (grub_be_to_cpu32 (*(grub_uint32_t *) ptr) != 0x63825363)
+    return;
+  ptr = ptr + sizeof (grub_uint32_t);
+  while (ptr - ptr0 < limit)
+    {
+      grub_uint8_t tagtype;
+      grub_uint8_t taglength;
+
+      tagtype = *ptr++;
+
+      /* Pad tag.  */
+      if (tagtype == 0)
+	continue;
+
+      /* End tag.  */
+      if (tagtype == 0xff)
+	return;
+
+      taglength = *ptr++;
+
+      switch (tagtype)
+	{
+	case 12:
+	  set_env_limn_ro ("net_pxe_hostname", (char *) ptr, taglength);
+	  break;
+
+	case 15:
+	  set_env_limn_ro ("net_pxe_domain", (char *) ptr, taglength);
+	  break;
+
+	case 17:
+	  set_env_limn_ro ("net_pxe_rootpath", (char *) ptr, taglength);
+	  break;
+
+	case 18:
+	  set_env_limn_ro ("net_pxe_extensionspath", (char *) ptr, taglength);
+	  break;
+
+	  /* If you need any other options please contact GRUB
+	     developpement team.  */
+	}
+
+      ptr += taglength;
+    }
+}
+
 static void
 grub_pxe_detect (void)
 {
@@ -293,9 +454,15 @@ grub_pxe_detect (void)
   bp = LINEAR (ci.buffer);
 
   grub_pxe_your_ip = bp->your_ip;
-  grub_pxe_server_ip = bp->server_ip;
-  grub_pxe_gateway_ip = bp->gateway_ip;
-
+  grub_pxe_default_server_ip = bp->server_ip;
+  grub_pxe_default_gateway_ip = bp->gateway_ip;
+  set_mac_env (bp->mac_addr, bp->hw_len < sizeof (bp->mac_addr) ? bp->hw_len
+	       : sizeof (bp->mac_addr));
+  set_env_limn_ro ("net_pxe_boot_file", (char *) bp->boot_file,
+		   sizeof (bp->boot_file));
+  set_env_limn_ro ("net_pxe_dhcp_server_name", (char *) bp->server_name,
+		   sizeof (bp->server_name));
+  parse_dhcp_vendor (&bp->vendor, sizeof (bp->vendor));
   grub_pxe_pxenv = pxenv;
 }
 
@@ -311,11 +478,110 @@ grub_pxe_unload (void)
     }
 }
 
+static void
+set_ip_env (char *varname, grub_uint32_t ip)
+{
+  char buf[sizeof ("XXX.XXX.XXX.XXX")];
+
+  grub_sprintf (buf, "%d.%d.%d.%d", (ip & 0xff),
+		(ip >> 8) & 0xff, (ip >> 16) & 0xff, (ip >> 24) & 0xff);
+  grub_env_set (varname, buf);
+}
+
+static char *
+write_ip_env (grub_uint32_t *ip, const char *val)
+{
+  char *buf;
+  grub_err_t err;
+  grub_uint32_t newip;
+  
+  err = parse_ip (val, &newip, 0);
+  if (err)
+    return 0;
+
+  /* Normalize the IP.  */
+  buf = grub_malloc (sizeof ("XXX.XXX.XXX.XXX"));
+  if (!buf)
+    return 0;
+
+  *ip = newip;
+
+  grub_sprintf (buf, "%d.%d.%d.%d", (newip & 0xff), (newip >> 8) & 0xff,
+		(newip >> 16) & 0xff, (newip >> 24) & 0xff);
+
+  return buf; 
+}
+
+static char *
+grub_env_write_pxe_default_server (struct grub_env_var *var 
+				   __attribute__ ((unused)),
+				   const char *val)
+{
+  return write_ip_env (&grub_pxe_default_server_ip, val);
+}
+
+static char *
+grub_env_write_pxe_default_gateway (struct grub_env_var *var
+				    __attribute__ ((unused)),
+				    const char *val)
+{
+  return write_ip_env (&grub_pxe_default_gateway_ip, val);
+}
+
+static char *
+grub_env_write_pxe_blocksize (struct grub_env_var *var __attribute__ ((unused)),
+			      const char *val)
+{
+  unsigned size;
+  char *buf;
+
+  size = grub_strtoul (val, 0, 0);
+  if (grub_errno)
+    return 0;
+
+  if (size < GRUB_PXE_MIN_BLKSIZE)
+    size = GRUB_PXE_MIN_BLKSIZE;
+  else if (size > GRUB_PXE_MAX_BLKSIZE)
+    size = GRUB_PXE_MAX_BLKSIZE;
+  
+  buf = grub_malloc (sizeof ("XXXXXX XXXXXX"));
+  if (!buf)
+    return 0;
+
+  grub_sprintf (buf, "%d", size);
+  grub_pxe_blksize = size;
+  
+  return buf;
+}
+
+
 GRUB_MOD_INIT(pxe)
 {
   grub_pxe_detect ();
   if (grub_pxe_pxenv)
     {
+      char *buf;
+
+      buf = grub_malloc (sizeof ("XXXXXX XXXXXX"));
+      if (buf)
+	{
+	  grub_sprintf (buf, "%d", grub_pxe_blksize);
+	  grub_env_set ("net_pxe_blksize", buf);
+	}
+
+      set_ip_env ("pxe_default_server", grub_pxe_default_server_ip);
+      set_ip_env ("pxe_default_gateway", grub_pxe_default_gateway_ip);
+      set_ip_env ("net_pxe_ip", grub_pxe_your_ip);
+      grub_register_variable_hook ("net_pxe_default_server", 0,
+				   grub_env_write_pxe_default_server);
+      grub_register_variable_hook ("net_pxe_default_gateway", 0,
+				   grub_env_write_pxe_default_gateway);
+
+      /* XXX: Is it possible to change IP in PXE?  */
+      grub_register_variable_hook ("net_pxe_ip", 0,
+				   grub_env_write_readonly);
+      grub_register_variable_hook ("net_pxe_blksize", 0,
+				   grub_env_write_pxe_blocksize);
       grub_disk_dev_register (&grub_pxe_dev);
       grub_fs_register (&grub_pxefs_fs);
     }
diff --git a/fs/iso9660.c b/fs/iso9660.c
index 976222a45..2fb0ffb63 100644
--- a/fs/iso9660.c
+++ b/fs/iso9660.c
@@ -280,13 +280,13 @@ grub_iso9660_mount (grub_disk_t disk)
 			  sizeof (struct grub_iso9660_primary_voldesc),
 			  (char *) &voldesc))
         {
-          grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
+          grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
           goto fail;
         }
 
       if (grub_strncmp ((char *) voldesc.voldesc.magic, "CD001", 5) != 0)
         {
-          grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
+          grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
           goto fail;
         }
 
@@ -315,7 +315,7 @@ grub_iso9660_mount (grub_disk_t disk)
 			     << GRUB_ISO9660_LOG2_BLKSZ), 0,
 		      sizeof (rootdir), (char *) &rootdir))
     {
-      grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
+      grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
       goto fail;
     }
 
@@ -331,7 +331,7 @@ grub_iso9660_mount (grub_disk_t disk)
 			     << GRUB_ISO9660_LOG2_BLKSZ), sua_pos,
 		      sua_size, sua))
     {
-      grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
+      grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
       goto fail;
     }
 
@@ -832,7 +832,7 @@ grub_iso9660_uuid (grub_device_t device, char **uuid)
 	  && ! data->voldesc.modified.second[0] && ! data->voldesc.modified.second[1]
 	  && ! data->voldesc.modified.hundredth[0] && ! data->voldesc.modified.hundredth[1])
 	{
-	  grub_error (GRUB_ERR_BAD_NUMBER, "No creation date in filesystem to generate UUID.");
+	  grub_error (GRUB_ERR_BAD_NUMBER, "no creation date in filesystem to generate UUID");
 	  *uuid = NULL;
 	}
       else
diff --git a/fs/jfs.c b/fs/jfs.c
index 589b6ae5a..dc5eaed67 100644
--- a/fs/jfs.c
+++ b/fs/jfs.c
@@ -344,7 +344,7 @@ grub_jfs_mount (grub_disk_t disk)
 
   if (grub_strncmp ((char *) (data->sblock.magic), "JFS1", 4))
     {
-      grub_error (GRUB_ERR_BAD_FS, "not a jfs filesystem");
+      grub_error (GRUB_ERR_BAD_FS, "not a JFS filesystem");
       goto fail;
     }
 
@@ -363,7 +363,7 @@ grub_jfs_mount (grub_disk_t disk)
   grub_free (data);
 
   if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
-    grub_error (GRUB_ERR_BAD_FS, "not a jfs filesystem");
+    grub_error (GRUB_ERR_BAD_FS, "not a JFS filesystem");
 
   return 0;
 }
@@ -715,7 +715,7 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, int ino)
 
   grub_jfs_find_file (data, symlink);
   if (grub_errno)
-    grub_error (grub_errno, "Can not follow symlink `%s'.", symlink);
+    grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
 
   return grub_errno;
 }
diff --git a/fs/minix.c b/fs/minix.c
index 08eb60729..a856e38c4 100644
--- a/fs/minix.c
+++ b/fs/minix.c
@@ -311,7 +311,7 @@ grub_minix_lookup_symlink (struct grub_minix_data *data, int ino)
 
   grub_minix_find_file (data, symlink);
   if (grub_errno)
-    grub_error (grub_errno, "Can not follow symlink `%s'.", symlink);
+    grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
 
   return grub_errno;
 }
diff --git a/fs/ntfs.c b/fs/ntfs.c
index f3097d60b..87db1a561 100644
--- a/fs/ntfs.c
+++ b/fs/ntfs.c
@@ -42,7 +42,7 @@ fixup (struct grub_ntfs_data *data, char *buf, int len, char *magic)
 
   ss = u16at (buf, 6) - 1;
   if (ss * (int) data->blocksize != len * GRUB_DISK_SECTOR_SIZE)
-    return grub_error (GRUB_ERR_BAD_FS, "Size not match",
+    return grub_error (GRUB_ERR_BAD_FS, "size not match",
 		       ss * (int) data->blocksize,
 		       len * GRUB_DISK_SECTOR_SIZE);
   pu = buf + u16at (buf, 4);
@@ -53,7 +53,7 @@ fixup (struct grub_ntfs_data *data, char *buf, int len, char *magic)
       buf += data->blocksize;
       pu += 2;
       if (u16at (buf, 0) != us)
-	return grub_error (GRUB_ERR_BAD_FS, "Fixup signature not match");
+	return grub_error (GRUB_ERR_BAD_FS, "fixup signature not match");
       v16at (buf, 0) = v16at (pu, 0);
       ss--;
     }
@@ -147,7 +147,7 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
 		  new_pos += u16at (new_pos, 4);
 		}
 	      grub_error (GRUB_ERR_BAD_FS,
-			  "Can\'t find 0x%X in attribute list",
+			  "can\'t find 0x%X in attribute list",
 			  (unsigned char) *at->attr_cur);
 	      return NULL;
 	    }
@@ -186,7 +186,7 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
 	  if (read_data (at, pa, at->edat_buf, 0, n, 0, 0))
 	    {
 	      grub_error (GRUB_ERR_BAD_FS,
-			  "Fail to read non-resident attribute list");
+			  "fail to read non-resident attribute list");
 	      return NULL;
 	    }
 	  at->attr_nxt = at->edat_buf;
@@ -315,7 +315,7 @@ retry:
 	      goto retry;
 	    }
 	}
-      return grub_error (GRUB_ERR_BAD_FS, "Run list overflown");
+      return grub_error (GRUB_ERR_BAD_FS, "run list overflown");
     }
   run = read_run_data (run + 1, c1, &val, 0);	/* length of current VCN */
   ctx->curr_vcn = ctx->next_vcn;
@@ -369,7 +369,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
   if (pa[8] == 0)
     {
       if (ofs + len > u32at (pa, 0x10))
-	return grub_error (GRUB_ERR_BAD_FS, "Read out of range");
+	return grub_error (GRUB_ERR_BAD_FS, "read out of range");
       grub_memcpy (dest, pa + u32at (pa, 0x14) + ofs, len);
       return 0;
     }
@@ -383,7 +383,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
   if (ctx->flags & RF_COMP)
     {
       if (!cached)
-	return grub_error (GRUB_ERR_BAD_FS, "Attribute can\'t be compressed");
+	return grub_error (GRUB_ERR_BAD_FS, "attribute can\'t be compressed");
 
       if (at->sbuf)
 	{
@@ -502,7 +502,7 @@ read_attr (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
   else
     ret =
       (grub_errno) ? grub_errno : grub_error (GRUB_ERR_BAD_FS,
-					      "Attribute not found");
+					      "attribute not found");
   at->attr_cur = save_cur;
   return ret;
 }
@@ -513,7 +513,7 @@ read_mft (struct grub_ntfs_data *data, char *buf, grub_uint32_t mftno)
   if (read_attr
       (&data->mmft.attr, buf, mftno * ((grub_disk_addr_t) data->mft_size << BLK_SHR),
        data->mft_size << BLK_SHR, 0, 0))
-    return grub_error (GRUB_ERR_BAD_FS, "Read MFT 0x%X fails", mftno);
+    return grub_error (GRUB_ERR_BAD_FS, "read MFT 0x%X fails", mftno);
   return fixup (data, buf, data->mft_size, "FILE");
 }
 
@@ -541,7 +541,7 @@ init_file (struct grub_ntfs_file *mft, grub_uint32_t mftno)
 
       pa = locate_attr (&mft->attr, mft, AT_DATA);
       if (pa == NULL)
-	return grub_error (GRUB_ERR_BAD_FS, "No $DATA in MFT 0x%X", mftno);
+	return grub_error (GRUB_ERR_BAD_FS, "no $DATA in MFT 0x%X", mftno);
 
       if (!pa[8])
 	mft->size = u32at (pa, 0x10);
@@ -664,7 +664,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
     {
       if ((cur_pos = find_attr (at, AT_INDEX_ROOT)) == NULL)
 	{
-	  grub_error (GRUB_ERR_BAD_FS, "No $INDEX_ROOT");
+	  grub_error (GRUB_ERR_BAD_FS, "no $INDEX_ROOT");
 	  goto done;
 	}
 
@@ -717,7 +717,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
               if (read_data (at, cur_pos, bmp, 0, bitmap_len, 0, 0))
                 {
                   grub_error (GRUB_ERR_BAD_FS,
-                              "Fails to read non-resident $BITMAP");
+                              "fails to read non-resident $BITMAP");
                   goto done;
                 }
               bitmap_len = u32at (cur_pos, 0x30);
diff --git a/fs/ntfscomp.c b/fs/ntfscomp.c
index 6bb33ffb1..c29979edc 100644
--- a/fs/ntfscomp.c
+++ b/fs/ntfscomp.c
@@ -28,7 +28,7 @@ static grub_err_t
 decomp_nextvcn (struct grub_ntfs_comp *cc)
 {
   if (cc->comp_head >= cc->comp_tail)
-    return grub_error (GRUB_ERR_BAD_FS, "Compression block overflown");
+    return grub_error (GRUB_ERR_BAD_FS, "compression block overflown");
   if (grub_disk_read
       (cc->disk,
        (cc->comp_table[cc->comp_head][1] -
@@ -87,7 +87,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
 	    {
 	      if (copied > COM_LEN)
 		return grub_error (GRUB_ERR_BAD_FS,
-				   "Compression block too large");
+				   "compression block too large");
 
 	      if (!bits)
 		{
@@ -112,7 +112,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
 
 		  if (!copied)
 		    {
-		      grub_error (GRUB_ERR_BAD_FS, "Context window empty");
+		      grub_error (GRUB_ERR_BAD_FS, "nontext window empty");
 		      return 0;
 		    }
 
@@ -150,7 +150,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
 	{
 	  if (cnt != COM_LEN)
 	    return grub_error (GRUB_ERR_BAD_FS,
-			       "Invalid compression block size");
+			       "invalid compression block size");
 	}
     }
 
@@ -187,7 +187,7 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, int num)
 	{
 
 	  if (ctx->comp.comp_head != ctx->comp.comp_tail)
-	    return grub_error (GRUB_ERR_BAD_FS, "Invalid compression block");
+	    return grub_error (GRUB_ERR_BAD_FS, "invalid compression block");
 	  ctx->comp.comp_head = ctx->comp.comp_tail = 0;
 	  ctx->comp.cbuf_vcn = ctx->target_vcn;
 	  ctx->comp.cbuf_ofs = (ctx->comp.spc << BLK_SHR);
diff --git a/fs/reiserfs.c b/fs/reiserfs.c
index fb4f1bc59..a8ba75910 100644
--- a/fs/reiserfs.c
+++ b/fs/reiserfs.c
@@ -691,7 +691,7 @@ grub_reiserfs_mount (grub_disk_t disk)
   if (grub_memcmp (data->superblock.magic_string,
                    REISERFS_MAGIC_STRING, sizeof (REISERFS_MAGIC_STRING) - 1))
     {
-      grub_error (GRUB_ERR_BAD_FS, "not a reiserfs filesystem");
+      grub_error (GRUB_ERR_BAD_FS, "not a ReiserFS filesystem");
       goto fail;
     }
   data->disk = disk;
@@ -700,7 +700,7 @@ grub_reiserfs_mount (grub_disk_t disk)
  fail:
   /* Disk is too small to contain a ReiserFS.  */
   if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
-    grub_error (GRUB_ERR_BAD_FS, "not a reiserfs filesystem");
+    grub_error (GRUB_ERR_BAD_FS, "not a ReiserFS filesystem");
 
   grub_free (data);
   return 0;
@@ -998,7 +998,7 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
     goto fail;
   if (root.block_number == 0)
     {
-      grub_error (GRUB_ERR_BAD_FS, "Unable to find root item");
+      grub_error (GRUB_ERR_BAD_FS, "unable to find root item");
       goto fail; /* Should never happen since checked at mount.  */
     }
   grub_fshelp_find_file (name, &root, &found,
@@ -1014,7 +1014,7 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
     goto fail;
   if (info.block_number == 0)
     {
-      grub_error (GRUB_ERR_BAD_FS, "Unable to find searched item");
+      grub_error (GRUB_ERR_BAD_FS, "unable to find searched item");
       goto fail;
     }
   entry_version = grub_le_to_cpu16 (info.header.version);
@@ -1289,7 +1289,7 @@ grub_reiserfs_dir (grub_device_t device, const char *path,
     goto fail;
   if (root.block_number == 0)
     {
-      grub_error(GRUB_ERR_BAD_FS, "Root not found");
+      grub_error(GRUB_ERR_BAD_FS, "root not found");
       goto fail;
     }
   grub_fshelp_find_file (path, &root, &found, grub_reiserfs_iterate_dir,
diff --git a/fs/sfs.c b/fs/sfs.c
index ec59b73ca..4f70ad3ec 100644
--- a/fs/sfs.c
+++ b/fs/sfs.c
@@ -279,7 +279,7 @@ grub_sfs_mount (grub_disk_t disk)
   /* Make sure this is a sfs filesystem.  */
   if (grub_strncmp ((char *) (data->rblock.header.magic), "SFS", 4))
     {
-      grub_error (GRUB_ERR_BAD_FS, "not a sfs filesystem");
+      grub_error (GRUB_ERR_BAD_FS, "not a SFS filesystem");
       goto fail;
     }
 
@@ -307,7 +307,7 @@ grub_sfs_mount (grub_disk_t disk)
 
  fail:
   if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
-    grub_error (GRUB_ERR_BAD_FS, "not an sfs filesystem");
+    grub_error (GRUB_ERR_BAD_FS, "not an SFS filesystem");
 
   grub_free (data);
   grub_free (rootobjc_data);
diff --git a/fs/udf.c b/fs/udf.c
index 9dfe431f6..b44fa8a6d 100644
--- a/fs/udf.c
+++ b/fs/udf.c
@@ -525,7 +525,7 @@ grub_udf_mount (grub_disk_t disk)
       if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
 			  sizeof (struct grub_udf_vrs), &vrs))
 	{
-	  grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
+	  grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
 	  goto fail;
 	}
 
@@ -539,7 +539,7 @@ grub_udf_mount (grub_disk_t disk)
 	  (grub_memcmp (vrs.magic, GRUB_UDF_STD_IDENT_CDW02, 5)) &&
 	  (grub_memcmp (vrs.magic, GRUB_UDF_STD_IDENT_TEA01, 5)))
 	{
-	  grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
+	  grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
 	  goto fail;
 	}
     }
@@ -552,7 +552,7 @@ grub_udf_mount (grub_disk_t disk)
       if (grub_disk_read (disk, *sblklist << GRUB_UDF_LOG2_BLKSZ, 0,
 			  sizeof (struct grub_udf_avdp), &avdp))
 	{
-	  grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
+	  grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
 	  goto fail;
 	}
 
@@ -565,7 +565,7 @@ grub_udf_mount (grub_disk_t disk)
       sblklist++;
       if (*sblklist == 0)
 	{
-	  grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
+	  grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
 	  goto fail;
 	}
     }
@@ -579,7 +579,7 @@ grub_udf_mount (grub_disk_t disk)
       if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
 			  sizeof (struct grub_udf_tag), &tag))
 	{
-	  grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
+	  grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
 	  goto fail;
 	}
 
@@ -596,7 +596,7 @@ grub_udf_mount (grub_disk_t disk)
 			      sizeof (struct grub_udf_pd),
 			      &data->pds[data->npd]))
 	    {
-	      grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
+	      grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
 	      goto fail;
 	    }
 
@@ -612,7 +612,7 @@ grub_udf_mount (grub_disk_t disk)
 			      sizeof (struct grub_udf_lvd),
 			      &data->lvd))
 	    {
-	      grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
+	      grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
 	      goto fail;
 	    }
 
@@ -675,7 +675,7 @@ grub_udf_mount (grub_disk_t disk)
   if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
 		      sizeof (struct grub_udf_fileset), &root_fs))
     {
-      grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
+      grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
       goto fail;
     }
 
diff --git a/fs/ufs.c b/fs/ufs.c
index c94ad9922..f95a6e12e 100644
--- a/fs/ufs.c
+++ b/fs/ufs.c
@@ -415,7 +415,7 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)
 
   grub_ufs_find_file (data, symlink);
   if (grub_errno)
-    grub_error (grub_errno, "Can not follow symlink `%s'.", symlink);
+    grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
 
   return grub_errno;
 }
diff --git a/fs/xfs.c b/fs/xfs.c
index 1b18bef3b..c15ec7341 100644
--- a/fs/xfs.c
+++ b/fs/xfs.c
@@ -222,7 +222,7 @@ grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino,
     return grub_errno;
 
   if (grub_strncmp ((char *) inode->magic, "IN", 2))
-    return grub_error (GRUB_ERR_BAD_FS, "not a correct XFS inode.\n");
+    return grub_error (GRUB_ERR_BAD_FS, "not a correct XFS inode");
 
   return 0;
 }
@@ -273,7 +273,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
           if (grub_strncmp ((char *) leaf->magic, "BMAP", 4))
             {
               grub_free (leaf);
-              grub_error (GRUB_ERR_BAD_FS, "not a correct XFS BMAP node.\n");
+              grub_error (GRUB_ERR_BAD_FS, "not a correct XFS BMAP node");
               return 0;
             }
 
@@ -290,7 +290,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
   else
     {
       grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-		  "xfs does not support inode format %d yet",
+		  "XFS does not support inode format %d yet",
 		  node->inode.format);
       return 0;
     }
@@ -567,7 +567,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
 
     default:
       grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-		  "xfs does not support inode format %d yet",
+		  "XFS does not support inode format %d yet",
 		  diro->inode.format);
     }
   return 0;
@@ -590,7 +590,7 @@ grub_xfs_mount (grub_disk_t disk)
 
   if (grub_strncmp ((char *) (data->sblock.magic), "XFSB", 4))
     {
-      grub_error (GRUB_ERR_BAD_FS, "not a xfs filesystem");
+      grub_error (GRUB_ERR_BAD_FS, "not a XFS filesystem");
       goto fail;
     }
 
@@ -617,7 +617,7 @@ grub_xfs_mount (grub_disk_t disk)
  fail:
 
   if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
-    grub_error (GRUB_ERR_BAD_FS, "not an xfs filesystem");
+    grub_error (GRUB_ERR_BAD_FS, "not an XFS filesystem");
 
   grub_free (data);
 
diff --git a/gettext/gettext.c b/gettext/gettext.c
index fe14dab2e..165feb332 100644
--- a/gettext/gettext.c
+++ b/gettext/gettext.c
@@ -243,7 +243,7 @@ grub_mofile_open (const char *filename)
   if (version != 0)
     {
       grub_error (GRUB_ERR_BAD_FILE_TYPE,
-		  "mo: invalid mo version in file: %s\n", filename);
+		  "mo: invalid mo version in file: %s", filename);
       fd_mo = 0;
       return 0;
     }
@@ -298,7 +298,7 @@ grub_gettext_init_ext (const char *lang)
 }
 
 static void
-grub_gettext_delete_list ()
+grub_gettext_delete_list (void)
 {
   struct grub_gettext_msg *item;
 
@@ -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/include/grub/auth.h b/include/grub/auth.h
index 823442941..99f9d7260 100644
--- a/include/grub/auth.h
+++ b/include/grub/auth.h
@@ -22,7 +22,7 @@
 #include <grub/i18n.h>
 
 /* Macros for indistinguishibility.  */
-#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
+#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "access denied")
 #define GRUB_GET_PASSWORD(string, len) grub_cmdline_get (N_("Enter password:"), \
 							 string, len,	\
 							 '*', 0, 0)
diff --git a/include/grub/i386/at_keyboard.h b/include/grub/i386/at_keyboard.h
index 12d61608e..017b58a62 100644
--- a/include/grub/i386/at_keyboard.h
+++ b/include/grub/i386/at_keyboard.h
@@ -25,6 +25,8 @@
 #define CTRL		0x1d
 #define ALT		0x38
 #define CAPS_LOCK	0x3a
+#define NUM_LOCK	0x45
+#define SCROLL_LOCK	0x46
 
 #define KEYBOARD_REG_DATA	0x60
 #define KEYBOARD_REG_STATUS	0x64
diff --git a/include/grub/i386/pc/pxe.h b/include/grub/i386/pc/pxe.h
index 482132896..39f356c83 100644
--- a/include/grub/i386/pc/pxe.h
+++ b/include/grub/i386/pc/pxe.h
@@ -201,7 +201,7 @@ struct grub_pxenv_get_cached_info
 
 #define GRUB_PXE_MAC_ADDR_LEN	16
 
-typedef grub_uint8_t grub_pxe_mac_addr[GRUB_PXE_MAC_ADDR_LEN];
+typedef grub_uint8_t grub_pxe_mac_addr_t[GRUB_PXE_MAC_ADDR_LEN];
 
 struct grub_pxenv_boot_player
 {
@@ -216,7 +216,7 @@ struct grub_pxenv_boot_player
   grub_uint32_t your_ip;
   grub_uint32_t	server_ip;
   grub_uint32_t	gateway_ip;
-  grub_pxe_mac_addr mac_addr;
+  grub_pxe_mac_addr_t mac_addr;
   grub_uint8_t server_name[64];
   grub_uint8_t boot_file[128];
   union
@@ -306,10 +306,6 @@ struct grub_pxenv * EXPORT_FUNC(grub_pxe_scan) (void);
 int EXPORT_FUNC(grub_pxe_call) (int func, void * data);
 
 extern struct grub_pxenv *grub_pxe_pxenv;
-extern grub_uint32_t grub_pxe_your_ip;
-extern grub_uint32_t grub_pxe_server_ip;
-extern grub_uint32_t grub_pxe_gateway_ip;
-extern int grub_pxe_blksize;
 
 void grub_pxe_unload (void);
 
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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GRUB_SEARCH_HEADER
+#define GRUB_SEARCH_HEADER 1
+
+void grub_search_fs_file (const char *key, const char *var, int no_floppy);
+void grub_search_fs_uuid (const char *key, const char *var, int no_floppy);
+void grub_search_label (const char *key, const char *var, int no_floppy);
+
+#endif
diff --git a/include/multiboot.h b/include/multiboot.h
index 9ce34f437..587f50832 100644
--- a/include/multiboot.h
+++ b/include/multiboot.h
@@ -1,6 +1,5 @@
-/*
- *  multiboot.h - Multiboot header file.
- *  Copyright (C) 2003,2007,2008,2009  Free Software Foundation, Inc.
+/*  multiboot.h - Multiboot header file.  */
+/*  Copyright (C) 1999,2003,2007,2008,2009  Free Software Foundation, Inc.
  *
  *  Permission is hereby granted, free of charge, to any person obtaining a copy
  *  of this software and associated documentation files (the "Software"), to
@@ -24,70 +23,66 @@
 #define MULTIBOOT_HEADER 1
 
 /* How many bytes from the start of the file we search for the header.  */
-#define MULTIBOOT_SEARCH                 8192
+#define MULTIBOOT_SEARCH			8192
 
 /* The magic field should contain this.  */
-#define MULTIBOOT_MAGIC                  0x1BADB002
+#define MULTIBOOT_HEADER_MAGIC			0x1BADB002
 
 /* This should be in %eax.  */
-#define MULTIBOOT_MAGIC2                 0x2BADB002
+#define MULTIBOOT_BOOTLOADER_MAGIC		0x2BADB002
 
 /* The bits in the required part of flags field we don't support.  */
-#define MULTIBOOT_UNSUPPORTED            0x0000fffc
+#define MULTIBOOT_UNSUPPORTED			0x0000fffc
 
 /* Alignment of multiboot modules.  */
-#define MULTIBOOT_MOD_ALIGN              0x00001000
+#define MULTIBOOT_MOD_ALIGN			0x00001000
 
 /* Alignment of the multiboot info structure.  */
-#define MULTIBOOT_INFO_ALIGN		 0x00000004
+#define MULTIBOOT_INFO_ALIGN			0x00000004
 
-/*
- * Flags set in the 'flags' member of the multiboot header.
- */
+/* Flags set in the 'flags' member of the multiboot header.  */
 
 /* Align all boot modules on i386 page (4KB) boundaries.  */
-#define MULTIBOOT_PAGE_ALIGN		0x00000001
+#define MULTIBOOT_PAGE_ALIGN			0x00000001
 
 /* Must pass memory information to OS.  */
-#define MULTIBOOT_MEMORY_INFO		0x00000002
+#define MULTIBOOT_MEMORY_INFO			0x00000002
 
 /* Must pass video information to OS.  */
-#define MULTIBOOT_VIDEO_MODE		0x00000004
+#define MULTIBOOT_VIDEO_MODE			0x00000004
 
 /* This flag indicates the use of the address fields in the header.  */
-#define MULTIBOOT_AOUT_KLUDGE		0x00010000
+#define MULTIBOOT_AOUT_KLUDGE			0x00010000
 
-/*
- *  Flags to be set in the 'flags' member of the multiboot info structure.
- */
+/* Flags to be set in the 'flags' member of the multiboot info structure.  */
 
 /* is there basic lower/upper memory information? */
-#define MULTIBOOT_INFO_MEMORY		0x00000001
+#define MULTIBOOT_INFO_MEMORY			0x00000001
 /* is there a boot device set? */
-#define MULTIBOOT_INFO_BOOTDEV		0x00000002
+#define MULTIBOOT_INFO_BOOTDEV			0x00000002
 /* is the command-line defined? */
-#define MULTIBOOT_INFO_CMDLINE		0x00000004
+#define MULTIBOOT_INFO_CMDLINE			0x00000004
 /* are there modules to do something with? */
-#define MULTIBOOT_INFO_MODS		0x00000008
+#define MULTIBOOT_INFO_MODS			0x00000008
 
 /* These next two are mutually exclusive */
 
 /* is there a symbol table loaded? */
 #define MULTIBOOT_INFO_AOUT_SYMS		0x00000010
 /* is there an ELF section header table? */
-#define MULTIBOOT_INFO_ELF_SHDR		0x00000020
+#define MULTIBOOT_INFO_ELF_SHDR			0X00000020
 
 /* is there a full memory map? */
-#define MULTIBOOT_INFO_MEM_MAP		0x00000040
+#define MULTIBOOT_INFO_MEM_MAP			0x00000040
 
 /* Is there drive info?  */
 #define MULTIBOOT_INFO_DRIVE_INFO		0x00000080
 
 /* Is there a config table?  */
-#define MULTIBOOT_INFO_CONFIG_TABLE	0x00000100
+#define MULTIBOOT_INFO_CONFIG_TABLE		0x00000100
 
 /* Is there a boot loader name?  */
-#define MULTIBOOT_INFO_BOOT_LOADER_NAME	0x00000200
+#define MULTIBOOT_INFO_BOOT_LOADER_NAME		0x00000200
 
 /* Is there a APM table?  */
 #define MULTIBOOT_INFO_APM_TABLE		0x00000400
@@ -97,102 +92,131 @@
 
 #ifndef ASM_FILE
 
-#include <grub/types.h>
+typedef unsigned short		multiboot_uint16_t;
+typedef unsigned int		multiboot_uint32_t;
+typedef unsigned long long	multiboot_uint64_t;
 
 struct multiboot_header
 {
   /* Must be MULTIBOOT_MAGIC - see above.  */
-  grub_uint32_t magic;
+  multiboot_uint32_t magic;
 
   /* Feature flags.  */
-  grub_uint32_t flags;
+  multiboot_uint32_t flags;
 
   /* The above fields plus this one must equal 0 mod 2^32. */
-  grub_uint32_t checksum;
+  multiboot_uint32_t checksum;
 
   /* These are only valid if MULTIBOOT_AOUT_KLUDGE is set.  */
-  grub_uint32_t header_addr;
-  grub_uint32_t load_addr;
-  grub_uint32_t load_end_addr;
-  grub_uint32_t bss_end_addr;
-  grub_uint32_t entry_addr;
+  multiboot_uint32_t header_addr;
+  multiboot_uint32_t load_addr;
+  multiboot_uint32_t load_end_addr;
+  multiboot_uint32_t bss_end_addr;
+  multiboot_uint32_t entry_addr;
 
   /* These are only valid if MULTIBOOT_VIDEO_MODE is set.  */
-  grub_uint32_t mode_type;
-  grub_uint32_t width;
-  grub_uint32_t height;
-  grub_uint32_t depth;
+  multiboot_uint32_t mode_type;
+  multiboot_uint32_t width;
+  multiboot_uint32_t height;
+  multiboot_uint32_t depth;
 };
 
+/* The symbol table for a.out.  */
+struct multiboot_aout_symbol_table
+{
+  multiboot_uint32_t tabsize;
+  multiboot_uint32_t strsize;
+  multiboot_uint32_t addr;
+  multiboot_uint32_t reserved;
+};
+typedef struct multiboot_aout_symbol_table multiboot_aout_symbol_table_t;
+
+/* The section header table for ELF.  */
+struct multiboot_elf_section_header_table
+{
+  multiboot_uint32_t num;
+  multiboot_uint32_t size;
+  multiboot_uint32_t addr;
+  multiboot_uint32_t shndx;
+};
+typedef struct multiboot_elf_section_header_table multiboot_elf_section_header_table_t;
+
 struct multiboot_info
 {
   /* Multiboot info version number */
-  grub_uint32_t flags;
+  multiboot_uint32_t flags;
 
   /* Available memory from BIOS */
-  grub_uint32_t mem_lower;
-  grub_uint32_t mem_upper;
+  multiboot_uint32_t mem_lower;
+  multiboot_uint32_t mem_upper;
 
   /* "root" partition */
-  grub_uint32_t boot_device;
+  multiboot_uint32_t boot_device;
 
   /* Kernel command line */
-  grub_uint32_t cmdline;
+  multiboot_uint32_t cmdline;
 
   /* Boot-Module list */
-  grub_uint32_t mods_count;
-  grub_uint32_t mods_addr;
+  multiboot_uint32_t mods_count;
+  multiboot_uint32_t mods_addr;
 
-  grub_uint32_t syms[4];
+  union
+  {
+    multiboot_aout_symbol_table_t aout_sym;
+    multiboot_elf_section_header_table_t elf_sec;
+  } u;
 
   /* Memory Mapping buffer */
-  grub_uint32_t mmap_length;
-  grub_uint32_t mmap_addr;
+  multiboot_uint32_t mmap_length;
+  multiboot_uint32_t mmap_addr;
 
   /* Drive Info buffer */
-  grub_uint32_t drives_length;
-  grub_uint32_t drives_addr;
+  multiboot_uint32_t drives_length;
+  multiboot_uint32_t drives_addr;
 
   /* ROM configuration table */
-  grub_uint32_t config_table;
+  multiboot_uint32_t config_table;
 
   /* Boot Loader Name */
-  grub_uint32_t boot_loader_name;
+  multiboot_uint32_t boot_loader_name;
 
   /* APM table */
-  grub_uint32_t apm_table;
+  multiboot_uint32_t apm_table;
 
   /* Video */
-  grub_uint32_t vbe_control_info;
-  grub_uint32_t vbe_mode_info;
-  grub_uint16_t vbe_mode;
-  grub_uint16_t vbe_interface_seg;
-  grub_uint16_t vbe_interface_off;
-  grub_uint16_t vbe_interface_len;
+  multiboot_uint32_t vbe_control_info;
+  multiboot_uint32_t vbe_mode_info;
+  multiboot_uint16_t vbe_mode;
+  multiboot_uint16_t vbe_interface_seg;
+  multiboot_uint16_t vbe_interface_off;
+  multiboot_uint16_t vbe_interface_len;
 };
+typedef struct multiboot_info multiboot_info_t;
 
 struct multiboot_mmap_entry
 {
-  grub_uint32_t size;
-  grub_uint64_t addr;
-  grub_uint64_t len;
+  multiboot_uint32_t size;
+  multiboot_uint64_t addr;
+  multiboot_uint64_t len;
 #define MULTIBOOT_MEMORY_AVAILABLE		1
 #define MULTIBOOT_MEMORY_RESERVED		2
-  grub_uint32_t type;
+  multiboot_uint32_t type;
 } __attribute__((packed));
+typedef struct multiboot_mmap_entry multiboot_memory_map_t;
 
 struct multiboot_mod_list
 {
   /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
-  grub_uint32_t mod_start;
-  grub_uint32_t mod_end;
+  multiboot_uint32_t mod_start;
+  multiboot_uint32_t mod_end;
 
   /* Module command line */
-  grub_uint32_t cmdline;
+  multiboot_uint32_t cmdline;
 
   /* padding to take it to 16 bytes (must be zero) */
-  grub_uint32_t pad;
+  multiboot_uint32_t pad;
 };
+typedef struct multiboot_mod_list multiboot_module_t;
 
 #endif /* ! ASM_FILE */
 
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..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,
-			 "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/kern/elf.c b/kern/elf.c
index 951049e73..10fe9c758 100644
--- a/kern/elf.c
+++ b/kern/elf.c
@@ -74,7 +74,7 @@ grub_elf_file (grub_file_t file)
       != sizeof (elf->ehdr))
     {
       grub_error_push ();
-      grub_error (GRUB_ERR_READ_ERROR, "Cannot read ELF header.");
+      grub_error (GRUB_ERR_READ_ERROR, "cannot read ELF header");
       goto fail;
     }
 
@@ -134,7 +134,7 @@ grub_elf32_load_phdrs (grub_elf_t elf)
       || (grub_file_read (elf->file, elf->phdrs, phdrs_size) != phdrs_size))
     {
       grub_error_push ();
-      return grub_error (GRUB_ERR_READ_ERROR, "Cannot read program headers");
+      return grub_error (GRUB_ERR_READ_ERROR, "cannot read program headers");
     }
 
   return GRUB_ERR_NONE;
@@ -200,14 +200,14 @@ grub_elf32_size (grub_elf_t elf)
 
   if (nr_phdrs == 0)
     {
-      grub_error (GRUB_ERR_BAD_OS, "No program headers present");
+      grub_error (GRUB_ERR_BAD_OS, "no program headers present");
       return 0;
     }
 
   if (segments_end < segments_start)
     {
       /* Very bad addresses.  */
-      grub_error (GRUB_ERR_BAD_OS, "Bad program header load addresses");
+      grub_error (GRUB_ERR_BAD_OS, "bad program header load addresses");
       return 0;
     }
 
@@ -249,7 +249,7 @@ grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
       {
 	grub_error_push ();
 	return grub_error (GRUB_ERR_BAD_OS,
-			   "Invalid offset in program header.");
+			   "invalid offset in program header");
       }
 
     if (phdr->p_filesz)
@@ -261,8 +261,8 @@ grub_elf32_load (grub_elf_t _elf, grub_elf32_load_hook_t _load_hook,
 	    /* XXX How can we free memory from `load_hook'? */
 	    grub_error_push ();
 	    return grub_error (GRUB_ERR_BAD_OS,
-			       "Couldn't read segment from file: "
-			       "wanted 0x%lx bytes; read 0x%lx bytes.",
+			       "couldn't read segment from file: "
+			       "wanted 0x%lx bytes; read 0x%lx bytes",
 			       phdr->p_filesz, read);
 	  }
       }
@@ -315,7 +315,7 @@ grub_elf64_load_phdrs (grub_elf_t elf)
       || (grub_file_read (elf->file, elf->phdrs, phdrs_size) != phdrs_size))
     {
       grub_error_push ();
-      return grub_error (GRUB_ERR_READ_ERROR, "Cannot read program headers");
+      return grub_error (GRUB_ERR_READ_ERROR, "cannot read program headers");
     }
 
   return GRUB_ERR_NONE;
@@ -381,14 +381,14 @@ grub_elf64_size (grub_elf_t elf)
 
   if (nr_phdrs == 0)
     {
-      grub_error (GRUB_ERR_BAD_OS, "No program headers present");
+      grub_error (GRUB_ERR_BAD_OS, "no program headers present");
       return 0;
     }
 
   if (segments_end < segments_start)
     {
       /* Very bad addresses.  */
-      grub_error (GRUB_ERR_BAD_OS, "Bad program header load addresses");
+      grub_error (GRUB_ERR_BAD_OS, "bad program header load addresses");
       return 0;
     }
 
@@ -431,7 +431,7 @@ grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
       {
 	grub_error_push ();
 	return grub_error (GRUB_ERR_BAD_OS,
-			   "Invalid offset in program header.");
+			   "invalid offset in program header");
       }
 
     if (phdr->p_filesz)
@@ -443,8 +443,8 @@ grub_elf64_load (grub_elf_t _elf, grub_elf64_load_hook_t _load_hook,
 	    /* XXX How can we free memory from `load_hook'?  */
 	    grub_error_push ();
 	    return grub_error (GRUB_ERR_BAD_OS,
-			      "Couldn't read segment from file: "
-			      "wanted 0x%lx bytes; read 0x%lx bytes.",
+			      "couldn't read segment from file: "
+			      "wanted 0x%lx bytes; read 0x%lx bytes",
 			      phdr->p_filesz, read);
           }
       }
diff --git a/kern/file.c b/kern/file.c
index f713acbca..4224cf910 100644
--- a/kern/file.c
+++ b/kern/file.c
@@ -115,7 +115,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
   if (file->offset > file->size)
     {
       grub_error (GRUB_ERR_OUT_OF_RANGE,
-		  "Attempt to read past the end of file.");
+		  "attempt to read past the end of file");
       return -1;
     }
 
diff --git a/kern/i386/coreboot/startup.S b/kern/i386/coreboot/startup.S
index 3f2dd5f50..e94950aae 100644
--- a/kern/i386/coreboot/startup.S
+++ b/kern/i386/coreboot/startup.S
@@ -66,7 +66,7 @@ multiboot_header:
 	.long	-0x1BADB002 - MULTIBOOT_MEMORY_INFO
 
 codestart:
-	cmpl	$MULTIBOOT_MAGIC2, %eax
+	cmpl	$MULTIBOOT_BOOTLOADER_MAGIC, %eax
 	jne 0f
 	movl	%ebx, EXT_C(startup_multiboot_info)
 0:
diff --git a/kern/i386/pc/startup.S b/kern/i386/pc/startup.S
index 4de14a3d1..06e26dea3 100644
--- a/kern/i386/pc/startup.S
+++ b/kern/i386/pc/startup.S
@@ -764,6 +764,11 @@ FUNCTION(grub_biosdisk_get_diskinfo_int13_extensions)
 	movw	%cx, %ax
 	movw	%bx, %ds
 	int	$0x13		/* do the operation */
+	jc      noclean
+	/* Clean return value if carry isn't set to workaround
+	some buggy BIOSes.  */
+	xor     %ax, %ax
+noclean:
 	movb	%ah, %bl	/* save return value in %bl */
 	/* back to protected mode */
 	DATA32	call	real_to_prot
@@ -807,6 +812,11 @@ FUNCTION(grub_biosdisk_get_diskinfo_standard)
 	.code16
 	movb	$0x8, %ah
 	int	$0x13		/* do the operation */
+	jc      noclean2
+	/* Clean return value if carry isn't set to workaround
+	some buggy BIOSes.  */
+	xor     %ax, %ax
+noclean2:
 	/* check if successful */
 	testb	%ah, %ah
 	jnz	1f
diff --git a/kern/ieee1275/init.c b/kern/ieee1275/init.c
index 5d5d733d9..f3305d71c 100644
--- a/kern/ieee1275/init.c
+++ b/kern/ieee1275/init.c
@@ -164,7 +164,7 @@ static void grub_claim_heap (void)
 	/* Claim and use it.  */
 	if (grub_claimmap (addr, len) < 0)
 	  return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-			     "Failed to claim heap at 0x%llx, len 0x%llx\n",
+			     "failed to claim heap at 0x%llx, len 0x%llx",
 			     addr, len);
 	grub_mm_init_region ((void *) (grub_addr_t) addr, len);
       }
diff --git a/kern/ieee1275/mmap.c b/kern/ieee1275/mmap.c
index 317a12117..6f0652770 100644
--- a/kern/ieee1275/mmap.c
+++ b/kern/ieee1275/mmap.c
@@ -44,11 +44,11 @@ grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uin
   /* Load `/memory/available'.  */
   if (grub_ieee1275_finddevice ("/memory", &memory))
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
-		       "Couldn't find /memory node");
+		       "couldn't find /memory node");
   if (grub_ieee1275_get_integer_property (memory, "available", available,
 					  sizeof available, &available_size))
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
-		       "Couldn't examine /memory/available property");
+		       "couldn't examine /memory/available property");
 
   /* Decode each entry and call `hook'.  */
   i = 0;
diff --git a/kern/ieee1275/openfw.c b/kern/ieee1275/openfw.c
index 9a2b0c9aa..c38eb450f 100644
--- a/kern/ieee1275/openfw.c
+++ b/kern/ieee1275/openfw.c
@@ -308,13 +308,13 @@ grub_ieee1275_parse_args (const char *path, enum grub_ieee1275_parse_type ptype)
      file path properly.  */
   if (grub_ieee1275_finddevice (device, &dev))
     {
-      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Device %s not found\n", device);
+      grub_error (GRUB_ERR_UNKNOWN_DEVICE, "device %s not found", device);
       goto fail;
     }
   if (grub_ieee1275_get_property (dev, "device_type", &type, sizeof type, 0))
     {
       grub_error (GRUB_ERR_UNKNOWN_DEVICE,
-		  "Device %s lacks a device_type property\n", device);
+		  "device %s lacks a device_type property", device);
       goto fail;
     }
 
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;
diff --git a/kern/powerpc/dl.c b/kern/powerpc/dl.c
index 2891b0dbb..fa112b16f 100644
--- a/kern/powerpc/dl.c
+++ b/kern/powerpc/dl.c
@@ -106,7 +106,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
 		      Elf_Sword delta = value - (Elf_Word) addr;
 
 		      if (delta << 6 >> 6 != delta)
-			return grub_error (GRUB_ERR_BAD_MODULE, "Relocation overflow");
+			return grub_error (GRUB_ERR_BAD_MODULE, "relocation overflow");
 		      *addr = (*addr & 0xfc000003) | (delta & 0x3fffffc);
 		      break;
 		    }
@@ -125,7 +125,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
 
 		  default:
 		    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-				       "This relocation (%d) is not implemented yet",
+				       "this relocation (%d) is not implemented yet",
 				       ELF_R_TYPE (rel->r_info));
 		  }
 	      }
diff --git a/kern/sparc64/dl.c b/kern/sparc64/dl.c
index a4d99ff08..7932b4969 100644
--- a/kern/sparc64/dl.c
+++ b/kern/sparc64/dl.c
@@ -98,7 +98,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
                   case R_SPARC_32: /* 3 V-word32 */
                     if (value & 0xFFFFFFFF00000000)
                       return grub_error (GRUB_ERR_BAD_MODULE,
-                                         "Address out of 32 bits range");
+                                         "address out of 32 bits range");
                     *addr = value;
                     break;
                   case R_SPARC_WDISP30: /* 7 V-disp30 */
@@ -106,7 +106,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
                         (((value - (Elf_Addr) addr) & 0xFFFFFFFF00000000)
 			 != 0xFFFFFFFF00000000))
                       return grub_error (GRUB_ERR_BAD_MODULE,
-                                         "Displacement out of 30 bits range");
+                                         "displacement out of 30 bits range");
                     *addr = (*addr & 0xC0000000) |
                       (((grub_int32_t) ((value - (Elf_Addr) addr) >> 2)) &
                        0x3FFFFFFF);
@@ -114,7 +114,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
                   case R_SPARC_HI22: /* 9 V-imm22 */
                     if (((grub_int32_t) value) & 0xFF00000000)
                       return grub_error (GRUB_ERR_BAD_MODULE,
-                                         "High address out of 22 bits range");
+                                         "high address out of 22 bits range");
                     *addr = (*addr & 0xFFC00000) | ((value >> 10) & 0x3FFFFF);
                     break;
                   case R_SPARC_LO10: /* 12 T-simm13 */
@@ -131,7 +131,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
 		    break;
 		  default:
 		    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-				       "This relocation (%d) is not implemented yet",
+				       "this relocation (%d) is not implemented yet",
 				       ELF_R_TYPE (rel->r_info));
 		  }
 	      }
diff --git a/lib/arg.c b/lib/arg.c
index 6da9bb5dd..6a7bb8beb 100644
--- a/lib/arg.c
+++ b/lib/arg.c
@@ -22,6 +22,7 @@
 #include <grub/err.h>
 #include <grub/term.h>
 #include <grub/extcmd.h>
+#include <grub/i18n.h>
 
 /* Built-in parser for default options.  */
 #define SHORT_ARG_HELP	-100
@@ -30,9 +31,9 @@
 static const struct grub_arg_option help_options[] =
   {
     {"help", SHORT_ARG_HELP, 0,
-     "Display this help and exit.", 0, ARG_TYPE_NONE},
+     N_("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},
+     N_("Display the usage of this command and exit."), 0, ARG_TYPE_NONE},
     {0, 0, 0, 0, 0, 0}
   };
 
@@ -106,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 ("Usage: %s\n", cmd->cmd->summary);
+  grub_printf ("%s %s %s\n", _("Usage:"), cmd->cmd->name, _(cmd->cmd->summary));
 }
 
 void
@@ -143,7 +144,7 @@ grub_arg_show_help (grub_extcmd_t cmd)
 		}
 	    }
 
-	  const char *doc = opt->doc;
+	  const char *doc = _(opt->doc);
 	  for (;;)
 	    {
 	      while (spacing-- > 0)
@@ -176,7 +177,7 @@ grub_arg_show_help (grub_extcmd_t cmd)
     }
 
   show_usage (cmd);
-  grub_printf ("%s\n\n", cmd->cmd->description);
+  grub_printf ("%s\n\n", _(cmd->cmd->description));
   if (cmd->options)
     showargs (cmd->options);
   showargs (help_options);
@@ -274,7 +275,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
 	      if (! opt)
 		{
 		  grub_error (GRUB_ERR_BAD_ARGUMENT,
-			      "Unknown argument `-%c'\n", *curshort);
+			      "unknown argument `-%c'", *curshort);
 		  goto fail;
 		}
 
@@ -326,7 +327,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
 	  opt = find_long (cmd->options, arg + 2, arglen);
 	  if (! opt)
 	    {
-	      grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown argument `%s'\n", arg);
+	      grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown argument `%s'", arg);
 	      goto fail;
 	    }
 	}
@@ -337,7 +338,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
 	  if (! option)
 	    {
 	      grub_error (GRUB_ERR_BAD_ARGUMENT,
-			  "Missing mandatory option for `%s'\n", opt->longarg);
+			  "missing mandatory option for `%s'", opt->longarg);
 	      goto fail;
 	    }
 
@@ -359,7 +360,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
 		if (tail == 0 || tail == option || *tail != '\0' || grub_errno)
 		  {
 		    grub_error (GRUB_ERR_BAD_ARGUMENT,
-				"The argument `%s' requires an integer.",
+				"the argument `%s' requires an integer",
 				arg);
 
 		    goto fail;
@@ -382,8 +383,8 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
 	  if (option)
 	    {
 	      grub_error (GRUB_ERR_BAD_ARGUMENT,
-			  "A value was assigned to the argument `%s' while it "
-			  "doesn't require an argument\n", arg);
+			  "a value was assigned to the argument `%s' while it "
+			  "doesn't require an argument", arg);
 	      goto fail;
 	    }
 
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/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 84eb13d74..ca60b0be9 100644
--- a/loader/i386/bsd.c
+++ b/loader/i386/bsd.c
@@ -679,7 +679,7 @@ grub_netbsd_boot (void)
       + sizeof (struct grub_netbsd_btinfo_mmap_header)
       + count * sizeof (struct grub_netbsd_btinfo_mmap_entry)
       > grub_os_area_addr + grub_os_area_size)
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "No memory for boot info.");
+    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "no memory for boot info");
 
   curarg = mmap = (struct grub_netbsd_btinfo_mmap_header *) kern_end;
   pm = (struct grub_netbsd_btinfo_mmap_entry *) (mmap + 1);
@@ -750,10 +750,10 @@ grub_bsd_load_aout (grub_file_t file)
     return grub_errno;
 
   if (grub_file_read (file, &ah, sizeof (ah)) != sizeof (ah))
-    return grub_error (GRUB_ERR_READ_ERROR, "Cannot read the a.out header");
+    return grub_error (GRUB_ERR_READ_ERROR, "cannot read the a.out header");
 
   if (grub_aout_get_type (&ah) != AOUT_TYPE_AOUT32)
-    return grub_error (GRUB_ERR_BAD_OS, "Invalid a.out header");
+    return grub_error (GRUB_ERR_BAD_OS, "invalid a.out header");
 
   entry = ah.aout32.a_entry & 0xFFFFFF;
 
@@ -771,7 +771,7 @@ grub_bsd_load_aout (grub_file_t file)
     }
 
   if (load_addr < 0x100000)
-    return grub_error (GRUB_ERR_BAD_OS, "Load address below 1M");
+    return grub_error (GRUB_ERR_BAD_OS, "load address below 1M");
 
   kern_start = load_addr;
   kern_end = load_addr + ah.aout32.a_text + ah.aout32.a_data;
@@ -811,7 +811,7 @@ grub_bsd_elf32_hook (Elf32_Phdr * phdr, grub_addr_t * addr, int *do_load)
 
   if ((paddr < grub_os_area_addr)
       || (paddr + phdr->p_memsz > grub_os_area_addr + grub_os_area_size))
-    return grub_error (GRUB_ERR_OUT_OF_RANGE, "Address 0x%x is out of range",
+    return grub_error (GRUB_ERR_OUT_OF_RANGE, "address 0x%x is out of range",
 		       paddr);
 
   if ((!kern_start) || (paddr < kern_start))
@@ -842,7 +842,7 @@ grub_bsd_elf64_hook (Elf64_Phdr * phdr, grub_addr_t * addr, int *do_load)
 
   if ((paddr < grub_os_area_addr)
       || (paddr + phdr->p_memsz > grub_os_area_addr + grub_os_area_size))
-    return grub_error (GRUB_ERR_OUT_OF_RANGE, "Address 0x%x is out of range",
+    return grub_error (GRUB_ERR_OUT_OF_RANGE, "address 0x%x is out of range",
 		       paddr);
 
   if ((!kern_start) || (paddr < kern_start))
@@ -871,7 +871,7 @@ grub_bsd_load_elf (grub_elf_t elf)
       is_64bit = 1;
 
       if (! grub_cpuid_has_longmode)
-	return grub_error (GRUB_ERR_BAD_OS, "Your CPU does not implement AMD64 architecture.");
+	return grub_error (GRUB_ERR_BAD_OS, "your CPU does not implement AMD64 architecture");
 
       /* FreeBSD has 64-bit entry point.  */
       if (kernel_type == KERNEL_TYPE_FREEBSD)
@@ -887,7 +887,7 @@ grub_bsd_load_elf (grub_elf_t elf)
       return grub_elf64_load (elf, grub_bsd_elf64_hook, 0, 0);
     }
   else
-    return grub_error (GRUB_ERR_BAD_OS, "Invalid elf");
+    return grub_error (GRUB_ERR_BAD_OS, "invalid elf");
 }
 
 static grub_err_t
@@ -902,7 +902,7 @@ grub_bsd_load (int argc, char *argv[])
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No kernel specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
       goto fail;
     }
 
@@ -1024,14 +1024,14 @@ grub_cmd_openbsd (grub_extcmd_t cmd, int argc, char *argv[])
       int unit, part;
       if (*(arg++) != 'w' || *(arg++) != 'd')
 	return grub_error (GRUB_ERR_BAD_ARGUMENT,
-			   "Only device specifications of form "
-			   "wd<number><lowercase letter> are supported.");
+			   "only device specifications of form "
+			   "wd<number><lowercase letter> are supported");
 
       unit = grub_strtoul (arg, (char **) &arg, 10);
       if (! (arg && *arg >= 'a' && *arg <= 'z'))
 	return grub_error (GRUB_ERR_BAD_ARGUMENT,
-			   "Only device specifications of form "
-			   "wd<number><lowercase letter> are supported.");
+			   "only device specifications of form "
+			   "wd<number><lowercase letter> are supported");
 
       part = *arg - 'a';
 
@@ -1076,15 +1076,15 @@ grub_cmd_freebsd_loadenv (grub_command_t cmd __attribute__ ((unused)),
 
   if (kernel_type == KERNEL_TYPE_NONE)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-		       "You need to load the kernel first.");
+		       "you need to load the kernel first");
 
   if (kernel_type != KERNEL_TYPE_FREEBSD)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-		       "Only FreeBSD support environment");
+		       "only FreeBSD support environment");
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No filename");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no filename");
       goto fail;
     }
 
@@ -1170,15 +1170,15 @@ grub_cmd_freebsd_module (grub_command_t cmd __attribute__ ((unused)),
 
   if (kernel_type == KERNEL_TYPE_NONE)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-		       "You need to load the kernel first.");
+		       "you need to load the kernel first");
 
   if (kernel_type != KERNEL_TYPE_FREEBSD)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-		       "Only FreeBSD support module");
+		       "only FreeBSD support module");
 
   if (!is_elf_kernel)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-		       "Only ELF kernel support module");
+		       "only ELF kernel support module");
 
   /* List the current modules if no parameter.  */
   if (!argc)
@@ -1193,7 +1193,7 @@ grub_cmd_freebsd_module (grub_command_t cmd __attribute__ ((unused)),
 
   if (kern_end + file->size > grub_os_area_addr + grub_os_area_size)
     {
-      grub_error (GRUB_ERR_OUT_OF_RANGE, "Not enough memory for the module");
+      grub_error (GRUB_ERR_OUT_OF_RANGE, "not enough memory for the module");
       goto fail;
     }
 
@@ -1236,15 +1236,15 @@ grub_cmd_freebsd_module_elf (grub_command_t cmd __attribute__ ((unused)),
 
   if (kernel_type == KERNEL_TYPE_NONE)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-		       "You need to load the kernel first.");
+		       "you need to load the kernel first");
 
   if (kernel_type != KERNEL_TYPE_FREEBSD)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-		       "Only FreeBSD support module");
+		       "only FreeBSD support module");
 
   if (! is_elf_kernel)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-		       "Only ELF kernel support module");
+		       "only ELF kernel support module");
 
   /* List the current modules if no parameter.  */
   if (! argc)
@@ -1280,25 +1280,25 @@ GRUB_MOD_INIT (bsd)
 {
   cmd_freebsd = grub_register_extcmd ("kfreebsd", grub_cmd_freebsd,
 				      GRUB_COMMAND_FLAG_BOTH,
-				      "kfreebsd FILE", "Load kernel of FreeBSD.",
+				      "FILE", "Load kernel of FreeBSD.",
 				      freebsd_opts);
   cmd_openbsd = grub_register_extcmd ("kopenbsd", grub_cmd_openbsd,
 				      GRUB_COMMAND_FLAG_BOTH,
-				      "kopenbsd FILE", "Load kernel of OpenBSD.",
+				      "FILE", "Load kernel of OpenBSD.",
 				      openbsd_opts);
   cmd_netbsd = grub_register_extcmd ("knetbsd", grub_cmd_netbsd,
 				     GRUB_COMMAND_FLAG_BOTH,
-				     "knetbsd FILE", "Load kernel of NetBSD.",
+				     "FILE", "Load kernel of NetBSD.",
 				     netbsd_opts);
   cmd_freebsd_loadenv =
     grub_register_command ("kfreebsd_loadenv", grub_cmd_freebsd_loadenv,
-			   0, "load FreeBSD env");
+			   0, "Load FreeBSD env.");
   cmd_freebsd_module =
     grub_register_command ("kfreebsd_module", grub_cmd_freebsd_module,
-			   0, "load FreeBSD kernel module");
+			   0, "Load FreeBSD kernel module.");
   cmd_freebsd_module_elf =
     grub_register_command ("kfreebsd_module_elf", grub_cmd_freebsd_module_elf,
-			   0, "load FreeBSD kernel module (ELF)");
+			   0, "Load FreeBSD kernel module (ELF).");
 
   my_mod = mod;
 }
diff --git a/loader/i386/bsdXX.c b/loader/i386/bsdXX.c
index aedc204b2..4c1c035a9 100644
--- a/loader/i386/bsdXX.c
+++ b/loader/i386/bsdXX.c
@@ -12,7 +12,7 @@ load (grub_file_t file, void *where, grub_off_t off, grub_size_t size)
 {
   if (PTR_TO_UINT32 (where) + size > grub_os_area_addr + grub_os_area_size)
     return grub_error (GRUB_ERR_OUT_OF_RANGE,
-		       "Not enough memory for the module");
+		       "not enough memory for the module");
   if (grub_file_seek (file, off) == (grub_off_t) -1)
     return grub_errno;
   if (grub_file_read (file, where, size)
@@ -116,7 +116,7 @@ SUFFIX (grub_freebsd_load_elfmodule_obj) (grub_file_t file, int argc,
 	case SHT_NOBITS:
 	  if (curload + s->sh_size > grub_os_area_addr + grub_os_area_size)
 	    return grub_error (GRUB_ERR_OUT_OF_RANGE,
-			       "Not enough memory for the module");
+			       "not enough memory for the module");
 	  grub_memset (UINT_TO_PTR (curload), 0, s->sh_size);
 	  break;
 	}
@@ -185,7 +185,7 @@ SUFFIX (grub_freebsd_load_elfmodule) (grub_file_t file, int argc, char *argv[],
 	  if (module + s->sh_addr + s->sh_size
 	      > grub_os_area_addr + grub_os_area_size)
 	    return grub_error (GRUB_ERR_OUT_OF_RANGE,
-			       "Not enough memory for the module");
+			       "not enough memory for the module");
 	  grub_memset (UINT_TO_PTR (module + s->sh_addr), 0, s->sh_size);
 	  break;
 	}
@@ -259,7 +259,7 @@ SUFFIX (grub_freebsd_load_elf_meta) (grub_file_t file, grub_addr_t *kern_end)
   if (*kern_end + 4 * sizeof (grub_freebsd_addr_t) + symsize + strsize
       > grub_os_area_addr + grub_os_area_size)
     return grub_error (GRUB_ERR_OUT_OF_RANGE,
-		       "Not enough memory for kernel symbols");
+		       "not enough memory for kernel symbols");
 
   symstart = curload = ALIGN_UP (*kern_end, sizeof (grub_freebsd_addr_t));
   *((grub_freebsd_addr_t *) UINT_TO_PTR (curload)) = symsize;
diff --git a/loader/i386/efi/linux.c b/loader/i386/efi/linux.c
index 8cd4d23f2..1c256e377 100644
--- a/loader/i386/efi/linux.c
+++ b/loader/i386/efi/linux.c
@@ -671,7 +671,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   len = 0x400 - sizeof (lh);
   if (grub_file_read (file, (char *) real_mode_mem + sizeof (lh), len) != len)
     {
-      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
       goto fail;
     }
 
@@ -853,7 +853,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   len = prot_size;
   if (grub_file_read (file, (void *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
-    grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+    grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
 
   if (grub_errno == GRUB_ERR_NONE)
     {
@@ -890,13 +890,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No module specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
       goto fail;
     }
 
   if (! loaded)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the kernel first.");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the kernel first");
       goto fail;
     }
 
@@ -966,7 +966,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (grub_file_read (file, initrd_mem, size) != size)
     {
-      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
       goto fail;
     }
 
@@ -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/efi/xnu.c b/loader/i386/efi/xnu.c
index 236732804..a7ede1960 100644
--- a/loader/i386/efi/xnu.c
+++ b/loader/i386/efi/xnu.c
@@ -148,10 +148,10 @@ grub_xnu_set_video (struct grub_xnu_boot_params *params)
 
   c = grub_efi_locate_protocol (&uga_draw_guid, 0);
   if (! c)
-    return grub_error (GRUB_ERR_IO, "Couldn't find UGADraw");
+    return grub_error (GRUB_ERR_IO, "couldn't find UGADraw");
 
   if (efi_call_5 (c->get_mode, c, &width, &height, &depth, &rate))
-    return grub_error (GRUB_ERR_IO, "Couldn't retrieve video mode");
+    return grub_error (GRUB_ERR_IO, "couldn't retrieve video mode");
 
   grub_printf ("Video mode: %ux%u-%u@%u\n", width, height, depth, rate);
 
@@ -163,7 +163,7 @@ grub_xnu_set_video (struct grub_xnu_boot_params *params)
   grub_efi_set_text_mode (1);
 
   if (! ret)
-    return grub_error (GRUB_ERR_IO, "Can\'t find frame buffer address\n");
+    return grub_error (GRUB_ERR_IO, "can\'t find frame buffer address");
 
   grub_printf ("Frame buffer base: 0x%x\n", fb_base);
   grub_printf ("Video line length: %d\n", line_len);
diff --git a/loader/i386/ieee1275/linux.c b/loader/i386/ieee1275/linux.c
index 529d1590a..b577de964 100644
--- a/loader/i386/ieee1275/linux.c
+++ b/loader/i386/ieee1275/linux.c
@@ -211,7 +211,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   kernel_size = prot_size;
   if (grub_file_read (file, kernel_addr, prot_size) != (int) prot_size)
-    grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+    grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
 
   if (grub_errno == GRUB_ERR_NONE)
     grub_loader_set (grub_linux_boot, grub_linux_unload, 1);
@@ -242,13 +242,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No module specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
       goto fail;
     }
 
   if (! kernel_addr)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the kernel first.");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the kernel first");
       goto fail;
     }
 
@@ -260,7 +260,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
   if (grub_file_read (file, (void *) GRUB_OFW_LINUX_INITRD_ADDR,
                       initrd_size) != (int) initrd_size)
     {
-      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
       goto fail;
     }
 
@@ -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 82bfd6b95..899216783 100644
--- a/loader/i386/linux.c
+++ b/loader/i386/linux.c
@@ -673,7 +673,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   len = 0x400 - sizeof (lh);
   if (grub_file_read (file, (char *) real_mode_mem + sizeof (lh), len) != len)
     {
-      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
       goto fail;
     }
 
@@ -862,7 +862,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   len = prot_size;
   if (grub_file_read (file, (void *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
-    grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+    grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
 
   if (grub_errno == GRUB_ERR_NONE)
     {
@@ -897,13 +897,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No module specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
       goto fail;
     }
 
   if (! loaded)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the kernel first.");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the kernel first");
       goto fail;
     }
 
@@ -951,7 +951,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (addr < addr_min)
     {
-      grub_error (GRUB_ERR_OUT_OF_RANGE, "The initrd is too big");
+      grub_error (GRUB_ERR_OUT_OF_RANGE, "the initrd is too big");
       goto fail;
     }
 
@@ -959,7 +959,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (grub_file_read (file, initrd_mem, size) != size)
     {
-      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
       goto fail;
     }
 
@@ -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/multiboot.c b/loader/i386/multiboot.c
index be824e2f4..a52b8d5d6 100644
--- a/loader/i386/multiboot.c
+++ b/loader/i386/multiboot.c
@@ -65,7 +65,7 @@ grub_multiboot_boot (void)
 {
   struct grub_relocator32_state state =
     {
-      .eax = MULTIBOOT_MAGIC2,
+      .eax = MULTIBOOT_BOOTLOADER_MAGIC,
       .ebx = PTR_TO_UINT32 (mbi_dest),
       .ecx = 0,
       .edx = 0,
@@ -226,21 +226,21 @@ grub_multiboot (int argc, char *argv[])
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No kernel specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
       goto fail;
     }
 
   file = grub_gzfile_open (argv[0], 1);
   if (! file)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "Couldn't open file");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "couldn't open file");
       goto fail;
     }
 
   len = grub_file_read (file, buffer, MULTIBOOT_SEARCH);
   if (len < 32)
     {
-      grub_error (GRUB_ERR_BAD_OS, "File too small");
+      grub_error (GRUB_ERR_BAD_OS, "file too small");
       goto fail;
     }
 
@@ -250,21 +250,21 @@ grub_multiboot (int argc, char *argv[])
        ((char *) header <= buffer + len - 12) || (header = 0);
        header = (struct multiboot_header *) ((char *) header + 4))
     {
-      if (header->magic == MULTIBOOT_MAGIC
+      if (header->magic == MULTIBOOT_HEADER_MAGIC
 	  && !(header->magic + header->flags + header->checksum))
 	break;
     }
 
   if (header == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No multiboot header found");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no multiboot header found");
       goto fail;
     }
 
   if (header->flags & MULTIBOOT_UNSUPPORTED)
     {
       grub_error (GRUB_ERR_UNKNOWN_OS,
-		  "Unsupported flag: 0x%x", header->flags);
+		  "unsupported flag: 0x%x", header->flags);
       goto fail;
     }
 
@@ -408,14 +408,14 @@ grub_module  (int argc, char *argv[])
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No module specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
       goto fail;
     }
 
   if (!mbi)
     {
       grub_error (GRUB_ERR_BAD_ARGUMENT,
-		  "You need to load the multiboot kernel first");
+		  "you need to load the multiboot kernel first");
       goto fail;
     }
 
@@ -430,7 +430,7 @@ grub_module  (int argc, char *argv[])
 
   if (grub_file_read (file, module, size) != size)
     {
-      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
       goto fail;
     }
 
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 c5279f6ce..b93754559 100644
--- a/loader/i386/pc/linux.c
+++ b/loader/i386/pc/linux.c
@@ -234,7 +234,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   len = real_size + GRUB_DISK_SECTOR_SIZE - sizeof (lh);
   if (grub_file_read (file, grub_linux_tmp_addr + sizeof (lh), len) != len)
     {
-      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
       goto fail;
     }
 
@@ -265,7 +265,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 
   len = prot_size;
   if (grub_file_read (file, (void *) GRUB_LINUX_BZIMAGE_ADDR, len) != len)
-    grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+    grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
 
   if (grub_errno == GRUB_ERR_NONE)
     {
@@ -299,13 +299,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No module specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
       goto fail;
     }
 
   if (!loaded)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the kernel first.");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the kernel first");
       goto fail;
     }
 
@@ -314,7 +314,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
   if (!(lh->header == grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE)
 	&& grub_le_to_cpu16 (lh->version) >= 0x0200))
     {
-      grub_error (GRUB_ERR_BAD_OS, "The kernel is too old for initrd.");
+      grub_error (GRUB_ERR_BAD_OS, "the kernel is too old for initrd");
       goto fail;
     }
 
@@ -357,13 +357,13 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (addr < addr_min)
     {
-      grub_error (GRUB_ERR_OUT_OF_RANGE, "The initrd is too big");
+      grub_error (GRUB_ERR_OUT_OF_RANGE, "the initrd is too big");
       goto fail;
     }
 
   if (grub_file_read (file, (void *) addr, size) != size)
     {
-      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
       goto fail;
     }
 
@@ -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/i386/pc/multiboot2.c b/loader/i386/pc/multiboot2.c
index 6ef8c70ca..9bfe5d248 100644
--- a/loader/i386/pc/multiboot2.c
+++ b/loader/i386/pc/multiboot2.c
@@ -42,7 +42,7 @@ grub_mb2_arch_elf32_hook (Elf32_Phdr *phdr,
 
   if ((paddr < grub_os_area_addr)
       || (paddr + phdr->p_memsz > grub_os_area_addr + grub_os_area_size))
-    return grub_error(GRUB_ERR_OUT_OF_RANGE,"Address 0x%x is out of range",
+    return grub_error(GRUB_ERR_OUT_OF_RANGE,"address 0x%x is out of range",
                       paddr);
 
   return GRUB_ERR_NONE;
@@ -64,7 +64,7 @@ grub_mb2_arch_elf64_hook (Elf64_Phdr *phdr,
 
   if ((paddr < grub_os_area_addr)
       || (paddr + phdr->p_memsz > grub_os_area_addr + grub_os_area_size))
-    return grub_error (GRUB_ERR_OUT_OF_RANGE, "Address 0x%x is out of range",
+    return grub_error (GRUB_ERR_OUT_OF_RANGE, "address 0x%x is out of range",
 		       paddr);
 
   return GRUB_ERR_NONE;
diff --git a/loader/i386/xnu.c b/loader/i386/xnu.c
index 4786bfd39..f71e2c306 100644
--- a/loader/i386/xnu.c
+++ b/loader/i386/xnu.c
@@ -527,12 +527,12 @@ grub_cmd_devprop_load (grub_command_t cmd __attribute__ ((unused)),
   unsigned i, j;
 
   if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "File name required. ");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
 
   file = grub_gzfile_open (args[0], 1);
   if (! file)
     return grub_error (GRUB_ERR_FILE_NOT_FOUND,
-		       "Couldn't load device-propertie dump. ");
+		       "couldn't load device-propertie dump");
   size = grub_file_size (file);
   buf = grub_malloc (size);
   if (!buf)
diff --git a/loader/ieee1275/multiboot2.c b/loader/ieee1275/multiboot2.c
index 3b0ab758e..8c0bc09ec 100644
--- a/loader/ieee1275/multiboot2.c
+++ b/loader/ieee1275/multiboot2.c
@@ -51,7 +51,7 @@ grub_mb2_arch_elf32_hook (Elf32_Phdr *phdr,
 
   rc = grub_claimmap (phdr->p_paddr, phdr->p_memsz);
   if (rc)
-    return grub_error(GRUB_ERR_OUT_OF_MEMORY, "Couldn't claim %x - %x",
+    return grub_error(GRUB_ERR_OUT_OF_MEMORY, "couldn't claim %x - %x",
 		      phdr->p_paddr, phdr->p_paddr + phdr->p_memsz);
 
   grub_dprintf ("loader", "Loading segment at 0x%x - 0x%x\n", phdr->p_paddr,
@@ -77,7 +77,7 @@ grub_mb2_arch_elf64_hook (Elf64_Phdr *phdr,
 
   rc = grub_claimmap (phdr->p_paddr, phdr->p_memsz);
   if (rc)
-    return grub_error(GRUB_ERR_OUT_OF_MEMORY, "Couldn't claim 0x%lx - 0x%lx",
+    return grub_error(GRUB_ERR_OUT_OF_MEMORY, "couldn't claim 0x%lx - 0x%lx",
 		      phdr->p_paddr, phdr->p_paddr + phdr->p_memsz);
 
   grub_dprintf ("loader", "Loading segment at 0x%lx - 0x%lx\n",
@@ -96,7 +96,7 @@ grub_mb2_arch_module_alloc (grub_size_t size, grub_addr_t *addr)
   rc = grub_ieee1275_claim (0, size, MULTIBOOT2_MOD_ALIGN, addr);
   if (rc)
     return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-		       "Firmware couldn't allocate memory (size 0x%lx)", size);
+		       "firmware couldn't allocate memory (size 0x%lx)", size);
 
   return GRUB_ERR_NONE;
 }
diff --git a/loader/macho.c b/loader/macho.c
index a23f5b206..199d6f111 100644
--- a/loader/macho.c
+++ b/loader/macho.c
@@ -71,7 +71,7 @@ grub_macho_file (grub_file_t file)
       != sizeof (filestart))
     {
       grub_error_push ();
-      grub_error (GRUB_ERR_READ_ERROR, "Cannot read Mach-O header.");
+      grub_error (GRUB_ERR_READ_ERROR, "cannot read Mach-O header");
       goto fail;
     }
 
@@ -95,7 +95,7 @@ grub_macho_file (grub_file_t file)
 	{
 	  grub_free (archs);
 	  grub_error_push ();
-	  grub_error (GRUB_ERR_READ_ERROR, "Cannot read Mach-O header.");
+	  grub_error (GRUB_ERR_READ_ERROR, "cannot read Mach-O header");
 	  goto fail;
 	}
 
diff --git a/loader/machoXX.c b/loader/machoXX.c
index 8441e0128..918ddbb20 100644
--- a/loader/machoXX.c
+++ b/loader/machoXX.c
@@ -25,13 +25,13 @@ SUFFIX (grub_macho_parse) (grub_macho_t macho)
       || grub_file_read (macho->file, &head, sizeof (head))
       != sizeof(head))
     {
-      grub_error (GRUB_ERR_READ_ERROR, "Cannot read Mach-O header.");
+      grub_error (GRUB_ERR_READ_ERROR, "cannot read Mach-O header");
       macho->offsetXX = -1;
       return;
     }
   if (head.magic != GRUB_MACHO_MAGIC)
     {
-      grub_error (GRUB_ERR_BAD_OS, "Invalid Mach-O " XX "-bit header.");
+      grub_error (GRUB_ERR_BAD_OS, "invalid Mach-O " XX "-bit header");
       macho->offsetXX = -1;
       return;
     }
@@ -49,7 +49,7 @@ SUFFIX (grub_macho_parse) (grub_macho_t macho)
 		      (grub_size_t) macho->cmdsizeXX)
       != (grub_ssize_t) macho->cmdsizeXX)
     {
-      grub_error (GRUB_ERR_READ_ERROR, "Cannot read Mach-O header.");
+      grub_error (GRUB_ERR_READ_ERROR, "cannot read Mach-O header");
       macho->offsetXX = -1;
     }
 }
@@ -66,7 +66,7 @@ grub_macho_cmds_iterate (grub_macho_t macho,
   grub_uint8_t *hdrs = macho->cmdsXX;
   int i;
   if (! macho->cmdsXX)
-    return grub_error (GRUB_ERR_BAD_OS, "Couldn't find " XX "-bit Mach-O");
+    return grub_error (GRUB_ERR_BAD_OS, "couldn't find " XX "-bit Mach-O");
   for (i = 0; i < macho->ncmdsXX; i++)
     {
       struct grub_macho_cmd *hdr = (struct grub_macho_cmd *) hdrs;
@@ -92,13 +92,13 @@ SUFFIX (grub_macho_readfile) (grub_macho_t macho, void *dest)
   grub_ssize_t read;
   if (! SUFFIX (grub_macho_contains_macho) (macho))
     return grub_error (GRUB_ERR_BAD_OS,
-		       "Couldn't read architecture-specific part");
+		       "couldn't read architecture-specific part");
 
   if (grub_file_seek (macho->file, macho->offsetXX) == (grub_off_t) -1)
     {
       grub_error_push ();
       return grub_error (GRUB_ERR_BAD_OS,
-			 "Invalid offset in program header.");
+			 "invalid offset in program header");
     }
 
   read = grub_file_read (macho->file, dest,
@@ -107,7 +107,7 @@ SUFFIX (grub_macho_readfile) (grub_macho_t macho, void *dest)
     {
       grub_error_push ();
       return grub_error (GRUB_ERR_BAD_OS,
-			 "Couldn't read architecture-specific part");
+			 "couldn't read architecture-specific part");
     }
   return GRUB_ERR_NONE;
 }
@@ -151,11 +151,11 @@ SUFFIX (grub_macho_size) (grub_macho_t macho, grub_macho_addr_t *segments_start,
   grub_macho_cmds_iterate (macho, calcsize, 0);
 
   if (nr_phdrs == 0)
-    return grub_error (GRUB_ERR_BAD_OS, "No program headers present");
+    return grub_error (GRUB_ERR_BAD_OS, "no program headers present");
 
   if (*segments_end < *segments_start)
     /* Very bad addresses.  */
-    return grub_error (GRUB_ERR_BAD_OS, "Bad program header load addresses");
+    return grub_error (GRUB_ERR_BAD_OS, "bad program header load addresses");
 
   return GRUB_ERR_NONE;
 }
@@ -187,7 +187,7 @@ SUFFIX (grub_macho_load) (grub_macho_t macho, char *offset, int flags)
       {
 	grub_error_push ();
 	grub_error (GRUB_ERR_BAD_OS,
-		    "Invalid offset in program header.");
+		    "invalid offset in program header");
 	return 1;
       }
 
@@ -201,8 +201,8 @@ SUFFIX (grub_macho_load) (grub_macho_t macho, char *offset, int flags)
 	    /* XXX How can we free memory from `load_hook'? */
 	    grub_error_push ();
 	    err=grub_error (GRUB_ERR_BAD_OS,
-			    "Couldn't read segment from file: "
-			    "wanted 0x%lx bytes; read 0x%lx bytes.",
+			    "couldn't read segment from file: "
+			    "wanted 0x%lx bytes; read 0x%lx bytes",
 			    hdr->filesize, read);
 	    return 1;
 	  }
diff --git a/loader/multiboot2.c b/loader/multiboot2.c
index 4c73a2f17..dbdee9c87 100644
--- a/loader/multiboot2.c
+++ b/loader/multiboot2.c
@@ -319,14 +319,14 @@ grub_multiboot2 (int argc, char *argv[])
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No kernel specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
       goto fail;
     }
 
   file = grub_gzfile_open (argv[0], 1);
   if (! file)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "Couldn't open file");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "couldn't open file");
       goto fail;
     }
 
@@ -337,7 +337,7 @@ grub_multiboot2 (int argc, char *argv[])
   len = grub_file_read (file, buffer, MULTIBOOT2_HEADER_SEARCH);
   if (len < 32)
     {
-      grub_error (GRUB_ERR_BAD_OS, "File too small");
+      grub_error (GRUB_ERR_BAD_OS, "file too small");
       goto fail;
     }
 
@@ -378,7 +378,7 @@ grub_multiboot2 (int argc, char *argv[])
 	err = grub_mb2_load_other (file, header);
       else
 	err = grub_error (GRUB_ERR_BAD_OS,
-			  "Need multiboot 2 header to load non-ELF files.");
+			  "need multiboot 2 header to load non-ELF files");
       grub_file_close (file);
     }
 
@@ -406,20 +406,20 @@ grub_module2 (int argc, char *argv[])
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No module specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified");
       return;
     }
 
   if (argc == 1)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No module type specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no module type specified");
       return;
     }
 
   if (entry == 0)
     {
       grub_error (GRUB_ERR_BAD_ARGUMENT,
-		  "You need to load the multiboot kernel first");
+		  "you need to load the multiboot kernel first");
       return;
     }
 
@@ -437,7 +437,7 @@ grub_module2 (int argc, char *argv[])
 		modaddr + modsize);
   if (grub_file_read (file, (void *) modaddr, modsize) != modsize)
     {
-      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
       goto out;
     }
 
diff --git a/loader/multiboot_loader.c b/loader/multiboot_loader.c
index 9078d0622..24c0c5eac 100644
--- a/loader/multiboot_loader.c
+++ b/loader/multiboot_loader.c
@@ -58,7 +58,7 @@ find_multi_boot1_header (grub_file_t file)
       ((char *) header <= buffer + len - 12) || (header = 0);
       header = (struct multiboot_header *) ((char *) header + 4))
     {
-      if (header->magic == MULTIBOOT_MAGIC
+      if (header->magic == MULTIBOOT_HEADER_MAGIC
           && !(header->magic + header->flags + header->checksum))
         {
            found_status = 1;
@@ -108,14 +108,14 @@ grub_cmd_multiboot_loader (grub_command_t cmd __attribute__ ((unused)),
 
   if (argc == 0)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "No kernel specified");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified");
       goto fail;
     }
 
   file = grub_gzfile_open (argv[0], 1);
   if (! file)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "Couldn't open file");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "couldn't open file");
       goto fail;
     }
 
@@ -126,7 +126,7 @@ grub_cmd_multiboot_loader (grub_command_t cmd __attribute__ ((unused)),
     header_multi_ver_found = 2;
   else
     {
-      grub_error (GRUB_ERR_BAD_OS, "Multiboot header not found");
+      grub_error (GRUB_ERR_BAD_OS, "multiboot header not found");
       goto fail;
     }
 
@@ -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 79fbf0b02..7996a22f6 100644
--- a/loader/powerpc/ieee1275/linux.c
+++ b/loader/powerpc/ieee1275/linux.c
@@ -75,10 +75,10 @@ grub_linux_release_mem (void)
   linux_args = 0;
 
   if (linux_addr && grub_ieee1275_release (linux_addr, linux_size))
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Can not release memory");
+    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot release memory");
 
   if (initrd_addr && grub_ieee1275_release (initrd_addr, initrd_size))
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Can not release memory");
+    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot release memory");
 
   linux_addr = 0;
   initrd_addr = 0;
@@ -128,7 +128,7 @@ grub_linux_load32 (grub_elf_t elf)
 	break;
     }
   if (found_addr == -1)
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Could not claim memory.");
+    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't claim memory");
 
   /* Now load the segments into the area we claimed.  */
   auto grub_err_t offset_phdr (Elf32_Phdr *phdr, grub_addr_t *addr, int *do_load);
@@ -178,7 +178,7 @@ grub_linux_load64 (grub_elf_t elf)
 	break;
     }
   if (found_addr == -1)
-    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Could not claim memory.");
+    return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't claim memory");
 
   /* Now load the segments into the area we claimed.  */
   auto grub_err_t offset_phdr (Elf64_Phdr *phdr, grub_addr_t *addr, int *do_load);
@@ -222,7 +222,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   if (elf->ehdr.ehdr32.e_type != ET_EXEC)
     {
       grub_error (GRUB_ERR_UNKNOWN_OS,
-		  "This ELF file is not of the right type\n");
+		  "this ELF file is not of the right type");
       goto out;
     }
 
@@ -236,7 +236,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
     grub_linux_load64 (elf);
   else
     {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "Unknown ELF class");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, "unknown ELF class");
       goto out;
     }
 
@@ -297,7 +297,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (!loaded)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the kernel first.");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the kernel first");
       goto fail;
     }
 
@@ -321,7 +321,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (found_addr == -1)
     {
-      grub_error (GRUB_ERR_OUT_OF_MEMORY, "Can not claim memory");
+      grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot claim memory");
       goto fail;
     }
 
@@ -330,7 +330,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
   if (grub_file_read (file, (void *) addr, size) != size)
     {
       grub_ieee1275_release (addr, size);
-      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
       goto fail;
     }
 
@@ -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 df420d8a0..3af93df7d 100644
--- a/loader/sparc64/ieee1275/linux.c
+++ b/loader/sparc64/ieee1275/linux.c
@@ -256,12 +256,12 @@ grub_linux_load64 (grub_elf_t elf)
   paddr = alloc_phys (linux_size + off);
   if (paddr == (grub_addr_t) -1)
     return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-		       "Could not allocate physical memory.");
+		       "couldn't allocate physical memory");
   ret = grub_ieee1275_map_physical (paddr, linux_addr - off,
 				    linux_size + off, IEEE1275_MAP_DEFAULT);
   if (ret)
     return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-		       "Could not map physical memory.");
+		       "couldn't map physical memory");
 
   grub_dprintf ("loader", "Loading linux at vaddr 0x%lx, paddr 0x%lx, size 0x%lx\n",
 		linux_addr, paddr, linux_size);
@@ -317,7 +317,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   if (elf->ehdr.ehdr32.e_type != ET_EXEC)
     {
       grub_error (GRUB_ERR_UNKNOWN_OS,
-		  "This ELF file is not of the right type\n");
+		  "this ELF file is not of the right type");
       goto out;
     }
 
@@ -328,7 +328,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
     grub_linux_load64 (elf);
   else
     {
-      grub_error (GRUB_ERR_BAD_FILE_TYPE, "Unknown ELF class");
+      grub_error (GRUB_ERR_BAD_FILE_TYPE, "unknown ELF class");
       goto out;
     }
 
@@ -390,7 +390,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (!loaded)
     {
-      grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the kernel first.");
+      grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the kernel first");
       goto fail;
     }
 
@@ -405,14 +405,14 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
   if (paddr == (grub_addr_t) -1)
     {
       grub_error (GRUB_ERR_OUT_OF_MEMORY,
-		  "Could not allocate physical memory.");
+		  "couldn't allocate physical memory");
       goto fail;
     }
   ret = grub_ieee1275_map_physical (paddr, addr, size, IEEE1275_MAP_DEFAULT);
   if (ret)
     {
       grub_error (GRUB_ERR_OUT_OF_MEMORY,
-		  "Could not map physical memory.");
+		  "couldn't map physical memory");
       goto fail;
     }
 
@@ -421,7 +421,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   if (grub_file_read (file, (void *) addr, size) != size)
     {
-      grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file");
+      grub_error (GRUB_ERR_FILE_READ_ERROR, "couldn't read file");
       goto fail;
     }
 
@@ -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 37239e23c..f3ae3888a 100644
--- a/loader/xnu.c
+++ b/loader/xnu.c
@@ -365,7 +365,7 @@ grub_cmd_xnu_kernel (grub_command_t cmd __attribute__ ((unused)),
     {
       grub_macho_close (macho);
       return grub_error (GRUB_ERR_BAD_OS,
-			 "Kernel doesn't contain suitable 32-bit architecture");
+			 "kernel doesn't contain suitable 32-bit architecture");
     }
 
   err = grub_macho_size32 (macho, &startcode, &endcode, GRUB_MACHO_NOBSS);
@@ -463,7 +463,7 @@ grub_cmd_xnu_kernel64 (grub_command_t cmd __attribute__ ((unused)),
     {
       grub_macho_close (macho);
       return grub_error (GRUB_ERR_BAD_OS,
-			 "Kernel doesn't contain suitable 64-bit architecture");
+			 "kernel doesn't contain suitable 64-bit architecture");
     }
 
   err = grub_macho_size64 (macho, &startcode, &endcode, GRUB_MACHO_NOBSS);
@@ -654,7 +654,7 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile)
 	  if (macho)
 	    grub_macho_close (macho);
 	  return grub_error (GRUB_ERR_BAD_OS,
-			     "Extension doesn't contain suitable architecture");
+			     "extension doesn't contain suitable architecture");
 	}
       if (grub_xnu_is_64bit)
 	machosize = grub_macho_filesize64 (macho);
@@ -719,7 +719,7 @@ grub_xnu_load_driver (char *infoplistname, grub_file_t binaryfile)
 	{
 	  grub_file_close (infoplist);
 	  grub_error_push ();
-	  return grub_error (GRUB_ERR_BAD_OS, "Couldn't read file %s: ",
+	  return grub_error (GRUB_ERR_BAD_OS, "couldn't read file %s: ",
 			     infoplistname);
 	}
       grub_file_close (infoplist);
@@ -763,7 +763,7 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)),
   file = grub_gzfile_open (args[0], 1);
   if (! file)
     return grub_error (GRUB_ERR_FILE_NOT_FOUND,
-		       "Couldn't load driver package");
+		       "couldn't load driver package");
 
   /* Sometimes caches are fat binary. Errgh. */
   if (grub_file_read (file, &head, sizeof (head))
@@ -773,7 +773,7 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)),
 	 can hardly imagine a valid package shorter than 20 bytes. */
       grub_file_close (file);
       grub_error_push ();
-      return grub_error (GRUB_ERR_BAD_OS, "Couldn't read file %s", args[0]);
+      return grub_error (GRUB_ERR_BAD_OS, "couldn't read file %s", args[0]);
     }
 
   /* Find the corresponding architecture. */
@@ -786,7 +786,7 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)),
 	  grub_file_close (file);
 	  grub_error_push ();
 	  return grub_error (GRUB_ERR_OUT_OF_MEMORY,
-			     "Couldn't read file %s", args[0]);
+			     "couldn't read file %s", args[0]);
 
 	}
       if (grub_file_read (file, archs,
@@ -795,7 +795,7 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)),
 	{
 	  grub_free (archs);
 	  grub_error_push ();
-	  return grub_error (GRUB_ERR_READ_ERROR, "Cannot read fat header.");
+	  return grub_error (GRUB_ERR_READ_ERROR, "cannot read fat header");
 	}
       for (i = 0; i < narchs; i++)
 	{
@@ -848,7 +848,7 @@ grub_cmd_xnu_mkext (grub_command_t cmd __attribute__ ((unused)),
     {
       grub_file_close (file);
       grub_error_push ();
-      return grub_error (GRUB_ERR_BAD_OS, "Couldn't read file %s", args[0]);
+      return grub_error (GRUB_ERR_BAD_OS, "couldn't read file %s", args[0]);
     }
   grub_file_close (file);
 
@@ -875,7 +875,7 @@ grub_cmd_xnu_ramdisk (grub_command_t cmd __attribute__ ((unused)),
   file = grub_gzfile_open (args[0], 1);
   if (! file)
     return grub_error (GRUB_ERR_FILE_NOT_FOUND,
-		       "Couldn't load ramdisk");
+		       "couldn't load ramdisk");
 
   err = grub_xnu_align_heap (GRUB_XNU_PAGESIZE);
   if (err)
@@ -891,7 +891,7 @@ grub_cmd_xnu_ramdisk (grub_command_t cmd __attribute__ ((unused)),
     {
       grub_file_close (file);
       grub_error_push ();
-      return grub_error (GRUB_ERR_BAD_OS, "Couldn't read file %s", args[0]);
+      return grub_error (GRUB_ERR_BAD_OS, "couldn't read file %s", args[0]);
     }
   return grub_xnu_register_memory ("RAMDisk", 0, loadto, size);
 }
@@ -917,7 +917,7 @@ grub_xnu_check_os_bundle_required (char *plistname, char *osbundlereq,
     {
       grub_file_close (file);
       grub_error_push ();
-      grub_error (GRUB_ERR_BAD_OS, "Couldn't read file %s", plistname);
+      grub_error (GRUB_ERR_BAD_OS, "couldn't read file %s", plistname);
       return 0;
     }
 
@@ -927,14 +927,14 @@ grub_xnu_check_os_bundle_required (char *plistname, char *osbundlereq,
     {
       grub_file_close (file);
       grub_error_push ();
-      grub_error (GRUB_ERR_OUT_OF_MEMORY, "Couldn't read file %s", plistname);
+      grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't read file %s", plistname);
       return 0;
     }
   if (grub_file_read (file, buf, size) != (grub_ssize_t) (size))
     {
       grub_file_close (file);
       grub_error_push ();
-      grub_error (GRUB_ERR_BAD_OS, "Couldn't read file %s", plistname);
+      grub_error (GRUB_ERR_BAD_OS, "couldn't read file %s", plistname);
       return 0;
     }
   grub_file_close (file);
@@ -1404,21 +1404,21 @@ static grub_command_t cmd_kextdir, cmd_ramdisk, cmd_resume, cmd_splash;
 GRUB_MOD_INIT(xnu)
 {
   cmd_kernel = grub_register_command ("xnu_kernel", grub_cmd_xnu_kernel, 0,
-				      "load a xnu kernel");
+				      "Load XNU image.");
   cmd_kernel64 = grub_register_command ("xnu_kernel64", grub_cmd_xnu_kernel64,
-					0, "load a 64-bit xnu kernel");
+					0, "Load 64-bit XNU image.");
   cmd_mkext = grub_register_command ("xnu_mkext", grub_cmd_xnu_mkext, 0,
 				     "Load XNU extension package.");
   cmd_kext = grub_register_command ("xnu_kext", grub_cmd_xnu_kext, 0,
 				    "Load XNU extension.");
   cmd_kextdir = grub_register_command ("xnu_kextdir", grub_cmd_xnu_kextdir,
-				       "xnu_kextdir DIRECTORY [OSBundleRequired]",
-				       "Load XNU extension directory");
+				       "DIRECTORY [OSBundleRequired]",
+				       "Load XNU extension directory.");
   cmd_ramdisk = grub_register_command ("xnu_ramdisk", grub_cmd_xnu_ramdisk, 0,
 				       "Load XNU ramdisk. "
-				       "It will be seen as md0");
+				       "It will be seen as md0.");
   cmd_splash = grub_register_command ("xnu_splash", grub_cmd_xnu_splash, 0,
-				      "Load a splash image for XNU");
+				      "Load a splash image for XNU.");
 
 #ifndef GRUB_UTIL
   cmd_resume = grub_register_command ("xnu_resume", grub_cmd_xnu_resume,
diff --git a/loader/xnu_resume.c b/loader/xnu_resume.c
index 83c2c3cd1..e6620e7b7 100644
--- a/loader/xnu_resume.c
+++ b/loader/xnu_resume.c
@@ -109,7 +109,7 @@ grub_xnu_resume (char *imagename)
       != (grub_ssize_t) codesize)
     {
       grub_file_close (file);
-      return grub_error (GRUB_ERR_READ_ERROR, "Cannot read resume image.");
+      return grub_error (GRUB_ERR_READ_ERROR, "cannot read resume image");
     }
 
   /* Read image. */
@@ -119,7 +119,7 @@ grub_xnu_resume (char *imagename)
       != (grub_ssize_t) hibhead.image_size)
     {
       grub_file_close (file);
-      return grub_error (GRUB_ERR_READ_ERROR, "Cannot read resume image.");
+      return grub_error (GRUB_ERR_READ_ERROR, "cannot read resume image");
     }
   grub_file_close (file);
 
diff --git a/mmap/i386/pc/mmap.c b/mmap/i386/pc/mmap.c
index 0e2dfe6a6..7d5a43fec 100644
--- a/mmap/i386/pc/mmap.c
+++ b/mmap/i386/pc/mmap.c
@@ -179,7 +179,7 @@ malloc_hook (void)
   if (! hooktarget)
     {
       slots_available = 0;
-      return grub_error (GRUB_ERR_OUT_OF_MEMORY, "No space for mmap hook");
+      return grub_error (GRUB_ERR_OUT_OF_MEMORY, "no space for mmap hook");
     }
   return GRUB_ERR_NONE;
 }
diff --git a/mmap/mmap.c b/mmap/mmap.c
index 7598cf501..874a238b2 100644
--- a/mmap/mmap.c
+++ b/mmap/mmap.c
@@ -414,8 +414,8 @@ static grub_command_t cmd;
 GRUB_MOD_INIT(mmap)
 {
   cmd = grub_register_command ("badram", grub_cmd_badram,
-			       "badram ADDR1,MASK1[,ADDR2,MASK2[,...]]",
-			       "declare memory regions as badram");
+			       "ADDR1,MASK1[,ADDR2,MASK2[,...]]",
+			       "Declare memory regions as badram.");
 }
 
 GRUB_MOD_FINI(mmap)
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/dyncmd.c b/normal/dyncmd.c
index dc530b07b..04f1945dc 100644
--- a/normal/dyncmd.c
+++ b/normal/dyncmd.c
@@ -23,6 +23,7 @@
 #include <grub/misc.h>
 #include <grub/command.h>
 #include <grub/normal.h>
+#include <grub/i18n.h>
 
 static grub_err_t
 grub_dyncmd_dispatcher (struct grub_command *cmd,
@@ -132,7 +133,7 @@ read_command_list (void)
 
 		  cmd = grub_register_command_prio (name,
 						    grub_dyncmd_dispatcher,
-						    0, "not loaded", prio);
+						    0, N_("not loaded"), prio);
 		  if (! cmd)
 		    {
 		      grub_free (name);
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..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)
     {
@@ -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/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--;
        }
diff --git a/normal/menu_viewer.c b/normal/menu_viewer.c
index 1bd271a21..f870ccd53 100644
--- a/normal/menu_viewer.c
+++ b/normal/menu_viewer.c
@@ -58,7 +58,7 @@ grub_menu_viewer_show_menu (grub_menu_t menu, int nested)
   grub_menu_viewer_t cur = get_current_menu_viewer ();
   grub_err_t err1, err2;
   if (!cur)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "No menu viewer available.");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "no menu viewer available");
 
   while (1)
     {
diff --git a/normal/misc.c b/normal/misc.c
index 18e20d2fc..17ba372ce 100644
--- a/normal/misc.c
+++ b/normal/misc.c
@@ -68,7 +68,10 @@ grub_normal_print_device_info (const char *name)
 	      if (grub_errno == GRUB_ERR_NONE)
 		{
 		  if (label && grub_strlen (label))
-		    grub_printf_ (N_("- Label %s"), label);
+		    {
+		      grub_putchar (' ');
+		      grub_printf_ (N_("- Label \"%s\""), label);
+		    }
 		  grub_free (label);
 		}
 	      grub_errno = GRUB_ERR_NONE;
@@ -81,6 +84,7 @@ grub_normal_print_device_info (const char *name)
 	      if (grub_errno == GRUB_ERR_NONE)
 		{
 		  grub_unixtime2datetime (tm, &datetime);
+		  grub_putchar (' ');
 		  grub_printf_ (N_("- Last modification time %d-%02d-%02d "
 			       "%02d:%02d:%02d %s"),
 			       datetime.year, datetime.month, datetime.day,
diff --git a/partmap/acorn.c b/partmap/acorn.c
index e005975c0..076d998f8 100644
--- a/partmap/acorn.c
+++ b/partmap/acorn.c
@@ -85,7 +85,7 @@ acorn_partition_map_find (grub_disk_t disk, struct linux_part *m,
 
 fail:
   return grub_error (GRUB_ERR_BAD_PART_TABLE,
-		     "Linux/ADFS partition map not found.");
+		     "Linux/ADFS partition map not found");
 
 }
 
diff --git a/partmap/amiga.c b/partmap/amiga.c
index dce9f4f1f..e8ba9181c 100644
--- a/partmap/amiga.c
+++ b/partmap/amiga.c
@@ -102,7 +102,7 @@ amiga_partition_map_iterate (grub_disk_t disk,
 
   if (next == -1)
     return grub_error (GRUB_ERR_BAD_PART_TABLE,
-		       "Amiga partition map not found.");
+		       "Amiga partition map not found");
 
   /* The end of the partition list is marked using "-1".  */
   while (next != -1)
diff --git a/partmap/apple.c b/partmap/apple.c
index 4dea55a32..765912672 100644
--- a/partmap/apple.c
+++ b/partmap/apple.c
@@ -176,7 +176,7 @@ apple_partition_map_iterate (grub_disk_t disk,
 
  fail:
   return grub_error (GRUB_ERR_BAD_PART_TABLE,
-		     "Apple partition map not found.");
+		     "Apple partition map not found");
 }
 
 
diff --git a/po/POTFILES b/po/POTFILES
index c214eb968..6efa12219 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -1,5 +1,12 @@
 # List of files which contain translatable strings.
+commands/i386/pc/play.c
 commands/loadenv.c
+commands/search.c
+commands/help.c
+
+lib/arg.c
+
+normal/dyncmd.c
 
 util/i386/pc/grub-mkimage.c
 util/i386/pc/grub-setup.c
diff --git a/script/lexer.c b/script/lexer.c
index a30e3c005..5bcdf628b 100644
--- a/script/lexer.c
+++ b/script/lexer.c
@@ -389,7 +389,7 @@ grub_script_yylex (union YYSTYPE *yylval, struct grub_parser_param *parsestate)
 	{
 	  /* There is either text or a variable name.  In the case you
 	 arrive here there is a serious problem with the lexer.  */
-	  grub_error (GRUB_ERR_BAD_ARGUMENT, "Internal error\n");
+	  grub_error (GRUB_ERR_BAD_ARGUMENT, "internal error");
 	  return 0;
 	}
     }
diff --git a/term/gfxterm.c b/term/gfxterm.c
index f161499e6..fa19a5d85 100644
--- a/term/gfxterm.c
+++ b/term/gfxterm.c
@@ -189,7 +189,7 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y,
   virtual_screen.font = grub_font_get (font_name);
   if (!virtual_screen.font)
     return grub_error (GRUB_ERR_BAD_FONT,
-                       "No font loaded.");
+                       "no font loaded");
   virtual_screen.width = width;
   virtual_screen.height = height;
   virtual_screen.offset_x = x;
@@ -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)
diff --git a/term/i386/pc/at_keyboard.c b/term/i386/pc/at_keyboard.c
index cf30e7242..4ad60c65c 100644
--- a/term/i386/pc/at_keyboard.c
+++ b/term/i386/pc/at_keyboard.c
@@ -32,6 +32,13 @@ static short at_keyboard_status = 0;
 #define KEYBOARD_STATUS_CTRL_L		(1 << 4)
 #define KEYBOARD_STATUS_CTRL_R		(1 << 5)
 #define KEYBOARD_STATUS_CAPS_LOCK	(1 << 6)
+#define KEYBOARD_STATUS_NUM_LOCK	(1 << 7)
+
+static grub_uint8_t led_status;
+
+#define KEYBOARD_LED_SCROLL		(1 << 0)
+#define KEYBOARD_LED_NUM		(1 << 1)
+#define KEYBOARD_LED_CAPS		(1 << 2)
 
 static char keyboard_map[128] =
 {
@@ -65,9 +72,15 @@ static char keyboard_map_shift[128] =
 static grub_uint8_t grub_keyboard_controller_orig;
 
 static void
-grub_keyboard_controller_write (grub_uint8_t c)
+keyboard_controller_wait_untill_ready (void)
 {
   while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
+}
+
+static void
+grub_keyboard_controller_write (grub_uint8_t c)
+{
+  keyboard_controller_wait_untill_ready ();
   grub_outb (KEYBOARD_COMMAND_WRITE, KEYBOARD_REG_STATUS);
   grub_outb (c, KEYBOARD_REG_DATA);
 }
@@ -75,11 +88,20 @@ grub_keyboard_controller_write (grub_uint8_t c)
 static grub_uint8_t
 grub_keyboard_controller_read (void)
 {
-  while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS)));
+  keyboard_controller_wait_untill_ready ();
   grub_outb (KEYBOARD_COMMAND_READ, KEYBOARD_REG_STATUS);
   return grub_inb (KEYBOARD_REG_DATA);
 }
 
+static void
+keyboard_controller_led (grub_uint8_t leds)
+{
+  keyboard_controller_wait_untill_ready ();
+  grub_outb (0xed, KEYBOARD_REG_DATA);
+  keyboard_controller_wait_untill_ready ();
+  grub_outb (leds & 0x7, KEYBOARD_REG_DATA);
+}
+
 /* FIXME: This should become an interrupt service routine.  For now
    it's just used to catch events from control keys.  */
 static void
@@ -158,14 +180,37 @@ grub_at_keyboard_getkey_noblock (void)
   switch (code)
     {
       case CAPS_LOCK:
-	at_keyboard_status ^= KEYBOARD_STATUS_CAPS_LOCK;
 	/* Caps lock sends scan code twice.  Get the second one and discard it.  */
 	while (grub_keyboard_getkey () == -1);
+
+	at_keyboard_status ^= KEYBOARD_STATUS_CAPS_LOCK;
+	led_status ^= KEYBOARD_LED_CAPS;
+	keyboard_controller_led (led_status);
+
 #ifdef DEBUG_AT_KEYBOARD
 	grub_dprintf ("atkeyb", "caps_lock = %d\n", !!(at_keyboard_status & KEYBOARD_STATUS_CAPS_LOCK));
 #endif
 	key = -1;
 	break;
+      case NUM_LOCK:
+	/* Num lock sends scan code twice.  Get the second one and discard it.  */
+	while (grub_keyboard_getkey () == -1);
+
+	at_keyboard_status ^= KEYBOARD_STATUS_NUM_LOCK;
+	led_status ^= KEYBOARD_LED_NUM;
+	keyboard_controller_led (led_status);
+
+#ifdef DEBUG_AT_KEYBOARD
+	grub_dprintf ("atkeyb", "num_lock = %d\n", !!(at_keyboard_status & KEYBOARD_STATUS_NUM_LOCK));
+#endif
+	key = -1;
+	break;
+      case SCROLL_LOCK:
+	/* For scroll lock we don't keep track of status.  Only update its led.  */
+	led_status ^= KEYBOARD_LED_SCROLL;
+	keyboard_controller_led (led_status);
+	key = -1;
+	break;
       default:
 	if (at_keyboard_status & (KEYBOARD_STATUS_CTRL_L | KEYBOARD_STATUS_CTRL_R))
 	  key = keyboard_map[code] - 'a' + 1;
diff --git a/term/i386/pc/serial.c b/term/i386/pc/serial.c
index 3f1c6d062..1c68f9bfc 100644
--- a/term/i386/pc/serial.c
+++ b/term/i386/pc/serial.c
@@ -498,7 +498,7 @@ grub_cmd_serial (grub_extcmd_t cmd,
       unit = grub_strtoul (state[0].arg, 0, 0);
       serial_settings.port = serial_hw_get_port (unit);
       if (!serial_settings.port)
-	return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad unit number.");
+	return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad unit number");
     }
 
   if (state[1].set)
diff --git a/term/i386/pc/vga.c b/term/i386/pc/vga.c
index 9deb6a6d7..402b30fe6 100644
--- a/term/i386/pc/vga.c
+++ b/term/i386/pc/vga.c
@@ -163,7 +163,7 @@ grub_vga_mod_init (void)
   set_start_address (PAGE_OFFSET (page));
   font = grub_font_get ("");  /* Choose any font, for now. */
   if (!font)
-    return grub_error (GRUB_ERR_BAD_FONT, "No font loaded.");
+    return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
 
   return GRUB_ERR_NONE;
 }
diff --git a/term/ieee1275/ofconsole.c b/term/ieee1275/ofconsole.c
index ab11e9fb2..fbed9eca1 100644
--- a/term/ieee1275/ofconsole.c
+++ b/term/ieee1275/ofconsole.c
@@ -346,7 +346,7 @@ grub_ofconsole_init_input (void)
   if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdin", &stdin_ihandle,
 					  sizeof stdin_ihandle, &actual)
       || actual != sizeof stdin_ihandle)
-    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin");
+    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot find stdin");
 
   return 0;
 }
@@ -365,7 +365,7 @@ grub_ofconsole_init_output (void)
   if (grub_ieee1275_get_integer_property (grub_ieee1275_chosen, "stdout", &stdout_ihandle,
 					  sizeof stdout_ihandle, &actual)
       || actual != sizeof stdout_ihandle)
-    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdout");
+    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot find stdout");
 
   /* Initialize colors.  */
   if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS))
diff --git a/term/terminfo.c b/term/terminfo.c
index 80ae9b100..fc22fe850 100644
--- a/term/terminfo.c
+++ b/term/terminfo.c
@@ -103,7 +103,7 @@ grub_terminfo_set_current (const char *str)
       return grub_errno;
     }
 
-  return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminfo type.");
+  return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminfo type");
 }
 
 /* Wrapper for grub_putchar to write strings.  */
@@ -168,7 +168,7 @@ grub_cmd_terminfo (grub_command_t cmd __attribute__ ((unused)),
     return GRUB_ERR_NONE;
   }
   else if (argc != 1)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "too many parameters.");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "too many parameters");
   else
     return grub_terminfo_set_current (args[0]);
 }
@@ -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/util/grub-install.in b/util/grub-install.in
index 4df620812..1fcfb1aca 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -29,10 +29,11 @@ PACKAGE_TARNAME=@PACKAGE_TARNAME@
 PACKAGE_VERSION=@PACKAGE_VERSION@
 target_cpu=@target_cpu@
 platform=@platform@
+host_os=@host_os@
 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 +52,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 +180,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 +242,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
@@ -278,7 +281,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_opt=
+
 if [ "x${devabstraction_module}" = "x" ] ; then
     if echo "${install_device}" | grep -qx "(.*)" ; then
       install_drive="${install_device}"
@@ -297,34 +307,33 @@ if [ "x${devabstraction_module}" = "x" ] ; then
           echo "UUID needed with ata mod, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
           exit 1
         fi
-        prefix_drive="(UUID=${uuid})"
-        modules="$modules fs_uuid"
+        echo "search.fs_uuid ${uuid} root " > ${grubdir}/load.cfg
+	echo 'set prefix=($root)'"${relative_grubdir}" >> ${grubdir}/load.cfg
+	config_opt="-c ${grubdir}/load.cfg "
+        modules="$modules search_fs_uuid"
     elif [ "x${grub_drive}" != "x${install_drive}" ] ; then
         uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
         if [ "x${uuid}" = "x" ] ; then
           echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
           exit 1
         fi
-        prefix_drive="(UUID=${uuid})"
-        modules="$modules fs_uuid"
+        echo "search.fs_uuid ${uuid} root " > ${grubdir}/load.cfg
+	echo 'set prefix=($root)'"${relative_grubdir}" >> ${grubdir}/load.cfg
+	config_opt="-c ${grubdir}/load.cfg "
+        modules="$modules search_fs_uuid"
     fi
 else
     prefix_drive=`$grub_probe --target=drive --device ${grub_device}`
 fi
 
-relative_grubdir=`make_system_path_relative_to_its_root ${grubdir}` || exit 1
-if [ "x${relative_grubdir}" = "x" ] ; then
-    relative_grubdir=/
-fi
-
-if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
-    $grub_mkimage --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
+if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
+    $grub_mkimage ${config_opt} --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
 
     # Now perform the installation.
     $grub_setup ${setup_verbose} ${setup_force} --directory=${grubdir} --device-map=${device_map} \
         ${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
 
 echo "Installation finished. No error reported."
diff --git a/util/grub-probe.c b/util/grub-probe.c
index 1958308c3..ebf5142d4 100644
--- a/util/grub-probe.c
+++ b/util/grub-probe.c
@@ -259,7 +259,7 @@ probe (const char *path, char *device_name)
 	      grub_util_info ("reading %s via GRUB facilities", grub_path);
 	      file = grub_file_open (grub_path);
 	      if (! file)
-		grub_util_error ("can not open %s via GRUB facilities", grub_path);
+		grub_util_error ("cannot open %s via GRUB facilities", grub_path);
 	      filebuf_via_grub = xmalloc (file->size);
 	      grub_file_read (file, filebuf_via_grub, file->size);
 
diff --git a/util/hostdisk.c b/util/hostdisk.c
index 11caaf407..c94f4237e 100644
--- a/util/hostdisk.c
+++ b/util/hostdisk.c
@@ -348,7 +348,8 @@ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
 	return -1;
       }
 
-    /* Make the buffer cache consistent with the physical disk.  */
+    /* Flush the buffer cache to the physical disk.
+       XXX: This also empties the buffer cache.  */
     ioctl (fd, BLKFLSBUF, 0);
 
     if (is_partition)
diff --git a/util/i386/efi/grub-install.in b/util/i386/efi/grub-install.in
index a5f97e346..e0e0f2717 100644
--- a/util/i386/efi/grub-install.in
+++ b/util/i386/efi/grub-install.in
@@ -29,6 +29,7 @@ PACKAGE_TARNAME=@PACKAGE_TARNAME@
 PACKAGE_VERSION=@PACKAGE_VERSION@
 target_cpu=@target_cpu@
 platform=@platform@
+host_os=@host_os@
 pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
 
 grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
diff --git a/util/misc.c b/util/misc.c
index 5896da0c8..6aa92fb64 100644
--- a/util/misc.c
+++ b/util/misc.c
@@ -504,7 +504,7 @@ make_system_path_relative_to_its_root (const char *path)
   free (p);
 
   if (stat (buf, &st) < 0)
-    grub_util_error ("can not stat %s: %s", buf, strerror (errno));
+    grub_util_error ("cannot stat %s: %s", buf, strerror (errno));
 
   buf2 = strdup (buf);
   num = st.st_dev;
@@ -523,7 +523,7 @@ make_system_path_relative_to_its_root (const char *path)
 	*++p = 0;
 
       if (stat (buf, &st) < 0)
-	grub_util_error ("can not stat %s: %s", buf, strerror (errno));
+	grub_util_error ("cannot stat %s: %s", buf, strerror (errno));
 
       /* buf is another filesystem; we found it.  */
       if (st.st_dev != num)
diff --git a/util/mkisofs/write.c b/util/mkisofs/write.c
index 69b6bb623..896e2833b 100644
--- a/util/mkisofs/write.c
+++ b/util/mkisofs/write.c
@@ -1436,7 +1436,10 @@ static int FDECL1(padblock_write, FILE *, 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);
+      if (fgetc (fp) != EOF)
+	error (1, 0, _("%s is too big for embed area"), boot_image_embed);
     }
 
   if (use_protective_msdos_label)
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 <http://www.gnu.org/licenses/>.
-
-# Initialize some variables.
-transform="@program_transform_name@"
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-sbindir=@sbindir@
-bindir=@bindir@
-libdir=@libdir@
-PACKAGE_NAME=@PACKAGE_NAME@
-PACKAGE_TARNAME=@PACKAGE_TARNAME@
-PACKAGE_VERSION=@PACKAGE_VERSION@
-target_cpu=@target_cpu@
-platform=@platform@
-pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
-
-grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
-grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
-grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
-grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
-rootdir=
-grub_prefix=`echo /boot/grub | sed ${transform}`
-modules=
-
-install_device=
-no_floppy=
-force_lba=
-recheck=no
-debug=no
-
-# Usage: usage
-# Print the usage.
-usage () {
-    cat <<EOF
-Usage: grub-install [OPTION] install_device
-Install GRUB on your drive.
-
-  -h, --help              print this message and exit
-  -v, --version           print the version information and exit
-  --modules=MODULES       pre-load specified modules MODULES
-  --root-directory=DIR    install GRUB images under the directory DIR
-                          instead of the root directory
-  --grub-setup=FILE       use FILE as grub-setup
-  --grub-mkimage=FILE     use FILE as grub-mkimage
-  --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
-  --grub-probe=FILE       use FILE as grub-probe
-  --no-floppy             do not probe any floppy drive
-  --recheck               probe a device map even if it already exists
-
-INSTALL_DEVICE can be a GRUB device name or a system device filename.
-
-grub-install copies GRUB images into the DIR/boot directory specified by
---root-directory, and uses grub-setup to install grub into the boot
-sector.
-
-Report bugs to <bug-grub@gnu.org>.
-EOF
-}
-
-# Check the arguments.
-for option in "$@"; do
-    case "$option" in
-    -h | --help)
-	usage
-	exit 0 ;;
-    -v | --version)
-	echo "grub-install (GNU GRUB ${PACKAGE_VERSION})"
-	exit 0 ;;
-    --modules=*)
-	modules=`echo "$option" | sed 's/--modules=//'` ;;
-    --root-directory=*)
-	rootdir=`echo "$option" | sed 's/--root-directory=//'` ;;
-    --grub-setup=*)
-	grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;;
-    --grub-mkimage=*)
-	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
-    --grub-mkdevicemap=*)
-	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
-    --grub-probe=*)
-	grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
-    --no-floppy)
-	no_floppy="--no-floppy" ;;
-    --recheck)
-	recheck=yes ;;
-    # This is an undocumented feature...
-    --debug)
-	debug=yes ;;
-    -*)
-	echo "Unrecognized option \`$option'" 1>&2
-	usage
-	exit 1
-	;;
-    *)
-	if test "x$install_device" != x; then
-	    echo "More than one install_devices?" 1>&2
-	    usage
-	    exit 1
-	fi
-	install_device="${option}" ;;
-    esac
-done
-
-# for make_system_path_relative_to_its_root()
-. ${libdir}/grub/grub-mkconfig_lib
-
-if test "x$install_device" = x; then
-    echo "install_device not specified." 1>&2
-    usage
-    exit 1
-fi
-
-# If the debugging feature is enabled, print commands.
-setup_verbose=
-if test $debug = yes; then
-    set -x
-    setup_verbose="--verbose"
-fi
-
-# Initialize these directories here, since ROOTDIR was initialized.
-bootdir=${rootdir}/boot
-grubdir=${bootdir}/`echo grub | sed ${transform}`
-device_map=${grubdir}/device.map
-
-grub_probe="${grub_probe} --device-map=${device_map}"
-
-# Check if GRUB is installed.
-set $grub_setup dummy
-if test -f "$1"; then
-    :
-else
-    echo "$1: Not found." 1>&2
-    exit 1
-fi
-
-set $grub_mkimage dummy
-if test -f "$1"; then
-    :
-else
-    echo "$1: Not found." 1>&2
-    exit 1
-fi
-
-set $grub_mkdevicemap dummy
-if test -f "$1"; then
-    :
-else
-    echo "$1: Not found." 1>&2
-    exit 1
-fi
-
-# Create the GRUB directory if it is not present.
-test -d "$bootdir" || mkdir "$bootdir" || exit 1
-test -d "$grubdir" || mkdir "$grubdir" || exit 1
-
-# If --recheck is specified, remove the device map, if present.
-if test $recheck = yes; then
-    rm -f $device_map
-fi
-
-# Create the device map file if it is not present.
-if test -f "$device_map"; then
-    :
-else
-    # Create a safe temporary file.
-    test -n "$mklog" && log_file=`$mklog`
-
-    $grub_mkdevicemap --device-map=$device_map $no_floppy || exit 1
-fi
-
-# Make sure that there is no duplicated entry.
-tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \
-    | sort | uniq -d | sed -n 1p`
-if test -n "$tmp"; then
-    echo "The drive $tmp is defined multiple times in the device map $device_map" 1>&2
-    exit 1
-fi
-
-# Copy the GRUB images to the GRUB directory.
-for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img; do
-    if test -f $file && [ "`basename $file`" != menu.lst ]; then
-	rm -f $file || exit 1
-    fi
-done
-for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do
-    cp -f $file ${grubdir} || exit 1
-done
-
-for file in ${pkglibdir}/*.img; do
-    cp -f $file ${grubdir} || exit 1
-done
-
-# Write device to a variable so we don't have to traverse /dev every time.
-grub_device=`$grub_probe --target=device ${grubdir}`
-
-# Create the core image. First, auto-detect the filesystem module.
-fs_module=`$grub_probe --target=fs --device ${grub_device}`
-if test "x$fs_module" = x -a "x$modules" = x; then
-    echo "Auto-detection of a filesystem module failed." 1>&2
-    echo "Please specify the module with the option \`--modules' explicitly." 1>&2
-    exit 1
-fi
-
-# Then the partition map module.  In order to support partition-less media,
-# this command is allowed to fail (--target=fs already grants us that the
-# filesystem will be accessible).
-partmap_module=`$grub_probe --target=partmap --device ${grub_device} 2> /dev/null`
-
-# Device abstraction module, if any (lvm, raid).
-devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}`
-
-modules="$modules $fs_module $partmap_module $devabstraction_module"
-
-prefix_drive=
-if [ "x${devabstraction_module}" = "x" ] ; then
-    if echo "${install_device}" | grep -qx "(.*)" ; then
-      install_drive="${install_device}"
-    else
-      install_drive="`$grub_probe --target=drive --device ${install_device}`"
-    fi
-    grub_drive="`$grub_probe --target=drive --device ${grub_device}`"
-
-    # Strip partition number
-    install_drive="`echo ${install_drive} | sed -e 's/\([^\]\),[0-9]*/\1/g'`"
-    grub_drive="`echo ${grub_drive} | sed -e 's/\([^\]\),[0-9]*/\1/g'`"
-    if [ "x${grub_drive}" != "x${install_drive}" ] ; then
-        uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
-        if [ "x${uuid}" = "x" ] ; then
-          echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
-          exit 1
-        fi
-        prefix_drive="(UUID=${uuid})"
-        modules="$modules fs_uuid"
-    fi
-else
-    prefix_drive=`$grub_probe --target=drive --device ${grub_device}`
-fi
-
-relative_grubdir=`make_system_path_relative_to_its_root ${grubdir}` || exit 1
-if [ "x${relative_grubdir}" = "x" ] ; then
-    relative_grubdir=/
-fi
-
-$grub_mkimage --output=${grubdir}/core.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
-
-# Now perform the installation.
-$grub_setup ${setup_verbose} --directory=${grubdir} --device-map=${device_map} \
-        ${install_device} || exit 1
-
-# Prompt the user to check if the device map is correct.
-echo "Installation finished. No error reported."
-echo "This is the contents of the device map $device_map."
-echo "Check if this is correct or not. If any of the lines is incorrect,"
-echo "fix it and re-run the script \`grub-install'."
-echo
-
-cat $device_map
-
-# Bye.
-exit 0
diff --git a/video/bitmap.c b/video/bitmap.c
index 7b135a5dc..2ea640728 100644
--- a/video/bitmap.c
+++ b/video/bitmap.c
@@ -58,12 +58,12 @@ grub_video_bitmap_create (struct grub_video_bitmap **bitmap,
   unsigned int size;
 
   if (!bitmap)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid argument.");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument");
 
   *bitmap = 0;
 
   if (width == 0 || height == 0)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid argument.");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument");
 
   *bitmap = (struct grub_video_bitmap *)grub_malloc (sizeof (struct grub_video_bitmap));
   if (! *bitmap)
@@ -129,7 +129,7 @@ grub_video_bitmap_create (struct grub_video_bitmap **bitmap,
         *bitmap = 0;
 
         return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                           "Unsupported bitmap format");
+                           "unsupported bitmap format");
     }
 
   mode_info->pitch = width * mode_info->bytes_per_pixel;
@@ -188,7 +188,7 @@ grub_video_bitmap_load (struct grub_video_bitmap **bitmap,
   grub_video_bitmap_reader_t reader = bitmap_readers_list;
 
   if (!bitmap)
-    return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid argument.");
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument");
 
   *bitmap = 0;
 
diff --git a/video/efi_gop.c b/video/efi_gop.c
index 0cae91e7b..30863c1ed 100644
--- a/video/efi_gop.c
+++ b/video/efi_gop.c
@@ -137,7 +137,7 @@ grub_video_gop_fill_mode_info (struct grub_efi_gop_mode_info *in,
   out->bpp = grub_video_gop_get_bpp (in);
   out->bytes_per_pixel = out->bpp >> 3;
   if (!out->bpp)
-    return grub_error (GRUB_ERR_IO, "Unsupported video mode");
+    return grub_error (GRUB_ERR_IO, "unsupported video mode");
   out->pitch = in->pixels_per_scanline * out->bytes_per_pixel;
 
   switch (in->pixel_format)
@@ -176,7 +176,7 @@ grub_video_gop_fill_mode_info (struct grub_efi_gop_mode_info *in,
       break;
 
     default:
-      return grub_error (GRUB_ERR_IO, "Unsupported video mode");
+      return grub_error (GRUB_ERR_IO, "unsupported video mode");
     }
 
   out->blit_format = grub_video_get_blit_format (out);
@@ -266,7 +266,7 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
   if (!found)
     {
       grub_dprintf ("video", "GOP: no mode found\n");
-      return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found.");
+      return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found");
     }
 
   if (best_mode != gop->mode->mode)
diff --git a/video/efi_uga.c b/video/efi_uga.c
index 9bca64306..12ca35cde 100644
--- a/video/efi_uga.c
+++ b/video/efi_uga.c
@@ -266,7 +266,7 @@ grub_video_uga_setup (unsigned int width, unsigned int height,
       return err;
     }
 
-  return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found.");
+  return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found");
 }
 
 static grub_err_t
diff --git a/video/fb/video_fb.c b/video/fb/video_fb.c
index 5f2917da6..5532a343c 100644
--- a/video/fb/video_fb.c
+++ b/video/fb/video_fb.c
@@ -1048,7 +1048,7 @@ grub_video_fb_create_render_target (struct grub_video_fbrender_target **result,
       || (width == 0)
       || (height == 0))
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                       "invalid argument given.");
+                       "invalid argument given");
 
   /* Allocate memory for render target.  */
   target = grub_malloc (sizeof (struct grub_video_fbrender_target));
@@ -1168,7 +1168,7 @@ grub_video_fb_set_active_render_target (struct grub_video_fbrender_target *targe
 {
   if (! target->data)
     return grub_error (GRUB_ERR_BAD_ARGUMENT,
-                       "invalid render target given.");
+                       "invalid render target given");
 
   render_target = target;
 
diff --git a/video/i386/pc/vbe.c b/video/i386/pc/vbe.c
index 28442eab6..17d9b3282 100644
--- a/video/i386/pc/vbe.c
+++ b/video/i386/pc/vbe.c
@@ -500,7 +500,7 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
     }
 
   /* Couldn't found matching mode.  */
-  return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found.");
+  return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found");
 }
 
 static grub_err_t
diff --git a/video/readers/jpeg.c b/video/readers/jpeg.c
index 460a52872..3c3ac33bb 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, "jpegtest FILE",
-			 "Tests loading of JPEG bitmap.", 0);
+  cmd = grub_register_command ("jpegtest", grub_cmd_jpegtest,
+			       "FILE",
+			       "Tests loading of JPEG bitmap.");
 #endif
 }
 
 GRUB_MOD_FINI (video_reader_jpeg)
 {
 #if defined(JPEG_DEBUG)
-  grub_unregister_command ("jpegtest");
+  grub_unregister_command (cmd);
 #endif
   grub_video_bitmap_reader_unregister (&jpeg_reader);
   grub_video_bitmap_reader_unregister (&jpg_reader);
diff --git a/video/readers/png.c b/video/readers/png.c
index c2008aeb2..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, "pngtest FILE",
-			 "Tests loading of PNG bitmap.", 0);
+  cmd = grub_register_command ("pngtest", grub_cmd_pngtest,
+			       "FILE",
+			       "Tests loading of PNG bitmap.");
 #endif
 }
 
 GRUB_MOD_FINI (video_reader_png)
 {
 #if defined(PNG_DEBUG)
-  grub_unregister_command ("pngtest");
+  grub_unregister_command (cmd);
 #endif
   grub_video_bitmap_reader_unregister (&png_reader);
 }
diff --git a/video/readers/tga.c b/video/readers/tga.c
index d0ca2770f..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
@@ -370,7 +371,7 @@ grub_video_reader_tga (struct grub_video_bitmap **bitmap,
       default:
         grub_file_close (file);
         return grub_error (GRUB_ERR_BAD_FILE_TYPE,
-                           "Unsupported bitmap format (unknown encoding).");
+                           "unsupported bitmap format (unknown encoding)");
     }
 
   /* Check that bitmap depth is supported.  */
@@ -387,7 +388,7 @@ grub_video_reader_tga (struct grub_video_bitmap **bitmap,
       default:
         grub_file_close (file);
         return grub_error (GRUB_ERR_BAD_FILE_TYPE,
-                           "Unsupported bitmap format (bpp=%d).",
+                           "unsupported bitmap format (bpp=%d)",
                            header.image_bpp);
     }
 
@@ -452,7 +453,7 @@ grub_video_reader_tga (struct grub_video_bitmap **bitmap,
 
 #if defined(TGA_DEBUG)
 static grub_err_t
-grub_cmd_tgatest (struct grub_arg_list *state __attribute__ ((unused)),
+grub_cmd_tgatest (grub_command_t cmd __attribute__ ((unused)),
                   int argc, char **args)
 {
   struct grub_video_bitmap *bitmap = 0;
@@ -480,15 +481,15 @@ GRUB_MOD_INIT(video_reader_tga)
 {
   grub_video_bitmap_reader_register (&tga_reader);
 #if defined(TGA_DEBUG)
-  grub_register_command ("tgatest", grub_cmd_tgatest, GRUB_COMMAND_FLAG_BOTH,
-                         "tgatest FILE", "Tests loading of TGA bitmap.", 0);
+  cmd = grub_register_command ("tgatest", grub_cmd_tgatest,
+                               "FILE", "Tests loading of TGA bitmap.");
 #endif
 }
 
 GRUB_MOD_FINI(video_reader_tga)
 {
 #if defined(TGA_DEBUG)
-  grub_unregister_command ("tgatest");
+  grub_unregister_command (cmd);
 #endif
   grub_video_bitmap_reader_unregister (&tga_reader);
 }
diff --git a/video/video.c b/video/video.c
index c1d66bdd0..682bebcbf 100644
--- a/video/video.c
+++ b/video/video.c
@@ -81,7 +81,7 @@ grub_err_t
 grub_video_get_info (struct grub_video_mode_info *mode_info)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   /* If mode_info is NULL just report that video adapter is active.  */
   if (! mode_info)
@@ -101,7 +101,7 @@ grub_video_get_info_and_fini (struct grub_video_mode_info *mode_info,
   grub_err_t err;
 
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   err = grub_video_adapter_active->get_info_and_fini (mode_info, framebuffer);
   if (err)
@@ -209,7 +209,7 @@ grub_video_set_palette (unsigned int start, unsigned int count,
                         struct grub_video_palette_data *palette_data)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->set_palette (start, count, palette_data);
 }
@@ -220,7 +220,7 @@ grub_video_get_palette (unsigned int start, unsigned int count,
                         struct grub_video_palette_data *palette_data)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->get_palette (start, count, palette_data);
 }
@@ -231,7 +231,7 @@ grub_video_set_viewport (unsigned int x, unsigned int y,
                          unsigned int width, unsigned int height)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->set_viewport (x, y, width, height);
 }
@@ -242,7 +242,7 @@ grub_video_get_viewport (unsigned int *x, unsigned int *y,
                          unsigned int *width, unsigned int *height)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->get_viewport (x, y, width, height);
 }
@@ -285,7 +285,7 @@ grub_video_unmap_color (grub_video_color_t color, grub_uint8_t *red,
                         grub_uint8_t *alpha)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->unmap_color (color,
                                                  red,
@@ -300,7 +300,7 @@ grub_video_fill_rect (grub_video_color_t color, int x, int y,
                       unsigned int width, unsigned int height)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->fill_rect (color, x, y, width, height);
 }
@@ -313,7 +313,7 @@ grub_video_blit_bitmap (struct grub_video_bitmap *bitmap,
                         unsigned int width, unsigned int height)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->blit_bitmap (bitmap, oper, x, y,
                                                  offset_x, offset_y,
@@ -328,7 +328,7 @@ grub_video_blit_render_target (struct grub_video_render_target *target,
                                unsigned int width, unsigned int height)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->blit_render_target (target, oper, x, y,
                                                         offset_x, offset_y,
@@ -340,7 +340,7 @@ grub_err_t
 grub_video_scroll (grub_video_color_t color, int dx, int dy)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->scroll (color, dx, dy);
 }
@@ -350,7 +350,7 @@ grub_err_t
 grub_video_swap_buffers (void)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->swap_buffers ();
 }
@@ -362,7 +362,7 @@ grub_video_create_render_target (struct grub_video_render_target **result,
                                  unsigned int mode_type)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->create_render_target (result,
                                                           width, height,
@@ -374,7 +374,7 @@ grub_err_t
 grub_video_delete_render_target (struct grub_video_render_target *target)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->delete_render_target (target);
 }
@@ -384,7 +384,7 @@ grub_err_t
 grub_video_set_active_render_target (struct grub_video_render_target *target)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->set_active_render_target (target);
 }
@@ -394,7 +394,7 @@ grub_err_t
 grub_video_get_active_render_target (struct grub_video_render_target **target)
 {
   if (! grub_video_adapter_active)
-    return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
+    return grub_error (GRUB_ERR_BAD_DEVICE, "no video mode activated");
 
   return grub_video_adapter_active->get_active_render_target (target);
 }
@@ -460,7 +460,7 @@ grub_video_set_mode (const char *modestring,
 	  grub_free (modevar);
 
 	  return grub_error (GRUB_ERR_BAD_ARGUMENT,
-			     "No suitable mode found.");
+			     "no suitable mode found");
 	}
 
       /* Skip separator. */
@@ -545,7 +545,7 @@ grub_video_set_mode (const char *modestring,
 
 	  /* First setup error message.  */
 	  rc = grub_error (GRUB_ERR_BAD_ARGUMENT,
-			   "Invalid mode: %s\n",
+			   "invalid mode: %s",
 			   current_mode);
 
 	  /* Free memory before returning.  */
@@ -564,7 +564,7 @@ grub_video_set_mode (const char *modestring,
 
 	  /* First setup error message.  */
 	  rc = grub_error (GRUB_ERR_BAD_ARGUMENT,
-			   "Invalid mode: %s\n",
+			   "invalid mode: %s",
 			   current_mode);
 
 	  /* Free memory before returning.  */
@@ -585,7 +585,7 @@ grub_video_set_mode (const char *modestring,
 
 	      /* First setup error message.  */
 	      rc = grub_error (GRUB_ERR_BAD_ARGUMENT,
-			       "Invalid mode: %s\n",
+			       "invalid mode: %s",
 			       current_mode);
 
 	      /* Free memory before returning.  */
@@ -607,7 +607,7 @@ grub_video_set_mode (const char *modestring,
 
 	      /* First setup error message.  */
 	      rc = grub_error (GRUB_ERR_BAD_ARGUMENT,
-			       "Invalid mode: %s\n",
+			       "invalid mode: %s",
 			       current_mode);
 
 	      /* Free memory before returning.  */
@@ -625,7 +625,7 @@ grub_video_set_mode (const char *modestring,
 
 	      /* First setup error message.  */
 	      rc = grub_error (GRUB_ERR_BAD_ARGUMENT,
-			       "Invalid mode: %s\n",
+			       "invalid mode: %s",
 			       current_mode);
 
 	      /* Free memory before returning.  */
@@ -709,7 +709,7 @@ grub_video_set_mode (const char *modestring,
   grub_free (modevar);
 
   return grub_error (GRUB_ERR_BAD_ARGUMENT,
-		     "No suitable mode found.");
+		     "no suitable mode found");
 }
 
 /* Initialize Video API module.  */