merge mainline into crypto

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-05 16:34:27 +01:00
commit 7d624c2949
68 changed files with 1412 additions and 6282 deletions

View File

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

326
ChangeLog
View File

@ -1,7 +1,327 @@
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
2009-12-05 Vladimir Serbinenko <phcoder@gmail.com>
* po/id.po: New file.
* LINGUAS: Add `id'.
* configure.ac (TARGET_ASFLAGS): Add "-D<MACHINE>".
2009-12-05 Carles Pina i Estany <carles@pina.cat>
* util/grub-install.in: Install gettext .mo files.
* util/grub-mkrescue.in (process_input_dir): Copy gettext .mo files.
2009-12-05 Carles Pina i Estany <carles@pina.cat>
* gettext/gettext.c (grub_gettext_init_ext): Replace grub_printf with
grub_dprintf.
2009-12-05 Robert Millan <rmh.grub@aybabtu.com>
* kern/ieee1275/openfw.c (grub_reboot): Disable for i386. The
non-firmware-dependant one in realmode.S takes precedence.
2009-12-04 Robert Millan <rmh.grub@aybabtu.com>
* commands/halt.c: Replace misc arch-specific headers with
`<grub/misc.h>'.
* commands/reboot.c: Likewise.
* commands/i386/pc/halt.c: Replace `<grub/machine/init.h>' with
`<grub/misc.h>'.
* conf/i386-coreboot.rmk (kernel_img_HEADERS): Remove `cpu/reboot.h'.
(halt_mod_SOURCES): Move `kern/i386/halt.c' from here ...
(kernel_img_SOURCES): ... to here.
* include/grub/efi/efi.h (grub_reboot, grub_halt): Remove prototypes.
* include/grub/i386/pc/init.h: Likewise.
* include/grub/powerpc/ieee1275/kernel.h: Likewise.
* include/grub/sparc64/ieee1275/kernel.h: Likewise.
* include/grub/misc.h (grub_reboot, grub_halt): New prototypes.
* include/grub/i386/halt.h: Remove.
* include/grub/i386/reboot.h: Likewise.
* kern/i386/halt.c: Remove `<grub/cpu/halt.h>'.
2009-12-03 David S. Miller <davem@sunset.davemloft.net>
* conf/sparc64-ieee1275.rmk (grub_mkimage_SOURCES,
grub_setup_SOURCES, grub_ofpathname_SOURCES): Add gnulib/progname.c
* util/sparc64/ieee1275/grub-mkimage.c: Include <grub/i18n.h> and
"progname.h"
* util/sparc64/ieee1275/grub-ofpathname.c: Likewise.
* util/sparc64/ieee1275/grub-setup.c: Likewise.
(usage): Add missing comma in printf.
2009-12-02 Robert Millan <rmh.grub@aybabtu.com>
Use the same reboot approach on i386 coreboot and qemu as we do on
BIOS.
* conf/i386-coreboot.rmk (kernel_img_HEADERS): Add `cpu/reboot.h'.
(reboot_mod_SOURCES): Remove `kern/i386/reboot.c'.
* kern/i386/reboot.c: Remove.
* include/grub/i386/reboot.h (grub_reboot): Export function.
* kern/i386/pc/startup.S (grub_reboot): Move from here ...
* kern/i386/realmode.S (grub_reboot): ... to here. Jump to
0xf000:0xfff0 instead of 0xffff:0x0000.
[!GRUB_MACHINE_PCBIOS] (prot_to_real): Do not restore interrupts.
* kern/i386/qemu/startup.S: Include `"../realmode.S"'.
2009-11-30 Robert Millan <rmh.grub@aybabtu.com>
Fix $srcdir != $objdir build.
* Makefile.in (po/%.po): Rewrite as ...
($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po)): ... this.
2009-11-29 Samuel Thibault <samuel.thibault@ens-lyon.org>
Fix GNU/Hurd grub-install crash.
* util/grub-probe.c (probe): Try to access `path' only when it is not
NULL.
2009-11-28 Vladimir Serbinenko <phcoder@gmail.com>
Correct module naming.
* video/efi_uga.c (GRUB_MOD_INIT(efi_fb)): Renamed from this ...
(GRUB_MOD_INIT(efi_uga)): ... to this
(GRUB_MOD_FINI(efi_fb)): Renamed from this ...
(GRUB_MOD_FINI(efi_uga)): ... to this
* video/efi_gop.c (GRUB_MOD_INIT(efi_fb)): Renamed from this ...
(GRUB_MOD_INIT(efi_gop)): ... to this
(GRUB_MOD_FINI(efi_fb)): Renamed from this ...
(GRUB_MOD_FINI(efi_gop)): ... to this
2009-11-28 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/mkisofs.c (ld_options): Mark all `arg' strings as
translatable.
(usage): Translate `arg' strings using gettext().
Thanks to Jordi Mallach for the suggestion.
2009-11-28 Vladimir Serbinenko <phcoder@gmail.com>
GOP support. Based on patch from Bean
(http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00384.html)
* video/efi_gop.c: New file.
* include/grub/efi/graphics_output.h: Likewise.
* conf/i386-efi.rmk (pkglib_MODULES): Add `efi_gop.mod'.
(efi_fb_mod_SOURCES, efi_fb_mod_CFLAGS, efi_fb_mod_LDFLAGS): New
variables.
* conf/x86_64-efi.rmk: Likewise.
2009-11-28 Vladimir Serbinenko <phcoder@gmail.com>
Rename efi_fb to efi_uga.
* conf/i386-efi.rmk (pkglib_MODULES): Rename 'efi_fb.mod' to
'efi_uga.mod'.
(efi_fb_mod_SOURCES): Rename this ...
(efi_uga_mod_SOURCES): ... to this.
(efi_fb_mod_CFLAGS): Rename this ...
(efi_uga_mod_CFLAGS): ... to this.
(efi_fb_mod_LDFLAGS): Rename this ...
(efi_uga_mod_LDFLAGS): ... to this.
* conf/x86_64-efi.rmk (pkglib_MODULES): Rename 'efi_fb.mod' to
'efi_uga.mod'.
(efi_fb_mod_SOURCES): Rename this ...
(efi_uga_mod_SOURCES): ... to this.
(efi_fb_mod_CFLAGS): Rename this ...
(efi_uga_mod_CFLAGS): ... to this.
(efi_fb_mod_LDFLAGS): Rename this ...
(efi_uga_mod_LDFLAGS): ... to this.
* video/efi_fb.c: Move this ...
* video/efi_uga.c: ... to this. Change prefix to 'grub_video_uga_'.
2009-11-27 Robert Millan <rmh.grub@aybabtu.com>
* po/README: New file. Explain our PO file workflow.
2009-11-27 Robert Millan <rmh.grub@aybabtu.com>
* po/ChangeLog: Remove. Move relevant entries back to ...
* ChangeLog: ... here.
* po/ca.po: Remove (now handled by TLP).
* po/id.po: Likewise.
* po/zh_CN.po: Likewise.
* Makefile.in (LINGUAS): Initialize in a way that supports
empty set.
2009-11-27 Robert Millan <rmh.grub@aybabtu.com>
* Makefile.in (LINGUAS): Rewrite by scanning po/ directory instead of
reliing on po/LINGUAS.
($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po)): Rewrite as ...
(po/%.po): ... this.
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
* util/i386/efi/grub-mkimage.c: Include "progname.h".
(main): Use `program_name' instead of nonexistent `progname'.
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
* conf/i386-efi.rmk (grub_mkimage_SOURCES): Add `gnulib/progname.c'.
* conf/x86_64-efi.rmk (grub_mkimage_SOURCES): Likewise.
2009-11-26 Robert Millan <rmh.grub@aybabtu.com>
* conf/i386-coreboot.rmk: Cleanup stale filenames from my previous
commit.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
* conf/any-emu.rmk (grub_emu_SOURCES): Add `gnulib/progname.c'.
2009-11-26 Felix Zielcke <fzielcke@z-51.de>
* conf/any-emu.rmk (grub_mkfont_SOURCES): Add `gnulib/progname.c'.
2009-11-26 Robert Millan <rmh.grub@aybabtu.com>
* conf/common.rmk (sbin_UTILITIES): Add `grub-mkdevicemap'.
(grub_mkdevicemap_SOURCES): New variable.
(grub_probe_SOURCES, grub_fstest_SOURCES, grub_mkfont_SOURCES)
(grub_mkrelpath_SOURCES, grub_editenv_SOURCES)
(grub_pe2elf_SOURCES): Add `gnulib/progname.c'.
* conf/i386-coreboot.rmk (sbin_UTILITIES): Remove `grub-mkdevicemap'.
(grub_mkdevicemap_SOURCES): Remove.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* util/elf/grub-mkimage.c: Include `<grub/i18n.h>' and `"progname.h"'.
(usage): Fix strings to use `program_name'.
(main): Initialize gettext.
* util/grub-editenv.c: Likewise.
* util/grub-emu.c: Likewise.
* util/grub-fstest.c: Likewise.
* util/grub-mkdevicemap.c: Likewise.
* util/grub-mkfont.c: Likewise.
* util/grub-mkrelpath.c: Likewise.
* util/grub-pe2elf.c: Likewise.
* util/grub-probe.c: Likewise.
* util/sparc64/ieee1275/grub-mkimage.c: Likewise.
* util/sparc64/ieee1275/grub-ofpathname.c: Likewise.
* util/sparc64/ieee1275/grub-setup.c: Likewise.
* util/misc.c: Include `"progname.h"'.
(progname): Remove variable.
(grub_util_warn, grub_util_info, grub_util_error): Use `program_name'.
2009-11-25 Felix Zielcke <fzielcke@z-51.de>
* util/grub.d/10_linux.in (linux_entry): Quote the arguments to
printf and print a newline after the menuentry header line.
* util/grub.d/10_kfreebsd.in (kfreebsd_entry): Likewise.
2009-11-25 Felix Zielcke <fzielcke@z-51.de>
autoconf >= 2.60 support $(localedir).
* INSTALL: Note that autoconf 2.60 is required.
* configure.ac (AC_PREREQ): Bump to 2.60.
* util/grub.d/10_kfreebsd.in (TEXTDOMAINDIR): Set to lowercased @localedir@.
* util/grub.d/10_linux.in (TEXTDOMAINDIR): Likewise.
2009-11-25 Yves Blusseau <yves.blusseau@zetam.org>
* configure.ac: move the call to AM_GNU_GETTEXT to avoid warnings when
aclocal is run.
2009-11-25 Robert Millan <rmh.grub@aybabtu.com>
* normal/main.c (grub_normal_read_line): Fix off-by-one
buffer overflow.
2009-11-25 Robert Millan <rmh.grub@aybabtu.com>
* normal/main.c (grub_normal_execute): Replace "parser.sh" with
"parser.grub" in grub_command_execute() call.
2009-11-24 Carles Pina i Estany <carles@pina.cat>
* conf/i386-coreboot.rmk (kernel_img_HEADERS): Add i18n.h.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* gettext/gettex.c: Include <grub/i18n.h>.
* include/grub/misc.h (grub_gettext_dummy, grub_gettext): Move from
here ...
* include/grub/i18n.h: ... to here
* include/grub/i18n.h: ... to here.
* kern/misc.c: Include <grub/i18n.h>
(grub_gettext_dummy): Move above user.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/Makefile.in (install-local): Convert a `for' into a normal
shell expansion.
2009-11-24 Robert Millan <rmh.grub@aybabtu.com>
* autogen.sh: Add automake call.
* config.guess: Remove.
* config.sub: Likewise.
* install-sh: Likewise.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/Makefile.in (install-local): Fix the use of $lang shell variable.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/Makefile.in (install-local): Convert a make `$(foreach)'
function to a normal shell `for'.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* conf/i386-coreboot.rmk (grub_mkimage_SOURCES): Add `gnulib/progname.c'.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrelpath.c: New file.
* conf/common.rmk (bin_UTILITIES): Add grub-mkrelpath.
(grub_mkrelpath_SOURCES): New variable.
* include/grub/util/misc.h: New function prototype.
* util/misc.c (make_system_path_relative_to_its_root): New function.
* util/grub-mkconfig_lib.in (bindir): New variable.
(grub_mkrelpath): Likewise.
(make_system_path_relative_to_its_root): Use grub-mkrelpath.
* util/probe.c (probe): Make the file path relative to its root.
Change a info message to use the GRUB path. Enable again the
check if we can read the file with GRUB facilities.
* util/i386/pc/grub-setup.c (setup): Make core.img path relative
to its root.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* Makefile.in: Don't include GRUB_CONTRIB makefiles with emu
platform.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/getroot.c (grub_util_get_dev_abstraction): Properly use
strncmp().
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/getroot.c (grub_util_is_dmraid): New function.
(grub_util_get_dev_abstraction): Treat dmraid and multipath
devices as normal ones, not as LVM.
2009-11-23 Carles Pina i Estany <carles@pina.cat>

View File

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

View File

@ -45,7 +45,9 @@ XGETTEXT = @XGETTEXT@
MSGMERGE = @MSGMERGE@
MSGFMT = @MSGFMT@
LINGUAS = $(shell tr '\n' ' ' < $(srcdir)/po/LINGUAS)
LINGUAS = $(shell for i in $(srcdir)/po/*.po ; do \
if test -e $$i ; then echo $$i ; fi ; \
done | sed -e "s,.*/po/\(.*\)\.po$$,\1,")
PACKAGE = @PACKAGE@
PACKAGE_NAME = @PACKAGE_NAME@
@ -156,10 +158,9 @@ ifeq ($(platform), emu)
include $(srcdir)/conf/any-emu.mk
else
include $(srcdir)/conf/$(target_cpu)-$(platform).mk
endif
# For external modules.
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
endif
### General targets.
@ -311,13 +312,13 @@ install-local: all
dest="`echo $$file | sed 's,.*/,,'`"; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \
done
$(foreach lang, $(LINGUAS), \
$(shell $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$(lang)/LC_MESSAGES) \
@list='po/$(lang).mo'; \
for file in $$list; do \
@langs='$(LINGUAS)'; \
for lang in $$langs; do \
$(SHELL) $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES; \
file="po/$$lang.mo"; \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)/$(datadir)/locale/$(lang)/LC_MESSAGES/$(PACKAGE).mo; \
done)
$(INSTALL_DATA) $$dir$$file $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(infodir)
@list='$(info_INFOS)'; \
for file in $$list; do \

View File

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

View File

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

View File

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

View File

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

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/password.c commands/keystatus.c \
disk/host.c disk/loopback.c disk/scsi.c \
fs/fshelp.c \
fs/fshelp.c \
\
io/gzio.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/menu.c normal/menu_entry.c normal/menu_viewer.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 \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.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/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
fs/befs.c fs/befs_be.c fs/tar.c \
\
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
@ -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/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_emu_init.c
grub_emu_init.c gnulib/progname.c
ifeq ($(target_cpu), i386)
grub_emu_SOURCES += commands/i386/cpuid.c
@ -79,7 +79,7 @@ DISTCLEANFILES += grub_emu_init.c
# For grub-mkfont.
ifeq ($(enable_grub_mkfont), yes)
bin_UTILITIES += grub-mkfont
grub_mkfont_SOURCES = util/grub-mkfont.c util/misc.c
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c
grub_mkfont_CFLAGS = $(freetype_cflags)
grub_mkfont_LDFLAGS = $(freetype_libs)
endif

View File

@ -1,15 +1,21 @@
# -*- makefile -*-
sbin_UTILITIES += grub-mkdevicemap
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
util/deviceiter.c \
util/devicemap.c util/misc.c
# For grub-mkelfimage.
bin_UTILITIES += grub-mkelfimage
grub_mkelfimage_SOURCES = util/elf/grub-mkimage.c util/misc.c \
grub_mkelfimage_SOURCES = gnulib/progname.c \
util/elf/grub-mkimage.c util/misc.c \
util/resolve.c
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
# For grub-probe.
sbin_UTILITIES += grub-probe
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
grub_probe_SOURCES = util/grub-probe.c \
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
util/hostdisk.c util/misc.c util/getroot.c \
kern/device.c kern/disk.c kern/err.c kern/misc.c \
kern/parser.c kern/partition.c kern/file.c \
@ -44,7 +50,8 @@ grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
# For grub-fstest.
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.c \
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
util/misc.c \
kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \
disk/host.c disk/loopback.c kern/list.c kern/command.c \
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
@ -66,11 +73,15 @@ grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.c \
# For grub-mkfont.
ifeq ($(enable_grub_mkfont), yes)
bin_UTILITIES += grub-mkfont
grub_mkfont_SOURCES = util/grub-mkfont.c util/misc.c
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c
grub_mkfont_CFLAGS = $(freetype_cflags)
grub_mkfont_LDFLAGS = $(freetype_libs)
endif
# For grub-mkrelpath.
bin_UTILITIES += grub-mkrelpath
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
# For the parser.
grub_script.tab.c grub_script.tab.h: script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
@ -117,7 +128,7 @@ DISTCLEANFILES += grub_fstest_init.c
# for grub-editenv
bin_UTILITIES += grub-editenv
grub_editenv_SOURCES = util/grub-editenv.c lib/envblk.c util/misc.c kern/misc.c kern/err.c
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c kern/misc.c kern/err.c
CLEANFILES += grub-editenv
# Needed for genmk.rb to work
@ -125,7 +136,7 @@ ifeq (0,1)
bin_UTILITIES += grub-macho2img grub-pe2elf
endif
grub_pe2elf_SOURCES = util/grub-pe2elf.c util/misc.c
grub_pe2elf_SOURCES = gnulib/progname.c util/grub-pe2elf.c util/misc.c
CLEANFILES += grub-pe2elf
grub_macho2img_SOURCES = util/grub-macho2img.c

View File

@ -18,6 +18,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
kern/i386/misc.S \
kern/i386/coreboot/init.c \
kern/i386/multiboot_mmap.c \
kern/i386/halt.c \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -34,7 +35,7 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
machine/boot.h machine/console.h machine/init.h \
machine/memory.h machine/loader.h list.h handler.h command.h
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
@ -53,7 +54,7 @@ boot_img_FORMAT = binary
bin_UTILITIES += grub-mkimage
grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
util/resolve.c
util/resolve.c gnulib/progname.c
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
pkglib_IMAGES += kernel.img
@ -61,6 +62,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
kern/i386/misc.S \
kern/i386/coreboot/init.c \
kern/i386/qemu/mmap.c \
kern/i386/halt.c \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -77,7 +79,7 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
machine/boot.h machine/console.h machine/init.h \
machine/memory.h machine/loader.h list.h handler.h command.h
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
@ -93,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
/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
grub_install_SOURCES = util/grub-install.in
@ -131,12 +126,12 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod.
reboot_mod_SOURCES = commands/reboot.c kern/i386/reboot.c
reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod.
halt_mod_SOURCES = commands/halt.c kern/i386/halt.c
halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)

View File

@ -9,11 +9,10 @@ script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-mkdevicemap
# For grub-mkimage.
grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
util/resolve.c
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
util/misc.c util/resolve.c
util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
# For grub-setup.
@ -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 \
# 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.
sbin_SCRIPTS = grub-install
@ -56,7 +51,7 @@ kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h
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_mod_ASFLAGS = $(COMMON_ASFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -148,10 +143,15 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_fb.mod
efi_fb_mod_SOURCES = video/efi_fb.c
efi_fb_mod_CFLAGS = $(COMMON_CFLAGS)
efi_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_uga.mod
efi_uga_mod_SOURCES = video/efi_uga.c
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_gop.mod
efi_gop_mod_SOURCES = video/efi_gop.c
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\

View File

@ -33,7 +33,7 @@ kernel_img_HEADERS = cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
ieee1275/ieee1275.h machine/kernel.h machine/loader.h machine/memory.h \
list.h handler.h command.h
list.h handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
@ -47,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
/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.
sbin_SCRIPTS = grub-install

View File

@ -64,7 +64,7 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
machine/memory.h machine/loader.h machine/vga.h machine/vbe.h \
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
@ -81,7 +81,7 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-setup grub-mkdevicemap
sbin_UTILITIES = grub-setup
# For grub-mkimage.
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 \
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
grub_install_SOURCES = util/grub-install.in

View File

@ -17,7 +17,7 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \
symbol.h term.h time.h types.h powerpc/libgcc.h loader.h partition.h \
msdos_partition.h ieee1275/ieee1275.h machine/kernel.h handler.h list.h \
command.h
command.h i18n.h
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
@ -28,13 +28,6 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
# Programs
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 \
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \

View File

@ -29,7 +29,7 @@ DEFSYMFILES += kernel_syms.lst
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
list.h handler.h command.h \
list.h handler.h command.h i18n.h \
sparc64/libgcc.h ieee1275/ieee1275.h machine/kernel.h \
sparc64/ieee1275/ieee1275.h
kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
@ -59,11 +59,11 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-setup grub-mkdevicemap grub-ofpathname
sbin_UTILITIES = grub-setup grub-ofpathname
# For grub-mkimage.
grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
util/resolve.c
util/resolve.c gnulib/progname.c
# For grub-setup.
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
@ -82,16 +82,12 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
partmap/sun.c partmap/acorn.c \
\
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
util/raid.c util/lvm.c \
util/raid.c util/lvm.c gnulib/progname.c \
grub_setup_init.c
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/ieee1275/ofpath.c util/ieee1275/devicemap.c util/misc.c
# For grub-ofpathname.
grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
util/ieee1275/ofpath.c util/misc.c
util/ieee1275/ofpath.c util/misc.c gnulib/progname.c
# Scripts.
sbin_SCRIPTS = grub-install

View File

@ -9,11 +9,10 @@ script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-mkdevicemap
# For grub-mkimage.
grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
util/resolve.c
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
util/misc.c util/resolve.c
# For grub-setup.
#grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
@ -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 \
# 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.
sbin_SCRIPTS = grub-install
@ -56,7 +51,7 @@ kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \
handler.h command.h
handler.h command.h i18n.h
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -154,10 +149,15 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_fb.mod
efi_fb_mod_SOURCES = video/efi_fb.c
efi_fb_mod_CFLAGS = $(COMMON_CFLAGS)
efi_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_uga.mod
efi_uga_mod_SOURCES = video/efi_uga.c
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_gop.mod
efi_gop_mod_SOURCES = video/efi_gop.c
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\

1494
config.guess vendored

File diff suppressed because it is too large Load Diff

1700
config.sub vendored

File diff suppressed because it is too large Load Diff

View File

@ -33,8 +33,7 @@ dnl type.
AC_INIT([GRUB],[1.97],[bug-grub@gnu.org])
AM_INIT_AUTOMAKE()
AM_GNU_GETTEXT()
AC_PREREQ(2.59d)
AC_PREREQ(2.60)
AC_CONFIG_SRCDIR([include/grub/dl.h])
AC_CONFIG_HEADER([config.h])
@ -123,6 +122,7 @@ case "$platform" in
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
esac
CFLAGS="$CFLAGS $machine_CFLAGS"
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
AC_SUBST(host_cpu)
@ -173,6 +173,7 @@ AC_PROG_CC
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
AC_GNU_SOURCE
AM_GNU_GETTEXT
AC_SYS_LARGEFILE
# Identify characteristics of the host architecture.

View File

@ -26,6 +26,7 @@
#include <grub/file.h>
#include <grub/kernel.h>
#include <grub/gzio.h>
#include <grub/i18n.h>
/*
.mo file information from:
@ -221,7 +222,7 @@ grub_gettext_init_ext (const char *lang)
locale_dir = grub_env_get ("locale_dir");
if (locale_dir == NULL)
{
grub_printf ("locale_dir variable is not set up.");
grub_dprintf ("gettext", "locale_dir variable is not set up.");
return;
}

View File

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

View File

@ -0,0 +1,96 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_EFI_GOP_HEADER
#define GRUB_EFI_GOP_HEADER 1
/* Based on UEFI specification. */
#define GRUB_EFI_GOP_GUID \
{ 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a }}
typedef enum
{
GRUB_EFI_GOT_RGBA8,
GRUB_EFI_GOT_BGRA8,
GRUB_EFI_GOT_BITMASK
}
grub_efi_gop_pixel_format_t;
struct grub_efi_gop_pixel_bitmask
{
grub_uint32_t r;
grub_uint32_t g;
grub_uint32_t b;
grub_uint32_t a;
};
struct grub_efi_gop_mode_info
{
grub_efi_uint32_t version;
grub_efi_uint32_t width;
grub_efi_uint32_t height;
grub_efi_gop_pixel_format_t pixel_format;
struct grub_efi_gop_pixel_bitmask pixel_bitmask;
grub_efi_uint32_t pixels_per_scanline;
};
struct grub_efi_gop_mode
{
grub_efi_uint32_t max_mode;
grub_efi_uint32_t mode;
struct grub_efi_gop_mode_info *info;
grub_efi_uintn_t info_size;
grub_efi_physical_address_t fb_base;
grub_efi_uintn_t fb_size;
};
/* Forward declaration. */
struct grub_efi_gop;
typedef grub_efi_status_t
(*grub_efi_gop_query_mode_t) (struct grub_efi_gop *this,
grub_efi_uint32_t mode_number,
grub_efi_uintn_t *size_of_info,
struct grub_efi_gop_mode_info **info);
typedef grub_efi_status_t
(*grub_efi_gop_set_mode_t) (struct grub_efi_gop *this,
grub_efi_uint32_t mode_number);
typedef grub_efi_status_t
(*grub_efi_gop_blt_t) (struct grub_efi_gop *this,
void *buffer,
grub_efi_uintn_t operation,
grub_efi_uintn_t sx,
grub_efi_uintn_t sy,
grub_efi_uintn_t dx,
grub_efi_uintn_t dy,
grub_efi_uintn_t width,
grub_efi_uintn_t height,
grub_efi_uintn_t delta);
struct grub_efi_gop
{
grub_efi_gop_query_mode_t query_mode;
grub_efi_gop_set_mode_t set_mode;
grub_efi_gop_blt_t blt;
struct grub_efi_gop_mode *mode;
};
#endif

View File

@ -25,6 +25,10 @@
# define _(str) gettext(str)
#else
# define _(str) grub_gettext(str)
const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s);
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
#endif
#define N_(str) str

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. */
void grub_gate_a20 (int on);
/* Reboot the machine. */
void EXPORT_FUNC (grub_reboot) (void);
/* Halt the system, using APM if possible. If NO_APM is true, don't
* use APM even if it is available. */
void EXPORT_FUNC (grub_halt) (int no_apm);
void EXPORT_FUNC(grub_stop_floppy) (void);
#endif /* ! GRUB_INIT_MACHINE_HEADER */

View File

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

@ -191,9 +191,6 @@ grub_ssize_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,
grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n,
grub_uint32_t d, grub_uint32_t *r);
const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s);
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
#ifdef NEED_ENABLE_EXECUTE_STACK
void EXPORT_FUNC(__enable_execute_stack) (void *addr);
#endif
@ -225,4 +222,15 @@ grub_div_roundup (unsigned int x, unsigned int y)
return (x + y - 1) / y;
}
/* Reboot the machine. */
void EXPORT_FUNC (grub_reboot) (void);
#ifdef GRUB_MACHINE_PCBIOS
/* Halt the system, using APM if possible. If NO_APM is true, don't
* use APM even if it is available. */
void EXPORT_FUNC (grub_halt) (int no_apm);
#else
void EXPORT_FUNC (grub_halt) (void);
#endif
#endif /* ! GRUB_MISC_HEADER */

View File

@ -23,9 +23,6 @@
#ifndef ASM_FILE
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];

View File

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

View File

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -76,4 +76,7 @@ grub_int64_t grub_util_get_disk_size (char *name);
#endif
char *make_system_path_relative_to_its_root (const char *path);
#endif /* ! GRUB_UTIL_MISC_HEADER */

View File

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

View File

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

View File

@ -484,21 +484,6 @@ FUNCTION(grub_exit)
jmp cold_reboot
.code32
/*
* grub_reboot()
*
* Reboot the system. At the moment, rely on BIOS.
*/
FUNCTION(grub_reboot)
call prot_to_real
.code16
cold_reboot:
/* cold boot */
movw $0x0472, %di
movw %ax, (%di)
ljmp $0xFFFF, $0x0000
.code32
/*
* grub_halt(int no_apm)
*

View File

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

View File

@ -215,10 +215,27 @@ realcseg:
movw %ax, %gs
movw %ax, %ss
#ifdef GRUB_MACHINE_PCBIOS
/* restore interrupts */
sti
#endif
/* return on new stack! */
DATA32 ret
.code32
/*
* grub_reboot()
*
* Reboot the system. At the moment, rely on BIOS.
*/
FUNCTION(grub_reboot)
call prot_to_real
.code16
cold_reboot:
/* set 0x472 to 0x0000 for cold boot (0x1234 for warm boot) */
movw $0x0472, %di
movw %ax, (%di)
ljmp $0xf000, $0xfff0
.code32

View File

@ -1,32 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/cpu/io.h>
#include <grub/cpu/at_keyboard.h>
#include <grub/cpu/reboot.h>
#include <grub/misc.h>
void
grub_reboot (void)
{
/* Use the keyboard controller to reboot. That's what keyboards were
designed for, isn't it? */
grub_outb (KEYBOARD_COMMAND_REBOOT, KEYBOARD_REG_STATUS);
grub_printf ("GRUB doesn't know how to reboot this machine yet!\n");
}

View File

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

View File

@ -23,6 +23,7 @@
#include <stdarg.h>
#include <grub/term.h>
#include <grub/env.h>
#include <grub/i18n.h>
static int
grub_iswordseparator (int c)
@ -30,6 +31,13 @@ grub_iswordseparator (int c)
return (grub_isspace (c) || c == ',' || c == ';' || c == '|' || c == '&');
}
/* grub_gettext_dummy is not translating anything. */
const char *
grub_gettext_dummy (const char *s)
{
return s;
}
const char* (*grub_gettext) (const char *s) = grub_gettext_dummy;
void *
@ -986,13 +994,6 @@ grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,
return p - dest;
}
/* grub_gettext_dummy is not translating anything. */
const char *
grub_gettext_dummy (const char *s)
{
return s;
}
/* Abort GRUB. This function does not return. */
void
grub_abort (void)

View File

@ -415,7 +415,7 @@ grub_normal_execute (const char *config, int nested, int batch)
read_command_list ();
read_fs_list ();
read_handler_list ();
grub_command_execute ("parser.sh", 0, 0);
grub_command_execute ("parser.grub", 0, 0);
reader_nested = nested;
@ -524,7 +524,7 @@ static grub_err_t
grub_normal_read_line (char **line, int cont)
{
grub_parser_t parser = grub_parser_get_current ();
char prompt[sizeof("> ") - 1 + grub_strlen (parser->name)];
char prompt[sizeof("> ") + grub_strlen (parser->name)];
grub_sprintf (prompt, "%s> ", parser->name);

View File

@ -1,2 +0,0 @@
ca
id

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

View File

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

View File

@ -460,13 +460,41 @@ grub_guess_root_device (const char *dir)
return os_dev;
}
int
grub_util_is_dmraid (const char *os_dev)
{
if (! strncmp (os_dev, "/dev/mapper/nvidia_", 19))
return 1;
else if (! strncmp (os_dev, "/dev/mapper/isw_", 16))
return 1;
else if (! strncmp (os_dev, "/dev/mapper/hpt37x_", 19))
return 1;
else if (! strncmp (os_dev, "/dev/mapper/hpt45x_", 19))
return 1;
else if (! strncmp (os_dev, "/dev/mapper/via_", 16))
return 1;
else if (! strncmp (os_dev, "/dev/mapper/lsi_", 16))
return 1;
else if (! strncmp (os_dev, "/dev/mapper/pdc_", 16))
return 1;
else if (! strncmp (os_dev, "/dev/mapper/jmicron_", 20))
return 1;
else if (! strncmp (os_dev, "/dev/mapper/asr_", 16))
return 1;
else if (! strncmp (os_dev, "/dev/mapper/sil_", 16))
return 1;
return 0;
}
int
grub_util_get_dev_abstraction (const char *os_dev UNUSED)
{
#ifdef __linux__
/* Check for LVM. */
if (!strncmp (os_dev, "/dev/mapper/", 12))
if (!strncmp (os_dev, "/dev/mapper/", 12)
&& ! grub_util_is_dmraid (os_dev)
&& strncmp (os_dev, "/dev/mapper/mpath", 17) != 0)
return GRUB_DEV_ABSTRACTION_LVM;
/* Check for RAID. */

View File

@ -22,6 +22,7 @@
#include <grub/util/misc.h>
#include <grub/lib/envblk.h>
#include <grub/handler.h>
#include <grub/i18n.h>
#include <stdio.h>
#include <unistd.h>
@ -29,6 +30,8 @@
#include <stdlib.h>
#include <getopt.h>
#include "progname.h"
#define DEFAULT_ENVBLK_SIZE 1024
void
@ -252,7 +255,10 @@ main (int argc, char *argv[])
char *filename;
char *command;
progname = "grub-editenv";
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Check for options. */
while (1)
@ -269,7 +275,7 @@ main (int argc, char *argv[])
break;
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;
case 'v':

View File

@ -1,6 +1,6 @@
/*
* 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
* it under the terms of the GNU General Public License as published by
@ -36,19 +36,22 @@
#include <grub/util/getroot.h>
#include <grub/env.h>
#include <grub/partition.h>
#include <grub/i18n.h>
#include <grub_emu_init.h>
#include "progname.h"
/* Used for going back to the main function. */
static jmp_buf main_env;
/* Store the prefix specified by an argument. */
static char *prefix = 0;
static char *prefix = NULL;
grub_addr_t
grub_arch_modules_addr (void)
{
return 0;
return NULL;
}
grub_err_t
@ -155,7 +158,10 @@ main (int argc, char *argv[])
volatile int hold = 0;
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)
switch (opt)
@ -178,7 +184,7 @@ main (int argc, char *argv[])
case 'h':
return usage (0);
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;
default:
return usage (1);
@ -193,7 +199,7 @@ main (int argc, char *argv[])
/* Wait until the ARGS.HOLD variable is cleared by an attached debugger. */
if (hold && verbosity > 0)
printf ("Run \"gdb %s %d\", and set ARGS.HOLD to zero.\n",
progname, (int) getpid ());
program_name, (int) getpid ());
while (hold)
{
if (hold > 0)

View File

@ -1,7 +1,7 @@
/* grub-fstest.c - debug tool for filesystem driver */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,6 +31,7 @@
#include <grub/lib/hexdump.h>
#include <grub/lib/crc.h>
#include <grub/command.h>
#include <grub/i18n.h>
#include <grub_fstest_init.h>
@ -40,6 +41,8 @@
#include <stdlib.h>
#include <getopt.h>
#include "progname.h"
void
grub_putchar (int c)
{
@ -346,10 +349,10 @@ static void
usage (int 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
printf ("\
Usage: grub-fstest [OPTION]... IMAGE_PATH COMMANDS\n\
Usage: %s [OPTION]... IMAGE_PATH COMMANDS\n\
\n\
Debug tool for filesystem driver.\n\
\nCommands:\n\
@ -369,7 +372,7 @@ Debug tool for filesystem driver.\n\
-V, --version print version information and exit\n\
-v, --verbose print verbose messages\n\
\n\
Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
exit (status);
}
@ -377,10 +380,13 @@ Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
int
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;
progname = "grub-fstest";
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Find the first non option entry. */
for (num_opts = 1; num_opts < argc; num_opts++)
@ -442,7 +448,7 @@ main (int argc, char *argv[])
break;
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;
case 'v':

View File

@ -247,6 +247,14 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
done
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.
grub_device=`$grub_probe --target=device ${grubdir}`

View File

@ -20,10 +20,12 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
datadir=@datadir@
bindir=@bindir@
sbindir=@sbindir@
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
grub_warn ()
{
@ -32,49 +34,7 @@ grub_warn ()
make_system_path_relative_to_its_root ()
{
path=$1
# abort if file doesn't exist
if test -e $path ; then : ;else
return 1
fi
# canonicalize
if path=`readlink -f $path` ; then : ; else
return 1
fi
# if not a directory, climb up to the directory containing it
if test -d $path ; then
dir=$path
else
dir=`echo $path | sed -e "s,/[^/]*$,,g"`
fi
num=`stat -c %d $dir`
# this loop sets $dir to the root directory of the filesystem we're inspecting
while : ; do
parent=`readlink -f $dir/..`
if [ "x`stat -c %d $parent`" = "x$num" ] ; then : ; else
# $parent is another filesystem; we found it.
break
fi
if [ "x$dir" = "x/" ] ; then
# / is our root.
break
fi
dir=$parent
done
# This function never prints trailing slashes (so that its output can be
# appended a slash unconditionally). Each slash in $dir is considered a
# preceding slash, and therefore the root directory is an empty string.
if [ "$dir" = "/" ] ; then
dir=""
fi
# XXX: This fails if $dir contains ','.
path=`echo "$path" | sed -e "s,^$dir,,g"` || return 1
path="`${grub_mkrelpath} $1`"
case "`uname 2>/dev/null`" in
CYGWIN*)

View File

@ -1,7 +1,7 @@
/* grub-mkdevicemap.c - make a device map file automatically */
/*
* 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
* 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/deviceiter.h>
#include <grub/i18n.h>
#define _GNU_SOURCE 1
#include <getopt.h>
#include "progname.h"
static void
make_device_map (const char *device_map, int floppy_disks)
{
@ -81,10 +84,10 @@ usage (int status)
{
if (status)
fprintf (stderr,
"Try ``grub-mkdevicemap --help'' for more information.\n");
"Try ``%s --help'' for more information.\n", program_name);
else
printf ("\
Usage: grub-mkdevicemap [OPTION]...\n\
Usage: %s [OPTION]...\n\
\n\
Generate a device map file automatically.\n\
\n\
@ -96,7 +99,7 @@ Generate a device map file automatically.\n\
-v, --verbose print verbose messages\n\
\n\
Report bugs to <%s>.\n\
",
", program_name,
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
exit (status);
@ -108,7 +111,10 @@ main (int argc, char *argv[])
char *dev_map = 0;
int floppy_disks = 1;
progname = "grub-mkdevicemap";
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Check for options. */
while (1)
@ -140,7 +146,7 @@ main (int argc, char *argv[])
break;
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;
case 'v':

View File

@ -19,6 +19,7 @@
#include <config.h>
#include <grub/types.h>
#include <grub/util/misc.h>
#include <grub/i18n.h>
#include <stdio.h>
#include <stdlib.h>
@ -29,6 +30,8 @@
#include FT_FREETYPE_H
#include <freetype/ftsynth.h>
#include "progname.h"
#define GRUB_FONT_DEFAULT_SIZE 16
#define GRUB_FONT_RANGE_BLOCK 1024
@ -90,10 +93,10 @@ static void
usage (int 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
printf ("\
Usage: grub-mkfont [OPTIONS] FONT_FILES\n\
Usage: %s [OPTIONS] FONT_FILES\n\
\nOptions:\n\
-o, --output=FILE_NAME set output file name\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, --verbose print verbose messages\n\
\n\
Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
exit (status);
}
@ -472,7 +475,10 @@ main (int argc, char *argv[])
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. */
while (1)
@ -560,7 +566,7 @@ main (int argc, char *argv[])
break;
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;
case 'v':

105
util/grub-mkrelpath.c Normal file
View File

@ -0,0 +1,105 @@
/* grub-mkrelpath.c - make a system path relative to its root */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/util/misc.h>
#include <grub/i18n.h>
#include <getopt.h>
#include "progname.h"
static struct option options[] =
{
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
};
static void
usage (int status)
{
if (status)
fprintf (stderr, "Try ``%s --help'' for more information.\n", program_name);
else
printf ("\
Usage: %s [OPTIONS] PATH\n\
\n\
Make a system path relative to it's root.\n\
\n\
Options:\n\
-h, --help display this message and exit\n\
-V, --version print version information and exit\n\
\n\
Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
exit (status);
}
int
main (int argc, char *argv[])
{
char *argument, *relpath;
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Check for options. */
while (1)
{
int c = getopt_long (argc, argv, "hV", options, 0);
if (c == -1)
break;
else
switch (c)
{
case 'h':
usage (0);
break;
case 'V':
printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
return 0;
default:
usage (1);
break;
}
}
if (optind >= argc)
{
fprintf (stderr, "No path is specified.\n");
usage (1);
}
if (optind + 1 != argc)
{
fprintf (stderr, "Unknown extra argument `%s'.\n", argv[optind + 1]);
usage (1);
}
argument = argv[optind];
relpath = make_system_path_relative_to_its_root (argument);
printf ("%s\n", relpath);
free (relpath);
return 0;
}

View File

@ -100,6 +100,13 @@ process_input_dir ()
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
fi
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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,6 +30,7 @@
#include <grub/kernel.h>
#include <grub/efi/pe32.h>
#include <grub/machine/kernel.h>
#include "progname.h"
#if GRUB_TARGET_WORDSIZE == 32
# define grub_le_to_cpu(val) grub_le_to_cpu32(val)
@ -1056,7 +1057,7 @@ main (int argc, char *argv[])
char *dir = NULL;
char *prefix = NULL;
progname = "grub-mkimage";
program_name = "grub-mkimage";
while (1)
{

View File

@ -90,7 +90,7 @@ setup (const char *dir,
const char *boot_file, const char *core_file,
const char *root, const char *dest, int must_embed, int force, int fs_probe)
{
char *boot_path, *core_path, *core_path_dev;
char *boot_path, *core_path, *core_path_dev, *core_path_dev_full;
char *boot_img, *core_img;
size_t boot_size, core_size;
grub_uint16_t core_sectors;
@ -426,7 +426,9 @@ unable_to_embed:
/* Make sure that GRUB reads the identical image as the OS. */
tmp_img = xmalloc (core_size);
core_path_dev = grub_util_get_path (dir, core_file);
core_path_dev_full = grub_util_get_path (dir, core_file);
core_path_dev = make_system_path_relative_to_its_root (core_path_dev_full);
free (core_path_dev_full);
/* It is a Good Thing to sync two times. */
sync ();

View File

@ -18,10 +18,12 @@
#include <config.h>
#include <errno.h>
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -37,6 +39,8 @@
#include <grub/term.h>
#include <grub/time.h>
#include "progname.h"
/* Include malloc.h, only if memalign is available. It is known that
memalign is declared in malloc.h in all systems, if present. */
#ifdef HAVE_MEMALIGN
@ -48,7 +52,6 @@
#include <winioctl.h>
#endif
char *progname = 0;
int verbosity = 0;
void
@ -56,7 +59,7 @@ grub_util_warn (const char *fmt, ...)
{
va_list ap;
fprintf (stderr, "%s: warn: ", progname);
fprintf (stderr, "%s: warn: ", program_name);
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
@ -71,7 +74,7 @@ grub_util_info (const char *fmt, ...)
{
va_list ap;
fprintf (stderr, "%s: info: ", progname);
fprintf (stderr, "%s: info: ", program_name);
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
@ -85,7 +88,7 @@ grub_util_error (const char *fmt, ...)
{
va_list ap;
fprintf (stderr, "%s: error: ", progname);
fprintf (stderr, "%s: error: ", program_name);
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
@ -447,3 +450,82 @@ fail:
}
#endif /* __MINGW32__ */
/* This function never prints trailing slashes (so that its output
can be appended a slash unconditionally). */
char *
make_system_path_relative_to_its_root (const char *path)
{
struct stat st;
char *p, *buf, *buf2, *buf3;
uintptr_t offset = 0;
dev_t num;
size_t len;
/* canonicalize. */
p = realpath (path, NULL);
if (p == NULL)
{
if (errno != EINVAL)
grub_util_error ("failed to get realpath of %s", path);
else
grub_util_error ("realpath not supporting (path, NULL)");
}
len = strlen (p) + 1;
buf = strdup (p);
free (p);
if (stat (buf, &st) < 0)
grub_util_error ("can not stat %s: %s", buf, strerror (errno));
buf2 = strdup (buf);
num = st.st_dev;
/* This loop sets offset to the number of chars of the root
directory we're inspecting. */
while (1)
{
p = strrchr (buf, '/');
if (p == NULL)
/* This should never happen. */
grub_util_error ("FIXME: no / in buf. (make_system_path_relative_to_its_root)");
if (p != buf)
*p = 0;
else
*++p = 0;
if (stat (buf, &st) < 0)
grub_util_error ("can not stat %s: %s", buf, strerror (errno));
/* buf is another filesystem; we found it. */
if (st.st_dev != num)
break;
offset = p - buf;
/* offset == 1 means root directory. */
if (offset == 1)
{
free (buf);
len = strlen (buf2);
while (buf2[len - 1] == '/' && len > 1)
{
buf2[len - 1] = '\0';
len--;
}
return buf2;
}
}
free (buf);
buf3 = strdup (buf2 + offset);
free (buf2);
len = strlen (buf3);
while (buf3[len - 1] == '/' && len > 1)
{
buf3[len - 1] = '\0';
len--;
}
return buf3;
}

View File

@ -202,17 +202,17 @@ static const struct ld_option ld_options[] =
{ {"all-files", no_argument, NULL, 'a'},
'a', NULL, N_("Process all files (don't skip backup files)"), ONE_DASH },
{ {"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'},
'A', "ID", N_("Set Application ID"), ONE_DASH },
'A', N_("ID"), N_("Set Application ID"), ONE_DASH },
{ {"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},
'\0', "FILE", N_("Set Copyright filename"), ONE_DASH },
'\0', N_("FILE"), N_("Set Copyright filename"), ONE_DASH },
{ {"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'},
'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 },
'\0', NULL, N_("Patch Boot Info Table in El Torito boot image"), ONE_DASH },
{ {"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 },
'\0', NULL, N_("Enable floppy drive emulation for El Torito"), TWO_DASHES },
{ {"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'},
'd', NULL, N_("Omit trailing periods from filenames"), ONE_DASH },
{ {"disable-deep-relocation", no_argument, NULL, 'D'},
@ -234,11 +234,11 @@ static const struct ld_option ld_options[] =
{ {"version", no_argument, NULL, OPTION_VERSION},
'\0', NULL, N_("Print version information and exit"), TWO_DASHES },
{ {"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},
'\0', "GLOBFILE", N_("Hide Joliet file"), ONE_DASH },
'\0', N_("GLOBFILE"), N_("Hide Joliet file"), ONE_DASH },
{ {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'},
'J', NULL, N_("Generate Joliet directory information"), ONE_DASH },
{ {"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'},
'L', NULL, N_("Allow iso9660 filenames to start with '.'"), ONE_DASH },
{ {"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'},
'm', "GLOBFILE", N_("Exclude file name"), ONE_DASH },
'm', N_("GLOBFILE"), N_("Exclude file name"), ONE_DASH },
{ {"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'},
'N', NULL, N_("Omit version number from iso9660 filename"), ONE_DASH },
{ {"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},
0, NULL, N_("Inhibit splitting symlink fields"), ONE_DASH },
{ {"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'},
'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},
'\0', NULL, N_("Print estimated filesystem size and exit"), ONE_DASH },
{ {"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},
'\0', NULL, N_("Run quietly"), ONE_DASH },
{ {"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},
'\0', NULL, N_("Split output into files of approx. 1GB size"), ONE_DASH },
{ {"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'},
'T', NULL, N_("Generate translation tables for systems that don't understand long filenames"), ONE_DASH },
{ {"verbose", no_argument, NULL, 'v'},
'v', NULL, N_("Verbose"), ONE_DASH },
{ {"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},
'\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},
'\0', "#", N_("Set Volume set size"), ONE_DASH },
{ {"volset-seqno", required_argument, NULL, OPTION_VOLSET_SEQ_NUM},
'\0', "#", N_("Set Volume set sequence number"), ONE_DASH },
{ {"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
{ {"transparent-compression", no_argument, NULL, 'z'},
'z', NULL, "Enable transparent compression of files", ONE_DASH },
@ -481,6 +481,7 @@ void usage(){
int comma;
int len;
unsigned int j;
char *arg;
printf (" ");
@ -502,8 +503,9 @@ void usage(){
putchar (' ');
++len;
}
printf ("%s", ld_options[j].arg);
len += strlen (ld_options[j].arg);
arg = gettext (ld_options[j].arg);
printf ("%s", arg);
len += strlen (arg);
}
comma = TRUE;
}
@ -527,8 +529,9 @@ void usage(){
+ strlen (ld_options[j].opt.name));
if (ld_options[j].arg != NULL)
{
printf (" %s", ld_options[j].arg);
len += 1 + strlen (ld_options[j].arg);
arg = gettext (ld_options[j].arg);
printf (" %s", arg);
len += 1 + strlen (arg);
}
comma = TRUE;
}

View File

@ -21,6 +21,7 @@
#include <grub/machine/boot.h>
#include <grub/machine/kernel.h>
#include <grub/kernel.h>
#include <grub/i18n.h>
#include <grub/disk.h>
#include <grub/util/misc.h>
#include <grub/util/resolve.h>
@ -34,6 +35,8 @@
#define _GNU_SOURCE 1
#include <getopt.h>
#include "progname.h"
static void
compress_kernel (char *kernel_img, size_t kernel_size,
char **core_img, size_t *core_size)
@ -188,10 +191,10 @@ static void
usage (int 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
printf ("\
Usage: grub-mkimage [OPTION]... [MODULES]\n\
Usage: %s [OPTION]... [MODULES]\n\
\n\
Make a bootable image of GRUB.\n\
\n\
@ -204,7 +207,7 @@ Make a bootable image of GRUB.\n\
-v, --verbose print verbose messages\n\
\n\
Report bugs to <%s>.\n\
", GRUB_LIBDIR, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);
", program_name, GRUB_LIBDIR, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);
exit (status);
}
@ -218,7 +221,11 @@ main (int argc, char *argv[])
char *memdisk = NULL;
FILE *fp = stdout;
progname = "grub-mkimage";
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
while (1)
{
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/ofpath.h>
#include <grub/i18n.h>
#include "progname.h"
int main(int argc, char **argv)
{
char *of_path;
progname = "grub-ofpathname";
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
if (argc != 2)
{
printf("Usage: grub-ofpathname DEVICE\n");
printf("Usage: %s DEVICE\n", program_name);
return 1;
}

View File

@ -21,6 +21,7 @@
#include <grub/types.h>
#include <grub/util/misc.h>
#include <grub/device.h>
#include <grub/i18n.h>
#include <grub/disk.h>
#include <grub/file.h>
#include <grub/fs.h>
@ -49,6 +50,8 @@
#define _GNU_SOURCE 1
#include <getopt.h>
#include "progname.h"
/* This program fills in various fields inside of the 'boot' and 'core'
* image files.
*
@ -401,10 +404,10 @@ static void
usage (int 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
printf ("\
Usage: grub-setup [OPTION]... DEVICE\n\
Usage: %s [OPTION]... DEVICE\n\
\n\
Set up images to boot from DEVICE.\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\
\n\
Report bugs to <%s>.\n\
",
", program_name,
DEFAULT_BOOT_FILE, DEFAULT_CORE_FILE, DEFAULT_DIRECTORY,
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
@ -616,7 +619,10 @@ main (int argc, char *argv[])
{
struct grub_setup_info ginfo;
progname = "grub-setup";
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
init_info (&ginfo);
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

@ -183,20 +183,20 @@ check_protocol (void)
}
static grub_err_t
grub_video_efi_init (void)
grub_video_uga_init (void)
{
grub_memset (&framebuffer, 0, sizeof(framebuffer));
return grub_video_fb_init ();
}
static grub_err_t
grub_video_efi_fini (void)
grub_video_uga_fini (void)
{
return grub_video_fb_fini ();
}
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 depth;
@ -269,14 +269,14 @@ grub_video_efi_setup (unsigned int width, unsigned int height,
}
static grub_err_t
grub_video_efi_swap_buffers (void)
grub_video_uga_swap_buffers (void)
{
/* TODO: Implement buffer swapping. */
return GRUB_ERR_NONE;
}
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)
target = framebuffer.render_target;
@ -285,7 +285,7 @@ grub_video_efi_set_active_render_target (struct grub_video_render_target *target
}
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)
{
grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info));
@ -296,15 +296,15 @@ grub_video_efi_get_info_and_fini (struct grub_video_mode_info *mode_info,
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,
.fini = grub_video_efi_fini,
.setup = grub_video_efi_setup,
.init = grub_video_uga_init,
.fini = grub_video_uga_fini,
.setup = grub_video_uga_setup,
.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,
.get_palette = grub_video_fb_get_palette,
.set_viewport = grub_video_fb_set_viewport,
@ -317,21 +317,21 @@ static struct grub_video_adapter grub_video_efi_adapter =
.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_efi_swap_buffers,
.swap_buffers = grub_video_uga_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_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,
};
GRUB_MOD_INIT(efi_fb)
GRUB_MOD_INIT(efi_uga)
{
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)
grub_video_unregister (&grub_video_efi_adapter);
grub_video_unregister (&grub_video_uga_adapter);
}