merge mainline into rescue-efi
This commit is contained in:
commit
1989170fd5
596 changed files with 57408 additions and 15601 deletions
|
@ -25,6 +25,8 @@ docs/version.texi
|
||||||
*.exec
|
*.exec
|
||||||
genkernsyms.sh
|
genkernsyms.sh
|
||||||
gensymlist.sh
|
gensymlist.sh
|
||||||
|
gentrigtables
|
||||||
|
grub-bin2h
|
||||||
grub-dumpbios
|
grub-dumpbios
|
||||||
grub-editenv
|
grub-editenv
|
||||||
grub-emu
|
grub-emu
|
||||||
|
@ -35,12 +37,18 @@ grub_fstest_init.c
|
||||||
grub_fstest_init.h
|
grub_fstest_init.h
|
||||||
grub-install
|
grub-install
|
||||||
grub-mk*
|
grub-mk*
|
||||||
|
grub-pbkdf2
|
||||||
grub-pe2elf
|
grub-pe2elf
|
||||||
grub-probe
|
grub-probe
|
||||||
grub_probe_init.c
|
grub_probe_init.c
|
||||||
grub_probe_init.h
|
grub_probe_init.h
|
||||||
|
grub-reboot
|
||||||
|
grub-script-check
|
||||||
|
grub_script_check_init.c
|
||||||
|
grub_script_check_init.h
|
||||||
grub_script.tab.c
|
grub_script.tab.c
|
||||||
grub_script.tab.h
|
grub_script.tab.h
|
||||||
|
grub-set-default
|
||||||
grub-setup
|
grub-setup
|
||||||
grub_setup_init.c
|
grub_setup_init.c
|
||||||
grub_setup_init.h
|
grub_setup_init.h
|
||||||
|
@ -61,4 +69,5 @@ stamp-h
|
||||||
stamp-h1
|
stamp-h1
|
||||||
stamp-h.in
|
stamp-h.in
|
||||||
symlist.c
|
symlist.c
|
||||||
|
trigtables.c
|
||||||
update-grub_lib
|
update-grub_lib
|
||||||
|
|
5
INSTALL
5
INSTALL
|
@ -14,6 +14,7 @@ configuring the GRUB.
|
||||||
* GCC 4.1.3 or later
|
* GCC 4.1.3 or later
|
||||||
* GNU Make
|
* GNU Make
|
||||||
* GNU Bison 2.3 or later
|
* GNU Bison 2.3 or later
|
||||||
|
* GNU gettext 0.17 or later
|
||||||
* GNU binutils 2.9.1.0.23 or later
|
* GNU binutils 2.9.1.0.23 or later
|
||||||
* Other standard GNU/Unix tools
|
* Other standard GNU/Unix tools
|
||||||
|
|
||||||
|
@ -25,6 +26,10 @@ need the following.
|
||||||
* Autoconf 2.60 or later
|
* Autoconf 2.60 or later
|
||||||
* Automake 1.10.1 or later
|
* Automake 1.10.1 or later
|
||||||
|
|
||||||
|
Prerequisites for make-check:
|
||||||
|
|
||||||
|
* qemu, specifically the binary 'qemu-system-i386'
|
||||||
|
|
||||||
Configuring the GRUB
|
Configuring the GRUB
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
|
109
Makefile.in
109
Makefile.in
|
@ -1,6 +1,6 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This Makefile.in is free software; the author
|
# This Makefile.in is free software; the author
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -41,6 +41,13 @@ includedir = @includedir@
|
||||||
pkgdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`
|
pkgdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`
|
||||||
pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '$(transform)'`
|
pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed '$(transform)'`
|
||||||
|
|
||||||
|
# Internationalization library.
|
||||||
|
LIBINTL = @LIBINTL@
|
||||||
|
TARGET_NO_MODULES = @TARGET_NO_MODULES@
|
||||||
|
|
||||||
|
# Util library.
|
||||||
|
LIBUTIL = @LIBUTIL@
|
||||||
|
|
||||||
XGETTEXT = @XGETTEXT@
|
XGETTEXT = @XGETTEXT@
|
||||||
MSGMERGE = @MSGMERGE@
|
MSGMERGE = @MSGMERGE@
|
||||||
MSGFMT = @MSGFMT@
|
MSGFMT = @MSGFMT@
|
||||||
|
@ -72,25 +79,31 @@ MKDIR_P = @MKDIR_P@
|
||||||
|
|
||||||
mkinstalldirs = $(srcdir)/mkinstalldirs
|
mkinstalldirs = $(srcdir)/mkinstalldirs
|
||||||
|
|
||||||
|
LIBS = @LIBS@ $(LIBINTL) $(LIBUTIL)
|
||||||
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
|
POSIX_CFLAGS = -I$(srcdir)/lib/posix_wrap
|
||||||
|
GNULIB_UTIL_CFLAGS = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" -I$(srcdir)/gnulib
|
||||||
|
GNULIB_CFLAGS = $(GNULIB_UTIL_CFLAGS) $(POSIX_CFLAGS)
|
||||||
ASFLAGS = @ASFLAGS@
|
ASFLAGS = @ASFLAGS@
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@ $(LIBS)
|
||||||
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
|
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
|
||||||
-DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\"
|
-DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\"
|
||||||
TARGET_CC = @TARGET_CC@
|
TARGET_CC = @TARGET_CC@
|
||||||
TARGET_CFLAGS = @TARGET_CFLAGS@
|
TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@
|
||||||
TARGET_ASFLAGS = @TARGET_ASFLAGS@
|
TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@
|
||||||
TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
|
TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@
|
||||||
TARGET_APPLE_CC = @TARGET_APPLE_CC@
|
TARGET_APPLE_CC = @TARGET_APPLE_CC@
|
||||||
OBJCONV = @OBJCONV@
|
OBJCONV = @OBJCONV@
|
||||||
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include) -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
|
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
|
||||||
-Wall -W
|
-Wall -W
|
||||||
TARGET_LDFLAGS = @TARGET_LDFLAGS@
|
TARGET_LDFLAGS = -nostdlib @TARGET_LDFLAGS@
|
||||||
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
|
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
|
||||||
TARGET_IMG_LDFLAGS = @TARGET_IMG_LDFLAGS@
|
TARGET_IMG_LDFLAGS = -nostdlib @TARGET_IMG_LDFLAGS@
|
||||||
TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
|
TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
|
||||||
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
|
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
|
||||||
|
kernel_img_LDFLAGS = -static-libgcc -lgcc
|
||||||
EXEEXT = @EXEEXT@
|
EXEEXT = @EXEEXT@
|
||||||
OBJCOPY = @OBJCOPY@
|
OBJCOPY = @OBJCOPY@
|
||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
|
@ -109,11 +122,16 @@ endif
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
LIBCURSES = @LIBCURSES@
|
LIBCURSES = @LIBCURSES@
|
||||||
LIBUSB = @LIBUSB@
|
LIBUSB = @LIBUSB@
|
||||||
|
LIBSDL = @LIBSDL@
|
||||||
|
LIBPCIACCESS = @LIBPCIACCESS@
|
||||||
|
LEX = @LEX@
|
||||||
YACC = @YACC@
|
YACC = @YACC@
|
||||||
FONT_SOURCE = @FONT_SOURCE@
|
FONT_SOURCE = @FONT_SOURCE@
|
||||||
|
|
||||||
# Options.
|
# Options.
|
||||||
enable_grub_emu_usb = @enable_grub_emu_usb@
|
enable_grub_emu_usb = @enable_grub_emu_usb@
|
||||||
|
enable_grub_emu_sdl = @enable_grub_emu_sdl@
|
||||||
|
enable_grub_emu_pci = @enable_grub_emu_pci@
|
||||||
enable_grub_fstest = @enable_grub_fstest@
|
enable_grub_fstest = @enable_grub_fstest@
|
||||||
enable_grub_pe2elf = @enable_grub_pe2elf@
|
enable_grub_pe2elf = @enable_grub_pe2elf@
|
||||||
enable_grub_mkfont = @enable_grub_mkfont@
|
enable_grub_mkfont = @enable_grub_mkfont@
|
||||||
|
@ -123,7 +141,7 @@ enable_efiemu = @enable_efiemu@
|
||||||
|
|
||||||
### General variables.
|
### General variables.
|
||||||
|
|
||||||
RMKFILES = $(wildcard conf/*.rmk)
|
RMKFILES = $(wildcard $(srcdir)/conf/*.rmk)
|
||||||
|
|
||||||
MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
|
MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
|
||||||
|
|
||||||
|
@ -138,9 +156,13 @@ INFOS = $(info_INFOS)
|
||||||
CLEANFILES =
|
CLEANFILES =
|
||||||
MOSTLYCLEANFILES =
|
MOSTLYCLEANFILES =
|
||||||
DISTCLEANFILES = config.status config.cache config.log config.h \
|
DISTCLEANFILES = config.status config.cache config.log config.h \
|
||||||
Makefile stamp-h include/grub/cpu include/grub/machine \
|
Makefile stamp-h stamp-h1 include/grub/cpu include/grub/machine \
|
||||||
gensymlist.sh genkernsyms.sh build_env.mk
|
gensymlist.sh genkernsyms.sh build_env.mk \
|
||||||
MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) \
|
docs/grub.info docs/version.texi docs/stamp-vti
|
||||||
|
|
||||||
|
MAINTAINER_CLEANFILES = $(srcdir)/configure $(srcdir)/aclocal.m4 \
|
||||||
|
$(MKFILES) $(srcdir)/config.guess \
|
||||||
|
$(srcdir)/config.sub $(srcdir)/install-sh $(srcdir)/missing \
|
||||||
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS)
|
$(srcdir)/DISTLIST $(srcdir)/config.h.in $(srcdir)/stamp-h.in $(INFOS)
|
||||||
|
|
||||||
# The default target.
|
# The default target.
|
||||||
|
@ -158,14 +180,23 @@ ifeq ($(platform), emu)
|
||||||
include $(srcdir)/conf/any-emu.mk
|
include $(srcdir)/conf/any-emu.mk
|
||||||
else
|
else
|
||||||
include $(srcdir)/conf/$(target_cpu)-$(platform).mk
|
include $(srcdir)/conf/$(target_cpu)-$(platform).mk
|
||||||
|
# For tests.
|
||||||
|
include $(srcdir)/conf/tests.mk
|
||||||
# For external modules.
|
# For external modules.
|
||||||
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
|
-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_NO_MODULES), yes)
|
||||||
|
TARGET_CFLAGS += -DGRUB_TARGET_NO_MODULES=1
|
||||||
|
CFLAGS += -DGRUB_TARGET_NO_MODULES=1
|
||||||
|
endif
|
||||||
|
|
||||||
### General targets.
|
### General targets.
|
||||||
|
|
||||||
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
|
CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo
|
||||||
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst
|
ifneq ($(TARGET_NO_MODULES), yes)
|
||||||
|
pkglib_DATA += moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst
|
||||||
|
endif
|
||||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
|
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep.awk
|
||||||
cat $(DEFSYMFILES) /dev/null \
|
cat $(DEFSYMFILES) /dev/null \
|
||||||
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
|
| $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \
|
||||||
|
@ -183,9 +214,18 @@ partmap.lst: $(PARTMAPFILES)
|
||||||
handler.lst: $(HANDLERFILES)
|
handler.lst: $(HANDLERFILES)
|
||||||
cat $^ /dev/null | sort > $@
|
cat $^ /dev/null | sort > $@
|
||||||
|
|
||||||
|
terminal.lst: $(TERMINALFILES)
|
||||||
|
cat $^ /dev/null | sort > $@
|
||||||
|
|
||||||
parttool.lst: $(PARTTOOLFILES)
|
parttool.lst: $(PARTTOOLFILES)
|
||||||
cat $^ /dev/null | sort | uniq > $@
|
cat $^ /dev/null | sort | uniq > $@
|
||||||
|
|
||||||
|
video.lst: $(VIDEOFILES)
|
||||||
|
cat $^ /dev/null | sort | uniq > $@
|
||||||
|
|
||||||
|
crypto.lst: lib/libgcrypt-grub/cipher/crypto.lst
|
||||||
|
cp $^ $@
|
||||||
|
|
||||||
ifneq (true, $(MAKEINFO))
|
ifneq (true, $(MAKEINFO))
|
||||||
info_INFOS += docs/grub.info
|
info_INFOS += docs/grub.info
|
||||||
endif
|
endif
|
||||||
|
@ -216,7 +256,8 @@ else
|
||||||
|
|
||||||
ifeq ($(enable_grub_mkfont),yes)
|
ifeq ($(enable_grub_mkfont),yes)
|
||||||
|
|
||||||
pkgdata_DATA += unicode.pf2 ascii.pf2
|
pkgdata_DATA += unicode.pf2 ascii.pf2 ascii.h
|
||||||
|
CLEANFILES += ascii.bitmaps
|
||||||
|
|
||||||
# Arrows and lines are needed to draw the menu, so we always include them
|
# Arrows and lines are needed to draw the menu, so we always include them
|
||||||
UNICODE_ARROWS=0x2190-0x2193
|
UNICODE_ARROWS=0x2190-0x2193
|
||||||
|
@ -227,6 +268,14 @@ unicode.pf2: $(FONT_SOURCE) grub-mkfont
|
||||||
|
|
||||||
ascii.pf2: $(FONT_SOURCE) grub-mkfont
|
ascii.pf2: $(FONT_SOURCE) grub-mkfont
|
||||||
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
|
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES)
|
||||||
|
|
||||||
|
ascii.bitmaps: $(FONT_SOURCE) grub-mkfont
|
||||||
|
$(builddir)/grub-mkfont --ascii-bitmaps -o $@ $(FONT_SOURCE)
|
||||||
|
|
||||||
|
ascii.h: ascii.bitmaps grub-bin2h
|
||||||
|
$(builddir)/grub-bin2h ascii_bitmaps < $< > $@
|
||||||
|
|
||||||
|
TARGET_CFLAGS += -DUSE_ASCII_FAILBACK=1
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -248,7 +297,7 @@ build_env.mk: Makefile
|
||||||
) > $@
|
) > $@
|
||||||
pkglib_BUILDDIR += config.h grub_script.tab.h
|
pkglib_BUILDDIR += config.h grub_script.tab.h
|
||||||
|
|
||||||
all-local: $(PROGRAMS) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES) $(foreach lang, $(LINGUAS), po/$(lang).mo)
|
all-local: $(PROGRAMS) $(GRUB_EMU) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES) $(foreach lang, $(LINGUAS), po/$(lang).mo)
|
||||||
|
|
||||||
install: install-local
|
install: install-local
|
||||||
|
|
||||||
|
@ -269,7 +318,7 @@ install-local: all
|
||||||
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkgdatadir)/$$dest; \
|
$(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkgdatadir)/$$dest; \
|
||||||
done
|
done
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
|
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
|
||||||
@list='$(bin_UTILITIES)'; for file in $$list; do \
|
@list='$(bin_UTILITIES) $(GRUB_EMU)'; for file in $$list; do \
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
||||||
|
@ -345,7 +394,7 @@ uninstall:
|
||||||
dest="`echo $$file | sed 's,.*/,,'`"; \
|
dest="`echo $$file | sed 's,.*/,,'`"; \
|
||||||
rm -f $(DESTDIR)$(pkgdatadir)/$$dest; \
|
rm -f $(DESTDIR)$(pkgdatadir)/$$dest; \
|
||||||
done
|
done
|
||||||
@list='$(bin_UTILITIES) $(bin_SCRIPTS)'; for file in $$list; do \
|
@list='$(bin_UTILITIES) $(bin_SCRIPTS) $(GRUB_EMU)'; for file in $$list; do \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
rm -f $(DESTDIR)$(bindir)/$$dest; \
|
rm -f $(DESTDIR)$(bindir)/$$dest; \
|
||||||
rm -f $(DESTDIR)$(mandir)/man1/$$dest.1; \
|
rm -f $(DESTDIR)$(mandir)/man1/$$dest.1; \
|
||||||
|
@ -362,7 +411,6 @@ uninstall:
|
||||||
@list='$(lib_SCRIPTS)'; \
|
@list='$(lib_SCRIPTS)'; \
|
||||||
for file in $$list; do \
|
for file in $$list; do \
|
||||||
dest="`echo $$file | sed 's,.*/,,'`"; \
|
dest="`echo $$file | sed 's,.*/,,'`"; \
|
||||||
echo rm -f $(DESTDIR)$(libdir)/$$dest; \
|
|
||||||
rm -f $(DESTDIR)$(libdir)/grub/$$dest; \
|
rm -f $(DESTDIR)$(libdir)/grub/$$dest; \
|
||||||
done
|
done
|
||||||
@list='$(info_INFOS)'; \
|
@list='$(info_INFOS)'; \
|
||||||
|
@ -391,6 +439,8 @@ distclean: mostlyclean
|
||||||
|
|
||||||
maintainer-clean: distclean
|
maintainer-clean: distclean
|
||||||
-test -z "$(MAINTAINER_CLEANFILES)" || rm -f $(MAINTAINER_CLEANFILES)
|
-test -z "$(MAINTAINER_CLEANFILES)" || rm -f $(MAINTAINER_CLEANFILES)
|
||||||
|
-rmdir $(srcdir)/lib/libgcrypt-grub/cipher
|
||||||
|
-rmdir $(srcdir)/lib/libgcrypt-grub
|
||||||
|
|
||||||
info:
|
info:
|
||||||
|
|
||||||
|
@ -443,7 +493,24 @@ distcheck: dist
|
||||||
@echo "$(distdir).tar.gz is ready for distribution" | \
|
@echo "$(distdir).tar.gz is ready for distribution" | \
|
||||||
sed 'h;s/./=/g;p;x;p;x'
|
sed 'h;s/./=/g;p;x;p;x'
|
||||||
|
|
||||||
check:
|
check: all $(UNIT_TESTS) $(FUNCTIONAL_TESTS) $(SCRIPTED_TESTS)
|
||||||
|
@list="$(UNIT_TESTS)"; \
|
||||||
|
set -e; \
|
||||||
|
for file in $$list; do \
|
||||||
|
$(builddir)/$$file; \
|
||||||
|
done
|
||||||
|
@list="$(FUNCTIONAL_TESTS)"; \
|
||||||
|
set -e; \
|
||||||
|
for file in $$list; do \
|
||||||
|
mod=`basename $$file .mod`; \
|
||||||
|
echo "insmod functional_test; insmod $$mod; functional_test" \
|
||||||
|
| $(builddir)/grub-shell; \
|
||||||
|
done
|
||||||
|
@list="$(SCRIPTED_TESTS)"; \
|
||||||
|
set -e; \
|
||||||
|
for file in $$list; do \
|
||||||
|
$(builddir)/$$file; \
|
||||||
|
done
|
||||||
|
|
||||||
.SUFFIX:
|
.SUFFIX:
|
||||||
.SUFFIX: .c .o .S .d
|
.SUFFIX: .c .o .S .d
|
||||||
|
@ -477,10 +544,10 @@ genkernsyms.sh: genkernsyms.sh.in config.status
|
||||||
$(SHELL) ./config.status
|
$(SHELL) ./config.status
|
||||||
|
|
||||||
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
|
$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell
|
||||||
cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ --keyword=N_
|
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o po/$(PACKAGE).pot -f po/POTFILES --keyword=_ --keyword=N_
|
||||||
cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell
|
cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o po/$(PACKAGE).pot -f po/POTFILES-shell -j --language=Shell
|
||||||
|
|
||||||
po/%.po: po/$(PACKAGE).pot
|
$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot
|
||||||
$(MSGMERGE) -U $@ $^
|
$(MSGMERGE) -U $@ $^
|
||||||
|
|
||||||
po/%.mo: po/%.po
|
po/%.mo: po/%.po
|
||||||
|
|
23
NEWS
23
NEWS
|
@ -1,7 +1,28 @@
|
||||||
New in 1.97 - :
|
New in 1.98 - 2010-03-06:
|
||||||
|
|
||||||
|
* Multiboot on EFI support.
|
||||||
|
|
||||||
|
* Graphical menu support.
|
||||||
|
|
||||||
|
* MIPS support.
|
||||||
|
|
||||||
|
* Saved default menu entry support, with new utilities `grub-reboot' and
|
||||||
|
`grub-set-default'.
|
||||||
|
|
||||||
|
* Unit testing framework.
|
||||||
|
|
||||||
|
* Support for multiple terminals.
|
||||||
|
|
||||||
|
* Encrypted password support, with a new utility `grub-mkpasswd-pbkdf2'.
|
||||||
|
|
||||||
|
* `grub-mkfloppy' removed; use `grub-mkrescue' to create floppy images.
|
||||||
|
|
||||||
|
* Add grub-probe support for GNU/Hurd.
|
||||||
|
|
||||||
* Add support for gettext.
|
* Add support for gettext.
|
||||||
|
|
||||||
|
New in 1.97:
|
||||||
|
|
||||||
* Add support for loading XNU (MacOS X kernel).
|
* Add support for loading XNU (MacOS X kernel).
|
||||||
|
|
||||||
* ACPI override support.
|
* ACPI override support.
|
||||||
|
|
1
THANKS
1
THANKS
|
@ -8,6 +8,7 @@ generally assist in the GRUB 2 maintainership process:
|
||||||
|
|
||||||
Andrey Shuvikov <mr_hyro@yahoo.com>
|
Andrey Shuvikov <mr_hyro@yahoo.com>
|
||||||
Bibo Mao <bibo.mao@intel.com>
|
Bibo Mao <bibo.mao@intel.com>
|
||||||
|
David Miller <davem@davemloft.net>
|
||||||
Guillem Jover <guillem@hadrons.org>
|
Guillem Jover <guillem@hadrons.org>
|
||||||
Harley D. Eades III <hde@foobar-qux.org>
|
Harley D. Eades III <hde@foobar-qux.org>
|
||||||
Hitoshi Ozeki <h-ozeki@ck2.so-net.ne.jp>
|
Hitoshi Ozeki <h-ozeki@ck2.so-net.ne.jp>
|
||||||
|
|
34
acinclude.m4
34
acinclude.m4
|
@ -14,11 +14,11 @@ $2
|
||||||
|
|
||||||
|
|
||||||
dnl Check whether target compiler is working
|
dnl Check whether target compiler is working
|
||||||
AC_DEFUN(grub_PROG_TARGET_CC,
|
AC_DEFUN([grub_PROG_TARGET_CC],
|
||||||
[AC_MSG_CHECKING([whether target compiler is working])
|
[AC_MSG_CHECKING([whether target compiler is working])
|
||||||
AC_CACHE_VAL(grub_cv_prog_target_cc,
|
AC_CACHE_VAL(grub_cv_prog_target_cc,
|
||||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||||
asm (".globl start; start: nop");
|
asm (".globl start; start:");
|
||||||
int main (void);
|
int main (void);
|
||||||
]], [[]])],
|
]], [[]])],
|
||||||
[grub_cv_prog_target_cc=yes],
|
[grub_cv_prog_target_cc=yes],
|
||||||
|
@ -36,7 +36,7 @@ dnl grub_ASM_USCORE checks if C symbols get an underscore after
|
||||||
dnl compiling to assembler.
|
dnl compiling to assembler.
|
||||||
dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by
|
dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by
|
||||||
dnl Erich Boleyn and modified by Yoshinori K. Okuji.
|
dnl Erich Boleyn and modified by Yoshinori K. Okuji.
|
||||||
AC_DEFUN(grub_ASM_USCORE,
|
AC_DEFUN([grub_ASM_USCORE],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING([if C symbols get an underscore after compilation])
|
AC_MSG_CHECKING([if C symbols get an underscore after compilation])
|
||||||
AC_CACHE_VAL(grub_cv_asm_uscore,
|
AC_CACHE_VAL(grub_cv_asm_uscore,
|
||||||
|
@ -75,7 +75,7 @@ AC_MSG_RESULT([$grub_cv_asm_uscore])
|
||||||
|
|
||||||
dnl Some versions of `objcopy -O binary' vary their output depending
|
dnl Some versions of `objcopy -O binary' vary their output depending
|
||||||
dnl on the link address.
|
dnl on the link address.
|
||||||
AC_DEFUN(grub_PROG_OBJCOPY_ABSOLUTE,
|
AC_DEFUN([grub_PROG_OBJCOPY_ABSOLUTE],
|
||||||
[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses])
|
[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses])
|
||||||
AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
|
AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
|
||||||
[cat > conftest.c <<\EOF
|
[cat > conftest.c <<\EOF
|
||||||
|
@ -119,7 +119,7 @@ fi
|
||||||
|
|
||||||
dnl Supply --build-id=none to ld if building modules.
|
dnl Supply --build-id=none to ld if building modules.
|
||||||
dnl This suppresses warnings from ld on some systems
|
dnl This suppresses warnings from ld on some systems
|
||||||
AC_DEFUN(grub_PROG_LD_BUILD_ID_NONE,
|
AC_DEFUN([grub_PROG_LD_BUILD_ID_NONE],
|
||||||
[AC_MSG_CHECKING([whether linker accepts --build-id=none])
|
[AC_MSG_CHECKING([whether linker accepts --build-id=none])
|
||||||
AC_CACHE_VAL(grub_cv_prog_ld_build_id_none,
|
AC_CACHE_VAL(grub_cv_prog_ld_build_id_none,
|
||||||
[save_LDFLAGS="$LDFLAGS"
|
[save_LDFLAGS="$LDFLAGS"
|
||||||
|
@ -150,7 +150,7 @@ dnl
|
||||||
dnl We only support the newer versions, because the old versions cause
|
dnl We only support the newer versions, because the old versions cause
|
||||||
dnl major pain, by requiring manual assembly to get 16-bit instructions into
|
dnl major pain, by requiring manual assembly to get 16-bit instructions into
|
||||||
dnl asm files.
|
dnl asm files.
|
||||||
AC_DEFUN(grub_I386_ASM_ADDR32,
|
AC_DEFUN([grub_I386_ASM_ADDR32],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT])
|
AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT])
|
||||||
AC_MSG_CHECKING([for .code16 addr32 assembler support])
|
AC_MSG_CHECKING([for .code16 addr32 assembler support])
|
||||||
|
@ -178,7 +178,7 @@ AC_MSG_RESULT([$grub_cv_i386_asm_addr32])])
|
||||||
|
|
||||||
dnl check if our compiler is apple cc
|
dnl check if our compiler is apple cc
|
||||||
dnl because it requires numerous workarounds
|
dnl because it requires numerous workarounds
|
||||||
AC_DEFUN(grub_apple_cc,
|
AC_DEFUN([grub_apple_cc],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING([whether our compiler is apple cc])
|
AC_MSG_CHECKING([whether our compiler is apple cc])
|
||||||
AC_CACHE_VAL(grub_cv_apple_cc,
|
AC_CACHE_VAL(grub_cv_apple_cc,
|
||||||
|
@ -193,7 +193,7 @@ AC_MSG_RESULT([$grub_cv_apple_cc])])
|
||||||
|
|
||||||
dnl check if our target compiler is apple cc
|
dnl check if our target compiler is apple cc
|
||||||
dnl because it requires numerous workarounds
|
dnl because it requires numerous workarounds
|
||||||
AC_DEFUN(grub_apple_target_cc,
|
AC_DEFUN([grub_apple_target_cc],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING([whether our target compiler is apple cc])
|
AC_MSG_CHECKING([whether our target compiler is apple cc])
|
||||||
AC_CACHE_VAL(grub_cv_apple_target_cc,
|
AC_CACHE_VAL(grub_cv_apple_target_cc,
|
||||||
|
@ -210,7 +210,7 @@ AC_MSG_RESULT([$grub_cv_apple_target_cc])])
|
||||||
dnl Later versions of GAS requires that addr32 and data32 prefixes
|
dnl Later versions of GAS requires that addr32 and data32 prefixes
|
||||||
dnl appear in the same lines as the instructions they modify, while
|
dnl appear in the same lines as the instructions they modify, while
|
||||||
dnl earlier versions requires that they appear in separate lines.
|
dnl earlier versions requires that they appear in separate lines.
|
||||||
AC_DEFUN(grub_I386_ASM_PREFIX_REQUIREMENT,
|
AC_DEFUN([grub_I386_ASM_PREFIX_REQUIREMENT],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING(dnl
|
AC_MSG_CHECKING(dnl
|
||||||
[whether addr32 must be in the same line as the instruction])
|
[whether addr32 must be in the same line as the instruction])
|
||||||
|
@ -246,7 +246,7 @@ AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])])
|
||||||
|
|
||||||
dnl Older versions of GAS require that absolute indirect calls/jumps are
|
dnl Older versions of GAS require that absolute indirect calls/jumps are
|
||||||
dnl not prefixed with `*', while later versions warn if not prefixed.
|
dnl not prefixed with `*', while later versions warn if not prefixed.
|
||||||
AC_DEFUN(grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK,
|
AC_DEFUN([grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING(dnl
|
AC_MSG_CHECKING(dnl
|
||||||
[whether an absolute indirect call/jump must not be prefixed with an asterisk])
|
[whether an absolute indirect call/jump must not be prefixed with an asterisk])
|
||||||
|
@ -276,7 +276,7 @@ AC_MSG_RESULT([$grub_cv_i386_asm_absolute_without_asterisk])])
|
||||||
|
|
||||||
dnl Check what symbol is defined as a bss start symbol.
|
dnl Check what symbol is defined as a bss start symbol.
|
||||||
dnl Written by Michael Hohmoth and Yoshinori K. Okuji.
|
dnl Written by Michael Hohmoth and Yoshinori K. Okuji.
|
||||||
AC_DEFUN(grub_CHECK_BSS_START_SYMBOL,
|
AC_DEFUN([grub_CHECK_BSS_START_SYMBOL],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING([if __bss_start is defined by the compiler])
|
AC_MSG_CHECKING([if __bss_start is defined by the compiler])
|
||||||
AC_CACHE_VAL(grub_cv_check_uscore_uscore_bss_start_symbol,
|
AC_CACHE_VAL(grub_cv_check_uscore_uscore_bss_start_symbol,
|
||||||
|
@ -320,7 +320,7 @@ fi
|
||||||
|
|
||||||
dnl Check what symbol is defined as an end symbol.
|
dnl Check what symbol is defined as an end symbol.
|
||||||
dnl Written by Yoshinori K. Okuji.
|
dnl Written by Yoshinori K. Okuji.
|
||||||
AC_DEFUN(grub_CHECK_END_SYMBOL,
|
AC_DEFUN([grub_CHECK_END_SYMBOL],
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
[AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_MSG_CHECKING([if end is defined by the compiler])
|
AC_MSG_CHECKING([if end is defined by the compiler])
|
||||||
AC_CACHE_VAL(grub_cv_check_end_symbol,
|
AC_CACHE_VAL(grub_cv_check_end_symbol,
|
||||||
|
@ -352,7 +352,7 @@ fi
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Check if the C compiler generates calls to `__enable_execute_stack()'.
|
dnl Check if the C compiler generates calls to `__enable_execute_stack()'.
|
||||||
AC_DEFUN(grub_CHECK_ENABLE_EXECUTE_STACK,[
|
AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[
|
||||||
AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
|
AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
|
||||||
AC_LANG_CONFTEST([[
|
AC_LANG_CONFTEST([[
|
||||||
void f (int (*p) (void));
|
void f (int (*p) (void));
|
||||||
|
@ -379,7 +379,7 @@ rm -f conftest*
|
||||||
|
|
||||||
|
|
||||||
dnl Check if the C compiler supports `-fstack-protector'.
|
dnl Check if the C compiler supports `-fstack-protector'.
|
||||||
AC_DEFUN(grub_CHECK_STACK_PROTECTOR,[
|
AC_DEFUN([grub_CHECK_STACK_PROTECTOR],[
|
||||||
[# Smashing stack protector.
|
[# Smashing stack protector.
|
||||||
ssp_possible=yes]
|
ssp_possible=yes]
|
||||||
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector'])
|
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector'])
|
||||||
|
@ -398,7 +398,7 @@ else
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Check if the C compiler supports `-mstack-arg-probe' (Cygwin).
|
dnl Check if the C compiler supports `-mstack-arg-probe' (Cygwin).
|
||||||
AC_DEFUN(grub_CHECK_STACK_ARG_PROBE,[
|
AC_DEFUN([grub_CHECK_STACK_ARG_PROBE],[
|
||||||
[# Smashing stack arg probe.
|
[# Smashing stack arg probe.
|
||||||
sap_possible=yes]
|
sap_possible=yes]
|
||||||
AC_MSG_CHECKING([whether `$CC' accepts `-mstack-arg-probe'])
|
AC_MSG_CHECKING([whether `$CC' accepts `-mstack-arg-probe'])
|
||||||
|
@ -414,7 +414,7 @@ else
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Check if ln can handle directories properly (mingw).
|
dnl Check if ln can handle directories properly (mingw).
|
||||||
AC_DEFUN(grub_CHECK_LINK_DIR,[
|
AC_DEFUN([grub_CHECK_LINK_DIR],[
|
||||||
AC_MSG_CHECKING([whether ln can handle directories properly])
|
AC_MSG_CHECKING([whether ln can handle directories properly])
|
||||||
[mkdir testdir 2>/dev/null
|
[mkdir testdir 2>/dev/null
|
||||||
case $srcdir in
|
case $srcdir in
|
||||||
|
@ -432,7 +432,7 @@ rm -rf testdir]
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Check if the C compiler supports `-fPIE'.
|
dnl Check if the C compiler supports `-fPIE'.
|
||||||
AC_DEFUN(grub_CHECK_PIE,[
|
AC_DEFUN([grub_CHECK_PIE],[
|
||||||
[# Position independent executable.
|
[# Position independent executable.
|
||||||
pie_possible=yes]
|
pie_possible=yes]
|
||||||
AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default])
|
AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default])
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* -*-Asm-*- */
|
/* -*-Asm-*- */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 1999,2000,2001,2002,2005,2006,2007,2008 Free Software Foundation, Inc.
|
* Copyright (C) 1999,2000,2001,2002,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
/* Print message string */
|
/* Print message string */
|
||||||
#define MSG(x) movw $x, %si; call LOCAL(message)
|
#define MSG(x) movw $x, %si; call LOCAL(message)
|
||||||
|
#define ERR(x) movw $x, %si; jmp LOCAL(error_message)
|
||||||
|
|
||||||
.file "boot.S"
|
.file "boot.S"
|
||||||
|
|
||||||
|
@ -233,7 +234,7 @@ LOCAL(chs_mode):
|
||||||
jz LOCAL(floppy_probe)
|
jz LOCAL(floppy_probe)
|
||||||
|
|
||||||
/* Nope, we definitely have a hard disk, and we're screwed. */
|
/* Nope, we definitely have a hard disk, and we're screwed. */
|
||||||
jmp LOCAL(hd_probe_error)
|
ERR(hd_probe_error_string)
|
||||||
|
|
||||||
LOCAL(final_init):
|
LOCAL(final_init):
|
||||||
/* set the mode to zero */
|
/* set the mode to zero */
|
||||||
|
@ -360,22 +361,15 @@ LOCAL(copy_buffer):
|
||||||
* BIOS Geometry translation error (past the end of the disk geometry!).
|
* BIOS Geometry translation error (past the end of the disk geometry!).
|
||||||
*/
|
*/
|
||||||
LOCAL(geometry_error):
|
LOCAL(geometry_error):
|
||||||
MSG(geometry_error_string)
|
ERR(geometry_error_string)
|
||||||
jmp LOCAL(general_error)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Disk probe failure.
|
|
||||||
*/
|
|
||||||
LOCAL(hd_probe_error):
|
|
||||||
MSG(hd_probe_error_string)
|
|
||||||
jmp LOCAL(general_error)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read error on the disk.
|
* Read error on the disk.
|
||||||
*/
|
*/
|
||||||
LOCAL(read_error):
|
LOCAL(read_error):
|
||||||
MSG(read_error_string)
|
movw $read_error_string, %si
|
||||||
|
LOCAL(error_message):
|
||||||
|
call LOCAL(message)
|
||||||
LOCAL(general_error):
|
LOCAL(general_error):
|
||||||
MSG(general_error_string)
|
MSG(general_error_string)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* -*-Asm-*- */
|
/* -*-Asm-*- */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 1999,2000,2001,2002,2006,2007 Free Software Foundation, Inc.
|
* Copyright (C) 1999,2000,2001,2002,2006,2007,2009,2010 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -370,7 +370,7 @@ blocklist_default_start:
|
||||||
the start of the disk, sector 0 */
|
the start of the disk, sector 0 */
|
||||||
.long 2, 0
|
.long 2, 0
|
||||||
blocklist_default_len:
|
blocklist_default_len:
|
||||||
/* this is the number of sectors to read the command "install"
|
/* this is the number of sectors to read. grub-mkimage
|
||||||
will fill this up */
|
will fill this up */
|
||||||
.word 0
|
.word 0
|
||||||
blocklist_default_seg:
|
blocklist_default_seg:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* -*-Asm-*- */
|
/* -*-Asm-*- */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2007,2008 Free Software Foundation, Inc.
|
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -185,7 +185,7 @@ real_code_2:
|
||||||
call LOCAL(move_memory)
|
call LOCAL(move_memory)
|
||||||
|
|
||||||
/* Check for multiboot signature. */
|
/* Check for multiboot signature. */
|
||||||
cmpl $MULTIBOOT_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
|
cmpl $MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_DATA_END)
|
||||||
jz 1f
|
jz 1f
|
||||||
|
|
||||||
movl (ramdisk_image - start), %esi
|
movl (ramdisk_image - start), %esi
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2000,2005,2007,2008 Free Software Foundation, Inc.
|
* Copyright (C) 2000,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <grub/machine/boot.h>
|
||||||
|
|
||||||
.file "pxeboot.S"
|
.file "pxeboot.S"
|
||||||
.text
|
.text
|
||||||
|
|
||||||
|
@ -28,7 +30,7 @@ _start:
|
||||||
start:
|
start:
|
||||||
|
|
||||||
/* Use drive number 0x7F for PXE */
|
/* Use drive number 0x7F for PXE */
|
||||||
movb $0x7F, %dl
|
movb $GRUB_BOOT_MACHINE_PXE_DL, %dl
|
||||||
|
|
||||||
/* Jump to the real world */
|
/* Jump to the real world */
|
||||||
ljmp $0, $0x8200
|
ljmp $0, $0x8200
|
||||||
|
|
|
@ -118,7 +118,7 @@ prom_call:
|
||||||
|
|
||||||
boot_continue:
|
boot_continue:
|
||||||
mov %o7, PIC_REG /* PIC base */
|
mov %o7, PIC_REG /* PIC base */
|
||||||
sethi %hi(SCRATCH_PAD), %l1 /* OF argument slots */
|
sethi %hi(SCRATCH_PAD_BOOT), %l1 /* OF argument slots */
|
||||||
|
|
||||||
/* Find the /chosen node so we can fetch the stdout handle,
|
/* Find the /chosen node so we can fetch the stdout handle,
|
||||||
* and thus perform console output.
|
* and thus perform console output.
|
||||||
|
|
|
@ -81,7 +81,7 @@ prom_call:
|
||||||
|
|
||||||
|
|
||||||
after_info_block:
|
after_info_block:
|
||||||
sethi %hi(SCRATCH_PAD), %l1 /* OF argument slots */
|
sethi %hi(SCRATCH_PAD_DISKBOOT), %l1 /* OF argument slots */
|
||||||
|
|
||||||
GET_ABS(notification_string, %o2)
|
GET_ABS(notification_string, %o2)
|
||||||
call console_write
|
call console_write
|
||||||
|
@ -129,7 +129,7 @@ bootit:
|
||||||
mov NOTIFICATION_DONE_LEN, %o3
|
mov NOTIFICATION_DONE_LEN, %o3
|
||||||
sethi %hi(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o2
|
sethi %hi(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o2
|
||||||
jmpl %o2 + %lo(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o7
|
jmpl %o2 + %lo(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o7
|
||||||
mov CIF_REG, %o0
|
mov CIF_REG, %o4
|
||||||
1: ba,a 1b
|
1: ba,a 1b
|
||||||
|
|
||||||
lastlist:
|
lastlist:
|
||||||
|
|
90
bus/bonito.c
Normal file
90
bus/bonito.c
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/* bonito.c - PCI bonito interface. */
|
||||||
|
/*
|
||||||
|
* 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/pci.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
|
||||||
|
static grub_uint32_t base_win[GRUB_MACHINE_PCI_NUM_WIN];
|
||||||
|
static const grub_size_t sizes_win[GRUB_MACHINE_PCI_NUM_WIN] =
|
||||||
|
{GRUB_MACHINE_PCI_WIN1_SIZE, GRUB_MACHINE_PCI_WIN_SIZE,
|
||||||
|
GRUB_MACHINE_PCI_WIN_SIZE};
|
||||||
|
/* Usage counters. */
|
||||||
|
static int usage_win[GRUB_MACHINE_PCI_NUM_WIN];
|
||||||
|
static grub_addr_t addr_win[GRUB_MACHINE_PCI_NUM_WIN] =
|
||||||
|
{GRUB_MACHINE_PCI_WIN1_ADDR, GRUB_MACHINE_PCI_WIN2_ADDR,
|
||||||
|
GRUB_MACHINE_PCI_WIN3_ADDR};
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
write_bases (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
grub_uint32_t reg = 0;
|
||||||
|
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||||
|
reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT)
|
||||||
|
& GRUB_MACHINE_PCI_WIN_MASK)
|
||||||
|
>> (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
|
||||||
|
GRUB_MACHINE_PCI_IO_CTRL_REG = reg;
|
||||||
|
}
|
||||||
|
|
||||||
|
volatile void *
|
||||||
|
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||||
|
grub_addr_t base, grub_size_t size)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
grub_addr_t newbase;
|
||||||
|
|
||||||
|
/* First try already used registers. */
|
||||||
|
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||||
|
if (usage_win[i] && base_win[i] <= base
|
||||||
|
&& base_win[i] + sizes_win[i] > base + size)
|
||||||
|
{
|
||||||
|
usage_win[i]++;
|
||||||
|
return (void *)
|
||||||
|
(addr_win[i] | (base & GRUB_MACHINE_PCI_WIN_OFFSET_MASK));
|
||||||
|
}
|
||||||
|
/* Map new register. */
|
||||||
|
newbase = base & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK;
|
||||||
|
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||||
|
if (!usage_win[i] && newbase <= base
|
||||||
|
&& newbase + sizes_win[i] > base + size)
|
||||||
|
{
|
||||||
|
usage_win[i]++;
|
||||||
|
base_win[i] = newbase;
|
||||||
|
write_bases ();
|
||||||
|
return (void *)
|
||||||
|
(addr_win[i] | (base & GRUB_MACHINE_PCI_WIN_OFFSET_MASK));
|
||||||
|
}
|
||||||
|
grub_fatal ("Out of PCI windows.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||||
|
volatile void *mem __attribute__ ((unused)),
|
||||||
|
grub_size_t size __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||||
|
if (usage_win[i] && addr_win[i]
|
||||||
|
== (((grub_addr_t) mem) & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK))
|
||||||
|
{
|
||||||
|
usage_win[i]--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
grub_fatal ("Tried to unmap not mapped region");
|
||||||
|
}
|
25
bus/pci.c
25
bus/pci.c
|
@ -1,7 +1,7 @@
|
||||||
/* pci.c - Generic PCI interfaces. */
|
/* pci.c - Generic PCI interfaces. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2007 Free Software Foundation, Inc.
|
* Copyright (C) 2007,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -21,41 +21,40 @@
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
|
|
||||||
grub_pci_address_t
|
grub_pci_address_t
|
||||||
grub_pci_make_address (int bus, int device, int function, int reg)
|
grub_pci_make_address (grub_pci_device_t dev, int reg)
|
||||||
{
|
{
|
||||||
return (1 << 31) | (bus << 16) | (device << 11) | (function << 8) | (reg << 2);
|
return (1 << 31) | (dev.bus << 16) | (dev.device << 11)
|
||||||
|
| (dev.function << 8) | reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
||||||
{
|
{
|
||||||
int bus;
|
grub_pci_device_t dev;
|
||||||
int dev;
|
|
||||||
int func;
|
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
grub_pci_id_t id;
|
grub_pci_id_t id;
|
||||||
grub_uint32_t hdr;
|
grub_uint32_t hdr;
|
||||||
|
|
||||||
for (bus = 0; bus < 256; bus++)
|
for (dev.bus = 0; dev.bus < GRUB_PCI_NUM_BUS; dev.bus++)
|
||||||
{
|
{
|
||||||
for (dev = 0; dev < 32; dev++)
|
for (dev.device = 0; dev.device < GRUB_PCI_NUM_DEVICES; 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, GRUB_PCI_REG_PCI_ID);
|
||||||
id = grub_pci_read (addr);
|
id = grub_pci_read (addr);
|
||||||
|
|
||||||
/* Check if there is a device present. */
|
/* Check if there is a device present. */
|
||||||
if (id >> 16 == 0xFFFF)
|
if (id >> 16 == 0xFFFF)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (hook (bus, dev, func, id))
|
if (hook (dev, id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Probe only func = 0 if the device if not multifunction */
|
/* Probe only func = 0 if the device if not multifunction */
|
||||||
if (func == 0)
|
if (dev.function == 0)
|
||||||
{
|
{
|
||||||
addr = grub_pci_make_address (bus, dev, func, 3);
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CACHELINE);
|
||||||
hdr = grub_pci_read (addr);
|
hdr = grub_pci_read (addr);
|
||||||
if (!(hdr & 0x800000))
|
if (!(hdr & 0x800000))
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -113,7 +113,7 @@ grub_ohci_writereg32 (struct grub_ohci *o,
|
||||||
/* Iterate over all PCI devices. Determine if a device is an OHCI
|
/* Iterate over all PCI devices. Determine if a device is an OHCI
|
||||||
controller. If this is the case, initialize it. */
|
controller. If this is the case, initialize it. */
|
||||||
static int NESTED_FUNC_ATTR
|
static int NESTED_FUNC_ATTR
|
||||||
grub_ohci_pci_iter (int bus, int device, int func,
|
grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid __attribute__((unused)))
|
grub_pci_id_t pciid __attribute__((unused)))
|
||||||
{
|
{
|
||||||
grub_uint32_t class_code;
|
grub_uint32_t class_code;
|
||||||
|
@ -126,7 +126,7 @@ grub_ohci_pci_iter (int bus, int device, int func,
|
||||||
grub_uint32_t revision;
|
grub_uint32_t revision;
|
||||||
grub_uint32_t frame_interval;
|
grub_uint32_t frame_interval;
|
||||||
|
|
||||||
addr = grub_pci_make_address (bus, device, func, 2);
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||||
class_code = grub_pci_read (addr) >> 8;
|
class_code = grub_pci_read (addr) >> 8;
|
||||||
|
|
||||||
interf = class_code & 0xFF;
|
interf = class_code & 0xFF;
|
||||||
|
@ -138,7 +138,7 @@ grub_ohci_pci_iter (int bus, int device, int func,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Determine IO base address. */
|
/* Determine IO base address. */
|
||||||
addr = grub_pci_make_address (bus, device, func, 4);
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0);
|
||||||
base = grub_pci_read (addr);
|
base = grub_pci_read (addr);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <grub/usb.h>
|
#include <grub/usb.h>
|
||||||
#include <grub/usbtrans.h>
|
#include <grub/usbtrans.h>
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
#include <grub/cpu/pci.h>
|
|
||||||
#include <grub/i386/io.h>
|
#include <grub/i386/io.h>
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
|
|
||||||
|
@ -138,7 +137,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
/* Iterate over all PCI devices. Determine if a device is an UHCI
|
/* Iterate over all PCI devices. Determine if a device is an UHCI
|
||||||
controller. If this is the case, initialize it. */
|
controller. If this is the case, initialize it. */
|
||||||
static int NESTED_FUNC_ATTR
|
static int NESTED_FUNC_ATTR
|
||||||
grub_uhci_pci_iter (int bus, int device, int func,
|
grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid __attribute__((unused)))
|
grub_pci_id_t pciid __attribute__((unused)))
|
||||||
{
|
{
|
||||||
grub_uint32_t class_code;
|
grub_uint32_t class_code;
|
||||||
|
@ -151,7 +150,7 @@ grub_uhci_pci_iter (int bus, int device, int func,
|
||||||
struct grub_uhci *u;
|
struct grub_uhci *u;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
addr = grub_pci_make_address (bus, device, func, 2);
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||||
class_code = grub_pci_read (addr) >> 8;
|
class_code = grub_pci_read (addr) >> 8;
|
||||||
|
|
||||||
interf = class_code & 0xFF;
|
interf = class_code & 0xFF;
|
||||||
|
@ -163,7 +162,7 @@ grub_uhci_pci_iter (int bus, int device, int func,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Determine IO base address. */
|
/* Determine IO base address. */
|
||||||
addr = grub_pci_make_address (bus, device, func, 8);
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG4);
|
||||||
base = grub_pci_read (addr);
|
base = grub_pci_read (addr);
|
||||||
/* Stop if there is no IO space base address defined. */
|
/* Stop if there is no IO space base address defined. */
|
||||||
if (! (base & 1))
|
if (! (base & 1))
|
||||||
|
@ -435,6 +434,7 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
||||||
grub_uhci_td_t td_prev = NULL;
|
grub_uhci_td_t td_prev = NULL;
|
||||||
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
||||||
int i;
|
int i;
|
||||||
|
grub_uint64_t endtime;
|
||||||
|
|
||||||
/* Allocate a queue head for the transfer queue. */
|
/* Allocate a queue head for the transfer queue. */
|
||||||
qh = grub_alloc_qh (u, GRUB_USB_TRANSACTION_TYPE_CONTROL);
|
qh = grub_alloc_qh (u, GRUB_USB_TRANSACTION_TYPE_CONTROL);
|
||||||
|
@ -483,6 +483,7 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
||||||
|
|
||||||
/* Wait until either the transaction completed or an error
|
/* Wait until either the transaction completed or an error
|
||||||
occurred. */
|
occurred. */
|
||||||
|
endtime = grub_get_time_ms () + 1000;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
grub_uhci_td_t errtd;
|
grub_uhci_td_t errtd;
|
||||||
|
@ -534,6 +535,13 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
||||||
updated. */
|
updated. */
|
||||||
grub_dprintf ("uhci", "transaction fallthrough\n");
|
grub_dprintf ("uhci", "transaction fallthrough\n");
|
||||||
}
|
}
|
||||||
|
if (grub_get_time_ms () > endtime)
|
||||||
|
{
|
||||||
|
err = GRUB_USB_ERR_STALL;
|
||||||
|
grub_dprintf ("uhci", "transaction timed out\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
grub_cpu_idle ();
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_dprintf ("uhci", "transaction complete\n");
|
grub_dprintf ("uhci", "transaction complete\n");
|
||||||
|
@ -573,6 +581,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
struct grub_uhci *u = (struct grub_uhci *) dev->data;
|
struct grub_uhci *u = (struct grub_uhci *) dev->data;
|
||||||
int reg;
|
int reg;
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
|
grub_uint64_t endtime;
|
||||||
|
|
||||||
grub_dprintf ("uhci", "enable=%d port=%d\n", enable, port);
|
grub_dprintf ("uhci", "enable=%d port=%d\n", enable, port);
|
||||||
|
|
||||||
|
@ -595,6 +604,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
|
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
|
||||||
grub_dprintf ("uhci", "reset completed\n");
|
grub_dprintf ("uhci", "reset completed\n");
|
||||||
|
grub_millisleep (10);
|
||||||
|
|
||||||
/* Enable the port. */
|
/* Enable the port. */
|
||||||
grub_uhci_writereg16 (u, reg, enable << 2);
|
grub_uhci_writereg16 (u, reg, enable << 2);
|
||||||
|
@ -602,7 +612,10 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
|
|
||||||
grub_dprintf ("uhci", "waiting for the port to be enabled\n");
|
grub_dprintf ("uhci", "waiting for the port to be enabled\n");
|
||||||
|
|
||||||
while (! (grub_uhci_readreg16 (u, reg) & (1 << 2)));
|
endtime = grub_get_time_ms () + 1000;
|
||||||
|
while (! (grub_uhci_readreg16 (u, reg) & (1 << 2)))
|
||||||
|
if (grub_get_time_ms () > endtime)
|
||||||
|
return grub_error (GRUB_ERR_IO, "UHCI Timed out");
|
||||||
|
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
||||||
|
|
|
@ -155,42 +155,6 @@ grub_usb_get_endpdescriptor (grub_usb_device_t usbdev, int addr)
|
||||||
return NULL;
|
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_err_t
|
||||||
grub_usb_device_initialize (grub_usb_device_t dev)
|
grub_usb_device_initialize (grub_usb_device_t dev)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,9 +48,9 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
|
||||||
if (! grub_usb_devs[i])
|
if (! grub_usb_devs[i])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (grub_usb_devs[i])
|
if (i == 128)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_IO, "Can't assign address to USB device");
|
grub_error (GRUB_ERR_IO, "can't assign address to USB device");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
|
||||||
| GRUB_USB_REQTYPE_TARGET_DEV),
|
| GRUB_USB_REQTYPE_TARGET_DEV),
|
||||||
GRUB_USB_REQ_SET_ADDRESS,
|
GRUB_USB_REQ_SET_ADDRESS,
|
||||||
i, 0, 0, NULL);
|
i, 0, 0, NULL);
|
||||||
|
|
||||||
dev->addr = i;
|
dev->addr = i;
|
||||||
dev->initialized = 1;
|
dev->initialized = 1;
|
||||||
grub_usb_devs[i] = dev;
|
grub_usb_devs[i] = dev;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/machine/memory.h>
|
#include <grub/machine/memory.h>
|
||||||
#include <grub/memory.h>
|
#include <grub/memory.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_EFI
|
#ifdef GRUB_MACHINE_EFI
|
||||||
#include <grub/efi/efi.h>
|
#include <grub/efi/efi.h>
|
||||||
|
@ -36,23 +37,23 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
static const struct grub_arg_option options[] = {
|
||||||
{"exclude", 'x', 0,
|
{"exclude", 'x', 0,
|
||||||
"Don't load host tables specified by comma-separated list",
|
N_("Don't load host tables specified by comma-separated list."),
|
||||||
0, ARG_TYPE_STRING},
|
0, ARG_TYPE_STRING},
|
||||||
{"load-only", 'n', 0,
|
{"load-only", 'n', 0,
|
||||||
"Load only tables specified by comma-separated list", 0, ARG_TYPE_STRING},
|
N_("Load only tables specified by comma-separated list."), 0, ARG_TYPE_STRING},
|
||||||
{"v1", '1', 0, "Expose v1 tables", 0, ARG_TYPE_NONE},
|
{"v1", '1', 0, N_("Expose v1 tables."), 0, ARG_TYPE_NONE},
|
||||||
{"v2", '2', 0, "Expose v2 and v3 tables", 0, ARG_TYPE_NONE},
|
{"v2", '2', 0, N_("Expose v2 and v3 tables."), 0, ARG_TYPE_NONE},
|
||||||
{"oemid", 'o', 0, "Set OEMID of RSDP, XSDT and RSDT", 0, ARG_TYPE_STRING},
|
{"oemid", 'o', 0, N_("Set OEMID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
|
||||||
{"oemtable", 't', 0,
|
{"oemtable", 't', 0,
|
||||||
"Set OEMTABLE ID of RSDP, XSDT and RSDT", 0, ARG_TYPE_STRING},
|
N_("Set OEMTABLE ID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
|
||||||
{"oemtablerev", 'r', 0,
|
{"oemtablerev", 'r', 0,
|
||||||
"Set OEMTABLE revision of RSDP, XSDT and RSDT", 0, ARG_TYPE_INT},
|
N_("Set OEMTABLE revision of RSDP, XSDT and RSDT."), 0, ARG_TYPE_INT},
|
||||||
{"oemtablecreator", 'c', 0,
|
{"oemtablecreator", 'c', 0,
|
||||||
"Set creator field of RSDP, XSDT and RSDT", 0, ARG_TYPE_STRING},
|
N_("Set creator field of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
|
||||||
{"oemtablecreatorrev", 'd', 0,
|
{"oemtablecreatorrev", 'd', 0,
|
||||||
"Set creator revision of RSDP, XSDT and RSDT", 0, ARG_TYPE_INT},
|
N_("Set creator revision of RSDP, XSDT and RSDT."), 0, ARG_TYPE_INT},
|
||||||
{"no-ebda", 'e', 0, "Don't update EBDA. May fix failures or hangs on some"
|
{"no-ebda", 'e', 0, N_("Don't update EBDA. May fix failures or hangs on some."
|
||||||
" BIOSes but makes it ineffective with OS not receiving RSDP from GRUB",
|
" BIOSes but makes it ineffective with OS not receiving RSDP from GRUB."),
|
||||||
0, ARG_TYPE_NONE},
|
0, ARG_TYPE_NONE},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
@ -228,7 +229,7 @@ grub_acpi_create_ebda (void)
|
||||||
sizeof (struct grub_acpi_rsdp_v10)) == 0)
|
sizeof (struct grub_acpi_rsdp_v10)) == 0)
|
||||||
{
|
{
|
||||||
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10));
|
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10));
|
||||||
grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
|
grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
|
||||||
v1inebda = target;
|
v1inebda = target;
|
||||||
target += sizeof (struct grub_acpi_rsdp_v10);
|
target += sizeof (struct grub_acpi_rsdp_v10);
|
||||||
target = (grub_uint8_t *) ((((long) target - 1) | 0xf) + 1);
|
target = (grub_uint8_t *) ((((long) target - 1) | 0xf) + 1);
|
||||||
|
@ -277,7 +278,7 @@ grub_acpi_create_ebda (void)
|
||||||
{
|
{
|
||||||
grub_mmap_unregister (mmapregion);
|
grub_mmap_unregister (mmapregion);
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||||
"Couldn't find suitable spot in EBDA");
|
"couldn't find suitable spot in EBDA");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove any other RSDT. */
|
/* Remove any other RSDT. */
|
||||||
|
@ -551,7 +552,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
|
||||||
grub_free (exclude);
|
grub_free (exclude);
|
||||||
grub_free (load_only);
|
grub_free (load_only);
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||||
"Couldn't allocate table");
|
"couldn't allocate table");
|
||||||
}
|
}
|
||||||
grub_memcpy (table_dsdt, dsdt, dsdt->length);
|
grub_memcpy (table_dsdt, dsdt, dsdt->length);
|
||||||
}
|
}
|
||||||
|
@ -578,7 +579,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
|
||||||
grub_free (exclude);
|
grub_free (exclude);
|
||||||
grub_free (load_only);
|
grub_free (load_only);
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||||
"Couldn't allocate table structure");
|
"couldn't allocate table structure");
|
||||||
}
|
}
|
||||||
table->size = curtable->length;
|
table->size = curtable->length;
|
||||||
table->addr = grub_malloc (table->size);
|
table->addr = grub_malloc (table->size);
|
||||||
|
@ -587,7 +588,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
|
||||||
{
|
{
|
||||||
free_tables ();
|
free_tables ();
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||||
"Couldn't allocate table");
|
"couldn't allocate table");
|
||||||
}
|
}
|
||||||
table->next = acpi_tables;
|
table->next = acpi_tables;
|
||||||
acpi_tables = table;
|
acpi_tables = table;
|
||||||
|
@ -674,7 +675,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
|
||||||
{
|
{
|
||||||
free_tables ();
|
free_tables ();
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||||
"Couldn't allocate table structure");
|
"couldn't allocate table structure");
|
||||||
}
|
}
|
||||||
|
|
||||||
table->size = size;
|
table->size = size;
|
||||||
|
@ -709,7 +710,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd,
|
||||||
{
|
{
|
||||||
free_tables ();
|
free_tables ();
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||||
"Couldn't allocate space for ACPI tables");
|
"couldn't allocate space for ACPI tables");
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_common_tables ();
|
setup_common_tables ();
|
||||||
|
@ -759,11 +760,11 @@ GRUB_MOD_INIT(acpi)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi,
|
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"acpi [-1|-2] [--exclude=table1,table2|"
|
N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
|
||||||
"--load-only=table1,table2] filename1 "
|
"--load-only=table1,table2] FILE1"
|
||||||
" [filename2] [...]",
|
" [FILE2] [...]"),
|
||||||
"Load host acpi tables and tables "
|
N_("Load host ACPI tables and tables "
|
||||||
"specified by arguments",
|
"specified by arguments."),
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <grub/disk.h>
|
#include <grub/disk.h>
|
||||||
#include <grub/partition.h>
|
#include <grub/partition.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
@ -87,10 +88,9 @@ grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
|
||||||
if (! file->device->disk)
|
if (! file->device->disk)
|
||||||
return grub_error (GRUB_ERR_BAD_DEVICE,
|
return grub_error (GRUB_ERR_BAD_DEVICE,
|
||||||
"this command is available only for disk devices.");
|
"this command is available only for disk devices");
|
||||||
|
|
||||||
if (file->device->disk->partition)
|
part_start = grub_partition_get_start (file->device->disk->partition);
|
||||||
part_start = grub_partition_get_start (file->device->disk->partition);
|
|
||||||
|
|
||||||
file->read_hook = read_blocklist;
|
file->read_hook = read_blocklist;
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(blocklist)
|
GRUB_MOD_INIT(blocklist)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("blocklist", grub_cmd_blocklist,
|
cmd = grub_register_command ("blocklist", grub_cmd_blocklist,
|
||||||
"blocklist FILE", "Print a block list.");
|
N_("FILE"), N_("Print a block list."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(blocklist)
|
GRUB_MOD_FINI(blocklist)
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <grub/loader.h>
|
#include <grub/loader.h>
|
||||||
#include <grub/kernel.h>
|
#include <grub/kernel.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t (*grub_loader_boot_func) (void);
|
static grub_err_t (*grub_loader_boot_func) (void);
|
||||||
static grub_err_t (*grub_loader_unload_func) (void);
|
static grub_err_t (*grub_loader_unload_func) (void);
|
||||||
|
@ -186,7 +187,7 @@ GRUB_MOD_INIT(boot)
|
||||||
{
|
{
|
||||||
cmd_boot =
|
cmd_boot =
|
||||||
grub_register_command ("boot", grub_cmd_boot,
|
grub_register_command ("boot", grub_cmd_boot,
|
||||||
0, "boot an operating system");
|
0, N_("Boot an operating system."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(boot)
|
GRUB_MOD_FINI(boot)
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/gzio.h>
|
#include <grub/gzio.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_cat (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_cat (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
@ -40,7 +41,7 @@ grub_cmd_cat (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
|
||||||
file = grub_gzfile_open (args[0], 1);
|
file = grub_gzfile_open (args[0], 1);
|
||||||
if (! file)
|
if (! file)
|
||||||
return 0;
|
return grub_errno;
|
||||||
|
|
||||||
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0
|
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0
|
||||||
&& key != GRUB_TERM_ESC)
|
&& key != GRUB_TERM_ESC)
|
||||||
|
@ -78,7 +79,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(cat)
|
GRUB_MOD_INIT(cat)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command_p1 ("cat", grub_cmd_cat,
|
cmd = grub_register_command_p1 ("cat", grub_cmd_cat,
|
||||||
"cat FILE", "Show the contents of a file.");
|
N_("FILE"), N_("Show the contents of a file."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(cat)
|
GRUB_MOD_FINI(cat)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* cmd.c - command to cmp an operating system */
|
/* cmd.c - command to cmp an operating system */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2003,2005,2006,2007 Free Software Foundation, Inc.
|
* Copyright (C) 2003,2005,2006,2007,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/gzio.h>
|
#include <grub/gzio.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
#define BUFFER_SIZE 512
|
#define BUFFER_SIZE 512
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
|
||||||
|
|
||||||
grub_printf ("Compare `%s' and `%s':\n", args[0],
|
grub_printf ("Compare file `%s' with `%s':\n", args[0],
|
||||||
args[1]);
|
args[1]);
|
||||||
|
|
||||||
file1 = grub_gzfile_open (args[0], 1);
|
file1 = grub_gzfile_open (args[0], 1);
|
||||||
|
@ -49,7 +50,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (grub_file_size (file1) != grub_file_size (file2))
|
if (grub_file_size (file1) != grub_file_size (file2))
|
||||||
grub_printf ("Differ in size: %llu [%s], %llu [%s]\n",
|
grub_printf ("Files differ in size: %llu [%s], %llu [%s]\n",
|
||||||
(unsigned long long) grub_file_size (file1), args[0],
|
(unsigned long long) grub_file_size (file1), args[0],
|
||||||
(unsigned long long) grub_file_size (file2), args[1]);
|
(unsigned long long) grub_file_size (file2), args[1]);
|
||||||
else
|
else
|
||||||
|
@ -76,7 +77,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
if (buf1[i] != buf2[i])
|
if (buf1[i] != buf2[i])
|
||||||
{
|
{
|
||||||
grub_printf ("Differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n",
|
grub_printf ("Files differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n",
|
||||||
(unsigned long long) (i + pos), buf1[i], args[0],
|
(unsigned long long) (i + pos), buf1[i], args[0],
|
||||||
buf2[i], args[1]);
|
buf2[i], args[1]);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -109,7 +110,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(cmp)
|
GRUB_MOD_INIT(cmp)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("cmp", grub_cmd_cmp,
|
cmd = grub_register_command ("cmp", grub_cmd_cmp,
|
||||||
"cmp FILE1 FILE2", "Compare two files.");
|
N_("FILE1 FILE2"), N_("Compare two files."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(cmp)
|
GRUB_MOD_FINI(cmp)
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/normal.h>
|
#include <grub/normal.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_source (grub_command_t cmd, int argc, char **args)
|
grub_cmd_source (grub_command_t cmd, int argc, char **args)
|
||||||
|
@ -53,16 +54,16 @@ GRUB_MOD_INIT(configfile)
|
||||||
{
|
{
|
||||||
cmd_configfile =
|
cmd_configfile =
|
||||||
grub_register_command ("configfile", grub_cmd_source,
|
grub_register_command ("configfile", grub_cmd_source,
|
||||||
"configfile FILE", "Load another config file.");
|
N_("FILE"), N_("Load another config file."));
|
||||||
cmd_source =
|
cmd_source =
|
||||||
grub_register_command ("source", grub_cmd_source,
|
grub_register_command ("source", grub_cmd_source,
|
||||||
"source FILE",
|
N_("FILE"),
|
||||||
"Load another config file without changing context."
|
N_("Load another config file without changing context.")
|
||||||
);
|
);
|
||||||
cmd_dot =
|
cmd_dot =
|
||||||
grub_register_command (".", grub_cmd_source,
|
grub_register_command (".", grub_cmd_source,
|
||||||
". FILE",
|
N_("FILE"),
|
||||||
"Load another config file without changing context."
|
N_("Load another config file without changing context.")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* crc.c - command to calculate the crc32 checksum of a file */
|
/* crc.c - command to calculate the crc32 checksum of a file */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
* Copyright (C) 2008,2010 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -23,6 +23,7 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/lib/crc.h>
|
#include <grub/lib/crc.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_crc (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_crc (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
@ -45,10 +46,13 @@ grub_cmd_crc (grub_command_t cmd __attribute__ ((unused)),
|
||||||
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0)
|
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0)
|
||||||
crc = grub_getcrc32 (crc, buf, size);
|
crc = grub_getcrc32 (crc, buf, size);
|
||||||
|
|
||||||
grub_file_close (file);
|
if (grub_errno)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
grub_printf ("%08x\n", crc);
|
grub_printf ("%08x\n", crc);
|
||||||
|
|
||||||
|
fail:
|
||||||
|
grub_file_close (file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,8 +61,8 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(crc)
|
GRUB_MOD_INIT(crc)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("crc", grub_cmd_crc,
|
cmd = grub_register_command ("crc", grub_cmd_crc,
|
||||||
"crc FILE",
|
N_("FILE"),
|
||||||
"Calculate the crc32 checksum of a file.");
|
N_("Calculate the crc32 checksum of a file."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(crc)
|
GRUB_MOD_FINI(crc)
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/datetime.h>
|
#include <grub/datetime.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
#define GRUB_DATETIME_SET_YEAR 1
|
#define GRUB_DATETIME_SET_YEAR 1
|
||||||
#define GRUB_DATETIME_SET_MONTH 2
|
#define GRUB_DATETIME_SET_MONTH 2
|
||||||
|
@ -135,8 +136,8 @@ GRUB_MOD_INIT(date)
|
||||||
{
|
{
|
||||||
cmd =
|
cmd =
|
||||||
grub_register_command ("date", grub_cmd_date,
|
grub_register_command ("date", grub_cmd_date,
|
||||||
"date [[year-]month-day] [hour:minute[:second]]",
|
N_("[[year-]month-day] [hour:minute[:second]]"),
|
||||||
"Command to display/set current datetime.");
|
N_("Command to display/set current datetime."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(date)
|
GRUB_MOD_FINI(date)
|
||||||
|
|
|
@ -20,11 +20,12 @@
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{0, 'n', 0, "do not output the trailing newline", 0, 0},
|
{0, 'n', 0, N_("Do not output the trailing newline."), 0, 0},
|
||||||
{0, 'e', 0, "enable interpretation of backslash escapes", 0, 0},
|
{0, 'e', 0, N_("Enable interpretation of backslash escapes."), 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ static grub_extcmd_t cmd;
|
||||||
GRUB_MOD_INIT(echo)
|
GRUB_MOD_INIT(echo)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("echo", grub_cmd_echo, GRUB_COMMAND_FLAG_BOTH,
|
cmd = grub_register_extcmd ("echo", grub_cmd_echo, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"echo [-e|-n] STRING", "Display a line of text.",
|
N_("[-e|-n] STRING"), N_("Display a line of text."),
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <grub/file.h>
|
#include <grub/file.h>
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static struct grub_video_patch
|
static struct grub_video_patch
|
||||||
{
|
{
|
||||||
|
@ -38,11 +39,11 @@ static struct grub_video_patch
|
||||||
};
|
};
|
||||||
|
|
||||||
static int NESTED_FUNC_ATTR
|
static int NESTED_FUNC_ATTR
|
||||||
scan_card (int bus, int dev, int func, grub_pci_id_t pciid)
|
scan_card (grub_pci_device_t dev, grub_pci_id_t pciid)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
|
||||||
addr = grub_pci_make_address (bus, dev, func, 2);
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||||
if (grub_pci_read_byte (addr + 3) == 0x3)
|
if (grub_pci_read_byte (addr + 3) == 0x3)
|
||||||
{
|
{
|
||||||
struct grub_video_patch *p = video_patches;
|
struct grub_video_patch *p = video_patches;
|
||||||
|
@ -99,7 +100,7 @@ static grub_command_t cmd_fixvideo;
|
||||||
GRUB_MOD_INIT(fixvideo)
|
GRUB_MOD_INIT(fixvideo)
|
||||||
{
|
{
|
||||||
cmd_fixvideo = grub_register_command ("fix_video", grub_cmd_fixvideo,
|
cmd_fixvideo = grub_register_command ("fix_video", grub_cmd_fixvideo,
|
||||||
0, "Fix video problem.");
|
0, N_("Fix video problem."));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <grub/efi/efi.h>
|
#include <grub/efi/efi.h>
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
|
static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
|
||||||
static grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
|
static grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
|
||||||
|
@ -41,15 +42,17 @@ enable_rom_area (void)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
grub_uint32_t *rom_ptr;
|
grub_uint32_t *rom_ptr;
|
||||||
|
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
||||||
|
|
||||||
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
|
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
|
||||||
if (*rom_ptr != BLANK_MEM)
|
if (*rom_ptr != BLANK_MEM)
|
||||||
{
|
{
|
||||||
grub_printf ("ROM image present.\n");
|
grub_printf ("ROM image is present.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
addr = grub_pci_make_address (0, 0, 0, 36);
|
/* FIXME: should be macroified. */
|
||||||
|
addr = grub_pci_make_address (dev, 144);
|
||||||
grub_pci_write_byte (addr++, 0x30);
|
grub_pci_write_byte (addr++, 0x30);
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
grub_pci_write_byte (addr++, 0x33);
|
||||||
grub_pci_write_byte (addr++, 0x33);
|
grub_pci_write_byte (addr++, 0x33);
|
||||||
|
@ -62,7 +65,7 @@ enable_rom_area (void)
|
||||||
*rom_ptr = 0;
|
*rom_ptr = 0;
|
||||||
if (*rom_ptr != 0)
|
if (*rom_ptr != 0)
|
||||||
{
|
{
|
||||||
grub_printf ("Can\'t enable rom area.\n");
|
grub_printf ("Can\'t enable ROM area.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,8 +76,10 @@ static void
|
||||||
lock_rom_area (void)
|
lock_rom_area (void)
|
||||||
{
|
{
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
||||||
|
|
||||||
addr = grub_pci_make_address (0, 0, 0, 36);
|
/* FIXME: should be macroified. */
|
||||||
|
addr = grub_pci_make_address (dev, 144);
|
||||||
grub_pci_write_byte (addr++, 0x10);
|
grub_pci_write_byte (addr++, 0x10);
|
||||||
grub_pci_write_byte (addr++, 0x11);
|
grub_pci_write_byte (addr++, 0x11);
|
||||||
grub_pci_write_byte (addr++, 0x11);
|
grub_pci_write_byte (addr++, 0x11);
|
||||||
|
@ -158,7 +163,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "No rom image specified");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no ROM image specified");
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
|
@ -167,7 +172,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
if (file->size != 4)
|
if (file->size != 4)
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid int10 dump size");
|
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid int10 dump size");
|
||||||
else
|
else
|
||||||
grub_file_read (file, (void *) 0x40, 4);
|
grub_file_read (file, (void *) 0x40, 4);
|
||||||
|
|
||||||
|
@ -182,7 +187,7 @@ grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
|
||||||
size = file->size;
|
size = file->size;
|
||||||
if ((size < 0x10000) || (size > 0x40000))
|
if ((size < 0x10000) || (size > 0x40000))
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid bios dump size");
|
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid bios dump size");
|
||||||
else if (enable_rom_area ())
|
else if (enable_rom_area ())
|
||||||
{
|
{
|
||||||
grub_file_read (file, (void *) VBIOS_ADDR, size);
|
grub_file_read (file, (void *) VBIOS_ADDR, size);
|
||||||
|
@ -199,11 +204,11 @@ static grub_command_t cmd_fakebios, cmd_loadbios;
|
||||||
GRUB_MOD_INIT(loadbios)
|
GRUB_MOD_INIT(loadbios)
|
||||||
{
|
{
|
||||||
cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
|
cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
|
||||||
0, "fake bios.");
|
0, N_("Fake BIOS."));
|
||||||
|
|
||||||
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
|
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
|
||||||
"loadbios BIOS_DUMP [INT10_DUMP]",
|
"BIOS_DUMP [INT10_DUMP]",
|
||||||
"Load bios dump.");
|
N_("Load BIOS dump."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(loadbios)
|
GRUB_MOD_FINI(loadbios)
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/fs.h>
|
#include <grub/fs.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
/* Convert a LBA address to a CHS address in the INT 13 format. */
|
/* Convert a LBA address to a CHS address in the INT 13 format. */
|
||||||
/* Taken from grub1. */
|
/* Taken from grub1. */
|
||||||
|
@ -240,13 +241,13 @@ GRUB_MOD_INIT(gptsync)
|
||||||
{
|
{
|
||||||
(void) mod; /* To stop warning. */
|
(void) mod; /* To stop warning. */
|
||||||
cmd = grub_register_command ("gptsync", grub_cmd_gptsync,
|
cmd = grub_register_command ("gptsync", grub_cmd_gptsync,
|
||||||
"gptsync DEVICE [PARTITION[+/-[TYPE]]] ...",
|
N_("DEVICE [PARTITION[+/-[TYPE]]] ..."),
|
||||||
"Fill hybrid MBR of GPT drive DEVICE. "
|
N_("Fill hybrid MBR of GPT drive DEVICE. "
|
||||||
"specified partitions will be a part "
|
"specified partitions will be a part "
|
||||||
"of hybrid mbr. Up to 3 partitions are "
|
"of hybrid mbr. Up to 3 partitions are "
|
||||||
"allowed. TYPE is an MBR type. "
|
"allowed. TYPE is an MBR type. "
|
||||||
"+ means that partition is active. "
|
"+ means that partition is active. "
|
||||||
"Only one partition can be active");
|
"Only one partition can be active."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(gptsync)
|
GRUB_MOD_FINI(gptsync)
|
||||||
|
|
|
@ -19,15 +19,8 @@
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
#if defined(GRUB_MACHINE_IEEE1275)
|
#include <grub/i18n.h>
|
||||||
#include <grub/machine/kernel.h>
|
|
||||||
#elif defined(GRUB_MACHINE_EFI)
|
|
||||||
#include <grub/efi/efi.h>
|
|
||||||
#else
|
|
||||||
/* Platforms shipping standalone halt, such as coreboot. */
|
|
||||||
#include <grub/cpu/halt.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
@ -43,8 +36,8 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(halt)
|
GRUB_MOD_INIT(halt)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("halt", grub_cmd_halt,
|
cmd = grub_register_command ("halt", grub_cmd_halt,
|
||||||
0, "halts the computer. This command does not"
|
0, N_("Halts the computer. This command does"
|
||||||
" work on all firmware.");
|
" not work on all firmware implementations."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(halt)
|
GRUB_MOD_FINI(halt)
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
#include <grub/handler.h>
|
#include <grub/handler.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_handler (struct grub_command *cmd,
|
grub_cmd_handler (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
int argc, char **args)
|
int argc, char **args)
|
||||||
{
|
{
|
||||||
char *class_name;
|
|
||||||
void *curr_item = 0;
|
void *curr_item = 0;
|
||||||
grub_handler_class_t head;
|
grub_handler_class_t head;
|
||||||
|
|
||||||
|
@ -43,23 +43,19 @@ grub_cmd_handler (struct grub_command *cmd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
class_name = (grub_strcmp (cmd->name, "handler")) ? (char *) cmd->name : 0;
|
|
||||||
|
|
||||||
head = grub_handler_class_list;
|
head = grub_handler_class_list;
|
||||||
if ((argc == 0) && (class_name == 0))
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
grub_list_iterate (GRUB_AS_LIST (head), (grub_list_hook_t) list_item);
|
grub_list_iterate (GRUB_AS_LIST (head), (grub_list_hook_t) list_item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char *class_name;
|
||||||
grub_handler_class_t class;
|
grub_handler_class_t class;
|
||||||
|
|
||||||
if (class_name == 0)
|
class_name = args[0];
|
||||||
{
|
argc--;
|
||||||
class_name = args[0];
|
args++;
|
||||||
argc--;
|
|
||||||
args++;
|
|
||||||
}
|
|
||||||
|
|
||||||
class = grub_named_list_find (GRUB_AS_NAMED_LIST (head), class_name);
|
class = grub_named_list_find (GRUB_AS_NAMED_LIST (head), class_name);
|
||||||
if (! class)
|
if (! class)
|
||||||
|
@ -89,27 +85,17 @@ grub_cmd_handler (struct grub_command *cmd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_command_t cmd_handler, cmd_terminal_input, cmd_terminal_output;
|
static grub_command_t cmd_handler;
|
||||||
|
|
||||||
GRUB_MOD_INIT(handler)
|
GRUB_MOD_INIT(handler)
|
||||||
{
|
{
|
||||||
cmd_handler =
|
cmd_handler =
|
||||||
grub_register_command ("handler", grub_cmd_handler,
|
grub_register_command ("handler", grub_cmd_handler,
|
||||||
"handler [class [handler]]",
|
N_("[class [handler]]"),
|
||||||
"List or select a handler");
|
N_("List or select a handler."));
|
||||||
cmd_terminal_input =
|
|
||||||
grub_register_command ("terminal_input", grub_cmd_handler,
|
|
||||||
"terminal_input [handler]",
|
|
||||||
"List or select a handler");
|
|
||||||
cmd_terminal_output =
|
|
||||||
grub_register_command ("terminal_output", grub_cmd_handler,
|
|
||||||
"terminal_output [handler]",
|
|
||||||
"List or select a handler");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(handler)
|
GRUB_MOD_FINI(handler)
|
||||||
{
|
{
|
||||||
grub_unregister_command (cmd_handler);
|
grub_unregister_command (cmd_handler);
|
||||||
grub_unregister_command (cmd_terminal_input);
|
|
||||||
grub_unregister_command (cmd_terminal_output);
|
|
||||||
}
|
}
|
||||||
|
|
276
commands/hashsum.c
Normal file
276
commands/hashsum.c
Normal file
|
@ -0,0 +1,276 @@
|
||||||
|
/*
|
||||||
|
* 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/dl.h>
|
||||||
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/file.h>
|
||||||
|
#include <grub/disk.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/crypto.h>
|
||||||
|
#include <grub/normal.h>
|
||||||
|
|
||||||
|
static const struct grub_arg_option options[] = {
|
||||||
|
{"hash", 'h', 0, "Specify hash to use.", "HASH", ARG_TYPE_STRING},
|
||||||
|
{"check", 'c', 0, "Check hash list file.", "FILE", ARG_TYPE_STRING},
|
||||||
|
{"prefix", 'p', 0, "Base directory for hash list.", "DIRECTORY",
|
||||||
|
ARG_TYPE_STRING},
|
||||||
|
{"keep-going", 'k', 0, "Don't stop after first error.", 0, 0},
|
||||||
|
{0, 0, 0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct { const char *name; const char *hashname; } aliases[] =
|
||||||
|
{
|
||||||
|
{"sha256sum", "sha256"},
|
||||||
|
{"sha512sum", "sha512"},
|
||||||
|
{"md5sum", "md5"},
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
hextoval (char c)
|
||||||
|
{
|
||||||
|
if (c >= '0' && c <= '9')
|
||||||
|
return c - '0';
|
||||||
|
if (c >= 'a' && c <= 'f')
|
||||||
|
return c - 'a' + 10;
|
||||||
|
if (c >= 'A' && c <= 'F')
|
||||||
|
return c - 'A' + 10;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
|
||||||
|
{
|
||||||
|
grub_uint8_t context[hash->contextsize];
|
||||||
|
grub_uint8_t readbuf[4096];
|
||||||
|
|
||||||
|
grub_memset (context, 0, sizeof (context));
|
||||||
|
hash->init (context);
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
grub_ssize_t r;
|
||||||
|
r = grub_file_read (file, readbuf, sizeof (readbuf));
|
||||||
|
if (r < 0)
|
||||||
|
return grub_errno;
|
||||||
|
if (r == 0)
|
||||||
|
break;
|
||||||
|
hash->write (context, readbuf, r);
|
||||||
|
}
|
||||||
|
hash->final (context);
|
||||||
|
grub_memcpy (result, hash->read (context), hash->mdlen);
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
||||||
|
const char *prefix, int keep)
|
||||||
|
{
|
||||||
|
grub_file_t hashlist, file;
|
||||||
|
char *buf = NULL;
|
||||||
|
grub_uint8_t expected[hash->mdlen];
|
||||||
|
grub_uint8_t actual[hash->mdlen];
|
||||||
|
grub_err_t err;
|
||||||
|
unsigned i;
|
||||||
|
unsigned unread = 0, mismatch = 0;
|
||||||
|
|
||||||
|
hashlist = grub_file_open (hashfilename);
|
||||||
|
if (!hashlist)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
while (grub_free (buf), (buf = grub_file_getline (hashlist)))
|
||||||
|
{
|
||||||
|
const char *p = buf;
|
||||||
|
for (i = 0; i < hash->mdlen; i++)
|
||||||
|
{
|
||||||
|
int high, low;
|
||||||
|
high = hextoval (*p++);
|
||||||
|
low = hextoval (*p++);
|
||||||
|
if (high < 0 || low < 0)
|
||||||
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
|
||||||
|
expected[i] = (high << 4) | low;
|
||||||
|
}
|
||||||
|
if (*p++ != ' ' || *p++ != ' ')
|
||||||
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list");
|
||||||
|
if (prefix)
|
||||||
|
{
|
||||||
|
char *filename;
|
||||||
|
|
||||||
|
filename = grub_xasprintf ("%s/%s", prefix, p);
|
||||||
|
if (!filename)
|
||||||
|
return grub_errno;
|
||||||
|
file = grub_file_open (filename);
|
||||||
|
grub_free (filename);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
file = grub_file_open (p);
|
||||||
|
if (!file)
|
||||||
|
{
|
||||||
|
grub_file_close (hashlist);
|
||||||
|
grub_free (buf);
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
err = hash_file (file, hash, actual);
|
||||||
|
grub_file_close (file);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
grub_printf ("%s: READ ERROR\n", p);
|
||||||
|
if (!keep)
|
||||||
|
{
|
||||||
|
grub_file_close (hashlist);
|
||||||
|
grub_free (buf);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
grub_print_error ();
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
unread++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (grub_crypto_memcmp (expected, actual, hash->mdlen) != 0)
|
||||||
|
{
|
||||||
|
grub_printf ("%s: HASH MISMATCH\n", p);
|
||||||
|
if (!keep)
|
||||||
|
{
|
||||||
|
grub_file_close (hashlist);
|
||||||
|
grub_free (buf);
|
||||||
|
return grub_error (GRUB_ERR_TEST_FAILURE,
|
||||||
|
"hash of '%s' mismatches", p);
|
||||||
|
}
|
||||||
|
mismatch++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
grub_printf ("%s: OK\n", p);
|
||||||
|
}
|
||||||
|
if (mismatch || unread)
|
||||||
|
return grub_error (GRUB_ERR_TEST_FAILURE,
|
||||||
|
"%d files couldn't be read and hash "
|
||||||
|
"of %d files mismatches", unread, mismatch);
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_hashsum (struct grub_extcmd *cmd,
|
||||||
|
int argc, char **args)
|
||||||
|
{
|
||||||
|
struct grub_arg_list *state = cmd->state;
|
||||||
|
const char *hashname = NULL;
|
||||||
|
const char *prefix = NULL;
|
||||||
|
const gcry_md_spec_t *hash;
|
||||||
|
unsigned i;
|
||||||
|
int keep = state[3].set;
|
||||||
|
unsigned unread = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE (aliases); i++)
|
||||||
|
if (grub_strcmp (cmd->cmd->name, aliases[i].name) == 0)
|
||||||
|
hashname = aliases[i].hashname;
|
||||||
|
if (state[0].set)
|
||||||
|
hashname = state[0].arg;
|
||||||
|
|
||||||
|
if (!hashname)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no hash specified");
|
||||||
|
|
||||||
|
hash = grub_crypto_lookup_md_by_name (hashname);
|
||||||
|
if (!hash)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown hash");
|
||||||
|
|
||||||
|
if (state[2].set)
|
||||||
|
prefix = state[2].arg;
|
||||||
|
|
||||||
|
if (state[1].set)
|
||||||
|
{
|
||||||
|
if (argc != 0)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
|
"--check is incompatible with file list");
|
||||||
|
return check_list (hash, state[1].arg, prefix, keep);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < (unsigned) argc; i++)
|
||||||
|
{
|
||||||
|
grub_uint8_t result[hash->mdlen];
|
||||||
|
grub_file_t file;
|
||||||
|
grub_err_t err;
|
||||||
|
unsigned j;
|
||||||
|
file = grub_file_open (args[i]);
|
||||||
|
if (!file)
|
||||||
|
{
|
||||||
|
if (!keep)
|
||||||
|
return grub_errno;
|
||||||
|
grub_print_error ();
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
unread++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
err = hash_file (file, hash, result);
|
||||||
|
grub_file_close (file);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
if (!keep)
|
||||||
|
return err;
|
||||||
|
grub_print_error ();
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
unread++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (j = 0; j < hash->mdlen; j++)
|
||||||
|
grub_printf ("%02x", result[j]);
|
||||||
|
grub_printf (" %s\n", args[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unread)
|
||||||
|
return grub_error (GRUB_ERR_TEST_FAILURE, "%d files couldn't be read.",
|
||||||
|
unread);
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_extcmd_t cmd, cmd_md5, cmd_sha256, cmd_sha512;
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(hashsum)
|
||||||
|
{
|
||||||
|
cmd = grub_register_extcmd ("hashsum", grub_cmd_hashsum,
|
||||||
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
|
"hashsum -h HASH [-c FILE [-p PREFIX]] "
|
||||||
|
"[FILE1 [FILE2 ...]]",
|
||||||
|
"Compute or check hash checksum.",
|
||||||
|
options);
|
||||||
|
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum,
|
||||||
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
|
"md5sum [-c FILE [-p PREFIX]] "
|
||||||
|
"[FILE1 [FILE2 ...]]",
|
||||||
|
"Compute or check hash checksum.",
|
||||||
|
options);
|
||||||
|
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum,
|
||||||
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
|
"sha256sum [-c FILE [-p PREFIX]] "
|
||||||
|
"[FILE1 [FILE2 ...]]",
|
||||||
|
"Compute or check hash checksum.",
|
||||||
|
options);
|
||||||
|
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum,
|
||||||
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
|
"sha512sum [-c FILE [-p PREFIX]] "
|
||||||
|
"[FILE1 [FILE2 ...]]",
|
||||||
|
"Compute or check hash checksum.",
|
||||||
|
options);
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(hashsum)
|
||||||
|
{
|
||||||
|
grub_unregister_extcmd (cmd);
|
||||||
|
grub_unregister_extcmd (cmd_md5);
|
||||||
|
grub_unregister_extcmd (cmd_sha256);
|
||||||
|
grub_unregister_extcmd (cmd_sha512);
|
||||||
|
}
|
|
@ -24,29 +24,30 @@
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/lib/hexdump.h>
|
#include <grub/lib/hexdump.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
static const struct grub_arg_option options[] = {
|
||||||
{"apm", 'B', 0, "set Advanced Power Management\n"
|
{"apm", 'B', 0, N_("Set Advanced Power Management\n"
|
||||||
"(1=low, ..., 254=high, 255=off)",
|
"(1=low, ..., 254=high, 255=off)."),
|
||||||
0, ARG_TYPE_INT},
|
0, ARG_TYPE_INT},
|
||||||
{"power", 'C', 0, "check power mode", 0, ARG_TYPE_NONE},
|
{"power", 'C', 0, N_("Check power mode."), 0, ARG_TYPE_NONE},
|
||||||
{"security-freeze", 'F', 0, "freeze ATA security settings until reset",
|
{"security-freeze", 'F', 0, N_("Freeze ATA security settings until reset."),
|
||||||
0, ARG_TYPE_NONE},
|
0, ARG_TYPE_NONE},
|
||||||
{"health", 'H', 0, "check SMART health status", 0, ARG_TYPE_NONE},
|
{"health", 'H', 0, N_("Check SMART health status."), 0, ARG_TYPE_NONE},
|
||||||
{"aam", 'M', 0, "set Automatic Acoustic Management\n"
|
{"aam", 'M', 0, N_("Set Automatic Acoustic Management\n"
|
||||||
"(0=off, 128=quiet, ..., 254=fast)",
|
"(0=off, 128=quiet, ..., 254=fast)."),
|
||||||
0, ARG_TYPE_INT},
|
0, ARG_TYPE_INT},
|
||||||
{"standby-timeout", 'S', 0, "set standby timeout\n"
|
{"standby-timeout", 'S', 0, N_("Set standby timeout\n"
|
||||||
"(0=off, 1=5s, 2=10s, ..., 240=20m, 241=30m, ...)",
|
"(0=off, 1=5s, 2=10s, ..., 240=20m, 241=30m, ...)."),
|
||||||
0, ARG_TYPE_INT},
|
0, ARG_TYPE_INT},
|
||||||
{"standby", 'y', 0, "set drive to standby mode", 0, ARG_TYPE_NONE},
|
{"standby", 'y', 0, N_("Set drive to standby mode."), 0, ARG_TYPE_NONE},
|
||||||
{"sleep", 'Y', 0, "set drive to sleep mode", 0, ARG_TYPE_NONE},
|
{"sleep", 'Y', 0, N_("Set drive to sleep mode."), 0, ARG_TYPE_NONE},
|
||||||
{"identify", 'i', 0, "print drive identity and settings",
|
{"identify", 'i', 0, N_("Print drive identity and settings."),
|
||||||
0, ARG_TYPE_NONE},
|
0, ARG_TYPE_NONE},
|
||||||
{"dumpid", 'I', 0, "dump contents of ATA IDENTIFY sector",
|
{"dumpid", 'I', 0, N_("Dump contents of ATA IDENTIFY sector."),
|
||||||
0, ARG_TYPE_NONE},
|
0, ARG_TYPE_NONE},
|
||||||
{"smart", -1, 0, "disable/enable SMART (0/1)", 0, ARG_TYPE_INT},
|
{"smart", -1, 0, N_("Disable/enable SMART (0/1)."), 0, ARG_TYPE_INT},
|
||||||
{"quiet", 'q', 0, "do not print messages", 0, ARG_TYPE_NONE},
|
{"quiet", 'q', 0, N_("Do not print messages."), 0, ARG_TYPE_NONE},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -410,8 +411,8 @@ GRUB_MOD_INIT(hdparm)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm,
|
cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"hdparm [OPTIONS] DISK",
|
N_("[OPTIONS] DISK"),
|
||||||
"Get/set ATA disk parameters.", options);
|
N_("Get/set ATA disk parameters."), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(hdparm)
|
GRUB_MOD_FINI(hdparm)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* help.c - command to show a help text. */
|
/* help.c - command to show a help text. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2005,2007,2008 Free Software Foundation, Inc.
|
* Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -21,6 +21,10 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <grub/normal.h>
|
||||||
|
#include <grub/charset.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
||||||
|
@ -37,18 +41,49 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
||||||
if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) &&
|
if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) &&
|
||||||
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
|
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
|
||||||
{
|
{
|
||||||
char description[GRUB_TERM_WIDTH / 2];
|
struct grub_term_output *term;
|
||||||
int desclen = grub_strlen (cmd->summary);
|
const char *summary_translated = _(cmd->summary);
|
||||||
|
char *command_help;
|
||||||
|
grub_uint32_t *unicode_command_help;
|
||||||
|
grub_uint32_t *unicode_last_position;
|
||||||
|
|
||||||
/* Make a string with a length of GRUB_TERM_WIDTH / 2 - 1 filled
|
command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated);
|
||||||
with the description followed by spaces. */
|
if (!command_help)
|
||||||
grub_memset (description, ' ', GRUB_TERM_WIDTH / 2 - 1);
|
return 1;
|
||||||
description[GRUB_TERM_WIDTH / 2 - 1] = '\0';
|
|
||||||
grub_memcpy (description, cmd->summary,
|
|
||||||
(desclen < GRUB_TERM_WIDTH / 2 - 1
|
|
||||||
? desclen : GRUB_TERM_WIDTH / 2 - 1));
|
|
||||||
|
|
||||||
grub_printf ("%s%s", description, (cnt++) % 2 ? "\n" : " ");
|
grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
|
||||||
|
&unicode_last_position);
|
||||||
|
|
||||||
|
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||||
|
{
|
||||||
|
unsigned stringwidth;
|
||||||
|
grub_uint32_t *unicode_last_screen_position;
|
||||||
|
|
||||||
|
unicode_last_screen_position = unicode_command_help;
|
||||||
|
|
||||||
|
stringwidth = 0;
|
||||||
|
|
||||||
|
while (unicode_last_screen_position < unicode_last_position &&
|
||||||
|
stringwidth < ((grub_term_width (term) / 2) - 2))
|
||||||
|
{
|
||||||
|
stringwidth
|
||||||
|
+= grub_term_getcharwidth (term,
|
||||||
|
*unicode_last_screen_position);
|
||||||
|
unicode_last_screen_position++;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_print_ucs4 (unicode_command_help,
|
||||||
|
unicode_last_screen_position, term);
|
||||||
|
if (!(cnt % 2))
|
||||||
|
grub_print_spaces (term, grub_term_width (term) / 2
|
||||||
|
- stringwidth);
|
||||||
|
}
|
||||||
|
if (cnt % 2)
|
||||||
|
grub_printf ("\n");
|
||||||
|
cnt++;
|
||||||
|
|
||||||
|
grub_free (command_help);
|
||||||
|
grub_free (unicode_command_help);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -65,15 +100,19 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
||||||
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
|
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
|
||||||
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
||||||
else
|
else
|
||||||
grub_printf ("Usage: %s\n%s\b", cmd->summary,
|
grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
|
||||||
cmd->description);
|
_(cmd->description));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
grub_command_iterate (print_command_info);
|
{
|
||||||
|
grub_command_iterate (print_command_info);
|
||||||
|
if (!(cnt % 2))
|
||||||
|
grub_printf ("\n");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -94,8 +133,8 @@ GRUB_MOD_INIT(help)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("help", grub_cmd_help,
|
cmd = grub_register_extcmd ("help", grub_cmd_help,
|
||||||
GRUB_COMMAND_FLAG_CMDLINE,
|
GRUB_COMMAND_FLAG_CMDLINE,
|
||||||
"help [PATTERN ...]",
|
N_("[PATTERN ...]"),
|
||||||
"Show a help message.", 0);
|
N_("Show a help message."), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(help)
|
GRUB_MOD_FINI(help)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* hexdump.c - command to dump the contents of a file or memory */
|
/* hexdump.c - command to dump the contents of a file or memory */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2007,2008 Free Software Foundation, Inc.
|
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -24,11 +24,12 @@
|
||||||
#include <grub/gzio.h>
|
#include <grub/gzio.h>
|
||||||
#include <grub/lib/hexdump.h>
|
#include <grub/lib/hexdump.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
static const struct grub_arg_option options[] = {
|
||||||
{"skip", 's', 0, "skip offset bytes from the beginning of file.", 0,
|
{"skip", 's', 0, N_("Skip offset bytes from the beginning of file."), 0,
|
||||||
ARG_TYPE_INT},
|
ARG_TYPE_INT},
|
||||||
{"length", 'n', 0, "read only length bytes", 0, ARG_TYPE_INT},
|
{"length", 'n', 0, N_("Read only LENGTH bytes."), 0, ARG_TYPE_INT},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -38,18 +39,18 @@ grub_cmd_hexdump (grub_extcmd_t cmd, int argc, char **args)
|
||||||
struct grub_arg_list *state = cmd->state;
|
struct grub_arg_list *state = cmd->state;
|
||||||
char buf[GRUB_DISK_SECTOR_SIZE * 4];
|
char buf[GRUB_DISK_SECTOR_SIZE * 4];
|
||||||
grub_ssize_t size, length;
|
grub_ssize_t size, length;
|
||||||
grub_addr_t skip;
|
grub_disk_addr_t skip;
|
||||||
int namelen;
|
int namelen;
|
||||||
|
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||||
|
|
||||||
namelen = grub_strlen (args[0]);
|
namelen = grub_strlen (args[0]);
|
||||||
skip = (state[0].set) ? grub_strtoul (state[0].arg, 0, 0) : 0;
|
skip = (state[0].set) ? grub_strtoull (state[0].arg, 0, 0) : 0;
|
||||||
length = (state[1].set) ? grub_strtoul (state[1].arg, 0, 0) : 256;
|
length = (state[1].set) ? grub_strtoul (state[1].arg, 0, 0) : 256;
|
||||||
|
|
||||||
if (!grub_strcmp (args[0], "(mem)"))
|
if (!grub_strcmp (args[0], "(mem)"))
|
||||||
hexdump (skip, (char *) skip, length);
|
hexdump (skip, (char *) (grub_addr_t) skip, length);
|
||||||
else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')'))
|
else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')'))
|
||||||
{
|
{
|
||||||
grub_disk_t disk;
|
grub_disk_t disk;
|
||||||
|
@ -121,8 +122,8 @@ GRUB_MOD_INIT (hexdump)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump,
|
cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"hexdump [OPTIONS] FILE_OR_DEVICE",
|
N_("[OPTIONS] FILE_OR_DEVICE"),
|
||||||
"Dump the contents of a file or memory.",
|
N_("Dump the contents of a file or memory."),
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
#include <grub/i386/cpuid.h>
|
#include <grub/i386/cpuid.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
#define cpuid(num,a,b,c,d) \
|
#define cpuid(num,a,b,c,d) \
|
||||||
asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1" \
|
asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1" \
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"long-mode", 'l', 0, "check for long mode flag (default)", 0, 0},
|
{"long-mode", 'l', 0, N_("Check for long mode flag (default)."), 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,7 +89,7 @@ done:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cmd = grub_register_extcmd ("cpuid", grub_cmd_cpuid, GRUB_COMMAND_FLAG_BOTH,
|
cmd = grub_register_extcmd ("cpuid", grub_cmd_cpuid, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"cpuid [-l]", "Check for CPU features", options);
|
"[-l]", N_("Check for CPU features."), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(cpuid)
|
GRUB_MOD_FINI(cpuid)
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/machine/memory.h>
|
#include <grub/machine/memory.h>
|
||||||
#include <grub/machine/biosnum.h>
|
#include <grub/machine/biosnum.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
|
||||||
/* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */
|
/* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */
|
||||||
|
@ -33,9 +34,9 @@ static grub_uint32_t *const int13slot = UINT_TO_PTR (4 * 0x13);
|
||||||
|
|
||||||
/* Remember to update enum opt_idxs accordingly. */
|
/* Remember to update enum opt_idxs accordingly. */
|
||||||
static const struct grub_arg_option options[] = {
|
static const struct grub_arg_option options[] = {
|
||||||
{"list", 'l', 0, "show the current mappings", 0, 0},
|
{"list", 'l', 0, N_("Show the current mappings."), 0, 0},
|
||||||
{"reset", 'r', 0, "reset all mappings to the default values", 0, 0},
|
{"reset", 'r', 0, N_("Reset all mappings to the default values."), 0, 0},
|
||||||
{"swap", 's', 0, "perform both direct and reverse mappings", 0, 0},
|
{"swap", 's', 0, N_("Perform both direct and reverse mappings."), 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -308,7 +309,7 @@ install_int13_handler (int noret __attribute__ ((unused)))
|
||||||
GRUB_MACHINE_MEMORY_RESERVED,
|
GRUB_MACHINE_MEMORY_RESERVED,
|
||||||
GRUB_MMAP_MALLOC_LOW);
|
GRUB_MMAP_MALLOC_LOW);
|
||||||
if (! handler_base)
|
if (! handler_base)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "Could not reserve "
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't reserve "
|
||||||
"memory for the int13h handler");
|
"memory for the int13h handler");
|
||||||
|
|
||||||
/* Copy int13h handler bundle to reserved area. */
|
/* Copy int13h handler bundle to reserved area. */
|
||||||
|
@ -403,8 +404,8 @@ GRUB_MOD_INIT (drivemap)
|
||||||
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap,
|
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"drivemap"
|
"drivemap"
|
||||||
" -l | -r | [-s] grubdev osdisk",
|
N_("-l | -r | [-s] grubdev osdisk."),
|
||||||
"Manage the BIOS drive mappings",
|
N_("Manage the BIOS drive mappings."),
|
||||||
options);
|
options);
|
||||||
drivemap_hook =
|
drivemap_hook =
|
||||||
grub_loader_register_preboot_hook (&install_int13_handler,
|
grub_loader_register_preboot_hook (&install_int13_handler,
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
|
|
||||||
#define INT13H_OFFSET(x) ((x) - EXT_C(grub_drivemap_handler))
|
#define INT13H_OFFSET(x) ((x) - LOCAL (base))
|
||||||
|
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
/* The replacement int13 handler. Preserve all registers. */
|
/* The replacement int13 handler. Preserve all registers. */
|
||||||
FUNCTION(grub_drivemap_handler)
|
FUNCTION(grub_drivemap_handler)
|
||||||
|
LOCAL (base):
|
||||||
/* Save %dx for future restore. */
|
/* Save %dx for future restore. */
|
||||||
push %dx
|
push %dx
|
||||||
/* Push flags. Used to simulate interrupt with original flags. */
|
/* Push flags. Used to simulate interrupt with original flags. */
|
||||||
|
@ -35,12 +36,7 @@ FUNCTION(grub_drivemap_handler)
|
||||||
/* Map the drive number (always in DL). */
|
/* Map the drive number (always in DL). */
|
||||||
push %ax
|
push %ax
|
||||||
push %bx
|
push %bx
|
||||||
#ifdef APPLE_CC
|
movw $INT13H_OFFSET(LOCAL (mapstart)), %bx
|
||||||
grub_drivemap_mapstart_ofs = INT13H_OFFSET(EXT_C(grub_drivemap_mapstart))
|
|
||||||
movw $grub_drivemap_mapstart_ofs, %bx
|
|
||||||
#else
|
|
||||||
movw $INT13H_OFFSET(EXT_C(grub_drivemap_mapstart)), %bx
|
|
||||||
#endif
|
|
||||||
|
|
||||||
more_remaining:
|
more_remaining:
|
||||||
movw %cs:(%bx), %ax
|
movw %cs:(%bx), %ax
|
||||||
|
@ -66,12 +62,7 @@ not_found:
|
||||||
popf
|
popf
|
||||||
pushf
|
pushf
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
lcall *%cs:INT13H_OFFSET (LOCAL (oldhandler))
|
||||||
grub_drivemap_oldhandler_ofs = INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
|
||||||
lcall *%cs:grub_drivemap_oldhandler_ofs
|
|
||||||
#else
|
|
||||||
lcall *%cs:INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
push %bp
|
push %bp
|
||||||
mov %sp, %bp
|
mov %sp, %bp
|
||||||
|
@ -94,11 +85,7 @@ norestore:
|
||||||
popf
|
popf
|
||||||
pushf
|
pushf
|
||||||
|
|
||||||
#ifdef APPLE_CC
|
lcall *%cs:INT13H_OFFSET (LOCAL (oldhandler))
|
||||||
lcall *%cs:grub_drivemap_oldhandler_ofs
|
|
||||||
#else
|
|
||||||
lcall *%cs:INT13H_OFFSET (EXT_C (grub_drivemap_oldhandler))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
push %bp
|
push %bp
|
||||||
mov %sp, %bp
|
mov %sp, %bp
|
||||||
|
@ -111,9 +98,13 @@ norestore:
|
||||||
/* Far pointer to the old handler. Stored as a CS:IP in the style of real-mode
|
/* Far pointer to the old handler. Stored as a CS:IP in the style of real-mode
|
||||||
IVT entries (thus PI:SC in mem). */
|
IVT entries (thus PI:SC in mem). */
|
||||||
VARIABLE(grub_drivemap_oldhandler)
|
VARIABLE(grub_drivemap_oldhandler)
|
||||||
|
LOCAL (oldhandler):
|
||||||
.word 0x0, 0x0
|
.word 0x0, 0x0
|
||||||
|
|
||||||
/* This label MUST be at the end of the copied block, since the installer code
|
/* This label MUST be at the end of the copied block, since the installer code
|
||||||
reserves additional space for mappings at runtime and copies them over it. */
|
reserves additional space for mappings at runtime and copies them over it. */
|
||||||
.align 2
|
.align 2
|
||||||
|
|
||||||
VARIABLE(grub_drivemap_mapstart)
|
VARIABLE(grub_drivemap_mapstart)
|
||||||
|
LOCAL (mapstart):
|
||||||
|
.byte 0
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* halt.c - command to halt the computer. */
|
/* halt.c - command to halt the computer. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2005,2007 Free Software Foundation, Inc.
|
* Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,12 +18,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/machine/init.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"no-apm", 'n', 0, "do not use APM to halt the computer", 0, 0},
|
{"no-apm", 'n', 0, N_("Do not use APM to halt the computer."), 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,8 +47,8 @@ static grub_extcmd_t cmd;
|
||||||
GRUB_MOD_INIT(halt)
|
GRUB_MOD_INIT(halt)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
|
cmd = grub_register_extcmd ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"halt [-n]",
|
"[-n]",
|
||||||
"Halt the system, if possible using APM",
|
N_("Halt the system, if possible using APM."),
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* play.c - command to play a tune */
|
/* play.c - command to play a tune */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2005,2007 Free Software Foundation, Inc.
|
* Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -27,8 +27,9 @@
|
||||||
#include <grub/machine/time.h>
|
#include <grub/machine/time.h>
|
||||||
#include <grub/cpu/io.h>
|
#include <grub/cpu/io.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
#define BASE_TEMPO 120
|
#define BASE_TEMPO (60 * GRUB_TICKS_PER_SECOND)
|
||||||
|
|
||||||
/* The speaker port. */
|
/* The speaker port. */
|
||||||
#define SPEAKER 0x61
|
#define SPEAKER 0x61
|
||||||
|
@ -100,13 +101,13 @@
|
||||||
#define PIT_CTRL_COUNT_BINARY 0x00 /* 16-bit binary counter. */
|
#define PIT_CTRL_COUNT_BINARY 0x00 /* 16-bit binary counter. */
|
||||||
#define PIT_CTRL_COUNT_BCD 0x01 /* 4-decade BCD counter. */
|
#define PIT_CTRL_COUNT_BCD 0x01 /* 4-decade BCD counter. */
|
||||||
|
|
||||||
#define T_REST ((short) 0)
|
#define T_REST ((grub_uint16_t) 0)
|
||||||
#define T_FINE ((short) -1)
|
#define T_FINE ((grub_uint16_t) -1)
|
||||||
|
|
||||||
struct note
|
struct note
|
||||||
{
|
{
|
||||||
short pitch;
|
grub_uint16_t pitch;
|
||||||
short duration;
|
grub_uint16_t duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -119,7 +120,7 @@ beep_off (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
beep_on (short pitch)
|
beep_on (grub_uint16_t pitch)
|
||||||
{
|
{
|
||||||
unsigned char status;
|
unsigned char status;
|
||||||
unsigned int counter;
|
unsigned int counter;
|
||||||
|
@ -142,60 +143,111 @@ beep_on (short pitch)
|
||||||
grub_outb (status | SPEAKER_TMR2 | SPEAKER_DATA, SPEAKER);
|
grub_outb (status | SPEAKER_TMR2 | SPEAKER_DATA, SPEAKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns whether playing should continue. */
|
||||||
|
static int
|
||||||
|
play (unsigned tempo, struct note *note)
|
||||||
|
{
|
||||||
|
unsigned int to;
|
||||||
|
|
||||||
|
if (note->pitch == T_FINE || grub_checkkey () >= 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
grub_dprintf ("play", "pitch = %d, duration = %d\n", note->pitch,
|
||||||
|
note->duration);
|
||||||
|
|
||||||
|
switch (note->pitch)
|
||||||
|
{
|
||||||
|
case T_REST:
|
||||||
|
beep_off ();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
beep_on (note->pitch);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
to = grub_get_rtc () + BASE_TEMPO * note->duration / tempo;
|
||||||
|
while (((unsigned int) grub_get_rtc () <= to) && (grub_checkkey () < 0))
|
||||||
|
;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int argc, char **args)
|
int argc, char **args)
|
||||||
{
|
{
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
struct note buf;
|
|
||||||
int tempo;
|
|
||||||
unsigned int to;
|
|
||||||
|
|
||||||
if (argc != 1)
|
if (argc < 1)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required");
|
||||||
|
|
||||||
file = grub_file_open (args[0]);
|
file = grub_file_open (args[0]);
|
||||||
if (! file)
|
if (file)
|
||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
|
|
||||||
|
|
||||||
if (grub_file_read (file, &tempo, sizeof(tempo)) != sizeof(tempo))
|
|
||||||
{
|
{
|
||||||
grub_file_close (file);
|
struct note buf;
|
||||||
return grub_error (GRUB_ERR_FILE_READ_ERROR,
|
grub_uint32_t tempo;
|
||||||
"file doesn't even contains a full tempo record");
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("play","tempo = %d\n", tempo);
|
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
|
||||||
|
|
||||||
while (grub_file_read (file, &buf,
|
|
||||||
sizeof (struct note)) == sizeof (struct note)
|
|
||||||
&& buf.pitch != T_FINE && grub_checkkey () < 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
grub_dprintf ("play", "pitch = %d, duration = %d\n", buf.pitch,
|
|
||||||
buf.duration);
|
|
||||||
|
|
||||||
switch (buf.pitch)
|
|
||||||
{
|
{
|
||||||
case T_REST:
|
grub_file_close (file);
|
||||||
beep_off ();
|
return grub_error (GRUB_ERR_FILE_READ_ERROR,
|
||||||
break;
|
"file doesn't even contains a full tempo record");
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
tempo = grub_le_to_cpu32 (tempo);
|
||||||
beep_on (buf.pitch);
|
grub_dprintf ("play","tempo = %d\n", tempo);
|
||||||
|
|
||||||
|
while (grub_file_read (file, &buf,
|
||||||
|
sizeof (struct note)) == sizeof (struct note))
|
||||||
|
{
|
||||||
|
buf.pitch = grub_le_to_cpu16 (buf.pitch);
|
||||||
|
buf.duration = grub_le_to_cpu16 (buf.duration);
|
||||||
|
|
||||||
|
if (play (tempo, &buf))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
to = grub_get_rtc () + BASE_TEMPO * buf.duration / tempo;
|
grub_file_close (file);
|
||||||
while (((unsigned int) grub_get_rtc () <= to) && (grub_checkkey () < 0))
|
}
|
||||||
;
|
else
|
||||||
|
{
|
||||||
|
char *end;
|
||||||
|
unsigned tempo;
|
||||||
|
struct note note;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
tempo = grub_strtoul (args[0], &end, 0);
|
||||||
|
|
||||||
|
if (*end)
|
||||||
|
/* Was not a number either, assume it was supposed to be a file name. */
|
||||||
|
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
|
||||||
|
|
||||||
|
grub_dprintf ("play","tempo = %d\n", tempo);
|
||||||
|
|
||||||
|
for (i = 1; i + 1 < argc; i += 2)
|
||||||
|
{
|
||||||
|
note.pitch = grub_strtoul (args[i], &end, 0);
|
||||||
|
if (*end)
|
||||||
|
{
|
||||||
|
grub_error (GRUB_ERR_BAD_NUMBER, "bogus pitch number");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
note.duration = grub_strtoul (args[i + 1], &end, 0);
|
||||||
|
if (*end)
|
||||||
|
{
|
||||||
|
grub_error (GRUB_ERR_BAD_NUMBER, "bogus duration number");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (play (tempo, ¬e))
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
beep_off ();
|
beep_off ();
|
||||||
|
|
||||||
grub_file_close (file);
|
|
||||||
|
|
||||||
while (grub_checkkey () > 0)
|
while (grub_checkkey () > 0)
|
||||||
grub_getkey ();
|
grub_getkey ();
|
||||||
|
|
||||||
|
@ -207,7 +259,8 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(play)
|
GRUB_MOD_INIT(play)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("play", grub_cmd_play,
|
cmd = grub_register_command ("play", grub_cmd_play,
|
||||||
"play FILE", "Play a tune");
|
N_("FILE | TEMPO [PITCH1 DURATION1] [PITCH2 DURATION2] ... "),
|
||||||
|
N_("Play a tune."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(play)
|
GRUB_MOD_FINI(play)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* pxe.c - command to control the pxe driver */
|
/* pxe.c - command to control the pxe driver */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -21,79 +21,32 @@
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/machine/pxe.h>
|
#include <grub/machine/pxe.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
static const struct grub_arg_option options[] =
|
|
||||||
{
|
|
||||||
{"info", 'i', 0, "show PXE information.", 0, 0},
|
|
||||||
{"bsize", 'b', 0, "set PXE block size", 0, ARG_TYPE_INT},
|
|
||||||
{"unload", 'u', 0, "unload PXE stack.", 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_ip (grub_uint32_t ip)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
grub_printf ("%d.", ip & 0xFF);
|
|
||||||
ip >>= 8;
|
|
||||||
}
|
|
||||||
grub_printf ("%d", ip);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_pxe (grub_extcmd_t cmd, int argc __attribute__ ((unused)),
|
grub_cmd_pxe_unload (grub_command_t cmd __attribute__ ((unused)),
|
||||||
char **args __attribute__ ((unused)))
|
int argc __attribute__ ((unused)),
|
||||||
|
char **args __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
|
|
||||||
if (! grub_pxe_pxenv)
|
if (! grub_pxe_pxenv)
|
||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no pxe environment");
|
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no pxe environment");
|
||||||
|
|
||||||
if (state[1].set)
|
grub_pxe_unload ();
|
||||||
{
|
|
||||||
int size;
|
|
||||||
|
|
||||||
size = grub_strtoul (state[1].arg, 0, 0);
|
|
||||||
if (size < GRUB_PXE_MIN_BLKSIZE)
|
|
||||||
size = GRUB_PXE_MIN_BLKSIZE;
|
|
||||||
else if (size > GRUB_PXE_MAX_BLKSIZE)
|
|
||||||
size = GRUB_PXE_MAX_BLKSIZE;
|
|
||||||
|
|
||||||
grub_pxe_blksize = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state[0].set)
|
|
||||||
{
|
|
||||||
grub_printf ("blksize : %d\n", grub_pxe_blksize);
|
|
||||||
grub_printf ("client ip : ");
|
|
||||||
print_ip (grub_pxe_your_ip);
|
|
||||||
grub_printf ("\nserver ip : ");
|
|
||||||
print_ip (grub_pxe_server_ip);
|
|
||||||
grub_printf ("\ngateway ip : ");
|
|
||||||
print_ip (grub_pxe_gateway_ip);
|
|
||||||
grub_printf ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state[2].set)
|
|
||||||
grub_pxe_unload ();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
static grub_command_t cmd;
|
||||||
|
|
||||||
GRUB_MOD_INIT(pxecmd)
|
GRUB_MOD_INIT(pxecmd)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("pxe", grub_cmd_pxe, GRUB_COMMAND_FLAG_BOTH,
|
cmd = grub_register_command ("pxe_unload", grub_cmd_pxe_unload,
|
||||||
"pxe [-i|-b|-u]",
|
0,
|
||||||
"Command to control the PXE device.", options);
|
N_("Unload PXE environment."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(pxecmd)
|
GRUB_MOD_FINI(pxecmd)
|
||||||
{
|
{
|
||||||
grub_unregister_extcmd (cmd);
|
grub_unregister_command (cmd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* vbeinfo.c - command to list compatible VBE video modes. */
|
/* vbeinfo.c - command to list compatible VBE video modes. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2005,2007,2008 Free Software Foundation, Inc.
|
* Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
#include <grub/machine/vbe.h>
|
#include <grub/machine/vbe.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
real2pm (grub_vbe_farptr_t ptr)
|
real2pm (grub_vbe_farptr_t ptr)
|
||||||
|
@ -175,7 +176,7 @@ GRUB_MOD_INIT(vbeinfo)
|
||||||
{
|
{
|
||||||
cmd =
|
cmd =
|
||||||
grub_register_command ("vbeinfo", grub_cmd_vbeinfo, 0,
|
grub_register_command ("vbeinfo", grub_cmd_vbeinfo, 0,
|
||||||
"List compatible VESA BIOS extension video modes.");
|
N_("List compatible VESA BIOS extension video modes."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(vbeinfo)
|
GRUB_MOD_FINI(vbeinfo)
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
#include <grub/machine/init.h>
|
#include <grub/machine/init.h>
|
||||||
#include <grub/machine/vbe.h>
|
#include <grub/machine/vbe.h>
|
||||||
|
#include <grub/video.h>
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_vbetest (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_vbetest (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
@ -168,7 +170,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(vbetest)
|
GRUB_MOD_INIT(vbetest)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("vbetest", grub_cmd_vbetest,
|
cmd = grub_register_command ("vbetest", grub_cmd_vbetest,
|
||||||
0, "Test VESA BIOS Extension 2.0+ support");
|
0, N_("Test VESA BIOS Extension 2.0+ support."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(vbetest)
|
GRUB_MOD_FINI(vbetest)
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
#include <grub/ieee1275/ieee1275.h>
|
#include <grub/ieee1275/ieee1275.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_suspend (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_suspend (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
@ -39,7 +40,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(ieee1275_suspend)
|
GRUB_MOD_INIT(ieee1275_suspend)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("suspend", grub_cmd_suspend,
|
cmd = grub_register_command ("suspend", grub_cmd_suspend,
|
||||||
0, "Return to Open Firmware prompt");
|
0, N_("Return to Open Firmware prompt."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(ieee1275_suspend)
|
GRUB_MOD_FINI(ieee1275_suspend)
|
||||||
|
|
|
@ -21,12 +21,13 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"shift", 's', 0, "check Shift key", 0, 0},
|
{"shift", 's', 0, N_("Check Shift key."), 0, 0},
|
||||||
{"ctrl", 'c', 0, "check Control key", 0, 0},
|
{"ctrl", 'c', 0, N_("Check Control key."), 0, 0},
|
||||||
{"alt", 'a', 0, "check Alt key", 0, 0},
|
{"alt", 'a', 0, N_("Check Alt key."), 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -48,13 +49,24 @@ grub_cmd_keystatus (grub_extcmd_t cmd,
|
||||||
if (state[2].set)
|
if (state[2].set)
|
||||||
expect_mods |= GRUB_TERM_STATUS_ALT;
|
expect_mods |= GRUB_TERM_STATUS_ALT;
|
||||||
|
|
||||||
|
grub_dprintf ("keystatus", "expect_mods: %d\n", expect_mods);
|
||||||
|
|
||||||
/* Without arguments, just check whether getkeystatus is supported at
|
/* Without arguments, just check whether getkeystatus is supported at
|
||||||
all. */
|
all. */
|
||||||
if (!grub_cur_term_input->getkeystatus)
|
if (expect_mods == 0)
|
||||||
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
{
|
||||||
grub_dprintf ("keystatus", "expect_mods: %d\n", expect_mods);
|
grub_term_input_t term;
|
||||||
if (!expect_mods)
|
int nterms = 0;
|
||||||
return 0;
|
|
||||||
|
FOR_ACTIVE_TERM_INPUTS (term)
|
||||||
|
if (!term->getkeystatus)
|
||||||
|
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
||||||
|
else
|
||||||
|
nterms++;
|
||||||
|
if (!nterms)
|
||||||
|
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
mods = grub_getkeystatus ();
|
mods = grub_getkeystatus ();
|
||||||
grub_dprintf ("keystatus", "mods: %d\n", mods);
|
grub_dprintf ("keystatus", "mods: %d\n", mods);
|
||||||
|
@ -70,8 +82,8 @@ GRUB_MOD_INIT(keystatus)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus,
|
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"keystatus [--shift] [--ctrl] [--alt]",
|
N_("[--shift] [--ctrl] [--alt]"),
|
||||||
"Check key modifier status",
|
N_("Check key modifier status."),
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* loadenv.c - command to load/save environment variable. */
|
/* loadenv.c - command to load/save environment variable. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
* Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -26,10 +26,11 @@
|
||||||
#include <grub/partition.h>
|
#include <grub/partition.h>
|
||||||
#include <grub/lib/envblk.h>
|
#include <grub/lib/envblk.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"file", 'f', 0, "specify filename", 0, ARG_TYPE_PATHNAME},
|
{"file", 'f', 0, N_("Specify filename."), 0, ARG_TYPE_PATHNAME},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -195,7 +196,7 @@ free_blocklists (struct blocklist *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static grub_err_t
|
||||||
check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||||
grub_file_t file)
|
grub_file_t file)
|
||||||
{
|
{
|
||||||
|
@ -218,8 +219,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||||
{
|
{
|
||||||
/* This might be actually valid, but it is unbelievable that
|
/* This might be actually valid, but it is unbelievable that
|
||||||
any filesystem makes such a silly allocation. */
|
any filesystem makes such a silly allocation. */
|
||||||
grub_error (GRUB_ERR_BAD_FS, "malformed file");
|
return grub_error (GRUB_ERR_BAD_FS, "malformed file");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,17 +229,14 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||||
if (total_length != grub_file_size (file))
|
if (total_length != grub_file_size (file))
|
||||||
{
|
{
|
||||||
/* Maybe sparse, unallocated sectors. No way in GRUB. */
|
/* Maybe sparse, unallocated sectors. No way in GRUB. */
|
||||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "sparse file not allowed");
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "sparse file not allowed");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One more sanity check. Re-read all sectors by blocklists, and compare
|
/* One more sanity check. Re-read all sectors by blocklists, and compare
|
||||||
those with the data read via a file. */
|
those with the data read via a file. */
|
||||||
disk = file->device->disk;
|
disk = file->device->disk;
|
||||||
if (disk->partition)
|
|
||||||
part_start = grub_partition_get_start (disk->partition);
|
part_start = grub_partition_get_start (disk->partition);
|
||||||
else
|
|
||||||
part_start = 0;
|
|
||||||
|
|
||||||
buf = grub_envblk_buffer (envblk);
|
buf = grub_envblk_buffer (envblk);
|
||||||
for (p = blocklists, index = 0; p; index += p->length, p = p->next)
|
for (p = blocklists, index = 0; p; index += p->length, p = p->next)
|
||||||
|
@ -248,16 +245,13 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||||
|
|
||||||
if (grub_disk_read (disk, p->sector - part_start,
|
if (grub_disk_read (disk, p->sector - part_start,
|
||||||
p->offset, p->length, blockbuf))
|
p->offset, p->length, blockbuf))
|
||||||
return 0;
|
return grub_errno;
|
||||||
|
|
||||||
if (grub_memcmp (buf + index, blockbuf, p->length) != 0)
|
if (grub_memcmp (buf + index, blockbuf, p->length) != 0)
|
||||||
{
|
return grub_error (GRUB_ERR_FILE_READ_ERROR, "invalid blocklist");
|
||||||
grub_error (GRUB_ERR_FILE_READ_ERROR, "invalid blocklist");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -272,10 +266,7 @@ write_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||||
|
|
||||||
buf = grub_envblk_buffer (envblk);
|
buf = grub_envblk_buffer (envblk);
|
||||||
disk = file->device->disk;
|
disk = file->device->disk;
|
||||||
if (disk->partition)
|
part_start = grub_partition_get_start (disk->partition);
|
||||||
part_start = grub_partition_get_start (disk->partition);
|
|
||||||
else
|
|
||||||
part_start = 0;
|
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
for (p = blocklists; p; index += p->length, p = p->next)
|
for (p = blocklists; p; index += p->length, p = p->next)
|
||||||
|
@ -328,7 +319,7 @@ grub_cmd_save_env (grub_extcmd_t cmd, int argc, char **args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! argc)
|
if (! argc)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "No variable is specified");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no variable is specified");
|
||||||
|
|
||||||
file = open_envblk_file ((state[0].set) ? state[0].arg : 0);
|
file = open_envblk_file ((state[0].set) ? state[0].arg : 0);
|
||||||
if (! file)
|
if (! file)
|
||||||
|
@ -346,7 +337,7 @@ grub_cmd_save_env (grub_extcmd_t cmd, int argc, char **args)
|
||||||
if (! envblk)
|
if (! envblk)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (! check_blocklists (envblk, head, file))
|
if (check_blocklists (envblk, head, file))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
while (argc)
|
while (argc)
|
||||||
|
@ -384,20 +375,20 @@ GRUB_MOD_INIT(loadenv)
|
||||||
cmd_load =
|
cmd_load =
|
||||||
grub_register_extcmd ("load_env", grub_cmd_load_env,
|
grub_register_extcmd ("load_env", grub_cmd_load_env,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"load_env [-f FILE]",
|
N_("[-f FILE]"),
|
||||||
"Load variables from environment block file.",
|
N_("Load variables from environment block file."),
|
||||||
options);
|
options);
|
||||||
cmd_list =
|
cmd_list =
|
||||||
grub_register_extcmd ("list_env", grub_cmd_list_env,
|
grub_register_extcmd ("list_env", grub_cmd_list_env,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"list_env [-f FILE]",
|
N_("[-f FILE]"),
|
||||||
"List variables from environment block file.",
|
N_("List variables from environment block file."),
|
||||||
options);
|
options);
|
||||||
cmd_save =
|
cmd_save =
|
||||||
grub_register_extcmd ("save_env", grub_cmd_save_env,
|
grub_register_extcmd ("save_env", grub_cmd_save_env,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"save_env [-f FILE] variable_name [...]",
|
N_("[-f FILE] variable_name [...]"),
|
||||||
"Save variables to environment block file.",
|
N_("Save variables to environment block file."),
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* ls.c - command to list files and devices */
|
/* ls.c - command to list files and devices */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2003,2005,2007,2008 Free Software Foundation, Inc.
|
* Copyright (C) 2003,2005,2007,2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -30,12 +30,13 @@
|
||||||
#include <grub/normal.h>
|
#include <grub/normal.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
#include <grub/datetime.h>
|
#include <grub/datetime.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"long", 'l', 0, "show a long list with more detailed information", 0, 0},
|
{"long", 'l', 0, N_("Show a long list with more detailed information."), 0, 0},
|
||||||
{"human-readable", 'h', 0, "print sizes in a human readable format", 0, 0},
|
{"human-readable", 'h', 0, N_("Print sizes in a human readable format."), 0, 0},
|
||||||
{"all", 'a', 0, "list all files", 0, 0},
|
{"all", 'a', 0, N_("List all files."), 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,19 +87,21 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
||||||
int print_files_long (const char *filename,
|
int print_files_long (const char *filename,
|
||||||
const struct grub_dirhook_info *info)
|
const struct grub_dirhook_info *info)
|
||||||
{
|
{
|
||||||
char pathname[grub_strlen (dirname) + grub_strlen (filename) + 1];
|
|
||||||
|
|
||||||
if ((! all) && (filename[0] == '.'))
|
if ((! all) && (filename[0] == '.'))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (! info->dir)
|
if (! info->dir)
|
||||||
{
|
{
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
|
char *pathname;
|
||||||
|
|
||||||
if (dirname[grub_strlen (dirname) - 1] == '/')
|
if (dirname[grub_strlen (dirname) - 1] == '/')
|
||||||
grub_sprintf (pathname, "%s%s", dirname, filename);
|
pathname = grub_xasprintf ("%s%s", dirname, filename);
|
||||||
else
|
else
|
||||||
grub_sprintf (pathname, "%s/%s", dirname, filename);
|
pathname = grub_xasprintf ("%s/%s", dirname, filename);
|
||||||
|
|
||||||
|
if (!pathname)
|
||||||
|
return 1;
|
||||||
|
|
||||||
/* XXX: For ext2fs symlinks are detected as files while they
|
/* XXX: For ext2fs symlinks are detected as files while they
|
||||||
should be reported as directories. */
|
should be reported as directories. */
|
||||||
|
@ -106,6 +109,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
||||||
if (! file)
|
if (! file)
|
||||||
{
|
{
|
||||||
grub_errno = 0;
|
grub_errno = 0;
|
||||||
|
grub_free (pathname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,8 +134,9 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
||||||
grub_uint32_t whole, fraction;
|
grub_uint32_t whole, fraction;
|
||||||
|
|
||||||
whole = grub_divmod64 (fsize, 100, &fraction);
|
whole = grub_divmod64 (fsize, 100, &fraction);
|
||||||
grub_sprintf (buf, "%u.%02u%c", whole, fraction,
|
grub_snprintf (buf, sizeof (buf),
|
||||||
grub_human_sizes[units]);
|
"%u.%02u%c", whole, fraction,
|
||||||
|
grub_human_sizes[units]);
|
||||||
grub_printf ("%-12s", buf);
|
grub_printf ("%-12s", buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -139,6 +144,7 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
||||||
|
|
||||||
}
|
}
|
||||||
grub_file_close (file);
|
grub_file_close (file);
|
||||||
|
grub_free (pathname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
grub_printf ("%-12s", "DIR");
|
grub_printf ("%-12s", "DIR");
|
||||||
|
@ -260,8 +266,8 @@ static grub_extcmd_t cmd;
|
||||||
GRUB_MOD_INIT(ls)
|
GRUB_MOD_INIT(ls)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
|
cmd = grub_register_extcmd ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"ls [-l|-h|-a] [FILE]",
|
N_("[-l|-h|-a] [FILE]"),
|
||||||
"List devices and files.", options);
|
N_("List devices and files."), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(ls)
|
GRUB_MOD_FINI(ls)
|
||||||
|
|
|
@ -16,10 +16,13 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef GRUB_MACHINE_EMU
|
||||||
#include <grub/machine/memory.h>
|
#include <grub/machine/memory.h>
|
||||||
|
#endif
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_lsmmap (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_lsmmap (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
@ -33,7 +36,9 @@ grub_cmd_lsmmap (grub_command_t cmd __attribute__ ((unused)),
|
||||||
(long long) addr, (long long) size, type);
|
(long long) addr, (long long) size, type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifndef GRUB_MACHINE_EMU
|
||||||
grub_machine_mmap_iterate (hook);
|
grub_machine_mmap_iterate (hook);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +48,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(lsmmap)
|
GRUB_MOD_INIT(lsmmap)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("lsmmap", grub_cmd_lsmmap,
|
cmd = grub_register_command ("lsmmap", grub_cmd_lsmmap,
|
||||||
0, "List memory map provided by firmware.");
|
0, N_("List memory map provided by firmware."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(lsmmap)
|
GRUB_MOD_FINI(lsmmap)
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/command.h>
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
struct grub_pci_classname
|
struct grub_pci_classname
|
||||||
{
|
{
|
||||||
|
@ -84,6 +85,7 @@ static const struct grub_pci_classname grub_pci_classes[] =
|
||||||
{ 11, 0x30, "MIPS Processor" },
|
{ 11, 0x30, "MIPS Processor" },
|
||||||
{ 11, 0x40, "Co-Processor" },
|
{ 11, 0x40, "Co-Processor" },
|
||||||
{ 11, 0x80, "Unknown Processor" },
|
{ 11, 0x80, "Unknown Processor" },
|
||||||
|
{ 12, 3, "USB Controller" },
|
||||||
{ 12, 0x80, "Serial Bus Controller" },
|
{ 12, 0x80, "Serial Bus Controller" },
|
||||||
{ 13, 0x80, "Wireless Controller" },
|
{ 13, 0x80, "Wireless Controller" },
|
||||||
{ 14, 0, "I2O" },
|
{ 14, 0, "I2O" },
|
||||||
|
@ -114,16 +116,26 @@ grub_pci_get_class (int class, int subclass)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct grub_arg_option options[] =
|
||||||
|
{
|
||||||
|
{"iospace", 'i', 0, "show I/O spaces", 0, 0},
|
||||||
|
{0, 0, 0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
static int iospace;
|
||||||
|
|
||||||
static int NESTED_FUNC_ATTR
|
static int NESTED_FUNC_ATTR
|
||||||
grub_lspci_iter (int bus, int dev, int func, grub_pci_id_t pciid)
|
grub_lspci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
||||||
{
|
{
|
||||||
grub_uint32_t class;
|
grub_uint32_t class;
|
||||||
const char *sclass;
|
const char *sclass;
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
int reg;
|
||||||
|
|
||||||
grub_printf ("%02x:%02x.%x %04x:%04x", bus, dev, func, pciid & 0xFFFF,
|
grub_printf ("%02x:%02x.%x %04x:%04x", grub_pci_get_bus (dev),
|
||||||
pciid >> 16);
|
grub_pci_get_device (dev), grub_pci_get_function (dev),
|
||||||
addr = grub_pci_make_address (bus, dev, func, 2);
|
pciid & 0xFFFF, pciid >> 16);
|
||||||
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||||
class = grub_pci_read (addr);
|
class = grub_pci_read (addr);
|
||||||
|
|
||||||
/* Lookup the class name, if there isn't a specific one,
|
/* Lookup the class name, if there isn't a specific one,
|
||||||
|
@ -142,27 +154,81 @@ grub_lspci_iter (int bus, int dev, int func, grub_pci_id_t pciid)
|
||||||
|
|
||||||
grub_printf ("\n");
|
grub_printf ("\n");
|
||||||
|
|
||||||
|
if (iospace)
|
||||||
|
{
|
||||||
|
reg = GRUB_PCI_REG_ADDRESSES;
|
||||||
|
while (reg < GRUB_PCI_REG_CIS_POINTER)
|
||||||
|
{
|
||||||
|
grub_uint64_t space;
|
||||||
|
addr = grub_pci_make_address (dev, reg);
|
||||||
|
space = grub_pci_read (addr);
|
||||||
|
|
||||||
|
reg += sizeof (grub_uint32_t);
|
||||||
|
|
||||||
|
if (space == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch (space & GRUB_PCI_ADDR_SPACE_MASK)
|
||||||
|
{
|
||||||
|
case GRUB_PCI_ADDR_SPACE_IO:
|
||||||
|
grub_printf ("\tIO space %d at 0x%llx\n",
|
||||||
|
(unsigned) ((reg - GRUB_PCI_REG_ADDRESSES)
|
||||||
|
/ sizeof (grub_uint32_t)) - 1,
|
||||||
|
(unsigned long long)
|
||||||
|
(space & GRUB_PCI_ADDR_IO_MASK));
|
||||||
|
break;
|
||||||
|
case GRUB_PCI_ADDR_SPACE_MEMORY:
|
||||||
|
if ((space & GRUB_PCI_ADDR_MEM_TYPE_MASK)
|
||||||
|
== GRUB_PCI_ADDR_MEM_TYPE_64)
|
||||||
|
{
|
||||||
|
addr = grub_pci_make_address (dev, reg);
|
||||||
|
space |= ((grub_uint64_t) grub_pci_read (addr)) << 32;
|
||||||
|
reg += sizeof (grub_uint32_t);
|
||||||
|
grub_printf ("\t64-bit memory space %d at 0x%016llx [%s]\n",
|
||||||
|
(unsigned) ((reg - GRUB_PCI_REG_ADDRESSES)
|
||||||
|
/ sizeof (grub_uint32_t)) - 2,
|
||||||
|
(unsigned long long)
|
||||||
|
(space & GRUB_PCI_ADDR_MEM_MASK),
|
||||||
|
space & GRUB_PCI_ADDR_MEM_PREFETCH
|
||||||
|
? "prefetchable" : "non-prefetchable");
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
grub_printf ("\t32-bit memory space %d at 0x%016llx [%s]\n",
|
||||||
|
(unsigned) ((reg - GRUB_PCI_REG_ADDRESSES)
|
||||||
|
/ sizeof (grub_uint32_t)) - 1,
|
||||||
|
(unsigned long long)
|
||||||
|
(space & GRUB_PCI_ADDR_MEM_MASK),
|
||||||
|
space & GRUB_PCI_ADDR_MEM_PREFETCH
|
||||||
|
? "prefetchable" : "non-prefetchable");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_lspci (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_lspci (grub_extcmd_t cmd,
|
||||||
int argc __attribute__ ((unused)),
|
int argc __attribute__ ((unused)),
|
||||||
char **args __attribute__ ((unused)))
|
char **args __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
|
iospace = cmd->state[0].set;
|
||||||
grub_pci_iterate (grub_lspci_iter);
|
grub_pci_iterate (grub_lspci_iter);
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_command_t cmd;
|
static grub_extcmd_t cmd;
|
||||||
|
|
||||||
GRUB_MOD_INIT(pci)
|
GRUB_MOD_INIT(lspci)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("lspci", grub_cmd_lspci,
|
cmd = grub_register_extcmd ("lspci", grub_cmd_lspci, GRUB_COMMAND_FLAG_BOTH,
|
||||||
0, "List PCI devices");
|
"[-i]", N_("List PCI devices."), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(pci)
|
GRUB_MOD_FINI(lspci)
|
||||||
{
|
{
|
||||||
grub_unregister_command (cmd);
|
grub_unregister_extcmd (cmd);
|
||||||
}
|
}
|
||||||
|
|
113
commands/memrw.c
113
commands/memrw.c
|
@ -19,29 +19,54 @@
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/command.h>
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/env.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_command_t cmd_read_byte, cmd_read_word, cmd_read_dword;
|
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
|
||||||
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
|
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
|
||||||
|
|
||||||
|
static const struct grub_arg_option options[] =
|
||||||
|
{
|
||||||
|
{0, 'v', 0, N_("Save read value into variable VARNAME."),
|
||||||
|
"VARNAME", ARG_TYPE_STRING},
|
||||||
|
{0, 0, 0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_read (grub_command_t cmd, int argc, char **argv)
|
grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
|
||||||
{
|
{
|
||||||
grub_target_addr_t addr;
|
grub_target_addr_t addr;
|
||||||
grub_uint32_t value;
|
grub_uint32_t value = 0;
|
||||||
|
char buf[sizeof ("XXXXXXXX")];
|
||||||
|
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
|
||||||
|
|
||||||
addr = grub_strtoul (argv[0], 0, 0);
|
addr = grub_strtoul (argv[0], 0, 0);
|
||||||
if (cmd->name[5] == 'd')
|
switch (cmd->cmd->name[sizeof ("read_") - 1])
|
||||||
value = *((grub_uint32_t *) addr);
|
{
|
||||||
else if (cmd->name[5] == 'w')
|
case 'd':
|
||||||
value = *((grub_uint16_t *) addr);
|
value = *((volatile grub_uint32_t *) addr);
|
||||||
else
|
break;
|
||||||
value = *((grub_uint8_t *) addr);
|
|
||||||
|
|
||||||
grub_printf ("0x%x\n", value);
|
case 'w':
|
||||||
|
value = *((volatile grub_uint16_t *) addr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'b':
|
||||||
|
value = *((volatile grub_uint8_t *) addr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd->state[0].set)
|
||||||
|
{
|
||||||
|
grub_snprintf (buf, sizeof (buf), "%x", value);
|
||||||
|
grub_env_set (cmd->state[0].arg, buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
grub_printf ("0x%x\n", value);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -51,18 +76,42 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
||||||
{
|
{
|
||||||
grub_target_addr_t addr;
|
grub_target_addr_t addr;
|
||||||
grub_uint32_t value;
|
grub_uint32_t value;
|
||||||
|
grub_uint32_t mask = 0xffffffff;
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2 && argc != 3)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid number of arguments");
|
||||||
|
|
||||||
addr = grub_strtoul (argv[0], 0, 0);
|
addr = grub_strtoul (argv[0], 0, 0);
|
||||||
value = grub_strtoul (argv[1], 0, 0);
|
value = grub_strtoul (argv[1], 0, 0);
|
||||||
if (cmd->name[6] == 'd')
|
if (argc == 3)
|
||||||
*((grub_uint32_t *) addr) = value;
|
mask = grub_strtoul (argv[2], 0, 0);
|
||||||
else if (cmd->name[6] == 'w')
|
value &= mask;
|
||||||
*((grub_uint16_t *) addr) = (grub_uint16_t) value;
|
switch (cmd->name[sizeof ("write_") - 1])
|
||||||
else
|
{
|
||||||
*((grub_uint8_t *) addr) = (grub_uint8_t) value;
|
case 'd':
|
||||||
|
if (mask != 0xffffffff)
|
||||||
|
*((volatile grub_uint32_t *) addr)
|
||||||
|
= (*((volatile grub_uint32_t *) addr) & ~mask) | value;
|
||||||
|
else
|
||||||
|
*((volatile grub_uint32_t *) addr) = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'w':
|
||||||
|
if ((mask & 0xffff) != 0xffff)
|
||||||
|
*((volatile grub_uint16_t *) addr)
|
||||||
|
= (*((volatile grub_uint16_t *) addr) & ~mask) | value;
|
||||||
|
else
|
||||||
|
*((volatile grub_uint16_t *) addr) = value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'b':
|
||||||
|
if ((mask & 0xff) != 0xff)
|
||||||
|
*((volatile grub_uint8_t *) addr)
|
||||||
|
= (*((volatile grub_uint8_t *) addr) & ~mask) | value;
|
||||||
|
else
|
||||||
|
*((volatile grub_uint8_t *) addr) = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -70,30 +119,30 @@ grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
||||||
GRUB_MOD_INIT(memrw)
|
GRUB_MOD_INIT(memrw)
|
||||||
{
|
{
|
||||||
cmd_read_byte =
|
cmd_read_byte =
|
||||||
grub_register_command ("read_byte", grub_cmd_read,
|
grub_register_extcmd ("read_byte", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"read_byte ADDR", "read byte.");
|
N_("ADDR"), N_("Read byte from ADDR."), options);
|
||||||
cmd_read_word =
|
cmd_read_word =
|
||||||
grub_register_command ("read_word", grub_cmd_read,
|
grub_register_extcmd ("read_word", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"read_word ADDR", "read word.");
|
N_("ADDR"), N_("Read word from ADDR."), options);
|
||||||
cmd_read_dword =
|
cmd_read_dword =
|
||||||
grub_register_command ("read_dword", grub_cmd_read,
|
grub_register_extcmd ("read_dword", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"read_dword ADDR", "read dword.");
|
N_("ADDR"), N_("Read dword from ADDR."), options);
|
||||||
cmd_write_byte =
|
cmd_write_byte =
|
||||||
grub_register_command ("write_byte", grub_cmd_write,
|
grub_register_command ("write_byte", grub_cmd_write,
|
||||||
"write_byte ADDR VALUE", "write byte.");
|
N_("ADDR VALUE [MASK]"), N_("Write byte VALUE to ADDR."));
|
||||||
cmd_write_word =
|
cmd_write_word =
|
||||||
grub_register_command ("write_word", grub_cmd_write,
|
grub_register_command ("write_word", grub_cmd_write,
|
||||||
"write_word ADDR VALUE", "write word.");
|
N_("ADDR VALUE [MASK]"), N_("Write word VALUE to ADDR."));
|
||||||
cmd_write_dword =
|
cmd_write_dword =
|
||||||
grub_register_command ("write_dword", grub_cmd_write,
|
grub_register_command ("write_dword", grub_cmd_write,
|
||||||
"write_dword ADDR VALUE", "write dword.");
|
N_("ADDR VALUE [MASK]"), N_("Write dword VALUE to ADDR."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(memrw)
|
GRUB_MOD_FINI(memrw)
|
||||||
{
|
{
|
||||||
grub_unregister_command (cmd_read_byte);
|
grub_unregister_extcmd (cmd_read_byte);
|
||||||
grub_unregister_command (cmd_read_word);
|
grub_unregister_extcmd (cmd_read_word);
|
||||||
grub_unregister_command (cmd_read_dword);
|
grub_unregister_extcmd (cmd_read_dword);
|
||||||
grub_unregister_command (cmd_write_byte);
|
grub_unregister_command (cmd_write_byte);
|
||||||
grub_unregister_command (cmd_write_word);
|
grub_unregister_command (cmd_write_word);
|
||||||
grub_unregister_command (cmd_write_dword);
|
grub_unregister_command (cmd_write_dword);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
#include <grub/loader.h>
|
#include <grub/loader.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
/* cat FILE */
|
/* cat FILE */
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
|
@ -315,7 +316,6 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
grub_printf ("%s", dep->mod->name);
|
grub_printf ("%s", dep->mod->name);
|
||||||
}
|
}
|
||||||
grub_putchar ('\n');
|
grub_putchar ('\n');
|
||||||
grub_refresh ();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -354,28 +354,28 @@ GRUB_MOD_INIT(minicmd)
|
||||||
{
|
{
|
||||||
cmd_cat =
|
cmd_cat =
|
||||||
grub_register_command ("cat", grub_mini_cmd_cat,
|
grub_register_command ("cat", grub_mini_cmd_cat,
|
||||||
"cat FILE", "show the contents of a file");
|
N_("FILE"), N_("Show the contents of a file."));
|
||||||
cmd_help =
|
cmd_help =
|
||||||
grub_register_command ("help", grub_mini_cmd_help,
|
grub_register_command ("help", grub_mini_cmd_help,
|
||||||
0, "show this message");
|
0, N_("Show this message."));
|
||||||
cmd_root =
|
cmd_root =
|
||||||
grub_register_command ("root", grub_mini_cmd_root,
|
grub_register_command ("root", grub_mini_cmd_root,
|
||||||
"root [DEVICE]", "set the root device");
|
N_("[DEVICE]"), N_("Set the root device."));
|
||||||
cmd_dump =
|
cmd_dump =
|
||||||
grub_register_command ("dump", grub_mini_cmd_dump,
|
grub_register_command ("dump", grub_mini_cmd_dump,
|
||||||
"dump ADDR", "dump memory");
|
N_("ADDR"), N_("Dump memory."));
|
||||||
cmd_rmmod =
|
cmd_rmmod =
|
||||||
grub_register_command ("rmmod", grub_mini_cmd_rmmod,
|
grub_register_command ("rmmod", grub_mini_cmd_rmmod,
|
||||||
"rmmod MODULE", "remove a module");
|
N_("MODULE"), N_("Remove a module."));
|
||||||
cmd_lsmod =
|
cmd_lsmod =
|
||||||
grub_register_command ("lsmod", grub_mini_cmd_lsmod,
|
grub_register_command ("lsmod", grub_mini_cmd_lsmod,
|
||||||
0, "show loaded modules");
|
0, N_("Show loaded modules."));
|
||||||
cmd_exit =
|
cmd_exit =
|
||||||
grub_register_command ("exit", grub_mini_cmd_exit,
|
grub_register_command ("exit", grub_mini_cmd_exit,
|
||||||
0, "exit from GRUB");
|
0, N_("Exit from GRUB."));
|
||||||
cmd_clear =
|
cmd_clear =
|
||||||
grub_register_command ("clear", grub_mini_cmd_clear,
|
grub_register_command ("clear", grub_mini_cmd_clear,
|
||||||
0, "clear the screen");
|
0, N_("Clear the screen."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(minicmd)
|
GRUB_MOD_FINI(minicmd)
|
||||||
|
|
|
@ -29,14 +29,15 @@
|
||||||
#include <grub/partition.h>
|
#include <grub/partition.h>
|
||||||
#include <grub/parttool.h>
|
#include <grub/parttool.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static struct grub_parttool *parts = 0;
|
static struct grub_parttool *parts = 0;
|
||||||
static int curhandle = 0;
|
static int curhandle = 0;
|
||||||
static grub_dl_t mymod;
|
static grub_dl_t mymod;
|
||||||
static char helpmsg[] =
|
static char helpmsg[] =
|
||||||
"perform COMMANDS on partition.\n"
|
"Perform COMMANDS on partition.\n"
|
||||||
"Use \"parttool PARTITION help\" for the list "
|
"Use \"parttool PARTITION help\" for the list "
|
||||||
"of available commands";
|
"of available commands.";
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_parttool_register(const char *part_name,
|
grub_parttool_register(const char *part_name,
|
||||||
|
@ -174,7 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load modules. */
|
/* Load modules. */
|
||||||
#ifndef GRUB_UTIL
|
#if GRUB_NO_MODULES
|
||||||
{
|
{
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
prefix = grub_env_get ("prefix");
|
prefix = grub_env_get ("prefix");
|
||||||
|
@ -182,12 +183,11 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
filename = grub_malloc (grub_strlen (prefix) + sizeof ("/parttool.lst"));
|
filename = grub_xasprintf ("%s/parttool.lst", prefix);
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
|
|
||||||
grub_sprintf (filename, "%s/parttool.lst", prefix);
|
|
||||||
file = grub_file_open (filename);
|
file = grub_file_open (filename);
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
|
@ -322,7 +322,7 @@ GRUB_MOD_INIT(parttool)
|
||||||
{
|
{
|
||||||
mymod = mod;
|
mymod = mod;
|
||||||
cmd = grub_register_command ("parttool", grub_cmd_parttool,
|
cmd = grub_register_command ("parttool", grub_cmd_parttool,
|
||||||
"parttool PARTITION COMMANDS",
|
N_("PARTITION COMMANDS"),
|
||||||
helpmsg);
|
helpmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,27 +17,22 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/auth.h>
|
#include <grub/auth.h>
|
||||||
|
#include <grub/crypto.h>
|
||||||
#include <grub/list.h>
|
#include <grub/list.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/normal.h>
|
#include <grub/normal.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_dl_t my_mod;
|
static grub_dl_t my_mod;
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
check_password (const char *user,
|
check_password (const char *user, const char *entered,
|
||||||
void *password)
|
void *password)
|
||||||
{
|
{
|
||||||
char entered[1024];
|
if (grub_crypto_memcmp (entered, password, GRUB_AUTH_MAX_PASSLEN) != 0)
|
||||||
|
|
||||||
grub_memset (entered, 0, sizeof (entered));
|
|
||||||
|
|
||||||
if (!GRUB_GET_PASSWORD (entered, sizeof (entered) - 1))
|
|
||||||
return GRUB_ACCESS_DENIED;
|
|
||||||
|
|
||||||
if (grub_auth_strcmp (entered, password) != 0)
|
|
||||||
return GRUB_ACCESS_DENIED;
|
return GRUB_ACCESS_DENIED;
|
||||||
|
|
||||||
grub_auth_authenticate (user);
|
grub_auth_authenticate (user);
|
||||||
|
@ -51,13 +46,18 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
char *pass;
|
char *pass;
|
||||||
|
int copylen;
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Two arguments expected.");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments expected");
|
||||||
|
|
||||||
pass = grub_strdup (args[1]);
|
pass = grub_zalloc (GRUB_AUTH_MAX_PASSLEN);
|
||||||
if (!pass)
|
if (!pass)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
copylen = grub_strlen (args[1]);
|
||||||
|
if (copylen >= GRUB_AUTH_MAX_PASSLEN)
|
||||||
|
copylen = GRUB_AUTH_MAX_PASSLEN - 1;
|
||||||
|
grub_memcpy (pass, args[1], copylen);
|
||||||
|
|
||||||
err = grub_auth_register_authentication (args[0], check_password, pass);
|
err = grub_auth_register_authentication (args[0], check_password, pass);
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -75,9 +75,9 @@ GRUB_MOD_INIT(password)
|
||||||
{
|
{
|
||||||
my_mod = mod;
|
my_mod = mod;
|
||||||
cmd = grub_register_command ("password", grub_cmd_password,
|
cmd = grub_register_command ("password", grub_cmd_password,
|
||||||
"password USER PASSWORD",
|
N_("USER PASSWORD"),
|
||||||
"Set user password (plaintext). "
|
N_("Set user password (plaintext). "
|
||||||
"Unrecommended and insecure.");
|
"Unrecommended and insecure."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(password)
|
GRUB_MOD_FINI(password)
|
||||||
|
|
196
commands/password_pbkdf2.c
Normal file
196
commands/password_pbkdf2.c
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
/*
|
||||||
|
* 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/auth.h>
|
||||||
|
#include <grub/crypto.h>
|
||||||
|
#include <grub/list.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/env.h>
|
||||||
|
#include <grub/normal.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
|
|
||||||
|
static grub_dl_t my_mod;
|
||||||
|
|
||||||
|
struct pbkdf2_password
|
||||||
|
{
|
||||||
|
grub_uint8_t *salt;
|
||||||
|
grub_size_t saltlen;
|
||||||
|
unsigned int c;
|
||||||
|
grub_uint8_t *expected;
|
||||||
|
grub_size_t buflen;
|
||||||
|
};
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
check_password (const char *user, const char *entered, void *pin)
|
||||||
|
{
|
||||||
|
grub_uint8_t *buf;
|
||||||
|
struct pbkdf2_password *pass = pin;
|
||||||
|
gcry_err_code_t err;
|
||||||
|
|
||||||
|
buf = grub_malloc (pass->buflen);
|
||||||
|
if (!buf)
|
||||||
|
return grub_crypto_gcry_error (GPG_ERR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
|
err = grub_crypto_pbkdf2 (GRUB_MD_SHA512, (grub_uint8_t *) entered,
|
||||||
|
grub_strlen (entered),
|
||||||
|
pass->salt, pass->saltlen, pass->c,
|
||||||
|
buf, pass->buflen);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
grub_free (buf);
|
||||||
|
return grub_crypto_gcry_error (err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grub_crypto_memcmp (buf, pass->expected, pass->buflen) != 0)
|
||||||
|
return GRUB_ACCESS_DENIED;
|
||||||
|
|
||||||
|
grub_auth_authenticate (user);
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
hex2val (char hex)
|
||||||
|
{
|
||||||
|
if ('0' <= hex && hex <= '9')
|
||||||
|
return hex - '0';
|
||||||
|
if ('a' <= hex && hex <= 'f')
|
||||||
|
return hex - 'a' + 10;
|
||||||
|
if ('A' <= hex && hex <= 'F')
|
||||||
|
return hex - 'A' + 10;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
int argc, char **args)
|
||||||
|
{
|
||||||
|
grub_err_t err;
|
||||||
|
char *ptr, *ptr2;
|
||||||
|
grub_uint8_t *ptro;
|
||||||
|
struct pbkdf2_password *pass;
|
||||||
|
|
||||||
|
if (argc != 2)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Two arguments expected.");
|
||||||
|
|
||||||
|
if (grub_memcmp (args[1], "grub.pbkdf2.sha512.",
|
||||||
|
sizeof ("grub.pbkdf2.sha512.") - 1) != 0)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
|
||||||
|
|
||||||
|
ptr = args[1] + sizeof ("grub.pbkdf2.sha512.") - 1;
|
||||||
|
|
||||||
|
pass = grub_malloc (sizeof (*pass));
|
||||||
|
if (!pass)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
pass->c = grub_strtoul (ptr, &ptr, 0);
|
||||||
|
if (*ptr != '.')
|
||||||
|
{
|
||||||
|
grub_free (pass);
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
|
||||||
|
}
|
||||||
|
ptr++;
|
||||||
|
|
||||||
|
ptr2 = grub_strchr (ptr, '.');
|
||||||
|
if (!ptr2 || ((ptr2 - ptr) & 1) || grub_strlen (ptr2 + 1) & 1)
|
||||||
|
{
|
||||||
|
grub_free (pass);
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Incorrect PBKDF2 password.");
|
||||||
|
}
|
||||||
|
|
||||||
|
pass->saltlen = (ptr2 - ptr) >> 1;
|
||||||
|
pass->buflen = grub_strlen (ptr2 + 1) >> 1;
|
||||||
|
ptro = pass->salt = grub_malloc (pass->saltlen);
|
||||||
|
if (!ptro)
|
||||||
|
{
|
||||||
|
grub_free (pass);
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
while (ptr < ptr2)
|
||||||
|
{
|
||||||
|
int hex1, hex2;
|
||||||
|
hex1 = hex2val (*ptr);
|
||||||
|
ptr++;
|
||||||
|
hex2 = hex2val (*ptr);
|
||||||
|
ptr++;
|
||||||
|
if (hex1 < 0 || hex2 < 0)
|
||||||
|
{
|
||||||
|
grub_free (pass->salt);
|
||||||
|
grub_free (pass);
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
|
"Incorrect PBKDF2 password.");
|
||||||
|
}
|
||||||
|
|
||||||
|
*ptro = (hex1 << 4) | hex2;
|
||||||
|
ptro++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptro = pass->expected = grub_malloc (pass->buflen);
|
||||||
|
if (!ptro)
|
||||||
|
{
|
||||||
|
grub_free (pass->salt);
|
||||||
|
grub_free (pass);
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
ptr = ptr2 + 1;
|
||||||
|
ptr2 += grub_strlen (ptr2);
|
||||||
|
while (ptr < ptr2)
|
||||||
|
{
|
||||||
|
int hex1, hex2;
|
||||||
|
hex1 = hex2val (*ptr);
|
||||||
|
ptr++;
|
||||||
|
hex2 = hex2val (*ptr);
|
||||||
|
ptr++;
|
||||||
|
if (hex1 < 0 || hex2 < 0)
|
||||||
|
{
|
||||||
|
grub_free (pass->expected);
|
||||||
|
grub_free (pass->salt);
|
||||||
|
grub_free (pass);
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
|
"Incorrect PBKDF2 password.");
|
||||||
|
}
|
||||||
|
|
||||||
|
*ptro = (hex1 << 4) | hex2;
|
||||||
|
ptro++;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = grub_auth_register_authentication (args[0], check_password, pass);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
grub_free (pass);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
grub_dl_ref (my_mod);
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_command_t cmd;
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(password_pbkdf2)
|
||||||
|
{
|
||||||
|
my_mod = mod;
|
||||||
|
cmd = grub_register_command ("password_pbkdf2", grub_cmd_password,
|
||||||
|
"password_pbkdf2 USER PBKDF2_PASSWORD",
|
||||||
|
"Set user password (PBKDF2). ");
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(password_pbkdf2)
|
||||||
|
{
|
||||||
|
grub_unregister_command (cmd);
|
||||||
|
}
|
|
@ -30,16 +30,17 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
|
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
|
||||||
"set a variable to return value", "VAR", ARG_TYPE_STRING},
|
N_("Set a variable to return value."), "VAR", ARG_TYPE_STRING},
|
||||||
{"driver", 'd', 0, "determine driver", 0, 0},
|
{"driver", 'd', 0, N_("Determine driver."), 0, 0},
|
||||||
{"partmap", 'p', 0, "determine partition map type", 0, 0},
|
{"partmap", 'p', 0, N_("Determine partition map type."), 0, 0},
|
||||||
{"fs", 'f', 0, "determine filesystem type", 0, 0},
|
{"fs", 'f', 0, N_("Determine filesystem type."), 0, 0},
|
||||||
{"fs-uuid", 'u', 0, "determine filesystem UUID", 0, 0},
|
{"fs-uuid", 'u', 0, N_("Determine filesystem UUID."), 0, 0},
|
||||||
{"label", 'l', 0, "determine filesystem label", 0, 0},
|
{"label", 'l', 0, N_("Determine filesystem label."), 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -150,8 +151,8 @@ static grub_extcmd_t cmd;
|
||||||
GRUB_MOD_INIT (probe)
|
GRUB_MOD_INIT (probe)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("probe", grub_cmd_probe, GRUB_COMMAND_FLAG_BOTH,
|
cmd = grub_register_extcmd ("probe", grub_cmd_probe, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"probe [DEVICE]",
|
N_("[DEVICE]"),
|
||||||
"Retrieve device info.", options);
|
N_("Retrieve device info."), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI (probe)
|
GRUB_MOD_FINI (probe)
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
grub_getline (void)
|
grub_getline (void)
|
||||||
|
@ -62,7 +63,7 @@ grub_getline (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
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 ();
|
char *line = grub_getline ();
|
||||||
if (! line)
|
if (! line)
|
||||||
|
@ -79,8 +80,8 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(read)
|
GRUB_MOD_INIT(read)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("read", grub_cmd_read,
|
cmd = grub_register_command ("read", grub_cmd_read,
|
||||||
"read [ENVVAR]",
|
N_("[ENVVAR]"),
|
||||||
"Set variable with user input");
|
N_("Set variable with user input."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(read)
|
GRUB_MOD_FINI(read)
|
||||||
|
|
|
@ -19,18 +19,8 @@
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
#if defined(GRUB_MACHINE_IEEE1275)
|
#include <grub/i18n.h>
|
||||||
#include <grub/machine/kernel.h>
|
|
||||||
#elif defined(GRUB_MACHINE_EFI)
|
|
||||||
#include <grub/efi/efi.h>
|
|
||||||
#elif defined(GRUB_MACHINE_PCBIOS)
|
|
||||||
#include <grub/machine/init.h>
|
|
||||||
#else
|
|
||||||
/* Platforms shipping standalone reboot, such as coreboot. */
|
|
||||||
#include <grub/cpu/reboot.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
@ -46,7 +36,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(reboot)
|
GRUB_MOD_INIT(reboot)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("reboot", grub_cmd_reboot,
|
cmd = grub_register_command ("reboot", grub_cmd_reboot,
|
||||||
0, "Reboot the computer");
|
0, N_("Reboot the computer."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(reboot)
|
GRUB_MOD_FINI(reboot)
|
||||||
|
|
79
commands/regexp.c
Normal file
79
commands/regexp.c
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/* regexp.c -- The regexp command. */
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2005,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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <grub/command.h>
|
||||||
|
#include <regex.h>
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_regexp (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
int argc, char **args)
|
||||||
|
{
|
||||||
|
int argn = 0;
|
||||||
|
int matches = 0;
|
||||||
|
regex_t regex;
|
||||||
|
int ret;
|
||||||
|
grub_size_t s;
|
||||||
|
char *comperr;
|
||||||
|
grub_err_t err;
|
||||||
|
|
||||||
|
if (argc != 2)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "2 arguments expected");
|
||||||
|
|
||||||
|
ret = regcomp (®ex, args[0], RE_SYNTAX_GNU_AWK);
|
||||||
|
if (ret)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
ret = regexec (®ex, args[1], 0, 0, 0);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
regfree (®ex);
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
|
s = regerror (ret, ®ex, 0, 0);
|
||||||
|
comperr = grub_malloc (s);
|
||||||
|
if (!comperr)
|
||||||
|
{
|
||||||
|
regfree (®ex);
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
regerror (ret, ®ex, comperr, s);
|
||||||
|
err = grub_error (GRUB_ERR_TEST_FAILURE, "%s", comperr);
|
||||||
|
regfree (®ex);
|
||||||
|
grub_free (comperr);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_command_t cmd;
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(regexp)
|
||||||
|
{
|
||||||
|
cmd = grub_register_command ("regexp", grub_cmd_regexp,
|
||||||
|
"REGEXP STRING",
|
||||||
|
"Test if REGEXP matches STRING.");
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(regexp)
|
||||||
|
{
|
||||||
|
grub_unregister_command (cmd);
|
||||||
|
}
|
|
@ -25,32 +25,14 @@
|
||||||
#include <grub/device.h>
|
#include <grub/device.h>
|
||||||
#include <grub/file.h>
|
#include <grub/file.h>
|
||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/search.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
void
|
||||||
{
|
FUNC_NAME (const char *key, const char *var, int no_floppy)
|
||||||
{"file", 'f', 0, "search devices by a file", 0, 0},
|
|
||||||
{"label", 'l', 0, "search devices by a filesystem label", 0, 0},
|
|
||||||
{"fs-uuid", 'u', 0, "search devices by a filesystem UUID", 0, 0},
|
|
||||||
{"set", 's', GRUB_ARG_OPTION_OPTIONAL, "set a variable to the first device found", "VAR", ARG_TYPE_STRING},
|
|
||||||
{"no-floppy", 'n', 0, "do not probe any floppy drive", 0, 0},
|
|
||||||
{0, 0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
enum options
|
|
||||||
{
|
|
||||||
SEARCH_FILE,
|
|
||||||
SEARCH_LABEL,
|
|
||||||
SEARCH_FS_UUID,
|
|
||||||
SEARCH_SET,
|
|
||||||
SEARCH_NO_FLOPPY,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
search_fs (const char *key, const char *var, int no_floppy, enum options type)
|
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
char *buf = NULL;
|
|
||||||
grub_fs_autoload_hook_t saved_autoload;
|
grub_fs_autoload_hook_t saved_autoload;
|
||||||
|
|
||||||
auto int iterate_device (const char *name);
|
auto int iterate_device (const char *name);
|
||||||
|
@ -63,48 +45,46 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
|
||||||
name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9')
|
name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (type == SEARCH_FILE)
|
#ifdef DO_SEARCH_FILE
|
||||||
{
|
{
|
||||||
grub_size_t len;
|
char *buf;
|
||||||
char *p;
|
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
|
|
||||||
len = grub_strlen (name) + 2 + grub_strlen (key) + 1;
|
buf = grub_xasprintf ("(%s)%s", name, key);
|
||||||
p = grub_realloc (buf, len);
|
if (! buf)
|
||||||
if (! p)
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
buf = p;
|
|
||||||
grub_sprintf (buf, "(%s)%s", name, key);
|
|
||||||
|
|
||||||
file = grub_file_open (buf);
|
file = grub_file_open (buf);
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
found = 1;
|
found = 1;
|
||||||
grub_file_close (file);
|
grub_file_close (file);
|
||||||
}
|
}
|
||||||
|
grub_free (buf);
|
||||||
}
|
}
|
||||||
else
|
#else
|
||||||
{
|
{
|
||||||
/* type is SEARCH_FS_UUID or SEARCH_LABEL */
|
/* SEARCH_FS_UUID or SEARCH_LABEL */
|
||||||
grub_device_t dev;
|
grub_device_t dev;
|
||||||
grub_fs_t fs;
|
grub_fs_t fs;
|
||||||
int (*compare_fn) (const char *, const char *);
|
|
||||||
char *quid;
|
char *quid;
|
||||||
|
|
||||||
dev = grub_device_open (name);
|
dev = grub_device_open (name);
|
||||||
if (dev)
|
if (dev)
|
||||||
{
|
{
|
||||||
fs = grub_fs_probe (dev);
|
fs = grub_fs_probe (dev);
|
||||||
compare_fn =
|
|
||||||
(type == SEARCH_FS_UUID) ? grub_strcasecmp : grub_strcmp;
|
|
||||||
|
|
||||||
if (fs && ((type == SEARCH_FS_UUID) ? fs->uuid : fs->label))
|
#ifdef DO_SEARCH_FS_UUID
|
||||||
|
#define compare_fn grub_strcasecmp
|
||||||
|
#define read_fn uuid
|
||||||
|
#else
|
||||||
|
#define compare_fn grub_strcmp
|
||||||
|
#define read_fn label
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (fs && fs->read_fn)
|
||||||
{
|
{
|
||||||
if (type == SEARCH_FS_UUID)
|
fs->read_fn (dev, &quid);
|
||||||
fs->uuid (dev, &quid);
|
|
||||||
else
|
|
||||||
fs->label (dev, &quid);
|
|
||||||
|
|
||||||
if (grub_errno == GRUB_ERR_NONE && quid)
|
if (grub_errno == GRUB_ERR_NONE && quid)
|
||||||
{
|
{
|
||||||
|
@ -118,6 +98,7 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
|
||||||
grub_device_close (dev);
|
grub_device_close (dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
|
@ -149,52 +130,45 @@ search_fs (const char *key, const char *var, int no_floppy, enum options type)
|
||||||
else
|
else
|
||||||
grub_device_iterate (iterate_device);
|
grub_device_iterate (iterate_device);
|
||||||
|
|
||||||
grub_free (buf);
|
|
||||||
|
|
||||||
if (grub_errno == GRUB_ERR_NONE && count == 0)
|
if (grub_errno == GRUB_ERR_NONE && count == 0)
|
||||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, "no such device: %s", key);
|
grub_error (GRUB_ERR_FILE_NOT_FOUND, "no such device: %s", key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_search (grub_extcmd_t cmd, int argc, char **args)
|
grub_cmd_do_search (grub_command_t cmd __attribute__ ((unused)), int argc,
|
||||||
|
char **args)
|
||||||
{
|
{
|
||||||
struct grub_arg_list *state = cmd->state;
|
|
||||||
const char *var = 0;
|
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
return grub_error (GRUB_ERR_INVALID_COMMAND, "no argument specified");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
|
||||||
|
|
||||||
if (state[SEARCH_SET].set)
|
FUNC_NAME (args[0], argc == 1 ? 0 : args[1], 0);
|
||||||
var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
|
|
||||||
|
|
||||||
if (state[SEARCH_LABEL].set)
|
|
||||||
search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_LABEL);
|
|
||||||
else if (state[SEARCH_FS_UUID].set)
|
|
||||||
search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_FS_UUID);
|
|
||||||
else if (state[SEARCH_FILE].set)
|
|
||||||
search_fs (args[0], var, state[SEARCH_NO_FLOPPY].set, SEARCH_FILE);
|
|
||||||
else
|
|
||||||
return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
|
|
||||||
|
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
static grub_command_t cmd;
|
||||||
|
|
||||||
GRUB_MOD_INIT(search)
|
#ifdef DO_SEARCH_FILE
|
||||||
|
GRUB_MOD_INIT(search_fs_file)
|
||||||
|
#elif defined (DO_SEARCH_FS_UUID)
|
||||||
|
GRUB_MOD_INIT(search_fs_uuid)
|
||||||
|
#else
|
||||||
|
GRUB_MOD_INIT(search_label)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
cmd =
|
cmd =
|
||||||
grub_register_extcmd ("search", grub_cmd_search,
|
grub_register_command (COMMAND_NAME, grub_cmd_do_search,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
N_("NAME [VARIABLE]"),
|
||||||
"search [-f|-l|-u|-s|-n] NAME",
|
HELP_MESSAGE);
|
||||||
"Search devices by file, filesystem label or filesystem UUID."
|
|
||||||
" If --set is specified, the first device found is"
|
|
||||||
" set to a variable. If no variable name is"
|
|
||||||
" specified, \"root\" is used.",
|
|
||||||
options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(search)
|
#ifdef DO_SEARCH_FILE
|
||||||
|
GRUB_MOD_FINI(search_fs_file)
|
||||||
|
#elif defined (DO_SEARCH_FS_UUID)
|
||||||
|
GRUB_MOD_FINI(search_fs_uuid)
|
||||||
|
#else
|
||||||
|
GRUB_MOD_FINI(search_label)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
grub_unregister_extcmd (cmd);
|
grub_unregister_command (cmd);
|
||||||
}
|
}
|
||||||
|
|
6
commands/search_file.c
Normal file
6
commands/search_file.c
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#define DO_SEARCH_FILE 1
|
||||||
|
#define FUNC_NAME grub_search_fs_file
|
||||||
|
#define COMMAND_NAME "search.file"
|
||||||
|
#define SEARCH_TARGET "file"
|
||||||
|
#define HELP_MESSAGE N_("Search devices by file. If VARIABLE is specified, the first device found is set to a variable.")
|
||||||
|
#include "search.c"
|
6
commands/search_label.c
Normal file
6
commands/search_label.c
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#define DO_SEARCH_FS_LABEL 1
|
||||||
|
#define FUNC_NAME grub_search_label
|
||||||
|
#define COMMAND_NAME "search.fs_label"
|
||||||
|
#define SEARCH_TARGET "filesystem label"
|
||||||
|
#define HELP_MESSAGE N_("Search devices by label. If VARIABLE is specified, the first device found is set to a variable.")
|
||||||
|
#include "search.c"
|
6
commands/search_uuid.c
Normal file
6
commands/search_uuid.c
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#define DO_SEARCH_FS_UUID 1
|
||||||
|
#define FUNC_NAME grub_search_fs_uuid
|
||||||
|
#define COMMAND_NAME "search.fs_uuid"
|
||||||
|
#define SEARCH_TARGET "filesystem UUID"
|
||||||
|
#define HELP_MESSAGE N_("Search devices by UUID. If VARIABLE is specified, the first device found is set to a variable.")
|
||||||
|
#include "search.c"
|
95
commands/search_wrap.c
Normal file
95
commands/search_wrap.c
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
/* search.c - search devices based on a file or a filesystem label */
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/types.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <grub/err.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/env.h>
|
||||||
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/search.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
static const struct grub_arg_option options[] =
|
||||||
|
{
|
||||||
|
{"file", 'f', 0, N_("Search devices by a file."), 0, 0},
|
||||||
|
{"label", 'l', 0, N_("Search devices by a filesystem label."),
|
||||||
|
0, 0},
|
||||||
|
{"fs-uuid", 'u', 0, N_("Search devices by a filesystem UUID."),
|
||||||
|
0, 0},
|
||||||
|
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
|
||||||
|
N_("Set a variable to the first device found."), "VAR", ARG_TYPE_STRING},
|
||||||
|
{"no-floppy", 'n', 0, N_("Do not probe any floppy drive."), 0, 0},
|
||||||
|
{0, 0, 0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
enum options
|
||||||
|
{
|
||||||
|
SEARCH_FILE,
|
||||||
|
SEARCH_LABEL,
|
||||||
|
SEARCH_FS_UUID,
|
||||||
|
SEARCH_SET,
|
||||||
|
SEARCH_NO_FLOPPY,
|
||||||
|
};
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_search (grub_extcmd_t cmd, int argc, char **args)
|
||||||
|
{
|
||||||
|
struct grub_arg_list *state = cmd->state;
|
||||||
|
const char *var = 0;
|
||||||
|
|
||||||
|
if (argc == 0)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no argument specified");
|
||||||
|
|
||||||
|
if (state[SEARCH_SET].set)
|
||||||
|
var = state[SEARCH_SET].arg ? state[SEARCH_SET].arg : "root";
|
||||||
|
|
||||||
|
if (state[SEARCH_LABEL].set)
|
||||||
|
grub_search_label (args[0], var, state[SEARCH_NO_FLOPPY].set);
|
||||||
|
else if (state[SEARCH_FS_UUID].set)
|
||||||
|
grub_search_fs_uuid (args[0], var, state[SEARCH_NO_FLOPPY].set);
|
||||||
|
else if (state[SEARCH_FILE].set)
|
||||||
|
grub_search_fs_file (args[0], var, state[SEARCH_NO_FLOPPY].set);
|
||||||
|
else
|
||||||
|
return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
|
||||||
|
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_extcmd_t cmd;
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(search)
|
||||||
|
{
|
||||||
|
cmd =
|
||||||
|
grub_register_extcmd ("search", grub_cmd_search,
|
||||||
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
|
N_("search [-f|-l|-u|-s|-n] NAME"),
|
||||||
|
N_("Search devices by file, filesystem label"
|
||||||
|
" or filesystem UUID."
|
||||||
|
" If --set is specified, the first device found is"
|
||||||
|
" set to a variable. If no variable name is"
|
||||||
|
" specified, \"root\" is used."),
|
||||||
|
options);
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(search)
|
||||||
|
{
|
||||||
|
grub_unregister_extcmd (cmd);
|
||||||
|
}
|
340
commands/setpci.c
Normal file
340
commands/setpci.c
Normal file
|
@ -0,0 +1,340 @@
|
||||||
|
/* lspci.c - List PCI devices. */
|
||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/pci.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/env.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
|
||||||
|
struct pci_register
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
grub_uint16_t addr;
|
||||||
|
unsigned size;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct pci_register pci_registers[] =
|
||||||
|
{
|
||||||
|
{"VENDOR_ID", GRUB_PCI_REG_VENDOR , 2},
|
||||||
|
{"DEVICE_ID", GRUB_PCI_REG_DEVICE , 2},
|
||||||
|
{"COMMAND", GRUB_PCI_REG_COMMAND , 2},
|
||||||
|
{"STATUS", GRUB_PCI_REG_STATUS , 2},
|
||||||
|
{"REVISION", GRUB_PCI_REG_REVISION , 1},
|
||||||
|
{"CLASS_PROG", GRUB_PCI_REG_CLASS + 1 , 1},
|
||||||
|
{"CLASS_DEVICE", GRUB_PCI_REG_CLASS + 2 , 2},
|
||||||
|
{"CACHE_LINE_SIZE", GRUB_PCI_REG_CACHELINE , 1},
|
||||||
|
{"LATENCY_TIMER", GRUB_PCI_REG_LAT_TIMER , 1},
|
||||||
|
{"HEADER_TYPE", GRUB_PCI_REG_HEADER_TYPE , 1},
|
||||||
|
{"BIST", GRUB_PCI_REG_BIST , 1},
|
||||||
|
{"BASE_ADDRESS_0", GRUB_PCI_REG_ADDRESS_REG0, 4},
|
||||||
|
{"BASE_ADDRESS_1", GRUB_PCI_REG_ADDRESS_REG1, 4},
|
||||||
|
{"BASE_ADDRESS_2", GRUB_PCI_REG_ADDRESS_REG2, 4},
|
||||||
|
{"BASE_ADDRESS_3", GRUB_PCI_REG_ADDRESS_REG3, 4},
|
||||||
|
{"BASE_ADDRESS_4", GRUB_PCI_REG_ADDRESS_REG4, 4},
|
||||||
|
{"BASE_ADDRESS_5", GRUB_PCI_REG_ADDRESS_REG5, 4},
|
||||||
|
{"CARDBUS_CIS", GRUB_PCI_REG_CIS_POINTER , 4},
|
||||||
|
{"SUBVENDOR_ID", GRUB_PCI_REG_SUBVENDOR , 2},
|
||||||
|
{"SUBSYSTEM_ID", GRUB_PCI_REG_SUBSYSTEM , 2},
|
||||||
|
{"ROM_ADDRESS", GRUB_PCI_REG_ROM_ADDRESS , 4},
|
||||||
|
{"CAP_POINTER", GRUB_PCI_REG_CAP_POINTER , 1},
|
||||||
|
{"INTERRUPT_LINE", GRUB_PCI_REG_IRQ_LINE , 1},
|
||||||
|
{"INTERRUPT_PIN", GRUB_PCI_REG_IRQ_PIN , 1},
|
||||||
|
{"MIN_GNT", GRUB_PCI_REG_MIN_GNT , 1},
|
||||||
|
{"MAX_LAT", GRUB_PCI_REG_MIN_GNT , 1},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct grub_arg_option options[] =
|
||||||
|
{
|
||||||
|
{0, 'd', 0, "Select device by vendor and device IDs.",
|
||||||
|
"[vendor]:[device]", ARG_TYPE_STRING},
|
||||||
|
{0, 's', 0, "Select device by its position on the bus.",
|
||||||
|
"[bus]:[slot][.func]", ARG_TYPE_STRING},
|
||||||
|
{0, 'v', 0, "Save read value into variable VARNAME.",
|
||||||
|
"VARNAME", ARG_TYPE_STRING},
|
||||||
|
{0, 0, 0, 0, 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
static grub_uint32_t pciid_check_mask, pciid_check_value;
|
||||||
|
static int bus, device, function;
|
||||||
|
static int check_bus, check_device, check_function;
|
||||||
|
static grub_uint32_t write_mask, regwrite;
|
||||||
|
static int regsize;
|
||||||
|
static grub_uint16_t regaddr;
|
||||||
|
static const char *varname;
|
||||||
|
|
||||||
|
static int NESTED_FUNC_ATTR
|
||||||
|
grub_setpci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
||||||
|
{
|
||||||
|
grub_uint32_t regval = 0;
|
||||||
|
grub_pci_address_t addr;
|
||||||
|
|
||||||
|
if ((pciid & pciid_check_mask) != pciid_check_value)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (check_bus && grub_pci_get_bus (dev) != bus)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (check_device && grub_pci_get_device (dev) != device)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (check_function && grub_pci_get_function (dev) != device)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
addr = grub_pci_make_address (dev, regaddr);
|
||||||
|
|
||||||
|
switch (regsize)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
regval = grub_pci_read_byte (addr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
regval = grub_pci_read_word (addr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
regval = grub_pci_read (addr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (varname)
|
||||||
|
{
|
||||||
|
char buf[sizeof ("XXXXXXXX")];
|
||||||
|
grub_snprintf (buf, sizeof (buf), "%x", regval);
|
||||||
|
grub_env_set (varname, buf);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!write_mask)
|
||||||
|
{
|
||||||
|
grub_printf ("Register %x of %d:%d.%d is %x\n", regaddr,
|
||||||
|
grub_pci_get_bus (dev),
|
||||||
|
grub_pci_get_device (dev),
|
||||||
|
grub_pci_get_function (dev),
|
||||||
|
regval);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
regval = (regval & ~write_mask) | regwrite;
|
||||||
|
|
||||||
|
switch (regsize)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
grub_pci_write_byte (addr, regval);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
grub_pci_write_word (addr, regval);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
grub_pci_write (addr, regval);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_setpci (grub_extcmd_t cmd, int argc, char **argv)
|
||||||
|
{
|
||||||
|
const char *ptr;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
pciid_check_value = 0;
|
||||||
|
pciid_check_mask = 0;
|
||||||
|
|
||||||
|
if (cmd->state[0].set)
|
||||||
|
{
|
||||||
|
ptr = cmd->state[0].arg;
|
||||||
|
pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff);
|
||||||
|
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||||
|
{
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
ptr = cmd->state[0].arg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pciid_check_mask |= 0xffff;
|
||||||
|
if (grub_errno)
|
||||||
|
return grub_errno;
|
||||||
|
if (*ptr != ':')
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Colon expected.");
|
||||||
|
ptr++;
|
||||||
|
pciid_check_value |= (grub_strtoul (ptr, (char **) &ptr, 16) & 0xffff)
|
||||||
|
<< 16;
|
||||||
|
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
else
|
||||||
|
pciid_check_mask |= 0xffff0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
pciid_check_value &= pciid_check_mask;
|
||||||
|
|
||||||
|
check_bus = check_device = check_function = 0;
|
||||||
|
|
||||||
|
if (cmd->state[1].set)
|
||||||
|
{
|
||||||
|
const char *optr;
|
||||||
|
|
||||||
|
ptr = cmd->state[1].arg;
|
||||||
|
optr = ptr;
|
||||||
|
bus = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||||
|
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||||
|
{
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
ptr = optr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
check_bus = 1;
|
||||||
|
if (grub_errno)
|
||||||
|
return grub_errno;
|
||||||
|
if (*ptr != ':')
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Colon expected.");
|
||||||
|
ptr++;
|
||||||
|
optr = ptr;
|
||||||
|
device = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||||
|
if (grub_errno == GRUB_ERR_BAD_NUMBER)
|
||||||
|
{
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
ptr = optr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
check_device = 1;
|
||||||
|
if (*ptr == '.')
|
||||||
|
{
|
||||||
|
ptr++;
|
||||||
|
function = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||||
|
if (grub_errno)
|
||||||
|
return grub_errno;
|
||||||
|
check_function = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd->state[2].set)
|
||||||
|
varname = cmd->state[2].arg;
|
||||||
|
else
|
||||||
|
varname = NULL;
|
||||||
|
|
||||||
|
write_mask = 0;
|
||||||
|
|
||||||
|
if (argc == 0)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Command expected.");
|
||||||
|
|
||||||
|
if (argc > 1)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Only one command is supported.");
|
||||||
|
|
||||||
|
ptr = argv[0];
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE (pci_registers); i++)
|
||||||
|
{
|
||||||
|
if (grub_strncmp (ptr, pci_registers[i].name,
|
||||||
|
grub_strlen (pci_registers[i].name)) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i == ARRAY_SIZE (pci_registers))
|
||||||
|
{
|
||||||
|
regsize = 0;
|
||||||
|
regaddr = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||||
|
if (grub_errno)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown register");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
regaddr = pci_registers[i].addr;
|
||||||
|
regsize = pci_registers[i].size;
|
||||||
|
ptr += grub_strlen (pci_registers[i].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grub_errno)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
if (*ptr == '+')
|
||||||
|
{
|
||||||
|
ptr++;
|
||||||
|
regaddr += grub_strtoul (ptr, (char **) &ptr, 16);
|
||||||
|
if (grub_errno)
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grub_memcmp (ptr, ".L", sizeof (".L") - 1) == 0
|
||||||
|
|| grub_memcmp (ptr, ".l", sizeof (".l") - 1) == 0)
|
||||||
|
{
|
||||||
|
regsize = 4;
|
||||||
|
ptr += sizeof (".l") - 1;
|
||||||
|
}
|
||||||
|
else if (grub_memcmp (ptr, ".W", sizeof (".W") - 1) == 0
|
||||||
|
|| grub_memcmp (ptr, ".w", sizeof (".w") - 1) == 0)
|
||||||
|
{
|
||||||
|
regsize = 2;
|
||||||
|
ptr += sizeof (".w") - 1;
|
||||||
|
}
|
||||||
|
else if (grub_memcmp (ptr, ".B", sizeof (".B") - 1) == 0
|
||||||
|
|| grub_memcmp (ptr, ".b", sizeof (".b") - 1) == 0)
|
||||||
|
{
|
||||||
|
regsize = 1;
|
||||||
|
ptr += sizeof (".b") - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!regsize)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
|
"Unknown register size.");
|
||||||
|
|
||||||
|
write_mask = 0;
|
||||||
|
if (*ptr == '=')
|
||||||
|
{
|
||||||
|
ptr++;
|
||||||
|
regwrite = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||||
|
if (grub_errno)
|
||||||
|
return grub_errno;
|
||||||
|
write_mask = 0xffffffff;
|
||||||
|
if (*ptr == ':')
|
||||||
|
{
|
||||||
|
ptr++;
|
||||||
|
write_mask = grub_strtoul (ptr, (char **) &ptr, 16);
|
||||||
|
if (grub_errno)
|
||||||
|
return grub_errno;
|
||||||
|
write_mask = 0xffffffff;
|
||||||
|
}
|
||||||
|
regwrite &= write_mask;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (write_mask && varname)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
|
"Option -v isn't valid for writes.");
|
||||||
|
|
||||||
|
grub_pci_iterate (grub_setpci_iter);
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_extcmd_t cmd;
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(setpci)
|
||||||
|
{
|
||||||
|
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, GRUB_COMMAND_FLAG_BOTH,
|
||||||
|
"setpci [-s POSITION] [-d DEVICE] [-v VAR] "
|
||||||
|
"[REGISTER][=VALUE[:MASK]]",
|
||||||
|
"Manipulate PCI devices.", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(setpci)
|
||||||
|
{
|
||||||
|
grub_unregister_extcmd (cmd);
|
||||||
|
}
|
|
@ -22,22 +22,22 @@
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/machine/time.h>
|
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"verbose", 'v', 0, "verbose countdown", 0, 0},
|
{"verbose", 'v', 0, N_("Verbose countdown."), 0, 0},
|
||||||
{"interruptible", 'i', 0, "interruptible with ESC", 0, 0},
|
{"interruptible", 'i', 0, N_("Interruptible with ESC."), 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
static grub_uint8_t x, y;
|
static grub_uint16_t *pos;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_print (int n)
|
do_print (int n)
|
||||||
{
|
{
|
||||||
grub_gotoxy (x, y);
|
grub_term_restore_pos (pos);
|
||||||
/* NOTE: Do not remove the trailing space characters.
|
/* NOTE: Do not remove the trailing space characters.
|
||||||
They are required to clear the line. */
|
They are required to clear the line. */
|
||||||
grub_printf ("%d ", n);
|
grub_printf ("%d ", n);
|
||||||
|
@ -63,7 +63,6 @@ static grub_err_t
|
||||||
grub_cmd_sleep (grub_extcmd_t cmd, int argc, char **args)
|
grub_cmd_sleep (grub_extcmd_t cmd, int argc, char **args)
|
||||||
{
|
{
|
||||||
struct grub_arg_list *state = cmd->state;
|
struct grub_arg_list *state = cmd->state;
|
||||||
grub_uint16_t xy;
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
|
@ -77,9 +76,7 @@ grub_cmd_sleep (grub_extcmd_t cmd, int argc, char **args)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xy = grub_getxy ();
|
pos = grub_term_save_pos ();
|
||||||
x = xy >> 8;
|
|
||||||
y = xy & 0xff;
|
|
||||||
|
|
||||||
for (; n; n--)
|
for (; n; n--)
|
||||||
{
|
{
|
||||||
|
@ -105,8 +102,8 @@ static grub_extcmd_t cmd;
|
||||||
GRUB_MOD_INIT(sleep)
|
GRUB_MOD_INIT(sleep)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
|
cmd = grub_register_extcmd ("sleep", grub_cmd_sleep, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"sleep NUMBER_OF_SECONDS",
|
N_("NUMBER_OF_SECONDS"),
|
||||||
"Wait for a specified number of seconds",
|
N_("Wait for a specified number of seconds."),
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
368
commands/terminal.c
Normal file
368
commands/terminal.c
Normal file
|
@ -0,0 +1,368 @@
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2009,2010 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/mm.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/command.h>
|
||||||
|
#include <grub/term.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
|
||||||
|
struct grub_term_autoload *grub_term_input_autoload = NULL;
|
||||||
|
struct grub_term_autoload *grub_term_output_autoload = NULL;
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
int argc, char **args)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
grub_term_input_t term;
|
||||||
|
struct grub_term_autoload *aut;
|
||||||
|
|
||||||
|
if (argc == 0)
|
||||||
|
{
|
||||||
|
grub_puts_ (N_ ("Active input terminals:"));
|
||||||
|
FOR_ACTIVE_TERM_INPUTS(term)
|
||||||
|
grub_printf ("%s ", term->name);
|
||||||
|
grub_printf ("\n");
|
||||||
|
grub_puts_ (N_ ("Available input terminals:"));
|
||||||
|
FOR_DISABLED_TERM_INPUTS(term)
|
||||||
|
grub_printf ("%s ", term->name);
|
||||||
|
/* This is quadratic but we don't expect mode than 30 terminal
|
||||||
|
modules ever. */
|
||||||
|
for (aut = grub_term_input_autoload; aut; aut = aut->next)
|
||||||
|
{
|
||||||
|
FOR_DISABLED_TERM_INPUTS(term)
|
||||||
|
if (grub_strcmp (term->name, aut->name) == 0)
|
||||||
|
break;
|
||||||
|
if (!term)
|
||||||
|
FOR_ACTIVE_TERM_INPUTS(term)
|
||||||
|
if (grub_strcmp (term->name, aut->name) == 0)
|
||||||
|
break;
|
||||||
|
if (!term)
|
||||||
|
grub_printf ("%s ", aut->name);
|
||||||
|
}
|
||||||
|
grub_printf ("\n");
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
|
|
||||||
|
if (grub_strcmp (args[0], "--append") == 0
|
||||||
|
|| grub_strcmp (args[0], "--remove") == 0)
|
||||||
|
i++;
|
||||||
|
|
||||||
|
if (i == argc)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
|
||||||
|
|
||||||
|
for (; i < argc; i++)
|
||||||
|
{
|
||||||
|
int again = 0;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
FOR_DISABLED_TERM_INPUTS(term)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (term == 0)
|
||||||
|
FOR_ACTIVE_TERM_INPUTS(term)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (term)
|
||||||
|
break;
|
||||||
|
if (again)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||||
|
args[i]);
|
||||||
|
for (aut = grub_term_input_autoload; aut; aut = aut->next)
|
||||||
|
if (grub_strcmp (args[i], aut->name) == 0)
|
||||||
|
{
|
||||||
|
grub_dl_t mod;
|
||||||
|
mod = grub_dl_load (aut->modname);
|
||||||
|
if (mod)
|
||||||
|
grub_dl_ref (mod);
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!aut)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||||
|
args[i]);
|
||||||
|
again = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grub_strcmp (args[0], "--append") == 0)
|
||||||
|
{
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
FOR_DISABLED_TERM_INPUTS(term)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (term)
|
||||||
|
{
|
||||||
|
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grub_strcmp (args[0], "--remove") == 0)
|
||||||
|
{
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
FOR_ACTIVE_TERM_INPUTS(term)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (term)
|
||||||
|
{
|
||||||
|
if (!term->next && term == grub_term_inputs)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
|
"can't remove the last terminal");
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
if (term->fini)
|
||||||
|
term->fini ();
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
{
|
||||||
|
FOR_DISABLED_TERM_INPUTS(term)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (term)
|
||||||
|
{
|
||||||
|
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FOR_ACTIVE_TERM_INPUTS(term)
|
||||||
|
{
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (i == argc)
|
||||||
|
{
|
||||||
|
if (!term->next && term == grub_term_inputs)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
|
"can't remove the last terminal");
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
if (term->fini)
|
||||||
|
term->fini ();
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
int argc, char **args)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
grub_term_output_t term;
|
||||||
|
struct grub_term_autoload *aut;
|
||||||
|
|
||||||
|
if (argc == 0)
|
||||||
|
{
|
||||||
|
grub_puts_ (N_ ("Active output terminals:"));
|
||||||
|
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||||
|
grub_printf ("%s ", term->name);
|
||||||
|
grub_printf ("\n");
|
||||||
|
grub_puts_ (N_ ("Available output terminals:"));
|
||||||
|
FOR_DISABLED_TERM_OUTPUTS(term)
|
||||||
|
grub_printf ("%s ", term->name);
|
||||||
|
/* This is quadratic but we don't expect mode than 30 terminal
|
||||||
|
modules ever. */
|
||||||
|
for (aut = grub_term_output_autoload; aut; aut = aut->next)
|
||||||
|
{
|
||||||
|
FOR_DISABLED_TERM_OUTPUTS(term)
|
||||||
|
if (grub_strcmp (term->name, aut->name) == 0)
|
||||||
|
break;
|
||||||
|
if (!term)
|
||||||
|
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||||
|
if (grub_strcmp (term->name, aut->name) == 0)
|
||||||
|
break;
|
||||||
|
if (!term)
|
||||||
|
grub_printf ("%s ", aut->name);
|
||||||
|
}
|
||||||
|
grub_printf ("\n");
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
|
|
||||||
|
if (grub_strcmp (args[0], "--append") == 0
|
||||||
|
|| grub_strcmp (args[0], "--remove") == 0)
|
||||||
|
i++;
|
||||||
|
|
||||||
|
if (i == argc)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
|
||||||
|
|
||||||
|
for (; i < argc; i++)
|
||||||
|
{
|
||||||
|
int again = 0;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
FOR_DISABLED_TERM_OUTPUTS(term)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (term == 0)
|
||||||
|
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (term)
|
||||||
|
break;
|
||||||
|
if (again)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||||
|
args[i]);
|
||||||
|
for (aut = grub_term_output_autoload; aut; aut = aut->next)
|
||||||
|
if (grub_strcmp (args[i], aut->name) == 0)
|
||||||
|
{
|
||||||
|
grub_dl_t mod;
|
||||||
|
mod = grub_dl_load (aut->modname);
|
||||||
|
if (mod)
|
||||||
|
grub_dl_ref (mod);
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!aut)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
|
||||||
|
args[i]);
|
||||||
|
again = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grub_strcmp (args[0], "--append") == 0)
|
||||||
|
{
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
FOR_DISABLED_TERM_OUTPUTS(term)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (term)
|
||||||
|
{
|
||||||
|
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grub_strcmp (args[0], "--remove") == 0)
|
||||||
|
{
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (term)
|
||||||
|
{
|
||||||
|
if (!term->next && term == grub_term_outputs)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
|
"can't remove the last terminal");
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
if (term->fini)
|
||||||
|
term->fini ();
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
{
|
||||||
|
FOR_DISABLED_TERM_OUTPUTS(term)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (term)
|
||||||
|
{
|
||||||
|
if (term->init && term->init () != GRUB_ERR_NONE)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||||
|
{
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
if (grub_strcmp (args[i], term->name) == 0)
|
||||||
|
break;
|
||||||
|
if (i == argc)
|
||||||
|
{
|
||||||
|
if (!term->next && term == grub_term_outputs)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
|
"can't remove the last terminal");
|
||||||
|
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
if (term->fini)
|
||||||
|
term->fini ();
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
|
||||||
|
GRUB_AS_LIST (term));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_command_t cmd_terminal_input, cmd_terminal_output;
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(terminal)
|
||||||
|
{
|
||||||
|
cmd_terminal_input =
|
||||||
|
grub_register_command ("terminal_input", grub_cmd_terminal_input,
|
||||||
|
"[--append|--remove] "
|
||||||
|
"[TERMINAL1] [TERMINAL2] ...",
|
||||||
|
"List or select an input terminal.");
|
||||||
|
cmd_terminal_output =
|
||||||
|
grub_register_command ("terminal_output", grub_cmd_terminal_output,
|
||||||
|
"[--append|--remove] "
|
||||||
|
"[TERMINAL1] [TERMINAL2] ...",
|
||||||
|
"List or select an output terminal.");
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(terminal)
|
||||||
|
{
|
||||||
|
grub_unregister_command (cmd_terminal_input);
|
||||||
|
grub_unregister_command (cmd_terminal_output);
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
/* test.c -- The test command.. */
|
/* test.c -- The test command.. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2005,2007 Free Software Foundation, Inc.
|
* Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
#include <grub/device.h>
|
#include <grub/device.h>
|
||||||
#include <grub/file.h>
|
#include <grub/file.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
/* A simple implementation for signed numbers. */
|
/* A simple implementation for signed numbers. */
|
||||||
static int
|
static int
|
||||||
|
@ -420,9 +421,9 @@ static grub_command_t cmd_1, cmd_2;
|
||||||
GRUB_MOD_INIT(test)
|
GRUB_MOD_INIT(test)
|
||||||
{
|
{
|
||||||
cmd_1 = grub_register_command ("[", grub_cmd_test,
|
cmd_1 = grub_register_command ("[", grub_cmd_test,
|
||||||
"[ EXPRESSION ]", "Evaluate an expression");
|
N_("EXPRESSION ]"), N_("Evaluate an expression."));
|
||||||
cmd_2 = grub_register_command ("test", grub_cmd_test,
|
cmd_2 = grub_register_command ("test", grub_cmd_test,
|
||||||
"test EXPRESSION", "Evaluate an expression");
|
N_("EXPRESSION"), N_("Evaluate an expression."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(test)
|
GRUB_MOD_FINI(test)
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_true (struct grub_command *cmd __attribute__ ((unused)),
|
grub_cmd_true (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
|
@ -43,10 +44,10 @@ GRUB_MOD_INIT(true)
|
||||||
{
|
{
|
||||||
cmd_true =
|
cmd_true =
|
||||||
grub_register_command ("true", grub_cmd_true,
|
grub_register_command ("true", grub_cmd_true,
|
||||||
0, "do nothing, successfully");
|
0, N_("Do nothing, successfully."));
|
||||||
cmd_false =
|
cmd_false =
|
||||||
grub_register_command ("false", grub_cmd_false,
|
grub_register_command ("false", grub_cmd_false,
|
||||||
0, "do nothing, unsuccessfully");
|
0, N_("Do nothing, unsuccessfully."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(true)
|
GRUB_MOD_FINI(true)
|
||||||
|
|
|
@ -19,11 +19,13 @@
|
||||||
|
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
|
#include <grub/charset.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/usb.h>
|
#include <grub/usb.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static const char *usb_classes[] =
|
static const char *usb_classes[] =
|
||||||
{
|
{
|
||||||
|
@ -59,18 +61,60 @@ static const char *usb_devspeed[] =
|
||||||
"High"
|
"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
|
static void
|
||||||
usb_print_str (const char *description, grub_usb_device_t dev, int idx)
|
usb_print_str (const char *description, grub_usb_device_t dev, int idx)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
grub_usb_err_t err;
|
||||||
/* XXX: LANGID */
|
/* XXX: LANGID */
|
||||||
|
|
||||||
if (! idx)
|
if (! idx)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
grub_usb_get_string (dev, idx, 0x0409, &name);
|
err = grub_usb_get_string (dev, idx, 0x0409, &name);
|
||||||
grub_printf ("%s: `%s'\n", description, name);
|
if (err)
|
||||||
grub_free (name);
|
grub_printf ("Error %d retrieving %s\n", err, description);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grub_printf ("%s: `%s'\n", description, name);
|
||||||
|
grub_free (name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -152,7 +196,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(usbtest)
|
GRUB_MOD_INIT(usbtest)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("usb", grub_cmd_usbtest,
|
cmd = grub_register_command ("usb", grub_cmd_usbtest,
|
||||||
0, "Test USB support");
|
0, N_("Test USB support."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(usbtest)
|
GRUB_MOD_FINI(usbtest)
|
||||||
|
|
|
@ -24,15 +24,14 @@
|
||||||
#include <grub/font.h>
|
#include <grub/font.h>
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int argc __attribute__ ((unused)),
|
int argc __attribute__ ((unused)),
|
||||||
char **args __attribute__ ((unused)))
|
char **args __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if (grub_video_set_mode ("1024x768;800x600;640x480", 0) != GRUB_ERR_NONE)
|
grub_err_t err;
|
||||||
return grub_errno;
|
|
||||||
|
|
||||||
grub_video_color_t color;
|
grub_video_color_t color;
|
||||||
unsigned int x;
|
unsigned int x;
|
||||||
unsigned int y;
|
unsigned int y;
|
||||||
|
@ -49,6 +48,10 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
||||||
const char *str;
|
const char *str;
|
||||||
int texty;
|
int texty;
|
||||||
|
|
||||||
|
err = grub_video_set_mode ("auto", GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
grub_video_get_viewport (&x, &y, &width, &height);
|
grub_video_get_viewport (&x, &y, &width, &height);
|
||||||
|
|
||||||
grub_video_create_render_target (&text_layer, width, height,
|
grub_video_create_render_target (&text_layer, width, height,
|
||||||
|
@ -66,12 +69,12 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
||||||
color = grub_video_map_rgb (0, 255, 255);
|
color = grub_video_map_rgb (0, 255, 255);
|
||||||
grub_video_fill_rect (color, 100, 100, 100, 100);
|
grub_video_fill_rect (color, 100, 100, 100, 100);
|
||||||
|
|
||||||
sansbig = grub_font_get ("Helvetica Bold 24");
|
sansbig = grub_font_get ("Unknown Regular 16");
|
||||||
sans = grub_font_get ("Helvetica Bold 14");
|
sans = grub_font_get ("Unknown Regular 16");
|
||||||
sanssmall = grub_font_get ("Helvetica 8");
|
sanssmall = grub_font_get ("Unknown Regular 16");
|
||||||
fixed = grub_font_get ("Fixed 20");
|
fixed = grub_font_get ("Fixed 20");
|
||||||
if (! sansbig || ! sans || ! sanssmall || ! fixed)
|
if (! sansbig || ! sans || ! sanssmall || ! fixed)
|
||||||
return grub_error (GRUB_ERR_BAD_FONT, "No font loaded.");
|
return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
|
||||||
|
|
||||||
glyph = grub_font_get_glyph (fixed, '*');
|
glyph = grub_font_get_glyph (fixed, '*');
|
||||||
grub_font_draw_glyph (glyph, color, 200 ,0);
|
grub_font_draw_glyph (glyph, color, 200 ,0);
|
||||||
|
@ -123,11 +126,6 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
||||||
grub_font_draw_string (str, fixed, color, 16, texty);
|
grub_font_draw_string (str, fixed, color, 16, texty);
|
||||||
texty += grub_font_get_descent (fixed) + grub_font_get_leading (fixed);
|
texty += grub_font_get_descent (fixed) + grub_font_get_leading (fixed);
|
||||||
|
|
||||||
/* Some character don't exist in the Helvetica font, so the font engine
|
|
||||||
will fall back to using glyphs from another font that does contain them.
|
|
||||||
TODO The font engine should be smart about selecting a replacement font
|
|
||||||
and prioritize fonts with similar sizes. */
|
|
||||||
|
|
||||||
texty += grub_font_get_ascent(sansbig);
|
texty += grub_font_get_ascent(sansbig);
|
||||||
grub_font_draw_string (str, sansbig, color, 16, texty);
|
grub_font_draw_string (str, sansbig, color, 16, texty);
|
||||||
texty += grub_font_get_descent (sansbig) + grub_font_get_leading (sansbig);
|
texty += grub_font_get_descent (sansbig) + grub_font_get_leading (sansbig);
|
||||||
|
@ -152,12 +150,13 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
||||||
|
|
||||||
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
|
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
|
||||||
|
|
||||||
for (i = 0; i < 255; i++)
|
for (i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
color = grub_video_map_rgb (i, 33, 77);
|
color = grub_video_map_rgb (i, 33, 77);
|
||||||
grub_video_fill_rect (color, 0, 0, width, height);
|
grub_video_fill_rect (color, 0, 0, width, height);
|
||||||
grub_video_blit_render_target (text_layer, GRUB_VIDEO_BLIT_BLEND, 0, 0,
|
grub_video_blit_render_target (text_layer, GRUB_VIDEO_BLIT_BLEND, 0, 0,
|
||||||
0, 0, width, height);
|
0, 0, width, height);
|
||||||
|
grub_video_swap_buffers ();
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_getkey ();
|
grub_getkey ();
|
||||||
|
@ -178,7 +177,7 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT(videotest)
|
GRUB_MOD_INIT(videotest)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("videotest", grub_cmd_videotest,
|
cmd = grub_register_command ("videotest", grub_cmd_videotest,
|
||||||
0, "Test video subsystem");
|
0, N_("Test video subsystem."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(videotest)
|
GRUB_MOD_FINI(videotest)
|
||||||
|
|
|
@ -31,12 +31,8 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/env.h>
|
#include <grub/env.h>
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
struct tohash
|
#include <grub/crypto.h>
|
||||||
{
|
|
||||||
grub_uint8_t prefix[16];
|
|
||||||
grub_uint64_t serial;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* This prefix is used by xnu and boot-132 to hash
|
/* This prefix is used by xnu and boot-132 to hash
|
||||||
together with volume serial. */
|
together with volume serial. */
|
||||||
|
@ -44,312 +40,28 @@ static grub_uint8_t hash_prefix[16]
|
||||||
= {0xB3, 0xE2, 0x0F, 0x39, 0xF2, 0x92, 0x11, 0xD6,
|
= {0xB3, 0xE2, 0x0F, 0x39, 0xF2, 0x92, 0x11, 0xD6,
|
||||||
0x97, 0xA4, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC};
|
0x97, 0xA4, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC};
|
||||||
|
|
||||||
#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
|
|
||||||
#define ror(x,n) ( ((x) >> (n)) | ((x) << (32-(n))) )
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
grub_uint32_t A,B,C,D; /* chaining variables */
|
|
||||||
grub_uint32_t nblocks;
|
|
||||||
grub_uint8_t buf[64];
|
|
||||||
int count;
|
|
||||||
} MD5_CONTEXT;
|
|
||||||
|
|
||||||
static void
|
|
||||||
md5_init( void *context )
|
|
||||||
{
|
|
||||||
MD5_CONTEXT *ctx = context;
|
|
||||||
|
|
||||||
ctx->A = 0x67452301;
|
|
||||||
ctx->B = 0xefcdab89;
|
|
||||||
ctx->C = 0x98badcfe;
|
|
||||||
ctx->D = 0x10325476;
|
|
||||||
|
|
||||||
ctx->nblocks = 0;
|
|
||||||
ctx->count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* These are the four functions used in the four steps of the MD5 algorithm
|
|
||||||
and defined in the RFC 1321. The first function is a little bit optimized
|
|
||||||
(as found in Colin Plumbs public domain implementation). */
|
|
||||||
/* #define FF(b, c, d) ((b & c) | (~b & d)) */
|
|
||||||
#define FF(b, c, d) (d ^ (b & (c ^ d)))
|
|
||||||
#define FG(b, c, d) FF (d, b, c)
|
|
||||||
#define FH(b, c, d) (b ^ c ^ d)
|
|
||||||
#define FI(b, c, d) (c ^ (b | ~d))
|
|
||||||
|
|
||||||
|
|
||||||
/****************
|
|
||||||
* transform n*64 grub_uint8_ts
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
transform ( MD5_CONTEXT *ctx, const unsigned char *data )
|
|
||||||
{
|
|
||||||
grub_uint32_t correct_words[16];
|
|
||||||
register grub_uint32_t A = ctx->A;
|
|
||||||
register grub_uint32_t B = ctx->B;
|
|
||||||
register grub_uint32_t C = ctx->C;
|
|
||||||
register grub_uint32_t D = ctx->D;
|
|
||||||
grub_uint32_t *cwp = correct_words;
|
|
||||||
|
|
||||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
const grub_uint32_t *p = (const grub_uint32_t *) data;
|
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
|
||||||
correct_words[i] = grub_le_to_cpu32 (p[i]);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
grub_memcpy (correct_words, data, 64);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define OP(a, b, c, d, s, T) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
a += FF (b, c, d) + (*cwp++) + T; \
|
|
||||||
a = rol(a, s); \
|
|
||||||
a += b; \
|
|
||||||
} \
|
|
||||||
while (0)
|
|
||||||
|
|
||||||
/* Before we start, one word about the strange constants.
|
|
||||||
They are defined in RFC 1321 as
|
|
||||||
|
|
||||||
T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Round 1. */
|
|
||||||
OP (A, B, C, D, 7, 0xd76aa478);
|
|
||||||
OP (D, A, B, C, 12, 0xe8c7b756);
|
|
||||||
OP (C, D, A, B, 17, 0x242070db);
|
|
||||||
OP (B, C, D, A, 22, 0xc1bdceee);
|
|
||||||
OP (A, B, C, D, 7, 0xf57c0faf);
|
|
||||||
OP (D, A, B, C, 12, 0x4787c62a);
|
|
||||||
OP (C, D, A, B, 17, 0xa8304613);
|
|
||||||
OP (B, C, D, A, 22, 0xfd469501);
|
|
||||||
OP (A, B, C, D, 7, 0x698098d8);
|
|
||||||
OP (D, A, B, C, 12, 0x8b44f7af);
|
|
||||||
OP (C, D, A, B, 17, 0xffff5bb1);
|
|
||||||
OP (B, C, D, A, 22, 0x895cd7be);
|
|
||||||
OP (A, B, C, D, 7, 0x6b901122);
|
|
||||||
OP (D, A, B, C, 12, 0xfd987193);
|
|
||||||
OP (C, D, A, B, 17, 0xa679438e);
|
|
||||||
OP (B, C, D, A, 22, 0x49b40821);
|
|
||||||
|
|
||||||
#undef OP
|
|
||||||
#define OP(f, a, b, c, d, k, s, T) \
|
|
||||||
do \
|
|
||||||
{ \
|
|
||||||
a += f (b, c, d) + correct_words[k] + T; \
|
|
||||||
a = rol(a, s); \
|
|
||||||
a += b; \
|
|
||||||
} \
|
|
||||||
while (0)
|
|
||||||
|
|
||||||
/* Round 2. */
|
|
||||||
OP (FG, A, B, C, D, 1, 5, 0xf61e2562);
|
|
||||||
OP (FG, D, A, B, C, 6, 9, 0xc040b340);
|
|
||||||
OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
|
|
||||||
OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
|
|
||||||
OP (FG, A, B, C, D, 5, 5, 0xd62f105d);
|
|
||||||
OP (FG, D, A, B, C, 10, 9, 0x02441453);
|
|
||||||
OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
|
|
||||||
OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
|
|
||||||
OP (FG, A, B, C, D, 9, 5, 0x21e1cde6);
|
|
||||||
OP (FG, D, A, B, C, 14, 9, 0xc33707d6);
|
|
||||||
OP (FG, C, D, A, B, 3, 14, 0xf4d50d87);
|
|
||||||
OP (FG, B, C, D, A, 8, 20, 0x455a14ed);
|
|
||||||
OP (FG, A, B, C, D, 13, 5, 0xa9e3e905);
|
|
||||||
OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8);
|
|
||||||
OP (FG, C, D, A, B, 7, 14, 0x676f02d9);
|
|
||||||
OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
|
|
||||||
|
|
||||||
/* Round 3. */
|
|
||||||
OP (FH, A, B, C, D, 5, 4, 0xfffa3942);
|
|
||||||
OP (FH, D, A, B, C, 8, 11, 0x8771f681);
|
|
||||||
OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
|
|
||||||
OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
|
|
||||||
OP (FH, A, B, C, D, 1, 4, 0xa4beea44);
|
|
||||||
OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9);
|
|
||||||
OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60);
|
|
||||||
OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
|
|
||||||
OP (FH, A, B, C, D, 13, 4, 0x289b7ec6);
|
|
||||||
OP (FH, D, A, B, C, 0, 11, 0xeaa127fa);
|
|
||||||
OP (FH, C, D, A, B, 3, 16, 0xd4ef3085);
|
|
||||||
OP (FH, B, C, D, A, 6, 23, 0x04881d05);
|
|
||||||
OP (FH, A, B, C, D, 9, 4, 0xd9d4d039);
|
|
||||||
OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
|
|
||||||
OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
|
|
||||||
OP (FH, B, C, D, A, 2, 23, 0xc4ac5665);
|
|
||||||
|
|
||||||
/* Round 4. */
|
|
||||||
OP (FI, A, B, C, D, 0, 6, 0xf4292244);
|
|
||||||
OP (FI, D, A, B, C, 7, 10, 0x432aff97);
|
|
||||||
OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
|
|
||||||
OP (FI, B, C, D, A, 5, 21, 0xfc93a039);
|
|
||||||
OP (FI, A, B, C, D, 12, 6, 0x655b59c3);
|
|
||||||
OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92);
|
|
||||||
OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
|
|
||||||
OP (FI, B, C, D, A, 1, 21, 0x85845dd1);
|
|
||||||
OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f);
|
|
||||||
OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
|
|
||||||
OP (FI, C, D, A, B, 6, 15, 0xa3014314);
|
|
||||||
OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
|
|
||||||
OP (FI, A, B, C, D, 4, 6, 0xf7537e82);
|
|
||||||
OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
|
|
||||||
OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
|
|
||||||
OP (FI, B, C, D, A, 9, 21, 0xeb86d391);
|
|
||||||
|
|
||||||
/* Put checksum in context given as argument. */
|
|
||||||
ctx->A += A;
|
|
||||||
ctx->B += B;
|
|
||||||
ctx->C += C;
|
|
||||||
ctx->D += D;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The routine updates the message-digest context to
|
|
||||||
* account for the presence of each of the characters inBuf[0..inLen-1]
|
|
||||||
* in the message whose digest is being computed.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
md5_write( void *context, const void *inbuf_arg , grub_size_t inlen)
|
|
||||||
{
|
|
||||||
const unsigned char *inbuf = inbuf_arg;
|
|
||||||
MD5_CONTEXT *hd = context;
|
|
||||||
|
|
||||||
if( hd->count == 64 ) /* flush the buffer */
|
|
||||||
{
|
|
||||||
transform( hd, hd->buf );
|
|
||||||
// _gcry_burn_stack (80+6*sizeof(void*));
|
|
||||||
hd->count = 0;
|
|
||||||
hd->nblocks++;
|
|
||||||
}
|
|
||||||
if( !inbuf )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( hd->count )
|
|
||||||
{
|
|
||||||
for( ; inlen && hd->count < 64; inlen-- )
|
|
||||||
hd->buf[hd->count++] = *inbuf++;
|
|
||||||
md5_write( hd, NULL, 0 );
|
|
||||||
if( !inlen )
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// _gcry_burn_stack (80+6*sizeof(void*));
|
|
||||||
|
|
||||||
while( inlen >= 64 )
|
|
||||||
{
|
|
||||||
transform( hd, inbuf );
|
|
||||||
hd->count = 0;
|
|
||||||
hd->nblocks++;
|
|
||||||
inlen -= 64;
|
|
||||||
inbuf += 64;
|
|
||||||
}
|
|
||||||
for( ; inlen && hd->count < 64; inlen-- )
|
|
||||||
hd->buf[hd->count++] = *inbuf++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* The routine final terminates the message-digest computation and
|
|
||||||
* ends with the desired message digest in mdContext->digest[0...15].
|
|
||||||
* The handle is prepared for a new MD5 cycle.
|
|
||||||
* Returns 16 grub_uint8_ts representing the digest.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
md5_final( void *context)
|
|
||||||
{
|
|
||||||
MD5_CONTEXT *hd = context;
|
|
||||||
grub_uint32_t t, msb, lsb;
|
|
||||||
grub_uint32_t *p;
|
|
||||||
|
|
||||||
md5_write(hd, NULL, 0); /* flush */;
|
|
||||||
|
|
||||||
t = hd->nblocks;
|
|
||||||
/* multiply by 64 to make a grub_uint8_t count */
|
|
||||||
lsb = t << 6;
|
|
||||||
msb = t >> 26;
|
|
||||||
/* add the count */
|
|
||||||
t = lsb;
|
|
||||||
if( (lsb += hd->count) < t )
|
|
||||||
msb++;
|
|
||||||
/* multiply by 8 to make a bit count */
|
|
||||||
t = lsb;
|
|
||||||
lsb <<= 3;
|
|
||||||
msb <<= 3;
|
|
||||||
msb |= t >> 29;
|
|
||||||
|
|
||||||
if( hd->count < 56 ) /* enough room */
|
|
||||||
{
|
|
||||||
hd->buf[hd->count++] = 0x80; /* pad */
|
|
||||||
while( hd->count < 56 )
|
|
||||||
hd->buf[hd->count++] = 0; /* pad */
|
|
||||||
}
|
|
||||||
else /* need one extra block */
|
|
||||||
{
|
|
||||||
hd->buf[hd->count++] = 0x80; /* pad character */
|
|
||||||
while( hd->count < 64 )
|
|
||||||
hd->buf[hd->count++] = 0;
|
|
||||||
md5_write(hd, NULL, 0); /* flush */;
|
|
||||||
grub_memset(hd->buf, 0, 56 ); /* fill next block with zeroes */
|
|
||||||
}
|
|
||||||
/* append the 64 bit count */
|
|
||||||
hd->buf[56] = lsb ;
|
|
||||||
hd->buf[57] = lsb >> 8;
|
|
||||||
hd->buf[58] = lsb >> 16;
|
|
||||||
hd->buf[59] = lsb >> 24;
|
|
||||||
hd->buf[60] = msb ;
|
|
||||||
hd->buf[61] = msb >> 8;
|
|
||||||
hd->buf[62] = msb >> 16;
|
|
||||||
hd->buf[63] = msb >> 24;
|
|
||||||
transform( hd, hd->buf );
|
|
||||||
// _gcry_burn_stack (80+6*sizeof(void*));
|
|
||||||
|
|
||||||
p = (grub_uint32_t *) hd->buf;
|
|
||||||
#define X(a) do { *p = grub_le_to_cpu32 (hd->a); p++; } while (0)
|
|
||||||
X(A);
|
|
||||||
X(B);
|
|
||||||
X(C);
|
|
||||||
X(D);
|
|
||||||
#undef X
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GRUB2 Crypto Interface
|
|
||||||
* Written by Michael Gorven
|
|
||||||
*/
|
|
||||||
static grub_err_t
|
|
||||||
md5 (const char *in, grub_size_t insize, char *out)
|
|
||||||
{
|
|
||||||
MD5_CONTEXT hd;
|
|
||||||
|
|
||||||
md5_init (&hd);
|
|
||||||
md5_write (&hd, in, insize);
|
|
||||||
md5_final (&hd);
|
|
||||||
grub_memcpy (out, hd.buf, 16);
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_xnu_uuid (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_xnu_uuid (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int argc, char **args)
|
int argc, char **args)
|
||||||
{
|
{
|
||||||
struct tohash hashme;
|
grub_uint64_t serial;
|
||||||
grub_uint8_t xnu_uuid[16];
|
grub_uint8_t *xnu_uuid;
|
||||||
char uuid_string[sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")];
|
char uuid_string[sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
grub_uint8_t ctx[GRUB_MD_MD5->contextsize];
|
||||||
|
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "UUID required");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "UUID required");
|
||||||
|
|
||||||
hashme.serial = grub_cpu_to_be64 (grub_strtoull (args[0], 0, 16));
|
serial = grub_cpu_to_be64 (grub_strtoull (args[0], 0, 16));
|
||||||
grub_memcpy (hashme.prefix, hash_prefix, sizeof (hashme.prefix));
|
|
||||||
|
|
||||||
md5 ((char *) &hashme, sizeof (hashme), (char *) xnu_uuid);
|
GRUB_MD_MD5->init (&ctx);
|
||||||
grub_sprintf (uuid_string,
|
GRUB_MD_MD5->write (&ctx, hash_prefix, sizeof (hash_prefix));
|
||||||
|
GRUB_MD_MD5->write (&ctx, &serial, sizeof (serial));
|
||||||
|
GRUB_MD_MD5->final (&ctx);
|
||||||
|
xnu_uuid = GRUB_MD_MD5->read (&ctx);
|
||||||
|
|
||||||
|
grub_snprintf (uuid_string, sizeof (uuid_string),
|
||||||
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||||
(unsigned int) xnu_uuid[0], (unsigned int) xnu_uuid[1],
|
(unsigned int) xnu_uuid[0], (unsigned int) xnu_uuid[1],
|
||||||
(unsigned int) xnu_uuid[2], (unsigned int) xnu_uuid[3],
|
(unsigned int) xnu_uuid[2], (unsigned int) xnu_uuid[3],
|
||||||
|
@ -377,9 +89,9 @@ static grub_command_t cmd;
|
||||||
GRUB_MOD_INIT (xnu_uuid)
|
GRUB_MOD_INIT (xnu_uuid)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("xnu_uuid", grub_cmd_xnu_uuid,
|
cmd = grub_register_command ("xnu_uuid", grub_cmd_xnu_uuid,
|
||||||
"xnu_uuid GRUBUUID [VARNAME]",
|
N_("GRUBUUID [VARNAME]"),
|
||||||
"Transform 64-bit UUID to format "
|
N_("Transform 64-bit UUID to format "
|
||||||
"suitable for xnu.");
|
"suitable for XNU."));
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI (xnu_uuid)
|
GRUB_MOD_FINI (xnu_uuid)
|
||||||
|
|
157
conf/any-emu.rmk
157
conf/any-emu.rmk
|
@ -1,89 +1,112 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include)
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
sbin_UTILITIES += grub-emu
|
kernel_img_RELOCATABLE = yes
|
||||||
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
|
pkglib_PROGRAMS = kernel.img
|
||||||
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
||||||
commands/configfile.c commands/echo.c commands/help.c \
|
kern/err.c kern/list.c kern/handler.c kern/command.c \
|
||||||
commands/handler.c commands/ls.c commands/test.c \
|
kern/corecmd.c kern/file.c kern/fs.c kern/main.c kern/misc.c \
|
||||||
commands/search.c commands/blocklist.c commands/hexdump.c \
|
kern/parser.c kern/partition.c kern/term.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 \
|
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 \
|
util/console.c util/grub-emu.c util/misc.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
util/hostdisk.c util/getroot.c util/mm.c util/time.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 \
|
gnulib/progname.c util/hostfs.c disk/host.c
|
||||||
util/hostdisk.c util/getroot.c \
|
kernel_img_HEADERS += datetime.h
|
||||||
\
|
kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-undef -I$(srcdir)/gnulib
|
||||||
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
TARGET_NO_STRIP = yes
|
||||||
commands/parttool.c parttool/msdospart.c \
|
|
||||||
grub_emu_init.c gnulib/progname.c
|
ifneq ($(TARGET_NO_MODULES), yes)
|
||||||
|
kernel_img_SOURCES += symlist.c kern/$(target_cpu)/dl.c
|
||||||
|
ifneq ($(target_cpu), i386)
|
||||||
|
ifneq ($(target_cpu), x86_64)
|
||||||
|
kernel_img_SOURCES += kern/$(target_cpu)/cache.S
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
kernel_img_SOURCES += grub_emu_init.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
# For halt.mod.
|
||||||
|
pkglib_MODULES += halt.mod
|
||||||
|
halt_mod_SOURCES = commands/halt.c
|
||||||
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
ifeq ($(target_cpu), i386)
|
ifeq ($(target_cpu), i386)
|
||||||
grub_emu_SOURCES += commands/i386/cpuid.c
|
pkglib_MODULES += cpuid.mod
|
||||||
|
cpuid_mod_SOURCES = commands/i386/cpuid.c
|
||||||
|
cpuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
grub_emu_LDFLAGS = $(LIBCURSES)
|
grub_emu_LDFLAGS = $(LIBCURSES)
|
||||||
|
|
||||||
ifeq ($(enable_grub_emu_usb), yes)
|
ifeq ($(enable_grub_emu_usb), yes)
|
||||||
grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \
|
kernel_img_HEADERS += libusb.h
|
||||||
commands/usbtest.c
|
|
||||||
grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
|
pkglib_MODULES += libusb.mod
|
||||||
|
libusb_mod_SOURCES = util/usb.c
|
||||||
|
libusb_mod_CFLAGS =
|
||||||
|
libusb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For usb.mod
|
||||||
|
pkglib_MODULES += usb.mod
|
||||||
|
usb_mod_SOURCES = bus/usb/usb.c
|
||||||
|
usb_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
usb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For usbtest.mod
|
||||||
|
pkglib_MODULES += usbtest.mod
|
||||||
|
usbtest_mod_SOURCES = commands/usbtest.c
|
||||||
|
usbtest_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
usbtest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For usbms.mod
|
||||||
|
pkglib_MODULES += usbms.mod
|
||||||
|
usbms_mod_SOURCES = disk/usbms.c
|
||||||
|
usbms_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
usbms_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
grub_emu_LDFLAGS += $(LIBUSB)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES))
|
ifeq ($(enable_grub_emu_sdl), yes)
|
||||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
pkglib_MODULES += sdl.mod
|
||||||
DISTCLEANFILES += grub_emu_init.lst
|
sdl_mod_SOURCES = util/sdl.c
|
||||||
|
sdl_mod_CFLAGS =
|
||||||
|
sdl_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
grub_emu_LDFLAGS += $(LIBSDL)
|
||||||
|
kernel_img_HEADERS += sdl.h
|
||||||
|
endif
|
||||||
|
|
||||||
grub_emu_init.h: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh
|
ifeq ($(enable_grub_emu_pci), yes)
|
||||||
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
|
pkglib_MODULES += pci.mod
|
||||||
|
pci_mod_SOURCES = util/pci.c commands/lspci.c
|
||||||
|
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
grub_emu_LDFLAGS += $(LIBPCIACCESS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
||||||
|
grub_emu_init.h: genemuinitheader.sh $(pkglib_MODULES)
|
||||||
|
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@
|
||||||
DISTCLEANFILES += grub_emu_init.h
|
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
|
grub_emu_init.c: genemuinit.sh $(pkglib_MODULES) grub_emu_init.h
|
||||||
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
|
rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinit.sh $(NM) > $@
|
||||||
DISTCLEANFILES += grub_emu_init.c
|
DISTCLEANFILES += grub_emu_init.c
|
||||||
|
|
||||||
|
CLEANFILES += grub-emu
|
||||||
|
ifneq ($(TARGET_NO_MODULES), yes)
|
||||||
|
grub-emu: $(pkglib_PROGRAMS)
|
||||||
# FIXME: this could be shared with common.rmk
|
$(CC) -o $@ $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
|
||||||
|
else
|
||||||
# For grub-mkfont.
|
grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS)
|
||||||
ifeq ($(enable_grub_mkfont), yes)
|
$(CC) -o $@ $(pkglib_MODULES) $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
|
||||||
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
|
endif
|
||||||
|
GRUB_EMU=grub-emu
|
||||||
|
|
||||||
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
|
|
||||||
|
|
317
conf/common.rmk
317
conf/common.rmk
|
@ -1,9 +1,18 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
|
# Used by various components. These rules need to precede them.
|
||||||
|
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
||||||
|
|
||||||
sbin_UTILITIES += grub-mkdevicemap
|
sbin_UTILITIES += grub-mkdevicemap
|
||||||
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
||||||
util/deviceiter.c \
|
util/deviceiter.c \
|
||||||
util/devicemap.c util/misc.c
|
util/misc.c
|
||||||
|
|
||||||
|
ifeq ($(target_cpu)-$(platform), sparc64-ieee1275)
|
||||||
|
grub_mkdevicemap_SOURCES += util/ieee1275/ofpath.c util/ieee1275/devicemap.c
|
||||||
|
else
|
||||||
|
grub_mkdevicemap_SOURCES += util/devicemap.c
|
||||||
|
endif
|
||||||
|
|
||||||
# For grub-mkelfimage.
|
# For grub-mkelfimage.
|
||||||
bin_UTILITIES += grub-mkelfimage
|
bin_UTILITIES += grub-mkelfimage
|
||||||
|
@ -16,9 +25,9 @@ util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||||
sbin_UTILITIES += grub-probe
|
sbin_UTILITIES += grub-probe
|
||||||
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
|
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
|
||||||
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
||||||
util/hostdisk.c util/misc.c util/getroot.c \
|
util/hostdisk.c util/misc.c util/getroot.c util/mm.c \
|
||||||
kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
||||||
kern/parser.c kern/partition.c kern/file.c \
|
kern/parser.c kern/partition.c kern/file.c kern/list.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.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/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
|
@ -26,7 +35,8 @@ grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
fs/befs.c fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
partmap/msdos.c partmap/apple.c partmap/sun.c partmap/gpt.c\
|
partmap/msdos.c partmap/bsdlabel.c partmap/apple.c \
|
||||||
|
partmap/sun.c partmap/sunpc.c partmap/gpt.c \
|
||||||
kern/fs.c kern/env.c fs/fshelp.c \
|
kern/fs.c kern/env.c fs/fshelp.c \
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c grub_probe_init.c
|
disk/raid.c disk/mdraid_linux.c disk/lvm.c grub_probe_init.c
|
||||||
|
|
||||||
|
@ -46,12 +56,12 @@ grub_mkisofs_SOURCES = util/mkisofs/eltorito.c \
|
||||||
gnulib/error.c gnulib/progname.c
|
gnulib/error.c gnulib/progname.c
|
||||||
grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
|
grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
|
||||||
-I$(srcdir)/util/mkisofs/include \
|
-I$(srcdir)/util/mkisofs/include \
|
||||||
-Wno-all -Werror
|
-Wno-all -Werror $(GNULIB_UTIL_CFLAGS)
|
||||||
|
|
||||||
# For grub-fstest.
|
# For grub-fstest.
|
||||||
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
|
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
|
||||||
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
|
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
|
||||||
util/misc.c \
|
util/misc.c util/mm.c \
|
||||||
kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
||||||
disk/host.c disk/loopback.c kern/list.c kern/command.c \
|
disk/host.c disk/loopback.c kern/list.c kern/command.c \
|
||||||
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
|
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
|
||||||
|
@ -63,8 +73,8 @@ grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \
|
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \
|
||||||
fs/befs_be.c fs/tar.c \
|
fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
kern/partition.c partmap/msdos.c partmap/apple.c partmap/sun.c \
|
kern/partition.c partmap/msdos.c partmap/bsdlabel.c \
|
||||||
partmap/gpt.c \
|
partmap/apple.c partmap/sun.c partmap/sunpc.c partmap/gpt.c \
|
||||||
kern/fs.c kern/env.c fs/fshelp.c disk/raid.c \
|
kern/fs.c kern/env.c fs/fshelp.c disk/raid.c \
|
||||||
disk/raid5_recover.c disk/raid6_recover.c \
|
disk/raid5_recover.c disk/raid6_recover.c \
|
||||||
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
||||||
|
@ -82,11 +92,60 @@ endif
|
||||||
bin_UTILITIES += grub-mkrelpath
|
bin_UTILITIES += grub-mkrelpath
|
||||||
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
|
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
|
||||||
|
|
||||||
|
bin_UTILITIES += grub-bin2h
|
||||||
|
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
||||||
|
|
||||||
|
# For the lexer.
|
||||||
|
grub_script.yy.c grub_script.yy.h: script/yylex.l
|
||||||
|
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(srcdir)/script/yylex.l
|
||||||
|
DISTCLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||||
|
|
||||||
|
# For grub-script-check.
|
||||||
|
bin_UTILITIES += grub-script-check
|
||||||
|
util/grub-script-check.c_DEPENDENCIES = grub_script_check_init.h
|
||||||
|
grub_script_check_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c \
|
||||||
|
util/grub-script-check.c util/misc.c util/mm.c \
|
||||||
|
script/main.c script/script.c script/function.c script/lexer.c \
|
||||||
|
kern/handler.c kern/err.c kern/parser.c kern/list.c \
|
||||||
|
kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c \
|
||||||
|
grub_script.yy.c
|
||||||
|
grub_script_check_CFLAGS = $(GNULIB_UTIL_CFLAGS)
|
||||||
|
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||||
|
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 i18n.h env_private.h libgcc.h
|
||||||
|
|
||||||
|
ifneq ($(platform), emu)
|
||||||
|
kernel_img_HEADERS += machine/memory.h machine/loader.h machine/kernel.h
|
||||||
|
endif
|
||||||
|
|
||||||
|
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_img_HEADERS)) config.h genkernsyms.sh
|
||||||
|
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
||||||
|
|
||||||
# For the parser.
|
# For the parser.
|
||||||
grub_script.tab.c grub_script.tab.h: script/parser.y
|
grub_script.tab.c grub_script.tab.h: script/parser.y
|
||||||
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/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
|
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
|
||||||
|
|
||||||
|
# For grub-script-check.
|
||||||
|
grub_script_check_init.lst: geninit.sh $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES))
|
||||||
|
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
||||||
|
DISTCLEANFILES += grub_script_check_init.lst
|
||||||
|
|
||||||
|
grub_script_check_init.h: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninitheader.sh
|
||||||
|
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
|
||||||
|
DISTCLEANFILES += grub_script_check_init.h
|
||||||
|
|
||||||
|
grub_script_check_init.c: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninit.sh
|
||||||
|
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
|
||||||
|
DISTCLEANFILES += grub_script_check_init.c
|
||||||
|
|
||||||
# For grub-probe.
|
# For grub-probe.
|
||||||
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
|
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
|
||||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
||||||
|
@ -128,7 +187,7 @@ DISTCLEANFILES += grub_fstest_init.c
|
||||||
|
|
||||||
# for grub-editenv
|
# for grub-editenv
|
||||||
bin_UTILITIES += grub-editenv
|
bin_UTILITIES += grub-editenv
|
||||||
grub_editenv_SOURCES = gnulib/progname.c 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 util/mm.c kern/misc.c kern/err.c
|
||||||
CLEANFILES += grub-editenv
|
CLEANFILES += grub-editenv
|
||||||
|
|
||||||
# Needed for genmk.rb to work
|
# Needed for genmk.rb to work
|
||||||
|
@ -179,6 +238,20 @@ CLEANFILES += $(grub-mkconfig_SCRIPTS)
|
||||||
|
|
||||||
grub-mkconfig_DATA += util/grub.d/README
|
grub-mkconfig_DATA += util/grub.d/README
|
||||||
|
|
||||||
|
# For grub-set-default.
|
||||||
|
grub-set-default: util/grub-set-default.in config.status
|
||||||
|
./config.status --file=$@:$<
|
||||||
|
chmod +x $@
|
||||||
|
sbin_SCRIPTS += grub-set-default
|
||||||
|
CLEANFILES += grub-set-default
|
||||||
|
|
||||||
|
# For grub-reboot.
|
||||||
|
grub-reboot: util/grub-reboot.in config.status
|
||||||
|
./config.status --file=$@:$<
|
||||||
|
chmod +x $@
|
||||||
|
sbin_SCRIPTS += grub-reboot
|
||||||
|
CLEANFILES += grub-reboot
|
||||||
|
|
||||||
# Filing systems.
|
# Filing systems.
|
||||||
pkglib_MODULES += fshelp.mod fat.mod ufs1.mod ufs2.mod ext2.mod ntfs.mod \
|
pkglib_MODULES += fshelp.mod fat.mod ufs1.mod ufs2.mod ext2.mod ntfs.mod \
|
||||||
ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod \
|
ntfscomp.mod minix.mod hfs.mod jfs.mod iso9660.mod xfs.mod \
|
||||||
|
@ -332,6 +405,16 @@ part_gpt_mod_SOURCES = partmap/gpt.c
|
||||||
part_gpt_mod_CFLAGS = $(COMMON_CFLAGS)
|
part_gpt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
part_gpt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
part_gpt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += part_bsd.mod
|
||||||
|
part_bsd_mod_SOURCES = partmap/bsdlabel.c
|
||||||
|
part_bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
part_bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += part_sunpc.mod
|
||||||
|
part_sunpc_mod_SOURCES = partmap/sunpc.c
|
||||||
|
part_sunpc_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
part_sunpc_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# Special disk structures and generic drivers
|
# Special disk structures and generic drivers
|
||||||
|
|
||||||
pkglib_MODULES += raid.mod raid5rec.mod raid6rec.mod mdraid.mod dm_nv.mod \
|
pkglib_MODULES += raid.mod raid5rec.mod raid6rec.mod mdraid.mod dm_nv.mod \
|
||||||
|
@ -375,7 +458,7 @@ scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
# Commands.
|
# Commands.
|
||||||
pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \
|
pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \
|
||||||
ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod \
|
ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod \
|
||||||
fs_file.mod fs_uuid.mod configfile.mod echo.mod \
|
configfile.mod echo.mod \
|
||||||
terminfo.mod test.mod blocklist.mod hexdump.mod \
|
terminfo.mod test.mod blocklist.mod hexdump.mod \
|
||||||
read.mod sleep.mod loadenv.mod crc.mod parttool.mod \
|
read.mod sleep.mod loadenv.mod crc.mod parttool.mod \
|
||||||
msdospart.mod memrw.mod normal.mod sh.mod \
|
msdospart.mod memrw.mod normal.mod sh.mod \
|
||||||
|
@ -407,6 +490,28 @@ hello_mod_SOURCES = hello/hello.c
|
||||||
hello_mod_CFLAGS = $(COMMON_CFLAGS)
|
hello_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
hello_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
hello_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For gfxmenu.mod.
|
||||||
|
pkglib_MODULES += gfxmenu.mod
|
||||||
|
gfxmenu_mod_SOURCES = \
|
||||||
|
gfxmenu/gfxmenu.c \
|
||||||
|
gfxmenu/model.c \
|
||||||
|
gfxmenu/view.c \
|
||||||
|
gfxmenu/icon_manager.c \
|
||||||
|
gfxmenu/theme_loader.c \
|
||||||
|
gfxmenu/widget-box.c \
|
||||||
|
gfxmenu/gui_canvas.c \
|
||||||
|
gfxmenu/gui_circular_progress.c \
|
||||||
|
gfxmenu/gui_box.c \
|
||||||
|
gfxmenu/gui_label.c \
|
||||||
|
gfxmenu/gui_list.c \
|
||||||
|
gfxmenu/gui_image.c \
|
||||||
|
gfxmenu/gui_progress_bar.c \
|
||||||
|
gfxmenu/gui_util.c \
|
||||||
|
gfxmenu/gui_string_util.c \
|
||||||
|
gfxmenu/named_colors.c
|
||||||
|
gfxmenu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
gfxmenu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For parttool.mod.
|
# For parttool.mod.
|
||||||
parttool_mod_SOURCES = commands/parttool.c
|
parttool_mod_SOURCES = commands/parttool.c
|
||||||
parttool_mod_CFLAGS = $(COMMON_CFLAGS)
|
parttool_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -448,10 +553,27 @@ help_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
help_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
help_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For search.mod.
|
# For search.mod.
|
||||||
search_mod_SOURCES = commands/search.c
|
search_mod_SOURCES = commands/search_wrap.c
|
||||||
search_mod_CFLAGS = $(COMMON_CFLAGS)
|
search_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
search_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
search_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += search_fs_file.mod search_fs_uuid.mod search_label.mod
|
||||||
|
|
||||||
|
# For search.mod.
|
||||||
|
search_fs_file_mod_SOURCES = commands/search_file.c
|
||||||
|
search_fs_file_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
search_fs_file_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For search.mod.
|
||||||
|
search_label_mod_SOURCES = commands/search_label.c
|
||||||
|
search_label_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
search_label_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For search.mod.
|
||||||
|
search_fs_uuid_mod_SOURCES = commands/search_uuid.c
|
||||||
|
search_fs_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
search_fs_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For test.mod.
|
# For test.mod.
|
||||||
test_mod_SOURCES = commands/test.c
|
test_mod_SOURCES = commands/test.c
|
||||||
test_mod_CFLAGS = $(COMMON_CFLAGS)
|
test_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -462,16 +584,6 @@ loopback_mod_SOURCES = disk/loopback.c
|
||||||
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
|
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
loopback_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
loopback_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For fs_file.mod
|
|
||||||
fs_file_mod_SOURCES = disk/fs_file.c
|
|
||||||
fs_file_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
fs_file_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For fs_uuid.mod
|
|
||||||
fs_uuid_mod_SOURCES = disk/fs_uuid.c
|
|
||||||
fs_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
fs_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For configfile.mod
|
# For configfile.mod
|
||||||
configfile_mod_SOURCES = commands/configfile.c
|
configfile_mod_SOURCES = commands/configfile.c
|
||||||
configfile_mod_CFLAGS = $(COMMON_CFLAGS)
|
configfile_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -536,68 +648,89 @@ keystatus_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
|
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
|
||||||
normal/auth.c normal/autofs.c normal/handler.c \
|
normal/auth.c normal/autofs.c normal/handler.c \
|
||||||
normal/color.c normal/completion.c normal/datetime.c normal/menu.c \
|
normal/color.c normal/completion.c normal/datetime.c normal/menu.c \
|
||||||
normal/menu_entry.c normal/menu_text.c normal/menu_viewer.c \
|
normal/menu_entry.c normal/menu_text.c \
|
||||||
normal/misc.c
|
normal/misc.c normal/crypto.c normal/term.c normal/context.c
|
||||||
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For sh.mod.
|
# For sh.mod.
|
||||||
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
|
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
|
||||||
script/function.c script/lexer.c grub_script.tab.c
|
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
|
||||||
sh_mod_CFLAGS = $(COMMON_CFLAGS)
|
sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
|
||||||
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
ifneq (, $(FONT_SOURCE))
|
||||||
|
font/font.c_DEPENDENCIES = ascii.h
|
||||||
|
endif
|
||||||
|
|
||||||
# Common Video Subsystem specific modules.
|
# Common Video Subsystem specific modules.
|
||||||
pkglib_MODULES += video.mod videotest.mod bitmap.mod tga.mod jpeg.mod \
|
# On Yeeloong it's part of kernel
|
||||||
png.mod font.mod gfxterm.mod video_fb.mod
|
ifneq ($(platform), yeeloong)
|
||||||
|
|
||||||
# For video.mod.
|
# For video.mod.
|
||||||
|
pkglib_MODULES += video.mod
|
||||||
video_mod_SOURCES = video/video.c
|
video_mod_SOURCES = video/video.c
|
||||||
video_mod_CFLAGS = $(COMMON_CFLAGS)
|
video_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
video_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
video_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += video_fb.mod
|
||||||
video_fb_mod_SOURCES = video/fb/video_fb.c video/fb/fbblit.c \
|
video_fb_mod_SOURCES = video/fb/video_fb.c video/fb/fbblit.c \
|
||||||
video/fb/fbfill.c video/fb/fbutil.c
|
video/fb/fbfill.c video/fb/fbutil.c
|
||||||
video_fb_mod_CFLAGS = $(COMMON_CFLAGS)
|
video_fb_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
video_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
video_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For videotest.mod.
|
|
||||||
videotest_mod_SOURCES = commands/videotest.c
|
|
||||||
videotest_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
videotest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For bitmap.mod
|
# For bitmap.mod
|
||||||
|
pkglib_MODULES += bitmap.mod
|
||||||
bitmap_mod_SOURCES = video/bitmap.c
|
bitmap_mod_SOURCES = video/bitmap.c
|
||||||
bitmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
bitmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
bitmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
bitmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For tga.mod
|
# For bitmap_scale.mod
|
||||||
tga_mod_SOURCES = video/readers/tga.c
|
pkglib_MODULES += bitmap_scale.mod
|
||||||
tga_mod_CFLAGS = $(COMMON_CFLAGS)
|
bitmap_scale_mod_SOURCES = video/bitmap_scale.c
|
||||||
tga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
bitmap_scale_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
bitmap_scale_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For jpeg.mod.
|
pkglib_MODULES += font.mod
|
||||||
jpeg_mod_SOURCES = video/readers/jpeg.c
|
|
||||||
jpeg_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
jpeg_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For png.mod.
|
|
||||||
png_mod_SOURCES = video/readers/png.c
|
|
||||||
png_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
png_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For font.mod.
|
|
||||||
font_mod_SOURCES = font/font_cmd.c font/font.c
|
font_mod_SOURCES = font/font_cmd.c font/font.c
|
||||||
font_mod_CFLAGS = $(COMMON_CFLAGS)
|
font_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
font_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
font_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For gfxterm.mod.
|
# For gfxterm.mod.
|
||||||
|
pkglib_MODULES += gfxterm.mod
|
||||||
gfxterm_mod_SOURCES = term/gfxterm.c
|
gfxterm_mod_SOURCES = term/gfxterm.c
|
||||||
gfxterm_mod_CFLAGS = $(COMMON_CFLAGS)
|
gfxterm_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
gfxterm_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
gfxterm_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
# For videotest.mod.
|
||||||
|
pkglib_MODULES += videotest.mod
|
||||||
|
videotest_mod_SOURCES = commands/videotest.c
|
||||||
|
videotest_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
videotest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For tga.mod
|
||||||
|
pkglib_MODULES += tga.mod
|
||||||
|
tga_mod_SOURCES = video/readers/tga.c
|
||||||
|
tga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
tga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For jpeg.mod.
|
||||||
|
pkglib_MODULES += jpeg.mod
|
||||||
|
jpeg_mod_SOURCES = video/readers/jpeg.c
|
||||||
|
jpeg_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
jpeg_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For png.mod.
|
||||||
|
pkglib_MODULES += png.mod
|
||||||
|
png_mod_SOURCES = video/readers/png.c
|
||||||
|
png_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
png_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
|
||||||
# Misc.
|
# Misc.
|
||||||
pkglib_MODULES += gzio.mod bufio.mod elf.mod
|
pkglib_MODULES += gzio.mod elf.mod
|
||||||
|
|
||||||
# For elf.mod.
|
# For elf.mod.
|
||||||
elf_mod_SOURCES = kern/elf.c
|
elf_mod_SOURCES = kern/elf.c
|
||||||
|
@ -609,10 +742,14 @@ gzio_mod_SOURCES = io/gzio.c
|
||||||
gzio_mod_CFLAGS = $(COMMON_CFLAGS)
|
gzio_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
gzio_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
gzio_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# On Yeeloong it's part of kernel
|
||||||
|
ifneq ($(platform), yeeloong)
|
||||||
# For bufio.mod.
|
# For bufio.mod.
|
||||||
|
pkglib_MODULES += bufio.mod
|
||||||
bufio_mod_SOURCES = io/bufio.c
|
bufio_mod_SOURCES = io/bufio.c
|
||||||
bufio_mod_CFLAGS = $(COMMON_CFLAGS)
|
bufio_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
bufio_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
bufio_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
endif
|
||||||
|
|
||||||
# For gettext.mod.
|
# For gettext.mod.
|
||||||
pkglib_MODULES += gettext.mod
|
pkglib_MODULES += gettext.mod
|
||||||
|
@ -628,13 +765,97 @@ xnu_uuid_mod_SOURCES = commands/xnu_uuid.c
|
||||||
xnu_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
xnu_uuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
xnu_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
xnu_uuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += trig.mod
|
||||||
|
trig_mod_SOURCES = trigtables.c
|
||||||
|
trig_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
trig_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
trigtables.c: gentrigtables
|
||||||
|
./gentrigtables > $@
|
||||||
|
DISTCLEANFILES += trigtables.c
|
||||||
|
gentrigtables: gentrigtables.c
|
||||||
|
$(CC) -o $@ $^ $(CPPFLAGS) -lm
|
||||||
|
DISTCLEANFILES += gentrigtables
|
||||||
|
|
||||||
pkglib_MODULES += setjmp.mod
|
pkglib_MODULES += setjmp.mod
|
||||||
setjmp_mod_SOURCES = lib/$(target_cpu)/setjmp.S
|
setjmp_mod_SOURCES = lib/$(target_cpu)/setjmp.S
|
||||||
setjmp_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
setjmp_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
setjmp_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
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)
|
||||||
|
|
||||||
|
pkglib_MODULES += regexp.mod
|
||||||
|
regexp_mod_SOURCES = gnulib/regex.c commands/regexp.c
|
||||||
|
regexp_mod_CFLAGS = $(COMMON_CFLAGS) $(GNULIB_CFLAGS)
|
||||||
|
regexp_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += terminal.mod
|
||||||
|
terminal_mod_SOURCES = commands/terminal.c
|
||||||
|
terminal_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
terminal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += crypto.mod
|
||||||
|
crypto_mod_SOURCES = lib/crypto.c
|
||||||
|
crypto_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
crypto_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += hashsum.mod
|
||||||
|
hashsum_mod_SOURCES = commands/hashsum.c
|
||||||
|
hashsum_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
hashsum_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += pbkdf2.mod
|
||||||
|
pbkdf2_mod_SOURCES = lib/pbkdf2.c
|
||||||
|
pbkdf2_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
pbkdf2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For password_pbkdf2.mod.
|
||||||
|
pkglib_MODULES += password_pbkdf2.mod
|
||||||
|
password_pbkdf2_mod_SOURCES = commands/password_pbkdf2.c
|
||||||
|
password_pbkdf2_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
password_pbkdf2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For memdisk.mod.
|
# For memdisk.mod.
|
||||||
pkglib_MODULES += memdisk.mod
|
pkglib_MODULES += memdisk.mod
|
||||||
memdisk_mod_SOURCES = disk/memdisk.c
|
memdisk_mod_SOURCES = disk/memdisk.c
|
||||||
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For reboot.mod.
|
||||||
|
pkglib_MODULES += reboot.mod
|
||||||
|
reboot_mod_SOURCES = commands/reboot.c
|
||||||
|
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For date.mod
|
||||||
|
pkglib_MODULES += date.mod
|
||||||
|
date_mod_SOURCES = commands/date.c
|
||||||
|
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For datehook.mod
|
||||||
|
pkglib_MODULES += datehook.mod
|
||||||
|
datehook_mod_SOURCES = hook/datehook.c
|
||||||
|
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For lsmmap.mod
|
||||||
|
pkglib_MODULES += lsmmap.mod
|
||||||
|
lsmmap_mod_SOURCES = commands/lsmmap.c
|
||||||
|
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For boot.mod.
|
||||||
|
pkglib_MODULES += boot.mod
|
||||||
|
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
||||||
|
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
bin_UTILITIES += grub-mkpasswd-pbkdf2
|
||||||
|
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c util/mm.c kern/err.c
|
||||||
|
grub_mkpasswd_pbkdf2_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap -DGRUB_MKPASSWD=1
|
||||||
|
|
||||||
|
include $(srcdir)/conf/gcry.mk
|
||||||
|
|
|
@ -1,26 +1,20 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
|
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
|
|
||||||
COMMON_LDFLAGS = -m32 -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
|
|
||||||
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
||||||
|
|
||||||
ifeq ($(platform), coreboot)
|
|
||||||
|
|
||||||
pkglib_PROGRAMS += kernel.img
|
pkglib_PROGRAMS += kernel.img
|
||||||
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
kern/i386/misc.S \
|
kern/i386/misc.S \
|
||||||
kern/i386/coreboot/init.c \
|
kern/i386/coreboot/init.c \
|
||||||
kern/i386/multiboot_mmap.c \
|
kern/i386/multiboot_mmap.c \
|
||||||
|
kern/i386/halt.c \
|
||||||
kern/main.c kern/device.c \
|
kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||||
|
@ -30,68 +24,9 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
kern/env.c \
|
kern/env.c \
|
||||||
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
||||||
symlist.c
|
symlist.c
|
||||||
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 i18n.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
|
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(platform), qemu)
|
|
||||||
|
|
||||||
GRUB_BOOT_MACHINE_LINK_ADDR = 0xffe00
|
|
||||||
|
|
||||||
pkglib_IMAGES += boot.img
|
|
||||||
boot_img_SOURCES = boot/i386/qemu/boot.S
|
|
||||||
boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
|
||||||
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
|
||||||
boot_img_FORMAT = binary
|
|
||||||
|
|
||||||
bin_UTILITIES += grub-mkimage
|
|
||||||
grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
|
|
||||||
util/resolve.c gnulib/progname.c
|
|
||||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
||||||
|
|
||||||
pkglib_IMAGES += kernel.img
|
|
||||||
kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
|
||||||
kern/i386/misc.S \
|
|
||||||
kern/i386/coreboot/init.c \
|
|
||||||
kern/i386/qemu/mmap.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 \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
|
||||||
kern/generic/rtc_get_time_ms.c \
|
|
||||||
kern/generic/millisleep.c \
|
|
||||||
kern/env.c \
|
|
||||||
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
|
||||||
symlist.c
|
|
||||||
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 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)
|
|
||||||
kernel_img_FORMAT = binary
|
|
||||||
endif
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
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_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
sbin_SCRIPTS += grub-install
|
sbin_SCRIPTS += grub-install
|
||||||
grub_install_SOURCES = util/grub-install.in
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
@ -100,17 +35,7 @@ bin_SCRIPTS += grub-mkrescue
|
||||||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
pkglib_MODULES = linux.mod multiboot.mod \
|
pkglib_MODULES = linux.mod aout.mod halt.mod datetime.mod mmap.mod
|
||||||
aout.mod play.mod serial.mod \
|
|
||||||
pci.mod lspci.mod reboot.mod \
|
|
||||||
halt.mod datetime.mod date.mod datehook.mod \
|
|
||||||
lsmmap.mod mmap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mmap.mod.
|
# For mmap.mod.
|
||||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
||||||
|
@ -123,31 +48,11 @@ linux_mod_SOURCES = loader/i386/linux.c
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c kern/i386/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
# For halt.mod.
|
||||||
halt_mod_SOURCES = commands/halt.c kern/i386/halt.c
|
halt_mod_SOURCES = commands/halt.c
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For serial.mod.
|
|
||||||
serial_mod_SOURCES = term/i386/pc/serial.c
|
|
||||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For multiboot.mod.
|
|
||||||
multiboot_mod_SOURCES = loader/i386/multiboot.c \
|
|
||||||
loader/i386/multiboot_helper.S \
|
|
||||||
loader/i386/pc/multiboot2.c \
|
|
||||||
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.
|
# For aout.mod.
|
||||||
aout_mod_SOURCES = loader/aout.c
|
aout_mod_SOURCES = loader/aout.c
|
||||||
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -160,40 +65,10 @@ bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
# For play.mod.
|
|
||||||
play_mod_SOURCES = commands/i386/pc/play.c
|
|
||||||
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
# For datetime.mod
|
||||||
datetime_mod_SOURCES = lib/i386/datetime.c
|
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
include $(srcdir)/conf/i386.mk
|
||||||
include $(srcdir)/conf/common.mk
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
|
@ -1,167 +1,5 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
|
COMMON_LDFLAGS = -melf_i386
|
||||||
COMMON_CFLAGS = -fno-builtin -m32
|
|
||||||
COMMON_LDFLAGS = -melf_i386 -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
include $(srcdir)/conf/x86-efi.mk
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Utilities.
|
|
||||||
bin_UTILITIES = grub-mkimage
|
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
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
|
|
||||||
|
|
||||||
bin_SCRIPTS += grub-mkrescue
|
|
||||||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
|
||||||
|
|
||||||
# For grub-setup.
|
|
||||||
#grub_setup_SOURCES = 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 fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
|
||||||
# fs/sfs.c kern/parser.c kern/partition.c partmap/msdos.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
|
|
||||||
|
|
||||||
# Scripts.
|
|
||||||
sbin_SCRIPTS = grub-install
|
|
||||||
|
|
||||||
# For grub-install.
|
|
||||||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
|
||||||
|
|
||||||
# Modules.
|
|
||||||
pkglib_MODULES = kernel.mod 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 \
|
|
||||||
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 \
|
|
||||||
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
|
||||||
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
|
||||||
term/efi/console.c disk/efi/efidisk.c \
|
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.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 \
|
|
||||||
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 i18n.h
|
|
||||||
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_mod_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
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For acpi.mod.
|
|
||||||
acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
|
|
||||||
acpi_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
acpi_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
|
|
||||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For chain.mod.
|
|
||||||
chain_mod_SOURCES = loader/efi/chainloader.c
|
|
||||||
chain_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For appleldr.mod.
|
|
||||||
appleldr_mod_SOURCES = loader/efi/appleloader.c
|
|
||||||
appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
|
||||||
linux_mod_SOURCES = loader/i386/efi/linux.c
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
|
||||||
halt_mod_SOURCES = commands/halt.c
|
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
|
||||||
datetime_mod_SOURCES = lib/efi/datetime.c
|
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For loadbios.mod
|
|
||||||
loadbios_mod_SOURCES = commands/efi/loadbios.c
|
|
||||||
loadbios_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
loadbios_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For fixvideo.mod
|
|
||||||
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_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
|
||||||
include $(srcdir)/conf/common.mk
|
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -m32 -nostdinc -fno-builtin
|
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
COMMON_CFLAGS = -ffreestanding -mrtd -mregparm=3
|
|
||||||
COMMON_LDFLAGS = -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
pkglib_PROGRAMS = kernel.img
|
pkglib_PROGRAMS = kernel.img
|
||||||
|
@ -19,7 +14,7 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
|
||||||
kern/ieee1275/cmain.c kern/ieee1275/openfw.c \
|
kern/ieee1275/cmain.c kern/ieee1275/openfw.c \
|
||||||
kern/main.c kern/device.c \
|
kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||||
kern/env.c \
|
kern/env.c \
|
||||||
|
@ -29,23 +24,10 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
|
||||||
term/ieee1275/ofconsole.c \
|
term/ieee1275/ofconsole.c \
|
||||||
disk/ieee1275/ofdisk.c \
|
disk/ieee1275/ofdisk.c \
|
||||||
symlist.c
|
symlist.c
|
||||||
kernel_img_HEADERS = cache.h device.h disk.h dl.h elf.h elfload.h \
|
kernel_img_HEADERS += ieee1275/ieee1275.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 i18n.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
|
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
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_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Scripts.
|
# Scripts.
|
||||||
sbin_SCRIPTS = grub-install
|
sbin_SCRIPTS = grub-install
|
||||||
|
@ -54,16 +36,10 @@ sbin_SCRIPTS = grub-install
|
||||||
grub_install_SOURCES = util/ieee1275/grub-install.in
|
grub_install_SOURCES = util/ieee1275/grub-install.in
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
pkglib_MODULES = halt.mod reboot.mod suspend.mod \
|
pkglib_MODULES = halt.mod suspend.mod \
|
||||||
aout.mod serial.mod linux.mod \
|
aout.mod linux.mod \
|
||||||
nand.mod pci.mod lspci.mod datetime.mod \
|
nand.mod datetime.mod \
|
||||||
date.mod datehook.mod lsmmap.mod mmap.mod
|
mmap.mod
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For mmap.mod.
|
# For mmap.mod.
|
||||||
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
||||||
|
@ -81,21 +57,11 @@ suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
||||||
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For reboot.mod
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod
|
# For halt.mod
|
||||||
halt_mod_SOURCES = commands/halt.c
|
halt_mod_SOURCES = commands/halt.c
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For serial.mod.
|
|
||||||
serial_mod_SOURCES = term/i386/pc/serial.c
|
|
||||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
# For linux.mod.
|
||||||
linux_mod_SOURCES = loader/i386/ieee1275/linux.c
|
linux_mod_SOURCES = loader/i386/ieee1275/linux.c
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -106,35 +72,10 @@ nand_mod_SOURCES = disk/ieee1275/nand.c
|
||||||
nand_mod_CFLAGS = $(COMMON_CFLAGS)
|
nand_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
nand_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
nand_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
# For datetime.mod
|
||||||
datetime_mod_SOURCES = lib/i386/datetime.c
|
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
include $(srcdir)/conf/i386.mk
|
||||||
include $(srcdir)/conf/common.mk
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
123
conf/i386-pc.rmk
123
conf/i386-pc.rmk
|
@ -2,12 +2,7 @@
|
||||||
|
|
||||||
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
|
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
|
|
||||||
COMMON_LDFLAGS = -m32 -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
|
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
|
||||||
|
@ -48,7 +43,7 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
|
||||||
kern/i386/misc.S \
|
kern/i386/misc.S \
|
||||||
kern/main.c kern/device.c \
|
kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||||
kern/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.c \
|
kern/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.c \
|
||||||
|
@ -59,35 +54,22 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
|
||||||
kern/env.c \
|
kern/env.c \
|
||||||
term/i386/pc/console.c term/i386/vga_common.c \
|
term/i386/pc/console.c term/i386/vga_common.c \
|
||||||
symlist.c
|
symlist.c
|
||||||
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
kernel_img_HEADERS += machine/biosdisk.h machine/vga.h machine/vbe.h \
|
||||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
machine/pxe.h i386/pit.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 i18n.h
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
|
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
|
||||||
kernel_img_FORMAT = binary
|
kernel_img_FORMAT = binary
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
||||||
DEFSYMFILES += kernel_syms.lst
|
|
||||||
|
|
||||||
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_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Utilities.
|
# Utilities.
|
||||||
bin_UTILITIES = grub-mkimage
|
bin_UTILITIES = grub-mkimage
|
||||||
sbin_UTILITIES = grub-setup
|
sbin_UTILITIES = grub-setup
|
||||||
|
|
||||||
# For grub-mkimage.
|
# For grub-mkimage.
|
||||||
grub_mkimage_SOURCES = gnulib/progname.c util/i386/pc/grub-mkimage.c util/misc.c \
|
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
|
||||||
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
||||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||||
util/i386/pc/grub-mkimage.c_DEPENDENCIES = Makefile
|
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
||||||
|
|
||||||
# For grub-setup.
|
# For grub-setup.
|
||||||
util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
||||||
|
@ -95,18 +77,20 @@ grub_setup_SOURCES = gnulib/progname.c \
|
||||||
util/i386/pc/grub-setup.c util/hostdisk.c \
|
util/i386/pc/grub-setup.c util/hostdisk.c \
|
||||||
util/misc.c util/getroot.c kern/device.c kern/disk.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/err.c kern/misc.c kern/parser.c kern/partition.c \
|
||||||
kern/file.c kern/fs.c kern/env.c fs/fshelp.c \
|
kern/file.c kern/fs.c kern/env.c kern/list.c \
|
||||||
|
fs/fshelp.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.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/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
fs/befs.c fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
partmap/msdos.c partmap/gpt.c \
|
partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \
|
||||||
|
partmap/gpt.c \
|
||||||
\
|
\
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||||
util/raid.c util/lvm.c \
|
util/raid.c util/lvm.c util/mm.c \
|
||||||
grub_setup_init.c
|
grub_setup_init.c
|
||||||
|
|
||||||
sbin_SCRIPTS += grub-install
|
sbin_SCRIPTS += grub-install
|
||||||
|
@ -115,24 +99,15 @@ grub_install_SOURCES = util/grub-install.in
|
||||||
bin_SCRIPTS += grub-mkrescue
|
bin_SCRIPTS += grub-mkrescue
|
||||||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||||
|
|
||||||
bin_SCRIPTS += grub-mkfloppy
|
|
||||||
grub_mkfloppy_SOURCES = util/i386/pc/grub-mkfloppy.in
|
|
||||||
|
|
||||||
pkglib_MODULES = biosdisk.mod chain.mod \
|
pkglib_MODULES = biosdisk.mod chain.mod \
|
||||||
multiboot.mod reboot.mod halt.mod \
|
halt.mod \
|
||||||
vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
|
vbe.mod vbetest.mod vbeinfo.mod \
|
||||||
vga.mod pci.mod lspci.mod \
|
vga.mod \
|
||||||
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
|
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod \
|
||||||
datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
|
ata_pthru.mod hdparm.mod \
|
||||||
usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
|
usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
|
||||||
efiemu.mod mmap.mod acpi.mod drivemap.mod
|
efiemu.mod mmap.mod acpi.mod drivemap.mod
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For drivemap.mod.
|
# For drivemap.mod.
|
||||||
drivemap_mod_SOURCES = commands/i386/pc/drivemap.c \
|
drivemap_mod_SOURCES = commands/i386/pc/drivemap.c \
|
||||||
commands/i386/pc/drivemap_int13h.S
|
commands/i386/pc/drivemap_int13h.S
|
||||||
|
@ -183,37 +158,17 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
pkglib_MODULES += xnu.mod
|
pkglib_MODULES += xnu.mod
|
||||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c\
|
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
|
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
||||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
# For halt.mod.
|
||||||
halt_mod_SOURCES = commands/i386/pc/halt.c
|
halt_mod_SOURCES = commands/i386/pc/halt.c
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For serial.mod.
|
|
||||||
serial_mod_SOURCES = term/i386/pc/serial.c
|
|
||||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For multiboot.mod.
|
|
||||||
multiboot_mod_SOURCES = loader/i386/multiboot.c \
|
|
||||||
loader/i386/multiboot_helper.S \
|
|
||||||
loader/i386/pc/multiboot2.c \
|
|
||||||
loader/multiboot2.c \
|
|
||||||
loader/multiboot_loader.c
|
|
||||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
# For vbe.mod.
|
# For vbe.mod.
|
||||||
vbe_mod_SOURCES = video/i386/pc/vbe.c
|
vbe_mod_SOURCES = video/i386/pc/vbe.c
|
||||||
vbe_mod_CFLAGS = $(COMMON_CFLAGS)
|
vbe_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -229,26 +184,11 @@ vbetest_mod_SOURCES = commands/i386/pc/vbetest.c
|
||||||
vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
|
vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For play.mod.
|
|
||||||
play_mod_SOURCES = commands/i386/pc/play.c
|
|
||||||
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For vga.mod.
|
# For vga.mod.
|
||||||
vga_mod_SOURCES = term/i386/pc/vga.c
|
vga_mod_SOURCES = term/i386/pc/vga.c
|
||||||
vga_mod_CFLAGS = $(COMMON_CFLAGS)
|
vga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
vga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
vga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For aout.mod
|
# For aout.mod
|
||||||
aout_mod_SOURCES = loader/aout.c
|
aout_mod_SOURCES = loader/aout.c
|
||||||
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -301,25 +241,10 @@ pxecmd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For datetime.mod
|
# For datetime.mod
|
||||||
datetime_mod_SOURCES = lib/i386/datetime.c
|
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For ata_pthru.mod.
|
# For ata_pthru.mod.
|
||||||
ata_pthru_mod_SOURCES = disk/ata_pthru.c
|
ata_pthru_mod_SOURCES = disk/ata_pthru.c
|
||||||
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
|
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
|
|
@ -1,2 +1,88 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
include $(srcdir)/conf/i386-coreboot.mk
|
|
||||||
|
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
|
|
||||||
|
# Images.
|
||||||
|
|
||||||
|
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
||||||
|
GRUB_BOOT_MACHINE_LINK_ADDR = 0xffe00
|
||||||
|
|
||||||
|
pkglib_IMAGES += boot.img
|
||||||
|
boot_img_SOURCES = boot/i386/qemu/boot.S
|
||||||
|
boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||||
|
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||||
|
boot_img_FORMAT = binary
|
||||||
|
|
||||||
|
bin_UTILITIES += grub-mkimage
|
||||||
|
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
|
||||||
|
util/resolve.c gnulib/progname.c
|
||||||
|
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||||
|
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
||||||
|
|
||||||
|
pkglib_IMAGES += kernel.img
|
||||||
|
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/term.c \
|
||||||
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
|
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||||
|
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||||
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
|
kern/generic/rtc_get_time_ms.c \
|
||||||
|
kern/generic/millisleep.c \
|
||||||
|
kern/env.c \
|
||||||
|
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
||||||
|
symlist.c
|
||||||
|
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)
|
||||||
|
kernel_img_FORMAT = binary
|
||||||
|
|
||||||
|
sbin_SCRIPTS += grub-install
|
||||||
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
|
||||||
|
bin_SCRIPTS += grub-mkrescue
|
||||||
|
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||||
|
|
||||||
|
# Modules.
|
||||||
|
pkglib_MODULES = linux.mod aout.mod halt.mod datetime.mod mmap.mod
|
||||||
|
|
||||||
|
# For mmap.mod.
|
||||||
|
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
||||||
|
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For linux.mod.
|
||||||
|
linux_mod_SOURCES = loader/i386/linux.c
|
||||||
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For halt.mod.
|
||||||
|
halt_mod_SOURCES = commands/halt.c
|
||||||
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For aout.mod.
|
||||||
|
aout_mod_SOURCES = loader/aout.c
|
||||||
|
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For bsd.mod
|
||||||
|
pkglib_MODULES += bsd.mod
|
||||||
|
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
|
||||||
|
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For datetime.mod
|
||||||
|
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
include $(srcdir)/conf/i386.mk
|
||||||
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
|
@ -6,7 +6,7 @@ cpuid_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
pkglib_MODULES += at_keyboard.mod
|
pkglib_MODULES += at_keyboard.mod
|
||||||
at_keyboard_mod_SOURCES = term/i386/pc/at_keyboard.c
|
at_keyboard_mod_SOURCES = term/at_keyboard.c
|
||||||
at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
|
at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
@ -15,7 +15,56 @@ vga_text_mod_SOURCES = term/i386/pc/vga_text.c term/i386/vga_common.c
|
||||||
vga_text_mod_CFLAGS = $(COMMON_CFLAGS)
|
vga_text_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
vga_text_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
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
|
pkglib_MODULES += ata.mod
|
||||||
ata_mod_SOURCES = disk/ata.c
|
ata_mod_SOURCES = disk/ata.c
|
||||||
ata_mod_CFLAGS = $(COMMON_CFLAGS)
|
ata_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For setpci.mod
|
||||||
|
pkglib_MODULES += setpci.mod
|
||||||
|
setpci_mod_SOURCES = commands/setpci.c
|
||||||
|
setpci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
setpci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += multiboot.mod
|
||||||
|
multiboot_mod_SOURCES = loader/multiboot.c loader/i386/multiboot_mbi.c
|
||||||
|
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += multiboot2.mod
|
||||||
|
multiboot2_mod_SOURCES = loader/multiboot.c loader/multiboot_mbi2.c
|
||||||
|
multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
|
||||||
|
multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For serial.mod.
|
||||||
|
pkglib_MODULES += serial.mod
|
||||||
|
serial_mod_SOURCES = term/serial.c
|
||||||
|
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For pci.mod
|
||||||
|
pkglib_MODULES += pci.mod
|
||||||
|
pci_mod_SOURCES = bus/pci.c
|
||||||
|
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For lspci.mod
|
||||||
|
pkglib_MODULES += lspci.mod
|
||||||
|
lspci_mod_SOURCES = commands/lspci.c
|
||||||
|
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For play.mod.
|
||||||
|
pkglib_MODULES += play.mod
|
||||||
|
play_mod_SOURCES = commands/i386/pc/play.c
|
||||||
|
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
|
22
conf/mips-qemu-mips.rmk
Normal file
22
conf/mips-qemu-mips.rmk
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# -*- makefile -*-
|
||||||
|
LINK_BASE = 0x80010000
|
||||||
|
target_machine=qemu-mips
|
||||||
|
COMMON_CFLAGS += -march=mips3
|
||||||
|
COMMON_ASFLAGS += -march=mips3
|
||||||
|
include $(srcdir)/conf/mips.mk
|
||||||
|
|
||||||
|
pkglib_IMAGES = kernel.img
|
||||||
|
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
||||||
|
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
||||||
|
kern/$(target_cpu)/$(target_machine)/init.c \
|
||||||
|
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||||
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
|
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||||
|
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
||||||
|
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
||||||
|
symlist.c kern/$(target_cpu)/cache.S
|
||||||
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
|
||||||
|
kernel_img_FORMAT = binary
|
73
conf/mips-yeeloong.rmk
Normal file
73
conf/mips-yeeloong.rmk
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
# -*- makefile -*-
|
||||||
|
LINK_BASE = 0x80200000
|
||||||
|
target_machine=yeeloong
|
||||||
|
COMMON_CFLAGS += -march=mips3
|
||||||
|
COMMON_ASFLAGS += -march=mips3
|
||||||
|
|
||||||
|
kernel_img_HEADERS += pci.h bitmap.h video.h gfxterm.h font.h bitmap_scale.h bufio.h
|
||||||
|
|
||||||
|
include $(srcdir)/conf/mips.mk
|
||||||
|
|
||||||
|
pkglib_IMAGES = kernel.img
|
||||||
|
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
||||||
|
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
||||||
|
kern/$(target_cpu)/$(target_machine)/init.c \
|
||||||
|
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||||
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
|
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||||
|
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
||||||
|
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
||||||
|
kern/$(target_cpu)/cache.S \
|
||||||
|
\
|
||||||
|
term/at_keyboard.c \
|
||||||
|
font/font_cmd.c font/font.c io/bufio.c \
|
||||||
|
video/video.c video/fb/video_fb.c video/fb/fbblit.c \
|
||||||
|
video/fb/fbfill.c video/fb/fbutil.c video/bitmap.c \
|
||||||
|
video/bitmap_scale.c video/sm712.c bus/pci.c bus/bonito.c \
|
||||||
|
term/gfxterm.c commands/extcmd.c lib/arg.c \
|
||||||
|
symlist.c
|
||||||
|
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DUSE_ASCII_FAILBACK
|
||||||
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
|
||||||
|
kernel_img_FORMAT = binary
|
||||||
|
|
||||||
|
# For ata.mod.
|
||||||
|
pkglib_MODULES += ata.mod
|
||||||
|
ata_mod_SOURCES = disk/ata.c
|
||||||
|
ata_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For lspci.mod
|
||||||
|
pkglib_MODULES += lspci.mod
|
||||||
|
lspci_mod_SOURCES = commands/lspci.c
|
||||||
|
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For ata_pthru.mod.
|
||||||
|
pkglib_MODULES += ata_pthru.mod
|
||||||
|
ata_pthru_mod_SOURCES = disk/ata_pthru.c
|
||||||
|
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
ata_pthru_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For mmap.mod.
|
||||||
|
pkglib_MODULES += mmap.mod
|
||||||
|
mmap_mod_SOURCES = mmap/mmap.c mmap/mips/yeeloong/uppermem.c
|
||||||
|
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
# For datetime.mod
|
||||||
|
pkglib_MODULES += datetime.mod
|
||||||
|
datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += linux.mod
|
||||||
|
linux_mod_SOURCES = loader/$(target_cpu)/linux.c
|
||||||
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
sbin_SCRIPTS += grub-install
|
||||||
|
grub_install_SOURCES = util/grub-install.in
|
40
conf/mips.rmk
Normal file
40
conf/mips.rmk
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
# -*- makefile -*-
|
||||||
|
|
||||||
|
COMMON_CFLAGS += -mexplicit-relocs -mflush-func=grub_cpu_flush_cache
|
||||||
|
|
||||||
|
# Images.
|
||||||
|
kernel_img_HEADERS += cpu/cache.h
|
||||||
|
|
||||||
|
# Scripts.
|
||||||
|
sbin_SCRIPTS =
|
||||||
|
bin_SCRIPTS =
|
||||||
|
|
||||||
|
# For grub-mkimage.
|
||||||
|
bin_UTILITIES += grub-mkimage
|
||||||
|
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
|
||||||
|
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
||||||
|
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(LINK_BASE)
|
||||||
|
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
||||||
|
|
||||||
|
# For serial.mod.
|
||||||
|
pkglib_MODULES += serial.mod
|
||||||
|
serial_mod_SOURCES = term/serial.c
|
||||||
|
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For relocator.mod.
|
||||||
|
pkglib_MODULES += relocator.mod
|
||||||
|
relocator_mod_SOURCES = lib/$(target_cpu)/relocator.c lib/$(target_cpu)/relocator_asm.S
|
||||||
|
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
relocator_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
relocator_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += multiboot2.mod
|
||||||
|
multiboot2_mod_SOURCES = loader/multiboot.c \
|
||||||
|
loader/multiboot_mbi2.c
|
||||||
|
multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
|
||||||
|
multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
include $(srcdir)/conf/common.mk
|
|
@ -1,29 +1,9 @@
|
||||||
|
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -D__ASSEMBLY__
|
|
||||||
COMMON_CFLAGS = -ffreestanding
|
|
||||||
COMMON_LDFLAGS += -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
kernel_img_HEADERS += ieee1275/ieee1275.h
|
||||||
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 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 i18n.h
|
|
||||||
|
|
||||||
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_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Programs
|
# Programs
|
||||||
pkglib_PROGRAMS = kernel.img
|
pkglib_PROGRAMS = kernel.img
|
||||||
|
@ -31,7 +11,7 @@ pkglib_PROGRAMS = kernel.img
|
||||||
kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
|
kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
|
||||||
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||||
kern/ieee1275/init.c \
|
kern/ieee1275/init.c \
|
||||||
|
@ -43,8 +23,7 @@ kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
|
||||||
symlist.c kern/$(target_cpu)/cache.S
|
symlist.c kern/$(target_cpu)/cache.S
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
|
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x200000,-Bstatic
|
||||||
-Wl,-N,-S,-Ttext,0x200000,-Bstatic
|
|
||||||
|
|
||||||
# Scripts.
|
# Scripts.
|
||||||
sbin_SCRIPTS = grub-install
|
sbin_SCRIPTS = grub-install
|
||||||
|
@ -57,49 +36,33 @@ grub_install_SOURCES = util/ieee1275/grub-install.in
|
||||||
grub_mkrescue_SOURCES = util/powerpc/ieee1275/grub-mkrescue.in
|
grub_mkrescue_SOURCES = util/powerpc/ieee1275/grub-mkrescue.in
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
pkglib_MODULES = halt.mod \
|
pkglib_MODULES += ieee1275_fb.mod
|
||||||
linux.mod \
|
ieee1275_fb_mod_SOURCES = video/ieee1275.c
|
||||||
reboot.mod \
|
ieee1275_fb_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
suspend.mod \
|
ieee1275_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
multiboot.mod \
|
|
||||||
lsmmap.mod
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
# For linux.mod.
|
||||||
|
pkglib_MODULES += linux.mod
|
||||||
linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c
|
linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For suspend.mod
|
# For suspend.mod
|
||||||
|
pkglib_MODULES += suspend.mod
|
||||||
suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
||||||
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For reboot.mod
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod
|
# For halt.mod
|
||||||
|
pkglib_MODULES += halt.mod
|
||||||
halt_mod_SOURCES = commands/halt.c
|
halt_mod_SOURCES = commands/halt.c
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For multiboot.mod
|
# For datetime.mod
|
||||||
multiboot_mod_SOURCES = loader/ieee1275/multiboot2.c \
|
pkglib_MODULES += datetime.mod
|
||||||
loader/multiboot2.c \
|
datetime_mod_SOURCES = lib/ieee1275/datetime.c
|
||||||
loader/multiboot_loader.c
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lsmmap.mod
|
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/common.mk
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
|
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -m64
|
COMMON_CFLAGS = -mno-app-regs
|
||||||
COMMON_CFLAGS = -ffreestanding -m64 -mno-app-regs
|
COMMON_LDFLAGS = -melf64_sparc -mno-relax
|
||||||
COMMON_LDFLAGS = -melf64_sparc -nostdlib -mno-relax
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
pkglib_IMAGES = boot.img diskboot.img kernel.img
|
pkglib_IMAGES = boot.img diskboot.img kernel.img
|
||||||
|
@ -23,19 +19,11 @@ diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4200
|
diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4200
|
||||||
diskboot_img_FORMAT = binary
|
diskboot_img_FORMAT = binary
|
||||||
|
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
kernel_img_HEADERS += ieee1275/ieee1275.h cpu/ieee1275/ieee1275.h
|
||||||
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 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 \
|
kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
|
||||||
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||||
kern/misc.c kern/mm.c kern/reader.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||||
kern/sparc64/ieee1275/ieee1275.c \
|
kern/sparc64/ieee1275/ieee1275.c \
|
||||||
|
@ -48,29 +36,24 @@ kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
|
||||||
symlist.c kern/$(target_cpu)/cache.S
|
symlist.c kern/$(target_cpu)/cache.S
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,0x200000,-Bstatic,-melf64_sparc -static-libgcc -lgcc
|
kernel_img_LDFLAGS += -nostdlib -Wl,-N,-Ttext,0x4400,-Bstatic,-melf64_sparc
|
||||||
kernel_img_FORMAT = binary
|
kernel_img_FORMAT = binary
|
||||||
|
|
||||||
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_img_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# Utilities.
|
# Utilities.
|
||||||
bin_UTILITIES = grub-mkimage
|
bin_UTILITIES = grub-mkimage
|
||||||
sbin_UTILITIES = grub-setup grub-ofpathname
|
sbin_UTILITIES = grub-setup grub-ofpathname
|
||||||
|
|
||||||
# For grub-mkimage.
|
# For grub-mkimage.
|
||||||
grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
|
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
|
||||||
util/resolve.c
|
util/resolve.c gnulib/progname.c
|
||||||
|
|
||||||
# For grub-setup.
|
# For grub-setup.
|
||||||
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
||||||
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
||||||
util/misc.c util/getroot.c kern/device.c kern/disk.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/err.c kern/misc.c kern/parser.c kern/partition.c \
|
||||||
kern/file.c kern/fs.c kern/env.c fs/fshelp.c \
|
kern/file.c kern/fs.c kern/env.c kern/list.c \
|
||||||
|
fs/fshelp.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.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/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
|
@ -78,53 +61,45 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
||||||
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
|
||||||
fs/befs.c fs/befs_be.c fs/tar.c \
|
fs/befs.c fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
||||||
partmap/sun.c partmap/acorn.c \
|
partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
|
||||||
\
|
\
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||||
util/raid.c util/lvm.c \
|
util/raid.c util/lvm.c util/mm.c gnulib/progname.c \
|
||||||
grub_setup_init.c
|
grub_setup_init.c
|
||||||
|
|
||||||
# For grub-ofpathname.
|
# For grub-ofpathname.
|
||||||
grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
|
grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
|
||||||
util/ieee1275/ofpath.c util/misc.c
|
util/ieee1275/ofpath.c util/misc.c gnulib/progname.c
|
||||||
|
|
||||||
# Scripts.
|
# Scripts.
|
||||||
sbin_SCRIPTS = grub-install
|
sbin_SCRIPTS = grub-install
|
||||||
|
|
||||||
# For grub-install.
|
# For grub-install.
|
||||||
grub_install_SOURCES = util/sparc64/ieee1275/grub-install.in
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
pkglib_MODULES = halt.mod \
|
pkglib_MODULES += ieee1275_fb.mod
|
||||||
linux.mod \
|
ieee1275_fb_mod_SOURCES = video/ieee1275.c
|
||||||
reboot.mod \
|
ieee1275_fb_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
lsmmap.mod
|
ieee1275_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
# For linux.mod.
|
||||||
|
pkglib_MODULES += linux.mod
|
||||||
linux_mod_SOURCES = loader/sparc64/ieee1275/linux.c
|
linux_mod_SOURCES = loader/sparc64/ieee1275/linux.c
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
# For halt.mod.
|
||||||
|
pkglib_MODULES += halt.mod
|
||||||
halt_mod_SOURCES = commands/halt.c
|
halt_mod_SOURCES = commands/halt.c
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For lsmmap.mod
|
# For datetime.mod
|
||||||
lsmmap_mod_SOURCES = commands/lsmmap.c
|
pkglib_MODULES += datetime.mod
|
||||||
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_SOURCES = lib/ieee1275/datetime.c
|
||||||
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
include $(srcdir)/conf/common.mk
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
87
conf/tests.rmk
Normal file
87
conf/tests.rmk
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
# -*- makefile -*-
|
||||||
|
|
||||||
|
# For grub-shell
|
||||||
|
grub-shell: tests/util/grub-shell.in config.status
|
||||||
|
./config.status --file=$@:$<
|
||||||
|
chmod +x $@
|
||||||
|
check_SCRIPTS += grub-shell
|
||||||
|
CLEANFILES += grub-shell
|
||||||
|
|
||||||
|
# For grub-shell-tester
|
||||||
|
grub-shell-tester: tests/util/grub-shell-tester.in config.status
|
||||||
|
./config.status --file=$@:$<
|
||||||
|
chmod +x $@
|
||||||
|
check_SCRIPTS += grub-shell-tester
|
||||||
|
CLEANFILES += grub-shell-tester
|
||||||
|
|
||||||
|
pkglib_MODULES += functional_test.mod
|
||||||
|
functional_test_mod_SOURCES = tests/lib/functional_test.c tests/lib/test.c
|
||||||
|
functional_test_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
functional_test_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# Rules for unit tests
|
||||||
|
check_UTILITIES += example_unit_test
|
||||||
|
example_unit_test_SOURCES = tests/example_unit_test.c kern/list.c kern/misc.c tests/lib/test.c tests/lib/unit_test.c
|
||||||
|
example_unit_test_CFLAGS = -Wno-format
|
||||||
|
|
||||||
|
# Rules for functional tests
|
||||||
|
pkglib_MODULES += example_functional_test.mod
|
||||||
|
example_functional_test_mod_SOURCES = tests/example_functional_test.c
|
||||||
|
example_functional_test_mod_CFLAGS = -Wno-format $(COMMON_CFLAGS)
|
||||||
|
example_functional_test_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# Rules for scripted tests
|
||||||
|
check_SCRIPTS += example_scripted_test
|
||||||
|
example_scripted_test_SOURCES = tests/example_scripted_test.in
|
||||||
|
|
||||||
|
check_SCRIPTS += example_grub_script_test
|
||||||
|
example_grub_script_test_SOURCES = tests/example_grub_script_test.in
|
||||||
|
|
||||||
|
#
|
||||||
|
# Rules for real tests
|
||||||
|
#
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_echo1
|
||||||
|
grub_script_echo1_SOURCES = tests/grub_script_echo1.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_echo_keywords
|
||||||
|
grub_script_echo_keywords_SOURCES = tests/grub_script_echo_keywords.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_vars1
|
||||||
|
grub_script_vars1_SOURCES = tests/grub_script_vars1.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_for1
|
||||||
|
grub_script_for1_SOURCES = tests/grub_script_for1.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_while1
|
||||||
|
grub_script_while1_SOURCES = tests/grub_script_while1.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_if
|
||||||
|
grub_script_if_SOURCES = tests/grub_script_if.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_blanklines
|
||||||
|
grub_script_blanklines_SOURCES = tests/grub_script_blanklines.in
|
||||||
|
|
||||||
|
check_SCRIPTS += grub_script_final_semicolon
|
||||||
|
grub_script_final_semicolon_SOURCES = tests/grub_script_final_semicolon.in
|
||||||
|
|
||||||
|
# List of tests to execute on "make check"
|
||||||
|
# SCRIPTED_TESTS = example_scripted_test
|
||||||
|
# SCRIPTED_TESTS += example_grub_script_test
|
||||||
|
# UNIT_TESTS = example_unit_test
|
||||||
|
# FUNCTIONAL_TESTS = example_functional_test.mod
|
||||||
|
|
||||||
|
SCRIPTED_TESTS = grub_script_echo1
|
||||||
|
SCRIPTED_TESTS += grub_script_echo_keywords
|
||||||
|
SCRIPTED_TESTS += grub_script_vars1
|
||||||
|
SCRIPTED_TESTS += grub_script_for1
|
||||||
|
SCRIPTED_TESTS += grub_script_while1
|
||||||
|
SCRIPTED_TESTS += grub_script_if
|
||||||
|
SCRIPTED_TESTS += grub_script_blanklines
|
||||||
|
SCRIPTED_TESTS += grub_script_final_semicolon
|
||||||
|
|
||||||
|
|
||||||
|
# dependencies between tests and testing-tools
|
||||||
|
$(SCRIPTED_TESTS): grub-shell grub-shell-tester
|
||||||
|
$(FUNCTIONAL_TESTS): functional_test.mod
|
||||||
|
|
116
conf/x86-efi.rmk
Normal file
116
conf/x86-efi.rmk
Normal file
|
@ -0,0 +1,116 @@
|
||||||
|
# -*- makefile -*-
|
||||||
|
|
||||||
|
# Utilities.
|
||||||
|
bin_UTILITIES = grub-mkimage
|
||||||
|
|
||||||
|
# For grub-mkimage.
|
||||||
|
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
|
||||||
|
|
||||||
|
# Scripts.
|
||||||
|
sbin_SCRIPTS = grub-install
|
||||||
|
|
||||||
|
# For grub-install.
|
||||||
|
grub_install_SOURCES = util/i386/efi/grub-install.in
|
||||||
|
|
||||||
|
bin_SCRIPTS += grub-mkrescue
|
||||||
|
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||||
|
|
||||||
|
# Modules.
|
||||||
|
pkglib_PROGRAMS = kernel.img
|
||||||
|
pkglib_MODULES = chain.mod appleldr.mod \
|
||||||
|
linux.mod halt.mod \
|
||||||
|
datetime.mod loadbios.mod \
|
||||||
|
fixvideo.mod mmap.mod acpi.mod
|
||||||
|
|
||||||
|
# For kernel.img.
|
||||||
|
kernel_img_RELOCATABLE = yes
|
||||||
|
kernel_img_SOURCES = kern/$(target_cpu)/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/term.c \
|
||||||
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
|
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
||||||
|
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
||||||
|
term/efi/console.c disk/efi/efidisk.c \
|
||||||
|
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||||
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
|
kern/generic/rtc_get_time_ms.c \
|
||||||
|
kern/generic/millisleep.c
|
||||||
|
ifeq ($(target_cpu),x86_64)
|
||||||
|
kernel_img_SOURCES += kern/x86_64/efi/callwrap.S
|
||||||
|
endif
|
||||||
|
kernel_img_HEADERS += efi/efi.h efi/time.h efi/disk.h i386/pit.h
|
||||||
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
kernel_img_LDFLAGS += $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For acpi.mod.
|
||||||
|
acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
|
||||||
|
acpi_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
acpi_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
|
||||||
|
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For chain.mod.
|
||||||
|
chain_mod_SOURCES = loader/efi/chainloader.c
|
||||||
|
chain_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For appleldr.mod.
|
||||||
|
appleldr_mod_SOURCES = loader/efi/appleloader.c
|
||||||
|
appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For linux.mod.
|
||||||
|
linux_mod_SOURCES = loader/i386/efi/linux.c
|
||||||
|
ifeq ($(target_cpu), x86_64)
|
||||||
|
linux_mod_SOURCES += loader/i386/linux_trampoline.S
|
||||||
|
endif
|
||||||
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For halt.mod.
|
||||||
|
halt_mod_SOURCES = commands/halt.c
|
||||||
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For datetime.mod
|
||||||
|
datetime_mod_SOURCES = lib/efi/datetime.c
|
||||||
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For loadbios.mod
|
||||||
|
loadbios_mod_SOURCES = commands/efi/loadbios.c
|
||||||
|
loadbios_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
loadbios_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For fixvideo.mod
|
||||||
|
fixvideo_mod_SOURCES = commands/efi/fixvideo.c
|
||||||
|
fixvideo_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
fixvideo_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += efi_uga.mod
|
||||||
|
efi_uga_mod_SOURCES = video/efi_uga.c
|
||||||
|
efi_uga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
efi_uga_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += efi_gop.mod
|
||||||
|
efi_gop_mod_SOURCES = video/efi_gop.c
|
||||||
|
efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
pkglib_MODULES += xnu.mod
|
||||||
|
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
|
||||||
|
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
||||||
|
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
|
||||||
|
include $(srcdir)/conf/i386.mk
|
||||||
|
include $(srcdir)/conf/common.mk
|
|
@ -1,172 +1,5 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_ASFLAGS = -nostdinc -fno-builtin -m64
|
COMMON_LDFLAGS = -melf_x86_64
|
||||||
COMMON_CFLAGS = -fno-builtin -m64
|
|
||||||
COMMON_LDFLAGS = -melf_x86_64 -nostdlib
|
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
include $(srcdir)/conf/x86-efi.mk
|
||||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
||||||
|
|
||||||
# Utilities.
|
|
||||||
bin_UTILITIES = grub-mkimage
|
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
|
|
||||||
util/misc.c util/resolve.c
|
|
||||||
|
|
||||||
bin_SCRIPTS += grub-mkrescue
|
|
||||||
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
|
||||||
|
|
||||||
# For grub-setup.
|
|
||||||
#grub_setup_SOURCES = 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 fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
|
|
||||||
# fs/sfs.c kern/parser.c kern/partition.c partmap/msdos.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
|
|
||||||
|
|
||||||
# Scripts.
|
|
||||||
sbin_SCRIPTS = grub-install
|
|
||||||
|
|
||||||
# For grub-install.
|
|
||||||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
|
||||||
|
|
||||||
# Modules.
|
|
||||||
pkglib_MODULES = kernel.mod 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 ata.mod
|
|
||||||
|
|
||||||
# For kernel.mod.
|
|
||||||
kernel_mod_EXPORTS = no
|
|
||||||
kernel_mod_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 \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
|
||||||
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
|
||||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
||||||
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 \
|
|
||||||
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 i18n.h
|
|
||||||
kernel_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
kernel_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_mod_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
|
|
||||||
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
kernel_syms.lst: $(addprefix include/grub/,$(kernel_mod_HEADERS)) config.h genkernsyms.sh
|
|
||||||
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
# For boot.mod.
|
|
||||||
pkglib_MODULES += boot.mod
|
|
||||||
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
|
|
||||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For acpi.mod.
|
|
||||||
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
|
|
||||||
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For chain.mod.
|
|
||||||
chain_mod_SOURCES = loader/efi/chainloader.c
|
|
||||||
chain_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For appleldr.mod.
|
|
||||||
appleldr_mod_SOURCES = loader/efi/appleloader.c
|
|
||||||
appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For linux.mod.
|
|
||||||
linux_mod_SOURCES = loader/i386/efi/linux.c loader/i386/linux_trampoline.S
|
|
||||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For halt.mod.
|
|
||||||
halt_mod_SOURCES = commands/halt.c
|
|
||||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For reboot.mod.
|
|
||||||
reboot_mod_SOURCES = commands/reboot.c
|
|
||||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For pci.mod
|
|
||||||
pci_mod_SOURCES = bus/pci.c
|
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For lspci.mod
|
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
|
||||||
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datetime.mod
|
|
||||||
datetime_mod_SOURCES = lib/efi/datetime.c
|
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For date.mod
|
|
||||||
date_mod_SOURCES = commands/date.c
|
|
||||||
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For datehook.mod
|
|
||||||
datehook_mod_SOURCES = hook/datehook.c
|
|
||||||
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For loadbios.mod
|
|
||||||
loadbios_mod_SOURCES = commands/efi/loadbios.c
|
|
||||||
loadbios_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
loadbios_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For fixvideo.mod
|
|
||||||
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_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
|
|
||||||
include $(srcdir)/conf/common.mk
|
|
||||||
|
|
672
config.rpath
Executable file
672
config.rpath
Executable file
|
@ -0,0 +1,672 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# Output a system dependent set of variables, describing how to set the
|
||||||
|
# run time search path of shared libraries in an executable.
|
||||||
|
#
|
||||||
|
# Copyright 1996-2008 Free Software Foundation, Inc.
|
||||||
|
# Taken from GNU libtool, 2001
|
||||||
|
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||||
|
#
|
||||||
|
# This file is free software; the Free Software Foundation gives
|
||||||
|
# unlimited permission to copy and/or distribute it, with or without
|
||||||
|
# modifications, as long as this notice is preserved.
|
||||||
|
#
|
||||||
|
# The first argument passed to this file is the canonical host specification,
|
||||||
|
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||||
|
# or
|
||||||
|
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||||
|
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||||
|
# should be set by the caller.
|
||||||
|
#
|
||||||
|
# The set of defined variables is at the end of this script.
|
||||||
|
|
||||||
|
# Known limitations:
|
||||||
|
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
|
||||||
|
# than 256 bytes, otherwise the compiler driver will dump core. The only
|
||||||
|
# known workaround is to choose shorter directory names for the build
|
||||||
|
# directory and/or the installation directory.
|
||||||
|
|
||||||
|
# All known linkers require a `.a' archive for static linking (except MSVC,
|
||||||
|
# which needs '.lib').
|
||||||
|
libext=a
|
||||||
|
shrext=.so
|
||||||
|
|
||||||
|
host="$1"
|
||||||
|
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||||
|
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||||
|
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||||
|
|
||||||
|
# Code taken from libtool.m4's _LT_CC_BASENAME.
|
||||||
|
|
||||||
|
for cc_temp in $CC""; do
|
||||||
|
case $cc_temp in
|
||||||
|
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
|
||||||
|
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
|
||||||
|
\-*) ;;
|
||||||
|
*) break;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
|
||||||
|
|
||||||
|
# Code taken from libtool.m4's _LT_COMPILER_PIC.
|
||||||
|
|
||||||
|
wl=
|
||||||
|
if test "$GCC" = yes; then
|
||||||
|
wl='-Wl,'
|
||||||
|
else
|
||||||
|
case "$host_os" in
|
||||||
|
aix*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
darwin*)
|
||||||
|
case $cc_basename in
|
||||||
|
xlc*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
mingw* | cygwin* | pw32* | os2* | cegcc*)
|
||||||
|
;;
|
||||||
|
hpux9* | hpux10* | hpux11*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
irix5* | irix6* | nonstopux*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
newsos6)
|
||||||
|
;;
|
||||||
|
linux* | k*bsd*-gnu)
|
||||||
|
case $cc_basename in
|
||||||
|
ecc*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
icc* | ifort*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
lf95*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
pgcc | pgf77 | pgf90)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
ccc*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
como)
|
||||||
|
wl='-lopt='
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
case `$CC -V 2>&1 | sed 5q` in
|
||||||
|
*Sun\ C*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
osf3* | osf4* | osf5*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
rdos*)
|
||||||
|
;;
|
||||||
|
solaris*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
sunos4*)
|
||||||
|
wl='-Qoption ld '
|
||||||
|
;;
|
||||||
|
sysv4 | sysv4.2uw2* | sysv4.3*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
sysv4*MP*)
|
||||||
|
;;
|
||||||
|
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
unicos*)
|
||||||
|
wl='-Wl,'
|
||||||
|
;;
|
||||||
|
uts4*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
|
||||||
|
|
||||||
|
hardcode_libdir_flag_spec=
|
||||||
|
hardcode_libdir_separator=
|
||||||
|
hardcode_direct=no
|
||||||
|
hardcode_minus_L=no
|
||||||
|
|
||||||
|
case "$host_os" in
|
||||||
|
cygwin* | mingw* | pw32* | cegcc*)
|
||||||
|
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||||
|
# When not using gcc, we currently assume that we are using
|
||||||
|
# Microsoft Visual C++.
|
||||||
|
if test "$GCC" != yes; then
|
||||||
|
with_gnu_ld=no
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
interix*)
|
||||||
|
# we just hope/assume this is gcc and not c89 (= MSVC++)
|
||||||
|
with_gnu_ld=yes
|
||||||
|
;;
|
||||||
|
openbsd*)
|
||||||
|
with_gnu_ld=no
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ld_shlibs=yes
|
||||||
|
if test "$with_gnu_ld" = yes; then
|
||||||
|
# Set some defaults for GNU ld with shared library support. These
|
||||||
|
# are reset later if shared libraries are not supported. Putting them
|
||||||
|
# here allows them to be overridden if necessary.
|
||||||
|
# Unlike libtool, we use -rpath here, not --rpath, since the documented
|
||||||
|
# option of GNU ld is called -rpath, not --rpath.
|
||||||
|
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||||
|
case "$host_os" in
|
||||||
|
aix[3-9]*)
|
||||||
|
# On AIX/PPC, the GNU linker is very broken
|
||||||
|
if test "$host_cpu" != ia64; then
|
||||||
|
ld_shlibs=no
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
amigaos*)
|
||||||
|
hardcode_libdir_flag_spec='-L$libdir'
|
||||||
|
hardcode_minus_L=yes
|
||||||
|
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
|
||||||
|
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||||
|
# to version 4, is to share data among multiple programs linked
|
||||||
|
# with the same dynamic library. Since this doesn't match the
|
||||||
|
# behavior of shared libraries on other platforms, we cannot use
|
||||||
|
# them.
|
||||||
|
ld_shlibs=no
|
||||||
|
;;
|
||||||
|
beos*)
|
||||||
|
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
ld_shlibs=no
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
cygwin* | mingw* | pw32* | cegcc*)
|
||||||
|
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||||
|
# no search path for DLLs.
|
||||||
|
hardcode_libdir_flag_spec='-L$libdir'
|
||||||
|
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
ld_shlibs=no
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
interix[3-9]*)
|
||||||
|
hardcode_direct=no
|
||||||
|
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||||
|
;;
|
||||||
|
gnu* | linux* | k*bsd*-gnu)
|
||||||
|
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
ld_shlibs=no
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
netbsd*)
|
||||||
|
;;
|
||||||
|
solaris*)
|
||||||
|
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
|
||||||
|
ld_shlibs=no
|
||||||
|
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
ld_shlibs=no
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
|
||||||
|
case `$LD -v 2>&1` in
|
||||||
|
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
|
||||||
|
ld_shlibs=no
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||||
|
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
|
||||||
|
else
|
||||||
|
ld_shlibs=no
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
sunos4*)
|
||||||
|
hardcode_direct=yes
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
ld_shlibs=no
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if test "$ld_shlibs" = no; then
|
||||||
|
hardcode_libdir_flag_spec=
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
case "$host_os" in
|
||||||
|
aix3*)
|
||||||
|
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||||
|
# are no directories specified by -L.
|
||||||
|
hardcode_minus_L=yes
|
||||||
|
if test "$GCC" = yes; then
|
||||||
|
# Neither direct hardcoding nor static linking is supported with a
|
||||||
|
# broken collect2.
|
||||||
|
hardcode_direct=unsupported
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
aix[4-9]*)
|
||||||
|
if test "$host_cpu" = ia64; then
|
||||||
|
# On IA64, the linker does run time linking by default, so we don't
|
||||||
|
# have to do anything special.
|
||||||
|
aix_use_runtimelinking=no
|
||||||
|
else
|
||||||
|
aix_use_runtimelinking=no
|
||||||
|
# Test if we are trying to use run time linking or normal
|
||||||
|
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||||
|
# need to do runtime linking.
|
||||||
|
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
|
||||||
|
for ld_flag in $LDFLAGS; do
|
||||||
|
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||||
|
aix_use_runtimelinking=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
hardcode_direct=yes
|
||||||
|
hardcode_libdir_separator=':'
|
||||||
|
if test "$GCC" = yes; then
|
||||||
|
case $host_os in aix4.[012]|aix4.[012].*)
|
||||||
|
collect2name=`${CC} -print-prog-name=collect2`
|
||||||
|
if test -f "$collect2name" && \
|
||||||
|
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||||
|
then
|
||||||
|
# We have reworked collect2
|
||||||
|
:
|
||||||
|
else
|
||||||
|
# We have old collect2
|
||||||
|
hardcode_direct=unsupported
|
||||||
|
hardcode_minus_L=yes
|
||||||
|
hardcode_libdir_flag_spec='-L$libdir'
|
||||||
|
hardcode_libdir_separator=
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
# Begin _LT_AC_SYS_LIBPATH_AIX.
|
||||||
|
echo 'int main () { return 0; }' > conftest.c
|
||||||
|
${CC} ${LDFLAGS} conftest.c -o conftest
|
||||||
|
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||||
|
}'`
|
||||||
|
if test -z "$aix_libpath"; then
|
||||||
|
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||||
|
}'`
|
||||||
|
fi
|
||||||
|
if test -z "$aix_libpath"; then
|
||||||
|
aix_libpath="/usr/lib:/lib"
|
||||||
|
fi
|
||||||
|
rm -f conftest.c conftest
|
||||||
|
# End _LT_AC_SYS_LIBPATH_AIX.
|
||||||
|
if test "$aix_use_runtimelinking" = yes; then
|
||||||
|
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||||
|
else
|
||||||
|
if test "$host_cpu" = ia64; then
|
||||||
|
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||||
|
else
|
||||||
|
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
amigaos*)
|
||||||
|
hardcode_libdir_flag_spec='-L$libdir'
|
||||||
|
hardcode_minus_L=yes
|
||||||
|
# see comment about different semantics on the GNU ld section
|
||||||
|
ld_shlibs=no
|
||||||
|
;;
|
||||||
|
bsdi[45]*)
|
||||||
|
;;
|
||||||
|
cygwin* | mingw* | pw32* | cegcc*)
|
||||||
|
# When not using gcc, we currently assume that we are using
|
||||||
|
# Microsoft Visual C++.
|
||||||
|
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||||
|
# no search path for DLLs.
|
||||||
|
hardcode_libdir_flag_spec=' '
|
||||||
|
libext=lib
|
||||||
|
;;
|
||||||
|
darwin* | rhapsody*)
|
||||||
|
hardcode_direct=no
|
||||||
|
if test "$GCC" = yes ; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
case $cc_basename in
|
||||||
|
xlc*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
ld_shlibs=no
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
dgux*)
|
||||||
|
hardcode_libdir_flag_spec='-L$libdir'
|
||||||
|
;;
|
||||||
|
freebsd1*)
|
||||||
|
ld_shlibs=no
|
||||||
|
;;
|
||||||
|
freebsd2.2*)
|
||||||
|
hardcode_libdir_flag_spec='-R$libdir'
|
||||||
|
hardcode_direct=yes
|
||||||
|
;;
|
||||||
|
freebsd2*)
|
||||||
|
hardcode_direct=yes
|
||||||
|
hardcode_minus_L=yes
|
||||||
|
;;
|
||||||
|
freebsd* | dragonfly*)
|
||||||
|
hardcode_libdir_flag_spec='-R$libdir'
|
||||||
|
hardcode_direct=yes
|
||||||
|
;;
|
||||||
|
hpux9*)
|
||||||
|
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||||
|
hardcode_libdir_separator=:
|
||||||
|
hardcode_direct=yes
|
||||||
|
# hardcode_minus_L: Not really in the search PATH,
|
||||||
|
# but as the default location of the library.
|
||||||
|
hardcode_minus_L=yes
|
||||||
|
;;
|
||||||
|
hpux10*)
|
||||||
|
if test "$with_gnu_ld" = no; then
|
||||||
|
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||||
|
hardcode_libdir_separator=:
|
||||||
|
hardcode_direct=yes
|
||||||
|
# hardcode_minus_L: Not really in the search PATH,
|
||||||
|
# but as the default location of the library.
|
||||||
|
hardcode_minus_L=yes
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
hpux11*)
|
||||||
|
if test "$with_gnu_ld" = no; then
|
||||||
|
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||||
|
hardcode_libdir_separator=:
|
||||||
|
case $host_cpu in
|
||||||
|
hppa*64*|ia64*)
|
||||||
|
hardcode_direct=no
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
hardcode_direct=yes
|
||||||
|
# hardcode_minus_L: Not really in the search PATH,
|
||||||
|
# but as the default location of the library.
|
||||||
|
hardcode_minus_L=yes
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
irix5* | irix6* | nonstopux*)
|
||||||
|
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||||
|
hardcode_libdir_separator=:
|
||||||
|
;;
|
||||||
|
netbsd*)
|
||||||
|
hardcode_libdir_flag_spec='-R$libdir'
|
||||||
|
hardcode_direct=yes
|
||||||
|
;;
|
||||||
|
newsos6)
|
||||||
|
hardcode_direct=yes
|
||||||
|
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||||
|
hardcode_libdir_separator=:
|
||||||
|
;;
|
||||||
|
openbsd*)
|
||||||
|
if test -f /usr/libexec/ld.so; then
|
||||||
|
hardcode_direct=yes
|
||||||
|
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||||
|
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||||
|
else
|
||||||
|
case "$host_os" in
|
||||||
|
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||||
|
hardcode_libdir_flag_spec='-R$libdir'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
ld_shlibs=no
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
os2*)
|
||||||
|
hardcode_libdir_flag_spec='-L$libdir'
|
||||||
|
hardcode_minus_L=yes
|
||||||
|
;;
|
||||||
|
osf3*)
|
||||||
|
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||||
|
hardcode_libdir_separator=:
|
||||||
|
;;
|
||||||
|
osf4* | osf5*)
|
||||||
|
if test "$GCC" = yes; then
|
||||||
|
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||||
|
else
|
||||||
|
# Both cc and cxx compiler support -rpath directly
|
||||||
|
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||||
|
fi
|
||||||
|
hardcode_libdir_separator=:
|
||||||
|
;;
|
||||||
|
solaris*)
|
||||||
|
hardcode_libdir_flag_spec='-R$libdir'
|
||||||
|
;;
|
||||||
|
sunos4*)
|
||||||
|
hardcode_libdir_flag_spec='-L$libdir'
|
||||||
|
hardcode_direct=yes
|
||||||
|
hardcode_minus_L=yes
|
||||||
|
;;
|
||||||
|
sysv4)
|
||||||
|
case $host_vendor in
|
||||||
|
sni)
|
||||||
|
hardcode_direct=yes # is this really true???
|
||||||
|
;;
|
||||||
|
siemens)
|
||||||
|
hardcode_direct=no
|
||||||
|
;;
|
||||||
|
motorola)
|
||||||
|
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
sysv4.3*)
|
||||||
|
;;
|
||||||
|
sysv4*MP*)
|
||||||
|
if test -d /usr/nec; then
|
||||||
|
ld_shlibs=yes
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
|
||||||
|
;;
|
||||||
|
sysv5* | sco3.2v5* | sco5v6*)
|
||||||
|
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
|
||||||
|
hardcode_libdir_separator=':'
|
||||||
|
;;
|
||||||
|
uts4*)
|
||||||
|
hardcode_libdir_flag_spec='-L$libdir'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
ld_shlibs=no
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check dynamic linker characteristics
|
||||||
|
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
|
||||||
|
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
|
||||||
|
# only about the one the linker finds when passed -lNAME. This is the last
|
||||||
|
# element of library_names_spec in libtool.m4, or possibly two of them if the
|
||||||
|
# linker has special search rules.
|
||||||
|
library_names_spec= # the last element of library_names_spec in libtool.m4
|
||||||
|
libname_spec='lib$name'
|
||||||
|
case "$host_os" in
|
||||||
|
aix3*)
|
||||||
|
library_names_spec='$libname.a'
|
||||||
|
;;
|
||||||
|
aix[4-9]*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
amigaos*)
|
||||||
|
library_names_spec='$libname.a'
|
||||||
|
;;
|
||||||
|
beos*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
bsdi[45]*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
cygwin* | mingw* | pw32* | cegcc*)
|
||||||
|
shrext=.dll
|
||||||
|
library_names_spec='$libname.dll.a $libname.lib'
|
||||||
|
;;
|
||||||
|
darwin* | rhapsody*)
|
||||||
|
shrext=.dylib
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
dgux*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
freebsd1*)
|
||||||
|
;;
|
||||||
|
freebsd* | dragonfly*)
|
||||||
|
case "$host_os" in
|
||||||
|
freebsd[123]*)
|
||||||
|
library_names_spec='$libname$shrext$versuffix' ;;
|
||||||
|
*)
|
||||||
|
library_names_spec='$libname$shrext' ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
gnu*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
hpux9* | hpux10* | hpux11*)
|
||||||
|
case $host_cpu in
|
||||||
|
ia64*)
|
||||||
|
shrext=.so
|
||||||
|
;;
|
||||||
|
hppa*64*)
|
||||||
|
shrext=.sl
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
shrext=.sl
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
interix[3-9]*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
irix5* | irix6* | nonstopux*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
case "$host_os" in
|
||||||
|
irix5* | nonstopux*)
|
||||||
|
libsuff= shlibsuff=
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
case $LD in
|
||||||
|
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
|
||||||
|
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
|
||||||
|
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
|
||||||
|
*) libsuff= shlibsuff= ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
linux*oldld* | linux*aout* | linux*coff*)
|
||||||
|
;;
|
||||||
|
linux* | k*bsd*-gnu)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
knetbsd*-gnu)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
netbsd*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
newsos6)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
nto-qnx*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
openbsd*)
|
||||||
|
library_names_spec='$libname$shrext$versuffix'
|
||||||
|
;;
|
||||||
|
os2*)
|
||||||
|
libname_spec='$name'
|
||||||
|
shrext=.dll
|
||||||
|
library_names_spec='$libname.a'
|
||||||
|
;;
|
||||||
|
osf3* | osf4* | osf5*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
rdos*)
|
||||||
|
;;
|
||||||
|
solaris*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
sunos4*)
|
||||||
|
library_names_spec='$libname$shrext$versuffix'
|
||||||
|
;;
|
||||||
|
sysv4 | sysv4.3*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
sysv4*MP*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
uts4*)
|
||||||
|
library_names_spec='$libname$shrext'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||||
|
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||||
|
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
|
||||||
|
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||||
|
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||||
|
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||||
|
|
||||||
|
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||||
|
|
||||||
|
# How to pass a linker flag through the compiler.
|
||||||
|
wl="$escaped_wl"
|
||||||
|
|
||||||
|
# Static library suffix (normally "a").
|
||||||
|
libext="$libext"
|
||||||
|
|
||||||
|
# Shared library suffix (normally "so").
|
||||||
|
shlibext="$shlibext"
|
||||||
|
|
||||||
|
# Format of library name prefix.
|
||||||
|
libname_spec="$escaped_libname_spec"
|
||||||
|
|
||||||
|
# Library names that the linker finds when passed -lNAME.
|
||||||
|
library_names_spec="$escaped_library_names_spec"
|
||||||
|
|
||||||
|
# Flag to hardcode \$libdir into a binary during linking.
|
||||||
|
# This must work even if \$libdir does not exist.
|
||||||
|
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||||
|
|
||||||
|
# Whether we need a single -rpath flag with a separated argument.
|
||||||
|
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||||
|
|
||||||
|
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||||
|
# resulting binary.
|
||||||
|
hardcode_direct="$hardcode_direct"
|
||||||
|
|
||||||
|
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||||
|
# resulting binary.
|
||||||
|
hardcode_minus_L="$hardcode_minus_L"
|
||||||
|
|
||||||
|
EOF
|
297
configure.ac
297
configure.ac
|
@ -1,6 +1,6 @@
|
||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This configure.ac is free software; the author
|
# This configure.ac is free software; the author
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
@ -31,7 +31,7 @@ dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
|
||||||
dnl type.
|
dnl type.
|
||||||
|
|
||||||
|
|
||||||
AC_INIT([GRUB],[1.97],[bug-grub@gnu.org])
|
AC_INIT([GRUB],[1.98],[bug-grub@gnu.org])
|
||||||
AM_INIT_AUTOMAKE()
|
AM_INIT_AUTOMAKE()
|
||||||
AC_PREREQ(2.60)
|
AC_PREREQ(2.60)
|
||||||
AC_CONFIG_SRCDIR([include/grub/dl.h])
|
AC_CONFIG_SRCDIR([include/grub/dl.h])
|
||||||
|
@ -44,9 +44,25 @@ AC_CANONICAL_TARGET
|
||||||
# Program name transformations
|
# Program name transformations
|
||||||
AC_ARG_PROGRAM
|
AC_ARG_PROGRAM
|
||||||
|
|
||||||
|
# Optimization flag. Allow user to override.
|
||||||
|
if test "x$TARGET_CFLAGS" = x; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -Os"
|
||||||
|
fi
|
||||||
|
|
||||||
case "$target_cpu" in
|
case "$target_cpu" in
|
||||||
i[[3456]]86) target_cpu=i386 ;;
|
i[[3456]]86) target_cpu=i386 ;;
|
||||||
|
amd64) target_cpu=x86_64 ;;
|
||||||
sparc) target_cpu=sparc64 ;;
|
sparc) target_cpu=sparc64 ;;
|
||||||
|
mipsel|mips64el)
|
||||||
|
target_cpu=mips;
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPSEL=1";
|
||||||
|
CFLAGS="$CFLAGS -DGRUB_CPU_MIPSEL=1";
|
||||||
|
;;
|
||||||
|
mips|mips64)
|
||||||
|
target_cpu=mips;
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPS=1";
|
||||||
|
CFLAGS="$CFLAGS -DGRUB_CPU_MIPS=1";
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Specify the platform (such as firmware).
|
# Specify the platform (such as firmware).
|
||||||
|
@ -64,6 +80,7 @@ if test "x$with_platform" = x; then
|
||||||
powerpc-*) platform=ieee1275 ;;
|
powerpc-*) platform=ieee1275 ;;
|
||||||
powerpc64-*) platform=ieee1275 ;;
|
powerpc64-*) platform=ieee1275 ;;
|
||||||
sparc64-*) platform=ieee1275 ;;
|
sparc64-*) platform=ieee1275 ;;
|
||||||
|
mips-*) platform=yeeloong ;;
|
||||||
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
@ -74,6 +91,7 @@ fi
|
||||||
if test -z "$target_alias"; then
|
if test -z "$target_alias"; then
|
||||||
case "$target_cpu"-"$platform" in
|
case "$target_cpu"-"$platform" in
|
||||||
x86_64-efi) ;;
|
x86_64-efi) ;;
|
||||||
|
x86_64-emu) ;;
|
||||||
x86_64-*) target_cpu=i386 ;;
|
x86_64-*) target_cpu=i386 ;;
|
||||||
powerpc64-ieee1275) target_cpu=powerpc ;;
|
powerpc64-ieee1275) target_cpu=powerpc ;;
|
||||||
esac
|
esac
|
||||||
|
@ -90,6 +108,8 @@ case "$target_cpu"-"$platform" in
|
||||||
i386-qemu) ;;
|
i386-qemu) ;;
|
||||||
powerpc-ieee1275) ;;
|
powerpc-ieee1275) ;;
|
||||||
sparc64-ieee1275) ;;
|
sparc64-ieee1275) ;;
|
||||||
|
mips-qemu-mips) ;;
|
||||||
|
mips-yeeloong) ;;
|
||||||
*-emu) ;;
|
*-emu) ;;
|
||||||
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
||||||
esac
|
esac
|
||||||
|
@ -110,6 +130,7 @@ case "$host_os" in
|
||||||
gnu*) host_kernel=hurd ;;
|
gnu*) host_kernel=hurd ;;
|
||||||
linux*) host_kernel=linux ;;
|
linux*) host_kernel=linux ;;
|
||||||
freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
|
freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
|
||||||
|
netbsd*) host_kernel=netbsd ;;
|
||||||
cygwin) host_kernel=windows ;;
|
cygwin) host_kernel=windows ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -120,8 +141,16 @@ case "$platform" in
|
||||||
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
|
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
|
||||||
pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
|
pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
|
||||||
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
|
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
|
||||||
|
yeeloong) machine_CFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||||
|
qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||||
esac
|
esac
|
||||||
|
case "$target_cpu" in
|
||||||
|
mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
||||||
|
sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
CFLAGS="$CFLAGS $machine_CFLAGS"
|
CFLAGS="$CFLAGS $machine_CFLAGS"
|
||||||
|
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
|
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
|
||||||
|
|
||||||
AC_SUBST(host_cpu)
|
AC_SUBST(host_cpu)
|
||||||
|
@ -147,7 +176,7 @@ if test "x$YACC" = x; then
|
||||||
AC_MSG_ERROR([bison is not found])
|
AC_MSG_ERROR([bison is not found])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do
|
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz /usr/share/fonts/unifont/unifont.pcf.gz; do
|
||||||
if test -e $file ; then
|
if test -e $file ; then
|
||||||
AC_SUBST([FONT_SOURCE], [$file])
|
AC_SUBST([FONT_SOURCE], [$file])
|
||||||
break
|
break
|
||||||
|
@ -156,9 +185,21 @@ done
|
||||||
|
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_AWK
|
AC_PROG_AWK
|
||||||
|
AC_PROG_LEX
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_MKDIR_P
|
AC_PROG_MKDIR_P
|
||||||
|
|
||||||
|
if test "x$LEX" = x; then
|
||||||
|
AC_MSG_ERROR([flex is not found])
|
||||||
|
else
|
||||||
|
version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
|
||||||
|
if test -n "$version" -a "$version" -ge 20535; then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# These are not a "must".
|
# These are not a "must".
|
||||||
AC_PATH_PROG(RUBY, ruby)
|
AC_PATH_PROG(RUBY, ruby)
|
||||||
AC_PATH_PROG(MAKEINFO, makeinfo)
|
AC_PATH_PROG(MAKEINFO, makeinfo)
|
||||||
|
@ -172,7 +213,7 @@ AC_PROG_CC
|
||||||
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
|
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
|
||||||
|
|
||||||
AC_GNU_SOURCE
|
AC_GNU_SOURCE
|
||||||
AM_GNU_GETTEXT
|
AM_GNU_GETTEXT([external])
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
# Identify characteristics of the host architecture.
|
# Identify characteristics of the host architecture.
|
||||||
|
@ -193,14 +234,28 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for functions.
|
# Check for functions.
|
||||||
AC_CHECK_FUNCS(posix_memalign memalign asprintf)
|
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
|
||||||
|
|
||||||
# For grub-mkisofs
|
# For grub-mkisofs
|
||||||
AC_HEADER_MAJOR
|
AC_HEADER_MAJOR
|
||||||
AC_HEADER_DIRENT
|
AC_HEADER_DIRENT
|
||||||
AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
|
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(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)
|
AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h limits.h)
|
||||||
|
|
||||||
|
# For opendisk() and getrawpartition() on NetBSD.
|
||||||
|
# Used in util/deviceiter.c and in util/hostdisk.c.
|
||||||
|
AC_CHECK_HEADER([util.h], [
|
||||||
|
AC_CHECK_LIB([util], [opendisk], [
|
||||||
|
LIBUTIL="-lutil"
|
||||||
|
AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
|
||||||
|
])
|
||||||
|
AC_CHECK_LIB([util], [getrawpartition], [
|
||||||
|
LIBUTIL="-lutil"
|
||||||
|
AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
AC_SUBST([LIBUTIL])
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check for target programs.
|
# Check for target programs.
|
||||||
|
@ -241,60 +296,45 @@ CPPFLAGS="$TARGET_CPPFLAGS"
|
||||||
LDFLAGS="$TARGET_LDFLAGS"
|
LDFLAGS="$TARGET_LDFLAGS"
|
||||||
LIBS=""
|
LIBS=""
|
||||||
|
|
||||||
if test "x$TARGET_CFLAGS" = x; then
|
# debug flags.
|
||||||
# debug flags.
|
TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
|
||||||
TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
|
-Wundef -Wstrict-prototypes -g"
|
||||||
-Wundef -Wstrict-prototypes -g"
|
|
||||||
|
|
||||||
# optimization flags.
|
# Force no alignment to save space on i386.
|
||||||
AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [
|
if test "x$target_cpu" = xi386; then
|
||||||
CFLAGS=-Os
|
AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
|
||||||
|
CFLAGS="$CFLAGS -falign-loops=1"
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
[grub_cv_cc_Os=yes],
|
[grub_cv_cc_falign_loop=yes],
|
||||||
[grub_cv_cc_Os=no])
|
[grub_cv_cc_falign_loop=no])
|
||||||
])
|
])
|
||||||
if test "x$grub_cv_cc_Os" = xyes; then
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -Os"
|
if test "x$grub_cv_cc_falign_loop" = xyes; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
|
||||||
else
|
else
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
|
TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Force no alignment to save space on i386.
|
# Some toolchains enable these features by default, but they need
|
||||||
if test "x$target_cpu" = xi386; then
|
# registers that aren't set up properly in GRUB.
|
||||||
AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
|
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
|
||||||
CFLAGS="$CFLAGS -falign-loops=1"
|
fi
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
||||||
[grub_cv_cc_falign_loop=yes],
|
|
||||||
[grub_cv_cc_falign_loop=no])
|
|
||||||
])
|
|
||||||
|
|
||||||
if test "x$grub_cv_cc_falign_loop" = xyes; then
|
# By default, GCC 4.4 generates .eh_frame sections containing unwind
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
|
# information in some cases where it previously did not. GRUB doesn't need
|
||||||
else
|
# these and they just use up vital space. Restore the old compiler
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
|
# behaviour.
|
||||||
fi
|
AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
|
||||||
|
SAVE_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_fno_dwarf2_cfi_asm=yes],
|
||||||
|
[grub_cv_cc_fno_dwarf2_cfi_asm=no])
|
||||||
|
CFLAGS="$SAVE_CFLAGS"
|
||||||
|
])
|
||||||
|
|
||||||
# Some toolchains enable these features by default, but they need
|
if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
|
||||||
# registers that aren't set up properly in GRUB.
|
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# By default, GCC 4.4 generates .eh_frame sections containing unwind
|
|
||||||
# information in some cases where it previously did not. GRUB doesn't need
|
|
||||||
# these and they just use up vital space. Restore the old compiler
|
|
||||||
# behaviour.
|
|
||||||
AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
|
|
||||||
SAVE_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
||||||
[grub_cv_cc_fno_dwarf2_cfi_asm=yes],
|
|
||||||
[grub_cv_cc_fno_dwarf2_cfi_asm=no])
|
|
||||||
CFLAGS="$SAVE_CFLAGS"
|
|
||||||
])
|
|
||||||
|
|
||||||
if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
|
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
grub_apple_target_cc
|
grub_apple_target_cc
|
||||||
|
@ -336,7 +376,11 @@ AC_SUBST(TARGET_IMG_CFLAGS)
|
||||||
# For platforms where ELF is not the default link format.
|
# For platforms where ELF is not the default link format.
|
||||||
AC_MSG_CHECKING([for command to convert module to ELF format])
|
AC_MSG_CHECKING([for command to convert module to ELF format])
|
||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
|
cygwin) TARGET_OBJ2ELF='grub-pe2elf';
|
||||||
|
# FIXME: put proper test here
|
||||||
|
AC_DEFINE([NEED_REGISTER_FRAME_INFO], 1,
|
||||||
|
[Define to 1 if GCC generates calls to __register_frame_info()])
|
||||||
|
;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
AC_SUBST(TARGET_OBJ2ELF)
|
AC_SUBST(TARGET_OBJ2ELF)
|
||||||
|
@ -346,6 +390,7 @@ AC_MSG_RESULT([$TARGET_OBJ2ELF])
|
||||||
if test "x$target_m32" = x1; then
|
if test "x$target_m32" = x1; then
|
||||||
# Force 32-bit mode.
|
# Force 32-bit mode.
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||||
|
TARGET_ASFLAGS="$TARGET_CFLAGS -m32"
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
||||||
TARGET_MODULE_FORMAT="elf32"
|
TARGET_MODULE_FORMAT="elf32"
|
||||||
fi
|
fi
|
||||||
|
@ -353,6 +398,7 @@ fi
|
||||||
if test "x$target_m64" = x1; then
|
if test "x$target_m64" = x1; then
|
||||||
# Force 64-bit mode.
|
# Force 64-bit mode.
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
||||||
|
TARGET_ASFLAGS="$TARGET_ASFLAGS -m64"
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
||||||
TARGET_MODULE_FORMAT="elf64"
|
TARGET_MODULE_FORMAT="elf64"
|
||||||
fi
|
fi
|
||||||
|
@ -432,18 +478,33 @@ AC_SUBST(TARGET_ASFLAGS)
|
||||||
AC_SUBST(TARGET_CPPFLAGS)
|
AC_SUBST(TARGET_CPPFLAGS)
|
||||||
AC_SUBST(TARGET_LDFLAGS)
|
AC_SUBST(TARGET_LDFLAGS)
|
||||||
|
|
||||||
# Check for libgcc symbols (must be performed before we add -nostdlib to LDFLAGS)
|
|
||||||
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2)
|
|
||||||
|
|
||||||
# Set them to their new values for the tests below.
|
# Set them to their new values for the tests below.
|
||||||
CC="$TARGET_CC"
|
CC="$TARGET_CC"
|
||||||
|
if test "x$TARGET_APPLE_CC" = x1 ; then
|
||||||
|
CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
|
||||||
|
else
|
||||||
|
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
|
||||||
|
fi
|
||||||
|
CPPFLAGS="$TARGET_CPPFLAGS"
|
||||||
|
LDFLAGS="$TARGET_LDFLAGS"
|
||||||
|
LIBS=-lgcc
|
||||||
|
|
||||||
|
grub_ASM_USCORE
|
||||||
|
if test x$grub_cv_asm_uscore = xyes; then
|
||||||
|
CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
|
||||||
|
else
|
||||||
|
CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for libgcc symbols
|
||||||
|
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
|
||||||
|
|
||||||
if test "x$TARGET_APPLE_CC" = x1 ; then
|
if test "x$TARGET_APPLE_CC" = x1 ; then
|
||||||
CFLAGS="$TARGET_CFLAGS -nostdlib"
|
CFLAGS="$TARGET_CFLAGS -nostdlib"
|
||||||
else
|
else
|
||||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
|
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
|
||||||
fi
|
fi
|
||||||
CPPFLAGS="$TARGET_CPPFLAGS"
|
LIBS=""
|
||||||
LDFLAGS="$TARGET_LDFLAGS"
|
|
||||||
|
|
||||||
# Defined in aclocal.m4.
|
# Defined in aclocal.m4.
|
||||||
grub_PROG_TARGET_CC
|
grub_PROG_TARGET_CC
|
||||||
|
@ -451,7 +512,6 @@ if test "x$TARGET_APPLE_CC" != x1 ; then
|
||||||
grub_PROG_OBJCOPY_ABSOLUTE
|
grub_PROG_OBJCOPY_ABSOLUTE
|
||||||
fi
|
fi
|
||||||
grub_PROG_LD_BUILD_ID_NONE
|
grub_PROG_LD_BUILD_ID_NONE
|
||||||
grub_ASM_USCORE
|
|
||||||
if test "x$target_cpu" = xi386; then
|
if test "x$target_cpu" = xi386; then
|
||||||
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
|
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
|
||||||
# Check symbols provided by linker script.
|
# Check symbols provided by linker script.
|
||||||
|
@ -502,6 +562,21 @@ enable_efiemu=no
|
||||||
fi
|
fi
|
||||||
AC_SUBST([enable_efiemu])
|
AC_SUBST([enable_efiemu])
|
||||||
|
|
||||||
|
if test "$platform" != emu; then
|
||||||
|
AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
|
||||||
|
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||||
|
CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
|
||||||
|
int va_arg_func (int fixed, va_list args);]], [[]])],
|
||||||
|
[grub_cv_cc_isystem=yes],
|
||||||
|
[grub_cv_cc_isystem=no])
|
||||||
|
CPPFLAGS="$SAVED_CPPFLAGS"
|
||||||
|
])
|
||||||
|
|
||||||
|
if test x"$grub_cv_cc_isystem" = xyes ; then
|
||||||
|
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Restore the flags.
|
# Restore the flags.
|
||||||
CC="$tmp_CC"
|
CC="$tmp_CC"
|
||||||
|
@ -525,6 +600,18 @@ AC_ARG_ENABLE([grub-emu-usb],
|
||||||
[AS_HELP_STRING([--enable-grub-emu-usb],
|
[AS_HELP_STRING([--enable-grub-emu-usb],
|
||||||
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
|
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([grub-emu-sdl],
|
||||||
|
[AS_HELP_STRING([--enable-grub-emu-sdl],
|
||||||
|
[build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([grub-emu-pci],
|
||||||
|
[AS_HELP_STRING([--enable-grub-emu-pci],
|
||||||
|
[build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([grub-emu-modules],
|
||||||
|
[AS_HELP_STRING([--enable-grub-emu-modules],
|
||||||
|
[Support module loading in `grub-emu' debugging utility (default=no)])])
|
||||||
|
|
||||||
if test "$platform" = emu; then
|
if test "$platform" = emu; then
|
||||||
missing_ncurses=
|
missing_ncurses=
|
||||||
[# Check for curses libraries.]
|
[# Check for curses libraries.]
|
||||||
|
@ -543,9 +630,21 @@ if test x"$missing_ncurses" = xtrue ; then
|
||||||
AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
|
AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x"$enable_grub_emu_modules" = xyes ; then
|
||||||
|
TARGET_NO_MODULES=no
|
||||||
|
else
|
||||||
|
TARGET_NO_MODULES=yes
|
||||||
|
fi
|
||||||
|
AC_SUBST(TARGET_NO_MODULES)
|
||||||
|
|
||||||
if test x"$enable_grub_emu_usb" = xno ; then
|
if test x"$enable_grub_emu_usb" = xno ; then
|
||||||
grub_emu_usb_excuse="explicitly disabled"
|
grub_emu_usb_excuse="explicitly disabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x"$enable_grub_emu_pci" = xyes ; then
|
||||||
|
grub_emu_usb_excuse="conflicts with PCI support"
|
||||||
|
fi
|
||||||
|
|
||||||
[if [ x"$grub_emu_usb_excuse" = x ]; then
|
[if [ x"$grub_emu_usb_excuse" = x ]; then
|
||||||
# Check for libusb libraries.]
|
# Check for libusb libraries.]
|
||||||
AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
|
AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
|
||||||
|
@ -565,7 +664,62 @@ enable_grub_emu_usb=yes
|
||||||
else
|
else
|
||||||
enable_grub_emu_usb=no
|
enable_grub_emu_usb=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x"$enable_grub_emu_sdl" = xno ; then
|
||||||
|
grub_emu_sdl_excuse="explicitely disabled"
|
||||||
|
fi
|
||||||
|
[if [ x"$grub_emu_sdl_excuse" = x ]; then
|
||||||
|
# Check for libSDL libraries.]
|
||||||
|
AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
|
||||||
|
[grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
|
||||||
|
AC_SUBST([LIBSDL])
|
||||||
|
[fi]
|
||||||
|
|
||||||
|
[if [ x"$grub_emu_sdl_excuse" = x ]; then
|
||||||
|
# Check for headers.]
|
||||||
|
AC_CHECK_HEADERS([SDL/SDL.h], [],
|
||||||
|
[grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
|
||||||
|
[fi]
|
||||||
|
|
||||||
|
if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
|
||||||
|
AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
|
||||||
|
fi
|
||||||
|
if test x"$grub_emu_sdl_excuse" = x ; then
|
||||||
|
enable_grub_emu_sdl=yes
|
||||||
|
else
|
||||||
|
enable_grub_emu_sdl=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$enable_grub_emu_pci" != xyes ; then
|
||||||
|
grub_emu_pci_excuse="not enabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$enable_grub_emu_usb" = xyes ; then
|
||||||
|
grub_emu_pci_excuse="conflicts with USB support"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[if [ x"$grub_emu_pci_excuse" = x ]; then
|
||||||
|
# Check for libpci libraries.]
|
||||||
|
AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
|
||||||
|
[grub_emu_pci_excuse=["need libpciaccess library"]])
|
||||||
|
AC_SUBST([LIBPCIACCESS])
|
||||||
|
[fi]
|
||||||
|
[if [ x"$grub_emu_pci_excuse" = x ]; then
|
||||||
|
# Check for headers.]
|
||||||
|
AC_CHECK_HEADERS([pci/pci.h], [],
|
||||||
|
[grub_emu_pci_excuse=["need libpciaccess headers"]])
|
||||||
|
[fi]
|
||||||
|
|
||||||
|
if test x"$grub_emu_pci_excuse" = x ; then
|
||||||
|
enable_grub_emu_pci=yes
|
||||||
|
else
|
||||||
|
|
||||||
|
enable_grub_emu_pci=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST([enable_grub_emu_sdl])
|
||||||
AC_SUBST([enable_grub_emu_usb])
|
AC_SUBST([enable_grub_emu_usb])
|
||||||
|
AC_SUBST([enable_grub_emu_pci])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE([grub-fstest],
|
AC_ARG_ENABLE([grub-fstest],
|
||||||
|
@ -597,6 +751,16 @@ if test x"$grub_mkfont_excuse" = x ; then
|
||||||
freetype_cflags=`freetype-config --cflags`
|
freetype_cflags=`freetype-config --cflags`
|
||||||
freetype_libs=`freetype-config --libs`
|
freetype_libs=`freetype-config --libs`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x"$grub_mkfont_excuse" = x ; then
|
||||||
|
# Check for freetype libraries.
|
||||||
|
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||||
|
CPPFLAGS="$CPPFLAGS $freetype_cflags"
|
||||||
|
AC_CHECK_HEADERS([ft2build.h], [],
|
||||||
|
[grub_mkfont_excuse=["need freetype2 headers"]])
|
||||||
|
CPPFLAGS="$SAVED_CPPFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
|
if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
|
||||||
AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
|
AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
|
||||||
fi
|
fi
|
||||||
|
@ -640,6 +804,21 @@ echo USB support for grub-emu: Yes
|
||||||
else
|
else
|
||||||
echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
|
echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
|
||||||
fi
|
fi
|
||||||
|
if [ x"$grub_emu_sdl_excuse" = x ]; then
|
||||||
|
echo SDL support for grub-emu: Yes
|
||||||
|
else
|
||||||
|
echo SDL support for grub-emu: No "($grub_emu_sdl_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
|
||||||
|
if [ x"$TARGET_NO_MODULES" = xno ]; then
|
||||||
|
echo Module support for grub-emu: Yes
|
||||||
|
else
|
||||||
|
echo Module support for grub-emu: No
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ x"$enable_mm_debug" = xyes ]; then
|
if [ x"$enable_mm_debug" = xyes ]; then
|
||||||
echo With memory debugging: Yes
|
echo With memory debugging: Yes
|
||||||
|
|
77
disk/ata.c
77
disk/ata.c
|
@ -26,8 +26,8 @@
|
||||||
#include <grub/scsi.h>
|
#include <grub/scsi.h>
|
||||||
|
|
||||||
/* At the moment, only two IDE ports are supported. */
|
/* At the moment, only two IDE ports are supported. */
|
||||||
static const int grub_ata_ioaddress[] = { 0x1f0, 0x170 };
|
static const grub_port_t grub_ata_ioaddress[] = { 0x1f0, 0x170 };
|
||||||
static const int grub_ata_ioaddress2[] = { 0x3f6, 0x376 };
|
static const grub_port_t grub_ata_ioaddress2[] = { 0x3f6, 0x376 };
|
||||||
|
|
||||||
static struct grub_ata_device *grub_ata_devices;
|
static struct grub_ata_device *grub_ata_devices;
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ grub_ata_identify (struct grub_ata_device *dev)
|
||||||
else
|
else
|
||||||
/* Other Error. */
|
/* Other Error. */
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||||
"device can not be identified");
|
"device cannot be identified");
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_ata_pio_read (dev, info, GRUB_DISK_SECTOR_SIZE);
|
grub_ata_pio_read (dev, info, GRUB_DISK_SECTOR_SIZE);
|
||||||
|
@ -347,8 +347,8 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
|
||||||
/* Setup the device information. */
|
/* Setup the device information. */
|
||||||
dev->port = port;
|
dev->port = port;
|
||||||
dev->device = device;
|
dev->device = device;
|
||||||
dev->ioaddress = addr;
|
dev->ioaddress = addr + GRUB_MACHINE_PCI_IO_BASE;
|
||||||
dev->ioaddress2 = addr2;
|
dev->ioaddress2 = addr2 + GRUB_MACHINE_PCI_IO_BASE;
|
||||||
dev->next = NULL;
|
dev->next = NULL;
|
||||||
|
|
||||||
grub_ata_regset (dev, GRUB_ATA_REG_DISK, dev->device << 4);
|
grub_ata_regset (dev, GRUB_ATA_REG_DISK, dev->device << 4);
|
||||||
|
@ -388,8 +388,8 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int NESTED_FUNC_ATTR
|
static int NESTED_FUNC_ATTR
|
||||||
grub_ata_pciinit (int bus, int device, int func,
|
grub_ata_pciinit (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid __attribute__((unused)))
|
grub_pci_id_t pciid)
|
||||||
{
|
{
|
||||||
static int compat_use[2] = { 0 };
|
static int compat_use[2] = { 0 };
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
|
@ -400,19 +400,34 @@ grub_ata_pciinit (int bus, int device, int func,
|
||||||
int regb;
|
int regb;
|
||||||
int i;
|
int i;
|
||||||
static int controller = 0;
|
static int controller = 0;
|
||||||
|
int cs5536 = 0;
|
||||||
|
int nports = 2;
|
||||||
|
|
||||||
/* Read class. */
|
/* Read class. */
|
||||||
addr = grub_pci_make_address (bus, device, func, 2);
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||||
class = grub_pci_read (addr);
|
class = grub_pci_read (addr);
|
||||||
|
|
||||||
|
/* AMD CS5536 Southbridge. */
|
||||||
|
if (pciid == 0x208f1022)
|
||||||
|
{
|
||||||
|
cs5536 = 1;
|
||||||
|
nports = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if this class ID matches that of a PCI IDE Controller. */
|
/* Check if this class ID matches that of a PCI IDE Controller. */
|
||||||
if (class >> 16 != 0x0101)
|
if (!cs5536 && (class >> 16 != 0x0101))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < nports; i++)
|
||||||
{
|
{
|
||||||
/* Set to 0 when the channel operated in compatibility mode. */
|
/* Set to 0 when the channel operated in compatibility mode. */
|
||||||
int compat = (class >> (8 + 2 * i)) & 1;
|
int compat;
|
||||||
|
|
||||||
|
/* We don't support non-compatibility mode for CS5536. */
|
||||||
|
if (cs5536)
|
||||||
|
compat = 0;
|
||||||
|
else
|
||||||
|
compat = (class >> (8 + 2 * i)) & 1;
|
||||||
|
|
||||||
rega = 0;
|
rega = 0;
|
||||||
regb = 0;
|
regb = 0;
|
||||||
|
@ -429,9 +444,12 @@ grub_ata_pciinit (int bus, int device, int func,
|
||||||
{
|
{
|
||||||
/* Read the BARs, which either contain a mmapped IO address
|
/* Read the BARs, which either contain a mmapped IO address
|
||||||
or the IO port address. */
|
or the IO port address. */
|
||||||
addr = grub_pci_make_address (bus, device, func, 4 + 2 * i);
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESSES
|
||||||
|
+ sizeof (grub_uint64_t) * i);
|
||||||
bar1 = grub_pci_read (addr);
|
bar1 = grub_pci_read (addr);
|
||||||
addr = grub_pci_make_address (bus, device, func, 5 + 2 * i);
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESSES
|
||||||
|
+ sizeof (grub_uint64_t) * i
|
||||||
|
+ sizeof (grub_uint32_t));
|
||||||
bar2 = grub_pci_read (addr);
|
bar2 = grub_pci_read (addr);
|
||||||
|
|
||||||
/* Check if the BARs describe an IO region. */
|
/* Check if the BARs describe an IO region. */
|
||||||
|
@ -444,7 +462,8 @@ grub_ata_pciinit (int bus, int device, int func,
|
||||||
|
|
||||||
grub_dprintf ("ata",
|
grub_dprintf ("ata",
|
||||||
"PCI dev (%d,%d,%d) compat=%d rega=0x%x regb=0x%x\n",
|
"PCI dev (%d,%d,%d) compat=%d rega=0x%x regb=0x%x\n",
|
||||||
bus, device, func, compat, rega, regb);
|
grub_pci_get_bus (dev), grub_pci_get_device (dev),
|
||||||
|
grub_pci_get_function (dev), compat, rega, regb);
|
||||||
|
|
||||||
if (rega && regb)
|
if (rega && regb)
|
||||||
{
|
{
|
||||||
|
@ -484,7 +503,6 @@ grub_ata_initialize (void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
grub_ata_setlba (struct grub_ata_device *dev, grub_disk_addr_t sector,
|
grub_ata_setlba (struct grub_ata_device *dev, grub_disk_addr_t sector,
|
||||||
grub_size_t size)
|
grub_size_t size)
|
||||||
|
@ -519,7 +537,7 @@ grub_ata_setaddress (struct grub_ata_device *dev,
|
||||||
|| cylinder > dev->cylinders
|
|| cylinder > dev->cylinders
|
||||||
|| head > dev->heads)
|
|| head > dev->heads)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||||
"sector %d can not be addressed "
|
"sector %d cannot be addressed "
|
||||||
"using CHS addressing", sector);
|
"using CHS addressing", sector);
|
||||||
|
|
||||||
grub_ata_regset (dev, GRUB_ATA_REG_DISK, (dev->device << 4) | head);
|
grub_ata_regset (dev, GRUB_ATA_REG_DISK, (dev->device << 4) | head);
|
||||||
|
@ -647,12 +665,14 @@ grub_ata_iterate (int (*hook) (const char *name))
|
||||||
|
|
||||||
for (dev = grub_ata_devices; dev; dev = dev->next)
|
for (dev = grub_ata_devices; dev; dev = dev->next)
|
||||||
{
|
{
|
||||||
char devname[5];
|
char devname[10];
|
||||||
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
|
|
||||||
|
|
||||||
if (dev->atapi)
|
if (dev->atapi)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
grub_snprintf (devname, sizeof (devname),
|
||||||
|
"ata%d", dev->port * 2 + dev->device);
|
||||||
|
|
||||||
if (hook (devname))
|
if (hook (devname))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -667,14 +687,15 @@ grub_ata_open (const char *name, grub_disk_t disk)
|
||||||
|
|
||||||
for (dev = grub_ata_devices; dev; dev = dev->next)
|
for (dev = grub_ata_devices; dev; dev = dev->next)
|
||||||
{
|
{
|
||||||
char devname[5];
|
char devname[10];
|
||||||
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
|
grub_snprintf (devname, sizeof (devname),
|
||||||
|
"ata%d", dev->port * 2 + dev->device);
|
||||||
if (grub_strcmp (name, devname) == 0)
|
if (grub_strcmp (name, devname) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! dev)
|
if (! dev)
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
|
||||||
|
|
||||||
if (dev->atapi)
|
if (dev->atapi)
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not an ATA harddisk");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not an ATA harddisk");
|
||||||
|
@ -734,8 +755,9 @@ grub_atapi_iterate (int (*hook) (const char *name, int luns))
|
||||||
|
|
||||||
for (dev = grub_ata_devices; dev; dev = dev->next)
|
for (dev = grub_ata_devices; dev; dev = dev->next)
|
||||||
{
|
{
|
||||||
char devname[7];
|
char devname[10];
|
||||||
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
|
grub_snprintf (devname, sizeof (devname),
|
||||||
|
"ata%d", dev->port * 2 + dev->device);
|
||||||
|
|
||||||
if (! dev->atapi)
|
if (! dev->atapi)
|
||||||
continue;
|
continue;
|
||||||
|
@ -774,7 +796,7 @@ grub_atapi_read (struct grub_scsi *scsi,
|
||||||
|
|
||||||
/* Count of last transfer may be uneven. */
|
/* Count of last transfer may be uneven. */
|
||||||
if (! (0 < cnt && cnt <= size - nread && (! (cnt & 1) || cnt == size - nread)))
|
if (! (0 < cnt && cnt <= size - nread && (! (cnt & 1) || cnt == size - nread)))
|
||||||
return grub_error (GRUB_ERR_READ_ERROR, "Invalid ATAPI transfer count");
|
return grub_error (GRUB_ERR_READ_ERROR, "invalid ATAPI transfer count");
|
||||||
|
|
||||||
/* Read the data. */
|
/* Read the data. */
|
||||||
grub_ata_pio_read (dev, buf + nread, cnt);
|
grub_ata_pio_read (dev, buf + nread, cnt);
|
||||||
|
@ -807,8 +829,9 @@ grub_atapi_open (const char *name, struct grub_scsi *scsi)
|
||||||
|
|
||||||
for (dev = grub_ata_devices; dev; dev = dev->next)
|
for (dev = grub_ata_devices; dev; dev = dev->next)
|
||||||
{
|
{
|
||||||
char devname[7];
|
char devname[10];
|
||||||
grub_sprintf (devname, "ata%d", dev->port * 2 + dev->device);
|
grub_snprintf (devname, sizeof (devname),
|
||||||
|
"ata%d", dev->port * 2 + dev->device);
|
||||||
|
|
||||||
if (!grub_strcmp (devname, name))
|
if (!grub_strcmp (devname, name))
|
||||||
{
|
{
|
||||||
|
@ -820,7 +843,7 @@ grub_atapi_open (const char *name, struct grub_scsi *scsi)
|
||||||
grub_dprintf ("ata", "opening ATAPI dev `%s'\n", name);
|
grub_dprintf ("ata", "opening ATAPI dev `%s'\n", name);
|
||||||
|
|
||||||
if (! devfnd)
|
if (! devfnd)
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "No such ATAPI device");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no such ATAPI device");
|
||||||
|
|
||||||
scsi->data = devfnd;
|
scsi->data = devfnd;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ grub_ata_pass_through (grub_disk_t disk,
|
||||||
{
|
{
|
||||||
if (disk->dev->id != GRUB_DISK_DEVICE_ATA_ID)
|
if (disk->dev->id != GRUB_DISK_DEVICE_ATA_ID)
|
||||||
return grub_error (GRUB_ERR_BAD_DEVICE,
|
return grub_error (GRUB_ERR_BAD_DEVICE,
|
||||||
"Device not accessed via ata.mod");
|
"device not accessed via ata.mod");
|
||||||
|
|
||||||
struct grub_ata_device *dev = (struct grub_ata_device *) disk->data;
|
struct grub_ata_device *dev = (struct grub_ata_device *) disk->data;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* dmraid_nvidia.c - module to handle Nvidia fakeraid. */
|
/* dmraid_nvidia.c - module to handle Nvidia fakeraid. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
|
* Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -107,7 +107,7 @@ grub_dmraid_nv_detect (grub_disk_t disk, struct grub_raid_array *array)
|
||||||
|
|
||||||
if (sb.version != NV_VERSION)
|
if (sb.version != NV_VERSION)
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
"Unknown version: %d.%d", sb.version);
|
"unknown version: %d.%d", sb.version);
|
||||||
|
|
||||||
switch (sb.array.raid_level)
|
switch (sb.array.raid_level)
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ grub_dmraid_nv_detect (grub_disk_t disk, struct grub_raid_array *array)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||||
"Unsupported RAID level: %d", sb.array.raid_level);
|
"unsupported RAID level: %d", sb.array.raid_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
array->number = 0;
|
array->number = 0;
|
||||||
|
|
|
@ -440,7 +440,7 @@ grub_efidisk_iterate (int (*hook) (const char *name))
|
||||||
|
|
||||||
for (d = fd_devices, count = 0; d; d = d->next, count++)
|
for (d = fd_devices, count = 0; d; d = d->next, count++)
|
||||||
{
|
{
|
||||||
grub_sprintf (buf, "fd%d", count);
|
grub_snprintf (buf, sizeof (buf), "fd%d", count);
|
||||||
grub_dprintf ("efidisk", "iterating %s\n", buf);
|
grub_dprintf ("efidisk", "iterating %s\n", buf);
|
||||||
if (hook (buf))
|
if (hook (buf))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -448,7 +448,7 @@ grub_efidisk_iterate (int (*hook) (const char *name))
|
||||||
|
|
||||||
for (d = hd_devices, count = 0; d; d = d->next, count++)
|
for (d = hd_devices, count = 0; d; d = d->next, count++)
|
||||||
{
|
{
|
||||||
grub_sprintf (buf, "hd%d", count);
|
grub_snprintf (buf, sizeof (buf), "hd%d", count);
|
||||||
grub_dprintf ("efidisk", "iterating %s\n", buf);
|
grub_dprintf ("efidisk", "iterating %s\n", buf);
|
||||||
if (hook (buf))
|
if (hook (buf))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -456,7 +456,7 @@ grub_efidisk_iterate (int (*hook) (const char *name))
|
||||||
|
|
||||||
for (d = cd_devices, count = 0; d; d = d->next, count++)
|
for (d = cd_devices, count = 0; d; d = d->next, count++)
|
||||||
{
|
{
|
||||||
grub_sprintf (buf, "cd%d", count);
|
grub_snprintf (buf, sizeof (buf), "cd%d", count);
|
||||||
grub_dprintf ("efidisk", "iterating %s\n", buf);
|
grub_dprintf ("efidisk", "iterating %s\n", buf);
|
||||||
if (hook (buf))
|
if (hook (buf))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -805,18 +805,10 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
device_name = grub_malloc (grub_strlen (parent->name) + 1
|
device_name = grub_xasprintf ("%s,%s", parent->name, partition_name);
|
||||||
+ grub_strlen (partition_name) + 1);
|
|
||||||
if (! device_name)
|
|
||||||
{
|
|
||||||
grub_free (partition_name);
|
|
||||||
grub_disk_close (parent);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_sprintf (device_name, "%s,%s", parent->name, partition_name);
|
|
||||||
grub_free (partition_name);
|
grub_free (partition_name);
|
||||||
grub_disk_close (parent);
|
grub_disk_close (parent);
|
||||||
|
|
||||||
return device_name;
|
return device_name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -833,7 +825,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
|
||||||
if (! disk)
|
if (! disk)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (disk->id == GRUB_DISK_DEVICE_EFIDISK_ID)
|
if (disk->dev->id == GRUB_DISK_DEVICE_EFIDISK_ID)
|
||||||
{
|
{
|
||||||
struct grub_efidisk_data *d;
|
struct grub_efidisk_data *d;
|
||||||
|
|
||||||
|
|
136
disk/fs_file.c
136
disk/fs_file.c
|
@ -1,136 +0,0 @@
|
||||||
/* fs_file.c - Access partition by a file it contains. */
|
|
||||||
/*
|
|
||||||
* 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/disk.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/partition.h>
|
|
||||||
|
|
||||||
static grub_device_t
|
|
||||||
search_fs_file (const char *key, unsigned long *count)
|
|
||||||
{
|
|
||||||
char *filename = NULL;
|
|
||||||
grub_device_t ret = NULL;
|
|
||||||
*count = 0;
|
|
||||||
|
|
||||||
auto int iterate_device (const char *name);
|
|
||||||
int iterate_device (const char *name)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
grub_file_t file;
|
|
||||||
|
|
||||||
(*count)++;
|
|
||||||
|
|
||||||
len = grub_strlen (name) + 2 + grub_strlen (key) + 1;
|
|
||||||
filename = grub_realloc (filename, len);
|
|
||||||
if (! filename)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
grub_sprintf (filename, "(%s)%s", name, key);
|
|
||||||
file = grub_file_open (filename);
|
|
||||||
if (file)
|
|
||||||
{
|
|
||||||
grub_file_close (file);
|
|
||||||
ret = grub_device_open (name);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_device_iterate (iterate_device);
|
|
||||||
grub_free (filename);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_fs_file_open (const char *name, grub_disk_t disk)
|
|
||||||
{
|
|
||||||
grub_device_t dev;
|
|
||||||
|
|
||||||
if (grub_strncmp (name, "FILE=", sizeof ("FILE=") - 1))
|
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a FILE virtual volume");
|
|
||||||
|
|
||||||
dev = search_fs_file (name + sizeof ("FILE=") - 1, &disk->id);
|
|
||||||
if (! dev)
|
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching file found");
|
|
||||||
|
|
||||||
disk->total_sectors = dev->disk->total_sectors;
|
|
||||||
disk->has_partitions = 0;
|
|
||||||
if (dev->disk->partition)
|
|
||||||
{
|
|
||||||
disk->partition = grub_malloc (sizeof (*disk->partition));
|
|
||||||
if (disk->partition)
|
|
||||||
grub_memcpy (disk->partition, dev->disk->partition,
|
|
||||||
sizeof (*disk->partition));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
disk->partition = NULL;
|
|
||||||
|
|
||||||
disk->data = dev;
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_fs_file_close (grub_disk_t disk)
|
|
||||||
{
|
|
||||||
grub_device_t parent = disk->data;
|
|
||||||
grub_device_close (parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_fs_file_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|
||||||
grub_size_t size, char *buf)
|
|
||||||
{
|
|
||||||
grub_device_t parent = disk->data;
|
|
||||||
return parent->disk->dev->read (parent->disk, sector, size, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_fs_file_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|
||||||
grub_size_t size, const char *buf)
|
|
||||||
{
|
|
||||||
grub_device_t parent = disk->data;
|
|
||||||
return parent->disk->dev->write (parent->disk, sector, size, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct grub_disk_dev grub_fs_file_dev = {
|
|
||||||
.name = "fs_file",
|
|
||||||
.id = GRUB_DISK_DEVICE_FILE_ID,
|
|
||||||
.open = grub_fs_file_open,
|
|
||||||
.close = grub_fs_file_close,
|
|
||||||
.read = grub_fs_file_read,
|
|
||||||
.write = grub_fs_file_write,
|
|
||||||
.next = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
GRUB_MOD_INIT (fs_file)
|
|
||||||
{
|
|
||||||
grub_disk_dev_register (&grub_fs_file_dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI (fs_file)
|
|
||||||
{
|
|
||||||
grub_disk_dev_unregister (&grub_fs_file_dev);
|
|
||||||
}
|
|
149
disk/fs_uuid.c
149
disk/fs_uuid.c
|
@ -1,149 +0,0 @@
|
||||||
/* fs_uuid.c - Access disks by their filesystem UUID. */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2007,2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/kernel.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/mm.h>
|
|
||||||
#include <grub/types.h>
|
|
||||||
|
|
||||||
#include <grub/fs.h>
|
|
||||||
#include <grub/partition.h>
|
|
||||||
|
|
||||||
static grub_device_t
|
|
||||||
search_fs_uuid (const char *key, unsigned long *count)
|
|
||||||
{
|
|
||||||
*count = 0;
|
|
||||||
grub_device_t ret = NULL;
|
|
||||||
|
|
||||||
auto int iterate_device (const char *name);
|
|
||||||
int iterate_device (const char *name)
|
|
||||||
{
|
|
||||||
grub_device_t dev;
|
|
||||||
|
|
||||||
dev = grub_device_open (name);
|
|
||||||
if (dev)
|
|
||||||
{
|
|
||||||
grub_fs_t fs;
|
|
||||||
|
|
||||||
fs = grub_fs_probe (dev);
|
|
||||||
if (fs && fs->uuid)
|
|
||||||
{
|
|
||||||
char *uuid;
|
|
||||||
|
|
||||||
(fs->uuid) (dev, &uuid);
|
|
||||||
if (grub_errno == GRUB_ERR_NONE && uuid)
|
|
||||||
{
|
|
||||||
(*count)++;
|
|
||||||
|
|
||||||
if (grub_strcasecmp (uuid, key) == 0)
|
|
||||||
{
|
|
||||||
ret = dev;
|
|
||||||
grub_free (uuid);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
grub_free (uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_device_close (dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_errno = GRUB_ERR_NONE;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_device_iterate (iterate_device);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_fs_uuid_open (const char *name, grub_disk_t disk)
|
|
||||||
{
|
|
||||||
grub_device_t dev;
|
|
||||||
|
|
||||||
if (grub_strncmp (name, "UUID=", sizeof ("UUID=")-1))
|
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a UUID virtual volume");
|
|
||||||
|
|
||||||
dev = search_fs_uuid (name + sizeof ("UUID=") - 1, &disk->id);
|
|
||||||
if (! dev)
|
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching UUID found");
|
|
||||||
|
|
||||||
disk->total_sectors = dev->disk->total_sectors;
|
|
||||||
disk->has_partitions = 0;
|
|
||||||
if (dev->disk->partition)
|
|
||||||
{
|
|
||||||
disk->partition = grub_malloc (sizeof (*disk->partition));
|
|
||||||
if (disk->partition)
|
|
||||||
grub_memcpy (disk->partition, dev->disk->partition,
|
|
||||||
sizeof (*disk->partition));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
disk->partition = NULL;
|
|
||||||
|
|
||||||
disk->data = dev;
|
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
grub_fs_uuid_close (grub_disk_t disk __attribute((unused)))
|
|
||||||
{
|
|
||||||
grub_device_t parent = disk->data;
|
|
||||||
grub_device_close (parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_fs_uuid_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|
||||||
grub_size_t size, char *buf)
|
|
||||||
{
|
|
||||||
grub_device_t parent = disk->data;
|
|
||||||
return parent->disk->dev->read (parent->disk, sector, size, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_fs_uuid_write (grub_disk_t disk, grub_disk_addr_t sector,
|
|
||||||
grub_size_t size, const char *buf)
|
|
||||||
{
|
|
||||||
grub_device_t parent = disk->data;
|
|
||||||
return parent->disk->dev->write (parent->disk, sector, size, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct grub_disk_dev grub_fs_uuid_dev =
|
|
||||||
{
|
|
||||||
.name = "fs_uuid",
|
|
||||||
.id = GRUB_DISK_DEVICE_UUID_ID,
|
|
||||||
.open = grub_fs_uuid_open,
|
|
||||||
.close = grub_fs_uuid_close,
|
|
||||||
.read = grub_fs_uuid_read,
|
|
||||||
.write = grub_fs_uuid_write,
|
|
||||||
.next = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(fs_uuid)
|
|
||||||
{
|
|
||||||
grub_disk_dev_register (&grub_fs_uuid_dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(fs_uuid)
|
|
||||||
{
|
|
||||||
grub_disk_dev_unregister (&grub_fs_uuid_dev);
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
|
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -56,7 +56,8 @@ grub_biosdisk_call_hook (int (*hook) (const char *name), int drive)
|
||||||
{
|
{
|
||||||
char name[10];
|
char name[10];
|
||||||
|
|
||||||
grub_sprintf (name, (drive & 0x80) ? "hd%d" : "fd%d", drive & (~0x80));
|
grub_snprintf (name, sizeof (name),
|
||||||
|
(drive & 0x80) ? "hd%d" : "fd%d", drive & (~0x80));
|
||||||
return hook (name);
|
return hook (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +170,7 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grub_free (data);
|
grub_free (data);
|
||||||
return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get C/H/S values");
|
return grub_error (GRUB_ERR_BAD_DEVICE, "%s cannot get C/H/S values", disk->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +223,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
||||||
if (cmd)
|
if (cmd)
|
||||||
return grub_error (GRUB_ERR_WRITE_ERROR, "can\'t write to cdrom");
|
return grub_error (GRUB_ERR_WRITE_ERROR, "can\'t write to cdrom");
|
||||||
|
|
||||||
dap->blocks = (dap->blocks + 3) >> 2;
|
dap->blocks = ALIGN_UP (dap->blocks, 4) >> 2;
|
||||||
dap->block >>= 2;
|
dap->block >>= 2;
|
||||||
|
|
||||||
for (i = 0; i < GRUB_BIOSDISK_CDROM_RETRY_COUNT; i++)
|
for (i = 0; i < GRUB_BIOSDISK_CDROM_RETRY_COUNT; i++)
|
||||||
|
@ -252,7 +253,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
||||||
1024 /* cylinders */ *
|
1024 /* cylinders */ *
|
||||||
256 /* heads */ *
|
256 /* heads */ *
|
||||||
63 /* spt */)
|
63 /* spt */)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk");
|
return grub_error (GRUB_ERR_OUT_OF_RANGE, "%s out of disk", disk->name);
|
||||||
|
|
||||||
soff = ((grub_uint32_t) sector) % data->sectors + 1;
|
soff = ((grub_uint32_t) sector) % data->sectors + 1;
|
||||||
head = ((grub_uint32_t) sector) / data->sectors;
|
head = ((grub_uint32_t) sector) / data->sectors;
|
||||||
|
@ -260,7 +261,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
||||||
coff = head / data->heads;
|
coff = head / data->heads;
|
||||||
|
|
||||||
if (coff >= data->cylinders)
|
if (coff >= data->cylinders)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk");
|
return grub_error (GRUB_ERR_OUT_OF_RANGE, "%s out of disk", disk->name);
|
||||||
|
|
||||||
if (grub_biosdisk_rw_standard (cmd + 0x02, data->drive,
|
if (grub_biosdisk_rw_standard (cmd + 0x02, data->drive,
|
||||||
coff, hoff, soff, size, segment))
|
coff, hoff, soff, size, segment))
|
||||||
|
@ -268,9 +269,9 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk,
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case GRUB_BIOSDISK_READ:
|
case GRUB_BIOSDISK_READ:
|
||||||
return grub_error (GRUB_ERR_READ_ERROR, "biosdisk read error");
|
return grub_error (GRUB_ERR_READ_ERROR, "%s read error", disk->name);
|
||||||
case GRUB_BIOSDISK_WRITE:
|
case GRUB_BIOSDISK_WRITE:
|
||||||
return grub_error (GRUB_ERR_WRITE_ERROR, "biosdisk write error");
|
return grub_error (GRUB_ERR_WRITE_ERROR, "%s write error", disk->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,8 +307,17 @@ grub_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
while (size)
|
while (size)
|
||||||
{
|
{
|
||||||
grub_size_t len;
|
grub_size_t len;
|
||||||
|
grub_size_t cdoff = 0;
|
||||||
|
|
||||||
len = get_safe_sectors (sector, data->sectors);
|
len = get_safe_sectors (sector, data->sectors);
|
||||||
|
|
||||||
|
if (data->flags & GRUB_BIOSDISK_FLAG_CDROM)
|
||||||
|
{
|
||||||
|
cdoff = (sector & 3) << GRUB_DISK_SECTOR_BITS;
|
||||||
|
len = ALIGN_UP (sector + len, 4) - (sector & ~3);
|
||||||
|
sector &= ~3;
|
||||||
|
}
|
||||||
|
|
||||||
if (len > size)
|
if (len > size)
|
||||||
len = size;
|
len = size;
|
||||||
|
|
||||||
|
@ -315,7 +325,7 @@ grub_biosdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
GRUB_MEMORY_MACHINE_SCRATCH_SEG))
|
GRUB_MEMORY_MACHINE_SCRATCH_SEG))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
grub_memcpy (buf, (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR,
|
grub_memcpy (buf, (void *) (GRUB_MEMORY_MACHINE_SCRATCH_ADDR + cdoff),
|
||||||
len << GRUB_DISK_SECTOR_BITS);
|
len << GRUB_DISK_SECTOR_BITS);
|
||||||
buf += len << GRUB_DISK_SECTOR_BITS;
|
buf += len << GRUB_DISK_SECTOR_BITS;
|
||||||
sector += len;
|
sector += len;
|
||||||
|
@ -331,6 +341,9 @@ grub_biosdisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
{
|
{
|
||||||
struct grub_biosdisk_data *data = disk->data;
|
struct grub_biosdisk_data *data = disk->data;
|
||||||
|
|
||||||
|
if (data->flags & GRUB_BIOSDISK_FLAG_CDROM)
|
||||||
|
return grub_error (GRUB_ERR_IO, "can't write to CDROM");
|
||||||
|
|
||||||
while (size)
|
while (size)
|
||||||
{
|
{
|
||||||
grub_size_t len;
|
grub_size_t len;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* nand.c - NAND flash disk access. */
|
/* nand.c - NAND flash disk access. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -67,7 +67,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
|
||||||
} args;
|
} args;
|
||||||
|
|
||||||
if (! grub_strstr (name, "nand"))
|
if (! grub_strstr (name, "nand"))
|
||||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Not a nand device");
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a NAND device");
|
||||||
|
|
||||||
data = grub_malloc (sizeof (*data));
|
data = grub_malloc (sizeof (*data));
|
||||||
if (! data)
|
if (! data)
|
||||||
|
@ -76,7 +76,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
|
||||||
grub_ieee1275_open (name, &dev_ihandle);
|
grub_ieee1275_open (name, &dev_ihandle);
|
||||||
if (! dev_ihandle)
|
if (! dev_ihandle)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
|
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
|
||||||
|
|
||||||
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
|
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't get block size");
|
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't get block size");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ grub_nand_open (const char *name, grub_disk_t disk)
|
||||||
|
|
||||||
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
|
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't get disk size");
|
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't get disk size");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ grub_nand_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
args.result = 1;
|
args.result = 1;
|
||||||
|
|
||||||
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
|
if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.result))
|
||||||
return grub_error (GRUB_ERR_READ_ERROR, "Read error");
|
return grub_error (GRUB_ERR_READ_ERROR, "read error");
|
||||||
|
|
||||||
ofs = 0;
|
ofs = 0;
|
||||||
size -= len;
|
size -= len;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue