merge mainline into lspci
This commit is contained in:
commit
6fba9b7490
|
|
@ -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
|
||||
4
INSTALL
4
INSTALL
|
|
@ -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
|
||||
====================
|
||||
|
|
|
|||
69
Makefile.in
69
Makefile.in
|
|
@ -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
|
||||
|
||||
|
|
|
|||
8
NEWS
8
NEWS
|
|
@ -1,4 +1,10 @@
|
|||
New in 1.97 - :
|
||||
New in 1.98:
|
||||
|
||||
* Add grub-probe support for GNU/Hurd.
|
||||
|
||||
* Add support for gettext.
|
||||
|
||||
New in 1.97:
|
||||
|
||||
* Add support for loading XNU (MacOS X kernel).
|
||||
|
||||
|
|
|
|||
1
THANKS
1
THANKS
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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/'`
|
||||
|
|
|
|||
23
bus/pci.c
23
bus/pci.c
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -155,42 +155,6 @@ grub_usb_get_endpdescriptor (grub_usb_device_t usbdev, int addr)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
grub_usb_err_t
|
||||
grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index, int langid,
|
||||
char **string)
|
||||
{
|
||||
struct grub_usb_desc_str descstr;
|
||||
struct grub_usb_desc_str *descstrp;
|
||||
grub_usb_err_t err;
|
||||
|
||||
/* Only get the length. */
|
||||
err = grub_usb_control_msg (dev, 1 << 7,
|
||||
0x06, (3 << 8) | index,
|
||||
langid, 1, (char *) &descstr);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
descstrp = grub_malloc (descstr.length);
|
||||
if (! descstrp)
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
err = grub_usb_control_msg (dev, 1 << 7,
|
||||
0x06, (3 << 8) | index,
|
||||
langid, descstr.length, (char *) descstrp);
|
||||
|
||||
*string = grub_malloc (descstr.length / 2);
|
||||
if (! *string)
|
||||
{
|
||||
grub_free (descstrp);
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str, descstrp->length / 2 - 1);
|
||||
(*string)[descstr.length / 2 - 1] = '\0';
|
||||
grub_free (descstrp);
|
||||
|
||||
return GRUB_USB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_usb_err_t
|
||||
grub_usb_device_initialize (grub_usb_device_t dev)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)),
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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[] =
|
||||
|
|
|
|||
|
|
@ -124,16 +124,17 @@ static const struct grub_arg_option options[] =
|
|||
static int iospace;
|
||||
|
||||
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;
|
||||
int i, reg;
|
||||
|
||||
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,
|
||||
|
|
@ -213,13 +214,13 @@ grub_cmd_lspci (grub_extcmd_t cmd,
|
|||
|
||||
static grub_extcmd_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(pci)
|
||||
GRUB_MOD_INIT(lspci)
|
||||
{
|
||||
cmd = grub_register_extcmd ("lspci", grub_cmd_lspci, GRUB_COMMAND_FLAG_BOTH,
|
||||
"lspci [-i]", "List PCI devices", options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(pci)
|
||||
GRUB_MOD_FINI(lspci)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ grub_getline (void)
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_read (grub_command_t cmd UNUSED, int argc, char **args)
|
||||
grub_cmd_read (grub_command_t cmd __attribute__ ((unused)), int argc, char **args)
|
||||
{
|
||||
char *line = grub_getline ();
|
||||
if (! line)
|
||||
|
|
|
|||
|
|
@ -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)),
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/charset.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/dl.h>
|
||||
|
|
@ -59,18 +60,60 @@ static const char *usb_devspeed[] =
|
|||
"High"
|
||||
};
|
||||
|
||||
static grub_usb_err_t
|
||||
grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index, int langid,
|
||||
char **string)
|
||||
{
|
||||
struct grub_usb_desc_str descstr;
|
||||
struct grub_usb_desc_str *descstrp;
|
||||
grub_usb_err_t err;
|
||||
|
||||
/* Only get the length. */
|
||||
err = grub_usb_control_msg (dev, 1 << 7,
|
||||
0x06, (3 << 8) | index,
|
||||
langid, 1, (char *) &descstr);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
descstrp = grub_malloc (descstr.length);
|
||||
if (! descstrp)
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
err = grub_usb_control_msg (dev, 1 << 7,
|
||||
0x06, (3 << 8) | index,
|
||||
langid, descstr.length, (char *) descstrp);
|
||||
|
||||
*string = grub_malloc (descstr.length / 2);
|
||||
if (! *string)
|
||||
{
|
||||
grub_free (descstrp);
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str, descstrp->length / 2 - 1);
|
||||
(*string)[descstr.length / 2 - 1] = '\0';
|
||||
grub_free (descstrp);
|
||||
|
||||
return GRUB_USB_ERR_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
usb_print_str (const char *description, grub_usb_device_t dev, int idx)
|
||||
{
|
||||
char *name;
|
||||
grub_usb_err_t err;
|
||||
/* XXX: LANGID */
|
||||
|
||||
if (! idx)
|
||||
return;
|
||||
|
||||
grub_usb_get_string (dev, idx, 0x0409, &name);
|
||||
grub_printf ("%s: `%s'\n", description, name);
|
||||
grub_free (name);
|
||||
err = grub_usb_get_string (dev, idx, 0x0409, &name);
|
||||
if (err)
|
||||
grub_printf ("Error %d retrieving %s\n", err, description);
|
||||
else
|
||||
{
|
||||
grub_printf ("%s: `%s'\n", description, name);
|
||||
grub_free (name);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -618,3 +638,8 @@ pkglib_MODULES += setjmp.mod
|
|||
setjmp_mod_SOURCES = lib/$(target_cpu)/setjmp.S
|
||||
setjmp_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
setjmp_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += charset.mod
|
||||
charset_mod_SOURCES = lib/charset.c
|
||||
charset_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
charset_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -5,18 +5,14 @@ COMMON_CFLAGS = -fno-builtin -m32
|
|||
COMMON_LDFLAGS = -melf_i386 -nostdlib
|
||||
|
||||
# Used by various components. These rules need to precede them.
|
||||
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
|
||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
||||
|
||||
# Utilities.
|
||||
bin_UTILITIES = grub-mkimage
|
||||
sbin_UTILITIES = grub-mkdevicemap
|
||||
#ifeq ($(enable_grub_emu), yes)
|
||||
#sbin_UTILITIES += grub-emu
|
||||
#endif
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
|
||||
util/resolve.c
|
||||
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
|
||||
util/misc.c util/resolve.c
|
||||
util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||
|
||||
# For grub-setup.
|
||||
|
|
@ -27,55 +23,6 @@ util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
|
|||
# fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
|
||||
# kern/fs.c kern/env.c fs/fshelp.c
|
||||
|
||||
# For grub-mkdevicemap.
|
||||
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
|
||||
util/devicemap.c util/misc.c
|
||||
|
||||
# For grub-emu.
|
||||
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
|
||||
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
||||
commands/configfile.c commands/help.c \
|
||||
commands/handler.c commands/ls.c commands/test.c \
|
||||
commands/search.c commands/hexdump.c lib/hexdump.c \
|
||||
commands/halt.c commands/reboot.c commands/keystatus.c \
|
||||
commands/i386/cpuid.c \
|
||||
commands/password.c \
|
||||
lib/envblk.c commands/loadenv.c \
|
||||
disk/loopback.c \
|
||||
\
|
||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
||||
\
|
||||
io/gzio.c \
|
||||
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
||||
kern/err.c kern/list.c kern/handler.c \
|
||||
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
|
||||
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
|
||||
kern/partition.c kern/reader.c kern/term.c \
|
||||
kern/rescue_reader.c kern/rescue_parser.c \
|
||||
lib/arg.c normal/cmdline.c normal/command.c normal/datetime.c \
|
||||
normal/auth.c normal/autofs.c \
|
||||
normal/completion.c normal/context.c normal/main.c \
|
||||
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
|
||||
normal/menu_text.c \
|
||||
normal/color.c \
|
||||
script/sh/main.c script/sh/execute.c script/sh/function.c \
|
||||
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
|
||||
partmap/amiga.c partmap/apple.c partmap/msdos.c partmap/sun.c \
|
||||
partmap/acorn.c partmap/gpt.c \
|
||||
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
||||
util/hostdisk.c util/getroot.c \
|
||||
\
|
||||
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
|
||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
||||
commands/parttool.c parttool/msdospart.c \
|
||||
grub_emu_init.c
|
||||
|
||||
grub_emu_LDFLAGS = $(LIBCURSES)
|
||||
|
||||
# Scripts.
|
||||
sbin_SCRIPTS = grub-install
|
||||
|
||||
|
|
@ -83,14 +30,14 @@ sbin_SCRIPTS = grub-install
|
|||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
||||
|
||||
# Modules.
|
||||
pkglib_MODULES = kernel.mod chain.mod appleldr.mod \
|
||||
pkglib_MODULES = kernel.img chain.mod appleldr.mod \
|
||||
linux.mod halt.mod reboot.mod pci.mod lspci.mod \
|
||||
datetime.mod date.mod datehook.mod loadbios.mod \
|
||||
fixvideo.mod mmap.mod acpi.mod
|
||||
|
||||
# For kernel.mod.
|
||||
kernel_mod_EXPORTS = no
|
||||
kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
|
||||
# For kernel.img.
|
||||
kernel_img_EXPORTS = no
|
||||
kernel_img_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
|
|
@ -101,22 +48,22 @@ kernel_mod_SOURCES = kern/i386/efi/startup.S kern/main.c kern/device.c \
|
|||
kern/i386/tsc.c kern/i386/pit.c \
|
||||
kern/generic/rtc_get_time_ms.c \
|
||||
kern/generic/millisleep.c
|
||||
kernel_mod_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h
|
||||
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
efi/efi.h efi/time.h efi/disk.h i386/pit.h list.h handler.h command.h i18n.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
MOSTLYCLEANFILES += symlist.c
|
||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||
DEFSYMFILES += kernel_syms.lst
|
||||
|
||||
symlist.c: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h gensymlist.sh
|
||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||
|
||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh
|
||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||
|
||||
# For boot.mod.
|
||||
|
|
@ -196,9 +143,19 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c
|
|||
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += efi_uga.mod
|
||||
efi_uga_mod_SOURCES = video/efi_uga.c
|
||||
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += efi_gop.mod
|
||||
efi_gop_mod_SOURCES = video/efi_gop.c
|
||||
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += xnu.mod
|
||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\
|
||||
loader/macho.c loader/xnu.c loader/i386/xnu_helper.S
|
||||
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
|
||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
105
conf/i386-pc.rmk
105
conf/i386-pc.rmk
|
|
@ -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
|
||||
|
||||
|
|
@ -243,8 +183,8 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += xnu.mod
|
||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c\
|
||||
loader/macho.c loader/xnu.c loader/i386/xnu_helper.S
|
||||
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
|
||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
|
@ -294,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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,11 +149,27 @@ fixvideo_mod_SOURCES = commands/efi/fixvideo.c
|
|||
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += efi_uga.mod
|
||||
efi_uga_mod_SOURCES = video/efi_uga.c
|
||||
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += efi_gop.mod
|
||||
efi_gop_mod_SOURCES = video/efi_gop.c
|
||||
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += xnu.mod
|
||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c\
|
||||
loader/macho.c loader/xnu.c loader/i386/xnu_helper.S
|
||||
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
|
||||
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
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
119
configure.ac
119
configure.ac
|
|
@ -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
|
||||
|
|
|
|||
19
disk/ata.c
19
disk/ata.c
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ grub_efi_system_table64_t *grub_efiemu_system_table64 = 0;
|
|||
static struct grub_efiemu_prepare_hook *efiemu_prepare_hooks = 0;
|
||||
/* Linked list of configuration tables */
|
||||
static struct grub_efiemu_configuration_table *efiemu_config_tables = 0;
|
||||
static int prepared = 0;
|
||||
|
||||
/* Free all allocated space */
|
||||
grub_err_t
|
||||
|
|
@ -70,6 +71,8 @@ grub_efiemu_unload (void)
|
|||
}
|
||||
efiemu_prepare_hooks = 0;
|
||||
|
||||
prepared = 0;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
|
@ -277,14 +280,19 @@ grub_efiemu_prepare (void)
|
|||
{
|
||||
grub_err_t err;
|
||||
|
||||
if (prepared)
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
grub_dprintf ("efiemu", "Preparing %d-bit efiemu\n",
|
||||
8 * grub_efiemu_sizeof_uintn_t ());
|
||||
|
||||
err = grub_efiemu_autocore ();
|
||||
|
||||
/* Create NVRAM if not yet done. */
|
||||
/* Create NVRAM. */
|
||||
grub_efiemu_pnvram ();
|
||||
|
||||
prepared = 1;
|
||||
|
||||
if (grub_efiemu_sizeof_uintn_t () == 4)
|
||||
return grub_efiemu_prepare32 (efiemu_prepare_hooks, efiemu_config_tables);
|
||||
else
|
||||
|
|
@ -316,9 +324,6 @@ grub_cmd_efiemu_load (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
static grub_command_t cmd_loadcore, cmd_prepare, cmd_unload;
|
||||
|
||||
void
|
||||
grub_efiemu_pnvram_cmd_register (void);
|
||||
|
||||
GRUB_MOD_INIT(efiemu)
|
||||
{
|
||||
cmd_loadcore = grub_register_command ("efiemu_loadcore",
|
||||
|
|
@ -332,7 +337,6 @@ GRUB_MOD_INIT(efiemu)
|
|||
cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
|
||||
"efiemu_unload",
|
||||
"Unload EFI emulator");
|
||||
grub_efiemu_pnvram_cmd_register ();
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(efiemu)
|
||||
|
|
@ -340,5 +344,4 @@ GRUB_MOD_FINI(efiemu)
|
|||
grub_unregister_command (cmd_loadcore);
|
||||
grub_unregister_command (cmd_prepare);
|
||||
grub_unregister_command (cmd_unload);
|
||||
grub_efiemu_pnvram_cmd_unregister ();
|
||||
}
|
||||
|
|
|
|||
454
efiemu/pnvram.c
454
efiemu/pnvram.c
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/normal.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/charset.h>
|
||||
#include <grub/efiemu/efiemu.h>
|
||||
#include <grub/efiemu/runtime.h>
|
||||
#include <grub/extcmd.h>
|
||||
|
|
@ -34,62 +35,184 @@ static int timezone_handle = 0;
|
|||
static int accuracy_handle = 0;
|
||||
static int daylight_handle = 0;
|
||||
|
||||
/* Temporary place */
|
||||
static grub_uint8_t *nvram;
|
||||
static grub_size_t nvramsize;
|
||||
static grub_uint32_t high_monotonic_count;
|
||||
static grub_int16_t timezone;
|
||||
static grub_uint8_t daylight;
|
||||
static grub_uint32_t accuracy;
|
||||
|
||||
static const struct grub_arg_option options[] = {
|
||||
{"size", 's', 0, "number of bytes to reserve for pseudo NVRAM", 0,
|
||||
ARG_TYPE_INT},
|
||||
{"high-monotonic-count", 'm', 0,
|
||||
"Initial value of high monotonic count", 0, ARG_TYPE_INT},
|
||||
{"timezone", 't', 0,
|
||||
"Timezone, offset in minutes from GMT", 0, ARG_TYPE_INT},
|
||||
{"accuracy", 'a', 0,
|
||||
"Accuracy of clock, in 1e-12 units", 0, ARG_TYPE_INT},
|
||||
{"daylight", 'd', 0,
|
||||
"Daylight value, as per EFI specifications", 0, ARG_TYPE_INT},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/* Parse signed value */
|
||||
static int
|
||||
grub_strtosl (char *arg, char **end, int base)
|
||||
grub_strtosl (const char *arg, char **end, int base)
|
||||
{
|
||||
if (arg[0] == '-')
|
||||
return -grub_strtoul (arg + 1, end, base);
|
||||
return grub_strtoul (arg, end, base);
|
||||
}
|
||||
|
||||
static inline int
|
||||
hextoval (char c)
|
||||
{
|
||||
if (c >= '0' && c <= '9')
|
||||
return c - '0';
|
||||
if (c >= 'a' && c <= 'z')
|
||||
return c - 'a' + 10;
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
return c - 'A' + 10;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline grub_err_t
|
||||
unescape (char *in, char *out, char *outmax, int *len)
|
||||
{
|
||||
char *ptr, *dptr;
|
||||
dptr = out;
|
||||
for (ptr = in; *ptr && dptr < outmax; )
|
||||
if (*ptr == '%' && ptr[1] && ptr[2])
|
||||
{
|
||||
*dptr = (hextoval (ptr[1]) << 4) | (hextoval (ptr[2]));
|
||||
ptr += 3;
|
||||
dptr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dptr = *ptr;
|
||||
ptr++;
|
||||
dptr++;
|
||||
}
|
||||
if (dptr == outmax)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"Too many NVRAM variables for reserved variable space."
|
||||
" Try increasing EfiEmu.pnvram.size.");
|
||||
*len = dptr - out;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Export stuff for efiemu */
|
||||
static grub_err_t
|
||||
nvram_set (void * data __attribute__ ((unused)))
|
||||
{
|
||||
const char *env;
|
||||
/* Take definitive pointers */
|
||||
grub_uint8_t *nvram_def = grub_efiemu_mm_obtain_request (nvram_handle);
|
||||
char *nvram = grub_efiemu_mm_obtain_request (nvram_handle);
|
||||
grub_uint32_t *nvramsize_def
|
||||
= grub_efiemu_mm_obtain_request (nvramsize_handle);
|
||||
grub_uint32_t *high_monotonic_count_def
|
||||
grub_uint32_t *high_monotonic_count
|
||||
= grub_efiemu_mm_obtain_request (high_monotonic_count_handle);
|
||||
grub_int16_t *timezone_def
|
||||
grub_int16_t *timezone
|
||||
= grub_efiemu_mm_obtain_request (timezone_handle);
|
||||
grub_uint8_t *daylight_def
|
||||
grub_uint8_t *daylight
|
||||
= grub_efiemu_mm_obtain_request (daylight_handle);
|
||||
grub_uint32_t *accuracy_def
|
||||
grub_uint32_t *accuracy
|
||||
= grub_efiemu_mm_obtain_request (accuracy_handle);
|
||||
char *nvramptr;
|
||||
|
||||
auto int iterate_env (struct grub_env_var *var);
|
||||
int iterate_env (struct grub_env_var *var)
|
||||
{
|
||||
char *guid, *attr, *name, *varname;
|
||||
struct efi_variable *efivar;
|
||||
int len = 0;
|
||||
int i;
|
||||
grub_uint64_t guidcomp;
|
||||
|
||||
if (grub_memcmp (var->name, "EfiEmu.pnvram.",
|
||||
sizeof ("EfiEmu.pnvram.") - 1) != 0)
|
||||
return 0;
|
||||
|
||||
guid = var->name + sizeof ("EfiEmu.pnvram.") - 1;
|
||||
|
||||
attr = grub_strchr (guid, '.');
|
||||
if (!attr)
|
||||
return 0;
|
||||
attr++;
|
||||
|
||||
name = grub_strchr (attr, '.');
|
||||
if (!name)
|
||||
return 0;
|
||||
name++;
|
||||
|
||||
efivar = (struct efi_variable *) nvramptr;
|
||||
if (nvramptr - nvram + sizeof (struct efi_variable) > nvramsize)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"Too many NVRAM variables for reserved variable space."
|
||||
" Try increasing EfiEmu.pnvram.size.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
nvramptr += sizeof (struct efi_variable);
|
||||
|
||||
efivar->guid.data1 = grub_cpu_to_le32 (grub_strtoul (guid, &guid, 16));
|
||||
if (*guid != '-')
|
||||
return 0;
|
||||
guid++;
|
||||
|
||||
efivar->guid.data2 = grub_cpu_to_le16 (grub_strtoul (guid, &guid, 16));
|
||||
if (*guid != '-')
|
||||
return 0;
|
||||
guid++;
|
||||
|
||||
efivar->guid.data3 = grub_cpu_to_le16 (grub_strtoul (guid, &guid, 16));
|
||||
if (*guid != '-')
|
||||
return 0;
|
||||
guid++;
|
||||
|
||||
guidcomp = grub_strtoull (guid, 0, 16);
|
||||
for (i = 0; i < 8; i++)
|
||||
efivar->guid.data4[i] = (guidcomp >> (56 - 8 * i)) & 0xff;
|
||||
|
||||
efivar->attributes = grub_strtoull (attr, 0, 16);
|
||||
|
||||
varname = grub_malloc (grub_strlen (name) + 1);
|
||||
if (! varname)
|
||||
return 1;
|
||||
|
||||
if (unescape (name, varname, varname + grub_strlen (name) + 1, &len))
|
||||
return 1;
|
||||
|
||||
len = grub_utf8_to_utf16 ((grub_uint16_t *) nvramptr,
|
||||
(nvramsize - (nvramptr - nvram)) / 2,
|
||||
(grub_uint8_t *) varname, len, NULL);
|
||||
|
||||
if (len < 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Broken UTF-8 in variable name\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
nvramptr += 2 * len;
|
||||
*((grub_uint16_t *) nvramptr) = 0;
|
||||
nvramptr += 2;
|
||||
efivar->namelen = 2 * len + 2;
|
||||
|
||||
if (unescape (var->value, nvramptr, nvram + nvramsize, &len))
|
||||
{
|
||||
efivar->namelen = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
nvramptr += len;
|
||||
|
||||
efivar->size = len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Copy to definitive loaction */
|
||||
grub_dprintf ("efiemu", "preparing pnvram\n");
|
||||
grub_memcpy (nvram_def, nvram, nvramsize);
|
||||
|
||||
env = grub_env_get ("EfiEmu.pnvram.high_monotonic_count");
|
||||
*high_monotonic_count = env ? grub_strtoul (env, 0, 0) : 1;
|
||||
env = grub_env_get ("EfiEmu.pnvram.timezone");
|
||||
*timezone = env ? grub_strtosl (env, 0, 0) : GRUB_EFI_UNSPECIFIED_TIMEZONE;
|
||||
env = grub_env_get ("EfiEmu.pnvram.accuracy");
|
||||
*accuracy = env ? grub_strtoul (env, 0, 0) : 50000000;
|
||||
env = grub_env_get ("EfiEmu.pnvram.daylight");
|
||||
*daylight = env ? grub_strtoul (env, 0, 0) : 0;
|
||||
|
||||
nvramptr = nvram;
|
||||
grub_memset (nvram, 0, nvramsize);
|
||||
grub_env_iterate (iterate_env);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
*nvramsize_def = nvramsize;
|
||||
*high_monotonic_count_def = high_monotonic_count;
|
||||
*timezone_def = timezone;
|
||||
*daylight_def = daylight;
|
||||
*accuracy_def = accuracy;
|
||||
|
||||
/* Register symbols */
|
||||
grub_efiemu_register_symbol ("efiemu_variables", nvram_handle, 0);
|
||||
|
|
@ -113,197 +236,27 @@ nvram_unload (void * data __attribute__ ((unused)))
|
|||
grub_efiemu_mm_return_request (timezone_handle);
|
||||
grub_efiemu_mm_return_request (accuracy_handle);
|
||||
grub_efiemu_mm_return_request (daylight_handle);
|
||||
|
||||
grub_free (nvram);
|
||||
nvram = 0;
|
||||
}
|
||||
|
||||
/* Load the variables file It's in format
|
||||
guid1:attr1:name1:data1;
|
||||
guid2:attr2:name2:data2;
|
||||
...
|
||||
Where all fields are in hex
|
||||
*/
|
||||
static grub_err_t
|
||||
read_pnvram (char *filename)
|
||||
{
|
||||
char *buf, *ptr, *ptr2;
|
||||
grub_file_t file;
|
||||
grub_size_t size;
|
||||
grub_uint8_t *nvramptr = nvram;
|
||||
struct efi_variable *efivar;
|
||||
grub_size_t guidlen, datalen;
|
||||
unsigned i, j;
|
||||
|
||||
file = grub_file_open (filename);
|
||||
if (!file)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "couldn't read pnvram");
|
||||
size = grub_file_size (file);
|
||||
buf = grub_malloc (size + 1);
|
||||
if (!buf)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't read pnvram");
|
||||
if (grub_file_read (file, buf, size) != (grub_ssize_t) size)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "couldn't read pnvram");
|
||||
buf[size] = 0;
|
||||
grub_file_close (file);
|
||||
|
||||
for (ptr = buf; *ptr; )
|
||||
{
|
||||
if (grub_isspace (*ptr))
|
||||
{
|
||||
ptr++;
|
||||
continue;
|
||||
}
|
||||
|
||||
efivar = (struct efi_variable *) nvramptr;
|
||||
if (nvramptr - nvram + sizeof (struct efi_variable) > nvramsize)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"file is too large for reserved variable space");
|
||||
|
||||
nvramptr += sizeof (struct efi_variable);
|
||||
|
||||
/* look ahow long guid field is*/
|
||||
guidlen = 0;
|
||||
for (ptr2 = ptr; (grub_isspace (*ptr2)
|
||||
|| (*ptr2 >= '0' && *ptr2 <= '9')
|
||||
|| (*ptr2 >= 'a' && *ptr2 <= 'f')
|
||||
|| (*ptr2 >= 'A' && *ptr2 <= 'F'));
|
||||
ptr2++)
|
||||
if (!grub_isspace (*ptr2))
|
||||
guidlen++;
|
||||
guidlen /= 2;
|
||||
|
||||
/* Read guid */
|
||||
if (guidlen != sizeof (efivar->guid))
|
||||
{
|
||||
grub_free (buf);
|
||||
return grub_error (GRUB_ERR_BAD_OS, "can't parse %s", filename);
|
||||
}
|
||||
for (i = 0; i < 2 * sizeof (efivar->guid); i++)
|
||||
{
|
||||
int hex = 0;
|
||||
while (grub_isspace (*ptr))
|
||||
ptr++;
|
||||
if (*ptr >= '0' && *ptr <= '9')
|
||||
hex = *ptr - '0';
|
||||
if (*ptr >= 'a' && *ptr <= 'f')
|
||||
hex = *ptr - 'a' + 10;
|
||||
if (*ptr >= 'A' && *ptr <= 'F')
|
||||
hex = *ptr - 'A' + 10;
|
||||
|
||||
if (i%2 == 0)
|
||||
((grub_uint8_t *)&(efivar->guid))[i/2] = hex << 4;
|
||||
else
|
||||
((grub_uint8_t *)&(efivar->guid))[i/2] |= hex;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
while (grub_isspace (*ptr))
|
||||
ptr++;
|
||||
if (*ptr != ':')
|
||||
{
|
||||
grub_dprintf ("efiemu", "Not colon\n");
|
||||
grub_free (buf);
|
||||
return grub_error (GRUB_ERR_BAD_OS, "can't parse %s", filename);
|
||||
}
|
||||
ptr++;
|
||||
while (grub_isspace (*ptr))
|
||||
ptr++;
|
||||
|
||||
/* Attributes can be just parsed by existing functions */
|
||||
efivar->attributes = grub_strtoul (ptr, &ptr, 16);
|
||||
|
||||
while (grub_isspace (*ptr))
|
||||
ptr++;
|
||||
if (*ptr != ':')
|
||||
{
|
||||
grub_dprintf ("efiemu", "Not colon\n");
|
||||
grub_free (buf);
|
||||
return grub_error (GRUB_ERR_BAD_OS, "can't parse %s", filename);
|
||||
}
|
||||
ptr++;
|
||||
while (grub_isspace (*ptr))
|
||||
ptr++;
|
||||
|
||||
/* Read name and value */
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
/* Look the length */
|
||||
datalen = 0;
|
||||
for (ptr2 = ptr; *ptr2 && (grub_isspace (*ptr2)
|
||||
|| (*ptr2 >= '0' && *ptr2 <= '9')
|
||||
|| (*ptr2 >= 'a' && *ptr2 <= 'f')
|
||||
|| (*ptr2 >= 'A' && *ptr2 <= 'F'));
|
||||
ptr2++)
|
||||
if (!grub_isspace (*ptr2))
|
||||
datalen++;
|
||||
datalen /= 2;
|
||||
|
||||
if (nvramptr - nvram + datalen > nvramsize)
|
||||
{
|
||||
grub_free (buf);
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"file is too large for reserved "
|
||||
" variable space");
|
||||
}
|
||||
|
||||
for (i = 0; i < 2 * datalen; i++)
|
||||
{
|
||||
int hex = 0;
|
||||
while (grub_isspace (*ptr))
|
||||
ptr++;
|
||||
if (*ptr >= '0' && *ptr <= '9')
|
||||
hex = *ptr - '0';
|
||||
if (*ptr >= 'a' && *ptr <= 'f')
|
||||
hex = *ptr - 'a' + 10;
|
||||
if (*ptr >= 'A' && *ptr <= 'F')
|
||||
hex = *ptr - 'A' + 10;
|
||||
|
||||
if (i%2 == 0)
|
||||
nvramptr[i/2] = hex << 4;
|
||||
else
|
||||
nvramptr[i/2] |= hex;
|
||||
ptr++;
|
||||
}
|
||||
nvramptr += datalen;
|
||||
while (grub_isspace (*ptr))
|
||||
ptr++;
|
||||
if (*ptr != (j ? ';' : ':'))
|
||||
{
|
||||
grub_free (buf);
|
||||
grub_dprintf ("efiemu", j?"Not semicolon\n":"Not colon\n");
|
||||
return grub_error (GRUB_ERR_BAD_OS, "can't parse %s", filename);
|
||||
}
|
||||
if (j)
|
||||
efivar->size = datalen;
|
||||
else
|
||||
efivar->namelen = datalen;
|
||||
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
grub_free (buf);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_efiemu_make_nvram (void)
|
||||
grub_err_t
|
||||
grub_efiemu_pnvram (void)
|
||||
{
|
||||
const char *size;
|
||||
grub_err_t err;
|
||||
|
||||
err = grub_efiemu_autocore ();
|
||||
if (err)
|
||||
{
|
||||
grub_free (nvram);
|
||||
return err;
|
||||
}
|
||||
nvramsize = 0;
|
||||
|
||||
size = grub_env_get ("EfiEmu.pnvram.size");
|
||||
if (size)
|
||||
nvramsize = grub_strtoul (size, 0, 0);
|
||||
|
||||
if (!nvramsize)
|
||||
nvramsize = 2048;
|
||||
|
||||
err = grub_efiemu_register_prepare_hook (nvram_set, nvram_unload, 0);
|
||||
if (err)
|
||||
{
|
||||
grub_free (nvram);
|
||||
return err;
|
||||
}
|
||||
return err;
|
||||
|
||||
nvram_handle
|
||||
= grub_efiemu_request_memalign (1, nvramsize,
|
||||
GRUB_EFI_RUNTIME_SERVICES_DATA);
|
||||
|
|
@ -323,78 +276,5 @@ grub_efiemu_make_nvram (void)
|
|||
= grub_efiemu_request_memalign (1, sizeof (grub_uint32_t),
|
||||
GRUB_EFI_RUNTIME_SERVICES_DATA);
|
||||
|
||||
grub_efiemu_request_symbols (6);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_efiemu_pnvram (void)
|
||||
{
|
||||
if (nvram)
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
nvramsize = 2048;
|
||||
high_monotonic_count = 1;
|
||||
timezone = GRUB_EFI_UNSPECIFIED_TIMEZONE;
|
||||
accuracy = 50000000;
|
||||
daylight = 0;
|
||||
|
||||
nvram = grub_zalloc (nvramsize);
|
||||
if (!nvram)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"Couldn't allocate space for temporary pnvram storage");
|
||||
|
||||
return grub_efiemu_make_nvram ();
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_efiemu_pnvram (struct grub_extcmd *cmd,
|
||||
int argc, char **args)
|
||||
{
|
||||
struct grub_arg_list *state = cmd->state;
|
||||
grub_err_t err;
|
||||
|
||||
if (argc > 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "only one argument expected");
|
||||
|
||||
nvramsize = state[0].set ? grub_strtoul (state[0].arg, 0, 0) : 2048;
|
||||
high_monotonic_count = state[1].set ? grub_strtoul (state[1].arg, 0, 0) : 1;
|
||||
timezone = state[2].set ? grub_strtosl (state[2].arg, 0, 0)
|
||||
: GRUB_EFI_UNSPECIFIED_TIMEZONE;
|
||||
accuracy = state[3].set ? grub_strtoul (state[3].arg, 0, 0) : 50000000;
|
||||
daylight = state[4].set ? grub_strtoul (state[4].arg, 0, 0) : 0;
|
||||
|
||||
nvram = grub_zalloc (nvramsize);
|
||||
if (!nvram)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"Couldn't allocate space for temporary pnvram storage");
|
||||
|
||||
if (argc == 1 && (err = read_pnvram (args[0])))
|
||||
{
|
||||
grub_free (nvram);
|
||||
return err;
|
||||
}
|
||||
return grub_efiemu_make_nvram ();
|
||||
}
|
||||
|
||||
static grub_extcmd_t cmd;
|
||||
|
||||
void grub_efiemu_pnvram_cmd_register (void);
|
||||
void grub_efiemu_pnvram_cmd_unregister (void);
|
||||
|
||||
void
|
||||
grub_efiemu_pnvram_cmd_register (void)
|
||||
{
|
||||
cmd = grub_register_extcmd ("efiemu_pnvram", grub_cmd_efiemu_pnvram,
|
||||
GRUB_COMMAND_FLAG_BOTH,
|
||||
"efiemu_pnvram [FILENAME]",
|
||||
"Initialise pseudo-NVRAM and load variables "
|
||||
"from FILE",
|
||||
options);
|
||||
}
|
||||
|
||||
void
|
||||
grub_efiemu_pnvram_cmd_unregister (void)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ SUFFIX (grub_efiemu_prepare) (struct grub_efiemu_prepare_hook *prepare_hooks,
|
|||
|
||||
int cntconftables = 0;
|
||||
struct SUFFIX (grub_efiemu_configuration_table) *conftables = 0;
|
||||
struct SUFFIX (grub_efiemu_runtime_services) *runtime_services;
|
||||
int i;
|
||||
int handle;
|
||||
grub_off_t off;
|
||||
|
|
@ -54,6 +53,7 @@ SUFFIX (grub_efiemu_prepare) (struct grub_efiemu_prepare_hook *prepare_hooks,
|
|||
/* Switch from phase 1 (counting) to phase 2 (real job) */
|
||||
grub_efiemu_alloc_syms ();
|
||||
grub_efiemu_mm_do_alloc ();
|
||||
grub_efiemu_write_sym_markers ();
|
||||
|
||||
grub_efiemu_system_table32 = 0;
|
||||
grub_efiemu_system_table64 = 0;
|
||||
|
|
@ -81,16 +81,6 @@ SUFFIX (grub_efiemu_prepare) (struct grub_efiemu_prepare_hook *prepare_hooks,
|
|||
= (struct SUFFIX (grub_efi_system_table) *)
|
||||
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
|
||||
|
||||
/* compute CRC32 of runtime_services */
|
||||
if ((err = grub_efiemu_resolve_symbol ("efiemu_runtime_services",
|
||||
&handle, &off)))
|
||||
return err;
|
||||
runtime_services = (struct SUFFIX (grub_efiemu_runtime_services) *)
|
||||
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
|
||||
runtime_services->hdr.crc32 = 0;
|
||||
runtime_services->hdr.crc32 = grub_getcrc32
|
||||
(0, runtime_services, runtime_services->hdr.header_size);
|
||||
|
||||
/* Put pointer to the list of configuration tables in system table */
|
||||
grub_efiemu_write_value
|
||||
(&(SUFFIX (grub_efiemu_system_table)->configuration_table), 0,
|
||||
|
|
@ -113,16 +103,51 @@ SUFFIX (grub_efiemu_prepare) (struct grub_efiemu_prepare_hook *prepare_hooks,
|
|||
conftables[i].vendor_table = PTR_TO_UINT64 (cur->data);
|
||||
}
|
||||
|
||||
err = SUFFIX (grub_efiemu_crc) ();
|
||||
if (err)
|
||||
{
|
||||
grub_efiemu_unload ();
|
||||
return err;
|
||||
}
|
||||
|
||||
grub_dprintf ("efiemu","system_table = %p, conftables = %p (%d entries)\n",
|
||||
SUFFIX (grub_efiemu_system_table), conftables, cntconftables);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
SUFFIX (grub_efiemu_crc) (void)
|
||||
{
|
||||
grub_err_t err;
|
||||
int handle;
|
||||
grub_off_t off;
|
||||
struct SUFFIX (grub_efiemu_runtime_services) *runtime_services;
|
||||
|
||||
/* compute CRC32 of runtime_services */
|
||||
err = grub_efiemu_resolve_symbol ("efiemu_runtime_services",
|
||||
&handle, &off);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
runtime_services = (struct SUFFIX (grub_efiemu_runtime_services) *)
|
||||
((grub_uint8_t *) grub_efiemu_mm_obtain_request (handle) + off);
|
||||
runtime_services->hdr.crc32 = 0;
|
||||
runtime_services->hdr.crc32 = grub_getcrc32
|
||||
(0, runtime_services, runtime_services->hdr.header_size);
|
||||
|
||||
err = grub_efiemu_resolve_symbol ("efiemu_system_table", &handle, &off);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* compute CRC32 of system table */
|
||||
SUFFIX (grub_efiemu_system_table)->hdr.crc32 = 0;
|
||||
SUFFIX (grub_efiemu_system_table)->hdr.crc32
|
||||
= grub_getcrc32 (0, SUFFIX (grub_efiemu_system_table),
|
||||
SUFFIX (grub_efiemu_system_table)->hdr.header_size);
|
||||
|
||||
grub_dprintf ("efiemu","system_table = %p, runtime_services = %p,"
|
||||
" conftables = %p (%d entries)\n",
|
||||
SUFFIX (grub_efiemu_system_table), runtime_services,
|
||||
conftables, cntconftables);
|
||||
grub_dprintf ("efiemu","system_table = %p, runtime_services = %p\n",
|
||||
SUFFIX (grub_efiemu_system_table), runtime_services);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,9 +111,8 @@ static grub_uint8_t loge[1000] = "EFIEMULOG";
|
|||
static int logn = 9;
|
||||
#define LOG(x) { if (logn<900) loge[logn++]=x; }
|
||||
|
||||
static int ptv_relocated = 0;
|
||||
|
||||
/* Interface with grub */
|
||||
extern grub_uint8_t efiemu_ptv_relocated;
|
||||
struct grub_efi_runtime_services efiemu_runtime_services;
|
||||
struct grub_efi_system_table efiemu_system_table;
|
||||
extern struct grub_efiemu_ptv_rel efiemu_ptv_relloc[];
|
||||
|
|
@ -343,9 +342,9 @@ grub_efi_status_t EFI_FUNC
|
|||
LOG ('e');
|
||||
|
||||
/* Ensure that we are called only once */
|
||||
if (ptv_relocated)
|
||||
if (efiemu_ptv_relocated)
|
||||
return GRUB_EFI_UNSUPPORTED;
|
||||
ptv_relocated = 1;
|
||||
efiemu_ptv_relocated = 1;
|
||||
|
||||
/* Correct addresses using information supplied by grub */
|
||||
for (cur_relloc = efiemu_ptv_relloc; cur_relloc->size;cur_relloc++)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
static int ptv_written = 0;
|
||||
static int ptv_alloc = 0;
|
||||
static int ptv_handle = 0;
|
||||
static int relocated_handle = 0;
|
||||
static int ptv_requested = 0;
|
||||
static struct grub_efiemu_sym *efiemu_syms = 0;
|
||||
|
||||
|
|
@ -54,6 +55,8 @@ grub_efiemu_free_syms (void)
|
|||
ptv_requested = 0;
|
||||
grub_efiemu_mm_return_request (ptv_handle);
|
||||
ptv_handle = 0;
|
||||
grub_efiemu_mm_return_request (relocated_handle);
|
||||
relocated_handle = 0;
|
||||
}
|
||||
|
||||
/* Announce that the module will need NUM allocators */
|
||||
|
|
@ -114,10 +117,26 @@ grub_efiemu_alloc_syms (void)
|
|||
ptv_handle = grub_efiemu_request_memalign
|
||||
(1, (ptv_requested + 1) * sizeof (struct grub_efiemu_ptv_rel),
|
||||
GRUB_EFI_RUNTIME_SERVICES_DATA);
|
||||
relocated_handle = grub_efiemu_request_memalign
|
||||
(1, sizeof (grub_uint8_t), GRUB_EFI_RUNTIME_SERVICES_DATA);
|
||||
|
||||
grub_efiemu_register_symbol ("efiemu_ptv_relocated", relocated_handle, 0);
|
||||
grub_efiemu_register_symbol ("efiemu_ptv_relloc", ptv_handle, 0);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_efiemu_write_sym_markers (void)
|
||||
{
|
||||
struct grub_efiemu_ptv_rel *ptv_rels
|
||||
= grub_efiemu_mm_obtain_request (ptv_handle);
|
||||
grub_uint8_t *relocated = grub_efiemu_mm_obtain_request (relocated_handle);
|
||||
grub_memset (ptv_rels, 0, (ptv_requested + 1)
|
||||
* sizeof (struct grub_efiemu_ptv_rel));
|
||||
*relocated = 0;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
/* Write value (pointer to memory PLUS_HANDLE)
|
||||
- (pointer to memory MINUS_HANDLE) + VALUE to ADDR assuming that the
|
||||
size SIZE bytes. If PTV_NEEDED is 1 then announce it to runtime that this
|
||||
|
|
@ -186,3 +205,67 @@ grub_efiemu_write_value (void *addr, grub_uint32_t value, int plus_handle,
|
|||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_efiemu_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
|
||||
grub_efi_uintn_t descriptor_size,
|
||||
grub_efi_uint32_t descriptor_version
|
||||
__attribute__ ((unused)),
|
||||
grub_efi_memory_descriptor_t *virtual_map)
|
||||
{
|
||||
grub_uint8_t *ptv_relocated;
|
||||
struct grub_efiemu_ptv_rel *cur_relloc;
|
||||
struct grub_efiemu_ptv_rel *ptv_rels;
|
||||
|
||||
ptv_relocated = grub_efiemu_mm_obtain_request (relocated_handle);
|
||||
ptv_rels = grub_efiemu_mm_obtain_request (ptv_handle);
|
||||
|
||||
/* Ensure that we are called only once */
|
||||
if (*ptv_relocated)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "EfiEmu is already relocated.");
|
||||
*ptv_relocated = 1;
|
||||
|
||||
/* Correct addresses using information supplied by grub */
|
||||
for (cur_relloc = ptv_rels; cur_relloc->size; cur_relloc++)
|
||||
{
|
||||
grub_int64_t corr = 0;
|
||||
grub_efi_memory_descriptor_t *descptr;
|
||||
|
||||
/* Compute correction */
|
||||
for (descptr = virtual_map;
|
||||
(grub_size_t) ((grub_uint8_t *) descptr
|
||||
- (grub_uint8_t *) virtual_map) < memory_map_size;
|
||||
descptr = (grub_efi_memory_descriptor_t *)
|
||||
((grub_uint8_t *) descptr + descriptor_size))
|
||||
{
|
||||
if (descptr->type == cur_relloc->plustype)
|
||||
corr += descptr->virtual_start - descptr->physical_start;
|
||||
if (descptr->type == cur_relloc->minustype)
|
||||
corr -= descptr->virtual_start - descptr->physical_start;
|
||||
}
|
||||
|
||||
/* Apply correction */
|
||||
switch (cur_relloc->size)
|
||||
{
|
||||
case 8:
|
||||
*((grub_uint64_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
|
||||
break;
|
||||
case 4:
|
||||
*((grub_uint32_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
|
||||
break;
|
||||
case 2:
|
||||
*((grub_uint16_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
|
||||
break;
|
||||
case 1:
|
||||
*((grub_uint8_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Recompute crc32 of system table and runtime services */
|
||||
|
||||
if (grub_efiemu_sizeof_uintn_t () == 4)
|
||||
return grub_efiemu_crc32 ();
|
||||
else
|
||||
return grub_efiemu_crc64 ();
|
||||
}
|
||||
|
|
|
|||
1
fs/fat.c
1
fs/fat.c
|
|
@ -25,6 +25,7 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/charset.h>
|
||||
|
||||
#define GRUB_FAT_DIR_ENTRY_SIZE 32
|
||||
|
||||
|
|
|
|||
26
fs/hfs.c
26
fs/hfs.c
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/fshelp.h>
|
||||
#include <grub/hfs.h>
|
||||
#include <grub/charset.h>
|
||||
|
||||
#define GRUB_HFSPLUS_MAGIC 0x482B
|
||||
#define GRUB_HFSPLUSX_MAGIC 0x4858
|
||||
|
|
|
|||
|
|
@ -107,9 +107,11 @@ static struct grub_disk_dev grub_pxe_dev =
|
|||
};
|
||||
|
||||
static grub_err_t
|
||||
grub_pxefs_dir (grub_device_t device UNUSED, const char *path UNUSED,
|
||||
grub_pxefs_dir (grub_device_t device __attribute__ ((unused)),
|
||||
const char *path __attribute__ ((unused)),
|
||||
int (*hook) (const char *filename,
|
||||
const struct grub_dirhook_info *info) UNUSED)
|
||||
const struct grub_dirhook_info *info)
|
||||
__attribute__ ((unused)))
|
||||
{
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
@ -150,7 +152,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));
|
||||
|
|
@ -205,13 +207,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;
|
||||
}
|
||||
|
|
@ -219,7 +222,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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/fshelp.h>
|
||||
#include <grub/charset.h>
|
||||
|
||||
#define GRUB_ISO9660_FSTYPE_DIR 0040000
|
||||
#define GRUB_ISO9660_FSTYPE_REG 0100000
|
||||
|
|
|
|||
1
fs/jfs.c
1
fs/jfs.c
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/charset.h>
|
||||
|
||||
#define GRUB_JFS_MAX_SYMLNK_CNT 8
|
||||
#define GRUB_JFS_FILETYPE_MASK 0170000
|
||||
|
|
|
|||
52
fs/ntfs.c
52
fs/ntfs.c
|
|
@ -24,6 +24,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/fshelp.h>
|
||||
#include <grub/ntfs.h>
|
||||
#include <grub/charset.h>
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
|
|
@ -63,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
|
||||
|
|
@ -72,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
|
||||
|
|
@ -260,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;
|
||||
|
|
@ -284,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;
|
||||
|
|
@ -335,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)
|
||||
|
|
@ -388,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)
|
||||
|
|
@ -411,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;
|
||||
|
|
@ -427,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)
|
||||
|
|
@ -462,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))
|
||||
|
|
@ -479,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)
|
||||
{
|
||||
|
|
@ -508,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");
|
||||
|
|
@ -640,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;
|
||||
|
|
@ -744,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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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' \
|
||||
|
|
|
|||
|
|
@ -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;}' \
|
||||
|
|
|
|||
9
genmk.rb
9
genmk.rb
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;}' \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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 */
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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 */
|
||||
|
|
@ -19,10 +19,11 @@
|
|||
#define GRUB_AUTH_HEADER 1
|
||||
|
||||
#include <grub/err.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
/* Macros for indistinguishibility. */
|
||||
#define GRUB_ACCESS_DENIED grub_error (GRUB_ERR_ACCESS_DENIED, "Access denied.")
|
||||
#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get ("Enter password: ", \
|
||||
#define GRUB_GET_PASSWORD(string, len) grub_cmdline_get (N_("Enter password:"), \
|
||||
string, len, \
|
||||
'*', 0, 0)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,14 +21,15 @@
|
|||
#ifndef GRUB_AUTOEFI_HEADER
|
||||
#define GRUB_AUTOEFI_HEADER 1
|
||||
|
||||
#include <grub/machine/machine.h>
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
# include <grub/efi/efi.h>
|
||||
# define grub_autoefi_get_memory_map grub_efi_get_memory_map
|
||||
# define grub_autoefi_finish_boot_services grub_efi_finish_boot_services
|
||||
# define grub_autoefi_exit_boot_services grub_efi_exit_boot_services
|
||||
# define grub_autoefi_system_table grub_efi_system_table
|
||||
# define grub_autoefi_mmap_iterate grub_machine_mmap_iterate
|
||||
# define grub_autoefi_set_virtual_address_map grub_efi_set_virtual_address_map
|
||||
static inline grub_err_t grub_autoefi_prepare (void)
|
||||
{
|
||||
return GRUB_ERR_NONE;
|
||||
|
|
@ -54,9 +55,11 @@ static inline grub_err_t grub_autoefi_prepare (void)
|
|||
# include <grub/efiemu/efiemu.h>
|
||||
# define grub_autoefi_get_memory_map grub_efiemu_get_memory_map
|
||||
# define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services
|
||||
# define grub_autoefi_exit_boot_services grub_efiemu_exit_boot_services
|
||||
# define grub_autoefi_system_table grub_efiemu_system_table
|
||||
# define grub_autoefi_mmap_iterate grub_efiemu_mmap_iterate
|
||||
# define grub_autoefi_prepare grub_efiemu_prepare
|
||||
# define grub_autoefi_set_virtual_address_map grub_efiemu_set_virtual_address_map
|
||||
# define GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_EFIEMU_MEMORY_AVAILABLE
|
||||
# define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_EFIEMU_MEMORY_RESERVED
|
||||
# define GRUB_AUTOEFI_MEMORY_ACPI GRUB_EFIEMU_MEMORY_ACPI
|
||||
|
|
|
|||
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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_CHARSET_HEADER
|
||||
#define GRUB_CHARSET_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
|
||||
#define GRUB_UINT8_1_LEADINGBIT 0x80
|
||||
#define GRUB_UINT8_2_LEADINGBITS 0xc0
|
||||
#define GRUB_UINT8_3_LEADINGBITS 0xe0
|
||||
#define GRUB_UINT8_4_LEADINGBITS 0xf0
|
||||
#define GRUB_UINT8_5_LEADINGBITS 0xf8
|
||||
#define GRUB_UINT8_6_LEADINGBITS 0xfc
|
||||
#define GRUB_UINT8_7_LEADINGBITS 0xfe
|
||||
|
||||
#define GRUB_UINT8_1_TRAILINGBIT 0x01
|
||||
#define GRUB_UINT8_2_TRAILINGBITS 0x03
|
||||
#define GRUB_UINT8_3_TRAILINGBITS 0x07
|
||||
#define GRUB_UINT8_4_TRAILINGBITS 0x0f
|
||||
#define GRUB_UINT8_5_TRAILINGBITS 0x1f
|
||||
#define GRUB_UINT8_6_TRAILINGBITS 0x3f
|
||||
|
||||
#define GRUB_UCS2_LIMIT 0x10000
|
||||
#define GRUB_UTF16_UPPER_SURROGATE(code) \
|
||||
(0xD800 + ((((code) - GRUB_UCS2_LIMIT) >> 12) & 0xfff))
|
||||
#define GRUB_UTF16_LOWER_SURROGATE(code) \
|
||||
(0xDC00 + (((code) - GRUB_UCS2_LIMIT) & 0xfff))
|
||||
|
||||
grub_ssize_t
|
||||
grub_utf8_to_utf16 (grub_uint16_t *dest, grub_size_t destsize,
|
||||
const grub_uint8_t *src, grub_size_t srcsize,
|
||||
const grub_uint8_t **srcend);
|
||||
|
||||
/* Convert UTF-16 to UTF-8. */
|
||||
static inline grub_uint8_t *
|
||||
grub_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src,
|
||||
grub_size_t size)
|
||||
{
|
||||
grub_uint32_t code_high = 0;
|
||||
|
||||
while (size--)
|
||||
{
|
||||
grub_uint32_t code = *src++;
|
||||
|
||||
if (code_high)
|
||||
{
|
||||
if (code >= 0xDC00 && code <= 0xDFFF)
|
||||
{
|
||||
/* Surrogate pair. */
|
||||
code = ((code_high - 0xD800) << 12) + (code - 0xDC00) + 0x10000;
|
||||
|
||||
*dest++ = (code >> 18) | 0xF0;
|
||||
*dest++ = ((code >> 12) & 0x3F) | 0x80;
|
||||
*dest++ = ((code >> 6) & 0x3F) | 0x80;
|
||||
*dest++ = (code & 0x3F) | 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Error... */
|
||||
*dest++ = '?';
|
||||
}
|
||||
|
||||
code_high = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (code <= 0x007F)
|
||||
*dest++ = code;
|
||||
else if (code <= 0x07FF)
|
||||
{
|
||||
*dest++ = (code >> 6) | 0xC0;
|
||||
*dest++ = (code & 0x3F) | 0x80;
|
||||
}
|
||||
else if (code >= 0xD800 && code <= 0xDBFF)
|
||||
{
|
||||
code_high = code;
|
||||
continue;
|
||||
}
|
||||
else if (code >= 0xDC00 && code <= 0xDFFF)
|
||||
{
|
||||
/* Error... */
|
||||
*dest++ = '?';
|
||||
}
|
||||
else
|
||||
{
|
||||
*dest++ = (code >> 12) | 0xE0;
|
||||
*dest++ = ((code >> 6) & 0x3F) | 0x80;
|
||||
*dest++ = (code & 0x3F) | 0x80;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -21,6 +21,7 @@
|
|||
#define GRUB_EFI_API_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* For consistency and safety, we name the EFI-defined types differently.
|
||||
All names are transformed into lower case, _t appended, and
|
||||
|
|
|
|||
|
|
@ -54,9 +54,11 @@ 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,
|
||||
grub_efi_uint32_t descriptor_version,
|
||||
grub_efi_memory_descriptor_t *virtual_map);
|
||||
|
||||
void grub_efi_mm_init (void);
|
||||
void grub_efi_mm_fini (void);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -268,9 +268,19 @@ void grub_efiemu_free_syms (void);
|
|||
grub_err_t grub_efiemu_write_value (void * addr, grub_uint32_t value,
|
||||
int plus_handle,
|
||||
int minus_handle, int ptv_needed, int size);
|
||||
grub_err_t grub_efiemu_write_sym_markers (void);
|
||||
grub_err_t grub_efiemu_pnvram (void);
|
||||
grub_err_t grub_efiemu_prepare (void);
|
||||
char *grub_efiemu_get_default_core_name (void);
|
||||
void grub_efiemu_pnvram_cmd_unregister (void);
|
||||
grub_err_t grub_efiemu_autocore (void);
|
||||
grub_err_t grub_efiemu_crc32 (void);
|
||||
grub_err_t grub_efiemu_crc64 (void);
|
||||
grub_err_t
|
||||
grub_efiemu_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
|
||||
grub_efi_uintn_t descriptor_size,
|
||||
grub_efi_uint32_t descriptor_version
|
||||
__attribute__ ((unused)),
|
||||
grub_efi_memory_descriptor_t *virtual_map);
|
||||
|
||||
#endif /* ! GRUB_EFI_EMU_HEADER */
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
@ -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 */
|
||||
|
|
@ -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 */
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* 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_CPU_MACHO_H
|
||||
#define GRUB_CPU_MACHO_H 1
|
||||
|
||||
#include <grub/macho.h>
|
||||
|
||||
#define GRUB_MACHO_CPUTYPE_IS_HOST32(x) ((x)==0x00000007)
|
||||
#define GRUB_MACHO_CPUTYPE_IS_HOST64(x) ((x)==0x01000007)
|
||||
|
||||
|
|
@ -9,3 +32,15 @@ struct grub_macho_thread32
|
|||
grub_uint32_t entry_point;
|
||||
grub_uint8_t unknown2[20];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
|
||||
struct grub_macho_thread64
|
||||
{
|
||||
grub_uint32_t cmd;
|
||||
grub_uint32_t cmdsize;
|
||||
grub_uint8_t unknown1[0x88];
|
||||
grub_uint64_t entry_point;
|
||||
grub_uint8_t unknown2[0x20];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -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 */
|
||||
|
|
@ -20,6 +20,10 @@
|
|||
#define GRUB_CPU_XNU_H 1
|
||||
|
||||
#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;
|
||||
|
|
@ -64,17 +68,54 @@ struct grub_xnu_boot_params
|
|||
/* Size of grub_efi_uintn_t in bits. */
|
||||
grub_uint8_t efi_uintnbits;
|
||||
} __attribute__ ((packed));
|
||||
#define GRUB_XNU_BOOTARGS_VERMINOR 4
|
||||
#define GRUB_XNU_BOOTARGS_VERMINOR 5
|
||||
#define GRUB_XNU_BOOTARGS_VERMAJOR 1
|
||||
|
||||
struct grub_xnu_devprop_header
|
||||
{
|
||||
grub_uint32_t length;
|
||||
/* Always set to 1. Version? */
|
||||
grub_uint32_t alwaysone;
|
||||
grub_uint32_t num_devices;
|
||||
};
|
||||
|
||||
struct grub_xnu_devprop_device_header
|
||||
{
|
||||
grub_uint32_t length;
|
||||
grub_uint32_t num_values;
|
||||
};
|
||||
|
||||
void grub_cpu_xnu_unload (void);
|
||||
|
||||
struct grub_xnu_devprop_device_descriptor;
|
||||
|
||||
struct grub_xnu_devprop_device_descriptor *
|
||||
grub_xnu_devprop_add_device (struct grub_efi_device_path *path, int length);
|
||||
grub_err_t
|
||||
grub_xnu_devprop_remove_device (struct grub_xnu_devprop_device_descriptor *dev);
|
||||
grub_err_t
|
||||
grub_xnu_devprop_remove_property (struct grub_xnu_devprop_device_descriptor *dev,
|
||||
char *name);
|
||||
grub_err_t
|
||||
grub_xnu_devprop_add_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
|
||||
char *name, void *data, int datalen);
|
||||
grub_err_t
|
||||
grub_xnu_devprop_add_property_utf16 (struct grub_xnu_devprop_device_descriptor *dev,
|
||||
grub_uint16_t *name, int namelen,
|
||||
void *data, int datalen);
|
||||
grub_err_t
|
||||
grub_xnu_devprop_remove_property_utf8 (struct grub_xnu_devprop_device_descriptor *dev,
|
||||
char *name);
|
||||
void grub_cpu_xnu_init (void);
|
||||
void grub_cpu_xnu_fini (void);
|
||||
|
||||
extern grub_uint32_t grub_xnu_entry_point;
|
||||
extern grub_uint32_t grub_xnu_stack;
|
||||
extern grub_uint32_t grub_xnu_arg1;
|
||||
extern char grub_xnu_cmdline[1024];
|
||||
grub_err_t grub_xnu_boot (void);
|
||||
grub_err_t grub_cpu_xnu_fill_devicetree (void);
|
||||
grub_err_t grub_xnu_set_video (struct grub_xnu_boot_params *bootparams_relloc);
|
||||
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
|
||||
|
|
|
|||
|
|
@ -102,6 +102,23 @@ struct grub_macho_segment32
|
|||
grub_uint32_t flags;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* 64-bit segment command. */
|
||||
struct grub_macho_segment64
|
||||
{
|
||||
#define GRUB_MACHO_CMD_SEGMENT64 0x19
|
||||
grub_uint32_t cmd;
|
||||
grub_uint32_t cmdsize;
|
||||
grub_uint8_t segname[16];
|
||||
grub_uint64_t vmaddr;
|
||||
grub_uint64_t vmsize;
|
||||
grub_uint64_t fileoff;
|
||||
grub_uint64_t filesize;
|
||||
grub_macho_vmprot_t maxprot;
|
||||
grub_macho_vmprot_t initprot;
|
||||
grub_uint32_t nsects;
|
||||
grub_uint32_t flags;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define GRUB_MACHO_CMD_THREAD 5
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -46,17 +46,28 @@ grub_macho_t grub_macho_file (grub_file_t);
|
|||
grub_err_t grub_macho_close (grub_macho_t);
|
||||
|
||||
int grub_macho_contains_macho32 (grub_macho_t);
|
||||
grub_err_t grub_macho32_size (grub_macho_t macho, grub_addr_t *segments_start,
|
||||
grub_addr_t *segments_end, int flags);
|
||||
grub_uint32_t grub_macho32_get_entry_point (grub_macho_t macho);
|
||||
grub_err_t grub_macho_size32 (grub_macho_t macho, grub_uint32_t *segments_start,
|
||||
grub_uint32_t *segments_end, int flags);
|
||||
grub_uint32_t grub_macho_get_entry_point32 (grub_macho_t macho);
|
||||
|
||||
int grub_macho_contains_macho64 (grub_macho_t);
|
||||
grub_err_t grub_macho_size64 (grub_macho_t macho, grub_uint64_t *segments_start,
|
||||
grub_uint64_t *segments_end, int flags);
|
||||
grub_uint64_t grub_macho_get_entry_point64 (grub_macho_t macho);
|
||||
|
||||
/* Ignore BSS segments when loading. */
|
||||
#define GRUB_MACHO_NOBSS 0x1
|
||||
grub_err_t grub_macho32_load (grub_macho_t macho, char *offset, int flags);
|
||||
grub_err_t grub_macho_load32 (grub_macho_t macho, char *offset, int flags);
|
||||
grub_err_t grub_macho_load64 (grub_macho_t macho, char *offset, int flags);
|
||||
|
||||
/* Like filesize and file_read but take only 32-bit part
|
||||
for current architecture. */
|
||||
grub_size_t grub_macho32_filesize (grub_macho_t macho);
|
||||
grub_err_t grub_macho32_readfile (grub_macho_t macho, void *dest);
|
||||
grub_size_t grub_macho_filesize32 (grub_macho_t macho);
|
||||
grub_err_t grub_macho_readfile32 (grub_macho_t macho, void *dest);
|
||||
grub_size_t grub_macho_filesize64 (grub_macho_t macho);
|
||||
grub_err_t grub_macho_readfile64 (grub_macho_t macho, void *dest);
|
||||
|
||||
void grub_macho_parse32 (grub_macho_t macho);
|
||||
void grub_macho_parse64 (grub_macho_t macho);
|
||||
|
||||
#endif /* ! GRUB_MACHOLOAD_HEADER */
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -180,9 +183,6 @@ int EXPORT_FUNC(grub_sprintf) (char *str, const char *fmt, ...) __attribute__ ((
|
|||
int EXPORT_FUNC(grub_vsprintf) (char *str, const char *fmt, va_list args);
|
||||
void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn));
|
||||
grub_uint8_t *EXPORT_FUNC(grub_utf16_to_utf8) (grub_uint8_t *dest,
|
||||
grub_uint16_t *src,
|
||||
grub_size_t size);
|
||||
grub_ssize_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest,
|
||||
grub_size_t destsize,
|
||||
const grub_uint8_t *src,
|
||||
|
|
@ -222,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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@
|
|||
/* The maximum size of a command-line. */
|
||||
#define GRUB_MAX_CMDLINE 1600
|
||||
|
||||
/* The standard left and right margin for some messages. */
|
||||
#define STANDARD_MARGIN 6
|
||||
|
||||
/* The type of a completion item. */
|
||||
enum grub_completion_type
|
||||
{
|
||||
|
|
@ -73,6 +76,14 @@ void grub_parse_color_name_pair (grub_uint8_t *ret, const char *name);
|
|||
|
||||
/* Defined in `menu_text.c'. */
|
||||
void grub_wait_after_message (void);
|
||||
int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
|
||||
grub_uint32_t **last_position);
|
||||
void grub_print_ucs4 (const grub_uint32_t * str,
|
||||
const grub_uint32_t * last_position);
|
||||
grub_ssize_t grub_getstringwidth (grub_uint32_t * str,
|
||||
const grub_uint32_t * last_position);
|
||||
void grub_print_message_indented (const char *msg, int margin_left,
|
||||
int margin_right);
|
||||
|
||||
/* Defined in `handler.c'. */
|
||||
void read_handler_list (void);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
@ -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[];
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue