Merged mainstream into newuuid

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-11-25 23:50:54 +01:00
commit 53e08cc54c
76 changed files with 3890 additions and 4518 deletions

View file

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

227
ChangeLog
View file

@ -1,3 +1,220 @@
2009-11-25 Yves Blusseau <yves.blusseau@zetam.org>
* configure.ac: move the call to AM_GNU_GETTEXT to avoid warnings when
aclocal is run.
2009-11-25 Robert Millan <rmh.grub@aybabtu.com>
* normal/main.c (grub_normal_read_line): Fix off-by-one
buffer overflow.
2009-11-25 Robert Millan <rmh.grub@aybabtu.com>
* normal/main.c (grub_normal_execute): Replace "parser.sh" with
"parser.grub" in grub_command_execute() call.
2009-11-24 Carles Pina i Estany <carles@pina.cat>
* conf/i386-coreboot.rmk (kernel_img_HEADERS): Add i18n.h.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* gettext/gettex.c: Include <grub/i18n.h>.
* include/grub/misc.h (grub_gettext_dummy, grub_gettext): Move from
here ...
* include/grub/i18n.h: ... to here
* include/grub/i18n.h: ... to here.
* kern/misc.c: Include <grub/i18n.h>
(grub_gettext_dummy): Move above user.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/Makefile.in (install-local): Convert a `for' into a normal
shell expansion.
2009-11-24 Robert Millan <rmh.grub@aybabtu.com>
* autogen.sh: Add automake call.
* config.guess: Remove.
* config.sub: Likewise.
* install-sh: Likewise.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/Makefile.in (install-local): Fix the use of $lang shell variable.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/Makefile.in (install-local): Convert a make `$(foreach)'
function to a normal shell `for'.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* conf/i386-coreboot.rmk (grub_mkimage_SOURCES): Add `gnulib/progname.c'.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrelpath.c: New file.
* conf/common.rmk (bin_UTILITIES): Add grub-mkrelpath.
(grub_mkrelpath_SOURCES): New variable.
* include/grub/util/misc.h: New function prototype.
* util/misc.c (make_system_path_relative_to_its_root): New function.
* util/grub-mkconfig_lib.in (bindir): New variable.
(grub_mkrelpath): Likewise.
(make_system_path_relative_to_its_root): Use grub-mkrelpath.
* util/probe.c (probe): Make the file path relative to its root.
Change a info message to use the GRUB path. Enable again the
check if we can read the file with GRUB facilities.
* util/i386/pc/grub-setup.c (setup): Make core.img path relative
to its root.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* Makefile.in: Don't include GRUB_CONTRIB makefiles with emu
platform.
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/getroot.c (grub_util_get_dev_abstraction): Properly use
strncmp().
2009-11-24 Felix Zielcke <fzielcke@z-51.de>
* util/getroot.c (grub_util_is_dmraid): New function.
(grub_util_get_dev_abstraction): Treat dmraid and multipath
devices as normal ones, not as LVM.
2009-11-23 Carles Pina i Estany <carles@pina.cat>
* conf/common.rmk: Add grub-gettext_lib target and updates
lib_DATA and CLEANFILES. Adds gettext.mod SOURCES, CFLAGS,
LDFLAGS.
* gettext/gettext.c: New file. (Reads mo files).
* include/grub/file.h (grub_file_pread): New prototype.
* include/grub/i18n.h (_): New prototype.
* include/grub/misc.h (grub_gettext_dummy, grub_gettext): New
prototypes.
* kern/misc.c (grub_gettext_dummy): New function.
* normal/menu_text.c: Include <grub/i18n.h>.
* normal/menu_text.c (print_timeout): Gettexttize string.
* normal/menu_text.c (print_message): Gettexttize string.
* util/grub.d/00_header.in: Define locale_dir and lang. insmod
gettext module and defines locale_dir and lang in grub.cfg.
* NEWS: Add gettext support.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* util/hostdisk.c: Include `<grub/i18n.h>'.
(find_grub_drive): Use ARRAY_SIZE for map size calculation.
(make_device_name): Rewrite using asprintf.
(convert_system_partition_to_system_disk): Replace 0 with NULL.
(find_system_device): If a device is not found, generate one just
by reusing the OS path name.
(read_device_map): Make it permissible for device.map not to exist.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* script/sh/execute.c: Move from here ...
* script/execute.c: ... to here. Update all users.
* script/sh/function.c: Move from here ...
* script/function.c: ... to here. Update all users.
* script/sh/lexer.c: Move from here ...
* script/lexer.c: ... to here. Update all users.
* script/sh/main.c: Move from here ...
* script/main.c: ... to here. Update all users.
* script/sh/parser.y: Move from here ...
* script/parser.y: ... to here. Update all users.
* script/sh/script.c: Move from here ...
* script/script.c: ... to here. Update all users.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* configure.ac: Detect all `emu' platforms. Define
GRUB_MACHINE_* macros in TARGET_CFLAGS. Remove
--enable-grub-emu logic. Disable include/grub/machine
symlink on `emu' platforms.
* genkernsyms.sh.in: Use @TARGET_CFLAGS@ during symbol generation.
* gensymlist.sh.in: Likewise.
* include/grub/i386/coreboot/machine.h: Remove file.
* include/grub/i386/efi/machine.h: Likewise.
* include/grub/i386/ieee1275/machine.h: Likewise.
* include/grub/i386/pc/machine.h: Likewise.
* include/grub/i386/qemu/machine.h: Likewise.
* include/grub/powerpc/ieee1275/machine.h: Likewise.
* include/grub/sparc64/ieee1275/machine.h: Likewise.
* include/grub/x86_64/efi/machine.h: Likewise.
* commands/acpi.c: Remove `<grub/machine/machine.h>'.
* commands/halt.c: Likewise.
* commands/reboot.c: Likewise.
* include/grub/autoefi.h: Likewise.
* include/grub/i386/at_keyboard.h: Likewise.
* include/grub/i386/kernel.h: Likewise.
* include/grub/i386/loader.h: Likewise.
* include/grub/i386/pc/memory.h: Likewise.
* kern/dl.c: Likewise.
* kern/i386/coreboot/init.c: Likewise.
* loader/i386/bsd.c: Likewise.
* loader/i386/linux.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* term/i386/pc/serial.c: Likewise.
* term/usb_keyboard.c: Likewise.
* include/grub/time.h [!GRUB_MACHINE_EMU]: Remove
`<grub/machine/machine.h>'
[!GRUB_MACHINE_EMU] (GRUB_TICKS_PER_SECOND): New macro.
* util/misc.c: Remove `<grub/machine/machine.h>' and
`<grub/machine/time.h>'.
* Makefile.in (enable_grub_emu): Remove variable.
Include $(srcdir)/conf/any-emu.mk for the `emu' platform.
* conf/any-emu.rmk: New file.
* conf/common.rmk (grub_emu_init.lst, grub_emu_init.h)
(grub_emu_init.c): Move from here ...
* conf/any-emu.rmk: ... to here.
* conf/i386-coreboot.rmk (sbin_UTILITIES): Remove `grub-emu'.
(grub_emu_SOURCES, grub_emu_LDFLAGS): Move from here ...
* conf/any-emu.rmk: ... to here.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* include/grub/parser.h (grub_parser_register): Document need
of `name' parameter.
* normal/main.c (grub_normal_read_line): Simplify prompt string.
* script/sh/main.c (grub_sh_parser, GRUB_MOD_INIT(sh)): Rename
"sh" to "grub".
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* Makefile.in ($(srcdir)/po/$(PACKAGE).pot): Pass --keyword=N_ to
`$(XGETTEXT)'.
* include/grub/i18n.h (N_): New macro.
* util/mkisofs/mkisofs.h: Likewise.
* util/mkisofs/mkisofs.c (ld_options): Wrap all translatable strings
around N_().
(usage): Use gettext() to translate help strings when printing them.
2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
Based on patch from Bean
(http://lists.gnu.org/archive/html/grub-devel/2009-08/msg00384.html)
* video/efi_fb.c: New file.
* conf/i386-efi.rmk (pkglib_MODULES): Add `efi_fb.mod'.
(efi_fb_mod_SOURCES, efi_fb_mod_CFLAGS, efi_fb_mod_LDFLAGS): New
variables.
* conf/x86_64-efi.rmk: Likewise.
2009-11-22 Robert Millan <rmh.grub@aybabtu.com> 2009-11-22 Robert Millan <rmh.grub@aybabtu.com>
* util/i386/pc/grub-mkimage.c: Ungettextize grub_util_info() strings. * util/i386/pc/grub-mkimage.c: Ungettextize grub_util_info() strings.
@ -89,8 +306,6 @@
* Makefile.in (po/*.po): Redefine as ... * Makefile.in (po/*.po): Redefine as ...
($(foreach lang, $(LINGUAS), po/$(lang).po)): ... this. ($(foreach lang, $(LINGUAS), po/$(lang).po)): ... this.
* po/POTFILES: Add `util/i386/pc/grub-setup.c'.
2009-11-19 Robert Millan <rmh.grub@aybabtu.com> 2009-11-19 Robert Millan <rmh.grub@aybabtu.com>
* conf/common.rmk (grub_mkisofs_SOURCES): Add `gnulib/progname.c'. * conf/common.rmk (grub_mkisofs_SOURCES): Add `gnulib/progname.c'.
@ -109,8 +324,6 @@
* util/mkisofs/tree.c: Likewise. * util/mkisofs/tree.c: Likewise.
* util/mkisofs/write.c: Likewise. * util/mkisofs/write.c: Likewise.
* po/POTFILES: Update with new files.
2009-11-18 Robert Millan <rmh.grub@aybabtu.com> 2009-11-18 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/eltorito.c: Fix minor mistake in license text. * util/mkisofs/eltorito.c: Fix minor mistake in license text.
@ -138,8 +351,6 @@
2009-11-18 Robert Millan <rmh.grub@aybabtu.com> 2009-11-18 Robert Millan <rmh.grub@aybabtu.com>
* po/POTFILES-shell: New file. List `util/grub.d/10_kfreebsd.in'
and `util/grub.d/10_linux.in'.
* Makefile.in (po/$(PACKAGE).pot): Process `po/POTFILES-shell' for * Makefile.in (po/$(PACKAGE).pot): Process `po/POTFILES-shell' for
translatable Shell files. translatable Shell files.
@ -150,7 +361,6 @@
2009-11-17 Robert Millan <rmh.grub@aybabtu.com> 2009-11-17 Robert Millan <rmh.grub@aybabtu.com>
* INSTALL: Document Automake is needed for bootstrap. * INSTALL: Document Automake is needed for bootstrap.
* po/ca.po: Fix PO-Revision-Date and Language-Team fields.
* util/grub.d/10_kfreebsd.in (bindir): New variable. * util/grub.d/10_kfreebsd.in (bindir): New variable.
Add gettext initialization. Add gettext initialization.
(kfreebsd_entry): Make menuentry output translatable. (kfreebsd_entry): Make menuentry output translatable.
@ -162,7 +372,6 @@
(po/*.po): Replace `msgmerge' with `$(MSGMERGE)'. (po/*.po): Replace `msgmerge' with `$(MSGMERGE)'.
(po/%.mo): Replace `msgfmt' with `$(MSGFMT)'. (po/%.mo): Replace `msgfmt' with `$(MSGFMT)'.
(LINGUAS): Auto-generate using `po/LINGUAS'. (LINGUAS): Auto-generate using `po/LINGUAS'.
* po/LINGUAS: New file.
2009-11-17 Robert Millan <rmh.grub@aybabtu.com> 2009-11-17 Robert Millan <rmh.grub@aybabtu.com>
@ -202,8 +411,6 @@
(install-local): Install MO files. (install-local): Install MO files.
(po/$(PACKAGE).pot, po/*.po, po/%.mo): New rules. (po/$(PACKAGE).pot, po/*.po, po/%.mo): New rules.
* include/grub/i18n.h: New file. * include/grub/i18n.h: New file.
* po/POTFILES: New file.
* po/ca.po: New file.
* util/grub.d/10_linux.in (bindir): New variable. * util/grub.d/10_linux.in (bindir): New variable.
Add gettext initialization. Add gettext initialization.
(linux_entry): Make menuentry output translatable. (linux_entry): Make menuentry output translatable.

View file

@ -111,7 +111,6 @@ YACC = @YACC@
FONT_SOURCE = @FONT_SOURCE@ FONT_SOURCE = @FONT_SOURCE@
# Options. # Options.
enable_grub_emu = @enable_grub_emu@
enable_grub_emu_usb = @enable_grub_emu_usb@ enable_grub_emu_usb = @enable_grub_emu_usb@
enable_grub_fstest = @enable_grub_fstest@ enable_grub_fstest = @enable_grub_fstest@
enable_grub_pe2elf = @enable_grub_pe2elf@ enable_grub_pe2elf = @enable_grub_pe2elf@
@ -153,10 +152,13 @@ $(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb
$(RUBY) $(srcdir)/genmk.rb < $< > $@; \ $(RUBY) $(srcdir)/genmk.rb < $< > $@; \
fi fi
ifeq ($(platform), emu)
include $(srcdir)/conf/any-emu.mk
else
include $(srcdir)/conf/$(target_cpu)-$(platform).mk include $(srcdir)/conf/$(target_cpu)-$(platform).mk
# For external modules. # For external modules.
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk) -include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
endif
### General targets. ### General targets.
@ -308,13 +310,13 @@ install-local: all
dest="`echo $$file | sed 's,.*/,,'`"; \ dest="`echo $$file | sed 's,.*/,,'`"; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \ $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \
done done
$(foreach lang, $(LINGUAS), \ @langs='$(LINGUAS)'; \
$(shell $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$(lang)/LC_MESSAGES) \ for lang in $$langs; do \
@list='po/$(lang).mo'; \ $(SHELL) $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES; \
for file in $$list; do \ file="po/$$lang.mo"; \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)/$(datadir)/locale/$(lang)/LC_MESSAGES/$(PACKAGE).mo; \ $(INSTALL_DATA) $$dir$$file $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
done) done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(infodir) $(SHELL) $(mkinstalldirs) $(DESTDIR)$(infodir)
@list='$(info_INFOS)'; \ @list='$(info_INFOS)'; \
for file in $$list; do \ for file in $$list; do \
@ -473,7 +475,7 @@ genkernsyms.sh: genkernsyms.sh.in config.status
$(SHELL) ./config.status $(SHELL) ./config.status
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell $(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ --keyword=N_
cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell
$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot $(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot

2
NEWS
View file

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

View file

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

View file

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

View file

@ -18,7 +18,6 @@
*/ */
#include <grub/dl.h> #include <grub/dl.h>
#include <grub/machine/machine.h>
#include <grub/command.h> #include <grub/command.h>
#if defined(GRUB_MACHINE_IEEE1275) #if defined(GRUB_MACHINE_IEEE1275)

View file

@ -18,7 +18,6 @@
*/ */
#include <grub/dl.h> #include <grub/dl.h>
#include <grub/machine/machine.h>
#include <grub/command.h> #include <grub/command.h>
#if defined(GRUB_MACHINE_IEEE1275) #if defined(GRUB_MACHINE_IEEE1275)

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

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

View file

@ -71,24 +71,15 @@ grub_mkfont_CFLAGS = $(freetype_cflags)
grub_mkfont_LDFLAGS = $(freetype_libs) grub_mkfont_LDFLAGS = $(freetype_libs)
endif endif
# For grub-mkrelpath.
bin_UTILITIES += grub-mkrelpath
grub_mkrelpath_SOURCES = util/grub-mkrelpath.c util/misc.c
# For the parser. # For the parser.
grub_script.tab.c grub_script.tab.h: script/sh/parser.y grub_script.tab.c grub_script.tab.h: script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/sh/parser.y $(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
# For grub-emu.
grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES))
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
DISTCLEANFILES += grub_emu_init.lst
grub_emu_init.h: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
DISTCLEANFILES += grub_emu_init.h
grub_emu_init.c: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_emu_init.h
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
DISTCLEANFILES += grub_emu_init.c
# For grub-probe. # For grub-probe.
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES)) grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@ rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
@ -163,6 +154,12 @@ update-grub_lib: util/update-grub_lib.in config.status
lib_SCRIPTS += update-grub_lib lib_SCRIPTS += update-grub_lib
CLEANFILES += update-grub_lib CLEANFILES += update-grub_lib
grub-gettext_lib: util/grub-gettext_lib.in config.status
./config.status --file=$@:$<
chmod +x $@
lib_DATA += grub-gettext_lib
CLEANFILES += grub-gettext_lib
%: util/grub.d/%.in config.status %: util/grub.d/%.in config.status
./config.status --file=$@:$< ./config.status --file=$@:$<
chmod +x $@ chmod +x $@
@ -545,8 +542,8 @@ normal_mod_CFLAGS = $(COMMON_CFLAGS)
normal_mod_LDFLAGS = $(COMMON_LDFLAGS) normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For sh.mod. # For sh.mod.
sh_mod_SOURCES = script/sh/main.c script/sh/script.c script/sh/execute.c \ sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
script/sh/function.c script/sh/lexer.c grub_script.tab.c script/function.c script/lexer.c grub_script.tab.c
sh_mod_CFLAGS = $(COMMON_CFLAGS) sh_mod_CFLAGS = $(COMMON_CFLAGS)
sh_mod_LDFLAGS = $(COMMON_LDFLAGS) sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -617,6 +614,12 @@ bufio_mod_SOURCES = io/bufio.c
bufio_mod_CFLAGS = $(COMMON_CFLAGS) bufio_mod_CFLAGS = $(COMMON_CFLAGS)
bufio_mod_LDFLAGS = $(COMMON_LDFLAGS) bufio_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For gettext.mod.
pkglib_MODULES += gettext.mod
gettext_mod_SOURCES = gettext/gettext.c
gettext_mod_CFLAGS = $(COMMON_CFLAGS)
gettext_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Misc. # Misc.
pkglib_MODULES += xnu_uuid.mod pkglib_MODULES += xnu_uuid.mod

View file

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

View file

@ -5,14 +5,11 @@ COMMON_CFLAGS = -fno-builtin -m32
COMMON_LDFLAGS = -melf_i386 -nostdlib COMMON_LDFLAGS = -melf_i386 -nostdlib
# Used by various components. These rules need to precede them. # Used by various components. These rules need to precede them.
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Utilities. # Utilities.
bin_UTILITIES = grub-mkimage bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-mkdevicemap sbin_UTILITIES = grub-mkdevicemap
#ifeq ($(enable_grub_emu), yes)
#sbin_UTILITIES += grub-emu
#endif
# For grub-mkimage. # For grub-mkimage.
grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \ grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
@ -31,51 +28,6 @@ util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c util/devicemap.c util/misc.c
# For grub-emu.
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search_file.c commands/search_label.c commands/search_uuid.c commands/search_wrap.c commands/hexdump.c lib/hexdump.c \
commands/halt.c commands/reboot.c commands/keystatus.c \
commands/i386/cpuid.c \
commands/password.c \
lib/envblk.c commands/loadenv.c \
disk/loopback.c \
\
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
\
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/reader.c kern/term.c \
kern/rescue_reader.c kern/rescue_parser.c \
lib/arg.c normal/cmdline.c normal/command.c normal/datetime.c \
normal/auth.c normal/autofs.c \
normal/completion.c normal/context.c normal/main.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/menu_text.c \
normal/color.c \
script/sh/main.c script/sh/execute.c script/sh/function.c \
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c partmap/gpt.c \
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
# Scripts. # Scripts.
sbin_SCRIPTS = grub-install sbin_SCRIPTS = grub-install
@ -104,7 +56,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 \ 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 \ env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \ partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h 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_CFLAGS = $(COMMON_CFLAGS)
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS) kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS) kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -196,6 +148,11 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS) fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS) fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_fb.mod
efi_fb_mod_SOURCES = video/efi_fb.c
efi_fb_mod_CFLAGS = $(COMMON_CFLAGS)
efi_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\ xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\
loader/macho.c loader/xnu.c loader/i386/xnu_helper.S loader/macho.c loader/xnu.c loader/i386/xnu_helper.S

View file

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

View file

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

View file

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

View file

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

View file

@ -5,14 +5,11 @@ COMMON_CFLAGS = -fno-builtin -m64
COMMON_LDFLAGS = -melf_x86_64 -nostdlib COMMON_LDFLAGS = -melf_x86_64 -nostdlib
# Used by various components. These rules need to precede them. # Used by various components. These rules need to precede them.
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Utilities. # Utilities.
bin_UTILITIES = grub-mkimage bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-mkdevicemap sbin_UTILITIES = grub-mkdevicemap
#ifeq ($(enable_grub_emu), yes)
#sbin_UTILITIES += grub-emu
#endif
# For grub-mkimage. # For grub-mkimage.
grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \ grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
@ -30,50 +27,6 @@ grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c util/devicemap.c util/misc.c
# For grub-emu.
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search_file.c commands/search_label.c commands/search_uuid.c commands/search_wrap.c commands/hexdump.c lib/hexdump.c \
commands/halt.c commands/reboot.c \
commands/i386/cpuid.c \
commands/password.c commands/keystatus.c \
lib/envblk.c commands/loadenv.c \
disk/loopback.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
\
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/readerescue.c kern/term.c \
lib/arg.c normal/cmdline.c normal/misc.c normal/auth.c \
normal/autofs.c \
normal/completion.c normal/datetime.c normal/context.c \
normal/main.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/menu_text.c \
normal/color.c \
script/sh/main.c script/sh/execute.c script/sh/function.c \
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c partmap/gpt.c \
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
# Scripts. # Scripts.
sbin_SCRIPTS = grub-install sbin_SCRIPTS = grub-install
@ -103,7 +56,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 \ env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \ partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \ efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \
handler.h command.h handler.h command.h i18n.h
kernel_mod_CFLAGS = $(COMMON_CFLAGS) kernel_mod_CFLAGS = $(COMMON_CFLAGS)
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS) kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS) kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -201,6 +154,11 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS) fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS) fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_fb.mod
efi_fb_mod_SOURCES = video/efi_fb.c
efi_fb_mod_CFLAGS = $(COMMON_CFLAGS)
efi_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\ xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\
loader/macho.c loader/xnu.c loader/i386/xnu_helper.S loader/macho.c loader/xnu.c loader/i386/xnu_helper.S

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,7 +33,6 @@ dnl type.
AC_INIT([GRUB],[1.97],[bug-grub@gnu.org]) AC_INIT([GRUB],[1.97],[bug-grub@gnu.org])
AM_INIT_AUTOMAKE() AM_INIT_AUTOMAKE()
AM_GNU_GETTEXT()
AC_PREREQ(2.59d) AC_PREREQ(2.59d)
AC_CONFIG_SRCDIR([include/grub/dl.h]) AC_CONFIG_SRCDIR([include/grub/dl.h])
AC_CONFIG_HEADER([config.h]) AC_CONFIG_HEADER([config.h])
@ -91,6 +90,7 @@ case "$target_cpu"-"$platform" in
i386-qemu) ;; i386-qemu) ;;
powerpc-ieee1275) ;; powerpc-ieee1275) ;;
sparc64-ieee1275) ;; sparc64-ieee1275) ;;
*-emu) ;;
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
esac esac
@ -113,6 +113,17 @@ case "$host_os" in
cygwin) host_kernel=windows ;; cygwin) host_kernel=windows ;;
esac esac
case "$platform" in
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
esac
CFLAGS="$CFLAGS $machine_CFLAGS"
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
AC_SUBST(host_cpu) AC_SUBST(host_cpu)
AC_SUBST(host_os) AC_SUBST(host_os)
AC_SUBST(host_kernel) AC_SUBST(host_kernel)
@ -161,6 +172,7 @@ AC_PROG_CC
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
AC_GNU_SOURCE AC_GNU_SOURCE
AM_GNU_GETTEXT
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
# Identify characteristics of the host architecture. # Identify characteristics of the host architecture.
@ -509,40 +521,28 @@ AC_ARG_ENABLE([mm-debug],
[AC_DEFINE([MM_DEBUG], [1], [AC_DEFINE([MM_DEBUG], [1],
[Define to 1 if you enable memory manager debugging.])]) [Define to 1 if you enable memory manager debugging.])])
AC_ARG_ENABLE([grub-emu],
[AS_HELP_STRING([--enable-grub-emu],
[build and install the `grub-emu' debugging utility (default=guessed)])])
AC_ARG_ENABLE([grub-emu-usb], AC_ARG_ENABLE([grub-emu-usb],
[AS_HELP_STRING([--enable-grub-emu-usb], [AS_HELP_STRING([--enable-grub-emu-usb],
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
if test x"$enable_grub_emu" = xno ; then
grub_emu_excuse="explicitly disabled"
fi
[# Check for curses libraries.] if test "$platform" = emu; then
[if [ x"$grub_emu_excuse" = x ]; then ] missing_ncurses=
[# Check for curses libraries.]
AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
[AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
[grub_emu_excuse=["need (n)curses libraries"]])]) [missing_ncurses=[true]])])
AC_SUBST([LIBCURSES]) AC_SUBST([LIBCURSES])
[fi] [if [ x"$missing_ncurses" = x ]; then ]
[if [ x"$grub_emu_excuse" = x ]; then ]
[# Check for headers.] [# Check for headers.]
AC_CHECK_HEADERS([ncurses/curses.h], [], AC_CHECK_HEADERS([ncurses/curses.h], [],
[AC_CHECK_HEADERS([ncurses.h], [], [AC_CHECK_HEADERS([ncurses.h], [],
[AC_CHECK_HEADERS([curses.h], [], [AC_CHECK_HEADERS([curses.h], [],
[grub_emu_excuse=["need (n)curses headers"]])])]) [missing_ncurses=[true]])])])
[fi] [fi]
if test x"$missing_ncurses" = xtrue ; then
AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
fi
if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then
AC_MSG_ERROR([grub-emu was explicitly requested but can't be compiled])
fi
if test x"$grub_emu_excuse" = x ; then
enable_grub_emu=yes
else
enable_grub_emu=no
grub_emu_usb_excuse="grub-emu isn't built"
fi
if test x"$enable_grub_emu_usb" = xno ; then if test x"$enable_grub_emu_usb" = xno ; then
grub_emu_usb_excuse="explicitly disabled" grub_emu_usb_excuse="explicitly disabled"
fi fi
@ -565,9 +565,8 @@ enable_grub_emu_usb=yes
else else
enable_grub_emu_usb=no enable_grub_emu_usb=no
fi fi
AC_SUBST([enable_grub_emu])
AC_SUBST([enable_grub_emu_usb]) AC_SUBST([enable_grub_emu_usb])
fi
AC_ARG_ENABLE([grub-fstest], AC_ARG_ENABLE([grub-fstest],
[AS_HELP_STRING([--enable-grub-fstest], [AS_HELP_STRING([--enable-grub-fstest],
@ -615,14 +614,18 @@ AC_SUBST(ASFLAGS)
# Output files. # Output files.
grub_CHECK_LINK_DIR grub_CHECK_LINK_DIR
if test x"$link_dir" = xyes ; then if test x"$link_dir" = xyes ; then
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
include/grub/machine:include/grub/$target_cpu/$platform]) if test "$platform" != emu ; then
AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
fi
else else
mkdir -p include/grub 2>/dev/null mkdir -p include/grub 2>/dev/null
rm -rf include/grub/cpu rm -rf include/grub/cpu
cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
rm -rf include/grub/machine if test "$platform" != emu ; then
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null rm -rf include/grub/machine
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
fi
fi fi
AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh]) AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
@ -631,16 +634,13 @@ AC_OUTPUT
echo "*******************************************************" echo "*******************************************************"
echo GRUB2 will be compiled with following components: echo GRUB2 will be compiled with following components:
echo Platform: "$target_cpu"-"$platform" echo Platform: "$target_cpu"-"$platform"
if [ x"$grub_emu_excuse" = x ]; then if [ x"$platform" = xemu ]; then
echo grub-emu: Yes
else
echo grub-emu: No "($grub_emu_excuse)"
fi
if [ x"$grub_emu_usb_excuse" = x ]; then if [ x"$grub_emu_usb_excuse" = x ]; then
echo USB support for grub-emu: Yes echo USB support for grub-emu: Yes
else else
echo USB support for grub-emu: No "($grub_emu_usb_excuse)" echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
fi fi
fi
if [ x"$enable_mm_debug" = xyes ]; then if [ x"$enable_mm_debug" = xyes ]; then
echo With memory debugging: Yes echo With memory debugging: Yes
else else

View file

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

View file

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

311
gettext/gettext.c Normal file
View file

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

View file

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

View file

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

View file

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

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_COREBOOT 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_EFI 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_IEEE1275 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

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

View file

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

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_PCBIOS 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -21,7 +21,6 @@
#define GRUB_MEMORY_MACHINE_HEADER 1 #define GRUB_MEMORY_MACHINE_HEADER 1
#include <grub/symbol.h> #include <grub/symbol.h>
#include <grub/machine/machine.h>
#ifndef ASM_FILE #ifndef ASM_FILE
#include <grub/types.h> #include <grub/types.h>
#include <grub/err.h> #include <grub/err.h>

View file

@ -1,24 +0,0 @@
/*
* 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_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_QEMU 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -1,7 +1,7 @@
/* misc.h - prototypes for misc functions */ /* misc.h - prototypes for misc functions */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008 Free Software Foundation, Inc. * Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View file

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

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_IEEE1275 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_IEEE1275 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* GRUB -- GRand Unified Bootloader * 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 * GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -76,4 +76,7 @@ grub_int64_t grub_util_get_disk_size (char *name);
#endif #endif
char *make_system_path_relative_to_its_root (const char *path);
#endif /* ! GRUB_UTIL_MISC_HEADER */ #endif /* ! GRUB_UTIL_MISC_HEADER */

View file

@ -1,24 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#define GRUB_MACHINE_EFI 1
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

View file

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

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

View file

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

View file

@ -23,6 +23,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <grub/term.h> #include <grub/term.h>
#include <grub/env.h> #include <grub/env.h>
#include <grub/i18n.h>
static int static int
grub_iswordseparator (int c) grub_iswordseparator (int c)
@ -30,6 +31,15 @@ grub_iswordseparator (int c)
return (grub_isspace (c) || c == ',' || c == ';' || c == '|' || 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 * void *
grub_memmove (void *dest, const void *src, grub_size_t n) grub_memmove (void *dest, const void *src, grub_size_t n)
{ {

View file

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

View file

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

View file

@ -17,7 +17,6 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/machine/machine.h>
#include <grub/multiboot.h> #include <grub/multiboot.h>
#include <grub/multiboot2.h> #include <grub/multiboot2.h>
#include <multiboot2.h> #include <multiboot2.h>

View file

@ -29,6 +29,7 @@
#include <grub/reader.h> #include <grub/reader.h>
#include <grub/menu_viewer.h> #include <grub/menu_viewer.h>
#include <grub/auth.h> #include <grub/auth.h>
#include <grub/i18n.h>
#define GRUB_DEFAULT_HISTORY_SIZE 50 #define GRUB_DEFAULT_HISTORY_SIZE 50
@ -414,7 +415,7 @@ grub_normal_execute (const char *config, int nested, int batch)
read_command_list (); read_command_list ();
read_fs_list (); read_fs_list ();
read_handler_list (); read_handler_list ();
grub_command_execute ("parser.sh", 0, 0); grub_command_execute ("parser.grub", 0, 0);
reader_nested = nested; reader_nested = nested;
@ -508,10 +509,10 @@ grub_normal_reader_init (void)
grub_normal_init_page (); grub_normal_init_page ();
grub_setcursor (1); grub_setcursor (1);
grub_printf ("\ grub_printf (_("\
[ Minimal BASH-like line editing is supported. For the first word, TAB\n\ [ Minimal BASH-like line editing is supported. For the first word, TAB\n\
lists possible command completions. Anywhere else TAB lists possible\n\ lists possible command completions. Anywhere else TAB lists possible\n\
device/file completions.%s ]\n\n", device/file completions.%s ]\n\n"),
reader_nested ? " ESC at any time exits." : ""); reader_nested ? " ESC at any time exits." : "");
return 0; return 0;
@ -523,9 +524,9 @@ static grub_err_t
grub_normal_read_line (char **line, int cont) grub_normal_read_line (char **line, int cont)
{ {
grub_parser_t parser = grub_parser_get_current (); grub_parser_t parser = grub_parser_get_current ();
char prompt[8 + grub_strlen (parser->name)]; char prompt[sizeof("> ") + grub_strlen (parser->name)];
grub_sprintf (prompt, "%s:%s> ", parser->name, (cont) ? "" : "grub"); grub_sprintf (prompt, "%s> ", parser->name);
while (1) while (1)
{ {

View file

@ -24,6 +24,7 @@
#include <grub/command.h> #include <grub/command.h>
#include <grub/parser.h> #include <grub/parser.h>
#include <grub/auth.h> #include <grub/auth.h>
#include <grub/i18n.h>
enum update_mode enum update_mode
{ {
@ -996,7 +997,7 @@ run (struct screen *screen)
} }
grub_cls (); grub_cls ();
grub_printf (" Booting a command list\n\n"); grub_printf (_(" Booting a command list\n\n"));
/* Execute the script, line for line. */ /* Execute the script, line for line. */
@ -1176,6 +1177,6 @@ grub_menu_entry_run (grub_menu_entry_t entry)
grub_cls (); grub_cls ();
grub_print_error (); grub_print_error ();
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
grub_printf ("\nPress any key to continue..."); grub_printf (_("\nPress any key to continue..."));
(void) grub_getkey (); (void) grub_getkey ();
} }

View file

@ -25,6 +25,7 @@
#include <grub/time.h> #include <grub/time.h>
#include <grub/env.h> #include <grub/env.h>
#include <grub/menu_viewer.h> #include <grub/menu_viewer.h>
#include <grub/i18n.h>
/* Time to delay after displaying an error message about a default/fallback /* Time to delay after displaying an error message about a default/fallback
entry failing to boot. */ entry failing to boot. */
@ -93,8 +94,8 @@ print_message (int nested, int edit)
} }
else else
{ {
grub_printf ("\n\ grub_printf (_("\n\
Use the %C and %C keys to select which entry is highlighted.\n", Use the %C and %C keys to select which entry is highlighted.\n"),
(grub_uint32_t) GRUB_TERM_DISP_UP, (grub_uint32_t) GRUB_TERM_DISP_DOWN); (grub_uint32_t) GRUB_TERM_DISP_UP, (grub_uint32_t) GRUB_TERM_DISP_DOWN);
grub_printf ("\ grub_printf ("\
Press enter to boot the selected OS, \'e\' to edit the\n\ Press enter to boot the selected OS, \'e\' to edit the\n\

43
po/ChangeLog Normal file
View file

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

View file

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

View file

@ -10,3 +10,5 @@ util/mkisofs/multi.c
util/mkisofs/rock.c util/mkisofs/rock.c
util/mkisofs/tree.c util/mkisofs/tree.c
util/mkisofs/write.c util/mkisofs/write.c
normal/menu_text.c

232
po/ca.po
View file

@ -6,7 +6,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: GNU GRUB\n" "Project-Id-Version: GNU GRUB\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-11-23 21:07+0100\n" "POT-Creation-Date: 2009-11-25 23:49+0100\n"
"PO-Revision-Date: 2009-11-17 12:26+0100\n" "PO-Revision-Date: 2009-11-17 12:26+0100\n"
"Last-Translator: Robert Millan <rmh.grub@aybabtu.com>\n" "Last-Translator: Robert Millan <rmh.grub@aybabtu.com>\n"
"Language-Team: None <no-team-yet@li.org>\n" "Language-Team: None <no-team-yet@li.org>\n"
@ -40,7 +40,7 @@ msgstr ""
msgid "Core image is too big (%p > %p)\n" msgid "Core image is too big (%p > %p)\n"
msgstr "" msgstr ""
#: util/i386/pc/grub-mkimage.c:321 util/i386/pc/grub-setup.c:587 #: util/i386/pc/grub-mkimage.c:321 util/i386/pc/grub-setup.c:589
#, c-format #, c-format
msgid "Try ``%s --help'' for more information.\n" msgid "Try ``%s --help'' for more information.\n"
msgstr "Proveu «%s --help» per a obtenir més informació.\n" msgstr "Proveu «%s --help» per a obtenir més informació.\n"
@ -162,39 +162,39 @@ msgstr ""
msgid "If you really want blocklists, use --force." msgid "If you really want blocklists, use --force."
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:439 #: util/i386/pc/grub-setup.c:441
#, c-format #, c-format
msgid "attempting to read the core image `%s' from GRUB" msgid "attempting to read the core image `%s' from GRUB"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:440 #: util/i386/pc/grub-setup.c:442
#, c-format #, c-format
msgid "attempting to read the core image `%s' from GRUB again" msgid "attempting to read the core image `%s' from GRUB again"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:498 #: util/i386/pc/grub-setup.c:500
#, c-format #, c-format
msgid "Cannot read `%s' correctly" msgid "Cannot read `%s' correctly"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:511 #: util/i386/pc/grub-setup.c:513
msgid "No terminator in the core image" msgid "No terminator in the core image"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:522 #: util/i386/pc/grub-setup.c:524
msgid "Failed to read the first sector of the core image" msgid "Failed to read the first sector of the core image"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:528 #: util/i386/pc/grub-setup.c:530
msgid "Failed to read the rest sectors of the core image" msgid "Failed to read the rest sectors of the core image"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:547 #: util/i386/pc/grub-setup.c:549
#, c-format #, c-format
msgid "Cannot open `%s'" msgid "Cannot open `%s'"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:589 #: util/i386/pc/grub-setup.c:591
#, c-format #, c-format
msgid "" msgid ""
"Usage: grub-setup [OPTION]... DEVICE\n" "Usage: grub-setup [OPTION]... DEVICE\n"
@ -216,27 +216,27 @@ msgid ""
"Report bugs to <%s>.\n" "Report bugs to <%s>.\n"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:719 #: util/i386/pc/grub-setup.c:721
#, c-format #, c-format
msgid "No device is specified.\n" msgid "No device is specified.\n"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:725 #: util/i386/pc/grub-setup.c:727
#, c-format #, c-format
msgid "Unknown extra argument `%s'.\n" msgid "Unknown extra argument `%s'.\n"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:742 #: util/i386/pc/grub-setup.c:744
#, c-format #, c-format
msgid "Invalid device `%s'.\n" msgid "Invalid device `%s'.\n"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:755 #: util/i386/pc/grub-setup.c:757
#, c-format #, c-format
msgid "Invalid root device `%s'" msgid "Invalid root device `%s'"
msgstr "" msgstr ""
#: util/i386/pc/grub-setup.c:768 #: util/i386/pc/grub-setup.c:770
msgid "Cannot guess the root device. Specify the option ``--root-device''." msgid "Cannot guess the root device. Specify the option ``--root-device''."
msgstr "" msgstr ""
@ -372,6 +372,199 @@ msgstr ""
msgid "Unexpected joliet directory length %d %d %s\n" msgid "Unexpected joliet directory length %d %d %s\n"
msgstr "" msgstr ""
#: util/mkisofs/mkisofs.c:203
msgid "Process all files (don't skip backup files)"
msgstr ""
#: util/mkisofs/mkisofs.c:205
msgid "Set Abstract filename"
msgstr ""
#: util/mkisofs/mkisofs.c:207
msgid "Set Application ID"
msgstr ""
#: util/mkisofs/mkisofs.c:209
msgid "Set Bibliographic filename"
msgstr ""
#: util/mkisofs/mkisofs.c:211
msgid "Set Copyright filename"
msgstr ""
#: util/mkisofs/mkisofs.c:213
msgid "Set El Torito boot image name"
msgstr ""
#: util/mkisofs/mkisofs.c:215
msgid "Set El Torito boot catalog name"
msgstr ""
#: util/mkisofs/mkisofs.c:217
msgid "Patch Boot Info Table in El Torito boot image"
msgstr ""
#: util/mkisofs/mkisofs.c:219
msgid "Dummy option for backward compatibility"
msgstr ""
#: util/mkisofs/mkisofs.c:221
msgid "Enable floppy drive emulation for El Torito"
msgstr ""
#: util/mkisofs/mkisofs.c:223
msgid "Magic parameters from cdrecord"
msgstr ""
#: util/mkisofs/mkisofs.c:225
msgid "Omit trailing periods from filenames"
msgstr ""
#: util/mkisofs/mkisofs.c:227
msgid "Disable deep directory relocation"
msgstr ""
#: util/mkisofs/mkisofs.c:229
msgid "Follow symbolic links"
msgstr ""
#: util/mkisofs/mkisofs.c:231 util/mkisofs/mkisofs.c:233
msgid "Print option help"
msgstr ""
#: util/mkisofs/mkisofs.c:235
msgid "Print version information and exit"
msgstr ""
#: util/mkisofs/mkisofs.c:237
msgid "Hide ISO9660/RR file"
msgstr ""
#: util/mkisofs/mkisofs.c:239
msgid "Hide Joliet file"
msgstr ""
#: util/mkisofs/mkisofs.c:241
msgid "No longer supported"
msgstr ""
#: util/mkisofs/mkisofs.c:243
msgid "Generate Joliet directory information"
msgstr ""
#: util/mkisofs/mkisofs.c:245
msgid "Allow full 32 character filenames for iso9660 names"
msgstr ""
#: util/mkisofs/mkisofs.c:247
msgid "Allow iso9660 filenames to start with '.'"
msgstr ""
#: util/mkisofs/mkisofs.c:249
msgid "Re-direct messages to LOG_FILE"
msgstr ""
#: util/mkisofs/mkisofs.c:251
msgid "Exclude file name"
msgstr ""
#: util/mkisofs/mkisofs.c:253
msgid "Set path to previous session to merge"
msgstr ""
#: util/mkisofs/mkisofs.c:255
msgid "Omit version number from iso9660 filename"
msgstr ""
#: util/mkisofs/mkisofs.c:257
msgid "Inhibit splitting symlink components"
msgstr ""
#: util/mkisofs/mkisofs.c:259
msgid "Inhibit splitting symlink fields"
msgstr ""
#: util/mkisofs/mkisofs.c:261
msgid "Set output file name"
msgstr ""
#: util/mkisofs/mkisofs.c:263
msgid "Set Volume preparer"
msgstr ""
#: util/mkisofs/mkisofs.c:265
msgid "Print estimated filesystem size and exit"
msgstr ""
#: util/mkisofs/mkisofs.c:267
msgid "Set Volume publisher"
msgstr ""
#: util/mkisofs/mkisofs.c:269
msgid "Run quietly"
msgstr ""
#: util/mkisofs/mkisofs.c:271
msgid "Generate rationalized Rock Ridge directory information"
msgstr ""
#: util/mkisofs/mkisofs.c:273
msgid "Generate Rock Ridge directory information"
msgstr ""
#: util/mkisofs/mkisofs.c:275
msgid "Split output into files of approx. 1GB size"
msgstr ""
#: util/mkisofs/mkisofs.c:277
msgid "Set System ID"
msgstr ""
#: util/mkisofs/mkisofs.c:279
msgid ""
"Generate translation tables for systems that don't understand long filenames"
msgstr ""
#: util/mkisofs/mkisofs.c:281
msgid "Verbose"
msgstr ""
#: util/mkisofs/mkisofs.c:283
msgid "Set Volume ID"
msgstr ""
#: util/mkisofs/mkisofs.c:285
msgid "Set Volume set ID"
msgstr ""
#: util/mkisofs/mkisofs.c:287
msgid "Set Volume set size"
msgstr ""
#: util/mkisofs/mkisofs.c:289
msgid "Set Volume set sequence number"
msgstr ""
#: util/mkisofs/mkisofs.c:291
msgid "Exclude file name (deprecated)"
msgstr ""
#: util/mkisofs/mkisofs.c:297
msgid "Override creation date"
msgstr ""
#: util/mkisofs/mkisofs.c:299
msgid "Override modification date"
msgstr ""
#: util/mkisofs/mkisofs.c:301
msgid "Override expiration date"
msgstr ""
#: util/mkisofs/mkisofs.c:303
msgid "Override effective date"
msgstr ""
#: util/mkisofs/mkisofs.c:373 #: util/mkisofs/mkisofs.c:373
#, c-format #, c-format
msgid "Using \"%s\"\n" msgid "Using \"%s\"\n"
@ -803,6 +996,15 @@ msgstr ""
msgid "Path table size(bytes): %d\n" msgid "Path table size(bytes): %d\n"
msgstr "" msgstr ""
#: normal/menu_text.c:97
#, c-format
msgid ""
"\n"
" Use the %C and %C keys to select which entry is highlighted.\n"
msgstr ""
"\n"
" Utilitzeu les tecles %C i %C per a seleccionar l'entrada ressaltada.\n"
#: util/grub.d/10_kfreebsd.in:40 #: util/grub.d/10_kfreebsd.in:40
msgid "%s, with kFreeBSD %s" msgid "%s, with kFreeBSD %s"
msgstr "" msgstr ""

1149
po/id.po Normal file

File diff suppressed because it is too large Load diff

1055
po/zh_CN.po Normal file

File diff suppressed because it is too large Load diff

View file

@ -42,13 +42,13 @@ grub_normal_parse_line (char *line, grub_reader_getline_t getline)
static struct grub_parser grub_sh_parser = static struct grub_parser grub_sh_parser =
{ {
.name = "sh", .name = "grub",
.parse_line = grub_normal_parse_line .parse_line = grub_normal_parse_line
}; };
GRUB_MOD_INIT(sh) GRUB_MOD_INIT(sh)
{ {
grub_parser_register ("sh", &grub_sh_parser); grub_parser_register ("grub", &grub_sh_parser);
} }
GRUB_MOD_FINI(sh) GRUB_MOD_FINI(sh)

View file

@ -16,7 +16,6 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/machine/machine.h>
#include <grub/machine/memory.h> #include <grub/machine/memory.h>
#include <grub/machine/serial.h> #include <grub/machine/serial.h>
#include <grub/machine/console.h> #include <grub/machine/console.h>

View file

@ -18,7 +18,6 @@
*/ */
#include <grub/term.h> #include <grub/term.h>
#include <grub/machine/machine.h>
#include <grub/machine/console.h> #include <grub/machine/console.h>
#include <grub/time.h> #include <grub/time.h>
#include <grub/cpu/io.h> #include <grub/cpu/io.h>

View file

@ -460,13 +460,41 @@ grub_guess_root_device (const char *dir)
return os_dev; 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 int
grub_util_get_dev_abstraction (const char *os_dev UNUSED) grub_util_get_dev_abstraction (const char *os_dev UNUSED)
{ {
#ifdef __linux__ #ifdef __linux__
/* Check for LVM. */ /* 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; return GRUB_DEV_ABSTRACTION_LVM;
/* Check for RAID. */ /* Check for RAID. */

View file

@ -20,10 +20,12 @@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
datarootdir=@datarootdir@ datarootdir=@datarootdir@
datadir=@datadir@ datadir=@datadir@
bindir=@bindir@
sbindir=@sbindir@ sbindir=@sbindir@
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"` pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}` grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
grub_warn () grub_warn ()
{ {
@ -32,49 +34,7 @@ grub_warn ()
make_system_path_relative_to_its_root () make_system_path_relative_to_its_root ()
{ {
path=$1 path="`${grub_mkrelpath} $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
case "`uname 2>/dev/null`" in case "`uname 2>/dev/null`" in
CYGWIN*) CYGWIN*)

99
util/grub-mkrelpath.c Normal file
View file

@ -0,0 +1,99 @@
/* 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 <getopt.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 ``grub-mkrelpath --help'' for more information.\n");
else
printf ("\
Usage: grub-mkrelpath [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", PACKAGE_BUGREPORT);
exit (status);
}
int
main (int argc, char *argv[])
{
char *argument, *relpath;
progname = "grub-mkrelpath";
/* 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", progname, 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

@ -235,9 +235,6 @@ probe (const char *path, char *device_name)
if (print == PRINT_FS) 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; struct stat st;
stat (path, &st); stat (path, &st);
@ -247,12 +244,17 @@ probe (const char *path, char *device_name)
/* Regular file. Verify that we can read it properly. */ /* Regular file. Verify that we can read it properly. */
grub_file_t file; grub_file_t file;
char *rel_path;
grub_util_info ("reading %s via OS facilities", path); grub_util_info ("reading %s via OS facilities", path);
filebuf_via_sys = grub_util_read_image (path); filebuf_via_sys = grub_util_read_image (path);
grub_util_info ("reading %s via GRUB facilities", path); rel_path = make_system_path_relative_to_its_root (path);
asprintf (&grub_path, "(%s)%s", drive_name, 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); 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); filebuf_via_grub = xmalloc (file->size);
grub_file_read (file, filebuf_via_grub, file->size); grub_file_read (file, filebuf_via_grub, file->size);
@ -261,7 +263,6 @@ probe (const char *path, char *device_name)
if (memcmp (filebuf_via_grub, filebuf_via_sys, file->size)) if (memcmp (filebuf_via_grub, filebuf_via_sys, file->size))
grub_util_error ("files differ"); grub_util_error ("files differ");
} }
#endif
printf ("%s\n", fs->name); printf ("%s\n", fs->name);
} }

View file

@ -22,6 +22,8 @@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
grub_prefix=`echo /boot/grub | sed ${transform}` grub_prefix=`echo /boot/grub | sed ${transform}`
locale_dir=`echo /boot/grub/locale | sed ${transform}`
grub_lang=`echo $LANG | cut -d _ -f 1`
. ${libdir}/grub/grub-mkconfig_lib . ${libdir}/grub/grub-mkconfig_lib
@ -100,6 +102,15 @@ EOF
;; ;;
esac esac
# Gettext variables and module
if [ "x${LANG}" != "xC" ] ; then
cat << EOF
set locale_dir=${locale_dir}
set lang=${grub_lang}
insmod gettext
EOF
fi
if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose= verbose=

View file

@ -25,6 +25,7 @@
#include <grub/util/misc.h> #include <grub/util/misc.h>
#include <grub/util/hostdisk.h> #include <grub/util/hostdisk.h>
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/i18n.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -127,7 +128,7 @@ find_grub_drive (const char *name)
if (name) if (name)
{ {
for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) for (i = 0; i < ARRAY_SIZE (map); i++)
if (map[i].drive && ! strcmp (map[i].drive, name)) if (map[i].drive && ! strcmp (map[i].drive, name))
return i; return i;
} }
@ -565,7 +566,10 @@ read_device_map (const char *dev_map)
fp = fopen (dev_map, "r"); fp = fopen (dev_map, "r");
if (! fp) if (! fp)
grub_util_error ("Cannot open `%s'", dev_map); {
grub_util_info (_("Cannot open `%s'"), dev_map);
return;
}
while (fgets (buf, sizeof (buf), fp)) while (fgets (buf, sizeof (buf), fp))
{ {
@ -670,34 +674,27 @@ grub_util_biosdisk_fini (void)
static char * static char *
make_device_name (int drive, int dos_part, int bsd_part) make_device_name (int drive, int dos_part, int bsd_part)
{ {
int len = strlen(map[drive].drive); char *ret;
char *p; char *dos_part_str = NULL;
char *bsd_part_str = NULL;
if (dos_part >= 0) if (dos_part >= 0)
{ asprintf (&dos_part_str, ",%d", dos_part + 1);
/* Add in char length of dos_part+1 */
int tmp = dos_part + 1;
len++;
while ((tmp /= 10) != 0)
len++;
}
if (bsd_part >= 0)
len += 2;
/* Length to alloc is: char length of map[drive].drive, plus
* char length of (dos_part+1) or of bsd_part, plus
* 2 for the comma and a null/end of string (\0)
*/
p = xmalloc (len + 2);
sprintf (p, "%s", map[drive].drive);
if (dos_part >= 0)
sprintf (p + strlen (p), ",%d", dos_part + 1);
if (bsd_part >= 0) if (bsd_part >= 0)
sprintf (p + strlen (p), ",%c", bsd_part + 'a'); asprintf (&bsd_part_str, ",%c", dos_part + 'a');
return p; asprintf (&ret, "%s%s%s", map[drive].drive,
dos_part_str ? : "",
bsd_part_str ? : "");
if (dos_part_str)
free (dos_part_str);
if (bsd_part_str)
free (bsd_part_str);
return ret;
} }
static char * static char *
@ -706,7 +703,7 @@ convert_system_partition_to_system_disk (const char *os_dev)
#if defined(__linux__) #if defined(__linux__)
char *path = xmalloc (PATH_MAX); char *path = xmalloc (PATH_MAX);
if (! realpath (os_dev, path)) if (! realpath (os_dev, path))
return 0; return NULL;
if (strncmp ("/dev/", path, 5) == 0) if (strncmp ("/dev/", path, 5) == 0)
{ {
@ -876,22 +873,29 @@ device_is_wholedisk (const char *os_dev)
static int static int
find_system_device (const char *os_dev) find_system_device (const char *os_dev)
{ {
int i; unsigned int i;
char *os_disk; char *os_disk;
os_disk = convert_system_partition_to_system_disk (os_dev); os_disk = convert_system_partition_to_system_disk (os_dev);
if (! os_disk) if (! os_disk)
return -1; return -1;
for (i = 0; i < (int) (sizeof (map) / sizeof (map[0])); i++) for (i = 0; i < ARRAY_SIZE (map); i++)
if (map[i].device && strcmp (map[i].device, os_disk) == 0) if (! map[i].device)
break;
else if (strcmp (map[i].device, os_disk) == 0)
{ {
free (os_disk); free (os_disk);
return i; return i;
} }
free (os_disk); if (i == ARRAY_SIZE (map))
return -1; grub_util_error (_("device count exceeds limit"));
map[i].device = os_disk;
map[i].drive = xstrdup (os_disk);
return i;
} }
char * char *

View file

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

View file

@ -18,10 +18,12 @@
#include <config.h> #include <config.h>
#include <errno.h>
#include <setjmp.h> #include <setjmp.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdint.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -36,8 +38,6 @@
#include <grub/mm.h> #include <grub/mm.h>
#include <grub/term.h> #include <grub/term.h>
#include <grub/time.h> #include <grub/time.h>
#include <grub/machine/time.h>
#include <grub/machine/machine.h>
/* Include malloc.h, only if memalign is available. It is known that /* Include malloc.h, only if memalign is available. It is known that
memalign is declared in malloc.h in all systems, if present. */ memalign is declared in malloc.h in all systems, if present. */
@ -449,3 +449,82 @@ fail:
} }
#endif /* __MINGW32__ */ #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

@ -200,107 +200,107 @@ struct ld_option
static const struct ld_option ld_options[] = static const struct ld_option ld_options[] =
{ {
{ {"all-files", no_argument, NULL, 'a'}, { {"all-files", no_argument, NULL, 'a'},
'a', NULL, "Process all files (don't skip backup files)", ONE_DASH }, 'a', NULL, N_("Process all files (don't skip backup files)"), ONE_DASH },
{ {"abstract", required_argument, NULL, OPTION_ABSTRACT}, { {"abstract", required_argument, NULL, OPTION_ABSTRACT},
'\0', "FILE", "Set Abstract filename" , ONE_DASH }, '\0', "FILE", N_("Set Abstract filename"), ONE_DASH },
{ {"appid", required_argument, NULL, 'A'}, { {"appid", required_argument, NULL, 'A'},
'A', "ID", "Set Application ID" , ONE_DASH }, 'A', "ID", N_("Set Application ID"), ONE_DASH },
{ {"biblio", required_argument, NULL, OPTION_BIBLIO}, { {"biblio", required_argument, NULL, OPTION_BIBLIO},
'\0', "FILE", "Set Bibliographic filename" , ONE_DASH }, '\0', "FILE", N_("Set Bibliographic filename"), ONE_DASH },
{ {"copyright", required_argument, NULL, OPTION_COPYRIGHT}, { {"copyright", required_argument, NULL, OPTION_COPYRIGHT},
'\0', "FILE", "Set Copyright filename" , ONE_DASH }, '\0', "FILE", N_("Set Copyright filename"), ONE_DASH },
{ {"eltorito-boot", required_argument, NULL, 'b'}, { {"eltorito-boot", required_argument, NULL, 'b'},
'b', "FILE", "Set El Torito boot image name" , ONE_DASH }, 'b', "FILE", N_("Set El Torito boot image name"), ONE_DASH },
{ {"eltorito-catalog", required_argument, NULL, 'c'}, { {"eltorito-catalog", required_argument, NULL, 'c'},
'c', "FILE", "Set El Torito boot catalog name" , ONE_DASH }, 'c', "FILE", N_("Set El Torito boot catalog name"), ONE_DASH },
{ {"boot-info-table", no_argument, NULL, OPTION_BOOT_INFO_TABLE }, { {"boot-info-table", no_argument, NULL, OPTION_BOOT_INFO_TABLE },
'\0', NULL, "Patch Boot Info Table in El Torito boot image" , ONE_DASH }, '\0', NULL, N_("Patch Boot Info Table in El Torito boot image"), ONE_DASH },
{ {"no-emul-boot", no_argument, NULL, OPTION_NO_EMUL_BOOT }, { {"no-emul-boot", no_argument, NULL, OPTION_NO_EMUL_BOOT },
'\0', NULL, "Dummy option for backward compatibility" , ONE_DASH }, '\0', NULL, N_("Dummy option for backward compatibility"), ONE_DASH },
{ {"eltorito-emul-floppy", no_argument, NULL, OPTION_ELTORITO_EMUL_FLOPPY }, { {"eltorito-emul-floppy", no_argument, NULL, OPTION_ELTORITO_EMUL_FLOPPY },
'\0', NULL, "Enable floppy drive emulation for El Torito" , TWO_DASHES }, '\0', NULL, N_("Enable floppy drive emulation for El Torito"), TWO_DASHES },
{ {"cdwrite-params", required_argument, NULL, 'C'}, { {"cdwrite-params", required_argument, NULL, 'C'},
'C', "PARAMS", "Magic parameters from cdrecord" , ONE_DASH }, 'C', "PARAMS", N_("Magic parameters from cdrecord"), ONE_DASH },
{ {"omit-period", no_argument, NULL, 'd'}, { {"omit-period", no_argument, NULL, 'd'},
'd', NULL, "Omit trailing periods from filenames", ONE_DASH }, 'd', NULL, N_("Omit trailing periods from filenames"), ONE_DASH },
{ {"disable-deep-relocation", no_argument, NULL, 'D'}, { {"disable-deep-relocation", no_argument, NULL, 'D'},
'D', NULL, "Disable deep directory relocation", ONE_DASH }, 'D', NULL, N_("Disable deep directory relocation"), ONE_DASH },
{ {"follow-links", no_argument, NULL, 'f'}, { {"follow-links", no_argument, NULL, 'f'},
'f', NULL, "Follow symbolic links", ONE_DASH }, 'f', NULL, N_("Follow symbolic links"), ONE_DASH },
{ {"help", no_argument, NULL, OPTION_HELP}, { {"help", no_argument, NULL, OPTION_HELP},
'\0', NULL, "Print option help", ONE_DASH }, '\0', NULL, N_("Print option help"), ONE_DASH },
{ {"help", no_argument, NULL, OPTION_HELP}, { {"help", no_argument, NULL, OPTION_HELP},
'\0', NULL, "Print option help", TWO_DASHES }, '\0', NULL, N_("Print option help"), TWO_DASHES },
{ {"version", no_argument, NULL, OPTION_VERSION}, { {"version", no_argument, NULL, OPTION_VERSION},
'\0', NULL, "Print version information and exit", TWO_DASHES }, '\0', NULL, N_("Print version information and exit"), TWO_DASHES },
{ {"hide", required_argument, NULL, OPTION_I_HIDE}, { {"hide", required_argument, NULL, OPTION_I_HIDE},
'\0', "GLOBFILE", "Hide ISO9660/RR file" , ONE_DASH }, '\0', "GLOBFILE", N_("Hide ISO9660/RR file"), ONE_DASH },
{ {"hide-joliet", required_argument, NULL, OPTION_J_HIDE}, { {"hide-joliet", required_argument, NULL, OPTION_J_HIDE},
'\0', "GLOBFILE", "Hide Joliet file" , ONE_DASH }, '\0', "GLOBFILE", N_("Hide Joliet file"), ONE_DASH },
{ {NULL, required_argument, NULL, 'i'}, { {NULL, required_argument, NULL, 'i'},
'i', "ADD_FILES", "No longer supported" , TWO_DASHES }, 'i', "ADD_FILES", N_("No longer supported"), TWO_DASHES },
{ {"joliet", no_argument, NULL, 'J'}, { {"joliet", no_argument, NULL, 'J'},
'J', NULL, "Generate Joliet directory information", ONE_DASH }, 'J', NULL, N_("Generate Joliet directory information"), ONE_DASH },
{ {"full-iso9660-filenames", no_argument, NULL, 'l'}, { {"full-iso9660-filenames", no_argument, NULL, 'l'},
'l', NULL, "Allow full 32 character filenames for iso9660 names", ONE_DASH }, 'l', NULL, N_("Allow full 32 character filenames for iso9660 names"), ONE_DASH },
{ {"allow-leading-dots", no_argument, NULL, 'L'}, { {"allow-leading-dots", no_argument, NULL, 'L'},
'L', NULL, "Allow iso9660 filenames to start with '.'", ONE_DASH }, 'L', NULL, N_("Allow iso9660 filenames to start with '.'"), ONE_DASH },
{ {"log-file", required_argument, NULL, OPTION_LOG_FILE}, { {"log-file", required_argument, NULL, OPTION_LOG_FILE},
'\0', "LOG_FILE", "Re-direct messages to LOG_FILE", ONE_DASH }, '\0', "LOG_FILE", N_("Re-direct messages to LOG_FILE"), ONE_DASH },
{ {"exclude", required_argument, NULL, 'm'}, { {"exclude", required_argument, NULL, 'm'},
'm', "GLOBFILE", "Exclude file name" , ONE_DASH }, 'm', "GLOBFILE", N_("Exclude file name"), ONE_DASH },
{ {"prev-session", required_argument, NULL, 'M'}, { {"prev-session", required_argument, NULL, 'M'},
'M', "FILE", "Set path to previous session to merge" , ONE_DASH }, 'M', "FILE", N_("Set path to previous session to merge"), ONE_DASH },
{ {"omit-version-number", no_argument, NULL, 'N'}, { {"omit-version-number", no_argument, NULL, 'N'},
'N', NULL, "Omit version number from iso9660 filename", ONE_DASH }, 'N', NULL, N_("Omit version number from iso9660 filename"), ONE_DASH },
{ {"no-split-symlink-components", no_argument, NULL, 0}, { {"no-split-symlink-components", no_argument, NULL, 0},
0, NULL, "Inhibit splitting symlink components" , ONE_DASH }, 0, NULL, N_("Inhibit splitting symlink components"), ONE_DASH },
{ {"no-split-symlink-fields", no_argument, NULL, 0}, { {"no-split-symlink-fields", no_argument, NULL, 0},
0, NULL, "Inhibit splitting symlink fields" , ONE_DASH }, 0, NULL, N_("Inhibit splitting symlink fields"), ONE_DASH },
{ {"output", required_argument, NULL, 'o'}, { {"output", required_argument, NULL, 'o'},
'o', "FILE", "Set output file name" , ONE_DASH }, 'o', "FILE", N_("Set output file name"), ONE_DASH },
{ {"preparer", required_argument, NULL, 'p'}, { {"preparer", required_argument, NULL, 'p'},
'p', "PREP", "Set Volume preparer" , ONE_DASH }, 'p', "PREP", N_("Set Volume preparer"), ONE_DASH },
{ {"print-size", no_argument, NULL, OPTION_PRINT_SIZE}, { {"print-size", no_argument, NULL, OPTION_PRINT_SIZE},
'\0', NULL, "Print estimated filesystem size and exit", ONE_DASH }, '\0', NULL, N_("Print estimated filesystem size and exit"), ONE_DASH },
{ {"publisher", required_argument, NULL, 'P'}, { {"publisher", required_argument, NULL, 'P'},
'P', "PUB", "Set Volume publisher" , ONE_DASH }, 'P', "PUB", N_("Set Volume publisher"), ONE_DASH },
{ {"quiet", no_argument, NULL, OPTION_QUIET}, { {"quiet", no_argument, NULL, OPTION_QUIET},
'\0', NULL, "Run quietly", ONE_DASH }, '\0', NULL, N_("Run quietly"), ONE_DASH },
{ {"rational-rock", no_argument, NULL, 'r'}, { {"rational-rock", no_argument, NULL, 'r'},
'r', NULL, "Generate rationalized Rock Ridge directory information", ONE_DASH }, 'r', NULL, N_("Generate rationalized Rock Ridge directory information"), ONE_DASH },
{ {"rock", no_argument, NULL, 'R'}, { {"rock", no_argument, NULL, 'R'},
'R', NULL, "Generate Rock Ridge directory information", ONE_DASH }, 'R', NULL, N_("Generate Rock Ridge directory information"), ONE_DASH },
{ {"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT}, { {"split-output", no_argument, NULL, OPTION_SPLIT_OUTPUT},
'\0', NULL, "Split output into files of approx. 1GB size", ONE_DASH }, '\0', NULL, N_("Split output into files of approx. 1GB size"), ONE_DASH },
{ {"sysid", required_argument, NULL, OPTION_SYSID}, { {"sysid", required_argument, NULL, OPTION_SYSID},
'\0', "ID", "Set System ID" , ONE_DASH }, '\0', "ID", N_("Set System ID"), ONE_DASH },
{ {"translation-table", no_argument, NULL, 'T'}, { {"translation-table", no_argument, NULL, 'T'},
'T', NULL, "Generate translation tables for systems that don't understand long filenames", ONE_DASH }, 'T', NULL, N_("Generate translation tables for systems that don't understand long filenames"), ONE_DASH },
{ {"verbose", no_argument, NULL, 'v'}, { {"verbose", no_argument, NULL, 'v'},
'v', NULL, "Verbose", ONE_DASH }, 'v', NULL, N_("Verbose"), ONE_DASH },
{ {"volid", required_argument, NULL, 'V'}, { {"volid", required_argument, NULL, 'V'},
'V', "ID", "Set Volume ID" , ONE_DASH }, 'V', "ID", N_("Set Volume ID"), ONE_DASH },
{ {"volset", required_argument, NULL, OPTION_VOLSET}, { {"volset", required_argument, NULL, OPTION_VOLSET},
'\0', "ID", "Set Volume set ID" , ONE_DASH }, '\0', "ID", N_("Set Volume set ID"), ONE_DASH },
{ {"volset-size", required_argument, NULL, OPTION_VOLSET_SIZE}, { {"volset-size", required_argument, NULL, OPTION_VOLSET_SIZE},
'\0', "#", "Set Volume set size" , ONE_DASH }, '\0', "#", N_("Set Volume set size"), ONE_DASH },
{ {"volset-seqno", required_argument, NULL, OPTION_VOLSET_SEQ_NUM}, { {"volset-seqno", required_argument, NULL, OPTION_VOLSET_SEQ_NUM},
'\0', "#", "Set Volume set sequence number" , ONE_DASH }, '\0', "#", N_("Set Volume set sequence number"), ONE_DASH },
{ {"old-exclude", required_argument, NULL, 'x'}, { {"old-exclude", required_argument, NULL, 'x'},
'x', "FILE", "Exclude file name(depreciated)" , ONE_DASH }, 'x', "FILE", N_("Exclude file name (deprecated)"), ONE_DASH },
#ifdef ERIC_neverdef #ifdef ERIC_neverdef
{ {"transparent-compression", no_argument, NULL, 'z'}, { {"transparent-compression", no_argument, NULL, 'z'},
'z', NULL, "Enable transparent compression of files", ONE_DASH }, 'z', NULL, "Enable transparent compression of files", ONE_DASH },
#endif #endif
{ {"creation-date", required_argument, NULL, OPTION_CREAT_DATE }, { {"creation-date", required_argument, NULL, OPTION_CREAT_DATE },
'\0', NULL, "Override creation date", TWO_DASHES }, '\0', NULL, N_("Override creation date"), TWO_DASHES },
{ {"modification-date", required_argument, NULL, OPTION_MODIF_DATE }, { {"modification-date", required_argument, NULL, OPTION_MODIF_DATE },
'\0', NULL, "Override modification date", TWO_DASHES }, '\0', NULL, N_("Override modification date"), TWO_DASHES },
{ {"expiration-date", required_argument, NULL, OPTION_EXPIR_DATE }, { {"expiration-date", required_argument, NULL, OPTION_EXPIR_DATE },
'\0', NULL, "Override expiration date", TWO_DASHES }, '\0', NULL, N_("Override expiration date"), TWO_DASHES },
{ {"effective-date", required_argument, NULL, OPTION_EFFEC_DATE }, { {"effective-date", required_argument, NULL, OPTION_EFFEC_DATE },
'\0', NULL, "Override effective date", TWO_DASHES }, '\0', NULL, N_("Override effective date"), TWO_DASHES },
}; };
#define OPTION_COUNT (sizeof ld_options / sizeof ld_options[0]) #define OPTION_COUNT (sizeof ld_options / sizeof ld_options[0])
@ -545,7 +545,7 @@ void usage(){
for (; len < 30; len++) for (; len < 30; len++)
putchar (' '); putchar (' ');
printf ("%s\n", ld_options[i].doc); printf ("%s\n", gettext (ld_options[i].doc));
} }
} }
exit(1); exit(1);

View file

@ -33,6 +33,7 @@
#include <locale.h> #include <locale.h>
#include <libintl.h> #include <libintl.h>
#define _(str) gettext(str) #define _(str) gettext(str)
#define N_(str) str
/* This symbol is used to indicate that we do not have things like /* This symbol is used to indicate that we do not have things like
symlinks, devices, and so forth available. Just files and dirs */ symlinks, devices, and so forth available. Just files and dirs */

337
video/efi_fb.c Normal file
View file

@ -0,0 +1,337 @@
/*
* 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/uga_draw.h>
#include <grub/pci.h>
static grub_efi_guid_t uga_draw_guid = GRUB_EFI_UGA_DRAW_GUID;
static struct grub_efi_uga_draw_protocol *uga;
static grub_uint32_t uga_fb;
static grub_uint32_t uga_pitch;
static struct
{
struct grub_video_mode_info mode_info;
struct grub_video_render_target *render_target;
grub_uint8_t *ptr;
} framebuffer;
#define RGB_MASK 0xffffff
#define RGB_MAGIC 0x121314
#define LINE_MIN 800
#define LINE_MAX 4096
#define FBTEST_STEP (0x10000 >> 2)
#define FBTEST_COUNT 8
static int
find_line_len (grub_uint32_t *fb_base, grub_uint32_t *line_len)
{
grub_uint32_t *base = (grub_uint32_t *) (grub_target_addr_t) *fb_base;
int i;
for (i = 0; i < FBTEST_COUNT; i++, base += FBTEST_STEP)
{
if ((*base & RGB_MASK) == RGB_MAGIC)
{
int j;
for (j = LINE_MIN; j <= LINE_MAX; j++)
{
if ((base[j] & RGB_MASK) == RGB_MAGIC)
{
*fb_base = (grub_uint32_t) (grub_target_addr_t) base;
*line_len = j << 2;
return 1;
}
}
break;
}
}
return 0;
}
static int
find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
{
int found = 0;
auto int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
grub_pci_id_t pciid);
int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
grub_pci_id_t pciid)
{
grub_pci_address_t addr;
addr = grub_pci_make_address (bus, dev, func, 2);
if (grub_pci_read (addr) >> 24 == 0x3)
{
int i;
grub_dprintf ("fb", "Display controller: %d:%d.%d\nDevice id: %x\n",
bus, dev, func, pciid);
addr += 8;
for (i = 0; i < 6; i++, addr += 4)
{
grub_uint32_t old_bar1, old_bar2, type;
grub_uint64_t base64;
old_bar1 = grub_pci_read (addr);
if ((! old_bar1) || (old_bar1 & GRUB_PCI_ADDR_SPACE_IO))
continue;
type = old_bar1 & GRUB_PCI_ADDR_MEM_TYPE_MASK;
if (type == GRUB_PCI_ADDR_MEM_TYPE_64)
{
if (i == 5)
break;
old_bar2 = grub_pci_read (addr + 4);
}
else
old_bar2 = 0;
base64 = old_bar2;
base64 <<= 32;
base64 |= (old_bar1 & GRUB_PCI_ADDR_MEM_MASK);
grub_dprintf ("fb", "%s(%d): 0x%llx\n",
((old_bar1 & GRUB_PCI_ADDR_MEM_PREFETCH) ?
"VMEM" : "MMIO"), i,
(unsigned long long) base64);
if ((old_bar1 & GRUB_PCI_ADDR_MEM_PREFETCH) && (! found))
{
*fb_base = base64;
if (find_line_len (fb_base, line_len))
found++;
}
if (type == GRUB_PCI_ADDR_MEM_TYPE_64)
{
i++;
addr += 4;
}
}
}
return found;
}
grub_pci_iterate (find_card);
return found;
}
static int
check_protocol (void)
{
grub_efi_uga_draw_protocol_t *c;
c = grub_efi_locate_protocol (&uga_draw_guid, 0);
if (c)
{
grub_uint32_t width, height, depth, rate, pixel;
int ret;
if (efi_call_5 (c->get_mode, c, &width, &height, &depth, &rate))
return 0;
grub_efi_set_text_mode (0);
pixel = RGB_MAGIC;
efi_call_10 (c->blt, c, (struct grub_efi_uga_pixel *) &pixel,
GRUB_EFI_UGA_VIDEO_FILL, 0, 0, 0, 0, 1, height, 0);
ret = find_framebuf (&uga_fb, &uga_pitch);
grub_efi_set_text_mode (1);
if (ret)
{
uga = c;
return 1;
}
}
return 0;
}
static grub_err_t
grub_video_efi_init (void)
{
grub_memset (&framebuffer, 0, sizeof(framebuffer));
return grub_video_fb_init ();
}
static grub_err_t
grub_video_efi_fini (void)
{
return grub_video_fb_fini ();
}
static grub_err_t
grub_video_efi_setup (unsigned int width, unsigned int height,
unsigned int mode_type)
{
unsigned int depth;
int found = 0;
depth = (mode_type & GRUB_VIDEO_MODE_TYPE_DEPTH_MASK)
>> GRUB_VIDEO_MODE_TYPE_DEPTH_POS;
{
grub_uint32_t w;
grub_uint32_t h;
grub_uint32_t d;
grub_uint32_t r;
if ((! efi_call_5 (uga->get_mode, uga, &w, &h, &d, &r)) &&
((! width) || (width == w)) &&
((! height) || (height == h)) &&
((! depth) || (depth == d)))
{
framebuffer.mode_info.width = w;
framebuffer.mode_info.height = h;
framebuffer.mode_info.pitch = uga_pitch;
framebuffer.ptr = (grub_uint8_t *) (grub_target_addr_t) uga_fb;
found = 1;
}
}
if (found)
{
grub_err_t err;
framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_RGB;
framebuffer.mode_info.bpp = 32;
framebuffer.mode_info.bytes_per_pixel = 4;
framebuffer.mode_info.number_of_colors = 256; /* TODO: fix me. */
framebuffer.mode_info.red_mask_size = 8;
framebuffer.mode_info.red_field_pos = 16;
framebuffer.mode_info.green_mask_size = 8;
framebuffer.mode_info.green_field_pos = 8;
framebuffer.mode_info.blue_mask_size = 8;
framebuffer.mode_info.blue_field_pos = 0;
framebuffer.mode_info.reserved_mask_size = 8;
framebuffer.mode_info.reserved_field_pos = 24;
framebuffer.mode_info.blit_format =
grub_video_get_blit_format (&framebuffer.mode_info);
err = grub_video_fb_create_render_target_from_pointer
(&framebuffer.render_target,
&framebuffer.mode_info,
framebuffer.ptr);
if (err)
return err;
err = grub_video_fb_set_active_render_target
(framebuffer.render_target);
if (err)
return err;
err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
grub_video_fbstd_colors);
return err;
}
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found.");
}
static grub_err_t
grub_video_efi_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)
{
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_efi_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_efi_adapter =
{
.name = "EFI frame buffer driver",
.init = grub_video_efi_init,
.fini = grub_video_efi_fini,
.setup = grub_video_efi_setup,
.get_info = grub_video_fb_get_info,
.get_info_and_fini = grub_video_efi_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_efi_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,
.get_active_render_target = grub_video_fb_get_active_render_target,
};
GRUB_MOD_INIT(efi_fb)
{
if (check_protocol ())
grub_video_register (&grub_video_efi_adapter);
}
GRUB_MOD_FINI(efi_fb)
{
if (uga)
grub_video_unregister (&grub_video_efi_adapter);
}