merge mainline into videomask

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-16 17:52:17 +01:00
commit 45da21ff5a
154 changed files with 4592 additions and 6246 deletions

View file

@ -7,12 +7,15 @@ autom4te.cache
build_env.mk
.bzrignore
config.cache
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
conf/*.mk
conf/gcry.rmk
*.d
DISTLIST
docs/*.info
@ -44,10 +47,13 @@ grub_setup_init.h
*.img
include/grub/cpu
include/grub/machine
install-sh
lib/libgcrypt-grub
*.lst
Makefile
*.mod
mod-*.c
missing
*.pf2
po/*.mo
po/grub.pot

833
ChangeLog
View file

@ -1,3 +1,836 @@
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>
Fix GNU/Hurd grub-install crash.
* util/grub-probe.c (probe): Try to access `path' only when it is not
NULL.
2009-11-28 Vladimir Serbinenko <phcoder@gmail.com>
Correct module naming.
* video/efi_uga.c (GRUB_MOD_INIT(efi_fb)): Renamed from this ...
(GRUB_MOD_INIT(efi_uga)): ... to this
(GRUB_MOD_FINI(efi_fb)): Renamed from this ...
(GRUB_MOD_FINI(efi_uga)): ... to this
* video/efi_gop.c (GRUB_MOD_INIT(efi_fb)): Renamed from this ...
(GRUB_MOD_INIT(efi_gop)): ... to this
(GRUB_MOD_FINI(efi_fb)): Renamed from this ...
(GRUB_MOD_FINI(efi_gop)): ... to this
2009-11-28 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/mkisofs.c (ld_options): Mark all `arg' strings as
translatable.
(usage): Translate `arg' strings using gettext().
Thanks to Jordi Mallach for the suggestion.
2009-11-28 Vladimir Serbinenko <phcoder@gmail.com>
GOP support. Based on patch from Bean
(http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00384.html)
* video/efi_gop.c: New file.
* include/grub/efi/graphics_output.h: Likewise.
* conf/i386-efi.rmk (pkglib_MODULES): Add `efi_gop.mod'.
(efi_fb_mod_SOURCES, efi_fb_mod_CFLAGS, efi_fb_mod_LDFLAGS): New
variables.
* conf/x86_64-efi.rmk: Likewise.
2009-11-28 Vladimir Serbinenko <phcoder@gmail.com>
Rename efi_fb to efi_uga.
* conf/i386-efi.rmk (pkglib_MODULES): Rename 'efi_fb.mod' to
'efi_uga.mod'.
(efi_fb_mod_SOURCES): Rename this ...
(efi_uga_mod_SOURCES): ... to this.
(efi_fb_mod_CFLAGS): Rename this ...
(efi_uga_mod_CFLAGS): ... to this.
(efi_fb_mod_LDFLAGS): Rename this ...
(efi_uga_mod_LDFLAGS): ... to this.
* conf/x86_64-efi.rmk (pkglib_MODULES): Rename 'efi_fb.mod' to
'efi_uga.mod'.
(efi_fb_mod_SOURCES): Rename this ...
(efi_uga_mod_SOURCES): ... to this.
(efi_fb_mod_CFLAGS): Rename this ...
(efi_uga_mod_CFLAGS): ... to this.
(efi_fb_mod_LDFLAGS): Rename this ...
(efi_uga_mod_LDFLAGS): ... to this.
* video/efi_fb.c: Move this ...
* video/efi_uga.c: ... to this. Change prefix to 'grub_video_uga_'.
2009-11-27 Robert Millan <rmh.grub@aybabtu.com>
* po/README: New file. Explain our PO file workflow.
2009-11-27 Robert Millan <rmh.grub@aybabtu.com>
* po/ChangeLog: Remove. Move relevant entries back to ...
* ChangeLog: ... here.
* po/ca.po: Remove (now handled by TLP).
* po/id.po: Likewise.
* po/zh_CN.po: Likewise.
* Makefile.in (LINGUAS): Initialize in a way that supports
empty set.
2009-11-27 Robert Millan <rmh.grub@aybabtu.com>
* Makefile.in (LINGUAS): Rewrite by scanning po/ directory instead of
reliing on po/LINGUAS.
($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po)): Rewrite as ...
(po/%.po): ... this.
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
* util/i386/efi/grub-mkimage.c: Include "progname.h".
(main): Use `program_name' instead of nonexistent `progname'.
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
* conf/i386-efi.rmk (grub_mkimage_SOURCES): Add `gnulib/progname.c'.
* conf/x86_64-efi.rmk (grub_mkimage_SOURCES): Likewise.
2009-11-26 Robert Millan <rmh.grub@aybabtu.com>
* conf/i386-coreboot.rmk: Cleanup stale filenames from my previous
commit.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
* conf/any-emu.rmk (grub_emu_SOURCES): Add `gnulib/progname.c'.
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
* conf/any-emu.rmk (grub_mkfont_SOURCES): Add `gnulib/progname.c'.
2009-11-26 Robert Millan <rmh.grub@aybabtu.com>
* conf/common.rmk (sbin_UTILITIES): Add `grub-mkdevicemap'.
(grub_mkdevicemap_SOURCES): New variable.
(grub_probe_SOURCES, grub_fstest_SOURCES, grub_mkfont_SOURCES)
(grub_mkrelpath_SOURCES, grub_editenv_SOURCES)
(grub_pe2elf_SOURCES): Add `gnulib/progname.c'.
* conf/i386-coreboot.rmk (sbin_UTILITIES): Remove `grub-mkdevicemap'.
(grub_mkdevicemap_SOURCES): Remove.
* 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.
* util/elf/grub-mkimage.c: Include `<grub/i18n.h>' and `"progname.h"'.
(usage): Fix strings to use `program_name'.
(main): Initialize gettext.
* util/grub-editenv.c: Likewise.
* util/grub-emu.c: Likewise.
* util/grub-fstest.c: Likewise.
* util/grub-mkdevicemap.c: Likewise.
* util/grub-mkfont.c: Likewise.
* util/grub-mkrelpath.c: Likewise.
* util/grub-pe2elf.c: Likewise.
* util/grub-probe.c: Likewise.
* util/sparc64/ieee1275/grub-mkimage.c: Likewise.
* util/sparc64/ieee1275/grub-ofpathname.c: Likewise.
* util/sparc64/ieee1275/grub-setup.c: Likewise.
* util/misc.c: Include `"progname.h"'.
(progname): Remove variable.
(grub_util_warn, grub_util_info, grub_util_error): Use `program_name'.
2009-11-25 Felix Zielcke <fzielcke@z-51.de>
* util/grub.d/10_linux.in (linux_entry): Quote the arguments to
printf and print a newline after the menuentry header line.
* util/grub.d/10_kfreebsd.in (kfreebsd_entry): Likewise.
2009-11-25 Felix Zielcke <fzielcke@z-51.de>
autoconf >= 2.60 support $(localedir).
* INSTALL: Note that autoconf 2.60 is required.
* configure.ac (AC_PREREQ): Bump to 2.60.
* util/grub.d/10_kfreebsd.in (TEXTDOMAINDIR): Set to lowercased @localedir@.
* util/grub.d/10_linux.in (TEXTDOMAINDIR): Likewise.
2009-11-25 Yves Blusseau <yves.blusseau@zetam.org>
* configure.ac: move the call to AM_GNU_GETTEXT to avoid warnings when
aclocal is run.
2009-11-25 Robert Millan <rmh.grub@aybabtu.com>
* normal/main.c (grub_normal_read_line): Fix off-by-one
buffer overflow.
2009-11-25 Robert Millan <rmh.grub@aybabtu.com>
* normal/main.c (grub_normal_execute): Replace "parser.sh" with
"parser.grub" in grub_command_execute() call.
2009-11-24 Carles Pina i Estany <carles@pina.cat>
* conf/i386-coreboot.rmk (kernel_img_HEADERS): Add i18n.h.
* 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.
* gettext/gettex.c: Include <grub/i18n.h>.
* include/grub/misc.h (grub_gettext_dummy, grub_gettext): Move from
here ...
* include/grub/i18n.h: ... to here
* include/grub/i18n.h: ... to here.
* kern/misc.c: Include <grub/i18n.h>
(grub_gettext_dummy): Move above user.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/Makefile.in (install-local): Convert a `for' into a normal
shell expansion.
2009-11-24 Robert Millan <rmh.grub@aybabtu.com>
* autogen.sh: Add automake call.
* config.guess: Remove.
* config.sub: Likewise.
* install-sh: Likewise.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/Makefile.in (install-local): Fix the use of $lang shell variable.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/Makefile.in (install-local): Convert a make `$(foreach)'
function to a normal shell `for'.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* conf/i386-coreboot.rmk (grub_mkimage_SOURCES): Add `gnulib/progname.c'.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrelpath.c: New file.
* conf/common.rmk (bin_UTILITIES): Add grub-mkrelpath.
(grub_mkrelpath_SOURCES): New variable.
* include/grub/util/misc.h: New function prototype.
* util/misc.c (make_system_path_relative_to_its_root): New function.
* util/grub-mkconfig_lib.in (bindir): New variable.
(grub_mkrelpath): Likewise.
(make_system_path_relative_to_its_root): Use grub-mkrelpath.
* util/probe.c (probe): Make the file path relative to its root.
Change a info message to use the GRUB path. Enable again the
check if we can read the file with GRUB facilities.
* util/i386/pc/grub-setup.c (setup): Make core.img path relative
to its root.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* Makefile.in: Don't include GRUB_CONTRIB makefiles with emu
platform.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/getroot.c (grub_util_get_dev_abstraction): Properly use
strncmp().
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/getroot.c (grub_util_is_dmraid): New function.
(grub_util_get_dev_abstraction): Treat dmraid and multipath
devices as normal ones, not as LVM.
2009-11-23 Carles Pina i Estany <carles@pina.cat>
* conf/common.rmk: Add grub-gettext_lib target and updates
lib_DATA and CLEANFILES. Adds gettext.mod SOURCES, CFLAGS,
LDFLAGS.
* gettext/gettext.c: New file. (Reads mo files).
* include/grub/file.h (grub_file_pread): New prototype.
* include/grub/i18n.h (_): New prototype.
* include/grub/misc.h (grub_gettext_dummy, grub_gettext): New
prototypes.
* kern/misc.c (grub_gettext_dummy): New function.
* normal/menu_text.c: Include <grub/i18n.h>.
* normal/menu_text.c (print_timeout): Gettexttize string.
* normal/menu_text.c (print_message): Gettexttize string.
* po/POTFILES: Add `normal/menu_text.c'.
* po/ca.po: Add new translations.
* util/grub.d/00_header.in: Define locale_dir and lang. insmod
gettext module and defines locale_dir and lang in grub.cfg.
* NEWS: Add gettext support.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* util/hostdisk.c: Include `<grub/i18n.h>'.
(find_grub_drive): Use ARRAY_SIZE for map size calculation.
(make_device_name): Rewrite using asprintf.
(convert_system_partition_to_system_disk): Replace 0 with NULL.
(find_system_device): If a device is not found, generate one just
by reusing the OS path name.
(read_device_map): Make it permissible for device.map not to exist.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* script/sh/execute.c: Move from here ...
* script/execute.c: ... to here. Update all users.
* script/sh/function.c: Move from here ...
* script/function.c: ... to here. Update all users.
* script/sh/lexer.c: Move from here ...
* script/lexer.c: ... to here. Update all users.
* script/sh/main.c: Move from here ...
* script/main.c: ... to here. Update all users.
* script/sh/parser.y: Move from here ...
* script/parser.y: ... to here. Update all users.
* script/sh/script.c: Move from here ...
* script/script.c: ... to here. Update all users.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* configure.ac: Detect all `emu' platforms. Define
GRUB_MACHINE_* macros in TARGET_CFLAGS. Remove
--enable-grub-emu logic. Disable include/grub/machine
symlink on `emu' platforms.
* genkernsyms.sh.in: Use @TARGET_CFLAGS@ during symbol generation.
* gensymlist.sh.in: Likewise.
* include/grub/i386/coreboot/machine.h: Remove file.
* include/grub/i386/efi/machine.h: Likewise.
* include/grub/i386/ieee1275/machine.h: Likewise.
* include/grub/i386/pc/machine.h: Likewise.
* include/grub/i386/qemu/machine.h: Likewise.
* include/grub/powerpc/ieee1275/machine.h: Likewise.
* include/grub/sparc64/ieee1275/machine.h: Likewise.
* include/grub/x86_64/efi/machine.h: Likewise.
* commands/acpi.c: Remove `<grub/machine/machine.h>'.
* commands/halt.c: Likewise.
* commands/reboot.c: Likewise.
* include/grub/autoefi.h: Likewise.
* include/grub/i386/at_keyboard.h: Likewise.
* include/grub/i386/kernel.h: Likewise.
* include/grub/i386/loader.h: Likewise.
* include/grub/i386/pc/memory.h: Likewise.
* kern/dl.c: Likewise.
* kern/i386/coreboot/init.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/usb_keyboard.c: Likewise.
* include/grub/time.h [!GRUB_MACHINE_EMU]: Remove
`<grub/machine/machine.h>'
[!GRUB_MACHINE_EMU] (GRUB_TICKS_PER_SECOND): New macro.
* util/misc.c: Remove `<grub/machine/machine.h>' and
`<grub/machine/time.h>'.
* Makefile.in (enable_grub_emu): Remove variable.
Include $(srcdir)/conf/any-emu.mk for the `emu' platform.
* conf/any-emu.rmk: New file.
* conf/common.rmk (grub_emu_init.lst, grub_emu_init.h)
(grub_emu_init.c): Move from here ...
* conf/any-emu.rmk: ... to here.
* conf/i386-coreboot.rmk (sbin_UTILITIES): Remove `grub-emu'.
(grub_emu_SOURCES, grub_emu_LDFLAGS): Move from here ...
* conf/any-emu.rmk: ... to here.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/parser.h (grub_parser_register): Document need
of `name' parameter.
* normal/main.c (grub_normal_read_line): Simplify prompt string.
* script/sh/main.c (grub_sh_parser, GRUB_MOD_INIT(sh)): Rename
"sh" to "grub".
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* Makefile.in ($(srcdir)/po/$(PACKAGE).pot): Pass --keyword=N_ to
`$(XGETTEXT)'.
* include/grub/i18n.h (N_): New macro.
* util/mkisofs/mkisofs.h: Likewise.
* util/mkisofs/mkisofs.c (ld_options): Wrap all translatable strings
around N_().
(usage): Use gettext() to translate help strings when printing them.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
Based on patch from Bean
(http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00384.html)
* video/efi_fb.c: New file.
* conf/i386-efi.rmk (pkglib_MODULES): Add `efi_fb.mod'.
(efi_fb_mod_SOURCES, efi_fb_mod_CFLAGS, efi_fb_mod_LDFLAGS): New
variables.
* conf/x86_64-efi.rmk: Likewise.
2009-11-22 Robert Millan <rmh.grub@aybabtu.com>
* util/i386/pc/grub-mkimage.c: Ungettextize grub_util_info() strings.
* util/i386/pc/grub-setup.c: Likewise.
2009-11-21 Samuel Thibault <samuel.thibault@ens-lyon.org>
* util/getroot.c [__GNU__]: Include <hurd.h>, <hurd/lookup.h>, and
<hurd/fs.h>
[__GNU__] (grub_guess_root_device): Call file_name_lookup and
file_get_storage_info to implement grub_guess_root_device.
2009-11-21 Felix Zielcke <fzielcke@z-51.de>
* Makefile.in (target): Use make's builtin $(shell) function
instead of calling directly $(SHELL) to create the locale directories,
inside the $(foreach) function.
2009-11-21 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrescue.in: Print an error and usage if output option
has not been given.
2009-11-21 Felix Zielcke <fzielcke@z-51.de>
Patch from Loïc Minier <loic.minier@ubuntu.com>.
* util/grub.d/30_os-prober.in: Cope with Linux entries where
root and /boot are on different devices.
2009-11-21 Robert Millan <rmh.grub@aybabtu.com>
Fix build for srcdir != objdir.
* Makefile.in (po/$(PACKAGE).pot): Rename to ...
($(srcdir)/po/$(PACKAGE).pot): ... this. Run $(XGETTEXT) from
$(srcdir).
($(foreach lang, $(LINGUAS), po/$(lang).po)): Rename to ...
($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): ... this. Use $^
reference for input.
2009-11-21 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-mkrescue.in: Use source directory direcly (without copiing
or hardlinking it). Remove -J option, Joliet is not compatible with
multiple source directories.
2009-11-21 Carles Pina i Estany <carles@pina.cat>
2009-11-21 Robert Millan <rmh.grub@aybabtu.com>
* util/grub-mkrescue.in: Recognize `--override-directory' option.
(process_input_dir): New function. Process an arbitrary input
directory.
Misc adjustments to support both "override mode" and system-wide mode.
2009-11-20 Felix Zielcke <fzielcke@z-51.de>
* configure.ac (UNIFONT_BDF): Rename to ...
(FONT_SOURCE): ... this. Update all users.
2009-11-20 Felix Zielcke <fzielcke@z-51.de>
* configure.ac: Add `/usr/share/fonts/X11/misc/unifont.pcf.gz'
to the list of unifont files to look for.
2009-11-19 Robert Millan <rmh.grub@aybabtu.com>
Patch from Joe Auricchio <jauricchio@gmail.com>

View file

@ -22,7 +22,7 @@ need the following.
* Ruby 1.6 or later
* Python 2.5.2 or later
* Autoconf 2.59d or later
* Autoconf 2.60 or later
* Automake 1.10.1 or later
Configuring the GRUB

View file

@ -45,7 +45,9 @@ XGETTEXT = @XGETTEXT@
MSGMERGE = @MSGMERGE@
MSGFMT = @MSGFMT@
LINGUAS = $(shell tr '\n' ' ' < $(srcdir)/po/LINGUAS)
LINGUAS = $(shell for i in $(srcdir)/po/*.po ; do \
if test -e $$i ; then echo $$i ; fi ; \
done | sed -e "s,.*/po/\(.*\)\.po$$,\1,")
PACKAGE = @PACKAGE@
PACKAGE_NAME = @PACKAGE_NAME@
@ -107,12 +109,13 @@ endif
AWK = @AWK@
LIBCURSES = @LIBCURSES@
LIBUSB = @LIBUSB@
LIBPCIACCESS = @LIBPCIACCESS@
YACC = @YACC@
UNIFONT_BDF = @UNIFONT_BDF@
FONT_SOURCE = @FONT_SOURCE@
# Options.
enable_grub_emu = @enable_grub_emu@
enable_grub_emu_usb = @enable_grub_emu_usb@
enable_grub_emu_pci = @enable_grub_emu_pci@
enable_grub_fstest = @enable_grub_fstest@
enable_grub_pe2elf = @enable_grub_pe2elf@
enable_grub_mkfont = @enable_grub_mkfont@
@ -138,7 +141,9 @@ CLEANFILES =
MOSTLYCLEANFILES =
DISTCLEANFILES = config.status config.cache config.log config.h \
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)) \
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS)
@ -153,15 +158,18 @@ $(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb
$(RUBY) $(srcdir)/genmk.rb < $< > $@; \
fi
ifeq ($(platform), emu)
include $(srcdir)/conf/any-emu.mk
else
include $(srcdir)/conf/$(target_cpu)-$(platform).mk
# For external modules.
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
endif
### General targets.
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
cat $(DEFSYMFILES) /dev/null \
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
@ -182,6 +190,9 @@ handler.lst: $(HANDLERFILES)
parttool.lst: $(PARTTOOLFILES)
cat $^ /dev/null | sort | uniq > $@
video.lst: $(VIDEOFILES)
cat $^ /dev/null | sort | uniq > $@
ifneq (true, $(MAKEINFO))
info_INFOS += docs/grub.info
endif
@ -207,7 +218,7 @@ docs/grub.info: docs/grub.texi docs/version.texi docs/fdl.texi
$(MKDIR_P) docs
-$(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@
ifeq (, $(UNIFONT_BDF))
ifeq (, $(FONT_SOURCE))
else
ifeq ($(enable_grub_mkfont),yes)
@ -218,11 +229,11 @@ pkgdata_DATA += unicode.pf2 ascii.pf2
UNICODE_ARROWS=0x2190-0x2193
UNICODE_LINES=0x2501-0x251B
unicode.pf2: $(UNIFONT_BDF) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(UNIFONT_BDF)
unicode.pf2: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE)
ascii.pf2: $(UNIFONT_BDF) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(UNIFONT_BDF) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
ascii.pf2: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
endif
endif
@ -308,13 +319,13 @@ install-local: all
dest="`echo $$file | sed 's,.*/,,'`"; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \
done
$(foreach lang, $(LINGUAS), \
$(SHELL) $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$(lang)/LC_MESSAGES \
@list='po/$(lang).mo'; \
for file in $$list; do \
@langs='$(LINGUAS)'; \
for lang in $$langs; do \
$(SHELL) $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES; \
file="po/$$lang.mo"; \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)/$(datadir)/locale/$(lang)/LC_MESSAGES/$(PACKAGE).mo; \
done)
$(INSTALL_DATA) $$dir$$file $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(infodir)
@list='$(info_INFOS)'; \
for file in $$list; do \
@ -472,12 +483,12 @@ gensymlist.sh: gensymlist.sh.in config.status
genkernsyms.sh: genkernsyms.sh.in config.status
$(SHELL) ./config.status
po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
$(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_
$(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=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) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell
$(foreach lang, $(LINGUAS), po/$(lang).po): po/$(PACKAGE).pot
$(MSGMERGE) -U $@ po/$(PACKAGE).pot
$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot
$(MSGMERGE) -U $@ $^
po/%.mo: po/%.po
$(MKDIR_P) $$(dirname $@)

2
NEWS
View file

@ -1,5 +1,7 @@
New in 1.97 - :
* Add support for gettext.
* Add support for loading XNU (MacOS X kernel).
* ACPI override support.

1
THANKS
View file

@ -8,6 +8,7 @@ generally assist in the GRUB 2 maintainership process:
Andrey Shuvikov <mr_hyro@yahoo.com>
Bibo Mao <bibo.mao@intel.com>
David Miller <davem@davemloft.net>
Guillem Jover <guillem@hadrons.org>
Harley D. Eades III <hde@foobar-qux.org>
Hitoshi Ozeki <h-ozeki@ck2.so-net.ne.jp>

View file

@ -6,6 +6,9 @@ aclocal
autoconf
autoheader
# FIXME: automake doesn't like that there's no Makefile.am
automake -a -c -f || true
echo timestamp > stamp-h.in
python util/import_gcry.py lib/libgcrypt/ .

View file

@ -21,41 +21,40 @@
#include <grub/pci.h>
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
grub_pci_iterate (grub_pci_iteratefunc_t hook)
{
int bus;
int dev;
int func;
grub_pci_device_t dev;
grub_pci_address_t addr;
grub_pci_id_t id;
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);
/* Check if there is a device present. */
if (id >> 16 == 0xFFFF)
continue;
if (hook (bus, dev, func, id))
if (hook (dev, id))
return;
/* 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);
if (!(hdr & 0x800000))
break;

View file

@ -113,7 +113,7 @@ grub_ohci_writereg32 (struct grub_ohci *o,
/* Iterate over all PCI devices. Determine if a device is an OHCI
controller. If this is the case, initialize it. */
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_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 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;
interf = class_code & 0xFF;
@ -138,7 +138,7 @@ grub_ohci_pci_iter (int bus, int device, int func,
return 0;
/* 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);
#if 0

View file

@ -138,7 +138,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
/* Iterate over all PCI devices. Determine if a device is an UHCI
controller. If this is the case, initialize it. */
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_uint32_t class_code;
@ -151,7 +151,7 @@ grub_uhci_pci_iter (int bus, int device, int func,
struct grub_uhci *u;
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;
interf = class_code & 0xFF;
@ -163,7 +163,7 @@ grub_uhci_pci_iter (int bus, int device, int func,
return 0;
/* 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);
/* Stop if there is no IO space base address defined. */
if (! (base & 1))

View file

@ -26,7 +26,6 @@
#include <grub/gzio.h>
#include <grub/acpi.h>
#include <grub/mm.h>
#include <grub/machine/machine.h>
#include <grub/machine/memory.h>
#include <grub/memory.h>

View file

@ -38,11 +38,11 @@ static struct grub_video_patch
};
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;
addr = grub_pci_make_address (bus, dev, func, 2);
addr = grub_pci_make_address (dev, 2);
if (grub_pci_read_byte (addr + 3) == 0x3)
{
struct grub_video_patch *p = video_patches;

View file

@ -41,6 +41,7 @@ enable_rom_area (void)
{
grub_pci_address_t addr;
grub_uint32_t *rom_ptr;
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
if (*rom_ptr != BLANK_MEM)
@ -49,7 +50,7 @@ enable_rom_area (void)
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++, 0x33);
grub_pci_write_byte (addr++, 0x33);
@ -73,8 +74,9 @@ static void
lock_rom_area (void)
{
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++, 0x11);
grub_pci_write_byte (addr++, 0x11);

View file

@ -18,17 +18,8 @@
*/
#include <grub/dl.h>
#include <grub/machine/machine.h>
#include <grub/command.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
#include <grub/misc.h>
static grub_err_t
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),

View file

@ -38,18 +38,18 @@ grub_cmd_hexdump (grub_extcmd_t cmd, int argc, char **args)
struct grub_arg_list *state = cmd->state;
char buf[GRUB_DISK_SECTOR_SIZE * 4];
grub_ssize_t size, length;
grub_addr_t skip;
grub_disk_addr_t skip;
int namelen;
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
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;
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] == ')'))
{
grub_disk_t disk;

View file

@ -18,7 +18,7 @@
*/
#include <grub/dl.h>
#include <grub/machine/init.h>
#include <grub/misc.h>
#include <grub/extcmd.h>
static const struct grub_arg_option options[] =

View file

@ -115,15 +115,16 @@ grub_pci_get_class (int class, int subclass)
}
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;
const char *sclass;
grub_pci_address_t addr;
grub_printf ("%02x:%02x.%x %04x:%04x", bus, dev, func, pciid & 0xFFFF,
pciid >> 16);
addr = grub_pci_make_address (bus, dev, func, 2);
grub_printf ("%02x:%02x.%x %04x:%04x", grub_pci_get_bus (dev),
grub_pci_get_device (dev), grub_pci_get_function (dev),
pciid & 0xFFFF, pciid >> 16);
addr = grub_pci_make_address (dev, 2);
class = grub_pci_read (addr);
/* Lookup the class name, if there isn't a specific one,
@ -156,13 +157,13 @@ grub_cmd_lspci (grub_command_t cmd __attribute__ ((unused)),
static grub_command_t cmd;
GRUB_MOD_INIT(pci)
GRUB_MOD_INIT(lspci)
{
cmd = grub_register_command ("lspci", grub_cmd_lspci,
0, "List PCI devices");
}
GRUB_MOD_FINI(pci)
GRUB_MOD_FINI(lspci)
{
grub_unregister_command (cmd);
}

View file

@ -18,20 +18,8 @@
*/
#include <grub/dl.h>
#include <grub/machine/machine.h>
#include <grub/command.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
#include <grub/misc.h>
static grub_err_t
grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),

94
conf/any-emu.rmk Normal file
View file

@ -0,0 +1,94 @@
# -*- makefile -*-
# Used by various components. These rules need to precede them.
script/lexer.c_DEPENDENCIES = grub_script.tab.h
sbin_UTILITIES += grub-emu
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/echo.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search.c commands/blocklist.c commands/hexdump.c \
lib/hexdump.c commands/halt.c commands/reboot.c \
lib/envblk.c commands/loadenv.c \
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
commands/password.c commands/keystatus.c \
disk/host.c disk/loopback.c disk/scsi.c \
fs/fshelp.c \
\
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/reader.c kern/term.c \
kern/rescue_reader.c kern/rescue_parser.c \
lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
normal/handler.c normal/auth.c normal/autofs.c \
normal/completion.c normal/main.c normal/color.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/menu_text.c \
script/main.c script/execute.c script/function.c \
script/lexer.c script/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c partmap/gpt.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
\
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_emu_init.c gnulib/progname.c
ifeq ($(target_cpu), i386)
grub_emu_SOURCES += commands/i386/cpuid.c
endif
grub_emu_LDFLAGS = $(LIBCURSES)
ifeq ($(enable_grub_emu_usb), yes)
grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \
commands/usbtest.c
grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
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))
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
DISTCLEANFILES += grub_emu_init.lst
grub_emu_init.h: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
DISTCLEANFILES += grub_emu_init.h
grub_emu_init.c: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_emu_init.h
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
DISTCLEANFILES += grub_emu_init.c
# FIXME: this could be shared with common.rmk
# For grub-mkfont.
ifeq ($(enable_grub_mkfont), yes)
bin_UTILITIES += grub-mkfont
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c
grub_mkfont_CFLAGS = $(freetype_cflags)
grub_mkfont_LDFLAGS = $(freetype_libs)
endif
grub_script.tab.c grub_script.tab.h: script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h

View file

@ -1,15 +1,27 @@
# -*- makefile -*-
sbin_UTILITIES += grub-mkdevicemap
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
util/deviceiter.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.
bin_UTILITIES += grub-mkelfimage
grub_mkelfimage_SOURCES = util/elf/grub-mkimage.c util/misc.c \
grub_mkelfimage_SOURCES = gnulib/progname.c \
util/elf/grub-mkimage.c util/misc.c \
util/resolve.c
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
# For grub-probe.
sbin_UTILITIES += grub-probe
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
grub_probe_SOURCES = util/grub-probe.c \
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
util/hostdisk.c util/misc.c util/getroot.c \
kern/device.c kern/disk.c kern/err.c kern/misc.c \
kern/parser.c kern/partition.c kern/file.c \
@ -44,7 +56,8 @@ grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
# For grub-fstest.
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.c \
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
util/misc.c \
kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \
disk/host.c disk/loopback.c kern/list.c kern/command.c \
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
@ -66,29 +79,20 @@ grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.c \
# For grub-mkfont.
ifeq ($(enable_grub_mkfont), yes)
bin_UTILITIES += grub-mkfont
grub_mkfont_SOURCES = util/grub-mkfont.c util/misc.c
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c
grub_mkfont_CFLAGS = $(freetype_cflags)
grub_mkfont_LDFLAGS = $(freetype_libs)
endif
# For grub-mkrelpath.
bin_UTILITIES += grub-mkrelpath
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
# For the parser.
grub_script.tab.c grub_script.tab.h: script/sh/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/sh/parser.y
grub_script.tab.c grub_script.tab.h: script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
# For grub-emu.
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 > $@
DISTCLEANFILES += grub_emu_init.lst
grub_emu_init.h: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
DISTCLEANFILES += grub_emu_init.h
grub_emu_init.c: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_emu_init.h
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
DISTCLEANFILES += grub_emu_init.c
# For grub-probe.
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
@ -130,7 +134,7 @@ DISTCLEANFILES += grub_fstest_init.c
# for grub-editenv
bin_UTILITIES += grub-editenv
grub_editenv_SOURCES = util/grub-editenv.c lib/envblk.c util/misc.c kern/misc.c kern/err.c
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c kern/misc.c kern/err.c
CLEANFILES += grub-editenv
# Needed for genmk.rb to work
@ -138,7 +142,7 @@ ifeq (0,1)
bin_UTILITIES += grub-macho2img grub-pe2elf
endif
grub_pe2elf_SOURCES = util/grub-pe2elf.c util/misc.c
grub_pe2elf_SOURCES = gnulib/progname.c util/grub-pe2elf.c util/misc.c
CLEANFILES += grub-pe2elf
grub_macho2img_SOURCES = util/grub-macho2img.c
@ -163,6 +167,12 @@ update-grub_lib: util/update-grub_lib.in config.status
lib_SCRIPTS += update-grub_lib
CLEANFILES += update-grub_lib
grub-gettext_lib: util/grub-gettext_lib.in config.status
./config.status --file=$@:$<
chmod +x $@
lib_DATA += grub-gettext_lib
CLEANFILES += grub-gettext_lib
%: util/grub.d/%.in config.status
./config.status --file=$@:$<
chmod +x $@
@ -538,8 +548,8 @@ normal_mod_CFLAGS = $(COMMON_CFLAGS)
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For sh.mod.
sh_mod_SOURCES = script/sh/main.c script/sh/script.c script/sh/execute.c \
script/sh/function.c script/sh/lexer.c grub_script.tab.c
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
script/function.c script/lexer.c grub_script.tab.c
sh_mod_CFLAGS = $(COMMON_CFLAGS)
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -610,6 +620,12 @@ bufio_mod_SOURCES = io/bufio.c
bufio_mod_CFLAGS = $(COMMON_CFLAGS)
bufio_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For gettext.mod.
pkglib_MODULES += gettext.mod
gettext_mod_SOURCES = gettext/gettext.c
gettext_mod_CFLAGS = $(COMMON_CFLAGS)
gettext_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Misc.
pkglib_MODULES += xnu_uuid.mod

View file

@ -5,7 +5,7 @@ COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
COMMON_LDFLAGS = -m32 -nostdlib
# Used by various components. These rules need to precede them.
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Images.
@ -18,6 +18,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
kern/i386/misc.S \
kern/i386/coreboot/init.c \
kern/i386/multiboot_mmap.c \
kern/i386/halt.c \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -34,7 +35,7 @@ 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 \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
machine/boot.h machine/console.h machine/init.h \
machine/memory.h machine/loader.h list.h handler.h command.h
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
@ -53,7 +54,7 @@ boot_img_FORMAT = binary
bin_UTILITIES += grub-mkimage
grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
util/resolve.c
util/resolve.c gnulib/progname.c
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
pkglib_IMAGES += kernel.img
@ -61,6 +62,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
kern/i386/misc.S \
kern/i386/coreboot/init.c \
kern/i386/qemu/mmap.c \
kern/i386/halt.c \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -77,7 +79,7 @@ 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 \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
machine/boot.h machine/console.h machine/init.h \
machine/memory.h machine/loader.h list.h handler.h command.h
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
@ -93,62 +95,6 @@ symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# Utilities.
sbin_UTILITIES = grub-mkdevicemap
ifeq ($(enable_grub_emu), yes)
sbin_UTILITIES += grub-emu
endif
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
# For grub-emu.
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/echo.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search.c commands/blocklist.c commands/hexdump.c \
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
commands/password.c commands/keystatus.c \
lib/hexdump.c commands/i386/cpuid.c \
lib/envblk.c commands/loadenv.c \
disk/host.c disk/loopback.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
\
fs/fshelp.c \
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/reader.c kern/term.c \
kern/rescue_reader.c kern/rescue_parser.c \
lib/arg.c normal/cmdline.c normal/misc.c \
normal/handler.c normal/auth.c normal/autofs.c \
normal/completion.c normal/datetime.c normal/main.c \
normal/menu_text.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/color.c \
script/sh/main.c script/sh/execute.c script/sh/function.c \
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c partmap/gpt.c \
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in
@ -180,12 +126,12 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# 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_LDFLAGS = $(COMMON_LDFLAGS)
# 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_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -5,18 +5,14 @@ COMMON_CFLAGS = -fno-builtin -m32
COMMON_LDFLAGS = -melf_i386 -nostdlib
# Used by various components. These rules need to precede them.
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-mkdevicemap
#ifeq ($(enable_grub_emu), yes)
#sbin_UTILITIES += grub-emu
#endif
# For grub-mkimage.
grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
util/resolve.c
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
util/misc.c util/resolve.c
util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
# For grub-setup.
@ -27,55 +23,6 @@ util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
# fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
# kern/fs.c kern/env.c fs/fshelp.c
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
# For grub-emu.
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search.c commands/hexdump.c lib/hexdump.c \
commands/halt.c commands/reboot.c commands/keystatus.c \
commands/i386/cpuid.c \
commands/password.c \
lib/envblk.c commands/loadenv.c \
disk/loopback.c \
\
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
\
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/reader.c kern/term.c \
kern/rescue_reader.c kern/rescue_parser.c \
lib/arg.c normal/cmdline.c normal/command.c normal/datetime.c \
normal/auth.c normal/autofs.c \
normal/completion.c normal/context.c normal/main.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/menu_text.c \
normal/color.c \
script/sh/main.c script/sh/execute.c script/sh/function.c \
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c partmap/gpt.c \
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
# Scripts.
sbin_SCRIPTS = grub-install
@ -83,14 +30,14 @@ sbin_SCRIPTS = grub-install
grub_install_SOURCES = util/i386/efi/grub-install.in
# 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 \
datetime.mod date.mod datehook.mod loadbios.mod \
fixvideo.mod mmap.mod acpi.mod
# For kernel.mod.
kernel_mod_EXPORTS = no
kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
# For kernel.img.
kernel_img_EXPORTS = no
kernel_img_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
@ -101,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/generic/rtc_get_time_ms.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 \
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
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
MOSTLYCLEANFILES += symlist.c
MOSTLYCLEANFILES += symlist.c 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)
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)
# For boot.mod.
@ -196,9 +143,19 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_uga.mod
efi_uga_mod_SOURCES = video/efi_uga.c
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_gop.mod
efi_gop_mod_SOURCES = video/efi_gop.c
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\
loader/macho.c loader/xnu.c loader/i386/xnu_helper.S
loader/macho.c loader/xnu.c
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)

View file

@ -5,7 +5,7 @@ COMMON_CFLAGS = -ffreestanding -mrtd -mregparm=3
COMMON_LDFLAGS = -nostdlib
# Used by various components. These rules need to precede them.
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Images.
pkglib_PROGRAMS = kernel.img
@ -33,7 +33,7 @@ kernel_img_HEADERS = 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 \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
ieee1275/ieee1275.h machine/kernel.h machine/loader.h machine/memory.h \
list.h handler.h command.h
list.h handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
@ -47,61 +47,6 @@ symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# Utilities.
sbin_UTILITIES = grub-mkdevicemap
ifeq ($(enable_grub_emu), yes)
sbin_UTILITIES += grub-emu
endif
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
# For grub-emu.
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/echo.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search.c commands/blocklist.c commands/hexdump.c \
lib/hexdump.c commands/halt.c commands/reboot.c \
lib/envblk.c commands/loadenv.c \
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
commands/i386/cpuid.c \
commands/password.c commands/keystatus.c \
disk/host.c disk/loopback.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \
fs/befs_be.c fs/tar.c \
\
fs/fshelp.c \
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/reader.c kern/term.c \
kern/rescue_reader.c kern/rescue_parser.c \
lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
normal/handler.c normal/auth.c normal/autofs.c \
normal/completion.c normal/main.c normal/menu_text.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/color.c \
script/sh/main.c script/sh/execute.c script/sh/function.c \
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c partmap/gpt.c \
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
# Scripts.
sbin_SCRIPTS = grub-install

View file

@ -7,7 +7,7 @@ COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
COMMON_LDFLAGS = -m32 -nostdlib
# Used by various components. These rules need to precede them.
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Images.
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
@ -64,7 +64,7 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
machine/memory.h machine/loader.h machine/vga.h machine/vbe.h \
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
@ -81,10 +81,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-setup grub-mkdevicemap
ifeq ($(enable_grub_emu), yes)
sbin_UTILITIES += grub-emu
endif
sbin_UTILITIES = grub-setup
# For grub-mkimage.
grub_mkimage_SOURCES = gnulib/progname.c util/i386/pc/grub-mkimage.c util/misc.c \
@ -112,63 +109,6 @@ grub_setup_SOURCES = gnulib/progname.c \
util/raid.c util/lvm.c \
grub_setup_init.c
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
# For grub-emu.
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/echo.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search.c commands/blocklist.c commands/hexdump.c \
lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c \
lib/envblk.c commands/loadenv.c \
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
commands/i386/cpuid.c \
commands/password.c commands/keystatus.c \
disk/host.c disk/loopback.c disk/scsi.c \
fs/fshelp.c \
\
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/reader.c kern/term.c \
kern/rescue_reader.c kern/rescue_parser.c \
lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
normal/handler.c normal/auth.c normal/autofs.c \
normal/completion.c normal/main.c normal/color.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/menu_text.c \
script/sh/main.c script/sh/execute.c script/sh/function.c \
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c partmap/gpt.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
\
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
ifeq ($(enable_grub_emu_usb), yes)
grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \
commands/usbtest.c
grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
endif
sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in
@ -244,7 +184,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c\
loader/macho.c loader/xnu.c loader/i386/xnu_helper.S
loader/macho.c loader/xnu.c
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)

View file

@ -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_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
ata_mod_SOURCES = disk/ata.c
ata_mod_CFLAGS = $(COMMON_CFLAGS)

View file

@ -6,7 +6,7 @@ COMMON_CFLAGS = -ffreestanding
COMMON_LDFLAGS += -nostdlib
# Used by various components. These rules need to precede them.
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Images.
@ -17,7 +17,7 @@ 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 misc.h mm.h net.h parser.h reader.h \
symbol.h term.h time.h types.h powerpc/libgcc.h loader.h partition.h \
msdos_partition.h ieee1275/ieee1275.h machine/kernel.h handler.h list.h \
command.h
command.h i18n.h
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
@ -28,62 +28,6 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
# Programs
pkglib_PROGRAMS = kernel.img
# Utilities.
sbin_UTILITIES = grub-mkdevicemap
ifeq ($(enable_grub_emu), yes)
sbin_UTILITIES += grub-emu
endif
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
# For grub-emu
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/help.c \
commands/search.c commands/handler.c commands/test.c \
commands/ls.c commands/blocklist.c commands/hexdump.c \
lib/hexdump.c commands/halt.c commands/reboot.c \
lib/envblk.c commands/loadenv.c \
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
commands/password.c commands/keystatus.c \
disk/loopback.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
\
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/file.c kern/fs.c commands/boot.c kern/main.c \
kern/misc.c kern/parser.c kern/partition.c kern/reader.c \
kern/rescue_reader.c kern/rescue_parser.c \
kern/term.c kern/list.c kern/handler.c fs/fshelp.c \
kern/command.c kern/corecmd.c commands/extcmd.c \
lib/arg.c normal/cmdline.c normal/datetime.c \
normal/completion.c normal/misc.c \
normal/handler.c normal/auth.c normal/autofs.c normal/main.c \
normal/menu.c \
normal/menu_text.c \
normal/menu_entry.c normal/menu_viewer.c \
normal/color.c \
script/sh/main.c script/sh/execute.c script/sh/function.c \
script/sh/lexer.c script/sh/script.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c \
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_script.tab.c grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \

View file

@ -6,7 +6,7 @@ COMMON_CFLAGS = -ffreestanding -m64 -mno-app-regs
COMMON_LDFLAGS = -melf64_sparc -nostdlib -mno-relax
# Used by various components. These rules need to precede them.
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Images.
pkglib_IMAGES = boot.img diskboot.img kernel.img
@ -29,7 +29,7 @@ DEFSYMFILES += kernel_syms.lst
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 \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
list.h handler.h command.h \
list.h handler.h command.h i18n.h \
sparc64/libgcc.h ieee1275/ieee1275.h machine/kernel.h \
sparc64/ieee1275/ieee1275.h
kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
@ -59,14 +59,11 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-setup grub-mkdevicemap grub-ofpathname
ifeq ($(enable_grub_emu), yes)
sbin_UTILITIES += grub-emu
endif
sbin_UTILITIES = grub-setup grub-ofpathname
# For grub-mkimage.
grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
util/resolve.c
util/resolve.c gnulib/progname.c
# For grub-setup.
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
@ -85,62 +82,12 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
partmap/sun.c partmap/acorn.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
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/ieee1275/ofpath.c util/ieee1275/devicemap.c util/misc.c
# For grub-ofpathname.
grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
util/ieee1275/ofpath.c util/misc.c
# For grub-emu
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/help.c \
commands/search.c commands/handler.c commands/test.c \
commands/ls.c commands/blocklist.c commands/hexdump.c \
lib/hexdump.c commands/halt.c commands/reboot.c \
lib/envblk.c commands/loadenv.c \
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
commands/password.c commands/keystatus.c \
disk/loopback.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
\
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/file.c kern/fs.c commands/boot.c kern/main.c \
kern/misc.c kern/parser.c kern/partition.c kern/reader.c \
kern/rescue_reader.c kern/rescue_parser.c \
kern/term.c kern/list.c kern/handler.c fs/fshelp.c \
kern/command.c kern/corecmd.c commands/extcmd.c \
lib/arg.c normal/cmdline.c normal/datetime.c \
normal/completion.c normal/misc.c \
normal/handler.c normal/auth.c normal/autofs.c normal/main.c \
normal/menu.c \
normal/menu_text.c \
normal/menu_entry.c normal/menu_viewer.c \
normal/color.c \
script/sh/main.c script/sh/execute.c script/sh/function.c \
script/sh/lexer.c script/sh/script.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c \
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_script.tab.c grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
util/ieee1275/ofpath.c util/misc.c gnulib/progname.c
# Scripts.
sbin_SCRIPTS = grub-install

View file

@ -5,18 +5,14 @@ COMMON_CFLAGS = -fno-builtin -m64
COMMON_LDFLAGS = -melf_x86_64 -nostdlib
# Used by various components. These rules need to precede them.
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-mkdevicemap
#ifeq ($(enable_grub_emu), yes)
#sbin_UTILITIES += grub-emu
#endif
# For grub-mkimage.
grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
util/resolve.c
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
util/misc.c util/resolve.c
# For grub-setup.
#grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
@ -26,54 +22,6 @@ grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
# fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
# kern/fs.c kern/env.c fs/fshelp.c
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
# For grub-emu.
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search.c commands/hexdump.c lib/hexdump.c \
commands/halt.c commands/reboot.c \
commands/i386/cpuid.c \
commands/password.c commands/keystatus.c \
lib/envblk.c commands/loadenv.c \
disk/loopback.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
\
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/readerescue.c kern/term.c \
lib/arg.c normal/cmdline.c normal/misc.c normal/auth.c \
normal/autofs.c \
normal/completion.c normal/datetime.c normal/context.c \
normal/main.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/menu_text.c \
normal/color.c \
script/sh/main.c script/sh/execute.c script/sh/function.c \
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c partmap/gpt.c \
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
# Scripts.
sbin_SCRIPTS = grub-install
@ -81,14 +29,14 @@ sbin_SCRIPTS = grub-install
grub_install_SOURCES = util/i386/efi/grub-install.in
# 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 \
datetime.mod date.mod datehook.mod loadbios.mod \
fixvideo.mod mmap.mod acpi.mod ata.mod
# For kernel.mod.
kernel_mod_EXPORTS = no
kernel_mod_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
# For kernel.img.
kernel_img_EXPORTS = no
kernel_img_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -99,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/generic/millisleep.c kern/generic/rtc_get_time_ms.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 \
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 \
handler.h command.h
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
MOSTLYCLEANFILES += symlist.c
MOSTLYCLEANFILES += symlist.c 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)
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)
# For boot.mod.
@ -201,11 +149,27 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_uga.mod
efi_uga_mod_SOURCES = video/efi_uga.c
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_gop.mod
efi_gop_mod_SOURCES = video/efi_gop.c
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\
loader/macho.c loader/xnu.c loader/i386/xnu_helper.S
loader/macho.c loader/xnu.c
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
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

1494
config.guess vendored

File diff suppressed because it is too large Load diff

1700
config.sub vendored

File diff suppressed because it is too large Load diff

View file

@ -33,8 +33,7 @@ dnl type.
AC_INIT([GRUB],[1.97],[bug-grub@gnu.org])
AM_INIT_AUTOMAKE()
AM_GNU_GETTEXT()
AC_PREREQ(2.59d)
AC_PREREQ(2.60)
AC_CONFIG_SRCDIR([include/grub/dl.h])
AC_CONFIG_HEADER([config.h])
@ -91,6 +90,7 @@ case "$target_cpu"-"$platform" in
i386-qemu) ;;
powerpc-ieee1275) ;;
sparc64-ieee1275) ;;
*-emu) ;;
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
esac
@ -113,6 +113,18 @@ case "$host_os" in
cygwin) host_kernel=windows ;;
esac
case "$platform" in
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
esac
CFLAGS="$CFLAGS $machine_CFLAGS"
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
AC_SUBST(host_cpu)
AC_SUBST(host_os)
AC_SUBST(host_kernel)
@ -136,9 +148,9 @@ if test "x$YACC" = x; then
AC_MSG_ERROR([bison is not found])
fi
for file in /usr/src/unifont.bdf ; do
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do
if test -e $file ; then
AC_SUBST([UNIFONT_BDF], [$file])
AC_SUBST([FONT_SOURCE], [$file])
break
fi
done
@ -161,6 +173,7 @@ AC_PROG_CC
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
AC_GNU_SOURCE
AM_GNU_GETTEXT
AC_SYS_LARGEFILE
# Identify characteristics of the host architecture.
@ -181,7 +194,7 @@ else
fi
# Check for functions.
AC_CHECK_FUNCS(posix_memalign memalign asprintf)
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
# For grub-mkisofs
AC_HEADER_MAJOR
@ -509,43 +522,40 @@ AC_ARG_ENABLE([mm-debug],
[AC_DEFINE([MM_DEBUG], [1],
[Define to 1 if you enable memory manager debugging.])])
AC_ARG_ENABLE([grub-emu],
[AS_HELP_STRING([--enable-grub-emu],
[build and install the `grub-emu' debugging utility (default=guessed)])])
AC_ARG_ENABLE([grub-emu-usb],
[AS_HELP_STRING([--enable-grub-emu-usb],
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
if test x"$enable_grub_emu" = xno ; then
grub_emu_excuse="explicitly disabled"
fi
[# Check for curses libraries.]
[if [ x"$grub_emu_excuse" = x ]; then ]
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
missing_ncurses=
[# Check for curses libraries.]
AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
[AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
[grub_emu_excuse=["need (n)curses libraries"]])])
[missing_ncurses=[true]])])
AC_SUBST([LIBCURSES])
[fi]
[if [ x"$grub_emu_excuse" = x ]; then ]
[if [ x"$missing_ncurses" = x ]; then ]
[# Check for headers.]
AC_CHECK_HEADERS([ncurses/curses.h], [],
[AC_CHECK_HEADERS([ncurses.h], [],
[AC_CHECK_HEADERS([curses.h], [],
[grub_emu_excuse=["need (n)curses headers"]])])])
[missing_ncurses=[true]])])])
[fi]
if test x"$missing_ncurses" = xtrue ; then
AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
fi
if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then
AC_MSG_ERROR([grub-emu was explicitly requested but can't be compiled])
fi
if test x"$grub_emu_excuse" = x ; then
enable_grub_emu=yes
else
enable_grub_emu=no
grub_emu_usb_excuse="grub-emu isn't built"
fi
if test x"$enable_grub_emu_usb" = xno ; then
grub_emu_usb_excuse="explicitly disabled"
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
# Check for libusb libraries.]
AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
@ -566,8 +576,35 @@ else
enable_grub_emu_usb=no
fi
AC_SUBST([enable_grub_emu])
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_usb])
AC_SUBST([enable_grub_emu_pci])
fi
AC_ARG_ENABLE([grub-fstest],
[AS_HELP_STRING([--enable-grub-fstest],
@ -615,14 +652,18 @@ AC_SUBST(ASFLAGS)
# Output files.
grub_CHECK_LINK_DIR
if test x"$link_dir" = xyes ; then
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu
include/grub/machine:include/grub/$target_cpu/$platform])
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
if test "$platform" != emu ; then
AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
fi
else
mkdir -p include/grub 2>/dev/null
rm -rf include/grub/cpu
cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
rm -rf include/grub/machine
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
if test "$platform" != emu ; then
rm -rf include/grub/machine
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
fi
fi
AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
@ -631,16 +672,18 @@ AC_OUTPUT
echo "*******************************************************"
echo GRUB2 will be compiled with following components:
echo Platform: "$target_cpu"-"$platform"
if [ x"$grub_emu_excuse" = x ]; then
echo grub-emu: Yes
else
echo grub-emu: No "($grub_emu_excuse)"
fi
if [ x"$platform" = xemu ]; then
if [ x"$grub_emu_usb_excuse" = x ]; then
echo USB support for grub-emu: Yes
else
echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
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
if [ x"$enable_mm_debug" = xyes ]; then
echo With memory debugging: Yes
else

View file

@ -388,7 +388,7 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
}
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)))
{
static int compat_use[2] = { 0 };
@ -402,7 +402,7 @@ grub_ata_pciinit (int bus, int device, int func,
static int controller = 0;
/* Read class. */
addr = grub_pci_make_address (bus, device, func, 2);
addr = grub_pci_make_address (dev, 2);
class = grub_pci_read (addr);
/* 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
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);
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);
/* Check if the BARs describe an IO region. */
@ -444,7 +444,8 @@ grub_ata_pciinit (int bus, int device, int func,
grub_dprintf ("ata",
"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)
{

View file

@ -169,7 +169,7 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)
else
{
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 */ *
256 /* heads */ *
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;
head = ((grub_uint32_t) sector) / data->sectors;
@ -260,7 +260,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
coff = head / data->heads;
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,
coff, hoff, soff, size, segment))
@ -268,9 +268,9 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
switch (cmd)
{
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:
return grub_error (GRUB_ERR_WRITE_ERROR, "biosdisk write error");
return grub_error (GRUB_ERR_WRITE_ERROR, "%s write error", disk->name);
}
}
}

View file

@ -107,7 +107,7 @@ grub_ofdisk_iterate (int (*hook) (const char *name))
}
if (! grub_strcmp (alias->type, "block") &&
grub_strcmp (alias->name, "cdrom"))
grub_strncmp (alias->name, "cdrom", 5))
ret = hook (alias->name);
return ret;
}

View file

@ -1072,6 +1072,31 @@ grub_hfs_label (grub_device_t device, char **label)
return grub_errno;
}
static grub_err_t
grub_hfs_uuid (grub_device_t device, char **uuid)
{
struct grub_hfs_data *data;
grub_dl_ref (my_mod);
data = grub_hfs_mount (device->disk);
if (data && data->sblock.num_serial != 0)
{
*uuid = grub_malloc (16 + sizeof ('\0'));
grub_sprintf (*uuid, "%016llx",
(unsigned long long)
grub_be_to_cpu64 (data->sblock.num_serial));
}
else
*uuid = NULL;
grub_dl_unref (my_mod);
grub_free (data);
return grub_errno;
}
static struct grub_fs grub_hfs_fs =
@ -1082,6 +1107,7 @@ static struct grub_fs grub_hfs_fs =
.read = grub_hfs_read,
.close = grub_hfs_close,
.label = grub_hfs_label,
.uuid = grub_hfs_uuid,
.next = 0
};

View file

@ -63,7 +63,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,
grub_uint32_t mftno);
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,
void
NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t
@ -72,7 +72,7 @@ static grub_err_t read_attr (struct grub_ntfs_attr *at, char *dest,
unsigned length));
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,
void
NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t
@ -260,9 +260,9 @@ locate_attr (struct grub_ntfs_attr *at, struct grub_ntfs_file *mft,
}
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;
v = 1;
@ -284,7 +284,7 @@ grub_err_t
grub_ntfs_read_run_list (struct grub_ntfs_rlst * ctx)
{
int c1, c2;
grub_uint32_t val;
grub_disk_addr_t val;
char *run;
run = ctx->cur_run;
@ -335,25 +335,25 @@ grub_ntfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t block)
struct grub_ntfs_rlst *ctx;
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))
return -1;
return ctx->curr_lcn;
}
else
return (ctx->flags & RF_BLNK) ? 0 : ((grub_uint32_t) block -
return (ctx->flags & RF_BLNK) ? 0 : (block -
ctx->curr_vcn + ctx->curr_lcn);
}
static grub_err_t
read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
grub_uint32_t len, int cached,
read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
grub_disk_addr_t ofs, grub_size_t len, int cached,
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset,
unsigned length))
{
grub_uint32_t vcn;
grub_disk_addr_t vcn;
struct grub_ntfs_rlst cc, *ctx;
if (len == 0)
@ -388,7 +388,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
{
if ((ofs & (~(COM_LEN - 1))) == at->save_pos)
{
grub_uint32_t n;
grub_disk_addr_t n;
n = COM_LEN - (ofs - at->save_pos);
if (n > len)
@ -411,11 +411,11 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
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;
}
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->curr_lcn = 0;
@ -427,11 +427,13 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
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 =
(ctx->target_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc +
((ofs >> BLK_SHR) % ctx->comp.spc);
(ctx->target_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc + m;
st1 = st0 + 1;
if (st1 ==
(ctx->next_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc)
@ -462,8 +464,8 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
}
static grub_err_t
read_attr (struct grub_ntfs_attr *at, char *dest, grub_uint32_t ofs,
grub_uint32_t len, int cached,
read_attr (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
grub_size_t len, int cached,
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset,
unsigned length))
@ -479,9 +481,9 @@ read_attr (struct grub_ntfs_attr *at, char *dest, grub_uint32_t ofs,
if (at->flags & AF_ALST)
{
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);
while (pa < at->attr_end)
{
@ -508,7 +510,7 @@ static grub_err_t
read_mft (struct grub_ntfs_data *data, char *buf, grub_uint32_t mftno)
{
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))
return grub_error (GRUB_ERR_BAD_FS, "Read MFT 0x%X fails", mftno);
return fixup (data, buf, data->mft_size, "FILE");
@ -640,7 +642,8 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
unsigned char *bitmap;
struct grub_ntfs_attr attr, *at;
char *cur_pos, *indx, *bmp;
int bitmap_len, ret = 0;
int ret = 0;
grub_size_t bitmap_len;
struct grub_ntfs_file *mft;
mft = (struct grub_ntfs_file *) dir;
@ -744,14 +747,14 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
if (bitmap)
{
grub_uint32_t v, i;
grub_disk_addr_t v, i;
indx = grub_malloc (mft->data->idx_size << BLK_SHR);
if (indx == NULL)
goto done;
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)
{

View file

@ -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)
nn = num;
num -= nn;

View file

@ -19,6 +19,7 @@ EXTRA_DISTFILES="AUTHORS COPYING ChangeLog DISTLIST INSTALL NEWS README \
gendistlist.sh genfslist.sh genhandlerlist.sh geninit.sh \
geninitheader.sh genkernsyms.sh.in genmk.rb genmoddep.awk \
genmodsrc.sh genpartmaplist.sh genparttoollist.sh \
genvideolist.sh \
gensymlist.sh.in install-sh mkinstalldirs stamp-h.in"
DISTDIRS="boot bus commands conf disk docs efiemu font fs hello hook include io \

View file

@ -19,7 +19,7 @@
u=
grep "^#define HAVE_ASM_USCORE" config.h >/dev/null 2>&1 && u="_"
$CC -DGRUB_SYMBOL_GENERATOR=1 -E -I. -Iinclude -I"$srcdir/include" $* \
$CC @TARGET_CFLAGS@ -DGRUB_SYMBOL_GENERATOR=1 -E -I. -Iinclude -I"$srcdir/include" $* \
| grep -v '^#' \
| sed -n \
-e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$u"'\1 kernel/;p;}' \

View file

@ -193,6 +193,7 @@ endif
partmap = 'partmap-' + obj.suffix('lst')
handler = 'handler-' + obj.suffix('lst')
parttool = 'parttool-' + obj.suffix('lst')
video = 'video-' + obj.suffix('lst')
dep = deps[i]
flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
@ -203,7 +204,7 @@ endif
-include #{dep}
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}
@ -212,6 +213,7 @@ FSFILES += #{fs}
PARTTOOLFILES += #{parttool}
PARTMAPFILES += #{partmap}
HANDLERFILES += #{handler}
VIDEOFILES += #{video}
#{command}: #{src} $(#{src}_DEPENDENCIES) gencmdlist.sh
set -e; \
@ -238,6 +240,11 @@ HANDLERFILES += #{handler}
$(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)
#{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

View file

@ -59,7 +59,7 @@ cat <<EOF
{
EOF
$CC -DGRUB_SYMBOL_GENERATOR=1 -E -I. -Iinclude -I"$srcdir/include" $* \
$CC @TARGET_CFLAGS@ -DGRUB_SYMBOL_GENERATOR=1 -E -I. -Iinclude -I"$srcdir/include" $* \
| grep -v '^#' \
| sed -n \
-e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/ {"\1", \1},/;p;}' \

26
genvideolist.sh Normal file
View 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

368
gettext/gettext.c Normal file
View file

@ -0,0 +1,368 @@
/* gettext.c - gettext module */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/list.h>
#include <grub/types.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/err.h>
#include <grub/dl.h>
#include <grub/normal.h>
#include <grub/file.h>
#include <grub/kernel.h>
#include <grub/gzio.h>
#include <grub/i18n.h>
/*
.mo file information from:
http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html .
*/
static grub_file_t fd_mo;
static int grub_gettext_offsetoriginal;
static int grub_gettext_max;
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_FILE_FORMAT 4
#define GETTEXT_NUMBER_OF_STRINGS 8
#define GETTEXT_OFFSET_ORIGINAL 12
#define GETTEXT_OFFSET_TRANSLATION 16
#define MO_MAGIC_NUMBER 0x950412de
static grub_ssize_t
grub_gettext_pread (grub_file_t file, void *buf, grub_size_t len,
grub_off_t offset)
{
if (grub_file_seek (file, offset) == (grub_off_t) - 1)
{
return -1;
}
return grub_file_read (file, buf, len);
}
static grub_uint32_t
grub_gettext_get_info (int offset)
{
grub_uint32_t value;
grub_gettext_pread (fd_mo, (char *) &value, 4, offset);
value = grub_cpu_to_le32 (value);
return value;
}
static void
grub_gettext_getstring_from_offset (grub_uint32_t offset,
grub_uint32_t length, char *translation)
{
grub_gettext_pread (fd_mo, translation, length, offset);
translation[length] = '\0';
}
static const char *
grub_gettext_gettranslation_from_position (int position)
{
int offsettranslation;
int internal_position;
grub_uint32_t length, offset;
char *translation;
offsettranslation = grub_gettext_get_info (GETTEXT_OFFSET_TRANSLATION);
internal_position = offsettranslation + position * 8;
grub_gettext_pread (fd_mo, (char *) &length, 4, internal_position);
length = grub_cpu_to_le32 (length);
grub_gettext_pread (fd_mo, (char *) &offset, 4, internal_position + 4);
offset = grub_cpu_to_le32 (offset);
translation = grub_malloc (length + 1);
grub_gettext_getstring_from_offset (offset, length, translation);
return translation;
}
static char *
grub_gettext_getstring_from_position (int position)
{
int internal_position;
int length, offset;
char *original;
/* Get position for string i. */
internal_position = grub_gettext_offsetoriginal + (position * 8);
/* Get the length of the string i. */
grub_gettext_pread (fd_mo, (char *) &length, 4, internal_position);
/* Get the offset of the string i. */
grub_gettext_pread (fd_mo, (char *) &offset, 4, internal_position + 4);
/* Get the string i. */
original = grub_malloc (length + 1);
grub_gettext_getstring_from_offset (offset, length, original);
return original;
}
static const char *
grub_gettext_translate (const char *orig)
{
char *current_string;
const char *ret;
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)
return orig;
min = 0;
max = grub_gettext_max;
current = (max + min) / 2;
while (current != min && current != max && found == 0)
{
current_string = grub_gettext_getstring_from_position (current);
/* Search by bisection. */
if (grub_strcmp (current_string, orig) < 0)
{
grub_free (current_string);
min = current;
}
else if (grub_strcmp (current_string, orig) > 0)
{
grub_free (current_string);
max = current;
}
else if (grub_strcmp (current_string, orig) == 0)
{
grub_free (current_string);
found = 1;
}
current = (max + min) / 2;
}
ret = found ? grub_gettext_gettranslation_from_position (current) : 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;
}
/* This is similar to grub_gzfile_open. */
static grub_file_t
grub_mofile_open (const char *filename)
{
int unsigned magic;
int version;
/* Using fd_mo and not another variable because
it's needed for grub_gettext_get_info. */
fd_mo = grub_gzfile_open (filename, 1);
grub_errno = GRUB_ERR_NONE;
if (!fd_mo)
{
grub_dprintf ("gettext", "Cannot read %s\n", filename);
return 0;
}
magic = grub_gettext_get_info (GETTEXT_MAGIC_NUMBER);
if (magic != MO_MAGIC_NUMBER)
{
grub_error (GRUB_ERR_BAD_FILE_TYPE, "mo: invalid mo file: %s",
filename);
grub_file_close (fd_mo);
fd_mo = 0;
return 0;
}
version = grub_gettext_get_info (GETTEXT_FILE_FORMAT);
if (version != 0)
{
grub_error (GRUB_ERR_BAD_FILE_TYPE,
"mo: invalid mo version in file: %s\n", filename);
fd_mo = 0;
return 0;
}
return fd_mo;
}
static void
grub_gettext_init_ext (const char *lang)
{
char *mo_file;
char *locale_dir;
locale_dir = grub_env_get ("locale_dir");
if (locale_dir == NULL)
{
grub_dprintf ("gettext", "locale_dir variable is not set up.\n");
return;
}
fd_mo = NULL;
/* mo_file e.g.: /boot/grub/locale/ca.mo */
mo_file =
grub_malloc (grub_strlen (locale_dir) + grub_strlen ("/") +
grub_strlen (lang) + grub_strlen (".mo") + 1);
/* Warning: if changing some paths in the below line, change the grub_malloc
contents below. */
grub_sprintf (mo_file, "%s/%s.mo", locale_dir, lang);
fd_mo = grub_mofile_open (mo_file);
/* Will try adding .gz as well. */
if (fd_mo == NULL)
{
grub_sprintf (mo_file, "%s.gz", mo_file);
fd_mo = grub_mofile_open (mo_file);
}
if (fd_mo)
{
grub_gettext_offsetoriginal =
grub_gettext_get_info (GETTEXT_OFFSET_ORIGINAL);
grub_gettext_max = grub_gettext_get_info (GETTEXT_NUMBER_OF_STRINGS);
grub_gettext_original = grub_gettext;
grub_gettext = grub_gettext_translate;
}
}
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 *
grub_gettext_env_write_lang (struct grub_env_var *var
__attribute__ ((unused)), const char *val)
{
grub_gettext_init_ext (val);
grub_gettext_delete_list ();
return grub_strdup (val);
}
static grub_err_t
grub_cmd_translate (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "text to translate required");
const char *translation;
translation = grub_gettext_translate (args[0]);
grub_printf ("%s\n", translation);
return 0;
}
GRUB_MOD_INIT (gettext)
{
(void) mod; /* To stop warning. */
const char *lang;
lang = grub_env_get ("lang");
grub_gettext_init_ext (lang);
grub_register_command_p1 ("gettext", grub_cmd_translate,
"gettext STRING",
"Translates the string with the current settings.");
/* Reload .mo file information if lang changes. */
grub_register_variable_hook ("lang", NULL, grub_gettext_env_write_lang);
/* Preserve hooks after context changes. */
grub_env_export ("lang");
}
GRUB_MOD_FINI (gettext)
{
if (fd_mo != 0)
grub_file_close (fd_mo);
grub_gettext_delete_list ();
grub_gettext = grub_gettext_original;
}

View file

@ -21,7 +21,6 @@
#ifndef GRUB_AUTOEFI_HEADER
#define GRUB_AUTOEFI_HEADER 1
#include <grub/machine/machine.h>
#ifdef GRUB_MACHINE_EFI
# include <grub/efi/efi.h>

View file

@ -54,8 +54,6 @@ char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
grub_efi_device_path_t *
EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
int EXPORT_FUNC(grub_efi_exit_boot_services) (grub_efi_uintn_t map_key);
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
int EXPORT_FUNC (grub_efi_finish_boot_services) (void);
void grub_efi_mm_init (void);

View file

@ -0,0 +1,96 @@
/*
* 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_EFI_GOP_HEADER
#define GRUB_EFI_GOP_HEADER 1
/* Based on UEFI specification. */
#define GRUB_EFI_GOP_GUID \
{ 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }}
typedef enum
{
GRUB_EFI_GOT_RGBA8,
GRUB_EFI_GOT_BGRA8,
GRUB_EFI_GOT_BITMASK
}
grub_efi_gop_pixel_format_t;
struct grub_efi_gop_pixel_bitmask
{
grub_uint32_t r;
grub_uint32_t g;
grub_uint32_t b;
grub_uint32_t a;
};
struct grub_efi_gop_mode_info
{
grub_efi_uint32_t version;
grub_efi_uint32_t width;
grub_efi_uint32_t height;
grub_efi_gop_pixel_format_t pixel_format;
struct grub_efi_gop_pixel_bitmask pixel_bitmask;
grub_efi_uint32_t pixels_per_scanline;
};
struct grub_efi_gop_mode
{
grub_efi_uint32_t max_mode;
grub_efi_uint32_t mode;
struct grub_efi_gop_mode_info *info;
grub_efi_uintn_t info_size;
grub_efi_physical_address_t fb_base;
grub_efi_uintn_t fb_size;
};
/* Forward declaration. */
struct grub_efi_gop;
typedef grub_efi_status_t
(*grub_efi_gop_query_mode_t) (struct grub_efi_gop *this,
grub_efi_uint32_t mode_number,
grub_efi_uintn_t *size_of_info,
struct grub_efi_gop_mode_info **info);
typedef grub_efi_status_t
(*grub_efi_gop_set_mode_t) (struct grub_efi_gop *this,
grub_efi_uint32_t mode_number);
typedef grub_efi_status_t
(*grub_efi_gop_blt_t) (struct grub_efi_gop *this,
void *buffer,
grub_efi_uintn_t operation,
grub_efi_uintn_t sx,
grub_efi_uintn_t sy,
grub_efi_uintn_t dx,
grub_efi_uintn_t dy,
grub_efi_uintn_t width,
grub_efi_uintn_t height,
grub_efi_uintn_t delta);
struct grub_efi_gop
{
grub_efi_gop_query_mode_t query_mode;
grub_efi_gop_set_mode_t set_mode;
grub_efi_gop_blt_t blt;
struct grub_efi_gop_mode *mode;
};
#endif

View file

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

View file

@ -24,7 +24,13 @@
# include <libintl.h>
# define _(str) gettext(str)
#else
# define _(str) str
# define _(str) grub_gettext(str)
const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s);
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
#endif
#define N_(str) str
#endif /* GRUB_I18N_H */

View file

@ -19,7 +19,6 @@
#ifndef GRUB_CPU_AT_KEYBOARD_HEADER
#define GRUB_CPU_AT_KEYBOARD_HEADER 1
#include <grub/machine/machine.h>
#define SHIFT_L 0x2a
#define SHIFT_R 0x36

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 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_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_COREBOOT 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 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_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_EFI 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -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_halt (void);

View file

@ -1,24 +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/>.
*/
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_IEEE1275 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -19,7 +19,6 @@
#ifndef GRUB_KERNEL_CPU_HEADER
#define GRUB_KERNEL_CPU_HEADER 1
#include <grub/machine/machine.h>
#ifdef GRUB_MACHINE_IEEE1275
#define GRUB_MOD_ALIGN 0x1000

View file

@ -22,7 +22,6 @@
#include <grub/types.h>
#include <grub/err.h>
#include <grub/symbol.h>
#include <grub/machine/machine.h>
extern grub_addr_t EXPORT_VAR(grub_os_area_addr);
extern grub_size_t EXPORT_VAR(grub_os_area_size);

View file

@ -1,6 +1,7 @@
/* memory.h - describe the memory map */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 2002,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,9 +17,14 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#ifndef GRUB_MEMORY_CPU_HEADER
#define GRUB_MEMORY_CPU_HEADER 1
#define GRUB_MACHINE_PCBIOS 1
/* The flag for protected mode. */
#define GRUB_MEMORY_CPU_CR0_PE_ON 0x1
#define GRUB_MEMORY_CPU_CR4_PAE_ON 0x00000040
#define GRUB_MEMORY_CPU_CR0_PAGING_ON 0x80000000
#define GRUB_MEMORY_CPU_AMD64_MSR 0xc0000080
#define GRUB_MEMORY_CPU_AMD64_MSR_ON 0x00000100
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */
#endif /* ! GRUB_MEMORY_CPU_HEADER */

View file

@ -27,16 +27,9 @@ void grub_multiboot2_real_boot (grub_addr_t entry,
struct multiboot_info *mbi)
__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_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 */

View file

@ -39,13 +39,6 @@ grub_uint32_t EXPORT_FUNC(grub_get_mmap_entry) (struct grub_machine_mmap_entry *
/* Turn on/off Gate A20. */
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);
#endif /* ! GRUB_INIT_MACHINE_HEADER */

View file

@ -21,13 +21,14 @@
#define GRUB_MEMORY_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/machine/machine.h>
#ifndef ASM_FILE
#include <grub/types.h>
#include <grub/err.h>
#include <grub/memory.h>
#endif
#include <grub/i386/memory.h>
/* The scratch buffer used in real mode code. */
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
@ -63,9 +64,6 @@
/* The address where another boot loader is loaded. */
#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. */
#define GRUB_MEMORY_MACHINE_PROT_MODE_CSEG 0x8

View file

@ -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));
}
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 */

View file

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

View file

@ -16,9 +16,26 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#ifndef GRUB_RELOCATOR_CPU_HEADER
#define GRUB_RELOCATOR_CPU_HEADER 1
#define GRUB_MACHINE_QEMU 1
#include <grub/types.h>
#include <grub/err.h>
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */
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 */

View file

@ -20,6 +20,9 @@
#define GRUB_CPU_XNU_H 1
#include <grub/err.h>
#include <grub/cpu/relocator.h>
#define XNU_RELOCATOR(x) (grub_relocator32_ ## x)
#define GRUB_XNU_PAGESIZE 4096
typedef grub_uint32_t grub_xnu_ptr_t;
@ -75,6 +78,4 @@ 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);
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

View file

@ -1,7 +1,7 @@
/* misc.h - prototypes for misc functions */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009,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
@ -171,6 +171,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);
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_puts) (const char *s);
int EXPORT_FUNC(grub_puts_) (const char *s);
void EXPORT_FUNC(grub_real_dprintf) (const char *file,
const int line,
const char *condition,
@ -222,4 +225,15 @@ grub_div_roundup (unsigned int x, unsigned int 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 */

View file

@ -73,6 +73,7 @@
#define MAX_IDX (16384 >> BLK_SHR)
#define COM_LEN 4096
#define COM_LOG_LEN 12
#define COM_SEC (COM_LEN >> BLK_SHR)
#define AF_ALST 1
@ -164,7 +165,7 @@ struct grub_ntfs_comp
struct grub_ntfs_rlst
{
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;
struct grub_ntfs_attr *attr;
struct grub_ntfs_comp comp;

View file

@ -88,6 +88,7 @@ grub_err_t EXPORT_FUNC(grub_parser_execute) (char *source);
static inline void
grub_parser_register (const char *name __attribute__ ((unused)),
/* `name' is ignored here, but used by genhandlerlist.sh. */
grub_parser_t parser)
{
grub_handler_register (&grub_parser_class, GRUB_AS_HANDLER (parser));

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -36,15 +36,44 @@
#define GRUB_PCI_ADDR_IO_MASK ~0x03
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,
int function, int reg);
#ifdef GRUB_UTIL
#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);
#include <grub/cpu/pci.h>
#endif /* GRUB_PCI_H */

103
include/grub/pciutils.h Normal file
View 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 */

View file

@ -23,9 +23,6 @@
#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
configuration file are located. */
extern char grub_prefix[];

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 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_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_IEEE1275 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -54,9 +54,6 @@ extern grub_int32_t grub_total_module_size;
configuration file are located. */
extern char grub_prefix[];
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
#endif /* ! ASM_FILE */
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 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_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_IEEE1275 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -21,9 +21,14 @@
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/machine/time.h>
#include <grub/cpu/time.h>
#ifdef GRUB_MACHINE_EMU
#define GRUB_TICKS_PER_SECOND 100000
#else
#include <grub/machine/time.h>
#endif
void EXPORT_FUNC(grub_millisleep) (grub_uint32_t ms);
grub_uint64_t EXPORT_FUNC(grub_get_time_ms) (void);

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,6 +21,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.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,
FILE *out);
#ifndef HAVE_VASPRINTF
int vasprintf (char **buf, const char *fmt, va_list ap);
#endif
#ifndef HAVE_ASPRINTF
int asprintf (char **buf, const char *fmt, ...);
#endif
char *xasprintf (const char *fmt, ...);
#ifdef __MINGW32__
#define fseeko fseeko64
@ -76,4 +85,7 @@ grub_int64_t grub_util_get_disk_size (char *name);
#endif
char *make_system_path_relative_to_its_root (const char *path);
#endif /* ! GRUB_UTIL_MISC_HEADER */

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 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_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_EFI 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -0,0 +1 @@
#include <grub/i386/relocator.h>

View file

@ -92,6 +92,7 @@ struct grub_xnu_devtree_key *grub_xnu_create_value (struct grub_xnu_devtree_key
void grub_xnu_lock (void);
void grub_xnu_unlock (void);
grub_err_t grub_xnu_resume (char *imagename);
grub_err_t grub_xnu_boot_resume (void);
struct grub_xnu_devtree_key *grub_xnu_find_key (struct grub_xnu_devtree_key *parent,
char *name);
grub_err_t grub_xnu_align_heap (int align);
@ -100,8 +101,7 @@ grub_err_t grub_xnu_scan_dir_for_kexts (char *dirname, char *osbundlerequired,
grub_err_t grub_xnu_load_kext_from_dir (char *dirname, char *osbundlerequired,
int maxrecursion);
void *grub_xnu_heap_malloc (int size);
extern grub_uint32_t grub_xnu_heap_real_start;
extern grub_size_t grub_xnu_heap_size;
extern char *grub_xnu_heap_start;
extern void *grub_xnu_heap_start;
extern struct grub_video_bitmap *grub_xnu_bitmap;
#endif

View file

@ -1,519 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2006-12-25.00
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -109,6 +109,8 @@ grub_device_iterate (int (*hook) (const char *name))
(void) grub_partition_iterate (dev->disk, iterate_partition);
grub_device_close (dev);
grub_errno = GRUB_ERR_NONE;
p = ents;
while (p != NULL)
{

View file

@ -31,7 +31,6 @@
#include <grub/file.h>
#include <grub/env.h>
#include <grub/cache.h>
#include <grub/machine/machine.h>
/* Platforms where modules are in a readonly area of memory. */
#if defined(GRUB_MACHINE_QEMU)

View file

@ -23,7 +23,6 @@
#include <grub/machine/memory.h>
#include <grub/machine/console.h>
#include <grub/machine/kernel.h>
#include <grub/machine/machine.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/dl.h>

View file

@ -17,7 +17,6 @@
*/
#include <grub/cpu/io.h>
#include <grub/cpu/halt.h>
#include <grub/machine/init.h>
#include <grub/misc.h>

View file

@ -146,6 +146,9 @@ multiboot_entry:
/* obtain the boot device */
movl 12(%ebx), %edx
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %ebp
movl %ebp, %esp
/* relocate the code */
movl $(GRUB_KERNEL_MACHINE_RAW_SIZE + 0x200), %ecx
addl EXT_C(grub_compressed_size) - _start + 0x100000 + 0x200, %ecx
@ -484,21 +487,6 @@ FUNCTION(grub_exit)
jmp cold_reboot
.code32
/*
* grub_reboot()
*
* Reboot the system. At the moment, rely on BIOS.
*/
FUNCTION(grub_reboot)
call prot_to_real
.code16
cold_reboot:
/* cold boot */
movw $0x0472, %di
movw %ax, (%di)
ljmp $0xFFFF, $0x0000
.code32
/*
* grub_halt(int no_apm)
*

View file

@ -95,3 +95,5 @@ codestart:
/* This should never happen. */
jmp EXT_C(grub_stop)
#include "../realmode.S"

View file

@ -127,7 +127,7 @@ real_to_prot:
/* turn on protected mode */
movl %cr0, %eax
orl $GRUB_MEMORY_MACHINE_CR0_PE_ON, %eax
orl $GRUB_MEMORY_CPU_CR0_PE_ON, %eax
movl %eax, %cr0
/* jump to relocation, flush prefetch queue, and reload %cs */
@ -196,7 +196,7 @@ tmpcseg:
/* clear the PE bit of CR0 */
movl %cr0, %eax
andl $(~GRUB_MEMORY_MACHINE_CR0_PE_ON), %eax
andl $(~GRUB_MEMORY_CPU_CR0_PE_ON), %eax
movl %eax, %cr0
/* flush prefetch queue, reload %cs */
@ -215,10 +215,27 @@ realcseg:
movw %ax, %gs
movw %ax, %ss
#ifdef GRUB_MACHINE_PCBIOS
/* restore interrupts */
sti
#endif
/* return on new stack! */
DATA32 ret
.code32
/*
* grub_reboot()
*
* Reboot the system. At the moment, rely on BIOS.
*/
FUNCTION(grub_reboot)
call prot_to_real
.code16
cold_reboot:
/* set 0x472 to 0x0000 for cold boot (0x1234 for warm boot) */
movw $0x0472, %di
movw %ax, (%di)
ljmp $0xf000, $0xfff0
.code32

View file

@ -1,32 +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/>.
*/
#include <grub/cpu/io.h>
#include <grub/cpu/at_keyboard.h>
#include <grub/cpu/reboot.h>
#include <grub/misc.h>
void
grub_reboot (void)
{
/* Use the keyboard controller to reboot. That's what keyboards were
designed for, isn't it? */
grub_outb (KEYBOARD_COMMAND_REBOOT, KEYBOARD_REG_STATUS);
grub_printf ("GRUB doesn't know how to reboot this machine yet!\n");
}

View file

@ -1,7 +1,7 @@
/* openfw.c -- Open firmware support functions. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -399,11 +399,14 @@ grub_ieee1275_encode_devname (const char *path)
return encoding;
}
/* On i386, a firmware-independant grub_reboot() is provided by realmode.S. */
#ifndef __i386__
void
grub_reboot (void)
{
grub_ieee1275_interpret ("reset-all", 0);
}
#endif
void
grub_halt (void)

View file

@ -23,6 +23,7 @@
#include <stdarg.h>
#include <grub/term.h>
#include <grub/env.h>
#include <grub/i18n.h>
static int
grub_iswordseparator (int c)
@ -30,6 +31,15 @@ grub_iswordseparator (int c)
return (grub_isspace (c) || c == ',' || c == ';' || c == '|' || c == '&');
}
/* grub_gettext_dummy is not translating anything. */
const char *
grub_gettext_dummy (const char *s)
{
return s;
}
const char* (*grub_gettext) (const char *s) = grub_gettext_dummy;
void *
grub_memmove (void *dest, const void *src, grub_size_t n)
{
@ -116,6 +126,38 @@ grub_printf (const char *fmt, ...)
return ret;
}
int
grub_printf_ (const char *fmt, ...)
{
va_list ap;
int ret;
va_start (ap, fmt);
ret = grub_vprintf (_(fmt), ap);
va_end (ap);
return ret;
}
int
grub_puts (const char *s)
{
while (*s)
{
grub_putchar (*s);
s++;
}
grub_putchar ('\n');
return 1; /* Cannot fail. */
}
int
grub_puts_ (const char *s)
{
return grub_puts (_(s));
}
#if defined (APPLE_CC) && ! defined (GRUB_UTIL)
int
grub_err_printf (const char *fmt, ...)

View file

@ -355,7 +355,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
{
char *tail;
grub_strtoul (option, &tail, 0);
grub_strtoull (option, &tail, 0);
if (tail == 0 || tail == option || *tail != '\0' || grub_errno)
{
grub_error (GRUB_ERR_BAD_ARGUMENT,

102
lib/i386/relocator.c Normal file
View file

@ -0,0 +1,102 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/types.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/i386/relocator.h>
extern grub_uint8_t grub_relocator32_forward_start;
extern grub_uint8_t grub_relocator32_forward_end;
extern grub_uint8_t grub_relocator32_backward_start;
extern grub_uint8_t grub_relocator32_backward_end;
extern grub_uint32_t grub_relocator32_backward_dest;
extern grub_uint32_t grub_relocator32_backward_size;
extern grub_addr_t grub_relocator32_backward_src;
extern grub_uint32_t grub_relocator32_forward_dest;
extern grub_uint32_t grub_relocator32_forward_size;
extern grub_addr_t grub_relocator32_forward_src;
extern grub_uint32_t grub_relocator32_forward_eax;
extern grub_uint32_t grub_relocator32_forward_ebx;
extern grub_uint32_t grub_relocator32_forward_ecx;
extern grub_uint32_t grub_relocator32_forward_edx;
extern grub_uint32_t grub_relocator32_forward_eip;
extern grub_uint32_t grub_relocator32_forward_esp;
extern grub_uint32_t grub_relocator32_backward_eax;
extern grub_uint32_t grub_relocator32_backward_ebx;
extern grub_uint32_t grub_relocator32_backward_ecx;
extern grub_uint32_t grub_relocator32_backward_edx;
extern grub_uint32_t grub_relocator32_backward_eip;
extern grub_uint32_t grub_relocator32_backward_esp;
#define RELOCATOR_SIZEOF(x) (&grub_relocator32_##x##_end - &grub_relocator32_##x##_start)
#define RELOCATOR_ALIGN 16
#define PREFIX(x) grub_relocator32_ ## x
static void
write_call_relocator_bw (void *ptr, void *src, grub_uint32_t dest,
grub_size_t size, struct grub_relocator32_state state)
{
grub_relocator32_backward_dest = dest;
grub_relocator32_backward_src = PTR_TO_UINT64 (src);
grub_relocator32_backward_size = size;
grub_relocator32_backward_eax = state.eax;
grub_relocator32_backward_ebx = state.ebx;
grub_relocator32_backward_ecx = state.ecx;
grub_relocator32_backward_edx = state.edx;
grub_relocator32_backward_eip = state.eip;
grub_relocator32_backward_esp = state.esp;
grub_memmove (ptr,
&grub_relocator32_backward_start,
RELOCATOR_SIZEOF (backward));
((void (*) (void)) ptr) ();
}
static void
write_call_relocator_fw (void *ptr, void *src, grub_uint32_t dest,
grub_size_t size, struct grub_relocator32_state state)
{
grub_relocator32_forward_dest = dest;
grub_relocator32_forward_src = PTR_TO_UINT64 (src);
grub_relocator32_forward_size = size;
grub_relocator32_forward_eax = state.eax;
grub_relocator32_forward_ebx = state.ebx;
grub_relocator32_forward_ecx = state.ecx;
grub_relocator32_forward_edx = state.edx;
grub_relocator32_forward_eip = state.eip;
grub_relocator32_forward_esp = state.esp;
grub_memmove (ptr,
&grub_relocator32_forward_start,
RELOCATOR_SIZEOF (forward));
((void (*) (void)) ptr) ();
}
#include "../relocator.c"

248
lib/i386/relocator_asm.S Normal file
View file

@ -0,0 +1,248 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/symbol.h>
#include <grub/i386/memory.h>
#ifdef BACKWARD
#define RELOCATOR_VARIABLE(x) VARIABLE(grub_relocator32_backward_ ## x)
#else
#define RELOCATOR_VARIABLE(x) VARIABLE(grub_relocator32_forward_ ## x)
#endif
#ifdef __x86_64__
#define RAX %rax
#define RCX %rcx
#define RDI %rdi
#define RSI %rdi
#else
#define RAX %eax
#define RCX %ecx
#define RDI %edi
#define RSI %esi
#endif
/* The code segment of the protected mode. */
#define CODE_SEGMENT 0x10
/* The data segment of the protected mode. */
#define DATA_SEGMENT 0x18
.p2align 4 /* force 16-byte alignment */
RELOCATOR_VARIABLE(start)
#ifdef BACKWARD
LOCAL(base):
#endif
cli
#ifndef __x86_64__
/* mov imm32, %eax */
.byte 0xb8
RELOCATOR_VARIABLE(dest)
.long 0
movl %eax, %edi
/* mov imm32, %eax */
.byte 0xb8
RELOCATOR_VARIABLE(src)
.long 0
movl %eax, %esi
/* mov imm32, %ecx */
.byte 0xb9
RELOCATOR_VARIABLE(size)
.long 0
#else
xorq %rax, %rax
/* mov imm32, %eax */
.byte 0xb8
RELOCATOR_VARIABLE(dest)
.long 0
movq %rax, %rdi
/* mov imm64, %rax */
.byte 0x48
.byte 0xb8
RELOCATOR_VARIABLE(src)
.long 0, 0
movq %rax, %rsi
xorq %rcx, %rcx
/* mov imm32, %ecx */
.byte 0xb9
RELOCATOR_VARIABLE(size)
.long 0
#endif
mov RDI, RAX
#ifdef BACKWARD
add RCX, RSI
add RCX, RDI
#endif
#ifndef BACKWARD
add RCX, RAX
#endif
add $0x3, RCX
shr $2, RCX
#ifdef BACKWARD
/* Backward movsl is implicitly off-by-four. compensate that. */
sub $4, RSI
sub $4, RDI
/* Backward copy. */
std
rep
movsl
#else
/* Forward copy. */
cld
rep
movsl
#endif
/* %rax contains now our new 'base'. */
mov RAX, RSI
add $(LOCAL(cont0) - LOCAL(base)), RAX
jmp *RAX
LOCAL(cont0):
lea (LOCAL(cont1) - LOCAL(base)) (RSI, 1), RAX
movl %eax, (LOCAL(jump_vector) - LOCAL(base)) (RSI, 1)
lea (LOCAL(gdt) - LOCAL(base)) (RSI, 1), RAX
mov RAX, (LOCAL(gdt_addr) - LOCAL(base)) (RSI, 1)
/* Switch to compatibility mode. */
lgdt (LOCAL(gdtdesc) - LOCAL(base)) (RSI, 1)
/* Update %cs. */
ljmp *(LOCAL(jump_vector) - LOCAL(base)) (RSI, 1)
LOCAL(cont1):
.code32
/* Update other registers. */
movl $DATA_SEGMENT, %eax
movl %eax, %ds
movl %eax, %es
movl %eax, %fs
movl %eax, %gs
movl %eax, %ss
/* Disable paging. */
movl %cr0, %eax
andl $(~GRUB_MEMORY_CPU_CR0_PAGING_ON), %eax
movl %eax, %cr0
/* Disable amd64. */
movl $GRUB_MEMORY_CPU_AMD64_MSR, %ecx
rdmsr
andl $(~GRUB_MEMORY_CPU_AMD64_MSR_ON), %eax
wrmsr
/* Turn off PAE. */
movl %cr4, %eax
andl $GRUB_MEMORY_CPU_CR4_PAE_ON, %eax
movl %eax, %cr4
jmp LOCAL(cont2)
LOCAL(cont2):
.code32
/* mov imm32, %eax */
.byte 0xb8
RELOCATOR_VARIABLE (esp)
.long 0
movl %eax, %esp
/* mov imm32, %eax */
.byte 0xb8
RELOCATOR_VARIABLE (eax)
.long 0
/* mov imm32, %ebx */
.byte 0xbb
RELOCATOR_VARIABLE (ebx)
.long 0
/* mov imm32, %ecx */
.byte 0xb9
RELOCATOR_VARIABLE (ecx)
.long 0
/* mov imm32, %edx */
.byte 0xba
RELOCATOR_VARIABLE (edx)
.long 0
/* Cleared direction flag is of no problem with any current
payload and makes this implementation easier. */
cld
.byte 0xea
RELOCATOR_VARIABLE (eip)
.long 0
.word CODE_SEGMENT
/* GDT. Copied from loader/i386/linux.c. */
.p2align 4
LOCAL(gdt):
/* NULL. */
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
/* Reserved. */
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
/* Code segment. */
.byte 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x9A, 0xCF, 0x00
/* Data segment. */
.byte 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x92, 0xCF, 0x00
.p2align 4
LOCAL(gdtdesc):
.word 0x27
LOCAL(gdt_addr):
#ifdef __x86_64__
/* Filled by the code. */
.quad 0
#else
/* Filled by the code. */
.long 0
#endif
.p2align 4
LOCAL(jump_vector):
/* Jump location. Is filled by the code */
.long 0
.long CODE_SEGMENT
#ifndef BACKWARD
LOCAL(base):
#endif
RELOCATOR_VARIABLE(end)

View file

@ -0,0 +1,2 @@
#define BACKWARD
#include "relocator_asm.S"

109
lib/mips/relocator.c Normal file
View file

@ -0,0 +1,109 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/types.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/cache.h>
#include <grub/mips/relocator.h>
/* Remark: doesn't work with source outside of 4G.
Use relocator64 in this case.
*/
extern grub_uint8_t grub_relocator32_forward_start;
extern grub_uint8_t grub_relocator32_forward_end;
extern grub_uint8_t grub_relocator32_backward_start;
extern grub_uint8_t grub_relocator32_backward_end;
#define REGW_SIZEOF (2 * sizeof (grub_uint32_t))
#define JUMP_SIZEOF (sizeof (grub_uint32_t))
#define RELOCATOR_SRC_SIZEOF(x) (&grub_relocator32_##x##_end \
- &grub_relocator32_##x##_start)
#define RELOCATOR_SIZEOF(x) (RELOCATOR_SRC_SIZEOF(x) \
+ REGW_SIZEOF * (31 + 3) + JUMP_SIZEOF)
#define RELOCATOR_ALIGN 16
#define PREFIX(x) grub_relocator32_ ## x
static void
write_reg (int regn, grub_uint32_t val, void **target)
{
/* lui $r, (val+0x8000). */
*(grub_uint32_t *) *target = ((0x3c00 | regn) << 16) | ((val + 0x8000) >> 16);
*target = ((grub_uint32_t *) *target) + 1;
/* addiu $r, $r, val. */
*(grub_uint32_t *) *target = (((0x2400 | regn << 5 | regn) << 16)
| (val & 0xffff));
*target = ((grub_uint32_t *) *target) + 1;
}
static void
write_jump (int regn, void **target)
{
/* j $r. */
*(grub_uint32_t *) *target = (regn<<21) | 0x8;
*target = ((grub_uint32_t *) *target) + 1;
}
static void
write_call_relocator_bw (void *ptr0, void *src, grub_uint32_t dest,
grub_size_t size, struct grub_relocator32_state state)
{
void *ptr = ptr0;
int i;
write_reg (8, (grub_uint32_t) src, &ptr);
write_reg (9, dest, &ptr);
write_reg (10, size, &ptr);
grub_memcpy (ptr, &grub_relocator32_backward_start,
RELOCATOR_SRC_SIZEOF (backward));
ptr = (grub_uint8_t *) ptr + RELOCATOR_SRC_SIZEOF (backward);
for (i = 1; i < 32; i++)
write_reg (i, state.gpr[i], &ptr);
write_jump (state.jumpreg, &ptr);
grub_arch_sync_caches (ptr0, (grub_uint8_t *) ptr - (grub_uint8_t *) ptr0);
grub_dprintf ("relocator", "Backward relocator: about to jump to %p\n", ptr0);
((void (*) (void)) ptr0) ();
}
static void
write_call_relocator_fw (void *ptr0, void *src, grub_uint32_t dest,
grub_size_t size, struct grub_relocator32_state state)
{
void *ptr = ptr0;
int i;
write_reg (8, (grub_uint32_t) src, &ptr);
write_reg (9, dest, &ptr);
write_reg (10, size, &ptr);
grub_memcpy (ptr, &grub_relocator32_forward_start,
RELOCATOR_SRC_SIZEOF (forward));
ptr = (grub_uint8_t *) ptr + RELOCATOR_SRC_SIZEOF (forward);
for (i = 1; i < 32; i++)
write_reg (i, state.gpr[i], &ptr);
write_jump (state.jumpreg, &ptr);
grub_arch_sync_caches (ptr0, (grub_uint8_t *) ptr - (grub_uint8_t *) ptr0);
grub_dprintf ("relocator", "Forward relocator: about to jump to %p\n", ptr0);
((void (*) (void)) ptr0) ();
}
#include "../relocator.c"

93
lib/mips/relocator_asm.S Normal file
View file

@ -0,0 +1,93 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/symbol.h>
.p2align 4 /* force 16-byte alignment */
VARIABLE (grub_relocator32_forward_start)
move $12, $9
move $13, $10
copycont1:
lb $11,0($8)
sb $11,0($9)
addiu $8, $8, 0x1
addiu $9, $9, 0x1
addiu $10, $10, 0xffff
bne $10, $0, copycont1
move $9, $12
move $10, $13
cachecont1a:
cache 1,0($12)
addiu $12, $12, 0x1
addiu $13, $13, 0xffff
bne $13, $0, cachecont1a
sync
move $12, $9
move $13, $10
cachecont1b:
cache 0,0($12)
addiu $12, $12, 0x1
addiu $13, $13, 0xffff
bne $13, $0, cachecont1b
sync
VARIABLE (grub_relocator32_forward_end)
VARIABLE (grub_relocator32_backward_start)
move $12, $9
move $13, $10
addu $9, $9, $10
addu $8, $8, $10
/* Backward movsl is implicitly off-by-one. compensate that. */
addiu $9, $9, 0xffff
addiu $8, $8, 0xffff
copycont2:
lb $11,0($8)
sb $11,0($9)
addiu $8, $8, 0xffff
addiu $9, $9, 0xffff
addiu $10, 0xffff
bne $10, $0, copycont2
move $9, $12
move $10, $13
cachecont2a:
cache 1,0($12)
addiu $12, $12, 0x1
addiu $13, $13, 0xffff
bne $13, $0, cachecont2a
sync
move $12, $9
move $13, $10
cachecont2b:
cache 0,0($12)
addiu $12, $12, 0x1
addiu $13, $13, 0xffff
bne $13, $0, cachecont2b
sync
VARIABLE (grub_relocator32_backward_end)

137
lib/relocator.c Normal file
View file

@ -0,0 +1,137 @@
/*
* 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/>.
*/
#define MAX_OVERHEAD ((RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN) \
+ (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN) \
+ (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN) \
+ (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN))
#define PRE_REGION_SIZE (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN)
void *
PREFIX (alloc) (grub_size_t size)
{
char *playground;
playground = grub_malloc (size + MAX_OVERHEAD);
if (!playground)
return 0;
*(grub_size_t *) playground = size;
return playground + PRE_REGION_SIZE;
}
void *
PREFIX (realloc) (void *relocator, grub_size_t size)
{
char *playground;
if (!relocator)
return PREFIX (alloc) (size);
playground = (char *) relocator - PRE_REGION_SIZE;
playground = grub_realloc (playground, size + MAX_OVERHEAD);
if (!playground)
return 0;
*(grub_size_t *) playground = size;
return playground + PRE_REGION_SIZE;
}
void
PREFIX(free) (void *relocator)
{
if (relocator)
grub_free ((char *) relocator - PRE_REGION_SIZE);
}
grub_err_t
PREFIX (boot) (void *relocator, grub_uint32_t dest,
struct grub_relocator32_state state)
{
grub_size_t size;
char *playground;
playground = (char *) relocator - PRE_REGION_SIZE;
size = *(grub_size_t *) playground;
grub_dprintf ("relocator",
"Relocator: source: %p, destination: 0x%x, size: 0x%lx\n",
relocator, (unsigned) dest, (unsigned long) size);
/* Very unlikely condition: Relocator may risk overwrite itself.
Just move it a bit up. */
if ((grub_addr_t) dest < (grub_addr_t) relocator
+ (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN)
&& (grub_addr_t) dest + (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN)
> (grub_addr_t) relocator)
{
void *relocator_new = ((grub_uint8_t *) relocator)
+ (RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN)
+ (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN);
grub_dprintf ("relocator", "Overwrite condition detected moving "
"relocator from %p to %p\n", relocator, relocator_new);
grub_memmove (relocator_new, relocator,
(RELOCATOR_SIZEOF (forward) + RELOCATOR_ALIGN)
+ size
+ (RELOCATOR_SIZEOF (backward) + RELOCATOR_ALIGN));
relocator = relocator_new;
}
if ((grub_addr_t) dest >= (grub_addr_t) relocator)
{
int overhead;
overhead = dest -
ALIGN_UP (dest - RELOCATOR_SIZEOF (backward) - RELOCATOR_ALIGN,
RELOCATOR_ALIGN);
grub_dprintf ("relocator",
"Backward relocator: code %p, source: %p, "
"destination: 0x%x, size: 0x%lx\n",
(char *) relocator - overhead,
(char *) relocator - overhead,
(unsigned) dest - overhead,
(unsigned long) size + overhead);
write_call_relocator_bw ((char *) relocator - overhead,
(char *) relocator - overhead,
dest - overhead, size + overhead, state);
}
else
{
int overhead;
overhead = ALIGN_UP (dest + size, RELOCATOR_ALIGN)
+ RELOCATOR_SIZEOF (forward) - (dest + size);
grub_dprintf ("relocator",
"Forward relocator: code %p, source: %p, "
"destination: 0x%x, size: 0x%lx\n",
(char *) relocator + size + overhead
- RELOCATOR_SIZEOF (forward),
relocator, (unsigned) dest,
(unsigned long) size + overhead);
write_call_relocator_fw ((char *) relocator + size + overhead
- RELOCATOR_SIZEOF (forward),
relocator, dest, size + overhead, state);
}
/* Not reached. */
return GRUB_ERR_NONE;
}

View file

@ -23,7 +23,6 @@
#include <grub/machine/init.h>
#include <grub/machine/memory.h>
#include <grub/memory.h>
#include <grub/machine/machine.h>
#include <grub/file.h>
#include <grub/err.h>
#include <grub/dl.h>

View file

@ -469,21 +469,22 @@ find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
{
int found = 0;
auto int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
grub_pci_id_t pciid);
int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
grub_pci_id_t pciid)
{
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 (addr) >> 24 == 0x3)
{
int i;
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n",
bus, dev, func, pciid);
grub_pci_get_bus (dev), grub_pci_get_device (dev),
grub_pci_get_function (dev), pciid);
addr += 8;
for (i = 0; i < 6; i++, addr += 4)
{

View file

@ -71,21 +71,22 @@ find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
{
int found = 0;
auto int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
grub_pci_id_t pciid);
int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
grub_pci_id_t pciid)
{
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 (addr) >> 24 == 0x3)
{
int i;
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n",
bus, dev, func, pciid);
grub_pci_get_bus (dev), grub_pci_get_device (dev),
grub_pci_get_function (dev), pciid);
addr += 8;
for (i = 0; i < 6; i++, addr += 4)
{

View file

@ -17,7 +17,6 @@
*/
#include <grub/loader.h>
#include <grub/machine/machine.h>
#include <grub/machine/memory.h>
#include <grub/machine/loader.h>
#include <grub/normal.h>

View file

@ -48,18 +48,36 @@
#include <grub/device.h>
#include <grub/partition.h>
#endif
#include <grub/i386/relocator.h>
extern grub_dl_t my_mod;
static struct multiboot_info *mbi, *mbi_dest;
static grub_addr_t entry;
static char *playground = 0;
static grub_size_t code_size;
char *grub_multiboot_payload_orig;
grub_addr_t grub_multiboot_payload_dest;
grub_size_t grub_multiboot_payload_size;
grub_uint32_t grub_multiboot_payload_eip;
static grub_err_t
grub_multiboot_boot (void)
{
grub_multiboot_real_boot (entry, mbi_dest);
struct grub_relocator32_state state =
{
.eax = MULTIBOOT_MAGIC2,
.ebx = PTR_TO_UINT32 (mbi_dest),
.ecx = 0,
.edx = 0,
.eip = grub_multiboot_payload_eip,
/* Set esp to some random location in low memory to avoid breaking
non-compliant kernels. */
.esp = 0x7ff00
};
grub_relocator32_boot (grub_multiboot_payload_orig,
grub_multiboot_payload_dest,
state);
/* Not reached. */
return GRUB_ERR_NONE;
@ -68,7 +86,7 @@ grub_multiboot_boot (void)
static grub_err_t
grub_multiboot_unload (void)
{
if (playground)
if (mbi)
{
unsigned int i;
for (i = 0; i < mbi->mods_count; i++)
@ -79,11 +97,11 @@ grub_multiboot_unload (void)
((struct multiboot_mod_list *) mbi->mods_addr)[i].cmdline);
}
grub_free ((void *) mbi->mods_addr);
grub_free (playground);
}
grub_relocator32_free (grub_multiboot_payload_orig);
mbi = NULL;
playground = NULL;
grub_multiboot_payload_orig = NULL;
grub_dl_unref (my_mod);
return GRUB_ERR_NONE;
@ -250,11 +268,8 @@ grub_multiboot (int argc, char *argv[])
goto fail;
}
if (playground)
{
grub_free (playground);
playground = NULL;
}
grub_relocator32_free (grub_multiboot_payload_orig);
grub_multiboot_payload_orig = NULL;
mmap_length = grub_get_multiboot_mmap_len ();
@ -296,13 +311,14 @@ grub_multiboot (int argc, char *argv[])
grub_multiboot_payload_dest = header->load_addr;
grub_multiboot_payload_size += code_size;
playground = grub_malloc (RELOCATOR_SIZEOF(forward) + grub_multiboot_payload_size + RELOCATOR_SIZEOF(backward));
if (! playground)
grub_multiboot_payload_orig
= grub_relocator32_alloc (grub_multiboot_payload_size);
if (! grub_multiboot_payload_orig)
goto fail;
grub_multiboot_payload_orig = (long) playground + RELOCATOR_SIZEOF(forward);
if ((grub_file_seek (file, offset)) == (grub_off_t) - 1)
if ((grub_file_seek (file, offset)) == (grub_off_t) -1)
goto fail;
grub_file_read (file, (void *) grub_multiboot_payload_orig, load_size);
@ -313,7 +329,7 @@ grub_multiboot (int argc, char *argv[])
grub_memset ((void *) (grub_multiboot_payload_orig + load_size), 0,
header->bss_end_addr - header->load_addr - load_size);
grub_multiboot_payload_entry_offset = header->entry_addr - header->load_addr;
grub_multiboot_payload_eip = header->entry_addr;
}
else if (grub_multiboot_load_elf (file, buffer) != GRUB_ERR_NONE)
@ -334,23 +350,6 @@ grub_multiboot (int argc, char *argv[])
mbi->mmap_addr = (grub_uint32_t) mmap_addr (grub_multiboot_payload_dest);
mbi->flags |= MULTIBOOT_INFO_MEM_MAP;
if (grub_multiboot_payload_dest >= grub_multiboot_payload_orig)
{
grub_memmove (playground, &grub_multiboot_forward_relocator, RELOCATOR_SIZEOF(forward));
entry = (grub_addr_t) playground;
}
else
{
grub_memmove ((char *) (grub_multiboot_payload_orig + grub_multiboot_payload_size),
&grub_multiboot_backward_relocator, RELOCATOR_SIZEOF(backward));
entry = (grub_addr_t) grub_multiboot_payload_orig + grub_multiboot_payload_size;
}
grub_dprintf ("multiboot_loader", "dest=%p, size=0x%x, entry_offset=0x%x\n",
(void *) grub_multiboot_payload_dest,
grub_multiboot_payload_size,
grub_multiboot_payload_entry_offset);
/* Convert from bytes to kilobytes. */
mbi->mem_lower = grub_mmap_get_lower () / 1024;
mbi->mem_upper = grub_mmap_get_upper () / 1024;

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