Merge from trunk

This commit is contained in:
Robert Millan 2009-12-11 21:20:00 +00:00
commit dfec2d96f9
89 changed files with 1963 additions and 3765 deletions

427
ChangeLog
View file

@ -1,3 +1,418 @@
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> 2009-11-25 Yves Blusseau <yves.blusseau@zetam.org>
* configure.ac: move the call to AM_GNU_GETTEXT to avoid warnings when * configure.ac: move the call to AM_GNU_GETTEXT to avoid warnings when
@ -104,6 +519,8 @@
* normal/menu_text.c: Include <grub/i18n.h>. * normal/menu_text.c: Include <grub/i18n.h>.
* normal/menu_text.c (print_timeout): Gettexttize string. * normal/menu_text.c (print_timeout): Gettexttize string.
* normal/menu_text.c (print_message): 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 * util/grub.d/00_header.in: Define locale_dir and lang. insmod
gettext module and defines locale_dir and lang in grub.cfg. gettext module and defines locale_dir and lang in grub.cfg.
* NEWS: Add gettext support. * NEWS: Add gettext support.
@ -306,6 +723,8 @@
* Makefile.in (po/*.po): Redefine as ... * Makefile.in (po/*.po): Redefine as ...
($(foreach lang, $(LINGUAS), po/$(lang).po)): ... this. ($(foreach lang, $(LINGUAS), po/$(lang).po)): ... this.
* po/POTFILES: Add `util/i386/pc/grub-setup.c'.
2009-11-19 Robert Millan <rmh.grub@aybabtu.com> 2009-11-19 Robert Millan <rmh.grub@aybabtu.com>
* conf/common.rmk (grub_mkisofs_SOURCES): Add `gnulib/progname.c'. * conf/common.rmk (grub_mkisofs_SOURCES): Add `gnulib/progname.c'.
@ -324,6 +743,8 @@
* util/mkisofs/tree.c: Likewise. * util/mkisofs/tree.c: Likewise.
* util/mkisofs/write.c: Likewise. * util/mkisofs/write.c: Likewise.
* po/POTFILES: Update with new files.
2009-11-18 Robert Millan <rmh.grub@aybabtu.com> 2009-11-18 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/eltorito.c: Fix minor mistake in license text. * util/mkisofs/eltorito.c: Fix minor mistake in license text.
@ -351,6 +772,8 @@
2009-11-18 Robert Millan <rmh.grub@aybabtu.com> 2009-11-18 Robert Millan <rmh.grub@aybabtu.com>
* po/POTFILES-shell: New file. List `util/grub.d/10_kfreebsd.in'
and `util/grub.d/10_linux.in'.
* Makefile.in (po/$(PACKAGE).pot): Process `po/POTFILES-shell' for * Makefile.in (po/$(PACKAGE).pot): Process `po/POTFILES-shell' for
translatable Shell files. translatable Shell files.
@ -361,6 +784,7 @@
2009-11-17 Robert Millan <rmh.grub@aybabtu.com> 2009-11-17 Robert Millan <rmh.grub@aybabtu.com>
* INSTALL: Document Automake is needed for bootstrap. * INSTALL: Document Automake is needed for bootstrap.
* po/ca.po: Fix PO-Revision-Date and Language-Team fields.
* util/grub.d/10_kfreebsd.in (bindir): New variable. * util/grub.d/10_kfreebsd.in (bindir): New variable.
Add gettext initialization. Add gettext initialization.
(kfreebsd_entry): Make menuentry output translatable. (kfreebsd_entry): Make menuentry output translatable.
@ -372,6 +796,7 @@
(po/*.po): Replace `msgmerge' with `$(MSGMERGE)'. (po/*.po): Replace `msgmerge' with `$(MSGMERGE)'.
(po/%.mo): Replace `msgfmt' with `$(MSGFMT)'. (po/%.mo): Replace `msgfmt' with `$(MSGFMT)'.
(LINGUAS): Auto-generate using `po/LINGUAS'. (LINGUAS): Auto-generate using `po/LINGUAS'.
* po/LINGUAS: New file.
2009-11-17 Robert Millan <rmh.grub@aybabtu.com> 2009-11-17 Robert Millan <rmh.grub@aybabtu.com>
@ -411,6 +836,8 @@
(install-local): Install MO files. (install-local): Install MO files.
(po/$(PACKAGE).pot, po/*.po, po/%.mo): New rules. (po/$(PACKAGE).pot, po/*.po, po/%.mo): New rules.
* include/grub/i18n.h: New file. * include/grub/i18n.h: New file.
* po/POTFILES: New file.
* po/ca.po: New file.
* util/grub.d/10_linux.in (bindir): New variable. * util/grub.d/10_linux.in (bindir): New variable.
Add gettext initialization. Add gettext initialization.
(linux_entry): Make menuentry output translatable. (linux_entry): Make menuentry output translatable.

View file

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

View file

@ -45,7 +45,9 @@ XGETTEXT = @XGETTEXT@
MSGMERGE = @MSGMERGE@ MSGMERGE = @MSGMERGE@
MSGFMT = @MSGFMT@ 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 = @PACKAGE@
PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_NAME = @PACKAGE_NAME@
@ -107,11 +109,13 @@ endif
AWK = @AWK@ AWK = @AWK@
LIBCURSES = @LIBCURSES@ LIBCURSES = @LIBCURSES@
LIBUSB = @LIBUSB@ LIBUSB = @LIBUSB@
LIBPCIACCESS = @LIBPCIACCESS@
YACC = @YACC@ YACC = @YACC@
FONT_SOURCE = @FONT_SOURCE@ FONT_SOURCE = @FONT_SOURCE@
# Options. # Options.
enable_grub_emu_usb = @enable_grub_emu_usb@ enable_grub_emu_usb = @enable_grub_emu_usb@
enable_grub_emu_pci = @enable_grub_emu_pci@
enable_grub_fstest = @enable_grub_fstest@ enable_grub_fstest = @enable_grub_fstest@
enable_grub_pe2elf = @enable_grub_pe2elf@ enable_grub_pe2elf = @enable_grub_pe2elf@
enable_grub_mkfont = @enable_grub_mkfont@ enable_grub_mkfont = @enable_grub_mkfont@
@ -137,7 +141,9 @@ CLEANFILES =
MOSTLYCLEANFILES = MOSTLYCLEANFILES =
DISTCLEANFILES = config.status config.cache config.log config.h \ DISTCLEANFILES = config.status config.cache config.log config.h \
Makefile stamp-h include/grub/cpu include/grub/machine \ Makefile stamp-h include/grub/cpu include/grub/machine \
gensymlist.sh genkernsyms.sh build_env.mk gensymlist.sh genkernsyms.sh build_env.mk \
docs/grub.info docs/version.texi docs/stamp-vti
MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) \ MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) \
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS) $(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS)

View file

@ -21,41 +21,40 @@
#include <grub/pci.h> #include <grub/pci.h>
grub_pci_address_t grub_pci_address_t
grub_pci_make_address (int bus, int device, int function, int reg) grub_pci_make_address (grub_pci_device_t dev, int reg)
{ {
return (1 << 31) | (bus << 16) | (device << 11) | (function << 8) | (reg << 2); return (1 << 31) | (dev.bus << 16) | (dev.device << 11)
| (dev.function << 8) | (reg << 2);
} }
void void
grub_pci_iterate (grub_pci_iteratefunc_t hook) grub_pci_iterate (grub_pci_iteratefunc_t hook)
{ {
int bus; grub_pci_device_t dev;
int dev;
int func;
grub_pci_address_t addr; grub_pci_address_t addr;
grub_pci_id_t id; grub_pci_id_t id;
grub_uint32_t hdr; grub_uint32_t hdr;
for (bus = 0; bus < 256; bus++) for (dev.bus = 0; dev.bus < 256; dev.bus++)
{ {
for (dev = 0; dev < 32; dev++) for (dev.device = 0; dev.device < 32; dev.device++)
{ {
for (func = 0; func < 8; func++) for (dev.function = 0; dev.function < 8; dev.function++)
{ {
addr = grub_pci_make_address (bus, dev, func, 0); addr = grub_pci_make_address (dev, 0);
id = grub_pci_read (addr); id = grub_pci_read (addr);
/* Check if there is a device present. */ /* Check if there is a device present. */
if (id >> 16 == 0xFFFF) if (id >> 16 == 0xFFFF)
continue; continue;
if (hook (bus, dev, func, id)) if (hook (dev, id))
return; return;
/* Probe only func = 0 if the device if not multifunction */ /* Probe only func = 0 if the device if not multifunction */
if (func == 0) if (dev.function == 0)
{ {
addr = grub_pci_make_address (bus, dev, func, 3); addr = grub_pci_make_address (dev, 3);
hdr = grub_pci_read (addr); hdr = grub_pci_read (addr);
if (!(hdr & 0x800000)) if (!(hdr & 0x800000))
break; break;

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 /* Iterate over all PCI devices. Determine if a device is an OHCI
controller. If this is the case, initialize it. */ controller. If this is the case, initialize it. */
static int NESTED_FUNC_ATTR static int NESTED_FUNC_ATTR
grub_ohci_pci_iter (int bus, int device, int func, grub_ohci_pci_iter (grub_pci_device_t dev,
grub_pci_id_t pciid __attribute__((unused))) grub_pci_id_t pciid __attribute__((unused)))
{ {
grub_uint32_t class_code; grub_uint32_t class_code;
@ -126,7 +126,7 @@ grub_ohci_pci_iter (int bus, int device, int func,
grub_uint32_t revision; grub_uint32_t revision;
grub_uint32_t frame_interval; grub_uint32_t frame_interval;
addr = grub_pci_make_address (bus, device, func, 2); addr = grub_pci_make_address (dev, 2);
class_code = grub_pci_read (addr) >> 8; class_code = grub_pci_read (addr) >> 8;
interf = class_code & 0xFF; interf = class_code & 0xFF;
@ -138,7 +138,7 @@ grub_ohci_pci_iter (int bus, int device, int func,
return 0; return 0;
/* Determine IO base address. */ /* Determine IO base address. */
addr = grub_pci_make_address (bus, device, func, 4); addr = grub_pci_make_address (dev, 4);
base = grub_pci_read (addr); base = grub_pci_read (addr);
#if 0 #if 0

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 /* Iterate over all PCI devices. Determine if a device is an UHCI
controller. If this is the case, initialize it. */ controller. If this is the case, initialize it. */
static int NESTED_FUNC_ATTR static int NESTED_FUNC_ATTR
grub_uhci_pci_iter (int bus, int device, int func, grub_uhci_pci_iter (grub_pci_device_t dev,
grub_pci_id_t pciid __attribute__((unused))) grub_pci_id_t pciid __attribute__((unused)))
{ {
grub_uint32_t class_code; grub_uint32_t class_code;
@ -151,7 +151,7 @@ grub_uhci_pci_iter (int bus, int device, int func,
struct grub_uhci *u; struct grub_uhci *u;
int i; int i;
addr = grub_pci_make_address (bus, device, func, 2); addr = grub_pci_make_address (dev, 2);
class_code = grub_pci_read (addr) >> 8; class_code = grub_pci_read (addr) >> 8;
interf = class_code & 0xFF; interf = class_code & 0xFF;
@ -163,7 +163,7 @@ grub_uhci_pci_iter (int bus, int device, int func,
return 0; return 0;
/* Determine IO base address. */ /* Determine IO base address. */
addr = grub_pci_make_address (bus, device, func, 8); addr = grub_pci_make_address (dev, 8);
base = grub_pci_read (addr); base = grub_pci_read (addr);
/* Stop if there is no IO space base address defined. */ /* Stop if there is no IO space base address defined. */
if (! (base & 1)) if (! (base & 1))

View file

@ -38,11 +38,11 @@ static struct grub_video_patch
}; };
static int NESTED_FUNC_ATTR static int NESTED_FUNC_ATTR
scan_card (int bus, int dev, int func, grub_pci_id_t pciid) scan_card (grub_pci_device_t dev, grub_pci_id_t pciid)
{ {
grub_pci_address_t addr; grub_pci_address_t addr;
addr = grub_pci_make_address (bus, dev, func, 2); addr = grub_pci_make_address (dev, 2);
if (grub_pci_read_byte (addr + 3) == 0x3) if (grub_pci_read_byte (addr + 3) == 0x3)
{ {
struct grub_video_patch *p = video_patches; struct grub_video_patch *p = video_patches;

View file

@ -41,6 +41,7 @@ enable_rom_area (void)
{ {
grub_pci_address_t addr; grub_pci_address_t addr;
grub_uint32_t *rom_ptr; grub_uint32_t *rom_ptr;
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
rom_ptr = (grub_uint32_t *) VBIOS_ADDR; rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
if (*rom_ptr != BLANK_MEM) if (*rom_ptr != BLANK_MEM)
@ -49,7 +50,7 @@ enable_rom_area (void)
return 0; return 0;
} }
addr = grub_pci_make_address (0, 0, 0, 36); addr = grub_pci_make_address (dev, 36);
grub_pci_write_byte (addr++, 0x30); grub_pci_write_byte (addr++, 0x30);
grub_pci_write_byte (addr++, 0x33); grub_pci_write_byte (addr++, 0x33);
grub_pci_write_byte (addr++, 0x33); grub_pci_write_byte (addr++, 0x33);
@ -73,8 +74,9 @@ static void
lock_rom_area (void) lock_rom_area (void)
{ {
grub_pci_address_t addr; grub_pci_address_t addr;
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
addr = grub_pci_make_address (0, 0, 0, 36); addr = grub_pci_make_address (dev, 36);
grub_pci_write_byte (addr++, 0x10); grub_pci_write_byte (addr++, 0x10);
grub_pci_write_byte (addr++, 0x11); grub_pci_write_byte (addr++, 0x11);
grub_pci_write_byte (addr++, 0x11); grub_pci_write_byte (addr++, 0x11);

View file

@ -19,15 +19,7 @@
#include <grub/dl.h> #include <grub/dl.h>
#include <grub/command.h> #include <grub/command.h>
#include <grub/misc.h>
#if defined(GRUB_MACHINE_IEEE1275)
#include <grub/machine/kernel.h>
#elif defined(GRUB_MACHINE_EFI)
#include <grub/efi/efi.h>
#else
/* Platforms shipping standalone halt, such as coreboot. */
#include <grub/cpu/halt.h>
#endif
static grub_err_t static grub_err_t
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)), grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),

View file

@ -38,18 +38,18 @@ grub_cmd_hexdump (grub_extcmd_t cmd, int argc, char **args)
struct grub_arg_list *state = cmd->state; struct grub_arg_list *state = cmd->state;
char buf[GRUB_DISK_SECTOR_SIZE * 4]; char buf[GRUB_DISK_SECTOR_SIZE * 4];
grub_ssize_t size, length; grub_ssize_t size, length;
grub_addr_t skip; grub_disk_addr_t skip;
int namelen; int namelen;
if (argc != 1) if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required"); return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
namelen = grub_strlen (args[0]); namelen = grub_strlen (args[0]);
skip = (state[0].set) ? grub_strtoul (state[0].arg, 0, 0) : 0; skip = (state[0].set) ? grub_strtoull (state[0].arg, 0, 0) : 0;
length = (state[1].set) ? grub_strtoul (state[1].arg, 0, 0) : 256; length = (state[1].set) ? grub_strtoul (state[1].arg, 0, 0) : 256;
if (!grub_strcmp (args[0], "(mem)")) if (!grub_strcmp (args[0], "(mem)"))
hexdump (skip, (char *) skip, length); hexdump (skip, (char *) (grub_addr_t) skip, length);
else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')')) else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')'))
{ {
grub_disk_t disk; grub_disk_t disk;

View file

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

View file

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

View file

@ -19,18 +19,7 @@
#include <grub/dl.h> #include <grub/dl.h>
#include <grub/command.h> #include <grub/command.h>
#include <grub/misc.h>
#if defined(GRUB_MACHINE_IEEE1275)
#include <grub/machine/kernel.h>
#elif defined(GRUB_MACHINE_EFI)
#include <grub/efi/efi.h>
#elif defined(GRUB_MACHINE_PCBIOS)
#include <grub/machine/init.h>
#else
/* Platforms shipping standalone reboot, such as coreboot. */
#include <grub/cpu/reboot.h>
#endif
static grub_err_t static grub_err_t
grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)), grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),

View file

@ -14,7 +14,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \ commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
commands/password.c commands/keystatus.c \ commands/password.c commands/keystatus.c \
disk/host.c disk/loopback.c disk/scsi.c \ disk/host.c disk/loopback.c disk/scsi.c \
fs/fshelp.c \ fs/fshelp.c \
\ \
io/gzio.c \ io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \ kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
@ -28,7 +28,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
normal/completion.c normal/main.c normal/color.c \ normal/completion.c normal/main.c normal/color.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \ normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/menu_text.c \ normal/menu_text.c \
script/main.c script/execute.c script/function.c \ script/main.c script/execute.c script/function.c \
script/lexer.c script/script.c grub_script.tab.c \ script/lexer.c script/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \ partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c partmap/gpt.c \ partmap/acorn.c partmap/gpt.c \
@ -37,7 +37,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.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/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/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/befs.c fs/befs_be.c fs/tar.c \
\ \
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \ util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \ util/hostdisk.c util/getroot.c \
@ -45,7 +45,7 @@ grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \ commands/parttool.c parttool/msdospart.c \
grub_emu_init.c grub_emu_init.c gnulib/progname.c
ifeq ($(target_cpu), i386) ifeq ($(target_cpu), i386)
grub_emu_SOURCES += commands/i386/cpuid.c grub_emu_SOURCES += commands/i386/cpuid.c
@ -59,6 +59,11 @@ grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \
grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB) grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
endif endif
ifeq ($(enable_grub_emu_pci), yes)
grub_emu_SOURCES += util/pci.c commands/lspci.c
grub_emu_LDFLAGS += $(LIBPCIACCESS)
endif
grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES))
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@ rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
DISTCLEANFILES += grub_emu_init.lst DISTCLEANFILES += grub_emu_init.lst
@ -79,7 +84,7 @@ DISTCLEANFILES += grub_emu_init.c
# For grub-mkfont. # For grub-mkfont.
ifeq ($(enable_grub_mkfont), yes) ifeq ($(enable_grub_mkfont), yes)
bin_UTILITIES += grub-mkfont 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_CFLAGS = $(freetype_cflags)
grub_mkfont_LDFLAGS = $(freetype_libs) grub_mkfont_LDFLAGS = $(freetype_libs)
endif endif

View file

@ -1,15 +1,27 @@
# -*- makefile -*- # -*- 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. # For grub-mkelfimage.
bin_UTILITIES += 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/resolve.c
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
# For grub-probe. # For grub-probe.
sbin_UTILITIES += grub-probe sbin_UTILITIES += grub-probe
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h 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 \ util/hostdisk.c util/misc.c util/getroot.c \
kern/device.c kern/disk.c kern/err.c kern/misc.c \ kern/device.c kern/disk.c kern/err.c kern/misc.c \
kern/parser.c kern/partition.c kern/file.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. # For grub-fstest.
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h 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 \ 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 \ disk/host.c disk/loopback.c kern/list.c kern/command.c \
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \ lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
@ -66,14 +79,14 @@ grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.c \
# For grub-mkfont. # For grub-mkfont.
ifeq ($(enable_grub_mkfont), yes) ifeq ($(enable_grub_mkfont), yes)
bin_UTILITIES += grub-mkfont 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_CFLAGS = $(freetype_cflags)
grub_mkfont_LDFLAGS = $(freetype_libs) grub_mkfont_LDFLAGS = $(freetype_libs)
endif endif
# For grub-mkrelpath. # For grub-mkrelpath.
bin_UTILITIES += grub-mkrelpath bin_UTILITIES += grub-mkrelpath
grub_mkrelpath_SOURCES = util/grub-mkrelpath.c util/misc.c grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
# For the parser. # For the parser.
grub_script.tab.c grub_script.tab.h: script/parser.y grub_script.tab.c grub_script.tab.h: script/parser.y
@ -121,7 +134,7 @@ DISTCLEANFILES += grub_fstest_init.c
# for grub-editenv # for grub-editenv
bin_UTILITIES += 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 CLEANFILES += grub-editenv
# Needed for genmk.rb to work # Needed for genmk.rb to work
@ -129,7 +142,7 @@ ifeq (0,1)
bin_UTILITIES += grub-macho2img grub-pe2elf bin_UTILITIES += grub-macho2img grub-pe2elf
endif 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 CLEANFILES += grub-pe2elf
grub_macho2img_SOURCES = util/grub-macho2img.c grub_macho2img_SOURCES = util/grub-macho2img.c

View file

@ -18,6 +18,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
kern/i386/misc.S \ kern/i386/misc.S \
kern/i386/coreboot/init.c \ kern/i386/coreboot/init.c \
kern/i386/multiboot_mmap.c \ kern/i386/multiboot_mmap.c \
kern/i386/halt.c \
kern/main.c kern/device.c \ kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \ kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -61,6 +62,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
kern/i386/misc.S \ kern/i386/misc.S \
kern/i386/coreboot/init.c \ kern/i386/coreboot/init.c \
kern/i386/qemu/mmap.c \ kern/i386/qemu/mmap.c \
kern/i386/halt.c \
kern/main.c kern/device.c \ kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \ kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -93,13 +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 kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# Utilities.
sbin_UTILITIES = grub-mkdevicemap
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
sbin_SCRIPTS += grub-install sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in grub_install_SOURCES = util/grub-install.in
@ -131,12 +126,12 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS) linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod. # For reboot.mod.
reboot_mod_SOURCES = commands/reboot.c kern/i386/reboot.c reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS) reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS) reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod. # For halt.mod.
halt_mod_SOURCES = commands/halt.c kern/i386/halt.c halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS) halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS) halt_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -9,11 +9,10 @@ script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Utilities. # Utilities.
bin_UTILITIES = grub-mkimage bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-mkdevicemap
# For grub-mkimage. # For grub-mkimage.
grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \ grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
util/resolve.c util/misc.c util/resolve.c
util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
# For grub-setup. # For grub-setup.
@ -24,10 +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 \ # 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 # 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
# Scripts. # Scripts.
sbin_SCRIPTS = grub-install sbin_SCRIPTS = grub-install
@ -35,14 +30,14 @@ sbin_SCRIPTS = grub-install
grub_install_SOURCES = util/i386/efi/grub-install.in grub_install_SOURCES = util/i386/efi/grub-install.in
# Modules. # Modules.
pkglib_MODULES = kernel.mod chain.mod appleldr.mod \ pkglib_MODULES = kernel.img chain.mod appleldr.mod \
linux.mod halt.mod reboot.mod pci.mod lspci.mod \ linux.mod halt.mod reboot.mod pci.mod lspci.mod \
datetime.mod date.mod datehook.mod loadbios.mod \ datetime.mod date.mod datehook.mod loadbios.mod \
fixvideo.mod mmap.mod acpi.mod fixvideo.mod mmap.mod acpi.mod
# For kernel.mod. # For kernel.img.
kernel_mod_EXPORTS = no kernel_img_EXPORTS = no
kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \ kernel_img_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \ kern/misc.c kern/mm.c kern/reader.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \ kern/rescue_parser.c kern/rescue_reader.c \
@ -53,22 +48,22 @@ kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
kern/i386/tsc.c kern/i386/pit.c \ kern/i386/tsc.c kern/i386/pit.c \
kern/generic/rtc_get_time_ms.c \ kern/generic/rtc_get_time_ms.c \
kern/generic/millisleep.c kern/generic/millisleep.c
kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \ env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \ partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h i18n.h efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h i18n.h
kernel_mod_CFLAGS = $(COMMON_CFLAGS) kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS) kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
MOSTLYCLEANFILES += symlist.c MOSTLYCLEANFILES += symlist.c
MOSTLYCLEANFILES += symlist.c kernel_syms.lst MOSTLYCLEANFILES += symlist.c kernel_syms.lst
DEFSYMFILES += kernel_syms.lst DEFSYMFILES += kernel_syms.lst
symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist.sh symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) /bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod. # For boot.mod.
@ -148,10 +143,15 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS) fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS) fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_fb.mod pkglib_MODULES += efi_uga.mod
efi_fb_mod_SOURCES = video/efi_fb.c efi_uga_mod_SOURCES = video/efi_uga.c
efi_fb_mod_CFLAGS = $(COMMON_CFLAGS) efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
efi_fb_mod_LDFLAGS = $(COMMON_LDFLAGS) 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 pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\ xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\

View file

@ -47,13 +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 kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# Utilities.
sbin_UTILITIES = grub-mkdevicemap
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
# Scripts. # Scripts.
sbin_SCRIPTS = grub-install sbin_SCRIPTS = grub-install

View file

@ -81,7 +81,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
# Utilities. # Utilities.
bin_UTILITIES = grub-mkimage bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-setup grub-mkdevicemap sbin_UTILITIES = grub-setup
# For grub-mkimage. # For grub-mkimage.
grub_mkimage_SOURCES = gnulib/progname.c util/i386/pc/grub-mkimage.c util/misc.c \ grub_mkimage_SOURCES = gnulib/progname.c util/i386/pc/grub-mkimage.c util/misc.c \
@ -109,10 +109,6 @@ grub_setup_SOURCES = gnulib/progname.c \
util/raid.c util/lvm.c \ util/raid.c util/lvm.c \
grub_setup_init.c grub_setup_init.c
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
sbin_SCRIPTS += grub-install sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in grub_install_SOURCES = util/grub-install.in

View file

@ -28,13 +28,6 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
# Programs # Programs
pkglib_PROGRAMS = kernel.img pkglib_PROGRAMS = kernel.img
# Utilities.
sbin_UTILITIES = grub-mkdevicemap
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \ kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \ kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \ kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \

View file

@ -59,11 +59,11 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
# Utilities. # Utilities.
bin_UTILITIES = grub-mkimage bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-setup grub-mkdevicemap grub-ofpathname sbin_UTILITIES = grub-setup grub-ofpathname
# For grub-mkimage. # For grub-mkimage.
grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \ grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
util/resolve.c util/resolve.c gnulib/progname.c
# For grub-setup. # For grub-setup.
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
@ -82,16 +82,12 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
partmap/sun.c partmap/acorn.c \ partmap/sun.c partmap/acorn.c \
\ \
disk/raid.c disk/mdraid_linux.c disk/lvm.c \ disk/raid.c disk/mdraid_linux.c disk/lvm.c \
util/raid.c util/lvm.c \ util/raid.c util/lvm.c gnulib/progname.c \
grub_setup_init.c grub_setup_init.c
# For grub-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. # For grub-ofpathname.
grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \ grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
util/ieee1275/ofpath.c util/misc.c util/ieee1275/ofpath.c util/misc.c gnulib/progname.c
# Scripts. # Scripts.
sbin_SCRIPTS = grub-install sbin_SCRIPTS = grub-install

View file

@ -9,11 +9,10 @@ script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Utilities. # Utilities.
bin_UTILITIES = grub-mkimage bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-mkdevicemap
# For grub-mkimage. # For grub-mkimage.
grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \ grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
util/resolve.c util/misc.c util/resolve.c
# For grub-setup. # For grub-setup.
#grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \ #grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
@ -23,10 +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 \ # 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 # 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
# Scripts. # Scripts.
sbin_SCRIPTS = grub-install sbin_SCRIPTS = grub-install
@ -34,14 +29,14 @@ sbin_SCRIPTS = grub-install
grub_install_SOURCES = util/i386/efi/grub-install.in grub_install_SOURCES = util/i386/efi/grub-install.in
# Modules. # Modules.
pkglib_MODULES = kernel.mod chain.mod appleldr.mod \ pkglib_MODULES = kernel.img chain.mod appleldr.mod \
halt.mod reboot.mod linux.mod pci.mod lspci.mod \ halt.mod reboot.mod linux.mod pci.mod lspci.mod \
datetime.mod date.mod datehook.mod loadbios.mod \ datetime.mod date.mod datehook.mod loadbios.mod \
fixvideo.mod mmap.mod acpi.mod ata.mod fixvideo.mod mmap.mod acpi.mod ata.mod
# For kernel.mod. # For kernel.img.
kernel_mod_EXPORTS = no kernel_img_EXPORTS = no
kernel_mod_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \ kernel_img_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
kern/main.c kern/device.c \ kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \ kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -52,23 +47,23 @@ kernel_mod_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
kern/i386/tsc.c kern/i386/pit.c \ kern/i386/tsc.c kern/i386/pit.c \
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c \ kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c \
term/efi/console.c disk/efi/efidisk.c term/efi/console.c disk/efi/efidisk.c
kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \ env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \ partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \ efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \
handler.h command.h i18n.h handler.h command.h i18n.h
kernel_mod_CFLAGS = $(COMMON_CFLAGS) kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS) kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS) kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
MOSTLYCLEANFILES += symlist.c MOSTLYCLEANFILES += symlist.c
MOSTLYCLEANFILES += symlist.c kernel_syms.lst MOSTLYCLEANFILES += symlist.c kernel_syms.lst
DEFSYMFILES += kernel_syms.lst DEFSYMFILES += kernel_syms.lst
symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist.sh symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) /bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod. # For boot.mod.
@ -154,10 +149,15 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS) fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS) fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_fb.mod pkglib_MODULES += efi_uga.mod
efi_fb_mod_SOURCES = video/efi_fb.c efi_uga_mod_SOURCES = video/efi_uga.c
efi_fb_mod_CFLAGS = $(COMMON_CFLAGS) efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
efi_fb_mod_LDFLAGS = $(COMMON_LDFLAGS) 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 pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\ xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\

View file

@ -33,7 +33,7 @@ dnl type.
AC_INIT([GRUB],[1.97],[bug-grub@gnu.org]) AC_INIT([GRUB],[1.97],[bug-grub@gnu.org])
AM_INIT_AUTOMAKE() AM_INIT_AUTOMAKE()
AC_PREREQ(2.59d) AC_PREREQ(2.60)
AC_CONFIG_SRCDIR([include/grub/dl.h]) AC_CONFIG_SRCDIR([include/grub/dl.h])
AC_CONFIG_HEADER([config.h]) AC_CONFIG_HEADER([config.h])
@ -122,6 +122,7 @@ case "$platform" in
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;; emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
esac esac
CFLAGS="$CFLAGS $machine_CFLAGS" CFLAGS="$CFLAGS $machine_CFLAGS"
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS" TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
AC_SUBST(host_cpu) AC_SUBST(host_cpu)
@ -193,7 +194,7 @@ else
fi fi
# Check for functions. # Check for functions.
AC_CHECK_FUNCS(posix_memalign memalign asprintf) AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
# For grub-mkisofs # For grub-mkisofs
AC_HEADER_MAJOR AC_HEADER_MAJOR
@ -525,6 +526,10 @@ AC_ARG_ENABLE([grub-emu-usb],
[AS_HELP_STRING([--enable-grub-emu-usb], [AS_HELP_STRING([--enable-grub-emu-usb],
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
AC_ARG_ENABLE([grub-emu-pci],
[AS_HELP_STRING([--enable-grub-emu-pci],
[build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
if test "$platform" = emu; then if test "$platform" = emu; then
missing_ncurses= missing_ncurses=
[# Check for curses libraries.] [# Check for curses libraries.]
@ -546,6 +551,11 @@ fi
if test x"$enable_grub_emu_usb" = xno ; then if test x"$enable_grub_emu_usb" = xno ; then
grub_emu_usb_excuse="explicitly disabled" grub_emu_usb_excuse="explicitly disabled"
fi fi
if test x"$enable_grub_emu_pci" = xyes ; then
grub_emu_usb_excuse="conflicts with PCI support"
fi
[if [ x"$grub_emu_usb_excuse" = x ]; then [if [ x"$grub_emu_usb_excuse" = x ]; then
# Check for libusb libraries.] # Check for libusb libraries.]
AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
@ -565,7 +575,35 @@ enable_grub_emu_usb=yes
else else
enable_grub_emu_usb=no enable_grub_emu_usb=no
fi fi
if test x"$enable_grub_emu_pci" != xyes ; then
grub_emu_pci_excuse="not enabled"
fi
if test x"$enable_grub_emu_usb" = xyes ; then
grub_emu_pci_excuse="conflicts with USB support"
fi
[if [ x"$grub_emu_pci_excuse" = x ]; then
# Check for libpci libraries.]
AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
[grub_emu_pci_excuse=["need libpciaccess library"]])
AC_SUBST([LIBPCIACCESS])
[fi]
[if [ x"$grub_emu_pci_excuse" = x ]; then
# Check for headers.]
AC_CHECK_HEADERS([pci/pci.h], [],
[grub_emu_pci_excuse=["need libpciaccess headers"]])
[fi]
if test x"$grub_emu_pci_excuse" = x ; then
enable_grub_emu_pci=yes
else
enable_grub_emu_pci=no
fi
AC_SUBST([enable_grub_emu_usb]) AC_SUBST([enable_grub_emu_usb])
AC_SUBST([enable_grub_emu_pci])
fi fi
AC_ARG_ENABLE([grub-fstest], AC_ARG_ENABLE([grub-fstest],
@ -640,6 +678,11 @@ echo USB support for grub-emu: Yes
else else
echo USB support for grub-emu: No "($grub_emu_usb_excuse)" echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
fi fi
if [ x"$grub_emu_pci_excuse" = x ]; then
echo PCI support for grub-emu: Yes
else
echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
fi
fi fi
if [ x"$enable_mm_debug" = xyes ]; then if [ x"$enable_mm_debug" = xyes ]; then
echo With memory debugging: Yes echo With memory debugging: Yes

View file

@ -388,7 +388,7 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
} }
static int NESTED_FUNC_ATTR static int NESTED_FUNC_ATTR
grub_ata_pciinit (int bus, int device, int func, grub_ata_pciinit (grub_pci_device_t dev,
grub_pci_id_t pciid __attribute__((unused))) grub_pci_id_t pciid __attribute__((unused)))
{ {
static int compat_use[2] = { 0 }; static int compat_use[2] = { 0 };
@ -402,7 +402,7 @@ grub_ata_pciinit (int bus, int device, int func,
static int controller = 0; static int controller = 0;
/* Read class. */ /* Read class. */
addr = grub_pci_make_address (bus, device, func, 2); addr = grub_pci_make_address (dev, 2);
class = grub_pci_read (addr); class = grub_pci_read (addr);
/* Check if this class ID matches that of a PCI IDE Controller. */ /* Check if this class ID matches that of a PCI IDE Controller. */
@ -429,9 +429,9 @@ grub_ata_pciinit (int bus, int device, int func,
{ {
/* Read the BARs, which either contain a mmapped IO address /* Read the BARs, which either contain a mmapped IO address
or the IO port address. */ or the IO port address. */
addr = grub_pci_make_address (bus, device, func, 4 + 2 * i); addr = grub_pci_make_address (dev, 4 + 2 * i);
bar1 = grub_pci_read (addr); bar1 = grub_pci_read (addr);
addr = grub_pci_make_address (bus, device, func, 5 + 2 * i); addr = grub_pci_make_address (dev, 5 + 2 * i);
bar2 = grub_pci_read (addr); bar2 = grub_pci_read (addr);
/* Check if the BARs describe an IO region. */ /* Check if the BARs describe an IO region. */
@ -444,7 +444,8 @@ grub_ata_pciinit (int bus, int device, int func,
grub_dprintf ("ata", grub_dprintf ("ata",
"PCI dev (%d,%d,%d) compat=%d rega=0x%x regb=0x%x\n", "PCI dev (%d,%d,%d) compat=%d rega=0x%x regb=0x%x\n",
bus, device, func, compat, rega, regb); grub_pci_get_bus (dev), grub_pci_get_device (dev),
grub_pci_get_function (dev), compat, rega, regb);
if (rega && regb) if (rega && regb)
{ {

View file

@ -169,7 +169,7 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)
else else
{ {
grub_free (data); grub_free (data);
return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get C/H/S values"); return grub_error (GRUB_ERR_BAD_DEVICE, "%s cannot get C/H/S values", disk->name);
} }
} }
@ -252,7 +252,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
1024 /* cylinders */ * 1024 /* cylinders */ *
256 /* heads */ * 256 /* heads */ *
63 /* spt */) 63 /* spt */)
return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk"); return grub_error (GRUB_ERR_OUT_OF_RANGE, "%s out of disk", disk->name);
soff = ((grub_uint32_t) sector) % data->sectors + 1; soff = ((grub_uint32_t) sector) % data->sectors + 1;
head = ((grub_uint32_t) sector) / data->sectors; head = ((grub_uint32_t) sector) / data->sectors;
@ -260,7 +260,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
coff = head / data->heads; coff = head / data->heads;
if (coff >= data->cylinders) if (coff >= data->cylinders)
return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk"); return grub_error (GRUB_ERR_OUT_OF_RANGE, "%s out of disk", disk->name);
if (grub_biosdisk_rw_standard (cmd + 0x02, data->drive, if (grub_biosdisk_rw_standard (cmd + 0x02, data->drive,
coff, hoff, soff, size, segment)) coff, hoff, soff, size, segment))
@ -268,9 +268,9 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
switch (cmd) switch (cmd)
{ {
case GRUB_BIOSDISK_READ: case GRUB_BIOSDISK_READ:
return grub_error (GRUB_ERR_READ_ERROR, "biosdisk read error"); return grub_error (GRUB_ERR_READ_ERROR, "%s read error", disk->name);
case GRUB_BIOSDISK_WRITE: case GRUB_BIOSDISK_WRITE:
return grub_error (GRUB_ERR_WRITE_ERROR, "biosdisk write error"); return grub_error (GRUB_ERR_WRITE_ERROR, "%s write error", disk->name);
} }
} }
} }

View file

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

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

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

View file

@ -17,6 +17,7 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/list.h>
#include <grub/types.h> #include <grub/types.h>
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/mm.h> #include <grub/mm.h>
@ -41,6 +42,16 @@ static int grub_gettext_max;
static const char *(*grub_gettext_original) (const char *s); static const char *(*grub_gettext_original) (const char *s);
struct grub_gettext_msg
{
struct grub_gettext_msg *next;
const char *name;
const char *translated;
};
struct grub_gettext_msg *grub_gettext_msg_list = NULL;
#define GETTEXT_MAGIC_NUMBER 0 #define GETTEXT_MAGIC_NUMBER 0
#define GETTEXT_FILE_FORMAT 4 #define GETTEXT_FILE_FORMAT 4
#define GETTEXT_NUMBER_OF_STRINGS 8 #define GETTEXT_NUMBER_OF_STRINGS 8
@ -79,7 +90,7 @@ grub_gettext_getstring_from_offset (grub_uint32_t offset,
translation[length] = '\0'; translation[length] = '\0';
} }
static char * static const char *
grub_gettext_gettranslation_from_position (int position) grub_gettext_gettranslation_from_position (int position)
{ {
int offsettranslation; int offsettranslation;
@ -130,9 +141,18 @@ static const char *
grub_gettext_translate (const char *orig) grub_gettext_translate (const char *orig)
{ {
char *current_string; char *current_string;
char *ret; const char *ret;
int min, max, current; int min, max, current;
int found = 0;
struct grub_gettext_msg *cur;
cur = grub_named_list_find (GRUB_AS_NAMED_LIST (grub_gettext_msg_list),
orig);
if (cur)
return cur->translated;
if (fd_mo == 0) if (fd_mo == 0)
return orig; return orig;
@ -142,7 +162,7 @@ grub_gettext_translate (const char *orig)
current = (max + min) / 2; current = (max + min) / 2;
while (current != min && current != max) while (current != min && current != max && found == 0)
{ {
current_string = grub_gettext_getstring_from_position (current); current_string = grub_gettext_getstring_from_position (current);
@ -160,13 +180,31 @@ grub_gettext_translate (const char *orig)
else if (grub_strcmp (current_string, orig) == 0) else if (grub_strcmp (current_string, orig) == 0)
{ {
grub_free (current_string); grub_free (current_string);
return grub_gettext_gettranslation_from_position (current); found = 1;
} }
current = (max + min) / 2; current = (max + min) / 2;
} }
ret = grub_malloc (grub_strlen (orig) + 1); ret = found ? grub_gettext_gettranslation_from_position (current) : orig;
grub_strcpy (ret, orig);
if (found)
{
cur = grub_zalloc (sizeof (*cur));
if (cur)
{
cur->name = grub_strdup (orig);
if (cur->name)
{
cur->translated = ret;
grub_list_push (GRUB_AS_LIST_P (&grub_gettext_msg_list),
GRUB_AS_LIST (cur));
}
}
else
grub_errno = GRUB_ERR_NONE;
}
return ret; return ret;
} }
@ -222,7 +260,7 @@ grub_gettext_init_ext (const char *lang)
locale_dir = grub_env_get ("locale_dir"); locale_dir = grub_env_get ("locale_dir");
if (locale_dir == NULL) if (locale_dir == NULL)
{ {
grub_printf ("locale_dir variable is not set up."); grub_dprintf ("gettext", "locale_dir variable is not set up.\n");
return; return;
} }
@ -259,12 +297,29 @@ grub_gettext_init_ext (const char *lang)
} }
} }
static void
grub_gettext_delete_list ()
{
struct grub_gettext_msg *item;
while ((item =
grub_list_pop (GRUB_AS_LIST_P (&grub_gettext_msg_list))) != 0)
{
char *original = (char *) ((struct grub_gettext_msg *) item)->name;
grub_free (original);
// Don't delete the translated message because could be in use.
}
}
static char * static char *
grub_gettext_env_write_lang (struct grub_env_var *var grub_gettext_env_write_lang (struct grub_env_var *var
__attribute__ ((unused)), const char *val) __attribute__ ((unused)), const char *val)
{ {
grub_gettext_init_ext (val); grub_gettext_init_ext (val);
grub_gettext_delete_list ();
return grub_strdup (val); return grub_strdup (val);
} }
@ -307,5 +362,7 @@ GRUB_MOD_FINI (gettext)
if (fd_mo != 0) if (fd_mo != 0)
grub_file_close (fd_mo); grub_file_close (fd_mo);
grub_gettext_delete_list ();
grub_gettext = grub_gettext_original; grub_gettext = grub_gettext_original;
} }

View file

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

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

@ -39,13 +39,6 @@ grub_uint32_t EXPORT_FUNC(grub_get_mmap_entry) (struct grub_machine_mmap_entry *
/* Turn on/off Gate A20. */ /* Turn on/off Gate A20. */
void grub_gate_a20 (int on); void grub_gate_a20 (int on);
/* Reboot the machine. */
void EXPORT_FUNC (grub_reboot) (void);
/* Halt the system, using APM if possible. If NO_APM is true, don't
* use APM even if it is available. */
void EXPORT_FUNC (grub_halt) (int no_apm);
void EXPORT_FUNC(grub_stop_floppy) (void); void EXPORT_FUNC(grub_stop_floppy) (void);
#endif /* ! GRUB_INIT_MACHINE_HEADER */ #endif /* ! GRUB_INIT_MACHINE_HEADER */

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)); grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
} }
static inline void *
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
grub_addr_t base,
grub_size_t size __attribute__ ((unused)))
{
return (void *) base;
}
static inline void
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
void *mem __attribute__ ((unused)),
grub_size_t size __attribute__ ((unused)))
{
}
#endif /* GRUB_CPU_PCI_H */ #endif /* GRUB_CPU_PCI_H */

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

@ -171,6 +171,7 @@ char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n);
void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n); void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
grub_size_t EXPORT_FUNC(grub_strlen) (const char *s); grub_size_t EXPORT_FUNC(grub_strlen) (const char *s);
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
void EXPORT_FUNC(grub_real_dprintf) (const char *file, void EXPORT_FUNC(grub_real_dprintf) (const char *file,
const int line, const int line,
const char *condition, const char *condition,
@ -222,4 +223,15 @@ grub_div_roundup (unsigned int x, unsigned int y)
return (x + y - 1) / y; return (x + y - 1) / y;
} }
/* Reboot the machine. */
void EXPORT_FUNC (grub_reboot) (void);
#ifdef GRUB_MACHINE_PCBIOS
/* Halt the system, using APM if possible. If NO_APM is true, don't
* use APM even if it is available. */
void EXPORT_FUNC (grub_halt) (int no_apm);
#else
void EXPORT_FUNC (grub_halt) (void);
#endif
#endif /* ! GRUB_MISC_HEADER */ #endif /* ! GRUB_MISC_HEADER */

View file

@ -73,6 +73,7 @@
#define MAX_IDX (16384 >> BLK_SHR) #define MAX_IDX (16384 >> BLK_SHR)
#define COM_LEN 4096 #define COM_LEN 4096
#define COM_LOG_LEN 12
#define COM_SEC (COM_LEN >> BLK_SHR) #define COM_SEC (COM_LEN >> BLK_SHR)
#define AF_ALST 1 #define AF_ALST 1
@ -164,7 +165,7 @@ struct grub_ntfs_comp
struct grub_ntfs_rlst struct grub_ntfs_rlst
{ {
int flags; int flags;
grub_uint32_t target_vcn, curr_vcn, next_vcn, curr_lcn; grub_disk_addr_t target_vcn, curr_vcn, next_vcn, curr_lcn;
char *cur_run; char *cur_run;
struct grub_ntfs_attr *attr; struct grub_ntfs_attr *attr;
struct grub_ntfs_comp comp; struct grub_ntfs_comp comp;

View file

@ -1,6 +1,6 @@
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc. * Copyright (C) 2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -36,15 +36,44 @@
#define GRUB_PCI_ADDR_IO_MASK ~0x03 #define GRUB_PCI_ADDR_IO_MASK ~0x03
typedef grub_uint32_t grub_pci_id_t; typedef grub_uint32_t grub_pci_id_t;
typedef int NESTED_FUNC_ATTR (*grub_pci_iteratefunc_t)
(int bus, int device, int func, grub_pci_id_t pciid);
typedef grub_uint32_t grub_pci_address_t;
grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (int bus, int device, #ifdef GRUB_UTIL
int function, int reg); #include <grub/pciutils.h>
#else
typedef grub_uint32_t grub_pci_address_t;
struct grub_pci_device
{
int bus;
int device;
int function;
};
typedef struct grub_pci_device grub_pci_device_t;
static inline int
grub_pci_get_bus (grub_pci_device_t dev)
{
return dev.bus;
}
static inline int
grub_pci_get_device (grub_pci_device_t dev)
{
return dev.device;
}
static inline int
grub_pci_get_function (grub_pci_device_t dev)
{
return dev.function;
}
#include <grub/cpu/pci.h>
#endif
typedef int NESTED_FUNC_ATTR (*grub_pci_iteratefunc_t)
(grub_pci_device_t dev, grub_pci_id_t pciid);
grub_pci_address_t EXPORT_FUNC(grub_pci_make_address) (grub_pci_device_t dev,
int reg);
void EXPORT_FUNC(grub_pci_iterate) (grub_pci_iteratefunc_t hook); void EXPORT_FUNC(grub_pci_iterate) (grub_pci_iteratefunc_t hook);
#include <grub/cpu/pci.h>
#endif /* GRUB_PCI_H */ #endif /* GRUB_PCI_H */

103
include/grub/pciutils.h Normal file
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 #ifndef ASM_FILE
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
/* The prefix which points to the directory where GRUB modules and its /* The prefix which points to the directory where GRUB modules and its
configuration file are located. */ configuration file are located. */
extern char grub_prefix[]; extern char grub_prefix[];

View file

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

View file

@ -21,6 +21,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h>
#include <setjmp.h> #include <setjmp.h>
#include <unistd.h> #include <unistd.h>
@ -57,12 +58,20 @@ void grub_util_write_image (const char *img, size_t size, FILE *out);
void grub_util_write_image_at (const void *img, size_t size, off_t offset, void grub_util_write_image_at (const void *img, size_t size, off_t offset,
FILE *out); FILE *out);
#ifndef HAVE_VASPRINTF
int vasprintf (char **buf, const char *fmt, va_list ap);
#endif
#ifndef HAVE_ASPRINTF #ifndef HAVE_ASPRINTF
int asprintf (char **buf, const char *fmt, ...); int asprintf (char **buf, const char *fmt, ...);
#endif #endif
char *xasprintf (const char *fmt, ...);
#ifdef __MINGW32__ #ifdef __MINGW32__
#define fseeko fseeko64 #define fseeko fseeko64

View file

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

View file

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

View file

@ -484,21 +484,6 @@ FUNCTION(grub_exit)
jmp cold_reboot jmp cold_reboot
.code32 .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) * grub_halt(int no_apm)
* *

View file

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

View file

@ -215,10 +215,27 @@ realcseg:
movw %ax, %gs movw %ax, %gs
movw %ax, %ss movw %ax, %ss
#ifdef GRUB_MACHINE_PCBIOS
/* restore interrupts */ /* restore interrupts */
sti sti
#endif
/* return on new stack! */ /* return on new stack! */
DATA32 ret DATA32 ret
.code32 .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. */ /* openfw.c -- Open firmware support functions. */
/* /*
* GRUB -- GRand Unified Bootloader * 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 * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -399,11 +399,14 @@ grub_ieee1275_encode_devname (const char *path)
return encoding; return encoding;
} }
/* On i386, a firmware-independant grub_reboot() is provided by realmode.S. */
#ifndef __i386__
void void
grub_reboot (void) grub_reboot (void)
{ {
grub_ieee1275_interpret ("reset-all", 0); grub_ieee1275_interpret ("reset-all", 0);
} }
#endif
void void
grub_halt (void) grub_halt (void)

View file

@ -126,6 +126,19 @@ grub_printf (const char *fmt, ...)
return ret; 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;
}
#if defined (APPLE_CC) && ! defined (GRUB_UTIL) #if defined (APPLE_CC) && ! defined (GRUB_UTIL)
int int
grub_err_printf (const char *fmt, ...) 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; char *tail;
grub_strtoul (option, &tail, 0); grub_strtoull (option, &tail, 0);
if (tail == 0 || tail == option || *tail != '\0' || grub_errno) if (tail == 0 || tail == option || *tail != '\0' || grub_errno)
{ {
grub_error (GRUB_ERR_BAD_ARGUMENT, grub_error (GRUB_ERR_BAD_ARGUMENT,

View file

@ -469,21 +469,22 @@ find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
{ {
int found = 0; 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); 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_id_t pciid)
{ {
grub_pci_address_t addr; grub_pci_address_t addr;
addr = grub_pci_make_address (bus, dev, func, 2); addr = grub_pci_make_address (dev, 2);
if (grub_pci_read (addr) >> 24 == 0x3) if (grub_pci_read (addr) >> 24 == 0x3)
{ {
int i; int i;
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n", 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; addr += 8;
for (i = 0; i < 6; i++, addr += 4) 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; 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); 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_id_t pciid)
{ {
grub_pci_address_t addr; grub_pci_address_t addr;
addr = grub_pci_make_address (bus, dev, func, 2); addr = grub_pci_make_address (dev, 2);
if (grub_pci_read (addr) >> 24 == 0x3) if (grub_pci_read (addr) >> 24 == 0x3)
{ {
int i; int i;
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n", 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; addr += 8;
for (i = 0; i < 6; i++, addr += 4) for (i = 0; i < 6; i++, addr += 4)
{ {

View file

@ -509,7 +509,7 @@ grub_normal_reader_init (void)
grub_normal_init_page (); grub_normal_init_page ();
grub_setcursor (1); grub_setcursor (1);
grub_printf (_("\ grub_printf_ (N_("\
[ Minimal BASH-like line editing is supported. For the first word, TAB\n\ [ Minimal BASH-like line editing is supported. For the first word, TAB\n\
lists possible command completions. Anywhere else TAB lists possible\n\ lists possible command completions. Anywhere else TAB lists possible\n\
device/file completions.%s ]\n\n"), device/file completions.%s ]\n\n"),

View file

@ -836,7 +836,9 @@ store_completion (const char *item, grub_completion_type_t type, int count)
} }
grub_gotoxy (0, GRUB_TERM_HEIGHT - 3); grub_gotoxy (0, GRUB_TERM_HEIGHT - 3);
grub_printf (" Possible %s are:\n ", what); grub_printf (" ");
grub_printf_ (N_("Possible %s are:"), what);
grub_printf ("\n ");
} }
/* Make sure that the completion buffer has enough room. */ /* Make sure that the completion buffer has enough room. */
@ -997,7 +999,9 @@ run (struct screen *screen)
} }
grub_cls (); grub_cls ();
grub_printf (_(" Booting a command list\n\n")); grub_printf (" ");
grub_printf_ (N_("Booting a command list"));
grub_printf ("\n\n");
/* Execute the script, line for line. */ /* Execute the script, line for line. */
@ -1177,6 +1181,7 @@ grub_menu_entry_run (grub_menu_entry_t entry)
grub_cls (); grub_cls ();
grub_print_error (); grub_print_error ();
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
grub_printf (_("\nPress any key to continue...")); grub_putchar ('\n');
grub_printf_ (N_("Press any key to continue..."));
(void) grub_getkey (); (void) grub_getkey ();
} }

View file

@ -39,11 +39,105 @@ static grub_uint8_t grub_color_menu_highlight;
void void
grub_wait_after_message (void) grub_wait_after_message (void)
{ {
grub_printf ("\nPress any key to continue..."); grub_putchar ('\n');
grub_printf_ (N_("Press any key to continue..."));
(void) grub_getkey (); (void) grub_getkey ();
grub_putchar ('\n'); grub_putchar ('\n');
} }
static void
print_spaces (int number_spaces)
{
int i;
for (i = 0; i < number_spaces; i++)
grub_putchar (' ');
}
static void
grub_print_ucs4 (const grub_uint32_t * str,
const grub_uint32_t * last_position)
{
while (str < last_position)
{
grub_putcode (*str);
str++;
}
}
static grub_ssize_t
getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position)
{
grub_ssize_t width = 0;
while (str < last_position)
{
width += grub_getcharwidth (*str);
str++;
}
return width;
}
static void
print_message_indented (const char *msg)
{
const int line_len = GRUB_TERM_WIDTH - grub_getcharwidth ('m') * 15;
grub_uint32_t *unicode_msg;
grub_ssize_t msg_len = grub_strlen (msg);
unicode_msg = grub_malloc (msg_len * sizeof (*unicode_msg));
msg_len = grub_utf8_to_ucs4 (unicode_msg, msg_len,
(grub_uint8_t *) msg, -1, 0);
if (!unicode_msg)
{
grub_printf ("print_message_indented ERROR1: %s", msg);
return;
}
if (msg_len < 0)
{
grub_printf ("print_message_indented ERROR2: %s", msg);
grub_free (unicode_msg);
return;
}
const grub_uint32_t *last_position = unicode_msg + msg_len;
grub_uint32_t *current_position = unicode_msg;
grub_uint32_t *next_new_line = unicode_msg;
while (current_position < last_position)
{
next_new_line = (grub_uint32_t *) last_position;
while (getstringwidth (current_position, next_new_line) > line_len
|| (*next_new_line != ' ' && next_new_line > current_position &&
next_new_line != last_position))
{
next_new_line--;
}
if (next_new_line == current_position)
{
next_new_line = (next_new_line + line_len > last_position) ?
(grub_uint32_t *) last_position : next_new_line + line_len;
}
print_spaces (6);
grub_print_ucs4 (current_position, next_new_line);
grub_putchar ('\n');
next_new_line++;
current_position = next_new_line;
}
grub_free (unicode_msg);
}
static void static void
draw_border (void) draw_border (void)
{ {
@ -87,22 +181,33 @@ print_message (int nested, int edit)
if (edit) if (edit)
{ {
grub_printf ("\n\ grub_putchar ('\n');
Minimum Emacs-like screen editing is supported. TAB lists\n\ print_message_indented (_("Minimum Emacs-like screen editing is \
completions. Press Ctrl-x to boot, Ctrl-c for a command-line\n\ supported. TAB lists completions. Press Ctrl-x to boot, Ctrl-c for a \
or ESC to return menu."); command-line or ESC to return menu."));
} }
else else
{ {
grub_printf (_("\n\ const char *msg = _("Use the %C and %C keys to select which \
Use the %C and %C keys to select which entry is highlighted.\n"), entry is highlighted.");
(grub_uint32_t) GRUB_TERM_DISP_UP, (grub_uint32_t) GRUB_TERM_DISP_DOWN); char *msg_translated =
grub_printf ("\ grub_malloc (sizeof (char) * grub_strlen (msg) + 1);
Press enter to boot the selected OS, \'e\' to edit the\n\
commands before booting or \'c\' for a command-line."); grub_sprintf (msg_translated, msg, (grub_uint32_t) GRUB_TERM_DISP_UP,
(grub_uint32_t) GRUB_TERM_DISP_DOWN);
grub_putchar ('\n');
print_message_indented (msg_translated);
grub_free (msg_translated);
print_message_indented (_("Press enter to boot the selected OS, \
\'e\' to edit the commands before booting or \'c\' for a command-line."));
if (nested) if (nested)
grub_printf ("\n\ {
ESC to return previous menu."); grub_printf ("\n ");
grub_printf_ (N_("ESC to return previous menu."));
}
} }
} }
@ -265,13 +370,17 @@ get_entry_number (const char *name)
static void static void
print_timeout (int timeout, int offset, int second_stage) print_timeout (int timeout, int offset, int second_stage)
{ {
/* NOTE: Do not remove the trailing space characters. const char *msg =
They are required to clear the line. */ _("The highlighted entry will be booted automatically in %ds.");
char *msg = " The highlighted entry will be booted automatically in %ds. "; const int msg_localized_len = grub_strlen (msg);
const int number_spaces = GRUB_TERM_WIDTH - msg_localized_len - 3;
char *msg_end = grub_strchr (msg, '%'); char *msg_end = grub_strchr (msg, '%');
grub_gotoxy (second_stage ? (msg_end - msg) : 0, GRUB_TERM_HEIGHT - 3); grub_gotoxy (second_stage ? (msg_end - msg + 3) : 3, GRUB_TERM_HEIGHT - 3);
grub_printf (second_stage ? msg_end : msg, timeout); grub_printf (second_stage ? msg_end : msg, timeout);
print_spaces (second_stage ? number_spaces : 0);
grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset); grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
grub_refresh (); grub_refresh ();
}; };
@ -360,8 +469,8 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
if (timeout >= 0) if (timeout >= 0)
{ {
grub_gotoxy (0, GRUB_TERM_HEIGHT - 3); grub_gotoxy (0, GRUB_TERM_HEIGHT - 3);
grub_printf ("\ print_spaces (GRUB_TERM_WIDTH - 1);
");
grub_env_unset ("timeout"); grub_env_unset ("timeout");
grub_env_unset ("fallback"); grub_env_unset ("fallback");
grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset); grub_gotoxy (GRUB_TERM_CURSOR_X, GRUB_TERM_FIRST_ENTRY_Y + offset);
@ -517,7 +626,9 @@ static void
notify_booting (grub_menu_entry_t entry, notify_booting (grub_menu_entry_t entry,
void *userdata __attribute__((unused))) void *userdata __attribute__((unused)))
{ {
grub_printf (" Booting \'%s\'\n\n", entry->title); grub_printf (" ");
grub_printf_ (N_("Booting \'%s\'"), entry->title);
grub_printf ("\n\n");
} }
/* Callback invoked when a default menu entry executed because of a timeout /* Callback invoked when a default menu entry executed because of a timeout
@ -527,7 +638,9 @@ static void
notify_fallback (grub_menu_entry_t entry, notify_fallback (grub_menu_entry_t entry,
void *userdata __attribute__((unused))) void *userdata __attribute__((unused)))
{ {
grub_printf ("\n Falling back to \'%s\'\n\n", entry->title); grub_printf ("\n ");
grub_printf_ (N_("Falling back to \'%s\'"), entry->title);
grub_printf ("\n\n");
grub_millisleep (DEFAULT_ENTRY_ERROR_DELAY_MS); grub_millisleep (DEFAULT_ENTRY_ERROR_DELAY_MS);
} }
@ -541,7 +654,8 @@ notify_execution_failure (void *userdata __attribute__((unused)))
grub_print_error (); grub_print_error ();
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
} }
grub_printf ("\n Failed to boot default entries.\n"); grub_printf ("\n ");
grub_printf_ (N_("Failed to boot default entries.\n"));
grub_wait_after_message (); grub_wait_after_message ();
} }

View file

@ -1,43 +0,0 @@
2009-11-24 Robert Millan <rmh.grub@aybabtu.com>
* zh_CN.po: New file.
* LINGUAS: Add `zh_CN'.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* id.po: New file.
* LINGUAS: Add `id'.
2009-11-23 Carles Pina i Estany <carles@pina.cat>
* POTFILES: Add `normal/menu_text.c'.
* ca.po: Add new translations.
2009-11-19 Robert Millan <rmh.grub@aybabtu.com>
* POTFILES: Add `util/i386/pc/grub-setup.c'.
2009-11-19 Robert Millan <rmh.grub@aybabtu.com>
* POTFILES: Add `util/mkisofs/eltorito.c', `util/mkisofs/joliet.c',
`util/mkisofs/mkisofs.c', `util/mkisofs/multi.c',
`util/mkisofs/rock.c', `util/mkisofs/tree.c', and
`util/mkisofs/write.c'.
2009-11-18 Robert Millan <rmh.grub@aybabtu.com>
* POTFILES-shell: New file. List `util/grub.d/10_kfreebsd.in'
and `util/grub.d/10_linux.in'.
2009-11-17 Robert Millan <rmh.grub@aybabtu.com>
* ca.po: Fix PO-Revision-Date and Language-Team fields.
2009-11-17 Robert Millan <rmh.grub@aybabtu.com>
* LINGUAS: New file.
2009-11-16 Robert Millan <rmh.grub@aybabtu.com>
* POTFILES: New file.
* ca.po: New file.

View file

@ -1,3 +0,0 @@
ca
id
zh_CN

View file

@ -11,4 +11,5 @@ util/mkisofs/rock.c
util/mkisofs/tree.c util/mkisofs/tree.c
util/mkisofs/write.c util/mkisofs/write.c
normal/menu_entry.c
normal/menu_text.c normal/menu_text.c

24
po/README Normal file
View file

@ -0,0 +1,24 @@
If you checked out this source tree directly from GRUB Bazaar, you might
be wondering where are the POT and PO files. Here are some instructions
that will hopefully clarify the situation.
- If you're a user or a distributor, simply fill the po directory by
importing translations from the Translation Project:
rsync -Lrtvz translationproject.org::tp/latest/grub/ po
GRUB's build system will automatically detect those and include them
in your install.
- If you're a translator and want to add a new translation or improve an
existing one, get in touch with the Translation Project
(http://translationproject.org/). The GRUB project doesn't interact
with translators directly (but we dearly appreciate your work!).
- If you're a developer adding/removing/modifiing translatable strings,
you can check that these turn into a sane POT file by using the
`po/grub.pot' make rule.
- If you're the maintainer of GNU GRUB preparing a new release, don't
forget to include the latest PO files in your source tarball!

1018
po/ca.po

File diff suppressed because it is too large Load diff

1149
po/id.po

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2004,2005,2006,2007,2008 Free Software Foundation, Inc. * Copyright (C) 2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,6 +31,9 @@
#include <grub/util/resolve.h> #include <grub/util/resolve.h>
#include <grub/kernel.h> #include <grub/kernel.h>
#include <grub/cpu/kernel.h> #include <grub/cpu/kernel.h>
#include <grub/i18n.h>
#include "progname.h"
#define GRUB_IEEE1275_NOTE_NAME "PowerPC" #define GRUB_IEEE1275_NOTE_NAME "PowerPC"
#define GRUB_IEEE1275_NOTE_TYPE 0x1275 #define GRUB_IEEE1275_NOTE_TYPE 0x1275
@ -325,10 +328,10 @@ static void
usage (int status) usage (int status)
{ {
if (status) if (status)
fprintf (stderr, "Try ``grub-mkimage --help'' for more information.\n"); fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
else else
printf ("\ printf ("\
Usage: grub-mkimage -o FILE [OPTION]... [MODULES]\n\ Usage: %s -o FILE [OPTION]... [MODULES]\n\
\n\ \n\
Make a bootable image of GRUB.\n\ Make a bootable image of GRUB.\n\
\n\ \n\
@ -342,7 +345,7 @@ Make a bootable image of GRUB.\n\
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
\n\ \n\
Report bugs to <%s>.\n\ Report bugs to <%s>.\n\
", GRUB_LIBDIR, PACKAGE_BUGREPORT); ", program_name, GRUB_LIBDIR, PACKAGE_BUGREPORT);
exit (status); exit (status);
} }
@ -357,7 +360,10 @@ main (int argc, char *argv[])
char *memdisk = NULL; char *memdisk = NULL;
int chrp = 0; int chrp = 0;
progname = "grub-mkimage"; set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
while (1) while (1)
{ {

View file

@ -546,7 +546,7 @@ grub_util_get_grub_dev (const char *os_dev)
if (q) if (q)
*q = ','; *q = ',';
asprintf (&grub_dev, "md%s", p); grub_dev = xasprintf ("md%s", p);
free (p); free (p);
} }
else if (os_dev[7] == '/' && os_dev[8] == 'd') else if (os_dev[7] == '/' && os_dev[8] == 'd')
@ -561,7 +561,7 @@ grub_util_get_grub_dev (const char *os_dev)
if (q) if (q)
*q = ','; *q = ',';
asprintf (&grub_dev, "md%s", p); grub_dev = xasprintf ("md%s", p);
free (p); free (p);
} }
else if (os_dev[7] >= '0' && os_dev[7] <= '9') else if (os_dev[7] >= '0' && os_dev[7] <= '9')
@ -574,7 +574,7 @@ grub_util_get_grub_dev (const char *os_dev)
if (q) if (q)
*q = ','; *q = ',';
asprintf (&grub_dev, "md%s", p); grub_dev = xasprintf ("md%s", p);
free (p); free (p);
} }
else if (os_dev[7] == '/' && os_dev[8] >= '0' && os_dev[8] <= '9') else if (os_dev[7] == '/' && os_dev[8] >= '0' && os_dev[8] <= '9')
@ -587,7 +587,7 @@ grub_util_get_grub_dev (const char *os_dev)
if (q) if (q)
*q = ','; *q = ',';
asprintf (&grub_dev, "md%s", p); grub_dev = xasprintf ("md%s", p);
free (p); free (p);
} }
else else

View file

@ -22,6 +22,7 @@
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/lib/envblk.h> #include <grub/lib/envblk.h>
#include <grub/handler.h> #include <grub/handler.h>
#include <grub/i18n.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
@ -29,6 +30,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <getopt.h> #include <getopt.h>
#include "progname.h"
#define DEFAULT_ENVBLK_SIZE 1024 #define DEFAULT_ENVBLK_SIZE 1024
void void
@ -104,7 +107,7 @@ create_envblk_file (const char *name)
if (! buf) if (! buf)
grub_util_error ("out of memory"); grub_util_error ("out of memory");
asprintf (&namenew, "%s.new", name); namenew = xasprintf ("%s.new", name);
fp = fopen (namenew, "wb"); fp = fopen (namenew, "wb");
if (! fp) if (! fp)
grub_util_error ("cannot open the file %s", namenew); grub_util_error ("cannot open the file %s", namenew);
@ -252,7 +255,10 @@ main (int argc, char *argv[])
char *filename; char *filename;
char *command; char *command;
progname = "grub-editenv"; set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Check for options. */ /* Check for options. */
while (1) while (1)
@ -269,7 +275,7 @@ main (int argc, char *argv[])
break; break;
case 'V': case 'V':
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION); printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0; return 0;
case 'v': case 'v':

View file

@ -1,6 +1,6 @@
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc. * Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -36,19 +36,22 @@
#include <grub/util/getroot.h> #include <grub/util/getroot.h>
#include <grub/env.h> #include <grub/env.h>
#include <grub/partition.h> #include <grub/partition.h>
#include <grub/i18n.h>
#include <grub_emu_init.h> #include <grub_emu_init.h>
#include "progname.h"
/* Used for going back to the main function. */ /* Used for going back to the main function. */
static jmp_buf main_env; static jmp_buf main_env;
/* Store the prefix specified by an argument. */ /* Store the prefix specified by an argument. */
static char *prefix = 0; static char *prefix = NULL;
grub_addr_t grub_addr_t
grub_arch_modules_addr (void) grub_arch_modules_addr (void)
{ {
return 0; return NULL;
} }
grub_err_t grub_err_t
@ -155,7 +158,10 @@ main (int argc, char *argv[])
volatile int hold = 0; volatile int hold = 0;
int opt; int opt;
progname = "grub-emu"; set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
while ((opt = getopt_long (argc, argv, "r:d:m:vH:hV", options, 0)) != -1) while ((opt = getopt_long (argc, argv, "r:d:m:vH:hV", options, 0)) != -1)
switch (opt) switch (opt)
@ -178,7 +184,7 @@ main (int argc, char *argv[])
case 'h': case 'h':
return usage (0); return usage (0);
case 'V': case 'V':
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION); printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0; return 0;
default: default:
return usage (1); return usage (1);
@ -193,7 +199,7 @@ main (int argc, char *argv[])
/* Wait until the ARGS.HOLD variable is cleared by an attached debugger. */ /* Wait until the ARGS.HOLD variable is cleared by an attached debugger. */
if (hold && verbosity > 0) if (hold && verbosity > 0)
printf ("Run \"gdb %s %d\", and set ARGS.HOLD to zero.\n", printf ("Run \"gdb %s %d\", and set ARGS.HOLD to zero.\n",
progname, (int) getpid ()); program_name, (int) getpid ());
while (hold) while (hold)
{ {
if (hold > 0) if (hold > 0)

View file

@ -1,7 +1,7 @@
/* grub-fstest.c - debug tool for filesystem driver */ /* grub-fstest.c - debug tool for filesystem driver */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc. * Copyright (C) 2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,6 +31,7 @@
#include <grub/lib/hexdump.h> #include <grub/lib/hexdump.h>
#include <grub/lib/crc.h> #include <grub/lib/crc.h>
#include <grub/command.h> #include <grub/command.h>
#include <grub/i18n.h>
#include <grub_fstest_init.h> #include <grub_fstest_init.h>
@ -40,6 +41,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <getopt.h> #include <getopt.h>
#include "progname.h"
void void
grub_putchar (int c) grub_putchar (int c)
{ {
@ -82,7 +85,7 @@ execute_command (char *name, int n, char **args)
#define BUF_SIZE 32256 #define BUF_SIZE 32256
static grub_off_t skip, leng; static grub_disk_addr_t skip, leng;
static void static void
read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len)) read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len))
@ -137,7 +140,7 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len))
if (skip > file->size) if (skip > file->size)
{ {
grub_util_error ("invalid skip value %d."); grub_util_error ("invalid skip value %lld.", (unsigned long long) skip);
return; return;
} }
@ -346,10 +349,10 @@ static void
usage (int status) usage (int status)
{ {
if (status) if (status)
fprintf (stderr, "Try ``grub-fstest --help'' for more information.\n"); fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
else else
printf ("\ printf ("\
Usage: grub-fstest [OPTION]... IMAGE_PATH COMMANDS\n\ Usage: %s [OPTION]... IMAGE_PATH COMMANDS\n\
\n\ \n\
Debug tool for filesystem driver.\n\ Debug tool for filesystem driver.\n\
\nCommands:\n\ \nCommands:\n\
@ -369,7 +372,7 @@ Debug tool for filesystem driver.\n\
-V, --version print version information and exit\n\ -V, --version print version information and exit\n\
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
\n\ \n\
Report bugs to <%s>.\n", PACKAGE_BUGREPORT); Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
exit (status); exit (status);
} }
@ -377,10 +380,13 @@ Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
char *debug_str = 0, *root = 0, *default_root, *alloc_root; char *debug_str = NULL, *root = NULL, *default_root, *alloc_root;
int i, cmd, num_opts, image_index, num_disks = 1; int i, cmd, num_opts, image_index, num_disks = 1;
progname = "grub-fstest"; set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Find the first non option entry. */ /* Find the first non option entry. */
for (num_opts = 1; num_opts < argc; num_opts++) for (num_opts = 1; num_opts < argc; num_opts++)
@ -442,7 +448,7 @@ main (int argc, char *argv[])
break; break;
case 'V': case 'V':
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION); printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0; return 0;
case 'v': case 'v':

View file

@ -247,6 +247,14 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
done done
fi fi
# Copy gettext files
mkdir -p ${grubdir}/locale/
for file in ${grubdir}/locale/*.mo ${pkglibdir}/locale/*.mo; do
if test -f "$file"; then
cp -f "$file" ${grubdir}/locale/
fi
done
# Write device to a variable so we don't have to traverse /dev every time. # Write device to a variable so we don't have to traverse /dev every time.
grub_device=`$grub_probe --target=device ${grubdir}` grub_device=`$grub_probe --target=device ${grubdir}`

View file

@ -24,8 +24,12 @@ bindir=@bindir@
sbindir=@sbindir@ sbindir=@sbindir@
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"` pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}` if test "x$grub_probe" = x; then
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}` grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
fi
if test "x$grub_mkrelpath" = x; then
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
fi
grub_warn () grub_warn ()
{ {

View file

@ -1,7 +1,7 @@
/* grub-mkdevicemap.c - make a device map file automatically */ /* grub-mkdevicemap.c - make a device map file automatically */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008 Free Software Foundation, Inc. * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -31,10 +31,13 @@
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/util/deviceiter.h> #include <grub/util/deviceiter.h>
#include <grub/i18n.h>
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#include <getopt.h> #include <getopt.h>
#include "progname.h"
static void static void
make_device_map (const char *device_map, int floppy_disks) make_device_map (const char *device_map, int floppy_disks)
{ {
@ -81,10 +84,10 @@ usage (int status)
{ {
if (status) if (status)
fprintf (stderr, fprintf (stderr,
"Try ``grub-mkdevicemap --help'' for more information.\n"); "Try ``%s --help'' for more information.\n", program_name);
else else
printf ("\ printf ("\
Usage: grub-mkdevicemap [OPTION]...\n\ Usage: %s [OPTION]...\n\
\n\ \n\
Generate a device map file automatically.\n\ Generate a device map file automatically.\n\
\n\ \n\
@ -96,7 +99,7 @@ Generate a device map file automatically.\n\
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
\n\ \n\
Report bugs to <%s>.\n\ Report bugs to <%s>.\n\
", ", program_name,
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT); DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
exit (status); exit (status);
@ -108,7 +111,10 @@ main (int argc, char *argv[])
char *dev_map = 0; char *dev_map = 0;
int floppy_disks = 1; int floppy_disks = 1;
progname = "grub-mkdevicemap"; set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Check for options. */ /* Check for options. */
while (1) while (1)
@ -140,7 +146,7 @@ main (int argc, char *argv[])
break; break;
case 'V': case 'V':
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION); printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0; return 0;
case 'v': case 'v':

View file

@ -19,6 +19,7 @@
#include <config.h> #include <config.h>
#include <grub/types.h> #include <grub/types.h>
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/i18n.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -29,6 +30,8 @@
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include <freetype/ftsynth.h> #include <freetype/ftsynth.h>
#include "progname.h"
#define GRUB_FONT_DEFAULT_SIZE 16 #define GRUB_FONT_DEFAULT_SIZE 16
#define GRUB_FONT_RANGE_BLOCK 1024 #define GRUB_FONT_RANGE_BLOCK 1024
@ -90,10 +93,10 @@ static void
usage (int status) usage (int status)
{ {
if (status) if (status)
fprintf (stderr, "Try ``grub-mkfont --help'' for more information.\n"); fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
else else
printf ("\ printf ("\
Usage: grub-mkfont [OPTIONS] FONT_FILES\n\ Usage: %s [OPTIONS] FONT_FILES\n\
\nOptions:\n\ \nOptions:\n\
-o, --output=FILE_NAME set output file name\n\ -o, --output=FILE_NAME set output file name\n\
-i, --index=N set face index\n\ -i, --index=N set face index\n\
@ -109,7 +112,7 @@ Usage: grub-mkfont [OPTIONS] FONT_FILES\n\
-V, --version print version information and exit\n\ -V, --version print version information and exit\n\
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
\n\ \n\
Report bugs to <%s>.\n", PACKAGE_BUGREPORT); Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
exit (status); exit (status);
} }
@ -363,8 +366,8 @@ write_font (struct grub_font_info *font_info, char *output_file)
if (! style_name[0]) if (! style_name[0])
strcpy (style_name, " Regular"); strcpy (style_name, " Regular");
asprintf (&font_name, "%s %s %d", font_info->name, &style_name[1], font_name = xasprintf ("%s %s %d", font_info->name, &style_name[1],
font_info->size); font_info->size);
write_string_section ("NAME", font_name, &offset, file); write_string_section ("NAME", font_name, &offset, file);
write_string_section ("FAMI", font_info->name, &offset, file); write_string_section ("FAMI", font_info->name, &offset, file);
@ -472,7 +475,10 @@ main (int argc, char *argv[])
memset (&font_info, 0, sizeof (font_info)); memset (&font_info, 0, sizeof (font_info));
progname = "grub-mkfont"; set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Check for options. */ /* Check for options. */
while (1) while (1)
@ -560,7 +566,7 @@ main (int argc, char *argv[])
break; break;
case 'V': case 'V':
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION); printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0; return 0;
case 'v': case 'v':

View file

@ -18,8 +18,11 @@
*/ */
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/i18n.h>
#include <getopt.h> #include <getopt.h>
#include "progname.h"
static struct option options[] = static struct option options[] =
{ {
{"help", no_argument, 0, 'h'}, {"help", no_argument, 0, 'h'},
@ -30,10 +33,10 @@ static void
usage (int status) usage (int status)
{ {
if (status) if (status)
fprintf (stderr, "Try ``grub-mkrelpath --help'' for more information.\n"); fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
else else
printf ("\ printf ("\
Usage: grub-mkrelpath [OPTIONS] PATH\n\ Usage: %s [OPTIONS] PATH\n\
\n\ \n\
Make a system path relative to it's root.\n\ Make a system path relative to it's root.\n\
\n\ \n\
@ -41,7 +44,7 @@ Options:\n\
-h, --help display this message and exit\n\ -h, --help display this message and exit\n\
-V, --version print version information and exit\n\ -V, --version print version information and exit\n\
\n\ \n\
Report bugs to <%s>.\n", PACKAGE_BUGREPORT); Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
exit (status); exit (status);
} }
@ -51,7 +54,10 @@ main (int argc, char *argv[])
{ {
char *argument, *relpath; char *argument, *relpath;
progname = "grub-mkrelpath"; set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Check for options. */ /* Check for options. */
while (1) while (1)
@ -68,7 +74,7 @@ main (int argc, char *argv[])
break; break;
case 'V': case 'V':
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION); printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0; return 0;
default: default:

View file

@ -100,6 +100,13 @@ process_input_dir ()
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/ cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
fi fi
done done
mkdir -p ${iso9660_dir}/boot/grub/locale
for file in ${input_dir}/po/*.mo; do
if test -f "$file"; then
cp -f "$file" ${iso9660_dir}/boot/grub/locale/
fi
done
} }
if [ "${override_dir}" = "" ] ; then if [ "${override_dir}" = "" ] ; then

View file

@ -1,7 +1,7 @@
/* grub-pe2elf.c - tool to convert pe image to elf. */ /* grub-pe2elf.c - tool to convert pe image to elf. */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc. * Copyright (C) 2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -40,10 +40,10 @@ static void
usage (int status) usage (int status)
{ {
if (status) if (status)
fprintf (stderr, "Try ``grub-pe2elf --help'' for more information.\n"); fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
else else
printf ("\ printf ("\
Usage: grub-pe2elf [OPTIONS] input [output]\n\ Usage: %s [OPTIONS] input [output]\n\
\n\ \n\
Tool to convert pe image to elf.\n\ Tool to convert pe image to elf.\n\
\nOptions:\n\ \nOptions:\n\
@ -51,7 +51,7 @@ Tool to convert pe image to elf.\n\
-V, --version print version information and exit\n\ -V, --version print version information and exit\n\
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
\n\ \n\
Report bugs to <%s>.\n", PACKAGE_BUGREPORT); Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
exit (status); exit (status);
} }
@ -467,7 +467,7 @@ main (int argc, char *argv[])
char *image; char *image;
FILE* fp; FILE* fp;
progname = "grub-pe2elf"; set_program_name (argv[0]);
/* Check for options. */ /* Check for options. */
while (1) while (1)
@ -484,7 +484,7 @@ main (int argc, char *argv[])
break; break;
case 'V': case 'V':
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION); printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0; return 0;
case 'v': case 'v':

View file

@ -31,6 +31,7 @@
#include <grub/term.h> #include <grub/term.h>
#include <grub/env.h> #include <grub/env.h>
#include <grub/raid.h> #include <grub/raid.h>
#include <grub/i18n.h>
#include <grub_probe_init.h> #include <grub_probe_init.h>
@ -43,6 +44,8 @@
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#include <getopt.h> #include <getopt.h>
#include "progname.h"
enum { enum {
PRINT_FS, PRINT_FS,
PRINT_FS_UUID, PRINT_FS_UUID,
@ -235,33 +238,36 @@ probe (const char *path, char *device_name)
if (print == PRINT_FS) if (print == PRINT_FS)
{ {
struct stat st; if (path)
{
struct stat st;
stat (path, &st); stat (path, &st);
if (S_ISREG (st.st_mode)) if (S_ISREG (st.st_mode))
{ {
/* Regular file. Verify that we can read it properly. */ /* Regular file. Verify that we can read it properly. */
grub_file_t file; grub_file_t file;
char *rel_path; char *rel_path;
grub_util_info ("reading %s via OS facilities", path); grub_util_info ("reading %s via OS facilities", path);
filebuf_via_sys = grub_util_read_image (path); filebuf_via_sys = grub_util_read_image (path);
rel_path = make_system_path_relative_to_its_root (path); rel_path = make_system_path_relative_to_its_root (path);
asprintf (&grub_path, "(%s)%s", drive_name, rel_path); grub_path = xasprintf ("(%s)%s", drive_name, rel_path);
free (rel_path); free (rel_path);
grub_util_info ("reading %s via GRUB facilities", grub_path); grub_util_info ("reading %s via GRUB facilities", grub_path);
file = grub_file_open (grub_path); file = grub_file_open (grub_path);
if (! file) if (! file)
grub_util_error ("can not open %s via GRUB facilities", grub_path); grub_util_error ("can not open %s via GRUB facilities", grub_path);
filebuf_via_grub = xmalloc (file->size); filebuf_via_grub = xmalloc (file->size);
grub_file_read (file, filebuf_via_grub, file->size); grub_file_read (file, filebuf_via_grub, file->size);
grub_util_info ("comparing"); grub_util_info ("comparing");
if (memcmp (filebuf_via_grub, filebuf_via_sys, file->size)) if (memcmp (filebuf_via_grub, filebuf_via_sys, file->size))
grub_util_error ("files differ"); grub_util_error ("files differ");
}
} }
printf ("%s\n", fs->name); printf ("%s\n", fs->name);
@ -303,10 +309,10 @@ usage (int status)
{ {
if (status) if (status)
fprintf (stderr, fprintf (stderr,
"Try ``grub-probe --help'' for more information.\n"); "Try ``%s --help'' for more information.\n", program_name);
else else
printf ("\ printf ("\
Usage: grub-probe [OPTION]... [PATH|DEVICE]\n\ Usage: %s [OPTION]... [PATH|DEVICE]\n\
\n\ \n\
Probe device information for a given path (or device, if the -d option is given).\n\ Probe device information for a given path (or device, if the -d option is given).\n\
\n\ \n\
@ -319,7 +325,7 @@ Probe device information for a given path (or device, if the -d option is given)
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
\n\ \n\
Report bugs to <%s>.\n\ Report bugs to <%s>.\n\
", ", program_name,
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT); DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
exit (status); exit (status);
@ -331,7 +337,10 @@ main (int argc, char *argv[])
char *dev_map = 0; char *dev_map = 0;
char *argument; char *argument;
progname = "grub-probe"; set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Check for options. */ /* Check for options. */
while (1) while (1)
@ -376,7 +385,7 @@ main (int argc, char *argv[])
break; break;
case 'V': case 'V':
printf ("%s (%s) %s\n", progname, PACKAGE_NAME, PACKAGE_VERSION); printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0; return 0;
case 'v': case 'v':

View file

@ -24,7 +24,7 @@ libdir=@libdir@
. ${bindir}/gettext.sh . ${bindir}/gettext.sh
export TEXTDOMAIN=@PACKAGE@ export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR=@LOCALEDIR@ export TEXTDOMAINDIR=@localedir@
case "${GRUB_DISTRIBUTOR}" in case "${GRUB_DISTRIBUTOR}" in
Debian) OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;; Debian) OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;;
@ -38,7 +38,7 @@ kfreebsd_entry ()
recovery="$3" # not used yet recovery="$3" # not used yet
args="$4" # not used yet args="$4" # not used yet
title="$(gettext "%s, with kFreeBSD %s")" title="$(gettext "%s, with kFreeBSD %s")"
printf "menuentry \"${title}\" {" ${os} ${version} printf "menuentry \"${title}\" {\n" "${os}" "${version}"
if [ -z "${prepare_boot_cache}" ]; then if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi fi

View file

@ -24,7 +24,7 @@ libdir=@libdir@
. ${bindir}/gettext.sh . ${bindir}/gettext.sh
export TEXTDOMAIN=@PACKAGE@ export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR=@LOCALEDIR@ export TEXTDOMAINDIR=@localedir@
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux OS=GNU/Linux
@ -58,7 +58,7 @@ linux_entry ()
else else
title="$(gettext "%s, with Linux %s")" title="$(gettext "%s, with Linux %s")"
fi fi
printf "menuentry \"${title}\" {" ${os} ${version} printf "menuentry \"${title}\" {\n" "${os}" "${version}"
if [ -z "${prepare_boot_cache}" ]; then if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi fi

View file

@ -679,14 +679,14 @@ make_device_name (int drive, int dos_part, int bsd_part)
char *bsd_part_str = NULL; char *bsd_part_str = NULL;
if (dos_part >= 0) if (dos_part >= 0)
asprintf (&dos_part_str, ",%d", dos_part + 1); dos_part_str = xasprintf (",%d", dos_part + 1);
if (bsd_part >= 0) if (bsd_part >= 0)
asprintf (&bsd_part_str, ",%c", dos_part + 'a'); bsd_part_str = xasprintf (",%c", dos_part + 'a');
asprintf (&ret, "%s%s%s", map[drive].drive, ret = xasprintf ("%s%s%s", map[drive].drive,
dos_part_str ? : "", dos_part_str ? : "",
bsd_part_str ? : ""); bsd_part_str ? : "");
if (dos_part_str) if (dos_part_str)
free (dos_part_str); free (dos_part_str);

View file

@ -30,6 +30,7 @@
#include <grub/kernel.h> #include <grub/kernel.h>
#include <grub/efi/pe32.h> #include <grub/efi/pe32.h>
#include <grub/machine/kernel.h> #include <grub/machine/kernel.h>
#include "progname.h"
#if GRUB_TARGET_WORDSIZE == 32 #if GRUB_TARGET_WORDSIZE == 32
# define grub_le_to_cpu(val) grub_le_to_cpu32(val) # define grub_le_to_cpu(val) grub_le_to_cpu32(val)
@ -54,12 +55,12 @@ align_pe32_section (Elf_Addr addr)
/* Read the whole kernel image. Return the pointer to a read image, /* Read the whole kernel image. Return the pointer to a read image,
and store the size in bytes in *SIZE. */ and store the size in bytes in *SIZE. */
static char * static char *
read_kernel_module (const char *dir, size_t *size) read_kernel_image (const char *dir, size_t *size)
{ {
char *kernel_image; char *kernel_image;
char *kernel_path; char *kernel_path;
kernel_path = grub_util_get_path (dir, "kernel.mod"); kernel_path = grub_util_get_path (dir, "kernel.img");
*size = grub_util_get_image_size (kernel_path); *size = grub_util_get_image_size (kernel_path);
kernel_image = grub_util_read_image (kernel_path); kernel_image = grub_util_read_image (kernel_path);
free (kernel_path); free (kernel_path);
@ -944,7 +945,7 @@ convert_elf (const char *dir, char *prefix, FILE *out, char *mods[])
int i; int i;
/* Get the kernel image and check the format. */ /* Get the kernel image and check the format. */
kernel_image = read_kernel_module (dir, &kernel_size); kernel_image = read_kernel_image (dir, &kernel_size);
e = (Elf_Ehdr *) kernel_image; e = (Elf_Ehdr *) kernel_image;
if (! check_elf_header (e, kernel_size)) if (! check_elf_header (e, kernel_size))
grub_util_error ("invalid ELF header"); grub_util_error ("invalid ELF header");
@ -1056,7 +1057,7 @@ main (int argc, char *argv[])
char *dir = NULL; char *dir = NULL;
char *prefix = NULL; char *prefix = NULL;
progname = "grub-mkimage"; program_name = "grub-mkimage";
while (1) while (1)
{ {

View file

@ -39,6 +39,8 @@
#include <grub/term.h> #include <grub/term.h>
#include <grub/time.h> #include <grub/time.h>
#include "progname.h"
/* Include malloc.h, only if memalign is available. It is known that /* Include malloc.h, only if memalign is available. It is known that
memalign is declared in malloc.h in all systems, if present. */ memalign is declared in malloc.h in all systems, if present. */
#ifdef HAVE_MEMALIGN #ifdef HAVE_MEMALIGN
@ -50,7 +52,6 @@
#include <winioctl.h> #include <winioctl.h>
#endif #endif
char *progname = 0;
int verbosity = 0; int verbosity = 0;
void void
@ -58,7 +59,7 @@ grub_util_warn (const char *fmt, ...)
{ {
va_list ap; va_list ap;
fprintf (stderr, "%s: warn: ", progname); fprintf (stderr, "%s: warn: ", program_name);
va_start (ap, fmt); va_start (ap, fmt);
vfprintf (stderr, fmt, ap); vfprintf (stderr, fmt, ap);
va_end (ap); va_end (ap);
@ -73,7 +74,7 @@ grub_util_info (const char *fmt, ...)
{ {
va_list ap; va_list ap;
fprintf (stderr, "%s: info: ", progname); fprintf (stderr, "%s: info: ", program_name);
va_start (ap, fmt); va_start (ap, fmt);
vfprintf (stderr, fmt, ap); vfprintf (stderr, fmt, ap);
va_end (ap); va_end (ap);
@ -87,7 +88,7 @@ grub_util_error (const char *fmt, ...)
{ {
va_list ap; va_list ap;
fprintf (stderr, "%s: error: ", progname); fprintf (stderr, "%s: error: ", program_name);
va_start (ap, fmt); va_start (ap, fmt);
vfprintf (stderr, fmt, ap); vfprintf (stderr, fmt, ap);
va_end (ap); va_end (ap);
@ -369,6 +370,19 @@ grub_arch_sync_caches (void *address __attribute__ ((unused)),
{ {
} }
#ifndef HAVE_VASPRINTF
int
vasprintf (char **buf, const char *fmt, va_list ap)
{
/* Should be large enough. */
*buf = xmalloc (512);
return vsprintf (*buf, fmt, ap);
}
#endif
#ifndef HAVE_ASPRINTF #ifndef HAVE_ASPRINTF
int int
@ -377,11 +391,8 @@ asprintf (char **buf, const char *fmt, ...)
int status; int status;
va_list ap; va_list ap;
/* Should be large enough. */
*buf = xmalloc (512);
va_start (ap, fmt); va_start (ap, fmt);
status = vsprintf (*buf, fmt, ap); status = vasprintf (*buf, fmt, ap);
va_end (ap); va_end (ap);
return status; return status;
@ -389,6 +400,23 @@ asprintf (char **buf, const char *fmt, ...)
#endif #endif
char *
xasprintf (const char *fmt, ...)
{
va_list ap;
char *result;
va_start (ap, fmt);
if (vasprintf (&result, fmt, ap) < 0)
{
if (errno == ENOMEM)
grub_util_error ("out of memory");
return NULL;
}
return result;
}
#ifdef __MINGW32__ #ifdef __MINGW32__
void sync (void) void sync (void)
@ -499,7 +527,17 @@ make_system_path_relative_to_its_root (const char *path)
/* buf is another filesystem; we found it. */ /* buf is another filesystem; we found it. */
if (st.st_dev != num) if (st.st_dev != num)
break; {
/* offset == 0 means path given is the mount point. */
if (offset == 0)
{
free (buf);
free (buf2);
return strdup ("/");
}
else
break;
}
offset = p - buf; offset = p - buf;
/* offset == 1 means root directory. */ /* offset == 1 means root directory. */

View file

@ -202,17 +202,17 @@ static const struct ld_option ld_options[] =
{ {"all-files", no_argument, NULL, 'a'}, { {"all-files", no_argument, NULL, 'a'},
'a', NULL, N_("Process all files (don't skip backup files)"), ONE_DASH }, 'a', NULL, N_("Process all files (don't skip backup files)"), ONE_DASH },
{ {"abstract", required_argument, NULL, OPTION_ABSTRACT}, { {"abstract", required_argument, NULL, OPTION_ABSTRACT},
'\0', "FILE", N_("Set Abstract filename"), ONE_DASH }, '\0', N_("FILE"), N_("Set Abstract filename"), ONE_DASH },
{ {"appid", required_argument, NULL, 'A'}, { {"appid", required_argument, NULL, 'A'},
'A', "ID", N_("Set Application ID"), ONE_DASH }, 'A', N_("ID"), N_("Set Application ID"), ONE_DASH },
{ {"biblio", required_argument, NULL, OPTION_BIBLIO}, { {"biblio", required_argument, NULL, OPTION_BIBLIO},
'\0', "FILE", N_("Set Bibliographic filename"), ONE_DASH }, '\0', N_("FILE"), N_("Set Bibliographic filename"), ONE_DASH },
{ {"copyright", required_argument, NULL, OPTION_COPYRIGHT}, { {"copyright", required_argument, NULL, OPTION_COPYRIGHT},
'\0', "FILE", N_("Set Copyright filename"), ONE_DASH }, '\0', N_("FILE"), N_("Set Copyright filename"), ONE_DASH },
{ {"eltorito-boot", required_argument, NULL, 'b'}, { {"eltorito-boot", required_argument, NULL, 'b'},
'b', "FILE", N_("Set El Torito boot image name"), ONE_DASH }, 'b', N_("FILE"), N_("Set El Torito boot image name"), ONE_DASH },
{ {"eltorito-catalog", required_argument, NULL, 'c'}, { {"eltorito-catalog", required_argument, NULL, 'c'},
'c', "FILE", N_("Set El Torito boot catalog name"), ONE_DASH }, 'c', N_("FILE"), N_("Set El Torito boot catalog name"), ONE_DASH },
{ {"boot-info-table", no_argument, NULL, OPTION_BOOT_INFO_TABLE }, { {"boot-info-table", no_argument, NULL, OPTION_BOOT_INFO_TABLE },
'\0', NULL, N_("Patch Boot Info Table in El Torito boot image"), ONE_DASH }, '\0', NULL, N_("Patch Boot Info Table in El Torito boot image"), ONE_DASH },
{ {"no-emul-boot", no_argument, NULL, OPTION_NO_EMUL_BOOT }, { {"no-emul-boot", no_argument, NULL, OPTION_NO_EMUL_BOOT },
@ -220,7 +220,7 @@ static const struct ld_option ld_options[] =
{ {"eltorito-emul-floppy", no_argument, NULL, OPTION_ELTORITO_EMUL_FLOPPY }, { {"eltorito-emul-floppy", no_argument, NULL, OPTION_ELTORITO_EMUL_FLOPPY },
'\0', NULL, N_("Enable floppy drive emulation for El Torito"), TWO_DASHES }, '\0', NULL, N_("Enable floppy drive emulation for El Torito"), TWO_DASHES },
{ {"cdwrite-params", required_argument, NULL, 'C'}, { {"cdwrite-params", required_argument, NULL, 'C'},
'C', "PARAMS", N_("Magic parameters from cdrecord"), ONE_DASH }, 'C', N_("PARAMS"), N_("Magic parameters from cdrecord"), ONE_DASH },
{ {"omit-period", no_argument, NULL, 'd'}, { {"omit-period", no_argument, NULL, 'd'},
'd', NULL, N_("Omit trailing periods from filenames"), ONE_DASH }, 'd', NULL, N_("Omit trailing periods from filenames"), ONE_DASH },
{ {"disable-deep-relocation", no_argument, NULL, 'D'}, { {"disable-deep-relocation", no_argument, NULL, 'D'},
@ -234,11 +234,11 @@ static const struct ld_option ld_options[] =
{ {"version", no_argument, NULL, OPTION_VERSION}, { {"version", no_argument, NULL, OPTION_VERSION},
'\0', NULL, N_("Print version information and exit"), TWO_DASHES }, '\0', NULL, N_("Print version information and exit"), TWO_DASHES },
{ {"hide", required_argument, NULL, OPTION_I_HIDE}, { {"hide", required_argument, NULL, OPTION_I_HIDE},
'\0', "GLOBFILE", N_("Hide ISO9660/RR file"), ONE_DASH }, '\0', N_("GLOBFILE"), N_("Hide ISO9660/RR file"), ONE_DASH },
{ {"hide-joliet", required_argument, NULL, OPTION_J_HIDE}, { {"hide-joliet", required_argument, NULL, OPTION_J_HIDE},
'\0', "GLOBFILE", N_("Hide Joliet file"), ONE_DASH }, '\0', N_("GLOBFILE"), N_("Hide Joliet file"), ONE_DASH },
{ {NULL, required_argument, NULL, 'i'}, { {NULL, required_argument, NULL, 'i'},
'i', "ADD_FILES", N_("No longer supported"), TWO_DASHES }, 'i', N_("ADD_FILES"), N_("No longer supported"), TWO_DASHES },
{ {"joliet", no_argument, NULL, 'J'}, { {"joliet", no_argument, NULL, 'J'},
'J', NULL, N_("Generate Joliet directory information"), ONE_DASH }, 'J', NULL, N_("Generate Joliet directory information"), ONE_DASH },
{ {"full-iso9660-filenames", no_argument, NULL, 'l'}, { {"full-iso9660-filenames", no_argument, NULL, 'l'},
@ -246,11 +246,11 @@ static const struct ld_option ld_options[] =
{ {"allow-leading-dots", no_argument, NULL, 'L'}, { {"allow-leading-dots", no_argument, NULL, 'L'},
'L', NULL, N_("Allow iso9660 filenames to start with '.'"), ONE_DASH }, 'L', NULL, N_("Allow iso9660 filenames to start with '.'"), ONE_DASH },
{ {"log-file", required_argument, NULL, OPTION_LOG_FILE}, { {"log-file", required_argument, NULL, OPTION_LOG_FILE},
'\0', "LOG_FILE", N_("Re-direct messages to LOG_FILE"), ONE_DASH }, '\0', N_("LOG_FILE"), N_("Re-direct messages to LOG_FILE"), ONE_DASH },
{ {"exclude", required_argument, NULL, 'm'}, { {"exclude", required_argument, NULL, 'm'},
'm', "GLOBFILE", N_("Exclude file name"), ONE_DASH }, 'm', N_("GLOBFILE"), N_("Exclude file name"), ONE_DASH },
{ {"prev-session", required_argument, NULL, 'M'}, { {"prev-session", required_argument, NULL, 'M'},
'M', "FILE", N_("Set path to previous session to merge"), ONE_DASH }, 'M', N_("FILE"), N_("Set path to previous session to merge"), ONE_DASH },
{ {"omit-version-number", no_argument, NULL, 'N'}, { {"omit-version-number", no_argument, NULL, 'N'},
'N', NULL, N_("Omit version number from iso9660 filename"), ONE_DASH }, 'N', NULL, N_("Omit version number from iso9660 filename"), ONE_DASH },
{ {"no-split-symlink-components", no_argument, NULL, 0}, { {"no-split-symlink-components", no_argument, NULL, 0},
@ -258,13 +258,13 @@ static const struct ld_option ld_options[] =
{ {"no-split-symlink-fields", no_argument, NULL, 0}, { {"no-split-symlink-fields", no_argument, NULL, 0},
0, NULL, N_("Inhibit splitting symlink fields"), ONE_DASH }, 0, NULL, N_("Inhibit splitting symlink fields"), ONE_DASH },
{ {"output", required_argument, NULL, 'o'}, { {"output", required_argument, NULL, 'o'},
'o', "FILE", N_("Set output file name"), ONE_DASH }, 'o', N_("FILE"), N_("Set output file name"), ONE_DASH },
{ {"preparer", required_argument, NULL, 'p'}, { {"preparer", required_argument, NULL, 'p'},
'p', "PREP", N_("Set Volume preparer"), ONE_DASH }, 'p', N_("PREP"), N_("Set Volume preparer"), ONE_DASH },
{ {"print-size", no_argument, NULL, OPTION_PRINT_SIZE}, { {"print-size", no_argument, NULL, OPTION_PRINT_SIZE},
'\0', NULL, N_("Print estimated filesystem size and exit"), ONE_DASH }, '\0', NULL, N_("Print estimated filesystem size and exit"), ONE_DASH },
{ {"publisher", required_argument, NULL, 'P'}, { {"publisher", required_argument, NULL, 'P'},
'P', "PUB", N_("Set Volume publisher"), ONE_DASH }, 'P', N_("PUB"), N_("Set Volume publisher"), ONE_DASH },
{ {"quiet", no_argument, NULL, OPTION_QUIET}, { {"quiet", no_argument, NULL, OPTION_QUIET},
'\0', NULL, N_("Run quietly"), ONE_DASH }, '\0', NULL, N_("Run quietly"), ONE_DASH },
{ {"rational-rock", no_argument, NULL, 'r'}, { {"rational-rock", no_argument, NULL, 'r'},
@ -274,21 +274,21 @@ static const struct ld_option ld_options[] =
{ {"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT}, { {"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT},
'\0', NULL, N_("Split output into files of approx. 1GB size"), ONE_DASH }, '\0', NULL, N_("Split output into files of approx. 1GB size"), ONE_DASH },
{ {"sysid", required_argument, NULL, OPTION_SYSID}, { {"sysid", required_argument, NULL, OPTION_SYSID},
'\0', "ID", N_("Set System ID"), ONE_DASH }, '\0', N_("ID"), N_("Set System ID"), ONE_DASH },
{ {"translation-table", no_argument, NULL, 'T'}, { {"translation-table", no_argument, NULL, 'T'},
'T', NULL, N_("Generate translation tables for systems that don't understand long filenames"), ONE_DASH }, 'T', NULL, N_("Generate translation tables for systems that don't understand long filenames"), ONE_DASH },
{ {"verbose", no_argument, NULL, 'v'}, { {"verbose", no_argument, NULL, 'v'},
'v', NULL, N_("Verbose"), ONE_DASH }, 'v', NULL, N_("Verbose"), ONE_DASH },
{ {"volid", required_argument, NULL, 'V'}, { {"volid", required_argument, NULL, 'V'},
'V', "ID", N_("Set Volume ID"), ONE_DASH }, 'V', N_("ID"), N_("Set Volume ID"), ONE_DASH },
{ {"volset", required_argument, NULL, OPTION_VOLSET}, { {"volset", required_argument, NULL, OPTION_VOLSET},
'\0', "ID", N_("Set Volume set ID"), ONE_DASH }, '\0', N_("ID"), N_("Set Volume set ID"), ONE_DASH },
{ {"volset-size", required_argument, NULL, OPTION_VOLSET_SIZE}, { {"volset-size", required_argument, NULL, OPTION_VOLSET_SIZE},
'\0', "#", N_("Set Volume set size"), ONE_DASH }, '\0', "#", N_("Set Volume set size"), ONE_DASH },
{ {"volset-seqno", required_argument, NULL, OPTION_VOLSET_SEQ_NUM}, { {"volset-seqno", required_argument, NULL, OPTION_VOLSET_SEQ_NUM},
'\0', "#", N_("Set Volume set sequence number"), ONE_DASH }, '\0', "#", N_("Set Volume set sequence number"), ONE_DASH },
{ {"old-exclude", required_argument, NULL, 'x'}, { {"old-exclude", required_argument, NULL, 'x'},
'x', "FILE", N_("Exclude file name (deprecated)"), ONE_DASH }, 'x', N_("FILE"), N_("Exclude file name (deprecated)"), ONE_DASH },
#ifdef ERIC_neverdef #ifdef ERIC_neverdef
{ {"transparent-compression", no_argument, NULL, 'z'}, { {"transparent-compression", no_argument, NULL, 'z'},
'z', NULL, "Enable transparent compression of files", ONE_DASH }, 'z', NULL, "Enable transparent compression of files", ONE_DASH },
@ -481,6 +481,7 @@ void usage(){
int comma; int comma;
int len; int len;
unsigned int j; unsigned int j;
char *arg;
printf (" "); printf (" ");
@ -502,8 +503,9 @@ void usage(){
putchar (' '); putchar (' ');
++len; ++len;
} }
printf ("%s", ld_options[j].arg); arg = gettext (ld_options[j].arg);
len += strlen (ld_options[j].arg); printf ("%s", arg);
len += strlen (arg);
} }
comma = TRUE; comma = TRUE;
} }
@ -527,8 +529,9 @@ void usage(){
+ strlen (ld_options[j].opt.name)); + strlen (ld_options[j].opt.name));
if (ld_options[j].arg != NULL) if (ld_options[j].arg != NULL)
{ {
printf (" %s", ld_options[j].arg); arg = gettext (ld_options[j].arg);
len += 1 + strlen (ld_options[j].arg); printf (" %s", arg);
len += 1 + strlen (arg);
} }
comma = TRUE; comma = TRUE;
} }

76
util/pci.c Normal file
View file

@ -0,0 +1,76 @@
/* pci.c - Generic PCI interfaces. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/pci.h>
#include <grub/dl.h>
#include <grub/util/misc.h>
grub_pci_address_t
grub_pci_make_address (grub_pci_device_t dev, int reg)
{
grub_pci_address_t ret;
ret.dev = dev;
ret.pos = reg << 2;
return ret;
}
void
grub_pci_iterate (grub_pci_iteratefunc_t hook)
{
struct pci_device_iterator *iter;
struct pci_slot_match slot;
struct pci_device *dev;
slot.domain = PCI_MATCH_ANY;
slot.bus = PCI_MATCH_ANY;
slot.dev = PCI_MATCH_ANY;
slot.func = PCI_MATCH_ANY;
iter = pci_slot_match_iterator_create (&slot);
while ((dev = pci_device_next (iter)))
hook (dev, dev->vendor_id | (dev->device_id << 16));
pci_iterator_destroy (iter);
}
void *
grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base,
grub_size_t size)
{
void *addr;
int err;
err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr);
if (err)
grub_util_error ("mapping 0x%x failed (error %d)\n", base, err);
return addr;
}
void
grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem,
grub_size_t size)
{
pci_device_unmap_range (dev, mem, size);
}
GRUB_MOD_INIT (pci)
{
pci_system_init ();
}
GRUB_MOD_FINI (pci)
{
pci_system_cleanup ();
}

View file

@ -31,9 +31,6 @@ target_cpu=@target_cpu@
platform=@platform@ platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}` pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
# for make_system_path_relative_to_its_root()
. ${libdir}/grub/grub-mkconfig_lib
grub_setup=${sbindir}/`echo grub-setup | sed ${transform}` grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}` grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}` grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
@ -120,6 +117,9 @@ for option in "$@"; do
esac esac
done done
# for make_system_path_relative_to_its_root()
. ${libdir}/grub/grub-mkconfig_lib
if test "x$install_device" = x; then if test "x$install_device" = x; then
echo "install_device not specified." 1>&2 echo "install_device not specified." 1>&2
usage usage

View file

@ -21,6 +21,7 @@
#include <grub/machine/boot.h> #include <grub/machine/boot.h>
#include <grub/machine/kernel.h> #include <grub/machine/kernel.h>
#include <grub/kernel.h> #include <grub/kernel.h>
#include <grub/i18n.h>
#include <grub/disk.h> #include <grub/disk.h>
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/util/resolve.h> #include <grub/util/resolve.h>
@ -34,6 +35,8 @@
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#include <getopt.h> #include <getopt.h>
#include "progname.h"
static void static void
compress_kernel (char *kernel_img, size_t kernel_size, compress_kernel (char *kernel_img, size_t kernel_size,
char **core_img, size_t *core_size) char **core_img, size_t *core_size)
@ -188,10 +191,10 @@ static void
usage (int status) usage (int status)
{ {
if (status) if (status)
fprintf (stderr, "Try ``grub-mkimage --help'' for more information.\n"); fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
else else
printf ("\ printf ("\
Usage: grub-mkimage [OPTION]... [MODULES]\n\ Usage: %s [OPTION]... [MODULES]\n\
\n\ \n\
Make a bootable image of GRUB.\n\ Make a bootable image of GRUB.\n\
\n\ \n\
@ -204,7 +207,7 @@ Make a bootable image of GRUB.\n\
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
\n\ \n\
Report bugs to <%s>.\n\ Report bugs to <%s>.\n\
", GRUB_LIBDIR, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT); ", program_name, GRUB_LIBDIR, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);
exit (status); exit (status);
} }
@ -218,7 +221,11 @@ main (int argc, char *argv[])
char *memdisk = NULL; char *memdisk = NULL;
FILE *fp = stdout; FILE *fp = stdout;
progname = "grub-mkimage"; set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
while (1) while (1)
{ {
int c = getopt_long (argc, argv, "d:p:m:o:hVv", options, 0); int c = getopt_long (argc, argv, "d:p:m:o:hVv", options, 0);

View file

@ -20,15 +20,22 @@
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/util/ofpath.h> #include <grub/util/ofpath.h>
#include <grub/i18n.h>
#include "progname.h"
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char *of_path; char *of_path;
progname = "grub-ofpathname"; set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
if (argc != 2) if (argc != 2)
{ {
printf("Usage: grub-ofpathname DEVICE\n"); printf("Usage: %s DEVICE\n", program_name);
return 1; return 1;
} }

View file

@ -21,6 +21,7 @@
#include <grub/types.h> #include <grub/types.h>
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/device.h> #include <grub/device.h>
#include <grub/i18n.h>
#include <grub/disk.h> #include <grub/disk.h>
#include <grub/file.h> #include <grub/file.h>
#include <grub/fs.h> #include <grub/fs.h>
@ -49,6 +50,8 @@
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#include <getopt.h> #include <getopt.h>
#include "progname.h"
/* This program fills in various fields inside of the 'boot' and 'core' /* This program fills in various fields inside of the 'boot' and 'core'
* image files. * image files.
* *
@ -401,10 +404,10 @@ static void
usage (int status) usage (int status)
{ {
if (status) if (status)
fprintf (stderr, "Try ``grub-setup --help'' for more information.\n"); fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
else else
printf ("\ printf ("\
Usage: grub-setup [OPTION]... DEVICE\n\ Usage: %s [OPTION]... DEVICE\n\
\n\ \n\
Set up images to boot from DEVICE.\n\ Set up images to boot from DEVICE.\n\
DEVICE must be a GRUB device (e.g. ``(hd0,1)'').\n\ DEVICE must be a GRUB device (e.g. ``(hd0,1)'').\n\
@ -419,7 +422,7 @@ DEVICE must be a GRUB device (e.g. ``(hd0,1)'').\n\
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
\n\ \n\
Report bugs to <%s>.\n\ Report bugs to <%s>.\n\
", ", program_name,
DEFAULT_BOOT_FILE, DEFAULT_CORE_FILE, DEFAULT_DIRECTORY, DEFAULT_BOOT_FILE, DEFAULT_CORE_FILE, DEFAULT_DIRECTORY,
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT); DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
@ -616,7 +619,10 @@ main (int argc, char *argv[])
{ {
struct grub_setup_info ginfo; struct grub_setup_info ginfo;
progname = "grub-setup"; set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
init_info (&ginfo); init_info (&ginfo);
if (!parse_options (&ginfo, argc, argv)) if (!parse_options (&ginfo, argc, argv))

398
video/efi_gop.c Normal file
View file

@ -0,0 +1,398 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 grub_video_render_target grub_video_fbrender_target
#include <grub/err.h>
#include <grub/types.h>
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/video.h>
#include <grub/video_fb.h>
#include <grub/efi/api.h>
#include <grub/efi/efi.h>
#include <grub/efi/graphics_output.h>
static grub_efi_guid_t graphics_output_guid = GRUB_EFI_GOP_GUID;
static struct grub_efi_gop *gop;
static unsigned old_mode;
static int restore_needed;
static struct
{
struct grub_video_mode_info mode_info;
struct grub_video_render_target *render_target;
grub_uint8_t *ptr;
} framebuffer;
static int
check_protocol (void)
{
gop = grub_efi_locate_protocol (&graphics_output_guid, 0);
if (gop)
return 1;
return 0;
}
static grub_err_t
grub_video_gop_init (void)
{
grub_memset (&framebuffer, 0, sizeof(framebuffer));
return grub_video_fb_init ();
}
static grub_err_t
grub_video_gop_fini (void)
{
if (restore_needed)
{
efi_call_2 (gop->set_mode, gop, old_mode);
restore_needed = 0;
}
return grub_video_fb_fini ();
}
static int
grub_video_gop_get_bpp (struct grub_efi_gop_mode_info *in)
{
grub_uint32_t total_mask;
int i;
switch (in->pixel_format)
{
case GRUB_EFI_GOT_BGRA8:
case GRUB_EFI_GOT_RGBA8:
return 32;
case GRUB_EFI_GOT_BITMASK:
/* Check overlaps. */
if ((in->pixel_bitmask.r & in->pixel_bitmask.g)
|| (in->pixel_bitmask.r & in->pixel_bitmask.b)
|| (in->pixel_bitmask.g & in->pixel_bitmask.b)
|| (in->pixel_bitmask.r & in->pixel_bitmask.a)
|| (in->pixel_bitmask.g & in->pixel_bitmask.a)
|| (in->pixel_bitmask.b & in->pixel_bitmask.a))
return 0;
total_mask = in->pixel_bitmask.r | in->pixel_bitmask.g
| in->pixel_bitmask.b | in->pixel_bitmask.a;
for (i = 31; i >= 0; i--)
if (total_mask & (1 << i))
return i + 1;
/* Fall through. */
default:
return 0;
}
}
static void
grub_video_gop_get_bitmask (grub_uint32_t mask, unsigned int *mask_size,
unsigned int *field_pos)
{
int i;
int last_p;
for (i = 31; i >= 0; i--)
if (mask & (1 << i))
break;
if (i == -1)
{
*mask_size = *field_pos = 0;
return;
}
last_p = i;
for (; i >= 0; i--)
if (!(mask & (1 << i)))
break;
*field_pos = i + 1;
*mask_size = last_p - *field_pos;
}
static grub_err_t
grub_video_gop_fill_mode_info (struct grub_efi_gop_mode_info *in,
struct grub_video_mode_info *out)
{
out->number_of_colors = 256;
out->width = in->width;
out->height = in->height;
out->mode_type = GRUB_VIDEO_MODE_TYPE_RGB;
out->bpp = grub_video_gop_get_bpp (in);
out->bytes_per_pixel = out->bpp >> 3;
if (!out->bpp)
return grub_error (GRUB_ERR_IO, "Unsupported video mode");
out->pitch = in->pixels_per_scanline * out->bytes_per_pixel;
switch (in->pixel_format)
{
case GRUB_EFI_GOT_RGBA8:
out->red_mask_size = 8;
out->red_field_pos = 0;
out->green_mask_size = 8;
out->green_field_pos = 8;
out->blue_mask_size = 8;
out->blue_field_pos = 16;
out->reserved_mask_size = 8;
out->reserved_field_pos = 24;
break;
case GRUB_EFI_GOT_BGRA8:
out->red_mask_size = 8;
out->red_field_pos = 16;
out->green_mask_size = 8;
out->green_field_pos = 8;
out->blue_mask_size = 8;
out->blue_field_pos = 0;
out->reserved_mask_size = 8;
out->reserved_field_pos = 24;
break;
case GRUB_EFI_GOT_BITMASK:
grub_video_gop_get_bitmask (in->pixel_bitmask.r, &out->red_mask_size,
&out->red_field_pos);
grub_video_gop_get_bitmask (in->pixel_bitmask.g, &out->green_mask_size,
&out->green_field_pos);
grub_video_gop_get_bitmask (in->pixel_bitmask.b, &out->blue_mask_size,
&out->blue_field_pos);
grub_video_gop_get_bitmask (in->pixel_bitmask.a, &out->reserved_mask_size,
&out->reserved_field_pos);
break;
default:
return grub_error (GRUB_ERR_IO, "Unsupported video mode");
}
out->blit_format = grub_video_get_blit_format (out);
return GRUB_ERR_NONE;
}
static grub_err_t
grub_video_gop_setup (unsigned int width, unsigned int height,
unsigned int mode_type)
{
unsigned int depth;
struct grub_efi_gop_mode_info *info = NULL;
unsigned best_mode = 0;
grub_err_t err;
unsigned bpp;
int found = 0;
unsigned long long best_volume = 0;
depth = (mode_type & GRUB_VIDEO_MODE_TYPE_DEPTH_MASK)
>> GRUB_VIDEO_MODE_TYPE_DEPTH_POS;
/* Keep current mode if possible. */
if (gop->mode->info)
{
bpp = grub_video_gop_get_bpp (gop->mode->info);
if (bpp && ((width == gop->mode->info->width
&& height == gop->mode->info->height)
|| (width == 0 && height == 0))
&& (depth == bpp || depth == 0))
{
grub_dprintf ("video", "GOP: keeping mode %d\n", gop->mode->mode);
best_mode = gop->mode->mode;
found = 1;
}
}
if (!found)
{
unsigned mode;
grub_dprintf ("video", "GOP: %d modes detected\n", gop->mode->max_mode);
for (mode = 0; mode < gop->mode->max_mode; mode++)
{
grub_efi_uintn_t size;
grub_efi_status_t status;
status = efi_call_4 (gop->query_mode, gop, mode, &size, &info);
if (status)
{
info = 0;
break;
}
grub_dprintf ("video", "GOP: mode %d: %dx%d\n", mode, info->width,
info->height);
bpp = grub_video_gop_get_bpp (info);
if (!bpp)
{
grub_dprintf ("video", "GOP: mode %d: incompatible pixel mode\n",
mode);
continue;
}
grub_dprintf ("video", "GOP: mode %d: depth %d\n", mode, bpp);
if (!(((info->width == width && info->height == height)
|| (width == 0 && height == 0))
&& (bpp == depth || depth == 0)))
{
grub_dprintf ("video", "GOP: mode %d: rejected\n", mode);
continue;
}
if (best_volume < ((unsigned long long) info->width)
* ((unsigned long long) info->height)
* ((unsigned long long) bpp))
{
best_volume = ((unsigned long long) info->width)
* ((unsigned long long) info->height)
* ((unsigned long long) bpp);
best_mode = mode;
}
found = 1;
}
}
if (!found)
{
grub_dprintf ("video", "GOP: no mode found\n");
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found.");
}
if (best_mode != gop->mode->mode)
{
if (!restore_needed)
{
old_mode = gop->mode->mode;
restore_needed = 1;
}
efi_call_2 (gop->set_mode, gop, best_mode);
}
info = gop->mode->info;
err = grub_video_gop_fill_mode_info (info, &framebuffer.mode_info);
if (err)
{
grub_dprintf ("video", "GOP: couldn't fill mode info\n");
return err;
}
framebuffer.ptr = (void *) (grub_addr_t) gop->mode->fb_base;
grub_dprintf ("video", "GOP: initialising FB @ %p %dx%dx%d\n",
framebuffer.ptr, framebuffer.mode_info.width,
framebuffer.mode_info.height, framebuffer.mode_info.bpp);
err = grub_video_fb_create_render_target_from_pointer
(&framebuffer.render_target, &framebuffer.mode_info, framebuffer.ptr);
if (err)
{
grub_dprintf ("video", "GOP: Couldn't create FB target\n");
return err;
}
err = grub_video_fb_set_active_render_target (framebuffer.render_target);
if (err)
{
grub_dprintf ("video", "GOP: Couldn't set FB target\n");
return err;
}
err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
grub_video_fbstd_colors);
if (err)
grub_dprintf ("video", "GOP: Couldn't set palette\n");
else
grub_dprintf ("video", "GOP: Success\n");
return err;
}
static grub_err_t
grub_video_gop_swap_buffers (void)
{
/* TODO: Implement buffer swapping. */
return GRUB_ERR_NONE;
}
static grub_err_t
grub_video_gop_set_active_render_target (struct grub_video_render_target *target)
{
if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY)
target = framebuffer.render_target;
return grub_video_fb_set_active_render_target (target);
}
static grub_err_t
grub_video_gop_get_info_and_fini (struct grub_video_mode_info *mode_info,
void **framebuf)
{
grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info));
*framebuf = (char *) framebuffer.ptr;
grub_video_fb_fini ();
return GRUB_ERR_NONE;
}
static struct grub_video_adapter grub_video_gop_adapter =
{
.name = "EFI GOP driver",
.init = grub_video_gop_init,
.fini = grub_video_gop_fini,
.setup = grub_video_gop_setup,
.get_info = grub_video_fb_get_info,
.get_info_and_fini = grub_video_gop_get_info_and_fini,
.set_palette = grub_video_fb_set_palette,
.get_palette = grub_video_fb_get_palette,
.set_viewport = grub_video_fb_set_viewport,
.get_viewport = grub_video_fb_get_viewport,
.map_color = grub_video_fb_map_color,
.map_rgb = grub_video_fb_map_rgb,
.map_rgba = grub_video_fb_map_rgba,
.unmap_color = grub_video_fb_unmap_color,
.fill_rect = grub_video_fb_fill_rect,
.blit_bitmap = grub_video_fb_blit_bitmap,
.blit_render_target = grub_video_fb_blit_render_target,
.scroll = grub_video_fb_scroll,
.swap_buffers = grub_video_gop_swap_buffers,
.create_render_target = grub_video_fb_create_render_target,
.delete_render_target = grub_video_fb_delete_render_target,
.set_active_render_target = grub_video_gop_set_active_render_target,
.get_active_render_target = grub_video_fb_get_active_render_target,
.next = 0
};
GRUB_MOD_INIT(efi_gop)
{
if (check_protocol ())
grub_video_register (&grub_video_gop_adapter);
}
GRUB_MOD_FINI(efi_gop)
{
if (restore_needed)
{
efi_call_2 (gop->set_mode, gop, old_mode);
restore_needed = 0;
}
if (gop)
grub_video_unregister (&grub_video_gop_adapter);
}

View file

@ -84,21 +84,22 @@ find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
{ {
int found = 0; 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); 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_id_t pciid)
{ {
grub_pci_address_t addr; grub_pci_address_t addr;
addr = grub_pci_make_address (bus, dev, func, 2); addr = grub_pci_make_address (dev, 2);
if (grub_pci_read (addr) >> 24 == 0x3) if (grub_pci_read (addr) >> 24 == 0x3)
{ {
int i; int i;
grub_dprintf ("fb", "Display controller: %d:%d.%d\nDevice id: %x\n", grub_dprintf ("fb", "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; addr += 8;
for (i = 0; i < 6; i++, addr += 4) for (i = 0; i < 6; i++, addr += 4)
{ {
@ -183,20 +184,20 @@ check_protocol (void)
} }
static grub_err_t static grub_err_t
grub_video_efi_init (void) grub_video_uga_init (void)
{ {
grub_memset (&framebuffer, 0, sizeof(framebuffer)); grub_memset (&framebuffer, 0, sizeof(framebuffer));
return grub_video_fb_init (); return grub_video_fb_init ();
} }
static grub_err_t static grub_err_t
grub_video_efi_fini (void) grub_video_uga_fini (void)
{ {
return grub_video_fb_fini (); return grub_video_fb_fini ();
} }
static grub_err_t static grub_err_t
grub_video_efi_setup (unsigned int width, unsigned int height, grub_video_uga_setup (unsigned int width, unsigned int height,
unsigned int mode_type) unsigned int mode_type)
{ {
unsigned int depth; unsigned int depth;
@ -269,14 +270,14 @@ grub_video_efi_setup (unsigned int width, unsigned int height,
} }
static grub_err_t static grub_err_t
grub_video_efi_swap_buffers (void) grub_video_uga_swap_buffers (void)
{ {
/* TODO: Implement buffer swapping. */ /* TODO: Implement buffer swapping. */
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
static grub_err_t static grub_err_t
grub_video_efi_set_active_render_target (struct grub_video_render_target *target) grub_video_uga_set_active_render_target (struct grub_video_render_target *target)
{ {
if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY) if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY)
target = framebuffer.render_target; target = framebuffer.render_target;
@ -285,7 +286,7 @@ grub_video_efi_set_active_render_target (struct grub_video_render_target *target
} }
static grub_err_t static grub_err_t
grub_video_efi_get_info_and_fini (struct grub_video_mode_info *mode_info, grub_video_uga_get_info_and_fini (struct grub_video_mode_info *mode_info,
void **framebuf) void **framebuf)
{ {
grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info)); grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info));
@ -296,15 +297,15 @@ grub_video_efi_get_info_and_fini (struct grub_video_mode_info *mode_info,
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
static struct grub_video_adapter grub_video_efi_adapter = static struct grub_video_adapter grub_video_uga_adapter =
{ {
.name = "EFI frame buffer driver", .name = "EFI UGA driver",
.init = grub_video_efi_init, .init = grub_video_uga_init,
.fini = grub_video_efi_fini, .fini = grub_video_uga_fini,
.setup = grub_video_efi_setup, .setup = grub_video_uga_setup,
.get_info = grub_video_fb_get_info, .get_info = grub_video_fb_get_info,
.get_info_and_fini = grub_video_efi_get_info_and_fini, .get_info_and_fini = grub_video_uga_get_info_and_fini,
.set_palette = grub_video_fb_set_palette, .set_palette = grub_video_fb_set_palette,
.get_palette = grub_video_fb_get_palette, .get_palette = grub_video_fb_get_palette,
.set_viewport = grub_video_fb_set_viewport, .set_viewport = grub_video_fb_set_viewport,
@ -317,21 +318,21 @@ static struct grub_video_adapter grub_video_efi_adapter =
.blit_bitmap = grub_video_fb_blit_bitmap, .blit_bitmap = grub_video_fb_blit_bitmap,
.blit_render_target = grub_video_fb_blit_render_target, .blit_render_target = grub_video_fb_blit_render_target,
.scroll = grub_video_fb_scroll, .scroll = grub_video_fb_scroll,
.swap_buffers = grub_video_efi_swap_buffers, .swap_buffers = grub_video_uga_swap_buffers,
.create_render_target = grub_video_fb_create_render_target, .create_render_target = grub_video_fb_create_render_target,
.delete_render_target = grub_video_fb_delete_render_target, .delete_render_target = grub_video_fb_delete_render_target,
.set_active_render_target = grub_video_efi_set_active_render_target, .set_active_render_target = grub_video_uga_set_active_render_target,
.get_active_render_target = grub_video_fb_get_active_render_target, .get_active_render_target = grub_video_fb_get_active_render_target,
}; };
GRUB_MOD_INIT(efi_fb) GRUB_MOD_INIT(efi_uga)
{ {
if (check_protocol ()) if (check_protocol ())
grub_video_register (&grub_video_efi_adapter); grub_video_register (&grub_video_uga_adapter);
} }
GRUB_MOD_FINI(efi_fb) GRUB_MOD_FINI(efi_uga)
{ {
if (uga) if (uga)
grub_video_unregister (&grub_video_efi_adapter); grub_video_unregister (&grub_video_uga_adapter);
} }