merge from trunk

This commit is contained in:
Colin Watson 2010-01-14 14:04:44 +00:00
commit 7d1468e4b6
243 changed files with 8862 additions and 3935 deletions

View file

@ -35,6 +35,7 @@ grub_fstest_init.c
grub_fstest_init.h
grub-install
grub-mk*
grub-pbkdf2
grub-pe2elf
grub-probe
grub_probe_init.c

755
ChangeLog
View file

@ -1,3 +1,758 @@
2010-01-14 BVK Chaitanya <bvk.groups@gmail.com>
Unit testing framework for GRUB.
* Makefile.in: Test framework build rules for 'make check'.
* conf/tests.rmk: Build rules for individual tests and framework.
* include/grub/test.h: Header file for whitebox tests.
* tests/lib/functional_test.c: Framework support for whitebox
functional tests.
* tests/lib/test.c: Common whitebox testing code for unit and
functional tests.
* tests/lib/unit_test.c: Framework support for whitebox unit
tests.
* tests/util/grub-shell-tester.in: Support utility for grub-script
tests.
* tests/util/grub-shell.in: Utility to execute grub-script
commands in a Qemu instance.
* tests/example_functional_test.c: Example whitebox functional
test.
* tests/example_grub_script_test.in: Example grub-script test.
* tests/example_scripted_test.in: Example scripted test.
* tests/example_unit_test.c: Example whitebox unit test.
2010-01-14 Vladimir Serbinenko <phcoder@gmail.com>
* conf/i386-coreboot.rmk (multiboot_mod_SOURCES):
Add loader/i386/multiboot_mbi.c.
(multiboot2_mod_SOURCES): Likewise.
* conf/i386-pc.rmk (multiboot_mod_SOURCES): Likewise.
(multiboot2_mod_SOURCES): Likewise.
* include/grub/multiboot.h (grub_multiboot_get_mbi_size): New proto.
(grub_multiboot_make_mbi): Likewise.
(grub_multiboot_free_mbi): Likewise.
(grub_multiboot_init_mbi): Likewise.
(grub_multiboot_add_module): Likewise.
(grub_multiboot_set_bootdev): Likewise.
* loader/i386/multiboot.c (mbi): Removed.
(mbi_dest): Likewise.
(alloc_mbi): New variable.
(grub_multiboot_payload_size): Removed. All users updated.
(grub_multiboot_pure_size): New variable.
(grub_multiboot_boot): Use grub_multiboot_make_mbi.
(grub_multiboot_unload): Use grub_multiboot_free_mbi.
(grub_get_multiboot_mmap_len): Moved to loader/i386/multiboot_mbi.c.
(grub_fill_multiboot_mmap): Likewise.
(grub_multiboot_get_bootdev): Likewise.
(grub_multiboot): Use multiboot_mbi functions.
* loader/i386/multiboot_mbi.c: New file.
2010-01-13 Vladimir Serbinenko <phcoder@gmail.com>
* kern/efi/init.c (grub_efi_fini): Don't call grub_efi_mm_fini as
it would result in module crash.
2010-01-13 Vladimir Serbinenko <phcoder@gmail.com>
* term/ieee1275/ofconsole.c (grub_ofconsole_putchar): Handle '\r'.
(grub_ofconsole_getwh): Split to ...
(grub_ofconsole_getwh): ... this.
(grub_ofconsole_dimensions): ...and this.
(grub_ofconsole_init_output): Call grub_ofconsole_dimensions.
2010-01-13 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/rock.c (generate_rock_ridge_attributes): Fix a typo.
2010-01-12 Vladimir Serbinenko <phcoder@gmail.com>
* loader/i386/pc/multiboot2.c: Removed stalled file.
2010-01-12 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkpasswd-pbkdf2.c (main): Use grub_util_init_nls.
Reported by: Grégoire Sutre
2010-01-11 Robert Millan <rmh.grub@aybabtu.com>
* util/misc.c (canonicalize_file_name): New function.
(make_system_path_relative_to_its_root): Use canonicalize_file_name()
instead of realpath().
2010-01-11 Colin Watson <cjwatson@ubuntu.com>
* util/grub-install.in (usage): Clarify meaning of --root-directory,
and make it clearer that it's optional. Based on confusion
witnessed on IRC.
2010-01-10 Vladimir Serbinenko <phcoder@gmail.com>
* term/i386/pc/vga_text.c (inc_y): Fix off-by-one error which resulted
in premature implicit newline.
2010-01-10 Vladimir Serbinenko <phcoder@gmail.com>
* normal/cmdline.c (grub_cmdline_get): Fix off-by-one error
which resulted in garbled command line at the end of screen.
2010-01-10 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/ieee1275/linux.c (grub_linux_boot): Rework video position
initialization with similar approach as with other Linux loaders.
2010-01-10 Robert Millan <rmh.grub@aybabtu.com>
Fix i386-ieee1275 build.
* loader/i386/ieee1275/linux.c (grub_linux_boot): Use grub_term_width()
and grub_term_height() for video_{width,height} initialization.
2010-01-10 Robert Millan <rmh.grub@aybabtu.com>
Fix grub-emu build.
* conf/any-emu.rmk (grub_emu_SOURCES): Remove `kern/reader.c'.
2010-01-07 Vladimir Serbinenko <phcoder@gmail.com>
2010-01-09 Robert Millan <rmh.grub@aybabtu.com>
Support for multiple terminals.
* Makefile.in (pkglib_DATA): terminal.lst.
(terminal.lst): New target.
* commands/handler.c (grub_cmd_handler): Don't handle terminals.
(GRUB_MOD_INIT(handler)): Likewise.
(GRUB_MOD_FINI(handler)): Likewise.
* commands/help.c (grub_cmd_help): Handle multiple terminals.
* commands/keystatus.c (grub_cmd_keystatus): Likewise.
* commands/sleep.c (do_print): Use grub_term_restore_pos.
(grub_cmd_sleep): Use grub_term_save_pos.
* commands/terminal.c: New file.
* conf/any-emu.rmk (grub_emu_SOURCES): Add normal/term.c
commands/terminal.c and lib/charset.c.
* conf/common.rmk (normal_mod_SOURCES): Add normal/term.c.
(pkglib_MODULES): Add terminal.mod.
(terminal_mod_SOURCES): New variable.
(terminal_mod_CFLAGS): Likewise.
(terminal_mod_LDFLAGS): Likewise.
* genhandlerlist.sh: Don't handle terminals.
* genmk.rb: Generate terminal-*.lst.
* genterminallist.sh: New file.
* include/grub/charset.h (grub_ucs4_to_utf8_alloc): New proto.
(grub_is_valid_utf8): Likewise.
(grub_utf8_to_ucs4_alloc): Likewise.
* include/grub/menu_viewer.h (grub_menu_viewer): Rewritten.
(grub_menu_register_viewer): Changed argument.
(grub_menu_try_text): New proto.
(grub_gfxmenu_try_hook): New declaration.
* include/grub/normal.h (grub_normal_exit_level): New declaration.
(grub_menu_init_page): Additional argument term.
(grub_normal_init_page): Likewise.
(grub_cmdline_get): Arguments simplified.
(grub_utf8_to_ucs4_alloc): Removed.
(grub_print_ucs4): Additional argument term.
(grub_getstringwidth): Likewise.
(grub_print_message_indented): Likewise.
(grub_menu_text_register_instances): New proto.
(grub_show_menu): Likewise.
(read_terminal_list): Likewise.
(grub_set_more): Likewise.
* include/grub/parser.h: Include handler.h.
* include/grub/reader.h: Rewritten.
* include/grub/term.h (GRUB_TERM_NEED_INIT): Removed.
(GRUB_TERM_WIDTH): Changed to function.
(GRUB_TERM_HEIGHT): Likewise.
(GRUB_TERM_BORDER_WIDTH): Likewise.
(GRUB_TERM_BORDER_HEIGHT): Likewise.
(GRUB_TERM_NUM_ENTRIES): Likewise.
(GRUB_TERM_ENTRY_WIDTH): Likewise.
(GRUB_TERM_CURSOR_X): Likewise.
(grub_term_input_class): Likewise.
(grub_term_output_class): Likewise.
(grub_term_outputs_disabled): New declaration.
(grub_term_inputs_disabled): Likewise.
(grub_term_outputs): Likewise.
(grub_term_inputs): Likewise.
(grub_term_register_input): Rewritten.
(grub_term_register_output): Likewise.
(grub_term_unregister_input): Likewise.
(grub_term_unregister_output): Likewise.
(FOR_ACTIVE_TERM_INPUTS): New macro.
(FOR_DISABLED_TERM_INPUTS): Likewise.
(FOR_ACTIVE_TERM_OUTPUTS): Likewise.
(FOR_DISABLED_TERM_OUTPUTS): Likewise.
* include/grub/terminfo.h: Add oterm argument to all protypes.
* kern/main.c (grub_main): Don't call grub_register_rescue_reader.
Use grub_rescue_run.
* kern/misc.c (grub_utf8_to_ucs4): Put '?' for invalid characters.
All users updated.
* kern/reader.c: Removed. All users updated.
* kern/rescue_reader.c (grub_rescue_init): Removed.
(grub_rescue_reader): Likewise.
(grub_register_rescue_reader): Likewise.
(grub_rescue_run): New function based on kern/reader.c.
* kern/term.c: Adapted for multiterm.
* lib/charset.c (grub_ucs4_to_utf8_alloc): New function.
(grub_is_valid_utf8): Likewise.
(grub_utf8_to_ucs4_alloc): Moved from normal/menu_text.c.
* loader/i386/efi/linux.c (grub_cmd_linux): Retrieve parameters of
right terminal.
* loader/i386/linux.c (grub_linux_boot): Likewise.
* normal/auth.c (grub_username_get): New function.
(grub_auth_check_authentication): Use grub_username_get.
* normal/cmdline.c: Changed to UCS4. Adapted for multiterm.
* normal/color.c: Adapt for multiterm.
* normal/main.c (read_config_file): Don't use grub_reader_loop.
(grub_normal_init_page): Additional argument term.
(read_lists): Call read_terminal_lists.
(grub_enter_normal_mode): Call grub_cmdline_run.
Handle grub_normal_exit_level.
(grub_cmd_normal): Make reentrant.
(grub_cmd_normal_exit): New function.
(grub_normal_reader_init): Additional argument nested. Handle multiterm.
* normal/menu.c: Adapt for multiterm.
* normal/menu_entry.c: Likewise.
* normal/menu_text.c: Likewise.
* normal/menu_viewer.c: Removed. All users updated.
* normal/term.c: New file.
* util/console.c: Change order of includes to workaround a bug in
ncurses headers.
* term/terminfo.c: New argument oterm on all exported functions.
All users updated.
* util/grub-editenv.c (grub_term_input_class): Removed.
(grub_term_output_class): Likewise.
2010-01-09 Robert Millan <rmh.grub@aybabtu.com>
Make loader output a bit more user-friendly.
* util/grub.d/10_hurd.in: Print message indicating that GNU Mach
is being loaded. Likewise for the Hurd.
* util/grub.d/10_kfreebsd.in (kfreebsd_entry): Print message indicating
that kernel of FreeBSD ${version} is being loaded.
* loader/i386/linux.c (grub_cmd_linux): Move debug info to
grub_dprintf().
(grub_cmd_initrd): Likewise.
* util/grub.d/10_linux.in (linux_entry): Print message indicating
that Linux ${version} is being loaded. Likewise for initrd.
2010-01-09 Carles Pina i Estany <carles@pina.cat>
* gettext/gettext.c (GRUB_MOD_INIT): Gettextizze.
2010-01-08 Carles Pina i Estany <carles@pina.cat>
* loader/efi/appleloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/efi/chainloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/efi/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/ieee1275/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/pc/chainloader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/pc/linux.c: Include `<grub/i18n.h>'.
(grub_cmd_linux): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/i386/xnu.c: Include `<grub/i18n.h>'.
(grub_cpu_xnu_init): Gettextizze.
* loader/multiboot_loader.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/powerpc/ieee1275/linux.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* loader/sparc64/ieee1275/linux.c: Include `<grub/i18n.h>'.
(grub_linux_load64): Capitalise Linux.
(GRUB_MOD_INIT): Gettextizze.
* loader/xnu.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* po/POTFILES: Add `loader/efi/appleloader.c',
`loader/efi/chainloader.c', `loader/i386/efi/linux.c',
`loader/i386/ieee1275/linux.c', `loader/i386/linux.c',
`loader/i386/pc/chainloader.c', `loader/i386/pc/linux.c',
`loader/i386/xnu.c', `loader/multiboot_loader.c',
`loader/powerpc/ieee1275/linux.c', `loader/sparc64/ieee1275/linux.c'
and `loader/xnu.c'.
2010-01-08 Robert Millan <rmh.grub@aybabtu.com>
* src/mkisofs.c: Remove `ifdef linux' portability kludge.
2010-01-08 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/defaults.h (APPID_DEFAULT): Redefine using PACKAGE_NAME.
(SYSTEM_ID_DEFAULT): Set to "GNU" unconditionally.
* util/mkisofs/mkisofs.c (main): Readjust --version output.
2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
Reset Multiboot 2 support. New loader implements the draft in
/branches/multiboot2 and shares as much code as possible with the
production Multiboot 1 implementation.
* loader/ieee1275/multiboot2.c: Remove file. Update all users.
* loader/multiboot2.c: Likewise.
* loader/i386/multiboot_helper.S: Likewise.
* include/multiboot2.h: Replace with latest version from the draft
in /branches/multiboot2.
* conf/i386-coreboot.rmk (multiboot_mod_SOURCES): Remove
`loader/i386/multiboot_helper.S', `loader/i386/pc/multiboot2.c'
and `loader/multiboot2.c'.
(pkglib_MODULES): Add `multiboot2.mod'.
(multiboot2_mod_SOURCES): New variable.
(multiboot2_mod_LDFLAGS): Likewise.
(multiboot2_mod_CFLAGS): Likewise. Define `GRUB_USE_MULTIBOOT2'.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk (pkglib_MODULES): Remove `multiboot.mod'.
(multiboot_mod_SOURCES): Remove variable.
(multiboot_mod_LDFLAGS): Likewise.
(multiboot_mod_CFLAGS): Likewise.
* include/grub/multiboot.h [GRUB_USE_MULTIBOOT2]: Include
`<multiboot2.h>' instead of `<multiboot.h>'.
[GRUB_USE_MULTIBOOT2] (MULTIBOOT_BOOTLOADER_MAGIC)
(MULTIBOOT_HEADER_MAGIC): New macros.
* loader/multiboot_loader.c (module_version_status): Remove variable.
(find_multi_boot2_header): Remove function.
(grub_cmd_multiboot_loader): Remove Multiboot 2 / Multiboot 1 selection
logic. Always check for the Multiboot version we're compiling for.
(grub_cmd_module_loader): Likewise.
[GRUB_USE_MULTIBOOT2] (GRUB_MOD_INIT(multiboot)): Register `multiboot2'
command instead of `multiboot'.
2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
* include/multiboot.h (MULTIBOOT_UNSUPPORTED): Moved from here ...
* loader/i386/multiboot.c (UNSUPPORTED_FLAGS): ... to here. Update
all users.
2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
2010-01-07 Vladimir Serbinenko <phcoder@gmail.com>
Fix breakage introduced with previous commit.
* normal/dyncmd.c (read_command_list): Avoid unregistering kernel
commands.
* normal/handler.c (read_handler_list): Revert part of previous commit
affecting this file.
* normal/main.c (read_lists): Move read_handler_list() call back to ...
(grub_normal_execute): ... here.
2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
Merge prefix-redefinition-fix branch.
* normal/autofs.c (read_fs_list): Make function capable of being
run multiple times, gracefuly replacing the previous data
structures.
* normal/dyncmd.c (read_command_list): Likewise.
* normal/handler.c (read_handler_list): Likewise.
* normal/main.c (read_lists): New function. Calls all the
list reading functions.
(grub_normal_execute): Use read_lists() instead of calling all
list reading functions explicitly. Register read_lists() as a
variable hook attached to ${prefix}.
2010-01-07 Vladimir Serbinenko <phcoder@gmail.com>
Merge crypto branch.
* Makefile.in (pkglib_DATA): Add crypto.lst.
(crypto.lst): New target.
* commands/hashsum.c: New file.
* commands/password.c (check_password): Use grub_crypto_memcmp.
* commands/password_pbkdf2.c: New file.
* commands/xnu_uuid.c: Remove MD5. Use GRUB_MD_MD5.
* conf/any-emu.rmk (grub_emu_SOURCES): Add lib/crypto.c,
normal/crypto.c and lib/libgcrypt-grub/cipher/md5.c.
(grub_emu_CFLAGS): Add -Wno-missing-field-initializers -Wno-error
-I$(srcdir)/lib/libgcrypt_wrap.
* conf/common.rmk (normal_mod_SOURCES): Add normal/crypto.c.
(pkglib_MODULES): Add crypto.mod, hashsum.mod, pbkdf2.mod and
password_pbkdf2.mod.
(crypto_mod_SOURCES): New variable.
(crypto_mod_CFLAGS): Likewise.
(crypto_mod_LDFLAGS): Likewise.
(hashsum_mod_SOURCES): New variable.
(hashsum_mod_CFLAGS): Likewise.
(hashsum_mod_LDFLAGS): Likewise.
(pbkdf2_mod_SOURCES): New variable.
(pbkdf2_mod_CFLAGS): Likewise.
(pbkdf2_mod_LDFLAGS): Likewise.
(password_pbkdf2_mod_SOURCES): New variable.
(password_pbkdf2_mod_CFLAGS): Likewise.
(password_pbkdf2_mod_LDFLAGS): Likewise.
(bin_UTILITIES): Add grub-mkpasswd-pbkdf2.
(grub_mkpasswd_pbkdf2_SOURCES): New variable.
(grub_mkpasswd_pbkdf2_CFLAGS): Likewise.
Include conf/gcry.rmk.
* include/grub/auth.h: Rewritten.
* include/grub/crypto.h: New file.
* include/grub/disk.h (grub_disk_dev_id): Add GRUB_DISK_DEVICE_LUKS_ID.
* include/grub/normal.h (read_crypto_list): New prototype.
* lib/crypto.c: New file.
* lib/libgcrypt_wrap/cipher_wrap.h: Likewise.
* lib/pbkdf2.c: Likewise.
* normal/auth.c (grub_auth_strcmp): Removed.
(grub_iswordseparator): Likewise.
(grub_auth_strword): Likewise.
(is_authenticated): Use grub_strword.
(grub_auth_check_authentication): Use grub_strcmp, grub_password_get
and grub_strword. Pass entered password to authentication callback.
* normal/crypto.c: New file.
* normal/main.c: Call read_crypto_list.
* util/grub-mkpasswd-pbkdf2.c: New file.
* util/import_gcry.py: Generate crypto.lst. Add hash blocklen.
2010-01-06 Vladimir Serbinenko <phcoder@gmail.com>
Fix descent and ascent calculation.
* util/grub-mkfont.c (grub_font_info): New fields 'asce' and 'max_y'.
(options): New option "asce".
(usage): Likewise.
(add_char): Ignore invalid glyphs for descent calculation.
Calculate ascent from actual content.
(print_glyphs): Use 'asce'.
(write_font): Likewise. Allow ascent override.
(main): Handle "asce" option.
2010-01-06 Carles Pina i Estany <carles@pina.cat>
* kern/err.c: Include `<grub/i18n.h>'.
(grub_print_error): Add full stop. Gettextizze.
* loader/i386/bsd.c (grub_netbsd_boot): Change grub_error description.
(grub_bsd_load_elf): Capitalise ELF.
(grub_cmd_freebsd_loadenv): Add `s' in error string.
(grub_cmd_freebsd_module): Likewise.
(grub_cmd_freebsd_module_elf): Likewise.
* loader/i386/bsdXX.c (SUFFIX): Capitalise ELF.
2010-01-06 Carles Pina i Estany <carles@pina.cat>
* commands/search.c (GRUB_MOD_INIT): Use HELP_MESSAGE.
* commands/search_file.c (HELP_MESSAGE): New macro.
* commands/search_label.c (HELP_MESSAGE): Likewise.
* commands/search_uuid.c (HELP_MESSAGE): Likewise.
* po/POTFILES: Add `commands/search_file.c',
`commands/search_label.c', `commands_uuid.c'. Remove duplicate
`commands/search.c'.
2010-01-05 Robert Millan <rmh.grub@aybabtu.com>
* config.rpath: Update from Gnulib.
2010-01-05 Yves Blusseau <blusseau@zetam.org>
* commands/acpi.c (grub_acpi_create_ebda): fix incorrect message.
2010-01-05 Yves Blusseau <yves.blusseau@zetam.org>
* util/sparc64/ieee1275/grub-mkimage.c (main): Typo fix.
2010-01-05 Colin Watson <cjwatson@ubuntu.com>
* util/mkisofs/write.c (padblock_write): Switch size and nmemb
arguments to fread so that we get a return value in bytes, rather
than something that will normally be rounded down to 0.
Adjust error handling to avoid producing garbage when size_t is not
the same size as long long.
2010-01-05 Colin Watson <cjwatson@ubuntu.com>
* util/mkisofs/write.c (padblock_write): Check return value of
fread.
2010-01-05 Robert Millan <rmh.grub@aybabtu.com>
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 <rmh.grub@aybabtu.com>
* 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 <rmh.grub@aybabtu.com>
* 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 <phcoder@gmail.com>
* 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 <phcoder@gmail.com>
* loader/efi/appleloader.c: Restored. Update all users.
2010-01-03 Robert Millan <rmh.grub@aybabtu.com>
* boot/i386/pc/diskboot.S: Fix inaccurate comment.
* util/i386/pc/grub-setup.c: Include `<assert.h>'.
(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 `<assert.h>'.
(generate_image): Fix broken blocklist length initialization.
Add assert() call to verify blocklist `segment' field.
2010-01-03 Robert Millan <rmh.grub@aybabtu.com>
* loader/efi/appleloader.c: Remove. Update all users.
2010-01-03 Robert Millan <rmh.grub@aybabtu.com>
* 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 <cjwatson@ubuntu.com>
* 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 <carles@pina.cat>
* normal/menu_text.c (print_message): Change messages.
2010-01-03 Carles Pina i Estany <carles@pina.cat>
* normal/menu_entry.c (store_completion): Gettextizze.
2010-01-03 Carles Pina i Estany <carles@pina.cat>
* kern/env.c (grub_env_unset): Set the variable to "" if has hooks.
2010-01-03 Carles Pina i Estany <carles@pina.cat>
* po/POTFILES: Sort correctly.
2010-01-03 Carles Pina i Estany <carles@pina.cat>
* 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 <carles@pina.cat>
* 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 <cjwatson@ubuntu.com>
* 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 <carles@pina.cat>
* 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 <rmh.grub@aybabtu.com>
Import from Gnulib.
* gnulib/getdelim.c: New file.
* gnulib/getline.c: Likewise.
2009-12-31 BVK Chaitanya <bvk.groups@gmail.com>
* 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 <phcoder@gmail.com>
* loader/sparc64/ieee1275/linux.c (GRUB_MOD_INIT (linux)):

View file

@ -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@
@ -162,6 +167,8 @@ ifeq ($(platform), emu)
include $(srcdir)/conf/any-emu.mk
else
include $(srcdir)/conf/$(target_cpu)-$(platform).mk
# For tests.
include $(srcdir)/conf/tests.mk
# For external modules.
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
endif
@ -169,7 +176,7 @@ endif
### General targets.
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
cat $(DEFSYMFILES) /dev/null \
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
@ -187,12 +194,18 @@ partmap.lst: $(PARTMAPFILES)
handler.lst: $(HANDLERFILES)
cat $^ /dev/null | sort > $@
terminal.lst: $(TERMINALFILES)
cat $^ /dev/null | sort > $@
parttool.lst: $(PARTTOOLFILES)
cat $^ /dev/null | sort | uniq > $@
video.lst: $(VIDEOFILES)
cat $^ /dev/null | sort | uniq > $@
crypto.lst: lib/libgcrypt-grub/cipher/crypto.lst
cp $^ $@
ifneq (true, $(MAKEINFO))
info_INFOS += docs/grub.info
endif
@ -450,7 +463,26 @@ distcheck: dist
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
check:
check: all $(UNIT_TESTS) $(FUNCTIONAL_TESTS) $(SCRIPTED_TESTS)
@list="$(UNIT_TESTS)"; \
for file in $$list; do \
$(builddir)/$$file; \
done
@list="$(FUNCTIONAL_TESTS)"; \
for file in $$list; do \
mod=`basename $$file .mod`; \
echo "insmod functional_test; insmod $$mod; functional_test" \
| $(builddir)/grub-shell; \
done
@list="$(SCRIPTED_TESTS)"; \
for file in $$list; do \
echo "$$file:"; \
if $(builddir)/$$file; then \
echo "$$file: PASS"; \
else \
echo "$$file: FAIL"; \
fi; \
done
.SUFFIX:
.SUFFIX: .c .o .S .d

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -28,6 +28,7 @@
#include <grub/mm.h>
#include <grub/machine/memory.h>
#include <grub/memory.h>
#include <grub/i18n.h>
#ifdef GRUB_MACHINE_EFI
#include <grub/efi/efi.h>
@ -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}
};
@ -228,7 +229,7 @@ grub_acpi_create_ebda (void)
sizeof (struct grub_acpi_rsdp_v10)) == 0)
{
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10));
grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
v1inebda = target;
target += sizeof (struct grub_acpi_rsdp_v10);
target = (grub_uint8_t *) ((((long) target - 1) | 0xf) + 1);
@ -759,11 +760,11 @@ GRUB_MOD_INIT(acpi)
{
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi,
GRUB_COMMAND_FLAG_BOTH,
"[-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);
}

View file

@ -24,6 +24,7 @@
#include <grub/disk.h>
#include <grub/partition.h>
#include <grub/command.h>
#include <grub/i18n.h>
static grub_err_t
grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
@ -110,7 +111,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(blocklist)
{
cmd = grub_register_command ("blocklist", grub_cmd_blocklist,
"FILE", "Print a block list.");
N_("FILE"), N_("Print a block list."));
}
GRUB_MOD_FINI(blocklist)

View file

@ -23,6 +23,7 @@
#include <grub/loader.h>
#include <grub/kernel.h>
#include <grub/mm.h>
#include <grub/i18n.h>
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)

View file

@ -24,6 +24,7 @@
#include <grub/misc.h>
#include <grub/gzio.h>
#include <grub/command.h>
#include <grub/i18n.h>
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,
"FILE", "Show the contents of a file.");
N_("FILE"), N_("Show the contents of a file."));
}
GRUB_MOD_FINI(cat)

View file

@ -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 <grub/mm.h>
#include <grub/gzio.h>
#include <grub/command.h>
#include <grub/i18n.h>
#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,
"FILE1 FILE2", "Compare two files.");
N_("FILE1 FILE2"), N_("Compare two files."));
}
GRUB_MOD_FINI(cmp)

View file

@ -22,6 +22,7 @@
#include <grub/env.h>
#include <grub/normal.h>
#include <grub/command.h>
#include <grub/i18n.h>
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,
"FILE", "Load another config file.");
N_("FILE"), N_("Load another config file."));
cmd_source =
grub_register_command ("source", grub_cmd_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.")
);
}

View file

@ -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 <grub/misc.h>
#include <grub/lib/crc.h>
#include <grub/command.h>
#include <grub/i18n.h>
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,
"FILE",
"Calculate the crc32 checksum of a file.");
N_("FILE"),
N_("Calculate the crc32 checksum of a file."));
}
GRUB_MOD_FINI(crc)

View file

@ -22,6 +22,7 @@
#include <grub/misc.h>
#include <grub/datetime.h>
#include <grub/command.h>
#include <grub/i18n.h>
#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,
"[[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)

View file

@ -20,11 +20,12 @@
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
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,
"[-e|-n] STRING", "Display a line of text.",
N_("[-e|-n] STRING"), N_("Display a line of text."),
options);
}

View file

@ -22,6 +22,7 @@
#include <grub/file.h>
#include <grub/pci.h>
#include <grub/command.h>
#include <grub/i18n.h>
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."));
}

View file

@ -23,6 +23,7 @@
#include <grub/efi/efi.h>
#include <grub/pci.h>
#include <grub/command.h>
#include <grub/i18n.h>
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;
@ -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,
"BIOS_DUMP [INT10_DUMP]",
"Load bios dump.");
N_("Load BIOS dump."));
}
GRUB_MOD_FINI(loadbios)

View file

@ -27,6 +27,7 @@
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/fs.h>
#include <grub/i18n.h>
/* 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,
"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)

View file

@ -20,6 +20,7 @@
#include <grub/dl.h>
#include <grub/command.h>
#include <grub/misc.h>
#include <grub/i18n.h>
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)

View file

@ -23,12 +23,12 @@
#include <grub/term.h>
#include <grub/handler.h>
#include <grub/command.h>
#include <grub/i18n.h>
static grub_err_t
grub_cmd_handler (struct grub_command *cmd,
grub_cmd_handler (struct grub_command *cmd __attribute__ ((unused)),
int argc, char **args)
{
char *class_name;
void *curr_item = 0;
grub_handler_class_t head;
@ -43,23 +43,19 @@ grub_cmd_handler (struct grub_command *cmd,
return 0;
}
class_name = (grub_strcmp (cmd->name, "handler")) ? (char *) cmd->name : 0;
head = grub_handler_class_list;
if ((argc == 0) && (class_name == 0))
if (argc == 0)
{
grub_list_iterate (GRUB_AS_LIST (head), (grub_list_hook_t) list_item);
}
else
{
char *class_name;
grub_handler_class_t class;
if (class_name == 0)
{
class_name = args[0];
argc--;
args++;
}
class_name = args[0];
argc--;
args++;
class = grub_named_list_find (GRUB_AS_NAMED_LIST (head), class_name);
if (! class)
@ -89,27 +85,17 @@ grub_cmd_handler (struct grub_command *cmd,
return 0;
}
static grub_command_t cmd_handler, cmd_terminal_input, cmd_terminal_output;
static grub_command_t cmd_handler;
GRUB_MOD_INIT(handler)
{
cmd_handler =
grub_register_command ("handler", grub_cmd_handler,
"[class [handler]]",
"List or select a handler.");
cmd_terminal_input =
grub_register_command ("terminal_input", grub_cmd_handler,
"[handler]",
"List or select an input terminal.");
cmd_terminal_output =
grub_register_command ("terminal_output", grub_cmd_handler,
"[handler]",
"List or select an output terminal.");
N_("[class [handler]]"),
N_("List or select a handler."));
}
GRUB_MOD_FINI(handler)
{
grub_unregister_command (cmd_handler);
grub_unregister_command (cmd_terminal_input);
grub_unregister_command (cmd_terminal_output);
}

278
commands/hashsum.c Normal file
View file

@ -0,0 +1,278 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/dl.h>
#include <grub/extcmd.h>
#include <grub/file.h>
#include <grub/disk.h>
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/crypto.h>
#include <grub/normal.h>
static const struct grub_arg_option options[] = {
{"hash", 'h', 0, "Specify hash to use.", "HASH", ARG_TYPE_STRING},
{"check", 'c', 0, "Check hash list file.", "FILE", ARG_TYPE_STRING},
{"prefix", 'p', 0, "Base directory for hash list.", "DIRECTORY",
ARG_TYPE_STRING},
{"keep-going", 'k', 0, "Don't stop after first error.", 0, 0},
{0, 0, 0, 0, 0, 0}
};
struct { const char *name; const char *hashname; } aliases[] =
{
{"sha256sum", "sha256"},
{"sha512sum", "sha512"},
{"md5sum", "md5"},
};
static inline int
hextoval (char c)
{
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
return -1;
}
static grub_err_t
hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
{
grub_uint8_t context[hash->contextsize];
char *readbuf[4096];
grub_memset (context, 0, sizeof (context));
hash->init (context);
while (1)
{
grub_ssize_t r;
r = grub_file_read (file, readbuf, sizeof (readbuf));
if (r < 0)
return grub_errno;
if (r == 0)
break;
hash->write (context, readbuf, r);
}
hash->final (context);
grub_memcpy (result, hash->read (context), hash->mdlen);
return GRUB_ERR_NONE;
}
static grub_err_t
check_list (const gcry_md_spec_t *hash, const char *hashfilename,
const char *prefix, int keep)
{
grub_file_t hashlist, file;
char *buf = NULL;
grub_uint8_t expected[hash->mdlen];
grub_uint8_t actual[hash->mdlen];
grub_err_t err;
unsigned i;
unsigned unread = 0, mismatch = 0;
hashlist = grub_file_open (hashfilename);
if (!hashlist)
return grub_errno;
while (grub_free (buf), (buf = grub_file_getline (hashlist)))
{
const char *p = buf;
for (i = 0; i < hash->mdlen; i++)
{
int high, low;
high = hextoval (*p++);
low = hextoval (*p++);
if (high < 0 || low < 0)
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
expected[i] = (high << 4) | low;
}
if (*p++ != ' ' || *p++ != ' ')
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
if (prefix)
{
char *filename;
filename = grub_malloc (grub_strlen (prefix)
+ grub_strlen (p) + 2);
if (!filename)
return grub_errno;
grub_sprintf (filename, "%s/%s", prefix, p);
file = grub_file_open (filename);
grub_free (filename);
}
else
file = grub_file_open (p);
if (!file)
{
grub_file_close (hashlist);
grub_free (buf);
return grub_errno;
}
err = hash_file (file, hash, actual);
grub_file_close (file);
if (err)
{
grub_printf ("%s: READ ERROR\n", p);
if (!keep)
{
grub_file_close (hashlist);
grub_free (buf);
return err;
}
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
unread++;
continue;
}
if (grub_crypto_memcmp (expected, actual, hash->mdlen) != 0)
{
grub_printf ("%s: HASH MISMATCH\n", p);
if (!keep)
{
grub_file_close (hashlist);
grub_free (buf);
return grub_error (GRUB_ERR_TEST_FAILURE,
"hash of '%s' mismatches", p);
}
mismatch++;
continue;
}
grub_printf ("%s: OK\n", p);
}
if (mismatch || unread)
return grub_error (GRUB_ERR_TEST_FAILURE,
"%d files couldn't be read and hash "
"of %d files mismatches", unread, mismatch);
return GRUB_ERR_NONE;
}
static grub_err_t
grub_cmd_hashsum (struct grub_extcmd *cmd,
int argc, char **args)
{
struct grub_arg_list *state = cmd->state;
const char *hashname = NULL;
const char *prefix = NULL;
const gcry_md_spec_t *hash;
unsigned i;
int keep = state[3].set;
unsigned unread = 0;
for (i = 0; i < ARRAY_SIZE (aliases); i++)
if (grub_strcmp (cmd->cmd->name, aliases[i].name) == 0)
hashname = aliases[i].hashname;
if (state[0].set)
hashname = state[0].arg;
if (!hashname)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no hash specified");
hash = grub_crypto_lookup_md_by_name (hashname);
if (!hash)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown hash");
if (state[2].set)
prefix = state[2].arg;
if (state[1].set)
{
if (argc != 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"--check is incompatible with file list");
return check_list (hash, state[1].arg, prefix, keep);
}
for (i = 0; i < (unsigned) argc; i++)
{
grub_uint8_t result[hash->mdlen];
grub_file_t file;
grub_err_t err;
unsigned j;
file = grub_file_open (args[i]);
if (!file)
{
if (!keep)
return grub_errno;
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
unread++;
continue;
}
err = hash_file (file, hash, result);
grub_file_close (file);
if (err)
{
if (!keep)
return err;
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
unread++;
continue;
}
for (j = 0; j < hash->mdlen; j++)
grub_printf ("%02x", result[j]);
grub_printf (" %s\n", args[i]);
}
if (unread)
return grub_error (GRUB_ERR_TEST_FAILURE, "%d files couldn't be read.",
unread);
return GRUB_ERR_NONE;
}
static grub_extcmd_t cmd, cmd_md5, cmd_sha256, cmd_sha512;
GRUB_MOD_INIT(hashsum)
{
cmd = grub_register_extcmd ("hashsum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
"hashsum -h HASH [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]",
"Compute or check hash checksum.",
options);
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
"md5sum [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]",
"Compute or check hash checksum.",
options);
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
"sha256sum [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]",
"Compute or check hash checksum.",
options);
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
"sha512sum [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]",
"Compute or check hash checksum.",
options);
}
GRUB_MOD_FINI(hashsum)
{
grub_unregister_extcmd (cmd);
grub_unregister_extcmd (cmd_md5);
grub_unregister_extcmd (cmd_sha256);
grub_unregister_extcmd (cmd_sha512);
}

View file

@ -24,29 +24,30 @@
#include <grub/mm.h>
#include <grub/lib/hexdump.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
static const struct grub_arg_option options[] = {
{"apm", 'B', 0, "Set Advanced Power Management\n"
"(1=low, ..., 254=high, 255=off).",
{"apm", 'B', 0, 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,
"[OPTIONS] DISK",
"Get/set ATA disk parameters.", options);
N_("[OPTIONS] DISK"),
N_("Get/set ATA disk parameters."), options);
}
GRUB_MOD_FINI(hdparm)

View file

@ -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
@ -22,6 +22,9 @@
#include <grub/term.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
#include <grub/mm.h>
#include <grub/normal.h>
#include <grub/charset.h>
static grub_err_t
grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
@ -38,19 +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))
{
char description[GRUB_TERM_WIDTH / 2];
const char* summary_translated = _(cmd->summary);
int desclen = grub_strlen (summary_translated);
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, ' ', GRUB_TERM_WIDTH / 2 - 1);
description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
grub_memcpy (description, summary_translated,
(desclen < GRUB_TERM_WIDTH / 2 - 1
? desclen : GRUB_TERM_WIDTH / 2 - 1));
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_printf ("%s%s", description, (cnt++) % 2 ? "\n" : " ");
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)
grub_printf ("\n");
cnt++;
grub_free (command_help);
grub_free (unicode_command_help);
}
return 0;
}
@ -75,7 +110,11 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
}
if (argc == 0)
grub_command_iterate (print_command_info);
{
grub_command_iterate (print_command_info);
if (!(cnt % 2))
grub_printf ("\n");
}
else
{
int i;

View file

@ -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 <grub/gzio.h>
#include <grub/lib/hexdump.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
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,
"[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);
}

View file

@ -25,6 +25,7 @@
#include <grub/command.h>
#include <grub/extcmd.h>
#include <grub/i386/cpuid.h>
#include <grub/i18n.h>
#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,
"[-l]", "Check for CPU features.", options);
"[-l]", N_("Check for CPU features."), options);
}
GRUB_MOD_FINI(cpuid)

View file

@ -26,6 +26,7 @@
#include <grub/env.h>
#include <grub/machine/memory.h>
#include <grub/machine/biosnum.h>
#include <grub/i18n.h>
/* 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}
};
@ -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,

View file

@ -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 <grub/dl.h>
#include <grub/misc.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
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}
};
@ -47,7 +48,7 @@ GRUB_MOD_INIT(halt)
{
cmd = grub_register_extcmd ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
"[-n]",
"Halt the system, if possible using APM.",
N_("Halt the system, if possible using APM."),
options);
}

View file

@ -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

View file

@ -22,6 +22,7 @@
#include <grub/misc.h>
#include <grub/machine/pxe.h>
#include <grub/command.h>
#include <grub/i18n.h>
static grub_err_t
grub_cmd_pxe_unload (grub_command_t cmd __attribute__ ((unused)),
@ -42,7 +43,7 @@ GRUB_MOD_INIT(pxecmd)
{
cmd = grub_register_command ("pxe_unload", grub_cmd_pxe_unload,
0,
"Unload PXE environment.");
N_("Unload PXE environment."));
}
GRUB_MOD_FINI(pxecmd)

View file

@ -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 <grub/machine/vbe.h>
#include <grub/mm.h>
#include <grub/command.h>
#include <grub/i18n.h>
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)

View file

@ -25,6 +25,7 @@
#include <grub/machine/init.h>
#include <grub/machine/vbe.h>
#include <grub/err.h>
#include <grub/i18n.h>
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)

View file

@ -22,6 +22,7 @@
#include <grub/term.h>
#include <grub/ieee1275/ieee1275.h>
#include <grub/command.h>
#include <grub/i18n.h>
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)

View file

@ -21,12 +21,13 @@
#include <grub/misc.h>
#include <grub/extcmd.h>
#include <grub/term.h>
#include <grub/i18n.h>
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}
};
@ -48,13 +49,24 @@ grub_cmd_keystatus (grub_extcmd_t cmd,
if (state[2].set)
expect_mods |= GRUB_TERM_STATUS_ALT;
grub_dprintf ("keystatus", "expect_mods: %d\n", expect_mods);
/* Without arguments, just check whether getkeystatus is supported at
all. */
if (!grub_cur_term_input->getkeystatus)
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
grub_dprintf ("keystatus", "expect_mods: %d\n", expect_mods);
if (!expect_mods)
return 0;
if (expect_mods == 0)
{
grub_term_input_t term;
int nterms = 0;
FOR_ACTIVE_TERM_INPUTS (term)
if (!term->getkeystatus)
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
else
nterms++;
if (!nterms)
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
return 0;
}
mods = grub_getkeystatus ();
grub_dprintf ("keystatus", "mods: %d\n", mods);
@ -70,8 +82,8 @@ GRUB_MOD_INIT(keystatus)
{
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus,
GRUB_COMMAND_FLAG_BOTH,
"[--shift] [--ctrl] [--alt]",
"Check key modifier status.",
N_("[--shift] [--ctrl] [--alt]"),
N_("Check key modifier status."),
options);
}

View file

@ -26,10 +26,11 @@
#include <grub/partition.h>
#include <grub/lib/envblk.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
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}
};
@ -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,
"[-f FILE] variable_name [...]",
"Save variables to environment block file.",
N_("[-f FILE] variable_name [...]"),
N_("Save variables to environment block file."),
options);
}

View file

@ -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 <grub/normal.h>
#include <grub/extcmd.h>
#include <grub/datetime.h>
#include <grub/i18n.h>
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,
"[-l|-h|-a] [FILE]",
"List devices and files.", options);
N_("[-l|-h|-a] [FILE]"),
N_("List devices and files."), options);
}
GRUB_MOD_FINI(ls)

View file

@ -20,6 +20,7 @@
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/command.h>
#include <grub/i18n.h>
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)

View file

@ -21,6 +21,7 @@
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
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,
"[-i]", "List PCI devices.", options);
"[-i]", N_("List PCI devices."), options);
}
GRUB_MOD_FINI(lspci)

View file

@ -21,13 +21,14 @@
#include <grub/misc.h>
#include <grub/extcmd.h>
#include <grub/env.h>
#include <grub/i18n.h>
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}
};
@ -119,22 +120,22 @@ GRUB_MOD_INIT(memrw)
{
cmd_read_byte =
grub_register_extcmd ("read_byte", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"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,
"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,
"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,
"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,
"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,
"ADDR VALUE [MASK]", "Write dword VALUE to ADDR.");
N_("ADDR VALUE [MASK]"), N_("Write dword VALUE to ADDR."));
}
GRUB_MOD_FINI(memrw)

View file

@ -27,6 +27,7 @@
#include <grub/term.h>
#include <grub/loader.h>
#include <grub/command.h>
#include <grub/i18n.h>
/* cat FILE */
static grub_err_t
@ -354,28 +355,28 @@ GRUB_MOD_INIT(minicmd)
{
cmd_cat =
grub_register_command ("cat", grub_mini_cmd_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,
"[DEVICE]", "Set the root device.");
N_("[DEVICE]"), N_("Set the root device."));
cmd_dump =
grub_register_command ("dump", grub_mini_cmd_dump,
"ADDR", "Dump memory.");
N_("ADDR"), N_("Dump memory."));
cmd_rmmod =
grub_register_command ("rmmod", grub_mini_cmd_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)

View file

@ -29,6 +29,7 @@
#include <grub/partition.h>
#include <grub/parttool.h>
#include <grub/command.h>
#include <grub/i18n.h>
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,
"PARTITION COMMANDS",
N_("PARTITION COMMANDS"),
helpmsg);
}

View file

@ -17,27 +17,22 @@
*/
#include <grub/auth.h>
#include <grub/crypto.h>
#include <grub/list.h>
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/env.h>
#include <grub/normal.h>
#include <grub/dl.h>
#include <grub/i18n.h>
static grub_dl_t my_mod;
static grub_err_t
check_password (const char *user,
check_password (const char *user, const char *entered,
void *password)
{
char entered[1024];
grub_memset (entered, 0, sizeof (entered));
if (!GRUB_GET_PASSWORD (entered, sizeof (entered) - 1))
return GRUB_ACCESS_DENIED;
if (grub_auth_strcmp (entered, password) != 0)
if (grub_crypto_memcmp (entered, password, GRUB_AUTH_MAX_PASSLEN) != 0)
return GRUB_ACCESS_DENIED;
grub_auth_authenticate (user);
@ -51,13 +46,18 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
{
grub_err_t err;
char *pass;
int copylen;
if (argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments expected");
pass = grub_strdup (args[1]);
pass = grub_zalloc (GRUB_AUTH_MAX_PASSLEN);
if (!pass)
return grub_errno;
copylen = grub_strlen (args[1]);
if (copylen >= GRUB_AUTH_MAX_PASSLEN)
copylen = GRUB_AUTH_MAX_PASSLEN - 1;
grub_memcpy (pass, args[1], copylen);
err = grub_auth_register_authentication (args[0], check_password, pass);
if (err)
@ -75,9 +75,9 @@ GRUB_MOD_INIT(password)
{
my_mod = mod;
cmd = grub_register_command ("password", grub_cmd_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)

196
commands/password_pbkdf2.c Normal file
View file

@ -0,0 +1,196 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/auth.h>
#include <grub/crypto.h>
#include <grub/list.h>
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/env.h>
#include <grub/normal.h>
#include <grub/dl.h>
static grub_dl_t my_mod;
struct pbkdf2_password
{
grub_uint8_t *salt;
grub_size_t saltlen;
unsigned int c;
grub_uint8_t *expected;
grub_size_t buflen;
};
static grub_err_t
check_password (const char *user, const char *entered, void *pin)
{
grub_uint8_t *buf;
struct pbkdf2_password *pass = pin;
gcry_err_code_t err;
buf = grub_malloc (pass->buflen);
if (!buf)
return grub_crypto_gcry_error (GPG_ERR_OUT_OF_MEMORY);
err = grub_crypto_pbkdf2 (GRUB_MD_SHA512, (grub_uint8_t *) entered,
grub_strlen (entered),
pass->salt, pass->saltlen, pass->c,
buf, pass->buflen);
if (err)
{
grub_free (buf);
return grub_crypto_gcry_error (err);
}
if (grub_crypto_memcmp (buf, pass->expected, pass->buflen) != 0)
return GRUB_ACCESS_DENIED;
grub_auth_authenticate (user);
return GRUB_ERR_NONE;
}
static inline int
hex2val (char hex)
{
if ('0' <= hex && hex <= '9')
return hex - '0';
if ('a' <= hex && hex <= 'f')
return hex - 'a' + 10;
if ('A' <= hex && hex <= 'F')
return hex - 'A' + 10;
return -1;
}
static grub_err_t
grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
grub_err_t err;
char *ptr, *ptr2;
grub_uint8_t *ptro;
struct pbkdf2_password *pass;
if (argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Two arguments expected.");
if (grub_memcmp (args[1], "grub.pbkdf2.sha512.",
sizeof ("grub.pbkdf2.sha512.") - 1) != 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
ptr = args[1] + sizeof ("grub.pbkdf2.sha512.") - 1;
pass = grub_malloc (sizeof (*pass));
if (!pass)
return grub_errno;
pass->c = grub_strtoul (ptr, &ptr, 0);
if (*ptr != '.')
{
grub_free (pass);
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
}
ptr++;
ptr2 = grub_strchr (ptr, '.');
if (!ptr2 || ((ptr2 - ptr) & 1) || grub_strlen (ptr2 + 1) & 1)
{
grub_free (pass);
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
}
pass->saltlen = (ptr2 - ptr) >> 1;
pass->buflen = grub_strlen (ptr2 + 1) >> 1;
ptro = pass->salt = grub_malloc (pass->saltlen);
if (!ptro)
{
grub_free (pass);
return grub_errno;
}
while (ptr < ptr2)
{
int hex1, hex2;
hex1 = hex2val (*ptr);
ptr++;
hex2 = hex2val (*ptr);
ptr++;
if (hex1 < 0 || hex2 < 0)
{
grub_free (pass->salt);
grub_free (pass);
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"Incorrect PBKDF2 password.");
}
*ptro = (hex1 << 4) | hex2;
ptro++;
}
ptro = pass->expected = grub_malloc (pass->buflen);
if (!ptro)
{
grub_free (pass->salt);
grub_free (pass);
return grub_errno;
}
ptr = ptr2 + 1;
ptr2 += grub_strlen (ptr2);
while (ptr < ptr2)
{
int hex1, hex2;
hex1 = hex2val (*ptr);
ptr++;
hex2 = hex2val (*ptr);
ptr++;
if (hex1 < 0 || hex2 < 0)
{
grub_free (pass->expected);
grub_free (pass->salt);
grub_free (pass);
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"Incorrect PBKDF2 password.");
}
*ptro = (hex1 << 4) | hex2;
ptro++;
}
err = grub_auth_register_authentication (args[0], check_password, pass);
if (err)
{
grub_free (pass);
return err;
}
grub_dl_ref (my_mod);
return GRUB_ERR_NONE;
}
static grub_command_t cmd;
GRUB_MOD_INIT(password_pbkdf2)
{
my_mod = mod;
cmd = grub_register_command ("password_pbkdf2", grub_cmd_password,
"password_pbkdf2 USER PBKDF2_PASSWORD",
"Set user password (PBKDF2). ");
}
GRUB_MOD_FINI(password_pbkdf2)
{
grub_unregister_command (cmd);
}

View file

@ -30,16 +30,17 @@
#include <grub/misc.h>
#include <grub/env.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
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,
"[DEVICE]",
"Retrieve device info.", options);
N_("[DEVICE]"),
N_("Retrieve device info."), options);
}
GRUB_MOD_FINI (probe)

View file

@ -24,6 +24,7 @@
#include <grub/term.h>
#include <grub/types.h>
#include <grub/command.h>
#include <grub/i18n.h>
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,
"[ENVVAR]",
"Set variable with user input.");
N_("[ENVVAR]"),
N_("Set variable with user input."));
}
GRUB_MOD_FINI(read)

View file

@ -20,6 +20,7 @@
#include <grub/dl.h>
#include <grub/command.h>
#include <grub/misc.h>
#include <grub/i18n.h>
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)

View file

@ -165,10 +165,8 @@ GRUB_MOD_INIT(search_fs_label)
{
cmd =
grub_register_command (COMMAND_NAME, grub_cmd_do_search,
"NAME [VARIABLE]",
"Search devices by " SEARCH_TARGET "."
" If VARIABLE is specified, "
"the first device found is set to a variable.");
N_("NAME [VARIABLE]"),
HELP_MESSAGE);
}
#ifdef DO_SEARCH_FILE

View file

@ -2,4 +2,5 @@
#define FUNC_NAME grub_search_fs_file
#define COMMAND_NAME "search.file"
#define SEARCH_TARGET "file"
#define HELP_MESSAGE N_("Search devices by file. If VARIABLE is specified, the first device found is set to a variable.")
#include "search.c"

View file

@ -2,4 +2,5 @@
#define FUNC_NAME grub_search_label
#define COMMAND_NAME "search.fs_label"
#define SEARCH_TARGET "filesystem label"
#define HELP_MESSAGE N_("Search devices by label. If VARIABLE is specified, the first device found is set to a variable.")
#include "search.c"

View file

@ -2,4 +2,5 @@
#define FUNC_NAME grub_search_fs_uuid
#define COMMAND_NAME "search.fs_uuid"
#define SEARCH_TARGET "filesystem UUID"
#define HELP_MESSAGE N_("Search devices by UUID. If VARIABLE is specified, the first device found is set to a variable.")
#include "search.c"

View file

@ -24,20 +24,21 @@
#include <grub/misc.h>
#include <grub/machine/time.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
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}
};
static grub_uint8_t x, y;
static grub_uint16_t *pos;
static void
do_print (int n)
{
grub_gotoxy (x, y);
grub_term_restore_pos (pos);
/* NOTE: Do not remove the trailing space characters.
They are required to clear the line. */
grub_printf ("%d ", n);
@ -63,7 +64,6 @@ static grub_err_t
grub_cmd_sleep (grub_extcmd_t cmd, int argc, char **args)
{
struct grub_arg_list *state = cmd->state;
grub_uint16_t xy;
int n;
if (argc != 1)
@ -77,9 +77,7 @@ grub_cmd_sleep (grub_extcmd_t cmd, int argc, char **args)
return 0;
}
xy = grub_getxy ();
x = xy >> 8;
y = xy & 0xff;
pos = grub_term_save_pos ();
for (; n; n--)
{
@ -105,8 +103,8 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(sleep)
{
cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
"NUMBER_OF_SECONDS",
"Wait for a specified number of seconds.",
N_("NUMBER_OF_SECONDS"),
N_("Wait for a specified number of seconds."),
options);
}

364
commands/terminal.c Normal file
View file

@ -0,0 +1,364 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/mm.h>
#include <grub/dl.h>
#include <grub/command.h>
#include <grub/term.h>
#include <grub/i18n.h>
#include <grub/misc.h>
struct grub_term_autoload *grub_term_input_autoload = NULL;
struct grub_term_autoload *grub_term_output_autoload = NULL;
static grub_err_t
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
int i;
grub_term_input_t term;
struct grub_term_autoload *aut;
if (argc == 0)
{
grub_puts_ (N_ ("Active input terminals:"));
FOR_ACTIVE_TERM_INPUTS(term)
grub_printf ("%s ", term->name);
grub_printf ("\n");
grub_puts_ (N_ ("Available input terminals:"));
FOR_DISABLED_TERM_INPUTS(term)
grub_printf ("%s ", term->name);
/* This is quadratic but we don't expect mode than 30 terminal
modules ever. */
for (aut = grub_term_input_autoload; aut; aut = aut->next)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
FOR_ACTIVE_TERM_INPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
grub_printf ("%s ", aut->name);
}
grub_printf ("\n");
return GRUB_ERR_NONE;
}
i = 0;
if (grub_strcmp (args[0], "--append") == 0
|| grub_strcmp (args[0], "--remove") == 0)
i++;
if (i == argc)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
for (; i < argc; i++)
{
int again = 0;
while (1)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term == 0)
FOR_ACTIVE_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
break;
if (again)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
for (aut = grub_term_input_autoload; aut; aut = aut->next)
if (grub_strcmp (args[i], aut->name) == 0)
{
grub_dl_t mod;
mod = grub_dl_load (aut->modname);
if (mod)
grub_dl_ref (mod);
grub_errno = GRUB_ERR_NONE;
break;
}
if (!aut)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
again = 1;
}
}
if (grub_strcmp (args[0], "--append") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
GRUB_AS_LIST (term));
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
if (grub_strcmp (args[0], "--remove") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_ACTIVE_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (!term->next && term == grub_term_inputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
for (i = 0; i < argc; i++)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
GRUB_AS_LIST (term));
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
GRUB_AS_LIST (term));
}
}
FOR_ACTIVE_TERM_INPUTS(term)
{
for (i = 0; i < argc; i++)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (i == argc)
{
if (!term->next && term == grub_term_inputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
static grub_err_t
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
int i;
grub_term_output_t term;
struct grub_term_autoload *aut;
if (argc == 0)
{
grub_puts_ (N_ ("Active output terminals:"));
FOR_ACTIVE_TERM_OUTPUTS(term)
grub_printf ("%s ", term->name);
grub_printf ("\n");
grub_puts_ (N_ ("Available output terminals:"));
FOR_DISABLED_TERM_OUTPUTS(term)
grub_printf ("%s ", term->name);
/* This is quadratic but we don't expect mode than 30 terminal
modules ever. */
for (aut = grub_term_output_autoload; aut; aut = aut->next)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
FOR_ACTIVE_TERM_OUTPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
grub_printf ("%s ", aut->name);
}
grub_printf ("\n");
return GRUB_ERR_NONE;
}
i = 0;
if (grub_strcmp (args[0], "--append") == 0
|| grub_strcmp (args[0], "--remove") == 0)
i++;
if (i == argc)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
for (; i < argc; i++)
{
int again = 0;
while (1)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term == 0)
FOR_ACTIVE_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
break;
if (again)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
for (aut = grub_term_output_autoload; aut; aut = aut->next)
if (grub_strcmp (args[i], aut->name) == 0)
{
grub_dl_t mod;
mod = grub_dl_load (aut->modname);
if (mod)
grub_dl_ref (mod);
grub_errno = GRUB_ERR_NONE;
break;
}
if (!aut)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
again = 1;
}
}
if (grub_strcmp (args[0], "--append") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
GRUB_AS_LIST (term));
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
if (grub_strcmp (args[0], "--remove") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_ACTIVE_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (!term->next && term == grub_term_outputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
for (i = 0; i < argc; i++)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
GRUB_AS_LIST (term));
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
GRUB_AS_LIST (term));
}
}
FOR_ACTIVE_TERM_OUTPUTS(term)
{
for (i = 0; i < argc; i++)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (i == argc)
{
if (!term->next && term == grub_term_outputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
static grub_command_t cmd_terminal_input, cmd_terminal_output;
GRUB_MOD_INIT(terminal)
{
cmd_terminal_input =
grub_register_command ("terminal_input", grub_cmd_terminal_input,
"[--append|--remove] "
"[TERMINAL1] [TERMINAL2] ...",
"List or select an input terminal.");
cmd_terminal_output =
grub_register_command ("terminal_output", grub_cmd_terminal_output,
"[--append|--remove] "
"[TERMINAL1] [TERMINAL2] ...",
"List or select an output terminal.");
}
GRUB_MOD_FINI(terminal)
{
grub_unregister_command (cmd_terminal_input);
grub_unregister_command (cmd_terminal_output);
}

View file

@ -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 <grub/device.h>
#include <grub/file.h>
#include <grub/command.h>
#include <grub/i18n.h>
/* 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,
"EXPRESSION", "Evaluate an expression.");
N_("EXPRESSION"), N_("Evaluate an expression."));
}
GRUB_MOD_FINI(test)

View file

@ -19,6 +19,7 @@
#include <grub/dl.h>
#include <grub/command.h>
#include <grub/i18n.h>
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)

View file

@ -25,6 +25,7 @@
#include <grub/dl.h>
#include <grub/usb.h>
#include <grub/command.h>
#include <grub/i18n.h>
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)

View file

@ -24,6 +24,7 @@
#include <grub/font.h>
#include <grub/term.h>
#include <grub/command.h>
#include <grub/i18n.h>
static grub_err_t
grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
@ -178,7 +179,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)

View file

@ -31,12 +31,8 @@
#include <grub/misc.h>
#include <grub/env.h>
#include <grub/command.h>
struct tohash
{
grub_uint8_t prefix[16];
grub_uint64_t serial;
} __attribute__ ((packed));
#include <grub/i18n.h>
#include <grub/crypto.h>
/* This prefix is used by xnu and boot-132 to hash
together with volume serial. */
@ -44,311 +40,27 @@ static grub_uint8_t hash_prefix[16]
= {0xB3, 0xE2, 0x0F, 0x39, 0xF2, 0x92, 0x11, 0xD6,
0x97, 0xA4, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC};
#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
#define ror(x,n) ( ((x) >> (n)) | ((x) << (32-(n))) )
typedef struct {
grub_uint32_t A,B,C,D; /* chaining variables */
grub_uint32_t nblocks;
grub_uint8_t buf[64];
int count;
} MD5_CONTEXT;
static void
md5_init( void *context )
{
MD5_CONTEXT *ctx = context;
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
ctx->C = 0x98badcfe;
ctx->D = 0x10325476;
ctx->nblocks = 0;
ctx->count = 0;
}
/* These are the four functions used in the four steps of the MD5 algorithm
and defined in the RFC 1321. The first function is a little bit optimized
(as found in Colin Plumbs public domain implementation). */
/* #define FF(b, c, d) ((b & c) | (~b & d)) */
#define FF(b, c, d) (d ^ (b & (c ^ d)))
#define FG(b, c, d) FF (d, b, c)
#define FH(b, c, d) (b ^ c ^ d)
#define FI(b, c, d) (c ^ (b | ~d))
/****************
* transform n*64 grub_uint8_ts
*/
static void
transform ( MD5_CONTEXT *ctx, const unsigned char *data )
{
grub_uint32_t correct_words[16];
register grub_uint32_t A = ctx->A;
register grub_uint32_t B = ctx->B;
register grub_uint32_t C = ctx->C;
register grub_uint32_t D = ctx->D;
grub_uint32_t *cwp = correct_words;
#ifdef GRUB_CPU_WORDS_BIGENDIAN
{
int i;
const grub_uint32_t *p = (const grub_uint32_t *) data;
for (i = 0; i < 16; i++)
correct_words[i] = grub_le_to_cpu32 (p[i]);
}
#else
grub_memcpy (correct_words, data, 64);
#endif
#define OP(a, b, c, d, s, T) \
do \
{ \
a += FF (b, c, d) + (*cwp++) + T; \
a = rol(a, s); \
a += b; \
} \
while (0)
/* Before we start, one word about the strange constants.
They are defined in RFC 1321 as
T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
*/
/* Round 1. */
OP (A, B, C, D, 7, 0xd76aa478);
OP (D, A, B, C, 12, 0xe8c7b756);
OP (C, D, A, B, 17, 0x242070db);
OP (B, C, D, A, 22, 0xc1bdceee);
OP (A, B, C, D, 7, 0xf57c0faf);
OP (D, A, B, C, 12, 0x4787c62a);
OP (C, D, A, B, 17, 0xa8304613);
OP (B, C, D, A, 22, 0xfd469501);
OP (A, B, C, D, 7, 0x698098d8);
OP (D, A, B, C, 12, 0x8b44f7af);
OP (C, D, A, B, 17, 0xffff5bb1);
OP (B, C, D, A, 22, 0x895cd7be);
OP (A, B, C, D, 7, 0x6b901122);
OP (D, A, B, C, 12, 0xfd987193);
OP (C, D, A, B, 17, 0xa679438e);
OP (B, C, D, A, 22, 0x49b40821);
#undef OP
#define OP(f, a, b, c, d, k, s, T) \
do \
{ \
a += f (b, c, d) + correct_words[k] + T; \
a = rol(a, s); \
a += b; \
} \
while (0)
/* Round 2. */
OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
OP (FG, D, A, B, C, 6, 9, 0xc040b340);
OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
OP (FG, D, A, B, C, 10, 9, 0x02441453);
OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
/* Round 3. */
OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
OP (FH, D, A, B, C, 8, 11, 0x8771f681);
OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
OP (FH, B, C, D, A, 6, 23, 0x04881d05);
OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
/* Round 4. */
OP (FI, A, B, C, D, 0, 6, 0xf4292244);
OP (FI, D, A, B, C, 7, 10, 0x432aff97);
OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
OP (FI, C, D, A, B, 6, 15, 0xa3014314);
OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
/* Put checksum in context given as argument. */
ctx->A += A;
ctx->B += B;
ctx->C += C;
ctx->D += D;
}
/* The routine updates the message-digest context to
* account for the presence of each of the characters inBuf[0..inLen-1]
* in the message whose digest is being computed.
*/
static void
md5_write( void *context, const void *inbuf_arg , grub_size_t inlen)
{
const unsigned char *inbuf = inbuf_arg;
MD5_CONTEXT *hd = context;
if( hd->count == 64 ) /* flush the buffer */
{
transform( hd, hd->buf );
// _gcry_burn_stack (80+6*sizeof(void*));
hd->count = 0;
hd->nblocks++;
}
if( !inbuf )
return;
if( hd->count )
{
for( ; inlen && hd->count < 64; inlen-- )
hd->buf[hd->count++] = *inbuf++;
md5_write( hd, NULL, 0 );
if( !inlen )
return;
}
// _gcry_burn_stack (80+6*sizeof(void*));
while( inlen >= 64 )
{
transform( hd, inbuf );
hd->count = 0;
hd->nblocks++;
inlen -= 64;
inbuf += 64;
}
for( ; inlen && hd->count < 64; inlen-- )
hd->buf[hd->count++] = *inbuf++;
}
/* The routine final terminates the message-digest computation and
* ends with the desired message digest in mdContext->digest[0...15].
* The handle is prepared for a new MD5 cycle.
* Returns 16 grub_uint8_ts representing the digest.
*/
static void
md5_final( void *context)
{
MD5_CONTEXT *hd = context;
grub_uint32_t t, msb, lsb;
grub_uint32_t *p;
md5_write(hd, NULL, 0); /* flush */;
t = hd->nblocks;
/* multiply by 64 to make a grub_uint8_t count */
lsb = t << 6;
msb = t >> 26;
/* add the count */
t = lsb;
if( (lsb += hd->count) < t )
msb++;
/* multiply by 8 to make a bit count */
t = lsb;
lsb <<= 3;
msb <<= 3;
msb |= t >> 29;
if( hd->count < 56 ) /* enough room */
{
hd->buf[hd->count++] = 0x80; /* pad */
while( hd->count < 56 )
hd->buf[hd->count++] = 0; /* pad */
}
else /* need one extra block */
{
hd->buf[hd->count++] = 0x80; /* pad character */
while( hd->count < 64 )
hd->buf[hd->count++] = 0;
md5_write(hd, NULL, 0); /* flush */;
grub_memset(hd->buf, 0, 56 ); /* fill next block with zeroes */
}
/* append the 64 bit count */
hd->buf[56] = lsb ;
hd->buf[57] = lsb >> 8;
hd->buf[58] = lsb >> 16;
hd->buf[59] = lsb >> 24;
hd->buf[60] = msb ;
hd->buf[61] = msb >> 8;
hd->buf[62] = msb >> 16;
hd->buf[63] = msb >> 24;
transform( hd, hd->buf );
// _gcry_burn_stack (80+6*sizeof(void*));
p = (grub_uint32_t *) hd->buf;
#define X(a) do { *p = grub_le_to_cpu32 (hd->a); p++; } while (0)
X(A);
X(B);
X(C);
X(D);
#undef X
}
/**
* GRUB2 Crypto Interface
* Written by Michael Gorven
*/
static grub_err_t
md5 (const char *in, grub_size_t insize, char *out)
{
MD5_CONTEXT hd;
md5_init (&hd);
md5_write (&hd, in, insize);
md5_final (&hd);
grub_memcpy (out, hd.buf, 16);
return GRUB_ERR_NONE;
}
static grub_err_t
grub_cmd_xnu_uuid (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
struct tohash hashme;
grub_uint8_t xnu_uuid[16];
grub_uint64_t serial;
grub_uint8_t *xnu_uuid;
char uuid_string[sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")];
char *ptr;
grub_uint8_t ctx[GRUB_MD_MD5->contextsize];
if (argc < 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "UUID required");
hashme.serial = grub_cpu_to_be64 (grub_strtoull (args[0], 0, 16));
grub_memcpy (hashme.prefix, hash_prefix, sizeof (hashme.prefix));
serial = grub_cpu_to_be64 (grub_strtoull (args[0], 0, 16));
GRUB_MD_MD5->init (&ctx);
GRUB_MD_MD5->write (&ctx, hash_prefix, sizeof (hash_prefix));
GRUB_MD_MD5->write (&ctx, &serial, sizeof (serial));
GRUB_MD_MD5->final (&ctx);
xnu_uuid = GRUB_MD_MD5->read (&ctx);
md5 ((char *) &hashme, sizeof (hashme), (char *) xnu_uuid);
grub_sprintf (uuid_string,
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
(unsigned int) xnu_uuid[0], (unsigned int) xnu_uuid[1],
@ -377,9 +89,9 @@ static grub_command_t cmd;
GRUB_MOD_INIT (xnu_uuid)
{
cmd = grub_register_command ("xnu_uuid", grub_cmd_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)

View file

@ -23,13 +23,14 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/reader.c kern/term.c \
kern/partition.c kern/term.c \
kern/rescue_reader.c kern/rescue_parser.c \
lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
normal/handler.c normal/auth.c normal/autofs.c \
normal/handler.c normal/auth.c lib/crypto.c normal/autofs.c \
normal/completion.c normal/main.c normal/color.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/menu_text.c \
normal/menu.c normal/menu_entry.c \
normal/menu_text.c normal/crypto.c normal/term.c \
commands/terminal.c lib/charset.c \
script/main.c script/execute.c script/function.c \
script/lexer.c script/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
@ -47,7 +48,10 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
lib/libgcrypt-grub/cipher/md5.c \
grub_emu_init.c gnulib/progname.c
grub_emu_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap
ifeq ($(target_cpu), i386)
grub_emu_SOURCES += commands/i386/cpuid.c

View file

@ -563,8 +563,8 @@ keystatus_mod_LDFLAGS = $(COMMON_LDFLAGS)
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
normal/auth.c normal/autofs.c normal/handler.c \
normal/color.c normal/completion.c normal/datetime.c normal/menu.c \
normal/menu_entry.c normal/menu_text.c normal/menu_viewer.c \
normal/misc.c
normal/menu_entry.c normal/menu_text.c \
normal/misc.c normal/crypto.c normal/term.c
normal_mod_CFLAGS = $(COMMON_CFLAGS)
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -664,3 +664,35 @@ pkglib_MODULES += charset.mod
charset_mod_SOURCES = lib/charset.c
charset_mod_CFLAGS = $(COMMON_CFLAGS)
charset_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += terminal.mod
terminal_mod_SOURCES = commands/terminal.c
terminal_mod_CFLAGS = $(COMMON_CFLAGS)
terminal_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += crypto.mod
crypto_mod_SOURCES = lib/crypto.c
crypto_mod_CFLAGS = $(COMMON_CFLAGS)
crypto_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += hashsum.mod
hashsum_mod_SOURCES = commands/hashsum.c
hashsum_mod_CFLAGS = $(COMMON_CFLAGS)
hashsum_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += pbkdf2.mod
pbkdf2_mod_SOURCES = lib/pbkdf2.c
pbkdf2_mod_CFLAGS = $(COMMON_CFLAGS)
pbkdf2_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For password_pbkdf2.mod.
pkglib_MODULES += password_pbkdf2.mod
password_pbkdf2_mod_SOURCES = commands/password_pbkdf2.c
password_pbkdf2_mod_CFLAGS = $(COMMON_CFLAGS)
password_pbkdf2_mod_LDFLAGS = $(COMMON_LDFLAGS)
bin_UTILITIES += grub-mkpasswd-pbkdf2
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c kern/err.c
grub_mkpasswd_pbkdf2_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap -DGRUB_MKPASSWD=1
include $(srcdir)/conf/gcry.mk

View file

@ -21,7 +21,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
kern/i386/halt.c \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
kern/misc.c kern/mm.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
@ -65,7 +65,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
kern/i386/halt.c \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
kern/misc.c kern/mm.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
@ -102,7 +102,7 @@ bin_SCRIPTS += grub-mkrescue
grub_mkrescue_SOURCES = util/grub-mkrescue.in
# Modules.
pkglib_MODULES = linux.mod multiboot.mod \
pkglib_MODULES = linux.mod \
aout.mod play.mod serial.mod \
memdisk.mod pci.mod lspci.mod reboot.mod \
halt.mod datetime.mod date.mod datehook.mod \
@ -140,16 +140,22 @@ serial_mod_SOURCES = term/i386/pc/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For multiboot.mod.
pkglib_MODULES += multiboot.mod
multiboot_mod_SOURCES = loader/i386/multiboot.c \
loader/i386/multiboot_helper.S \
loader/i386/pc/multiboot2.c \
loader/multiboot2.c \
loader/multiboot_loader.c
loader/i386/multiboot_mbi.c \
loader/multiboot_loader.c
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
pkglib_MODULES += multiboot2.mod
multiboot2_mod_SOURCES = loader/i386/multiboot.c \
loader/multiboot_loader.c \
loader/i386/multiboot_mbi.c
multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For aout.mod.
aout_mod_SOURCES = loader/aout.c
aout_mod_CFLAGS = $(COMMON_CFLAGS)

View file

@ -39,7 +39,7 @@ pkglib_MODULES = kernel.img chain.mod appleldr.mod \
kernel_img_EXPORTS = no
kernel_img_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
kern/misc.c kern/mm.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \

View file

@ -19,7 +19,7 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
kern/ieee1275/cmain.c kern/ieee1275/openfw.c \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
kern/misc.c kern/mm.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
kern/env.c \

View file

@ -48,7 +48,7 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
kern/i386/misc.S \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
kern/misc.c kern/mm.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
kern/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.c \
@ -115,11 +115,8 @@ 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 \
reboot.mod halt.mod \
vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
vga.mod memdisk.mod pci.mod lspci.mod \
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
@ -204,16 +201,22 @@ serial_mod_SOURCES = term/i386/pc/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For multiboot.mod.
pkglib_MODULES += multiboot.mod
multiboot_mod_SOURCES = loader/i386/multiboot.c \
loader/i386/multiboot_helper.S \
loader/i386/pc/multiboot2.c \
loader/multiboot2.c \
loader/i386/multiboot_mbi.c \
loader/multiboot_loader.c
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
pkglib_MODULES += multiboot2.mod
multiboot2_mod_SOURCES = loader/i386/multiboot.c \
loader/i386/multiboot_mbi.c \
loader/multiboot_loader.c
multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For vbe.mod.
vbe_mod_SOURCES = video/i386/pc/vbe.c
vbe_mod_CFLAGS = $(COMMON_CFLAGS)

View file

@ -31,7 +31,7 @@ pkglib_PROGRAMS = kernel.img
kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
kern/misc.c kern/mm.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
kern/ieee1275/init.c \
@ -61,7 +61,6 @@ pkglib_MODULES = halt.mod \
linux.mod \
reboot.mod \
suspend.mod \
multiboot.mod \
memdisk.mod \
lsmmap.mod
@ -91,13 +90,6 @@ halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For multiboot.mod
multiboot_mod_SOURCES = loader/ieee1275/multiboot2.c \
loader/multiboot2.c \
loader/multiboot_loader.c
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For memdisk.mod.
memdisk_mod_SOURCES = disk/memdisk.c
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)

View file

@ -35,7 +35,7 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
kern/misc.c kern/mm.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
kern/sparc64/ieee1275/ieee1275.c \

50
conf/tests.rmk Normal file
View file

@ -0,0 +1,50 @@
# -*- makefile -*-
# For grub-shell
grub-shell: tests/util/grub-shell.in config.status
./config.status --file=$@:$<
chmod +x $@
check_SCRIPTS += grub-shell
CLEANFILES += grub-shell
# For grub-shell-tester
grub-shell-tester: tests/util/grub-shell-tester.in config.status
./config.status --file=$@:$<
chmod +x $@
check_SCRIPTS += grub-shell-tester
CLEANFILES += grub-shell-tester
pkglib_MODULES += functional_test.mod
functional_test_mod_SOURCES = tests/lib/functional_test.c tests/lib/test.c
functional_test_mod_CFLAGS = $(COMMON_CFLAGS)
functional_test_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Rules for unit tests
check_UTILITIES += example_unit_test
example_unit_test_SOURCES = tests/example_unit_test.c kern/list.c kern/misc.c tests/lib/test.c tests/lib/unit_test.c
example_unit_test_CFLAGS = -Wno-format
# Rules for functional tests
pkglib_MODULES += example_functional_test.mod
example_functional_test_mod_SOURCES = tests/example_functional_test.c
example_functional_test_mod_CFLAGS = -Wno-format $(COMMON_CFLAGS)
example_functional_test_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Rules for scripted tests
check_SCRIPTS += example_scripted_test
example_scripted_test_SOURCES = tests/example_scripted_test.in
check_SCRIPTS += example_grub_script_test
example_grub_script_test_SOURCES = tests/example_grub_script_test.in
# List of tests to execute on "make check"
SCRIPTED_TESTS = example_scripted_test
SCRIPTED_TESTS += example_grub_script_test
UNIT_TESTS = example_unit_test
FUNCTIONAL_TESTS = example_functional_test.mod
# dependencies between tests and testing-tools
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
$(FUNCTIONAL_TESTS): functional_test.mod

View file

@ -39,7 +39,7 @@ kernel_img_EXPORTS = no
kernel_img_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
kern/misc.c kern/mm.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \

672
config.rpath Executable file
View file

@ -0,0 +1,672 @@
#! /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-2008 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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 _LT_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* | cegcc*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
newsos6)
;;
linux* | k*bsd*-gnu)
case $cc_basename in
ecc*)
wl='-Wl,'
;;
icc* | ifort*)
wl='-Wl,'
;;
lf95*)
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 _LT_LINKER_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32* | cegcc*)
# 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
aix[3-9]*)
# 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 <kc5tja@dolphin.openprojects.net> 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* | cegcc*)
# 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
;;
aix[4-9]*)
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].*|aix[5-9]*)
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* | cegcc*)
# 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 _LT_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'
;;
aix[4-9]*)
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* | cegcc*)
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=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Format of library name prefix.
libname_spec="$escaped_libname_spec"
# Library names that the linker finds when passed -lNAME.
library_names_spec="$escaped_library_names_spec"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF

View file

@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
# 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.
#
# This configure.ac is free software; the author
# gives unlimited permission to copy and/or distribute it,
@ -178,7 +178,7 @@ AC_PROG_CC
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
AC_GNU_SOURCE
AM_GNU_GETTEXT
AM_GNU_GETTEXT([external])
AC_SYS_LARGEFILE
# Identify characteristics of the host architecture.

View file

@ -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

View file

@ -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++)

View file

@ -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

View file

@ -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

View file

@ -23,6 +23,7 @@
#include <grub/disk.h>
#include <grub/mm.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
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}
};
@ -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);
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
@ -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;
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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,

View file

@ -16,8 +16,4 @@
module=$1
grep -v "^#" | sed -n \
-e "/grub_parser_register *( *\"/{s/.*( *\"\([^\"]*\)\".*/parser.\1: $module/;p;}" \
-e "/grub_reader_register *( *\"/{s/.*( *\"\([^\"]*\)\".*/reader.\1: $module/;p;}" \
-e "/grub_term_register_input *( *\"/{s/.*( *\"\([^\"]*\)\".*/terminal_input.\1: $module/;p;}" \
-e "/grub_term_register_output *( *\"/{s/.*( *\"\([^\"]*\)\".*/terminal_output.\1: $module/;p;}" \
-e "/grub_menu_viewer_register *( *\"/{s/.*( *\"\([^\"]*\)\".*/menu_viewer.\1: $module/;p;}"
-e "/grub_parser_register *( *\"/{s/.*( *\"\([^\"]*\)\".*/parser.\1: $module/;p;}"

View file

@ -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,
@ -192,6 +192,7 @@ endif
fs = 'fs-' + obj.suffix('lst')
partmap = 'partmap-' + obj.suffix('lst')
handler = 'handler-' + obj.suffix('lst')
terminal = 'terminal-' + obj.suffix('lst')
parttool = 'parttool-' + obj.suffix('lst')
video = 'video-' + obj.suffix('lst')
dep = deps[i]
@ -213,6 +214,7 @@ FSFILES += #{fs}
PARTTOOLFILES += #{parttool}
PARTMAPFILES += #{partmap}
HANDLERFILES += #{handler}
TERMINALFILES += #{terminal}
VIDEOFILES += #{video}
#{command}: #{src} $(#{src}_DEPENDENCIES) gencmdlist.sh
@ -240,6 +242,11 @@ VIDEOFILES += #{video}
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genhandlerlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
#{terminal}: #{src} $(#{src}_DEPENDENCIES) genterminallist.sh
set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genterminallist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
#{video}: #{src} $(#{src}_DEPENDENCIES) genvideolist.sh
set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \

20
genterminallist.sh Normal file
View file

@ -0,0 +1,20 @@
#! /bin/sh
#
# Copyright (C) 2009,2010 Free Software Foundation, Inc.
#
# This script is free software; the author
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Read source code from stdin and detect command names.
module=$1
grep -v "^#" | sed -n \
-e "/grub_term_register_input *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $module/;p;}" \
-e "/grub_term_register_output *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $module/;p;}" \

View file

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

133
gnulib/getdelim.c Normal file
View file

@ -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 <config.h>
#include <stdio.h>
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#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;
}

30
gnulib/getline.c Normal file
View file

@ -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 <config.h>
#include <stdio.h>
#include <sys/types.h>
ssize_t
getline (char **lineptr, size_t *n, FILE *stream)
{
return getdelim (lineptr, n, '\n', stream);
}

View file

@ -24,6 +24,7 @@
#include <grub/err.h>
#include <grub/dl.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
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)

View file

@ -15,24 +15,15 @@
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_AURH_HEADER
#ifndef GRUB_AUTH_HEADER
#define GRUB_AUTH_HEADER 1
#include <grub/err.h>
#include <grub/i18n.h>
#include <grub/crypto.h>
/* Macros for indistinguishibility. */
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "access denied")
#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get (N_("Enter password:"), \
string, len, \
'*', 0, 0)
#define GRUB_AUTH_MAX_PASSLEN 1024
/* Like strcmp but untimeable. Accepts NULL as second argument. */
int grub_auth_strcmp (const char *user_input, const char *template);
/* Like strcmp but untimeable and ignores commas in needle. */
int grub_auth_strword (const char *haystack, const char *needle);
typedef grub_err_t (*grub_auth_callback_t) (const char*, void *);
typedef grub_err_t (*grub_auth_callback_t) (const char *, const char *, void *);
grub_err_t grub_auth_register_authentication (const char *user,
grub_auth_callback_t callback,

View file

@ -109,4 +109,13 @@ grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
return dest;
}
/* Convert UCS-4 to UTF-8. */
char *grub_ucs4_to_utf8_alloc (grub_uint32_t *src, grub_size_t size);
int
grub_is_valid_utf8 (const grub_uint8_t *src, grub_size_t srcsize);
int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
grub_uint32_t **last_position);
#endif

Some files were not shown because too many files have changed in this diff Show more