merge mtrunk into xnu

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-18 03:57:32 +01:00
commit 7ea73643f5
224 changed files with 43437 additions and 7593 deletions

64
.bzrignore Normal file
View File

@ -0,0 +1,64 @@
00_header
10_*
30_os-prober
40_custom
aclocal.m4
autom4te.cache
build_env.mk
.bzrignore
config.cache
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
conf/*.mk
conf/gcry.rmk
*.d
DISTLIST
docs/*.info
docs/stamp-vti
docs/version.texi
*.elf
*.exec
genkernsyms.sh
gensymlist.sh
grub-dumpbios
grub-editenv
grub-emu
grub_emu_init.c
grub_emu_init.h
grub-fstest
grub_fstest_init.c
grub_fstest_init.h
grub-install
grub-mk*
grub-pe2elf
grub-probe
grub_probe_init.c
grub_probe_init.h
grub_script.tab.c
grub_script.tab.h
grub-setup
grub_setup_init.c
grub_setup_init.h
*.img
include/grub/cpu
include/grub/machine
install-sh
lib/libgcrypt-grub
*.lst
Makefile
*.mod
mod-*.c
missing
*.pf2
po/*.mo
po/grub.pot
stamp-h
stamp-h1
stamp-h.in
symlist.c
update-grub_lib

1284
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,9 @@ If you use a development snapshot or want to hack on GRUB you may
need the following.
* Ruby 1.6 or later
* Autoconf 2.59d or later
* Python 2.5.2 or later
* Autoconf 2.60 or later
* Automake 1.10.1 or later
Configuring the GRUB
====================

View File

@ -41,6 +41,15 @@ includedir = @includedir@
pkgdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`
pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '$(transform)'`
XGETTEXT = @XGETTEXT@
MSGMERGE = @MSGMERGE@
MSGFMT = @MSGFMT@
LINGUAS = $(shell for i in $(srcdir)/po/*.po ; do \
if test -e $$i ; then echo $$i ; fi ; \
done | sed -e "s,.*/po/\(.*\)\.po$$,\1,")
PACKAGE = @PACKAGE@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
@ -67,15 +76,15 @@ CC = @CC@
CFLAGS = @CFLAGS@
ASFLAGS = @ASFLAGS@
LDFLAGS = @LDFLAGS@
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/include -Wall -W \
-DGRUB_LIBDIR=\"$(pkglibdir)\"
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
-DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\"
TARGET_CC = @TARGET_CC@
TARGET_CFLAGS = @TARGET_CFLAGS@
TARGET_ASFLAGS = @TARGET_ASFLAGS@
TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
TARGET_APPLE_CC = @TARGET_APPLE_CC@
OBJCONV = @OBJCONV@
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -isystem=$(srcdir)/include -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include) -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
-Wall -W
TARGET_LDFLAGS = @TARGET_LDFLAGS@
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
@ -100,12 +109,13 @@ endif
AWK = @AWK@
LIBCURSES = @LIBCURSES@
LIBUSB = @LIBUSB@
LIBPCIACCESS = @LIBPCIACCESS@
YACC = @YACC@
UNIFONT_BDF = @UNIFONT_BDF@
FONT_SOURCE = @FONT_SOURCE@
# Options.
enable_grub_emu = @enable_grub_emu@
enable_grub_emu_usb = @enable_grub_emu_usb@
enable_grub_emu_pci = @enable_grub_emu_pci@
enable_grub_fstest = @enable_grub_fstest@
enable_grub_pe2elf = @enable_grub_pe2elf@
enable_grub_mkfont = @enable_grub_mkfont@
@ -131,7 +141,9 @@ CLEANFILES =
MOSTLYCLEANFILES =
DISTCLEANFILES = config.status config.cache config.log config.h \
Makefile stamp-h include/grub/cpu include/grub/machine \
gensymlist.sh genkernsyms.sh build_env.mk
gensymlist.sh genkernsyms.sh build_env.mk \
docs/grub.info docs/version.texi docs/stamp-vti
MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) \
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS)
@ -146,15 +158,18 @@ $(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb
$(RUBY) $(srcdir)/genmk.rb < $< > $@; \
fi
ifeq ($(platform), emu)
include $(srcdir)/conf/any-emu.mk
else
include $(srcdir)/conf/$(target_cpu)-$(platform).mk
# For external modules.
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
endif
### General targets.
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA)
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
cat $(DEFSYMFILES) /dev/null \
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
@ -175,6 +190,9 @@ handler.lst: $(HANDLERFILES)
parttool.lst: $(PARTTOOLFILES)
cat $^ /dev/null | sort | uniq > $@
video.lst: $(VIDEOFILES)
cat $^ /dev/null | sort | uniq > $@
ifneq (true, $(MAKEINFO))
info_INFOS += docs/grub.info
endif
@ -200,7 +218,7 @@ docs/grub.info: docs/grub.texi docs/version.texi docs/fdl.texi
$(MKDIR_P) docs
-$(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@
ifeq (, $(UNIFONT_BDF))
ifeq (, $(FONT_SOURCE))
else
ifeq ($(enable_grub_mkfont),yes)
@ -211,11 +229,11 @@ pkgdata_DATA += unicode.pf2 ascii.pf2
UNICODE_ARROWS=0x2190-0x2193
UNICODE_LINES=0x2501-0x251B
unicode.pf2: $(UNIFONT_BDF) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(UNIFONT_BDF)
unicode.pf2: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE)
ascii.pf2: $(UNIFONT_BDF) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(UNIFONT_BDF) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
ascii.pf2: $(FONT_SOURCE) grub-mkfont
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
endif
endif
@ -237,7 +255,7 @@ build_env.mk: Makefile
) > $@
pkglib_BUILDDIR += config.h grub_script.tab.h
all-local: $(PROGRAMS) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES)
all-local: $(PROGRAMS) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES) $(foreach lang, $(LINGUAS), po/$(lang).mo)
install: install-local
@ -301,6 +319,13 @@ install-local: all
dest="`echo $$file | sed 's,.*/,,'`"; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \
done
@langs='$(LINGUAS)'; \
for lang in $$langs; do \
$(SHELL) $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES; \
file="po/$$lang.mo"; \
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
$(INSTALL_DATA) $$dir$$file $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
done
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(infodir)
@list='$(info_INFOS)'; \
for file in $$list; do \
@ -431,6 +456,9 @@ check:
.SUFFIX: .c .o .S .d
# Regenerate configure and Makefile automatically.
$(srcdir)/aclocal.m4: configure.ac acinclude.m4
cd $(srcdir) && aclocal
$(srcdir)/configure: configure.ac aclocal.m4
cd $(srcdir) && autoconf
@ -455,6 +483,17 @@ gensymlist.sh: gensymlist.sh.in config.status
genkernsyms.sh: genkernsyms.sh.in config.status
$(SHELL) ./config.status
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ --keyword=N_
cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell
$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot
$(MSGMERGE) -U $@ $^
po/%.mo: po/%.po
$(MKDIR_P) $$(dirname $@)
$(MSGFMT) -c --statistics -o $@ $^
.PHONY: all install install-strip uninstall clean mostlyclean distclean
.PHONY: maintainer-clean info dvi dist check

2
NEWS
View File

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

1
THANKS
View File

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

View File

@ -2,9 +2,17 @@
set -e
aclocal
autoconf
autoheader
# FIXME: automake doesn't like that there's no Makefile.am
automake -a -c -f || true
echo timestamp > stamp-h.in
python util/import_gcry.py lib/libgcrypt/ .
for rmk in conf/*.rmk ${GRUB_CONTRIB}/*/conf/*.rmk; do
if test -e $rmk ; then
ruby genmk.rb < $rmk > `echo $rmk | sed 's/\.rmk$/.mk/'`

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -336,8 +336,19 @@ grub_mini_cmd_exit (struct grub_command *cmd __attribute__ ((unused)),
return 0;
}
/* clear */
static grub_err_t
grub_mini_cmd_clear (struct grub_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),
char *argv[] __attribute__ ((unused)))
{
grub_cls ();
return 0;
}
static grub_command_t cmd_cat, cmd_help, cmd_root;
static grub_command_t cmd_dump, cmd_rmmod, cmd_lsmod, cmd_exit;
static grub_command_t cmd_clear;
GRUB_MOD_INIT(minicmd)
{
@ -362,6 +373,9 @@ GRUB_MOD_INIT(minicmd)
cmd_exit =
grub_register_command ("exit", grub_mini_cmd_exit,
0, "exit from GRUB");
cmd_clear =
grub_register_command ("clear", grub_mini_cmd_clear,
0, "clear the screen");
}
GRUB_MOD_FINI(minicmd)
@ -373,4 +387,5 @@ GRUB_MOD_FINI(minicmd)
grub_unregister_command (cmd_rmmod);
grub_unregister_command (cmd_lsmod);
grub_unregister_command (cmd_exit);
grub_unregister_command (cmd_clear);
}

View File

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

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

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

View File

@ -1,15 +1,27 @@
# -*- makefile -*-
sbin_UTILITIES += grub-mkdevicemap
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
util/deviceiter.c \
util/misc.c
ifeq ($(target_cpu)-$(platform), sparc64-ieee1275)
grub_mkdevicemap_SOURCES += util/ieee1275/ofpath.c util/ieee1275/devicemap.c
else
grub_mkdevicemap_SOURCES += util/devicemap.c
endif
# For grub-mkelfimage.
bin_UTILITIES += grub-mkelfimage
grub_mkelfimage_SOURCES = util/elf/grub-mkimage.c util/misc.c \
grub_mkelfimage_SOURCES = gnulib/progname.c \
util/elf/grub-mkimage.c util/misc.c \
util/resolve.c
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
# For grub-probe.
sbin_UTILITIES += grub-probe
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
grub_probe_SOURCES = util/grub-probe.c \
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
util/hostdisk.c util/misc.c util/getroot.c \
kern/device.c kern/disk.c kern/err.c kern/misc.c \
kern/parser.c kern/partition.c kern/file.c \
@ -29,18 +41,23 @@ bin_UTILITIES += grub-fstest
endif
bin_UTILITIES += grub-mkisofs
grub_mkisofs_SOURCES = util/mkisofs/eltorito.c util/mkisofs/fnmatch.c \
util/mkisofs/getopt1.c util/mkisofs/getopt.c \
grub_mkisofs_SOURCES = util/mkisofs/eltorito.c \
util/mkisofs/hash.c util/mkisofs/joliet.c \
util/mkisofs/match.c util/mkisofs/mkisofs.c \
util/mkisofs/multi.c util/mkisofs/name.c \
util/mkisofs/rock.c util/mkisofs/tree.c \
util/mkisofs/write.c
grub_mkisofs_CFLAGS = -I$(srcdir)/util/mkisofs/include -Wno-all -Werror
util/mkisofs/write.c \
\
gnulib/fnmatch.c gnulib/getopt1.c gnulib/getopt.c \
gnulib/error.c gnulib/progname.c
grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
-I$(srcdir)/util/mkisofs/include \
-Wno-all -Werror
# For grub-fstest.
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.c \
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
util/misc.c \
kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \
disk/host.c disk/loopback.c kern/list.c kern/command.c \
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
@ -62,29 +79,20 @@ grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.c \
# For grub-mkfont.
ifeq ($(enable_grub_mkfont), yes)
bin_UTILITIES += grub-mkfont
grub_mkfont_SOURCES = util/grub-mkfont.c util/misc.c
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c
grub_mkfont_CFLAGS = $(freetype_cflags)
grub_mkfont_LDFLAGS = $(freetype_libs)
endif
# For grub-mkrelpath.
bin_UTILITIES += grub-mkrelpath
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
# For the parser.
grub_script.tab.c grub_script.tab.h: script/sh/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/sh/parser.y
grub_script.tab.c grub_script.tab.h: script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
# For grub-emu.
grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES))
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
DISTCLEANFILES += grub_emu_init.lst
grub_emu_init.h: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
DISTCLEANFILES += grub_emu_init.h
grub_emu_init.c: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_emu_init.h
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
DISTCLEANFILES += grub_emu_init.c
# For grub-probe.
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
@ -126,7 +134,7 @@ DISTCLEANFILES += grub_fstest_init.c
# for grub-editenv
bin_UTILITIES += grub-editenv
grub_editenv_SOURCES = util/grub-editenv.c lib/envblk.c util/misc.c kern/misc.c kern/err.c
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c kern/misc.c kern/err.c
CLEANFILES += grub-editenv
# Needed for genmk.rb to work
@ -134,7 +142,7 @@ ifeq (0,1)
bin_UTILITIES += grub-macho2img grub-pe2elf
endif
grub_pe2elf_SOURCES = util/grub-pe2elf.c util/misc.c
grub_pe2elf_SOURCES = gnulib/progname.c util/grub-pe2elf.c util/misc.c
CLEANFILES += grub-pe2elf
grub_macho2img_SOURCES = util/grub-macho2img.c
@ -159,6 +167,12 @@ update-grub_lib: util/update-grub_lib.in config.status
lib_SCRIPTS += update-grub_lib
CLEANFILES += update-grub_lib
grub-gettext_lib: util/grub-gettext_lib.in config.status
./config.status --file=$@:$<
chmod +x $@
lib_DATA += grub-gettext_lib
CLEANFILES += grub-gettext_lib
%: util/grub.d/%.in config.status
./config.status --file=$@:$<
chmod +x $@
@ -534,8 +548,8 @@ normal_mod_CFLAGS = $(COMMON_CFLAGS)
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For sh.mod.
sh_mod_SOURCES = script/sh/main.c script/sh/script.c script/sh/execute.c \
script/sh/function.c script/sh/lexer.c grub_script.tab.c
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
script/function.c script/lexer.c grub_script.tab.c
sh_mod_CFLAGS = $(COMMON_CFLAGS)
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -606,6 +620,12 @@ bufio_mod_SOURCES = io/bufio.c
bufio_mod_CFLAGS = $(COMMON_CFLAGS)
bufio_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For gettext.mod.
pkglib_MODULES += gettext.mod
gettext_mod_SOURCES = gettext/gettext.c
gettext_mod_CFLAGS = $(COMMON_CFLAGS)
gettext_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Misc.
pkglib_MODULES += xnu_uuid.mod

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@ COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
COMMON_LDFLAGS = -m32 -nostdlib
# Used by various components. These rules need to precede them.
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Images.
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
@ -64,7 +64,7 @@ kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
machine/memory.h machine/loader.h machine/vga.h machine/vbe.h \
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h
machine/kernel.h machine/pxe.h i386/pit.h list.h handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
@ -81,20 +81,18 @@ kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genke
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-setup grub-mkdevicemap
ifeq ($(enable_grub_emu), yes)
sbin_UTILITIES += grub-emu
endif
sbin_UTILITIES = grub-setup
# For grub-mkimage.
grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
grub_mkimage_SOURCES = gnulib/progname.c util/i386/pc/grub-mkimage.c util/misc.c \
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
util/i386/pc/grub-mkimage.c_DEPENDENCIES = Makefile
# For grub-setup.
util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
grub_setup_SOURCES = gnulib/progname.c \
util/i386/pc/grub-setup.c util/hostdisk.c \
util/misc.c util/getroot.c kern/device.c kern/disk.c \
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
kern/file.c kern/fs.c kern/env.c fs/fshelp.c \
@ -111,79 +109,21 @@ grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
util/raid.c util/lvm.c \
grub_setup_init.c
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in
# For grub-emu.
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/echo.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search.c commands/blocklist.c commands/hexdump.c \
lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c \
lib/envblk.c commands/loadenv.c \
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
commands/i386/cpuid.c \
commands/password.c commands/keystatus.c \
disk/host.c disk/loopback.c disk/scsi.c \
fs/fshelp.c \
\
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/reader.c kern/term.c \
kern/rescue_reader.c kern/rescue_parser.c \
lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c \
normal/handler.c normal/auth.c normal/autofs.c \
normal/completion.c normal/main.c normal/color.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/menu_text.c \
script/sh/main.c script/sh/execute.c script/sh/function.c \
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c partmap/gpt.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
\
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_emu_init.c
bin_SCRIPTS += grub-mkrescue
grub_mkrescue_SOURCES = util/grub-mkrescue.in
grub_emu_LDFLAGS = $(LIBCURSES)
bin_SCRIPTS += grub-mkfloppy
grub_mkfloppy_SOURCES = util/i386/pc/grub-mkfloppy.in
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
# Scripts.
sbin_SCRIPTS = grub-install
bin_SCRIPTS = grub-mkrescue
# For grub-install.
grub_install_SOURCES = util/i386/pc/grub-install.in
# For grub-mkrescue.
grub_mkrescue_SOURCES = util/i386/pc/grub-mkrescue.in
pkglib_MODULES = biosdisk.mod chain.mod \
multiboot.mod reboot.mod halt.mod \
vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
ata.mod vga.mod memdisk.mod pci.mod lspci.mod \
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
pkglib_MODULES = biosdisk.mod chain.mod \
multiboot.mod reboot.mod halt.mod \
vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
vga.mod memdisk.mod pci.mod lspci.mod \
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
efiemu.mod mmap.mod acpi.mod drivemap.mod
@ -244,8 +184,7 @@ linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c \
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c \
loader/i386/xnu_helper.S
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
@ -295,11 +234,6 @@ play_mod_SOURCES = commands/i386/pc/play.c
play_mod_CFLAGS = $(COMMON_CFLAGS)
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For ata.mod.
ata_mod_SOURCES = disk/ata.c
ata_mod_CFLAGS = $(COMMON_CFLAGS)
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For vga.mod.
vga_mod_SOURCES = term/i386/pc/vga.c
vga_mod_CFLAGS = $(COMMON_CFLAGS)

View File

@ -14,3 +14,14 @@ pkglib_MODULES += vga_text.mod
vga_text_mod_SOURCES = term/i386/pc/vga_text.c term/i386/vga_common.c
vga_text_mod_CFLAGS = $(COMMON_CFLAGS)
vga_text_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += relocator.mod
relocator_mod_SOURCES = lib/i386/relocator.c lib/i386/relocator_asm.S lib/i386/relocator_backward.S
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
relocator_mod_ASFLAGS = $(COMMON_ASFLAGS)
relocator_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += ata.mod
ata_mod_SOURCES = disk/ata.c
ata_mod_CFLAGS = $(COMMON_CFLAGS)
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)

View File

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

View File

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

View File

@ -5,18 +5,14 @@ COMMON_CFLAGS = -fno-builtin -m64
COMMON_LDFLAGS = -melf_x86_64 -nostdlib
# Used by various components. These rules need to precede them.
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-mkdevicemap
#ifeq ($(enable_grub_emu), yes)
#sbin_UTILITIES += grub-emu
#endif
# For grub-mkimage.
grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
util/resolve.c
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
util/misc.c util/resolve.c
# For grub-setup.
#grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
@ -26,54 +22,6 @@ grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
# fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
# kern/fs.c kern/env.c fs/fshelp.c
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
util/devicemap.c util/misc.c
# For grub-emu.
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
commands/configfile.c commands/help.c \
commands/handler.c commands/ls.c commands/test.c \
commands/search.c commands/hexdump.c lib/hexdump.c \
commands/halt.c commands/reboot.c \
commands/i386/cpuid.c \
commands/password.c commands/keystatus.c \
lib/envblk.c commands/loadenv.c \
disk/loopback.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
\
io/gzio.c \
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/readerescue.c kern/term.c \
lib/arg.c normal/cmdline.c normal/misc.c normal/auth.c \
normal/autofs.c \
normal/completion.c normal/datetime.c normal/context.c \
normal/main.c \
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
normal/menu_text.c \
normal/color.c \
script/sh/main.c script/sh/execute.c script/sh/function.c \
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
partmap/acorn.c partmap/gpt.c \
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c \
\
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
commands/parttool.c parttool/msdospart.c \
grub_emu_init.c
grub_emu_LDFLAGS = $(LIBCURSES)
# Scripts.
sbin_SCRIPTS = grub-install
@ -81,14 +29,14 @@ sbin_SCRIPTS = grub-install
grub_install_SOURCES = util/i386/efi/grub-install.in
# Modules.
pkglib_MODULES = kernel.mod chain.mod appleldr.mod \
pkglib_MODULES = kernel.img chain.mod appleldr.mod \
halt.mod reboot.mod linux.mod pci.mod lspci.mod \
datetime.mod date.mod datehook.mod loadbios.mod \
fixvideo.mod mmap.mod acpi.mod
fixvideo.mod mmap.mod acpi.mod ata.mod
# For kernel.mod.
kernel_mod_EXPORTS = no
kernel_mod_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
# For kernel.img.
kernel_img_EXPORTS = no
kernel_img_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
@ -99,23 +47,23 @@ kernel_mod_SOURCES = kern/x86_64/efi/startup.S kern/x86_64/efi/callwrap.S \
kern/i386/tsc.c kern/i386/pit.c \
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c \
term/efi/console.c disk/efi/efidisk.c
kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
efi/efi.h efi/time.h efi/disk.h machine/loader.h i386/pit.h list.h \
handler.h command.h
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
handler.h command.h i18n.h
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
MOSTLYCLEANFILES += symlist.c
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
DEFSYMFILES += kernel_syms.lst
symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist.sh
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod.
@ -129,6 +77,11 @@ acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
acpi_mod_CFLAGS = $(COMMON_CFLAGS)
acpi_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For ata.mod
ata_mod_SOURCES = disk/ata.c
ata_mod_CFLAGS = $(COMMON_CFLAGS)
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For mmap.mod.
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c \
mmap/efi/mmap.c
@ -196,12 +149,27 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_uga.mod
efi_uga_mod_SOURCES = video/efi_uga.c
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += efi_gop.mod
efi_gop_mod_SOURCES = video/efi_gop.c
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += xnu.mod
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c \
loader/i386/xnu_helper.S
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
pkglib_MODULES += relocator.mod
relocator_mod_SOURCES = lib/i386/relocator.c lib/i386/relocator_asm.S lib/i386/relocator_backward.S
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
relocator_mod_ASFLAGS = $(COMMON_ASFLAGS)
relocator_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/common.mk

1494
config.guess vendored

File diff suppressed because it is too large Load Diff

1700
config.sub vendored

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,8 @@ dnl type.
AC_INIT([GRUB],[1.97],[bug-grub@gnu.org])
AC_PREREQ(2.59d)
AM_INIT_AUTOMAKE()
AC_PREREQ(2.60)
AC_CONFIG_SRCDIR([include/grub/dl.h])
AC_CONFIG_HEADER([config.h])
@ -89,6 +90,7 @@ case "$target_cpu"-"$platform" in
i386-qemu) ;;
powerpc-ieee1275) ;;
sparc64-ieee1275) ;;
*-emu) ;;
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
esac
@ -98,7 +100,7 @@ case "$target_cpu" in
esac
case "$host_os" in
mingw32) host_os=cygwin ;;
mingw32*) host_os=cygwin ;;
esac
# This normalizes the names, and creates a new variable ("host_kernel")
@ -111,6 +113,18 @@ case "$host_os" in
cygwin) host_kernel=windows ;;
esac
case "$platform" in
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
esac
CFLAGS="$CFLAGS $machine_CFLAGS"
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
AC_SUBST(host_cpu)
AC_SUBST(host_os)
AC_SUBST(host_kernel)
@ -134,9 +148,9 @@ if test "x$YACC" = x; then
AC_MSG_ERROR([bison is not found])
fi
for file in /usr/src/unifont.bdf ; do
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do
if test -e $file ; then
AC_SUBST([UNIFONT_BDF], [$file])
AC_SUBST([FONT_SOURCE], [$file])
break
fi
done
@ -159,6 +173,7 @@ AC_PROG_CC
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
AC_GNU_SOURCE
AM_GNU_GETTEXT
AC_SYS_LARGEFILE
# Identify characteristics of the host architecture.
@ -179,12 +194,12 @@ else
fi
# Check for functions.
AC_CHECK_FUNCS(posix_memalign memalign asprintf)
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
# For grub-mkisofs
AC_HEADER_MAJOR
AC_HEADER_DIRENT
AC_CHECK_FUNCS(memmove sbrk strdup)
AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h)
@ -507,43 +522,40 @@ AC_ARG_ENABLE([mm-debug],
[AC_DEFINE([MM_DEBUG], [1],
[Define to 1 if you enable memory manager debugging.])])
AC_ARG_ENABLE([grub-emu],
[AS_HELP_STRING([--enable-grub-emu],
[build and install the `grub-emu' debugging utility (default=guessed)])])
AC_ARG_ENABLE([grub-emu-usb],
[AS_HELP_STRING([--enable-grub-emu-usb],
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
if test x"$enable_grub_emu" = xno ; then
grub_emu_excuse="explicitly disabled"
fi
[# Check for curses libraries.]
[if [ x"$grub_emu_excuse" = x ]; then ]
AC_ARG_ENABLE([grub-emu-pci],
[AS_HELP_STRING([--enable-grub-emu-pci],
[build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
if test "$platform" = emu; then
missing_ncurses=
[# Check for curses libraries.]
AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
[AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
[grub_emu_excuse=["need (n)curses libraries"]])])
[missing_ncurses=[true]])])
AC_SUBST([LIBCURSES])
[fi]
[if [ x"$grub_emu_excuse" = x ]; then ]
[if [ x"$missing_ncurses" = x ]; then ]
[# Check for headers.]
AC_CHECK_HEADERS([ncurses/curses.h], [],
[AC_CHECK_HEADERS([ncurses.h], [],
[AC_CHECK_HEADERS([curses.h], [],
[grub_emu_excuse=["need (n)curses headers"]])])])
[missing_ncurses=[true]])])])
[fi]
if test x"$missing_ncurses" = xtrue ; then
AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
fi
if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then
AC_MSG_ERROR([grub-emu was explicitly requested but can't be compiled])
fi
if test x"$grub_emu_excuse" = x ; then
enable_grub_emu=yes
else
enable_grub_emu=no
grub_emu_usb_excuse="grub-emu isn't built"
fi
if test x"$enable_grub_emu_usb" = xno ; then
grub_emu_usb_excuse="explicitly disabled"
fi
if test x"$enable_grub_emu_pci" = xyes ; then
grub_emu_usb_excuse="conflicts with PCI support"
fi
[if [ x"$grub_emu_usb_excuse" = x ]; then
# Check for libusb libraries.]
AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
@ -564,8 +576,35 @@ else
enable_grub_emu_usb=no
fi
AC_SUBST([enable_grub_emu])
if test x"$enable_grub_emu_pci" != xyes ; then
grub_emu_pci_excuse="not enabled"
fi
if test x"$enable_grub_emu_usb" = xyes ; then
grub_emu_pci_excuse="conflicts with USB support"
fi
[if [ x"$grub_emu_pci_excuse" = x ]; then
# Check for libpci libraries.]
AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
[grub_emu_pci_excuse=["need libpciaccess library"]])
AC_SUBST([LIBPCIACCESS])
[fi]
[if [ x"$grub_emu_pci_excuse" = x ]; then
# Check for headers.]
AC_CHECK_HEADERS([pci/pci.h], [],
[grub_emu_pci_excuse=["need libpciaccess headers"]])
[fi]
if test x"$grub_emu_pci_excuse" = x ; then
enable_grub_emu_pci=yes
else
enable_grub_emu_pci=no
fi
AC_SUBST([enable_grub_emu_usb])
AC_SUBST([enable_grub_emu_pci])
fi
AC_ARG_ENABLE([grub-fstest],
[AS_HELP_STRING([--enable-grub-fstest],
@ -613,14 +652,18 @@ AC_SUBST(ASFLAGS)
# Output files.
grub_CHECK_LINK_DIR
if test x"$link_dir" = xyes ; then
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu
include/grub/machine:include/grub/$target_cpu/$platform])
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
if test "$platform" != emu ; then
AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
fi
else
mkdir -p include/grub 2>/dev/null
rm -rf include/grub/cpu
cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
rm -rf include/grub/machine
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
if test "$platform" != emu ; then
rm -rf include/grub/machine
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
fi
fi
AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
@ -629,16 +672,18 @@ AC_OUTPUT
echo "*******************************************************"
echo GRUB2 will be compiled with following components:
echo Platform: "$target_cpu"-"$platform"
if [ x"$grub_emu_excuse" = x ]; then
echo grub-emu: Yes
else
echo grub-emu: No "($grub_emu_excuse)"
fi
if [ x"$platform" = xemu ]; then
if [ x"$grub_emu_usb_excuse" = x ]; then
echo USB support for grub-emu: Yes
else
echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
fi
if [ x"$grub_emu_pci_excuse" = x ]; then
echo PCI support for grub-emu: Yes
else
echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
fi
fi
if [ x"$enable_mm_debug" = xyes ]; then
echo With memory debugging: Yes
else

View File

@ -140,7 +140,7 @@ grub_ata_dumpinfo (struct grub_ata_device *dev, char *info)
if (! dev->atapi)
{
grub_dprintf ("ata", "Addressing: %d\n", dev->addr);
grub_dprintf ("ata", "Sectors: %lld\n", dev->size);
grub_dprintf ("ata", "Sectors: %lld\n", (unsigned long long) dev->size);
}
}
@ -388,7 +388,7 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
}
static int NESTED_FUNC_ATTR
grub_ata_pciinit (int bus, int device, int func,
grub_ata_pciinit (grub_pci_device_t dev,
grub_pci_id_t pciid __attribute__((unused)))
{
static int compat_use[2] = { 0 };
@ -402,7 +402,7 @@ grub_ata_pciinit (int bus, int device, int func,
static int controller = 0;
/* Read class. */
addr = grub_pci_make_address (bus, device, func, 2);
addr = grub_pci_make_address (dev, 2);
class = grub_pci_read (addr);
/* Check if this class ID matches that of a PCI IDE Controller. */
@ -429,9 +429,9 @@ grub_ata_pciinit (int bus, int device, int func,
{
/* Read the BARs, which either contain a mmapped IO address
or the IO port address. */
addr = grub_pci_make_address (bus, device, func, 4 + 2 * i);
addr = grub_pci_make_address (dev, 4 + 2 * i);
bar1 = grub_pci_read (addr);
addr = grub_pci_make_address (bus, device, func, 5 + 2 * i);
addr = grub_pci_make_address (dev, 5 + 2 * i);
bar2 = grub_pci_read (addr);
/* Check if the BARs describe an IO region. */
@ -444,7 +444,8 @@ grub_ata_pciinit (int bus, int device, int func,
grub_dprintf ("ata",
"PCI dev (%d,%d,%d) compat=%d rega=0x%x regb=0x%x\n",
bus, device, func, compat, rega, regb);
grub_pci_get_bus (dev), grub_pci_get_device (dev),
grub_pci_get_function (dev), compat, rega, regb);
if (rega && regb)
{
@ -569,7 +570,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
{
struct grub_ata_device *dev = (struct grub_ata_device *) disk->data;
grub_dprintf("ata", "grub_ata_readwrite (size=%u, rw=%d)\n", size, rw);
grub_dprintf("ata", "grub_ata_readwrite (size=%llu, rw=%d)\n", (unsigned long long) size, rw);
grub_ata_addressing_t addressing = dev->addr;
grub_size_t batch;
@ -596,7 +597,7 @@ grub_ata_readwrite (grub_disk_t disk, grub_disk_addr_t sector,
if (size - nsectors < batch)
batch = size - nsectors;
grub_dprintf("ata", "rw=%d, sector=%llu, batch=%u\n", rw, sector, batch);
grub_dprintf("ata", "rw=%d, sector=%llu, batch=%llu\n", rw, (unsigned long long) sector, (unsigned long long) batch);
/* Send read/write command. */
if (grub_ata_setaddress (dev, addressing, sector, batch))
@ -755,7 +756,7 @@ grub_atapi_read (struct grub_scsi *scsi,
{
struct grub_ata_device *dev = (struct grub_ata_device *) scsi->data;
grub_dprintf("ata", "grub_atapi_read (size=%u)\n", size);
grub_dprintf("ata", "grub_atapi_read (size=%llu)\n", (unsigned long long) size);
if (grub_atapi_packet (dev, cmd, size))
return grub_errno;

View File

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

View File

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

View File

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

View File

@ -149,7 +149,7 @@ grub_pxefs_open (struct grub_file *file, const char *name)
if (! data)
return grub_errno;
data->block_size = grub_pxe_blksize;
data->block_size = c.c2.packet_size;
grub_strcpy (data->filename, name);
file_int = grub_malloc (sizeof (*file_int));
@ -204,13 +204,14 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
o.gateway_ip = grub_pxe_gateway_ip;
grub_strcpy ((char *)&o.filename[0], data->filename);
o.tftp_port = grub_cpu_to_be16 (GRUB_PXE_TFTP_PORT);
o.packet_size = data->block_size;
o.packet_size = grub_pxe_blksize;
grub_pxe_call (GRUB_PXENV_TFTP_OPEN, &o);
if (o.status)
{
grub_error (GRUB_ERR_BAD_FS, "open fails");
return -1;
}
data->block_size = o.packet_size;
data->packet_number = 0;
curr_file = file;
}
@ -218,7 +219,7 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
c.buffer = SEGOFS (GRUB_MEMORY_MACHINE_SCRATCH_ADDR);
while (pn >= data->packet_number)
{
c.buffer_size = grub_pxe_blksize;
c.buffer_size = data->block_size;
grub_pxe_call (GRUB_PXENV_TFTP_READ, &c);
if (c.status)
{

View File

@ -64,7 +64,7 @@ fixup (struct grub_ntfs_data *data, char *buf, int len, char *magic)
static grub_err_t read_mft (struct grub_ntfs_data *data, char *buf,
grub_uint32_t mftno);
static grub_err_t read_attr (struct grub_ntfs_attr *at, char *dest,
grub_uint32_t ofs, grub_uint32_t len,
grub_disk_addr_t ofs, grub_size_t len,
int cached,
void
NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t
@ -73,7 +73,7 @@ static grub_err_t read_attr (struct grub_ntfs_attr *at, char *dest,
unsigned length));
static grub_err_t read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
grub_uint32_t ofs, grub_uint32_t len,
grub_disk_addr_t ofs, grub_size_t len,
int cached,
void
NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t
@ -261,9 +261,9 @@ locate_attr (struct grub_ntfs_attr *at, struct grub_ntfs_file *mft,
}
static char *
read_run_data (char *run, int nn, grub_uint32_t * val, int sig)
read_run_data (char *run, int nn, grub_disk_addr_t * val, int sig)
{
grub_uint32_t r, v;
grub_disk_addr_t r, v;
r = 0;
v = 1;
@ -285,7 +285,7 @@ grub_err_t
grub_ntfs_read_run_list (struct grub_ntfs_rlst * ctx)
{
int c1, c2;
grub_uint32_t val;
grub_disk_addr_t val;
char *run;
run = ctx->cur_run;
@ -336,25 +336,25 @@ grub_ntfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t block)
struct grub_ntfs_rlst *ctx;
ctx = (struct grub_ntfs_rlst *) node;
if ((grub_uint32_t) block >= ctx->next_vcn)
if (block >= ctx->next_vcn)
{
if (grub_ntfs_read_run_list (ctx))
return -1;
return ctx->curr_lcn;
}
else
return (ctx->flags & RF_BLNK) ? 0 : ((grub_uint32_t) block -
return (ctx->flags & RF_BLNK) ? 0 : (block -
ctx->curr_vcn + ctx->curr_lcn);
}
static grub_err_t
read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
grub_uint32_t len, int cached,
read_data (struct grub_ntfs_attr *at, char *pa, char *dest,
grub_disk_addr_t ofs, grub_size_t len, int cached,
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset,
unsigned length))
{
grub_uint32_t vcn;
grub_disk_addr_t vcn;
struct grub_ntfs_rlst cc, *ctx;
if (len == 0)
@ -389,7 +389,7 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
{
if ((ofs & (~(COM_LEN - 1))) == at->save_pos)
{
grub_uint32_t n;
grub_disk_addr_t n;
n = COM_LEN - (ofs - at->save_pos);
if (n > len)
@ -412,11 +412,11 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
at->save_pos = 1;
}
vcn = ctx->target_vcn = (ofs / COM_LEN) * (COM_SEC / ctx->comp.spc);
vcn = ctx->target_vcn = (ofs >> COM_LOG_LEN) * (COM_SEC / ctx->comp.spc);
ctx->target_vcn &= ~0xF;
}
else
vcn = ctx->target_vcn = (ofs >> BLK_SHR) / ctx->comp.spc;
vcn = ctx->target_vcn = grub_divmod64 (ofs >> BLK_SHR, ctx->comp.spc, 0);
ctx->next_vcn = u32at (pa, 0x10);
ctx->curr_lcn = 0;
@ -428,11 +428,13 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
if (at->flags & AF_GPOS)
{
grub_uint32_t st0, st1;
grub_disk_addr_t st0, st1;
grub_uint32_t m;
grub_divmod64 (ofs >> BLK_SHR, ctx->comp.spc, &m);
st0 =
(ctx->target_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc +
((ofs >> BLK_SHR) % ctx->comp.spc);
(ctx->target_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc + m;
st1 = st0 + 1;
if (st1 ==
(ctx->next_vcn - ctx->curr_vcn + ctx->curr_lcn) * ctx->comp.spc)
@ -463,8 +465,8 @@ read_data (struct grub_ntfs_attr *at, char *pa, char *dest, grub_uint32_t ofs,
}
static grub_err_t
read_attr (struct grub_ntfs_attr *at, char *dest, grub_uint32_t ofs,
grub_uint32_t len, int cached,
read_attr (struct grub_ntfs_attr *at, char *dest, grub_disk_addr_t ofs,
grub_size_t len, int cached,
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
unsigned offset,
unsigned length))
@ -480,9 +482,9 @@ read_attr (struct grub_ntfs_attr *at, char *dest, grub_uint32_t ofs,
if (at->flags & AF_ALST)
{
char *pa;
grub_uint32_t vcn;
grub_disk_addr_t vcn;
vcn = ofs / (at->mft->data->spc << BLK_SHR);
vcn = grub_divmod64 (ofs, at->mft->data->spc << BLK_SHR, 0);
pa = at->attr_nxt + u16at (at->attr_nxt, 4);
while (pa < at->attr_end)
{
@ -509,7 +511,7 @@ static grub_err_t
read_mft (struct grub_ntfs_data *data, char *buf, grub_uint32_t mftno)
{
if (read_attr
(&data->mmft.attr, buf, mftno * (data->mft_size << BLK_SHR),
(&data->mmft.attr, buf, mftno * ((grub_disk_addr_t) data->mft_size << BLK_SHR),
data->mft_size << BLK_SHR, 0, 0))
return grub_error (GRUB_ERR_BAD_FS, "Read MFT 0x%X fails", mftno);
return fixup (data, buf, data->mft_size, "FILE");
@ -641,7 +643,8 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
unsigned char *bitmap;
struct grub_ntfs_attr attr, *at;
char *cur_pos, *indx, *bmp;
int bitmap_len, ret = 0;
int ret = 0;
grub_size_t bitmap_len;
struct grub_ntfs_file *mft;
mft = (struct grub_ntfs_file *) dir;
@ -745,14 +748,14 @@ grub_ntfs_iterate_dir (grub_fshelp_node_t dir,
if (bitmap)
{
grub_uint32_t v, i;
grub_disk_addr_t v, i;
indx = grub_malloc (mft->data->idx_size << BLK_SHR);
if (indx == NULL)
goto done;
v = 1;
for (i = 0; i < (grub_uint32_t) bitmap_len * 8; i++)
for (i = 0; i < (grub_disk_addr_t)bitmap_len * 8; i++)
{
if (*bitmap & v)
{

View File

@ -209,7 +209,7 @@ read_block (struct grub_ntfs_rlst *ctx, char *buf, int num)
}
}
nn = (16 - (ctx->target_vcn & 0xF)) / cpb;
nn = (16 - (unsigned) (ctx->target_vcn & 0xF)) / cpb;
if (nn > num)
nn = num;
num -= nn;

View File

@ -19,6 +19,7 @@ EXTRA_DISTFILES="AUTHORS COPYING ChangeLog DISTLIST INSTALL NEWS README \
gendistlist.sh genfslist.sh genhandlerlist.sh geninit.sh \
geninitheader.sh genkernsyms.sh.in genmk.rb genmoddep.awk \
genmodsrc.sh genpartmaplist.sh genparttoollist.sh \
genvideolist.sh \
gensymlist.sh.in install-sh mkinstalldirs stamp-h.in"
DISTDIRS="boot bus commands conf disk docs efiemu font fs hello hook include io \
@ -35,7 +36,7 @@ dir=`dirname $0`
cd $dir
for dir in $DISTDIRS; do
for d in `find $dir -type d -not -name .svn -not -name .bzr | sort`; do
for d in `find $dir -type d ! -name .svn ! -name .bzr | sort`; do
find $d -maxdepth 1 -name '*.[chSy]' -o -name '*.mk' -o -name '*.rmk' \
-o -name '*.rb' -o -name '*.in' -o -name '*.tex' -o -name '*.texi' \
-o -name '*.info' -o -name 'grub.cfg' -o -name 'README' \

View File

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

View File

@ -193,6 +193,7 @@ endif
partmap = 'partmap-' + obj.suffix('lst')
handler = 'handler-' + obj.suffix('lst')
parttool = 'parttool-' + obj.suffix('lst')
video = 'video-' + obj.suffix('lst')
dep = deps[i]
flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
@ -203,7 +204,7 @@ endif
-include #{dep}
clean-module-#{extra_target}.#{@rule_count}:
rm -f #{command} #{fs} #{partmap} #{handler} #{parttool}
rm -f #{command} #{fs} #{partmap} #{handler} #{parttool} #{video}
CLEAN_MODULE_TARGETS += clean-module-#{extra_target}.#{@rule_count}
@ -212,6 +213,7 @@ FSFILES += #{fs}
PARTTOOLFILES += #{parttool}
PARTMAPFILES += #{partmap}
HANDLERFILES += #{handler}
VIDEOFILES += #{video}
#{command}: #{src} $(#{src}_DEPENDENCIES) gencmdlist.sh
set -e; \
@ -238,6 +240,11 @@ HANDLERFILES += #{handler}
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genhandlerlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
#{video}: #{src} $(#{src}_DEPENDENCIES) genvideolist.sh
set -e; \
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
| sh $(srcdir)/genvideolist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
"
end.join('')
end

View File

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

26
genvideolist.sh Normal file
View File

@ -0,0 +1,26 @@
#! /bin/sh
#
# Copyright (C) 2005,2008,2009 Free Software Foundation, Inc.
#
# This script is free software; the author
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Read source code from stdin and detect partmap names.
module=$1
# Ignore video.mod.
if test $module = video; then
exit
fi
# For now, this emits only a module name, if the module registers a partition map.
if grep -v "^#" | grep '^ *grub_video_register' >/dev/null 2>&1; then
echo $module
fi

368
gettext/gettext.c Normal file
View File

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

352
gnulib/error.c Normal file
View File

@ -0,0 +1,352 @@
/* Error handler for noninteractive utilities
Copyright (C) 1990-1998, 2000-2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
#if !_LIBC
# include <config.h>
#endif
#include "error.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if !_LIBC && ENABLE_NLS
# include "gettext.h"
# define _(msgid) gettext (msgid)
#endif
#ifdef _LIBC
# include <libintl.h>
# include <stdbool.h>
# include <stdint.h>
# include <wchar.h>
# define mbsrtowcs __mbsrtowcs
#endif
#if USE_UNLOCKED_IO
# include "unlocked-io.h"
#endif
#ifndef _
# define _(String) String
#endif
/* If NULL, error will flush stdout, then print on stderr the program
name, a colon and a space. Otherwise, error will call this
function without parameters instead. */
void (*error_print_progname) (void);
/* This variable is incremented each time `error' is called. */
unsigned int error_message_count;
#ifdef _LIBC
/* In the GNU C library, there is a predefined variable for this. */
# define program_name program_invocation_name
# include <errno.h>
# include <limits.h>
# include <libio/libioP.h>
/* In GNU libc we want do not want to use the common name `error' directly.
Instead make it a weak alias. */
extern void __error (int status, int errnum, const char *message, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
extern void __error_at_line (int status, int errnum, const char *file_name,
unsigned int line_number, const char *message,
...)
__attribute__ ((__format__ (__printf__, 5, 6)));;
# define error __error
# define error_at_line __error_at_line
# include <libio/iolibio.h>
# define fflush(s) INTUSE(_IO_fflush) (s)
# undef putc
# define putc(c, fp) INTUSE(_IO_putc) (c, fp)
# include <bits/libc-lock.h>
#else /* not _LIBC */
# include <fcntl.h>
# if !HAVE_DECL_STRERROR_R && STRERROR_R_CHAR_P
# ifndef HAVE_DECL_STRERROR_R
"this configure-time declaration test was not run"
# endif
char *strerror_r ();
# endif
/* The calling program should define program_name and set it to the
name of the executing program. */
extern char *program_name;
# if HAVE_STRERROR_R || defined strerror_r
# define __strerror_r strerror_r
# endif /* HAVE_STRERROR_R || defined strerror_r */
#endif /* not _LIBC */
static void
print_errno_message (int errnum)
{
char const *s;
#if defined HAVE_STRERROR_R || _LIBC
char errbuf[1024];
# if STRERROR_R_CHAR_P || _LIBC
s = __strerror_r (errnum, errbuf, sizeof errbuf);
# else
if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
s = errbuf;
else
s = 0;
# endif
#else
s = strerror (errnum);
#endif
#if !_LIBC
if (! s)
s = _("Unknown system error");
#endif
#if _LIBC
__fxprintf (NULL, ": %s", s);
#else
fprintf (stderr, ": %s", s);
#endif
}
static void
error_tail (int status, int errnum, const char *message, va_list args)
{
#if _LIBC
if (_IO_fwide (stderr, 0) > 0)
{
# define ALLOCA_LIMIT 2000
size_t len = strlen (message) + 1;
wchar_t *wmessage = NULL;
mbstate_t st;
size_t res;
const char *tmp;
bool use_malloc = false;
while (1)
{
if (__libc_use_alloca (len * sizeof (wchar_t)))
wmessage = (wchar_t *) alloca (len * sizeof (wchar_t));
else
{
if (!use_malloc)
wmessage = NULL;
wchar_t *p = (wchar_t *) realloc (wmessage,
len * sizeof (wchar_t));
if (p == NULL)
{
free (wmessage);
fputws_unlocked (L"out of memory\n", stderr);
return;
}
wmessage = p;
use_malloc = true;
}
memset (&st, '\0', sizeof (st));
tmp = message;
res = mbsrtowcs (wmessage, &tmp, len, &st);
if (res != len)
break;
if (__builtin_expect (len >= SIZE_MAX / 2, 0))
{
/* This really should not happen if everything is fine. */
res = (size_t) -1;
break;
}
len *= 2;
}
if (res == (size_t) -1)
{
/* The string cannot be converted. */
if (use_malloc)
{
free (wmessage);
use_malloc = false;
}
wmessage = (wchar_t *) L"???";
}
__vfwprintf (stderr, wmessage, args);
if (use_malloc)
free (wmessage);
}
else
#endif
vfprintf (stderr, message, args);
va_end (args);
++error_message_count;
if (errnum)
print_errno_message (errnum);
#if _LIBC
__fxprintf (NULL, "\n");
#else
putc ('\n', stderr);
#endif
fflush (stderr);
if (status)
exit (status);
}
/* Print the program name and error message MESSAGE, which is a printf-style
format string with optional args.
If ERRNUM is nonzero, print its corresponding system error message.
Exit with status STATUS if it is nonzero. */
void
error (int status, int errnum, const char *message, ...)
{
va_list args;
#if defined _LIBC && defined __libc_ptf_call
/* We do not want this call to be cut short by a thread
cancellation. Therefore disable cancellation for now. */
int state = PTHREAD_CANCEL_ENABLE;
__libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
0);
#endif
#if !_LIBC && defined F_GETFL
/* POSIX states that fflush (stdout) after fclose is unspecified; it
is safe in glibc, but not on all other platforms. fflush (NULL)
is always defined, but too draconian. */
if (0 <= fcntl (1, F_GETFL))
#endif
fflush (stdout);
#ifdef _LIBC
_IO_flockfile (stderr);
#endif
if (error_print_progname)
(*error_print_progname) ();
else
{
#if _LIBC
__fxprintf (NULL, "%s: ", program_name);
#else
fprintf (stderr, "%s: ", program_name);
#endif
}
va_start (args, message);
error_tail (status, errnum, message, args);
#ifdef _LIBC
_IO_funlockfile (stderr);
# ifdef __libc_ptf_call
__libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
# endif
#endif
}
/* Sometimes we want to have at most one error per line. This
variable controls whether this mode is selected or not. */
int error_one_per_line;
void
error_at_line (int status, int errnum, const char *file_name,
unsigned int line_number, const char *message, ...)
{
va_list args;
if (error_one_per_line)
{
static const char *old_file_name;
static unsigned int old_line_number;
if (old_line_number == line_number
&& (file_name == old_file_name
|| strcmp (old_file_name, file_name) == 0))
/* Simply return and print nothing. */
return;
old_file_name = file_name;
old_line_number = line_number;
}
#if defined _LIBC && defined __libc_ptf_call
/* We do not want this call to be cut short by a thread
cancellation. Therefore disable cancellation for now. */
int state = PTHREAD_CANCEL_ENABLE;
__libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state),
0);
#endif
#if !_LIBC && defined F_GETFL
/* POSIX states that fflush (stdout) after fclose is unspecified; it
is safe in glibc, but not on all other platforms. fflush (NULL)
is always defined, but too draconian. */
if (0 <= fcntl (1, F_GETFL))
#endif
fflush (stdout);
#ifdef _LIBC
_IO_flockfile (stderr);
#endif
if (error_print_progname)
(*error_print_progname) ();
else
{
#if _LIBC
__fxprintf (NULL, "%s:", program_name);
#else
fprintf (stderr, "%s:", program_name);
#endif
}
#if _LIBC
__fxprintf (NULL, file_name != NULL ? "%s:%d: " : " ",
file_name, line_number);
#else
fprintf (stderr, file_name != NULL ? "%s:%d: " : " ",
file_name, line_number);
#endif
va_start (args, message);
error_tail (status, errnum, message, args);
#ifdef _LIBC
_IO_funlockfile (stderr);
# ifdef __libc_ptf_call
__libc_ptf_call (pthread_setcancelstate, (state, NULL), 0);
# endif
#endif
}
#ifdef _LIBC
/* Make the weak alias. */
# undef error
# undef error_at_line
weak_alias (__error, error)
weak_alias (__error_at_line, error_at_line)
#endif

65
gnulib/error.h Normal file
View File

@ -0,0 +1,65 @@
/* Declaration for error-reporting function
Copyright (C) 1995, 1996, 1997, 2003, 2006, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _ERROR_H
#define _ERROR_H 1
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
# define __attribute__(Spec) /* empty */
# endif
/* The __-protected variants of `format' and `printf' attributes
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Print a message with `fprintf (stderr, FORMAT, ...)';
if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
extern void error (int __status, int __errnum, const char *__format, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
extern void error_at_line (int __status, int __errnum, const char *__fname,
unsigned int __lineno, const char *__format, ...)
__attribute__ ((__format__ (__printf__, 5, 6)));
/* If NULL, error will flush stdout, then print on stderr the program
name, a colon and a space. Otherwise, error will call this
function without parameters instead. */
extern void (*error_print_progname) (void);
/* This variable is incremented each time `error' is called. */
extern unsigned int error_message_count;
/* Sometimes we want to have at most one error per line. This
variable controls whether this mode is selected or not. */
extern int error_one_per_line;
#ifdef __cplusplus
}
#endif
#endif /* error.h */

View File

@ -1069,9 +1069,10 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
size_t plensize; \
size_t newpsize; \
\
assert (p > startp); \
plen = (opt == L_('?') || opt == L_('@') \
? pattern_len \
: p - startp + 1); \
: (unsigned) (p - startp) + 1); \
plensize = plen * sizeof (CHAR); \
newpsize = offsetof (struct patternlist, str) + plensize; \
if ((size_t) -1 / sizeof (CHAR) < plen \

78
gnulib/progname.c Normal file
View File

@ -0,0 +1,78 @@
/* Program name management.
Copyright (C) 2001-2003, 2005-2009 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
/* Specification. */
#undef ENABLE_RELOCATABLE /* avoid defining set_program_name as a macro */
#include "progname.h"
#include <errno.h> /* get program_invocation_name declaration */
#include <string.h>
/* String containing name the program is called with.
To be initialized by main(). */
const char *program_name = NULL;
/* Set program_name, based on argv[0]. */
void
set_program_name (const char *argv0)
{
/* libtool creates a temporary executable whose name is sometimes prefixed
with "lt-" (depends on the platform). It also makes argv[0] absolute.
But the name of the temporary executable is a detail that should not be
visible to the end user and to the test suite.
Remove this "<dirname>/.libs/" or "<dirname>/.libs/lt-" prefix here. */
const char *slash;
const char *base;
slash = strrchr (argv0, '/');
base = (slash != NULL ? slash + 1 : argv0);
if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0)
{
argv0 = base;
if (strncmp (base, "lt-", 3) == 0)
{
argv0 = base + 3;
/* On glibc systems, remove the "lt-" prefix from the variable
program_invocation_short_name. */
#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
program_invocation_short_name = (char *) argv0;
#endif
}
}
/* But don't strip off a leading <dirname>/ in general, because when the user
runs
/some/hidden/place/bin/cp foo foo
he should get the error message
/some/hidden/place/bin/cp: `foo' and `foo' are the same file
not
cp: `foo' and `foo' are the same file
*/
program_name = argv0;
/* On glibc systems, the error() function comes from libc and uses the
variable program_invocation_name, not program_name. So set this variable
as well. */
#if HAVE_DECL_PROGRAM_INVOCATION_NAME
program_invocation_name = (char *) argv0;
#endif
}

60
gnulib/progname.h Normal file
View File

@ -0,0 +1,60 @@
/* Program name management.
Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program 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.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _PROGNAME_H
#define _PROGNAME_H
/* Programs using this file should do the following in main():
set_program_name (argv[0]);
*/
#ifdef __cplusplus
extern "C" {
#endif
/* String containing name the program is called with. */
extern const char *program_name;
/* Set program_name, based on argv[0]. */
extern void set_program_name (const char *argv0);
#if ENABLE_RELOCATABLE
/* Set program_name, based on argv[0], and original installation prefix and
directory, for relocatability. */
extern void set_program_name_and_installdir (const char *argv0,
const char *orig_installprefix,
const char *orig_installdir);
#undef set_program_name
#define set_program_name(ARG0) \
set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR)
/* Return the full pathname of the current executable, based on the earlier
call to set_program_name_and_installdir. Return NULL if unknown. */
extern char *get_full_program_name (void);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _PROGNAME_H */

View File

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

View File

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

View File

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

View File

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

View File

@ -16,9 +16,21 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_MACHINE_HEADER
#define GRUB_MACHINE_MACHINE_HEADER 1
#ifndef GRUB_I18N_H
#define GRUB_I18N_H 1
#define GRUB_MACHINE_QEMU 1
#ifdef GRUB_UTIL
# include <locale.h>
# include <libintl.h>
# define _(str) gettext(str)
#else
# define _(str) grub_gettext(str)
#endif /* ! GRUB_MACHINE_MACHINE_HEADER */
const char *EXPORT_FUNC(grub_gettext_dummy) (const char *s);
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
#endif
#define N_(str) str
#endif /* GRUB_I18N_H */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,22 +21,15 @@
/* The asm part of the multiboot loader. */
void grub_multiboot_real_boot (grub_addr_t entry,
struct grub_multiboot_info *mbi)
struct multiboot_info *mbi)
__attribute__ ((noreturn));
void grub_multiboot2_real_boot (grub_addr_t entry,
struct grub_multiboot_info *mbi)
struct multiboot_info *mbi)
__attribute__ ((noreturn));
extern grub_addr_t grub_multiboot_payload_orig;
extern grub_uint32_t grub_multiboot_payload_eip;
extern char *grub_multiboot_payload_orig;
extern grub_addr_t grub_multiboot_payload_dest;
extern grub_size_t grub_multiboot_payload_size;
extern grub_uint32_t grub_multiboot_payload_entry_offset;
extern grub_uint8_t grub_multiboot_forward_relocator;
extern grub_uint8_t grub_multiboot_forward_relocator_end;
extern grub_uint8_t grub_multiboot_backward_relocator;
extern grub_uint8_t grub_multiboot_backward_relocator_end;
#define RELOCATOR_SIZEOF(x) (&grub_multiboot_##x##_relocator_end - &grub_multiboot_##x##_relocator)
#endif /* ! GRUB_MULTIBOOT_CPU_HEADER */

View File

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

View File

@ -21,13 +21,14 @@
#define GRUB_MEMORY_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/machine/machine.h>
#ifndef ASM_FILE
#include <grub/types.h>
#include <grub/err.h>
#include <grub/memory.h>
#endif
#include <grub/i386/memory.h>
/* The scratch buffer used in real mode code. */
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
@ -63,9 +64,6 @@
/* The address where another boot loader is loaded. */
#define GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR 0x7c00
/* The flag for protected mode. */
#define GRUB_MEMORY_MACHINE_CR0_PE_ON 0x1
/* The code segment of the protected mode. */
#define GRUB_MEMORY_MACHINE_PROT_MODE_CSEG 0x8

View File

@ -67,4 +67,20 @@ grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
grub_outb (data, GRUB_PCI_DATA_REG + (addr & 3));
}
static inline void *
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
grub_addr_t base,
grub_size_t size __attribute__ ((unused)))
{
return (void *) base;
}
static inline void
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
void *mem __attribute__ ((unused)),
grub_size_t size __attribute__ ((unused)))
{
}
#endif /* GRUB_CPU_PCI_H */

View File

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

View File

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,17 +16,26 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/cpu/io.h>
#include <grub/cpu/at_keyboard.h>
#include <grub/cpu/reboot.h>
#include <grub/misc.h>
#ifndef GRUB_RELOCATOR_CPU_HEADER
#define GRUB_RELOCATOR_CPU_HEADER 1
void
grub_reboot (void)
#include <grub/types.h>
#include <grub/err.h>
struct grub_relocator32_state
{
/* Use the keyboard controller to reboot. That's what keyboards were
designed for, isn't it? */
grub_outb (KEYBOARD_COMMAND_REBOOT, KEYBOARD_REG_STATUS);
grub_uint32_t esp;
grub_uint32_t eax;
grub_uint32_t ebx;
grub_uint32_t ecx;
grub_uint32_t edx;
grub_uint32_t eip;
};
grub_printf ("GRUB doesn't know how to reboot this machine yet!\n");
}
void *grub_relocator32_alloc (grub_size_t size);
grub_err_t grub_relocator32_boot (void *relocator, grub_uint32_t dest,
struct grub_relocator32_state state);
void *grub_relocator32_realloc (void *relocator, grub_size_t size);
void grub_relocator32_free (void *relocator);
#endif /* ! GRUB_RELOCATOR_CPU_HEADER */

View File

@ -21,6 +21,9 @@
#include <grub/err.h>
#include <grub/efi/api.h>
#include <grub/cpu/relocator.h>
#define XNU_RELOCATOR(x) (grub_relocator32_ ## x)
#define GRUB_XNU_PAGESIZE 4096
typedef grub_uint32_t grub_xnu_ptr_t;
@ -115,6 +118,4 @@ grub_err_t grub_xnu_set_video (struct grub_xnu_boot_params *bootparams_relloc);
grub_err_t
grub_cpu_xnu_fill_devicetree (void);
extern grub_uint32_t grub_xnu_heap_will_be_at;
extern grub_uint8_t grub_xnu_launcher_start[];
extern grub_uint8_t grub_xnu_launcher_end[];
#endif

View File

@ -1,7 +1,7 @@
/* misc.h - prototypes for misc functions */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -171,6 +171,9 @@ char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n);
void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
grub_size_t EXPORT_FUNC(grub_strlen) (const char *s);
int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
int EXPORT_FUNC(grub_puts) (const char *s);
int EXPORT_FUNC(grub_puts_) (const char *s);
void EXPORT_FUNC(grub_real_dprintf) (const char *file,
const int line,
const char *condition,
@ -219,4 +222,15 @@ grub_div_roundup (unsigned int x, unsigned int y)
return (x + y - 1) / y;
}
/* Reboot the machine. */
void EXPORT_FUNC (grub_reboot) (void);
#ifdef GRUB_MACHINE_PCBIOS
/* Halt the system, using APM if possible. If NO_APM is true, don't
* use APM even if it is available. */
void EXPORT_FUNC (grub_halt) (int no_apm);
#else
void EXPORT_FUNC (grub_halt) (void);
#endif
#endif /* ! GRUB_MISC_HEADER */

View File

@ -25,105 +25,4 @@
void grub_multiboot (int argc, char *argv[]);
void grub_module (int argc, char *argv[]);
#ifndef ASM_FILE
#include <grub/types.h>
struct grub_multiboot_header
{
/* Must be MULTIBOOT_MAGIC - see above. */
grub_uint32_t magic;
/* Feature flags. */
grub_uint32_t flags;
/* The above fields plus this one must equal 0 mod 2^32. */
grub_uint32_t checksum;
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
grub_uint32_t header_addr;
grub_uint32_t load_addr;
grub_uint32_t load_end_addr;
grub_uint32_t bss_end_addr;
grub_uint32_t entry_addr;
/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
grub_uint32_t mode_type;
grub_uint32_t width;
grub_uint32_t height;
grub_uint32_t depth;
};
struct grub_multiboot_info
{
/* Multiboot info version number */
grub_uint32_t flags;
/* Available memory from BIOS */
grub_uint32_t mem_lower;
grub_uint32_t mem_upper;
/* "root" partition */
grub_uint32_t boot_device;
/* Kernel command line */
grub_uint32_t cmdline;
/* Boot-Module list */
grub_uint32_t mods_count;
grub_uint32_t mods_addr;
grub_uint32_t syms[4];
/* Memory Mapping buffer */
grub_uint32_t mmap_length;
grub_uint32_t mmap_addr;
/* Drive Info buffer */
grub_uint32_t drives_length;
grub_uint32_t drives_addr;
/* ROM configuration table */
grub_uint32_t config_table;
/* Boot Loader Name */
grub_uint32_t boot_loader_name;
/* APM table */
grub_uint32_t apm_table;
/* Video */
grub_uint32_t vbe_control_info;
grub_uint32_t vbe_mode_info;
grub_uint16_t vbe_mode;
grub_uint16_t vbe_interface_seg;
grub_uint16_t vbe_interface_off;
grub_uint16_t vbe_interface_len;
};
struct grub_multiboot_mmap_entry
{
grub_uint32_t size;
grub_uint64_t addr;
grub_uint64_t len;
#define GRUB_MULTIBOOT_MEMORY_AVAILABLE 1
#define GRUB_MULTIBOOT_MEMORY_RESERVED 2
grub_uint32_t type;
} __attribute__((packed));
struct grub_mod_list
{
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
grub_uint32_t mod_start;
grub_uint32_t mod_end;
/* Module command line */
grub_uint32_t cmdline;
/* padding to take it to 16 bytes (must be zero) */
grub_uint32_t pad;
};
#endif /* ! ASM_FILE */
#endif /* ! GRUB_MULTIBOOT_HEADER */

View File

@ -30,7 +30,7 @@ typedef grub_uint64_t uint64_t;
#define __WORDSIZE GRUB_TARGET_WORDSIZE
#endif
struct multiboot_tag_header;
struct multiboot2_tag_header;
grub_err_t
grub_mb2_tag_alloc (grub_addr_t *addr, int key, grub_size_t len);
@ -42,7 +42,7 @@ void
grub_mb2_arch_boot (grub_addr_t entry, void *tags);
void
grub_mb2_arch_unload (struct multiboot_tag_header *tags);
grub_mb2_arch_unload (struct multiboot2_tag_header *tags);
grub_err_t
grub_mb2_arch_elf32_hook (Elf32_Phdr *phdr, grub_addr_t *addr, int *do_load);
@ -65,6 +65,6 @@ grub_module2 (int argc, char *argv[]);
#define for_each_tag(tag, tags) \
for (tag = tags; \
tag && tag->key != MULTIBOOT2_TAG_END; \
tag = (struct multiboot_tag_header *)((char *)tag + tag->len))
tag = (struct multiboot2_tag_header *)((char *)tag + tag->len))
#endif /* ! GRUB_MULTIBOOT2_HEADER */

View File

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

View File

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

View File

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

103
include/grub/pciutils.h Normal file
View File

@ -0,0 +1,103 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_PCIUTILS_H
#define GRUB_PCIUTILS_H 1
#include <pciaccess.h>
typedef struct pci_device *grub_pci_device_t;
static inline int
grub_pci_get_bus (grub_pci_device_t dev)
{
return dev->bus;
}
static inline int
grub_pci_get_device (grub_pci_device_t dev)
{
return dev->dev;
}
static inline int
grub_pci_get_function (grub_pci_device_t dev)
{
return dev->func;
}
struct grub_pci_address
{
grub_pci_device_t dev;
int pos;
};
typedef struct grub_pci_address grub_pci_address_t;
static inline grub_uint32_t
grub_pci_read (grub_pci_address_t addr)
{
grub_uint32_t ret;
pci_device_cfg_read_u32 (addr.dev, &ret, addr.pos);
return ret;
}
static inline grub_uint16_t
grub_pci_read_word (grub_pci_address_t addr)
{
grub_uint16_t ret;
pci_device_cfg_read_u16 (addr.dev, &ret, addr.pos);
return ret;
}
static inline grub_uint8_t
grub_pci_read_byte (grub_pci_address_t addr)
{
grub_uint8_t ret;
pci_device_cfg_read_u8 (addr.dev, &ret, addr.pos);
return ret;
}
static inline void
grub_pci_write (grub_pci_address_t addr, grub_uint32_t data)
{
pci_device_cfg_write_u32 (addr.dev, data, addr.pos);
}
static inline void
grub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data)
{
pci_device_cfg_write_u16 (addr.dev, data, addr.pos);
}
static inline void
grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data)
{
pci_device_cfg_write_u8 (addr.dev, data, addr.pos);
}
void *
grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base,
grub_size_t size);
void
grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem,
grub_size_t size);
#endif /* GRUB_PCIUTILS_H */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc.
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,4 +16,4 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
extern void grub_halt (void);
#include <grub/i386/io.h>

View File

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

View File

@ -94,6 +94,7 @@ struct grub_xnu_devtree_key *grub_xnu_create_value (struct grub_xnu_devtree_key
void grub_xnu_lock (void);
void grub_xnu_unlock (void);
grub_err_t grub_xnu_resume (char *imagename);
grub_err_t grub_xnu_boot_resume (void);
struct grub_xnu_devtree_key *grub_xnu_find_key (struct grub_xnu_devtree_key *parent,
char *name);
grub_err_t grub_xnu_align_heap (int align);
@ -105,7 +106,7 @@ void *grub_xnu_heap_malloc (int size);
grub_err_t grub_xnu_fill_devicetree (void);
extern grub_uint32_t grub_xnu_heap_real_start;
extern grub_size_t grub_xnu_heap_size;
extern char *grub_xnu_heap_start;
extern void *grub_xnu_heap_start;
extern struct grub_video_bitmap *grub_xnu_bitmap;
extern int grub_xnu_is_64bit;
#endif

View File

@ -1,20 +1,23 @@
/* multiboot.h - multiboot header file. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2007,2009 Free Software Foundation, Inc.
* multiboot.h - Multiboot header file.
* Copyright (C) 2003,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.
* 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:
*
* 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.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
* 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 ANY
* DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef MULTIBOOT_HEADER
@ -92,4 +95,105 @@
/* Is there video information? */
#define MULTIBOOT_INFO_VIDEO_INFO 0x00000800
#ifndef ASM_FILE
#include <grub/types.h>
struct multiboot_header
{
/* Must be MULTIBOOT_MAGIC - see above. */
grub_uint32_t magic;
/* Feature flags. */
grub_uint32_t flags;
/* The above fields plus this one must equal 0 mod 2^32. */
grub_uint32_t checksum;
/* These are only valid if MULTIBOOT_AOUT_KLUDGE is set. */
grub_uint32_t header_addr;
grub_uint32_t load_addr;
grub_uint32_t load_end_addr;
grub_uint32_t bss_end_addr;
grub_uint32_t entry_addr;
/* These are only valid if MULTIBOOT_VIDEO_MODE is set. */
grub_uint32_t mode_type;
grub_uint32_t width;
grub_uint32_t height;
grub_uint32_t depth;
};
struct multiboot_info
{
/* Multiboot info version number */
grub_uint32_t flags;
/* Available memory from BIOS */
grub_uint32_t mem_lower;
grub_uint32_t mem_upper;
/* "root" partition */
grub_uint32_t boot_device;
/* Kernel command line */
grub_uint32_t cmdline;
/* Boot-Module list */
grub_uint32_t mods_count;
grub_uint32_t mods_addr;
grub_uint32_t syms[4];
/* Memory Mapping buffer */
grub_uint32_t mmap_length;
grub_uint32_t mmap_addr;
/* Drive Info buffer */
grub_uint32_t drives_length;
grub_uint32_t drives_addr;
/* ROM configuration table */
grub_uint32_t config_table;
/* Boot Loader Name */
grub_uint32_t boot_loader_name;
/* APM table */
grub_uint32_t apm_table;
/* Video */
grub_uint32_t vbe_control_info;
grub_uint32_t vbe_mode_info;
grub_uint16_t vbe_mode;
grub_uint16_t vbe_interface_seg;
grub_uint16_t vbe_interface_off;
grub_uint16_t vbe_interface_len;
};
struct multiboot_mmap_entry
{
grub_uint32_t size;
grub_uint64_t addr;
grub_uint64_t len;
#define MULTIBOOT_MEMORY_AVAILABLE 1
#define MULTIBOOT_MEMORY_RESERVED 2
grub_uint32_t type;
} __attribute__((packed));
struct multiboot_mod_list
{
/* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */
grub_uint32_t mod_start;
grub_uint32_t mod_end;
/* Module command line */
grub_uint32_t cmdline;
/* padding to take it to 16 bytes (must be zero) */
grub_uint32_t pad;
};
#endif /* ! ASM_FILE */
#endif /* ! MULTIBOOT_HEADER */

View File

@ -40,18 +40,18 @@
/* XXX not portable? */
#if __WORDSIZE == 64
typedef uint64_t multiboot_word;
typedef uint64_t multiboot2_word;
#else
typedef uint32_t multiboot_word;
typedef uint32_t multiboot2_word;
#endif
struct multiboot_header
struct multiboot2_header
{
uint32_t magic;
uint32_t flags;
};
struct multiboot_tag_header
struct multiboot2_tag_header
{
uint32_t key;
uint32_t len;
@ -61,48 +61,48 @@ struct multiboot_tag_header
#define MULTIBOOT2_TAG_RESERVED2 (~0)
#define MULTIBOOT2_TAG_START 1
struct multiboot_tag_start
struct multiboot2_tag_start
{
struct multiboot_tag_header header;
multiboot_word size; /* Total size of all multiboot tags. */
struct multiboot2_tag_header header;
multiboot2_word size; /* Total size of all multiboot tags. */
};
#define MULTIBOOT2_TAG_NAME 2
struct multiboot_tag_name
struct multiboot2_tag_name
{
struct multiboot_tag_header header;
struct multiboot2_tag_header header;
char name[1];
};
#define MULTIBOOT2_TAG_MODULE 3
struct multiboot_tag_module
struct multiboot2_tag_module
{
struct multiboot_tag_header header;
multiboot_word addr;
multiboot_word size;
struct multiboot2_tag_header header;
multiboot2_word addr;
multiboot2_word size;
char type[36];
char cmdline[1];
};
#define MULTIBOOT2_TAG_MEMORY 4
struct multiboot_tag_memory
struct multiboot2_tag_memory
{
struct multiboot_tag_header header;
multiboot_word addr;
multiboot_word size;
multiboot_word type;
struct multiboot2_tag_header header;
multiboot2_word addr;
multiboot2_word size;
multiboot2_word type;
};
#define MULTIBOOT2_TAG_UNUSED 5
struct multiboot_tag_unused
struct multiboot2_tag_unused
{
struct multiboot_tag_header header;
struct multiboot2_tag_header header;
};
#define MULTIBOOT2_TAG_END 0xffff
struct multiboot_tag_end
struct multiboot2_tag_end
{
struct multiboot_tag_header header;
struct multiboot2_tag_header header;
};
#endif /* ! ASM_FILE */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,15 +26,15 @@
grub_size_t grub_lower_mem, grub_upper_mem;
/* A pointer to the MBI in its initial location. */
struct grub_multiboot_info *startup_multiboot_info;
struct multiboot_info *startup_multiboot_info;
/* The MBI has to be copied to our BSS so that it won't be
overwritten. This is its final location. */
static struct grub_multiboot_info kern_multiboot_info;
static struct multiboot_info kern_multiboot_info;
/* Unfortunately we can't use heap at this point. But 32 looks like a sane
limit (used by memtest86). */
static grub_uint8_t mmap_entries[sizeof (struct grub_multiboot_mmap_entry) * 32];
static grub_uint8_t mmap_entries[sizeof (struct multiboot_mmap_entry) * 32];
void
grub_machine_mmap_init ()
@ -43,7 +43,7 @@ grub_machine_mmap_init ()
grub_fatal ("Unable to find Multiboot Information (is CONFIG_MULTIBOOT disabled in coreboot?)");
/* Move MBI to a safe place. */
grub_memmove (&kern_multiboot_info, startup_multiboot_info, sizeof (struct grub_multiboot_info));
grub_memmove (&kern_multiboot_info, startup_multiboot_info, sizeof (struct multiboot_info));
if ((kern_multiboot_info.flags & MULTIBOOT_INFO_MEM_MAP) == 0)
grub_fatal ("Missing Multiboot memory information");
@ -73,7 +73,7 @@ grub_machine_mmap_init ()
grub_err_t
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
{
struct grub_multiboot_mmap_entry *entry = (void *) kern_multiboot_info.mmap_addr;
struct multiboot_mmap_entry *entry = (void *) kern_multiboot_info.mmap_addr;
while ((unsigned long) entry < kern_multiboot_info.mmap_addr + kern_multiboot_info.mmap_length)
{

View File

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

View File

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

View File

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

View File

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

View File

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

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