Merge from trunk

This commit is contained in:
Robert Millan 2009-12-25 22:29:47 +00:00
commit d94000ed13
210 changed files with 4949 additions and 2557 deletions

750
ChangeLog
View File

@ -1,3 +1,739 @@
2009-12-25 Robert Millan <rmh.grub@aybabtu.com>
* term/i386/pc/at_keyboard.c
(keyboard_controller_wait_untill_ready): New function.
(grub_keyboard_controller_write, grub_keyboard_controller_read)
(keyboard_controller_led): Use keyboard_controller_wait_untill_ready()
for keyboard polling, rather than duplicate the same loop. This
saves a few bytes in code size.
2009-12-25 Vladimir Serbinenko <phcoder@gmail.com>
Support for (pxe[:server[:gateway]]) syntax and
use environment variable for PXE.
* commands/i386/pc/pxecmd.c (options): Removed.
(print_ip): Removed.
(grub_cmd_pxe): Removed
(grub_cmd_pxe_unload): New function.
* fs/i386/pc/pxe.c (grub_pxe_disk_data): New structure.
(grub_pxe_your_ip): Made static.
(grub_pxe_default_server_ip): Likewise.
(grub_pxe_default_gateway_ip): Likewise.
(grub_pxe_blksize): Likewise.
(parse_ip): New function.
(grub_pxe_open): Support server and gateway specification.
(grub_pxe_close): Free disk->data.
(grub_pxefs_open): Use disk->data.
(grub_pxefs_read): Likewise.
(grub_env_write_readonly): New function.
(set_mac_env): Likewise.
(set_env_limn_ro): Likewise.
(parse_dhcp_vendor): Likewise.
(grub_pxe_detect): Set the environment variables.
(set_ip_env): New function.
(write_ip_env): Likewise.
(grub_env_write_pxe_default_server): Likewise.
(grub_env_write_pxe_default_gateway): Likewise.
(grub_env_write_pxe_blocksize): Likewise.
(GRUB_MOD_INIT(pxe)): Set environment variables.
* include/grub/i386/pc/pxe.h (grub_pxe_mac_addr): Rename to ...
(grub_pxe_mac_addr_t): ... this. All users updated.
(grub_pxe_your_ip): Removed.
(grub_pxe_server_ip): Likewise.
(grub_pxe_gateway_ip): Likewise.
(grub_pxe_blksize): Likewise.
2009-12-25 Carles Pina i Estany <carles@pina.cat>
* commands/help.c: Include `<grub/i18n.h>'.
(grub_cmd_help): Gettextizze.
(GRUB_MOD_INIT): Likewise.
* commands/i386/pc/play.c: Include `<grub/i18n.h>'.
(GRUB_MOD_INIT): Gettextizze.
* commands/search.c: Include `<grub/i18n.h>'.
(options): Gettextizze.
(GRUB_MOD_INIT): Gettextizze.
* lib/arg.c: Include `<grub/i18n.h>'.
(help_options): Gettextizze.
(find_long): Likewise.
(grub_arg_show_help): Likewise.
* normal/dyncmd.c: Include `<grub/i18n.h>'.
(read_command_list): Gettextizze.
* po/POTFILES: Add `commands/i386/pc/play.c', `commands/search.c',
`commands/help.c', `lib/arg.c' and `normal/dyncmd.c'.
2009-12-25 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/i386/at_keyboard.h (NUM_LOCK, SCROLL_LOCK): New macros.
* term/i386/pc/at_keyboard.c (KEYBOARD_STATUS_NUM_LOCK)
(KEYBOARD_LED_SCROLL, KEYBOARD_LED_NUM, KEYBOARD_LED_CAPS): New macros.
(led_status): New variable.
(keyboard_controller_led): New function.
(grub_at_keyboard_getkey_noblock): Handle num lock and scroll lock,
update led status for caps lock, num lock and scroll lock.
2009-12-25 Felix Zielcke <fzielcke@z-51.de>
* util/hostdisk.c (open_device): Fix a comment.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-install.in (host_os): New variable.
* util/i386/efi/grub-install.in (host_os): Likewise.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/write.c (padblock_write): Abort when given an
excedingly large embed image, instead of silently truncating it.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* include/multiboot.h: Indentation fixes.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* include/multiboot.h (struct multiboot_aout_symbol_table)
(struct multiboot_elf_section_header_table): New structure
declarations (stolen from GRUB Legacy).
(struct multiboot_info): Replace opaque `syms' with a.out and ELF
table information.
(multiboot_aout_symbol_table_t, multiboot_elf_section_header_table_t)
(multiboot_info_t, multiboot_memory_map_t, multiboot_module_t): New
type aliases.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* include/multiboot.h: Make comments src2texi-friendly.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
For consistency with [multiboot]/docs/boot.S.
* include/multiboot.h (MULTIBOOT_MAGIC): Rename from this ...
(MULTIBOOT_HEADER_MAGIC): ... to this. Update all users.
(MULTIBOOT_MAGIC2): Rename from this ...
(MULTIBOOT_BOOTLOADER_MAGIC): ... to this. Update all users.
2009-12-24 Robert Millan <rmh.grub@aybabtu.com>
* include/multiboot.h: Remove `<grub/types.h>'.
(multiboot_uint16_t, multiboot_uint32_t, multiboot_uint64_t): New
types. Update all users.
2009-12-25 Carles Pina i Estany <carles@pina.cat>
* commands/efi/loadbios.c: Capitalize acronyms, replace `could not' by
`couldn't' and `can not' by `cannot'.
* commands/i386/pc/drivemap.c: Likewise.
* disk/ata.c: Likewise.
* disk/ieee1275/nand.c: Likewise.
* fs/affs.c: Likewise.
* fs/fat.c: Likewise.
* fs/hfs.c: Likewise.
* fs/hfsplus.c: Likewise.
* fs/iso9660.c: Likewise.
* fs/jfs.c: Likewise.
* fs/minix.c: Likewise.
* fs/reiserfs.c: Likewise.
* fs/sfs.c: Likewise.
* fs/udf.c: Likewise.
* fs/ufs.c: Likewise.
* fs/xfs.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/sparc64/ieee1275/linux.c: Likewise.
* util/grub-probe.c: Likewise.
* util/misc.c: Likewise.
2009-12-24 Carles Pina i Estany <carles@pina.cat>
* bus/usb/usbhub.c: Fix capitalization, fullstop and newlines in
grub_errno calls.
* commands/acpi.c: Likewise.
* commands/blocklist.c: Likewise.
* commands/efi/loadbios.c: Likewise.
* commands/i386/pc/drivemap.c: Likewise.
* commands/loadenv.c: Likewise.
* commands/memrw.c: Likewise.
* commands/password.c: Likewise.
* commands/videotest.c: Likewise.
* disk/ata.c: Likewise.
* disk/ata_pthru.c: Likewise.
* disk/dmraid_nvidia.c: Likewise.
* disk/ieee1275/nand.c: Likewise.
* disk/ieee1275/ofdisk.c: Likewise.
* disk/loopback.c: Likewise.
* disk/lvm.c: Likewise.
* disk/mdraid_linux.c: Likewise.
* disk/raid.c: Likewise.
* disk/raid6_recover.c: Likewise.
* disk/scsi.c: Likewise.
* efiemu/main.c: Likewise.
* efiemu/mm.c: Likewise.
* efiemu/pnvram.c: Likewise.
* efiemu/symbols.c: Likewise.
* font/font.c: Likewise.
* fs/cpio.c: Likewise.
* fs/hfsplus.c: Likewise.
* fs/iso9660.c: Likewise.
* fs/jfs.c: Likewise.
* fs/minix.c: Likewise.
* fs/ntfs.c: Likewise.
* fs/ntfscomp.c: Likewise.
* fs/reiserfs.c: Likewise.
* fs/ufs.c: Likewise.
* fs/xfs.c: Likewise.
* gettext/gettext.c: Likewise.
* include/grub/auth.h: Likewise.
* kern/elf.c: Likewise.
* kern/file.c: Likewise.
* kern/ieee1275/init.c: Likewise.
* kern/ieee1275/mmap.c: Likewise.
* kern/ieee1275/openfw.c: Likewise.
* kern/powerpc/dl.c: Likewise.
* kern/sparc64/dl.c: Likewise.
* lib/arg.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/bsdXX.c: Likewise.
* loader/i386/efi/linux.c: Likewise.
* loader/i386/efi/xnu.c: Likewise.
* loader/i386/ieee1275/linux.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/i386/multiboot.c: Likewise.
* loader/i386/pc/linux.c: Likewise.
* loader/i386/pc/multiboot2.c: Likewise.
* loader/i386/xnu.c: Likewise.
* loader/ieee1275/multiboot2.c: Likewise.
* loader/macho.c: Likewise.
* loader/machoXX.c: Likewise.
* loader/multiboot2.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* loader/powerpc/ieee1275/linux.c: Likewise.
* loader/sparc64/ieee1275/linux.c: Likewise.
* loader/xnu.c: Likewise.
* loader/xnu_resume.c: Likewise.
* mmap/i386/pc/mmap.c: Likewise.
* normal/menu_viewer.c: Likewise.
* partmap/acorn.c: Likewise.
* partmap/amiga.c: Likewise.
* partmap/apple.c: Likewise.
* script/lexer.c: Likewise.
* term/gfxterm.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/i386/pc/vga.c: Likewise.
* term/ieee1275/ofconsole.c: Likewise.
* term/terminfo.c: Likewise.
* video/bitmap.c: Likewise.
* video/efi_gop.c: Likewise.
* video/efi_uga.c: Likewise.
* video/fb/video_fb.c: Likewise.
* video/i386/pc/vbe.c: Likewise.
* video/readers/tga.c: Likewise.
* video/video.c: Likewise.
2009-12-23 Felix Zielcke <fzielcke@z-51.de>
* commands/i386/pc/drivemap.c: Remove all trailing whitespace.
* commands/lspci.c: Likewise.
* commands/probe.c: Likewise.
* commands/xnu_uuid.c: Likewise.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* fs/i386/pc/pxe.c: Likewise.
* gettext/gettext.c: Likewise.
* include/grub/efi/graphics_output.h: Likewise.
* include/grub/i386/pc/memory.h: Likewise.
* kern/env.c: Likewise.
* kern/i386/qemu/startup.S: Likewise.
* lib/i386/pc/biosnum.c: Likewise.
* lib/i386/relocator.c: Likewise.
* lib/i386/relocator_asm.S: Likewise.
* lib/relocator.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/multiboot.c: Likewise.
* loader/i386/pc/chainloader.c: Likewise.
* loader/i386/xnu.c: Likewise.
* loader/xnu.c: Likewise.
* normal/main.c: Likewise.
* normal/menu_text.c: Likewise.
* util/getroot.c: Likewise.
* util/grub-mkconfig_lib.in: Likewise.
* util/grub.d/00_header.in: Likewise.
* util/i386/pc/grub-mkimage.c: Likewise.
* util/mkisofs/eltorito.c: Likewise.
* util/mkisofs/exclude.h: Likewise.
* util/mkisofs/hash.c: Likewise.
* util/mkisofs/iso9660.h: Likewise.
* util/mkisofs/joliet.c: Likewise.
* util/mkisofs/mkisofs.c: Likewise.
* util/mkisofs/mkisofs.h: Likewise.
* util/mkisofs/multi.c: Likewise.
* util/mkisofs/name.c: Likewise.
* util/mkisofs/rock.c: Likewise.
* util/mkisofs/tree.c: Likewise.
* util/mkisofs/write.c: Likewise.
* video/efi_gop.c: Likewise.
2009-12-23 Vladimir Serbinenko <phcoder@gmail.com>
* video/efi_gop.c (grub_video_gop_get_bitmask): Fix off-by-one in mask
size counting.
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrescue.in (pkglib_DATA): Set to @pkglib_DATA@.
* genmk.rb (class SCRIPT): Modify the target file instead of source.
2009-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* commands/memrw.c (grub_cmd_write): Support for mask parameter.
(GRUB_MOD_INIT(memrw)): Update help line.
2009-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* commands/memrw.c (cmd_read_byte, cmd_read_word, cmd_read_dword):
Use grub_extcmd_t. All users updated.
(options): New variable.
(grub_cmd_read): Restructure for readability. Support "-v" option.
(grub_cmd_write): Restructure for readability.
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* genmk.rb (class SCRIPT): Prepend #{src} path with $(srcdir).
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* genmk.rb (class SCRIPT): Use sed to substitute @pkglib_DATA@
with the actual contents of the correspondending make variable.
* util/grub-mkrescue.in (pkglib_DATA): New variable.
(process_input_dir): Copy all $pkglib_DATA files instead of explicitly
specifying `*.lst' and `efiemu??.o'
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* util/grub.d/30_os-prober.in (osx_entry): Add round brackets
after function name.
Noticed by Rene Engelhard <rene@debian.org>.
2009-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* commands/lspci.c (grub_pci_classes): Add "USB Controller".
(options): New variable.
(iospace): Likewise.
(grub_lspci_iter): List IO spaces if "-i" was given.
(grub_cmd_lspci): Parse options.
(GRUB_MOD_INIT(lspci)): Use extcmd.
(GRUB_MOD_FINI(lspci)): Likewise.
2009-12-22 Felix Zielcke <fzielcke@z-51.de>
* util/grub.d/30_os-prober.in (osx_entry): Remove non POSIX compliant
`function' keyword.
Patch by Tony Mancill <tmancill@debian.org>.
2009-12-22 Vladimir Serbinenko <phcoder@gmail.com>
* bus/usb/uhci.c (grub_uhci_transfer): Set a limit transaction time.
(grub_uhci_portstatus): Likewise.
(grub_uhci_portstatus): Add necessary delay.
* bus/usb/usbhub.c (grub_usb_hub_add_dev): Fix loop-break condition.
2009-12-21 Carles Pina i Estany <carles@pina.cat>
* commands/acpi.c (options): Fix capitalizations and/or full stops.
(GRUB_MOD_INIT): Likewise.
* commands/boot.c (GRUB_MOD_INIT): Likewise.
* commands/cmp.c (grub_cmd_cmp): Improve the help message.
* commands/echo.c (options): Fix capitalizations and/or full stops.
* commands/efi/loadbios.c (enable_rom_area): Likewise.
(enable_rom_area): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/gptsync.c (GRUB_MOD_INIT): Likewise.
* commands/halt.c (GRUB_MOD_INIT): Improve the help message.
* commands/handler.c (GRUB_MOD_INIT): Likewise.
* commands/hdparm.c (options): Fix capitalizations and/or full stops.
* commands/hexdump.c (options): Likewise.
* commands/i386/cpuid.c (options): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/i386/pc/drivemap.c (options): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/i386/pc/halt (options): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/i386/pc/play.c (GRUB_MOD_INIT): Likewise.
* commands/i386/pc/pxecmd.c (options): Likewise.
* commands/i386/pc/vbetest.c (GRUB_MOD_INIT): Likewise.
* commands/ieee1275/suspend.c (GRUB_MOD_INIT): Likewise.
* commands/keystatus.c (options): Likewise.
(GRUB_MOD_INIT): Likewise.
* commands/loadenv.c (options): Likewise.
* commands/ls.c (options): Likewise.
* commands/lspci.c (GRUB_MOD_INIT): Likewise.
* commands/memrw.c (GRUB_MOD_INIT): Likewise.
* commands/minicmd.c (GRUB_MOD_INIT): Likewise.
* commands/parttool.c (helpmsg): Likewise.
* commands/probe.c (options): Likewise.
* commands/read.c (GRUB_MOD_INIT): Likewise.
* commands/reboot.c (GRUB_MOD_INIT): Likewise.
* commands/search.c (options): Likewise.
* commands/sleep.c (options): Likewise.
* commands/test.c (GRUB_MOD_INIT): Likewise.
* commands/true.c (GRUB_MOD_INIT): Likewise.
* commands/usbtest.c (GRUB_MOD_INIT): Likewise.
* commands/videotest.c (GRUB_MOD_INIT): Likewise.
* lib/arg.c (help_options): Likewise.
* Makefile.in ($(srcdir)/po/$(PACKAGE).pot): Pass -ctranslate to
`$(XGETTEXT)'.
* po/POTFILES: Add `commands/loadenv.c'.
2009-12-21 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrescue.in (process_input_dir): Copy `*.lst' files
instead of specifying them explicit.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* NEWS: Add grub-probe support for GNU/Hurd.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* NEWS: gettext was added after 1.97.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/msdos_partition.h: New file (based on
include/grub/msdos_partition.h).
* util/mkisofs/mkisofs.c (use_protective_msdos_label): New variable.
(OPTION_PROTECTIVE_MSDOS_LABEL): New macro.
(ld_options, main): Recognize --protective-msdos-label.
* util/mkisofs/mkisofs.h (use_protective_msdos_label): New declaration.
* util/mkisofs/write.c: Include `"msdos_partition.h"'.
(padblock_write): If `use_protective_msdos_label' is set, patch a
protective DOS-style label in the output image.
* util/grub-mkrescue.in: Use --protective-msdos-label.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-mkrescue.in: Do not zero-pad image for BIOS-based disk
boot.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/mkisofs.c (use_embedded_boot, boot_image_embed): New
variables.
(ld_options, main): Recognize `--embedded-boot'.
* util/mkisofs/mkisofs.h (use_embedded_boot, boot_image_embed): New
declarations.
* util/mkisofs/write.c (PADBLOCK_SIZE): New variable.
(padblock_size): Use `PADBLOCK_SIZE' instead of hardcoding 16.
(padblock_write): Likewise. Rewrite to support embedded boot image.
* util/grub-mkrescue.in: When building i386-pc images, embed core.img
for BIOS-based disk boot instead of only ElTorito.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-mkrescue.in: Remove `configfile' and `sh' from i386-pc
build (not needed for bootstrap).
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-mkrescue.in: Remove `memdisk', `tar' and `search' modules
from i386-pc build (not needed for bootstrap).
Rewrite a pair of strings.
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* normal/main.c (grub_normal_reader_init): Set left margin back to 3.
2009-12-21 Vladimir Serbinenko <phcoder@gmail.com>
* video/i386/pc/vbe.c (grub_video_vbe_fini): Set 'last_set_mode'.
2009-12-21 Andreas Born <futur.andy@googlemail.com>
* kern/env.c (grub_env_context_open): Mark exported variable for
reexport.
2009-12-21 Andreas Born <futur.andy@googlemail.com>
* kern/env.c (grub_env_export): Create nonexistent variables before
exporting.
2009-12-20 Carles Pina i Estany <carles@pina.cat>
* include/grub/auth.h: Include `<grub/i18n.h>'.
(GRUB_GET_PASSWORD): Gettextizze string.
* include/grub/normal.h (STANDARD_MARGIN): New macro, moved from
menu_text.c.
(grub_utf8_to_ucs4_alloc): Fix indentation.
(grub_print_ucs4): Likewise.
(grub_getstringwidth): Likewise.
(print_message_indented): New declaration.
* normal/auth.c: Include `<grub/i18n.h>'.
(grub_auth_check_authentication): Gettexttize string.
* normal/cmdline.c: Include `<grub/i18n.h>'.
(grub_cmdline_get): Gettextizze.
* normal/color.c: Include `<grub/i18n.h>'.
(grub_parse_color_name_pair): Gettexttize strings.
* normal/main.c (grub_normal_reader_init): Cleanup gettexttized
string (use `print_message_indented').
* normal/menu_text.c (STANDARD_MARGIN): Moved from here to
`include/grub/normal.h'.
(print_message_indented): Renamed to ...
(grub_print_message_indented): ... this. Remove `static' qualifer (now
used in normal/main.c).
(print_message): Use `grub_print_message_indented' instead of
`print_message_indented'.
(print_timeout): Likewise.
* normal/misc.c: Include `<grub/term.h>' and `<grub/i18n.h>'.
(grub_normal_print_device_info): Gettexttize strings.
* po/POTFILES: Add `auth.c', `color.c' and `misc.c'.
2009-12-20 Vladimir Serbinenko <phcoder@gmail.com>
* kern/parser.c (grub_parser_split_cmdline): Fix incorrect counting
of arguments. Return number of tokens and not arguments. All users
updated.
2009-12-20 Vladimir Serbinenko <phcoder@gmail.com>
* util/i386/pc/grub-setup.c (setup): Don't install on non-GPT,
non-MSDOS paritions.
2009-12-19 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/types.h (UNUSED): Removed since it conflicts with
NetBSD headers. All users changed to direct __attribute__ ((unused)).
Reported by Grégoire Sutre.
2009-12-19 Carles Pina i Estany <carles@pina.cat>
* include/grub/normal.h (grub_utf8_to_ucs4): New declaration.
(grub_print_ucs4_alloc): Likewise.
(grub_getstringwidth): Likewise.
* normal/main.c (grub_normal_init_page): Gettextize version string.
* normal/menu_text.c (grub_utf8_to_ucs4_alloc): New definition.
(getstringwidth): Renamed to ...
(grub_getstringwidth): ... this. Remove `static' qualifier (now used
in normal/main.c). Use `grub_utf8_to_ucs4_alloc'.
(grub_print_ucs4): Remove `static' qualifer (now used in
normal/main.c).
* po/POTFILES: Add normal/main.c.
2009-12-19 Carles Pina i Estany <carles@pina.cat>
* normal/menu_text.c (STANDARD_MARGIN): New macro.
(print_message_indented): Add `margin_left' and `margin_right'
parameters.
(print_message): Update `print_message_indented' calls. Adds '\n' to the
strings.
(print_timeout): Use `print_message_indented' to print the message.
Deletes `second_stage' parameter.
(run_menu): Update `print_timeout' calls.
2009-12-18 Vladimir Serbinenko <phcoder@gmail.com>
Fix console palette on OpenFirmware.
* term/ieee1275/ofconsole.c (MAX): Removed.
(colors): Redone based on VGA palette.
(grub_ofconsole_setcolor): Discard brightness bit since only 8
colors are supported.
(grub_ofconsole_init_output): Use ARRAY_SIZE instead of hardcoded size.
2009-12-18 Vladimir Serbinenko <phcoder@gmail.com>
Fix potential EfiEmu double prepare.
* efiemu/main.c (prepared): New variable
(grub_efiemu_unload): Set prepare to '0'.
(grub_efiemu_prepare): Return if already prepared. Set prepared.
set_virtual_address_map support.
* include/grub/efi/efi.h (grub_efi_set_virtual_address_map): New
prototype.
* include/grub/efiemu/efiemu.h (grub_efiemu_write_sym_markers): New
prototype.
(grub_efiemu_crc32): Likewise.
(grub_efiemu_crc64): Likewise.
(grub_efiemu_set_virtual_address_map): Likewise.
* include/grub/autoefi.h (grub_autoefi_exit_boot_services):
New definition.
(grub_autoefi_set_virtual_address_map): Likewise.
* kern/efi/efi.c (grub_efi_set_virtual_address_map): New function.
* loader/i386/xnu.c (grub_xnu_boot): Call set_virtual_address_map.
Restructure flow to accomodate it.
* efiemu/prepare.c (grub_efiemu_prepare): Support set_virtual_address_map.
(grub_efiemu_crc): Recompute CRC32.
* efiemu/runtime/efiemu.c (ptv_relocated): Renamed to ...
(efiemu_ptv_relocated): ... this. Made global. All users updated.
* efiemu/symbols.c (relocated_handle): New variable.
(grub_efiemu_free_syms): Free relocated_handle.
(grub_efiemu_alloc_syms): Allocate relocated_handle.
(grub_efiemu_write_sym_markers): New function.
(grub_efiemu_set_virtual_address_map): Likewise.
Newer XNU parameters.
* include/grub/i386/xnu.h (GRUB_XNU_BOOTARGS_VERMINOR): Change to 5.
* include/grub/xnu.h (grub_xnu_extheader): Add nameaddr and namesize.
(grub_xnu_fill_devicetree): New prototype.
(grub_xnu_heap_real_start): New variable.
* loader/xnu.c (get_name_ptr): New function.
(grub_xnu_load_driver): Fill namelen and name.
64-bit xnu support.
* conf/i386-efi.rmk (xnu_mod_SOURCES): Add 'loader/macho32.c'
and 'loader/macho64.c'.
* conf/i386-pc.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* include/grub/i386/macho.h (grub_macho_thread64): New structure.
* include/grub/xnu.h (grub_xnu_is_64bit): New variable.
* include/grub/macho.h (grub_macho_segment64): New structure.
* include/grub/machoload.h (grub_macho32_size): Renamed from ...
(grub_macho_size32): ... to this.
(grub_macho32_get_entry_point): Renamed from ...
(grub_macho_get_entry_point32): ... to this.
(grub_macho_contains_macho64): New prototype.
(grub_macho_size64): Likewise.
(grub_macho_get_entry_point64): Likewise.
(grub_macho32_load): Renamed from ...
(grub_macho_load32): ... to this.
(grub_macho32_filesize): Renamed from ...
(grub_macho_filesize32): ... to this.
(grub_macho32_readfile): Renamed from ...
(grub_macho_readfile32): ... to this.
(grub_macho_filesize64): New prototype.
(grub_macho_readfile64): Likewise.
(grub_macho_parse32): Likewise.
(grub_macho_parse64): Likewise.
* loader/macho.c: Split into ...
* loader/machoXX.c: ... and this. Replace 32 with XX.
* loader/macho32.c: New file.
* loader/macho64.c: Likewise.
* loader/xnu.c (grub_xnu_is_64bit): New variable.
(grub_cmd_xnu_kernel): Make 32-bit only.
(grub_cmd_xnu_kernel64): New function.
(grub_xnu_load_driver): Support Mach-O 64.
(grub_cmd_xnu_mkext): Likewise.
* util/grub.d/30_os-prober.in (osx_entry): New function.
Generate entries for 64-bit boot too.
Eliminate ad-hoc tree format in XNU and EfiEmu.
* efiemu/main.c (grub_efiemu_prepare): Update comment.
* efiemu/pnvram.c: Rewritten to use environment variables.
All users updated.
Inline utf16_to_utf8.
* kern/misc.c (grub_utf16_to_utf8): Move from here ...
* include/grub/charset.h (grub_utf16_to_utf8): ... to here. Inlined.
All users updated.
* include/grub/misc.h (grub_utf16_to_utf8): Removed.
* bus/usb/usb.c (grub_usb_get_string): Move from here ...
* commands/usbtest.c (grub_usb_get_string): ... move here.
(usb_print_str): Fix error handling.
* include/grub/usb.h (grub_usb_get_string): Remove.
UTF-8 to UTF-16 transformation.
* conf/common.rmk (pkglib_MODULES): Add charset.mod
(charset_mod_SOURCES): New variable.
(charset_mod_CFLAGS): Likewise.
(charset_mod_LDFLAGS): Likewise.
* include/grub/utf.h: New file.
* lib/utf.c: New file. (Based on grub_utf8_to_ucs4 from kern/misc.c)
Support for device properties.
* include/grub/i386/xnu.h (grub_xnu_devprop_header): New structure.
(grub_xnu_devprop_device_header): Likewise.
(grub_xnu_devprop_device_descriptor): Likewise.
(grub_xnu_devprop_add_device): New prototype.
(grub_xnu_devprop_remove_device): Likewise.
(grub_xnu_devprop_remove_property): Likewise.
(grub_xnu_devprop_add_property_utf8): Likewise.
(grub_xnu_devprop_add_property_utf16): Likewise.
(grub_cpu_xnu_init): Likewise.
(grub_cpu_xnu_fini): Likewise.
(grub_cpu_xnu_unload): Likewise.
* loader/i386/xnu.c (grub_xnu_devprop_device_descriptor): New structure.
(property_descriptor): Likewise.
(devices): New variable.
(grub_xnu_devprop_remove_property): New function.
(grub_xnu_devprop_add_device): Likewise.
(grub_xnu_devprop_remove_device): Likewise.
(grub_xnu_devprop_add_property): Likewise.
(grub_xnu_devprop_add_property_utf8): Likewise.
(grub_xnu_devprop_add_property_utf16): Likewise.
(hextoval): Likewise.
(grub_cpu_xnu_fill_devprop): Likewise.
(grub_cmd_devprop_load): Likewise.
(grub_xnu_boot): Call grub_cpu_xnu_fill_devprop,
grub_xnu_fill_devicetree, grub_xnu_fill_devicetree
(cmd_devprop_load): New variable.
(grub_cpu_xnu_init): New function.
(grub_cpu_xnu_fini): Likewise.
* loader/i386/xnu.c (grub_xnu_unload): Call grub_cpu_xnu_unload.
* loader/xnu.c (grub_xnu_parse_devtree): Remove.
(grub_cmd_xnu_devtree): Likewise.
(hextoval): New function.
(unescape): Likewise.
(grub_xnu_fill_devicetree): Likewise.
* util/grub.d/30_os-prober.in: Load devprop.bin. Don't load devtree.txt.
* util/i386/efi/grub-dumpdevtree: Generate devprop.bin.
2009-12-18 Vladimir Serbinenko <phcoder@gmail.com>
Workaround for broken ATI VBE.
* video/i386/pc/vbe.c (last_set_mode): New variable.
(grub_vbe_set_video_mode): Set 'last_set_mode'.
(grub_vbe_get_video_mode): Use 'last_set_mode' if get_mode fails.
(grub_video_vbe_setup): Don't check for reserved flag.
2009-12-17 Felix Zielcke <fzielcke@z-51.de>
* gendistlist.sh: Use POSIX compliant `!' instead of `-not' in
the `find' command.
2009-12-16 Vladimir Serbinenko <phcoder@gmail.com>
UUID support for HFS.
* fs/hfs.c (grub_hfs_uuid): New function.
(grub_hfs_fs): New value .uuid.
* include/grub/hfs.h (grub_hfs_sblock): New field 'num_serial'.
2009-12-14 Felix Zielcke <fzielcke@z-51.de>
Fix a segfault with parsing unknown long options.
* util/grub-mkrelpath.c (options): Zero terminate it.
2009-12-13 Carles Pina i Estany <carles@pina.cat>
* include/grub/misc.h (grub_puts): New declaration.
(grub_puts_): Likewise.
* kern/misc.c (grub_puts): New definition.
(grub_puts_): Likewise.
2009-12-13 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-probe.c (probe): Improve error message.
2009-12-13 Robert Millan <rmh.grub@aybabtu.com>
* loader/i386/multiboot_elfxx.c
@ -130,11 +866,11 @@
* include/grub/pciutils.h: New file.
* util/pci.c: Likewise.
2009-12-11 Felix Zielcke <fzielcke@z-51.de>
2009-12-11 Felix Zielcke <fzielcke@z-51.de>
* util/misc.c: Don't include <errno.h> twice.
2009-12-10 Felix Zielcke <fzielcke@z-51.de>
2009-12-10 Felix Zielcke <fzielcke@z-51.de>
* disk/i386/pc/biosdisk.c (grub_biosdisk_open): Show the disk
name in an error message.
@ -230,7 +966,7 @@
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Recognize
anything even prefixed with 'cdrom' as a cdrom.
2009-12-06 Felix Zielcke <fzielcke@z-51.de>
2009-12-06 Felix Zielcke <fzielcke@z-51.de>
* util/misc.c (make_system_path_relative_to_its_root): Correctly cope with
mount points.
@ -241,7 +977,7 @@
grub_gettext_msg_list.
(grub_gettext_gettranslation_from_position): Return const char *
and not char *.
(grub_gettext_translate): Add the translated strings into a list,
(grub_gettext_translate): Add the translated strings into a list,
returns from the list if existing there.
(grub_gettext_init_ext): Add \n at the end of grub_dprintf string.
(grub_gettext_delete_list): Delete the list.
@ -282,7 +1018,7 @@
(run_menu): Replaces grub_printf by print_spaces and dynamic terminal
width.
(get_entry_number): Gettextize and uses dynamic terminal width.
(notify_booting, notify_fallback, notify_execution_failure):
(notify_booting, notify_fallback, notify_execution_failure):
Gettextize.
* normal/menu_entry.c (store_completion): Cleanup the gettextized
string.
@ -446,7 +1182,7 @@
($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po)): Rewrite as ...
(po/%.po): ... this.
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
* util/i386/efi/grub-mkimage.c: Include "progname.h".
(main): Use `program_name' instead of nonexistent `progname'.
@ -553,7 +1289,7 @@
* include/grub/i18n.h: ... to here
* include/grub/i18n.h: ... to here.
* kern/misc.c: Include <grub/i18n.h>
(grub_gettext_dummy): Move above user.
(grub_gettext_dummy): Move above user.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>

View File

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

6
NEWS
View File

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

View File

@ -185,7 +185,7 @@ real_code_2:
call LOCAL(move_memory)
/* Check for multiboot signature. */
cmpl $MULTIBOOT_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
cmpl $MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
jz 1f
movl (ramdisk_image - start), %esi

View File

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

View File

@ -155,42 +155,6 @@ grub_usb_get_endpdescriptor (grub_usb_device_t usbdev, int addr)
return NULL;
}
grub_usb_err_t
grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index, int langid,
char **string)
{
struct grub_usb_desc_str descstr;
struct grub_usb_desc_str *descstrp;
grub_usb_err_t err;
/* Only get the length. */
err = grub_usb_control_msg (dev, 1 << 7,
0x06, (3 << 8) | index,
langid, 1, (char *) &descstr);
if (err)
return err;
descstrp = grub_malloc (descstr.length);
if (! descstrp)
return GRUB_USB_ERR_INTERNAL;
err = grub_usb_control_msg (dev, 1 << 7,
0x06, (3 << 8) | index,
langid, descstr.length, (char *) descstrp);
*string = grub_malloc (descstr.length / 2);
if (! *string)
{
grub_free (descstrp);
return GRUB_USB_ERR_INTERNAL;
}
grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str, descstrp->length / 2 - 1);
(*string)[descstr.length / 2 - 1] = '\0';
grub_free (descstrp);
return GRUB_USB_ERR_NONE;
}
grub_usb_err_t
grub_usb_device_initialize (grub_usb_device_t dev)
{

View File

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

View File

@ -36,23 +36,23 @@
static const struct grub_arg_option options[] = {
{"exclude", 'x', 0,
"Don't load host tables specified by comma-separated list",
"Don't load host tables specified by comma-separated list.",
0, ARG_TYPE_STRING},
{"load-only", 'n', 0,
"Load only tables specified by comma-separated list", 0, ARG_TYPE_STRING},
{"v1", '1', 0, "Expose v1 tables", 0, ARG_TYPE_NONE},
{"v2", '2', 0, "Expose v2 and v3 tables", 0, ARG_TYPE_NONE},
{"oemid", 'o', 0, "Set OEMID of RSDP, XSDT and RSDT", 0, ARG_TYPE_STRING},
"Load only tables specified by comma-separated list.", 0, ARG_TYPE_STRING},
{"v1", '1', 0, "Expose v1 tables.", 0, ARG_TYPE_NONE},
{"v2", '2', 0, "Expose v2 and v3 tables.", 0, ARG_TYPE_NONE},
{"oemid", 'o', 0, "Set OEMID of RSDP, XSDT and RSDT.", 0, ARG_TYPE_STRING},
{"oemtable", 't', 0,
"Set OEMTABLE ID of RSDP, XSDT and RSDT", 0, ARG_TYPE_STRING},
"Set OEMTABLE ID of RSDP, XSDT and RSDT.", 0, ARG_TYPE_STRING},
{"oemtablerev", 'r', 0,
"Set OEMTABLE revision of RSDP, XSDT and RSDT", 0, ARG_TYPE_INT},
"Set OEMTABLE revision of RSDP, XSDT and RSDT.", 0, ARG_TYPE_INT},
{"oemtablecreator", 'c', 0,
"Set creator field of RSDP, XSDT and RSDT", 0, ARG_TYPE_STRING},
"Set creator field of RSDP, XSDT and RSDT.", 0, ARG_TYPE_STRING},
{"oemtablecreatorrev", 'd', 0,
"Set creator revision of RSDP, XSDT and RSDT", 0, ARG_TYPE_INT},
{"no-ebda", 'e', 0, "Don't update EBDA. May fix failures or hangs on some"
" BIOSes but makes it ineffective with OS not receiving RSDP from GRUB",
"Set creator revision of RSDP, XSDT and RSDT.", 0, ARG_TYPE_INT},
{"no-ebda", 'e', 0, "Don't update EBDA. May fix failures or hangs on some."
" BIOSes but makes it ineffective with OS not receiving RSDP from GRUB.",
0, ARG_TYPE_NONE},
{0, 0, 0, 0, 0, 0}
};
@ -277,7 +277,7 @@ grub_acpi_create_ebda (void)
{
grub_mmap_unregister (mmapregion);
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't find suitable spot in EBDA");
"couldn't find suitable spot in EBDA");
}
/* Remove any other RSDT. */
@ -551,7 +551,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
grub_free (exclude);
grub_free (load_only);
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate table");
"couldn't allocate table");
}
grub_memcpy (table_dsdt, dsdt, dsdt->length);
}
@ -578,7 +578,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
grub_free (exclude);
grub_free (load_only);
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate table structure");
"couldn't allocate table structure");
}
table->size = curtable->length;
table->addr = grub_malloc (table->size);
@ -587,7 +587,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
{
free_tables ();
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate table");
"couldn't allocate table");
}
table->next = acpi_tables;
acpi_tables = table;
@ -674,7 +674,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
{
free_tables ();
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate table structure");
"couldn't allocate table structure");
}
table->size = size;
@ -709,7 +709,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
{
free_tables ();
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate space for ACPI tables");
"couldn't allocate space for ACPI tables");
}
setup_common_tables ();
@ -763,7 +763,7 @@ GRUB_MOD_INIT(acpi)
"--load-only=table1,table2] filename1 "
" [filename2] [...]",
"Load host acpi tables and tables "
"specified by arguments",
"specified by arguments.",
options);
}

View File

@ -87,7 +87,7 @@ grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
if (! file->device->disk)
return grub_error (GRUB_ERR_BAD_DEVICE,
"this command is available only for disk devices.");
"this command is available only for disk devices");
if (file->device->disk->partition)
part_start = grub_partition_get_start (file->device->disk->partition);

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@ enable_rom_area (void)
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
if (*rom_ptr != BLANK_MEM)
{
grub_printf ("ROM image present.\n");
grub_printf ("ROM image is present.\n");
return 0;
}
@ -63,7 +63,7 @@ enable_rom_area (void)
*rom_ptr = 0;
if (*rom_ptr != 0)
{
grub_printf ("Can\'t enable rom area.\n");
grub_printf ("Can\'t enable ROM area.\n");
return 0;
}
@ -160,7 +160,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
int size;
if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "No rom image specified");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no ROM image specified");
if (argc > 1)
{
@ -169,7 +169,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
return grub_errno;
if (file->size != 4)
grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid int10 dump size");
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid int10 dump size");
else
grub_file_read (file, (void *) 0x40, 4);
@ -184,7 +184,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
size = file->size;
if ((size < 0x10000) || (size > 0x40000))
grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid bios dump size");
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid bios dump size");
else if (enable_rom_area ())
{
grub_file_read (file, (void *) VBIOS_ADDR, size);
@ -201,7 +201,7 @@ static grub_command_t cmd_fakebios, cmd_loadbios;
GRUB_MOD_INIT(loadbios)
{
cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
0, "fake bios.");
0, "Fake bios.");
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
"loadbios BIOS_DUMP [INT10_DUMP]",

View File

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

View File

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

View File

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

View File

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

View File

@ -21,6 +21,7 @@
#include <grub/misc.h>
#include <grub/term.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
static grub_err_t
grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
@ -38,13 +39,14 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
{
char description[GRUB_TERM_WIDTH / 2];
int desclen = grub_strlen (cmd->summary);
const char* summary_translated = _(cmd->summary);
int desclen = grub_strlen (summary_translated);
/* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled
with the description followed by spaces. */
grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1);
description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
grub_memcpy (description, cmd->summary,
grub_memcpy (description, summary_translated,
(desclen < GRUB_TERM_WIDTH / 2 - 1
? desclen : GRUB_TERM_WIDTH / 2 - 1));
@ -65,8 +67,8 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
grub_arg_show_help ((grub_extcmd_t) cmd->data);
else
grub_printf ("Usage: %s\n%s\b", cmd->summary,
cmd->description);
grub_printf ("%s %s\n%s\b", _("Usage:"), _(cmd->summary),
_(cmd->description));
}
}
return 0;
@ -94,8 +96,8 @@ GRUB_MOD_INIT(help)
{
cmd = grub_register_extcmd ("help", grub_cmd_help,
GRUB_COMMAND_FLAG_CMDLINE,
"help [PATTERN ...]",
"Show a help message.", 0);
N_("help [PATTERN ...]"),
N_("Show a help message."), 0);
}
GRUB_MOD_FINI(help)

View File

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

View File

@ -33,7 +33,7 @@
static const struct grub_arg_option options[] =
{
{"long-mode", 'l', 0, "check for long mode flag (default)", 0, 0},
{"long-mode", 'l', 0, "Check for long mode flag (default).", 0, 0},
{0, 0, 0, 0, 0, 0}
};
@ -88,7 +88,7 @@ done:
#endif
cmd = grub_register_extcmd ("cpuid", grub_cmd_cpuid, GRUB_COMMAND_FLAG_BOTH,
"cpuid [-l]", "Check for CPU features", options);
"cpuid [-l]", "Check for CPU features.", options);
}
GRUB_MOD_FINI(cpuid)

View File

@ -33,9 +33,9 @@ static grub_uint32_t *const int13slot = UINT_TO_PTR (4 * 0x13);
/* Remember to update enum opt_idxs accordingly. */
static const struct grub_arg_option options[] = {
{"list", 'l', 0, "show the current mappings", 0, 0},
{"reset", 'r', 0, "reset all mappings to the default values", 0, 0},
{"swap", 's', 0, "perform both direct and reverse mappings", 0, 0},
{"list", 'l', 0, "Show the current mappings.", 0, 0},
{"reset", 'r', 0, "Reset all mappings to the default values.", 0, 0},
{"swap", 's', 0, "Perform both direct and reverse mappings.", 0, 0},
{0, 0, 0, 0, 0, 0}
};
@ -308,7 +308,7 @@ install_int13_handler (int noret __attribute__ ((unused)))
GRUB_MACHINE_MEMORY_RESERVED,
GRUB_MMAP_MALLOC_LOW);
if (! handler_base)
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Could not reserve "
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't reserve "
"memory for the int13h handler");
/* Copy int13h handler bundle to reserved area. */
@ -370,7 +370,7 @@ grub_get_root_biosnumber_drivemap (void)
return grub_strtoul (biosnum, 0, 0);
dev = grub_device_open (0);
if (dev && dev->disk && dev->disk->dev
if (dev && dev->disk && dev->disk->dev
&& dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID)
{
drivemap_node_t *curnode = map_head;
@ -404,7 +404,7 @@ GRUB_MOD_INIT (drivemap)
GRUB_COMMAND_FLAG_BOTH,
"drivemap"
" -l | -r | [-s] grubdev osdisk",
"Manage the BIOS drive mappings",
"Manage the BIOS drive mappings.",
options);
drivemap_hook =
grub_loader_register_preboot_hook (&install_int13_handler,

View File

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

View File

@ -27,6 +27,7 @@
#include <grub/machine/time.h>
#include <grub/cpu/io.h>
#include <grub/command.h>
#include <grub/i18n.h>
#define BASE_TEMPO 120
@ -207,7 +208,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(play)
{
cmd = grub_register_command ("play", grub_cmd_play,
"play FILE", "Play a tune");
N_("play FILE"), N_("Play a tune."));
}
GRUB_MOD_FINI(play)

View File

@ -1,7 +1,7 @@
/* pxe.c - command to control the pxe driver */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,79 +21,31 @@
#include <grub/err.h>
#include <grub/misc.h>
#include <grub/machine/pxe.h>
#include <grub/extcmd.h>
static const struct grub_arg_option options[] =
{
{"info", 'i', 0, "show PXE information.", 0, 0},
{"bsize", 'b', 0, "set PXE block size", 0, ARG_TYPE_INT},
{"unload", 'u', 0, "unload PXE stack.", 0, 0},
{0, 0, 0, 0, 0, 0}
};
static void
print_ip (grub_uint32_t ip)
{
int i;
for (i = 0; i < 3; i++)
{
grub_printf ("%d.", ip & 0xFF);
ip >>= 8;
}
grub_printf ("%d", ip);
}
#include <grub/command.h>
static grub_err_t
grub_cmd_pxe (grub_extcmd_t cmd, int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
grub_cmd_pxe_unload (grub_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char **args __attribute__ ((unused)))
{
struct grub_arg_list *state = cmd->state;
if (! grub_pxe_pxenv)
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no pxe environment");
if (state[1].set)
{
int size;
size = grub_strtoul (state[1].arg, 0, 0);
if (size < GRUB_PXE_MIN_BLKSIZE)
size = GRUB_PXE_MIN_BLKSIZE;
else if (size > GRUB_PXE_MAX_BLKSIZE)
size = GRUB_PXE_MAX_BLKSIZE;
grub_pxe_blksize = size;
}
if (state[0].set)
{
grub_printf ("blksize : %d\n", grub_pxe_blksize);
grub_printf ("client ip : ");
print_ip (grub_pxe_your_ip);
grub_printf ("\nserver ip : ");
print_ip (grub_pxe_server_ip);
grub_printf ("\ngateway ip : ");
print_ip (grub_pxe_gateway_ip);
grub_printf ("\n");
}
if (state[2].set)
grub_pxe_unload ();
grub_pxe_unload ();
return 0;
}
static grub_extcmd_t cmd;
static grub_command_t cmd;
GRUB_MOD_INIT(pxecmd)
{
cmd = grub_register_extcmd ("pxe", grub_cmd_pxe, GRUB_COMMAND_FLAG_BOTH,
"pxe [-i|-b|-u]",
"Command to control the PXE device.", options);
cmd = grub_register_command ("pxe_unload", grub_cmd_pxe_unload,
"pxe_unload",
"Unload PXE environment.");
}
GRUB_MOD_FINI(pxecmd)
{
grub_unregister_extcmd (cmd);
grub_unregister_command (cmd);
}

View File

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

View File

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

View File

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

View File

@ -29,7 +29,7 @@
static const struct grub_arg_option options[] =
{
{"file", 'f', 0, "specify filename", 0, ARG_TYPE_PATHNAME},
{"file", 'f', 0, "Specify filename.", 0, ARG_TYPE_PATHNAME},
{0, 0, 0, 0, 0, 0}
};
@ -328,7 +328,7 @@ grub_cmd_save_env (grub_extcmd_t cmd, int argc, char **args)
}
if (! argc)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "No variable is specified");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no variable is specified");
file = open_envblk_file ((state[0].set) ? state[0].arg : 0);
if (! file)

View File

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

View File

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

View File

@ -19,29 +19,53 @@
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/command.h>
#include <grub/extcmd.h>
#include <grub/env.h>
static grub_command_t cmd_read_byte, cmd_read_word, cmd_read_dword;
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.",
"VARNAME", ARG_TYPE_STRING},
{0, 0, 0, 0, 0, 0}
};
static grub_err_t
grub_cmd_read (grub_command_t cmd, int argc, char **argv)
grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
{
grub_target_addr_t addr;
grub_uint32_t value;
grub_uint32_t value = 0;
char buf[sizeof ("XXXXXXXX")];
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
addr = grub_strtoul (argv[0], 0, 0);
if (cmd->name[5] == 'd')
value = *((grub_uint32_t *) addr);
else if (cmd->name[5] == 'w')
value = *((grub_uint16_t *) addr);
else
value = *((grub_uint8_t *) addr);
switch (cmd->cmd->name[sizeof ("read_") - 1])
{
case 'd':
value = *((volatile grub_uint32_t *) addr);
break;
grub_printf ("0x%x\n", value);
case 'w':
value = *((volatile grub_uint16_t *) addr);
break;
case 'b':
value = *((volatile grub_uint8_t *) addr);
break;
}
if (cmd->state[0].set)
{
grub_sprintf (buf, "%x", value);
grub_env_set (cmd->state[0].arg, buf);
}
else
grub_printf ("0x%x\n", value);
return 0;
}
@ -51,18 +75,42 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
{
grub_target_addr_t addr;
grub_uint32_t value;
grub_uint32_t mask = 0xffffffff;
if (argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
if (argc != 2 && argc != 3)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
addr = grub_strtoul (argv[0], 0, 0);
value = grub_strtoul (argv[1], 0, 0);
if (cmd->name[6] == 'd')
*((grub_uint32_t *) addr) = value;
else if (cmd->name[6] == 'w')
*((grub_uint16_t *) addr) = (grub_uint16_t) value;
else
*((grub_uint8_t *) addr) = (grub_uint8_t) value;
if (argc == 3)
mask = grub_strtoul (argv[2], 0, 0);
value &= mask;
switch (cmd->name[sizeof ("write_") - 1])
{
case 'd':
if (mask != 0xffffffff)
*((volatile grub_uint32_t *) addr)
= (*((volatile grub_uint32_t *) addr) & ~mask) | value;
else
*((volatile grub_uint32_t *) addr) = value;
break;
case 'w':
if ((mask & 0xffff) != 0xffff)
*((volatile grub_uint16_t *) addr)
= (*((volatile grub_uint16_t *) addr) & ~mask) | value;
else
*((volatile grub_uint16_t *) addr) = value;
break;
case 'b':
if ((mask & 0xff) != 0xff)
*((volatile grub_uint8_t *) addr)
= (*((volatile grub_uint8_t *) addr) & ~mask) | value;
else
*((volatile grub_uint8_t *) addr) = value;
break;
}
return 0;
}
@ -70,30 +118,30 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
GRUB_MOD_INIT(memrw)
{
cmd_read_byte =
grub_register_command ("read_byte", grub_cmd_read,
"read_byte ADDR", "read byte.");
grub_register_extcmd ("read_byte", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_byte ADDR", "Read byte from ADDR.", options);
cmd_read_word =
grub_register_command ("read_word", grub_cmd_read,
"read_word ADDR", "read word.");
grub_register_extcmd ("read_word", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_word ADDR", "Read word from ADDR.", options);
cmd_read_dword =
grub_register_command ("read_dword", grub_cmd_read,
"read_dword ADDR", "read dword.");
grub_register_extcmd ("read_dword", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
"read_dword ADDR", "Read dword from ADDR.", options);
cmd_write_byte =
grub_register_command ("write_byte", grub_cmd_write,
"write_byte ADDR VALUE", "write byte.");
"write_byte ADDR VALUE [MASK]", "Write byte VALUE to ADDR.");
cmd_write_word =
grub_register_command ("write_word", grub_cmd_write,
"write_word ADDR VALUE", "write word.");
"write_word ADDR VALUE [MASK]", "Write word VALUE to ADDR.");
cmd_write_dword =
grub_register_command ("write_dword", grub_cmd_write,
"write_dword ADDR VALUE", "write dword.");
"write_dword ADDR VALUE [MASK]", "Write dword VALUE to ADDR.");
}
GRUB_MOD_FINI(memrw)
{
grub_unregister_command (cmd_read_byte);
grub_unregister_command (cmd_read_word);
grub_unregister_command (cmd_read_dword);
grub_unregister_extcmd (cmd_read_byte);
grub_unregister_extcmd (cmd_read_word);
grub_unregister_extcmd (cmd_read_dword);
grub_unregister_command (cmd_write_byte);
grub_unregister_command (cmd_write_word);
grub_unregister_command (cmd_write_dword);

View File

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

View File

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

View File

@ -53,7 +53,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
char *pass;
if (argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Two arguments expected.");
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments expected");
pass = grub_strdup (args[1]);
if (!pass)

View File

@ -31,15 +31,15 @@
#include <grub/env.h>
#include <grub/extcmd.h>
static const struct grub_arg_option options[] =
static const struct grub_arg_option options[] =
{
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
"set a variable to return value", "VAR", ARG_TYPE_STRING},
{"driver", 'd', 0, "determine driver", 0, 0},
{"partmap", 'p', 0, "determine partition map type", 0, 0},
{"fs", 'f', 0, "determine filesystem type", 0, 0},
{"fs-uuid", 'u', 0, "determine filesystem UUID", 0, 0},
{"label", 'l', 0, "determine filesystem label", 0, 0},
"Set a variable to return value.", "VAR", ARG_TYPE_STRING},
{"driver", 'd', 0, "Determine driver.", 0, 0},
{"partmap", 'p', 0, "Determine partition map type.", 0, 0},
{"fs", 'f', 0, "Determine filesystem type.", 0, 0},
{"fs-uuid", 'u', 0, "Determine filesystem UUID.", 0, 0},
{"label", 'l', 0, "Determine filesystem label.", 0, 0},
{0, 0, 0, 0, 0, 0}
};

View File

@ -62,7 +62,7 @@ grub_getline (void)
}
static grub_err_t
grub_cmd_read (grub_command_t cmd UNUSED, int argc, char **args)
grub_cmd_read (grub_command_t cmd __attribute__ ((unused)), int argc, char **args)
{
char *line = grub_getline ();
if (! line)
@ -80,7 +80,7 @@ GRUB_MOD_INIT(read)
{
cmd = grub_register_command ("read", grub_cmd_read,
"read [ENVVAR]",
"Set variable with user input");
"Set variable with user input.");
}
GRUB_MOD_FINI(read)

View File

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

View File

@ -26,14 +26,15 @@
#include <grub/file.h>
#include <grub/env.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
static const struct grub_arg_option options[] =
{
{"file", 'f', 0, "search devices by a file", 0, 0},
{"label", 'l', 0, "search devices by a filesystem label", 0, 0},
{"fs-uuid", 'u', 0, "search devices by a filesystem UUID", 0, 0},
{"set", 's', GRUB_ARG_OPTION_OPTIONAL, "set a variable to the first device found", "VAR", ARG_TYPE_STRING},
{"no-floppy", 'n', 0, "do not probe any floppy drive", 0, 0},
{"file", 'f', 0, N_("Search devices by a file."), 0, 0},
{"label", 'l', 0, N_("Search devices by a filesystem label."), 0, 0},
{"fs-uuid", 'u', 0, N_("Search devices by a filesystem UUID."), 0, 0},
{"set", 's', GRUB_ARG_OPTION_OPTIONAL, N_("Set a variable to the first device found."), "VAR", ARG_TYPE_STRING},
{"no-floppy", 'n', 0, N_("Do not probe any floppy drive."), 0, 0},
{0, 0, 0, 0, 0, 0}
};
@ -186,11 +187,11 @@ GRUB_MOD_INIT(search)
cmd =
grub_register_extcmd ("search", grub_cmd_search,
GRUB_COMMAND_FLAG_BOTH,
"search [-f|-l|-u|-s|-n] NAME",
"Search devices by file, filesystem label or filesystem UUID."
N_("search [-f|-l|-u|-s|-n] NAME"),
N_("Search devices by file, filesystem label or filesystem UUID."
" If --set is specified, the first device found is"
" set to a variable. If no variable name is"
" specified, \"root\" is used.",
" specified, \"root\" is used."),
options);
}

View File

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

View File

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

View File

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

View File

@ -19,6 +19,7 @@
#include <grub/types.h>
#include <grub/misc.h>
#include <grub/charset.h>
#include <grub/mm.h>
#include <grub/err.h>
#include <grub/dl.h>
@ -59,18 +60,60 @@ static const char *usb_devspeed[] =
"High"
};
static grub_usb_err_t
grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index, int langid,
char **string)
{
struct grub_usb_desc_str descstr;
struct grub_usb_desc_str *descstrp;
grub_usb_err_t err;
/* Only get the length. */
err = grub_usb_control_msg (dev, 1 << 7,
0x06, (3 << 8) | index,
langid, 1, (char *) &descstr);
if (err)
return err;
descstrp = grub_malloc (descstr.length);
if (! descstrp)
return GRUB_USB_ERR_INTERNAL;
err = grub_usb_control_msg (dev, 1 << 7,
0x06, (3 << 8) | index,
langid, descstr.length, (char *) descstrp);
*string = grub_malloc (descstr.length / 2);
if (! *string)
{
grub_free (descstrp);
return GRUB_USB_ERR_INTERNAL;
}
grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str, descstrp->length / 2 - 1);
(*string)[descstr.length / 2 - 1] = '\0';
grub_free (descstrp);
return GRUB_USB_ERR_NONE;
}
static void
usb_print_str (const char *description, grub_usb_device_t dev, int idx)
{
char *name;
grub_usb_err_t err;
/* XXX: LANGID */
if (! idx)
return;
grub_usb_get_string (dev, idx, 0x0409, &name);
grub_printf ("%s: `%s'\n", description, name);
grub_free (name);
err = grub_usb_get_string (dev, idx, 0x0409, &name);
if (err)
grub_printf ("Error %d retrieving %s\n", err, description);
else
{
grub_printf ("%s: `%s'\n", description, name);
grub_free (name);
}
}
static int
@ -152,7 +195,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(usbtest)
{
cmd = grub_register_command ("usb", grub_cmd_usbtest,
0, "Test USB support");
0, "Test USB support.");
}
GRUB_MOD_FINI(usbtest)

View File

@ -71,7 +71,7 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
sanssmall = grub_font_get ("Helvetica 8");
fixed = grub_font_get ("Fixed 20");
if (! sansbig || ! sans || ! sanssmall || ! fixed)
return grub_error (GRUB_ERR_BAD_FONT, "No font loaded.");
return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
glyph = grub_font_get_glyph (fixed, '*');
grub_font_draw_glyph (glyph, color, 200 ,0);
@ -178,7 +178,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(videotest)
{
cmd = grub_register_command ("videotest", grub_cmd_videotest,
0, "Test video subsystem");
0, "Test video subsystem.");
}
GRUB_MOD_FINI(videotest)

View File

@ -1,4 +1,4 @@
/* xnu_uuid.c - transform 64-bit serial number
/* xnu_uuid.c - transform 64-bit serial number
to 128-bit uuid suitable for xnu. */
/*
* GRUB -- GRand Unified Bootloader
@ -38,10 +38,10 @@ struct tohash
grub_uint64_t serial;
} __attribute__ ((packed));
/* This prefix is used by xnu and boot-132 to hash
/* This prefix is used by xnu and boot-132 to hash
together with volume serial. */
static grub_uint8_t hash_prefix[16]
= {0xB3, 0xE2, 0x0F, 0x39, 0xF2, 0x92, 0x11, 0xD6,
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))) )
@ -237,7 +237,7 @@ md5_write( void *context, const void *inbuf_arg , grub_size_t inlen)
}
// _gcry_burn_stack (80+6*sizeof(void*));
while( inlen >= 64 )
while( inlen >= 64 )
{
transform( hd, inbuf );
hd->count = 0;

View File

@ -638,3 +638,8 @@ pkglib_MODULES += setjmp.mod
setjmp_mod_SOURCES = lib/$(target_cpu)/setjmp.S
setjmp_mod_ASFLAGS = $(COMMON_ASFLAGS)
setjmp_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += charset.mod
charset_mod_SOURCES = lib/charset.c
charset_mod_CFLAGS = $(COMMON_CFLAGS)
charset_mod_LDFLAGS = $(COMMON_LDFLAGS)

View File

@ -111,7 +111,7 @@ pkglib_MODULES = linux.mod multiboot.mod \
lsmmap.mod mmap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)

View File

@ -67,7 +67,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod.
pkglib_MODULES += boot.mod
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -154,8 +154,8 @@ efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\
loader/macho.c loader/xnu.c
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)

View File

@ -60,7 +60,7 @@ pkglib_MODULES = halt.mod reboot.mod suspend.mod \
date.mod datehook.mod lsmmap.mod mmap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)

View File

@ -128,7 +128,7 @@ pkglib_MODULES = biosdisk.mod chain.mod \
efiemu.mod mmap.mod acpi.mod drivemap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -183,8 +183,8 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c\
loader/macho.c loader/xnu.c
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c \
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)

View File

@ -66,7 +66,7 @@ pkglib_MODULES = halt.mod \
lsmmap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)

View File

@ -103,7 +103,7 @@ pkglib_MODULES = halt.mod \
lsmmap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)

View File

@ -67,7 +67,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod.
pkglib_MODULES += boot.mod
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -160,8 +160,8 @@ efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\
loader/macho.c loader/xnu.c
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)

View File

@ -281,7 +281,7 @@ grub_ata_identify (struct grub_ata_device *dev)
else
/* Other Error. */
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"device can not be identified");
"device cannot be identified");
}
grub_ata_pio_read (dev, info, GRUB_DISK_SECTOR_SIZE);
@ -534,7 +534,7 @@ grub_ata_setaddress (struct grub_ata_device *dev,
|| cylinder > dev->cylinders
|| head > dev->heads)
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"sector %d can not be addressed "
"sector %d cannot be addressed "
"using CHS addressing", sector);
grub_ata_regset (dev, GRUB_ATA_REG_DISK, (dev->device << 4) | head);
@ -689,7 +689,7 @@ grub_ata_open (const char *name, grub_disk_t disk)
}
if (! dev)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
if (dev->atapi)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not an ATA harddisk");
@ -789,7 +789,7 @@ grub_atapi_read (struct grub_scsi *scsi,
/* Count of last transfer may be uneven. */
if (! (0 < cnt && cnt <= size - nread && (! (cnt & 1) || cnt == size - nread)))
return grub_error (GRUB_ERR_READ_ERROR, "Invalid ATAPI transfer count");
return grub_error (GRUB_ERR_READ_ERROR, "invalid ATAPI transfer count");
/* Read the data. */
grub_ata_pio_read (dev, buf + nread, cnt);
@ -835,7 +835,7 @@ grub_atapi_open (const char *name, struct grub_scsi *scsi)
grub_dprintf ("ata", "opening ATAPI dev `%s'\n", name);
if (! devfnd)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "No such ATAPI device");
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no such ATAPI device");
scsi->data = devfnd;

View File

@ -30,7 +30,7 @@ grub_ata_pass_through (grub_disk_t disk,
{
if (disk->dev->id != GRUB_DISK_DEVICE_ATA_ID)
return grub_error (GRUB_ERR_BAD_DEVICE,
"Device not accessed via ata.mod");
"device not accessed via ata.mod");
struct grub_ata_device *dev = (struct grub_ata_device *) disk->data;

View File

@ -107,7 +107,7 @@ grub_dmraid_nv_detect (grub_disk_t disk, struct grub_raid_array *array)
if (sb.version != NV_VERSION)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unknown version: %d.%d", sb.version);
"unknown version: %d.%d", sb.version);
switch (sb.array.raid_level)
{
@ -129,7 +129,7 @@ grub_dmraid_nv_detect (grub_disk_t disk, struct grub_raid_array *array)
default:
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unsupported RAID level: %d", sb.array.raid_level);
"unsupported RAID level: %d", sb.array.raid_level);
}
array->number = 0;

View File

@ -67,7 +67,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
} args;
if (! grub_strstr (name, "nand"))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Not a nand device");
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a NAND device");
data = grub_malloc (sizeof (*data));
if (! data)
@ -76,7 +76,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
grub_ieee1275_open (name, &dev_ihandle);
if (! dev_ihandle)
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
goto fail;
}
@ -89,7 +89,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't get block size");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't get block size");
goto fail;
}
@ -102,7 +102,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't get disk size");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't get disk size");
goto fail;
}
@ -172,7 +172,7 @@ grub_nand_read (grub_disk_t disk, grub_disk_addr_t sector,
args.result = 1;
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
return grub_error (GRUB_ERR_READ_ERROR, "Read error");
return grub_error (GRUB_ERR_READ_ERROR, "read error");
ofs = 0;
size -= len;

View File

@ -175,7 +175,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
grub_ieee1275_open (op->devpath, &dev_ihandle);
if (! dev_ihandle)
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
goto fail;
}
@ -184,20 +184,20 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
if (grub_ieee1275_finddevice (op->devpath, &dev))
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't read device properties");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't read device properties");
goto fail;
}
if (grub_ieee1275_get_property (dev, "device_type", prop, sizeof (prop),
&actual))
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't read the device type");
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't read the device type");
goto fail;
}
if (grub_strcmp (prop, "block"))
{
grub_error (GRUB_ERR_BAD_DEVICE, "Not a block device");
grub_error (GRUB_ERR_BAD_DEVICE, "not a block device");
goto fail;
}
@ -244,12 +244,12 @@ grub_ofdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
(int) (pos >> 32), (int) pos & 0xFFFFFFFFUL, &status);
if (status < 0)
return grub_error (GRUB_ERR_READ_ERROR,
"Seek error, can't seek block %llu",
"seek error, can't seek block %llu",
(long long) sector);
grub_ieee1275_read ((grub_ieee1275_ihandle_t) (unsigned long) disk->data,
buf, size * 512UL, &actual);
if (actual != actual)
return grub_error (GRUB_ERR_READ_ERROR, "Read error on block: %llu",
return grub_error (GRUB_ERR_READ_ERROR, "read error on block: %llu",
(long long) sector);
return 0;

View File

@ -56,7 +56,7 @@ delete_loopback (const char *name)
break;
if (! dev)
return grub_error (GRUB_ERR_BAD_DEVICE, "Device not found");
return grub_error (GRUB_ERR_BAD_DEVICE, "device not found");
/* Remove the device from the list. */
*prev = dev->next;
@ -167,7 +167,7 @@ grub_loopback_open (const char *name, grub_disk_t disk)
break;
if (! dev)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
file = grub_file_open (dev->filename);
if (! file)

View File

@ -95,7 +95,7 @@ grub_lvm_open (const char *name, grub_disk_t disk)
}
if (! lv)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Unknown LVM device %s", name);
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown LVM device %s", name);
disk->has_partitions = 0;
disk->id = lv->number;
@ -188,7 +188,7 @@ grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
size << GRUB_DISK_SECTOR_BITS, buf);
else
err = grub_error (GRUB_ERR_UNKNOWN_DEVICE,
"Physical volume %s not found", pv->name);
"physical volume %s not found", pv->name);
return err;
}
@ -263,7 +263,7 @@ grub_lvm_scan_device (const char *name)
if (dlocn->offset)
{
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"We don't support multiple LVM data areas");
"we don't support multiple LVM data areas");
goto fail;
}
@ -290,7 +290,7 @@ grub_lvm_scan_device (const char *name)
|| (grub_le_to_cpu32 (mdah->version) != GRUB_LVM_FMTT_VERSION))
{
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unknown LVM metadata header");
"unknown LVM metadata header");
goto fail2;
}

View File

@ -181,7 +181,7 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array)
/* FIXME: Also support version 1.0. */
if (sb.major_version != 0 || sb.minor_version != 90)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unsupported RAID version: %d.%d",
"unsupported RAID version: %d.%d",
sb.major_version, sb.minor_version);
/* FIXME: Check the checksum. */
@ -193,7 +193,7 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array)
if (sb.level != 0 && sb.level != 1 && sb.level != 4 &&
sb.level != 5 && sb.level != 6 && sb.level != 10)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unsupported RAID level: %d", sb.level);
"unsupported RAID level: %d", sb.level);
array->number = sb.md_minor;
array->level = sb.level;

View File

@ -123,7 +123,7 @@ grub_raid_open (const char *name, grub_disk_t disk)
}
if (!array)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Unknown RAID device %s",
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown RAID device %s",
name);
disk->has_partitions = 1;
@ -265,7 +265,7 @@ grub_raid_read (grub_disk_t disk, grub_disk_addr_t sector,
}
else
err = grub_error (GRUB_ERR_READ_ERROR,
"disk missing.");
"disk missing");
k++;
if (k == array->total_devs)

View File

@ -157,7 +157,7 @@ grub_raid6_recover (struct grub_raid_array *array, int disknr, int p,
if (! array->device[q])
{
grub_error (GRUB_ERR_READ_ERROR, "Not enough disk to restore");
grub_error (GRUB_ERR_READ_ERROR, "not enough disk to restore");
goto quit;
}
@ -176,7 +176,7 @@ grub_raid6_recover (struct grub_raid_array *array, int disknr, int p,
if ((! array->device[p]) || (! array->device[q]))
{
grub_error (GRUB_ERR_READ_ERROR, "Not enough disk to restore");
grub_error (GRUB_ERR_READ_ERROR, "not enough disk to restore");
goto quit;
}

View File

@ -337,14 +337,14 @@ grub_scsi_read (grub_disk_t disk, grub_disk_addr_t sector,
unsigned spb = scsi->blocksize >> GRUB_DISK_SECTOR_BITS;
if (! (spb != 0 && (scsi->blocksize & GRUB_DISK_SECTOR_SIZE) == 0))
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unsupported SCSI block size");
"unsupported SCSI block size");
grub_uint32_t sector_mod = 0;
sector = grub_divmod64 (sector, spb, &sector_mod);
if (! (sector_mod == 0 && size % spb == 0))
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"Unaligned SCSI read not supported");
"unaligned SCSI read not supported");
size /= spb;
}

View File

@ -39,6 +39,7 @@ grub_efi_system_table64_t *grub_efiemu_system_table64 = 0;
static struct grub_efiemu_prepare_hook *efiemu_prepare_hooks = 0;
/* Linked list of configuration tables */
static struct grub_efiemu_configuration_table *efiemu_config_tables = 0;
static int prepared = 0;
/* Free all allocated space */
grub_err_t
@ -70,6 +71,8 @@ grub_efiemu_unload (void)
}
efiemu_prepare_hooks = 0;
prepared = 0;
return GRUB_ERR_NONE;
}
@ -211,7 +214,7 @@ grub_efiemu_load_file (const char *filename)
{
grub_file_close (file);
grub_efiemu_unload ();
return grub_error (grub_errno, "Couldn't init memory management");
return grub_error (grub_errno, "couldn't init memory management");
}
grub_dprintf ("efiemu", "mm initialized\n");
@ -277,14 +280,19 @@ grub_efiemu_prepare (void)
{
grub_err_t err;
if (prepared)
return GRUB_ERR_NONE;
grub_dprintf ("efiemu", "Preparing %d-bit efiemu\n",
8 * grub_efiemu_sizeof_uintn_t ());
err = grub_efiemu_autocore ();
/* Create NVRAM if not yet done. */
/* Create NVRAM. */
grub_efiemu_pnvram ();
prepared = 1;
if (grub_efiemu_sizeof_uintn_t () == 4)
return grub_efiemu_prepare32 (efiemu_prepare_hooks, efiemu_config_tables);
else
@ -316,9 +324,6 @@ grub_cmd_efiemu_load (grub_command_t cmd __attribute__ ((unused)),
static grub_command_t cmd_loadcore, cmd_prepare, cmd_unload;
void
grub_efiemu_pnvram_cmd_register (void);
GRUB_MOD_INIT(efiemu)
{
cmd_loadcore = grub_register_command ("efiemu_loadcore",
@ -332,7 +337,6 @@ GRUB_MOD_INIT(efiemu)
cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
"efiemu_unload",
"Unload EFI emulator");
grub_efiemu_pnvram_cmd_register ();
}
GRUB_MOD_FINI(efiemu)
@ -340,5 +344,4 @@ GRUB_MOD_FINI(efiemu)
grub_unregister_command (cmd_loadcore);
grub_unregister_command (cmd_prepare);
grub_unregister_command (cmd_unload);
grub_efiemu_pnvram_cmd_unregister ();
}

View File

@ -67,7 +67,7 @@ grub_efiemu_add_to_mmap (grub_uint64_t start, grub_uint64_t size,
* sizeof (grub_efi_memory_descriptor_t));
if (!efiemu_mmap)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Not enough space for memory map");
"not enough space for memory map");
}
/* Fill slot*/
@ -622,7 +622,7 @@ grub_efiemu_mm_do_alloc (void)
if (!efiemu_mmap)
{
grub_efiemu_unload ();
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Couldn't initialize mmap");
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't initialize mmap");
}
if ((err = efiemu_alloc_requests ()))

View File

@ -22,6 +22,7 @@
#include <grub/normal.h>
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/charset.h>
#include <grub/efiemu/efiemu.h>
#include <grub/efiemu/runtime.h>
#include <grub/extcmd.h>
@ -34,62 +35,184 @@ static int timezone_handle = 0;
static int accuracy_handle = 0;
static int daylight_handle = 0;
/* Temporary place */
static grub_uint8_t *nvram;
static grub_size_t nvramsize;
static grub_uint32_t high_monotonic_count;
static grub_int16_t timezone;
static grub_uint8_t daylight;
static grub_uint32_t accuracy;
static const struct grub_arg_option options[] = {
{"size", 's', 0, "number of bytes to reserve for pseudo NVRAM", 0,
ARG_TYPE_INT},
{"high-monotonic-count", 'm', 0,
"Initial value of high monotonic count", 0, ARG_TYPE_INT},
{"timezone", 't', 0,
"Timezone, offset in minutes from GMT", 0, ARG_TYPE_INT},
{"accuracy", 'a', 0,
"Accuracy of clock, in 1e-12 units", 0, ARG_TYPE_INT},
{"daylight", 'd', 0,
"Daylight value, as per EFI specifications", 0, ARG_TYPE_INT},
{0, 0, 0, 0, 0, 0}
};
/* Parse signed value */
static int
grub_strtosl (char *arg, char **end, int base)
grub_strtosl (const char *arg, char **end, int base)
{
if (arg[0] == '-')
return -grub_strtoul (arg + 1, end, base);
return grub_strtoul (arg, end, base);
}
static inline int
hextoval (char c)
{
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'a' && c <= 'z')
return c - 'a' + 10;
if (c >= 'A' && c <= 'Z')
return c - 'A' + 10;
return 0;
}
static inline grub_err_t
unescape (char *in, char *out, char *outmax, int *len)
{
char *ptr, *dptr;
dptr = out;
for (ptr = in; *ptr && dptr < outmax; )
if (*ptr == '%' && ptr[1] && ptr[2])
{
*dptr = (hextoval (ptr[1]) << 4) | (hextoval (ptr[2]));
ptr += 3;
dptr++;
}
else
{
*dptr = *ptr;
ptr++;
dptr++;
}
if (dptr == outmax)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"too many NVRAM variables for reserved variable space."
" Try increasing EfiEmu.pnvram.size");
*len = dptr - out;
return 0;
}
/* Export stuff for efiemu */
static grub_err_t
nvram_set (void * data __attribute__ ((unused)))
{
const char *env;
/* Take definitive pointers */
grub_uint8_t *nvram_def = grub_efiemu_mm_obtain_request (nvram_handle);
char *nvram = grub_efiemu_mm_obtain_request (nvram_handle);
grub_uint32_t *nvramsize_def
= grub_efiemu_mm_obtain_request (nvramsize_handle);
grub_uint32_t *high_monotonic_count_def
grub_uint32_t *high_monotonic_count
= grub_efiemu_mm_obtain_request (high_monotonic_count_handle);
grub_int16_t *timezone_def
grub_int16_t *timezone
= grub_efiemu_mm_obtain_request (timezone_handle);
grub_uint8_t *daylight_def
grub_uint8_t *daylight
= grub_efiemu_mm_obtain_request (daylight_handle);
grub_uint32_t *accuracy_def
grub_uint32_t *accuracy
= grub_efiemu_mm_obtain_request (accuracy_handle);
char *nvramptr;
auto int iterate_env (struct grub_env_var *var);
int iterate_env (struct grub_env_var *var)
{
char *guid, *attr, *name, *varname;
struct efi_variable *efivar;
int len = 0;
int i;
grub_uint64_t guidcomp;
if (grub_memcmp (var->name, "EfiEmu.pnvram.",
sizeof ("EfiEmu.pnvram.") - 1) != 0)
return 0;
guid = var->name + sizeof ("EfiEmu.pnvram.") - 1;
attr = grub_strchr (guid, '.');
if (!attr)
return 0;
attr++;
name = grub_strchr (attr, '.');
if (!name)
return 0;
name++;
efivar = (struct efi_variable *) nvramptr;
if (nvramptr - nvram + sizeof (struct efi_variable) > nvramsize)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY,
"too many NVRAM variables for reserved variable space."
" Try increasing EfiEmu.pnvram.size");
return 1;
}
nvramptr += sizeof (struct efi_variable);
efivar->guid.data1 = grub_cpu_to_le32 (grub_strtoul (guid, &guid, 16));
if (*guid != '-')
return 0;
guid++;
efivar->guid.data2 = grub_cpu_to_le16 (grub_strtoul (guid, &guid, 16));
if (*guid != '-')
return 0;
guid++;
efivar->guid.data3 = grub_cpu_to_le16 (grub_strtoul (guid, &guid, 16));
if (*guid != '-')
return 0;
guid++;
guidcomp = grub_strtoull (guid, 0, 16);
for (i = 0; i < 8; i++)
efivar->guid.data4[i] = (guidcomp >> (56 - 8 * i)) & 0xff;
efivar->attributes = grub_strtoull (attr, 0, 16);
varname = grub_malloc (grub_strlen (name) + 1);
if (! varname)
return 1;
if (unescape (name, varname, varname + grub_strlen (name) + 1, &len))
return 1;
len = grub_utf8_to_utf16 ((grub_uint16_t *) nvramptr,
(nvramsize - (nvramptr - nvram)) / 2,
(grub_uint8_t *) varname, len, NULL);
if (len < 0)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "broken UTF-8 in variable name");
return 1;
}
nvramptr += 2 * len;
*((grub_uint16_t *) nvramptr) = 0;
nvramptr += 2;
efivar->namelen = 2 * len + 2;
if (unescape (var->value, nvramptr, nvram + nvramsize, &len))
{
efivar->namelen = 0;
return 1;
}
nvramptr += len;
efivar->size = len;
return 0;
}
/* Copy to definitive loaction */
grub_dprintf ("efiemu", "preparing pnvram\n");
grub_memcpy (nvram_def, nvram, nvramsize);
env = grub_env_get ("EfiEmu.pnvram.high_monotonic_count");
*high_monotonic_count = env ? grub_strtoul (env, 0, 0) : 1;
env = grub_env_get ("EfiEmu.pnvram.timezone");
*timezone = env ? grub_strtosl (env, 0, 0) : GRUB_EFI_UNSPECIFIED_TIMEZONE;
env = grub_env_get ("EfiEmu.pnvram.accuracy");
*accuracy = env ? grub_strtoul (env, 0, 0) : 50000000;
env = grub_env_get ("EfiEmu.pnvram.daylight");
*daylight = env ? grub_strtoul (env, 0, 0) : 0;
nvramptr = nvram;
grub_memset (nvram, 0, nvramsize);
grub_env_iterate (iterate_env);
if (grub_errno)
return grub_errno;
*nvramsize_def = nvramsize;
*high_monotonic_count_def = high_monotonic_count;
*timezone_def = timezone;
*daylight_def = daylight;
*accuracy_def = accuracy;
/* Register symbols */
grub_efiemu_register_symbol ("efiemu_variables", nvram_handle, 0);
@ -113,197 +236,27 @@ nvram_unload (void * data __attribute__ ((unused)))
grub_efiemu_mm_return_request (timezone_handle);
grub_efiemu_mm_return_request (accuracy_handle);
grub_efiemu_mm_return_request (daylight_handle);
grub_free (nvram);
nvram = 0;
}
/* Load the variables file It's in format
guid1:attr1:name1:data1;
guid2:attr2:name2:data2;
...
Where all fields are in hex
*/
static grub_err_t
read_pnvram (char *filename)
{
char *buf, *ptr, *ptr2;
grub_file_t file;
grub_size_t size;
grub_uint8_t *nvramptr = nvram;
struct efi_variable *efivar;
grub_size_t guidlen, datalen;
unsigned i, j;
file = grub_file_open (filename);
if (!file)
return grub_error (GRUB_ERR_BAD_OS, "couldn't read pnvram");
size = grub_file_size (file);
buf = grub_malloc (size + 1);
if (!buf)
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't read pnvram");
if (grub_file_read (file, buf, size) != (grub_ssize_t) size)
return grub_error (GRUB_ERR_BAD_OS, "couldn't read pnvram");
buf[size] = 0;
grub_file_close (file);
for (ptr = buf; *ptr; )
{
if (grub_isspace (*ptr))
{
ptr++;
continue;
}
efivar = (struct efi_variable *) nvramptr;
if (nvramptr - nvram + sizeof (struct efi_variable) > nvramsize)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"file is too large for reserved variable space");
nvramptr += sizeof (struct efi_variable);
/* look ahow long guid field is*/
guidlen = 0;
for (ptr2 = ptr; (grub_isspace (*ptr2)
|| (*ptr2 >= '0' && *ptr2 <= '9')
|| (*ptr2 >= 'a' && *ptr2 <= 'f')
|| (*ptr2 >= 'A' && *ptr2 <= 'F'));
ptr2++)
if (!grub_isspace (*ptr2))
guidlen++;
guidlen /= 2;
/* Read guid */
if (guidlen != sizeof (efivar->guid))
{
grub_free (buf);
return grub_error (GRUB_ERR_BAD_OS, "can't parse %s", filename);
}
for (i = 0; i < 2 * sizeof (efivar->guid); i++)
{
int hex = 0;
while (grub_isspace (*ptr))
ptr++;
if (*ptr >= '0' && *ptr <= '9')
hex = *ptr - '0';
if (*ptr >= 'a' && *ptr <= 'f')
hex = *ptr - 'a' + 10;
if (*ptr >= 'A' && *ptr <= 'F')
hex = *ptr - 'A' + 10;
if (i%2 == 0)
((grub_uint8_t *)&(efivar->guid))[i/2] = hex << 4;
else
((grub_uint8_t *)&(efivar->guid))[i/2] |= hex;
ptr++;
}
while (grub_isspace (*ptr))
ptr++;
if (*ptr != ':')
{
grub_dprintf ("efiemu", "Not colon\n");
grub_free (buf);
return grub_error (GRUB_ERR_BAD_OS, "can't parse %s", filename);
}
ptr++;
while (grub_isspace (*ptr))
ptr++;
/* Attributes can be just parsed by existing functions */
efivar->attributes = grub_strtoul (ptr, &ptr, 16);
while (grub_isspace (*ptr))
ptr++;
if (*ptr != ':')
{
grub_dprintf ("efiemu", "Not colon\n");
grub_free (buf);
return grub_error (GRUB_ERR_BAD_OS, "can't parse %s", filename);
}
ptr++;
while (grub_isspace (*ptr))
ptr++;
/* Read name and value */
for (j = 0; j < 2; j++)
{
/* Look the length */
datalen = 0;
for (ptr2 = ptr; *ptr2 && (grub_isspace (*ptr2)
|| (*ptr2 >= '0' && *ptr2 <= '9')
|| (*ptr2 >= 'a' && *ptr2 <= 'f')
|| (*ptr2 >= 'A' && *ptr2 <= 'F'));
ptr2++)
if (!grub_isspace (*ptr2))
datalen++;
datalen /= 2;
if (nvramptr - nvram + datalen > nvramsize)
{
grub_free (buf);
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"file is too large for reserved "
" variable space");
}
for (i = 0; i < 2 * datalen; i++)
{
int hex = 0;
while (grub_isspace (*ptr))
ptr++;
if (*ptr >= '0' && *ptr <= '9')
hex = *ptr - '0';
if (*ptr >= 'a' && *ptr <= 'f')
hex = *ptr - 'a' + 10;
if (*ptr >= 'A' && *ptr <= 'F')
hex = *ptr - 'A' + 10;
if (i%2 == 0)
nvramptr[i/2] = hex << 4;
else
nvramptr[i/2] |= hex;
ptr++;
}
nvramptr += datalen;
while (grub_isspace (*ptr))
ptr++;
if (*ptr != (j ? ';' : ':'))
{
grub_free (buf);
grub_dprintf ("efiemu", j?"Not semicolon\n":"Not colon\n");
return grub_error (GRUB_ERR_BAD_OS, "can't parse %s", filename);
}
if (j)
efivar->size = datalen;
else
efivar->namelen = datalen;
ptr++;
}
}
grub_free (buf);
return GRUB_ERR_NONE;
}
static grub_err_t
grub_efiemu_make_nvram (void)
grub_err_t
grub_efiemu_pnvram (void)
{
const char *size;
grub_err_t err;
err = grub_efiemu_autocore ();
if (err)
{
grub_free (nvram);
return err;
}
nvramsize = 0;
size = grub_env_get ("EfiEmu.pnvram.size");
if (size)
nvramsize = grub_strtoul (size, 0, 0);
if (!nvramsize)
nvramsize = 2048;
err = grub_efiemu_register_prepare_hook (nvram_set, nvram_unload, 0);
if (err)
{
grub_free (nvram);
return err;
}
return err;
nvram_handle
= grub_efiemu_request_memalign (1, nvramsize,
GRUB_EFI_RUNTIME_SERVICES_DATA);
@ -323,78 +276,5 @@ grub_efiemu_make_nvram (void)
= grub_efiemu_request_memalign (1, sizeof (grub_uint32_t),
GRUB_EFI_RUNTIME_SERVICES_DATA);
grub_efiemu_request_symbols (6);
return GRUB_ERR_NONE;
}
grub_err_t
grub_efiemu_pnvram (void)
{
if (nvram)
return GRUB_ERR_NONE;
nvramsize = 2048;
high_monotonic_count = 1;
timezone = GRUB_EFI_UNSPECIFIED_TIMEZONE;
accuracy = 50000000;
daylight = 0;
nvram = grub_zalloc (nvramsize);
if (!nvram)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate space for temporary pnvram storage");
return grub_efiemu_make_nvram ();
}
static grub_err_t
grub_cmd_efiemu_pnvram (struct grub_extcmd *cmd,
int argc, char **args)
{
struct grub_arg_list *state = cmd->state;
grub_err_t err;
if (argc > 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "only one argument expected");
nvramsize = state[0].set ? grub_strtoul (state[0].arg, 0, 0) : 2048;
high_monotonic_count = state[1].set ? grub_strtoul (state[1].arg, 0, 0) : 1;
timezone = state[2].set ? grub_strtosl (state[2].arg, 0, 0)
: GRUB_EFI_UNSPECIFIED_TIMEZONE;
accuracy = state[3].set ? grub_strtoul (state[3].arg, 0, 0) : 50000000;
daylight = state[4].set ? grub_strtoul (state[4].arg, 0, 0) : 0;
nvram = grub_zalloc (nvramsize);
if (!nvram)
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
"Couldn't allocate space for temporary pnvram storage");
if (argc == 1 && (err = read_pnvram (args[0])))
{
grub_free (nvram);
return err;
}
return grub_efiemu_make_nvram ();
}
static grub_extcmd_t cmd;
void grub_efiemu_pnvram_cmd_register (void);
void grub_efiemu_pnvram_cmd_unregister (void);
void
grub_efiemu_pnvram_cmd_register (void)
{
cmd = grub_register_extcmd ("efiemu_pnvram", grub_cmd_efiemu_pnvram,
GRUB_COMMAND_FLAG_BOTH,
"efiemu_pnvram [FILENAME]",
"Initialise pseudo-NVRAM and load variables "
"from FILE",
options);
}
void
grub_efiemu_pnvram_cmd_unregister (void)
{
grub_unregister_extcmd (cmd);
}

View File

@ -36,7 +36,6 @@ SUFFIX (grub_efiemu_prepare) (struct grub_efiemu_prepare_hook *prepare_hooks,
int cntconftables = 0;
struct SUFFIX (grub_efiemu_configuration_table) *conftables = 0;
struct SUFFIX (grub_efiemu_runtime_services) *runtime_services;
int i;
int handle;
grub_off_t off;
@ -54,6 +53,7 @@ SUFFIX (grub_efiemu_prepare) (struct grub_efiemu_prepare_hook *prepare_hooks,
/* Switch from phase 1 (counting) to phase 2 (real job) */
grub_efiemu_alloc_syms ();
grub_efiemu_mm_do_alloc ();
grub_efiemu_write_sym_markers ();
grub_efiemu_system_table32 = 0;
grub_efiemu_system_table64 = 0;
@ -81,16 +81,6 @@ SUFFIX (grub_efiemu_prepare) (struct grub_efiemu_prepare_hook *prepare_hooks,
= (struct SUFFIX (grub_efi_system_table) *)
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
/* compute CRC32 of runtime_services */
if ((err = grub_efiemu_resolve_symbol ("efiemu_runtime_services",
&handle, &off)))
return err;
runtime_services = (struct SUFFIX (grub_efiemu_runtime_services) *)
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
runtime_services->hdr.crc32 = 0;
runtime_services->hdr.crc32 = grub_getcrc32
(0, runtime_services, runtime_services->hdr.header_size);
/* Put pointer to the list of configuration tables in system table */
grub_efiemu_write_value
(&(SUFFIX (grub_efiemu_system_table)->configuration_table), 0,
@ -113,16 +103,51 @@ SUFFIX (grub_efiemu_prepare) (struct grub_efiemu_prepare_hook *prepare_hooks,
conftables[i].vendor_table = PTR_TO_UINT64 (cur->data);
}
err = SUFFIX (grub_efiemu_crc) ();
if (err)
{
grub_efiemu_unload ();
return err;
}
grub_dprintf ("efiemu","system_table = %p, conftables = %p (%d entries)\n",
SUFFIX (grub_efiemu_system_table), conftables, cntconftables);
return GRUB_ERR_NONE;
}
grub_err_t
SUFFIX (grub_efiemu_crc) (void)
{
grub_err_t err;
int handle;
grub_off_t off;
struct SUFFIX (grub_efiemu_runtime_services) *runtime_services;
/* compute CRC32 of runtime_services */
err = grub_efiemu_resolve_symbol ("efiemu_runtime_services",
&handle, &off);
if (err)
return err;
runtime_services = (struct SUFFIX (grub_efiemu_runtime_services) *)
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
runtime_services->hdr.crc32 = 0;
runtime_services->hdr.crc32 = grub_getcrc32
(0, runtime_services, runtime_services->hdr.header_size);
err = grub_efiemu_resolve_symbol ("efiemu_system_table", &handle, &off);
if (err)
return err;
/* compute CRC32 of system table */
SUFFIX (grub_efiemu_system_table)->hdr.crc32 = 0;
SUFFIX (grub_efiemu_system_table)->hdr.crc32
= grub_getcrc32 (0, SUFFIX (grub_efiemu_system_table),
SUFFIX (grub_efiemu_system_table)->hdr.header_size);
grub_dprintf ("efiemu","system_table = %p, runtime_services = %p,"
" conftables = %p (%d entries)\n",
SUFFIX (grub_efiemu_system_table), runtime_services,
conftables, cntconftables);
grub_dprintf ("efiemu","system_table = %p, runtime_services = %p\n",
SUFFIX (grub_efiemu_system_table), runtime_services);
return GRUB_ERR_NONE;
}

View File

@ -111,9 +111,8 @@ static grub_uint8_t loge[1000] = "EFIEMULOG";
static int logn = 9;
#define LOG(x) { if (logn<900) loge[logn++]=x; }
static int ptv_relocated = 0;
/* Interface with grub */
extern grub_uint8_t efiemu_ptv_relocated;
struct grub_efi_runtime_services efiemu_runtime_services;
struct grub_efi_system_table efiemu_system_table;
extern struct grub_efiemu_ptv_rel efiemu_ptv_relloc[];
@ -343,9 +342,9 @@ grub_efi_status_t EFI_FUNC
LOG ('e');
/* Ensure that we are called only once */
if (ptv_relocated)
if (efiemu_ptv_relocated)
return GRUB_EFI_UNSUPPORTED;
ptv_relocated = 1;
efiemu_ptv_relocated = 1;
/* Correct addresses using information supplied by grub */
for (cur_relloc = efiemu_ptv_relloc; cur_relloc->size;cur_relloc++)

View File

@ -26,6 +26,7 @@
static int ptv_written = 0;
static int ptv_alloc = 0;
static int ptv_handle = 0;
static int relocated_handle = 0;
static int ptv_requested = 0;
static struct grub_efiemu_sym *efiemu_syms = 0;
@ -54,6 +55,8 @@ grub_efiemu_free_syms (void)
ptv_requested = 0;
grub_efiemu_mm_return_request (ptv_handle);
ptv_handle = 0;
grub_efiemu_mm_return_request (relocated_handle);
relocated_handle = 0;
}
/* Announce that the module will need NUM allocators */
@ -114,10 +117,26 @@ grub_efiemu_alloc_syms (void)
ptv_handle = grub_efiemu_request_memalign
(1, (ptv_requested + 1) * sizeof (struct grub_efiemu_ptv_rel),
GRUB_EFI_RUNTIME_SERVICES_DATA);
relocated_handle = grub_efiemu_request_memalign
(1, sizeof (grub_uint8_t), GRUB_EFI_RUNTIME_SERVICES_DATA);
grub_efiemu_register_symbol ("efiemu_ptv_relocated", relocated_handle, 0);
grub_efiemu_register_symbol ("efiemu_ptv_relloc", ptv_handle, 0);
return grub_errno;
}
grub_err_t
grub_efiemu_write_sym_markers (void)
{
struct grub_efiemu_ptv_rel *ptv_rels
= grub_efiemu_mm_obtain_request (ptv_handle);
grub_uint8_t *relocated = grub_efiemu_mm_obtain_request (relocated_handle);
grub_memset (ptv_rels, 0, (ptv_requested + 1)
* sizeof (struct grub_efiemu_ptv_rel));
*relocated = 0;
return GRUB_ERR_NONE;
}
/* Write value (pointer to memory PLUS_HANDLE)
- (pointer to memory MINUS_HANDLE) + VALUE to ADDR assuming that the
size SIZE bytes. If PTV_NEEDED is 1 then announce it to runtime that this
@ -186,3 +205,67 @@ grub_efiemu_write_value (void *addr, grub_uint32_t value, int plus_handle,
return GRUB_ERR_NONE;
}
grub_err_t
grub_efiemu_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
grub_efi_uintn_t descriptor_size,
grub_efi_uint32_t descriptor_version
__attribute__ ((unused)),
grub_efi_memory_descriptor_t *virtual_map)
{
grub_uint8_t *ptv_relocated;
struct grub_efiemu_ptv_rel *cur_relloc;
struct grub_efiemu_ptv_rel *ptv_rels;
ptv_relocated = grub_efiemu_mm_obtain_request (relocated_handle);
ptv_rels = grub_efiemu_mm_obtain_request (ptv_handle);
/* Ensure that we are called only once */
if (*ptv_relocated)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "EfiEmu is already relocated");
*ptv_relocated = 1;
/* Correct addresses using information supplied by grub */
for (cur_relloc = ptv_rels; cur_relloc->size; cur_relloc++)
{
grub_int64_t corr = 0;
grub_efi_memory_descriptor_t *descptr;
/* Compute correction */
for (descptr = virtual_map;
(grub_size_t) ((grub_uint8_t *) descptr
- (grub_uint8_t *) virtual_map) < memory_map_size;
descptr = (grub_efi_memory_descriptor_t *)
((grub_uint8_t *) descptr + descriptor_size))
{
if (descptr->type == cur_relloc->plustype)
corr += descptr->virtual_start - descptr->physical_start;
if (descptr->type == cur_relloc->minustype)
corr -= descptr->virtual_start - descptr->physical_start;
}
/* Apply correction */
switch (cur_relloc->size)
{
case 8:
*((grub_uint64_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
break;
case 4:
*((grub_uint32_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
break;
case 2:
*((grub_uint16_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
break;
case 1:
*((grub_uint8_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
break;
}
}
/* Recompute crc32 of system table and runtime services */
if (grub_efiemu_sizeof_uintn_t () == 4)
return grub_efiemu_crc32 ();
else
return grub_efiemu_crc64 ();
}

View File

@ -209,7 +209,7 @@ open_section (grub_file_t file, struct font_file_section *section)
else if (retval < 0)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font format error: can't read section name");
"font format error: can't read section name");
return 1;
}
@ -224,7 +224,7 @@ open_section (grub_file_t file, struct font_file_section *section)
else if (retval < 0)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font format error: can't read section length");
"font format error: can't read section length");
return 1;
}
@ -258,7 +258,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
if ((sect_length % FONT_CHAR_INDEX_ENTRY_SIZE) != 0)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font file format error: character index length %d "
"font file format error: character index length %d "
"is not a multiple of the entry size %d",
sect_length, FONT_CHAR_INDEX_ENTRY_SIZE);
return 1;
@ -293,7 +293,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
if (i != 0 && entry->code <= last_code)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font characters not in ascending order: %u <= %u",
"font characters not in ascending order: %u <= %u",
entry->code, last_code);
return 1;
}
@ -356,7 +356,7 @@ read_section_as_short (struct font_file_section *section, grub_int16_t *value)
if (section->length != 2)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font file format error: section %c%c%c%c length "
"font file format error: section %c%c%c%c length "
"is %d but should be 2",
section->name[0], section->name[1],
section->name[2], section->name[3],
@ -389,7 +389,7 @@ grub_font_load (grub_file_t file)
if (grub_memcmp (section.name, section_names_file, 4) != 0)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font file format error: 1st section must be FILE");
"font file format error: 1st section must be FILE");
goto fail;
}
@ -399,7 +399,7 @@ grub_font_load (grub_file_t file)
if (section.length != 4)
{
grub_error (GRUB_ERR_BAD_FONT,
"Font file format error (file type ID length is %d "
"font file format error (file type ID length is %d "
"but should be 4)", section.length);
goto fail;
}
@ -417,7 +417,7 @@ grub_font_load (grub_file_t file)
if (grub_memcmp (magic, pff2_magic, 4) != 0)
{
grub_error (GRUB_ERR_BAD_FONT, "Invalid font magic %x %x %x %x",
grub_error (GRUB_ERR_BAD_FONT, "invalid font magic %x %x %x %x",
magic[0], magic[1], magic[2], magic[3]);
goto fail;
}
@ -544,7 +544,7 @@ grub_font_load (grub_file_t file)
|| font->descent == 0)
{
grub_error (GRUB_ERR_BAD_FONT,
"Invalid font file: missing some required data.");
"invalid font file: missing some required data");
goto fail;
}

View File

@ -182,14 +182,14 @@ grub_affs_mount (grub_disk_t disk)
/* Make sure this is an affs filesystem. */
if (grub_strncmp ((char *) (data->bblock.type), "DOS", 3))
{
grub_error (GRUB_ERR_BAD_FS, "not an affs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an AFFS filesystem");
goto fail;
}
/* Test if the filesystem is a OFS filesystem. */
if (! (data->bblock.flags & GRUB_AFFS_FLAG_FFS))
{
grub_error (GRUB_ERR_BAD_FS, "ofs not yet supported");
grub_error (GRUB_ERR_BAD_FS, "OFS not yet supported");
goto fail;
}
@ -231,7 +231,7 @@ grub_affs_mount (grub_disk_t disk)
}
if (-checksum != checksumr)
{
grub_error (GRUB_ERR_BAD_FS, "affs blocksize could not be determined");
grub_error (GRUB_ERR_BAD_FS, "AFFS blocksize couldn't be determined");
goto fail;
}
blocksize++;
@ -248,7 +248,7 @@ grub_affs_mount (grub_disk_t disk)
fail:
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not an affs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an AFFS filesystem");
grub_free (data);
grub_free (rootblock);

View File

@ -88,7 +88,7 @@ grub_cpio_find_file (struct grub_cpio_data *data, char **name,
return grub_errno;
if (hd.magic != MAGIC_BCPIO)
return grub_error (GRUB_ERR_BAD_FS, "Invalid cpio archive");
return grub_error (GRUB_ERR_BAD_FS, "invalid cpio archive");
data->size = (((grub_uint32_t) hd.filesize_1) << 16) + hd.filesize_2;
@ -130,7 +130,7 @@ grub_cpio_find_file (struct grub_cpio_data *data, char **name,
}
if (grub_memcmp (hd.magic, MAGIC_USTAR, sizeof (MAGIC_USTAR) - 1))
return grub_error (GRUB_ERR_BAD_FS, "Invalid tar archive");
return grub_error (GRUB_ERR_BAD_FS, "invalid tar archive");
if ((*name = grub_strdup (hd.name)) == NULL)
return grub_errno;

View File

@ -25,6 +25,7 @@
#include <grub/mm.h>
#include <grub/err.h>
#include <grub/dl.h>
#include <grub/charset.h>
#define GRUB_FAT_DIR_ENTRY_SIZE 32
@ -337,7 +338,7 @@ grub_fat_mount (grub_disk_t disk)
fail:
grub_free (data);
grub_error (GRUB_ERR_BAD_FS, "not a fat filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a FAT filesystem");
return 0;
}

View File

@ -365,7 +365,7 @@ grub_hfs_mount (grub_disk_t disk)
if (grub_hfs_find_node (data, (char *) &key, data->cat_root,
0, (char *) &dir, sizeof (dir)) == 0)
{
grub_error (GRUB_ERR_BAD_FS, "can not find the hfs root directory");
grub_error (GRUB_ERR_BAD_FS, "cannot find the HFS root directory");
goto fail;
}
@ -379,7 +379,7 @@ grub_hfs_mount (grub_disk_t disk)
grub_free (data);
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not a hfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a HFS filesystem");
return 0;
}
@ -1072,6 +1072,31 @@ grub_hfs_label (grub_device_t device, char **label)
return grub_errno;
}
static grub_err_t
grub_hfs_uuid (grub_device_t device, char **uuid)
{
struct grub_hfs_data *data;
grub_dl_ref (my_mod);
data = grub_hfs_mount (device->disk);
if (data && data->sblock.num_serial != 0)
{
*uuid = grub_malloc (16 + sizeof ('\0'));
grub_sprintf (*uuid, "%016llx",
(unsigned long long)
grub_be_to_cpu64 (data->sblock.num_serial));
}
else
*uuid = NULL;
grub_dl_unref (my_mod);
grub_free (data);
return grub_errno;
}
static struct grub_fs grub_hfs_fs =
@ -1082,6 +1107,7 @@ static struct grub_fs grub_hfs_fs =
.read = grub_hfs_read,
.close = grub_hfs_close,
.label = grub_hfs_label,
.uuid = grub_hfs_uuid,
.next = 0
};

View File

@ -28,6 +28,7 @@
#include <grub/types.h>
#include <grub/fshelp.h>
#include <grub/hfs.h>
#include <grub/charset.h>
#define GRUB_HFSPLUS_MAGIC 0x482B
#define GRUB_HFSPLUSX_MAGIC 0x4858
@ -501,7 +502,7 @@ grub_hfsplus_mount (grub_disk_t disk)
fail:
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not a hfsplus filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a HFS+ filesystem");
grub_free (data);
return 0;
@ -652,7 +653,7 @@ grub_hfsplus_btree_search (struct grub_hfsplus_btree *btree,
btree->nodesize, (char *) node) <= 0)
{
grub_free (node);
return grub_error (GRUB_ERR_BAD_FS, "Couldn't read i-node.");
return grub_error (GRUB_ERR_BAD_FS, "couldn't read i-node");
}
nodedesc = (struct grub_hfsplus_btnode *) node;

View File

@ -1,7 +1,7 @@
/* pxe.c - Driver to provide access to the pxe filesystem */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,6 +24,7 @@
#include <grub/file.h>
#include <grub/misc.h>
#include <grub/bufio.h>
#include <grub/env.h>
#include <grub/machine/pxe.h>
#include <grub/machine/memory.h>
@ -33,11 +34,17 @@
#define SEGOFS(x) ((SEGMENT(x) << 16) + OFFSET(x))
#define LINEAR(x) (void *) (((x >> 16) <<4) + (x & 0xFFFF))
struct grub_pxe_disk_data
{
grub_uint32_t server_ip;
grub_uint32_t gateway_ip;
};
struct grub_pxenv *grub_pxe_pxenv;
grub_uint32_t grub_pxe_your_ip;
grub_uint32_t grub_pxe_server_ip;
grub_uint32_t grub_pxe_gateway_ip;
int grub_pxe_blksize = GRUB_PXE_MIN_BLKSIZE;
static grub_uint32_t grub_pxe_your_ip;
static grub_uint32_t grub_pxe_default_server_ip;
static grub_uint32_t grub_pxe_default_gateway_ip;
static unsigned grub_pxe_blksize = GRUB_PXE_MIN_BLKSIZE;
static grub_file_t curr_file = 0;
@ -56,24 +63,83 @@ grub_pxe_iterate (int (*hook) (const char *name))
return 0;
}
static grub_err_t
parse_ip (const char *val, grub_uint32_t *ip, const char **rest)
{
grub_uint32_t newip = 0;
unsigned long t;
int i;
const char *ptr = val;
for (i = 0; i < 4; i++)
{
t = grub_strtoul (ptr, (char **) &ptr, 0);
if (grub_errno)
return grub_errno;
if (t & ~0xff)
return grub_error (GRUB_ERR_OUT_OF_RANGE, "Invalid IP.");
newip >>= 8;
newip |= (t << 24);
if (i != 3 && *ptr != '.')
return grub_error (GRUB_ERR_OUT_OF_RANGE, "Invalid IP.");
ptr++;
}
*ip = newip;
if (rest)
*rest = ptr - 1;
return 0;
}
static grub_err_t
grub_pxe_open (const char *name, grub_disk_t disk)
{
if (grub_strcmp (name, "pxe"))
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a pxe disk");
struct grub_pxe_disk_data *data;
if (grub_strcmp (name, "pxe") != 0
&& grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) != 0)
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a pxe disk");
data = grub_malloc (sizeof (*data));
if (!data)
return grub_errno;
if (grub_strncmp (name, "pxe:", sizeof ("pxe:") - 1) == 0)
{
const char *ptr;
grub_err_t err;
ptr = name + sizeof ("pxe:") - 1;
err = parse_ip (ptr, &(data->server_ip), &ptr);
if (err)
return err;
if (*ptr == ':')
{
err = parse_ip (ptr + 1, &(data->server_ip), 0);
if (err)
return err;
}
else
data->gateway_ip = grub_pxe_default_gateway_ip;
}
else
{
data->server_ip = grub_pxe_default_server_ip;
data->gateway_ip = grub_pxe_default_gateway_ip;
}
disk->total_sectors = 0;
disk->id = (unsigned long) "pxe";
disk->id = (unsigned long) data;
disk->has_partitions = 0;
disk->data = 0;
disk->data = data;
return GRUB_ERR_NONE;
}
static void
grub_pxe_close (grub_disk_t disk __attribute((unused)))
grub_pxe_close (grub_disk_t disk)
{
grub_free (disk->data);
}
static grub_err_t
@ -107,9 +173,11 @@ static struct grub_disk_dev grub_pxe_dev =
};
static grub_err_t
grub_pxefs_dir (grub_device_t device UNUSED, const char *path UNUSED,
grub_pxefs_dir (grub_device_t device __attribute__ ((unused)),
const char *path __attribute__ ((unused)),
int (*hook) (const char *filename,
const struct grub_dirhook_info *info) UNUSED)
const struct grub_dirhook_info *info)
__attribute__ ((unused)))
{
return GRUB_ERR_NONE;
}
@ -123,6 +191,7 @@ grub_pxefs_open (struct grub_file *file, const char *name)
struct grub_pxenv_tftp_open c2;
} c;
struct grub_pxe_data *data;
struct grub_pxe_disk_data *disk_data = file->device->disk->data;
grub_file_t file_int, bufio;
if (curr_file != 0)
@ -131,8 +200,8 @@ grub_pxefs_open (struct grub_file *file, const char *name)
curr_file = 0;
}
c.c1.server_ip = grub_pxe_server_ip;
c.c1.gateway_ip = grub_pxe_gateway_ip;
c.c1.server_ip = disk_data->server_ip;
c.c1.gateway_ip = disk_data->gateway_ip;
grub_strcpy ((char *)&c.c1.filename[0], name);
grub_pxe_call (GRUB_PXENV_TFTP_GET_FSIZE, &c.c1);
if (c.c1.status)
@ -182,6 +251,7 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
{
struct grub_pxenv_tftp_read c;
struct grub_pxe_data *data;
struct grub_pxe_disk_data *disk_data = file->device->disk->data;
grub_uint32_t pn, r;
data = file->data;
@ -201,8 +271,8 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
if (curr_file != 0)
grub_pxe_call (GRUB_PXENV_TFTP_CLOSE, &o);
o.server_ip = grub_pxe_server_ip;
o.gateway_ip = grub_pxe_gateway_ip;
o.server_ip = disk_data->server_ip;
o.gateway_ip = disk_data->gateway_ip;
grub_strcpy ((char *)&o.filename[0], data->filename);
o.tftp_port = grub_cpu_to_be16 (GRUB_PXE_TFTP_PORT);
o.packet_size = grub_pxe_blksize;
@ -270,6 +340,99 @@ static struct grub_fs grub_pxefs_fs =
.next = 0
};
static char *
grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)),
const char *val __attribute__ ((unused)))
{
return NULL;
}
static void
set_mac_env (grub_uint8_t *mac_addr, grub_size_t mac_len)
{
char buf[(sizeof ("XX:") - 1) * mac_len + 1];
char *ptr = buf;
unsigned i;
for (i = 0; i < mac_len; i++)
{
grub_sprintf (ptr, "%02x:", mac_addr[i] & 0xff);
ptr += (sizeof ("XX:") - 1);
}
if (mac_len)
*(ptr - 1) = 0;
else
buf[0] = 0;
grub_env_set ("net_pxe_mac", buf);
/* XXX: Is it possible to change MAC in PXE? */
grub_register_variable_hook ("net_pxe_mac", 0, grub_env_write_readonly);
}
static void
set_env_limn_ro (const char *varname, char *value, grub_size_t len)
{
char c;
c = value[len];
value[len] = 0;
grub_env_set (varname, value);
value[len] = c;
grub_register_variable_hook (varname, 0, grub_env_write_readonly);
}
static void
parse_dhcp_vendor (void *vend, int limit)
{
grub_uint8_t *ptr, *ptr0;
ptr = ptr0 = vend;
if (grub_be_to_cpu32 (*(grub_uint32_t *) ptr) != 0x63825363)
return;
ptr = ptr + sizeof (grub_uint32_t);
while (ptr - ptr0 < limit)
{
grub_uint8_t tagtype;
grub_uint8_t taglength;
tagtype = *ptr++;
/* Pad tag. */
if (tagtype == 0)
continue;
/* End tag. */
if (tagtype == 0xff)
return;
taglength = *ptr++;
switch (tagtype)
{
case 12:
set_env_limn_ro ("net_pxe_hostname", (char *) ptr, taglength);
break;
case 15:
set_env_limn_ro ("net_pxe_domain", (char *) ptr, taglength);
break;
case 17:
set_env_limn_ro ("net_pxe_rootpath", (char *) ptr, taglength);
break;
case 18:
set_env_limn_ro ("net_pxe_extensionspath", (char *) ptr, taglength);
break;
/* If you need any other options please contact GRUB
developpement team. */
}
ptr += taglength;
}
}
static void
grub_pxe_detect (void)
{
@ -291,9 +454,15 @@ grub_pxe_detect (void)
bp = LINEAR (ci.buffer);
grub_pxe_your_ip = bp->your_ip;
grub_pxe_server_ip = bp->server_ip;
grub_pxe_gateway_ip = bp->gateway_ip;
grub_pxe_default_server_ip = bp->server_ip;
grub_pxe_default_gateway_ip = bp->gateway_ip;
set_mac_env (bp->mac_addr, bp->hw_len < sizeof (bp->mac_addr) ? bp->hw_len
: sizeof (bp->mac_addr));
set_env_limn_ro ("net_pxe_boot_file", (char *) bp->boot_file,
sizeof (bp->boot_file));
set_env_limn_ro ("net_pxe_dhcp_server_name", (char *) bp->server_name,
sizeof (bp->server_name));
parse_dhcp_vendor (&bp->vendor, sizeof (bp->vendor));
grub_pxe_pxenv = pxenv;
}
@ -309,11 +478,110 @@ grub_pxe_unload (void)
}
}
static void
set_ip_env (char *varname, grub_uint32_t ip)
{
char buf[sizeof ("XXX.XXX.XXX.XXX")];
grub_sprintf (buf, "%d.%d.%d.%d", (ip & 0xff),
(ip >> 8) & 0xff, (ip >> 16) & 0xff, (ip >> 24) & 0xff);
grub_env_set (varname, buf);
}
static char *
write_ip_env (grub_uint32_t *ip, const char *val)
{
char *buf;
grub_err_t err;
grub_uint32_t newip;
err = parse_ip (val, &newip, 0);
if (err)
return 0;
/* Normalize the IP. */
buf = grub_malloc (sizeof ("XXX.XXX.XXX.XXX"));
if (!buf)
return 0;
*ip = newip;
grub_sprintf (buf, "%d.%d.%d.%d", (newip & 0xff), (newip >> 8) & 0xff,
(newip >> 16) & 0xff, (newip >> 24) & 0xff);
return buf;
}
static char *
grub_env_write_pxe_default_server (struct grub_env_var *var
__attribute__ ((unused)),
const char *val)
{
return write_ip_env (&grub_pxe_default_server_ip, val);
}
static char *
grub_env_write_pxe_default_gateway (struct grub_env_var *var
__attribute__ ((unused)),
const char *val)
{
return write_ip_env (&grub_pxe_default_gateway_ip, val);
}
static char *
grub_env_write_pxe_blocksize (struct grub_env_var *var __attribute__ ((unused)),
const char *val)
{
unsigned size;
char *buf;
size = grub_strtoul (val, 0, 0);
if (grub_errno)
return 0;
if (size < GRUB_PXE_MIN_BLKSIZE)
size = GRUB_PXE_MIN_BLKSIZE;
else if (size > GRUB_PXE_MAX_BLKSIZE)
size = GRUB_PXE_MAX_BLKSIZE;
buf = grub_malloc (sizeof ("XXXXXX XXXXXX"));
if (!buf)
return 0;
grub_sprintf (buf, "%d", size);
grub_pxe_blksize = size;
return buf;
}
GRUB_MOD_INIT(pxe)
{
grub_pxe_detect ();
if (grub_pxe_pxenv)
{
char *buf;
buf = grub_malloc (sizeof ("XXXXXX XXXXXX"));
if (buf)
{
grub_sprintf (buf, "%d", grub_pxe_blksize);
grub_env_set ("net_pxe_blksize", buf);
}
set_ip_env ("pxe_default_server", grub_pxe_default_server_ip);
set_ip_env ("pxe_default_gateway", grub_pxe_default_gateway_ip);
set_ip_env ("net_pxe_ip", grub_pxe_your_ip);
grub_register_variable_hook ("net_pxe_default_server", 0,
grub_env_write_pxe_default_server);
grub_register_variable_hook ("net_pxe_default_gateway", 0,
grub_env_write_pxe_default_gateway);
/* XXX: Is it possible to change IP in PXE? */
grub_register_variable_hook ("net_pxe_ip", 0,
grub_env_write_readonly);
grub_register_variable_hook ("net_pxe_blksize", 0,
grub_env_write_pxe_blocksize);
grub_disk_dev_register (&grub_pxe_dev);
grub_fs_register (&grub_pxefs_fs);
}

View File

@ -26,6 +26,7 @@
#include <grub/dl.h>
#include <grub/types.h>
#include <grub/fshelp.h>
#include <grub/charset.h>
#define GRUB_ISO9660_FSTYPE_DIR 0040000
#define GRUB_ISO9660_FSTYPE_REG 0100000
@ -279,13 +280,13 @@ grub_iso9660_mount (grub_disk_t disk)
sizeof (struct grub_iso9660_primary_voldesc),
(char *) &voldesc))
{
grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
goto fail;
}
if (grub_strncmp ((char *) voldesc.voldesc.magic, "CD001", 5) != 0)
{
grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
goto fail;
}
@ -314,7 +315,7 @@ grub_iso9660_mount (grub_disk_t disk)
<< GRUB_ISO9660_LOG2_BLKSZ), 0,
sizeof (rootdir), (char *) &rootdir))
{
grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
goto fail;
}
@ -330,7 +331,7 @@ grub_iso9660_mount (grub_disk_t disk)
<< GRUB_ISO9660_LOG2_BLKSZ), sua_pos,
sua_size, sua))
{
grub_error (GRUB_ERR_BAD_FS, "not a iso9660 filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ISO9660 filesystem");
goto fail;
}
@ -831,7 +832,7 @@ grub_iso9660_uuid (grub_device_t device, char **uuid)
&& ! data->voldesc.modified.second[0] && ! data->voldesc.modified.second[1]
&& ! data->voldesc.modified.hundredth[0] && ! data->voldesc.modified.hundredth[1])
{
grub_error (GRUB_ERR_BAD_NUMBER, "No creation date in filesystem to generate UUID.");
grub_error (GRUB_ERR_BAD_NUMBER, "no creation date in filesystem to generate UUID");
*uuid = NULL;
}
else

View File

@ -24,6 +24,7 @@
#include <grub/disk.h>
#include <grub/dl.h>
#include <grub/types.h>
#include <grub/charset.h>
#define GRUB_JFS_MAX_SYMLNK_CNT 8
#define GRUB_JFS_FILETYPE_MASK 0170000
@ -343,7 +344,7 @@ grub_jfs_mount (grub_disk_t disk)
if (grub_strncmp ((char *) (data->sblock.magic), "JFS1", 4))
{
grub_error (GRUB_ERR_BAD_FS, "not a jfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a JFS filesystem");
goto fail;
}
@ -362,7 +363,7 @@ grub_jfs_mount (grub_disk_t disk)
grub_free (data);
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not a jfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a JFS filesystem");
return 0;
}
@ -714,7 +715,7 @@ grub_jfs_lookup_symlink (struct grub_jfs_data *data, int ino)
grub_jfs_find_file (data, symlink);
if (grub_errno)
grub_error (grub_errno, "Can not follow symlink `%s'.", symlink);
grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
return grub_errno;
}

View File

@ -311,7 +311,7 @@ grub_minix_lookup_symlink (struct grub_minix_data *data, int ino)
grub_minix_find_file (data, symlink);
if (grub_errno)
grub_error (grub_errno, "Can not follow symlink `%s'.", symlink);
grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
return grub_errno;
}

View File

@ -24,6 +24,7 @@
#include <grub/dl.h>
#include <grub/fshelp.h>
#include <grub/ntfs.h>
#include <grub/charset.h>
static grub_dl_t my_mod;
@ -41,7 +42,7 @@ fixup (struct grub_ntfs_data *data, char *buf, int len, char *magic)
ss = u16at (buf, 6) - 1;
if (ss * (int) data->blocksize != len * GRUB_DISK_SECTOR_SIZE)
return grub_error (GRUB_ERR_BAD_FS, "Size not match",
return grub_error (GRUB_ERR_BAD_FS, "size not match",
ss * (int) data->blocksize,
len * GRUB_DISK_SECTOR_SIZE);
pu = buf + u16at (buf, 4);
@ -52,7 +53,7 @@ fixup (struct grub_ntfs_data *data, char *buf, int len, char *magic)
buf += data->blocksize;
pu += 2;
if (u16at (buf, 0) != us)
return grub_error (GRUB_ERR_BAD_FS, "Fixup signature not match");
return grub_error (GRUB_ERR_BAD_FS, "fixup signature not match");
v16at (buf, 0) = v16at (pu, 0);
ss--;
}
@ -146,7 +147,7 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
new_pos += u16at (new_pos, 4);
}
grub_error (GRUB_ERR_BAD_FS,
"Can\'t find 0x%X in attribute list",
"can\'t find 0x%X in attribute list",
(unsigned char) *at->attr_cur);
return NULL;
}
@ -185,7 +186,7 @@ find_attr (struct grub_ntfs_attr *at, unsigned char attr)
if (read_data (at, pa, at->edat_buf, 0, n, 0, 0))
{
grub_error (GRUB_ERR_BAD_FS,
"Fail to read non-resident attribute list");
"fail to read non-resident attribute list");
return NULL;
}
at->attr_nxt = at->edat_buf;
@ -314,7 +315,7 @@ retry:
goto retry;
}
}
return grub_error (GRUB_ERR_BAD_FS, "Run list overflown");
return grub_error (GRUB_ERR_BAD_FS, "run list overflown");
}
run = read_run_data (run + 1, c1, &val, 0); /* length of current VCN */
ctx->curr_vcn = ctx->next_vcn;
@ -368,7 +369,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
if (pa[8] == 0)
{
if (ofs + len > u32at (pa, 0x10))
return grub_error (GRUB_ERR_BAD_FS, "Read out of range");
return grub_error (GRUB_ERR_BAD_FS, "read out of range");
grub_memcpy (dest, pa + u32at (pa, 0x14) + ofs, len);
return 0;
}
@ -382,7 +383,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
if (ctx->flags & RF_COMP)
{
if (!cached)
return grub_error (GRUB_ERR_BAD_FS, "Attribute can\'t be compressed");
return grub_error (GRUB_ERR_BAD_FS, "attribute can\'t be compressed");
if (at->sbuf)
{
@ -501,7 +502,7 @@ read_attr (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
else
ret =
(grub_errno) ? grub_errno : grub_error (GRUB_ERR_BAD_FS,
"Attribute not found");
"attribute not found");
at->attr_cur = save_cur;
return ret;
}
@ -512,7 +513,7 @@ read_mft (struct grub_ntfs_data *data, char *buf, grub_uint32_t mftno)
if (read_attr
(&data->mmft.attr, buf, mftno * ((grub_disk_addr_t) data->mft_size << BLK_SHR),
data->mft_size << BLK_SHR, 0, 0))
return grub_error (GRUB_ERR_BAD_FS, "Read MFT 0x%X fails", mftno);
return grub_error (GRUB_ERR_BAD_FS, "read MFT 0x%X fails", mftno);
return fixup (data, buf, data->mft_size, "FILE");
}
@ -540,7 +541,7 @@ init_file (struct grub_ntfs_file *mft, grub_uint32_t mftno)
pa = locate_attr (&mft->attr, mft, AT_DATA);
if (pa == NULL)
return grub_error (GRUB_ERR_BAD_FS, "No $DATA in MFT 0x%X", mftno);
return grub_error (GRUB_ERR_BAD_FS, "no $DATA in MFT 0x%X", mftno);
if (!pa[8])
mft->size = u32at (pa, 0x10);
@ -663,7 +664,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
{
if ((cur_pos = find_attr (at, AT_INDEX_ROOT)) == NULL)
{
grub_error (GRUB_ERR_BAD_FS, "No $INDEX_ROOT");
grub_error (GRUB_ERR_BAD_FS, "no $INDEX_ROOT");
goto done;
}
@ -716,7 +717,7 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
if (read_data (at, cur_pos, bmp, 0, bitmap_len, 0, 0))
{
grub_error (GRUB_ERR_BAD_FS,
"Fails to read non-resident $BITMAP");
"fails to read non-resident $BITMAP");
goto done;
}
bitmap_len = u32at (cur_pos, 0x30);

View File

@ -28,7 +28,7 @@ static grub_err_t
decomp_nextvcn (struct grub_ntfs_comp *cc)
{
if (cc->comp_head >= cc->comp_tail)
return grub_error (GRUB_ERR_BAD_FS, "Compression block overflown");
return grub_error (GRUB_ERR_BAD_FS, "compression block overflown");
if (grub_disk_read
(cc->disk,
(cc->comp_table[cc->comp_head][1] -
@ -87,7 +87,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
{
if (copied > COM_LEN)
return grub_error (GRUB_ERR_BAD_FS,
"Compression block too large");
"compression block too large");
if (!bits)
{
@ -112,7 +112,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
if (!copied)
{
grub_error (GRUB_ERR_BAD_FS, "Context window empty");
grub_error (GRUB_ERR_BAD_FS, "nontext window empty");
return 0;
}
@ -150,7 +150,7 @@ decomp_block (struct grub_ntfs_comp *cc, char *dest)
{
if (cnt != COM_LEN)
return grub_error (GRUB_ERR_BAD_FS,
"Invalid compression block size");
"invalid compression block size");
}
}
@ -187,7 +187,7 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, int num)
{
if (ctx->comp.comp_head != ctx->comp.comp_tail)
return grub_error (GRUB_ERR_BAD_FS, "Invalid compression block");
return grub_error (GRUB_ERR_BAD_FS, "invalid compression block");
ctx->comp.comp_head = ctx->comp.comp_tail = 0;
ctx->comp.cbuf_vcn = ctx->target_vcn;
ctx->comp.cbuf_ofs = (ctx->comp.spc << BLK_SHR);

View File

@ -691,7 +691,7 @@ grub_reiserfs_mount (grub_disk_t disk)
if (grub_memcmp (data->superblock.magic_string,
REISERFS_MAGIC_STRING, sizeof (REISERFS_MAGIC_STRING) - 1))
{
grub_error (GRUB_ERR_BAD_FS, "not a reiserfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ReiserFS filesystem");
goto fail;
}
data->disk = disk;
@ -700,7 +700,7 @@ grub_reiserfs_mount (grub_disk_t disk)
fail:
/* Disk is too small to contain a ReiserFS. */
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not a reiserfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a ReiserFS filesystem");
grub_free (data);
return 0;
@ -998,7 +998,7 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
goto fail;
if (root.block_number == 0)
{
grub_error (GRUB_ERR_BAD_FS, "Unable to find root item");
grub_error (GRUB_ERR_BAD_FS, "unable to find root item");
goto fail; /* Should never happen since checked at mount. */
}
grub_fshelp_find_file (name, &root, &found,
@ -1014,7 +1014,7 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
goto fail;
if (info.block_number == 0)
{
grub_error (GRUB_ERR_BAD_FS, "Unable to find searched item");
grub_error (GRUB_ERR_BAD_FS, "unable to find searched item");
goto fail;
}
entry_version = grub_le_to_cpu16 (info.header.version);
@ -1289,7 +1289,7 @@ grub_reiserfs_dir (grub_device_t device, const char *path,
goto fail;
if (root.block_number == 0)
{
grub_error(GRUB_ERR_BAD_FS, "Root not found");
grub_error(GRUB_ERR_BAD_FS, "root not found");
goto fail;
}
grub_fshelp_find_file (path, &root, &found, grub_reiserfs_iterate_dir,

View File

@ -279,7 +279,7 @@ grub_sfs_mount (grub_disk_t disk)
/* Make sure this is a sfs filesystem. */
if (grub_strncmp ((char *) (data->rblock.header.magic), "SFS", 4))
{
grub_error (GRUB_ERR_BAD_FS, "not a sfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a SFS filesystem");
goto fail;
}
@ -307,7 +307,7 @@ grub_sfs_mount (grub_disk_t disk)
fail:
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not an sfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an SFS filesystem");
grub_free (data);
grub_free (rootobjc_data);

View File

@ -525,7 +525,7 @@ grub_udf_mount (grub_disk_t disk)
if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_vrs), &vrs))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
@ -539,7 +539,7 @@ grub_udf_mount (grub_disk_t disk)
(grub_memcmp (vrs.magic, GRUB_UDF_STD_IDENT_CDW02, 5)) &&
(grub_memcmp (vrs.magic, GRUB_UDF_STD_IDENT_TEA01, 5)))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
}
@ -552,7 +552,7 @@ grub_udf_mount (grub_disk_t disk)
if (grub_disk_read (disk, *sblklist << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_avdp), &avdp))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
@ -565,7 +565,7 @@ grub_udf_mount (grub_disk_t disk)
sblklist++;
if (*sblklist == 0)
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
}
@ -579,7 +579,7 @@ grub_udf_mount (grub_disk_t disk)
if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_tag), &tag))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
@ -596,7 +596,7 @@ grub_udf_mount (grub_disk_t disk)
sizeof (struct grub_udf_pd),
&data->pds[data->npd]))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
@ -612,7 +612,7 @@ grub_udf_mount (grub_disk_t disk)
sizeof (struct grub_udf_lvd),
&data->lvd))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}
@ -675,7 +675,7 @@ grub_udf_mount (grub_disk_t disk)
if (grub_disk_read (disk, block << GRUB_UDF_LOG2_BLKSZ, 0,
sizeof (struct grub_udf_fileset), &root_fs))
{
grub_error (GRUB_ERR_BAD_FS, "not an udf filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an UDF filesystem");
goto fail;
}

View File

@ -415,7 +415,7 @@ grub_ufs_lookup_symlink (struct grub_ufs_data *data, int ino)
grub_ufs_find_file (data, symlink);
if (grub_errno)
grub_error (grub_errno, "Can not follow symlink `%s'.", symlink);
grub_error (grub_errno, "cannot follow symlink `%s'", symlink);
return grub_errno;
}

View File

@ -222,7 +222,7 @@ grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino,
return grub_errno;
if (grub_strncmp ((char *) inode->magic, "IN", 2))
return grub_error (GRUB_ERR_BAD_FS, "not a correct XFS inode.\n");
return grub_error (GRUB_ERR_BAD_FS, "not a correct XFS inode");
return 0;
}
@ -273,7 +273,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
if (grub_strncmp ((char *) leaf->magic, "BMAP", 4))
{
grub_free (leaf);
grub_error (GRUB_ERR_BAD_FS, "not a correct XFS BMAP node.\n");
grub_error (GRUB_ERR_BAD_FS, "not a correct XFS BMAP node");
return 0;
}
@ -290,7 +290,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
else
{
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"xfs does not support inode format %d yet",
"XFS does not support inode format %d yet",
node->inode.format);
return 0;
}
@ -567,7 +567,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
default:
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"xfs does not support inode format %d yet",
"XFS does not support inode format %d yet",
diro->inode.format);
}
return 0;
@ -590,7 +590,7 @@ grub_xfs_mount (grub_disk_t disk)
if (grub_strncmp ((char *) (data->sblock.magic), "XFSB", 4))
{
grub_error (GRUB_ERR_BAD_FS, "not a xfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not a XFS filesystem");
goto fail;
}
@ -617,7 +617,7 @@ grub_xfs_mount (grub_disk_t disk)
fail:
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
grub_error (GRUB_ERR_BAD_FS, "not an xfs filesystem");
grub_error (GRUB_ERR_BAD_FS, "not an XFS filesystem");
grub_free (data);

View File

@ -36,7 +36,7 @@ dir=`dirname $0`
cd $dir
for dir in $DISTDIRS; do
for d in `find $dir -type d -not -name .svn -not -name .bzr | sort`; do
for d in `find $dir -type d ! -name .svn ! -name .bzr | sort`; do
find $d -maxdepth 1 -name '*.[chSy]' -o -name '*.mk' -o -name '*.rmk' \
-o -name '*.rb' -o -name '*.in' -o -name '*.tex' -o -name '*.texi' \
-o -name '*.info' -o -name 'grub.cfg' -o -name 'README' \

View File

@ -366,6 +366,7 @@ class Script
#{@name}: #{src} $(#{src}_DEPENDENCIES) config.status
./config.status --file=#{name}:#{src}
sed -i -e 's,@pkglib_DATA@,$(pkglib_DATA),g' $@
chmod +x $@
"

View File

@ -29,8 +29,8 @@
#include <grub/gzio.h>
#include <grub/i18n.h>
/*
.mo file information from:
/*
.mo file information from:
http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html .
*/
@ -243,7 +243,7 @@ grub_mofile_open (const char *filename)
if (version != 0)
{
grub_error (GRUB_ERR_BAD_FILE_TYPE,
"mo: invalid mo version in file: %s\n", filename);
"mo: invalid mo version in file: %s", filename);
fd_mo = 0;
return 0;
}

View File

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,6 +24,8 @@
#define CTRL 0x1d
#define ALT 0x38
#define CAPS_LOCK 0x3a
#define NUM_LOCK 0x45
#define SCROLL_LOCK 0x46
/* Used for sending commands to the controller. */
#define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02)

View File

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

View File

@ -26,8 +26,10 @@
# include <grub/efi/efi.h>
# define grub_autoefi_get_memory_map grub_efi_get_memory_map
# define grub_autoefi_finish_boot_services grub_efi_finish_boot_services
# define grub_autoefi_exit_boot_services grub_efi_exit_boot_services
# define grub_autoefi_system_table grub_efi_system_table
# define grub_autoefi_mmap_iterate grub_machine_mmap_iterate
# define grub_autoefi_set_virtual_address_map grub_efi_set_virtual_address_map
static inline grub_err_t grub_autoefi_prepare (void)
{
return GRUB_ERR_NONE;
@ -53,9 +55,11 @@ static inline grub_err_t grub_autoefi_prepare (void)
# include <grub/efiemu/efiemu.h>
# define grub_autoefi_get_memory_map grub_efiemu_get_memory_map
# define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services
# define grub_autoefi_exit_boot_services grub_efiemu_exit_boot_services
# define grub_autoefi_system_table grub_efiemu_system_table
# define grub_autoefi_mmap_iterate grub_efiemu_mmap_iterate
# define grub_autoefi_prepare grub_efiemu_prepare
# define grub_autoefi_set_virtual_address_map grub_efiemu_set_virtual_address_map
# define GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_EFIEMU_MEMORY_AVAILABLE
# define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_EFIEMU_MEMORY_RESERVED
# define GRUB_AUTOEFI_MEMORY_ACPI GRUB_EFIEMU_MEMORY_ACPI

112
include/grub/charset.h Normal file
View File

@ -0,0 +1,112 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CHARSET_HEADER
#define GRUB_CHARSET_HEADER 1
#include <grub/types.h>
#define GRUB_UINT8_1_LEADINGBIT 0x80
#define GRUB_UINT8_2_LEADINGBITS 0xc0
#define GRUB_UINT8_3_LEADINGBITS 0xe0
#define GRUB_UINT8_4_LEADINGBITS 0xf0
#define GRUB_UINT8_5_LEADINGBITS 0xf8
#define GRUB_UINT8_6_LEADINGBITS 0xfc
#define GRUB_UINT8_7_LEADINGBITS 0xfe
#define GRUB_UINT8_1_TRAILINGBIT 0x01
#define GRUB_UINT8_2_TRAILINGBITS 0x03
#define GRUB_UINT8_3_TRAILINGBITS 0x07
#define GRUB_UINT8_4_TRAILINGBITS 0x0f
#define GRUB_UINT8_5_TRAILINGBITS 0x1f
#define GRUB_UINT8_6_TRAILINGBITS 0x3f
#define GRUB_UCS2_LIMIT 0x10000
#define GRUB_UTF16_UPPER_SURROGATE(code) \
(0xD800 + ((((code) - GRUB_UCS2_LIMIT) >> 12) & 0xfff))
#define GRUB_UTF16_LOWER_SURROGATE(code) \
(0xDC00 + (((code) - GRUB_UCS2_LIMIT) & 0xfff))
grub_ssize_t
grub_utf8_to_utf16 (grub_uint16_t *dest, grub_size_t destsize,
const grub_uint8_t *src, grub_size_t srcsize,
const grub_uint8_t **srcend);
/* Convert UTF-16 to UTF-8. */
static inline grub_uint8_t *
grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
grub_size_t size)
{
grub_uint32_t code_high = 0;
while (size--)
{
grub_uint32_t code = *src++;
if (code_high)
{
if (code >= 0xDC00 && code <= 0xDFFF)
{
/* Surrogate pair. */
code = ((code_high - 0xD800) << 12) + (code - 0xDC00) + 0x10000;
*dest++ = (code >> 18) | 0xF0;
*dest++ = ((code >> 12) & 0x3F) | 0x80;
*dest++ = ((code >> 6) & 0x3F) | 0x80;
*dest++ = (code & 0x3F) | 0x80;
}
else
{
/* Error... */
*dest++ = '?';
}
code_high = 0;
}
else
{
if (code <= 0x007F)
*dest++ = code;
else if (code <= 0x07FF)
{
*dest++ = (code >> 6) | 0xC0;
*dest++ = (code & 0x3F) | 0x80;
}
else if (code >= 0xD800 && code <= 0xDBFF)
{
code_high = code;
continue;
}
else if (code >= 0xDC00 && code <= 0xDFFF)
{
/* Error... */
*dest++ = '?';
}
else
{
*dest++ = (code >> 12) | 0xE0;
*dest++ = ((code >> 6) & 0x3F) | 0x80;
*dest++ = (code & 0x3F) | 0x80;
}
}
}
return dest;
}
#endif

View File

@ -21,6 +21,7 @@
#define GRUB_EFI_API_HEADER 1
#include <grub/types.h>
#include <grub/symbol.h>
/* For consistency and safety, we name the EFI-defined types differently.
All names are transformed into lower case, _t appended, and

View File

@ -55,6 +55,10 @@ grub_efi_device_path_t *
EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
int EXPORT_FUNC(grub_efi_exit_boot_services) (grub_efi_uintn_t map_key);
int EXPORT_FUNC (grub_efi_finish_boot_services) (void);
grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memory_map_size,
grub_efi_uintn_t descriptor_size,
grub_efi_uint32_t descriptor_version,
grub_efi_memory_descriptor_t *virtual_map);
void grub_efi_mm_init (void);
void grub_efi_mm_fini (void);

View File

@ -24,7 +24,7 @@
#define GRUB_EFI_GOP_GUID \
{ 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }}
typedef enum
typedef enum
{
GRUB_EFI_GOT_RGBA8,
GRUB_EFI_GOT_BGRA8,

View File

@ -268,9 +268,19 @@ void grub_efiemu_free_syms (void);
grub_err_t grub_efiemu_write_value (void * addr, grub_uint32_t value,
int plus_handle,
int minus_handle, int ptv_needed, int size);
grub_err_t grub_efiemu_write_sym_markers (void);
grub_err_t grub_efiemu_pnvram (void);
grub_err_t grub_efiemu_prepare (void);
char *grub_efiemu_get_default_core_name (void);
void grub_efiemu_pnvram_cmd_unregister (void);
grub_err_t grub_efiemu_autocore (void);
grub_err_t grub_efiemu_crc32 (void);
grub_err_t grub_efiemu_crc64 (void);
grub_err_t
grub_efiemu_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
grub_efi_uintn_t descriptor_size,
grub_efi_uint32_t descriptor_version
__attribute__ ((unused)),
grub_efi_memory_descriptor_t *virtual_map);
#endif /* ! GRUB_EFI_EMU_HEADER */

View File

@ -48,7 +48,8 @@ struct grub_hfs_sblock
/* A pascal style string that holds the volumename. */
grub_uint8_t volname[28];
grub_uint8_t unused5[60];
grub_uint8_t unused5[52];
grub_uint64_t num_serial;
grub_uint16_t embed_sig;
struct grub_hfs_extent embed_extent;
grub_uint8_t unused6[4];

View File

@ -1,3 +1,26 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_CPU_MACHO_H
#define GRUB_CPU_MACHO_H 1
#include <grub/macho.h>
#define GRUB_MACHO_CPUTYPE_IS_HOST32(x) ((x)==0x00000007)
#define GRUB_MACHO_CPUTYPE_IS_HOST64(x) ((x)==0x01000007)
@ -9,3 +32,15 @@ struct grub_macho_thread32
grub_uint32_t entry_point;
grub_uint8_t unknown2[20];
} __attribute__ ((packed));
struct grub_macho_thread64
{
grub_uint32_t cmd;
grub_uint32_t cmdsize;
grub_uint8_t unknown1[0x88];
grub_uint64_t entry_point;
grub_uint8_t unknown2[0x20];
} __attribute__ ((packed));
#endif

View File

@ -85,7 +85,7 @@
struct grub_machine_bios_data_area
{
grub_uint8_t unused1[0x17];
grub_uint8_t keyboard_flag_lower; /* 0x17 */
grub_uint8_t keyboard_flag_lower; /* 0x17 */
grub_uint8_t unused2[0xf0 - 0x18];
};

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