diff --git a/ChangeLog b/ChangeLog index e594931e1..061fadc18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,713 @@ -2009-12-23 Felix Zielcke +2010-01-05 Colin Watson + + * util/mkisofs/write.c (padblock_write): Check return value of + fread. + +2010-01-05 Robert Millan + + Remove grub-mkfloppy. Images produced by grub-mkrescue are valid + floppy images now. + + * util/i386/pc/grub-mkfloppy.in: Remove. Update all users. + +2010-01-04 Robert Millan + + * disk/i386/pc/biosdisk.c (grub_biosdisk_rw): Use ALIGN_UP macro + instead of manual alignment. + * kern/disk.c (grub_disk_read): Remove grub_dprintf call (excessively + verbose). Avoid attempts to read past end of the device + (grub_disk_adjust_range() guarantees that we can read `size' bytes, + but GRUB_DISK_CACHE_SIZE may exceed that). + +2010-01-04 Robert Millan + + * commands/crc.c (grub_cmd_crc): Abort on read errors. + * fs/iso9660.c (grub_iso9660_read): Check for read error and pass + it to upper layer. + +2010-01-04 Vladimir Serbinenko + + * include/grub/efi/api.h (GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE): + New constant. + (grub_efi_piwg_device_path): New structure + (grub_efi_piwg_device_path_t): New type. + * loader/efi/appleloader.c (piwg_full_device_path): New structure. + (devpath_1): Transform to a structure. All users updated. + (devpath_2): Likewise. + (devpath_3): Likewise. + (devpath_4): Likewise. + (devpath_5): Likewise. + +2010-01-04 Vladimir Serbinenko + + * loader/efi/appleloader.c: Restored. Update all users. + +2010-01-03 Robert Millan + + * boot/i386/pc/diskboot.S: Fix inaccurate comment. + + * util/i386/pc/grub-setup.c: Include `'. + (struct boot_blocklist): Move from here ... + * include/grub/i386/pc/boot.h [ASM_FILE] + (struct grub_boot_blocklist): ... to here. Update all users. + (setup): Only initialize `start' member of `first_block' + structure. Add assert() calls to verify the other members. + + * util/i386/pc/grub-mkimage.c: Include `'. + (generate_image): Fix broken blocklist length initialization. + Add assert() call to verify blocklist `segment' field. + +2010-01-03 Robert Millan + + * loader/efi/appleloader.c: Remove. Update all users. + +2010-01-03 Robert Millan + + * boot/i386/pc/boot.S: Update copyright year. + * boot/i386/pc/cdboot.S: Likewise. + * boot/i386/pc/diskboot.S: Likewise. + * boot/i386/pc/lnxboot.S: Likewise. + * boot/i386/pc/pxeboot.S: Likewise. + * bus/pci.c: Likewise. + * commands/cmp.c: Likewise. + * commands/help.c: Likewise. + * commands/hexdump.c: Likewise. + * commands/i386/pc/halt.c: Likewise. + * commands/i386/pc/play.c: Likewise. + * commands/i386/pc/vbeinfo.c: Likewise. + * commands/ls.c: Likewise. + * commands/test.c: Likewise. + * disk/dmraid_nvidia.c: Likewise. + * disk/i386/pc/biosdisk.c: Likewise. + * disk/ieee1275/nand.c: Likewise. + * disk/ieee1275/ofdisk.c: Likewise. + * disk/lvm.c: Likewise. + * disk/raid.c: Likewise. + * disk/raid6_recover.c: Likewise. + * disk/scsi.c: Likewise. + * fs/affs.c: Likewise. + * fs/cpio.c: Likewise. + * fs/ext2.c: Likewise. + * fs/hfs.c: Likewise. + * fs/iso9660.c: Likewise. + * fs/ntfs.c: Likewise. + * fs/sfs.c: Likewise. + * fs/udf.c: Likewise. + * fs/ufs.c: Likewise. + * fs/xfs.c: Likewise. + * gencmdlist.sh: Likewise. + * genmk.rb: Likewise. + * include/grub/disk.h: Likewise. + * include/grub/efi/api.h: Likewise. + * include/grub/efi/efi.h: Likewise. + * include/grub/efi/pe32.h: Likewise. + * include/grub/elf.h: Likewise. + * include/grub/fs.h: Likewise. + * include/grub/i386/at_keyboard.h: Likewise. + * include/grub/i386/pc/memory.h: Likewise. + * include/grub/i386/pc/vbe.h: Likewise. + * include/grub/i386/pci.h: Likewise. + * include/grub/i386/tsc.h: Likewise. + * include/grub/ieee1275/ieee1275.h: Likewise. + * include/grub/ntfs.h: Likewise. + * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. + * include/grub/sparc64/libgcc.h: Likewise. + * include/grub/symbol.h: Likewise. + * include/grub/types.h: Likewise. + * include/multiboot2.h: Likewise. + * io/gzio.c: Likewise. + * kern/device.c: Likewise. + * kern/disk.c: Likewise. + * kern/efi/efi.c: Likewise. + * kern/efi/mm.c: Likewise. + * kern/elf.c: Likewise. + * kern/file.c: Likewise. + * kern/i386/dl.c: Likewise. + * kern/i386/pc/init.c: Likewise. + * kern/i386/pc/startup.S: Likewise. + * kern/ieee1275/ieee1275.c: Likewise. + * kern/ieee1275/init.c: Likewise. + * kern/main.c: Likewise. + * kern/mm.c: Likewise. + * kern/powerpc/dl.c: Likewise. + * kern/sparc64/dl.c: Likewise. + * kern/x86_64/dl.c: Likewise. + * lib/hexdump.c: Likewise. + * loader/efi/appleloader.c: Likewise. + * loader/i386/ieee1275/linux.c: Likewise. + * loader/i386/pc/chainloader.c: Likewise. + * loader/i386/pc/linux.c: Likewise. + * loader/i386/pc/multiboot2.c: Likewise. + * loader/ieee1275/multiboot2.c: Likewise. + * loader/multiboot2.c: Likewise. + * loader/multiboot_loader.c: Likewise. + * loader/powerpc/ieee1275/linux.c: Likewise. + * normal/completion.c: Likewise. + * normal/menu_entry.c: Likewise. + * partmap/apple.c: Likewise. + * util/grub.d/10_hurd.in: Likewise. + * util/hostfs.c: Likewise. + * video/readers/png.c: Likewise. + +2010-01-03 Colin Watson + + * include/grub/misc.h (GNUC_PREREQ): New macro. + (ATTRIBUTE_ERROR): New macro. + * include/grub/list.h (grub_bad_type_cast_real): Use + ATTRIBUTE_ERROR. + +2010-01-03 Carles Pina i Estany + + * normal/menu_text.c (print_message): Change messages. + +2010-01-03 Carles Pina i Estany + + * normal/menu_entry.c (store_completion): Gettextizze. + +2010-01-03 Carles Pina i Estany + + * kern/env.c (grub_env_unset): Set the variable to "" if has hooks. + +2010-01-03 Carles Pina i Estany + + * po/POTFILES: Sort correctly. + +2010-01-03 Carles Pina i Estany + + * commands/acpi.c (GRUB_MOD_INIT): Capitalise some words from help. + * commands/efi/loadbios.c (GRUB_MOD_INIT): Capitalise BIOS. + * commands/i386/pc/drivemap.c (GRUB_MOD_INIT): Remove space. Add + full stop. + * commands/loadenv.c (GRUB_MOD_INIT): Remove command name from + summary. Gettextizze the strings. + * commands/probe.c (grub_cmd_probe): Capitalise UUID and FS. + * commands/xnu_uuid.c (GRUB_MOD_INIT): Capitalise XNU. + * disk/loopback.c (grub_arg_options): Capitalise first letter. Add + full stop. + (GRUB_MOD_INIT): Remove command name from summary. + * hello/hello.c (GRUD_MOT_INIT): Add missing full stop. Improve the + summary. + * loader/i386/bsd.c (grub_arg_option): Capitalise CDROM. + * term/i386/pc/serial.c (options): Add full stops. + (GRUB_MOD_INIT): Remove command name from the summary. + +2010-01-03 Carles Pina i Estany + + * commands/acpi.c: Gettextizze help strings and/or options. Include + `grub/i18n.h' if needed. + * commands/blocklist.c: Likewise. + * commands/boot.c: Likewise. + * commands/cat.c: Likewise. + * commands/cmp.c: Likewise. + * commands/configfile.c: Likewise. + * commands/crc.c: Likewise. + * commands/date.c: Likewise. + * commands/echo.c: Likewise. + * commands/efi/fixvideo.c: Likewise. + * commands/efi/loadbios.c: Likewise. + * commands/gptsync.c: Likewise. + * commands/halt.c: Likewise. + * commands/handler.c: Likewise. + * commands/hdparm.c: Likewise. + * commands/hexdump.c: Likewise. + * commands/i386/cpuid.c: Likewise. + * commands/i386/pc/drivemap.c: Likewise. + * commands/i386/pc/halt.c: Likewise. + * commands/i386/pc/pxecmd.c: Likewise. + * commands/i386/pc/vbeinfo.c: Likewise. + * commands/i386/pc/vbetest.c: Likewise. + * commands/ieee1275/suspend.c: Likewise. + * commands/keystatus.c: Likewise. + * commands/loadenv.c: Likewise. + * commands/ls.c: Likewise. + * commands/lsmmap.c: Likewise. + * commands/lspci.c: Likewise. + * commands/memrw.c: Likewise. + * commands/minicmd.c: Likewise. + * commands/parttool.c: Likewise. + * commands/password.c: Likewise. + * commands/probe.c: Likewise. + * commands/read.c: Likewise. + * commands/reboot.c: Likewise. + * commands/search.c: Likewise. + * commands/sleep.c: Likewise. + * commands/test.c: Likewise. + * commands/true.c: Likewise. + * commands/usbtest.c: Likewise. + * commands/videotest.c: Likewise. + * commands/xnu_uuid.c: Likewise. + * disk/loopback.c: Likewise. + * hello/hello.c: Likewise. + * loader/i386/bsd.c: Likewise. + * term/i386/pc/serial.c: Likewise. + * po/POTFILES: Add new files. + +2010-01-02 Colin Watson + + * term/i386/pc/at_keyboard.c + (keyboard_controller_wait_untill_ready): Rename to ... + (keyboard_controller_wait_until_ready): ... this. Update all users. + +2010-01-01 Carles Pina i Estany + + * commands/help.c: Include `grub/mm.h' and `grub/normal.h'. + (grub_cmd_help): Print the cmd->name before the cmd->summary. Cut the + string using string width. + * normal/menu_text.c (grub_print_message_indented): Use + grub_print_spaces and not print_spaces. + (print_timeout): Likewise. + (print_spaces): Move to... + * include/grub/term.h: ... here. Change the name to grub_print_spaces. + +2010-01-01 Robert Millan + + Import from Gnulib. + + * gnulib/getdelim.c: New file. + * gnulib/getline.c: Likewise. + +2009-12-31 BVK Chaitanya + + * include/grub/list.h (grub_assert_fail): Removed. + (grub_bad_type_cast_real): New function. + (grub_bad_type_cast): New macro. + (GRUB_AS_LIST): Use grub_bad_type_cast. + (GRUB_AS_LIST_P): Likewise. + (GRUB_AS_NAMED_LIST): Likewise. + (GRUB_AS_NAMED_LIST_P): Likewise. + (GRUB_AS_PRIO_LIST): Likewise. + (GRUB_AS_PRIO_LIST_P): Likewise. + * include/grub/handler.h (GRUB_AS_HANDLER): Likewise. + +2009-12-29 Vladimir Serbinenko + + * loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT (linux)): + Fix syntax error. + +2009-12-29 Robert Millan + + * 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 + + * normal/misc.c (grub_normal_print_device_info): Add spaces and double + quotes. + +2009-12-27 Vladimir Serbinenko + + * kern/parser.c (grub_parser_split_cmdline): Don't dereference NULL. + +2009-12-27 Vladimir Serbinenko + + * normal/menu_text.c (grub_print_message_indented): Prevent + past-the-end-of-array dereference. + +2009-12-27 Vladimir Serbinenko + + * video/readers/jpeg.c (GRUB_MOD_FINI (grub_cmd_jpegtest)): Rename to .. + (GRUB_MOD_FINI (video_reader_jpeg)): ...this + +2009-12-27 Carles Pina i Estany + + * normal/cmdline.c (grub_cmdline_get): Print a space after prompt. + * normal/main.c (grub_normal_read_line): Remove a space from the + default prompt. + +2009-12-27 Carles Pina i Estany + + * loader/i386/efi/linux.c (GRUB_MOD_INIT): Improve command summary. + * loader/i386/ieee1275/linux.c (GRUB_MOD_INIT): Likewise. + * loader/i386/linux.c (GRUB_MOD_INIT): Likewise. + * loader/i386/pc/linux.c (GRUB_MOD_INIT): Likewise. + * loader/powerpc/ieee1275/linux.c (GRUB_MOD_INIT): Likewise. + * loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT): Likewise. + * loader/xnu.c (GRUB_MOD_INIT): Likewise. + +2009-12-26 Carles Pina i Estany + + * video/readers/jpeg.c (cmd): Declare. + (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 + + * efiemu/main.c (GRUB_MOD_INIT): Fix capitalizations and/or full + stops. + * kern/corecmd.c (grub_register_core_commands): Likewise. + * loader/efi/chainloader.c (GRUB_MOD_INIT): Likewise. + * loader/i386/bsd.c (GRUB_MOD_INIT): Likewise. + * loader/i386/efi/linux.c (GRUB_MOD_INIT): Likewise. + * loader/i386/ieee1275/linux.c (GRUB_MOD_INIT): Likewise. + * loader/i386/linux.c (GRUB_MOD_INIT): Likewise. + * loader/i386/pc/chainloader.c (GRUB_MOD_INIT): Likewise. + * loader/i386/pc/linux.c (GRUB_MOD_INIT): Likewise. + * loader/multiboot_loader.c (GRUB_MOD_INIT): Likewise. + * loader/powerpc/ieee1275/linux.c (GRUB_MOD_INIT): Likewise. + * loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT): Likewise. + * loader/xnu.c (GRUB_MOD_INIT): Likewise. + * mmap/mmap.c (GRUB_MOD_INIT): Likewise. + * normal/handler.c (insert_handler): Likewise. + * normal/main.c (GRUB_MOD_INIT): Likewise. + * term/gfxterm.c (GRUB_MOD_INIT): Likewise. + +2009-12-26 Carles Pina i Estany + + * commands/help.c (grub_cmd_help): Print the command name before the + 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 + + 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 + + * 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 + + * 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 + + 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 + + * commands/help.c: Include `'. + (grub_cmd_help): Gettextizze. + (GRUB_MOD_INIT): Likewise. + * commands/i386/pc/play.c: Include `'. + (GRUB_MOD_INIT): Gettextizze. + * commands/search.c: Include `'. + (options): Gettextizze. + (GRUB_MOD_INIT): Gettextizze. + * lib/arg.c: Include `'. + (help_options): Gettextizze. + (find_long): Likewise. + (grub_arg_show_help): Likewise. + * normal/dyncmd.c: Include `'. + (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 + + * 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 + + * util/hostdisk.c (open_device): Fix a comment. + +2009-12-24 Robert Millan + + * util/grub-install.in (host_os): New variable. + * util/i386/efi/grub-install.in (host_os): Likewise. + +2009-12-24 Robert Millan + + * util/mkisofs/write.c (padblock_write): Abort when given an + excedingly large embed image, instead of silently truncating it. + +2009-12-24 Robert Millan + + * include/multiboot.h: Indentation fixes. + +2009-12-24 Robert Millan + + * 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 + + * include/multiboot.h: Make comments src2texi-friendly. + +2009-12-24 Robert Millan + + 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 + + * include/multiboot.h: Remove `'. + (multiboot_uint16_t, multiboot_uint32_t, multiboot_uint64_t): New + types. Update all users. + +2009-12-25 Carles Pina i Estany + + * 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 + + * 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 * commands/i386/pc/drivemap.c: Remove all trailing whitespace. * commands/lspci.c: Likewise. @@ -51,7 +760,7 @@ * video/efi_gop.c (grub_video_gop_get_bitmask): Fix off-by-one in mask size counting. -2009-12-22 Felix Zielcke +2009-12-22 Felix Zielcke * util/grub-mkrescue.in (pkglib_DATA): Set to @pkglib_DATA@. * genmk.rb (class SCRIPT): Modify the target file instead of source. @@ -69,11 +778,11 @@ (grub_cmd_read): Restructure for readability. Support "-v" option. (grub_cmd_write): Restructure for readability. -2009-12-22 Felix Zielcke +2009-12-22 Felix Zielcke * genmk.rb (class SCRIPT): Prepend #{src} path with $(srcdir). -2009-12-22 Felix Zielcke +2009-12-22 Felix Zielcke * genmk.rb (class SCRIPT): Use sed to substitute @pkglib_DATA@ with the actual contents of the correspondending make variable. @@ -81,7 +790,7 @@ (process_input_dir): Copy all $pkglib_DATA files instead of explicitly specifying `*.lst' and `efiemu??.o' -2009-12-22 Felix Zielcke +2009-12-22 Felix Zielcke * util/grub.d/30_os-prober.in (osx_entry): Add round brackets after function name. @@ -97,7 +806,7 @@ (GRUB_MOD_INIT(lspci)): Use extcmd. (GRUB_MOD_FINI(lspci)): Likewise. -2009-12-22 Felix Zielcke +2009-12-22 Felix Zielcke * util/grub.d/30_os-prober.in (osx_entry): Remove non POSIX compliant `function' keyword. @@ -157,7 +866,7 @@ `$(XGETTEXT)'. * po/POTFILES: Add `commands/loadenv.c'. -2009-12-21 Felix Zielcke +2009-12-21 Felix Zielcke * util/grub-mkrescue.in (process_input_dir): Copy `*.lst' files instead of specifying them explicit. @@ -470,7 +1179,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 +2009-12-17 Felix Zielcke * gendistlist.sh: Use POSIX compliant `!' instead of `-not' in the `find' command. @@ -483,7 +1192,7 @@ (grub_hfs_fs): New value .uuid. * include/grub/hfs.h (grub_hfs_sblock): New field 'num_serial'. -2009-12-14 Felix Zielcke +2009-12-14 Felix Zielcke Fix a segfault with parsing unknown long options. @@ -493,7 +1202,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 @@ -632,11 +1341,11 @@ * include/grub/pciutils.h: New file. * util/pci.c: Likewise. -2009-12-11 Felix Zielcke +2009-12-11 Felix Zielcke * util/misc.c: Don't include twice. -2009-12-10 Felix Zielcke +2009-12-10 Felix Zielcke * disk/i386/pc/biosdisk.c (grub_biosdisk_open): Show the disk name in an error message. @@ -732,7 +1441,7 @@ * disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Recognize anything even prefixed with 'cdrom' as a cdrom. -2009-12-06 Felix Zielcke +2009-12-06 Felix Zielcke * util/misc.c (make_system_path_relative_to_its_root): Correctly cope with mount points. @@ -948,7 +1657,7 @@ ($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po)): Rewrite as ... (po/%.po): ... this. -2009-11-26 Felix Zielcke +2009-11-26 Felix Zielcke * util/i386/efi/grub-mkimage.c: Include "progname.h". (main): Use `program_name' instead of nonexistent `progname'. diff --git a/Makefile.in b/Makefile.in index 018bed733..37c5d2035 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,6 +1,6 @@ # -*- makefile -*- # -# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. +# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. # # This Makefile.in is free software; the author # gives unlimited permission to copy and/or distribute it, @@ -41,6 +41,9 @@ includedir = @includedir@ pkgdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'` pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '$(transform)'` +# Internationalization library. +LIBINTL = @LIBINTL@ + XGETTEXT = @XGETTEXT@ MSGMERGE = @MSGMERGE@ MSGFMT = @MSGFMT@ @@ -72,10 +75,12 @@ MKDIR_P = @MKDIR_P@ mkinstalldirs = $(srcdir)/mkinstalldirs +LIBS = @LIBS@ $(LIBINTL) + CC = @CC@ CFLAGS = @CFLAGS@ ASFLAGS = @ASFLAGS@ -LDFLAGS = @LDFLAGS@ +LDFLAGS = @LDFLAGS@ $(LIBS) CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \ -DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\" TARGET_CC = @TARGET_CC@ diff --git a/boot/i386/pc/boot.S b/boot/i386/pc/boot.S index 865326ee2..257f9044e 100644 --- a/boot/i386/pc/boot.S +++ b/boot/i386/pc/boot.S @@ -1,7 +1,7 @@ /* -*-Asm-*- */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,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 diff --git a/boot/i386/pc/cdboot.S b/boot/i386/pc/cdboot.S index ccc9d64de..33569ce9d 100644 --- a/boot/i386/pc/cdboot.S +++ b/boot/i386/pc/cdboot.S @@ -1,7 +1,7 @@ /* -*-Asm-*- */ /* * 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 diff --git a/boot/i386/pc/diskboot.S b/boot/i386/pc/diskboot.S index e5e4a4ef3..92f223f0d 100644 --- a/boot/i386/pc/diskboot.S +++ b/boot/i386/pc/diskboot.S @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2006,2007 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,2006,2007,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -370,7 +370,7 @@ blocklist_default_start: the start of the disk, sector 0 */ .long 2, 0 blocklist_default_len: - /* this is the number of sectors to read the command "install" + /* this is the number of sectors to read. grub-mkimage will fill this up */ .word 0 blocklist_default_seg: diff --git a/boot/i386/pc/lnxboot.S b/boot/i386/pc/lnxboot.S index c51741d42..b4f0030b8 100644 --- a/boot/i386/pc/lnxboot.S +++ b/boot/i386/pc/lnxboot.S @@ -1,7 +1,7 @@ /* -*-Asm-*- */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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/boot/i386/pc/pxeboot.S b/boot/i386/pc/pxeboot.S index 2fc53bc81..28c90e29b 100644 --- a/boot/i386/pc/pxeboot.S +++ b/boot/i386/pc/pxeboot.S @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2000,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 diff --git a/bus/pci.c b/bus/pci.c index fe4cad181..65d848a18 100644 --- a/bus/pci.c +++ b/bus/pci.c @@ -1,7 +1,7 @@ /* pci.c - Generic PCI interfaces. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007 Free Software Foundation, Inc. + * Copyright (C) 2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by 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..f62592115 100644 --- a/commands/acpi.c +++ b/commands/acpi.c @@ -28,6 +28,7 @@ #include #include #include +#include #ifdef GRUB_MACHINE_EFI #include @@ -36,23 +37,23 @@ static const struct grub_arg_option options[] = { {"exclude", 'x', 0, - "Don't load host tables specified by comma-separated list.", + N_("Don't load host tables specified by comma-separated list."), 0, ARG_TYPE_STRING}, {"load-only", 'n', 0, - "Load only tables specified by comma-separated list.", 0, ARG_TYPE_STRING}, - {"v1", '1', 0, "Expose v1 tables.", 0, ARG_TYPE_NONE}, - {"v2", '2', 0, "Expose v2 and v3 tables.", 0, ARG_TYPE_NONE}, - {"oemid", 'o', 0, "Set OEMID of RSDP, XSDT and RSDT.", 0, ARG_TYPE_STRING}, + N_("Load only tables specified by comma-separated list."), 0, ARG_TYPE_STRING}, + {"v1", '1', 0, N_("Expose v1 tables."), 0, ARG_TYPE_NONE}, + {"v2", '2', 0, N_("Expose v2 and v3 tables."), 0, ARG_TYPE_NONE}, + {"oemid", 'o', 0, N_("Set OEMID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING}, {"oemtable", 't', 0, - "Set OEMTABLE ID of RSDP, XSDT and RSDT.", 0, ARG_TYPE_STRING}, + N_("Set OEMTABLE ID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING}, {"oemtablerev", 'r', 0, - "Set OEMTABLE revision of RSDP, XSDT and RSDT.", 0, ARG_TYPE_INT}, + N_("Set OEMTABLE revision of RSDP, XSDT and RSDT."), 0, ARG_TYPE_INT}, {"oemtablecreator", 'c', 0, - "Set creator field of RSDP, XSDT and RSDT.", 0, ARG_TYPE_STRING}, + N_("Set creator field of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING}, {"oemtablecreatorrev", 'd', 0, - "Set creator revision of RSDP, XSDT and RSDT.", 0, ARG_TYPE_INT}, - {"no-ebda", 'e', 0, "Don't update EBDA. May fix failures or hangs on some." - " BIOSes but makes it ineffective with OS not receiving RSDP from GRUB.", + N_("Set creator revision of RSDP, XSDT and RSDT."), 0, ARG_TYPE_INT}, + {"no-ebda", 'e', 0, N_("Don't update EBDA. May fix failures or hangs on some." + " BIOSes but makes it ineffective with OS not receiving RSDP from GRUB."), 0, ARG_TYPE_NONE}, {0, 0, 0, 0, 0, 0} }; @@ -277,7 +278,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 +552,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 +579,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 +588,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 +675,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 +710,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,11 +760,11 @@ GRUB_MOD_INIT(acpi) { cmd = grub_register_extcmd ("acpi", grub_cmd_acpi, GRUB_COMMAND_FLAG_BOTH, - "acpi [-1|-2] [--exclude=table1,table2|" - "--load-only=table1,table2] filename1 " - " [filename2] [...]", - "Load host acpi tables and tables " - "specified by arguments.", + N_("[-1|-2] [--exclude=TABLE1,TABLE2|" + "--load-only=table1,table2] FILE1" + " [FILE2] [...]"), + N_("Load host ACPI tables and tables " + "specified by arguments."), options); } diff --git a/commands/blocklist.c b/commands/blocklist.c index b457b7c39..fec59a828 100644 --- a/commands/blocklist.c +++ b/commands/blocklist.c @@ -24,6 +24,7 @@ #include #include #include +#include static grub_err_t grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)), @@ -87,7 +88,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 +111,7 @@ static grub_command_t cmd; GRUB_MOD_INIT(blocklist) { cmd = grub_register_command ("blocklist", grub_cmd_blocklist, - "blocklist FILE", "Print a block list."); + N_("FILE"), N_("Print a block list.")); } GRUB_MOD_FINI(blocklist) diff --git a/commands/boot.c b/commands/boot.c index fe0453b8a..1ec1e6f77 100644 --- a/commands/boot.c +++ b/commands/boot.c @@ -23,6 +23,7 @@ #include #include #include +#include static grub_err_t (*grub_loader_boot_func) (void); static grub_err_t (*grub_loader_unload_func) (void); @@ -186,7 +187,7 @@ GRUB_MOD_INIT(boot) { cmd_boot = grub_register_command ("boot", grub_cmd_boot, - 0, "Boot an operating system."); + 0, N_("Boot an operating system.")); } GRUB_MOD_FINI(boot) diff --git a/commands/cat.c b/commands/cat.c index 1a2374360..844034777 100644 --- a/commands/cat.c +++ b/commands/cat.c @@ -24,6 +24,7 @@ #include #include #include +#include static grub_err_t grub_cmd_cat (grub_command_t cmd __attribute__ ((unused)), @@ -78,7 +79,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."); + N_("FILE"), N_("Show the contents of a file.")); } GRUB_MOD_FINI(cat) diff --git a/commands/cmp.c b/commands/cmp.c index 8a4b4158b..626e1d022 100644 --- a/commands/cmp.c +++ b/commands/cmp.c @@ -1,7 +1,7 @@ /* cmd.c - command to cmp an operating system */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2005,2006,2007 Free Software Foundation, Inc. + * Copyright (C) 2003,2005,2006,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ #include #include #include +#include #define BUFFER_SIZE 512 @@ -109,7 +110,7 @@ static grub_command_t cmd; GRUB_MOD_INIT(cmp) { cmd = grub_register_command ("cmp", grub_cmd_cmp, - "cmp FILE1 FILE2", "Compare two files."); + N_("FILE1 FILE2"), N_("Compare two files.")); } GRUB_MOD_FINI(cmp) diff --git a/commands/configfile.c b/commands/configfile.c index 852932216..469447711 100644 --- a/commands/configfile.c +++ b/commands/configfile.c @@ -22,6 +22,7 @@ #include #include #include +#include static grub_err_t grub_cmd_source (grub_command_t cmd, int argc, char **args) @@ -53,16 +54,16 @@ GRUB_MOD_INIT(configfile) { cmd_configfile = grub_register_command ("configfile", grub_cmd_source, - "configfile FILE", "Load another config file."); + N_("FILE"), N_("Load another config file.")); cmd_source = grub_register_command ("source", grub_cmd_source, - "source FILE", - "Load another config file without changing context." + N_("FILE"), + N_("Load another config file without changing context.") ); cmd_dot = grub_register_command (".", grub_cmd_source, - ". FILE", - "Load another config file without changing context." + N_("FILE"), + N_("Load another config file without changing context.") ); } diff --git a/commands/crc.c b/commands/crc.c index 6b4b1d1b5..1c1a690aa 100644 --- a/commands/crc.c +++ b/commands/crc.c @@ -1,7 +1,7 @@ /* crc.c - command to calculate the crc32 checksum of a file */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2008 Free Software Foundation, Inc. + * Copyright (C) 2008,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ #include #include #include +#include static grub_err_t grub_cmd_crc (grub_command_t cmd __attribute__ ((unused)), @@ -45,10 +46,13 @@ grub_cmd_crc (grub_command_t cmd __attribute__ ((unused)), while ((size = grub_file_read (file, buf, sizeof (buf))) > 0) crc = grub_getcrc32 (crc, buf, size); - grub_file_close (file); + if (grub_errno) + goto fail; grub_printf ("%08x\n", crc); + fail: + grub_file_close (file); return 0; } @@ -57,8 +61,8 @@ static grub_command_t cmd; GRUB_MOD_INIT(crc) { cmd = grub_register_command ("crc", grub_cmd_crc, - "crc FILE", - "Calculate the crc32 checksum of a file."); + N_("FILE"), + N_("Calculate the crc32 checksum of a file.")); } GRUB_MOD_FINI(crc) diff --git a/commands/date.c b/commands/date.c index 1d609642e..623db4943 100644 --- a/commands/date.c +++ b/commands/date.c @@ -22,6 +22,7 @@ #include #include #include +#include #define GRUB_DATETIME_SET_YEAR 1 #define GRUB_DATETIME_SET_MONTH 2 @@ -135,8 +136,8 @@ GRUB_MOD_INIT(date) { cmd = grub_register_command ("date", grub_cmd_date, - "date [[year-]month-day] [hour:minute[:second]]", - "Command to display/set current datetime."); + N_("[[year-]month-day] [hour:minute[:second]]"), + N_("Command to display/set current datetime.")); } GRUB_MOD_FINI(date) diff --git a/commands/echo.c b/commands/echo.c index c9daf62f1..4fea091cb 100644 --- a/commands/echo.c +++ b/commands/echo.c @@ -20,11 +20,12 @@ #include #include #include +#include static const struct grub_arg_option options[] = { - {0, 'n', 0, "Do not output the trailing newline.", 0, 0}, - {0, 'e', 0, "Enable interpretation of backslash escapes.", 0, 0}, + {0, 'n', 0, N_("Do not output the trailing newline."), 0, 0}, + {0, 'e', 0, N_("Enable interpretation of backslash escapes."), 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -113,7 +114,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.", + N_("[-e|-n] STRING"), N_("Display a line of text."), options); } diff --git a/commands/efi/fixvideo.c b/commands/efi/fixvideo.c index 685662237..0f821b7a2 100644 --- a/commands/efi/fixvideo.c +++ b/commands/efi/fixvideo.c @@ -22,6 +22,7 @@ #include #include #include +#include static struct grub_video_patch { @@ -99,7 +100,7 @@ static grub_command_t cmd_fixvideo; GRUB_MOD_INIT(fixvideo) { cmd_fixvideo = grub_register_command ("fix_video", grub_cmd_fixvideo, - 0, "Fix video problem."); + 0, N_("Fix video problem.")); } diff --git a/commands/efi/loadbios.c b/commands/efi/loadbios.c index d7ad42690..653327d6c 100644 --- a/commands/efi/loadbios.c +++ b/commands/efi/loadbios.c @@ -23,6 +23,7 @@ #include #include #include +#include static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID; static grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID; @@ -160,7 +161,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 +170,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 +185,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); @@ -201,11 +202,11 @@ static grub_command_t cmd_fakebios, cmd_loadbios; GRUB_MOD_INIT(loadbios) { cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios, - 0, "Fake bios."); + 0, N_("Fake BIOS.")); cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios, - "loadbios BIOS_DUMP [INT10_DUMP]", - "Load bios dump."); + "BIOS_DUMP [INT10_DUMP]", + N_("Load BIOS dump.")); } GRUB_MOD_FINI(loadbios) diff --git a/commands/gptsync.c b/commands/gptsync.c index 8315faa53..d217b5d5c 100644 --- a/commands/gptsync.c +++ b/commands/gptsync.c @@ -27,6 +27,7 @@ #include #include #include +#include /* Convert a LBA address to a CHS address in the INT 13 format. */ /* Taken from grub1. */ @@ -240,13 +241,13 @@ GRUB_MOD_INIT(gptsync) { (void) mod; /* To stop warning. */ cmd = grub_register_command ("gptsync", grub_cmd_gptsync, - "gptsync DEVICE [PARTITION[+/-[TYPE]]] ...", - "Fill hybrid MBR of GPT drive DEVICE. " + N_("DEVICE [PARTITION[+/-[TYPE]]] ..."), + N_("Fill hybrid MBR of GPT drive DEVICE. " "specified partitions will be a part " "of hybrid mbr. Up to 3 partitions are " "allowed. TYPE is an MBR type. " "+ means that partition is active. " - "Only one partition can be active."); + "Only one partition can be active.")); } GRUB_MOD_FINI(gptsync) diff --git a/commands/halt.c b/commands/halt.c index 09431d3cb..3400115a0 100644 --- a/commands/halt.c +++ b/commands/halt.c @@ -20,6 +20,7 @@ #include #include #include +#include static grub_err_t grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)), @@ -35,8 +36,8 @@ static grub_command_t cmd; GRUB_MOD_INIT(halt) { cmd = grub_register_command ("halt", grub_cmd_halt, - 0, "Halts the computer. This command does not" - " work on all firmware implementations."); + 0, N_("Halts the computer. This command does" + " not work on all firmware implementations.")); } GRUB_MOD_FINI(halt) diff --git a/commands/handler.c b/commands/handler.c index 60889dd5e..f9270972b 100644 --- a/commands/handler.c +++ b/commands/handler.c @@ -23,6 +23,7 @@ #include #include #include +#include static grub_err_t grub_cmd_handler (struct grub_command *cmd __attribute__ ((unused)), @@ -90,8 +91,8 @@ GRUB_MOD_INIT(handler) { cmd_handler = grub_register_command ("handler", grub_cmd_handler, - "handler [class [handler]]", - "List or select a handler."); + N_("[class [handler]]"), + N_("List or select a handler.")); } GRUB_MOD_FINI(handler) diff --git a/commands/hdparm.c b/commands/hdparm.c index 458a447c7..a3f8bbff0 100644 --- a/commands/hdparm.c +++ b/commands/hdparm.c @@ -24,29 +24,30 @@ #include #include #include +#include static const struct grub_arg_option options[] = { - {"apm", 'B', 0, "Set Advanced Power Management\n" - "(1=low, ..., 254=high, 255=off).", + {"apm", 'B', 0, N_("Set Advanced Power Management\n" + "(1=low, ..., 254=high, 255=off)."), 0, ARG_TYPE_INT}, - {"power", 'C', 0, "Check power mode.", 0, ARG_TYPE_NONE}, - {"security-freeze", 'F', 0, "Freeze ATA security settings until reset.", + {"power", 'C', 0, N_("Check power mode."), 0, ARG_TYPE_NONE}, + {"security-freeze", 'F', 0, N_("Freeze ATA security settings until reset."), 0, ARG_TYPE_NONE}, - {"health", 'H', 0, "Check SMART health status.", 0, ARG_TYPE_NONE}, - {"aam", 'M', 0, "Set Automatic Acoustic Management\n" - "(0=off, 128=quiet, ..., 254=fast).", + {"health", 'H', 0, N_("Check SMART health status."), 0, ARG_TYPE_NONE}, + {"aam", 'M', 0, N_("Set Automatic Acoustic Management\n" + "(0=off, 128=quiet, ..., 254=fast)."), 0, ARG_TYPE_INT}, - {"standby-timeout", 'S', 0, "Set standby timeout\n" - "(0=off, 1=5s, 2=10s, ..., 240=20m, 241=30m, ...).", + {"standby-timeout", 'S', 0, N_("Set standby timeout\n" + "(0=off, 1=5s, 2=10s, ..., 240=20m, 241=30m, ...)."), 0, ARG_TYPE_INT}, - {"standby", 'y', 0, "Set drive to standby mode.", 0, ARG_TYPE_NONE}, - {"sleep", 'Y', 0, "Set drive to sleep mode.", 0, ARG_TYPE_NONE}, - {"identify", 'i', 0, "Print drive identity and settings.", + {"standby", 'y', 0, N_("Set drive to standby mode."), 0, ARG_TYPE_NONE}, + {"sleep", 'Y', 0, N_("Set drive to sleep mode."), 0, ARG_TYPE_NONE}, + {"identify", 'i', 0, N_("Print drive identity and settings."), 0, ARG_TYPE_NONE}, - {"dumpid", 'I', 0, "Dump contents of ATA IDENTIFY sector.", + {"dumpid", 'I', 0, N_("Dump contents of ATA IDENTIFY sector."), 0, ARG_TYPE_NONE}, - {"smart", -1, 0, "Disable/enable SMART (0/1).", 0, ARG_TYPE_INT}, - {"quiet", 'q', 0, "Do not print messages.", 0, ARG_TYPE_NONE}, + {"smart", -1, 0, N_("Disable/enable SMART (0/1)."), 0, ARG_TYPE_INT}, + {"quiet", 'q', 0, N_("Do not print messages."), 0, ARG_TYPE_NONE}, {0, 0, 0, 0, 0, 0} }; @@ -410,8 +411,8 @@ GRUB_MOD_INIT(hdparm) { cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm, GRUB_COMMAND_FLAG_BOTH, - "hdparm [OPTIONS] DISK", - "Get/set ATA disk parameters.", options); + N_("[OPTIONS] DISK"), + N_("Get/set ATA disk parameters."), options); } GRUB_MOD_FINI(hdparm) diff --git a/commands/help.c b/commands/help.c index bfca5e0cc..9234a3697 100644 --- a/commands/help.c +++ b/commands/help.c @@ -1,7 +1,7 @@ /* help.c - command to show a help text. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,10 @@ #include #include #include +#include +#include +#include +#include static grub_err_t grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc, @@ -37,26 +41,51 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc, if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) && (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE)) { - struct grub_term_output *cur; - int desclen = grub_strlen (cmd->summary); - FOR_ACTIVE_TERM_OUTPUTS(cur) - { - int width = grub_term_width(cur); - char description[width / 2]; + struct grub_term_output *term; + const char *summary_translated = _(cmd->summary); + char *command_help; + grub_uint32_t *unicode_command_help; + grub_uint32_t *unicode_last_position; - /* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled - with the description followed by spaces. */ - grub_memset (description, ' ', width / 2 - 1); - description[width / 2 - 1] = '\0'; - grub_memcpy (description, cmd->summary, - (desclen < width / 2 - 1 - ? desclen : width / 2 - 1)); - grub_puts_terminal (description, cur); + command_help = grub_malloc (grub_strlen (cmd->name) + + sizeof (" ") - 1 + + grub_strlen (summary_translated)); + + grub_sprintf(command_help, "%s %s", cmd->name, summary_translated); + + grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help, + &unicode_last_position); + + FOR_ACTIVE_TERM_OUTPUTS(term) + { + unsigned stringwidth; + grub_uint32_t *unicode_last_screen_position; + + unicode_last_screen_position = unicode_command_help; + + stringwidth = 0; + + while (unicode_last_screen_position < unicode_last_position && + stringwidth < ((grub_term_width (term) / 2) - 2)) + { + stringwidth + += grub_term_getcharwidth (term, + *unicode_last_screen_position); + unicode_last_screen_position++; + } + + grub_print_ucs4 (unicode_command_help, + unicode_last_screen_position, term); + if (!(cnt % 2)) + grub_print_spaces (term, grub_term_width (term) / 2 + - stringwidth); } - if ((cnt++) % 2) + if (cnt % 2) grub_printf ("\n"); - else - grub_printf (" "); + cnt++; + + grub_free (command_help); + grub_free (unicode_command_help); } return 0; } @@ -73,8 +102,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; @@ -106,8 +135,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..c1d4ecba9 100644 --- a/commands/hexdump.c +++ b/commands/hexdump.c @@ -1,7 +1,7 @@ /* hexdump.c - command to dump the contents of a file or memory */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2007,2008,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,11 +24,12 @@ #include #include #include +#include static const struct grub_arg_option options[] = { - {"skip", 's', 0, "Skip offset bytes from the beginning of file.", 0, + {"skip", 's', 0, N_("Skip offset bytes from the beginning of file."), 0, ARG_TYPE_INT}, - {"length", 'n', 0, "Read only LENGTH bytes.", 0, ARG_TYPE_INT}, + {"length", 'n', 0, N_("Read only LENGTH bytes."), 0, ARG_TYPE_INT}, {0, 0, 0, 0, 0, 0} }; @@ -121,8 +122,8 @@ GRUB_MOD_INIT (hexdump) { cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump, GRUB_COMMAND_FLAG_BOTH, - "hexdump [OPTIONS] FILE_OR_DEVICE", - "Dump the contents of a file or memory.", + N_("[OPTIONS] FILE_OR_DEVICE"), + N_("Dump the contents of a file or memory."), options); } diff --git a/commands/i386/cpuid.c b/commands/i386/cpuid.c index 8097e7372..6eebf91a1 100644 --- a/commands/i386/cpuid.c +++ b/commands/i386/cpuid.c @@ -25,6 +25,7 @@ #include #include #include +#include #define cpuid(num,a,b,c,d) \ asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1" \ @@ -33,7 +34,7 @@ static const struct grub_arg_option options[] = { - {"long-mode", 'l', 0, "Check for long mode flag (default).", 0, 0}, + {"long-mode", 'l', 0, N_("Check for long mode flag (default)."), 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -88,7 +89,7 @@ done: #endif cmd = grub_register_extcmd ("cpuid", grub_cmd_cpuid, GRUB_COMMAND_FLAG_BOTH, - "cpuid [-l]", "Check for CPU features.", options); + "[-l]", N_("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..3baacba49 100644 --- a/commands/i386/pc/drivemap.c +++ b/commands/i386/pc/drivemap.c @@ -26,6 +26,7 @@ #include #include #include +#include /* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */ @@ -33,9 +34,9 @@ static grub_uint32_t *const int13slot = UINT_TO_PTR (4 * 0x13); /* Remember to update enum opt_idxs accordingly. */ static const struct grub_arg_option options[] = { - {"list", 'l', 0, "Show the current mappings.", 0, 0}, - {"reset", 'r', 0, "Reset all mappings to the default values.", 0, 0}, - {"swap", 's', 0, "Perform both direct and reverse mappings.", 0, 0}, + {"list", 'l', 0, N_("Show the current mappings."), 0, 0}, + {"reset", 'r', 0, N_("Reset all mappings to the default values."), 0, 0}, + {"swap", 's', 0, N_("Perform both direct and reverse mappings."), 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -308,7 +309,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. */ @@ -403,8 +404,8 @@ GRUB_MOD_INIT (drivemap) cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap, GRUB_COMMAND_FLAG_BOTH, "drivemap" - " -l | -r | [-s] grubdev osdisk", - "Manage the BIOS drive mappings.", + N_("-l | -r | [-s] grubdev osdisk."), + N_("Manage the BIOS drive mappings."), options); drivemap_hook = grub_loader_register_preboot_hook (&install_int13_handler, diff --git a/commands/i386/pc/halt.c b/commands/i386/pc/halt.c index befd58804..4c39612ae 100644 --- a/commands/i386/pc/halt.c +++ b/commands/i386/pc/halt.c @@ -1,7 +1,7 @@ /* halt.c - command to halt the computer. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2007 Free Software Foundation, Inc. + * Copyright (C) 2005,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,10 +20,11 @@ #include #include #include +#include static const struct grub_arg_option options[] = { - {"no-apm", 'n', 0, "Do not use APM to halt the computer.", 0, 0}, + {"no-apm", 'n', 0, N_("Do not use APM to halt the computer."), 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -46,8 +47,8 @@ static grub_extcmd_t cmd; GRUB_MOD_INIT(halt) { cmd = grub_register_extcmd ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH, - "halt [-n]", - "Halt the system, if possible using APM.", + "[-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..1151dddf4 100644 --- a/commands/i386/pc/play.c +++ b/commands/i386/pc/play.c @@ -1,7 +1,7 @@ /* play.c - command to play a tune */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2007 Free Software Foundation, Inc. + * Copyright (C) 2005,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ #include #include #include +#include #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..b576a8ea4 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,32 @@ #include #include #include -#include - -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 +#include 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, + N_("Unload PXE environment.")); } GRUB_MOD_FINI(pxecmd) { - grub_unregister_extcmd (cmd); + grub_unregister_command (cmd); } diff --git a/commands/i386/pc/vbeinfo.c b/commands/i386/pc/vbeinfo.c index ee9f3c186..c266bbfcb 100644 --- a/commands/i386/pc/vbeinfo.c +++ b/commands/i386/pc/vbeinfo.c @@ -1,7 +1,7 @@ /* vbeinfo.c - command to list compatible VBE video modes. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ #include #include #include +#include static void * real2pm (grub_vbe_farptr_t ptr) @@ -175,7 +176,7 @@ GRUB_MOD_INIT(vbeinfo) { cmd = grub_register_command ("vbeinfo", grub_cmd_vbeinfo, 0, - "List compatible VESA BIOS extension video modes."); + N_("List compatible VESA BIOS extension video modes.")); } GRUB_MOD_FINI(vbeinfo) diff --git a/commands/i386/pc/vbetest.c b/commands/i386/pc/vbetest.c index 4050c869e..d97323087 100644 --- a/commands/i386/pc/vbetest.c +++ b/commands/i386/pc/vbetest.c @@ -25,6 +25,7 @@ #include #include #include +#include static grub_err_t grub_cmd_vbetest (grub_command_t cmd __attribute__ ((unused)), @@ -168,7 +169,7 @@ static grub_command_t cmd; GRUB_MOD_INIT(vbetest) { cmd = grub_register_command ("vbetest", grub_cmd_vbetest, - 0, "Test VESA BIOS Extension 2.0+ support."); + 0, N_("Test VESA BIOS Extension 2.0+ support.")); } GRUB_MOD_FINI(vbetest) diff --git a/commands/ieee1275/suspend.c b/commands/ieee1275/suspend.c index fd538f8ea..f096cc9ba 100644 --- a/commands/ieee1275/suspend.c +++ b/commands/ieee1275/suspend.c @@ -22,6 +22,7 @@ #include #include #include +#include static grub_err_t grub_cmd_suspend (grub_command_t cmd __attribute__ ((unused)), @@ -39,7 +40,7 @@ static grub_command_t cmd; GRUB_MOD_INIT(ieee1275_suspend) { cmd = grub_register_command ("suspend", grub_cmd_suspend, - 0, "Return to Open Firmware prompt."); + 0, N_("Return to Open Firmware prompt.")); } GRUB_MOD_FINI(ieee1275_suspend) diff --git a/commands/keystatus.c b/commands/keystatus.c index 580e25f5d..838792889 100644 --- a/commands/keystatus.c +++ b/commands/keystatus.c @@ -21,12 +21,13 @@ #include #include #include +#include static const struct grub_arg_option options[] = { - {"shift", 's', 0, "Check Shift key.", 0, 0}, - {"ctrl", 'c', 0, "Check Control key.", 0, 0}, - {"alt", 'a', 0, "Check Alt key.", 0, 0}, + {"shift", 's', 0, N_("Check Shift key."), 0, 0}, + {"ctrl", 'c', 0, N_("Check Control key."), 0, 0}, + {"alt", 'a', 0, N_("Check Alt key."), 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -81,8 +82,8 @@ GRUB_MOD_INIT(keystatus) { cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus, GRUB_COMMAND_FLAG_BOTH, - "keystatus [--shift] [--ctrl] [--alt]", - "Check key modifier status.", + N_("[--shift] [--ctrl] [--alt]"), + N_("Check key modifier status."), options); } diff --git a/commands/loadenv.c b/commands/loadenv.c index c10dd0e27..910392614 100644 --- a/commands/loadenv.c +++ b/commands/loadenv.c @@ -26,10 +26,11 @@ #include #include #include +#include static const struct grub_arg_option options[] = { - {"file", 'f', 0, "Specify filename.", 0, ARG_TYPE_PATHNAME}, + {"file", 'f', 0, N_("Specify filename."), 0, ARG_TYPE_PATHNAME}, {0, 0, 0, 0, 0, 0} }; @@ -328,7 +329,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) @@ -384,20 +385,20 @@ GRUB_MOD_INIT(loadenv) cmd_load = grub_register_extcmd ("load_env", grub_cmd_load_env, GRUB_COMMAND_FLAG_BOTH, - "load_env [-f FILE]", - "Load variables from environment block file.", + N_("[-f FILE]"), + N_("Load variables from environment block file."), options); cmd_list = grub_register_extcmd ("list_env", grub_cmd_list_env, GRUB_COMMAND_FLAG_BOTH, - "list_env [-f FILE]", - "List variables from environment block file.", + N_("[-f FILE]"), + N_("List variables from environment block file."), options); cmd_save = grub_register_extcmd ("save_env", grub_cmd_save_env, GRUB_COMMAND_FLAG_BOTH, - "save_env [-f FILE] variable_name [...]", - "Save variables to environment block file.", + N_("[-f FILE] variable_name [...]"), + N_("Save variables to environment block file."), options); } diff --git a/commands/ls.c b/commands/ls.c index 6eaa1d59e..57409c4f6 100644 --- a/commands/ls.c +++ b/commands/ls.c @@ -1,7 +1,7 @@ /* ls.c - command to list files and devices */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2003,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 @@ -30,12 +30,13 @@ #include #include #include +#include static const struct grub_arg_option options[] = { - {"long", 'l', 0, "Show a long list with more detailed information.", 0, 0}, - {"human-readable", 'h', 0, "Print sizes in a human readable format.", 0, 0}, - {"all", 'a', 0, "List all files.", 0, 0}, + {"long", 'l', 0, N_("Show a long list with more detailed information."), 0, 0}, + {"human-readable", 'h', 0, N_("Print sizes in a human readable format."), 0, 0}, + {"all", 'a', 0, N_("List all files."), 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -260,8 +261,8 @@ 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]", - "List devices and files.", options); + N_("[-l|-h|-a] [FILE]"), + N_("List devices and files."), options); } GRUB_MOD_FINI(ls) diff --git a/commands/lsmmap.c b/commands/lsmmap.c index 09f141ea0..d5eef1ce9 100644 --- a/commands/lsmmap.c +++ b/commands/lsmmap.c @@ -20,6 +20,7 @@ #include #include #include +#include static grub_err_t grub_cmd_lsmmap (grub_command_t cmd __attribute__ ((unused)), @@ -43,7 +44,7 @@ static grub_command_t cmd; GRUB_MOD_INIT(lsmmap) { cmd = grub_register_command ("lsmmap", grub_cmd_lsmmap, - 0, "List memory map provided by firmware."); + 0, N_("List memory map provided by firmware.")); } GRUB_MOD_FINI(lsmmap) diff --git a/commands/lspci.c b/commands/lspci.c index fbade98c1..c2abd8736 100644 --- a/commands/lspci.c +++ b/commands/lspci.c @@ -21,6 +21,7 @@ #include #include #include +#include struct grub_pci_classname { @@ -218,7 +219,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]", N_("List PCI devices."), options); } GRUB_MOD_FINI(lspci) diff --git a/commands/memrw.c b/commands/memrw.c index eada1d232..d0908a237 100644 --- a/commands/memrw.c +++ b/commands/memrw.c @@ -21,13 +21,14 @@ #include #include #include +#include static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword; static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword; static const struct grub_arg_option options[] = { - {0, 'v', 0, "Save read value into variable VARNAME.", + {0, 'v', 0, N_("Save read value into variable VARNAME."), "VARNAME", ARG_TYPE_STRING}, {0, 0, 0, 0, 0, 0} }; @@ -41,7 +42,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 +79,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 +120,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); + N_("ADDR"), N_("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); + N_("ADDR"), N_("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); + N_("ADDR"), N_("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."); + N_("ADDR VALUE [MASK]"), N_("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."); + N_("ADDR VALUE [MASK]"), N_("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."); + N_("ADDR VALUE [MASK]"), N_("Write dword VALUE to ADDR.")); } GRUB_MOD_FINI(memrw) diff --git a/commands/minicmd.c b/commands/minicmd.c index ee7f6b4c3..4ea9efead 100644 --- a/commands/minicmd.c +++ b/commands/minicmd.c @@ -27,6 +27,7 @@ #include #include #include +#include /* cat FILE */ static grub_err_t @@ -353,28 +354,28 @@ GRUB_MOD_INIT(minicmd) { cmd_cat = grub_register_command ("cat", grub_mini_cmd_cat, - "cat FILE", "Show the contents of a file."); + N_("FILE"), N_("Show the contents of a file.")); cmd_help = grub_register_command ("help", grub_mini_cmd_help, - 0, "Show this message."); + 0, N_("Show this message.")); cmd_root = grub_register_command ("root", grub_mini_cmd_root, - "root [DEVICE]", "Set the root device."); + N_("[DEVICE]"), N_("Set the root device.")); cmd_dump = grub_register_command ("dump", grub_mini_cmd_dump, - "dump ADDR", "Dump memory."); + N_("ADDR"), N_("Dump memory.")); cmd_rmmod = grub_register_command ("rmmod", grub_mini_cmd_rmmod, - "rmmod MODULE", "Remove a module."); + N_("MODULE"), N_("Remove a module.")); cmd_lsmod = grub_register_command ("lsmod", grub_mini_cmd_lsmod, - 0, "Show loaded modules."); + 0, N_("Show loaded modules.")); cmd_exit = grub_register_command ("exit", grub_mini_cmd_exit, - 0, "Exit from GRUB."); + 0, N_("Exit from GRUB.")); cmd_clear = grub_register_command ("clear", grub_mini_cmd_clear, - 0, "Clear the screen."); + 0, N_("Clear the screen.")); } GRUB_MOD_FINI(minicmd) diff --git a/commands/parttool.c b/commands/parttool.c index 473652cec..3f69d5525 100644 --- a/commands/parttool.c +++ b/commands/parttool.c @@ -29,6 +29,7 @@ #include #include #include +#include static struct grub_parttool *parts = 0; static int curhandle = 0; @@ -322,7 +323,7 @@ GRUB_MOD_INIT(parttool) { mymod = mod; cmd = grub_register_command ("parttool", grub_cmd_parttool, - "parttool PARTITION COMMANDS", + N_("PARTITION COMMANDS"), helpmsg); } diff --git a/commands/password.c b/commands/password.c index 7bb2f0ae5..04285254e 100644 --- a/commands/password.c +++ b/commands/password.c @@ -24,6 +24,7 @@ #include #include #include +#include static grub_dl_t my_mod; @@ -48,7 +49,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)), int copylen; 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_zalloc (GRUB_AUTH_MAX_PASSLEN); if (!pass) @@ -74,9 +75,9 @@ GRUB_MOD_INIT(password) { my_mod = mod; cmd = grub_register_command ("password", grub_cmd_password, - "password USER PASSWORD", - "Set user password (plaintext). " - "Unrecommended and insecure."); + N_("USER PASSWORD"), + N_("Set user password (plaintext). " + "Unrecommended and insecure.")); } GRUB_MOD_FINI(password) diff --git a/commands/probe.c b/commands/probe.c index fb196275f..c2cc599e9 100644 --- a/commands/probe.c +++ b/commands/probe.c @@ -30,16 +30,17 @@ #include #include #include +#include static const struct grub_arg_option options[] = { {"set", 's', GRUB_ARG_OPTION_OPTIONAL, - "Set a variable to return value.", "VAR", ARG_TYPE_STRING}, - {"driver", 'd', 0, "Determine driver.", 0, 0}, - {"partmap", 'p', 0, "Determine partition map type.", 0, 0}, - {"fs", 'f', 0, "Determine filesystem type.", 0, 0}, - {"fs-uuid", 'u', 0, "Determine filesystem UUID.", 0, 0}, - {"label", 'l', 0, "Determine filesystem label.", 0, 0}, + N_("Set a variable to return value."), "VAR", ARG_TYPE_STRING}, + {"driver", 'd', 0, N_("Determine driver."), 0, 0}, + {"partmap", 'p', 0, N_("Determine partition map type."), 0, 0}, + {"fs", 'f', 0, N_("Determine filesystem type."), 0, 0}, + {"fs-uuid", 'u', 0, N_("Determine filesystem UUID."), 0, 0}, + {"label", 'l', 0, N_("Determine filesystem label."), 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -150,8 +151,8 @@ static grub_extcmd_t cmd; GRUB_MOD_INIT (probe) { cmd = grub_register_extcmd ("probe", grub_cmd_probe, GRUB_COMMAND_FLAG_BOTH, - "probe [DEVICE]", - "Retrieve device info.", options); + N_("[DEVICE]"), + N_("Retrieve device info."), options); } GRUB_MOD_FINI (probe) diff --git a/commands/read.c b/commands/read.c index 270b7bd77..8a7c4a01f 100644 --- a/commands/read.c +++ b/commands/read.c @@ -24,6 +24,7 @@ #include #include #include +#include static char * grub_getline (void) @@ -79,8 +80,8 @@ static grub_command_t cmd; GRUB_MOD_INIT(read) { cmd = grub_register_command ("read", grub_cmd_read, - "read [ENVVAR]", - "Set variable with user input."); + N_("[ENVVAR]"), + N_("Set variable with user input.")); } GRUB_MOD_FINI(read) diff --git a/commands/reboot.c b/commands/reboot.c index 2add295ef..eedd53c91 100644 --- a/commands/reboot.c +++ b/commands/reboot.c @@ -20,6 +20,7 @@ #include #include #include +#include static grub_err_t grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)), @@ -35,7 +36,7 @@ static grub_command_t cmd; GRUB_MOD_INIT(reboot) { cmd = grub_register_command ("reboot", grub_cmd_reboot, - 0, "Reboot the computer."); + 0, N_("Reboot the computer.")); } GRUB_MOD_FINI(reboot) diff --git a/commands/search.c b/commands/search.c index 2907daa9f..2f0cef8aa 100644 --- a/commands/search.c +++ b/commands/search.c @@ -25,29 +25,12 @@ #include #include #include -#include +#include +#include +#include -static const struct grub_arg_option options[] = - { - {"file", 'f', 0, "Search devices by a file.", 0, 0}, - {"label", 'l', 0, "Search devices by a filesystem label.", 0, 0}, - {"fs-uuid", 'u', 0, "Search devices by a filesystem UUID.", 0, 0}, - {"set", 's', GRUB_ARG_OPTION_OPTIONAL, "Set a variable to the first device found.", "VAR", ARG_TYPE_STRING}, - {"no-floppy", 'n', 0, "Do not probe any floppy drive.", 0, 0}, - {0, 0, 0, 0, 0, 0} - }; - -enum options - { - SEARCH_FILE, - SEARCH_LABEL, - SEARCH_FS_UUID, - SEARCH_SET, - SEARCH_NO_FLOPPY, - }; - -static void -search_fs (const char *key, const char *var, int no_floppy, enum options type) +void +FUNC_NAME (const char *key, const char *var, int no_floppy) { int count = 0; char *buf = NULL; @@ -63,7 +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, + N_("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 . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 aea7f2690..012181fa2 100644 --- a/commands/sleep.c +++ b/commands/sleep.c @@ -24,11 +24,12 @@ #include #include #include +#include static const struct grub_arg_option options[] = { - {"verbose", 'v', 0, "Verbose countdown.", 0, 0}, - {"interruptible", 'i', 0, "Interruptible with ESC.", 0, 0}, + {"verbose", 'v', 0, N_("Verbose countdown."), 0, 0}, + {"interruptible", 'i', 0, N_("Interruptible with ESC."), 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -102,8 +103,8 @@ 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", - "Wait for a specified number of seconds.", + N_("NUMBER_OF_SECONDS"), + N_("Wait for a specified number of seconds."), options); } diff --git a/commands/terminal.c b/commands/terminal.c index 0fff70a69..b30f43130 100644 --- a/commands/terminal.c +++ b/commands/terminal.c @@ -347,12 +347,12 @@ GRUB_MOD_INIT(terminal) { cmd_terminal_input = grub_register_command ("terminal_input", grub_cmd_terminal_input, - "terminal_input [--append|--remove] " + "[--append|--remove] " "[TERMINAL1] [TERMINAL2] ...", "List or select an input terminal."); cmd_terminal_output = grub_register_command ("terminal_output", grub_cmd_terminal_output, - "terminal_output [--append|--remove] " + "[--append|--remove] " "[TERMINAL1] [TERMINAL2] ...", "List or select an output terminal."); } diff --git a/commands/test.c b/commands/test.c index 84b4279ea..6995165cf 100644 --- a/commands/test.c +++ b/commands/test.c @@ -1,7 +1,7 @@ /* test.c -- The test command.. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2007 Free Software Foundation, Inc. + * Copyright (C) 2005,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ #include #include #include +#include /* A simple implementation for signed numbers. */ static int @@ -420,9 +421,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."); + N_("EXPRESSION ]"), N_("Evaluate an expression.")); cmd_2 = grub_register_command ("test", grub_cmd_test, - "test EXPRESSION", "Evaluate an expression."); + N_("EXPRESSION"), N_("Evaluate an expression.")); } GRUB_MOD_FINI(test) diff --git a/commands/true.c b/commands/true.c index ef9f65889..aa8125853 100644 --- a/commands/true.c +++ b/commands/true.c @@ -19,6 +19,7 @@ #include #include +#include static grub_err_t grub_cmd_true (struct grub_command *cmd __attribute__ ((unused)), @@ -43,10 +44,10 @@ GRUB_MOD_INIT(true) { cmd_true = grub_register_command ("true", grub_cmd_true, - 0, "Do nothing, successfully."); + 0, N_("Do nothing, successfully.")); cmd_false = grub_register_command ("false", grub_cmd_false, - 0, "Do nothing, unsuccessfully."); + 0, N_("Do nothing, unsuccessfully.")); } GRUB_MOD_FINI(true) diff --git a/commands/usbtest.c b/commands/usbtest.c index df124ca18..b884a93f1 100644 --- a/commands/usbtest.c +++ b/commands/usbtest.c @@ -25,6 +25,7 @@ #include #include #include +#include static const char *usb_classes[] = { @@ -195,7 +196,7 @@ static grub_command_t cmd; GRUB_MOD_INIT(usbtest) { cmd = grub_register_command ("usb", grub_cmd_usbtest, - 0, "Test USB support."); + 0, N_("Test USB support.")); } GRUB_MOD_FINI(usbtest) diff --git a/commands/videotest.c b/commands/videotest.c index 33b46e229..1730a2031 100644 --- a/commands/videotest.c +++ b/commands/videotest.c @@ -24,6 +24,7 @@ #include #include #include +#include static grub_err_t grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)), @@ -73,7 +74,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); @@ -181,7 +182,7 @@ static grub_command_t cmd; GRUB_MOD_INIT(videotest) { cmd = grub_register_command ("videotest", grub_cmd_videotest, - 0, "Test video subsystem."); + 0, N_("Test video subsystem.")); } GRUB_MOD_FINI(videotest) diff --git a/commands/xnu_uuid.c b/commands/xnu_uuid.c index c43c4bf37..b01352269 100644 --- a/commands/xnu_uuid.c +++ b/commands/xnu_uuid.c @@ -32,6 +32,7 @@ #include #include #include +#include /* This prefix is used by xnu and boot-132 to hash together with volume serial. */ @@ -88,9 +89,9 @@ static grub_command_t cmd; GRUB_MOD_INIT (xnu_uuid) { cmd = grub_register_command ("xnu_uuid", grub_cmd_xnu_uuid, - "xnu_uuid GRUBUUID [VARNAME]", - "Transform 64-bit UUID to format " - "suitable for xnu."); + N_("GRUBUUID [VARNAME]"), + N_("Transform 64-bit UUID to format " + "suitable for XNU.")); } GRUB_MOD_FINI (xnu_uuid) diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk index c3d14ca7a..1ded4776f 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 81e964ca4..93b138eee 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -395,7 +395,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 \ @@ -490,10 +490,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) @@ -504,16 +521,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/i386-pc.rmk b/conf/i386-pc.rmk index 4ae753776..afdf47e5a 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -115,9 +115,6 @@ grub_install_SOURCES = util/grub-install.in bin_SCRIPTS += grub-mkrescue grub_mkrescue_SOURCES = util/grub-mkrescue.in -bin_SCRIPTS += grub-mkfloppy -grub_mkfloppy_SOURCES = util/i386/pc/grub-mkfloppy.in - pkglib_MODULES = biosdisk.mod chain.mod \ multiboot.mod reboot.mod halt.mod \ vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \ 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/config.rpath b/config.rpath new file mode 100755 index 000000000..c547c6882 --- /dev/null +++ b/config.rpath @@ -0,0 +1,666 @@ +#! /bin/sh +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2007 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's _LT_CC_BASENAME. + +for cc_temp in $CC""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + darwin*) + case $cc_basename in + xlc*) + wl='-Wl,' + ;; + esac + ;; + mingw* | cygwin* | pw32* | os2*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + newsos6) + ;; + linux* | k*bsd*-gnu) + case $cc_basename in + icc* | ecc*) + wl='-Wl,' + ;; + pgcc | pgf77 | pgf90) + wl='-Wl,' + ;; + ccc*) + wl='-Wl,' + ;; + como) + wl='-lopt=' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + wl='-Wl,' + ;; + esac + ;; + esac + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + rdos*) + ;; + solaris*) + wl='-Wl,' + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; + unicos*) + wl='-Wl,' + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + case "$host_os" in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we cannot use + # them. + ld_shlibs=no + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + interix[3-9]*) + hardcode_direct=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + gnu* | linux* | k*bsd*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = no; then + hardcode_libdir_flag_spec= + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + bsdi[45]*) + ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=no + if test "$GCC" = yes ; then + : + else + case $cc_basename in + xlc*) + ;; + *) + ld_shlibs=no + ;; + esac + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd1*) + ld_shlibs=no + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd* | dragonfly*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + hpux11*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + ;; + *) + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + ;; + sysv5* | sco3.2v5* | sco5v6*) + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 +libname_spec='lib$name' +case "$host_os" in + aix3*) + library_names_spec='$libname.a' + ;; + aix4* | aix5*) + library_names_spec='$libname$shrext' + ;; + amigaos*) + library_names_spec='$libname.a' + ;; + beos*) + library_names_spec='$libname$shrext' + ;; + bsdi[45]*) + library_names_spec='$libname$shrext' + ;; + cygwin* | mingw* | pw32*) + shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' + ;; + darwin* | rhapsody*) + shrext=.dylib + library_names_spec='$libname$shrext' + ;; + dgux*) + library_names_spec='$libname$shrext' + ;; + freebsd1*) + ;; + freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac + ;; + gnu*) + library_names_spec='$libname$shrext' + ;; + hpux9* | hpux10* | hpux11*) + case $host_cpu in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + library_names_spec='$libname$shrext' + ;; + interix[3-9]*) + library_names_spec='$libname$shrext' + ;; + irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux* | k*bsd*-gnu) + library_names_spec='$libname$shrext' + ;; + knetbsd*-gnu) + library_names_spec='$libname$shrext' + ;; + netbsd*) + library_names_spec='$libname$shrext' + ;; + newsos6) + library_names_spec='$libname$shrext' + ;; + nto-qnx*) + library_names_spec='$libname$shrext' + ;; + openbsd*) + library_names_spec='$libname$shrext$versuffix' + ;; + os2*) + libname_spec='$name' + shrext=.dll + library_names_spec='$libname.a' + ;; + osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) + ;; + solaris*) + library_names_spec='$libname$shrext' + ;; + sunos4*) + library_names_spec='$libname$shrext$versuffix' + ;; + sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' + ;; + sysv4*MP*) + library_names_spec='$libname$shrext' + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + uts4*) + library_names_spec='$libname$shrext' + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' < 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 84dfad8c4..c4e3922cf 100644 --- a/disk/dmraid_nvidia.c +++ b/disk/dmraid_nvidia.c @@ -1,7 +1,7 @@ /* dmraid_nvidia.c - module to handle Nvidia fakeraid. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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->number = 0; diff --git a/disk/fs_file.c b/disk/fs_file.c deleted file mode 100644 index e09568250..000000000 --- a/disk/fs_file.c +++ /dev/null @@ -1,136 +0,0 @@ -/* fs_file.c - Access partition by a file it contains. */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2009 Free Software Foundation, Inc. - * - * GRUB is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GRUB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GRUB. If not, see . - */ - -#include -#include -#include -#include -#include -#include - -static grub_device_t -search_fs_file (const char *key, unsigned long *count) -{ - char *filename = NULL; - grub_device_t ret = NULL; - *count = 0; - - auto int iterate_device (const char *name); - int iterate_device (const char *name) - { - int len; - grub_file_t file; - - (*count)++; - - len = grub_strlen (name) + 2 + grub_strlen (key) + 1; - filename = grub_realloc (filename, len); - if (! filename) - return 1; - - grub_sprintf (filename, "(%s)%s", name, key); - file = grub_file_open (filename); - if (file) - { - grub_file_close (file); - ret = grub_device_open (name); - return 1; - } - - grub_errno = GRUB_ERR_NONE; - return 0; - } - - grub_device_iterate (iterate_device); - grub_free (filename); - - return ret; -} - -static grub_err_t -grub_fs_file_open (const char *name, grub_disk_t disk) -{ - grub_device_t dev; - - if (grub_strncmp (name, "FILE=", sizeof ("FILE=") - 1)) - return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a FILE virtual volume"); - - dev = search_fs_file (name + sizeof ("FILE=") - 1, &disk->id); - if (! dev) - return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching file found"); - - disk->total_sectors = dev->disk->total_sectors; - disk->has_partitions = 0; - if (dev->disk->partition) - { - disk->partition = grub_malloc (sizeof (*disk->partition)); - if (disk->partition) - grub_memcpy (disk->partition, dev->disk->partition, - sizeof (*disk->partition)); - } - else - disk->partition = NULL; - - disk->data = dev; - - return GRUB_ERR_NONE; -} - -static void -grub_fs_file_close (grub_disk_t disk) -{ - grub_device_t parent = disk->data; - grub_device_close (parent); -} - -static grub_err_t -grub_fs_file_read (grub_disk_t disk, grub_disk_addr_t sector, - grub_size_t size, char *buf) -{ - grub_device_t parent = disk->data; - return parent->disk->dev->read (parent->disk, sector, size, buf); -} - -static grub_err_t -grub_fs_file_write (grub_disk_t disk, grub_disk_addr_t sector, - grub_size_t size, const char *buf) -{ - grub_device_t parent = disk->data; - return parent->disk->dev->write (parent->disk, sector, size, buf); -} - -static struct grub_disk_dev grub_fs_file_dev = { - .name = "fs_file", - .id = GRUB_DISK_DEVICE_FILE_ID, - .open = grub_fs_file_open, - .close = grub_fs_file_close, - .read = grub_fs_file_read, - .write = grub_fs_file_write, - .next = 0 -}; - -GRUB_MOD_INIT (fs_file) -{ - grub_disk_dev_register (&grub_fs_file_dev); -} - -GRUB_MOD_FINI (fs_file) -{ - grub_disk_dev_unregister (&grub_fs_file_dev); -} diff --git a/disk/fs_uuid.c b/disk/fs_uuid.c deleted file mode 100644 index 6901dbacf..000000000 --- a/disk/fs_uuid.c +++ /dev/null @@ -1,149 +0,0 @@ -/* fs_uuid.c - Access disks by their filesystem UUID. */ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007,2008 Free Software Foundation, Inc. - * - * GRUB is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GRUB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GRUB. If not, see . - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -static grub_device_t -search_fs_uuid (const char *key, unsigned long *count) -{ - *count = 0; - grub_device_t ret = NULL; - - auto int iterate_device (const char *name); - int iterate_device (const char *name) - { - grub_device_t dev; - - dev = grub_device_open (name); - if (dev) - { - grub_fs_t fs; - - fs = grub_fs_probe (dev); - if (fs && fs->uuid) - { - char *uuid; - - (fs->uuid) (dev, &uuid); - if (grub_errno == GRUB_ERR_NONE && uuid) - { - (*count)++; - - if (grub_strcasecmp (uuid, key) == 0) - { - ret = dev; - grub_free (uuid); - return 1; - } - grub_free (uuid); - } - } - - grub_device_close (dev); - } - - grub_errno = GRUB_ERR_NONE; - return 0; - } - - grub_device_iterate (iterate_device); - - return ret; -} - -static grub_err_t -grub_fs_uuid_open (const char *name, grub_disk_t disk) -{ - grub_device_t dev; - - if (grub_strncmp (name, "UUID=", sizeof ("UUID=")-1)) - return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a UUID virtual volume"); - - dev = search_fs_uuid (name + sizeof ("UUID=") - 1, &disk->id); - if (! dev) - return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching UUID found"); - - disk->total_sectors = dev->disk->total_sectors; - disk->has_partitions = 0; - if (dev->disk->partition) - { - disk->partition = grub_malloc (sizeof (*disk->partition)); - if (disk->partition) - grub_memcpy (disk->partition, dev->disk->partition, - sizeof (*disk->partition)); - } - else - disk->partition = NULL; - - disk->data = dev; - - return GRUB_ERR_NONE; -} - -static void -grub_fs_uuid_close (grub_disk_t disk __attribute((unused))) -{ - grub_device_t parent = disk->data; - grub_device_close (parent); -} - -static grub_err_t -grub_fs_uuid_read (grub_disk_t disk, grub_disk_addr_t sector, - grub_size_t size, char *buf) -{ - grub_device_t parent = disk->data; - return parent->disk->dev->read (parent->disk, sector, size, buf); -} - -static grub_err_t -grub_fs_uuid_write (grub_disk_t disk, grub_disk_addr_t sector, - grub_size_t size, const char *buf) -{ - grub_device_t parent = disk->data; - return parent->disk->dev->write (parent->disk, sector, size, buf); -} - -static struct grub_disk_dev grub_fs_uuid_dev = - { - .name = "fs_uuid", - .id = GRUB_DISK_DEVICE_UUID_ID, - .open = grub_fs_uuid_open, - .close = grub_fs_uuid_close, - .read = grub_fs_uuid_read, - .write = grub_fs_uuid_write, - .next = 0 - }; - -GRUB_MOD_INIT(fs_uuid) -{ - grub_disk_dev_register (&grub_fs_uuid_dev); -} - -GRUB_MOD_FINI(fs_uuid) -{ - grub_disk_dev_unregister (&grub_fs_uuid_dev); -} diff --git a/disk/i386/pc/biosdisk.c b/disk/i386/pc/biosdisk.c index af184b1ba..5f04ecc1e 100644 --- a/disk/i386/pc/biosdisk.c +++ b/disk/i386/pc/biosdisk.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -222,7 +222,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk, if (cmd) return grub_error (GRUB_ERR_WRITE_ERROR, "can\'t write to cdrom"); - dap->blocks = (dap->blocks + 3) >> 2; + dap->blocks = ALIGN_UP (dap->blocks, 4) >> 2; dap->block >>= 2; for (i = 0; i < GRUB_BIOSDISK_CDROM_RETRY_COUNT; i++) diff --git a/disk/ieee1275/nand.c b/disk/ieee1275/nand.c index 37427f884..df2ee81f3 100644 --- a/disk/ieee1275/nand.c +++ b/disk/ieee1275/nand.c @@ -1,7 +1,7 @@ /* nand.c - NAND flash disk access. */ /* * 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 @@ -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..c8c4d1a4e 100644 --- a/disk/ieee1275/ofdisk.c +++ b/disk/ieee1275/ofdisk.c @@ -1,7 +1,7 @@ /* ofdisk.c - Open Firmware disk access. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2004,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2004,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 @@ -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..a8b7cf5d7 100644 --- a/disk/loopback.c +++ b/disk/loopback.c @@ -23,6 +23,7 @@ #include #include #include +#include struct grub_loopback { @@ -36,8 +37,8 @@ static struct grub_loopback *loopback_list; static const struct grub_arg_option options[] = { - {"delete", 'd', 0, "delete the loopback device entry", 0, 0}, - {"partitions", 'p', 0, "simulate a hard drive with partitions", 0, 0}, + {"delete", 'd', 0, N_("Delete the loopback device entry."), 0, 0}, + {"partitions", 'p', 0, N_("Simulate a hard drive with partitions."), 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -56,7 +57,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 +168,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) @@ -245,8 +246,8 @@ GRUB_MOD_INIT(loop) { cmd = grub_register_extcmd ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH, - "loopback [-d|-p] DEVICENAME FILE", - "Make a device of a file.", options); + N_("[-d|-p] DEVICENAME FILE."), + N_("Make a device of a file."), options); grub_disk_dev_register (&grub_loopback_dev); } diff --git a/disk/lvm.c b/disk/lvm.c index 126b49439..2c54ca3b3 100644 --- a/disk/lvm.c +++ b/disk/lvm.c @@ -1,7 +1,7 @@ /* lvm.c - module to read Logical Volumes. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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 29a21b4c7..306c66a8b 100644 --- a/disk/mdraid_linux.c +++ b/disk/mdraid_linux.c @@ -181,7 +181,7 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array) /* FIXME: Also support version 1.0. */ 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. */ @@ -193,7 +193,7 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array) 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->number = sb.md_minor; array->level = sb.level; diff --git a/disk/raid.c b/disk/raid.c index c720fb36c..5d2793a07 100644 --- a/disk/raid.c +++ b/disk/raid.c @@ -1,7 +1,7 @@ /* raid.c - module to read RAID arrays. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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..550968ceb 100644 --- a/disk/raid6_recover.c +++ b/disk/raid6_recover.c @@ -1,7 +1,7 @@ /* raid6_recover.c - module to recover from faulty RAID6 arrays. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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..2a5e934f0 100644 --- a/disk/scsi.c +++ b/disk/scsi.c @@ -1,7 +1,7 @@ /* scsi.c - scsi support. */ /* * 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 @@ -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, §or_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 82e0d88e7..12f80847f 100644 --- a/font/font.c +++ b/font/font.c @@ -212,7 +212,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; } @@ -227,7 +227,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; } @@ -261,7 +261,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; @@ -304,7 +304,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; } @@ -370,7 +370,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], @@ -416,7 +416,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; } @@ -426,7 +426,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; } @@ -444,7 +444,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; } @@ -571,7 +571,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..3dc80752d 100644 --- a/fs/affs.c +++ b/fs/affs.c @@ -1,7 +1,7 @@ /* affs.c - Amiga Fast FileSystem. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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..17c37975d 100644 --- a/fs/cpio.c +++ b/fs/cpio.c @@ -1,7 +1,7 @@ /* cpio.c - cpio and tar filesystem. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2007,2008,2009 Free Software Foundation, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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/ext2.c b/fs/ext2.c index e7a20a43b..58be3e6fc 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -1,7 +1,7 @@ /* ext2.c - Second Extended filesystem */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2003,2004,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 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..f7dc2484f 100644 --- a/fs/hfs.c +++ b/fs/hfs.c @@ -1,7 +1,7 @@ /* hfs.c - HFS. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2004,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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 #include #include +#include #include #include @@ -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..1ab98be3f 100644 --- a/fs/iso9660.c +++ b/fs/iso9660.c @@ -2,7 +2,7 @@ SUSP, Rock Ridge. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2004,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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; } @@ -773,7 +773,10 @@ grub_iso9660_read (grub_file_t file, char *buf, grub_size_t len) data->first_sector << GRUB_ISO9660_LOG2_BLKSZ, file->offset, len, buf); - data->disk->read_hook = 0; + data->disk->read_hook = NULL; + + if (grub_errno) + return -1; return len; } @@ -832,7 +835,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..c1b4b2fe1 100644 --- a/fs/ntfs.c +++ b/fs/ntfs.c @@ -1,7 +1,7 @@ /* ntfs.c - NTFS filesystem */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2007,2008,2009 Free Software Foundation, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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..68f8b3a6e 100644 --- a/fs/sfs.c +++ b/fs/sfs.c @@ -1,7 +1,7 @@ /* sfs.c - Amiga Smart FileSystem. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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..cecb6eb78 100644 --- a/fs/udf.c +++ b/fs/udf.c @@ -1,7 +1,7 @@ /* udf.c - Universal Disk Format 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 @@ -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..9f3743d8b 100644 --- a/fs/ufs.c +++ b/fs/ufs.c @@ -1,7 +1,7 @@ /* ufs.c - Unix File System */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2004,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2004,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 @@ -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..8b512de37 100644 --- a/fs/xfs.c +++ b/fs/xfs.c @@ -1,7 +1,7 @@ /* xfs.c - XFS. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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/gencmdlist.sh b/gencmdlist.sh index 7f2549099..ed5965f07 100644 --- a/gencmdlist.sh +++ b/gencmdlist.sh @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 2005 Free Software Foundation, Inc. +# Copyright (C) 2005,2009 Free Software Foundation, Inc. # # This gensymlist.sh is free software; the author # gives unlimited permission to copy and/or distribute it, diff --git a/genmk.rb b/genmk.rb index 6cb7b5a89..810a2f1be 100644 --- a/genmk.rb +++ b/genmk.rb @@ -1,6 +1,6 @@ #! /usr/bin/ruby -w # -# Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc. +# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. # # This genmk.rb is free software; the author # gives unlimited permission to copy and/or distribute it, 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/gnulib/getdelim.c b/gnulib/getdelim.c new file mode 100644 index 000000000..12f2167c9 --- /dev/null +++ b/gnulib/getdelim.c @@ -0,0 +1,133 @@ +/* getdelim.c --- Implementation of replacement getdelim function. + Copyright (C) 1994, 1996, 1997, 1998, 2001, 2003, 2005, 2006, 2007, + 2008, 2009 Free Software Foundation, Inc. + + This program 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 2, or (at + your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + +/* Ported from glibc by Simon Josefsson. */ + +#include + +#include + +#include +#include +#include +#include + +#ifndef SSIZE_MAX +# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) +#endif + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +# define getc_maybe_unlocked(fp) getc(fp) +#elif !HAVE_FLOCKFILE || !HAVE_FUNLOCKFILE || !HAVE_DECL_GETC_UNLOCKED +# undef flockfile +# undef funlockfile +# define flockfile(x) ((void) 0) +# define funlockfile(x) ((void) 0) +# define getc_maybe_unlocked(fp) getc(fp) +#else +# define getc_maybe_unlocked(fp) getc_unlocked(fp) +#endif + +/* Read up to (and including) a DELIMITER from FP into *LINEPTR (and + NUL-terminate it). *LINEPTR is a pointer returned from malloc (or + NULL), pointing to *N characters of space. It is realloc'ed as + necessary. Returns the number of characters read (not including + the null terminator), or -1 on error or EOF. */ + +ssize_t +getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp) +{ + ssize_t result; + size_t cur_len = 0; + + if (lineptr == NULL || n == NULL || fp == NULL) + { + errno = EINVAL; + return -1; + } + + flockfile (fp); + + if (*lineptr == NULL || *n == 0) + { + char *new_lineptr; + *n = 120; + new_lineptr = (char *) realloc (*lineptr, *n); + if (new_lineptr == NULL) + { + result = -1; + goto unlock_return; + } + *lineptr = new_lineptr; + } + + for (;;) + { + int i; + + i = getc_maybe_unlocked (fp); + if (i == EOF) + { + result = -1; + break; + } + + /* Make enough space for len+1 (for final NUL) bytes. */ + if (cur_len + 1 >= *n) + { + size_t needed_max = + SSIZE_MAX < SIZE_MAX ? (size_t) SSIZE_MAX + 1 : SIZE_MAX; + size_t needed = 2 * *n + 1; /* Be generous. */ + char *new_lineptr; + + if (needed_max < needed) + needed = needed_max; + if (cur_len + 1 >= needed) + { + result = -1; + errno = EOVERFLOW; + goto unlock_return; + } + + new_lineptr = (char *) realloc (*lineptr, needed); + if (new_lineptr == NULL) + { + result = -1; + goto unlock_return; + } + + *lineptr = new_lineptr; + *n = needed; + } + + (*lineptr)[cur_len] = i; + cur_len++; + + if (i == delimiter) + break; + } + (*lineptr)[cur_len] = '\0'; + result = cur_len ? cur_len : result; + + unlock_return: + funlockfile (fp); /* doesn't set errno */ + + return result; +} diff --git a/gnulib/getline.c b/gnulib/getline.c new file mode 100644 index 000000000..eb8f055a8 --- /dev/null +++ b/gnulib/getline.c @@ -0,0 +1,30 @@ +/* getline.c --- Implementation of replacement getline function. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. + + This program 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 2, or (at + your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + +/* Written by Simon Josefsson. */ + +#include + +#include +#include + +ssize_t +getline (char **lineptr, size_t *n, FILE *stream) +{ + return getdelim (lineptr, n, '\n', stream); +} diff --git a/hello/hello.c b/hello/hello.c index be60761ec..eff07d941 100644 --- a/hello/hello.c +++ b/hello/hello.c @@ -24,6 +24,7 @@ #include #include #include +#include static grub_err_t grub_cmd_hello (struct grub_extcmd *cmd __attribute__ ((unused)), @@ -39,7 +40,7 @@ static grub_extcmd_t cmd; GRUB_MOD_INIT(hello) { cmd = grub_register_extcmd ("hello", grub_cmd_hello, GRUB_COMMAND_FLAG_BOTH, - "hello", "Say hello", 0); + 0, N_("Say \"Hello World\"."), 0); } GRUB_MOD_FINI(hello) diff --git a/include/grub/disk.h b/include/grub/disk.h index cc801bc67..e60b1f3de 100644 --- a/include/grub/disk.h +++ b/include/grub/disk.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index 32904150e..36363ae1e 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -1,7 +1,7 @@ /* efi.h - declare EFI types and functions */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -584,6 +584,16 @@ struct grub_efi_protocol_device_path }; typedef struct grub_efi_protocol_device_path grub_efi_protocol_device_path_t; +#define GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE 6 + +struct grub_efi_piwg_device_path +{ + grub_efi_device_path_t header; + grub_efi_guid_t guid __attribute__ ((packed)); +}; +typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t; + + /* BIOS Boot Specification Device Path. */ #define GRUB_EFI_BIOS_DEVICE_PATH_TYPE 5 diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h index b12205ad3..5852a476f 100644 --- a/include/grub/efi/efi.h +++ b/include/grub/efi/efi.h @@ -1,7 +1,7 @@ /* efi.h - declare variables and functions for EFI support */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h index 4fb8d098c..21b56ae27 100644 --- a/include/grub/efi/pe32.h +++ b/include/grub/efi/pe32.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 diff --git a/include/grub/elf.h b/include/grub/elf.h index 1a1ec1310..e54989cde 100644 --- a/include/grub/elf.h +++ b/include/grub/elf.h @@ -1,5 +1,5 @@ /* This file defines standard ELF types, structures, and macros. - Copyright (C) 1995-1999, 2000, 2001, 2002,2008 Free Software Foundation, Inc. + Copyright (C) 1995-1999,2000,2001,2002,2008,2009 Free Software Foundation, Inc. This file was part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/include/grub/fs.h b/include/grub/fs.h index 132ab4755..45f515768 100644 --- a/include/grub/fs.h +++ b/include/grub/fs.h @@ -1,7 +1,7 @@ /* fs.h - filesystem manager */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2004,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2002,2003,2004,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 diff --git a/include/grub/handler.h b/include/grub/handler.h index 3331bb417..77dd7d9c1 100644 --- a/include/grub/handler.h +++ b/include/grub/handler.h @@ -55,6 +55,6 @@ grub_err_t EXPORT_FUNC(grub_handler_set_current) (grub_handler_class_t class, GRUB_FIELD_MATCH (ptr, grub_handler_t, name) && \ GRUB_FIELD_MATCH (ptr, grub_handler_t, init) && \ GRUB_FIELD_MATCH (ptr, grub_handler_t, fini)) ? \ - (grub_handler_t) ptr : grub_assert_fail ()) + (grub_handler_t) ptr : grub_bad_type_cast ()) #endif /* ! GRUB_HANDLER_HEADER */ diff --git a/include/grub/i18n.h b/include/grub/i18n.h index f6f468744..4d4a0b7bd 100644 --- a/include/grub/i18n.h +++ b/include/grub/i18n.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2009 Free Software Foundation, Inc. + * Copyright (C) 2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,17 +19,42 @@ #ifndef GRUB_I18N_H #define GRUB_I18N_H 1 -#ifdef GRUB_UTIL -# include -# include -# define _(str) gettext(str) -#else -# define _(str) grub_gettext(str) +#include +#include const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s); extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s); -#endif +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +# ifdef GRUB_UTIL + +# include +# include + +# endif /* GRUB_UTIL */ + +#else /* ! ENABLE_NLS */ + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# ifdef GRUB_UTIL +# define gettext(Msgid) ((const char *) (Msgid)) +# else +# define grub_gettext(str) ((const char *) (str)) +# endif /* GRUB_UTIL */ + +#endif /* ENABLE_NLS */ + +#ifdef GRUB_UTIL +# define _(str) gettext(str) +#else +# define _(str) grub_gettext(str) +#endif /* GRUB_UTIL */ #define N_(str) str diff --git a/include/grub/i386/at_keyboard.h b/include/grub/i386/at_keyboard.h index 12d61608e..e6ee60d28 100644 --- a/include/grub/i386/at_keyboard.h +++ b/include/grub/i386/at_keyboard.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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/boot.h b/include/grub/i386/pc/boot.h index f45fe6da0..508b10742 100644 --- a/include/grub/i386/pc/boot.h +++ b/include/grub/i386/pc/boot.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2002,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2002,2005,2006,2007,2008,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -66,4 +66,16 @@ /* The size of a block list used in the kernel startup code. */ #define GRUB_BOOT_MACHINE_LIST_SIZE 12 +#ifndef ASM_FILE + +/* This is the blocklist used in the diskboot image. */ +struct grub_boot_blocklist +{ + grub_uint64_t start; + grub_uint16_t len; + grub_uint16_t segment; +} __attribute__ ((packed)); + +#endif /* ! ASM_FILE */ + #endif /* ! BOOT_MACHINE_HEADER */ diff --git a/include/grub/i386/pc/memory.h b/include/grub/i386/pc/memory.h index e14cc3e96..841b06164 100644 --- a/include/grub/i386/pc/memory.h +++ b/include/grub/i386/pc/memory.h @@ -1,7 +1,7 @@ /* memory.h - describe the memory map */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2002,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 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/i386/pc/vbe.h b/include/grub/i386/pc/vbe.h index 32427679b..9c4c4dd3d 100644 --- a/include/grub/i386/pc/vbe.h +++ b/include/grub/i386/pc/vbe.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 diff --git a/include/grub/i386/pci.h b/include/grub/i386/pci.h index 5b5f5f0df..31217d5f5 100644 --- a/include/grub/i386/pci.h +++ b/include/grub/i386/pci.h @@ -1,6 +1,6 @@ /* * 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 diff --git a/include/grub/i386/tsc.h b/include/grub/i386/tsc.h index 46041c2b2..dad9d062d 100644 --- a/include/grub/i386/tsc.h +++ b/include/grub/i386/tsc.h @@ -1,6 +1,6 @@ /* * 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 diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h index 0e6aae548..8b31e32e2 100644 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@ -1,7 +1,7 @@ /* ieee1275.h - Access the Open Firmware client interface. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2003,2004,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 diff --git a/include/grub/list.h b/include/grub/list.h index 2dffdc08d..b7703e214 100644 --- a/include/grub/list.h +++ b/include/grub/list.h @@ -22,6 +22,7 @@ #include #include +#include struct grub_list { @@ -39,31 +40,30 @@ int EXPORT_FUNC(grub_list_iterate) (grub_list_t head, grub_list_hook_t hook); void EXPORT_FUNC(grub_list_insert) (grub_list_t *head, grub_list_t item, grub_list_test_t test); -/* This function doesn't exist, so if assertion is false for some reason, the - linker would fail. */ -#ifdef APPLE_CC -/* This approach fails with Apple's gcc. Use grub_abort. */ -#include static inline void * -grub_assert_fail (void) +grub_bad_type_cast_real (int line, const char *file) + ATTRIBUTE_ERROR ("bad type cast between incompatible grub types"); + +static inline void * +grub_bad_type_cast_real (int line, const char *file) { - grub_abort (); - return 0; + grub_fatal ("error:%s:%u: bad type cast between incompatible grub types", + file, line); + return 0; } -#else -extern void* grub_assert_fail (void); -#endif + +#define grub_bad_type_cast() grub_bad_type_cast_real(__LINE__, __FILE__) #define GRUB_FIELD_MATCH(ptr, type, field) \ ((char *) &(ptr)->field == (char *) &((type) (ptr))->field) #define GRUB_AS_LIST(ptr) \ (GRUB_FIELD_MATCH (ptr, grub_list_t, next) ? \ - (grub_list_t) ptr : grub_assert_fail ()) + (grub_list_t) ptr : grub_bad_type_cast ()) #define GRUB_AS_LIST_P(pptr) \ (GRUB_FIELD_MATCH (*pptr, grub_list_t, next) ? \ - (grub_list_t *) (void *) pptr : grub_assert_fail ()) + (grub_list_t *) (void *) pptr : grub_bad_type_cast ()) struct grub_named_list { @@ -78,12 +78,12 @@ void * EXPORT_FUNC(grub_named_list_find) (grub_named_list_t head, #define GRUB_AS_NAMED_LIST(ptr) \ ((GRUB_FIELD_MATCH (ptr, grub_named_list_t, next) && \ GRUB_FIELD_MATCH (ptr, grub_named_list_t, name))? \ - (grub_named_list_t) ptr : grub_assert_fail ()) + (grub_named_list_t) ptr : grub_bad_type_cast ()) #define GRUB_AS_NAMED_LIST_P(pptr) \ ((GRUB_FIELD_MATCH (*pptr, grub_named_list_t, next) && \ GRUB_FIELD_MATCH (*pptr, grub_named_list_t, name))? \ - (grub_named_list_t *) (void *) pptr : grub_assert_fail ()) + (grub_named_list_t *) (void *) pptr : grub_bad_type_cast ()) #define GRUB_PRIO_LIST_PRIO_MASK 0xff #define GRUB_PRIO_LIST_FLAG_ACTIVE 0x100 @@ -111,12 +111,12 @@ grub_prio_list_remove (grub_prio_list_t *head, grub_prio_list_t item) ((GRUB_FIELD_MATCH (ptr, grub_prio_list_t, next) && \ GRUB_FIELD_MATCH (ptr, grub_prio_list_t, name) && \ GRUB_FIELD_MATCH (ptr, grub_prio_list_t, prio))? \ - (grub_prio_list_t) ptr : grub_assert_fail ()) + (grub_prio_list_t) ptr : grub_bad_type_cast ()) #define GRUB_AS_PRIO_LIST_P(pptr) \ ((GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, next) && \ GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, name) && \ GRUB_FIELD_MATCH (*pptr, grub_prio_list_t, prio))? \ - (grub_prio_list_t *) (void *) pptr : grub_assert_fail ()) + (grub_prio_list_t *) (void *) pptr : grub_bad_type_cast ()) #endif /* ! GRUB_LIST_HEADER */ diff --git a/include/grub/misc.h b/include/grub/misc.h index 4accd061f..5eeb13cc1 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -1,7 +1,7 @@ /* misc.h - prototypes for misc functions */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,22 @@ #include #include +/* GCC version checking borrowed from glibc. */ +#if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define GNUC_PREREQ(maj,min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#else +# define GNUC_PREREQ(maj,min) 0 +#endif + +/* Does this compiler support compile-time error attributes? */ +#if GNUC_PREREQ(4,3) +# define ATTRIBUTE_ERROR(msg) \ + __attribute__ ((__error__ (msg))) +#else +# define ATTRIBUTE_ERROR(msg) +#endif + #define ALIGN_UP(addr, align) \ ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1)) #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0])) diff --git a/include/grub/ntfs.h b/include/grub/ntfs.h index 6f9d4ad6e..31b99398b 100644 --- a/include/grub/ntfs.h +++ b/include/grub/ntfs.h @@ -1,7 +1,7 @@ /* ntfs.h - header for the NTFS filesystem */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007 Free Software Foundation, Inc. + * Copyright (C) 2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/grub/search.h b/include/grub/search.h new file mode 100644 index 000000000..e8f9db285 --- /dev/null +++ b/include/grub/search.h @@ -0,0 +1,26 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#ifndef GRUB_SEARCH_HEADER +#define GRUB_SEARCH_HEADER 1 + +void grub_search_fs_file (const char *key, const char *var, int no_floppy); +void grub_search_fs_uuid (const char *key, const char *var, int no_floppy); +void grub_search_label (const char *key, const char *var, int no_floppy); + +#endif diff --git a/include/grub/sparc64/ieee1275/ieee1275.h b/include/grub/sparc64/ieee1275/ieee1275.h index 7626e93c1..b25e98a6d 100644 --- a/include/grub/sparc64/ieee1275/ieee1275.h +++ b/include/grub/sparc64/ieee1275/ieee1275.h @@ -1,7 +1,7 @@ /* ieee1275.h - Access the Open Firmware client interface. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2004,2005,2007 Free Software Foundation, Inc. + * Copyright (C) 2003,2004,2005,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/grub/sparc64/libgcc.h b/include/grub/sparc64/libgcc.h index 008821d81..e73abe29c 100644 --- a/include/grub/sparc64/libgcc.h +++ b/include/grub/sparc64/libgcc.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2004,2007 Free Software Foundation, Inc. + * Copyright (C) 2004,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/grub/symbol.h b/include/grub/symbol.h index 6bf512d12..63ed19436 100644 --- a/include/grub/symbol.h +++ b/include/grub/symbol.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,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 diff --git a/include/grub/term.h b/include/grub/term.h index 922ccb2d2..1c57a4ede 100644 --- a/include/grub/term.h +++ b/include/grub/term.h @@ -405,6 +405,14 @@ struct grub_term_autoload extern struct grub_term_autoload *grub_term_input_autoload; extern struct grub_term_autoload *grub_term_output_autoload; +static inline void +grub_print_spaces (struct grub_term_output *term, int number_spaces) +{ + while (--number_spaces >= 0) + grub_putcode (' ', term); +} + + /* For convenience. */ #define GRUB_TERM_ASCII_CHAR(c) ((c) & 0xff) diff --git a/include/grub/types.h b/include/grub/types.h index 5f6b7ec62..93174b424 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2002,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 diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h index 09108547c..373fff8bb 100644 --- a/include/grub/util/misc.h +++ b/include/grub/util/misc.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,4 +88,6 @@ grub_int64_t grub_util_get_disk_size (char *name); char *make_system_path_relative_to_its_root (const char *path); +void grub_util_init_nls (void); + #endif /* ! GRUB_UTIL_MISC_HEADER */ 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 +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/include/multiboot2.h b/include/multiboot2.h index e55af8392..275aa5a9b 100644 --- a/include/multiboot2.h +++ b/include/multiboot2.h @@ -1,7 +1,7 @@ /* multiboot2.h - multiboot 2 header file. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007 Free Software Foundation, Inc. + * Copyright (C) 2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/io/gzio.c b/io/gzio.c index a38bfb372..39f6d7b13 100644 --- a/io/gzio.c +++ b/io/gzio.c @@ -1,7 +1,7 @@ /* gzio.c - decompression support for gzip */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2005,2006,2007 Free Software Foundation, Inc. + * Copyright (C) 1999,2005,2006,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by 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/device.c b/kern/device.c index 9f219949b..f519c63b2 100644 --- a/kern/device.c +++ b/kern/device.c @@ -1,7 +1,7 @@ /* device.c - device manager */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2002,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 diff --git a/kern/disk.c b/kern/disk.c index e463626fb..544896f2f 100644 --- a/kern/disk.c +++ b/kern/disk.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2004,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2002,2003,2004,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -386,8 +386,6 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector, char *tmp_buf; unsigned real_offset; - grub_dprintf ("disk", "Reading `%s'...\n", disk->name); - /* First of all, check if the region is within the disk. */ if (grub_disk_adjust_range (disk, §or, &offset, size) != GRUB_ERR_NONE) { @@ -432,8 +430,9 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector, else { /* Otherwise read data from the disk actually. */ - if ((disk->dev->read) (disk, start_sector, - GRUB_DISK_CACHE_SIZE, tmp_buf) + if (start_sector + GRUB_DISK_CACHE_SIZE > disk->total_sectors + || (disk->dev->read) (disk, start_sector, + GRUB_DISK_CACHE_SIZE, tmp_buf) != GRUB_ERR_NONE) { /* Uggh... Failed. Instead, just read necessary data. */ diff --git a/kern/efi/efi.c b/kern/efi/efi.c index 501ab4578..c6ce04c5e 100644 --- a/kern/efi/efi.c +++ b/kern/efi/efi.c @@ -1,7 +1,7 @@ /* efi.c - generic EFI support */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 diff --git a/kern/efi/mm.c b/kern/efi/mm.c index e1fca81f3..ceb8fc9ba 100644 --- a/kern/efi/mm.c +++ b/kern/efi/mm.c @@ -1,7 +1,7 @@ /* mm.c - generic EFI memory management */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 diff --git a/kern/elf.c b/kern/elf.c index 951049e73..7625f6acd 100644 --- a/kern/elf.c +++ b/kern/elf.c @@ -1,7 +1,7 @@ /* elf.c - load ELF files */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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/env.c b/kern/env.c index 969227dec..8f94e891e 100644 --- a/kern/env.c +++ b/kern/env.c @@ -264,10 +264,11 @@ grub_env_unset (const char *name) if (! var) return; - /* XXX: It is not possible to unset variables with a read or write - hook. */ if (var->read_hook || var->write_hook) - return; + { + grub_env_set (name, ""); + return; + } grub_env_remove (var); diff --git a/kern/file.c b/kern/file.c index f713acbca..e17c35f95 100644 --- a/kern/file.c +++ b/kern/file.c @@ -1,7 +1,7 @@ /* file.c - file I/O functions */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2006,2007 Free Software Foundation, Inc. + * Copyright (C) 2002,2006,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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/dl.c b/kern/i386/dl.c index 91121f614..57854964b 100644 --- a/kern/i386/dl.c +++ b/kern/i386/dl.c @@ -1,7 +1,7 @@ /* dl-386.c - arch-dependent part of loadable module support */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2005,2007 Free Software Foundation, Inc. + * Copyright (C) 2002,2005,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/kern/i386/pc/init.c b/kern/i386/pc/init.c index ebe4bb6ea..0f2374c6d 100644 --- a/kern/i386/pc/init.c +++ b/kern/i386/pc/init.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 diff --git a/kern/i386/pc/startup.S b/kern/i386/pc/startup.S index 4de14a3d1..23f3f398e 100644 --- a/kern/i386/pc/startup.S +++ b/kern/i386/pc/startup.S @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,2003,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 @@ -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/ieee1275.c b/kern/ieee1275/ieee1275.c index 37a98071c..8a5773c23 100644 --- a/kern/ieee1275/ieee1275.c +++ b/kern/ieee1275/ieee1275.c @@ -1,7 +1,7 @@ /* of.c - Access the Open Firmware client interface. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2003,2004,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 diff --git a/kern/ieee1275/init.c b/kern/ieee1275/init.c index 5d5d733d9..3e11d2369 100644 --- a/kern/ieee1275/init.c +++ b/kern/ieee1275/init.c @@ -1,7 +1,7 @@ /* init.c -- Initialize GRUB on the newworld mac (PPC). */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2003,2004,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 @@ -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/main.c b/kern/main.c index 040f89e6d..7250c73e0 100644 --- a/kern/main.c +++ b/kern/main.c @@ -1,7 +1,7 @@ /* main.c - the kernel main routine */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2005,2006,2008 Free Software Foundation, Inc. + * Copyright (C) 2002,2003,2005,2006,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 diff --git a/kern/misc.c b/kern/misc.c index da9c3650d..6b481dc7a 100644 --- a/kern/misc.c +++ b/kern/misc.c @@ -1,7 +1,7 @@ /* misc.c - definitions of misc functions */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -226,6 +226,11 @@ grub_memcmp (const void *s1, const void *s2, grub_size_t n) #ifndef APPLE_CC int memcmp (const void *s1, const void *s2, grub_size_t n) __attribute__ ((alias ("grub_memcmp"))); +#else +int memcmp (const void *s1, const void *s2, grub_size_t n) +{ + return grub_memcmp (s1, s2, n); +} #endif int @@ -511,6 +516,11 @@ grub_memset (void *s, int c, grub_size_t n) #ifndef APPLE_CC void *memset (void *s, int c, grub_size_t n) __attribute__ ((alias ("grub_memset"))); +#else +void *memset (void *s, int c, grub_size_t n) +{ + return grub_memset (s, c, n); +} #endif grub_size_t diff --git a/kern/mm.c b/kern/mm.c index cbcb99560..ef97b018e 100644 --- a/kern/mm.c +++ b/kern/mm.c @@ -1,7 +1,7 @@ /* mm.c - functions for memory manager */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2002,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 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..ad19e5600 100644 --- a/kern/powerpc/dl.c +++ b/kern/powerpc/dl.c @@ -1,7 +1,7 @@ /* dl.c - arch-dependent part of loadable module support */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2004,2005,2007 Free Software Foundation, Inc. + * Copyright (C) 2002,2004,2005,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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..7b6266cac 100644 --- a/kern/sparc64/dl.c +++ b/kern/sparc64/dl.c @@ -1,7 +1,7 @@ /* dl.c - arch-dependent part of loadable module support */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2004,2005,2007 Free Software Foundation, Inc. + * Copyright (C) 2002,2004,2005,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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/kern/x86_64/dl.c b/kern/x86_64/dl.c index 73a7337e7..090ad78b8 100644 --- a/kern/x86_64/dl.c +++ b/kern/x86_64/dl.c @@ -1,7 +1,7 @@ /* dl-x86_64.c - arch-dependent part of loadable module support */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2005,2007 Free Software Foundation, Inc. + * Copyright (C) 2002,2005,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by 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 #include #include +#include /* 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/lib/hexdump.c b/lib/hexdump.c index c69cb093b..800beb2ba 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c @@ -1,7 +1,7 @@ /* hexdump.c - hexdump function */ /* * 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 diff --git a/loader/efi/appleloader.c b/loader/efi/appleloader.c index 94d501bcf..114a0a506 100644 --- a/loader/efi/appleloader.c +++ b/loader/efi/appleloader.c @@ -1,7 +1,7 @@ /* appleloader.c - apple legacy boot loader. */ /* * 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 @@ -59,58 +59,171 @@ grub_appleloader_boot (void) return grub_errno; } -/* early 2006 Core Duo / Core Solo models */ -static grub_uint8_t devpath_1[] = +struct piwg_full_device_path { - 0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0xF9, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B, - 0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B, - 0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00, + struct grub_efi_memory_mapped_device_path comp1; + struct grub_efi_piwg_device_path comp2; + struct grub_efi_device_path end; +}; + +/* early 2006 Core Duo / Core Solo models */ +static struct piwg_full_device_path devpath_1 = +{ + .comp1 = + { + .header = { + .type = GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_memory_mapped_device_path), 0} + }, + .memory_type = GRUB_EFI_MEMORY_MAPPED_IO, + .start_address = 0xffe00000, + .end_address = 0xfff9ffff + }, + .comp2 = + { + .header = { + .type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_piwg_device_path), 0} + }, + .guid = {0x2B0585EB, 0xD8B8, 0x49A9, {0x8B, 0x8C, 0xE2, 0x1B, + 0x01, 0xAE, 0xF2, 0xB7}} + }, + .end = + { + .type = GRUB_EFI_END_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_device_path), 0} + } }; /* mid-2006 Mac Pro (and probably other Core 2 models) */ -static grub_uint8_t devpath_2[] = +static struct piwg_full_device_path devpath_2 = { - 0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0xF7, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B, - 0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B, - 0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00, + .comp1 = + { + .header = { + .type = GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_memory_mapped_device_path), 0} + }, + .memory_type = GRUB_EFI_MEMORY_MAPPED_IO, + .start_address = 0xffe00000, + .end_address = 0xfff7ffff + }, + .comp2 = + { + .header = { + .type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_piwg_device_path), 0} + }, + .guid = {0x2B0585EB, 0xD8B8, 0x49A9, {0x8B, 0x8C, 0xE2, 0x1B, + 0x01, 0xAE, 0xF2, 0xB7}} + }, + .end = + { + .type = GRUB_EFI_END_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_device_path), 0} + } }; /* mid-2007 MBP ("Santa Rosa" based models) */ -static grub_uint8_t devpath_3[] = +static struct piwg_full_device_path devpath_3 = { - 0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0xF8, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B, - 0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B, - 0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00, + .comp1 = + { + .header = { + .type = GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_memory_mapped_device_path), 0} + }, + .memory_type = GRUB_EFI_MEMORY_MAPPED_IO, + .start_address = 0xffe00000, + .end_address = 0xfff8ffff + }, + .comp2 = + { + .header = { + .type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_piwg_device_path), 0} + }, + .guid = {0x2B0585EB, 0xD8B8, 0x49A9, {0x8B, 0x8C, 0xE2, 0x1B, + 0x01, 0xAE, 0xF2, 0xB7}} + }, + .end = + { + .type = GRUB_EFI_END_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_device_path), 0} + } }; /* early-2008 MBA */ -static grub_uint8_t devpath_4[] = +static struct piwg_full_device_path devpath_4 = { - 0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xC0, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0xF8, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B, - 0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B, - 0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00, + .comp1 = + { + .header = { + .type = GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_memory_mapped_device_path), 0} + }, + .memory_type = GRUB_EFI_MEMORY_MAPPED_IO, + .start_address = 0xffc00000, + .end_address = 0xfff8ffff + }, + .comp2 = + { + .header = { + .type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_piwg_device_path), 0} + }, + .guid = {0x2B0585EB, 0xD8B8, 0x49A9, {0x8B, 0x8C, 0xE2, 0x1B, + 0x01, 0xAE, 0xF2, 0xB7}} + }, + .end = + { + .type = GRUB_EFI_END_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_device_path), 0} + } }; /* late-2008 MB/MBP (NVidia chipset) */ -static grub_uint8_t devpath_5[] = { - 0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00, - 0x00, 0x40, 0xCB, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xBF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B, - 0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B, - 0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00, +static struct piwg_full_device_path devpath_5 = +{ + .comp1 = + { + .header = { + .type = GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_memory_mapped_device_path), 0} + }, + .memory_type = GRUB_EFI_MEMORY_MAPPED_IO, + .start_address = 0xffcb4000, + .end_address = 0xffffbfff + }, + .comp2 = + { + .header = { + .type = GRUB_EFI_MEDIA_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_piwg_device_path), 0} + }, + .guid = {0x2B0585EB, 0xD8B8, 0x49A9, {0x8B, 0x8C, 0xE2, 0x1B, + 0x01, 0xAE, 0xF2, 0xB7}} + }, + .end = + { + .type = GRUB_EFI_END_DEVICE_PATH_TYPE, + .subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE, + .length = {sizeof (struct grub_efi_device_path), 0} + } }; struct devdata @@ -121,11 +234,11 @@ struct devdata struct devdata devs[] = { - {"Core Duo/Solo", (grub_efi_device_path_t *) devpath_1}, - {"Mac Pro", (grub_efi_device_path_t *) devpath_2}, - {"MBP", (grub_efi_device_path_t *) devpath_3}, - {"MBA", (grub_efi_device_path_t *) devpath_4}, - {"MB NV", (grub_efi_device_path_t *) devpath_5}, + {"Core Duo/Solo", (grub_efi_device_path_t *) &devpath_1}, + {"Mac Pro", (grub_efi_device_path_t *) &devpath_2}, + {"MBP", (grub_efi_device_path_t *) &devpath_3}, + {"MBA", (grub_efi_device_path_t *) &devpath_4}, + {"MB NV", (grub_efi_device_path_t *) &devpath_5}, {NULL, NULL}, }; @@ -208,7 +321,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..d0f0c464b 100644 --- a/loader/i386/bsd.c +++ b/loader/i386/bsd.c @@ -34,6 +34,7 @@ #include #include #include +#include #ifdef GRUB_MACHINE_PCBIOS #include @@ -61,20 +62,20 @@ static grub_uint32_t openbsd_root; static const struct grub_arg_option freebsd_opts[] = { - {"dual", 'D', 0, "Display output on all consoles.", 0, 0}, - {"serial", 'h', 0, "Use serial console.", 0, 0}, - {"askname", 'a', 0, "Ask for file name to reboot from.", 0, 0}, - {"cdrom", 'C', 0, "Use cdrom as root.", 0, 0}, - {"config", 'c', 0, "Invoke user configuration routing.", 0, 0}, - {"kdb", 'd', 0, "Enter in KDB on boot.", 0, 0}, - {"gdb", 'g', 0, "Use GDB remote debugger instead of DDB.", 0, 0}, - {"mute", 'm', 0, "Disable all boot output.", 0, 0}, + {"dual", 'D', 0, N_("Display output on all consoles."), 0, 0}, + {"serial", 'h', 0, N_("Use serial console."), 0, 0}, + {"askname", 'a', 0, N_("Ask for file name to reboot from."), 0, 0}, + {"cdrom", 'C', 0, N_("Use CDROM as root."), 0, 0}, + {"config", 'c', 0, N_("Invoke user configuration routing."), 0, 0}, + {"kdb", 'd', 0, N_("Enter in KDB on boot."), 0, 0}, + {"gdb", 'g', 0, N_("Use GDB remote debugger instead of DDB."), 0, 0}, + {"mute", 'm', 0, N_("Disable all boot output."), 0, 0}, {"nointr", 'n', 0, "", 0, 0}, - {"pause", 'p', 0, "Wait for keypress after every line of output.", 0, 0}, + {"pause", 'p', 0, N_("Wait for keypress after every line of output."), 0, 0}, {"quiet", 'q', 0, "", 0, 0}, - {"dfltroot", 'r', 0, "Use compiled-in rootdev.", 0, 0}, - {"single", 's', 0, "Boot into single mode.", 0, 0}, - {"verbose", 'v', 0, "Boot with verbose messages.", 0, 0}, + {"dfltroot", 'r', 0, N_("Use compiled-in rootdev."), 0, 0}, + {"single", 's', 0, N_("Boot into single mode."), 0, 0}, + {"verbose", 'v', 0, N_("Boot with verbose messages."), 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -89,12 +90,12 @@ static const grub_uint32_t freebsd_flags[] = static const struct grub_arg_option openbsd_opts[] = { - {"askname", 'a', 0, "Ask for file name to reboot from.", 0, 0}, - {"halt", 'b', 0, "Don't reboot, just halt.", 0, 0}, - {"config", 'c', 0, "Change configured devices.", 0, 0}, - {"single", 's', 0, "Boot into single mode.", 0, 0}, - {"kdb", 'd', 0, "Enter in KDB on boot.", 0, 0}, - {"root", 'r', 0, "Set root device.", "wdXY", ARG_TYPE_STRING}, + {"askname", 'a', 0, N_("Ask for file name to reboot from."), 0, 0}, + {"halt", 'b', 0, N_("Don't reboot, just halt."), 0, 0}, + {"config", 'c', 0, N_("Change configured devices."), 0, 0}, + {"single", 's', 0, N_("Boot into single mode."), 0, 0}, + {"kdb", 'd', 0, N_("Enter in KDB on boot."), 0, 0}, + {"root", 'r', 0, N_("Set root device."), "wdXY", ARG_TYPE_STRING}, {0, 0, 0, 0, 0, 0} }; @@ -108,19 +109,19 @@ static const grub_uint32_t openbsd_flags[] = static const struct grub_arg_option netbsd_opts[] = { - {"no-smp", '1', 0, "Disable SMP.", 0, 0}, - {"no-acpi", '2', 0, "Disable ACPI.", 0, 0}, - {"askname", 'a', 0, "Ask for file name to reboot from.", 0, 0}, - {"halt", 'b', 0, "Don't reboot, just halt.", 0, 0}, - {"config", 'c', 0, "Change configured devices.", 0, 0}, - {"kdb", 'd', 0, "Enter in KDB on boot.", 0, 0}, + {"no-smp", '1', 0, N_("Disable SMP."), 0, 0}, + {"no-acpi", '2', 0, N_("Disable ACPI."), 0, 0}, + {"askname", 'a', 0, N_("Ask for file name to reboot from."), 0, 0}, + {"halt", 'b', 0, N_("Don't reboot, just halt."), 0, 0}, + {"config", 'c', 0, N_("Change configured devices."), 0, 0}, + {"kdb", 'd', 0, N_("Enter in KDB on boot."), 0, 0}, {"miniroot", 'm', 0, "", 0, 0}, - {"quiet", 'q', 0, "Don't display boot diagnostic messages.", 0, 0}, - {"single", 's', 0, "Boot into single mode.", 0, 0}, - {"verbose", 'v', 0, "Boot with verbose messages.", 0, 0}, - {"debug", 'x', 0, "Boot with debug messages.", 0, 0}, - {"silent", 'z', 0, "Supress normal output (warnings remain).", 0, 0}, - {"root", 'r', 0, "Set root device.", "DEVICE", ARG_TYPE_STRING}, + {"quiet", 'q', 0, N_("Don't display boot diagnostic messages."), 0, 0}, + {"single", 's', 0, N_("Boot into single mode."), 0, 0}, + {"verbose", 'v', 0, N_("Boot with verbose messages."), 0, 0}, + {"debug", 'x', 0, N_("Boot with debug messages."), 0, 0}, + {"silent", 'z', 0, N_("Supress normal output (warnings remain)."), 0, 0}, + {"root", 'r', 0, N_("Set root device."), N_("DEVICE"), ARG_TYPE_STRING}, {0, 0, 0, 0, 0, 0} }; @@ -679,7 +680,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 +751,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 +772,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 +812,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 +843,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 +872,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 +888,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 +903,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 +1025,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 are supported."); + "only device specifications of form " + "wd 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 are supported."); + "only device specifications of form " + "wd are supported"); part = *arg - 'a'; @@ -1076,15 +1077,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 +1171,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 +1194,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 +1237,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 +1281,25 @@ GRUB_MOD_INIT (bsd) { cmd_freebsd = grub_register_extcmd ("kfreebsd", grub_cmd_freebsd, GRUB_COMMAND_FLAG_BOTH, - "kfreebsd FILE", "Load kernel of FreeBSD.", + N_("FILE"), N_("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.", + N_("FILE"), N_("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.", + N_("FILE"), N_("Load kernel of NetBSD."), netbsd_opts); cmd_freebsd_loadenv = grub_register_command ("kfreebsd_loadenv", grub_cmd_freebsd_loadenv, - 0, "load FreeBSD env"); + 0, N_("Load FreeBSD env.")); cmd_freebsd_module = grub_register_command ("kfreebsd_module", grub_cmd_freebsd_module, - 0, "load FreeBSD kernel module"); + 0, N_("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, N_("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 a869ca71a..c6acab641 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; } @@ -881,7 +881,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) { @@ -918,13 +918,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; } @@ -994,7 +994,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; } @@ -1017,9 +1017,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 33488d443..33076ea5b 100644 --- a/loader/i386/ieee1275/linux.c +++ b/loader/i386/ieee1275/linux.c @@ -1,7 +1,7 @@ /* linux.c - boot Linux zImage or bzImage */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,2003,2004,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 @@ -241,7 +241,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); @@ -272,13 +272,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; } @@ -290,7 +290,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; } @@ -306,9 +306,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 e6e337fdf..599711362 100644 --- a/loader/i386/linux.c +++ b/loader/i386/linux.c @@ -696,7 +696,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; } @@ -885,7 +885,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) { @@ -920,13 +920,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; } @@ -974,7 +974,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; } @@ -982,7 +982,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; } @@ -1005,9 +1005,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..a153d80a9 100644 --- a/loader/i386/pc/chainloader.c +++ b/loader/i386/pc/chainloader.c @@ -1,7 +1,7 @@ /* chainloader.c - boot another boot loader */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2004,2007 Free Software Foundation, Inc. + * Copyright (C) 2002,2004,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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..77b7966bf 100644 --- a/loader/i386/pc/linux.c +++ b/loader/i386/pc/linux.c @@ -1,7 +1,7 @@ /* linux.c - boot Linux zImage or bzImage */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,2003,2004,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 @@ -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..005c8a823 100644 --- a/loader/i386/pc/multiboot2.c +++ b/loader/i386/pc/multiboot2.c @@ -1,7 +1,7 @@ /* multiboot2.c - boot a multiboot 2 OS image. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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..846550ee5 100644 --- a/loader/ieee1275/multiboot2.c +++ b/loader/ieee1275/multiboot2.c @@ -1,7 +1,7 @@ /* multiboot.c - boot a multiboot 2 OS image. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007 Free Software Foundation, Inc. + * Copyright (C) 2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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..cfc7b400c 100644 --- a/loader/multiboot2.c +++ b/loader/multiboot2.c @@ -1,7 +1,7 @@ /* multiboot2.c - boot a multiboot 2 OS image. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007 Free Software Foundation, Inc. + * Copyright (C) 2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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..9e5cf1628 100644 --- a/loader/multiboot_loader.c +++ b/loader/multiboot_loader.c @@ -1,7 +1,7 @@ /* multiboot_loader.c - boot multiboot 1 or 2 OS image */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -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..085f5c026 100644 --- a/loader/powerpc/ieee1275/linux.c +++ b/loader/powerpc/ieee1275/linux.c @@ -1,7 +1,7 @@ /* linux.c - boot Linux */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc. + * Copyright (C) 2003,2004,2005,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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..6ffad202e 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 85a19033f..7f6c697cf 100644 --- a/loader/xnu.c +++ b/loader/xnu.c @@ -366,7 +366,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); @@ -464,7 +464,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); @@ -655,7 +655,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); @@ -720,7 +720,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); @@ -764,7 +764,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)) @@ -774,7 +774,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. */ @@ -787,7 +787,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, @@ -796,7 +796,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++) { @@ -849,7 +849,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); @@ -876,7 +876,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) @@ -892,7 +892,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); } @@ -918,7 +918,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; } @@ -928,14 +928,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); @@ -1425,23 +1425,23 @@ static grub_extcmd_t 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_extcmd ("xnu_splash", grub_cmd_xnu_splash, GRUB_COMMAND_FLAG_BOTH, 0, - "Load a splash image for XNU", + "Load a splash image for XNU.", xnu_splash_cmd_options); #ifndef GRUB_UTIL 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 de0463662..9aaf44056 100644 --- a/normal/cmdline.c +++ b/normal/cmdline.c @@ -351,7 +351,7 @@ grub_cmdline_get (const char *prompt) if (!buf) return 0; - plen = grub_strlen (prompt_translated); + plen = grub_strlen (prompt_translated) + sizeof (" ") - 1; lpos = llen = 0; buf[0] = '\0'; @@ -362,7 +362,7 @@ grub_cmdline_get (const char *prompt) if ((grub_term_getxy (term) >> 8) != 0) grub_putcode ('\n', term); } - grub_printf ("%s", prompt_translated); + grub_printf ("%s ", prompt_translated); { struct cmdline_term *cl_term_cur; diff --git a/normal/completion.c b/normal/completion.c index d264028cc..f9d8307e8 100644 --- a/normal/completion.c +++ b/normal/completion.c @@ -1,7 +1,7 @@ /* completion.c - complete a command, a disk, a partition or a file */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,2003,2004,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 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 #include #include +#include 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 6d7a558f3..cdb816bfc 100644 --- a/normal/main.c +++ b/normal/main.c @@ -554,12 +554,12 @@ static grub_err_t grub_normal_read_line_real (char **line, int cont, int nested) { grub_parser_t parser = grub_parser_get_current (); - char prompt[sizeof("> ") + grub_strlen (parser->name)]; + char prompt[sizeof(">") + grub_strlen (parser->name)]; if (cont) - grub_sprintf (prompt, "> "); + grub_sprintf (prompt, ">"); else - grub_sprintf (prompt, "%s> ", parser->name); + grub_sprintf (prompt, "%s>", parser->name); while (1) { @@ -640,9 +640,9 @@ GRUB_MOD_INIT(normal) /* Register a command "normal" for the rescue mode. */ grub_register_command ("normal", grub_cmd_normal, - 0, "Enter normal mode"); + 0, "Enter normal mode."); grub_register_command ("normal_exit", grub_cmd_normal_exit, - 0, "Exit from normal mode"); + 0, "Exit from normal mode."); /* Reload terminal colors when these variables are written to. */ grub_register_variable_hook ("color_normal", NULL, grub_env_write_color_normal); diff --git a/normal/menu_entry.c b/normal/menu_entry.c index 7236f78e1..644fe90fd 100644 --- a/normal/menu_entry.c +++ b/normal/menu_entry.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 diff --git a/normal/menu_text.c b/normal/menu_text.c index 91000c1d4..cab1d22f8 100644 --- a/normal/menu_text.c +++ b/normal/menu_text.c @@ -108,8 +108,8 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right, while (grub_getstringwidth (current_position, next_new_line,term) > 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--; } @@ -359,7 +359,7 @@ static void menu_text_print_timeout (int timeout, void *dataptr) { const char *msg = - _("The highlighted entry will be booted automatically in %ds."); + _("The highlighted entry will be executed automatically in %ds."); struct menu_viewer_data *data = dataptr; char *msg_translated; int posx; 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..7934c90fd 100644 --- a/partmap/apple.c +++ b/partmap/apple.c @@ -1,7 +1,7 @@ /* apple.c - Read macintosh partition tables. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2004,2005,2006,2007,2008 Free Software Foundation, Inc. + * Copyright (C) 2002,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 @@ -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..cecf8a049 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -1,5 +1,67 @@ # List of files which contain translatable strings. +commands/acpi.c +commands/blocklist.c +commands/boot.c +commands/cat.c +commands/cmp.c +commands/configfile.c +commands/crc.c +commands/date.c +commands/echo.c +commands/efi/fixvideo.c +commands/efi/loadbios.c +commands/gptsync.c +commands/halt.c +commands/handler.c +commands/hdparm.c +commands/help.c +commands/hexdump.c +commands/i386/cpuid.c +commands/i386/pc/drivemap.c +commands/i386/pc/halt.c +commands/i386/pc/play.c +commands/i386/pc/pxecmd.c +commands/i386/pc/vbeinfo.c +commands/i386/pc/vbetest.c +commands/ieee1275/suspend.c +commands/keystatus.c commands/loadenv.c +commands/ls.c +commands/lsmmap.c +commands/lspci.c +commands/memrw.c +commands/minicmd.c +commands/parttool.c +commands/password.c +commands/probe.c +commands/read.c +commands/reboot.c +commands/search.c +commands/search.c +commands/sleep.c +commands/test.c +commands/true.c +commands/usbtest.c +commands/videotest.c +commands/xnu_uuid.c + +disk/loopback.c + +hello/hello.c + +lib/arg.c + +loader/i386/bsd.c + +normal/auth.c +normal/color.c +normal/dyncmd.c +normal/main.c +normal/menu_entry.c +normal/menu_text.c +normal/misc.c + +term/i386/pc/serial.c util/i386/pc/grub-mkimage.c util/i386/pc/grub-setup.c @@ -12,10 +74,3 @@ util/mkisofs/multi.c util/mkisofs/rock.c util/mkisofs/tree.c util/mkisofs/write.c - -normal/auth.c -normal/color.c -normal/main.c -normal/menu_entry.c -normal/menu_text.c -normal/misc.c 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 fc94f9511..0abe0f07d 100644 --- a/term/gfxterm.c +++ b/term/gfxterm.c @@ -211,7 +211,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; @@ -1181,12 +1181,11 @@ GRUB_MOD_INIT(term_gfxterm) #else grub_term_register_output ("gfxterm", &grub_video_term); #endif - background_image_cmd_handle = grub_register_extcmd ("background_image", grub_gfxterm_background_image_cmd, GRUB_COMMAND_FLAG_BOTH, - "background_image [-m (stretch|normal)] FILE", + "[-m (stretch|normal)] FILE", "Load background image for active terminal.", background_image_cmd_options); } diff --git a/term/i386/pc/at_keyboard.c b/term/i386/pc/at_keyboard.c index fd9767736..594ed6787 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_until_ready (void) { while (! KEYBOARD_COMMAND_ISREADY (grub_inb (KEYBOARD_REG_STATUS))); +} + +static void +grub_keyboard_controller_write (grub_uint8_t c) +{ + keyboard_controller_wait_until_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_until_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_until_ready (); + grub_outb (0xed, KEYBOARD_REG_DATA); + keyboard_controller_wait_until_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 12612efcd..8d09f6211 100644 --- a/term/i386/pc/serial.c +++ b/term/i386/pc/serial.c @@ -26,6 +26,7 @@ #include #include #include +#include #define TEXT_WIDTH 80 #define TEXT_HEIGHT 25 @@ -42,12 +43,12 @@ static unsigned int npending = 0; /* Argument options. */ static const struct grub_arg_option options[] = { - {"unit", 'u', 0, "Set the serial unit", 0, ARG_TYPE_INT}, - {"port", 'p', 0, "Set the serial port address", 0, ARG_TYPE_STRING}, - {"speed", 's', 0, "Set the serial port speed", 0, ARG_TYPE_INT}, - {"word", 'w', 0, "Set the serial port word length", 0, ARG_TYPE_INT}, - {"parity", 'r', 0, "Set the serial port parity", 0, ARG_TYPE_STRING}, - {"stop", 't', 0, "Set the serial port stop bits", 0, ARG_TYPE_INT}, + {"unit", 'u', 0, N_("Set the serial unit."), 0, ARG_TYPE_INT}, + {"port", 'p', 0, N_("Set the serial port address."), 0, ARG_TYPE_STRING}, + {"speed", 's', 0, N_("Set the serial port speed."), 0, ARG_TYPE_INT}, + {"word", 'w', 0, N_("Set the serial port word length."), 0, ARG_TYPE_INT}, + {"parity", 'r', 0, N_("Set the serial port parity."), 0, ARG_TYPE_STRING}, + {"stop", 't', 0, N_("Set the serial port stop bits."), 0, ARG_TYPE_INT}, {0, 0, 0, 0, 0, 0} }; @@ -499,7 +500,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) @@ -603,8 +604,8 @@ GRUB_MOD_INIT(serial) { cmd = grub_register_extcmd ("serial", grub_cmd_serial, GRUB_COMMAND_FLAG_BOTH, - "serial [OPTIONS...]", - "Configure serial port.", options); + N_("[OPTIONS...]"), + N_("Configure serial port."), options); /* Set default settings. */ serial_settings.port = serial_hw_get_port (0); 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 4b9c9060e..44cbb763d 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 a793564fd..9a5979b1c 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/elf/grub-mkimage.c b/util/elf/grub-mkimage.c index 5750543ad..6ba8b1ae2 100644 --- a/util/elf/grub-mkimage.c +++ b/util/elf/grub-mkimage.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -361,9 +361,8 @@ main (int argc, char *argv[]) int chrp = 0; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); while (1) { diff --git a/util/grub-editenv.c b/util/grub-editenv.c index e75892430..1fb1422df 100644 --- a/util/grub-editenv.c +++ b/util/grub-editenv.c @@ -1,7 +1,7 @@ /* grub-editenv.c - tool to edit environment block. */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -253,9 +253,8 @@ main (int argc, char *argv[]) char *command; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); /* Check for options. */ while (1) diff --git a/util/grub-emu.c b/util/grub-emu.c index e65c8585e..3f2acaaec 100644 --- a/util/grub-emu.c +++ b/util/grub-emu.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -159,9 +159,8 @@ main (int argc, char *argv[]) int opt; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); while ((opt = getopt_long (argc, argv, "r:d:m:vH:hV", options, 0)) != -1) switch (opt) diff --git a/util/grub-fstest.c b/util/grub-fstest.c index fa54fe414..586dda0f9 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c @@ -1,7 +1,7 @@ /* grub-fstest.c - debug tool for filesystem driver */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -384,9 +384,8 @@ main (int argc, char *argv[]) int i, cmd, num_opts, image_index, num_disks = 1; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); /* Find the first non option entry. */ for (num_opts = 1; num_opts < argc; num_opts++) diff --git a/util/grub-install.in b/util/grub-install.in index d11432de4..96bb009cf 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}` @@ -52,6 +53,8 @@ debug=no if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then disk_module=biosdisk +elif [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then + disk_module= else disk_module=ata fi @@ -178,7 +181,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 : @@ -240,7 +243,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 @@ -283,7 +286,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}" @@ -302,34 +312,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-mkdevicemap.c b/util/grub-mkdevicemap.c index 2b69f905e..b4febbb8d 100644 --- a/util/grub-mkdevicemap.c +++ b/util/grub-mkdevicemap.c @@ -1,7 +1,7 @@ /* grub-mkdevicemap.c - make a device map file automatically */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -112,9 +112,8 @@ main (int argc, char *argv[]) int floppy_disks = 1; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); /* Check for options. */ while (1) diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c index 9775e0803..a358ba5b0 100644 --- a/util/grub-mkfont.c +++ b/util/grub-mkfont.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2009 Free Software Foundation, Inc. + * Copyright (C) 2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -476,9 +476,8 @@ main (int argc, char *argv[]) memset (&font_info, 0, sizeof (font_info)); set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); /* Check for options. */ while (1) diff --git a/util/grub-mkrelpath.c b/util/grub-mkrelpath.c index 956e52ed7..62e400814 100644 --- a/util/grub-mkrelpath.c +++ b/util/grub-mkrelpath.c @@ -1,7 +1,7 @@ /* grub-mkrelpath.c - make a system path relative to its root */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2009 Free Software Foundation, Inc. + * Copyright (C) 2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,9 +56,8 @@ main (int argc, char *argv[]) char *argument, *relpath; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); /* Check for options. */ while (1) diff --git a/util/grub-probe.c b/util/grub-probe.c index 1958308c3..4ba8a98e5 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -1,7 +1,7 @@ /* grub-probe.c - probe device information for a given path */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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); @@ -338,9 +338,8 @@ main (int argc, char *argv[]) char *argument; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); /* Check for options. */ while (1) diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in index c1871e07a..27b1bfe51 100644 --- a/util/grub.d/10_hurd.in +++ b/util/grub.d/10_hurd.in @@ -1,7 +1,7 @@ #! /bin/sh -e # grub-mkconfig helper script. -# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. +# Copyright (C) 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 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/hostfs.c b/util/hostfs.c index 83db2f1a9..df930b42e 100644 --- a/util/hostfs.c +++ b/util/hostfs.c @@ -1,7 +1,7 @@ /* hostfs.c - Dummy filesystem to provide access to the hosts filesystem */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007,2008 Free Software Foundation, Inc. + * Copyright (C) 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 diff --git a/util/i386/efi/grub-install.in b/util/i386/efi/grub-install.in index e597c4eee..caa7be7e4 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/i386/pc/grub-mkfloppy.in b/util/i386/pc/grub-mkfloppy.in deleted file mode 100644 index 3b5518690..000000000 --- a/util/i386/pc/grub-mkfloppy.in +++ /dev/null @@ -1,116 +0,0 @@ -#! /bin/sh -e - -# Make GRUB rescue floppy -# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,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 . - -# Initialize some variables. -transform="@program_transform_name@" - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -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}` - -# Usage: usage -# Print the usage. -usage () { - cat <. -EOF -} - -input_dir=${pkglibdir} - -# Check the arguments. -for option in "$@"; do - case "$option" in - -h | --help) - usage - exit 0 ;; - -v | --version) - echo "$0 (GNU GRUB ${PACKAGE_VERSION})" - exit 0 ;; - --modules=*) - modules=`echo "$option" | sed 's/--modules=//'` ;; - --output=*) - output_image=`echo "$option" | sed 's/--output=//'` ;; - -*) - echo "Unrecognized option \`$option'" 1>&2 - usage - exit 1 - ;; - *) - if test "x$output_image" != x; then - echo "Unrecognized option \`$option'" 1>&2 - usage - exit 1 - fi - output_image="${option}" ;; - esac -done - -if test "x$output_image" = x; then - usage - exit 1 -fi - -aux_dir=`mktemp -d` -mkdir -p ${aux_dir}/boot/grub - -for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \ - ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \ - ${input_dir}/handler.lst ${input_dir}/parttool.lst; do - if test -f "$file"; then - cp -f "$file" ${aux_dir}/boot/grub/ - fi -done - -modules="$(cat ${input_dir}/partmap.lst) ${modules}" -for i in ${modules} ; do - echo "insmod $i" -done > ${aux_dir}/boot/grub/grub.cfg - -# build memdisk -memdisk_img=`mktemp` -tar -C ${aux_dir} -cf ${memdisk_img} boot -rm -rf ${aux_dir} - -# build core.img -core_img=`mktemp` -grub-mkimage -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk tar biosdisk -rm -f ${memdisk_img} - -# build floppy image -cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > ${output_image} -rm -f ${core_img} - -exit 0 diff --git a/util/i386/pc/grub-mkimage.c b/util/i386/pc/grub-mkimage.c index 3c2cb7549..ebf1bc7ff 100644 --- a/util/i386/pc/grub-mkimage.c +++ b/util/i386/pc/grub-mkimage.c @@ -1,7 +1,7 @@ /* grub-mkimage.c - make a bootable image */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +33,7 @@ #include #include #include +#include #define _GNU_SOURCE 1 #include @@ -212,10 +213,17 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[], boot_img = grub_util_read_image (boot_path); - /* i386 is a little endian architecture. */ - *((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE - - GRUB_BOOT_MACHINE_LIST_SIZE + 8)) - = grub_cpu_to_le16 (num); + { + struct grub_boot_blocklist *block; + block = (struct grub_boot_blocklist *) (boot_img + + GRUB_DISK_SECTOR_SIZE + - sizeof (*block)); + block->len = grub_host_to_target16 (num); + + /* This is filled elsewhere. Verify it just in case. */ + assert (block->segment == grub_host_to_target16 (GRUB_BOOT_MACHINE_KERNEL_SEG + + (GRUB_DISK_SECTOR_SIZE >> 4))); + } grub_util_write_image (boot_img, boot_size, out); free (boot_img); @@ -351,9 +359,8 @@ main (int argc, char *argv[]) FILE *fp = stdout; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); while (1) { diff --git a/util/i386/pc/grub-setup.c b/util/i386/pc/grub-setup.c index c2b9b9268..909a521eb 100644 --- a/util/i386/pc/grub-setup.c +++ b/util/i386/pc/grub-setup.c @@ -1,7 +1,7 @@ /* grub-setup.c - make GRUB usable */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,6 +48,7 @@ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_P #include #include #include +#include #include "progname.h" #define _GNU_SOURCE 1 @@ -56,14 +57,6 @@ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_P #define DEFAULT_BOOT_FILE "boot.img" #define DEFAULT_CORE_FILE "core.img" -/* This is the blocklist used in the diskboot image. */ -struct boot_blocklist -{ - grub_uint64_t start; - grub_uint16_t len; - grub_uint16_t segment; -} __attribute__ ((packed)); - void grub_putchar (int c) { @@ -99,7 +92,7 @@ setup (const char *dir, grub_uint8_t *boot_drive; grub_disk_addr_t *kernel_sector; grub_uint16_t *boot_drive_check; - struct boot_blocklist *first_block, *block; + struct grub_boot_blocklist *first_block, *block; grub_int32_t *install_dos_part, *install_bsd_part; grub_int32_t dos_part, bsd_part; char *tmp_img; @@ -171,7 +164,7 @@ setup (const char *dir, void NESTED_FUNC_ATTR save_blocklists (grub_disk_addr_t sector, unsigned offset, unsigned length) { - struct boot_blocklist *prev = block + 1; + struct grub_boot_blocklist *prev = block + 1; grub_util_info ("saving <%llu,%u,%u> with the segment 0x%x", sector, offset, length, (unsigned) current_segment); @@ -226,9 +219,9 @@ setup (const char *dir, core_img = grub_util_read_image (core_path); /* Have FIRST_BLOCK to point to the first blocklist. */ - first_block = (struct boot_blocklist *) (core_img - + GRUB_DISK_SECTOR_SIZE - - sizeof (*block)); + first_block = (struct grub_boot_blocklist *) (core_img + + GRUB_DISK_SECTOR_SIZE + - sizeof (*block)); install_dos_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART); @@ -389,10 +382,11 @@ setup (const char *dir, /* The first blocklist contains the whole sectors. */ first_block->start = grub_cpu_to_le64 (embed_region.start + 1); - first_block->len = grub_cpu_to_le16 (core_sectors - 1); - first_block->segment - = grub_cpu_to_le16 (GRUB_BOOT_MACHINE_KERNEL_SEG - + (GRUB_DISK_SECTOR_SIZE >> 4)); + + /* These are filled elsewhere. Verify them just in case. */ + assert (first_block->len == grub_host_to_target16 (core_sectors - 1)); + assert (first_block->segment == grub_host_to_target16 (GRUB_BOOT_MACHINE_KERNEL_SEG + + (GRUB_DISK_SECTOR_SIZE >> 4))); /* Make sure that the second blocklist is a terminator. */ block = first_block - 1; @@ -641,9 +635,8 @@ main (int argc, char *argv[]) int must_embed = 0, force = 0, fs_probe = 1; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); /* Check for options. */ while (1) diff --git a/util/misc.c b/util/misc.c index 5896da0c8..d8aa041be 100644 --- a/util/misc.c +++ b/util/misc.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +38,7 @@ #include #include #include +#include #include "progname.h" @@ -504,7 +505,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 +524,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) @@ -566,3 +567,13 @@ make_system_path_relative_to_its_root (const char *path) return buf3; } + +void +grub_util_init_nls (void) +{ +#if ENABLE_NLS + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); +#endif /* ENABLE_NLS */ +} diff --git a/util/mkisofs/mkisofs.c b/util/mkisofs/mkisofs.c index 8e99d5c18..588345232 100644 --- a/util/mkisofs/mkisofs.c +++ b/util/mkisofs/mkisofs.c @@ -6,7 +6,7 @@ Copyright 1993 Yggdrasil Computing, Incorporated - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009,2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -490,7 +490,7 @@ void usage(){ int comma; int len; unsigned int j; - char *arg; + const char *arg; printf (" "); @@ -645,9 +645,11 @@ int FDECL2(main, int, argc, char **, argv){ char *log_file = 0; set_program_name (argv[0]); +#if ENABLE_NLS setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); +#endif /* ENABLE_NLS */ if (argc < 2) usage(); diff --git a/util/mkisofs/mkisofs.h b/util/mkisofs/mkisofs.h index 79ae50251..482db6ceb 100644 --- a/util/mkisofs/mkisofs.h +++ b/util/mkisofs/mkisofs.h @@ -5,7 +5,7 @@ Copyright 1993 Yggdrasil Computing, Incorporated - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009,2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,8 +30,21 @@ #include #include -#include -#include +#if ENABLE_NLS + +# include +# include + +#else /* ! ENABLE_NLS */ + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# define gettext(Msgid) ((const char *) (Msgid)) +#endif /* ENABLE_NLS */ + #define _(str) gettext(str) #define N_(str) str diff --git a/util/mkisofs/write.c b/util/mkisofs/write.c index 69b6bb623..d9b1fd05d 100644 --- a/util/mkisofs/write.c +++ b/util/mkisofs/write.c @@ -1436,7 +1436,12 @@ 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 (fread (buffer, 2048 * PADBLOCK_SIZE, 1, fp) == 0) + error (1, errno, _("cannot read %llu bytes from %s"), + (size_t) (2048 * PADBLOCK_SIZE), boot_image_embed); + 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 be9922202..000000000 --- a/util/sparc64/ieee1275/grub-install.in +++ /dev/null @@ -1,281 +0,0 @@ -#! /bin/sh - -# Install GRUB on your drive. -# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. -# -# GRUB is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# GRUB is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GRUB. If not, see . - -# Initialize some variables. -transform="@program_transform_name@" - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -sbindir=@sbindir@ -bindir=@bindir@ -libdir=@libdir@ -PACKAGE_NAME=@PACKAGE_NAME@ -PACKAGE_TARNAME=@PACKAGE_TARNAME@ -PACKAGE_VERSION=@PACKAGE_VERSION@ -target_cpu=@target_cpu@ -platform=@platform@ -pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}` - -grub_setup=${sbindir}/`echo grub-setup | sed ${transform}` -grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}` -grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}` -grub_probe=${sbindir}/`echo grub-probe | sed ${transform}` -grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}` -rootdir= -grub_prefix=`echo /boot/grub | sed ${transform}` -modules= - -install_device= -no_floppy= -force_lba= -recheck=no -debug=no - -# Usage: usage -# Print the usage. -usage () { - cat <. -EOF -} - -# Check the arguments. -for option in "$@"; do - case "$option" in - -h | --help) - usage - exit 0 ;; - -v | --version) - echo "grub-install (GNU GRUB ${PACKAGE_VERSION})" - exit 0 ;; - --modules=*) - modules=`echo "$option" | sed 's/--modules=//'` ;; - --root-directory=*) - rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; - --grub-setup=*) - grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;; - --grub-mkimage=*) - grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; - --grub-mkdevicemap=*) - grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; - --grub-probe=*) - grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; - --no-floppy) - no_floppy="--no-floppy" ;; - --recheck) - recheck=yes ;; - # This is an undocumented feature... - --debug) - debug=yes ;; - -*) - echo "Unrecognized option \`$option'" 1>&2 - usage - exit 1 - ;; - *) - if test "x$install_device" != x; then - echo "More than one install_devices?" 1>&2 - usage - exit 1 - fi - install_device="${option}" ;; - esac -done - -# for make_system_path_relative_to_its_root() -. ${libdir}/grub/grub-mkconfig_lib - -if test "x$install_device" = x; then - echo "install_device not specified." 1>&2 - usage - exit 1 -fi - -# If the debugging feature is enabled, print commands. -setup_verbose= -if test $debug = yes; then - set -x - setup_verbose="--verbose" -fi - -# Initialize these directories here, since ROOTDIR was initialized. -bootdir=${rootdir}/boot -grubdir=${bootdir}/`echo grub | sed ${transform}` -device_map=${grubdir}/device.map - -grub_probe="${grub_probe} --device-map=${device_map}" - -# Check if GRUB is installed. -set $grub_setup dummy -if test -f "$1"; then - : -else - echo "$1: Not found." 1>&2 - exit 1 -fi - -set $grub_mkimage dummy -if test -f "$1"; then - : -else - echo "$1: Not found." 1>&2 - exit 1 -fi - -set $grub_mkdevicemap dummy -if test -f "$1"; then - : -else - echo "$1: Not found." 1>&2 - exit 1 -fi - -# Create the GRUB directory if it is not present. -test -d "$bootdir" || mkdir "$bootdir" || exit 1 -test -d "$grubdir" || mkdir "$grubdir" || exit 1 - -# If --recheck is specified, remove the device map, if present. -if test $recheck = yes; then - rm -f $device_map -fi - -# Create the device map file if it is not present. -if test -f "$device_map"; then - : -else - # Create a safe temporary file. - test -n "$mklog" && log_file=`$mklog` - - $grub_mkdevicemap --device-map=$device_map $no_floppy || exit 1 -fi - -# Make sure that there is no duplicated entry. -tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \ - | sort | uniq -d | sed -n 1p` -if test -n "$tmp"; then - echo "The drive $tmp is defined multiple times in the device map $device_map" 1>&2 - exit 1 -fi - -# Copy the GRUB images to the GRUB directory. -for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img; do - if test -f $file && [ "`basename $file`" != menu.lst ]; then - rm -f $file || exit 1 - fi -done -for file in ${pkglibdir}/*.mod ${pkglibdir}/*.lst; do - cp -f $file ${grubdir} || exit 1 -done - -for file in ${pkglibdir}/*.img; do - cp -f $file ${grubdir} || exit 1 -done - -if ! test -f ${grubdir}/grubenv; then - $grub_editenv ${grubdir}/grubenv create -fi - -# 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/util/sparc64/ieee1275/grub-mkimage.c b/util/sparc64/ieee1275/grub-mkimage.c index d756586af..b79bbeb41 100644 --- a/util/sparc64/ieee1275/grub-mkimage.c +++ b/util/sparc64/ieee1275/grub-mkimage.c @@ -1,7 +1,7 @@ /* grub-mkimage.c - make a bootable image */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -222,9 +222,8 @@ main (int argc, char *argv[]) FILE *fp = stdout; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_ls (); while (1) { diff --git a/util/sparc64/ieee1275/grub-ofpathname.c b/util/sparc64/ieee1275/grub-ofpathname.c index 166ce4cbe..3ac6fce8b 100644 --- a/util/sparc64/ieee1275/grub-ofpathname.c +++ b/util/sparc64/ieee1275/grub-ofpathname.c @@ -1,7 +1,7 @@ /* grub-ofpathname.c - Find OpenBOOT path for a given device */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2009 Free Software Foundation, Inc. + * Copyright (C) 2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,9 +29,8 @@ int main(int argc, char **argv) char *of_path; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); if (argc != 2) { diff --git a/util/sparc64/ieee1275/grub-setup.c b/util/sparc64/ieee1275/grub-setup.c index ade1bd595..9d8e67562 100644 --- a/util/sparc64/ieee1275/grub-setup.c +++ b/util/sparc64/ieee1275/grub-setup.c @@ -1,7 +1,7 @@ /* grub-setup.c - make GRUB usable */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -620,9 +620,8 @@ main (int argc, char *argv[]) struct grub_setup_info ginfo; set_program_name (argv[0]); - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); + + grub_util_init_nls (); init_info (&ginfo); if (!parse_options (&ginfo, argc, argv)) 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 f3a296ef9..8cfe9f89a 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 1fe0aa500..af7e803e1 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 b7323b5b7..ead567a2d 100644 --- a/video/fb/video_fb.c +++ b/video/fb/video_fb.c @@ -1050,7 +1050,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)); @@ -1170,7 +1170,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 f815e789c..713876301 100644 --- a/video/i386/pc/vbe.c +++ b/video/i386/pc/vbe.c @@ -700,7 +700,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..8eec421dd 100644 --- a/video/readers/png.c +++ b/video/readers/png.c @@ -1,6 +1,6 @@ /* * 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 @@ -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 2e17ee7dc..e3f80610b 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); } @@ -520,7 +520,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. */ @@ -684,7 +684,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. */