merge mainline into gfxmenu
This commit is contained in:
commit
9f293ab0df
198 changed files with 5911 additions and 2701 deletions
868
ChangeLog
868
ChangeLog
|
@ -1,3 +1,871 @@
|
||||||
|
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/mis.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
|
||||||
|
(CONCAT(grub_multiboot_load_elf, XX)): Fix `grub_multiboot_payload_eip'
|
||||||
|
initialization.
|
||||||
|
|
||||||
|
2009-12-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Relocator framework
|
||||||
|
|
||||||
|
* loader/i386/xnu_helper.S: Removed. All users updated.
|
||||||
|
* conf/i386.rmk (pkglib_MODULES): Add relocator.mod.
|
||||||
|
(relocator_mod_SOURCES): New variable.
|
||||||
|
(relocator_mod_CFLAGS): Likewise.
|
||||||
|
(relocator_mod_LDFLAGS): Likewise.
|
||||||
|
(relocator_mod_ASFLAGS): Likewise.
|
||||||
|
* conf/x86_64.rmk: Likewise.
|
||||||
|
* include/grub/i386/multiboot.h (grub_multiboot_payload_orig): Removed.
|
||||||
|
(grub_multiboot_payload_entry_offset): Likewise.
|
||||||
|
(grub_multiboot_forward_relocator): Likewise.
|
||||||
|
(grub_multiboot_forward_relocator_end): Likewise.
|
||||||
|
(grub_multiboot_backward_relocator): Likewise.
|
||||||
|
(grub_multiboot_backward_relocator_end): Likewise.
|
||||||
|
(grub_multiboot_payload_eip): New variable.
|
||||||
|
(grub_multiboot_payload_orig): Likewise.
|
||||||
|
* include/grub/i386/pc/memory.h: Include grub/i386/memory.h.
|
||||||
|
(GRUB_MEMORY_MACHINE_CR0_PE_ON): Move from here ...
|
||||||
|
* include/grub/i386/memory.h
|
||||||
|
(GRUB_MEMORY_CPU_CR0_PE_ON): ... to here
|
||||||
|
(GRUB_MEMORY_CPU_CR4_PAE_ON): New definition.
|
||||||
|
(GRUB_MEMORY_CPU_CR0_PAGING_ON): Likewise.
|
||||||
|
(GRUB_MEMORY_CPU_AMD64_MSR): Likewise.
|
||||||
|
(GRUB_MEMORY_CPU_AMD64_MSR_ON): Likewise.
|
||||||
|
* include/grub/i386/relocator.h: New file.
|
||||||
|
* include/grub/x86_64/relocator.h: Likewise.
|
||||||
|
* include/grub/i386/xnu.h: Include grub/cpu/relocator.h.
|
||||||
|
(XNU_RELOCATOR): New macro.
|
||||||
|
(grub_xnu_launcher_start): Remove.
|
||||||
|
(grub_xnu_launcher_end): Likewise.
|
||||||
|
* include/grub/xnu.h (grub_xnu_boot_resume): New prototype.
|
||||||
|
(grub_xnu_heap_real_start): Remove.
|
||||||
|
(grub_xnu_heap_start): Change to void *. All users updated.
|
||||||
|
* kern/i386/realmode.S (real_to_prot): Use GRUB_MEMORY_CPU_CR0_PE_ON.
|
||||||
|
* lib/i386/relocator.c: New file.
|
||||||
|
* lib/i386/relocator_asm.S: Likewise.
|
||||||
|
* lib/i386/relocator_backward.S: Likewise.
|
||||||
|
* lib/mips/relocator.c: Likewise.
|
||||||
|
* lib/mips/relocator_asm.S: Likewise.
|
||||||
|
* lib/relocator.c: Likewise.
|
||||||
|
* loader/i386/multiboot.c: Include grub/i386/relocator.h.
|
||||||
|
(entry): Removed.
|
||||||
|
(playground): Likewise.
|
||||||
|
(grub_multiboot_payload_orig): New variable.
|
||||||
|
(grub_multiboot_payload_dest): Likewise.
|
||||||
|
(grub_multiboot_payload_size): Likewise.
|
||||||
|
(grub_multiboot_payload_eip): Likewise.
|
||||||
|
(grub_multiboot_payload_esp): Likewise.
|
||||||
|
(grub_multiboot_boot): Use grub_relocator32_boot.
|
||||||
|
(grub_multiboot_unload): Free relocators.
|
||||||
|
(grub_multiboot): Setup stack. Use relocators.
|
||||||
|
* loader/i386/multiboot_elfxx.c: Include grub/i386/relocator.h.
|
||||||
|
(grub_multiboot_load_elfXX): Use relocators.
|
||||||
|
* loader/i386/multiboot_helper.S (grub_multiboot_payload_orig): Removed.
|
||||||
|
(grub_multiboot_payload_size): Likewise.
|
||||||
|
(grub_multiboot_payload_dest): Likewise.
|
||||||
|
(grub_multiboot_payload_entry_offset): Likewise.
|
||||||
|
(grub_multiboot_forward_relocator): Likewise.
|
||||||
|
(grub_multiboot_backward_relocator): Likewise.
|
||||||
|
(grub_multiboot_real_boot): Likewise.
|
||||||
|
* loader/i386/xnu.c (grub_xnu_heap_will_be_at): New variable.
|
||||||
|
(grub_xnu_entry_point): Likewise.
|
||||||
|
(grub_xnu_arg1): Likewise.
|
||||||
|
(grub_xnu_stack): Likewise.
|
||||||
|
(grub_xnu_launch): Removed.
|
||||||
|
(grub_xnu_boot_resume): New function.
|
||||||
|
(grub_xnu_boot): Use relocators.
|
||||||
|
* loader/i386/xnu_helper.S: Removed.
|
||||||
|
* loader/xnu.c (grub_xnu_heap_start): New variable.
|
||||||
|
(grub_xnu_heap_size): Likewise.
|
||||||
|
(grub_xnu_heap_malloc): Use relocators.
|
||||||
|
* loader/xnu_resume.c (grub_xnu_resume): Use relocators.
|
||||||
|
|
||||||
|
2009-12-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/i386/pc/startup.S (multiboot_entry): Setup stack before calling
|
||||||
|
anything.
|
||||||
|
|
||||||
|
2009-12-13 Carles Pina i Estany <carles@pina.cat>
|
||||||
|
|
||||||
|
* script/execute.c (grub_script_execute_cmdline): Set grub_errno to
|
||||||
|
GRUB_ERR_NONE before calling grub_env_set.
|
||||||
|
|
||||||
|
2009-12-12 Robert Millan <rmh@aybabtu.com>
|
||||||
|
|
||||||
|
* gendistlist.sh (EXTRA_DISTFILES): Add `genvideolist.sh'.
|
||||||
|
* genmk.rb (video): New variable.
|
||||||
|
(CLEANFILES, VIDEOFILES): Add #{video}.
|
||||||
|
(#{video}): New target rule.
|
||||||
|
* genvideolist.sh: New file.
|
||||||
|
* Makefile.in (pkglib_DATA): Add video.lst.
|
||||||
|
(video.lst): New target rule.
|
||||||
|
* util/grub-mkconfig.in: Initialize ${GRUB_VIDEO_BACKEND} using
|
||||||
|
`video.lst'.
|
||||||
|
* util/grub.d/30_os-prober.in: Replace `vbe' with
|
||||||
|
${GRUB_VIDEO_BACKEND}.
|
||||||
|
|
||||||
|
2009-12-11 Robert Millan <rmh.grub@aybabtu.com>
|
||||||
|
|
||||||
|
* THANKS: Add David Miller.
|
||||||
|
|
||||||
|
2009-12-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
libpciaccess support.
|
||||||
|
|
||||||
|
* Makefile.in (LIBPCIACCESS): New variable.
|
||||||
|
(enable_grub_emu_pci): Likewise.
|
||||||
|
* conf/any-emu.rmk (grub_emu_SOURCES) [enable_grub_emu_pci]: Add
|
||||||
|
util/pci.c and commands/lspci.c.
|
||||||
|
(grub_emu_LDFLAGS) [enable_grub_emu_pci]: Add $(LIBPCIACCESS).
|
||||||
|
* configure.ac (grub-emu-pci): New option.
|
||||||
|
* include/grub/i386/pci.h (grub_pci_device_map_range): New function.
|
||||||
|
(grub_pci_device_unmap_range): Likewise.
|
||||||
|
* include/grub/pci.h [GRUB_UTIL]: Include grub/pciutils.h.
|
||||||
|
(grub_pci_device) [!GRUB_UTIL]: New structure. All users updated.
|
||||||
|
(grub_pci_address_t) [!GRUB_UTIL]: New type.
|
||||||
|
(grub_pci_device_t) [!GRUB_UTIL]: Likewise.
|
||||||
|
(grub_pci_get_bus) [!GRUB_UTIL]: New function.
|
||||||
|
(grub_pci_get_device) [!GRUB_UTIL]: Likewise.
|
||||||
|
(grub_pci_get_function) [!GRUB_UTIL]: Likewise.
|
||||||
|
* include/grub/pciutils.h: New file.
|
||||||
|
* util/pci.c: Likewise.
|
||||||
|
|
||||||
|
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>
|
||||||
|
|
||||||
|
* disk/i386/pc/biosdisk.c (grub_biosdisk_open): Show the disk
|
||||||
|
name in an error message.
|
||||||
|
(grub_biosdisk_rw): Likewise.
|
||||||
|
|
||||||
|
2009-12-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Eliminate NTFS 4Gib barrier.
|
||||||
|
|
||||||
|
* fs/ntfs.c (read_attr): Use grub_disk_addr_t and grub_size_t.
|
||||||
|
(read_run_data): Likewise.
|
||||||
|
(grub_ntfs_read_run_list): Likewise.
|
||||||
|
(grub_ntfs_read_block): Likewise.
|
||||||
|
(grub_ntfs_iterate_dir): Likewise.
|
||||||
|
(read_mft): Likewise.
|
||||||
|
(read_data): Likewise.
|
||||||
|
Use COM_LOG_LEN.
|
||||||
|
* fs/ntfscomp.c (read_block): Cast ctx->target_vcn & 0xF to unsigned
|
||||||
|
to avoid 64-bit division
|
||||||
|
* include/grub/ntfs.h (COM_LOG_LEN): New definition.
|
||||||
|
(grub_ntfs_rlst): Use grub_disk_addr_t.
|
||||||
|
|
||||||
|
2009-12-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Eliminate grub-fstest 4Gib barrier.
|
||||||
|
|
||||||
|
* util/grub-fstest.c (skip, leng): Use grub_disk_addr_t.
|
||||||
|
(read_file): Fix error reporting.
|
||||||
|
|
||||||
|
2009-12-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Eliminate hexdump 4Gib barrier.
|
||||||
|
|
||||||
|
* commands/hexdump.c (grub_cmd_hexdump): Use grub_disk_addr_t.
|
||||||
|
* lib/arg.c (grub_arg_parse): Use grub_strtoull.
|
||||||
|
|
||||||
|
2009-12-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/device.c (grub_device_iterate): Ignore errors during first scan.
|
||||||
|
Fixes amarsh bug.
|
||||||
|
|
||||||
|
2009-12-09 Bruce Dubbs <bruce.dubbs@gmail.com>
|
||||||
|
|
||||||
|
Remove miscellaneous files in distclean target.
|
||||||
|
|
||||||
|
* Makefile.in: Remove docs/{grub.info,version.texi,stamp-vti}
|
||||||
|
|
||||||
|
2009-12-09 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* util/grub-mkconfig_lib.in: Don't set grub_probe or grub_mkrelpath
|
||||||
|
if they're already set. This resolves the conflict between my
|
||||||
|
grub-install change on 2009-10-06 and Felix' change on 2009-11-11,
|
||||||
|
fixing the --grub-probe option again.
|
||||||
|
* util/sparc64/ieee1275/grub-install.in: Revert the last piece of my
|
||||||
|
change on 2009-10-06, so that we now once again source
|
||||||
|
`${libdir}/grub/grub-mkconfig_lib' after options have been parsed.
|
||||||
|
|
||||||
|
2009-12-08 Robert Millan <rmh.grub@aybabtu.com>
|
||||||
|
|
||||||
|
* conf/common.rmk [sparc64-ieee1275] (grub_mkdevicemap_SOURCES): Use
|
||||||
|
`util/ieee1275/ofpath.c' and `util/ieee1275/devicemap.c' instead of
|
||||||
|
`util/devicemap.c'.
|
||||||
|
|
||||||
|
2009-12-08 Carles Pina i Estany <carles@pina.cat>
|
||||||
|
|
||||||
|
* include/grub/misc.h (grub_printf_): New declaration.
|
||||||
|
* kern/misc.c (grub_printf_): New definition.
|
||||||
|
* normal/main.c (grub_normal_reader_init): Use `grub_printf_' and `N_'
|
||||||
|
instead of `grub_printf' and `_'.
|
||||||
|
* normal/menu_entry.c (store_completion): Likewise.
|
||||||
|
(run): Likewise.
|
||||||
|
(grub_menu_entry_run): Likewise.
|
||||||
|
* normal/menu_text.c (grub_wait_after_message): Likewise.
|
||||||
|
(notify_booting): Likewise.
|
||||||
|
(notify_fallback): Likewise.
|
||||||
|
(notify_execution_failure): Likewise.
|
||||||
|
|
||||||
|
2009-12-07 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* configure.ac: Check for vasprintf.
|
||||||
|
* util/misc.c (asprintf): Move allocation from here ...
|
||||||
|
(vasprintf): ... to here. New function.
|
||||||
|
(xasprintf): New function.
|
||||||
|
* include/grub/util/misc.h (vasprintf, xasprintf): Add
|
||||||
|
prototypes.
|
||||||
|
* util/getroot.c (grub_util_get_grub_dev): Use xasprintf.
|
||||||
|
* util/grub-mkfont.c (write_font): Likewise.
|
||||||
|
* util/grub-probe.c (probe): Likewise.
|
||||||
|
* util/hostdisk.c (make_device_name): Likewise.
|
||||||
|
|
||||||
|
2009-12-06 David S. Miller <davem@sunset.davemloft.net>
|
||||||
|
|
||||||
|
* 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>
|
||||||
|
|
||||||
|
* util/misc.c (make_system_path_relative_to_its_root): Correctly cope with
|
||||||
|
mount points.
|
||||||
|
|
||||||
|
2009-12-05 Carles Pina i Estany <carles@pina.cat>
|
||||||
|
|
||||||
|
* gettext/gettext.c: Include `<grub/list.h>'. Define grub_gettext_msg,
|
||||||
|
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,
|
||||||
|
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.
|
||||||
|
(grub_gettext_env_write_lang): Call grub_gettext_delete_list when
|
||||||
|
lang environment variable is changed.
|
||||||
|
(GRUB_MOD_FINI): Call grub_gettext_delete_list.
|
||||||
|
|
||||||
|
2009-12-05 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Rename kernel.mod to kernel.img.
|
||||||
|
|
||||||
|
* conf/i386-efi.rmk (pkglib_MODULES): Change kernel.mod to kernel.img.
|
||||||
|
(kernel_mod_EXPORTS): Rename to ...
|
||||||
|
(kernel_img_EXPORTS): ... this.
|
||||||
|
(kernel_mod_SOURCES): Rename to ...
|
||||||
|
(kernel_img_SOURCES): ... this.
|
||||||
|
(kernel_mod_HEADERS): Rename to ...
|
||||||
|
(kernel_img_HEADERS): ... this. All users updated.
|
||||||
|
(kernel_mod_CFLAGS): Rename to ...
|
||||||
|
(kernel_img_CFLAGS): ... this.
|
||||||
|
(kernel_mod_ASFLAGS): Rename to ...
|
||||||
|
(kernel_img_ASFLAGS): ... this.
|
||||||
|
(kernel_mod_LDFLAGS): Rename to ...
|
||||||
|
(kernel_img_LDFLAGS): ... this.
|
||||||
|
* conf/x86_64-efi.rmk: Likewise.
|
||||||
|
* util/i386/efi/grub-mkimage.c (read_kernel_module): Rename to ...
|
||||||
|
(read_kernel_image): ... this. All users updated.
|
||||||
|
(read_kernel_image): Read "kernel.img" instead of "kernel.mod".
|
||||||
|
|
||||||
|
2009-12-05 Carles Pina i Estany <carles@pina.cat>
|
||||||
|
|
||||||
|
* normal/menu_text.c (grub_color_menu_high): Gettexttize string.
|
||||||
|
(print_spaces): New function.
|
||||||
|
(grub_print_ucs4): New function.
|
||||||
|
(getstringwidth): New function.
|
||||||
|
(print_message_indented): New function.
|
||||||
|
(print_message): Gettexttize strings using print_message_indented.
|
||||||
|
(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):
|
||||||
|
Gettextize.
|
||||||
|
* normal/menu_entry.c (store_completion): Cleanup the gettextized
|
||||||
|
string.
|
||||||
|
(run): Likewise.
|
||||||
|
(grub_menu_entry_run): Likewise.
|
||||||
|
* PO/POTFILES: Add normal/menu_entry.c.
|
||||||
|
|
||||||
|
2009-12-05 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* configure.ac (TARGET_ASFLAGS): Add "-D<MACHINE>".
|
||||||
|
|
||||||
|
2009-12-05 Carles Pina i Estany <carles@pina.cat>
|
||||||
|
|
||||||
|
* util/grub-install.in: Install gettext .mo files.
|
||||||
|
* util/grub-mkrescue.in (process_input_dir): Copy gettext .mo files.
|
||||||
|
|
||||||
|
2009-12-05 Carles Pina i Estany <carles@pina.cat>
|
||||||
|
|
||||||
|
* gettext/gettext.c (grub_gettext_init_ext): Replace grub_printf with
|
||||||
|
grub_dprintf.
|
||||||
|
|
||||||
|
2009-12-05 Robert Millan <rmh.grub@aybabtu.com>
|
||||||
|
|
||||||
|
* kern/ieee1275/openfw.c (grub_reboot): Disable for i386. The
|
||||||
|
non-firmware-dependant one in realmode.S takes precedence.
|
||||||
|
|
||||||
|
2009-12-04 Robert Millan <rmh.grub@aybabtu.com>
|
||||||
|
|
||||||
|
* commands/halt.c: Replace misc arch-specific headers with
|
||||||
|
`<grub/misc.h>'.
|
||||||
|
* commands/reboot.c: Likewise.
|
||||||
|
* commands/i386/pc/halt.c: Replace `<grub/machine/init.h>' with
|
||||||
|
`<grub/misc.h>'.
|
||||||
|
* conf/i386-coreboot.rmk (kernel_img_HEADERS): Remove `cpu/reboot.h'.
|
||||||
|
(halt_mod_SOURCES): Move `kern/i386/halt.c' from here ...
|
||||||
|
(kernel_img_SOURCES): ... to here.
|
||||||
|
|
||||||
|
* include/grub/efi/efi.h (grub_reboot, grub_halt): Remove prototypes.
|
||||||
|
* include/grub/i386/pc/init.h: Likewise.
|
||||||
|
* include/grub/powerpc/ieee1275/kernel.h: Likewise.
|
||||||
|
* include/grub/sparc64/ieee1275/kernel.h: Likewise.
|
||||||
|
|
||||||
|
* include/grub/misc.h (grub_reboot, grub_halt): New prototypes.
|
||||||
|
|
||||||
|
* include/grub/i386/halt.h: Remove.
|
||||||
|
* include/grub/i386/reboot.h: Likewise.
|
||||||
|
|
||||||
|
* kern/i386/halt.c: Remove `<grub/cpu/halt.h>'.
|
||||||
|
|
||||||
|
2009-12-03 David S. Miller <davem@sunset.davemloft.net>
|
||||||
|
|
||||||
|
* conf/sparc64-ieee1275.rmk (grub_mkimage_SOURCES,
|
||||||
|
grub_setup_SOURCES, grub_ofpathname_SOURCES): Add gnulib/progname.c
|
||||||
|
* util/sparc64/ieee1275/grub-mkimage.c: Include <grub/i18n.h> and
|
||||||
|
"progname.h"
|
||||||
|
* util/sparc64/ieee1275/grub-ofpathname.c: Likewise.
|
||||||
|
* util/sparc64/ieee1275/grub-setup.c: Likewise.
|
||||||
|
(usage): Add missing comma in printf.
|
||||||
|
|
||||||
|
2009-12-02 Robert Millan <rmh.grub@aybabtu.com>
|
||||||
|
|
||||||
|
Use the same reboot approach on i386 coreboot and qemu as we do on
|
||||||
|
BIOS.
|
||||||
|
|
||||||
|
* conf/i386-coreboot.rmk (kernel_img_HEADERS): Add `cpu/reboot.h'.
|
||||||
|
(reboot_mod_SOURCES): Remove `kern/i386/reboot.c'.
|
||||||
|
* kern/i386/reboot.c: Remove.
|
||||||
|
* include/grub/i386/reboot.h (grub_reboot): Export function.
|
||||||
|
* kern/i386/pc/startup.S (grub_reboot): Move from here ...
|
||||||
|
* kern/i386/realmode.S (grub_reboot): ... to here. Jump to
|
||||||
|
0xf000:0xfff0 instead of 0xffff:0x0000.
|
||||||
|
[!GRUB_MACHINE_PCBIOS] (prot_to_real): Do not restore interrupts.
|
||||||
|
* kern/i386/qemu/startup.S: Include `"../realmode.S"'.
|
||||||
|
|
||||||
|
2009-11-30 Robert Millan <rmh.grub@aybabtu.com>
|
||||||
|
|
||||||
|
Fix $srcdir != $objdir build.
|
||||||
|
|
||||||
|
* Makefile.in (po/%.po): Rewrite as ...
|
||||||
|
($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po)): ... this.
|
||||||
|
|
||||||
2009-11-29 Samuel Thibault <samuel.thibault@ens-lyon.org>
|
2009-11-29 Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||||
|
|
||||||
Fix GNU/Hurd grub-install crash.
|
Fix GNU/Hurd grub-install crash.
|
||||||
|
|
17
Makefile.in
17
Makefile.in
|
@ -110,12 +110,14 @@ AWK = @AWK@
|
||||||
LIBCURSES = @LIBCURSES@
|
LIBCURSES = @LIBCURSES@
|
||||||
LIBUSB = @LIBUSB@
|
LIBUSB = @LIBUSB@
|
||||||
LIBSDL = @LIBSDL@
|
LIBSDL = @LIBSDL@
|
||||||
|
LIBPCIACCESS = @LIBPCIACCESS@
|
||||||
YACC = @YACC@
|
YACC = @YACC@
|
||||||
FONT_SOURCE = @FONT_SOURCE@
|
FONT_SOURCE = @FONT_SOURCE@
|
||||||
|
|
||||||
# Options.
|
# Options.
|
||||||
enable_grub_emu_usb = @enable_grub_emu_usb@
|
enable_grub_emu_usb = @enable_grub_emu_usb@
|
||||||
enable_grub_emu_sdl = @enable_grub_emu_sdl@
|
enable_grub_emu_sdl = @enable_grub_emu_sdl@
|
||||||
|
enable_grub_emu_pci = @enable_grub_emu_pci@
|
||||||
enable_grub_fstest = @enable_grub_fstest@
|
enable_grub_fstest = @enable_grub_fstest@
|
||||||
enable_grub_pe2elf = @enable_grub_pe2elf@
|
enable_grub_pe2elf = @enable_grub_pe2elf@
|
||||||
enable_grub_mkfont = @enable_grub_mkfont@
|
enable_grub_mkfont = @enable_grub_mkfont@
|
||||||
|
@ -141,7 +143,9 @@ CLEANFILES =
|
||||||
MOSTLYCLEANFILES =
|
MOSTLYCLEANFILES =
|
||||||
DISTCLEANFILES = config.status config.cache config.log config.h \
|
DISTCLEANFILES = config.status config.cache config.log config.h \
|
||||||
Makefile stamp-h include/grub/cpu include/grub/machine \
|
Makefile stamp-h include/grub/cpu include/grub/machine \
|
||||||
gensymlist.sh genkernsyms.sh build_env.mk
|
gensymlist.sh genkernsyms.sh build_env.mk \
|
||||||
|
docs/grub.info docs/version.texi docs/stamp-vti
|
||||||
|
|
||||||
MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) \
|
MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) \
|
||||||
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS)
|
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS)
|
||||||
|
|
||||||
|
@ -167,7 +171,7 @@ endif
|
||||||
### General targets.
|
### General targets.
|
||||||
|
|
||||||
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
|
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
|
||||||
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst
|
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst
|
||||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
|
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
|
||||||
cat $(DEFSYMFILES) /dev/null \
|
cat $(DEFSYMFILES) /dev/null \
|
||||||
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
|
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
|
||||||
|
@ -188,6 +192,9 @@ handler.lst: $(HANDLERFILES)
|
||||||
parttool.lst: $(PARTTOOLFILES)
|
parttool.lst: $(PARTTOOLFILES)
|
||||||
cat $^ /dev/null | sort | uniq > $@
|
cat $^ /dev/null | sort | uniq > $@
|
||||||
|
|
||||||
|
video.lst: $(VIDEOFILES)
|
||||||
|
cat $^ /dev/null | sort | uniq > $@
|
||||||
|
|
||||||
ifneq (true, $(MAKEINFO))
|
ifneq (true, $(MAKEINFO))
|
||||||
info_INFOS += docs/grub.info
|
info_INFOS += docs/grub.info
|
||||||
endif
|
endif
|
||||||
|
@ -479,10 +486,10 @@ genkernsyms.sh: genkernsyms.sh.in config.status
|
||||||
$(SHELL) ./config.status
|
$(SHELL) ./config.status
|
||||||
|
|
||||||
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
|
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
|
||||||
cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ --keyword=N_
|
cd $(srcdir) && $(XGETTEXT) -ctranslate --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 po/POTFILES-shell -j --language=Shell
|
||||||
|
|
||||||
po/%.po: po/$(PACKAGE).pot
|
$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot
|
||||||
$(MSGMERGE) -U $@ $^
|
$(MSGMERGE) -U $@ $^
|
||||||
|
|
||||||
po/%.mo: po/%.po
|
po/%.mo: po/%.po
|
||||||
|
|
6
NEWS
6
NEWS
|
@ -1,7 +1,11 @@
|
||||||
New in 1.97 - :
|
New in 1.98:
|
||||||
|
|
||||||
|
* Add grub-probe support for GNU/Hurd.
|
||||||
|
|
||||||
* Add support for gettext.
|
* Add support for gettext.
|
||||||
|
|
||||||
|
New in 1.97:
|
||||||
|
|
||||||
* Add support for loading XNU (MacOS X kernel).
|
* Add support for loading XNU (MacOS X kernel).
|
||||||
|
|
||||||
* ACPI override support.
|
* ACPI override support.
|
||||||
|
|
1
THANKS
1
THANKS
|
@ -8,6 +8,7 @@ generally assist in the GRUB 2 maintainership process:
|
||||||
|
|
||||||
Andrey Shuvikov <mr_hyro@yahoo.com>
|
Andrey Shuvikov <mr_hyro@yahoo.com>
|
||||||
Bibo Mao <bibo.mao@intel.com>
|
Bibo Mao <bibo.mao@intel.com>
|
||||||
|
David Miller <davem@davemloft.net>
|
||||||
Guillem Jover <guillem@hadrons.org>
|
Guillem Jover <guillem@hadrons.org>
|
||||||
Harley D. Eades III <hde@foobar-qux.org>
|
Harley D. Eades III <hde@foobar-qux.org>
|
||||||
Hitoshi Ozeki <h-ozeki@ck2.so-net.ne.jp>
|
Hitoshi Ozeki <h-ozeki@ck2.so-net.ne.jp>
|
||||||
|
|
23
bus/pci.c
23
bus/pci.c
|
@ -21,41 +21,40 @@
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
|
|
||||||
grub_pci_address_t
|
grub_pci_address_t
|
||||||
grub_pci_make_address (int bus, int device, int function, int reg)
|
grub_pci_make_address (grub_pci_device_t dev, int reg)
|
||||||
{
|
{
|
||||||
return (1 << 31) | (bus << 16) | (device << 11) | (function << 8) | (reg << 2);
|
return (1 << 31) | (dev.bus << 16) | (dev.device << 11)
|
||||||
|
| (dev.function << 8) | (reg << 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
||||||
{
|
{
|
||||||
int bus;
|
grub_pci_device_t dev;
|
||||||
int dev;
|
|
||||||
int func;
|
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
grub_pci_id_t id;
|
grub_pci_id_t id;
|
||||||
grub_uint32_t hdr;
|
grub_uint32_t hdr;
|
||||||
|
|
||||||
for (bus = 0; bus < 256; bus++)
|
for (dev.bus = 0; dev.bus < 256; dev.bus++)
|
||||||
{
|
{
|
||||||
for (dev = 0; dev < 32; dev++)
|
for (dev.device = 0; dev.device < 32; dev.device++)
|
||||||
{
|
{
|
||||||
for (func = 0; func < 8; func++)
|
for (dev.function = 0; dev.function < 8; dev.function++)
|
||||||
{
|
{
|
||||||
addr = grub_pci_make_address (bus, dev, func, 0);
|
addr = grub_pci_make_address (dev, 0);
|
||||||
id = grub_pci_read (addr);
|
id = grub_pci_read (addr);
|
||||||
|
|
||||||
/* Check if there is a device present. */
|
/* Check if there is a device present. */
|
||||||
if (id >> 16 == 0xFFFF)
|
if (id >> 16 == 0xFFFF)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (hook (bus, dev, func, id))
|
if (hook (dev, id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Probe only func = 0 if the device if not multifunction */
|
/* Probe only func = 0 if the device if not multifunction */
|
||||||
if (func == 0)
|
if (dev.function == 0)
|
||||||
{
|
{
|
||||||
addr = grub_pci_make_address (bus, dev, func, 3);
|
addr = grub_pci_make_address (dev, 3);
|
||||||
hdr = grub_pci_read (addr);
|
hdr = grub_pci_read (addr);
|
||||||
if (!(hdr & 0x800000))
|
if (!(hdr & 0x800000))
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -113,7 +113,7 @@ grub_ohci_writereg32 (struct grub_ohci *o,
|
||||||
/* Iterate over all PCI devices. Determine if a device is an OHCI
|
/* Iterate over all PCI devices. Determine if a device is an OHCI
|
||||||
controller. If this is the case, initialize it. */
|
controller. If this is the case, initialize it. */
|
||||||
static int NESTED_FUNC_ATTR
|
static int NESTED_FUNC_ATTR
|
||||||
grub_ohci_pci_iter (int bus, int device, int func,
|
grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid __attribute__((unused)))
|
grub_pci_id_t pciid __attribute__((unused)))
|
||||||
{
|
{
|
||||||
grub_uint32_t class_code;
|
grub_uint32_t class_code;
|
||||||
|
@ -126,7 +126,7 @@ grub_ohci_pci_iter (int bus, int device, int func,
|
||||||
grub_uint32_t revision;
|
grub_uint32_t revision;
|
||||||
grub_uint32_t frame_interval;
|
grub_uint32_t frame_interval;
|
||||||
|
|
||||||
addr = grub_pci_make_address (bus, device, func, 2);
|
addr = grub_pci_make_address (dev, 2);
|
||||||
class_code = grub_pci_read (addr) >> 8;
|
class_code = grub_pci_read (addr) >> 8;
|
||||||
|
|
||||||
interf = class_code & 0xFF;
|
interf = class_code & 0xFF;
|
||||||
|
@ -138,7 +138,7 @@ grub_ohci_pci_iter (int bus, int device, int func,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Determine IO base address. */
|
/* Determine IO base address. */
|
||||||
addr = grub_pci_make_address (bus, device, func, 4);
|
addr = grub_pci_make_address (dev, 4);
|
||||||
base = grub_pci_read (addr);
|
base = grub_pci_read (addr);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <grub/usb.h>
|
#include <grub/usb.h>
|
||||||
#include <grub/usbtrans.h>
|
#include <grub/usbtrans.h>
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
#include <grub/cpu/pci.h>
|
|
||||||
#include <grub/i386/io.h>
|
#include <grub/i386/io.h>
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
|
|
||||||
|
@ -138,7 +137,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
/* Iterate over all PCI devices. Determine if a device is an UHCI
|
/* Iterate over all PCI devices. Determine if a device is an UHCI
|
||||||
controller. If this is the case, initialize it. */
|
controller. If this is the case, initialize it. */
|
||||||
static int NESTED_FUNC_ATTR
|
static int NESTED_FUNC_ATTR
|
||||||
grub_uhci_pci_iter (int bus, int device, int func,
|
grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid __attribute__((unused)))
|
grub_pci_id_t pciid __attribute__((unused)))
|
||||||
{
|
{
|
||||||
grub_uint32_t class_code;
|
grub_uint32_t class_code;
|
||||||
|
@ -151,7 +150,7 @@ grub_uhci_pci_iter (int bus, int device, int func,
|
||||||
struct grub_uhci *u;
|
struct grub_uhci *u;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
addr = grub_pci_make_address (bus, device, func, 2);
|
addr = grub_pci_make_address (dev, 2);
|
||||||
class_code = grub_pci_read (addr) >> 8;
|
class_code = grub_pci_read (addr) >> 8;
|
||||||
|
|
||||||
interf = class_code & 0xFF;
|
interf = class_code & 0xFF;
|
||||||
|
@ -163,7 +162,7 @@ grub_uhci_pci_iter (int bus, int device, int func,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Determine IO base address. */
|
/* Determine IO base address. */
|
||||||
addr = grub_pci_make_address (bus, device, func, 8);
|
addr = grub_pci_make_address (dev, 8);
|
||||||
base = grub_pci_read (addr);
|
base = grub_pci_read (addr);
|
||||||
/* Stop if there is no IO space base address defined. */
|
/* Stop if there is no IO space base address defined. */
|
||||||
if (! (base & 1))
|
if (! (base & 1))
|
||||||
|
@ -435,6 +434,7 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
||||||
grub_uhci_td_t td_prev = NULL;
|
grub_uhci_td_t td_prev = NULL;
|
||||||
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
||||||
int i;
|
int i;
|
||||||
|
grub_uint64_t endtime;
|
||||||
|
|
||||||
/* Allocate a queue head for the transfer queue. */
|
/* Allocate a queue head for the transfer queue. */
|
||||||
qh = grub_alloc_qh (u, GRUB_USB_TRANSACTION_TYPE_CONTROL);
|
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
|
/* Wait until either the transaction completed or an error
|
||||||
occurred. */
|
occurred. */
|
||||||
|
endtime = grub_get_time_ms () + 1000;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
grub_uhci_td_t errtd;
|
grub_uhci_td_t errtd;
|
||||||
|
@ -534,6 +535,13 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
||||||
updated. */
|
updated. */
|
||||||
grub_dprintf ("uhci", "transaction fallthrough\n");
|
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");
|
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;
|
struct grub_uhci *u = (struct grub_uhci *) dev->data;
|
||||||
int reg;
|
int reg;
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
|
grub_uint64_t endtime;
|
||||||
|
|
||||||
grub_dprintf ("uhci", "enable=%d port=%d\n", enable, port);
|
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);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
|
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
|
||||||
grub_dprintf ("uhci", "reset completed\n");
|
grub_dprintf ("uhci", "reset completed\n");
|
||||||
|
grub_millisleep (10);
|
||||||
|
|
||||||
/* Enable the port. */
|
/* Enable the port. */
|
||||||
grub_uhci_writereg16 (u, reg, enable << 2);
|
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");
|
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);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
||||||
|
|
|
@ -155,42 +155,6 @@ grub_usb_get_endpdescriptor (grub_usb_device_t usbdev, int addr)
|
||||||
return NULL;
|
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_err_t
|
||||||
grub_usb_device_initialize (grub_usb_device_t dev)
|
grub_usb_device_initialize (grub_usb_device_t dev)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,7 +48,7 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
|
||||||
if (! grub_usb_devs[i])
|
if (! grub_usb_devs[i])
|
||||||
break;
|
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;
|
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_REQTYPE_TARGET_DEV),
|
||||||
GRUB_USB_REQ_SET_ADDRESS,
|
GRUB_USB_REQ_SET_ADDRESS,
|
||||||
i, 0, 0, NULL);
|
i, 0, 0, NULL);
|
||||||
|
|
||||||
dev->addr = i;
|
dev->addr = i;
|
||||||
dev->initialized = 1;
|
dev->initialized = 1;
|
||||||
grub_usb_devs[i] = dev;
|
grub_usb_devs[i] = dev;
|
||||||
|
|
|
@ -36,23 +36,23 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
static const struct grub_arg_option options[] = {
|
||||||
{"exclude", 'x', 0,
|
{"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},
|
0, ARG_TYPE_STRING},
|
||||||
{"load-only", 'n', 0,
|
{"load-only", 'n', 0,
|
||||||
"Load only tables specified by comma-separated list", 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},
|
{"v1", '1', 0, "Expose v1 tables.", 0, ARG_TYPE_NONE},
|
||||||
{"v2", '2', 0, "Expose v2 and v3 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},
|
{"oemid", 'o', 0, "Set OEMID of RSDP, XSDT and RSDT.", 0, ARG_TYPE_STRING},
|
||||||
{"oemtable", 't', 0,
|
{"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,
|
{"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,
|
{"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,
|
{"oemtablecreatorrev", 'd', 0,
|
||||||
"Set creator revision of RSDP, XSDT and RSDT", 0, ARG_TYPE_INT},
|
"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"
|
{"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",
|
" BIOSes but makes it ineffective with OS not receiving RSDP from GRUB.",
|
||||||
0, ARG_TYPE_NONE},
|
0, ARG_TYPE_NONE},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
@ -763,7 +763,7 @@ GRUB_MOD_INIT(acpi)
|
||||||
"--load-only=table1,table2] filename1 "
|
"--load-only=table1,table2] filename1 "
|
||||||
" [filename2] [...]",
|
" [filename2] [...]",
|
||||||
"Load host acpi tables and tables "
|
"Load host acpi tables and tables "
|
||||||
"specified by arguments",
|
"specified by arguments.",
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ GRUB_MOD_INIT(boot)
|
||||||
{
|
{
|
||||||
cmd_boot =
|
cmd_boot =
|
||||||
grub_register_command ("boot", grub_cmd_boot,
|
grub_register_command ("boot", grub_cmd_boot,
|
||||||
0, "boot an operating system");
|
0, "Boot an operating system.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(boot)
|
GRUB_MOD_FINI(boot)
|
||||||
|
|
|
@ -40,7 +40,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
|
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]);
|
args[1]);
|
||||||
|
|
||||||
file1 = grub_gzfile_open (args[0], 1);
|
file1 = grub_gzfile_open (args[0], 1);
|
||||||
|
@ -49,7 +49,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (grub_file_size (file1) != grub_file_size (file2))
|
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 (file1), args[0],
|
||||||
(unsigned long long) grub_file_size (file2), args[1]);
|
(unsigned long long) grub_file_size (file2), args[1]);
|
||||||
else
|
else
|
||||||
|
@ -76,7 +76,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
if (buf1[i] != buf2[i])
|
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],
|
(unsigned long long) (i + pos), buf1[i], args[0],
|
||||||
buf2[i], args[1]);
|
buf2[i], args[1]);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{0, 'n', 0, "do not output the trailing newline", 0, 0},
|
{0, 'n', 0, "Do not output the trailing newline.", 0, 0},
|
||||||
{0, 'e', 0, "enable interpretation of backslash escapes", 0, 0},
|
{0, 'e', 0, "Enable interpretation of backslash escapes.", 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,11 @@ static struct grub_video_patch
|
||||||
};
|
};
|
||||||
|
|
||||||
static int NESTED_FUNC_ATTR
|
static int NESTED_FUNC_ATTR
|
||||||
scan_card (int bus, int dev, int func, grub_pci_id_t pciid)
|
scan_card (grub_pci_device_t dev, grub_pci_id_t pciid)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
|
||||||
addr = grub_pci_make_address (bus, dev, func, 2);
|
addr = grub_pci_make_address (dev, 2);
|
||||||
if (grub_pci_read_byte (addr + 3) == 0x3)
|
if (grub_pci_read_byte (addr + 3) == 0x3)
|
||||||
{
|
{
|
||||||
struct grub_video_patch *p = video_patches;
|
struct grub_video_patch *p = video_patches;
|
||||||
|
|
|
@ -41,15 +41,16 @@ enable_rom_area (void)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
grub_uint32_t *rom_ptr;
|
grub_uint32_t *rom_ptr;
|
||||||
|
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
||||||
|
|
||||||
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
|
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
|
||||||
if (*rom_ptr != BLANK_MEM)
|
if (*rom_ptr != BLANK_MEM)
|
||||||
{
|
{
|
||||||
grub_printf ("ROM image present.\n");
|
grub_printf ("ROM image is present.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = grub_pci_make_address (0, 0, 0, 36);
|
addr = grub_pci_make_address (dev, 36);
|
||||||
grub_pci_write_byte (addr++, 0x30);
|
grub_pci_write_byte (addr++, 0x30);
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
grub_pci_write_byte (addr++, 0x33);
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
grub_pci_write_byte (addr++, 0x33);
|
||||||
|
@ -62,7 +63,7 @@ enable_rom_area (void)
|
||||||
*rom_ptr = 0;
|
*rom_ptr = 0;
|
||||||
if (*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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,8 +74,9 @@ static void
|
||||||
lock_rom_area (void)
|
lock_rom_area (void)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
||||||
|
|
||||||
addr = grub_pci_make_address (0, 0, 0, 36);
|
addr = grub_pci_make_address (dev, 36);
|
||||||
grub_pci_write_byte (addr++, 0x10);
|
grub_pci_write_byte (addr++, 0x10);
|
||||||
grub_pci_write_byte (addr++, 0x11);
|
grub_pci_write_byte (addr++, 0x11);
|
||||||
grub_pci_write_byte (addr++, 0x11);
|
grub_pci_write_byte (addr++, 0x11);
|
||||||
|
@ -199,7 +201,7 @@ static grub_command_t cmd_fakebios, cmd_loadbios;
|
||||||
GRUB_MOD_INIT(loadbios)
|
GRUB_MOD_INIT(loadbios)
|
||||||
{
|
{
|
||||||
cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
|
cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
|
||||||
0, "fake bios.");
|
0, "Fake bios.");
|
||||||
|
|
||||||
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
|
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
|
||||||
"loadbios BIOS_DUMP [INT10_DUMP]",
|
"loadbios BIOS_DUMP [INT10_DUMP]",
|
||||||
|
|
|
@ -246,7 +246,7 @@ GRUB_MOD_INIT(gptsync)
|
||||||
"of hybrid mbr. Up to 3 partitions are "
|
"of hybrid mbr. Up to 3 partitions are "
|
||||||
"allowed. TYPE is an MBR type. "
|
"allowed. TYPE is an MBR type. "
|
||||||
"+ means that partition is active. "
|
"+ means that partition is active. "
|
||||||
"Only one partition can be active");
|
"Only one partition can be active.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(gptsync)
|
GRUB_MOD_FINI(gptsync)
|
||||||
|
|
|
@ -19,15 +19,7 @@
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
#if defined(GRUB_MACHINE_IEEE1275)
|
|
||||||
#include <grub/machine/kernel.h>
|
|
||||||
#elif defined(GRUB_MACHINE_EFI)
|
|
||||||
#include <grub/efi/efi.h>
|
|
||||||
#else
|
|
||||||
/* Platforms shipping standalone halt, such as coreboot. */
|
|
||||||
#include <grub/cpu/halt.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
@ -43,8 +35,8 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(halt)
|
GRUB_MOD_INIT(halt)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("halt", grub_cmd_halt,
|
cmd = grub_register_command ("halt", grub_cmd_halt,
|
||||||
0, "halts the computer. This command does not"
|
0, "Halts the computer. This command does not"
|
||||||
" work on all firmware.");
|
" work on all firmware implementations.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(halt)
|
GRUB_MOD_FINI(halt)
|
||||||
|
|
|
@ -96,15 +96,15 @@ GRUB_MOD_INIT(handler)
|
||||||
cmd_handler =
|
cmd_handler =
|
||||||
grub_register_command ("handler", grub_cmd_handler,
|
grub_register_command ("handler", grub_cmd_handler,
|
||||||
"handler [class [handler]]",
|
"handler [class [handler]]",
|
||||||
"List or select a handler");
|
"List or select a handler.");
|
||||||
cmd_terminal_input =
|
cmd_terminal_input =
|
||||||
grub_register_command ("terminal_input", grub_cmd_handler,
|
grub_register_command ("terminal_input", grub_cmd_handler,
|
||||||
"terminal_input [handler]",
|
"terminal_input [handler]",
|
||||||
"List or select a handler");
|
"List or select an input terminal.");
|
||||||
cmd_terminal_output =
|
cmd_terminal_output =
|
||||||
grub_register_command ("terminal_output", grub_cmd_handler,
|
grub_register_command ("terminal_output", grub_cmd_handler,
|
||||||
"terminal_output [handler]",
|
"terminal_output [handler]",
|
||||||
"List or select a handler");
|
"List or select an output terminal.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(handler)
|
GRUB_MOD_FINI(handler)
|
||||||
|
|
|
@ -26,27 +26,27 @@
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
static const struct grub_arg_option options[] = {
|
||||||
{"apm", 'B', 0, "set Advanced Power Management\n"
|
{"apm", 'B', 0, "Set Advanced Power Management\n"
|
||||||
"(1=low, ..., 254=high, 255=off)",
|
"(1=low, ..., 254=high, 255=off).",
|
||||||
0, ARG_TYPE_INT},
|
0, ARG_TYPE_INT},
|
||||||
{"power", 'C', 0, "check power mode", 0, ARG_TYPE_NONE},
|
{"power", 'C', 0, "Check power mode.", 0, ARG_TYPE_NONE},
|
||||||
{"security-freeze", 'F', 0, "freeze ATA security settings until reset",
|
{"security-freeze", 'F', 0, "Freeze ATA security settings until reset.",
|
||||||
0, ARG_TYPE_NONE},
|
0, ARG_TYPE_NONE},
|
||||||
{"health", 'H', 0, "check SMART health status", 0, ARG_TYPE_NONE},
|
{"health", 'H', 0, "Check SMART health status.", 0, ARG_TYPE_NONE},
|
||||||
{"aam", 'M', 0, "set Automatic Acoustic Management\n"
|
{"aam", 'M', 0, "Set Automatic Acoustic Management\n"
|
||||||
"(0=off, 128=quiet, ..., 254=fast)",
|
"(0=off, 128=quiet, ..., 254=fast).",
|
||||||
0, ARG_TYPE_INT},
|
0, ARG_TYPE_INT},
|
||||||
{"standby-timeout", 'S', 0, "set standby timeout\n"
|
{"standby-timeout", 'S', 0, "Set standby timeout\n"
|
||||||
"(0=off, 1=5s, 2=10s, ..., 240=20m, 241=30m, ...)",
|
"(0=off, 1=5s, 2=10s, ..., 240=20m, 241=30m, ...).",
|
||||||
0, ARG_TYPE_INT},
|
0, ARG_TYPE_INT},
|
||||||
{"standby", 'y', 0, "set drive to standby mode", 0, ARG_TYPE_NONE},
|
{"standby", 'y', 0, "Set drive to standby mode.", 0, ARG_TYPE_NONE},
|
||||||
{"sleep", 'Y', 0, "set drive to sleep 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",
|
{"identify", 'i', 0, "Print drive identity and settings.",
|
||||||
0, ARG_TYPE_NONE},
|
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},
|
0, ARG_TYPE_NONE},
|
||||||
{"smart", -1, 0, "disable/enable SMART (0/1)", 0, ARG_TYPE_INT},
|
{"smart", -1, 0, "Disable/enable SMART (0/1).", 0, ARG_TYPE_INT},
|
||||||
{"quiet", 'q', 0, "do not print messages", 0, ARG_TYPE_NONE},
|
{"quiet", 'q', 0, "Do not print messages.", 0, ARG_TYPE_NONE},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
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},
|
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}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,18 +38,18 @@ grub_cmd_hexdump (grub_extcmd_t cmd, int argc, char **args)
|
||||||
struct grub_arg_list *state = cmd->state;
|
struct grub_arg_list *state = cmd->state;
|
||||||
char buf[GRUB_DISK_SECTOR_SIZE * 4];
|
char buf[GRUB_DISK_SECTOR_SIZE * 4];
|
||||||
grub_ssize_t size, length;
|
grub_ssize_t size, length;
|
||||||
grub_addr_t skip;
|
grub_disk_addr_t skip;
|
||||||
int namelen;
|
int namelen;
|
||||||
|
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||||
|
|
||||||
namelen = grub_strlen (args[0]);
|
namelen = grub_strlen (args[0]);
|
||||||
skip = (state[0].set) ? grub_strtoul (state[0].arg, 0, 0) : 0;
|
skip = (state[0].set) ? grub_strtoull (state[0].arg, 0, 0) : 0;
|
||||||
length = (state[1].set) ? grub_strtoul (state[1].arg, 0, 0) : 256;
|
length = (state[1].set) ? grub_strtoul (state[1].arg, 0, 0) : 256;
|
||||||
|
|
||||||
if (!grub_strcmp (args[0], "(mem)"))
|
if (!grub_strcmp (args[0], "(mem)"))
|
||||||
hexdump (skip, (char *) skip, length);
|
hexdump (skip, (char *) (grub_addr_t) skip, length);
|
||||||
else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')'))
|
else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')'))
|
||||||
{
|
{
|
||||||
grub_disk_t disk;
|
grub_disk_t disk;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
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}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ done:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cmd = grub_register_extcmd ("cpuid", grub_cmd_cpuid, GRUB_COMMAND_FLAG_BOTH,
|
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)
|
GRUB_MOD_FINI(cpuid)
|
||||||
|
|
|
@ -33,9 +33,9 @@ static grub_uint32_t *const int13slot = UINT_TO_PTR (4 * 0x13);
|
||||||
|
|
||||||
/* Remember to update enum opt_idxs accordingly. */
|
/* Remember to update enum opt_idxs accordingly. */
|
||||||
static const struct grub_arg_option options[] = {
|
static const struct grub_arg_option options[] = {
|
||||||
{"list", 'l', 0, "show the current mappings", 0, 0},
|
{"list", 'l', 0, "Show the current mappings.", 0, 0},
|
||||||
{"reset", 'r', 0, "reset all mappings to the default values", 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},
|
{"swap", 's', 0, "Perform both direct and reverse mappings.", 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ GRUB_MOD_INIT (drivemap)
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"drivemap"
|
"drivemap"
|
||||||
" -l | -r | [-s] grubdev osdisk",
|
" -l | -r | [-s] grubdev osdisk",
|
||||||
"Manage the BIOS drive mappings",
|
"Manage the BIOS drive mappings.",
|
||||||
options);
|
options);
|
||||||
drivemap_hook =
|
drivemap_hook =
|
||||||
grub_loader_register_preboot_hook (&install_int13_handler,
|
grub_loader_register_preboot_hook (&install_int13_handler,
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/machine/init.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
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}
|
{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,
|
cmd = grub_register_extcmd ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"halt [-n]",
|
"halt [-n]",
|
||||||
"Halt the system, if possible using APM",
|
"Halt the system, if possible using APM.",
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(play)
|
GRUB_MOD_INIT(play)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("play", grub_cmd_play,
|
cmd = grub_register_command ("play", grub_cmd_play,
|
||||||
"play FILE", "Play a tune");
|
"play FILE", "Play a tune.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(play)
|
GRUB_MOD_FINI(play)
|
||||||
|
|
|
@ -25,9 +25,9 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"info", 'i', 0, "show PXE information.", 0, 0},
|
{"info", 'i', 0, "Show PXE information.", 0, 0},
|
||||||
{"bsize", 'b', 0, "set PXE block size", 0, ARG_TYPE_INT},
|
{"bsize", 'b', 0, "Set PXE block size.", 0, ARG_TYPE_INT},
|
||||||
{"unload", 'u', 0, "unload PXE stack.", 0, 0},
|
{"unload", 'u', 0, "Unload PXE stack.", 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(vbetest)
|
GRUB_MOD_INIT(vbetest)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("vbetest", grub_cmd_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)
|
GRUB_MOD_FINI(vbetest)
|
||||||
|
|
|
@ -39,7 +39,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(ieee1275_suspend)
|
GRUB_MOD_INIT(ieee1275_suspend)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("suspend", grub_cmd_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)
|
GRUB_MOD_FINI(ieee1275_suspend)
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"shift", 's', 0, "check Shift key", 0, 0},
|
{"shift", 's', 0, "Check Shift key.", 0, 0},
|
||||||
{"ctrl", 'c', 0, "check Control key", 0, 0},
|
{"ctrl", 'c', 0, "Check Control key.", 0, 0},
|
||||||
{"alt", 'a', 0, "check Alt key", 0, 0},
|
{"alt", 'a', 0, "Check Alt key.", 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ GRUB_MOD_INIT(keystatus)
|
||||||
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus,
|
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"keystatus [--shift] [--ctrl] [--alt]",
|
"keystatus [--shift] [--ctrl] [--alt]",
|
||||||
"Check key modifier status",
|
"Check key modifier status.",
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
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}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"long", 'l', 0, "show a long list with more detailed information", 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},
|
{"human-readable", 'h', 0, "Print sizes in a human readable format.", 0, 0},
|
||||||
{"all", 'a', 0, "list all files", 0, 0},
|
{"all", 'a', 0, "List all files.", 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/command.h>
|
#include <grub/extcmd.h>
|
||||||
|
|
||||||
struct grub_pci_classname
|
struct grub_pci_classname
|
||||||
{
|
{
|
||||||
|
@ -84,6 +84,7 @@ static const struct grub_pci_classname grub_pci_classes[] =
|
||||||
{ 11, 0x30, "MIPS Processor" },
|
{ 11, 0x30, "MIPS Processor" },
|
||||||
{ 11, 0x40, "Co-Processor" },
|
{ 11, 0x40, "Co-Processor" },
|
||||||
{ 11, 0x80, "Unknown Processor" },
|
{ 11, 0x80, "Unknown Processor" },
|
||||||
|
{ 12, 3, "USB Controller" },
|
||||||
{ 12, 0x80, "Serial Bus Controller" },
|
{ 12, 0x80, "Serial Bus Controller" },
|
||||||
{ 13, 0x80, "Wireless Controller" },
|
{ 13, 0x80, "Wireless Controller" },
|
||||||
{ 14, 0, "I2O" },
|
{ 14, 0, "I2O" },
|
||||||
|
@ -114,16 +115,26 @@ grub_pci_get_class (int class, int subclass)
|
||||||
return 0;
|
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
|
static int NESTED_FUNC_ATTR
|
||||||
grub_lspci_iter (int bus, int dev, int func, grub_pci_id_t pciid)
|
grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
||||||
{
|
{
|
||||||
grub_uint32_t class;
|
grub_uint32_t class;
|
||||||
const char *sclass;
|
const char *sclass;
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
int reg;
|
||||||
|
|
||||||
grub_printf ("%02x:%02x.%x %04x:%04x", bus, dev, func, pciid & 0xFFFF,
|
grub_printf ("%02x:%02x.%x %04x:%04x", grub_pci_get_bus (dev),
|
||||||
pciid >> 16);
|
grub_pci_get_device (dev), grub_pci_get_function (dev),
|
||||||
addr = grub_pci_make_address (bus, dev, func, 2);
|
pciid & 0xFFFF, pciid >> 16);
|
||||||
|
addr = grub_pci_make_address (dev, 2);
|
||||||
class = grub_pci_read (addr);
|
class = grub_pci_read (addr);
|
||||||
|
|
||||||
/* Lookup the class name, if there isn't a specific one,
|
/* Lookup the class name, if there isn't a specific one,
|
||||||
|
@ -142,27 +153,75 @@ grub_lspci_iter (int bus, int dev, int func, grub_pci_id_t pciid)
|
||||||
|
|
||||||
grub_printf ("\n");
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_lspci (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_lspci (grub_extcmd_t cmd,
|
||||||
int argc __attribute__ ((unused)),
|
int argc __attribute__ ((unused)),
|
||||||
char **args __attribute__ ((unused)))
|
char **args __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
|
iospace = cmd->state[0].set;
|
||||||
grub_pci_iterate (grub_lspci_iter);
|
grub_pci_iterate (grub_lspci_iter);
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_command_t cmd;
|
static grub_extcmd_t cmd;
|
||||||
|
|
||||||
GRUB_MOD_INIT(pci)
|
GRUB_MOD_INIT(lspci)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("lspci", grub_cmd_lspci,
|
cmd = grub_register_extcmd ("lspci", grub_cmd_lspci, GRUB_COMMAND_FLAG_BOTH,
|
||||||
0, "List PCI devices");
|
"lspci [-i]", "List PCI devices.", options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(pci)
|
GRUB_MOD_FINI(lspci)
|
||||||
{
|
{
|
||||||
grub_unregister_command (cmd);
|
grub_unregister_extcmd (cmd);
|
||||||
}
|
}
|
||||||
|
|
104
commands/memrw.c
104
commands/memrw.c
|
@ -19,28 +19,52 @@
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/misc.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 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
|
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_target_addr_t addr;
|
||||||
grub_uint32_t value;
|
grub_uint32_t value = 0;
|
||||||
|
char buf[sizeof ("XXXXXXXX")];
|
||||||
|
|
||||||
if (argc != 1)
|
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);
|
addr = grub_strtoul (argv[0], 0, 0);
|
||||||
if (cmd->name[5] == 'd')
|
switch (cmd->cmd->name[sizeof ("read_") - 1])
|
||||||
value = *((grub_uint32_t *) addr);
|
{
|
||||||
else if (cmd->name[5] == 'w')
|
case 'd':
|
||||||
value = *((grub_uint16_t *) addr);
|
value = *((volatile grub_uint32_t *) addr);
|
||||||
else
|
break;
|
||||||
value = *((grub_uint8_t *) addr);
|
|
||||||
|
|
||||||
|
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);
|
grub_printf ("0x%x\n", value);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -51,18 +75,42 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
||||||
{
|
{
|
||||||
grub_target_addr_t addr;
|
grub_target_addr_t addr;
|
||||||
grub_uint32_t value;
|
grub_uint32_t value;
|
||||||
|
grub_uint32_t mask = 0xffffffff;
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2 && argc != 3)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
||||||
|
|
||||||
addr = grub_strtoul (argv[0], 0, 0);
|
addr = grub_strtoul (argv[0], 0, 0);
|
||||||
value = grub_strtoul (argv[1], 0, 0);
|
value = grub_strtoul (argv[1], 0, 0);
|
||||||
if (cmd->name[6] == 'd')
|
if (argc == 3)
|
||||||
*((grub_uint32_t *) addr) = value;
|
mask = grub_strtoul (argv[2], 0, 0);
|
||||||
else if (cmd->name[6] == 'w')
|
value &= mask;
|
||||||
*((grub_uint16_t *) addr) = (grub_uint16_t) value;
|
switch (cmd->name[sizeof ("write_") - 1])
|
||||||
|
{
|
||||||
|
case 'd':
|
||||||
|
if (mask != 0xffffffff)
|
||||||
|
*((volatile grub_uint32_t *) addr)
|
||||||
|
= (*((volatile grub_uint32_t *) addr) & ~mask) | value;
|
||||||
else
|
else
|
||||||
*((grub_uint8_t *) addr) = (grub_uint8_t) value;
|
*((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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -70,30 +118,30 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
||||||
GRUB_MOD_INIT(memrw)
|
GRUB_MOD_INIT(memrw)
|
||||||
{
|
{
|
||||||
cmd_read_byte =
|
cmd_read_byte =
|
||||||
grub_register_command ("read_byte", grub_cmd_read,
|
grub_register_extcmd ("read_byte", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"read_byte ADDR", "read byte.");
|
"read_byte ADDR", "Read byte from ADDR.", options);
|
||||||
cmd_read_word =
|
cmd_read_word =
|
||||||
grub_register_command ("read_word", grub_cmd_read,
|
grub_register_extcmd ("read_word", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"read_word ADDR", "read word.");
|
"read_word ADDR", "Read word from ADDR.", options);
|
||||||
cmd_read_dword =
|
cmd_read_dword =
|
||||||
grub_register_command ("read_dword", grub_cmd_read,
|
grub_register_extcmd ("read_dword", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"read_dword ADDR", "read dword.");
|
"read_dword ADDR", "Read dword from ADDR.", options);
|
||||||
cmd_write_byte =
|
cmd_write_byte =
|
||||||
grub_register_command ("write_byte", grub_cmd_write,
|
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 =
|
cmd_write_word =
|
||||||
grub_register_command ("write_word", grub_cmd_write,
|
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 =
|
cmd_write_dword =
|
||||||
grub_register_command ("write_dword", grub_cmd_write,
|
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_MOD_FINI(memrw)
|
||||||
{
|
{
|
||||||
grub_unregister_command (cmd_read_byte);
|
grub_unregister_extcmd (cmd_read_byte);
|
||||||
grub_unregister_command (cmd_read_word);
|
grub_unregister_extcmd (cmd_read_word);
|
||||||
grub_unregister_command (cmd_read_dword);
|
grub_unregister_extcmd (cmd_read_dword);
|
||||||
grub_unregister_command (cmd_write_byte);
|
grub_unregister_command (cmd_write_byte);
|
||||||
grub_unregister_command (cmd_write_word);
|
grub_unregister_command (cmd_write_word);
|
||||||
grub_unregister_command (cmd_write_dword);
|
grub_unregister_command (cmd_write_dword);
|
||||||
|
|
|
@ -353,28 +353,28 @@ GRUB_MOD_INIT(minicmd)
|
||||||
{
|
{
|
||||||
cmd_cat =
|
cmd_cat =
|
||||||
grub_register_command ("cat", grub_mini_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 =
|
cmd_help =
|
||||||
grub_register_command ("help", grub_mini_cmd_help,
|
grub_register_command ("help", grub_mini_cmd_help,
|
||||||
0, "show this message");
|
0, "Show this message.");
|
||||||
cmd_root =
|
cmd_root =
|
||||||
grub_register_command ("root", grub_mini_cmd_root,
|
grub_register_command ("root", grub_mini_cmd_root,
|
||||||
"root [DEVICE]", "set the root device");
|
"root [DEVICE]", "Set the root device.");
|
||||||
cmd_dump =
|
cmd_dump =
|
||||||
grub_register_command ("dump", grub_mini_cmd_dump,
|
grub_register_command ("dump", grub_mini_cmd_dump,
|
||||||
"dump ADDR", "dump memory");
|
"dump ADDR", "Dump memory.");
|
||||||
cmd_rmmod =
|
cmd_rmmod =
|
||||||
grub_register_command ("rmmod", grub_mini_cmd_rmmod,
|
grub_register_command ("rmmod", grub_mini_cmd_rmmod,
|
||||||
"rmmod MODULE", "remove a module");
|
"rmmod MODULE", "Remove a module.");
|
||||||
cmd_lsmod =
|
cmd_lsmod =
|
||||||
grub_register_command ("lsmod", grub_mini_cmd_lsmod,
|
grub_register_command ("lsmod", grub_mini_cmd_lsmod,
|
||||||
0, "show loaded modules");
|
0, "Show loaded modules.");
|
||||||
cmd_exit =
|
cmd_exit =
|
||||||
grub_register_command ("exit", grub_mini_cmd_exit,
|
grub_register_command ("exit", grub_mini_cmd_exit,
|
||||||
0, "exit from GRUB");
|
0, "Exit from GRUB.");
|
||||||
cmd_clear =
|
cmd_clear =
|
||||||
grub_register_command ("clear", grub_mini_cmd_clear,
|
grub_register_command ("clear", grub_mini_cmd_clear,
|
||||||
0, "clear the screen");
|
0, "Clear the screen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(minicmd)
|
GRUB_MOD_FINI(minicmd)
|
||||||
|
|
|
@ -34,9 +34,9 @@ static struct grub_parttool *parts = 0;
|
||||||
static int curhandle = 0;
|
static int curhandle = 0;
|
||||||
static grub_dl_t mymod;
|
static grub_dl_t mymod;
|
||||||
static char helpmsg[] =
|
static char helpmsg[] =
|
||||||
"perform COMMANDS on partition.\n"
|
"Perform COMMANDS on partition.\n"
|
||||||
"Use \"parttool PARTITION help\" for the list "
|
"Use \"parttool PARTITION help\" for the list "
|
||||||
"of available commands";
|
"of available commands.";
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_parttool_register(const char *part_name,
|
grub_parttool_register(const char *part_name,
|
||||||
|
|
|
@ -34,12 +34,12 @@
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
|
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
|
||||||
"set a variable to return value", "VAR", ARG_TYPE_STRING},
|
"Set a variable to return value.", "VAR", ARG_TYPE_STRING},
|
||||||
{"driver", 'd', 0, "determine driver", 0, 0},
|
{"driver", 'd', 0, "Determine driver.", 0, 0},
|
||||||
{"partmap", 'p', 0, "determine partition map type", 0, 0},
|
{"partmap", 'p', 0, "Determine partition map type.", 0, 0},
|
||||||
{"fs", 'f', 0, "determine filesystem type", 0, 0},
|
{"fs", 'f', 0, "Determine filesystem type.", 0, 0},
|
||||||
{"fs-uuid", 'u', 0, "determine filesystem UUID", 0, 0},
|
{"fs-uuid", 'u', 0, "Determine filesystem UUID.", 0, 0},
|
||||||
{"label", 'l', 0, "determine filesystem label", 0, 0},
|
{"label", 'l', 0, "Determine filesystem label.", 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ grub_getline (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
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 ();
|
char *line = grub_getline ();
|
||||||
if (! line)
|
if (! line)
|
||||||
|
@ -80,7 +80,7 @@ GRUB_MOD_INIT(read)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("read", grub_cmd_read,
|
cmd = grub_register_command ("read", grub_cmd_read,
|
||||||
"read [ENVVAR]",
|
"read [ENVVAR]",
|
||||||
"Set variable with user input");
|
"Set variable with user input.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(read)
|
GRUB_MOD_FINI(read)
|
||||||
|
|
|
@ -19,18 +19,7 @@
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
#if defined(GRUB_MACHINE_IEEE1275)
|
|
||||||
#include <grub/machine/kernel.h>
|
|
||||||
#elif defined(GRUB_MACHINE_EFI)
|
|
||||||
#include <grub/efi/efi.h>
|
|
||||||
#elif defined(GRUB_MACHINE_PCBIOS)
|
|
||||||
#include <grub/machine/init.h>
|
|
||||||
#else
|
|
||||||
/* Platforms shipping standalone reboot, such as coreboot. */
|
|
||||||
#include <grub/cpu/reboot.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
@ -46,7 +35,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(reboot)
|
GRUB_MOD_INIT(reboot)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("reboot", grub_cmd_reboot,
|
cmd = grub_register_command ("reboot", grub_cmd_reboot,
|
||||||
0, "Reboot the computer");
|
0, "Reboot the computer.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(reboot)
|
GRUB_MOD_FINI(reboot)
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"file", 'f', 0, "search devices by a file", 0, 0},
|
{"file", 'f', 0, "Search devices by a file.", 0, 0},
|
||||||
{"label", 'l', 0, "search devices by a filesystem label", 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},
|
{"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},
|
{"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},
|
{"no-floppy", 'n', 0, "Do not probe any floppy drive.", 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"verbose", 'v', 0, "verbose countdown", 0, 0},
|
{"verbose", 'v', 0, "Verbose countdown.", 0, 0},
|
||||||
{"interruptible", 'i', 0, "interruptible with ESC", 0, 0},
|
{"interruptible", 'i', 0, "Interruptible with ESC.", 0, 0},
|
||||||
{0, 0, 0, 0, 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,
|
cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"sleep NUMBER_OF_SECONDS",
|
"sleep NUMBER_OF_SECONDS",
|
||||||
"Wait for a specified number of seconds",
|
"Wait for a specified number of seconds.",
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -420,9 +420,9 @@ static grub_command_t cmd_1, cmd_2;
|
||||||
GRUB_MOD_INIT(test)
|
GRUB_MOD_INIT(test)
|
||||||
{
|
{
|
||||||
cmd_1 = grub_register_command ("[", grub_cmd_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,
|
cmd_2 = grub_register_command ("test", grub_cmd_test,
|
||||||
"test EXPRESSION", "Evaluate an expression");
|
"test EXPRESSION", "Evaluate an expression.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(test)
|
GRUB_MOD_FINI(test)
|
||||||
|
|
|
@ -43,10 +43,10 @@ GRUB_MOD_INIT(true)
|
||||||
{
|
{
|
||||||
cmd_true =
|
cmd_true =
|
||||||
grub_register_command ("true", grub_cmd_true,
|
grub_register_command ("true", grub_cmd_true,
|
||||||
0, "do nothing, successfully");
|
0, "Do nothing, successfully.");
|
||||||
cmd_false =
|
cmd_false =
|
||||||
grub_register_command ("false", grub_cmd_false,
|
grub_register_command ("false", grub_cmd_false,
|
||||||
0, "do nothing, unsuccessfully");
|
0, "Do nothing, unsuccessfully.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(true)
|
GRUB_MOD_FINI(true)
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
|
#include <grub/charset.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
|
@ -59,19 +60,61 @@ static const char *usb_devspeed[] =
|
||||||
"High"
|
"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
|
static void
|
||||||
usb_print_str (const char *description, grub_usb_device_t dev, int idx)
|
usb_print_str (const char *description, grub_usb_device_t dev, int idx)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
grub_usb_err_t err;
|
||||||
/* XXX: LANGID */
|
/* XXX: LANGID */
|
||||||
|
|
||||||
if (! idx)
|
if (! idx)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
grub_usb_get_string (dev, idx, 0x0409, &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_printf ("%s: `%s'\n", description, name);
|
||||||
grub_free (name);
|
grub_free (name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
usb_iterate (grub_usb_device_t dev)
|
usb_iterate (grub_usb_device_t dev)
|
||||||
|
@ -152,7 +195,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(usbtest)
|
GRUB_MOD_INIT(usbtest)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("usb", grub_cmd_usbtest,
|
cmd = grub_register_command ("usb", grub_cmd_usbtest,
|
||||||
0, "Test USB support");
|
0, "Test USB support.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(usbtest)
|
GRUB_MOD_FINI(usbtest)
|
||||||
|
|
|
@ -181,7 +181,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(videotest)
|
GRUB_MOD_INIT(videotest)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("videotest", grub_cmd_videotest,
|
cmd = grub_register_command ("videotest", grub_cmd_videotest,
|
||||||
0, "Test video subsystem");
|
0, "Test video subsystem.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(videotest)
|
GRUB_MOD_FINI(videotest)
|
||||||
|
|
|
@ -78,6 +78,11 @@ grub_emu_SOURCES += util/sdl.c
|
||||||
grub_emu_LDFLAGS += $(LIBSDL)
|
grub_emu_LDFLAGS += $(LIBSDL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(enable_grub_emu_pci), yes)
|
||||||
|
grub_emu_SOURCES += util/pci.c commands/lspci.c
|
||||||
|
grub_emu_LDFLAGS += $(LIBPCIACCESS)
|
||||||
|
endif
|
||||||
|
|
||||||
grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES))
|
grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES))
|
||||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
||||||
DISTCLEANFILES += grub_emu_init.lst
|
DISTCLEANFILES += grub_emu_init.lst
|
||||||
|
|
|
@ -3,7 +3,13 @@
|
||||||
sbin_UTILITIES += grub-mkdevicemap
|
sbin_UTILITIES += grub-mkdevicemap
|
||||||
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
||||||
util/deviceiter.c \
|
util/deviceiter.c \
|
||||||
util/devicemap.c util/misc.c
|
util/misc.c
|
||||||
|
|
||||||
|
ifeq ($(target_cpu)-$(platform), sparc64-ieee1275)
|
||||||
|
grub_mkdevicemap_SOURCES += util/ieee1275/ofpath.c util/ieee1275/devicemap.c
|
||||||
|
else
|
||||||
|
grub_mkdevicemap_SOURCES += util/devicemap.c
|
||||||
|
endif
|
||||||
|
|
||||||
# For grub-mkelfimage.
|
# For grub-mkelfimage.
|
||||||
bin_UTILITIES += grub-mkelfimage
|
bin_UTILITIES += grub-mkelfimage
|
||||||
|
@ -686,3 +692,8 @@ pkglib_MODULES += setjmp.mod
|
||||||
setjmp_mod_SOURCES = lib/$(target_cpu)/setjmp.S
|
setjmp_mod_SOURCES = lib/$(target_cpu)/setjmp.S
|
||||||
setjmp_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
setjmp_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
setjmp_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
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)
|
||||||
|
|
|
@ -18,6 +18,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
kern/i386/misc.S \
|
kern/i386/misc.S \
|
||||||
kern/i386/coreboot/init.c \
|
kern/i386/coreboot/init.c \
|
||||||
kern/i386/multiboot_mmap.c \
|
kern/i386/multiboot_mmap.c \
|
||||||
|
kern/i386/halt.c \
|
||||||
kern/main.c kern/device.c \
|
kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||||
|
@ -61,6 +62,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
||||||
kern/i386/misc.S \
|
kern/i386/misc.S \
|
||||||
kern/i386/coreboot/init.c \
|
kern/i386/coreboot/init.c \
|
||||||
kern/i386/qemu/mmap.c \
|
kern/i386/qemu/mmap.c \
|
||||||
|
kern/i386/halt.c \
|
||||||
kern/main.c kern/device.c \
|
kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||||
|
@ -124,12 +126,12 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For reboot.mod.
|
# For reboot.mod.
|
||||||
reboot_mod_SOURCES = commands/reboot.c kern/i386/reboot.c
|
reboot_mod_SOURCES = commands/reboot.c
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For halt.mod.
|
# For halt.mod.
|
||||||
halt_mod_SOURCES = commands/halt.c kern/i386/halt.c
|
halt_mod_SOURCES = commands/halt.c
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -30,14 +30,14 @@ sbin_SCRIPTS = grub-install
|
||||||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
grub_install_SOURCES = util/i386/efi/grub-install.in
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
pkglib_MODULES = kernel.mod chain.mod appleldr.mod \
|
pkglib_MODULES = kernel.img chain.mod appleldr.mod \
|
||||||
linux.mod halt.mod reboot.mod pci.mod lspci.mod \
|
linux.mod halt.mod reboot.mod pci.mod lspci.mod \
|
||||||
datetime.mod date.mod datehook.mod loadbios.mod \
|
datetime.mod date.mod datehook.mod loadbios.mod \
|
||||||
fixvideo.mod mmap.mod acpi.mod
|
fixvideo.mod mmap.mod acpi.mod
|
||||||
|
|
||||||
# For kernel.mod.
|
# For kernel.img.
|
||||||
kernel_mod_EXPORTS = no
|
kernel_img_EXPORTS = no
|
||||||
kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
|
kernel_img_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
|
@ -48,22 +48,22 @@ kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
kern/generic/rtc_get_time_ms.c \
|
kern/generic/rtc_get_time_ms.c \
|
||||||
kern/generic/millisleep.c
|
kern/generic/millisleep.c
|
||||||
kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||||
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h i18n.h
|
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h i18n.h
|
||||||
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c
|
MOSTLYCLEANFILES += symlist.c
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||||
DEFSYMFILES += kernel_syms.lst
|
DEFSYMFILES += kernel_syms.lst
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist.sh
|
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh
|
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
# For boot.mod.
|
# For boot.mod.
|
||||||
|
@ -155,7 +155,7 @@ efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
pkglib_MODULES += xnu.mod
|
pkglib_MODULES += xnu.mod
|
||||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
|
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
|
||||||
loader/macho.c loader/xnu.c loader/i386/xnu_helper.S
|
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
||||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
|
@ -184,7 +184,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
pkglib_MODULES += xnu.mod
|
pkglib_MODULES += xnu.mod
|
||||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c \
|
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c \
|
||||||
loader/macho.c loader/xnu.c loader/i386/xnu_helper.S
|
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
||||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
|
@ -15,6 +15,12 @@ vga_text_mod_SOURCES = term/i386/pc/vga_text.c term/i386/vga_common.c
|
||||||
vga_text_mod_CFLAGS = $(COMMON_CFLAGS)
|
vga_text_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
vga_text_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
vga_text_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += relocator.mod
|
||||||
|
relocator_mod_SOURCES = lib/i386/relocator.c lib/i386/relocator_asm.S lib/i386/relocator_backward.S
|
||||||
|
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
relocator_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
relocator_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
pkglib_MODULES += ata.mod
|
pkglib_MODULES += ata.mod
|
||||||
ata_mod_SOURCES = disk/ata.c
|
ata_mod_SOURCES = disk/ata.c
|
||||||
ata_mod_CFLAGS = $(COMMON_CFLAGS)
|
ata_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
|
|
@ -63,7 +63,7 @@ sbin_UTILITIES = grub-setup grub-ofpathname
|
||||||
|
|
||||||
# For grub-mkimage.
|
# For grub-mkimage.
|
||||||
grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
|
grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
|
||||||
util/resolve.c
|
util/resolve.c gnulib/progname.c
|
||||||
|
|
||||||
# For grub-setup.
|
# For grub-setup.
|
||||||
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
||||||
|
@ -82,12 +82,12 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
||||||
partmap/sun.c partmap/acorn.c \
|
partmap/sun.c partmap/acorn.c \
|
||||||
\
|
\
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||||
util/raid.c util/lvm.c \
|
util/raid.c util/lvm.c gnulib/progname.c \
|
||||||
grub_setup_init.c
|
grub_setup_init.c
|
||||||
|
|
||||||
# For grub-ofpathname.
|
# For grub-ofpathname.
|
||||||
grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
|
grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
|
||||||
util/ieee1275/ofpath.c util/misc.c
|
util/ieee1275/ofpath.c util/misc.c gnulib/progname.c
|
||||||
|
|
||||||
# Scripts.
|
# Scripts.
|
||||||
sbin_SCRIPTS = grub-install
|
sbin_SCRIPTS = grub-install
|
||||||
|
|
|
@ -29,14 +29,14 @@ sbin_SCRIPTS = grub-install
|
||||||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
grub_install_SOURCES = util/i386/efi/grub-install.in
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
pkglib_MODULES = kernel.mod chain.mod appleldr.mod \
|
pkglib_MODULES = kernel.img chain.mod appleldr.mod \
|
||||||
halt.mod reboot.mod linux.mod pci.mod lspci.mod \
|
halt.mod reboot.mod linux.mod pci.mod lspci.mod \
|
||||||
datetime.mod date.mod datehook.mod loadbios.mod \
|
datetime.mod date.mod datehook.mod loadbios.mod \
|
||||||
fixvideo.mod mmap.mod acpi.mod ata.mod
|
fixvideo.mod mmap.mod acpi.mod ata.mod
|
||||||
|
|
||||||
# For kernel.mod.
|
# For kernel.img.
|
||||||
kernel_mod_EXPORTS = no
|
kernel_img_EXPORTS = no
|
||||||
kernel_mod_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
|
kernel_img_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
|
||||||
kern/main.c kern/device.c \
|
kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||||
|
@ -47,23 +47,23 @@ kernel_mod_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c \
|
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c \
|
||||||
term/efi/console.c disk/efi/efidisk.c
|
term/efi/console.c disk/efi/efidisk.c
|
||||||
kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||||
efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \
|
efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \
|
||||||
handler.h command.h i18n.h
|
handler.h command.h i18n.h
|
||||||
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c
|
MOSTLYCLEANFILES += symlist.c
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||||
DEFSYMFILES += kernel_syms.lst
|
DEFSYMFILES += kernel_syms.lst
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist.sh
|
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh
|
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
# For boot.mod.
|
# For boot.mod.
|
||||||
|
@ -161,9 +161,15 @@ efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
pkglib_MODULES += xnu.mod
|
pkglib_MODULES += xnu.mod
|
||||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
|
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
|
||||||
loader/macho.c loader/xnu.c loader/i386/xnu_helper.S
|
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
||||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += relocator.mod
|
||||||
|
relocator_mod_SOURCES = lib/i386/relocator.c lib/i386/relocator_asm.S lib/i386/relocator_backward.S
|
||||||
|
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
relocator_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
relocator_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
include $(srcdir)/conf/common.mk
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
47
configure.ac
47
configure.ac
|
@ -122,6 +122,7 @@ case "$platform" in
|
||||||
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
|
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
|
||||||
esac
|
esac
|
||||||
CFLAGS="$CFLAGS $machine_CFLAGS"
|
CFLAGS="$CFLAGS $machine_CFLAGS"
|
||||||
|
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
|
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
|
||||||
|
|
||||||
AC_SUBST(host_cpu)
|
AC_SUBST(host_cpu)
|
||||||
|
@ -193,7 +194,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for functions.
|
# Check for functions.
|
||||||
AC_CHECK_FUNCS(posix_memalign memalign asprintf)
|
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
|
||||||
|
|
||||||
# For grub-mkisofs
|
# For grub-mkisofs
|
||||||
AC_HEADER_MAJOR
|
AC_HEADER_MAJOR
|
||||||
|
@ -529,6 +530,10 @@ AC_ARG_ENABLE([grub-emu-sdl],
|
||||||
[AS_HELP_STRING([--enable-grub-emu-sdl],
|
[AS_HELP_STRING([--enable-grub-emu-sdl],
|
||||||
[build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
|
[build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([grub-emu-pci],
|
||||||
|
[AS_HELP_STRING([--enable-grub-emu-pci],
|
||||||
|
[build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
|
||||||
|
|
||||||
if test "$platform" = emu; then
|
if test "$platform" = emu; then
|
||||||
missing_ncurses=
|
missing_ncurses=
|
||||||
[# Check for curses libraries.]
|
[# Check for curses libraries.]
|
||||||
|
@ -550,6 +555,11 @@ fi
|
||||||
if test x"$enable_grub_emu_usb" = xno ; then
|
if test x"$enable_grub_emu_usb" = xno ; then
|
||||||
grub_emu_usb_excuse="explicitly disabled"
|
grub_emu_usb_excuse="explicitly disabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x"$enable_grub_emu_pci" = xyes ; then
|
||||||
|
grub_emu_usb_excuse="conflicts with PCI support"
|
||||||
|
fi
|
||||||
|
|
||||||
[if [ x"$grub_emu_usb_excuse" = x ]; then
|
[if [ x"$grub_emu_usb_excuse" = x ]; then
|
||||||
# Check for libusb libraries.]
|
# Check for libusb libraries.]
|
||||||
AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
|
AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
|
||||||
|
@ -579,11 +589,13 @@ AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
|
||||||
[grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
|
[grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
|
||||||
AC_SUBST([LIBSDL])
|
AC_SUBST([LIBSDL])
|
||||||
[fi]
|
[fi]
|
||||||
|
|
||||||
[if [ x"$grub_emu_sdl_excuse" = x ]; then
|
[if [ x"$grub_emu_sdl_excuse" = x ]; then
|
||||||
# Check for headers.]
|
# Check for headers.]
|
||||||
AC_CHECK_HEADERS([SDL/SDL.h], [],
|
AC_CHECK_HEADERS([SDL/SDL.h], [],
|
||||||
[grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
|
[grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
|
||||||
[fi]
|
[fi]
|
||||||
|
|
||||||
if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
|
if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
|
||||||
AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
|
AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
|
||||||
fi
|
fi
|
||||||
|
@ -593,8 +605,36 @@ else
|
||||||
enable_grub_emu_sdl=no
|
enable_grub_emu_sdl=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x"$enable_grub_emu_pci" != xyes ; then
|
||||||
|
grub_emu_pci_excuse="not enabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$enable_grub_emu_usb" = xyes ; then
|
||||||
|
grub_emu_pci_excuse="conflicts with USB support"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[if [ x"$grub_emu_pci_excuse" = x ]; then
|
||||||
|
# Check for libpci libraries.]
|
||||||
|
AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
|
||||||
|
[grub_emu_pci_excuse=["need libpciaccess library"]])
|
||||||
|
AC_SUBST([LIBPCIACCESS])
|
||||||
|
[fi]
|
||||||
|
[if [ x"$grub_emu_pci_excuse" = x ]; then
|
||||||
|
# Check for headers.]
|
||||||
|
AC_CHECK_HEADERS([pci/pci.h], [],
|
||||||
|
[grub_emu_pci_excuse=["need libpciaccess headers"]])
|
||||||
|
[fi]
|
||||||
|
|
||||||
|
if test x"$grub_emu_pci_excuse" = x ; then
|
||||||
|
enable_grub_emu_pci=yes
|
||||||
|
else
|
||||||
|
|
||||||
|
enable_grub_emu_pci=no
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SUBST([enable_grub_emu_sdl])
|
AC_SUBST([enable_grub_emu_sdl])
|
||||||
AC_SUBST([enable_grub_emu_usb])
|
AC_SUBST([enable_grub_emu_usb])
|
||||||
|
AC_SUBST([enable_grub_emu_pci])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE([grub-fstest],
|
AC_ARG_ENABLE([grub-fstest],
|
||||||
|
@ -674,6 +714,11 @@ echo SDL support for grub-emu: Yes
|
||||||
else
|
else
|
||||||
echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
|
echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
|
||||||
fi
|
fi
|
||||||
|
if [ x"$grub_emu_pci_excuse" = x ]; then
|
||||||
|
echo PCI support for grub-emu: Yes
|
||||||
|
else
|
||||||
|
echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ x"$enable_mm_debug" = xyes ]; then
|
if [ x"$enable_mm_debug" = xyes ]; then
|
||||||
echo With memory debugging: Yes
|
echo With memory debugging: Yes
|
||||||
|
|
11
disk/ata.c
11
disk/ata.c
|
@ -388,7 +388,7 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int NESTED_FUNC_ATTR
|
static int NESTED_FUNC_ATTR
|
||||||
grub_ata_pciinit (int bus, int device, int func,
|
grub_ata_pciinit (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid __attribute__((unused)))
|
grub_pci_id_t pciid __attribute__((unused)))
|
||||||
{
|
{
|
||||||
static int compat_use[2] = { 0 };
|
static int compat_use[2] = { 0 };
|
||||||
|
@ -402,7 +402,7 @@ grub_ata_pciinit (int bus, int device, int func,
|
||||||
static int controller = 0;
|
static int controller = 0;
|
||||||
|
|
||||||
/* Read class. */
|
/* Read class. */
|
||||||
addr = grub_pci_make_address (bus, device, func, 2);
|
addr = grub_pci_make_address (dev, 2);
|
||||||
class = grub_pci_read (addr);
|
class = grub_pci_read (addr);
|
||||||
|
|
||||||
/* Check if this class ID matches that of a PCI IDE Controller. */
|
/* Check if this class ID matches that of a PCI IDE Controller. */
|
||||||
|
@ -429,9 +429,9 @@ grub_ata_pciinit (int bus, int device, int func,
|
||||||
{
|
{
|
||||||
/* Read the BARs, which either contain a mmapped IO address
|
/* Read the BARs, which either contain a mmapped IO address
|
||||||
or the IO port address. */
|
or the IO port address. */
|
||||||
addr = grub_pci_make_address (bus, device, func, 4 + 2 * i);
|
addr = grub_pci_make_address (dev, 4 + 2 * i);
|
||||||
bar1 = grub_pci_read (addr);
|
bar1 = grub_pci_read (addr);
|
||||||
addr = grub_pci_make_address (bus, device, func, 5 + 2 * i);
|
addr = grub_pci_make_address (dev, 5 + 2 * i);
|
||||||
bar2 = grub_pci_read (addr);
|
bar2 = grub_pci_read (addr);
|
||||||
|
|
||||||
/* Check if the BARs describe an IO region. */
|
/* Check if the BARs describe an IO region. */
|
||||||
|
@ -444,7 +444,8 @@ grub_ata_pciinit (int bus, int device, int func,
|
||||||
|
|
||||||
grub_dprintf ("ata",
|
grub_dprintf ("ata",
|
||||||
"PCI dev (%d,%d,%d) compat=%d rega=0x%x regb=0x%x\n",
|
"PCI dev (%d,%d,%d) compat=%d rega=0x%x regb=0x%x\n",
|
||||||
bus, device, func, compat, rega, regb);
|
grub_pci_get_bus (dev), grub_pci_get_device (dev),
|
||||||
|
grub_pci_get_function (dev), compat, rega, regb);
|
||||||
|
|
||||||
if (rega && regb)
|
if (rega && regb)
|
||||||
{
|
{
|
||||||
|
|
|
@ -169,7 +169,7 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grub_free (data);
|
grub_free (data);
|
||||||
return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get C/H/S values");
|
return grub_error (GRUB_ERR_BAD_DEVICE, "%s cannot get C/H/S values", disk->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
||||||
1024 /* cylinders */ *
|
1024 /* cylinders */ *
|
||||||
256 /* heads */ *
|
256 /* heads */ *
|
||||||
63 /* spt */)
|
63 /* spt */)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk");
|
return grub_error (GRUB_ERR_OUT_OF_RANGE, "%s out of disk", disk->name);
|
||||||
|
|
||||||
soff = ((grub_uint32_t) sector) % data->sectors + 1;
|
soff = ((grub_uint32_t) sector) % data->sectors + 1;
|
||||||
head = ((grub_uint32_t) sector) / data->sectors;
|
head = ((grub_uint32_t) sector) / data->sectors;
|
||||||
|
@ -260,7 +260,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
||||||
coff = head / data->heads;
|
coff = head / data->heads;
|
||||||
|
|
||||||
if (coff >= data->cylinders)
|
if (coff >= data->cylinders)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk");
|
return grub_error (GRUB_ERR_OUT_OF_RANGE, "%s out of disk", disk->name);
|
||||||
|
|
||||||
if (grub_biosdisk_rw_standard (cmd + 0x02, data->drive,
|
if (grub_biosdisk_rw_standard (cmd + 0x02, data->drive,
|
||||||
coff, hoff, soff, size, segment))
|
coff, hoff, soff, size, segment))
|
||||||
|
@ -268,9 +268,9 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case GRUB_BIOSDISK_READ:
|
case GRUB_BIOSDISK_READ:
|
||||||
return grub_error (GRUB_ERR_READ_ERROR, "biosdisk read error");
|
return grub_error (GRUB_ERR_READ_ERROR, "%s read error", disk->name);
|
||||||
case GRUB_BIOSDISK_WRITE:
|
case GRUB_BIOSDISK_WRITE:
|
||||||
return grub_error (GRUB_ERR_WRITE_ERROR, "biosdisk write error");
|
return grub_error (GRUB_ERR_WRITE_ERROR, "%s write error", disk->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ grub_ofdisk_iterate (int (*hook) (const char *name))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! grub_strcmp (alias->type, "block") &&
|
if (! grub_strcmp (alias->type, "block") &&
|
||||||
grub_strcmp (alias->name, "cdrom"))
|
grub_strncmp (alias->name, "cdrom", 5))
|
||||||
ret = hook (alias->name);
|
ret = hook (alias->name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ grub_efi_system_table64_t *grub_efiemu_system_table64 = 0;
|
||||||
static struct grub_efiemu_prepare_hook *efiemu_prepare_hooks = 0;
|
static struct grub_efiemu_prepare_hook *efiemu_prepare_hooks = 0;
|
||||||
/* Linked list of configuration tables */
|
/* Linked list of configuration tables */
|
||||||
static struct grub_efiemu_configuration_table *efiemu_config_tables = 0;
|
static struct grub_efiemu_configuration_table *efiemu_config_tables = 0;
|
||||||
|
static int prepared = 0;
|
||||||
|
|
||||||
/* Free all allocated space */
|
/* Free all allocated space */
|
||||||
grub_err_t
|
grub_err_t
|
||||||
|
@ -70,6 +71,8 @@ grub_efiemu_unload (void)
|
||||||
}
|
}
|
||||||
efiemu_prepare_hooks = 0;
|
efiemu_prepare_hooks = 0;
|
||||||
|
|
||||||
|
prepared = 0;
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,14 +280,19 @@ grub_efiemu_prepare (void)
|
||||||
{
|
{
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
|
||||||
|
if (prepared)
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
grub_dprintf ("efiemu", "Preparing %d-bit efiemu\n",
|
grub_dprintf ("efiemu", "Preparing %d-bit efiemu\n",
|
||||||
8 * grub_efiemu_sizeof_uintn_t ());
|
8 * grub_efiemu_sizeof_uintn_t ());
|
||||||
|
|
||||||
err = grub_efiemu_autocore ();
|
err = grub_efiemu_autocore ();
|
||||||
|
|
||||||
/* Create NVRAM if not yet done. */
|
/* Create NVRAM. */
|
||||||
grub_efiemu_pnvram ();
|
grub_efiemu_pnvram ();
|
||||||
|
|
||||||
|
prepared = 1;
|
||||||
|
|
||||||
if (grub_efiemu_sizeof_uintn_t () == 4)
|
if (grub_efiemu_sizeof_uintn_t () == 4)
|
||||||
return grub_efiemu_prepare32 (efiemu_prepare_hooks, efiemu_config_tables);
|
return grub_efiemu_prepare32 (efiemu_prepare_hooks, efiemu_config_tables);
|
||||||
else
|
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;
|
static grub_command_t cmd_loadcore, cmd_prepare, cmd_unload;
|
||||||
|
|
||||||
void
|
|
||||||
grub_efiemu_pnvram_cmd_register (void);
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(efiemu)
|
GRUB_MOD_INIT(efiemu)
|
||||||
{
|
{
|
||||||
cmd_loadcore = grub_register_command ("efiemu_loadcore",
|
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,
|
cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
|
||||||
"efiemu_unload",
|
"efiemu_unload",
|
||||||
"Unload EFI emulator");
|
"Unload EFI emulator");
|
||||||
grub_efiemu_pnvram_cmd_register ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(efiemu)
|
GRUB_MOD_FINI(efiemu)
|
||||||
|
@ -340,5 +344,4 @@ GRUB_MOD_FINI(efiemu)
|
||||||
grub_unregister_command (cmd_loadcore);
|
grub_unregister_command (cmd_loadcore);
|
||||||
grub_unregister_command (cmd_prepare);
|
grub_unregister_command (cmd_prepare);
|
||||||
grub_unregister_command (cmd_unload);
|
grub_unregister_command (cmd_unload);
|
||||||
grub_efiemu_pnvram_cmd_unregister ();
|
|
||||||
}
|
}
|
||||||
|
|
452
efiemu/pnvram.c
452
efiemu/pnvram.c
|
@ -22,6 +22,7 @@
|
||||||
#include <grub/normal.h>
|
#include <grub/normal.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
|
#include <grub/charset.h>
|
||||||
#include <grub/efiemu/efiemu.h>
|
#include <grub/efiemu/efiemu.h>
|
||||||
#include <grub/efiemu/runtime.h>
|
#include <grub/efiemu/runtime.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
@ -34,62 +35,184 @@ static int timezone_handle = 0;
|
||||||
static int accuracy_handle = 0;
|
static int accuracy_handle = 0;
|
||||||
static int daylight_handle = 0;
|
static int daylight_handle = 0;
|
||||||
|
|
||||||
/* Temporary place */
|
|
||||||
static grub_uint8_t *nvram;
|
|
||||||
static grub_size_t nvramsize;
|
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 */
|
/* Parse signed value */
|
||||||
static int
|
static int
|
||||||
grub_strtosl (char *arg, char **end, int base)
|
grub_strtosl (const char *arg, char **end, int base)
|
||||||
{
|
{
|
||||||
if (arg[0] == '-')
|
if (arg[0] == '-')
|
||||||
return -grub_strtoul (arg + 1, end, base);
|
return -grub_strtoul (arg + 1, end, base);
|
||||||
return grub_strtoul (arg, 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 */
|
/* Export stuff for efiemu */
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
nvram_set (void * data __attribute__ ((unused)))
|
nvram_set (void * data __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
|
const char *env;
|
||||||
/* Take definitive pointers */
|
/* 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_uint32_t *nvramsize_def
|
||||||
= grub_efiemu_mm_obtain_request (nvramsize_handle);
|
= 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_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_efiemu_mm_obtain_request (timezone_handle);
|
||||||
grub_uint8_t *daylight_def
|
grub_uint8_t *daylight
|
||||||
= grub_efiemu_mm_obtain_request (daylight_handle);
|
= grub_efiemu_mm_obtain_request (daylight_handle);
|
||||||
grub_uint32_t *accuracy_def
|
grub_uint32_t *accuracy
|
||||||
= grub_efiemu_mm_obtain_request (accuracy_handle);
|
= 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\n");
|
||||||
|
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 */
|
/* Copy to definitive loaction */
|
||||||
grub_dprintf ("efiemu", "preparing pnvram\n");
|
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;
|
*nvramsize_def = nvramsize;
|
||||||
*high_monotonic_count_def = high_monotonic_count;
|
|
||||||
*timezone_def = timezone;
|
|
||||||
*daylight_def = daylight;
|
|
||||||
*accuracy_def = accuracy;
|
|
||||||
|
|
||||||
/* Register symbols */
|
/* Register symbols */
|
||||||
grub_efiemu_register_symbol ("efiemu_variables", nvram_handle, 0);
|
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 (timezone_handle);
|
||||||
grub_efiemu_mm_return_request (accuracy_handle);
|
grub_efiemu_mm_return_request (accuracy_handle);
|
||||||
grub_efiemu_mm_return_request (daylight_handle);
|
grub_efiemu_mm_return_request (daylight_handle);
|
||||||
|
|
||||||
grub_free (nvram);
|
|
||||||
nvram = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the variables file It's in format
|
grub_err_t
|
||||||
guid1:attr1:name1:data1;
|
grub_efiemu_pnvram (void)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
|
const char *size;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
|
||||||
err = grub_efiemu_autocore ();
|
nvramsize = 0;
|
||||||
if (err)
|
|
||||||
{
|
size = grub_env_get ("EfiEmu.pnvram.size");
|
||||||
grub_free (nvram);
|
if (size)
|
||||||
return err;
|
nvramsize = grub_strtoul (size, 0, 0);
|
||||||
}
|
|
||||||
|
if (!nvramsize)
|
||||||
|
nvramsize = 2048;
|
||||||
|
|
||||||
err = grub_efiemu_register_prepare_hook (nvram_set, nvram_unload, 0);
|
err = grub_efiemu_register_prepare_hook (nvram_set, nvram_unload, 0);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
|
||||||
grub_free (nvram);
|
|
||||||
return err;
|
return err;
|
||||||
}
|
|
||||||
nvram_handle
|
nvram_handle
|
||||||
= grub_efiemu_request_memalign (1, nvramsize,
|
= grub_efiemu_request_memalign (1, nvramsize,
|
||||||
GRUB_EFI_RUNTIME_SERVICES_DATA);
|
GRUB_EFI_RUNTIME_SERVICES_DATA);
|
||||||
|
@ -323,78 +276,5 @@ grub_efiemu_make_nvram (void)
|
||||||
= grub_efiemu_request_memalign (1, sizeof (grub_uint32_t),
|
= grub_efiemu_request_memalign (1, sizeof (grub_uint32_t),
|
||||||
GRUB_EFI_RUNTIME_SERVICES_DATA);
|
GRUB_EFI_RUNTIME_SERVICES_DATA);
|
||||||
|
|
||||||
grub_efiemu_request_symbols (6);
|
|
||||||
return GRUB_ERR_NONE;
|
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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ SUFFIX (grub_efiemu_prepare) (struct grub_efiemu_prepare_hook *prepare_hooks,
|
||||||
|
|
||||||
int cntconftables = 0;
|
int cntconftables = 0;
|
||||||
struct SUFFIX (grub_efiemu_configuration_table) *conftables = 0;
|
struct SUFFIX (grub_efiemu_configuration_table) *conftables = 0;
|
||||||
struct SUFFIX (grub_efiemu_runtime_services) *runtime_services;
|
|
||||||
int i;
|
int i;
|
||||||
int handle;
|
int handle;
|
||||||
grub_off_t off;
|
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) */
|
/* Switch from phase 1 (counting) to phase 2 (real job) */
|
||||||
grub_efiemu_alloc_syms ();
|
grub_efiemu_alloc_syms ();
|
||||||
grub_efiemu_mm_do_alloc ();
|
grub_efiemu_mm_do_alloc ();
|
||||||
|
grub_efiemu_write_sym_markers ();
|
||||||
|
|
||||||
grub_efiemu_system_table32 = 0;
|
grub_efiemu_system_table32 = 0;
|
||||||
grub_efiemu_system_table64 = 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) *)
|
= (struct SUFFIX (grub_efi_system_table) *)
|
||||||
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
|
((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 */
|
/* Put pointer to the list of configuration tables in system table */
|
||||||
grub_efiemu_write_value
|
grub_efiemu_write_value
|
||||||
(&(SUFFIX (grub_efiemu_system_table)->configuration_table), 0,
|
(&(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);
|
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 */
|
/* compute CRC32 of system table */
|
||||||
SUFFIX (grub_efiemu_system_table)->hdr.crc32 = 0;
|
SUFFIX (grub_efiemu_system_table)->hdr.crc32 = 0;
|
||||||
SUFFIX (grub_efiemu_system_table)->hdr.crc32
|
SUFFIX (grub_efiemu_system_table)->hdr.crc32
|
||||||
= grub_getcrc32 (0, SUFFIX (grub_efiemu_system_table),
|
= grub_getcrc32 (0, SUFFIX (grub_efiemu_system_table),
|
||||||
SUFFIX (grub_efiemu_system_table)->hdr.header_size);
|
SUFFIX (grub_efiemu_system_table)->hdr.header_size);
|
||||||
|
|
||||||
grub_dprintf ("efiemu","system_table = %p, runtime_services = %p,"
|
grub_dprintf ("efiemu","system_table = %p, runtime_services = %p\n",
|
||||||
" conftables = %p (%d entries)\n",
|
SUFFIX (grub_efiemu_system_table), runtime_services);
|
||||||
SUFFIX (grub_efiemu_system_table), runtime_services,
|
|
||||||
conftables, cntconftables);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,9 +111,8 @@ static grub_uint8_t loge[1000] = "EFIEMULOG";
|
||||||
static int logn = 9;
|
static int logn = 9;
|
||||||
#define LOG(x) { if (logn<900) loge[logn++]=x; }
|
#define LOG(x) { if (logn<900) loge[logn++]=x; }
|
||||||
|
|
||||||
static int ptv_relocated = 0;
|
|
||||||
|
|
||||||
/* Interface with grub */
|
/* Interface with grub */
|
||||||
|
extern grub_uint8_t efiemu_ptv_relocated;
|
||||||
struct grub_efi_runtime_services efiemu_runtime_services;
|
struct grub_efi_runtime_services efiemu_runtime_services;
|
||||||
struct grub_efi_system_table efiemu_system_table;
|
struct grub_efi_system_table efiemu_system_table;
|
||||||
extern struct grub_efiemu_ptv_rel efiemu_ptv_relloc[];
|
extern struct grub_efiemu_ptv_rel efiemu_ptv_relloc[];
|
||||||
|
@ -343,9 +342,9 @@ grub_efi_status_t EFI_FUNC
|
||||||
LOG ('e');
|
LOG ('e');
|
||||||
|
|
||||||
/* Ensure that we are called only once */
|
/* Ensure that we are called only once */
|
||||||
if (ptv_relocated)
|
if (efiemu_ptv_relocated)
|
||||||
return GRUB_EFI_UNSUPPORTED;
|
return GRUB_EFI_UNSUPPORTED;
|
||||||
ptv_relocated = 1;
|
efiemu_ptv_relocated = 1;
|
||||||
|
|
||||||
/* Correct addresses using information supplied by grub */
|
/* Correct addresses using information supplied by grub */
|
||||||
for (cur_relloc = efiemu_ptv_relloc; cur_relloc->size;cur_relloc++)
|
for (cur_relloc = efiemu_ptv_relloc; cur_relloc->size;cur_relloc++)
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
static int ptv_written = 0;
|
static int ptv_written = 0;
|
||||||
static int ptv_alloc = 0;
|
static int ptv_alloc = 0;
|
||||||
static int ptv_handle = 0;
|
static int ptv_handle = 0;
|
||||||
|
static int relocated_handle = 0;
|
||||||
static int ptv_requested = 0;
|
static int ptv_requested = 0;
|
||||||
static struct grub_efiemu_sym *efiemu_syms = 0;
|
static struct grub_efiemu_sym *efiemu_syms = 0;
|
||||||
|
|
||||||
|
@ -54,6 +55,8 @@ grub_efiemu_free_syms (void)
|
||||||
ptv_requested = 0;
|
ptv_requested = 0;
|
||||||
grub_efiemu_mm_return_request (ptv_handle);
|
grub_efiemu_mm_return_request (ptv_handle);
|
||||||
ptv_handle = 0;
|
ptv_handle = 0;
|
||||||
|
grub_efiemu_mm_return_request (relocated_handle);
|
||||||
|
relocated_handle = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Announce that the module will need NUM allocators */
|
/* Announce that the module will need NUM allocators */
|
||||||
|
@ -114,10 +117,26 @@ grub_efiemu_alloc_syms (void)
|
||||||
ptv_handle = grub_efiemu_request_memalign
|
ptv_handle = grub_efiemu_request_memalign
|
||||||
(1, (ptv_requested + 1) * sizeof (struct grub_efiemu_ptv_rel),
|
(1, (ptv_requested + 1) * sizeof (struct grub_efiemu_ptv_rel),
|
||||||
GRUB_EFI_RUNTIME_SERVICES_DATA);
|
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);
|
grub_efiemu_register_symbol ("efiemu_ptv_relloc", ptv_handle, 0);
|
||||||
return grub_errno;
|
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)
|
/* Write value (pointer to memory PLUS_HANDLE)
|
||||||
- (pointer to memory MINUS_HANDLE) + VALUE to ADDR assuming that the
|
- (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
|
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;
|
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 ();
|
||||||
|
}
|
||||||
|
|
1
fs/fat.c
1
fs/fat.c
|
@ -25,6 +25,7 @@
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
|
#include <grub/charset.h>
|
||||||
|
|
||||||
#define GRUB_FAT_DIR_ENTRY_SIZE 32
|
#define GRUB_FAT_DIR_ENTRY_SIZE 32
|
||||||
|
|
||||||
|
|
26
fs/hfs.c
26
fs/hfs.c
|
@ -1072,6 +1072,31 @@ grub_hfs_label (grub_device_t device, char **label)
|
||||||
return grub_errno;
|
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 =
|
static struct grub_fs grub_hfs_fs =
|
||||||
|
@ -1082,6 +1107,7 @@ static struct grub_fs grub_hfs_fs =
|
||||||
.read = grub_hfs_read,
|
.read = grub_hfs_read,
|
||||||
.close = grub_hfs_close,
|
.close = grub_hfs_close,
|
||||||
.label = grub_hfs_label,
|
.label = grub_hfs_label,
|
||||||
|
.uuid = grub_hfs_uuid,
|
||||||
.next = 0
|
.next = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/fshelp.h>
|
#include <grub/fshelp.h>
|
||||||
#include <grub/hfs.h>
|
#include <grub/hfs.h>
|
||||||
|
#include <grub/charset.h>
|
||||||
|
|
||||||
#define GRUB_HFSPLUS_MAGIC 0x482B
|
#define GRUB_HFSPLUS_MAGIC 0x482B
|
||||||
#define GRUB_HFSPLUSX_MAGIC 0x4858
|
#define GRUB_HFSPLUSX_MAGIC 0x4858
|
||||||
|
|
|
@ -107,9 +107,11 @@ static struct grub_disk_dev grub_pxe_dev =
|
||||||
};
|
};
|
||||||
|
|
||||||
static grub_err_t
|
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,
|
int (*hook) (const char *filename,
|
||||||
const struct grub_dirhook_info *info) UNUSED)
|
const struct grub_dirhook_info *info)
|
||||||
|
__attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/fshelp.h>
|
#include <grub/fshelp.h>
|
||||||
|
#include <grub/charset.h>
|
||||||
|
|
||||||
#define GRUB_ISO9660_FSTYPE_DIR 0040000
|
#define GRUB_ISO9660_FSTYPE_DIR 0040000
|
||||||
#define GRUB_ISO9660_FSTYPE_REG 0100000
|
#define GRUB_ISO9660_FSTYPE_REG 0100000
|
||||||
|
|
1
fs/jfs.c
1
fs/jfs.c
|
@ -24,6 +24,7 @@
|
||||||
#include <grub/disk.h>
|
#include <grub/disk.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
#include <grub/charset.h>
|
||||||
|
|
||||||
#define GRUB_JFS_MAX_SYMLNK_CNT 8
|
#define GRUB_JFS_MAX_SYMLNK_CNT 8
|
||||||
#define GRUB_JFS_FILETYPE_MASK 0170000
|
#define GRUB_JFS_FILETYPE_MASK 0170000
|
||||||
|
|
52
fs/ntfs.c
52
fs/ntfs.c
|
@ -24,6 +24,7 @@
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/fshelp.h>
|
#include <grub/fshelp.h>
|
||||||
#include <grub/ntfs.h>
|
#include <grub/ntfs.h>
|
||||||
|
#include <grub/charset.h>
|
||||||
|
|
||||||
static grub_dl_t my_mod;
|
static grub_dl_t my_mod;
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ fixup (struct grub_ntfs_data *data, char *buf, int len, char *magic)
|
||||||
static grub_err_t read_mft (struct grub_ntfs_data *data, char *buf,
|
static grub_err_t read_mft (struct grub_ntfs_data *data, char *buf,
|
||||||
grub_uint32_t mftno);
|
grub_uint32_t mftno);
|
||||||
static grub_err_t read_attr (struct grub_ntfs_attr *at, char *dest,
|
static grub_err_t read_attr (struct grub_ntfs_attr *at, char *dest,
|
||||||
grub_uint32_t ofs, grub_uint32_t len,
|
grub_disk_addr_t ofs, grub_size_t len,
|
||||||
int cached,
|
int cached,
|
||||||
void
|
void
|
||||||
NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t
|
NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t
|
||||||
|
@ -72,7 +73,7 @@ static grub_err_t read_attr (struct grub_ntfs_attr *at, char *dest,
|
||||||
unsigned length));
|
unsigned length));
|
||||||
|
|
||||||
static grub_err_t read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
|
static grub_err_t read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
|
||||||
grub_uint32_t ofs, grub_uint32_t len,
|
grub_disk_addr_t ofs, grub_size_t len,
|
||||||
int cached,
|
int cached,
|
||||||
void
|
void
|
||||||
NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t
|
NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t
|
||||||
|
@ -260,9 +261,9 @@ locate_attr (struct grub_ntfs_attr *at, struct grub_ntfs_file *mft,
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
read_run_data (char *run, int nn, grub_uint32_t * val, int sig)
|
read_run_data (char *run, int nn, grub_disk_addr_t * val, int sig)
|
||||||
{
|
{
|
||||||
grub_uint32_t r, v;
|
grub_disk_addr_t r, v;
|
||||||
|
|
||||||
r = 0;
|
r = 0;
|
||||||
v = 1;
|
v = 1;
|
||||||
|
@ -284,7 +285,7 @@ grub_err_t
|
||||||
grub_ntfs_read_run_list (struct grub_ntfs_rlst * ctx)
|
grub_ntfs_read_run_list (struct grub_ntfs_rlst * ctx)
|
||||||
{
|
{
|
||||||
int c1, c2;
|
int c1, c2;
|
||||||
grub_uint32_t val;
|
grub_disk_addr_t val;
|
||||||
char *run;
|
char *run;
|
||||||
|
|
||||||
run = ctx->cur_run;
|
run = ctx->cur_run;
|
||||||
|
@ -335,25 +336,25 @@ grub_ntfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t block)
|
||||||
struct grub_ntfs_rlst *ctx;
|
struct grub_ntfs_rlst *ctx;
|
||||||
|
|
||||||
ctx = (struct grub_ntfs_rlst *) node;
|
ctx = (struct grub_ntfs_rlst *) node;
|
||||||
if ((grub_uint32_t) block >= ctx->next_vcn)
|
if (block >= ctx->next_vcn)
|
||||||
{
|
{
|
||||||
if (grub_ntfs_read_run_list (ctx))
|
if (grub_ntfs_read_run_list (ctx))
|
||||||
return -1;
|
return -1;
|
||||||
return ctx->curr_lcn;
|
return ctx->curr_lcn;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return (ctx->flags & RF_BLNK) ? 0 : ((grub_uint32_t) block -
|
return (ctx->flags & RF_BLNK) ? 0 : (block -
|
||||||
ctx->curr_vcn + ctx->curr_lcn);
|
ctx->curr_vcn + ctx->curr_lcn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
|
read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
|
||||||
grub_uint32_t len, int cached,
|
grub_disk_addr_t ofs, grub_size_t len, int cached,
|
||||||
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
|
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
|
||||||
unsigned offset,
|
unsigned offset,
|
||||||
unsigned length))
|
unsigned length))
|
||||||
{
|
{
|
||||||
grub_uint32_t vcn;
|
grub_disk_addr_t vcn;
|
||||||
struct grub_ntfs_rlst cc, *ctx;
|
struct grub_ntfs_rlst cc, *ctx;
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
|
@ -388,7 +389,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
|
||||||
{
|
{
|
||||||
if ((ofs & (~(COM_LEN - 1))) == at->save_pos)
|
if ((ofs & (~(COM_LEN - 1))) == at->save_pos)
|
||||||
{
|
{
|
||||||
grub_uint32_t n;
|
grub_disk_addr_t n;
|
||||||
|
|
||||||
n = COM_LEN - (ofs - at->save_pos);
|
n = COM_LEN - (ofs - at->save_pos);
|
||||||
if (n > len)
|
if (n > len)
|
||||||
|
@ -411,11 +412,11 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
|
||||||
at->save_pos = 1;
|
at->save_pos = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
vcn = ctx->target_vcn = (ofs / COM_LEN) * (COM_SEC / ctx->comp.spc);
|
vcn = ctx->target_vcn = (ofs >> COM_LOG_LEN) * (COM_SEC / ctx->comp.spc);
|
||||||
ctx->target_vcn &= ~0xF;
|
ctx->target_vcn &= ~0xF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
vcn = ctx->target_vcn = (ofs >> BLK_SHR) / ctx->comp.spc;
|
vcn = ctx->target_vcn = grub_divmod64 (ofs >> BLK_SHR, ctx->comp.spc, 0);
|
||||||
|
|
||||||
ctx->next_vcn = u32at (pa, 0x10);
|
ctx->next_vcn = u32at (pa, 0x10);
|
||||||
ctx->curr_lcn = 0;
|
ctx->curr_lcn = 0;
|
||||||
|
@ -427,11 +428,13 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
|
||||||
|
|
||||||
if (at->flags & AF_GPOS)
|
if (at->flags & AF_GPOS)
|
||||||
{
|
{
|
||||||
grub_uint32_t st0, st1;
|
grub_disk_addr_t st0, st1;
|
||||||
|
grub_uint32_t m;
|
||||||
|
|
||||||
|
grub_divmod64 (ofs >> BLK_SHR, ctx->comp.spc, &m);
|
||||||
|
|
||||||
st0 =
|
st0 =
|
||||||
(ctx->target_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc +
|
(ctx->target_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc + m;
|
||||||
((ofs >> BLK_SHR) % ctx->comp.spc);
|
|
||||||
st1 = st0 + 1;
|
st1 = st0 + 1;
|
||||||
if (st1 ==
|
if (st1 ==
|
||||||
(ctx->next_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc)
|
(ctx->next_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc)
|
||||||
|
@ -462,8 +465,8 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
read_attr (struct grub_ntfs_attr *at, char *dest, grub_uint32_t ofs,
|
read_attr (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
|
||||||
grub_uint32_t len, int cached,
|
grub_size_t len, int cached,
|
||||||
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
|
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
|
||||||
unsigned offset,
|
unsigned offset,
|
||||||
unsigned length))
|
unsigned length))
|
||||||
|
@ -479,9 +482,9 @@ read_attr (struct grub_ntfs_attr *at, char *dest, grub_uint32_t ofs,
|
||||||
if (at->flags & AF_ALST)
|
if (at->flags & AF_ALST)
|
||||||
{
|
{
|
||||||
char *pa;
|
char *pa;
|
||||||
grub_uint32_t vcn;
|
grub_disk_addr_t vcn;
|
||||||
|
|
||||||
vcn = ofs / (at->mft->data->spc << BLK_SHR);
|
vcn = grub_divmod64 (ofs, at->mft->data->spc << BLK_SHR, 0);
|
||||||
pa = at->attr_nxt + u16at (at->attr_nxt, 4);
|
pa = at->attr_nxt + u16at (at->attr_nxt, 4);
|
||||||
while (pa < at->attr_end)
|
while (pa < at->attr_end)
|
||||||
{
|
{
|
||||||
|
@ -508,7 +511,7 @@ static grub_err_t
|
||||||
read_mft (struct grub_ntfs_data *data, char *buf, grub_uint32_t mftno)
|
read_mft (struct grub_ntfs_data *data, char *buf, grub_uint32_t mftno)
|
||||||
{
|
{
|
||||||
if (read_attr
|
if (read_attr
|
||||||
(&data->mmft.attr, buf, mftno * (data->mft_size << BLK_SHR),
|
(&data->mmft.attr, buf, mftno * ((grub_disk_addr_t) data->mft_size << BLK_SHR),
|
||||||
data->mft_size << BLK_SHR, 0, 0))
|
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");
|
return fixup (data, buf, data->mft_size, "FILE");
|
||||||
|
@ -640,7 +643,8 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
|
||||||
unsigned char *bitmap;
|
unsigned char *bitmap;
|
||||||
struct grub_ntfs_attr attr, *at;
|
struct grub_ntfs_attr attr, *at;
|
||||||
char *cur_pos, *indx, *bmp;
|
char *cur_pos, *indx, *bmp;
|
||||||
int bitmap_len, ret = 0;
|
int ret = 0;
|
||||||
|
grub_size_t bitmap_len;
|
||||||
struct grub_ntfs_file *mft;
|
struct grub_ntfs_file *mft;
|
||||||
|
|
||||||
mft = (struct grub_ntfs_file *) dir;
|
mft = (struct grub_ntfs_file *) dir;
|
||||||
|
@ -744,14 +748,14 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
|
||||||
|
|
||||||
if (bitmap)
|
if (bitmap)
|
||||||
{
|
{
|
||||||
grub_uint32_t v, i;
|
grub_disk_addr_t v, i;
|
||||||
|
|
||||||
indx = grub_malloc (mft->data->idx_size << BLK_SHR);
|
indx = grub_malloc (mft->data->idx_size << BLK_SHR);
|
||||||
if (indx == NULL)
|
if (indx == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
v = 1;
|
v = 1;
|
||||||
for (i = 0; i < (grub_uint32_t) bitmap_len * 8; i++)
|
for (i = 0; i < (grub_disk_addr_t)bitmap_len * 8; i++)
|
||||||
{
|
{
|
||||||
if (*bitmap & v)
|
if (*bitmap & v)
|
||||||
{
|
{
|
||||||
|
|
|
@ -209,7 +209,7 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, int num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nn = (16 - (ctx->target_vcn & 0xF)) / cpb;
|
nn = (16 - (unsigned) (ctx->target_vcn & 0xF)) / cpb;
|
||||||
if (nn > num)
|
if (nn > num)
|
||||||
nn = num;
|
nn = num;
|
||||||
num -= nn;
|
num -= nn;
|
||||||
|
|
3
gendistlist.sh
Normal file → Executable file
3
gendistlist.sh
Normal file → Executable file
|
@ -19,6 +19,7 @@ EXTRA_DISTFILES="AUTHORS COPYING ChangeLog DISTLIST INSTALL NEWS README \
|
||||||
gendistlist.sh genfslist.sh genhandlerlist.sh geninit.sh \
|
gendistlist.sh genfslist.sh genhandlerlist.sh geninit.sh \
|
||||||
geninitheader.sh genkernsyms.sh.in genmk.rb genmoddep.awk \
|
geninitheader.sh genkernsyms.sh.in genmk.rb genmoddep.awk \
|
||||||
genmodsrc.sh genpartmaplist.sh genparttoollist.sh \
|
genmodsrc.sh genpartmaplist.sh genparttoollist.sh \
|
||||||
|
genvideolist.sh \
|
||||||
gensymlist.sh.in install-sh mkinstalldirs stamp-h.in"
|
gensymlist.sh.in install-sh mkinstalldirs stamp-h.in"
|
||||||
|
|
||||||
DISTDIRS="boot bus commands conf disk docs efiemu font fs hello hook include io \
|
DISTDIRS="boot bus commands conf disk docs efiemu font fs hello hook include io \
|
||||||
|
@ -35,7 +36,7 @@ dir=`dirname $0`
|
||||||
cd $dir
|
cd $dir
|
||||||
|
|
||||||
for dir in $DISTDIRS; do
|
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' \
|
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 '*.rb' -o -name '*.in' -o -name '*.tex' -o -name '*.texi' \
|
||||||
-o -name '*.info' -o -name 'grub.cfg' -o -name 'README' \
|
-o -name '*.info' -o -name 'grub.cfg' -o -name 'README' \
|
||||||
|
|
10
genmk.rb
10
genmk.rb
|
@ -193,6 +193,7 @@ endif
|
||||||
partmap = 'partmap-' + obj.suffix('lst')
|
partmap = 'partmap-' + obj.suffix('lst')
|
||||||
handler = 'handler-' + obj.suffix('lst')
|
handler = 'handler-' + obj.suffix('lst')
|
||||||
parttool = 'parttool-' + obj.suffix('lst')
|
parttool = 'parttool-' + obj.suffix('lst')
|
||||||
|
video = 'video-' + obj.suffix('lst')
|
||||||
dep = deps[i]
|
dep = deps[i]
|
||||||
flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
|
flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
|
||||||
extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
|
extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
|
||||||
|
@ -203,7 +204,7 @@ endif
|
||||||
-include #{dep}
|
-include #{dep}
|
||||||
|
|
||||||
clean-module-#{extra_target}.#{@rule_count}:
|
clean-module-#{extra_target}.#{@rule_count}:
|
||||||
rm -f #{command} #{fs} #{partmap} #{handler} #{parttool}
|
rm -f #{command} #{fs} #{partmap} #{handler} #{parttool} #{video}
|
||||||
|
|
||||||
CLEAN_MODULE_TARGETS += clean-module-#{extra_target}.#{@rule_count}
|
CLEAN_MODULE_TARGETS += clean-module-#{extra_target}.#{@rule_count}
|
||||||
|
|
||||||
|
@ -212,6 +213,7 @@ FSFILES += #{fs}
|
||||||
PARTTOOLFILES += #{parttool}
|
PARTTOOLFILES += #{parttool}
|
||||||
PARTMAPFILES += #{partmap}
|
PARTMAPFILES += #{partmap}
|
||||||
HANDLERFILES += #{handler}
|
HANDLERFILES += #{handler}
|
||||||
|
VIDEOFILES += #{video}
|
||||||
|
|
||||||
#{command}: #{src} $(#{src}_DEPENDENCIES) gencmdlist.sh
|
#{command}: #{src} $(#{src}_DEPENDENCIES) gencmdlist.sh
|
||||||
set -e; \
|
set -e; \
|
||||||
|
@ -238,6 +240,11 @@ HANDLERFILES += #{handler}
|
||||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||||
| sh $(srcdir)/genhandlerlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
| sh $(srcdir)/genhandlerlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
|
#{video}: #{src} $(#{src}_DEPENDENCIES) genvideolist.sh
|
||||||
|
set -e; \
|
||||||
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||||
|
| sh $(srcdir)/genvideolist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
"
|
"
|
||||||
end.join('')
|
end.join('')
|
||||||
end
|
end
|
||||||
|
@ -357,6 +364,7 @@ class Script
|
||||||
|
|
||||||
#{@name}: #{src} $(#{src}_DEPENDENCIES) config.status
|
#{@name}: #{src} $(#{src}_DEPENDENCIES) config.status
|
||||||
./config.status --file=#{name}:#{src}
|
./config.status --file=#{name}:#{src}
|
||||||
|
sed -i -e 's,@pkglib_DATA@,$(pkglib_DATA),g' $@
|
||||||
chmod +x $@
|
chmod +x $@
|
||||||
|
|
||||||
"
|
"
|
||||||
|
|
26
genvideolist.sh
Normal file
26
genvideolist.sh
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2005,2008,2009 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This script is free software; the author
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
# Read source code from stdin and detect partmap names.
|
||||||
|
|
||||||
|
module=$1
|
||||||
|
|
||||||
|
# Ignore video.mod.
|
||||||
|
if test $module = video; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For now, this emits only a module name, if the module registers a partition map.
|
||||||
|
if grep -v "^#" | grep '^ *grub_video_register' >/dev/null 2>&1; then
|
||||||
|
echo $module
|
||||||
|
fi
|
|
@ -17,6 +17,7 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <grub/list.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
|
@ -41,6 +42,16 @@ static int grub_gettext_max;
|
||||||
|
|
||||||
static const char *(*grub_gettext_original) (const char *s);
|
static const char *(*grub_gettext_original) (const char *s);
|
||||||
|
|
||||||
|
struct grub_gettext_msg
|
||||||
|
{
|
||||||
|
struct grub_gettext_msg *next;
|
||||||
|
const char *name;
|
||||||
|
|
||||||
|
const char *translated;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct grub_gettext_msg *grub_gettext_msg_list = NULL;
|
||||||
|
|
||||||
#define GETTEXT_MAGIC_NUMBER 0
|
#define GETTEXT_MAGIC_NUMBER 0
|
||||||
#define GETTEXT_FILE_FORMAT 4
|
#define GETTEXT_FILE_FORMAT 4
|
||||||
#define GETTEXT_NUMBER_OF_STRINGS 8
|
#define GETTEXT_NUMBER_OF_STRINGS 8
|
||||||
|
@ -79,7 +90,7 @@ grub_gettext_getstring_from_offset (grub_uint32_t offset,
|
||||||
translation[length] = '\0';
|
translation[length] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static const char *
|
||||||
grub_gettext_gettranslation_from_position (int position)
|
grub_gettext_gettranslation_from_position (int position)
|
||||||
{
|
{
|
||||||
int offsettranslation;
|
int offsettranslation;
|
||||||
|
@ -130,9 +141,18 @@ static const char *
|
||||||
grub_gettext_translate (const char *orig)
|
grub_gettext_translate (const char *orig)
|
||||||
{
|
{
|
||||||
char *current_string;
|
char *current_string;
|
||||||
char *ret;
|
const char *ret;
|
||||||
|
|
||||||
int min, max, current;
|
int min, max, current;
|
||||||
|
int found = 0;
|
||||||
|
|
||||||
|
struct grub_gettext_msg *cur;
|
||||||
|
|
||||||
|
cur = grub_named_list_find (GRUB_AS_NAMED_LIST (grub_gettext_msg_list),
|
||||||
|
orig);
|
||||||
|
|
||||||
|
if (cur)
|
||||||
|
return cur->translated;
|
||||||
|
|
||||||
if (fd_mo == 0)
|
if (fd_mo == 0)
|
||||||
return orig;
|
return orig;
|
||||||
|
@ -142,7 +162,7 @@ grub_gettext_translate (const char *orig)
|
||||||
|
|
||||||
current = (max + min) / 2;
|
current = (max + min) / 2;
|
||||||
|
|
||||||
while (current != min && current != max)
|
while (current != min && current != max && found == 0)
|
||||||
{
|
{
|
||||||
current_string = grub_gettext_getstring_from_position (current);
|
current_string = grub_gettext_getstring_from_position (current);
|
||||||
|
|
||||||
|
@ -160,13 +180,31 @@ grub_gettext_translate (const char *orig)
|
||||||
else if (grub_strcmp (current_string, orig) == 0)
|
else if (grub_strcmp (current_string, orig) == 0)
|
||||||
{
|
{
|
||||||
grub_free (current_string);
|
grub_free (current_string);
|
||||||
return grub_gettext_gettranslation_from_position (current);
|
found = 1;
|
||||||
}
|
}
|
||||||
current = (max + min) / 2;
|
current = (max + min) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = grub_malloc (grub_strlen (orig) + 1);
|
ret = found ? grub_gettext_gettranslation_from_position (current) : orig;
|
||||||
grub_strcpy (ret, orig);
|
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
cur = grub_zalloc (sizeof (*cur));
|
||||||
|
|
||||||
|
if (cur)
|
||||||
|
{
|
||||||
|
cur->name = grub_strdup (orig);
|
||||||
|
if (cur->name)
|
||||||
|
{
|
||||||
|
cur->translated = ret;
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_gettext_msg_list),
|
||||||
|
GRUB_AS_LIST (cur));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +260,7 @@ grub_gettext_init_ext (const char *lang)
|
||||||
locale_dir = grub_env_get ("locale_dir");
|
locale_dir = grub_env_get ("locale_dir");
|
||||||
if (locale_dir == NULL)
|
if (locale_dir == NULL)
|
||||||
{
|
{
|
||||||
grub_printf ("locale_dir variable is not set up.");
|
grub_dprintf ("gettext", "locale_dir variable is not set up.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,12 +297,29 @@ grub_gettext_init_ext (const char *lang)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
grub_gettext_delete_list ()
|
||||||
|
{
|
||||||
|
struct grub_gettext_msg *item;
|
||||||
|
|
||||||
|
while ((item =
|
||||||
|
grub_list_pop (GRUB_AS_LIST_P (&grub_gettext_msg_list))) != 0)
|
||||||
|
{
|
||||||
|
char *original = (char *) ((struct grub_gettext_msg *) item)->name;
|
||||||
|
grub_free (original);
|
||||||
|
|
||||||
|
// Don't delete the translated message because could be in use.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
grub_gettext_env_write_lang (struct grub_env_var *var
|
grub_gettext_env_write_lang (struct grub_env_var *var
|
||||||
__attribute__ ((unused)), const char *val)
|
__attribute__ ((unused)), const char *val)
|
||||||
{
|
{
|
||||||
grub_gettext_init_ext (val);
|
grub_gettext_init_ext (val);
|
||||||
|
|
||||||
|
grub_gettext_delete_list ();
|
||||||
|
|
||||||
return grub_strdup (val);
|
return grub_strdup (val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,5 +362,7 @@ GRUB_MOD_FINI (gettext)
|
||||||
if (fd_mo != 0)
|
if (fd_mo != 0)
|
||||||
grub_file_close (fd_mo);
|
grub_file_close (fd_mo);
|
||||||
|
|
||||||
|
grub_gettext_delete_list ();
|
||||||
|
|
||||||
grub_gettext = grub_gettext_original;
|
grub_gettext = grub_gettext_original;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,11 @@
|
||||||
#define GRUB_AUTH_HEADER 1
|
#define GRUB_AUTH_HEADER 1
|
||||||
|
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
/* Macros for indistinguishibility. */
|
/* Macros for indistinguishibility. */
|
||||||
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
|
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
|
||||||
#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get ("Enter password: ", \
|
#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get (N_("Enter password:"), \
|
||||||
string, len, \
|
string, len, \
|
||||||
'*', 0, 0)
|
'*', 0, 0)
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,10 @@
|
||||||
# include <grub/efi/efi.h>
|
# include <grub/efi/efi.h>
|
||||||
# define grub_autoefi_get_memory_map grub_efi_get_memory_map
|
# 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_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_system_table grub_efi_system_table
|
||||||
# define grub_autoefi_mmap_iterate grub_machine_mmap_iterate
|
# 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)
|
static inline grub_err_t grub_autoefi_prepare (void)
|
||||||
{
|
{
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
|
@ -53,9 +55,11 @@ static inline grub_err_t grub_autoefi_prepare (void)
|
||||||
# include <grub/efiemu/efiemu.h>
|
# include <grub/efiemu/efiemu.h>
|
||||||
# define grub_autoefi_get_memory_map grub_efiemu_get_memory_map
|
# 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_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_system_table grub_efiemu_system_table
|
||||||
# define grub_autoefi_mmap_iterate grub_efiemu_mmap_iterate
|
# define grub_autoefi_mmap_iterate grub_efiemu_mmap_iterate
|
||||||
# define grub_autoefi_prepare grub_efiemu_prepare
|
# 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_AVAILABLE GRUB_EFIEMU_MEMORY_AVAILABLE
|
||||||
# define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_EFIEMU_MEMORY_RESERVED
|
# define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_EFIEMU_MEMORY_RESERVED
|
||||||
# define GRUB_AUTOEFI_MEMORY_ACPI GRUB_EFIEMU_MEMORY_ACPI
|
# define GRUB_AUTOEFI_MEMORY_ACPI GRUB_EFIEMU_MEMORY_ACPI
|
||||||
|
|
112
include/grub/charset.h
Normal file
112
include/grub/charset.h
Normal 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
|
|
@ -21,6 +21,7 @@
|
||||||
#define GRUB_EFI_API_HEADER 1
|
#define GRUB_EFI_API_HEADER 1
|
||||||
|
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
#include <grub/symbol.h>
|
||||||
|
|
||||||
/* For consistency and safety, we name the EFI-defined types differently.
|
/* For consistency and safety, we name the EFI-defined types differently.
|
||||||
All names are transformed into lower case, _t appended, and
|
All names are transformed into lower case, _t appended, and
|
||||||
|
|
|
@ -54,9 +54,11 @@ char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
|
||||||
grub_efi_device_path_t *
|
grub_efi_device_path_t *
|
||||||
EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
|
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_exit_boot_services) (grub_efi_uintn_t map_key);
|
||||||
void EXPORT_FUNC (grub_reboot) (void);
|
|
||||||
void EXPORT_FUNC (grub_halt) (void);
|
|
||||||
int EXPORT_FUNC (grub_efi_finish_boot_services) (void);
|
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_init (void);
|
||||||
void grub_efi_mm_fini (void);
|
void grub_efi_mm_fini (void);
|
||||||
|
|
|
@ -268,9 +268,19 @@ void grub_efiemu_free_syms (void);
|
||||||
grub_err_t grub_efiemu_write_value (void * addr, grub_uint32_t value,
|
grub_err_t grub_efiemu_write_value (void * addr, grub_uint32_t value,
|
||||||
int plus_handle,
|
int plus_handle,
|
||||||
int minus_handle, int ptv_needed, int size);
|
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_pnvram (void);
|
||||||
grub_err_t grub_efiemu_prepare (void);
|
grub_err_t grub_efiemu_prepare (void);
|
||||||
char *grub_efiemu_get_default_core_name (void);
|
char *grub_efiemu_get_default_core_name (void);
|
||||||
void grub_efiemu_pnvram_cmd_unregister (void);
|
void grub_efiemu_pnvram_cmd_unregister (void);
|
||||||
grub_err_t grub_efiemu_autocore (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 */
|
#endif /* ! GRUB_EFI_EMU_HEADER */
|
||||||
|
|
|
@ -48,7 +48,8 @@ struct grub_hfs_sblock
|
||||||
/* A pascal style string that holds the volumename. */
|
/* A pascal style string that holds the volumename. */
|
||||||
grub_uint8_t volname[28];
|
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;
|
grub_uint16_t embed_sig;
|
||||||
struct grub_hfs_extent embed_extent;
|
struct grub_hfs_extent embed_extent;
|
||||||
grub_uint8_t unused6[4];
|
grub_uint8_t unused6[4];
|
||||||
|
|
|
@ -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_HOST32(x) ((x)==0x00000007)
|
||||||
#define GRUB_MACHO_CPUTYPE_IS_HOST64(x) ((x)==0x01000007)
|
#define GRUB_MACHO_CPUTYPE_IS_HOST64(x) ((x)==0x01000007)
|
||||||
|
|
||||||
|
@ -9,3 +32,15 @@ struct grub_macho_thread32
|
||||||
grub_uint32_t entry_point;
|
grub_uint32_t entry_point;
|
||||||
grub_uint8_t unknown2[20];
|
grub_uint8_t unknown2[20];
|
||||||
} __attribute__ ((packed));
|
} __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
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
/* memory.h - describe the memory map */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
* Copyright (C) 2002,2007,2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,17 +17,14 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/cpu/io.h>
|
#ifndef GRUB_MEMORY_CPU_HEADER
|
||||||
#include <grub/cpu/at_keyboard.h>
|
#define GRUB_MEMORY_CPU_HEADER 1
|
||||||
#include <grub/cpu/reboot.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
|
|
||||||
void
|
/* The flag for protected mode. */
|
||||||
grub_reboot (void)
|
#define GRUB_MEMORY_CPU_CR0_PE_ON 0x1
|
||||||
{
|
#define GRUB_MEMORY_CPU_CR4_PAE_ON 0x00000040
|
||||||
/* Use the keyboard controller to reboot. That's what keyboards were
|
#define GRUB_MEMORY_CPU_CR0_PAGING_ON 0x80000000
|
||||||
designed for, isn't it? */
|
#define GRUB_MEMORY_CPU_AMD64_MSR 0xc0000080
|
||||||
grub_outb (KEYBOARD_COMMAND_REBOOT, KEYBOARD_REG_STATUS);
|
#define GRUB_MEMORY_CPU_AMD64_MSR_ON 0x00000100
|
||||||
|
|
||||||
grub_printf ("GRUB doesn't know how to reboot this machine yet!\n");
|
#endif /* ! GRUB_MEMORY_CPU_HEADER */
|
||||||
}
|
|
|
@ -27,16 +27,9 @@ void grub_multiboot2_real_boot (grub_addr_t entry,
|
||||||
struct multiboot_info *mbi)
|
struct multiboot_info *mbi)
|
||||||
__attribute__ ((noreturn));
|
__attribute__ ((noreturn));
|
||||||
|
|
||||||
extern grub_addr_t grub_multiboot_payload_orig;
|
extern grub_uint32_t grub_multiboot_payload_eip;
|
||||||
|
extern char *grub_multiboot_payload_orig;
|
||||||
extern grub_addr_t grub_multiboot_payload_dest;
|
extern grub_addr_t grub_multiboot_payload_dest;
|
||||||
extern grub_size_t grub_multiboot_payload_size;
|
extern grub_size_t grub_multiboot_payload_size;
|
||||||
extern grub_uint32_t grub_multiboot_payload_entry_offset;
|
|
||||||
|
|
||||||
extern grub_uint8_t grub_multiboot_forward_relocator;
|
|
||||||
extern grub_uint8_t grub_multiboot_forward_relocator_end;
|
|
||||||
extern grub_uint8_t grub_multiboot_backward_relocator;
|
|
||||||
extern grub_uint8_t grub_multiboot_backward_relocator_end;
|
|
||||||
|
|
||||||
#define RELOCATOR_SIZEOF(x) (&grub_multiboot_##x##_relocator_end - &grub_multiboot_##x##_relocator)
|
|
||||||
|
|
||||||
#endif /* ! GRUB_MULTIBOOT_CPU_HEADER */
|
#endif /* ! GRUB_MULTIBOOT_CPU_HEADER */
|
||||||
|
|
|
@ -39,13 +39,6 @@ grub_uint32_t EXPORT_FUNC(grub_get_mmap_entry) (struct grub_machine_mmap_entry *
|
||||||
/* Turn on/off Gate A20. */
|
/* Turn on/off Gate A20. */
|
||||||
void grub_gate_a20 (int on);
|
void grub_gate_a20 (int on);
|
||||||
|
|
||||||
/* Reboot the machine. */
|
|
||||||
void EXPORT_FUNC (grub_reboot) (void);
|
|
||||||
|
|
||||||
/* Halt the system, using APM if possible. If NO_APM is true, don't
|
|
||||||
* use APM even if it is available. */
|
|
||||||
void EXPORT_FUNC (grub_halt) (int no_apm);
|
|
||||||
|
|
||||||
void EXPORT_FUNC(grub_stop_floppy) (void);
|
void EXPORT_FUNC(grub_stop_floppy) (void);
|
||||||
|
|
||||||
#endif /* ! GRUB_INIT_MACHINE_HEADER */
|
#endif /* ! GRUB_INIT_MACHINE_HEADER */
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <grub/memory.h>
|
#include <grub/memory.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <grub/i386/memory.h>
|
||||||
|
|
||||||
/* The scratch buffer used in real mode code. */
|
/* The scratch buffer used in real mode code. */
|
||||||
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
|
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
|
||||||
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
|
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
|
||||||
|
@ -62,9 +64,6 @@
|
||||||
/* The address where another boot loader is loaded. */
|
/* The address where another boot loader is loaded. */
|
||||||
#define GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR 0x7c00
|
#define GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR 0x7c00
|
||||||
|
|
||||||
/* The flag for protected mode. */
|
|
||||||
#define GRUB_MEMORY_MACHINE_CR0_PE_ON 0x1
|
|
||||||
|
|
||||||
/* The code segment of the protected mode. */
|
/* The code segment of the protected mode. */
|
||||||
#define GRUB_MEMORY_MACHINE_PROT_MODE_CSEG 0x8
|
#define GRUB_MEMORY_MACHINE_PROT_MODE_CSEG 0x8
|
||||||
|
|
||||||
|
|
|
@ -67,4 +67,20 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
|
||||||
grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
|
grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void *
|
||||||
|
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||||
|
grub_addr_t base,
|
||||||
|
grub_size_t size __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
return (void *) base;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||||
|
void *mem __attribute__ ((unused)),
|
||||||
|
grub_size_t size __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* GRUB_CPU_PCI_H */
|
#endif /* GRUB_CPU_PCI_H */
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern void grub_reboot (void);
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,4 +16,26 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern void grub_halt (void);
|
#ifndef GRUB_RELOCATOR_CPU_HEADER
|
||||||
|
#define GRUB_RELOCATOR_CPU_HEADER 1
|
||||||
|
|
||||||
|
#include <grub/types.h>
|
||||||
|
#include <grub/err.h>
|
||||||
|
|
||||||
|
struct grub_relocator32_state
|
||||||
|
{
|
||||||
|
grub_uint32_t esp;
|
||||||
|
grub_uint32_t eax;
|
||||||
|
grub_uint32_t ebx;
|
||||||
|
grub_uint32_t ecx;
|
||||||
|
grub_uint32_t edx;
|
||||||
|
grub_uint32_t eip;
|
||||||
|
};
|
||||||
|
|
||||||
|
void *grub_relocator32_alloc (grub_size_t size);
|
||||||
|
grub_err_t grub_relocator32_boot (void *relocator, grub_uint32_t dest,
|
||||||
|
struct grub_relocator32_state state);
|
||||||
|
void *grub_relocator32_realloc (void *relocator, grub_size_t size);
|
||||||
|
void grub_relocator32_free (void *relocator);
|
||||||
|
|
||||||
|
#endif /* ! GRUB_RELOCATOR_CPU_HEADER */
|
|
@ -20,6 +20,10 @@
|
||||||
#define GRUB_CPU_XNU_H 1
|
#define GRUB_CPU_XNU_H 1
|
||||||
|
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
|
#include <grub/efi/api.h>
|
||||||
|
#include <grub/cpu/relocator.h>
|
||||||
|
|
||||||
|
#define XNU_RELOCATOR(x) (grub_relocator32_ ## x)
|
||||||
|
|
||||||
#define GRUB_XNU_PAGESIZE 4096
|
#define GRUB_XNU_PAGESIZE 4096
|
||||||
typedef grub_uint32_t grub_xnu_ptr_t;
|
typedef grub_uint32_t grub_xnu_ptr_t;
|
||||||
|
@ -64,17 +68,54 @@ struct grub_xnu_boot_params
|
||||||
/* Size of grub_efi_uintn_t in bits. */
|
/* Size of grub_efi_uintn_t in bits. */
|
||||||
grub_uint8_t efi_uintnbits;
|
grub_uint8_t efi_uintnbits;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
#define GRUB_XNU_BOOTARGS_VERMINOR 4
|
#define GRUB_XNU_BOOTARGS_VERMINOR 5
|
||||||
#define GRUB_XNU_BOOTARGS_VERMAJOR 1
|
#define GRUB_XNU_BOOTARGS_VERMAJOR 1
|
||||||
|
|
||||||
|
struct grub_xnu_devprop_header
|
||||||
|
{
|
||||||
|
grub_uint32_t length;
|
||||||
|
/* Always set to 1. Version? */
|
||||||
|
grub_uint32_t alwaysone;
|
||||||
|
grub_uint32_t num_devices;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct grub_xnu_devprop_device_header
|
||||||
|
{
|
||||||
|
grub_uint32_t length;
|
||||||
|
grub_uint32_t num_values;
|
||||||
|
};
|
||||||
|
|
||||||
|
void grub_cpu_xnu_unload (void);
|
||||||
|
|
||||||
|
struct grub_xnu_devprop_device_descriptor;
|
||||||
|
|
||||||
|
struct grub_xnu_devprop_device_descriptor *
|
||||||
|
grub_xnu_devprop_add_device (struct grub_efi_device_path *path, int length);
|
||||||
|
grub_err_t
|
||||||
|
grub_xnu_devprop_remove_device (struct grub_xnu_devprop_device_descriptor *dev);
|
||||||
|
grub_err_t
|
||||||
|
grub_xnu_devprop_remove_property (struct grub_xnu_devprop_device_descriptor *dev,
|
||||||
|
char *name);
|
||||||
|
grub_err_t
|
||||||
|
grub_xnu_devprop_add_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
|
||||||
|
char *name, void *data, int datalen);
|
||||||
|
grub_err_t
|
||||||
|
grub_xnu_devprop_add_property_utf16 (struct grub_xnu_devprop_device_descriptor *dev,
|
||||||
|
grub_uint16_t *name, int namelen,
|
||||||
|
void *data, int datalen);
|
||||||
|
grub_err_t
|
||||||
|
grub_xnu_devprop_remove_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
|
||||||
|
char *name);
|
||||||
|
void grub_cpu_xnu_init (void);
|
||||||
|
void grub_cpu_xnu_fini (void);
|
||||||
|
|
||||||
extern grub_uint32_t grub_xnu_entry_point;
|
extern grub_uint32_t grub_xnu_entry_point;
|
||||||
extern grub_uint32_t grub_xnu_stack;
|
extern grub_uint32_t grub_xnu_stack;
|
||||||
extern grub_uint32_t grub_xnu_arg1;
|
extern grub_uint32_t grub_xnu_arg1;
|
||||||
extern char grub_xnu_cmdline[1024];
|
extern char grub_xnu_cmdline[1024];
|
||||||
grub_err_t grub_xnu_boot (void);
|
grub_err_t grub_xnu_boot (void);
|
||||||
grub_err_t grub_cpu_xnu_fill_devicetree (void);
|
|
||||||
grub_err_t grub_xnu_set_video (struct grub_xnu_boot_params *bootparams_relloc);
|
grub_err_t grub_xnu_set_video (struct grub_xnu_boot_params *bootparams_relloc);
|
||||||
|
grub_err_t
|
||||||
|
grub_cpu_xnu_fill_devicetree (void);
|
||||||
extern grub_uint32_t grub_xnu_heap_will_be_at;
|
extern grub_uint32_t grub_xnu_heap_will_be_at;
|
||||||
extern grub_uint8_t grub_xnu_launcher_start[];
|
|
||||||
extern grub_uint8_t grub_xnu_launcher_end[];
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -102,6 +102,23 @@ struct grub_macho_segment32
|
||||||
grub_uint32_t flags;
|
grub_uint32_t flags;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* 64-bit segment command. */
|
||||||
|
struct grub_macho_segment64
|
||||||
|
{
|
||||||
|
#define GRUB_MACHO_CMD_SEGMENT64 0x19
|
||||||
|
grub_uint32_t cmd;
|
||||||
|
grub_uint32_t cmdsize;
|
||||||
|
grub_uint8_t segname[16];
|
||||||
|
grub_uint64_t vmaddr;
|
||||||
|
grub_uint64_t vmsize;
|
||||||
|
grub_uint64_t fileoff;
|
||||||
|
grub_uint64_t filesize;
|
||||||
|
grub_macho_vmprot_t maxprot;
|
||||||
|
grub_macho_vmprot_t initprot;
|
||||||
|
grub_uint32_t nsects;
|
||||||
|
grub_uint32_t flags;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#define GRUB_MACHO_CMD_THREAD 5
|
#define GRUB_MACHO_CMD_THREAD 5
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,17 +46,28 @@ grub_macho_t grub_macho_file (grub_file_t);
|
||||||
grub_err_t grub_macho_close (grub_macho_t);
|
grub_err_t grub_macho_close (grub_macho_t);
|
||||||
|
|
||||||
int grub_macho_contains_macho32 (grub_macho_t);
|
int grub_macho_contains_macho32 (grub_macho_t);
|
||||||
grub_err_t grub_macho32_size (grub_macho_t macho, grub_addr_t *segments_start,
|
grub_err_t grub_macho_size32 (grub_macho_t macho, grub_uint32_t *segments_start,
|
||||||
grub_addr_t *segments_end, int flags);
|
grub_uint32_t *segments_end, int flags);
|
||||||
grub_uint32_t grub_macho32_get_entry_point (grub_macho_t macho);
|
grub_uint32_t grub_macho_get_entry_point32 (grub_macho_t macho);
|
||||||
|
|
||||||
|
int grub_macho_contains_macho64 (grub_macho_t);
|
||||||
|
grub_err_t grub_macho_size64 (grub_macho_t macho, grub_uint64_t *segments_start,
|
||||||
|
grub_uint64_t *segments_end, int flags);
|
||||||
|
grub_uint64_t grub_macho_get_entry_point64 (grub_macho_t macho);
|
||||||
|
|
||||||
/* Ignore BSS segments when loading. */
|
/* Ignore BSS segments when loading. */
|
||||||
#define GRUB_MACHO_NOBSS 0x1
|
#define GRUB_MACHO_NOBSS 0x1
|
||||||
grub_err_t grub_macho32_load (grub_macho_t macho, char *offset, int flags);
|
grub_err_t grub_macho_load32 (grub_macho_t macho, char *offset, int flags);
|
||||||
|
grub_err_t grub_macho_load64 (grub_macho_t macho, char *offset, int flags);
|
||||||
|
|
||||||
/* Like filesize and file_read but take only 32-bit part
|
/* Like filesize and file_read but take only 32-bit part
|
||||||
for current architecture. */
|
for current architecture. */
|
||||||
grub_size_t grub_macho32_filesize (grub_macho_t macho);
|
grub_size_t grub_macho_filesize32 (grub_macho_t macho);
|
||||||
grub_err_t grub_macho32_readfile (grub_macho_t macho, void *dest);
|
grub_err_t grub_macho_readfile32 (grub_macho_t macho, void *dest);
|
||||||
|
grub_size_t grub_macho_filesize64 (grub_macho_t macho);
|
||||||
|
grub_err_t grub_macho_readfile64 (grub_macho_t macho, void *dest);
|
||||||
|
|
||||||
|
void grub_macho_parse32 (grub_macho_t macho);
|
||||||
|
void grub_macho_parse64 (grub_macho_t macho);
|
||||||
|
|
||||||
#endif /* ! GRUB_MACHOLOAD_HEADER */
|
#endif /* ! GRUB_MACHOLOAD_HEADER */
|
||||||
|
|
|
@ -220,6 +220,9 @@ char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n);
|
||||||
void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
|
void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
|
||||||
grub_size_t EXPORT_FUNC(grub_strlen) (const char *s);
|
grub_size_t EXPORT_FUNC(grub_strlen) (const char *s);
|
||||||
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
int EXPORT_FUNC(grub_puts) (const char *s);
|
||||||
|
int EXPORT_FUNC(grub_puts_) (const char *s);
|
||||||
void EXPORT_FUNC(grub_real_dprintf) (const char *file,
|
void EXPORT_FUNC(grub_real_dprintf) (const char *file,
|
||||||
const int line,
|
const int line,
|
||||||
const char *condition,
|
const char *condition,
|
||||||
|
@ -229,9 +232,6 @@ int EXPORT_FUNC(grub_sprintf) (char *str, const char *fmt, ...) __attribute__ ((
|
||||||
int EXPORT_FUNC(grub_vsprintf) (char *str, const char *fmt, va_list args);
|
int EXPORT_FUNC(grub_vsprintf) (char *str, const char *fmt, va_list args);
|
||||||
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
|
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
|
||||||
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
|
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
|
||||||
grub_uint8_t *EXPORT_FUNC(grub_utf16_to_utf8) (grub_uint8_t *dest,
|
|
||||||
grub_uint16_t *src,
|
|
||||||
grub_size_t size);
|
|
||||||
grub_ssize_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,
|
grub_ssize_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,
|
||||||
grub_size_t destsize,
|
grub_size_t destsize,
|
||||||
const grub_uint8_t *src,
|
const grub_uint8_t *src,
|
||||||
|
@ -271,4 +271,15 @@ grub_div_roundup (unsigned int x, unsigned int y)
|
||||||
return (x + y - 1) / y;
|
return (x + y - 1) / y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Reboot the machine. */
|
||||||
|
void EXPORT_FUNC (grub_reboot) (void);
|
||||||
|
|
||||||
|
#ifdef GRUB_MACHINE_PCBIOS
|
||||||
|
/* Halt the system, using APM if possible. If NO_APM is true, don't
|
||||||
|
* use APM even if it is available. */
|
||||||
|
void EXPORT_FUNC (grub_halt) (int no_apm);
|
||||||
|
#else
|
||||||
|
void EXPORT_FUNC (grub_halt) (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* ! GRUB_MISC_HEADER */
|
#endif /* ! GRUB_MISC_HEADER */
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
/* The maximum size of a command-line. */
|
/* The maximum size of a command-line. */
|
||||||
#define GRUB_MAX_CMDLINE 1600
|
#define GRUB_MAX_CMDLINE 1600
|
||||||
|
|
||||||
|
/* The standard left and right margin for some messages. */
|
||||||
|
#define STANDARD_MARGIN 6
|
||||||
|
|
||||||
/* The type of a completion item. */
|
/* The type of a completion item. */
|
||||||
enum grub_completion_type
|
enum grub_completion_type
|
||||||
{
|
{
|
||||||
|
@ -73,6 +76,14 @@ void grub_parse_color_name_pair (grub_uint8_t *ret, const char *name);
|
||||||
|
|
||||||
/* Defined in `menu_text.c'. */
|
/* Defined in `menu_text.c'. */
|
||||||
void grub_wait_after_message (void);
|
void grub_wait_after_message (void);
|
||||||
|
int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
|
||||||
|
grub_uint32_t **last_position);
|
||||||
|
void grub_print_ucs4 (const grub_uint32_t * str,
|
||||||
|
const grub_uint32_t * last_position);
|
||||||
|
grub_ssize_t grub_getstringwidth (grub_uint32_t * str,
|
||||||
|
const grub_uint32_t * last_position);
|
||||||
|
void grub_print_message_indented (const char *msg, int margin_left,
|
||||||
|
int margin_right);
|
||||||
|
|
||||||
/* Defined in `handler.c'. */
|
/* Defined in `handler.c'. */
|
||||||
void read_handler_list (void);
|
void read_handler_list (void);
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
#define MAX_IDX (16384 >> BLK_SHR)
|
#define MAX_IDX (16384 >> BLK_SHR)
|
||||||
|
|
||||||
#define COM_LEN 4096
|
#define COM_LEN 4096
|
||||||
|
#define COM_LOG_LEN 12
|
||||||
#define COM_SEC (COM_LEN >> BLK_SHR)
|
#define COM_SEC (COM_LEN >> BLK_SHR)
|
||||||
|
|
||||||
#define AF_ALST 1
|
#define AF_ALST 1
|
||||||
|
@ -164,7 +165,7 @@ struct grub_ntfs_comp
|
||||||
struct grub_ntfs_rlst
|
struct grub_ntfs_rlst
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
grub_uint32_t target_vcn, curr_vcn, next_vcn, curr_lcn;
|
grub_disk_addr_t target_vcn, curr_vcn, next_vcn, curr_lcn;
|
||||||
char *cur_run;
|
char *cur_run;
|
||||||
struct grub_ntfs_attr *attr;
|
struct grub_ntfs_attr *attr;
|
||||||
struct grub_ntfs_comp comp;
|
struct grub_ntfs_comp comp;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* 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
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -36,15 +36,44 @@
|
||||||
#define GRUB_PCI_ADDR_IO_MASK ~0x03
|
#define GRUB_PCI_ADDR_IO_MASK ~0x03
|
||||||
|
|
||||||
typedef grub_uint32_t grub_pci_id_t;
|
typedef grub_uint32_t grub_pci_id_t;
|
||||||
typedef int NESTED_FUNC_ATTR (*grub_pci_iteratefunc_t)
|
|
||||||
(int bus, int device, int func, grub_pci_id_t pciid);
|
|
||||||
typedef grub_uint32_t grub_pci_address_t;
|
|
||||||
|
|
||||||
grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (int bus, int device,
|
#ifdef GRUB_UTIL
|
||||||
int function, int reg);
|
#include <grub/pciutils.h>
|
||||||
|
#else
|
||||||
|
typedef grub_uint32_t grub_pci_address_t;
|
||||||
|
struct grub_pci_device
|
||||||
|
{
|
||||||
|
int bus;
|
||||||
|
int device;
|
||||||
|
int function;
|
||||||
|
};
|
||||||
|
typedef struct grub_pci_device grub_pci_device_t;
|
||||||
|
static inline int
|
||||||
|
grub_pci_get_bus (grub_pci_device_t dev)
|
||||||
|
{
|
||||||
|
return dev.bus;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
grub_pci_get_device (grub_pci_device_t dev)
|
||||||
|
{
|
||||||
|
return dev.device;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
grub_pci_get_function (grub_pci_device_t dev)
|
||||||
|
{
|
||||||
|
return dev.function;
|
||||||
|
}
|
||||||
|
#include <grub/cpu/pci.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef int NESTED_FUNC_ATTR (*grub_pci_iteratefunc_t)
|
||||||
|
(grub_pci_device_t dev, grub_pci_id_t pciid);
|
||||||
|
|
||||||
|
grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (grub_pci_device_t dev,
|
||||||
|
int reg);
|
||||||
|
|
||||||
void EXPORT_FUNC(grub_pci_iterate) (grub_pci_iteratefunc_t hook);
|
void EXPORT_FUNC(grub_pci_iterate) (grub_pci_iteratefunc_t hook);
|
||||||
|
|
||||||
#include <grub/cpu/pci.h>
|
|
||||||
|
|
||||||
#endif /* GRUB_PCI_H */
|
#endif /* GRUB_PCI_H */
|
||||||
|
|
103
include/grub/pciutils.h
Normal file
103
include/grub/pciutils.h
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* 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
|
||||||
|
* 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_PCIUTILS_H
|
||||||
|
#define GRUB_PCIUTILS_H 1
|
||||||
|
|
||||||
|
#include <pciaccess.h>
|
||||||
|
|
||||||
|
typedef struct pci_device *grub_pci_device_t;
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
grub_pci_get_bus (grub_pci_device_t dev)
|
||||||
|
{
|
||||||
|
return dev->bus;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
grub_pci_get_device (grub_pci_device_t dev)
|
||||||
|
{
|
||||||
|
return dev->dev;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
grub_pci_get_function (grub_pci_device_t dev)
|
||||||
|
{
|
||||||
|
return dev->func;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct grub_pci_address
|
||||||
|
{
|
||||||
|
grub_pci_device_t dev;
|
||||||
|
int pos;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct grub_pci_address grub_pci_address_t;
|
||||||
|
|
||||||
|
static inline grub_uint32_t
|
||||||
|
grub_pci_read (grub_pci_address_t addr)
|
||||||
|
{
|
||||||
|
grub_uint32_t ret;
|
||||||
|
pci_device_cfg_read_u32 (addr.dev, &ret, addr.pos);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline grub_uint16_t
|
||||||
|
grub_pci_read_word (grub_pci_address_t addr)
|
||||||
|
{
|
||||||
|
grub_uint16_t ret;
|
||||||
|
pci_device_cfg_read_u16 (addr.dev, &ret, addr.pos);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline grub_uint8_t
|
||||||
|
grub_pci_read_byte (grub_pci_address_t addr)
|
||||||
|
{
|
||||||
|
grub_uint8_t ret;
|
||||||
|
pci_device_cfg_read_u8 (addr.dev, &ret, addr.pos);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_pci_write (grub_pci_address_t addr, grub_uint32_t data)
|
||||||
|
{
|
||||||
|
pci_device_cfg_write_u32 (addr.dev, data, addr.pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data)
|
||||||
|
{
|
||||||
|
pci_device_cfg_write_u16 (addr.dev, data, addr.pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
|
||||||
|
{
|
||||||
|
pci_device_cfg_write_u8 (addr.dev, data, addr.pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base,
|
||||||
|
grub_size_t size);
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem,
|
||||||
|
grub_size_t size);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* GRUB_PCIUTILS_H */
|
|
@ -23,9 +23,6 @@
|
||||||
|
|
||||||
#ifndef ASM_FILE
|
#ifndef ASM_FILE
|
||||||
|
|
||||||
void EXPORT_FUNC (grub_reboot) (void);
|
|
||||||
void EXPORT_FUNC (grub_halt) (void);
|
|
||||||
|
|
||||||
/* The prefix which points to the directory where GRUB modules and its
|
/* The prefix which points to the directory where GRUB modules and its
|
||||||
configuration file are located. */
|
configuration file are located. */
|
||||||
extern char grub_prefix[];
|
extern char grub_prefix[];
|
||||||
|
|
|
@ -54,9 +54,6 @@ extern grub_int32_t grub_total_module_size;
|
||||||
configuration file are located. */
|
configuration file are located. */
|
||||||
extern char grub_prefix[];
|
extern char grub_prefix[];
|
||||||
|
|
||||||
void EXPORT_FUNC (grub_reboot) (void);
|
|
||||||
void EXPORT_FUNC (grub_halt) (void);
|
|
||||||
|
|
||||||
#endif /* ! ASM_FILE */
|
#endif /* ! ASM_FILE */
|
||||||
|
|
||||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <grub/cpu/types.h>
|
#include <grub/cpu/types.h>
|
||||||
|
|
||||||
#define UNUSED __attribute__ ((unused))
|
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
# define GRUB_CPU_SIZEOF_VOID_P SIZEOF_VOID_P
|
# define GRUB_CPU_SIZEOF_VOID_P SIZEOF_VOID_P
|
||||||
# define GRUB_CPU_SIZEOF_LONG SIZEOF_LONG
|
# define GRUB_CPU_SIZEOF_LONG SIZEOF_LONG
|
||||||
|
|
|
@ -64,9 +64,6 @@ grub_usb_err_t grub_usb_clear_halt (grub_usb_device_t dev, int endpoint);
|
||||||
grub_usb_err_t grub_usb_set_configuration (grub_usb_device_t dev,
|
grub_usb_err_t grub_usb_set_configuration (grub_usb_device_t dev,
|
||||||
int configuration);
|
int configuration);
|
||||||
|
|
||||||
grub_usb_err_t grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index,
|
|
||||||
int langid, char **string);
|
|
||||||
|
|
||||||
void grub_usb_controller_dev_register (grub_usb_controller_dev_t usb);
|
void grub_usb_controller_dev_register (grub_usb_controller_dev_t usb);
|
||||||
|
|
||||||
void grub_usb_controller_dev_unregister (grub_usb_controller_dev_t usb);
|
void grub_usb_controller_dev_unregister (grub_usb_controller_dev_t usb);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
@ -57,12 +58,20 @@ void grub_util_write_image (const char *img, size_t size, FILE *out);
|
||||||
void grub_util_write_image_at (const void *img, size_t size, off_t offset,
|
void grub_util_write_image_at (const void *img, size_t size, off_t offset,
|
||||||
FILE *out);
|
FILE *out);
|
||||||
|
|
||||||
|
#ifndef HAVE_VASPRINTF
|
||||||
|
|
||||||
|
int vasprintf (char **buf, const char *fmt, va_list ap);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_ASPRINTF
|
#ifndef HAVE_ASPRINTF
|
||||||
|
|
||||||
int asprintf (char **buf, const char *fmt, ...);
|
int asprintf (char **buf, const char *fmt, ...);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char *xasprintf (const char *fmt, ...);
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
|
|
||||||
#define fseeko fseeko64
|
#define fseeko fseeko64
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue