From 725396942e6929567f786234f0a95e7390d45f19 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 4 May 2010 09:47:48 +0530 Subject: [PATCH 001/174] replace --enable-grub-emu-modules with grub-emu-lite --- Makefile.in | 14 ++------- commands/parttool.c | 3 +- conf/any-emu.rmk | 38 ++++++++++++------------- configure.ac | 63 ++++++++++++++--------------------------- genmk.rb | 8 ------ include/grub/dl.h | 11 ++----- include/grub/emu/misc.h | 1 + include/grub/misc.h | 3 ++ kern/emu/main.c | 36 ++--------------------- kern/main.c | 2 ++ normal/main.c | 11 ++++--- util/misc.c | 4 +-- 12 files changed, 63 insertions(+), 131 deletions(-) diff --git a/Makefile.in b/Makefile.in index 822a08797..513deb516 100644 --- a/Makefile.in +++ b/Makefile.in @@ -44,7 +44,6 @@ pkglibdir = $(libdir)/`echo @PACKAGE_TARNAME@/$(target_cpu)-$(platform) | sed ' # Internationalization library. LIBINTL = @LIBINTL@ -TARGET_NO_MODULES = @TARGET_NO_MODULES@ # Util library. LIBUTIL = @LIBUTIL@ @@ -187,17 +186,10 @@ include $(srcdir)/conf/tests.mk -include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk) endif -ifeq ($(TARGET_NO_MODULES), yes) - TARGET_CFLAGS += -DGRUB_TARGET_NO_MODULES=1 - CFLAGS += -DGRUB_TARGET_NO_MODULES=1 -endif - ### General targets. CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo -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 cat $(DEFSYMFILES) /dev/null \ | $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \ @@ -298,7 +290,7 @@ build_env.mk: Makefile ) > $@ pkglib_BUILDDIR += config.h grub_script.tab.h -all-local: $(PROGRAMS) $(GRUB_EMU) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES) $(foreach lang, $(LINGUAS), po/$(lang).mo) +all-local: $(PROGRAMS) $(GRUB_EMU) $(GRUB_EMU_LITE) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES) $(foreach lang, $(LINGUAS), po/$(lang).mo) install: install-local @@ -319,7 +311,7 @@ install-local: all $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkgdatadir)/$$dest; \ done $(SHELL) $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 - @list='$(bin_UTILITIES) $(GRUB_EMU)'; for file in $$list; do \ + @list='$(bin_UTILITIES) $(GRUB_EMU) $(GRUB_EMU_LITE)'; for file in $$list; do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \ @@ -395,7 +387,7 @@ uninstall: dest="`echo $$file | sed 's,.*/,,'`"; \ rm -f $(DESTDIR)$(pkgdatadir)/$$dest; \ done - @list='$(bin_UTILITIES) $(bin_SCRIPTS) $(GRUB_EMU)'; for file in $$list; do \ + @list='$(bin_UTILITIES) $(bin_SCRIPTS) $(GRUB_EMU) $(GRUB_EMU_LITE)'; for file in $$list; do \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ rm -f $(DESTDIR)$(bindir)/$$dest; \ rm -f $(DESTDIR)$(mandir)/man1/$$dest.1; \ diff --git a/commands/parttool.c b/commands/parttool.c index 528cf43d7..f2a62e581 100644 --- a/commands/parttool.c +++ b/commands/parttool.c @@ -175,7 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), } /* Load modules. */ -#if !GRUB_NO_MODULES + if (! grub_no_autoload) { const char *prefix; prefix = grub_env_get ("prefix"); @@ -233,7 +233,6 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), /* Ignore errors. */ grub_errno = GRUB_ERR_NONE; } -#endif if (argc == 1) return show_help (); diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk index cb0ec873f..4e940181b 100644 --- a/conf/any-emu.rmk +++ b/conf/any-emu.rmk @@ -20,16 +20,13 @@ kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-undef -I$(srcdir)/g kernel_img_LDFLAGS = $(COMMON_LDFLAGS) TARGET_NO_STRIP = yes -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 +noinst_MODULES = emu-full.mod +emu_full_mod_SOURCES = kern/emu/full.c +emu_full_mod_CFLAGS = $(COMMON_CFLAGS) + +noinst_MODULES = emu-lite.mod +emu_lite_mod_SOURCES = kern/emu/lite.c kern/emu/cache.S symlist.c +emu_lite_mod_CFLAGS = $(COMMON_CFLAGS) # For halt.mod. pkglib_MODULES += halt.mod @@ -102,13 +99,16 @@ grub_emu_init.c: genemuinit.sh $(pkglib_MODULES) grub_emu_init.h rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinit.sh $(NM) > $@ DISTCLEANFILES += grub_emu_init.c -CLEANFILES += grub-emu -ifneq ($(TARGET_NO_MODULES), yes) -grub-emu: $(pkglib_PROGRAMS) - $(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS) -else -grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS) - $(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS) -endif -GRUB_EMU=grub-emu +grub_emu_init.o: grub_emu_init.c grub_emu_init.h + rm -f $@; $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"grub_init.c\" -c -o $@ $< +CLEANFILES += grub_emu_init.o +CLEANFILES += grub-emu-lite +grub-emu-lite: $(pkglib_PROGRAMS) emu-lite.mod + $(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS) +GRUB_EMU_LITE=grub-emu-lite + +CLEANFILES += grub-emu +grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS) emu-full.mod grub_emu_init.o + $(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS) +GRUB_EMU=grub-emu diff --git a/configure.ac b/configure.ac index 4e1dd41d8..9462b32a3 100644 --- a/configure.ac +++ b/configure.ac @@ -54,14 +54,12 @@ case "$target_cpu" in amd64) target_cpu=x86_64 ;; sparc) target_cpu=sparc64 ;; mipsel|mips64el) - target_cpu=mips; - TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPSEL=1"; - CFLAGS="$CFLAGS -DGRUB_CPU_MIPSEL=1"; + target_cpu=mips; + cpu_CPPFLAGS="-DGRUB_CPU_MIPSEL=1"; ;; mips|mips64) - target_cpu=mips; - TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPS=1"; - CFLAGS="$CFLAGS -DGRUB_CPU_MIPS=1"; + target_cpu=mips; + cpu_CPPFLAGS="-DGRUB_CPU_MIPS=1"; ;; esac @@ -136,24 +134,27 @@ case "$host_os" in esac case "$platform" in - coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; - multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;; - efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;; - ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; - qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;; - pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; - emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;; - 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" ;; + coreboot) machine_CPPFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; + multiboot) machine_CPPFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;; + efi) machine_CPPFLAGS="-DGRUB_MACHINE_EFI=1" ;; + ieee1275) machine_CPPFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; + qemu) machine_CPPFLAGS="-DGRUB_MACHINE_QEMU=1" ;; + pc) machine_CPPFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; + emu) machine_CPPFLAGS="-DGRUB_MACHINE_EMU=1" ;; + yeeloong) machine_CPPFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; + qemu-mips) machine_CPPFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; esac case "$target_cpu" in - mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;; - sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;; + i386) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_I386";; + x86_64) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_X86_64";; + powerpc) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_POWERPC";; + mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;; # cpu_CPPFLAGS handled above + sparc64) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_SPARC64"; + machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;; esac -CFLAGS="$CFLAGS $machine_CFLAGS" -TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS" -TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS" +CPPFLAGS="$CPPFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" +TARGET_CFLAGS="$TARGET_CFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" AC_SUBST(host_cpu) AC_SUBST(host_os) @@ -608,10 +609,6 @@ 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 missing_ncurses= [# Check for curses libraries.] @@ -630,19 +627,6 @@ if test x"$missing_ncurses" = xtrue ; then AC_MSG_ERROR([grub-emu can't be compiled without ncurses]) fi -if test x"$enable_grub_emu_modules" = xyes ; then - TARGET_NO_MODULES=no -else - TARGET_NO_MODULES=yes -fi -AC_SUBST(TARGET_NO_MODULES) - -if test "$TARGET_NO_MODULES" = yes ; then - # Do not convert modules, otherwise linkage may fail (Cygwin only). - # FIXME: Should be checked above before TARGET_OBJ2ELF is set first. - TARGET_OBJ2ELF= -fi - if test x"$enable_grub_emu_usb" = xno ; then grub_emu_usb_excuse="explicitly disabled" fi @@ -820,11 +804,6 @@ 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 if [ x"$enable_mm_debug" = xyes ]; then echo With memory debugging: Yes diff --git a/genmk.rb b/genmk.rb index e62dbd4f6..6b5ecd1d4 100644 --- a/genmk.rb +++ b/genmk.rb @@ -143,13 +143,6 @@ mostlyclean-module-#{@name}.#{@rule_count}: MOSTLYCLEAN_MODULE_TARGETS += mostlyclean-module-#{@name}.#{@rule_count} UNDSYMFILES += #{undsym} -ifeq ($(TARGET_NO_MODULES), yes) -#{@name}: #{pre_obj} $(TARGET_OBJ2ELF) - -rm -f $@ - $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} - if test ! -z \"$(TARGET_OBJ2ELF)\"; then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi - if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; fi -else ifneq ($(TARGET_APPLE_CC),1) #{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF) -rm -f $@ @@ -164,7 +157,6 @@ else $(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -ew2030 -ew2050 -nu -nd $@.bin $@ -rm -f $@.bin endif -endif #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str} -rm -f $@ diff --git a/include/grub/dl.h b/include/grub/dl.h index cf5da7fd5..fde2e3163 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -91,22 +91,17 @@ grub_dl_t grub_dl_load_core (void *addr, grub_size_t size); int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod); void grub_dl_unload_unneeded (void); void grub_dl_unload_all (void); -#if defined (GRUB_UTIL) || defined (GRUB_TARGET_NO_MODULES) -#define GRUB_NO_MODULES 1 -#else -#define GRUB_NO_MODULES 0 -#endif int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod); int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod); void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod)); grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name); -grub_err_t grub_dl_register_symbol (const char *name, void *addr, - grub_dl_t mod); +grub_err_t EXPORT_FUNC(grub_dl_register_symbol) (const char *name, void *addr, + grub_dl_t mod); grub_err_t grub_arch_dl_check_header (void *ehdr); grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr); -#if defined (_mips) && ! GRUB_NO_MODULES +#if defined (_mips) && ! GRUB_MACHINE_EMU #define GRUB_LINKER_HAVE_INIT 1 void grub_arch_dl_init_linker (void); #endif diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index 146e64aa9..6d7fd8820 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -16,6 +16,7 @@ extern int verbosity; extern const char *program_name; +void grub_emu_init (void); void grub_init_all (void); void grub_fini_all (void); diff --git a/include/grub/misc.h b/include/grub/misc.h index 9bfc6974e..1ec8bbc5a 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -50,6 +50,9 @@ /* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */ #define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n)) +/* Flag to control module autoloading in normal mode. */ +extern int EXPORT_VAR(grub_no_autoload); + void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n); char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src); char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c); diff --git a/kern/emu/main.c b/kern/emu/main.c index fb5dbf19f..8d6118c93 100644 --- a/kern/emu/main.c +++ b/kern/emu/main.c @@ -57,25 +57,6 @@ grub_arch_modules_addr (void) return 0; } -#if GRUB_NO_MODULES -grub_err_t -grub_arch_dl_check_header (void *ehdr) -{ - (void) ehdr; - - return GRUB_ERR_BAD_MODULE; -} - -grub_err_t -grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) -{ - (void) mod; - (void) ehdr; - - return GRUB_ERR_BAD_MODULE; -} -#endif - void grub_reboot (void) { @@ -154,10 +135,7 @@ void grub_hostfs_init (void); void grub_hostfs_fini (void); void grub_host_init (void); void grub_host_fini (void); -#if GRUB_NO_MODULES -void grub_init_all (void); -void grub_fini_all (void); -#endif +void grub_emu_init (void); int main (int argc, char *argv[]) @@ -216,6 +194,7 @@ main (int argc, char *argv[]) } signal (SIGINT, SIG_IGN); + grub_emu_init (); grub_console_init (); grub_host_init (); grub_hostfs_init (); @@ -223,9 +202,7 @@ main (int argc, char *argv[]) /* XXX: This is a bit unportable. */ grub_util_biosdisk_init (dev_map); -#if GRUB_NO_MODULES grub_init_all (); -#endif /* Make sure that there is a root device. */ if (! root_dev) @@ -255,9 +232,7 @@ main (int argc, char *argv[]) if (setjmp (main_env) == 0) grub_main (); -#if GRUB_NO_MODULES grub_fini_all (); -#endif grub_hostfs_fini (); grub_host_fini (); @@ -287,10 +262,3 @@ grub_millisleep (grub_uint32_t ms) } #endif - -#if GRUB_NO_MODULES -void -grub_register_exported_symbols (void) -{ -} -#endif diff --git a/kern/main.c b/kern/main.c index 1fdf4ab07..2541d3295 100644 --- a/kern/main.c +++ b/kern/main.c @@ -30,6 +30,8 @@ #include #include +int grub_no_autoload; + void grub_module_iterate (int (*hook) (struct grub_module_header *header)) { diff --git a/normal/main.c b/normal/main.c index 4ed17e82c..2d493b897 100644 --- a/normal/main.c +++ b/normal/main.c @@ -476,10 +476,13 @@ grub_normal_init_page (struct grub_term_output *term) static void read_lists (const char *val) { - read_command_list (val); - read_fs_list (val); - read_crypto_list (val); - read_terminal_list (val); + if (! grub_no_autoload) + { + read_command_list (val); + read_fs_list (val); + read_crypto_list (val); + read_terminal_list (val); + } } static char * diff --git a/util/misc.c b/util/misc.c index 1656d6b5b..caec60552 100644 --- a/util/misc.c +++ b/util/misc.c @@ -193,12 +193,10 @@ grub_mm_init_region (void *addr __attribute__ ((unused)), { } -#if GRUB_NO_MODULES void grub_register_exported_symbols (void) { } -#endif #ifdef __MINGW32__ @@ -222,7 +220,7 @@ grub_millisleep (grub_uint32_t ms) #endif -#if !(defined (__i386__) || defined (__x86_64__)) && GRUB_NO_MODULES +#if !(defined (__i386__) || defined (__x86_64__)) && GRUB_MACHINE_EMU void grub_arch_sync_caches (void *address __attribute__ ((unused)), grub_size_t len __attribute__ ((unused))) From a7aa28248b1f005b09392b4f25027a896ef0eca6 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 5 May 2010 15:34:26 +0530 Subject: [PATCH 002/174] break command support --- conf/common.rmk | 12 +++--- conf/tests.rmk | 4 ++ include/grub/script_sh.h | 4 ++ script/execute.c | 47 +++++++++++++++++++-- script/main.c | 3 ++ tests/grub_script_break.in | 86 ++++++++++++++++++++++++++++++++++++++ util/grub-script-check.c | 8 ++++ 7 files changed, 155 insertions(+), 9 deletions(-) create mode 100644 tests/grub_script_break.in diff --git a/conf/common.rmk b/conf/common.rmk index 4b39e9b71..ed96ce320 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -103,12 +103,12 @@ 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_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 kern/command.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 diff --git a/conf/tests.rmk b/conf/tests.rmk index 9144e5528..8af4207b7 100644 --- a/conf/tests.rmk +++ b/conf/tests.rmk @@ -74,6 +74,9 @@ grub_script_comments_SOURCES = tests/grub_script_comments.in check_SCRIPTS += grub_script_functions grub_script_functions_SOURCES = tests/grub_script_functions.in +check_SCRIPTS += grub_script_break +grub_script_break_SOURCES = tests/grub_script_break.in + # List of tests to execute on "make check" # SCRIPTED_TESTS = example_scripted_test # SCRIPTED_TESTS += example_grub_script_test @@ -91,6 +94,7 @@ SCRIPTED_TESTS += grub_script_final_semicolon SCRIPTED_TESTS += grub_script_dollar SCRIPTED_TESTS += grub_script_comments SCRIPTED_TESTS += grub_script_functions +SCRIPTED_TESTS += grub_script_break # dependencies between tests and testing-tools $(SCRIPTED_TESTS): grub-shell grub-shell-tester diff --git a/include/grub/script_sh.h b/include/grub/script_sh.h index 730aa3005..aee0a743f 100644 --- a/include/grub/script_sh.h +++ b/include/grub/script_sh.h @@ -23,6 +23,7 @@ #include #include #include +#include struct grub_script_mem; @@ -308,6 +309,9 @@ grub_err_t grub_script_execute_menuentry (struct grub_script_cmd *cmd); /* Execute any GRUB pre-parsed command or script. */ grub_err_t grub_script_execute (struct grub_script *script); +/* Break command for loops. */ +grub_err_t grub_script_break (grub_command_t cmd, int argc, char *argv[]); + /* This variable points to the parsed command. This is used to communicate with the bison code. */ extern struct grub_script_cmd *grub_script_parsed; diff --git a/script/execute.c b/script/execute.c index 571b6785b..1f639e00b 100644 --- a/script/execute.c +++ b/script/execute.c @@ -30,8 +30,29 @@ is sizeof (int) * 3, and one extra for a possible -ve sign. */ #define ERRNO_DIGITS_MAX (sizeof (int) * 3 + 1) +static unsigned long active_loops; +static unsigned long active_breaks; static struct grub_script_scope *scope = 0; +grub_err_t +grub_script_break (grub_command_t cmd __attribute__((unused)), + int argc, char *argv[]) +{ + char *p = 0; + unsigned long count; + + if (argc == 0) + count = 1; + + else if ((argc > 1) || + (count = grub_strtoul (argv[0], &p, 10)) > active_loops || + (*p != '\0')) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad break"); + + active_breaks = count; + return GRUB_ERR_NONE; +} + static char * grub_script_env_get (const char *name) { @@ -242,8 +263,10 @@ grub_err_t grub_script_function_call (grub_script_function_t func, int argc, char **args) { grub_err_t ret = 0; + unsigned long loops = active_loops; struct grub_script_scope new_scope; + active_loops = 0; new_scope.argc = argc; new_scope.args = args; grub_list_push (GRUB_AS_LIST_P (&scope), GRUB_AS_LIST (&new_scope)); @@ -251,6 +274,7 @@ grub_script_function_call (grub_script_function_t func, int argc, char **args) ret = grub_script_execute (func->func); grub_list_pop (GRUB_AS_LIST_P (&scope)); + active_loops = loops; return ret; } @@ -338,7 +362,7 @@ grub_script_execute_cmdlist (struct grub_script_cmd *list) struct grub_script_cmd *cmd; /* Loop over every command and execute it. */ - for (cmd = list->next; cmd; cmd = cmd->next) + for (cmd = list->next; cmd && ! active_breaks; cmd = cmd->next) ret = grub_script_execute_cmd (cmd); return ret; @@ -380,14 +404,22 @@ grub_script_execute_cmdfor (struct grub_script_cmd *cmd) if (!args) return grub_errno; + active_loops++; result = 0; for (i = 0; i < argcount; i++) { - grub_script_env_set (cmdfor->name->str, args[i]); - result = grub_script_execute_cmd (cmdfor->list); + if (! active_breaks) + { + grub_script_env_set (cmdfor->name->str, args[i]); + result = grub_script_execute_cmd (cmdfor->list); + } grub_free (args[i]); } + if (active_breaks) + active_breaks--; + + active_loops--; grub_free (args); return result; } @@ -400,6 +432,7 @@ grub_script_execute_cmdwhile (struct grub_script_cmd *cmd) int result; struct grub_script_cmdwhile *cmdwhile = (struct grub_script_cmdwhile *) cmd; + active_loops++; result = 0; do { cond = grub_script_execute_cmd (cmdwhile->cond); @@ -407,8 +440,16 @@ grub_script_execute_cmdwhile (struct grub_script_cmd *cmd) break; result = grub_script_execute_cmd (cmdwhile->list); + + if (active_breaks) + { + active_breaks--; + break; + } + } while (1); /* XXX Put a check for ^C here */ + active_loops--; return result; } diff --git a/script/main.c b/script/main.c index b5159dc7d..c30df1f2d 100644 --- a/script/main.c +++ b/script/main.c @@ -17,6 +17,7 @@ */ #include +#include #include #include @@ -49,6 +50,8 @@ static struct grub_parser grub_sh_parser = GRUB_MOD_INIT(sh) { grub_parser_register ("grub", &grub_sh_parser); + grub_register_command ("break", grub_script_break, + N_("[n]"), N_("Exit from loops")); } GRUB_MOD_FINI(sh) diff --git a/tests/grub_script_break.in b/tests/grub_script_break.in new file mode 100644 index 000000000..bf265e8b3 --- /dev/null +++ b/tests/grub_script_break.in @@ -0,0 +1,86 @@ +#! @builddir@/grub-shell-tester +# +# Copyright (C) 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 . + +# break without any arguments +for i in 1 2 3 4 5 6 7 8 9 10 +do + echo $i + if test "$i" = 5 + then + break + fi +done + +# break with one +for i in 1 2 3 4 5 6 7 8 9 10 +do + echo $i + if test "$i" = 5 + then + break 1 + fi +done + +# break with loop count +for i in 1 2 3 4 5 +do + for j in a b c d e f + do + echo "$i $j" + if test "$i" = 3 + then + if test "$j" = d + then + break 2 + fi + fi + done +done + +# break into middle loop +for i in 1 2 3 4 5 +do + for j in a b c d e f + do + echo "$i $j" + if test "$i" = 3 + then + if test "$j" = d + then + break 1 + fi + fi + done +done + +# while and until loops +a= +while test "$a" != "aaaaaaa" +do + a="a$a" + for i in 1 2 3 4 + do + b= + until test "$b" = "bbbbb" + do + b="b$b" + echo "$a $i $b" + if test "$i" = 3; then echo "break 2"; break 2; fi + done + done +done + diff --git a/util/grub-script-check.c b/util/grub-script-check.c index 3b7ab295d..972a5fe17 100644 --- a/util/grub-script-check.c +++ b/util/grub-script-check.c @@ -57,6 +57,14 @@ grub_refresh (void) fflush (stdout); } +grub_err_t +grub_script_break (grub_command_t cmd __attribute__((unused)), + int argc __attribute__((unused)), + char *argv[] __attribute__((unused))) +{ + return 0; +} + char * grub_script_execute_argument_to_string (struct grub_script_arg *arg __attribute__ ((unused))) { From eee25941042302c182be4732194c4e2570461490 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 5 May 2010 16:19:31 +0530 Subject: [PATCH 003/174] continue command support --- conf/tests.rmk | 4 ++ script/execute.c | 20 +++++--- script/main.c | 2 + tests/grub_script_continue.in | 86 +++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 6 deletions(-) create mode 100644 tests/grub_script_continue.in diff --git a/conf/tests.rmk b/conf/tests.rmk index 8af4207b7..57cae95c5 100644 --- a/conf/tests.rmk +++ b/conf/tests.rmk @@ -77,6 +77,9 @@ grub_script_functions_SOURCES = tests/grub_script_functions.in check_SCRIPTS += grub_script_break grub_script_break_SOURCES = tests/grub_script_break.in +check_SCRIPTS += grub_script_continue +grub_script_continue_SOURCES = tests/grub_script_continue.in + # List of tests to execute on "make check" # SCRIPTED_TESTS = example_scripted_test # SCRIPTED_TESTS += example_grub_script_test @@ -95,6 +98,7 @@ SCRIPTED_TESTS += grub_script_dollar SCRIPTED_TESTS += grub_script_comments SCRIPTED_TESTS += grub_script_functions SCRIPTED_TESTS += grub_script_break +SCRIPTED_TESTS += grub_script_continue # dependencies between tests and testing-tools $(SCRIPTED_TESTS): grub-shell grub-shell-tester diff --git a/script/execute.c b/script/execute.c index 1f639e00b..88d15495c 100644 --- a/script/execute.c +++ b/script/execute.c @@ -30,13 +30,13 @@ is sizeof (int) * 3, and one extra for a possible -ve sign. */ #define ERRNO_DIGITS_MAX (sizeof (int) * 3 + 1) +static unsigned long is_continue; static unsigned long active_loops; static unsigned long active_breaks; static struct grub_script_scope *scope = 0; grub_err_t -grub_script_break (grub_command_t cmd __attribute__((unused)), - int argc, char *argv[]) +grub_script_break (grub_command_t cmd, int argc, char *argv[]) { char *p = 0; unsigned long count; @@ -50,6 +50,8 @@ grub_script_break (grub_command_t cmd __attribute__((unused)), return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad break"); active_breaks = count; + is_continue = grub_strcmp (cmd->name, "break") ? 1 : 0; + return GRUB_ERR_NONE; } @@ -408,6 +410,9 @@ grub_script_execute_cmdfor (struct grub_script_cmd *cmd) result = 0; for (i = 0; i < argcount; i++) { + if (is_continue && active_breaks == 1) + active_breaks = 0; + if (! active_breaks) { grub_script_env_set (cmdfor->name->str, args[i]); @@ -441,14 +446,17 @@ grub_script_execute_cmdwhile (struct grub_script_cmd *cmd) result = grub_script_execute_cmd (cmdwhile->list); + if (active_breaks == 1 && is_continue) + active_breaks = 0; + if (active_breaks) - { - active_breaks--; - break; - } + break; } while (1); /* XXX Put a check for ^C here */ + if (active_breaks) + active_breaks--; + active_loops--; return result; } diff --git a/script/main.c b/script/main.c index c30df1f2d..401456e1d 100644 --- a/script/main.c +++ b/script/main.c @@ -52,6 +52,8 @@ GRUB_MOD_INIT(sh) grub_parser_register ("grub", &grub_sh_parser); grub_register_command ("break", grub_script_break, N_("[n]"), N_("Exit from loops")); + grub_register_command ("continue", grub_script_break, + N_("[n]"), N_("Continue loops")); } GRUB_MOD_FINI(sh) diff --git a/tests/grub_script_continue.in b/tests/grub_script_continue.in new file mode 100644 index 000000000..4c28ce404 --- /dev/null +++ b/tests/grub_script_continue.in @@ -0,0 +1,86 @@ +#! @builddir@/grub-shell-tester +# +# Copyright (C) 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 . + +# continue without any arguments +for i in 1 2 3 4 5 6 7 8 9 10 +do + if test "$i" = 5 + then + continue + fi + echo $i +done + +# continue with one +for i in 1 2 3 4 5 6 7 8 9 10 +do + if test "$i" = 5 + then + continue 1 + fi + echo $i +done + +# continue with loop count +for i in 1 2 3 4 5 +do + for j in a b c d e f + do + if test "$i" = 3 + then + if test "$j" = d + then + continue 2 + fi + echo "$i $j" + fi + done +done + +# continue into middle loop +for i in 1 2 3 4 5 +do + for j in a b c d e f + do + if test "$i" = 3 + then + if test "$j" = d + then + continue 1 + fi + echo "$i $j" + fi + done +done + +# while and until loops +a= +while test "$a" != "aaaaaaa" +do + a="a$a" + for i in 1 2 3 4 + do + b= + until test "$b" = "bbbbb" + do + b="b$b" + if test "$i" = 3; then echo "continue 2"; continue 2; fi + echo "$a $i $b" + done + done +done + From 8f6a910b2389271059858ff58cace5a0639472c8 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 6 May 2010 09:55:06 +0530 Subject: [PATCH 004/174] fixed n > active_loops case --- include/grub/misc.h | 9 +++++++++ script/execute.c | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/grub/misc.h b/include/grub/misc.h index 9bfc6974e..bcbcf33a3 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -281,6 +281,15 @@ grub_abs (int x) return (unsigned int) x; } +static inline long +grub_min (long x, long y) +{ + if (x < y) + return x; + else + return y; +} + static inline long grub_max (long x, long y) { diff --git a/script/execute.c b/script/execute.c index 1f639e00b..3ad0b9dff 100644 --- a/script/execute.c +++ b/script/execute.c @@ -44,12 +44,11 @@ grub_script_break (grub_command_t cmd __attribute__((unused)), if (argc == 0) count = 1; - else if ((argc > 1) || - (count = grub_strtoul (argv[0], &p, 10)) > active_loops || + else if ((argc > 1) || (count = grub_strtoul (argv[0], &p, 10)) == 0 || (*p != '\0')) return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad break"); - active_breaks = count; + active_breaks = grub_min (active_loops, count); return GRUB_ERR_NONE; } From 8c411768822a75c8c15108872191a05e84befa6e Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 6 May 2010 11:34:04 +0530 Subject: [PATCH 005/174] automake commit without merge history --- .bzrignore | 6 + ABOUT-NLS | 223 +++ Makefile.am | 87 + Makefile.in | 564 ------ autogen.sh | 39 +- configure.ac | 783 +------- configure.common | 804 +++++++++ docs/Makefile.am | 6 + geninit.sh | 30 +- geninitheader.sh | 45 - genkernsyms.sh.in | 27 - genmk.rb | 475 ----- gentpl.py | 460 +++++ grub-core/Makefile.am | 155 ++ grub-core/Makefile.extra-dist | 53 + grub-core/Makefile.kernel | 192 ++ grub-core/Makefile.vars | 80 + {boot => grub-core/boot}/i386/pc/boot.S | 0 {boot => grub-core/boot}/i386/pc/cdboot.S | 0 {boot => grub-core/boot}/i386/pc/diskboot.S | 0 {boot => grub-core/boot}/i386/pc/lnxboot.S | 0 {boot => grub-core/boot}/i386/pc/pxeboot.S | 0 {boot => grub-core/boot}/i386/qemu/boot.S | 0 .../boot}/sparc64/ieee1275/boot.S | 0 .../boot}/sparc64/ieee1275/diskboot.S | 0 {bus => grub-core/bus}/bonito.c | 0 {util => grub-core/bus/emu}/pci.c | 1 + {bus => grub-core/bus}/pci.c | 0 {util => grub-core/bus/usb/emu}/usb.c | 0 {bus => grub-core/bus}/usb/ohci.c | 0 {bus => grub-core/bus}/usb/uhci.c | 0 {bus => grub-core/bus}/usb/usb.c | 0 {bus => grub-core/bus}/usb/usbhub.c | 0 {bus => grub-core/bus}/usb/usbtrans.c | 0 {commands => grub-core/commands}/acpi.c | 0 {commands => grub-core/commands}/blocklist.c | 0 {commands => grub-core/commands}/boot.c | 0 {commands => grub-core/commands}/cat.c | 0 {commands => grub-core/commands}/cmp.c | 0 {commands => grub-core/commands}/configfile.c | 0 {commands => grub-core/commands}/crc.c | 0 {commands => grub-core/commands}/date.c | 0 {commands => grub-core/commands}/echo.c | 0 {commands => grub-core/commands}/efi/acpi.c | 0 .../commands}/efi/fixvideo.c | 0 .../commands}/efi/loadbios.c | 0 {commands => grub-core/commands}/extcmd.c | 0 {commands => grub-core/commands}/gptsync.c | 0 {commands => grub-core/commands}/halt.c | 0 {commands => grub-core/commands}/handler.c | 0 {commands => grub-core/commands}/hashsum.c | 0 {commands => grub-core/commands}/hdparm.c | 0 {commands => grub-core/commands}/help.c | 0 {commands => grub-core/commands}/hexdump.c | 0 {commands => grub-core/commands}/i386/cpuid.c | 0 .../commands}/i386/pc/acpi.c | 0 .../commands}/i386/pc/drivemap.c | 0 .../commands}/i386/pc/drivemap_int13h.S | 0 .../commands}/i386/pc/halt.c | 0 .../commands}/i386/pc/play.c | 0 .../commands}/i386/pc/pxecmd.c | 0 .../commands}/i386/pc/vbeinfo.c | 0 .../commands}/i386/pc/vbetest.c | 0 .../commands}/ieee1275/suspend.c | 0 {commands => grub-core/commands}/iorw.c | 0 {commands => grub-core/commands}/keystatus.c | 0 {commands => grub-core/commands}/loadenv.c | 0 {commands => grub-core/commands}/ls.c | 0 {commands => grub-core/commands}/lsmmap.c | 0 {commands => grub-core/commands}/lspci.c | 0 {commands => grub-core/commands}/memrw.c | 0 {commands => grub-core/commands}/minicmd.c | 0 {commands => grub-core/commands}/parttool.c | 2 +- {commands => grub-core/commands}/password.c | 0 .../commands}/password_pbkdf2.c | 0 {commands => grub-core/commands}/probe.c | 0 {commands => grub-core/commands}/read.c | 0 {commands => grub-core/commands}/reboot.c | 0 {commands => grub-core/commands}/regexp.c | 0 {commands => grub-core/commands}/search.c | 0 .../commands}/search_file.c | 0 .../commands}/search_label.c | 0 .../commands}/search_uuid.c | 0 .../commands}/search_wrap.c | 0 {commands => grub-core/commands}/setpci.c | 0 {commands => grub-core/commands}/sleep.c | 0 {commands => grub-core/commands}/terminal.c | 0 {commands => grub-core/commands}/test.c | 0 {commands => grub-core/commands}/true.c | 0 {commands => grub-core/commands}/usbtest.c | 0 {commands => grub-core/commands}/videotest.c | 0 {commands => grub-core/commands}/xnu_uuid.c | 0 {conf => grub-core/conf}/any-emu.rmk | 0 {conf => grub-core/conf}/common.rmk | 0 {conf => grub-core/conf}/i386-coreboot.rmk | 0 {conf => grub-core/conf}/i386-efi.rmk | 0 {conf => grub-core/conf}/i386-ieee1275.rmk | 0 {conf => grub-core/conf}/i386-multiboot.rmk | 0 .../conf}/i386-pc-cygwin-img-ld.sc | 0 {conf => grub-core/conf}/i386-pc.rmk | 0 {conf => grub-core/conf}/i386-qemu.rmk | 0 {conf => grub-core/conf}/i386.rmk | 0 {conf => grub-core/conf}/mips-qemu-mips.rmk | 0 {conf => grub-core/conf}/mips-yeeloong.rmk | 0 {conf => grub-core/conf}/mips.rmk | 0 {conf => grub-core/conf}/powerpc-ieee1275.rmk | 0 {conf => grub-core/conf}/sparc64-ieee1275.rmk | 0 {conf => grub-core/conf}/tests.rmk | 0 {conf => grub-core/conf}/x86-efi.rmk | 0 {conf => grub-core/conf}/x86_64-efi.rmk | 0 grub-core/configure.ac | 91 + {disk => grub-core/disk}/ata.c | 0 {disk => grub-core/disk}/ata_pthru.c | 0 {disk => grub-core/disk}/dmraid_nvidia.c | 0 {disk => grub-core/disk}/efi/efidisk.c | 0 {disk => grub-core/disk}/host.c | 0 {disk => grub-core/disk}/i386/pc/biosdisk.c | 0 {disk => grub-core/disk}/ieee1275/nand.c | 0 {disk => grub-core/disk}/ieee1275/ofdisk.c | 0 {disk => grub-core/disk}/loopback.c | 0 {disk => grub-core/disk}/lvm.c | 0 {disk => grub-core/disk}/mdraid_linux.c | 0 {disk => grub-core/disk}/memdisk.c | 0 {disk => grub-core/disk}/raid.c | 0 {disk => grub-core/disk}/raid5_recover.c | 0 {disk => grub-core/disk}/raid6_recover.c | 0 {disk => grub-core/disk}/scsi.c | 0 {disk => grub-core/disk}/usbms.c | 0 .../efiemu}/i386/coredetect.c | 0 .../efiemu}/i386/loadcore32.c | 0 .../efiemu}/i386/loadcore64.c | 0 .../efiemu}/i386/pc/cfgtables.c | 0 {efiemu => grub-core/efiemu}/loadcore.c | 0 {efiemu => grub-core/efiemu}/loadcore32.c | 0 {efiemu => grub-core/efiemu}/loadcore64.c | 0 .../efiemu}/loadcore_common.c | 0 {efiemu => grub-core/efiemu}/main.c | 0 {efiemu => grub-core/efiemu}/mm.c | 0 {efiemu => grub-core/efiemu}/pnvram.c | 0 {efiemu => grub-core/efiemu}/prepare.c | 0 {efiemu => grub-core/efiemu}/prepare32.c | 0 {efiemu => grub-core/efiemu}/prepare64.c | 0 {efiemu => grub-core/efiemu}/runtime/config.h | 0 {efiemu => grub-core/efiemu}/runtime/efiemu.S | 0 {efiemu => grub-core/efiemu}/runtime/efiemu.c | 0 .../efiemu}/runtime/efiemu.sh | 0 {efiemu => grub-core/efiemu}/symbols.c | 0 {font => grub-core/font}/font.c | 0 {font => grub-core/font}/font_cmd.c | 0 {fs => grub-core/fs}/affs.c | 0 {fs => grub-core/fs}/afs.c | 0 {fs => grub-core/fs}/afs_be.c | 0 {fs => grub-core/fs}/befs.c | 0 {fs => grub-core/fs}/befs_be.c | 0 {fs => grub-core/fs}/cpio.c | 0 {fs => grub-core/fs}/ext2.c | 0 {fs => grub-core/fs}/fat.c | 0 {fs => grub-core/fs}/fshelp.c | 0 {fs => grub-core/fs}/hfs.c | 0 {fs => grub-core/fs}/hfsplus.c | 0 {fs => grub-core/fs}/i386/pc/pxe.c | 0 {fs => grub-core/fs}/iso9660.c | 0 {fs => grub-core/fs}/jfs.c | 0 {fs => grub-core/fs}/minix.c | 0 {fs => grub-core/fs}/nilfs2.c | 0 {fs => grub-core/fs}/ntfs.c | 0 {fs => grub-core/fs}/ntfscomp.c | 0 {fs => grub-core/fs}/reiserfs.c | 0 {fs => grub-core/fs}/sfs.c | 0 {fs => grub-core/fs}/tar.c | 0 {fs => grub-core/fs}/udf.c | 0 {fs => grub-core/fs}/ufs.c | 0 {fs => grub-core/fs}/ufs2.c | 0 {fs => grub-core/fs}/xfs.c | 0 gencmdlist.sh => grub-core/gencmdlist.sh | 0 gendistlist.sh => grub-core/gendistlist.sh | 0 genemuinit.sh => grub-core/genemuinit.sh | 0 .../genemuinitheader.sh | 0 genfslist.sh => grub-core/genfslist.sh | 0 .../genhandlerlist.sh | 0 genmoddep.awk => grub-core/genmoddep.awk | 13 +- genmodsrc.sh => grub-core/genmodsrc.sh | 0 .../genpartmaplist.sh | 0 .../genparttoollist.sh | 0 gensymlist.sh.in => grub-core/gensymlist.sh | 13 +- .../genterminallist.sh | 0 gentrigtables.c => grub-core/gentrigtables.c | 3 +- genvideolist.sh => grub-core/genvideolist.sh | 0 {gettext => grub-core/gettext}/gettext.c | 0 {gfxmenu => grub-core/gfxmenu}/gfxmenu.c | 0 {gfxmenu => grub-core/gfxmenu}/gui_box.c | 0 {gfxmenu => grub-core/gfxmenu}/gui_canvas.c | 0 .../gfxmenu}/gui_circular_progress.c | 0 {gfxmenu => grub-core/gfxmenu}/gui_image.c | 0 {gfxmenu => grub-core/gfxmenu}/gui_label.c | 0 {gfxmenu => grub-core/gfxmenu}/gui_list.c | 0 .../gfxmenu}/gui_progress_bar.c | 0 .../gfxmenu}/gui_string_util.c | 0 {gfxmenu => grub-core/gfxmenu}/gui_util.c | 0 {gfxmenu => grub-core/gfxmenu}/icon_manager.c | 0 {gfxmenu => grub-core/gfxmenu}/model.c | 0 {gfxmenu => grub-core/gfxmenu}/named_colors.c | 0 {gfxmenu => grub-core/gfxmenu}/theme_loader.c | 0 {gfxmenu => grub-core/gfxmenu}/view.c | 0 {gfxmenu => grub-core/gfxmenu}/widget-box.c | 0 {gnulib => grub-core/gnulib}/alloca.h | 0 {gnulib => grub-core/gnulib}/argp-ba.c | 0 {gnulib => grub-core/gnulib}/argp-eexst.c | 0 {gnulib => grub-core/gnulib}/argp-fmtstream.c | 0 {gnulib => grub-core/gnulib}/argp-fmtstream.h | 0 {gnulib => grub-core/gnulib}/argp-fs-xinl.c | 0 {gnulib => grub-core/gnulib}/argp-help.c | 0 {gnulib => grub-core/gnulib}/argp-namefrob.h | 0 {gnulib => grub-core/gnulib}/argp-parse.c | 0 {gnulib => grub-core/gnulib}/argp-pin.c | 0 {gnulib => grub-core/gnulib}/argp-pv.c | 0 {gnulib => grub-core/gnulib}/argp-pvh.c | 0 .../gnulib}/argp-version-etc.c | 0 .../gnulib}/argp-version-etc.h | 0 {gnulib => grub-core/gnulib}/argp-xinl.c | 0 {gnulib => grub-core/gnulib}/argp.h | 0 {gnulib => grub-core/gnulib}/error.c | 0 {gnulib => grub-core/gnulib}/error.h | 0 {gnulib => grub-core/gnulib}/fnmatch.c | 0 {gnulib => grub-core/gnulib}/fnmatch.h | 0 {gnulib => grub-core/gnulib}/fnmatch_loop.c | 0 {gnulib => grub-core/gnulib}/getdelim.c | 0 {gnulib => grub-core/gnulib}/getline.c | 0 {gnulib => grub-core/gnulib}/getopt.c | 0 {gnulib => grub-core/gnulib}/getopt.h | 0 {gnulib => grub-core/gnulib}/getopt1.c | 0 {gnulib => grub-core/gnulib}/getopt_int.h | 0 {gnulib => grub-core/gnulib}/gettext.h | 0 {gnulib => grub-core/gnulib}/progname.c | 0 {gnulib => grub-core/gnulib}/progname.h | 0 {gnulib => grub-core/gnulib}/regcomp.c | 0 {gnulib => grub-core/gnulib}/regex.c | 0 {gnulib => grub-core/gnulib}/regex.h | 0 {gnulib => grub-core/gnulib}/regex_internal.c | 0 {gnulib => grub-core/gnulib}/regex_internal.h | 0 {gnulib => grub-core/gnulib}/regexec.c | 0 {hello => grub-core/hello}/hello.c | 0 {hook => grub-core/hook}/datehook.c | 0 {util => grub-core}/import_gcry.py | 0 .../include}/grub/acorn_filecore.h | 0 {include => grub-core/include}/grub/acpi.h | 0 {include => grub-core/include}/grub/aout.h | 0 .../include}/grub/at_keyboard.h | 0 {include => grub-core/include}/grub/ata.h | 0 {include => grub-core/include}/grub/auth.h | 0 {include => grub-core/include}/grub/autoefi.h | 0 {include => grub-core/include}/grub/bitmap.h | 0 .../include}/grub/bitmap_scale.h | 0 {include => grub-core/include}/grub/boot.h | 0 .../include}/grub/bsdlabel.h | 0 {include => grub-core/include}/grub/bufio.h | 0 {include => grub-core/include}/grub/cache.h | 0 {include => grub-core/include}/grub/charset.h | 0 {include => grub-core/include}/grub/cmos.h | 0 {include => grub-core/include}/grub/command.h | 0 {include => grub-core/include}/grub/crypto.h | 0 .../include}/grub/datetime.h | 0 {include => grub-core/include}/grub/device.h | 0 {include => grub-core/include}/grub/disk.h | 0 {include => grub-core/include}/grub/dl.h | 32 +- {include => grub-core/include}/grub/efi/api.h | 0 .../include}/grub/efi/console.h | 0 .../include}/grub/efi/console_control.h | 0 .../include}/grub/efi/disk.h | 0 {include => grub-core/include}/grub/efi/efi.h | 0 .../include}/grub/efi/graphics_output.h | 0 .../include}/grub/efi/memory.h | 0 .../include}/grub/efi/pe32.h | 0 .../include}/grub/efi/time.h | 0 .../include}/grub/efi/uga_draw.h | 0 .../include}/grub/efiemu/efiemu.h | 0 .../include}/grub/efiemu/runtime.h | 0 {include => grub-core/include}/grub/elf.h | 0 {include => grub-core/include}/grub/elfload.h | 0 .../include/grub/emu}/console.h | 0 .../include/grub/emu}/getroot.h | 1 + .../include/grub/emu}/hostdisk.h | 0 grub-core/include/grub/emu/misc.h | 22 + {include => grub-core/include}/grub/env.h | 0 .../include}/grub/env_private.h | 0 {include => grub-core/include}/grub/err.h | 0 {include => grub-core/include}/grub/extcmd.h | 0 {include => grub-core/include}/grub/fbblit.h | 0 {include => grub-core/include}/grub/fbfill.h | 0 {include => grub-core/include}/grub/fbutil.h | 0 {include => grub-core/include}/grub/file.h | 0 {include => grub-core/include}/grub/font.h | 0 .../include}/grub/fontformat.h | 0 {include => grub-core/include}/grub/fs.h | 0 {include => grub-core/include}/grub/fshelp.h | 0 .../include}/grub/gfxmenu_model.h | 0 .../include}/grub/gfxmenu_view.h | 0 {include => grub-core/include}/grub/gfxterm.h | 0 .../include}/grub/gfxwidgets.h | 0 .../include}/grub/gpt_partition.h | 0 {include => grub-core/include}/grub/gui.h | 0 .../include}/grub/gui_string_util.h | 0 {include => grub-core/include}/grub/gzio.h | 0 {include => grub-core/include}/grub/handler.h | 0 {include => grub-core/include}/grub/hfs.h | 0 {include => grub-core/include}/grub/i18n.h | 0 .../include}/grub/i386/at_keyboard.h | 0 .../include}/grub/i386/bsd.h | 0 .../include}/grub/i386/cmos.h | 0 .../include}/grub/i386/coreboot/boot.h | 0 .../include}/grub/i386/coreboot/console.h | 0 .../include}/grub/i386/coreboot/init.h | 0 .../include}/grub/i386/coreboot/kernel.h | 0 .../include}/grub/i386/coreboot/loader.h | 0 .../include}/grub/i386/coreboot/memory.h | 0 .../include}/grub/i386/coreboot/serial.h | 0 .../include}/grub/i386/coreboot/time.h | 0 .../include}/grub/i386/cpuid.h | 0 .../include}/grub/i386/efi/kernel.h | 0 .../include}/grub/i386/efi/loader.h | 0 .../include}/grub/i386/efi/memory.h | 0 .../include}/grub/i386/efi/serial.h | 0 .../include}/grub/i386/efi/time.h | 0 .../include}/grub/i386/efiemu.h | 0 .../include}/grub/i386/freebsd_linker.h | 0 .../include}/grub/i386/freebsd_reboot.h | 0 .../include}/grub/i386/ieee1275/console.h | 0 .../include}/grub/i386/ieee1275/ieee1275.h | 0 .../include}/grub/i386/ieee1275/kernel.h | 0 .../include}/grub/i386/ieee1275/loader.h | 0 .../include}/grub/i386/ieee1275/memory.h | 0 .../include}/grub/i386/ieee1275/serial.h | 0 .../include}/grub/i386/ieee1275/time.h | 0 {include => grub-core/include}/grub/i386/io.h | 0 .../include}/grub/i386/kernel.h | 0 .../include}/grub/i386/linux.h | 0 .../include}/grub/i386/loader.h | 0 .../include}/grub/i386/macho.h | 0 .../include}/grub/i386/memory.h | 0 .../include}/grub/i386/multiboot.h | 0 .../include}/grub/i386/multiboot/boot.h | 0 .../include}/grub/i386/multiboot/console.h | 0 .../include}/grub/i386/multiboot/init.h | 0 .../include}/grub/i386/multiboot/kernel.h | 0 .../include}/grub/i386/multiboot/loader.h | 0 .../include}/grub/i386/multiboot/memory.h | 0 .../include}/grub/i386/multiboot/serial.h | 0 .../include}/grub/i386/multiboot/time.h | 0 .../include}/grub/i386/netbsd_bootinfo.h | 0 .../include}/grub/i386/netbsd_reboot.h | 0 .../include}/grub/i386/openbsd_bootarg.h | 0 .../include}/grub/i386/openbsd_reboot.h | 0 .../include}/grub/i386/pc/biosdisk.h | 0 .../include}/grub/i386/pc/biosnum.h | 0 .../include}/grub/i386/pc/boot.h | 0 .../include}/grub/i386/pc/chainloader.h | 0 .../include}/grub/i386/pc/console.h | 0 .../include}/grub/i386/pc/efiemu.h | 0 .../include}/grub/i386/pc/init.h | 0 .../include}/grub/i386/pc/kernel.h | 0 .../include}/grub/i386/pc/loader.h | 0 .../include}/grub/i386/pc/memory.h | 0 .../include}/grub/i386/pc/pxe.h | 0 .../include}/grub/i386/pc/time.h | 0 .../include}/grub/i386/pc/vbe.h | 0 .../include}/grub/i386/pc/vga.h | 0 .../include}/grub/i386/pci.h | 0 .../include}/grub/i386/pit.h | 0 .../include}/grub/i386/qemu/boot.h | 0 .../include}/grub/i386/qemu/console.h | 0 .../include}/grub/i386/qemu/init.h | 0 .../include}/grub/i386/qemu/kernel.h | 0 .../include}/grub/i386/qemu/loader.h | 0 .../include}/grub/i386/qemu/memory.h | 0 .../include}/grub/i386/qemu/serial.h | 0 .../include}/grub/i386/qemu/time.h | 0 .../include}/grub/i386/relocator.h | 0 .../include}/grub/i386/setjmp.h | 0 .../include}/grub/i386/time.h | 0 .../include}/grub/i386/tsc.h | 0 .../include}/grub/i386/types.h | 0 .../include}/grub/i386/vga_common.h | 0 .../include}/grub/i386/xnu.h | 0 .../include}/grub/icon_manager.h | 0 .../include}/grub/ieee1275/ieee1275.h | 0 .../include}/grub/ieee1275/ofdisk.h | 0 {include => grub-core/include}/grub/kernel.h | 0 .../include}/grub/lib/LzFind.h | 0 .../include}/grub/lib/LzHash.h | 0 .../include}/grub/lib/LzmaDec.h | 0 .../include}/grub/lib/LzmaEnc.h | 0 .../include}/grub/lib/LzmaTypes.h | 0 {include => grub-core/include}/grub/lib/arg.h | 0 {include => grub-core/include}/grub/lib/crc.h | 0 .../include}/grub/lib/envblk.h | 0 .../include}/grub/lib/hexdump.h | 0 {include => grub-core/include}/grub/libgcc.h | 0 .../include}/grub/libpciaccess.h | 0 {include => grub-core/include}/grub/libusb.h | 0 {include => grub-core/include}/grub/list.h | 0 {include => grub-core/include}/grub/loader.h | 0 {include => grub-core/include}/grub/lvm.h | 0 {include => grub-core/include}/grub/macho.h | 0 .../include}/grub/machoload.h | 0 {include => grub-core/include}/grub/memory.h | 0 {include => grub-core/include}/grub/menu.h | 0 .../include}/grub/menu_viewer.h | 0 .../include}/grub/mips/at_keyboard.h | 0 .../include}/grub/mips/cache.h | 0 .../include}/grub/mips/cmos.h | 0 {include => grub-core/include}/grub/mips/io.h | 0 .../include}/grub/mips/kernel.h | 0 .../include}/grub/mips/multiboot.h | 0 .../include}/grub/mips/pci.h | 0 .../include}/grub/mips/qemu-mips/boot.h | 0 .../include}/grub/mips/qemu-mips/kernel.h | 0 .../include}/grub/mips/qemu-mips/loader.h | 0 .../include}/grub/mips/qemu-mips/memory.h | 0 .../include}/grub/mips/qemu-mips/serial.h | 0 .../include}/grub/mips/qemu-mips/time.h | 0 .../include}/grub/mips/relocator.h | 0 .../include}/grub/mips/setjmp.h | 0 .../include}/grub/mips/time.h | 0 .../include}/grub/mips/types.h | 0 .../include}/grub/mips/yeeloong/at_keyboard.h | 0 .../include}/grub/mips/yeeloong/boot.h | 0 .../include}/grub/mips/yeeloong/cmos.h | 0 .../include}/grub/mips/yeeloong/kernel.h | 0 .../include}/grub/mips/yeeloong/loader.h | 0 .../include}/grub/mips/yeeloong/memory.h | 0 .../include}/grub/mips/yeeloong/pci.h | 0 .../include}/grub/mips/yeeloong/serial.h | 0 .../include}/grub/mips/yeeloong/time.h | 0 {include => grub-core/include}/grub/misc.h | 0 {include => grub-core/include}/grub/mm.h | 0 .../include}/grub/msdos_partition.h | 0 .../include}/grub/multiboot.h | 0 .../include}/grub/multiboot_loader.h | 0 {include => grub-core/include}/grub/net.h | 0 {include => grub-core/include}/grub/normal.h | 0 {include => grub-core/include}/grub/ntfs.h | 0 {include => grub-core/include}/grub/parser.h | 0 .../include}/grub/partition.h | 0 .../include}/grub/parttool.h | 0 {include => grub-core/include}/grub/pci.h | 0 .../include}/grub/pciutils.h | 0 .../include}/grub/powerpc/ieee1275/biosdisk.h | 0 .../include}/grub/powerpc/ieee1275/console.h | 0 .../include}/grub/powerpc/ieee1275/ieee1275.h | 0 .../include}/grub/powerpc/ieee1275/kernel.h | 0 .../include}/grub/powerpc/ieee1275/loader.h | 0 .../include}/grub/powerpc/ieee1275/memory.h | 0 .../include}/grub/powerpc/ieee1275/time.h | 0 .../grub/powerpc/ieee1275/util/biosdisk.h | 0 .../include}/grub/powerpc/kernel.h | 0 .../include}/grub/powerpc/setjmp.h | 0 .../include}/grub/powerpc/time.h | 0 .../include}/grub/powerpc/types.h | 0 {include => grub-core/include}/grub/raid.h | 0 {include => grub-core/include}/grub/reader.h | 0 .../include}/grub/script_sh.h | 0 {include => grub-core/include}/grub/scsi.h | 0 {include => grub-core/include}/grub/scsicmd.h | 0 {include => grub-core/include}/grub/sdl.h | 0 {include => grub-core/include}/grub/search.h | 0 {include => grub-core/include}/grub/serial.h | 0 {include => grub-core/include}/grub/setjmp.h | 0 .../include}/grub/sparc64/ieee1275/boot.h | 0 .../include}/grub/sparc64/ieee1275/console.h | 0 .../include}/grub/sparc64/ieee1275/ieee1275.h | 0 .../include}/grub/sparc64/ieee1275/kernel.h | 0 .../include}/grub/sparc64/ieee1275/loader.h | 0 .../include}/grub/sparc64/ieee1275/memory.h | 0 .../include}/grub/sparc64/ieee1275/time.h | 0 .../include}/grub/sparc64/kernel.h | 0 .../include}/grub/sparc64/setjmp.h | 0 .../include}/grub/sparc64/time.h | 0 .../include}/grub/sparc64/types.h | 0 {include => grub-core/include}/grub/symbol.h | 0 {include => grub-core/include}/grub/term.h | 0 .../include}/grub/terminfo.h | 0 {include => grub-core/include}/grub/test.h | 8 +- {include => grub-core/include}/grub/time.h | 0 {include => grub-core/include}/grub/tparm.h | 0 {include => grub-core/include}/grub/trig.h | 0 {include => grub-core/include}/grub/types.h | 0 {include => grub-core/include}/grub/usb.h | 0 {include => grub-core/include}/grub/usbdesc.h | 0 .../include}/grub/usbtrans.h | 0 .../include}/grub/util/deviceiter.h | 0 .../include}/grub/util/lvm.h | 0 .../include}/grub/util/misc.h | 13 - .../include}/grub/util/ofpath.h | 0 .../include}/grub/util/raid.h | 0 .../include}/grub/util/resolve.h | 0 {include => grub-core/include}/grub/video.h | 0 .../include}/grub/video_fb.h | 0 .../include}/grub/x86_64/at_keyboard.h | 0 .../include}/grub/x86_64/efi/kernel.h | 0 .../include}/grub/x86_64/efi/loader.h | 0 .../include}/grub/x86_64/efi/memory.h | 0 .../include}/grub/x86_64/efi/serial.h | 0 .../include}/grub/x86_64/efi/time.h | 0 .../include}/grub/x86_64/io.h | 0 .../include}/grub/x86_64/kernel.h | 0 .../include}/grub/x86_64/linux.h | 0 .../include}/grub/x86_64/macho.h | 0 .../include}/grub/x86_64/multiboot.h | 0 .../include}/grub/x86_64/pci.h | 0 .../include}/grub/x86_64/relocator.h | 0 .../include}/grub/x86_64/setjmp.h | 0 .../include}/grub/x86_64/time.h | 0 .../include}/grub/x86_64/types.h | 0 .../include}/grub/x86_64/xnu.h | 0 {include => grub-core/include}/grub/xnu.h | 0 {include => grub-core/include}/multiboot.h | 0 {include => grub-core/include}/multiboot2.h | 0 {io => grub-core/io}/bufio.c | 0 {io => grub-core/io}/gzio.c | 0 {kern => grub-core/kern}/command.c | 0 {kern => grub-core/kern}/corecmd.c | 0 {kern => grub-core/kern}/device.c | 0 {kern => grub-core/kern}/disk.c | 0 {kern => grub-core/kern}/dl.c | 6 +- {kern => grub-core/kern}/efi/efi.c | 0 {kern => grub-core/kern}/efi/init.c | 0 {kern => grub-core/kern}/efi/mm.c | 0 {kern => grub-core/kern}/elf.c | 0 grub-core/kern/emu/cache.S | 17 + {util => grub-core/kern/emu}/console.c | 2 +- grub-core/kern/emu/dl.c | 19 + grub-core/kern/emu/dummy/dl.c | 51 + grub-core/kern/emu/dummy/symlist.c | 26 + {util => grub-core/kern/emu}/getroot.c | 109 +- {util => grub-core/kern/emu}/hostdisk.c | 4 +- {util => grub-core/kern/emu}/hostfs.c | 0 grub-core/kern/emu/lite.c | 16 + util/grub-emu.c => grub-core/kern/emu/main.c | 67 +- grub-core/kern/emu/misc.c | 199 +++ {util => grub-core/kern/emu}/time.c | 0 {kern => grub-core/kern}/env.c | 0 {kern => grub-core/kern}/err.c | 0 {kern => grub-core/kern}/file.c | 0 {kern => grub-core/kern}/fs.c | 0 {kern => grub-core/kern}/generic/millisleep.c | 0 .../kern}/generic/rtc_get_time_ms.c | 0 {kern => grub-core/kern}/handler.c | 0 {kern => grub-core/kern}/i386/coreboot/init.c | 0 {kern => grub-core/kern}/i386/coreboot/mmap.c | 0 .../kern}/i386/coreboot/startup.S | 0 {kern => grub-core/kern}/i386/dl.c | 0 {kern => grub-core/kern}/i386/efi/init.c | 0 {kern => grub-core/kern}/i386/efi/startup.S | 0 {kern => grub-core/kern}/i386/halt.c | 0 {kern => grub-core/kern}/i386/ieee1275/init.c | 0 .../kern}/i386/ieee1275/startup.S | 0 {kern => grub-core/kern}/i386/loader.S | 0 {kern => grub-core/kern}/i386/misc.S | 0 .../kern}/i386/multiboot_mmap.c | 0 {kern => grub-core/kern}/i386/pc/init.c | 0 .../kern}/i386/pc/lzma_decode.S | 0 {kern => grub-core/kern}/i386/pc/mmap.c | 0 {kern => grub-core/kern}/i386/pc/startup.S | 0 {kern => grub-core/kern}/i386/pit.c | 0 {kern => grub-core/kern}/i386/qemu/mmap.c | 0 {kern => grub-core/kern}/i386/qemu/startup.S | 0 {kern => grub-core/kern}/i386/realmode.S | 0 {kern => grub-core/kern}/i386/tsc.c | 0 {kern => grub-core/kern}/ieee1275/cmain.c | 0 {kern => grub-core/kern}/ieee1275/ieee1275.c | 0 {kern => grub-core/kern}/ieee1275/init.c | 0 {kern => grub-core/kern}/ieee1275/mmap.c | 0 {kern => grub-core/kern}/ieee1275/openfw.c | 0 {kern => grub-core/kern}/list.c | 0 {kern => grub-core/kern}/main.c | 0 {kern => grub-core/kern}/mips/cache.S | 0 {kern => grub-core/kern}/mips/cache_flush.S | 0 {kern => grub-core/kern}/mips/dl.c | 0 {kern => grub-core/kern}/mips/init.c | 0 .../kern}/mips/qemu-mips/init.c | 0 {kern => grub-core/kern}/mips/startup.S | 0 {kern => grub-core/kern}/mips/yeeloong/init.c | 0 {kern => grub-core/kern}/misc.c | 0 {kern => grub-core/kern}/mm.c | 0 {kern => grub-core/kern}/parser.c | 0 {kern => grub-core/kern}/partition.c | 0 {kern => grub-core/kern}/powerpc/cache.S | 0 {kern => grub-core/kern}/powerpc/dl.c | 0 .../kern}/powerpc/ieee1275/startup.S | 0 {kern => grub-core/kern}/rescue_parser.c | 0 {kern => grub-core/kern}/rescue_reader.c | 0 {kern => grub-core/kern}/sparc64/cache.S | 0 {kern => grub-core/kern}/sparc64/dl.c | 0 .../kern}/sparc64/ieee1275/crt0.S | 0 .../kern}/sparc64/ieee1275/ieee1275.c | 0 .../kern}/sparc64/ieee1275/init.c | 0 {kern => grub-core/kern}/term.c | 0 {kern => grub-core/kern}/time.c | 0 {kern => grub-core/kern}/x86_64/dl.c | 0 .../kern}/x86_64/efi/callwrap.S | 0 {kern => grub-core/kern}/x86_64/efi/startup.S | 0 {lib => grub-core/lib}/LzFind.c | 0 {lib => grub-core/lib}/LzmaDec.c | 0 {lib => grub-core/lib}/LzmaEnc.c | 0 {lib => grub-core/lib}/arg.c | 0 {lib => grub-core/lib}/charset.c | 0 {lib => grub-core/lib}/cmos_datetime.c | 0 {lib => grub-core/lib}/crc.c | 0 {lib => grub-core/lib}/crypto.c | 0 {lib => grub-core/lib}/efi/datetime.c | 0 {lib => grub-core/lib}/envblk.c | 0 {lib => grub-core/lib}/hexdump.c | 0 {lib => grub-core/lib}/i386/pc/biosnum.c | 0 {lib => grub-core/lib}/i386/relocator.c | 0 {lib => grub-core/lib}/i386/relocator_asm.S | 0 .../lib}/i386/relocator_backward.S | 0 {lib => grub-core/lib}/i386/setjmp.S | 0 {lib => grub-core/lib}/ieee1275/datetime.c | 0 .../lib}/libgcrypt/cipher/ChangeLog | 0 {lib => grub-core/lib}/libgcrypt/cipher/ac.c | 0 .../lib}/libgcrypt/cipher/arcfour.c | 0 .../lib}/libgcrypt/cipher/bithelp.h | 0 .../lib}/libgcrypt/cipher/blowfish.c | 0 .../lib}/libgcrypt/cipher/camellia-glue.c | 0 .../lib}/libgcrypt/cipher/camellia.c | 0 .../lib}/libgcrypt/cipher/camellia.h | 0 .../lib}/libgcrypt/cipher/cast5.c | 0 .../lib}/libgcrypt/cipher/cipher.c | 0 {lib => grub-core/lib}/libgcrypt/cipher/crc.c | 0 {lib => grub-core/lib}/libgcrypt/cipher/des.c | 0 {lib => grub-core/lib}/libgcrypt/cipher/dsa.c | 0 {lib => grub-core/lib}/libgcrypt/cipher/ecc.c | 0 .../lib}/libgcrypt/cipher/elgamal.c | 0 .../lib}/libgcrypt/cipher/hash-common.c | 0 .../lib}/libgcrypt/cipher/hash-common.h | 0 .../lib}/libgcrypt/cipher/hmac-tests.c | 0 {lib => grub-core/lib}/libgcrypt/cipher/md.c | 0 {lib => grub-core/lib}/libgcrypt/cipher/md4.c | 0 {lib => grub-core/lib}/libgcrypt/cipher/md5.c | 0 .../lib}/libgcrypt/cipher/primegen.c | 0 .../lib}/libgcrypt/cipher/pubkey.c | 0 .../lib}/libgcrypt/cipher/rfc2268.c | 0 .../lib}/libgcrypt/cipher/rijndael-tables.h | 0 .../lib}/libgcrypt/cipher/rijndael.c | 0 {lib => grub-core/lib}/libgcrypt/cipher/rmd.h | 0 .../lib}/libgcrypt/cipher/rmd160.c | 0 {lib => grub-core/lib}/libgcrypt/cipher/rsa.c | 0 .../lib}/libgcrypt/cipher/seed.c | 0 .../lib}/libgcrypt/cipher/serpent.c | 0 .../lib}/libgcrypt/cipher/sha1.c | 0 .../lib}/libgcrypt/cipher/sha256.c | 0 .../lib}/libgcrypt/cipher/sha512.c | 0 .../lib}/libgcrypt/cipher/tiger.c | 0 .../lib}/libgcrypt/cipher/twofish.c | 0 .../lib}/libgcrypt/cipher/whirlpool.c | 0 .../lib}/libgcrypt_wrap/cipher_wrap.h | 0 {lib => grub-core/lib}/mips/relocator.c | 0 {lib => grub-core/lib}/mips/relocator_asm.S | 0 {lib => grub-core/lib}/mips/setjmp.S | 0 {lib => grub-core/lib}/pbkdf2.c | 0 {lib => grub-core/lib}/posix_wrap/assert.h | 0 {lib => grub-core/lib}/posix_wrap/ctype.h | 0 {lib => grub-core/lib}/posix_wrap/errno.h | 0 {lib => grub-core/lib}/posix_wrap/langinfo.h | 0 {lib => grub-core/lib}/posix_wrap/limits.h | 0 .../lib}/posix_wrap/localcharset.h | 0 {lib => grub-core/lib}/posix_wrap/locale.h | 0 {lib => grub-core/lib}/posix_wrap/stdint.h | 0 {lib => grub-core/lib}/posix_wrap/stdio.h | 0 {lib => grub-core/lib}/posix_wrap/stdlib.h | 1 + {lib => grub-core/lib}/posix_wrap/string.h | 2 + {lib => grub-core/lib}/posix_wrap/sys/types.h | 0 {lib => grub-core/lib}/posix_wrap/unistd.h | 0 {lib => grub-core/lib}/posix_wrap/wchar.h | 0 {lib => grub-core/lib}/posix_wrap/wctype.h | 0 {lib => grub-core/lib}/powerpc/setjmp.S | 0 {lib => grub-core/lib}/relocator.c | 0 {lib => grub-core/lib}/sparc64/setjmp.S | 0 {lib => grub-core/lib}/x86_64/setjmp.S | 0 {loader => grub-core/loader}/aout.c | 0 .../loader}/efi/appleloader.c | 0 .../loader}/efi/chainloader.c | 0 {loader => grub-core/loader}/i386/bsd.c | 0 {loader => grub-core/loader}/i386/bsd32.c | 0 {loader => grub-core/loader}/i386/bsd64.c | 0 {loader => grub-core/loader}/i386/bsdXX.c | 0 .../loader}/i386/bsd_helper.S | 0 .../loader}/i386/bsd_pagetable.c | 0 .../loader}/i386/bsd_trampoline.S | 0 {loader => grub-core/loader}/i386/efi/linux.c | 0 {loader => grub-core/loader}/i386/efi/xnu.c | 0 .../loader}/i386/ieee1275/linux.c | 0 {loader => grub-core/loader}/i386/linux.c | 0 .../loader}/i386/linux_trampoline.S | 0 .../loader}/i386/multiboot_mbi.c | 0 .../loader}/i386/pc/chainloader.c | 0 {loader => grub-core/loader}/i386/pc/linux.c | 0 {loader => grub-core/loader}/i386/pc/xnu.c | 0 {loader => grub-core/loader}/i386/xnu.c | 0 {loader => grub-core/loader}/macho.c | 0 {loader => grub-core/loader}/macho32.c | 0 {loader => grub-core/loader}/macho64.c | 0 {loader => grub-core/loader}/machoXX.c | 0 {loader => grub-core/loader}/mips/linux.c | 0 {loader => grub-core/loader}/multiboot.c | 0 .../loader}/multiboot_elfxx.c | 0 {loader => grub-core/loader}/multiboot_mbi2.c | 0 .../loader}/powerpc/ieee1275/linux.c | 0 .../loader}/sparc64/ieee1275/linux.c | 0 {loader => grub-core/loader}/xnu.c | 0 {loader => grub-core/loader}/xnu_resume.c | 0 {mmap => grub-core/mmap}/efi/mmap.c | 0 {mmap => grub-core/mmap}/i386/mmap.c | 0 {mmap => grub-core/mmap}/i386/pc/mmap.c | 0 .../mmap}/i386/pc/mmap_helper.S | 0 {mmap => grub-core/mmap}/i386/uppermem.c | 0 .../mmap}/mips/yeeloong/uppermem.c | 0 {mmap => grub-core/mmap}/mmap.c | 0 grub-core/modules.def | 1592 +++++++++++++++++ {normal => grub-core/normal}/auth.c | 0 {normal => grub-core/normal}/autofs.c | 0 {normal => grub-core/normal}/cmdline.c | 0 {normal => grub-core/normal}/color.c | 0 {normal => grub-core/normal}/completion.c | 0 {normal => grub-core/normal}/context.c | 0 {normal => grub-core/normal}/crypto.c | 0 {normal => grub-core/normal}/datetime.c | 0 {normal => grub-core/normal}/dyncmd.c | 0 {normal => grub-core/normal}/handler.c | 0 {normal => grub-core/normal}/main.c | 0 {normal => grub-core/normal}/menu.c | 0 {normal => grub-core/normal}/menu_entry.c | 0 {normal => grub-core/normal}/menu_text.c | 0 {normal => grub-core/normal}/misc.c | 0 {normal => grub-core/normal}/term.c | 0 {partmap => grub-core/partmap}/acorn.c | 0 {partmap => grub-core/partmap}/amiga.c | 0 {partmap => grub-core/partmap}/apple.c | 0 {partmap => grub-core/partmap}/bsdlabel.c | 0 {partmap => grub-core/partmap}/gpt.c | 0 {partmap => grub-core/partmap}/msdos.c | 0 {partmap => grub-core/partmap}/sun.c | 0 {partmap => grub-core/partmap}/sunpc.c | 0 {parttool => grub-core/parttool}/msdospart.c | 0 grub-core/po/Makefile.am | 0 {po => grub-core/po}/POTFILES | 0 {po => grub-core/po}/POTFILES-shell | 0 {po => grub-core/po}/README | 0 {script => grub-core/script}/execute.c | 0 {script => grub-core/script}/function.c | 0 {script => grub-core/script}/lexer.c | 0 {script => grub-core/script}/main.c | 0 {script => grub-core/script}/parser.y | 0 {script => grub-core/script}/script.c | 0 {script => grub-core/script}/yylex.l | 0 {term => grub-core/term}/at_keyboard.c | 0 {term => grub-core/term}/efi/console.c | 0 {term => grub-core/term}/gfxterm.c | 0 {term => grub-core/term}/i386/pc/console.c | 0 {term => grub-core/term}/i386/pc/vga.c | 0 {term => grub-core/term}/i386/pc/vga_text.c | 0 {term => grub-core/term}/i386/vga_common.c | 0 {term => grub-core/term}/ieee1275/ofconsole.c | 0 {term => grub-core/term}/serial.c | 0 {term => grub-core/term}/terminfo.c | 0 {term => grub-core/term}/tparm.c | 0 {term => grub-core/term}/usb_keyboard.c | 0 .../tests}/example_functional_test.c | 2 +- .../tests}/lib/functional_test.c | 0 {tests => grub-core/tests}/lib/test.c | 0 {video => grub-core/video}/bitmap.c | 0 {video => grub-core/video}/bitmap_scale.c | 0 {video => grub-core/video}/efi_gop.c | 0 {video => grub-core/video}/efi_uga.c | 0 {util => grub-core/video/emu}/sdl.c | 0 {video => grub-core/video}/fb/fbblit.c | 0 {video => grub-core/video}/fb/fbfill.c | 0 {video => grub-core/video}/fb/fbutil.c | 0 {video => grub-core/video}/fb/video_fb.c | 0 {video => grub-core/video}/i386/pc/vbe.c | 0 {video => grub-core/video}/ieee1275.c | 0 {video => grub-core/video}/readers/jpeg.c | 0 {video => grub-core/video}/readers/png.c | 0 {video => grub-core/video}/readers/tga.c | 0 {video => grub-core/video}/sm712.c | 0 {video => grub-core/video}/video.c | 0 modules.def | 497 +++++ po/Makefile.am | 0 tests/example_grub_script_test.in | 2 +- tests/lib/unit_test.c | 3 +- tests/util/grub-shell-tester.in | 2 +- tests/util/grub-shell.in | 10 +- util/elf/grub-mkimage.c | 1 + util/grub-editenv.c | 19 +- util/grub-fstest.c | 24 +- util/grub-mkdevicemap.c | 1 + util/grub-mkfont.c | 2 + util/grub-mkpasswd-pbkdf2.c | 32 +- util/grub-mkrawimage.c | 1 + util/grub-mkrelpath.c | 3 +- util/grub-mkrescue.in | 23 +- util/grub-probe.c | 30 +- util/grub-script-check.c | 74 +- util/i386/efi/grub-mkimage.c | 1 + util/i386/pc/grub-setup.c | 30 +- util/lvm.c | 2 +- util/misc.c | 354 +--- util/raid.c | 1 + util/resolve.c | 3 +- util/sparc64/ieee1275/grub-setup.c | 32 +- 810 files changed, 4980 insertions(+), 2508 deletions(-) create mode 100644 ABOUT-NLS create mode 100644 Makefile.am delete mode 100644 Makefile.in create mode 100644 configure.common create mode 100644 docs/Makefile.am delete mode 100644 geninitheader.sh delete mode 100644 genkernsyms.sh.in delete mode 100644 genmk.rb create mode 100644 gentpl.py create mode 100644 grub-core/Makefile.am create mode 100644 grub-core/Makefile.extra-dist create mode 100644 grub-core/Makefile.kernel create mode 100644 grub-core/Makefile.vars rename {boot => grub-core/boot}/i386/pc/boot.S (100%) rename {boot => grub-core/boot}/i386/pc/cdboot.S (100%) rename {boot => grub-core/boot}/i386/pc/diskboot.S (100%) rename {boot => grub-core/boot}/i386/pc/lnxboot.S (100%) rename {boot => grub-core/boot}/i386/pc/pxeboot.S (100%) rename {boot => grub-core/boot}/i386/qemu/boot.S (100%) rename {boot => grub-core/boot}/sparc64/ieee1275/boot.S (100%) rename {boot => grub-core/boot}/sparc64/ieee1275/diskboot.S (100%) rename {bus => grub-core/bus}/bonito.c (100%) rename {util => grub-core/bus/emu}/pci.c (98%) rename {bus => grub-core/bus}/pci.c (100%) rename {util => grub-core/bus/usb/emu}/usb.c (100%) rename {bus => grub-core/bus}/usb/ohci.c (100%) rename {bus => grub-core/bus}/usb/uhci.c (100%) rename {bus => grub-core/bus}/usb/usb.c (100%) rename {bus => grub-core/bus}/usb/usbhub.c (100%) rename {bus => grub-core/bus}/usb/usbtrans.c (100%) rename {commands => grub-core/commands}/acpi.c (100%) rename {commands => grub-core/commands}/blocklist.c (100%) rename {commands => grub-core/commands}/boot.c (100%) rename {commands => grub-core/commands}/cat.c (100%) rename {commands => grub-core/commands}/cmp.c (100%) rename {commands => grub-core/commands}/configfile.c (100%) rename {commands => grub-core/commands}/crc.c (100%) rename {commands => grub-core/commands}/date.c (100%) rename {commands => grub-core/commands}/echo.c (100%) rename {commands => grub-core/commands}/efi/acpi.c (100%) rename {commands => grub-core/commands}/efi/fixvideo.c (100%) rename {commands => grub-core/commands}/efi/loadbios.c (100%) rename {commands => grub-core/commands}/extcmd.c (100%) rename {commands => grub-core/commands}/gptsync.c (100%) rename {commands => grub-core/commands}/halt.c (100%) rename {commands => grub-core/commands}/handler.c (100%) rename {commands => grub-core/commands}/hashsum.c (100%) rename {commands => grub-core/commands}/hdparm.c (100%) rename {commands => grub-core/commands}/help.c (100%) rename {commands => grub-core/commands}/hexdump.c (100%) rename {commands => grub-core/commands}/i386/cpuid.c (100%) rename {commands => grub-core/commands}/i386/pc/acpi.c (100%) rename {commands => grub-core/commands}/i386/pc/drivemap.c (100%) rename {commands => grub-core/commands}/i386/pc/drivemap_int13h.S (100%) rename {commands => grub-core/commands}/i386/pc/halt.c (100%) rename {commands => grub-core/commands}/i386/pc/play.c (100%) rename {commands => grub-core/commands}/i386/pc/pxecmd.c (100%) rename {commands => grub-core/commands}/i386/pc/vbeinfo.c (100%) rename {commands => grub-core/commands}/i386/pc/vbetest.c (100%) rename {commands => grub-core/commands}/ieee1275/suspend.c (100%) rename {commands => grub-core/commands}/iorw.c (100%) rename {commands => grub-core/commands}/keystatus.c (100%) rename {commands => grub-core/commands}/loadenv.c (100%) rename {commands => grub-core/commands}/ls.c (100%) rename {commands => grub-core/commands}/lsmmap.c (100%) rename {commands => grub-core/commands}/lspci.c (100%) rename {commands => grub-core/commands}/memrw.c (100%) rename {commands => grub-core/commands}/minicmd.c (100%) rename {commands => grub-core/commands}/parttool.c (99%) rename {commands => grub-core/commands}/password.c (100%) rename {commands => grub-core/commands}/password_pbkdf2.c (100%) rename {commands => grub-core/commands}/probe.c (100%) rename {commands => grub-core/commands}/read.c (100%) rename {commands => grub-core/commands}/reboot.c (100%) rename {commands => grub-core/commands}/regexp.c (100%) rename {commands => grub-core/commands}/search.c (100%) rename {commands => grub-core/commands}/search_file.c (100%) rename {commands => grub-core/commands}/search_label.c (100%) rename {commands => grub-core/commands}/search_uuid.c (100%) rename {commands => grub-core/commands}/search_wrap.c (100%) rename {commands => grub-core/commands}/setpci.c (100%) rename {commands => grub-core/commands}/sleep.c (100%) rename {commands => grub-core/commands}/terminal.c (100%) rename {commands => grub-core/commands}/test.c (100%) rename {commands => grub-core/commands}/true.c (100%) rename {commands => grub-core/commands}/usbtest.c (100%) rename {commands => grub-core/commands}/videotest.c (100%) rename {commands => grub-core/commands}/xnu_uuid.c (100%) rename {conf => grub-core/conf}/any-emu.rmk (100%) rename {conf => grub-core/conf}/common.rmk (100%) rename {conf => grub-core/conf}/i386-coreboot.rmk (100%) rename {conf => grub-core/conf}/i386-efi.rmk (100%) rename {conf => grub-core/conf}/i386-ieee1275.rmk (100%) rename {conf => grub-core/conf}/i386-multiboot.rmk (100%) rename {conf => grub-core/conf}/i386-pc-cygwin-img-ld.sc (100%) rename {conf => grub-core/conf}/i386-pc.rmk (100%) rename {conf => grub-core/conf}/i386-qemu.rmk (100%) rename {conf => grub-core/conf}/i386.rmk (100%) rename {conf => grub-core/conf}/mips-qemu-mips.rmk (100%) rename {conf => grub-core/conf}/mips-yeeloong.rmk (100%) rename {conf => grub-core/conf}/mips.rmk (100%) rename {conf => grub-core/conf}/powerpc-ieee1275.rmk (100%) rename {conf => grub-core/conf}/sparc64-ieee1275.rmk (100%) rename {conf => grub-core/conf}/tests.rmk (100%) rename {conf => grub-core/conf}/x86-efi.rmk (100%) rename {conf => grub-core/conf}/x86_64-efi.rmk (100%) create mode 100644 grub-core/configure.ac rename {disk => grub-core/disk}/ata.c (100%) rename {disk => grub-core/disk}/ata_pthru.c (100%) rename {disk => grub-core/disk}/dmraid_nvidia.c (100%) rename {disk => grub-core/disk}/efi/efidisk.c (100%) rename {disk => grub-core/disk}/host.c (100%) rename {disk => grub-core/disk}/i386/pc/biosdisk.c (100%) rename {disk => grub-core/disk}/ieee1275/nand.c (100%) rename {disk => grub-core/disk}/ieee1275/ofdisk.c (100%) rename {disk => grub-core/disk}/loopback.c (100%) rename {disk => grub-core/disk}/lvm.c (100%) rename {disk => grub-core/disk}/mdraid_linux.c (100%) rename {disk => grub-core/disk}/memdisk.c (100%) rename {disk => grub-core/disk}/raid.c (100%) rename {disk => grub-core/disk}/raid5_recover.c (100%) rename {disk => grub-core/disk}/raid6_recover.c (100%) rename {disk => grub-core/disk}/scsi.c (100%) rename {disk => grub-core/disk}/usbms.c (100%) rename {efiemu => grub-core/efiemu}/i386/coredetect.c (100%) rename {efiemu => grub-core/efiemu}/i386/loadcore32.c (100%) rename {efiemu => grub-core/efiemu}/i386/loadcore64.c (100%) rename {efiemu => grub-core/efiemu}/i386/pc/cfgtables.c (100%) rename {efiemu => grub-core/efiemu}/loadcore.c (100%) rename {efiemu => grub-core/efiemu}/loadcore32.c (100%) rename {efiemu => grub-core/efiemu}/loadcore64.c (100%) rename {efiemu => grub-core/efiemu}/loadcore_common.c (100%) rename {efiemu => grub-core/efiemu}/main.c (100%) rename {efiemu => grub-core/efiemu}/mm.c (100%) rename {efiemu => grub-core/efiemu}/pnvram.c (100%) rename {efiemu => grub-core/efiemu}/prepare.c (100%) rename {efiemu => grub-core/efiemu}/prepare32.c (100%) rename {efiemu => grub-core/efiemu}/prepare64.c (100%) rename {efiemu => grub-core/efiemu}/runtime/config.h (100%) rename {efiemu => grub-core/efiemu}/runtime/efiemu.S (100%) rename {efiemu => grub-core/efiemu}/runtime/efiemu.c (100%) rename {efiemu => grub-core/efiemu}/runtime/efiemu.sh (100%) rename {efiemu => grub-core/efiemu}/symbols.c (100%) rename {font => grub-core/font}/font.c (100%) rename {font => grub-core/font}/font_cmd.c (100%) rename {fs => grub-core/fs}/affs.c (100%) rename {fs => grub-core/fs}/afs.c (100%) rename {fs => grub-core/fs}/afs_be.c (100%) rename {fs => grub-core/fs}/befs.c (100%) rename {fs => grub-core/fs}/befs_be.c (100%) rename {fs => grub-core/fs}/cpio.c (100%) rename {fs => grub-core/fs}/ext2.c (100%) rename {fs => grub-core/fs}/fat.c (100%) rename {fs => grub-core/fs}/fshelp.c (100%) rename {fs => grub-core/fs}/hfs.c (100%) rename {fs => grub-core/fs}/hfsplus.c (100%) rename {fs => grub-core/fs}/i386/pc/pxe.c (100%) rename {fs => grub-core/fs}/iso9660.c (100%) rename {fs => grub-core/fs}/jfs.c (100%) rename {fs => grub-core/fs}/minix.c (100%) rename {fs => grub-core/fs}/nilfs2.c (100%) rename {fs => grub-core/fs}/ntfs.c (100%) rename {fs => grub-core/fs}/ntfscomp.c (100%) rename {fs => grub-core/fs}/reiserfs.c (100%) rename {fs => grub-core/fs}/sfs.c (100%) rename {fs => grub-core/fs}/tar.c (100%) rename {fs => grub-core/fs}/udf.c (100%) rename {fs => grub-core/fs}/ufs.c (100%) rename {fs => grub-core/fs}/ufs2.c (100%) rename {fs => grub-core/fs}/xfs.c (100%) rename gencmdlist.sh => grub-core/gencmdlist.sh (100%) rename gendistlist.sh => grub-core/gendistlist.sh (100%) rename genemuinit.sh => grub-core/genemuinit.sh (100%) rename genemuinitheader.sh => grub-core/genemuinitheader.sh (100%) rename genfslist.sh => grub-core/genfslist.sh (100%) rename genhandlerlist.sh => grub-core/genhandlerlist.sh (100%) rename genmoddep.awk => grub-core/genmoddep.awk (93%) rename genmodsrc.sh => grub-core/genmodsrc.sh (100%) rename genpartmaplist.sh => grub-core/genpartmaplist.sh (100%) rename genparttoollist.sh => grub-core/genparttoollist.sh (100%) rename gensymlist.sh.in => grub-core/gensymlist.sh (84%) rename genterminallist.sh => grub-core/genterminallist.sh (100%) rename gentrigtables.c => grub-core/gentrigtables.c (93%) rename genvideolist.sh => grub-core/genvideolist.sh (100%) rename {gettext => grub-core/gettext}/gettext.c (100%) rename {gfxmenu => grub-core/gfxmenu}/gfxmenu.c (100%) rename {gfxmenu => grub-core/gfxmenu}/gui_box.c (100%) rename {gfxmenu => grub-core/gfxmenu}/gui_canvas.c (100%) rename {gfxmenu => grub-core/gfxmenu}/gui_circular_progress.c (100%) rename {gfxmenu => grub-core/gfxmenu}/gui_image.c (100%) rename {gfxmenu => grub-core/gfxmenu}/gui_label.c (100%) rename {gfxmenu => grub-core/gfxmenu}/gui_list.c (100%) rename {gfxmenu => grub-core/gfxmenu}/gui_progress_bar.c (100%) rename {gfxmenu => grub-core/gfxmenu}/gui_string_util.c (100%) rename {gfxmenu => grub-core/gfxmenu}/gui_util.c (100%) rename {gfxmenu => grub-core/gfxmenu}/icon_manager.c (100%) rename {gfxmenu => grub-core/gfxmenu}/model.c (100%) rename {gfxmenu => grub-core/gfxmenu}/named_colors.c (100%) rename {gfxmenu => grub-core/gfxmenu}/theme_loader.c (100%) rename {gfxmenu => grub-core/gfxmenu}/view.c (100%) rename {gfxmenu => grub-core/gfxmenu}/widget-box.c (100%) rename {gnulib => grub-core/gnulib}/alloca.h (100%) rename {gnulib => grub-core/gnulib}/argp-ba.c (100%) rename {gnulib => grub-core/gnulib}/argp-eexst.c (100%) rename {gnulib => grub-core/gnulib}/argp-fmtstream.c (100%) rename {gnulib => grub-core/gnulib}/argp-fmtstream.h (100%) rename {gnulib => grub-core/gnulib}/argp-fs-xinl.c (100%) rename {gnulib => grub-core/gnulib}/argp-help.c (100%) rename {gnulib => grub-core/gnulib}/argp-namefrob.h (100%) rename {gnulib => grub-core/gnulib}/argp-parse.c (100%) rename {gnulib => grub-core/gnulib}/argp-pin.c (100%) rename {gnulib => grub-core/gnulib}/argp-pv.c (100%) rename {gnulib => grub-core/gnulib}/argp-pvh.c (100%) rename {gnulib => grub-core/gnulib}/argp-version-etc.c (100%) rename {gnulib => grub-core/gnulib}/argp-version-etc.h (100%) rename {gnulib => grub-core/gnulib}/argp-xinl.c (100%) rename {gnulib => grub-core/gnulib}/argp.h (100%) rename {gnulib => grub-core/gnulib}/error.c (100%) rename {gnulib => grub-core/gnulib}/error.h (100%) rename {gnulib => grub-core/gnulib}/fnmatch.c (100%) rename {gnulib => grub-core/gnulib}/fnmatch.h (100%) rename {gnulib => grub-core/gnulib}/fnmatch_loop.c (100%) rename {gnulib => grub-core/gnulib}/getdelim.c (100%) rename {gnulib => grub-core/gnulib}/getline.c (100%) rename {gnulib => grub-core/gnulib}/getopt.c (100%) rename {gnulib => grub-core/gnulib}/getopt.h (100%) rename {gnulib => grub-core/gnulib}/getopt1.c (100%) rename {gnulib => grub-core/gnulib}/getopt_int.h (100%) rename {gnulib => grub-core/gnulib}/gettext.h (100%) rename {gnulib => grub-core/gnulib}/progname.c (100%) rename {gnulib => grub-core/gnulib}/progname.h (100%) rename {gnulib => grub-core/gnulib}/regcomp.c (100%) rename {gnulib => grub-core/gnulib}/regex.c (100%) rename {gnulib => grub-core/gnulib}/regex.h (100%) rename {gnulib => grub-core/gnulib}/regex_internal.c (100%) rename {gnulib => grub-core/gnulib}/regex_internal.h (100%) rename {gnulib => grub-core/gnulib}/regexec.c (100%) rename {hello => grub-core/hello}/hello.c (100%) rename {hook => grub-core/hook}/datehook.c (100%) rename {util => grub-core}/import_gcry.py (100%) rename {include => grub-core/include}/grub/acorn_filecore.h (100%) rename {include => grub-core/include}/grub/acpi.h (100%) rename {include => grub-core/include}/grub/aout.h (100%) rename {include => grub-core/include}/grub/at_keyboard.h (100%) rename {include => grub-core/include}/grub/ata.h (100%) rename {include => grub-core/include}/grub/auth.h (100%) rename {include => grub-core/include}/grub/autoefi.h (100%) rename {include => grub-core/include}/grub/bitmap.h (100%) rename {include => grub-core/include}/grub/bitmap_scale.h (100%) rename {include => grub-core/include}/grub/boot.h (100%) rename {include => grub-core/include}/grub/bsdlabel.h (100%) rename {include => grub-core/include}/grub/bufio.h (100%) rename {include => grub-core/include}/grub/cache.h (100%) rename {include => grub-core/include}/grub/charset.h (100%) rename {include => grub-core/include}/grub/cmos.h (100%) rename {include => grub-core/include}/grub/command.h (100%) rename {include => grub-core/include}/grub/crypto.h (100%) rename {include => grub-core/include}/grub/datetime.h (100%) rename {include => grub-core/include}/grub/device.h (100%) rename {include => grub-core/include}/grub/disk.h (100%) rename {include => grub-core/include}/grub/dl.h (90%) rename {include => grub-core/include}/grub/efi/api.h (100%) rename {include => grub-core/include}/grub/efi/console.h (100%) rename {include => grub-core/include}/grub/efi/console_control.h (100%) rename {include => grub-core/include}/grub/efi/disk.h (100%) rename {include => grub-core/include}/grub/efi/efi.h (100%) rename {include => grub-core/include}/grub/efi/graphics_output.h (100%) rename {include => grub-core/include}/grub/efi/memory.h (100%) rename {include => grub-core/include}/grub/efi/pe32.h (100%) rename {include => grub-core/include}/grub/efi/time.h (100%) rename {include => grub-core/include}/grub/efi/uga_draw.h (100%) rename {include => grub-core/include}/grub/efiemu/efiemu.h (100%) rename {include => grub-core/include}/grub/efiemu/runtime.h (100%) rename {include => grub-core/include}/grub/elf.h (100%) rename {include => grub-core/include}/grub/elfload.h (100%) rename {include/grub/util => grub-core/include/grub/emu}/console.h (100%) rename {include/grub/util => grub-core/include/grub/emu}/getroot.h (94%) rename {include/grub/util => grub-core/include/grub/emu}/hostdisk.h (100%) create mode 100644 grub-core/include/grub/emu/misc.h rename {include => grub-core/include}/grub/env.h (100%) rename {include => grub-core/include}/grub/env_private.h (100%) rename {include => grub-core/include}/grub/err.h (100%) rename {include => grub-core/include}/grub/extcmd.h (100%) rename {include => grub-core/include}/grub/fbblit.h (100%) rename {include => grub-core/include}/grub/fbfill.h (100%) rename {include => grub-core/include}/grub/fbutil.h (100%) rename {include => grub-core/include}/grub/file.h (100%) rename {include => grub-core/include}/grub/font.h (100%) rename {include => grub-core/include}/grub/fontformat.h (100%) rename {include => grub-core/include}/grub/fs.h (100%) rename {include => grub-core/include}/grub/fshelp.h (100%) rename {include => grub-core/include}/grub/gfxmenu_model.h (100%) rename {include => grub-core/include}/grub/gfxmenu_view.h (100%) rename {include => grub-core/include}/grub/gfxterm.h (100%) rename {include => grub-core/include}/grub/gfxwidgets.h (100%) rename {include => grub-core/include}/grub/gpt_partition.h (100%) rename {include => grub-core/include}/grub/gui.h (100%) rename {include => grub-core/include}/grub/gui_string_util.h (100%) rename {include => grub-core/include}/grub/gzio.h (100%) rename {include => grub-core/include}/grub/handler.h (100%) rename {include => grub-core/include}/grub/hfs.h (100%) rename {include => grub-core/include}/grub/i18n.h (100%) rename {include => grub-core/include}/grub/i386/at_keyboard.h (100%) rename {include => grub-core/include}/grub/i386/bsd.h (100%) rename {include => grub-core/include}/grub/i386/cmos.h (100%) rename {include => grub-core/include}/grub/i386/coreboot/boot.h (100%) rename {include => grub-core/include}/grub/i386/coreboot/console.h (100%) rename {include => grub-core/include}/grub/i386/coreboot/init.h (100%) rename {include => grub-core/include}/grub/i386/coreboot/kernel.h (100%) rename {include => grub-core/include}/grub/i386/coreboot/loader.h (100%) rename {include => grub-core/include}/grub/i386/coreboot/memory.h (100%) rename {include => grub-core/include}/grub/i386/coreboot/serial.h (100%) rename {include => grub-core/include}/grub/i386/coreboot/time.h (100%) rename {include => grub-core/include}/grub/i386/cpuid.h (100%) rename {include => grub-core/include}/grub/i386/efi/kernel.h (100%) rename {include => grub-core/include}/grub/i386/efi/loader.h (100%) rename {include => grub-core/include}/grub/i386/efi/memory.h (100%) rename {include => grub-core/include}/grub/i386/efi/serial.h (100%) rename {include => grub-core/include}/grub/i386/efi/time.h (100%) rename {include => grub-core/include}/grub/i386/efiemu.h (100%) rename {include => grub-core/include}/grub/i386/freebsd_linker.h (100%) rename {include => grub-core/include}/grub/i386/freebsd_reboot.h (100%) rename {include => grub-core/include}/grub/i386/ieee1275/console.h (100%) rename {include => grub-core/include}/grub/i386/ieee1275/ieee1275.h (100%) rename {include => grub-core/include}/grub/i386/ieee1275/kernel.h (100%) rename {include => grub-core/include}/grub/i386/ieee1275/loader.h (100%) rename {include => grub-core/include}/grub/i386/ieee1275/memory.h (100%) rename {include => grub-core/include}/grub/i386/ieee1275/serial.h (100%) rename {include => grub-core/include}/grub/i386/ieee1275/time.h (100%) rename {include => grub-core/include}/grub/i386/io.h (100%) rename {include => grub-core/include}/grub/i386/kernel.h (100%) rename {include => grub-core/include}/grub/i386/linux.h (100%) rename {include => grub-core/include}/grub/i386/loader.h (100%) rename {include => grub-core/include}/grub/i386/macho.h (100%) rename {include => grub-core/include}/grub/i386/memory.h (100%) rename {include => grub-core/include}/grub/i386/multiboot.h (100%) rename {include => grub-core/include}/grub/i386/multiboot/boot.h (100%) rename {include => grub-core/include}/grub/i386/multiboot/console.h (100%) rename {include => grub-core/include}/grub/i386/multiboot/init.h (100%) rename {include => grub-core/include}/grub/i386/multiboot/kernel.h (100%) rename {include => grub-core/include}/grub/i386/multiboot/loader.h (100%) rename {include => grub-core/include}/grub/i386/multiboot/memory.h (100%) rename {include => grub-core/include}/grub/i386/multiboot/serial.h (100%) rename {include => grub-core/include}/grub/i386/multiboot/time.h (100%) rename {include => grub-core/include}/grub/i386/netbsd_bootinfo.h (100%) rename {include => grub-core/include}/grub/i386/netbsd_reboot.h (100%) rename {include => grub-core/include}/grub/i386/openbsd_bootarg.h (100%) rename {include => grub-core/include}/grub/i386/openbsd_reboot.h (100%) rename {include => grub-core/include}/grub/i386/pc/biosdisk.h (100%) rename {include => grub-core/include}/grub/i386/pc/biosnum.h (100%) rename {include => grub-core/include}/grub/i386/pc/boot.h (100%) rename {include => grub-core/include}/grub/i386/pc/chainloader.h (100%) rename {include => grub-core/include}/grub/i386/pc/console.h (100%) rename {include => grub-core/include}/grub/i386/pc/efiemu.h (100%) rename {include => grub-core/include}/grub/i386/pc/init.h (100%) rename {include => grub-core/include}/grub/i386/pc/kernel.h (100%) rename {include => grub-core/include}/grub/i386/pc/loader.h (100%) rename {include => grub-core/include}/grub/i386/pc/memory.h (100%) rename {include => grub-core/include}/grub/i386/pc/pxe.h (100%) rename {include => grub-core/include}/grub/i386/pc/time.h (100%) rename {include => grub-core/include}/grub/i386/pc/vbe.h (100%) rename {include => grub-core/include}/grub/i386/pc/vga.h (100%) rename {include => grub-core/include}/grub/i386/pci.h (100%) rename {include => grub-core/include}/grub/i386/pit.h (100%) rename {include => grub-core/include}/grub/i386/qemu/boot.h (100%) rename {include => grub-core/include}/grub/i386/qemu/console.h (100%) rename {include => grub-core/include}/grub/i386/qemu/init.h (100%) rename {include => grub-core/include}/grub/i386/qemu/kernel.h (100%) rename {include => grub-core/include}/grub/i386/qemu/loader.h (100%) rename {include => grub-core/include}/grub/i386/qemu/memory.h (100%) rename {include => grub-core/include}/grub/i386/qemu/serial.h (100%) rename {include => grub-core/include}/grub/i386/qemu/time.h (100%) rename {include => grub-core/include}/grub/i386/relocator.h (100%) rename {include => grub-core/include}/grub/i386/setjmp.h (100%) rename {include => grub-core/include}/grub/i386/time.h (100%) rename {include => grub-core/include}/grub/i386/tsc.h (100%) rename {include => grub-core/include}/grub/i386/types.h (100%) rename {include => grub-core/include}/grub/i386/vga_common.h (100%) rename {include => grub-core/include}/grub/i386/xnu.h (100%) rename {include => grub-core/include}/grub/icon_manager.h (100%) rename {include => grub-core/include}/grub/ieee1275/ieee1275.h (100%) rename {include => grub-core/include}/grub/ieee1275/ofdisk.h (100%) rename {include => grub-core/include}/grub/kernel.h (100%) rename {include => grub-core/include}/grub/lib/LzFind.h (100%) rename {include => grub-core/include}/grub/lib/LzHash.h (100%) rename {include => grub-core/include}/grub/lib/LzmaDec.h (100%) rename {include => grub-core/include}/grub/lib/LzmaEnc.h (100%) rename {include => grub-core/include}/grub/lib/LzmaTypes.h (100%) rename {include => grub-core/include}/grub/lib/arg.h (100%) rename {include => grub-core/include}/grub/lib/crc.h (100%) rename {include => grub-core/include}/grub/lib/envblk.h (100%) rename {include => grub-core/include}/grub/lib/hexdump.h (100%) rename {include => grub-core/include}/grub/libgcc.h (100%) rename {include => grub-core/include}/grub/libpciaccess.h (100%) rename {include => grub-core/include}/grub/libusb.h (100%) rename {include => grub-core/include}/grub/list.h (100%) rename {include => grub-core/include}/grub/loader.h (100%) rename {include => grub-core/include}/grub/lvm.h (100%) rename {include => grub-core/include}/grub/macho.h (100%) rename {include => grub-core/include}/grub/machoload.h (100%) rename {include => grub-core/include}/grub/memory.h (100%) rename {include => grub-core/include}/grub/menu.h (100%) rename {include => grub-core/include}/grub/menu_viewer.h (100%) rename {include => grub-core/include}/grub/mips/at_keyboard.h (100%) rename {include => grub-core/include}/grub/mips/cache.h (100%) rename {include => grub-core/include}/grub/mips/cmos.h (100%) rename {include => grub-core/include}/grub/mips/io.h (100%) rename {include => grub-core/include}/grub/mips/kernel.h (100%) rename {include => grub-core/include}/grub/mips/multiboot.h (100%) rename {include => grub-core/include}/grub/mips/pci.h (100%) rename {include => grub-core/include}/grub/mips/qemu-mips/boot.h (100%) rename {include => grub-core/include}/grub/mips/qemu-mips/kernel.h (100%) rename {include => grub-core/include}/grub/mips/qemu-mips/loader.h (100%) rename {include => grub-core/include}/grub/mips/qemu-mips/memory.h (100%) rename {include => grub-core/include}/grub/mips/qemu-mips/serial.h (100%) rename {include => grub-core/include}/grub/mips/qemu-mips/time.h (100%) rename {include => grub-core/include}/grub/mips/relocator.h (100%) rename {include => grub-core/include}/grub/mips/setjmp.h (100%) rename {include => grub-core/include}/grub/mips/time.h (100%) rename {include => grub-core/include}/grub/mips/types.h (100%) rename {include => grub-core/include}/grub/mips/yeeloong/at_keyboard.h (100%) rename {include => grub-core/include}/grub/mips/yeeloong/boot.h (100%) rename {include => grub-core/include}/grub/mips/yeeloong/cmos.h (100%) rename {include => grub-core/include}/grub/mips/yeeloong/kernel.h (100%) rename {include => grub-core/include}/grub/mips/yeeloong/loader.h (100%) rename {include => grub-core/include}/grub/mips/yeeloong/memory.h (100%) rename {include => grub-core/include}/grub/mips/yeeloong/pci.h (100%) rename {include => grub-core/include}/grub/mips/yeeloong/serial.h (100%) rename {include => grub-core/include}/grub/mips/yeeloong/time.h (100%) rename {include => grub-core/include}/grub/misc.h (100%) rename {include => grub-core/include}/grub/mm.h (100%) rename {include => grub-core/include}/grub/msdos_partition.h (100%) rename {include => grub-core/include}/grub/multiboot.h (100%) rename {include => grub-core/include}/grub/multiboot_loader.h (100%) rename {include => grub-core/include}/grub/net.h (100%) rename {include => grub-core/include}/grub/normal.h (100%) rename {include => grub-core/include}/grub/ntfs.h (100%) rename {include => grub-core/include}/grub/parser.h (100%) rename {include => grub-core/include}/grub/partition.h (100%) rename {include => grub-core/include}/grub/parttool.h (100%) rename {include => grub-core/include}/grub/pci.h (100%) rename {include => grub-core/include}/grub/pciutils.h (100%) rename {include => grub-core/include}/grub/powerpc/ieee1275/biosdisk.h (100%) rename {include => grub-core/include}/grub/powerpc/ieee1275/console.h (100%) rename {include => grub-core/include}/grub/powerpc/ieee1275/ieee1275.h (100%) rename {include => grub-core/include}/grub/powerpc/ieee1275/kernel.h (100%) rename {include => grub-core/include}/grub/powerpc/ieee1275/loader.h (100%) rename {include => grub-core/include}/grub/powerpc/ieee1275/memory.h (100%) rename {include => grub-core/include}/grub/powerpc/ieee1275/time.h (100%) rename {include => grub-core/include}/grub/powerpc/ieee1275/util/biosdisk.h (100%) rename {include => grub-core/include}/grub/powerpc/kernel.h (100%) rename {include => grub-core/include}/grub/powerpc/setjmp.h (100%) rename {include => grub-core/include}/grub/powerpc/time.h (100%) rename {include => grub-core/include}/grub/powerpc/types.h (100%) rename {include => grub-core/include}/grub/raid.h (100%) rename {include => grub-core/include}/grub/reader.h (100%) rename {include => grub-core/include}/grub/script_sh.h (100%) rename {include => grub-core/include}/grub/scsi.h (100%) rename {include => grub-core/include}/grub/scsicmd.h (100%) rename {include => grub-core/include}/grub/sdl.h (100%) rename {include => grub-core/include}/grub/search.h (100%) rename {include => grub-core/include}/grub/serial.h (100%) rename {include => grub-core/include}/grub/setjmp.h (100%) rename {include => grub-core/include}/grub/sparc64/ieee1275/boot.h (100%) rename {include => grub-core/include}/grub/sparc64/ieee1275/console.h (100%) rename {include => grub-core/include}/grub/sparc64/ieee1275/ieee1275.h (100%) rename {include => grub-core/include}/grub/sparc64/ieee1275/kernel.h (100%) rename {include => grub-core/include}/grub/sparc64/ieee1275/loader.h (100%) rename {include => grub-core/include}/grub/sparc64/ieee1275/memory.h (100%) rename {include => grub-core/include}/grub/sparc64/ieee1275/time.h (100%) rename {include => grub-core/include}/grub/sparc64/kernel.h (100%) rename {include => grub-core/include}/grub/sparc64/setjmp.h (100%) rename {include => grub-core/include}/grub/sparc64/time.h (100%) rename {include => grub-core/include}/grub/sparc64/types.h (100%) rename {include => grub-core/include}/grub/symbol.h (100%) rename {include => grub-core/include}/grub/term.h (100%) rename {include => grub-core/include}/grub/terminfo.h (100%) rename {include => grub-core/include}/grub/test.h (93%) rename {include => grub-core/include}/grub/time.h (100%) rename {include => grub-core/include}/grub/tparm.h (100%) rename {include => grub-core/include}/grub/trig.h (100%) rename {include => grub-core/include}/grub/types.h (100%) rename {include => grub-core/include}/grub/usb.h (100%) rename {include => grub-core/include}/grub/usbdesc.h (100%) rename {include => grub-core/include}/grub/usbtrans.h (100%) rename {include => grub-core/include}/grub/util/deviceiter.h (100%) rename {include => grub-core/include}/grub/util/lvm.h (100%) rename {include => grub-core/include}/grub/util/misc.h (85%) rename {include => grub-core/include}/grub/util/ofpath.h (100%) rename {include => grub-core/include}/grub/util/raid.h (100%) rename {include => grub-core/include}/grub/util/resolve.h (100%) rename {include => grub-core/include}/grub/video.h (100%) rename {include => grub-core/include}/grub/video_fb.h (100%) rename {include => grub-core/include}/grub/x86_64/at_keyboard.h (100%) rename {include => grub-core/include}/grub/x86_64/efi/kernel.h (100%) rename {include => grub-core/include}/grub/x86_64/efi/loader.h (100%) rename {include => grub-core/include}/grub/x86_64/efi/memory.h (100%) rename {include => grub-core/include}/grub/x86_64/efi/serial.h (100%) rename {include => grub-core/include}/grub/x86_64/efi/time.h (100%) rename {include => grub-core/include}/grub/x86_64/io.h (100%) rename {include => grub-core/include}/grub/x86_64/kernel.h (100%) rename {include => grub-core/include}/grub/x86_64/linux.h (100%) rename {include => grub-core/include}/grub/x86_64/macho.h (100%) rename {include => grub-core/include}/grub/x86_64/multiboot.h (100%) rename {include => grub-core/include}/grub/x86_64/pci.h (100%) rename {include => grub-core/include}/grub/x86_64/relocator.h (100%) rename {include => grub-core/include}/grub/x86_64/setjmp.h (100%) rename {include => grub-core/include}/grub/x86_64/time.h (100%) rename {include => grub-core/include}/grub/x86_64/types.h (100%) rename {include => grub-core/include}/grub/x86_64/xnu.h (100%) rename {include => grub-core/include}/grub/xnu.h (100%) rename {include => grub-core/include}/multiboot.h (100%) rename {include => grub-core/include}/multiboot2.h (100%) rename {io => grub-core/io}/bufio.c (100%) rename {io => grub-core/io}/gzio.c (100%) rename {kern => grub-core/kern}/command.c (100%) rename {kern => grub-core/kern}/corecmd.c (100%) rename {kern => grub-core/kern}/device.c (100%) rename {kern => grub-core/kern}/disk.c (100%) rename {kern => grub-core/kern}/dl.c (99%) rename {kern => grub-core/kern}/efi/efi.c (100%) rename {kern => grub-core/kern}/efi/init.c (100%) rename {kern => grub-core/kern}/efi/mm.c (100%) rename {kern => grub-core/kern}/elf.c (100%) create mode 100644 grub-core/kern/emu/cache.S rename {util => grub-core/kern/emu}/console.c (99%) create mode 100644 grub-core/kern/emu/dl.c create mode 100644 grub-core/kern/emu/dummy/dl.c create mode 100644 grub-core/kern/emu/dummy/symlist.c rename {util => grub-core/kern/emu}/getroot.c (82%) rename {util => grub-core/kern/emu}/hostdisk.c (99%) rename {util => grub-core/kern/emu}/hostfs.c (100%) create mode 100644 grub-core/kern/emu/lite.c rename util/grub-emu.c => grub-core/kern/emu/main.c (90%) create mode 100644 grub-core/kern/emu/misc.c rename {util => grub-core/kern/emu}/time.c (100%) rename {kern => grub-core/kern}/env.c (100%) rename {kern => grub-core/kern}/err.c (100%) rename {kern => grub-core/kern}/file.c (100%) rename {kern => grub-core/kern}/fs.c (100%) rename {kern => grub-core/kern}/generic/millisleep.c (100%) rename {kern => grub-core/kern}/generic/rtc_get_time_ms.c (100%) rename {kern => grub-core/kern}/handler.c (100%) rename {kern => grub-core/kern}/i386/coreboot/init.c (100%) rename {kern => grub-core/kern}/i386/coreboot/mmap.c (100%) rename {kern => grub-core/kern}/i386/coreboot/startup.S (100%) rename {kern => grub-core/kern}/i386/dl.c (100%) rename {kern => grub-core/kern}/i386/efi/init.c (100%) rename {kern => grub-core/kern}/i386/efi/startup.S (100%) rename {kern => grub-core/kern}/i386/halt.c (100%) rename {kern => grub-core/kern}/i386/ieee1275/init.c (100%) rename {kern => grub-core/kern}/i386/ieee1275/startup.S (100%) rename {kern => grub-core/kern}/i386/loader.S (100%) rename {kern => grub-core/kern}/i386/misc.S (100%) rename {kern => grub-core/kern}/i386/multiboot_mmap.c (100%) rename {kern => grub-core/kern}/i386/pc/init.c (100%) rename {kern => grub-core/kern}/i386/pc/lzma_decode.S (100%) rename {kern => grub-core/kern}/i386/pc/mmap.c (100%) rename {kern => grub-core/kern}/i386/pc/startup.S (100%) rename {kern => grub-core/kern}/i386/pit.c (100%) rename {kern => grub-core/kern}/i386/qemu/mmap.c (100%) rename {kern => grub-core/kern}/i386/qemu/startup.S (100%) rename {kern => grub-core/kern}/i386/realmode.S (100%) rename {kern => grub-core/kern}/i386/tsc.c (100%) rename {kern => grub-core/kern}/ieee1275/cmain.c (100%) rename {kern => grub-core/kern}/ieee1275/ieee1275.c (100%) rename {kern => grub-core/kern}/ieee1275/init.c (100%) rename {kern => grub-core/kern}/ieee1275/mmap.c (100%) rename {kern => grub-core/kern}/ieee1275/openfw.c (100%) rename {kern => grub-core/kern}/list.c (100%) rename {kern => grub-core/kern}/main.c (100%) rename {kern => grub-core/kern}/mips/cache.S (100%) rename {kern => grub-core/kern}/mips/cache_flush.S (100%) rename {kern => grub-core/kern}/mips/dl.c (100%) rename {kern => grub-core/kern}/mips/init.c (100%) rename {kern => grub-core/kern}/mips/qemu-mips/init.c (100%) rename {kern => grub-core/kern}/mips/startup.S (100%) rename {kern => grub-core/kern}/mips/yeeloong/init.c (100%) rename {kern => grub-core/kern}/misc.c (100%) rename {kern => grub-core/kern}/mm.c (100%) rename {kern => grub-core/kern}/parser.c (100%) rename {kern => grub-core/kern}/partition.c (100%) rename {kern => grub-core/kern}/powerpc/cache.S (100%) rename {kern => grub-core/kern}/powerpc/dl.c (100%) rename {kern => grub-core/kern}/powerpc/ieee1275/startup.S (100%) rename {kern => grub-core/kern}/rescue_parser.c (100%) rename {kern => grub-core/kern}/rescue_reader.c (100%) rename {kern => grub-core/kern}/sparc64/cache.S (100%) rename {kern => grub-core/kern}/sparc64/dl.c (100%) rename {kern => grub-core/kern}/sparc64/ieee1275/crt0.S (100%) rename {kern => grub-core/kern}/sparc64/ieee1275/ieee1275.c (100%) rename {kern => grub-core/kern}/sparc64/ieee1275/init.c (100%) rename {kern => grub-core/kern}/term.c (100%) rename {kern => grub-core/kern}/time.c (100%) rename {kern => grub-core/kern}/x86_64/dl.c (100%) rename {kern => grub-core/kern}/x86_64/efi/callwrap.S (100%) rename {kern => grub-core/kern}/x86_64/efi/startup.S (100%) rename {lib => grub-core/lib}/LzFind.c (100%) rename {lib => grub-core/lib}/LzmaDec.c (100%) rename {lib => grub-core/lib}/LzmaEnc.c (100%) rename {lib => grub-core/lib}/arg.c (100%) rename {lib => grub-core/lib}/charset.c (100%) rename {lib => grub-core/lib}/cmos_datetime.c (100%) rename {lib => grub-core/lib}/crc.c (100%) rename {lib => grub-core/lib}/crypto.c (100%) rename {lib => grub-core/lib}/efi/datetime.c (100%) rename {lib => grub-core/lib}/envblk.c (100%) rename {lib => grub-core/lib}/hexdump.c (100%) rename {lib => grub-core/lib}/i386/pc/biosnum.c (100%) rename {lib => grub-core/lib}/i386/relocator.c (100%) rename {lib => grub-core/lib}/i386/relocator_asm.S (100%) rename {lib => grub-core/lib}/i386/relocator_backward.S (100%) rename {lib => grub-core/lib}/i386/setjmp.S (100%) rename {lib => grub-core/lib}/ieee1275/datetime.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/ChangeLog (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/ac.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/arcfour.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/bithelp.h (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/blowfish.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/camellia-glue.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/camellia.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/camellia.h (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/cast5.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/cipher.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/crc.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/des.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/dsa.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/ecc.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/elgamal.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/hash-common.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/hash-common.h (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/hmac-tests.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/md.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/md4.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/md5.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/primegen.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/pubkey.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/rfc2268.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/rijndael-tables.h (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/rijndael.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/rmd.h (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/rmd160.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/rsa.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/seed.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/serpent.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/sha1.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/sha256.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/sha512.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/tiger.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/twofish.c (100%) rename {lib => grub-core/lib}/libgcrypt/cipher/whirlpool.c (100%) rename {lib => grub-core/lib}/libgcrypt_wrap/cipher_wrap.h (100%) rename {lib => grub-core/lib}/mips/relocator.c (100%) rename {lib => grub-core/lib}/mips/relocator_asm.S (100%) rename {lib => grub-core/lib}/mips/setjmp.S (100%) rename {lib => grub-core/lib}/pbkdf2.c (100%) rename {lib => grub-core/lib}/posix_wrap/assert.h (100%) rename {lib => grub-core/lib}/posix_wrap/ctype.h (100%) rename {lib => grub-core/lib}/posix_wrap/errno.h (100%) rename {lib => grub-core/lib}/posix_wrap/langinfo.h (100%) rename {lib => grub-core/lib}/posix_wrap/limits.h (100%) rename {lib => grub-core/lib}/posix_wrap/localcharset.h (100%) rename {lib => grub-core/lib}/posix_wrap/locale.h (100%) rename {lib => grub-core/lib}/posix_wrap/stdint.h (100%) rename {lib => grub-core/lib}/posix_wrap/stdio.h (100%) rename {lib => grub-core/lib}/posix_wrap/stdlib.h (98%) rename {lib => grub-core/lib}/posix_wrap/string.h (97%) rename {lib => grub-core/lib}/posix_wrap/sys/types.h (100%) rename {lib => grub-core/lib}/posix_wrap/unistd.h (100%) rename {lib => grub-core/lib}/posix_wrap/wchar.h (100%) rename {lib => grub-core/lib}/posix_wrap/wctype.h (100%) rename {lib => grub-core/lib}/powerpc/setjmp.S (100%) rename {lib => grub-core/lib}/relocator.c (100%) rename {lib => grub-core/lib}/sparc64/setjmp.S (100%) rename {lib => grub-core/lib}/x86_64/setjmp.S (100%) rename {loader => grub-core/loader}/aout.c (100%) rename {loader => grub-core/loader}/efi/appleloader.c (100%) rename {loader => grub-core/loader}/efi/chainloader.c (100%) rename {loader => grub-core/loader}/i386/bsd.c (100%) rename {loader => grub-core/loader}/i386/bsd32.c (100%) rename {loader => grub-core/loader}/i386/bsd64.c (100%) rename {loader => grub-core/loader}/i386/bsdXX.c (100%) rename {loader => grub-core/loader}/i386/bsd_helper.S (100%) rename {loader => grub-core/loader}/i386/bsd_pagetable.c (100%) rename {loader => grub-core/loader}/i386/bsd_trampoline.S (100%) rename {loader => grub-core/loader}/i386/efi/linux.c (100%) rename {loader => grub-core/loader}/i386/efi/xnu.c (100%) rename {loader => grub-core/loader}/i386/ieee1275/linux.c (100%) rename {loader => grub-core/loader}/i386/linux.c (100%) rename {loader => grub-core/loader}/i386/linux_trampoline.S (100%) rename {loader => grub-core/loader}/i386/multiboot_mbi.c (100%) rename {loader => grub-core/loader}/i386/pc/chainloader.c (100%) rename {loader => grub-core/loader}/i386/pc/linux.c (100%) rename {loader => grub-core/loader}/i386/pc/xnu.c (100%) rename {loader => grub-core/loader}/i386/xnu.c (100%) rename {loader => grub-core/loader}/macho.c (100%) rename {loader => grub-core/loader}/macho32.c (100%) rename {loader => grub-core/loader}/macho64.c (100%) rename {loader => grub-core/loader}/machoXX.c (100%) rename {loader => grub-core/loader}/mips/linux.c (100%) rename {loader => grub-core/loader}/multiboot.c (100%) rename {loader => grub-core/loader}/multiboot_elfxx.c (100%) rename {loader => grub-core/loader}/multiboot_mbi2.c (100%) rename {loader => grub-core/loader}/powerpc/ieee1275/linux.c (100%) rename {loader => grub-core/loader}/sparc64/ieee1275/linux.c (100%) rename {loader => grub-core/loader}/xnu.c (100%) rename {loader => grub-core/loader}/xnu_resume.c (100%) rename {mmap => grub-core/mmap}/efi/mmap.c (100%) rename {mmap => grub-core/mmap}/i386/mmap.c (100%) rename {mmap => grub-core/mmap}/i386/pc/mmap.c (100%) rename {mmap => grub-core/mmap}/i386/pc/mmap_helper.S (100%) rename {mmap => grub-core/mmap}/i386/uppermem.c (100%) rename {mmap => grub-core/mmap}/mips/yeeloong/uppermem.c (100%) rename {mmap => grub-core/mmap}/mmap.c (100%) create mode 100644 grub-core/modules.def rename {normal => grub-core/normal}/auth.c (100%) rename {normal => grub-core/normal}/autofs.c (100%) rename {normal => grub-core/normal}/cmdline.c (100%) rename {normal => grub-core/normal}/color.c (100%) rename {normal => grub-core/normal}/completion.c (100%) rename {normal => grub-core/normal}/context.c (100%) rename {normal => grub-core/normal}/crypto.c (100%) rename {normal => grub-core/normal}/datetime.c (100%) rename {normal => grub-core/normal}/dyncmd.c (100%) rename {normal => grub-core/normal}/handler.c (100%) rename {normal => grub-core/normal}/main.c (100%) rename {normal => grub-core/normal}/menu.c (100%) rename {normal => grub-core/normal}/menu_entry.c (100%) rename {normal => grub-core/normal}/menu_text.c (100%) rename {normal => grub-core/normal}/misc.c (100%) rename {normal => grub-core/normal}/term.c (100%) rename {partmap => grub-core/partmap}/acorn.c (100%) rename {partmap => grub-core/partmap}/amiga.c (100%) rename {partmap => grub-core/partmap}/apple.c (100%) rename {partmap => grub-core/partmap}/bsdlabel.c (100%) rename {partmap => grub-core/partmap}/gpt.c (100%) rename {partmap => grub-core/partmap}/msdos.c (100%) rename {partmap => grub-core/partmap}/sun.c (100%) rename {partmap => grub-core/partmap}/sunpc.c (100%) rename {parttool => grub-core/parttool}/msdospart.c (100%) create mode 100644 grub-core/po/Makefile.am rename {po => grub-core/po}/POTFILES (100%) rename {po => grub-core/po}/POTFILES-shell (100%) rename {po => grub-core/po}/README (100%) rename {script => grub-core/script}/execute.c (100%) rename {script => grub-core/script}/function.c (100%) rename {script => grub-core/script}/lexer.c (100%) rename {script => grub-core/script}/main.c (100%) rename {script => grub-core/script}/parser.y (100%) rename {script => grub-core/script}/script.c (100%) rename {script => grub-core/script}/yylex.l (100%) rename {term => grub-core/term}/at_keyboard.c (100%) rename {term => grub-core/term}/efi/console.c (100%) rename {term => grub-core/term}/gfxterm.c (100%) rename {term => grub-core/term}/i386/pc/console.c (100%) rename {term => grub-core/term}/i386/pc/vga.c (100%) rename {term => grub-core/term}/i386/pc/vga_text.c (100%) rename {term => grub-core/term}/i386/vga_common.c (100%) rename {term => grub-core/term}/ieee1275/ofconsole.c (100%) rename {term => grub-core/term}/serial.c (100%) rename {term => grub-core/term}/terminfo.c (100%) rename {term => grub-core/term}/tparm.c (100%) rename {term => grub-core/term}/usb_keyboard.c (100%) rename {tests => grub-core/tests}/example_functional_test.c (95%) rename {tests => grub-core/tests}/lib/functional_test.c (100%) rename {tests => grub-core/tests}/lib/test.c (100%) rename {video => grub-core/video}/bitmap.c (100%) rename {video => grub-core/video}/bitmap_scale.c (100%) rename {video => grub-core/video}/efi_gop.c (100%) rename {video => grub-core/video}/efi_uga.c (100%) rename {util => grub-core/video/emu}/sdl.c (100%) rename {video => grub-core/video}/fb/fbblit.c (100%) rename {video => grub-core/video}/fb/fbfill.c (100%) rename {video => grub-core/video}/fb/fbutil.c (100%) rename {video => grub-core/video}/fb/video_fb.c (100%) rename {video => grub-core/video}/i386/pc/vbe.c (100%) rename {video => grub-core/video}/ieee1275.c (100%) rename {video => grub-core/video}/readers/jpeg.c (100%) rename {video => grub-core/video}/readers/png.c (100%) rename {video => grub-core/video}/readers/tga.c (100%) rename {video => grub-core/video}/sm712.c (100%) rename {video => grub-core/video}/video.c (100%) create mode 100644 modules.def create mode 100644 po/Makefile.am diff --git a/.bzrignore b/.bzrignore index 46e8637b6..f91e72efa 100644 --- a/.bzrignore +++ b/.bzrignore @@ -71,3 +71,9 @@ stamp-h.in symlist.c trigtables.c update-grub_lib +Makefile.in +modules.am +GPATH +GRTAGS +GSYMS +GTAGS \ No newline at end of file diff --git a/ABOUT-NLS b/ABOUT-NLS new file mode 100644 index 000000000..866b904ec --- /dev/null +++ b/ABOUT-NLS @@ -0,0 +1,223 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is +a way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +1.1 Quick configuration advice +============================== + +If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias, message inheritance, automatic +charset conversion or plural form handling) as the implementation here. +It is also not possible to offer this additional functionality on top +of a `catgets' implementation. Future versions of GNU `gettext' will +very likely convey even more functionality. So it might be a good idea +to change to GNU `gettext' as soon as possible. + + So you need _not_ provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +1.2 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU `gettext'. Other packages have their own ways to +internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU `gettext' functions. If not, the included GNU +`gettext' library will be used. This library is wholly contained +within this package, usually in the `intl/' subdirectory, so prior +installation of the GNU `gettext' package is _not_ required. +Installers may use special options at configuration time for changing +the default behaviour. The commands: + + ./configure --with-included-gettext + ./configure --disable-nls + +will, respectively, bypass any pre-existing `gettext' to use the +internationalizing routines provided within this package, or else, +_totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might not be desirable. You should use +the more recent version of the GNU `gettext' library. I.e. if the file +`intl/VERSION' shows that the library which comes with this package is +more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. + + The configuration process will not test for the `catgets' function +and therefore it will not be used. The reason is that even an +emulation of `gettext' on top of `catgets' could not provide all the +extensions of the GNU `gettext' library. + + Internationalized packages usually have many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.3 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, +and `CC' is an ISO 3166 two-letter country code. For example, let's +suppose that you speak German and live in Germany. At the shell +prompt, merely execute `setenv LANG de_DE' (in `csh'), +`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). +This can be done from your `.login' or `.profile' file, once and for +all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your language by running the +command `locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' +for the purpose of message handling, but you still need to have `LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather +read translations in German than English for when Swedish is not +available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from `no' to `nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under `nb' and some older ones under `no', it's recommended +for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and +older translations are used. + + In the `LANGUAGE' environment variable, but not in the `LANG' +environment variable, `LL_CC' combinations can be abbreviated as `LL' +to denote the language's main dialect. For example, `de' is equivalent +to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' +(Portuguese as spoken in Portugal) in this context. + +1.4 Translating Teams +===================== + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" +area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +_actively_ in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `translation@iro.umontreal.ca' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skills are praised more than +programming skills, here. + +1.5 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of October +2006. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a +translation percentage of at least 50%. + +# Matrix here is removed! + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and +distributed as such by its maintainer. There might be an observable +lag between the mere existence a PO file and its wide availability in a +distribution. + + If October 2006 seems to be old, you may fetch a more recent copy of +this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date +matrix with full percentage details can be found at +`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. + +1.6 Using `gettext' in new packages +=================================== + +If you are writing a freely available program and want to +internationalize it you are welcome to use GNU `gettext' in your +package. Of course you have to respect the GNU Library General Public +License which covers the use of the GNU `gettext' library. This means +in particular that even non-free programs can use `libintl' as a shared +library, whereas only free software can use `libintl' as a static +library or use modified versions of `libintl'. + + Once the sources are changed appropriately and the setup can handle +the use of `gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +`translation@iro.umontreal.ca' to make the `.pot' files available to +the translation teams. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 000000000..d962963c1 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,87 @@ +AUTOMAKE_OPTIONS = subdir-objects +DEPDIR = .deps-util + +EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def \ + \ + geninit.sh \ + \ + gnulib/progname.h gnulib/fnmatch_loop.c gnulib/alloca.h \ + gnulib/error.h gnulib/fnmatch.h gnulib/getopt.h \ + gnulib/getopt_int.h gnulib/gettext.h gnulib/progname.h \ + \ + util/mkisofs/mkisofs.h util/mkisofs/iso9660.h \ + util/mkisofs/include/prototyp.h util/mkisofs/defaults.h \ + util/mkisofs/match.h util/mkisofs/exclude.h \ + util/mkisofs/msdos_partition.h util/mkisofs/include/fctldefs.h \ + util/mkisofs/include/mconfig.h util/mkisofs/include/statdefs.h + +SUBDIRS = . grub-core po docs + +include $(top_srcdir)/grub-core/Makefile.vars + +CFLAGS_PROGRAM = $(HOST_CFLAGS) $(CFLAGS_GNULIB) +LDFLAGS_PROGRAM = $(HOST_LDFLAGS) $(LDFLAGS_GNULIB) $(LIBINTL) +CPPFLAGS_PROGRAM = $(HOST_CPPFLAGS) $(CPPFLAGS_GNULIB) +CCASFLAGS_PROGRAM = $(HOST_CCASFLAGS) $(CCASFLAGS_GNULIB) + +CFLAGS_LIBRARY = $(CFLAGS_PROGRAM) +CPPFLAGS_LIBRARY = $(CPPFLAGS_PROGRAM) +CCASFLAGS_LIBRARY = $(CCASFLAGS_PROGRAM) + +AM_CFLAGS = +AM_LDFLAGS = +AM_CPPFLAGS = $(CPPFLAGS_GRUB) -DGRUB_FILE=\"$(subst $(top_srcdir)/,,$<)\" +AM_CCASFLAGS = -DASM_FILE=1 + +# XXX Use Automake's LEX & YACC support +grub_script.tab.c grub_script.tab.h: $(top_srcdir)/grub-core/script/parser.y + $(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/grub-core/script/parser.y +CLEANFILES += grub_script.tab.c grub_script.tab.h + +# For the lexer. +grub_script.yy.c grub_script.yy.h: $(top_srcdir)/grub-core/script/yylex.l + $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(top_srcdir)/grub-core/script/yylex.l +CLEANFILES += grub_script.yy.c grub_script.yy.h + +# For libutil.a +libutil_a_init.lst: grub_script.tab.h grub_script.yy.h $(libutil_a_SOURCES) + rm -f $@ + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutil_a_CPPFLAGS) $(CPPFLAGS) \ + -D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ \ + | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1) +CLEANFILES += libutil_a_init.lst + +libutil_a_init.c: libutil_a_init.lst $(top_srcdir)/geninit.sh + rm -f $@; sh $(top_srcdir)/geninit.sh `cat $<` > $@ || (rm -f $@; exit 1) +CLEANFILES += libutil_a_init.c + +if COND_GRUB_MKFONT +if COND_HAVE_FONT_SOURCE +pkgdata_DATA = unicode.pf2 ascii.pf2 ascii.h +endif +endif + +unicode.pf2: $(FONT_SOURCE) grub-mkfont + $(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) +CLEANFILES += unicode.pf2 + +# Arrows and lines are needed to draw the menu, so always include them +UNICODE_ARROWS=0x2190-0x2193 +UNICODE_LINES=0x2501-0x251B + +ascii.pf2: $(FONT_SOURCE) grub-mkfont + $(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) +CLEANFILES += ascii.pf2 + +ascii.bitmaps: $(FONT_SOURCE) grub-mkfont + $(builddir)/grub-mkfont --ascii-bitmaps -o $@ $(FONT_SOURCE) +CLEANFILES += ascii.bitmaps + +ascii.h: ascii.bitmaps grub-bin2h + $(builddir)/grub-bin2h ascii_bitmaps < $< > $@ + cp $@ $(top_builddir)/grub-core/include +CLEANFILES += ascii.h $(top_builddir)/grub-core/include/ascii.h + +platform_HEADERS = config.h + +include $(srcdir)/modules.am diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 822a08797..000000000 --- a/Makefile.in +++ /dev/null @@ -1,564 +0,0 @@ -# -*- makefile -*- -# -# 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 -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -### The configure script will replace these variables. - -SHELL = /bin/sh - -@SET_MAKE@ - -transform = @program_transform_name@ - -srcdir = @srcdir@ -builddir = @builddir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datarootdir = @datarootdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -localedir = @localedir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -pkgdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | 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@ -MSGMERGE = @MSGMERGE@ -MSGFMT = @MSGFMT@ - -LINGUAS = $(shell for i in $(srcdir)/po/*.po ; do \ - if test -e $$i ; then echo $$i ; fi ; \ - done | sed -e "s,.*/po/\(.*\)\.po$$,\1,") - -PACKAGE = @PACKAGE@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ - -host_os = @host_os@ -host_kernel = @host_kernel@ -host_cpu = @host_cpu@ - -target_cpu = @target_cpu@ -platform = @platform@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -MKDIR_P = @MKDIR_P@ - -mkinstalldirs = $(srcdir)/mkinstalldirs - -LIBS = @LIBS@ $(LIBINTL) $(LIBUTIL) - -CC = @CC@ -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@ -LDFLAGS = @LDFLAGS@ $(LIBS) -CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \ - -DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\" -TARGET_CC = @TARGET_CC@ -TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@ -TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@ -TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@ -TARGET_APPLE_CC = @TARGET_APPLE_CC@ -OBJCONV = @OBJCONV@ -TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \ - -Wall -W -TARGET_LDFLAGS = -nostdlib -static-libgcc @TARGET_LDFLAGS@ -TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@ -TARGET_IMG_LDFLAGS = -nostdlib @TARGET_IMG_LDFLAGS@ -TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@ -TARGET_OBJ2ELF = @TARGET_OBJ2ELF@ -kernel_img_LDFLAGS = -lgcc -EXEEXT = @EXEEXT@ -OBJCOPY = @OBJCOPY@ -STRIP = @STRIP@ -NM = @NM@ -RUBY = @RUBY@ -MAKEINFO = @MAKEINFO@ -ifeq (, $(MAKEINFO)) -MAKEINFO = true -endif -HELP2MAN = @HELP2MAN@ -ifeq (, $(HELP2MAN)) -HELP2MAN = true -else -HELP2MAN := LANG=C $(HELP2MAN) --no-info --source=FSF -endif -AWK = @AWK@ -LIBCURSES = @LIBCURSES@ -LIBUSB = @LIBUSB@ -LIBSDL = @LIBSDL@ -LIBPCIACCESS = @LIBPCIACCESS@ -LEX = @LEX@ -YACC = @YACC@ -FONT_SOURCE = @FONT_SOURCE@ - -# Options. -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_pe2elf = @enable_grub_pe2elf@ -enable_grub_mkfont = @enable_grub_mkfont@ -freetype_cflags = @freetype_cflags@ -freetype_libs = @freetype_libs@ -enable_efiemu = @enable_efiemu@ - -### General variables. - -RMKFILES = $(wildcard $(srcdir)/conf/*.rmk) - -MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES)) - -PKGLIB = $(pkglib_IMAGES) $(pkglib_MODULES) $(pkglib_PROGRAMS) \ - $(pkglib_DATA) $(pkglib_BUILDDIR) -PKGDATA = $(pkgdata_DATA) -PROGRAMS = $(bin_UTILITIES) $(sbin_UTILITIES) -SCRIPTS = $(bin_SCRIPTS) $(sbin_SCRIPTS) $(grub-mkconfig_SCRIPTS) \ - $(lib_SCRIPTS) -INFOS = $(info_INFOS) - -CLEANFILES = -MOSTLYCLEANFILES = -DISTCLEANFILES = config.status config.cache config.log config.h \ - Makefile stamp-h stamp-h1 include/grub/cpu include/grub/machine \ - gensymlist.sh genkernsyms.sh build_env.mk \ - 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) - -# The default target. -all: all-local - -### Include an arch-specific Makefile. -$(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb - if test "x$(RUBY)" = x; then \ - touch $@; \ - else \ - $(RUBY) $(srcdir)/genmk.rb < $< > $@; \ - fi - -ifeq ($(platform), emu) -include $(srcdir)/conf/any-emu.mk -else -include $(srcdir)/conf/$(target_cpu)-$(platform).mk -# For tests. -include $(srcdir)/conf/tests.mk -# For external modules. --include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk) -endif - -ifeq ($(TARGET_NO_MODULES), yes) - TARGET_CFLAGS += -DGRUB_TARGET_NO_MODULES=1 - CFLAGS += -DGRUB_TARGET_NO_MODULES=1 -endif - -### General targets. - -CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) po/*.mo -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 - cat $(DEFSYMFILES) /dev/null \ - | $(AWK) -f $(srcdir)/genmoddep.awk $(UNDSYMFILES) > $@ \ - || (rm -f $@; exit 1) - -command.lst: $(COMMANDFILES) - cat $^ /dev/null | sort > $@ - -fs.lst: $(FSFILES) - cat $^ /dev/null | sort > $@ - -partmap.lst: $(PARTMAPFILES) - cat $^ /dev/null | sort > $@ - -handler.lst: $(HANDLERFILES) - cat $^ /dev/null | sort > $@ - -terminal.lst: $(TERMINALFILES) - cat $^ /dev/null | sort > $@ - -parttool.lst: $(PARTTOOLFILES) - 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)) -info_INFOS += docs/grub.info -endif - -MOSTLYCLEANFILES += vti.tmp -MAINTAINER_CLEANFILES += docs/stamp-vti docs/version.texi -docs/version.texi: docs/stamp-vti -docs/stamp-vti: docs/grub.texi configure.ac - $(MKDIR_P) docs - (set `$(SHELL) $(srcdir)/docs/mdate-sh $<`; \ - echo "@set UPDATED $$1 $$2 $$3"; \ - echo "@set UPDATED-MONTH $$2 $$3"; \ - echo "@set EDITION $(PACKAGE_VERSION)"; \ - echo "@set VERSION $(PACKAGE_VERSION)") > vti.tmp - @cmp -s vti.tmp $(builddir)/docs/version.texi \ - || (echo "Updating $(builddir)/docs/version.texi"; \ - cp vti.tmp $(builddir)/docs/version.texi) - -@rm -f vti.tmp - @cp $(builddir)/docs/version.texi $@ - -# Use --force until such time as the documentation is cleaned up. -docs/grub.info: docs/grub.texi docs/version.texi docs/fdl.texi - $(MKDIR_P) docs - -$(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@ - -ifeq (, $(FONT_SOURCE)) -else - -ifeq ($(enable_grub_mkfont),yes) - -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 -UNICODE_ARROWS=0x2190-0x2193 -UNICODE_LINES=0x2501-0x251B - -unicode.pf2: $(FONT_SOURCE) grub-mkfont - $(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) - -ascii.pf2: $(FONT_SOURCE) grub-mkfont - $(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 - -# Used for building modules externally -pkglib_BUILDDIR += build_env.mk -build_env.mk: Makefile - (\ - echo "TARGET_CC=$(TARGET_CC)" ; \ - echo "TARGET_CFLAGS=$(TARGET_CFLAGS)" ; \ - echo "TARGET_ASFLAGS=$(TARGET_ASFLAGS)" ; \ - echo "TARGET_CPPFLAGS=$(TARGET_CPPFLAGS) -I$(pkglibdir) -I$(includedir)" ; \ - echo "STRIP=$(STRIP)" ; \ - echo "OBJCONV=$(OBJCONV)" ; \ - echo "TARGET_MODULE_FORMAT=$(TARGET_MODULE_FORMAT)" ; \ - echo "TARGET_APPLE_CC=$(TARGET_APPLE_CC)" ; \ - echo "COMMON_ASFLAGS=$(COMMON_ASFLAGS)" ; \ - echo "COMMON_CFLAGS=$(COMMON_CFLAGS)" ; \ - echo "COMMON_LDFLAGS=$(COMMON_LDFLAGS)"\ - ) > $@ -pkglib_BUILDDIR += config.h grub_script.tab.h - -all-local: $(PROGRAMS) $(GRUB_EMU) $(PKGLIB) $(PKGDATA) $(SCRIPTS) $(INFOS) $(MKFILES) $(foreach lang, $(LINGUAS), po/$(lang).mo) - -install: install-local - -install-local: all - $(SHELL) $(mkinstalldirs) $(DESTDIR)$(pkglibdir) - rm -f $(DESTDIR)$(pkglibdir)/* - @list='$(PKGLIB)'; \ - for file in $$list; do \ - if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ - dest="`echo $$file | sed 's,.*/,,'`"; \ - $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkglibdir)/$$dest; \ - done - $(SHELL) $(mkinstalldirs) $(DESTDIR)$(pkgdatadir) - @list='$(PKGDATA)'; \ - for file in $$list; do \ - if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ - dest="`echo $$file | sed 's,.*/,,'`"; \ - $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(pkgdatadir)/$$dest; \ - done - $(SHELL) $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 - @list='$(bin_UTILITIES) $(GRUB_EMU)'; for file in $$list; do \ - if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ - dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ - $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \ - $(HELP2MAN) --section=1 -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ - done - $(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8 - @list='$(sbin_UTILITIES)'; for file in $$list; do \ - if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ - dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ - $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ - $(HELP2MAN) --section=8 -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ - done - @list='$(bin_SCRIPTS)'; for file in $$list; do \ - if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ - dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ - $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \ - $(HELP2MAN) --section=1 -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ - done - @list='$(sbin_SCRIPTS)'; for file in $$list; do \ - if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ - dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ - $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ - $(HELP2MAN) --section=8 -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ - done - $(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d - @list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \ - if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ - dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ - $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \ - done - @list='$(grub-mkconfig_DATA)'; for file in $$list; do \ - if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ - dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ - $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \ - done - $(SHELL) $(mkinstalldirs) $(DESTDIR)$(libdir)/grub - @list='$(lib_SCRIPTS)'; \ - for file in $$list; do \ - if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ - dest="`echo $$file | sed 's,.*/,,'`"; \ - $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(libdir)/grub/$$dest; \ - done - @langs='$(LINGUAS)'; \ - for lang in $$langs; do \ - $(SHELL) $(mkinstalldirs) $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES; \ - file="po/$$lang.mo"; \ - if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ - $(INSTALL_DATA) $$dir$$file $(DESTDIR)/$(datadir)/locale/$$lang/LC_MESSAGES/$(PACKAGE).mo; \ - done - $(SHELL) $(mkinstalldirs) $(DESTDIR)$(infodir) - @list='$(info_INFOS)'; \ - for file in $$list; do \ - if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ - dest="`echo $$file | sed 's,.*/,,'`"; \ - $(INSTALL_DATA) $$dir$$file $(DESTDIR)$(infodir); \ - if (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ - install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$dest" || :; \ - fi; \ - done - -install-strip: - $(MAKE) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" install - -uninstall: - @list='$(PKGLIB)'; \ - for file in $$list; do \ - dest="`echo $$file | sed 's,.*/,,'`"; \ - rm -f $(DESTDIR)$(pkglibdir)/$$dest; \ - done - @list='$(PKGDATA)'; \ - for file in $$list; do \ - dest="`echo $$file | sed 's,.*/,,'`"; \ - rm -f $(DESTDIR)$(pkgdatadir)/$$dest; \ - done - @list='$(bin_UTILITIES) $(bin_SCRIPTS) $(GRUB_EMU)'; for file in $$list; do \ - dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ - rm -f $(DESTDIR)$(bindir)/$$dest; \ - rm -f $(DESTDIR)$(mandir)/man1/$$dest.1; \ - done - @list='$(sbin_UTILITIES) $(sbin_SCRIPTS)'; for file in $$list; do \ - dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ - rm -f $(DESTDIR)$(sbindir)/$$dest; \ - rm -f $(DESTDIR)$(mandir)/man8/$$dest.8; \ - done - @list='$(grub-mkconfig_SCRIPTS) $(grub-mkconfig_DATA)'; for file in $$list; do \ - dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ - rm -f $(DESTDIR)$(sysconfdir)/grub.d/$$dest; \ - done - @list='$(lib_SCRIPTS)'; \ - for file in $$list; do \ - dest="`echo $$file | sed 's,.*/,,'`"; \ - rm -f $(DESTDIR)$(libdir)/grub/$$dest; \ - done - @list='$(info_INFOS)'; \ - for file in $$list; do \ - dest="`echo $$file | sed 's,.*/,,'`"; \ - if (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ - if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$dest"; then \ - :; \ - else \ - test ! -f "$(DESTDIR)$(infodir)/$$dest" || exit 1; \ - fi; \ - fi; \ - rm -f $(DESTDIR)$(infodir)/$$dest; \ - done - -clean: $(CLEAN_IMAGE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_UTILITY_TARGETS) - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -mostlyclean: clean $(MOSTLYCLEAN_IMAGE_TARGETS) $(MOSTLYCLEAN_MODULE_TARGETS) $(MOSTLYCLEAN_UTILITY_TARGETS) - -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) - -distclean: mostlyclean - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -rm -rf $(srcdir)/autom4te.cache - -maintainer-clean: distclean - -test -z "$(MAINTAINER_CLEANFILES)" || rm -f $(MAINTAINER_CLEANFILES) - -rmdir $(srcdir)/lib/libgcrypt-grub/cipher - -rmdir $(srcdir)/lib/libgcrypt-grub - -info: - -dvi: - -distdir=$(PACKAGE_TARNAME)-$(PACKAGE_VERSION) - -DISTLIST: gendistlist.sh - $(SHELL) $(srcdir)/gendistlist.sh > $(srcdir)/DISTLIST - -distdir: DISTLIST - -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) - $(SHELL) $(mkinstalldirs) $(distdir) - for i in `cat $(srcdir)/DISTLIST`; do \ - dir=`echo "$$i" | sed 's:/[^/]*$$::'`; \ - if test -d $(srcdir)/$$dir; then \ - $(SHELL) $(mkinstalldirs) $(distdir)/$$dir; \ - fi; \ - cp -p $(srcdir)/$$i $(distdir)/$$i || exit 1; \ - done - chmod -R a+r $(distdir) - -GZIP_ENV = --best - -dist: distdir - tar chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) - -distcheck: dist - -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) - GZIP=$(GZIP_ENV) gzip -cd $(distdir).tar.gz | tar xf - - chmod -R a-w $(distdir) - chmod a+w $(distdir) - mkdir $(distdir)/=build - mkdir $(distdir)/=inst - chmod a-w $(distdir) - dc_instdir=`CDPATH=: && cd $(distdir)/=inst && pwd` \ - && cd $(distdir)/=build \ - && $(SHELL) ../configure --srcdir=.. --prefix=$$dc_instdir \ - && $(MAKE) all dvi check install && $(MAKE) uninstall \ - && (test `find $$dc_instdir -type f -print | wc -l` -le 1 \ - || (echo "Error: files left after uninstall" 1>&2; \ - exit 1)) \ - && $(MAKE) dist && $(MAKE) distclean \ - && rm -f $(distdir).tar.gz \ - && (test `find . -type f -print | wc -l` -eq 0 \ - || (echo "Error: files left after distclean" 1>&2; \ - exit 1)) - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) - @echo "$(distdir).tar.gz is ready for distribution" | \ - sed 'h;s/./=/g;p;x;p;x' - -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: .c .o .S .d - -# Regenerate configure and Makefile automatically. -$(srcdir)/aclocal.m4: configure.ac acinclude.m4 - cd $(srcdir) && aclocal - -$(srcdir)/configure: configure.ac aclocal.m4 - cd $(srcdir) && autoconf - -$(srcdir)/config.h.in: stamp-h.in -$(srcdir)/stamp-h.in: configure.ac aclocal.m4 - cd $(srcdir) && autoheader - echo timestamp > $(srcdir)/stamp-h.in - -config.h: stamp-h -stamp-h: config.h.in config.status - $(SHELL) ./config.status - -Makefile: Makefile.in config.status - $(SHELL) ./config.status - -config.status: configure - $(SHELL) ./config.status --recheck - -gensymlist.sh: gensymlist.sh.in config.status - $(SHELL) ./config.status - -genkernsyms.sh: genkernsyms.sh.in config.status - $(SHELL) ./config.status - -$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell - cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o po/$(PACKAGE).pot -f po/POTFILES --keyword=_ --keyword=N_ - cd $(srcdir) && $(XGETTEXT) -ctranslate --from-code=utf-8 -o po/$(PACKAGE).pot -f po/POTFILES-shell -j --language=Shell - -$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot - $(MSGMERGE) -U $@ $^ - -po/%.mo: po/%.po - $(MKDIR_P) $$(dirname $@) - $(MSGFMT) -c --statistics -o $@ $^ - -.PHONY: all install install-strip uninstall clean mostlyclean distclean -.PHONY: maintainer-clean info dvi dist check - -# Prevent an overflow. -.NOEXPORT: - -.DELETE_ON_ERROR: diff --git a/autogen.sh b/autogen.sh index eb251f9f0..5358d45f1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -2,22 +2,33 @@ set -e -aclocal -autoconf -autoheader +ln -sf ../NEWS grub-core/ +ln -sf ../README grub-core/ +ln -sf ../INSTALL grub-core/ +ln -sf ../AUTHORS grub-core/ +ln -sf ../COPYING grub-core/ +ln -sf ../ABOUT-NLS grub-core/ +ln -sf ../ChangeLog grub-core/ +ln -sf ../aclocal.m4 grub-core/ +ln -sf ../acinclude.m4 grub-core/ +ln -sf ../config.rpath grub-core/ +ln -sf ../gentpl.py grub-core/ +ln -sf ../configure.common grub-core/ -# FIXME: automake doesn't like that there's no Makefile.am -automake -a -c -f || true +ln -sf grub-core/include . +ln -sf grub-core/gnulib . +ln -sf grub-core/lib . + +python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl +autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am + +(cd grub-core && python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl) +(cd grub-core && autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am) + +(cd grub-core && echo timestamp > stamp-h.in) +(cd grub-core && python import_gcry.py lib/libgcrypt/ .) echo timestamp > stamp-h.in - -python util/import_gcry.py lib/libgcrypt/ . - -for rmk in conf/*.rmk ${GRUB_CONTRIB}/*/conf/*.rmk; do - if test -e $rmk ; then - ruby genmk.rb < $rmk > `echo $rmk | sed 's/\.rmk$/.mk/'` - fi -done -sh gendistlist.sh > DISTLIST +autoreconf -vi exit 0 diff --git a/configure.ac b/configure.ac index 4e1dd41d8..10c527565 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # Process this file with autoconf to produce a configure script. -# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. +# Copyright (C) 2010 Free Software Foundation, Inc. # # This configure.ac is free software; the author # gives unlimited permission to copy and/or distribute it, @@ -23,782 +23,50 @@ dnl which specifies the system running GRUB, such as firmware. dnl This is necessary because the target type in autoconf does not dnl describe such a system very well. dnl -dnl The current strategy is to use variables with no prefix (such as -dnl CC, CFLAGS, etc.) for the host type as well as the build type, -dnl because GRUB does not need to use those variables for the build -dnl type, so there is no conflict. Variables with the prefix "TARGET_" -dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target -dnl type. - +dnl The current strategy is to build utilities using host +dnl cross-compiler and grub core and modules using target +dnl cross-compiler. For this we use nested packages approach, where +dnl top-level package grub utilities is built with HOSTCC and nested +dnl package (in grub-core directory) builds with TARGETCC. +# NOTE: grub-core/configure.ac must also be updated. AC_INIT([GRUB],[1.98],[bug-grub@gnu.org]) -AM_INIT_AUTOMAKE() -AC_PREREQ(2.60) -AC_CONFIG_SRCDIR([include/grub/dl.h]) -AC_CONFIG_HEADER([config.h]) +AC_CONFIG_AUX_DIR([.]) # Checks for host and target systems. AC_CANONICAL_HOST AC_CANONICAL_TARGET -# Program name transformations -AC_ARG_PROGRAM +AM_INIT_AUTOMAKE() +AC_PREREQ(2.60) +AC_CONFIG_SRCDIR([grub-core/include/grub/dl.h]) +AC_CONFIG_HEADER([config.h]) -# Optimization flag. Allow user to override. -if test "x$TARGET_CFLAGS" = x; then - TARGET_CFLAGS="$TARGET_CFLAGS -Os" -fi - -case "$target_cpu" in - i[[3456]]86) target_cpu=i386 ;; - amd64) target_cpu=x86_64 ;; - 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 - -# Specify the platform (such as firmware). -AC_ARG_WITH([platform], - AS_HELP_STRING([--with-platform=PLATFORM], - [select the host platform [[guessed]]])) - -# Guess the platform if not specified. -if test "x$with_platform" = x; then - case "$target_cpu"-"$target_vendor" in - i386-apple) platform=efi ;; - i386-*) platform=pc ;; - x86_64-apple) platform=efi ;; - x86_64-*) platform=pc ;; - powerpc-*) platform=ieee1275 ;; - powerpc64-*) platform=ieee1275 ;; - sparc64-*) platform=ieee1275 ;; - mips-*) platform=yeeloong ;; - *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;; - esac -else - platform="$with_platform" -fi - -# Adjust CPU unless target was explicitly specified. -if test -z "$target_alias"; then - case "$target_cpu"-"$platform" in - x86_64-efi) ;; - x86_64-emu) ;; - x86_64-*) target_cpu=i386 ;; - powerpc64-ieee1275) target_cpu=powerpc ;; - esac -fi - -# Check if the platform is supported, make final adjustments. -case "$target_cpu"-"$platform" in - i386-efi) ;; - x86_64-efi) ;; - i386-pc) ;; - i386-multiboot) ;; - i386-coreboot) ;; - i386-linuxbios) platform=coreboot ;; - i386-ieee1275) ;; - i386-qemu) ;; - powerpc-ieee1275) ;; - sparc64-ieee1275) ;; - mips-qemu-mips) ;; - mips-yeeloong) ;; - *-emu) ;; - *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; -esac - -case "$target_cpu" in - i386 | powerpc) target_m32=1 ;; - x86_64 | sparc64) target_m64=1 ;; -esac - -case "$host_os" in - mingw32*) host_os=cygwin ;; -esac - -# This normalizes the names, and creates a new variable ("host_kernel") -# while at it, since the mapping is not always 1:1 (e.g. different OSes -# using the same kernel type). -case "$host_os" in - gnu*) host_kernel=hurd ;; - linux*) host_kernel=linux ;; - freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;; - netbsd*) host_kernel=netbsd ;; - cygwin) host_kernel=windows ;; -esac - -case "$platform" in - coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; - multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;; - efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;; - ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; - qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;; - pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; - emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;; - 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 -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" -TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS" -TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS" - -AC_SUBST(host_cpu) -AC_SUBST(host_os) -AC_SUBST(host_kernel) - -AC_SUBST(target_cpu) -AC_SUBST(platform) - -# -# Checks for build programs. -# - -# Although cmp is listed in the GNU Coding Standards as a command which -# can used directly, OpenBSD lacks cmp in the default installation. -AC_CHECK_PROGS([CMP], [cmp]) -if test "x$CMP" = x; then - AC_MSG_ERROR([cmp is not found]) -fi - -AC_CHECK_PROGS([YACC], [bison]) -if test "x$YACC" = x; then - AC_MSG_ERROR([bison is not found]) -fi - -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 - AC_SUBST([FONT_SOURCE], [$file]) - break - fi -done - -AC_PROG_INSTALL -AC_PROG_AWK -AC_PROG_LEX -AC_PROG_MAKE_SET -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". -AC_PATH_PROG(RUBY, ruby) -AC_PATH_PROG(MAKEINFO, makeinfo) - -# -# Checks for host programs. -# - -AC_PROG_CC -# Must be GCC. -test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) - -AC_GNU_SOURCE -AM_GNU_GETTEXT([external]) -AC_SYS_LARGEFILE - -# Identify characteristics of the host architecture. -AC_C_BIGENDIAN -AC_CHECK_SIZEOF(void *) -AC_CHECK_SIZEOF(long) - -grub_apple_cc -if test x$grub_cv_apple_cc = xyes ; then - CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" - ASFLAGS="$ASFLAGS -DAPPLE_CC=1" -fi - -if test "x$cross_compiling" = xyes; then - AC_MSG_WARN([cannot generate manual pages while cross compiling]) -else - AC_PATH_PROG(HELP2MAN, help2man) -fi - -# Check for functions. -AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf) - -# For grub-mkisofs -AC_HEADER_MAJOR -AC_HEADER_DIRENT -AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid) -AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h) -AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h 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. -# - -# Find tools for the target. -if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then - tmp_ac_tool_prefix="$ac_tool_prefix" - ac_tool_prefix=$target_alias- - - AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc], - [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])]) - AC_CHECK_TOOL(OBJCOPY, objcopy) - AC_CHECK_TOOL(STRIP, strip) - AC_CHECK_TOOL(NM, nm) - - ac_tool_prefix="$tmp_ac_tool_prefix" -else - if test "x$TARGET_CC" = x; then - TARGET_CC=$CC - fi - AC_CHECK_TOOL(OBJCOPY, objcopy) - AC_CHECK_TOOL(STRIP, strip) - AC_CHECK_TOOL(NM, nm) -fi -AC_SUBST(TARGET_CC) - - -# Test the C compiler for the target environment. -tmp_CC="$CC" -tmp_CFLAGS="$CFLAGS" -tmp_LDFLAGS="$LDFLAGS" -tmp_CPPFLAGS="$CPPFLAGS" -tmp_LIBS="$LIBS" -CC="$TARGET_CC" -CFLAGS="$TARGET_CFLAGS" -CPPFLAGS="$TARGET_CPPFLAGS" -LDFLAGS="$TARGET_LDFLAGS" -LIBS="" - -# debug flags. -TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \ - -Wundef -Wstrict-prototypes -g" - -# Force no alignment to save space on i386. -if test "x$target_cpu" = xi386; then - AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ - CFLAGS="$CFLAGS -falign-loops=1" - 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 - TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" - else - TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" - fi - - # Some toolchains enable these features by default, but they need - # registers that aren't set up properly in GRUB. - 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 - -grub_apple_target_cc -if test x$grub_cv_apple_target_cc = xyes ; then - TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions" - CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" - TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1" - TARGET_APPLE_CC=1 - AC_CHECK_PROG([OBJCONV], [objconv], [objconv], []) - if test "x$OBJCONV" = x ; then - AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.]) - fi - if test "x$OBJCONV" = x ; then - AC_MSG_ERROR([objconv not found which is required when building with apple compiler]) - fi - TARGET_IMG_LDSCRIPT= - TARGET_IMG_CFLAGS="-static" - TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' - TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' -else - TARGET_APPLE_CC=0 -# Use linker script if present, otherwise use builtin -N script. -if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then - TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" - TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext," - TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext," -else - TARGET_IMG_LDSCRIPT= - TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,' - TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,' -fi -TARGET_IMG_CFLAGS= -fi - -AC_SUBST(TARGET_IMG_LDSCRIPT) -AC_SUBST(TARGET_IMG_LDFLAGS) -AC_SUBST(TARGET_IMG_CFLAGS) - -# For platforms where ELF is not the default link format. -AC_MSG_CHECKING([for command to convert module to ELF format]) -case "${host_os}" in - 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 -AC_SUBST(TARGET_OBJ2ELF) -AC_MSG_RESULT([$TARGET_OBJ2ELF]) - - -if test "x$target_m32" = x1; then - # Force 32-bit mode. - TARGET_CFLAGS="$TARGET_CFLAGS -m32" - TARGET_ASFLAGS="$TARGET_CFLAGS -m32" - TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" - TARGET_MODULE_FORMAT="elf32" -fi - -if test "x$target_m64" = x1; then - # Force 64-bit mode. - TARGET_CFLAGS="$TARGET_CFLAGS -m64" - TARGET_ASFLAGS="$TARGET_ASFLAGS -m64" - TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" - TARGET_MODULE_FORMAT="elf64" -fi - -if test "$target_cpu"-"$platform" = x86_64-efi; then - # Use large model to support 4G memory - AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ - SAVED_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -m64 -mcmodel=large" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_mcmodel=yes], - [grub_cv_cc_mcmodel=no]) - ]) - if test "x$grub_cv_cc_mcmodel" = xno; then - AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.]) - else - TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" - fi - - # EFI writes to stack below %rsp, we must not use the red zone - AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ - CFLAGS="$CFLAGS -m64 -mno-red-zone" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_no_red_zone=yes], - [grub_cv_cc_no_red_zone=no]) - ]) - if test "x$grub_cv_cc_no_red_zone" = xno; then - AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc]) - fi - - TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone" -fi - -# -# Compiler features. -# - -# Need __enable_execute_stack() for nested function trampolines? -grub_CHECK_ENABLE_EXECUTE_STACK - -# Position independent executable. -grub_CHECK_PIE -[# Need that, because some distributions ship compilers that include -# `-fPIE' in the default specs. -if [ x"$pie_possible" = xyes ]; then - TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE" -fi] - -# Smashing stack protector. -grub_CHECK_STACK_PROTECTOR -# Need that, because some distributions ship compilers that include -# `-fstack-protector' in the default specs. -if test "x$ssp_possible" = xyes; then - TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector" -fi -grub_CHECK_STACK_ARG_PROBE -# Cygwin's GCC uses alloca() to probe the stackframe on static -# stack allocations above some threshold. -if test x"$sap_possible" = xyes; then - TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" -fi - -AC_ARG_ENABLE([werror], - [AS_HELP_STRING([--disable-werror], - [do not use -Werror when building GRUB])]) -if test x"$enable_werror" != xno ; then - TARGET_CFLAGS="$TARGET_CFLAGS -Werror" -fi - -AC_SUBST(TARGET_CFLAGS) -AC_SUBST(TARGET_MODULE_FORMAT) -AC_SUBST(OBJCONV) -AC_SUBST(TARGET_APPLE_CC) -AC_SUBST(TARGET_ASFLAGS) -AC_SUBST(TARGET_CPPFLAGS) -AC_SUBST(TARGET_LDFLAGS) - -# Set them to their new values for the tests below. -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 -CFLAGS="$TARGET_CFLAGS -nostdlib" -else -CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100" -fi -LIBS="" - -# Defined in aclocal.m4. -grub_PROG_TARGET_CC -if test "x$TARGET_APPLE_CC" != x1 ; then -grub_PROG_OBJCOPY_ABSOLUTE -fi -grub_PROG_LD_BUILD_ID_NONE -if test "x$target_cpu" = xi386; then - if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then - if test ! -z "$TARGET_IMG_LDSCRIPT"; then - # Check symbols provided by linker script. - CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100" - fi - grub_CHECK_BSS_START_SYMBOL - grub_CHECK_END_SYMBOL - fi - CFLAGS="$TARGET_CFLAGS" - grub_I386_ASM_PREFIX_REQUIREMENT - grub_I386_ASM_ADDR32 - grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK -else - AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug]) -fi - -AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL) -#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1))) -#else -#define NESTED_FUNC_ATTR -#endif]) - -AC_ARG_ENABLE([efiemu], - [AS_HELP_STRING([--enable-efiemu], - [build and install the efiemu runtimes (default=guessed)])]) -if test x"$enable_efiemu" = xno ; then - efiemu_excuse="explicitly disabled" -fi -if test x"$efiemu_excuse" = x ; then - AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [ - CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_efiemu=yes], - [grub_cv_cc_efiemu=no]) - ]) - if test x$grub_cv_cc_efiemu = xno; then - efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" - fi -fi -if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then - AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled]) -fi -if test x"$efiemu_excuse" = x ; then -enable_efiemu=yes -else -enable_efiemu=no -fi -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 -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. -CC="$tmp_CC" -CFLAGS="$tmp_CFLAGS" -CPPFLAGS="$tmp_CPPFLAGS" -LDFLAGS="$tmp_LDFLAGS" -LIBS="$tmp_LIBS" - -# -# Check for options. -# - -# Memory manager debugging. -AC_ARG_ENABLE([mm-debug], - AS_HELP_STRING([--enable-mm-debug], - [include memory manager debugging]), - [AC_DEFINE([MM_DEBUG], [1], - [Define to 1 if you enable memory manager debugging.])]) - -AC_ARG_ENABLE([grub-emu-usb], - [AS_HELP_STRING([--enable-grub-emu-usb], - [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) - -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 - missing_ncurses= -[# Check for curses libraries.] - AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], - [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], - [missing_ncurses=[true]])]) - AC_SUBST([LIBCURSES]) -[if [ x"$missing_ncurses" = x ]; then ] - [# Check for headers.] - AC_CHECK_HEADERS([ncurses/curses.h], [], - [AC_CHECK_HEADERS([ncurses.h], [], - [AC_CHECK_HEADERS([curses.h], [], - [missing_ncurses=[true]])])]) -[fi] -if test x"$missing_ncurses" = xtrue ; then - AC_MSG_ERROR([grub-emu can't be compiled without ncurses]) -fi - -if test x"$enable_grub_emu_modules" = xyes ; then - TARGET_NO_MODULES=no -else - TARGET_NO_MODULES=yes -fi -AC_SUBST(TARGET_NO_MODULES) - -if test "$TARGET_NO_MODULES" = yes ; then - # Do not convert modules, otherwise linkage may fail (Cygwin only). - # FIXME: Should be checked above before TARGET_OBJ2ELF is set first. - TARGET_OBJ2ELF= -fi - -if test x"$enable_grub_emu_usb" = xno ; then - grub_emu_usb_excuse="explicitly disabled" -fi - -if test x"$enable_grub_emu_pci" = xyes ; then - grub_emu_usb_excuse="conflicts with PCI support" -fi - -[if [ x"$grub_emu_usb_excuse" = x ]; then - # Check for libusb libraries.] -AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], - [grub_emu_usb_excuse=["need libusb library"]]) - AC_SUBST([LIBUSB]) -[fi] -[if [ x"$grub_emu_usb_excuse" = x ]; then - # Check for headers.] - AC_CHECK_HEADERS([usb.h], [], - [grub_emu_usb_excuse=["need libusb headers"]]) -[fi] -if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then - AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled]) -fi -if test x"$grub_emu_usb_excuse" = x ; then -enable_grub_emu_usb=yes -else -enable_grub_emu_usb=no -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_pci]) -fi - -AC_ARG_ENABLE([grub-fstest], - [AS_HELP_STRING([--enable-grub-fstest], - [build and install the `grub-fstest' debugging utility (default=guessed)])]) -if test x"$enable_grub_fstest" = xno ; then - grub_fstest_excuse="explicitly disabled" -fi -if test x"$grub_fstest_excuse" = x ; then -enable_grub_fstest=yes -else -enable_grub_fstest=no -fi -AC_SUBST([enable_grub_fstest]) - -AC_ARG_ENABLE([grub-mkfont], - [AS_HELP_STRING([--enable-grub-mkfont], - [build and install the `grub-mkfont' utility (default=guessed)])]) -if test x"$enable_grub_mkfont" = xno ; then - grub_mkfont_excuse="explicitly disabled" -fi - -if test x"$grub_mkfont_excuse" = x ; then - # Check for freetype libraries. - AC_CHECK_PROGS([FREETYPE], [freetype-config]) - if test "x$FREETYPE" = x ; then - grub_mkfont_excuse=["need freetype2 library"] - fi - freetype_cflags=`freetype-config --cflags` - freetype_libs=`freetype-config --libs` -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 - AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled]) -fi -if test x"$grub_mkfont_excuse" = x ; then -enable_grub_mkfont=yes -else -enable_grub_mkfont=no -fi -AC_SUBST([enable_grub_mkfont]) -AC_SUBST([freetype_cflags]) -AC_SUBST([freetype_libs]) - -AC_SUBST(ASFLAGS) +m4_include([configure.common]) # Output files. grub_CHECK_LINK_DIR if test x"$link_dir" = xyes ; then - AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu]) + AC_CONFIG_LINKS([include/grub/cpu:grub-core/include/grub/$target_cpu]) if test "$platform" != emu ; then - AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform]) + AC_CONFIG_LINKS([include/grub/machine:grub-core/include/grub/$target_cpu/$platform]) fi else mkdir -p include/grub 2>/dev/null rm -rf include/grub/cpu - cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null + cp -rp $srcdir/grub-core/include/grub/$target_cpu include/grub/cpu 2>/dev/null if test "$platform" != emu ; then rm -rf include/grub/machine - cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null + cp -rp $srcdir/grub-core/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null fi fi -AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([po/Makefile]) +AC_CONFIG_FILES([docs/Makefile]) AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) + +AC_CONFIG_SUBDIRS([grub-core]) AC_OUTPUT [ echo "*******************************************************" @@ -820,11 +88,6 @@ 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 if [ x"$enable_mm_debug" = xyes ]; then echo With memory debugging: Yes diff --git a/configure.common b/configure.common new file mode 100644 index 000000000..31bac7742 --- /dev/null +++ b/configure.common @@ -0,0 +1,804 @@ +# -*- autoconf -*- + +# Process this file with autoconf to produce a configure script. + +# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. +# +# This configure.ac is free software; the author +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# This file is shared between grub-core and util configure scripts. + +# Program name transformations +AC_ARG_PROGRAM + +# Optimization flag. Allow user to override. +if test "x$CFLAGS" = x; then + CFLAGS="$CFLAGS -Os" +fi + +# Default HOST_CPPFLAGS +CPPFLAGS='' +HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W" +HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_srcdir)/grub-core/include" +HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" +HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_srcdir)/grub-core/gnulib" +HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1" +HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\"" +HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\"" + +TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W" +TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" +TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" + +case "$target_cpu" in + i[[3456]]86) target_cpu=i386 ;; + amd64) target_cpu=x86_64 ;; + sparc) target_cpu=sparc64 ;; + mipsel|mips64el) + target_cpu=mips; + cpu_CPPFLAGS="-DGRUB_CPU_MIPSEL=1"; + ;; + mips|mips64) + target_cpu=mips; + cpu_CPPFLAGS="-DGRUB_CPU_MIPS=1"; + ;; +esac + +# Specify the platform (such as firmware). +AC_ARG_WITH([platform], + AS_HELP_STRING([--with-platform=PLATFORM], + [select the host platform [[guessed]]])) + +# Guess the platform if not specified. +if test "x$with_platform" = x; then + case "$target_cpu"-"$target_vendor" in + i386-apple) platform=efi ;; + i386-*) platform=pc ;; + x86_64-apple) platform=efi ;; + x86_64-*) platform=pc ;; + powerpc-*) platform=ieee1275 ;; + powerpc64-*) platform=ieee1275 ;; + sparc64-*) platform=ieee1275 ;; + mips-*) platform=yeeloong ;; + *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;; + esac +else + platform="$with_platform" +fi + +# Adjust CPU unless target was explicitly specified. +if test -z "$target_alias"; then + case "$target_cpu"-"$platform" in + x86_64-efi) ;; + x86_64-emu) ;; + x86_64-*) target_cpu=i386 ;; + powerpc64-ieee1275) target_cpu=powerpc ;; + esac +fi + +# Check if the platform is supported, make final adjustments. +case "$target_cpu"-"$platform" in + i386-efi) ;; + x86_64-efi) ;; + i386-pc) ;; + i386-multiboot) ;; + i386-coreboot) ;; + i386-linuxbios) platform=coreboot ;; + i386-ieee1275) ;; + i386-qemu) ;; + powerpc-ieee1275) ;; + sparc64-ieee1275) ;; + mips-qemu-mips) ;; + mips-yeeloong) ;; + *-emu) ;; + *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; +esac + +case "$target_cpu" in + i386 | powerpc) target_m32=1 ;; + x86_64 | sparc64) target_m64=1 ;; +esac + +case "$host_os" in + mingw32*) host_os=cygwin ;; +esac + +# This normalizes the names, and creates a new variable ("host_kernel") +# while at it, since the mapping is not always 1:1 (e.g. different OSes +# using the same kernel type). +case "$host_os" in + gnu*) host_kernel=hurd ;; + linux*) host_kernel=linux ;; + freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;; + netbsd*) host_kernel=netbsd ;; + cygwin) host_kernel=windows ;; +esac + +case "$platform" in + coreboot) machine_CPPFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; + multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;; + efi) machine_CPPFLAGS="-DGRUB_MACHINE_EFI=1" ;; + ieee1275) machine_CPPFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; + qemu) machine_CPPFLAGS="-DGRUB_MACHINE_QEMU=1" ;; + pc) machine_CPPFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; + emu) machine_CPPFLAGS="-DGRUB_MACHINE_EMU=1" ;; + yeeloong) machine_CPPFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; + qemu-mips) machine_CPPFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; +esac +case "$target_cpu" in + i386) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_I386";; + x86_64) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_X86_64";; + powerpc) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_POWERPC";; + mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;; # cpu_CPPFLAGS handled above + sparc64) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_SPARC64"; + machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;; +esac + +HOST_CPPFLAGS="$HOST_CPPFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" +TARGET_CPPFLAGS="$TARGET_CPPFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" + +AC_SUBST(host_cpu) +AC_SUBST(host_os) +AC_SUBST(host_kernel) + +AC_SUBST(target_cpu) +AC_SUBST(platform) + +# +# Checks for build programs. +# + +# Although cmp is listed in the GNU Coding Standards as a command which +# can used directly, OpenBSD lacks cmp in the default installation. +AC_CHECK_PROGS([CMP], [cmp]) +if test "x$CMP" = x; then + AC_MSG_ERROR([cmp is not found]) +fi + +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 + FONT_SOURCE=$file + HOST_CPPFLAGS="$HOST_CPPFLAGS -DUSE_ASCII_FAILBACK=1" + TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DUSE_ASCII_FAILBACK=1" + break + fi +done + +AC_PROG_RANLIB +AC_PROG_INSTALL +AC_PROG_AWK +AC_PROG_LEX +AC_PROG_YACC +AC_PROG_MAKE_SET +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". +AC_PATH_PROG(MAKEINFO, makeinfo) + +# +# Checks for host programs. +# + +AC_PROG_CC +AM_PROG_CC_C_O +AM_PROG_AS + +# Must be GCC. +test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) + +AC_GNU_SOURCE +AM_GNU_GETTEXT([external]) +AC_SYS_LARGEFILE + +# Identify characteristics of the host architecture. +AC_C_BIGENDIAN +AC_CHECK_SIZEOF(void *) +AC_CHECK_SIZEOF(long) + +grub_apple_cc +if test x$grub_cv_apple_cc = xyes ; then + HOST_CPPFLAGS="$HOST_CPPFLAGS -DAPPLE_CC=1" + HOST_CFLAGS="$HOST_CFLAGS -fnested-functions" +fi + +if test "x$cross_compiling" = xyes; then + AC_MSG_WARN([cannot generate manual pages while cross compiling]) +else + AC_PATH_PROG(HELP2MAN, help2man) +fi + +# Check for functions. +AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf) + +# For grub-mkisofs +AC_HEADER_MAJOR +AC_HEADER_DIRENT +AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid) +AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h) +AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h 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 host and build compilers. +# +HOST_CC=$CC +AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc], + [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])]) + +# +# Check for target programs. +# + +# Find tools for the target. +if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then + tmp_ac_tool_prefix="$ac_tool_prefix" + ac_tool_prefix=$target_alias- + + AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc], + [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])]) + AC_CHECK_TOOL(OBJCOPY, objcopy) + AC_CHECK_TOOL(STRIP, strip) + AC_CHECK_TOOL(NM, nm) + + ac_tool_prefix="$tmp_ac_tool_prefix" +else + if test "x$TARGET_CC" = x; then + TARGET_CC=$CC + fi + AC_CHECK_TOOL(OBJCOPY, objcopy) + AC_CHECK_TOOL(STRIP, strip) + AC_CHECK_TOOL(NM, nm) +fi +AC_SUBST(HOST_CC) +AC_SUBST(BUILD_CC) +AC_SUBST(TARGET_CC) + +# Test the C compiler for the target environment. +tmp_CC="$CC" +tmp_CFLAGS="$CFLAGS" +tmp_LDFLAGS="$LDFLAGS" +tmp_CPPFLAGS="$CPPFLAGS" +tmp_LIBS="$LIBS" +CC="$TARGET_CC" +CFLAGS="$TARGET_CFLAGS" +CPPFLAGS="$TARGET_CPPFLAGS" +LDFLAGS="$TARGET_LDFLAGS" +LIBS="" + +# debug flags. +TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g" +TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" + +# Force no alignment to save space on i386. +if test "x$target_cpu" = xi386; then + AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ + CFLAGS="$CFLAGS -falign-loops=1" + 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 + TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" + else + TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" + fi + + # Some toolchains enable these features by default, but they need + # registers that aren't set up properly in GRUB. + 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 + +grub_apple_target_cc +if test x$grub_cv_apple_target_cc = xyes ; then + TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1" + TARGET_CFLAGS="$TARGET_CFLAGS -fnested-functions" + + CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" + TARGET_APPLE_CC=1 + AC_CHECK_PROG([OBJCONV], [objconv], [objconv], []) + if test "x$OBJCONV" = x ; then + AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.]) + fi + if test "x$OBJCONV" = x ; then + AC_MSG_ERROR([objconv not found which is required when building with apple compiler]) + fi + TARGET_IMG_LDSCRIPT= + TARGET_IMG_CFLAGS="-static" + TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' + TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' +else + TARGET_APPLE_CC=0 +# Use linker script if present, otherwise use builtin -N script. +if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then + TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" + TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext," + TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext," +else + TARGET_IMG_LDSCRIPT= + TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,' + TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,' +fi +TARGET_IMG_CFLAGS= +fi + +# For platforms where ELF is not the default link format. +AC_MSG_CHECKING([for command to convert module to ELF format]) +case "${host_os}" in + 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 +AC_MSG_RESULT([$TARGET_OBJ2ELF]) + +if test "x$target_m32" = x1; then + # Force 32-bit mode. + TARGET_CFLAGS="$TARGET_CFLAGS -m32" + TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32" + TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" + TARGET_MODULE_FORMAT="elf32" +fi + +if test "x$target_m64" = x1; then + # Force 64-bit mode. + TARGET_CFLAGS="$TARGET_CFLAGS -m64" + TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64" + TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" + TARGET_MODULE_FORMAT="elf64" +fi + +if test "$target_cpu"-"$platform" = x86_64-efi; then + # Use large model to support 4G memory + AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ + SAVED_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -m64 -mcmodel=large" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_mcmodel=yes], + [grub_cv_cc_mcmodel=no]) + ]) + if test "x$grub_cv_cc_mcmodel" = xno; then + AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.]) + else + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" + fi + + # EFI writes to stack below %rsp, we must not use the red zone + AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ + CFLAGS="$CFLAGS -m64 -mno-red-zone" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_no_red_zone=yes], + [grub_cv_cc_no_red_zone=no]) + ]) + if test "x$grub_cv_cc_no_red_zone" = xno; then + AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc]) + fi + + TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone" +fi + +# +# Compiler features. +# + +# Need __enable_execute_stack() for nested function trampolines? +grub_CHECK_ENABLE_EXECUTE_STACK + +# Position independent executable. +grub_CHECK_PIE +[# Need that, because some distributions ship compilers that include +# `-fPIE' in the default specs. +if [ x"$pie_possible" = xyes ]; then + TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE" +fi] + +# Smashing stack protector. +grub_CHECK_STACK_PROTECTOR +# Need that, because some distributions ship compilers that include +# `-fstack-protector' in the default specs. +if test "x$ssp_possible" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector" +fi +grub_CHECK_STACK_ARG_PROBE +# Cygwin's GCC uses alloca() to probe the stackframe on static +# stack allocations above some threshold. +if test x"$sap_possible" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" +fi + +AC_ARG_ENABLE([werror], + [AS_HELP_STRING([--disable-werror], + [do not use -Werror when building GRUB])]) +if test x"$enable_werror" != xno ; then + TARGET_CFLAGS="$TARGET_CFLAGS -Werror" +fi + +AC_SUBST(TARGET_MODULE_FORMAT) +AC_SUBST(OBJCONV) +AC_SUBST(TARGET_APPLE_CC) + +AC_SUBST(TARGET_CFLAGS) +AC_SUBST(TARGET_LDFLAGS) +AC_SUBST(TARGET_CPPFLAGS) +AC_SUBST(TARGET_CCASFLAGS) + +AC_SUBST(HOST_CFLAGS) +AC_SUBST(HOST_LDFLAGS) +AC_SUBST(HOST_CPPFLAGS) +AC_SUBST(HOST_CCASFLAGS) + +# Set them to their new values for the tests below. +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 +CFLAGS="$TARGET_CFLAGS -nostdlib" +else +CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100" +fi +LIBS="" + +# Defined in aclocal.m4. +grub_PROG_TARGET_CC +if test "x$TARGET_APPLE_CC" != x1 ; then +grub_PROG_OBJCOPY_ABSOLUTE +fi +grub_PROG_LD_BUILD_ID_NONE +if test "x$target_cpu" = xi386; then + if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then + if test ! -z "$TARGET_IMG_LDSCRIPT"; then + # Check symbols provided by linker script. + CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100" + fi + grub_CHECK_BSS_START_SYMBOL + grub_CHECK_END_SYMBOL + fi + CFLAGS="$TARGET_CFLAGS" + grub_I386_ASM_PREFIX_REQUIREMENT + grub_I386_ASM_ADDR32 + grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK +else + AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug]) +fi + +AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL) +#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1))) +#else +#define NESTED_FUNC_ATTR +#endif]) + +AC_ARG_ENABLE([efiemu], + [AS_HELP_STRING([--enable-efiemu], + [build and install the efiemu runtimes (default=guessed)])]) +if test x"$enable_efiemu" = xno ; then + efiemu_excuse="explicitly disabled" +fi +if test x"$efiemu_excuse" = x ; then + AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [ + CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_efiemu=yes], + [grub_cv_cc_efiemu=no]) + ]) + if test x$grub_cv_cc_efiemu = xno; then + efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" + fi +fi +if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then + AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled]) +fi +if test x"$efiemu_excuse" = x ; then +enable_efiemu=yes +else +enable_efiemu=no +fi +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 +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. +CC="$tmp_CC" +CFLAGS="$tmp_CFLAGS" +CPPFLAGS="$tmp_CPPFLAGS" +LDFLAGS="$tmp_LDFLAGS" +LIBS="$tmp_LIBS" + +# +# Check for options. +# + +# Memory manager debugging. +AC_ARG_ENABLE([mm-debug], + AS_HELP_STRING([--enable-mm-debug], + [include memory manager debugging]), + [AC_DEFINE([MM_DEBUG], [1], + [Define to 1 if you enable memory manager debugging.])]) + +AC_ARG_ENABLE([grub-emu-usb], + [AS_HELP_STRING([--enable-grub-emu-usb], + [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) + +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)])]) + +if test "$platform" = emu; then + missing_ncurses= +[# Check for curses libraries.] + AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], + [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], + [missing_ncurses=[true]])]) + AC_SUBST([LIBCURSES]) +[if [ x"$missing_ncurses" = x ]; then ] + [# Check for headers.] + AC_CHECK_HEADERS([ncurses/curses.h], [], + [AC_CHECK_HEADERS([ncurses.h], [], + [AC_CHECK_HEADERS([curses.h], [], + [missing_ncurses=[true]])])]) +[fi] +if test x"$missing_ncurses" = xtrue ; then + AC_MSG_ERROR([grub-emu can't be compiled without ncurses]) +fi + +if test x"$enable_grub_emu_usb" = xno ; then + grub_emu_usb_excuse="explicitly disabled" +fi + +if test x"$enable_grub_emu_pci" = xyes ; then + grub_emu_usb_excuse="conflicts with PCI support" +fi + +[if [ x"$grub_emu_usb_excuse" = x ]; then + # Check for libusb libraries.] +AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], + [grub_emu_usb_excuse=["need libusb library"]]) + AC_SUBST([LIBUSB]) +[fi] +[if [ x"$grub_emu_usb_excuse" = x ]; then + # Check for headers.] + AC_CHECK_HEADERS([usb.h], [], + [grub_emu_usb_excuse=["need libusb headers"]]) +[fi] +if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then + AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled]) +fi +if test x"$grub_emu_usb_excuse" = x ; then +enable_grub_emu_usb=yes +else +enable_grub_emu_usb=no +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_pci]) +fi + +AC_ARG_ENABLE([grub-fstest], + [AS_HELP_STRING([--enable-grub-fstest], + [build and install the `grub-fstest' debugging utility (default=guessed)])]) +if test x"$enable_grub_fstest" = xno ; then + grub_fstest_excuse="explicitly disabled" +fi +if test x"$grub_fstest_excuse" = x ; then +enable_grub_fstest=yes +else +enable_grub_fstest=no +fi +AC_SUBST([enable_grub_fstest]) + +AC_ARG_ENABLE([grub-mkfont], + [AS_HELP_STRING([--enable-grub-mkfont], + [build and install the `grub-mkfont' utility (default=guessed)])]) +if test x"$enable_grub_mkfont" = xno ; then + grub_mkfont_excuse="explicitly disabled" +fi + +if test x"$grub_mkfont_excuse" = x ; then + # Check for freetype libraries. + AC_CHECK_PROGS([FREETYPE], [freetype-config]) + if test "x$FREETYPE" = x ; then + grub_mkfont_excuse=["need freetype2 library"] + fi + freetype_cflags=`freetype-config --cflags` + freetype_libs=`freetype-config --libs` +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 + AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled]) +fi +if test x"$grub_mkfont_excuse" = x ; then +enable_grub_mkfont=yes +else +enable_grub_mkfont=no +fi +AC_SUBST([enable_grub_mkfont]) +AC_SUBST([freetype_cflags]) +AC_SUBST([freetype_libs]) + +AC_SUBST([FONT_SOURCE]) +AS_IF([test x$target_cpu = xi386 -a x$platform = xpc], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)]) +AS_IF([test x$target_cpu = xi386 -a x$platform = xcoreboot], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)]) +AS_IF([test x$target_cpu = xmips -a x$platform = xyeeloong], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x80200000)]) +AS_IF([test x$target_cpu = xpowerpc -a x$platform = xieee1275], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x200000)]) +AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu], + [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)]) +AS_IF([test x$target_cpu = xi386 -a x$platform = xieee1275], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x10000)]) +AS_IF([test x$TARGET_APPLE_CC = x1], + [AC_SUBST([USE_APPLE_CC_FIXES], yes)]) + +# +# Automake conditionals +# + +AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) +AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) +AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi]) +AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot]) +AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275]) +AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu]) +AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi]) +AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong]) +AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips]) +AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) +AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) + +AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x]) +AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes]) +AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) +AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) +AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) +AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) +AM_CONDITIONAL([COND_GRUB_FSTEST], [test x$enable_grub_fstest = xyes]) +AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) + diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100644 index 000000000..ab65a8dd2 --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1,6 @@ +AUTOMAKE_OPTIONS = subdir-objects +AM_MAKEINFOFLAGS = --force --no-split --no-validate + +info_TEXINFOS = grub.texi +grub_TEXINFOS = fdl.texi + diff --git a/geninit.sh b/geninit.sh index 43d2d1640..f0810120f 100644 --- a/geninit.sh +++ b/geninit.sh @@ -11,11 +11,6 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -lst="$1" -shift - -header=`echo "${lst}" | sed -e "s/\.lst$/.h/g"` - cat <. */ -#include <$header> +#include EOF +for mod in "$@"; do + echo "extern void grub_${mod}_init (void);" + echo "extern void grub_${mod}_fini (void);" +done + cat </dev/null; then - echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_init ();/' - fi -done < ${lst} +for mod in "$@"; do + echo "grub_${mod}_init ();" +done cat </dev/null; then - echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_fini ();/' - fi -done < ${lst} +for mod in "$@"; do + echo "grub_${mod}_fini ();" +done cat <. - */ - -EOF - -cat </dev/null 2>&1 && u="_" - -$CC @TARGET_CFLAGS@ -DGRUB_SYMBOL_GENERATOR=1 -E -I. -Iinclude -I"$srcdir/include" $* \ - | grep -v '^#' \ - | sed -n \ - -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$u"'\1 kernel/;p;}' \ - -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/'"$u"'\1 kernel/;p;}' \ - | sort -u diff --git a/genmk.rb b/genmk.rb deleted file mode 100644 index e62dbd4f6..000000000 --- a/genmk.rb +++ /dev/null @@ -1,475 +0,0 @@ -#! /usr/bin/ruby -w -# -# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. -# -# This genmk.rb is free software; the author -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -module Enumerable - def collect_with_index - ret = [] - self.each_with_index do |item, index| - ret.push(yield(item, index)) - end - ret - end -end - -class String - def to_var - self.gsub(/[^a-zA-Z0-9_@]/, '_') - end - - def suffix(str) - self.sub(/\.[^\.]*$/, '') + '.' + str - end - - def to_obj - self.sub(/\.[^\.]*$/, '').to_var + '.o' - end -end - -class Image - def initialize(dir, name) - @dir = dir - @name = name - @rule_count = 0 - end - attr_reader :dir, :name - - def rule(sources) - prefix = @name.to_var - @rule_count += 1 - exe = @name.suffix('exec') - objs = sources.collect do |src| - raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src - prefix + '-' + src.to_obj - end - objs_str = objs.join(' ') - deps = objs.collect {|obj| obj.suffix('d')} - deps_str = deps.join(' ') - -" -clean-image-#{@name}.#{@rule_count}: - rm -f #{@name} #{exe} #{objs_str} - -CLEAN_IMAGE_TARGETS += clean-image-#{@name}.#{@rule_count} - -mostlyclean-image-#{@name}.#{@rule_count}: - rm -f #{deps_str} - -MOSTLYCLEAN_IMAGE_TARGETS += mostlyclean-image-#{@name}.#{@rule_count} - -ifneq ($(TARGET_APPLE_CC),1) -#{@name}: #{exe} - $(OBJCOPY) -O $(#{prefix}_FORMAT) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@ -else -ifneq (#{exe},kernel.exec) -#{@name}: #{exe} ./grub-macho2img - ./grub-macho2img $< $@ -else -#{@name}: #{exe} ./grub-macho2img - ./grub-macho2img --bss $< $@ -endif -endif - -#{exe}: #{objs_str} - $(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS) - -" + objs.collect_with_index do |obj, i| - src = sources[i] - fake_obj = File.basename(src).suffix('o') - dep = deps[i] - flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end - extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end - dir = File.dirname(src) - - "#{obj}: #{src} $(#{src}_DEPENDENCIES) - $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $< --include #{dep} - -" - end.join('') - end -end - -# Use PModule instead Module, to avoid name conflicting. -class PModule - def initialize(dir, name) - @dir = dir - @name = name - @rule_count = 0 - end - attr_reader :dir, :name - - def rule(sources) - prefix = @name.to_var - @rule_count += 1 - objs = sources.collect do |src| - raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src - prefix + '-' + src.to_obj - end - objs_str = objs.join(' ') - deps = objs.collect {|obj| obj.suffix('d')} - deps_str = deps.join(' ') - pre_obj = 'pre-' + @name.suffix('o') - mod_src = 'mod-' + @name.suffix('c') - mod_obj = mod_src.suffix('o') - defsym = 'def-' + @name.suffix('lst') - undsym = 'und-' + @name.suffix('lst') - mod_name = File.basename(@name, '.mod') - symbolic_name = mod_name.sub(/\.[^\.]*$/, '') - -" -clean-module-#{@name}.#{@rule_count}: - rm -f #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym} - -CLEAN_MODULE_TARGETS += clean-module-#{@name}.#{@rule_count} - -clean-module-#{@name}-symbol.#{@rule_count}: - rm -f #{defsym} - -CLEAN_MODULE_TARGETS += clean-module-#{@name}-symbol.#{@rule_count} -DEFSYMFILES += #{defsym} -mostlyclean-module-#{@name}.#{@rule_count}: - rm -f #{deps_str} - -MOSTLYCLEAN_MODULE_TARGETS += mostlyclean-module-#{@name}.#{@rule_count} -UNDSYMFILES += #{undsym} - -ifeq ($(TARGET_NO_MODULES), yes) -#{@name}: #{pre_obj} $(TARGET_OBJ2ELF) - -rm -f $@ - $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} - if test ! -z \"$(TARGET_OBJ2ELF)\"; then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi - if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; fi -else -ifneq ($(TARGET_APPLE_CC),1) -#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF) - -rm -f $@ - $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj} - if test ! -z \"$(TARGET_OBJ2ELF)\"; then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi - if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; fi -else -#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF) - -rm -f $@ - -rm -f $@.bin - $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@.bin #{pre_obj} #{mod_obj} - $(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -ew2030 -ew2050 -nu -nd $@.bin $@ - -rm -f $@.bin -endif -endif - -#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str} - -rm -f $@ - $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{objs_str} - -#{mod_obj}: #{mod_src} - $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -DGRUB_FILE=\\\"#{mod_src}\\\" -c -o $@ $< - -#{mod_src}: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh - sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1) - -ifneq ($(TARGET_APPLE_CC),1) -#{defsym}: #{pre_obj} - $(NM) -g --defined-only -P -p $< | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@ -else -#{defsym}: #{pre_obj} - $(NM) -g -P -p $< | grep -E '^[a-zA-Z0-9_]* [TDS]' | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@ -endif - -#{undsym}: #{pre_obj} - echo '#{mod_name}' > $@ - $(NM) -u -P -p $< | cut -f1 -d' ' >> $@ - -" + objs.collect_with_index do |obj, i| - src = sources[i] - fake_obj = File.basename(src).suffix('o') - extra_target = obj.sub(/\.[^\.]*$/, '') + '-extra' - command = 'cmd-' + obj.suffix('lst') - fs = 'fs-' + obj.suffix('lst') - partmap = 'partmap-' + obj.suffix('lst') - handler = 'handler-' + obj.suffix('lst') - terminal = 'terminal-' + obj.suffix('lst') - parttool = 'parttool-' + obj.suffix('lst') - video = 'video-' + obj.suffix('lst') - dep = deps[i] - flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end - extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end - dir = File.dirname(src) - - "#{obj}: #{src} $(#{src}_DEPENDENCIES) - $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $< --include #{dep} - -clean-module-#{extra_target}.#{@rule_count}: - rm -f #{command} #{fs} #{partmap} #{handler} #{parttool} #{video} #{terminal} - -CLEAN_MODULE_TARGETS += clean-module-#{extra_target}.#{@rule_count} - -COMMANDFILES += #{command} -FSFILES += #{fs} -PARTTOOLFILES += #{parttool} -PARTMAPFILES += #{partmap} -HANDLERFILES += #{handler} -TERMINALFILES += #{terminal} -VIDEOFILES += #{video} - -#{command}: #{src} $(#{src}_DEPENDENCIES) gencmdlist.sh - set -e; \ - $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \ - | sh $(srcdir)/gencmdlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1) - -#{fs}: #{src} $(#{src}_DEPENDENCIES) genfslist.sh - set -e; \ - $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \ - | sh $(srcdir)/genfslist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1) - -#{parttool}: #{src} $(#{src}_DEPENDENCIES) genparttoollist.sh - set -e; \ - $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \ - | sh $(srcdir)/genparttoollist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1) - -#{partmap}: #{src} $(#{src}_DEPENDENCIES) genpartmaplist.sh - set -e; \ - $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \ - | sh $(srcdir)/genpartmaplist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1) - -#{handler}: #{src} $(#{src}_DEPENDENCIES) genhandlerlist.sh - set -e; \ - $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \ - | sh $(srcdir)/genhandlerlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1) - -#{terminal}: #{src} $(#{src}_DEPENDENCIES) genterminallist.sh - set -e; \ - $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \ - | sh $(srcdir)/genterminallist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1) - -#{video}: #{src} $(#{src}_DEPENDENCIES) genvideolist.sh - set -e; \ - $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \ - | sh $(srcdir)/genvideolist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1) - -" - end.join('') - end -end - -class Utility - def initialize(dir, name) - @dir = dir - @name = name - @rule_count = 0 - end - def print_tail() - prefix = @name.to_var - print "#{@name}: $(#{prefix}_DEPENDENCIES) $(#{prefix}_OBJECTS) - $(CC) -o $@ $(#{prefix}_OBJECTS) $(LDFLAGS) $(#{prefix}_LDFLAGS) - -" - end - attr_reader :dir, :name - - def rule(sources) - prefix = @name.to_var - @rule_count += 1 - objs = sources.collect do |src| - raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src - prefix + '-' + src.to_obj - end - objs_str = objs.join(' '); - deps = objs.collect {|obj| obj.suffix('d')} - deps_str = deps.join(' '); - - " -clean-utility-#{@name}.#{@rule_count}: - rm -f #{@name}$(EXEEXT) #{objs_str} - -CLEAN_UTILITY_TARGETS += clean-utility-#{@name}.#{@rule_count} - -mostlyclean-utility-#{@name}.#{@rule_count}: - rm -f #{deps_str} - -MOSTLYCLEAN_UTILITY_TARGETS += mostlyclean-utility-#{@name}.#{@rule_count} - -#{prefix}_OBJECTS += #{objs_str} - -" + objs.collect_with_index do |obj, i| - src = sources[i] - fake_obj = File.basename(src).suffix('o') - dep = deps[i] - dir = File.dirname(src) - - "#{obj}: #{src} $(#{src}_DEPENDENCIES) - $(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $< --include #{dep} - -" - end.join('') - end -end - -class Program - def initialize(dir, name) - @dir = dir - @name = name - end - attr_reader :dir, :name - - def print_tail() - prefix = @name.to_var - print "CLEANFILES += #{@name} $(#{prefix}_OBJECTS) -ifeq ($(#{prefix}_RELOCATABLE),yes) -#{@name}: $(#{prefix}_DEPENDENCIES) $(#{prefix}_OBJECTS) - $(TARGET_CC) -Wl,-r,-d -o $@ $(#{prefix}_OBJECTS) $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS) - if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) --strip-unneeded -K start -R .note -R .comment $@; fi -else -#{@name}: $(#{prefix}_DEPENDENCIES) $(#{prefix}_OBJECTS) - $(TARGET_CC) -o $@ $(#{prefix}_OBJECTS) $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS) - if test x$(TARGET_NO_STRIP) != xyes ; then $(STRIP) -R .rel.dyn -R .reginfo -R .note -R .comment $@; fi -endif - -" - end - - def rule(sources) - prefix = @name.to_var - objs = sources.collect do |src| - raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src - prefix + '-' + src.to_obj - end - deps = objs.collect {|obj| obj.suffix('d')} - deps_str = deps.join(' '); - - "MOSTLYCLEANFILES += #{deps_str} - -" + objs.collect_with_index do |obj, i| - src = sources[i] - fake_obj = File.basename(src).suffix('o') - dep = deps[i] - flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end - extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end - dir = File.dirname(src) - - "#{obj}: #{src} $(#{src}_DEPENDENCIES) - $(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -DGRUB_FILE=\\\"#{src}\\\" -MD -c -o $@ $< - --include #{dep} - -#{prefix}_OBJECTS += #{obj} -" - end.join('') - end -end - -class Script - def initialize(dir, name) - @dir = dir - @name = name - end - attr_reader :dir, :name - - def rule(sources) - if sources.length != 1 - raise "only a single source file must be specified for a script" - end - src = sources[0] - if /\.in$/ !~ src - raise "unknown source file `#{src}'" - end - - "CLEANFILES += #{@name} - -#{@name}: #{src} $(#{src}_DEPENDENCIES) config.status - ./config.status --file=-:#{src} | sed -e 's,@pkglib_DATA@,$(pkglib_DATA),g' > $@ - chmod +x $@ - -" - end -end - -images = [] -utils = [] -pmodules = [] -programs = [] -scripts = [] - -l = gets -print l -print "# Generated by genmk.rb, please don't edit!\n" - -cont = false -str = nil -while l = gets - if cont - str += l - else - str = l - end - - print l - cont = (/\\$/ =~ l) - unless cont - str.gsub!(/\\\n/, ' ') - - if /^([a-zA-Z0-9_]+)\s*\+?=\s*(.*?)\s*$/ =~ str - var, args = $1, $2 - - if var =~ /^([a-zA-Z0-9_]+)_([A-Z]+)$/ - prefix, type = $1, $2 - - case type - when 'IMAGES' - images += args.split(/\s+/).collect do |img| - Image.new(prefix, img) - end - - when 'MODULES' - pmodules += args.split(/\s+/).collect do |pmod| - PModule.new(prefix, pmod) - end - - when 'UTILITIES' - utils += args.split(/\s+/).collect do |util| - Utility.new(prefix, util) - end - - when 'PROGRAMS' - programs += args.split(/\s+/).collect do |prog| - Program.new(prefix, prog) - end - - when 'SCRIPTS' - scripts += args.split(/\s+/).collect do |script| - Script.new(prefix, script) - end - - when 'SOURCES' - if img = images.detect() {|i| i.name.to_var == prefix} - print img.rule(args.split(/\s+/)) - elsif pmod = pmodules.detect() {|m| m.name.to_var == prefix} - print pmod.rule(args.split(/\s+/)) - elsif util = utils.detect() {|u| u.name.to_var == prefix} - print util.rule(args.split(/\s+/)) - elsif program = programs.detect() {|u| u.name.to_var == prefix} - print program.rule(args.split(/\s+/)) - elsif script = scripts.detect() {|s| s.name.to_var == prefix} - print script.rule(args.split(/\s+/)) - end - end - end - - end - - end - -end -utils.each {|util| util.print_tail()} -programs.each {|program| program.print_tail()} - diff --git a/gentpl.py b/gentpl.py new file mode 100644 index 000000000..214b58afd --- /dev/null +++ b/gentpl.py @@ -0,0 +1,460 @@ +#! /usr/bin/python + +# +# This is the python script used to generate Makefile.tpl +# + +GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", + "i386_ieee1275", "x86_64_efi", "mips_yeeloong", "sparc64_ieee1275", + "powerpc_ieee1275" ] + +GROUPS = {} +GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_ieee1275" ] +GROUPS["x86_64"] = [ "x86_64_efi" ] +GROUPS["mips"] = [ "mips_yeeloong" ] +GROUPS["sparc64"] = [ "sparc64_ieee1275" ] +GROUPS["powerpc"] = [ "powerpc_ieee1275" ] +GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"] +GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ] +GROUPS["common"] = GRUB_PLATFORMS[:] +GROUPS["nonemu"] = GRUB_PLATFORMS[:] +GROUPS["nonemu"].remove("emu") + +# +# Create platform => groups reverse map, where groups covering that +# platform are ordered by their sizes +# +RMAP = {} +for platform in GRUB_PLATFORMS: + # initialize with platform itself as a group + RMAP[platform] = [ platform ] + + for k in GROUPS.keys(): + v = GROUPS[k] + # skip groups that don't cover this platform + if platform not in v: continue + + bigger = [] + smaller = [] + # partition currently known groups based on their size + for group in RMAP[platform]: + if group in GRUB_PLATFORMS: smaller.append(group) + elif len(GROUPS[group]) < len(v): smaller.append(group) + else: bigger.append(group) + # insert in the middle + RMAP[platform] = smaller + [ k ] + bigger + +# +# Global variables +# +GVARS = [] + +def gvar_add(var, value): + if var not in GVARS: + GVARS.append(var) + return var + " += " + value + "\n" + +def global_variable_initializers(): + r = "" + for var in GVARS: + r += var + " ?= \n" + return r + +# +# Per PROGRAM/SCRIPT variables +# + +def var_set(var, value): + return var + " = " + value + "\n" + +def var_add(var, value): + return var + " += " + value + "\n" + +# +# Autogen constructs +# + +def if_tag(tag, closure): + return "[+ IF " + tag + " +]" + closure() + "[+ ENDIF +]" + +def if_tag_defined(tag, closure): + return "[+ IF " + tag + " defined +]" + closure() + "[+ ENDIF +]" + +def for_tag(tag, closure): + return "[+ FOR ." + tag + " +]" + closure() + "[+ ENDFOR +]" + +def collect_values(tag, prefix=""): + return for_tag(tag, lambda: prefix + "[+ ." + tag + " +] ") + +def each_group(platform, suffix, closure): + r = None + for group in RMAP[platform]: + if r == None: + r = "[+ IF ." + group + suffix + " +]" + else: + r += "[+ ELIF ." + group + suffix + " +]" + + r += closure(group) + + if r: + r += "[+ ELSE +]" + r += closure(None) + r += "[+ ENDIF +]" + else: + r = closure(None) + + return r + +def each_platform(closure): + r = "" + for platform in GRUB_PLATFORMS: + for group in RMAP[platform]: + if group == RMAP[platform][0]: + r += "[+ IF ." + group + " defined +]" + else: + r += "[+ ELIF ." + group + " defined +]" + + r += "if COND_" + platform + "\n" + r += closure(platform) + r += "endif\n" + r += "[+ ENDIF +]" + return r + +def canonical_name(): return "[+ % name `echo -n %s | sed -e 's/[^0-9A-Za-z@_]/_/g'` +]" +def canonical_module(): return canonical_name() + "_module" +def canonical_kernel(): return canonical_name() + "_exec" +def canonical_image(): return canonical_name() + "_image" + +def shared_sources(prefix=""): return collect_values("shared", prefix) +def shared_nodist_sources(prefix=""): return collect_values("nodist_shared", prefix) + +def default_sources(prefix=""): return collect_values("source", prefix) +def default_nodist_sources(prefix=""): return collect_values("nodist", prefix) +def default_ldadd(): return collect_values("ldadd") +def default_cflags(): return collect_values("cflags") +def default_ldflags(): return collect_values("ldflags") +def default_cppflags(): return collect_values("cppflags") +def default_ccasflags(): return collect_values("ccasflags") + +def group_sources(group, prefix=""): return collect_values(group, prefix) if group else default_sources(prefix) +def group_nodist_sources(group, prefix=""): return collect_values(group + "_nodist", prefix) if group else default_nodist_sources(prefix) + +def platform_sources(platform, prefix=""): return each_group(platform, "", lambda g: collect_values(g, prefix) if g else default_sources(prefix)) +def platform_nodist_sources(platform, prefix=""): return each_group(platform, "_nodist", lambda g: collect_values(g + "_nodist", prefix) if g else default_nodist_sources(prefix)) + +def platform_ldadd(platform): return each_group(platform, "_ldadd", lambda g: collect_values(g + "_ldadd") if g else default_ldadd()) +def platform_cflags(platform): return each_group(platform, "_cflags", lambda g: collect_values(g + "_cflags") if g else default_cflags()) +def platform_ldflags(platform): return each_group(platform, "_ldflags", lambda g: collect_values(g + "_ldflags") if g else default_ldflags()) +def platform_cppflags(platform): return each_group(platform, "_cppflags", lambda g: collect_values(g + "_cppflags") if g else default_cppflags()) +def platform_ccasflags(platform): return each_group(platform, "_ccasflags", lambda g: collect_values(g + "_ccasflags") if g else default_ccasflags()) +def platform_format(platform): return each_group(platform, "_format", lambda g: collect_values(g + "_format") if g else "binary") + +def module(platform): + r = gvar_add("noinst_PROGRAMS", "[+ name +].module") + r += gvar_add("MODULE_FILES", "[+ name +].module") + + r += var_set(canonical_module() + "_SOURCES", platform_sources(platform) + "## platform sources") + r += var_add(canonical_module() + "_SOURCES", shared_sources() + "## shared sources") + r += var_set("nodist_" + canonical_module() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources") + r += var_add("nodist_" + canonical_module() + "_SOURCES", shared_nodist_sources() + "## shared nodist sources") + r += var_set(canonical_module() + "_LDADD", platform_ldadd(platform)) + r += var_set(canonical_module() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_MODULE) " + platform_cflags(platform)) + r += var_set(canonical_module() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_MODULE) " + platform_ldflags(platform)) + r += var_set(canonical_module() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_MODULE) " + platform_cppflags(platform)) + r += var_set(canonical_module() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(platform)) + + r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_module() + "_SOURCES)") + r += gvar_add("CLEANFILES", "$(nodist_" + canonical_module() + "_SOURCES)") + + r += gvar_add("DEF_FILES", "def-[+ name +].lst") + r += gvar_add("UND_FILES", "und-[+ name +].lst") + r += gvar_add("MOD_FILES", "[+ name +].mod") + r += gvar_add("platform_DATA", "[+ name +].mod") + r += gvar_add("CLEANFILES", "def-[+ name +].lst und-[+ name +].lst mod-[+ name +].c mod-[+ name +].o [+ name +].mod") + + r += gvar_add("COMMAND_FILES", "command-[+ name +].lst") + r += gvar_add("FS_FILES", "fs-[+ name +].lst") + r += gvar_add("VIDEO_FILES", "video-[+ name +].lst") + r += gvar_add("PARTMAP_FILES", "partmap-[+ name +].lst") + r += gvar_add("HANDLER_FILES", "handler-[+ name +].lst") + r += gvar_add("PARTTOOL_FILES", "parttool-[+ name +].lst") + r += gvar_add("TERMINAL_FILES", "terminal-[+ name +].lst") + r += gvar_add("CLEANFILES", "command-[+ name +].lst fs-[+ name +].lst") + r += gvar_add("CLEANFILES", "handler-[+ name +].lst terminal-[+ name +].lst") + r += gvar_add("CLEANFILES", "video-[+ name +].lst partmap-[+ name +].lst parttool-[+ name +].lst") + + r += """ +[+ name +].pp: $(""" + canonical_module() + """_SOURCES) $(nodist_""" + canonical_module() + """_SOURCES) + $(TARGET_CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + canonical_module() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@ || (rm -f $@; exit 1) + +def-[+ name +].lst: [+ name +].module + if test x$(USE_APPLE_CC_FIXES) = xyes; then \ + $(NM) -g -P -p $< | grep -E '^[a-zA-Z0-9_]* [TDS]' | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@; \ + else \ + $(NM) -g --defined-only -P -p $< | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@; \ + fi + +und-[+ name +].lst: [+ name +].module + $(NM) -u -P -p $< | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@ + +mod-[+ name +].c: [+ name +].module $(top_builddir)/moddep.lst $(top_srcdir)/genmodsrc.sh + sh $(top_srcdir)/genmodsrc.sh [+ name +] $(top_builddir)/moddep.lst > $@ || (rm -f $@; exit 1) + +mod-[+ name +].o: mod-[+ name +].c + $(TARGET_CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS_MODULE) $(CPPFLAGS) $(CFLAGS_MODULE) $(CFLAGS) -c -o $@ $< + +[+ name +].mod: [+ name +].module mod-[+ name +].o + if test x$(USE_APPLE_CC_FIXES) = xyes; then \ + $(CCLD) $(LDFLAGS_MODULE) $(LDFLAGS) -o $@.bin $^; \ + $(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -nu -nd $@.bin $@; \ + rm -f $@.bin; \ + else \ + $(CCLD) -o $@ $(LDFLAGS_MODULE) $(LDFLAGS) $^; \ + if test ! -z '$(TARGET_OBJ2ELF)'; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; \ + fi + +command-[+ name +].lst: [+ name +].pp $(top_srcdir)/gencmdlist.sh + cat $< | sh $(top_srcdir)/gencmdlist.sh [+ name +] > $@ || (rm -f $@; exit 1) + +fs-[+ name +].lst: [+ name +].pp $(top_srcdir)/genfslist.sh + cat $< | sh $(top_srcdir)/genfslist.sh [+ name +] > $@ || (rm -f $@; exit 1) + +video-[+ name +].lst: [+ name +].pp $(top_srcdir)/genvideolist.sh + cat $< | sh $(top_srcdir)/genvideolist.sh [+ name +] > $@ || (rm -f $@; exit 1) + +partmap-[+ name +].lst: [+ name +].pp $(top_srcdir)/genpartmaplist.sh + cat $< | sh $(top_srcdir)/genpartmaplist.sh [+ name +] > $@ || (rm -f $@; exit 1) + +parttool-[+ name +].lst: [+ name +].pp $(top_srcdir)/genparttoollist.sh + cat $< | sh $(top_srcdir)/genparttoollist.sh [+ name +] > $@ || (rm -f $@; exit 1) + +handler-[+ name +].lst: [+ name +].pp $(top_srcdir)/genhandlerlist.sh + cat $< | sh $(top_srcdir)/genhandlerlist.sh [+ name +] > $@ || (rm -f $@; exit 1) + +terminal-[+ name +].lst: [+ name +].pp $(top_srcdir)/genterminallist.sh + cat $< | sh $(top_srcdir)/genterminallist.sh [+ name +] > $@ || (rm -f $@; exit 1) +""" + return r + +def rule(target, source, cmd): + if cmd[0] == "\n": + return "\n" + target + ": " + source + cmd.replace("\n", "\n\t") + "\n" + else: + return "\n" + target + ": " + source + "\n\t" + cmd.replace("\n", "\n\t") + "\n" + +def image_nostrip(platform): + return if_tag_defined("image_nostrip." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", "cp $< $@")) + +def image_strip(platform): + return if_tag_defined("image_strip." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", "$(STRIP) -o $@ -R .rel.dyn -R .reginfo -R .note -R .comment $<")) + +def image_strip_keep_kernel(platform): + return if_tag_defined("image_strip_keep_kernel." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", "$(STRIP) -o $@ --strip-unneeded -K start -R .note -R .comment $<")) + +def image_strip_macho2img(platform): + return if_tag_defined("image_strip_macho2img." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", """ +if test "x$(TARGET_APPLE_CC)" = x1; then \ + $(MACHO2IMG) --bss $< $@ || exit 1; \ +else \ + $(STRIP) -o $@ -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< || exit 1; \ +fi +""")) + +def kernel(platform): + r = gvar_add("noinst_PROGRAMS", "[+ name +].exec") + r += var_set(canonical_kernel() + "_SOURCES", platform_sources(platform)) + r += var_add(canonical_kernel() + "_SOURCES", shared_sources()) + r += var_set("nodist_" + canonical_kernel() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources") + r += var_add("nodist_" + canonical_kernel() + "_SOURCES", shared_nodist_sources() + "## shared nodist sources") + r += var_set(canonical_kernel() + "_LDADD", platform_ldadd(platform)) + r += var_set(canonical_kernel() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_KERNEL) " + platform_cflags(platform)) + r += var_set(canonical_kernel() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_KERNEL) " + platform_ldflags(platform)) + r += var_set(canonical_kernel() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) " + platform_cppflags(platform)) + r += var_set(canonical_kernel() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_KERNEL) " + platform_ccasflags(platform)) + + r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_kernel() + "_SOURCES)") + r += gvar_add("CLEANFILES", "$(nodist_" + canonical_kernel() + "_SOURCES)") + + r += gvar_add("platform_DATA", "[+ name +].img") + r += image_nostrip(platform) + r += image_strip(platform) + r += image_strip_keep_kernel(platform) + r += image_strip_macho2img(platform) + return r + +def image(platform): + r = gvar_add("noinst_PROGRAMS", "[+ name +].image") + r += var_set(canonical_image() + "_SOURCES", platform_sources(platform)) + r += var_add(canonical_image() + "_SOURCES", shared_sources()) + r += var_set("nodist_" + canonical_image() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources") + r += var_add("nodist_" + canonical_image() + "_SOURCES", shared_nodist_sources() + "## shared nodist sources") + r += var_set(canonical_image() + "_LDADD", platform_ldadd(platform)) + r += var_set(canonical_image() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_IMAGE) " + platform_cflags(platform)) + r += var_set(canonical_image() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_IMAGE) " + platform_ldflags(platform)) + r += var_set(canonical_image() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_IMAGE) " + platform_cppflags(platform)) + r += var_set(canonical_image() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_IMAGE) " + platform_ccasflags(platform)) + + r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_image() + "_SOURCES)") + r += gvar_add("CLEANFILES", "$(nodist_" + canonical_image() + "_SOURCES)") + + r += gvar_add("platform_DATA", "[+ name +].img") + r += rule("[+ name +].img", "[+ name +].image", """ +if test x$(USE_APPLE_CC_FIXES) = xyes; then \ + $(MACHO2IMG) $< $@; \ +else \ + $(OBJCOPY) -O """ + platform_format(platform) + """ --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@; \ +fi +""") + return r + +def library(platform): + r = gvar_add("noinst_LIBRARIES", "[+ name +]") + r += var_set(canonical_name() + "_SOURCES", platform_sources(platform)) + r += var_add(canonical_name() + "_SOURCES", shared_sources()) + r += var_set("nodist_" + canonical_name() + "_SOURCES", platform_nodist_sources(platform)) + r += var_add("nodist_" + canonical_name() + "_SOURCES", shared_nodist_sources()) + r += var_set(canonical_name() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_LIBRARY) " + platform_cflags(platform)) + r += var_set(canonical_name() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) " + platform_cppflags(platform)) + r += var_set(canonical_name() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) " + platform_ccasflags(platform)) + + r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_name() + "_SOURCES)") + r += gvar_add("CLEANFILES", "$(nodist_" + canonical_name() + "_SOURCES)") + + return r + +def installdir(default="bin"): + return "[+ IF installdir +][+ installdir +][+ ELSE +]" + default + "[+ ENDIF +]" + +def manpage(): + r = "if COND_MAN_PAGES\n" + r += "man_MANS += [+ name +].[+ mansection +]\n" + r += rule("[+ name +].[+ mansection +]", "", """ +$(MAKE) $(AM_MAKEFLAGS) [+ name +] +chmod a+x [+ name +] +$(HELP2MAN) --section=[+ mansection +] -o $@ ./[+ name +] +""") + r += gvar_add("CLEANFILES", "[+ name +].[+ mansection +]") + r += "endif\n" + return r + +def program(platform, test=False): + if test: + r = gvar_add("check_PROGRAMS", "[+ name +]") + else: + r = gvar_add(installdir() + "_PROGRAMS", "[+ name +]") + + r += var_set(canonical_name() + "_SOURCES", platform_sources(platform)) + r += var_add(canonical_name() + "_SOURCES", shared_sources()) + r += var_set("nodist_" + canonical_name() + "_SOURCES", platform_nodist_sources(platform)) + r += var_add("nodist_" + canonical_name() + "_SOURCES", shared_nodist_sources()) + r += var_set(canonical_name() + "_LDADD", platform_ldadd(platform)) + r += var_set(canonical_name() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_PROGRAM) " + platform_cflags(platform)) + r += var_set(canonical_name() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_PROGRAM) " + platform_ldflags(platform)) + r += var_set(canonical_name() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM) " + platform_cppflags(platform)) + r += var_set(canonical_name() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM) " + platform_ccasflags(platform)) + + r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_name() + "_SOURCES)") + r += gvar_add("CLEANFILES", "$(nodist_" + canonical_name() + "_SOURCES)") + + if test: + r += if_tag_defined("enable", lambda: gvar_add("TESTS", "[+ name +]")) + else: + r += if_tag("mansection", lambda: manpage()) + + return r + +def test_program(platform): + return program(platform, True) + +def data(platform): + return gvar_add(installdir() + "_DATA", platform_sources(platform)) + +def script(platform, test=False): + if test: + r = gvar_add("check_SCRIPTS", "[+ name +]") + else: + r = gvar_add(installdir() + "_SCRIPTS", "[+ name +]") + + r += rule("[+ name +]", "$(top_builddir)/config.status " + platform_sources(platform), """ +$(top_builddir)/config.status --file=-:""" + platform_sources(platform) + """ \ + | sed -e 's,@pkglib_DATA@,$(pkglib_DATA),g' > $@ +chmod a+x [+ name +] +""") + + r += gvar_add("CLEANFILES", "[+ name +]") + r += gvar_add("EXTRA_DIST", platform_sources(platform)) + + if test: + r += if_tag_defined("enable", lambda: gvar_add("TESTS", "[+ name +]")) + else: + r += if_tag("mansection", lambda: manpage()) + + return r + +def test_script(platform): + return script(platform, True) + +def with_enable_condition(x): + return "[+ IF enable +]if [+ enable +]\n" + x + "endif\n[+ ELSE +]" + x + "[+ ENDIF +]" + +def module_rules(): + return for_tag("module", lambda: with_enable_condition(each_platform(lambda p: module(p)))) + +def kernel_rules(): + return for_tag("kernel", lambda: with_enable_condition(each_platform(lambda p: kernel(p)))) + +def image_rules(): + return for_tag("image", lambda: with_enable_condition(each_platform(lambda p: image(p)))) + +def library_rules(): + return for_tag("library", lambda: with_enable_condition(each_platform(lambda p: library(p)))) + +def program_rules(): + return for_tag("program", lambda: with_enable_condition(each_platform(lambda p: program(p)))) + +def script_rules(): + return for_tag("script", lambda: with_enable_condition(each_platform(lambda p: script(p)))) + +def data_rules(): + return for_tag("data", lambda: with_enable_condition(each_platform(lambda p: data(p)))) + +def test_program_rules(): + return for_tag("test_program", lambda: with_enable_condition(each_platform(lambda p: test_program(p)))) + +def test_script_rules(): + return for_tag("test_script", lambda: with_enable_condition(each_platform(lambda p: test_script(p)))) + +print "[+ AutoGen5 template +]\n" +a = module_rules() +b = kernel_rules() +c = image_rules() +d = library_rules() +e = program_rules() +f = script_rules() +g = data_rules() +h = test_program_rules() +i = test_script_rules() +z = global_variable_initializers() + +print z # initializer for all vars +print a +print b +print c +print d +print e +print f +print g +print h +print i + +print """.PRECIOUS: modules.am +$(srcdir)/modules.am: $(srcdir)/modules.def $(top_srcdir)/Makefile.tpl + autogen -T $(top_srcdir)/Makefile.tpl $(srcdir)/modules.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) + mv $@.new $@ + +.PRECIOUS: $(top_srcdir)/Makefile.tpl +$(top_srcdir)/Makefile.tpl: $(top_srcdir)/gentpl.py + python $(top_srcdir)/gentpl.py | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) + mv $@.new $@ +""" diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am new file mode 100644 index 000000000..1f2657656 --- /dev/null +++ b/grub-core/Makefile.am @@ -0,0 +1,155 @@ +AUTOMAKE_OPTIONS = subdir-objects +SUBDIRS = po +DEPDIR = .deps-core + +include $(top_srcdir)/Makefile.extra-dist +include $(top_srcdir)/Makefile.vars + +LDADD_KERNEL = -lgcc +CFLAGS_KERNEL = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding +LDFLAGS_KERNEL = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc +CPPFLAGS_KERNEL = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) +CCASFLAGS_KERNEL = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) + +CFLAGS_MODULE = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding +LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d +CPPFLAGS_MODULE = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) +CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) + +CFLAGS_IMAGE = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin +LDFLAGS_IMAGE = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-S +CPPFLAGS_IMAGE = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) +CCASFLAGS_IMAGE = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) + +CFLAGS_LIBRARY = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin +CPPFLAGS_LIBRARY = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) +CCASFLAGS_LIBRARY = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) + +CFLAGS_PROGRAM = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) +LDFLAGS_PROGRAM = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) +CPPFLAGS_PROGRAM = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) +CCASFLAGS_PROGRAM = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) + +AM_CFLAGS = +AM_LDFLAGS = +AM_CPPFLAGS = $(CPPFLAGS_GRUB) -DGRUB_FILE=\"$(subst $(top_srcdir)/,,$<)\" +AM_CCASFLAGS = -DASM_FILE=1 + +# gentrigtables +gentrigtables: $(top_srcdir)/gentrigtables.c + $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(CPPFLAGS) -lm $< +CLEANFILES += gentrigtables + +# trigtables.c +trigtables.c: gentrigtables.c configure.ac + $(MAKE) $(AM_MAKEFLAGS) gentrigtables + $(top_builddir)/gentrigtables > $@ +CLEANFILES += trigtables.c + +# XXX Use Automake's LEX & YACC support +# See Recording Dependencies Manually in automake doc for below rules +script/sh_module-lexer.$(OBJEXT):grub_script.tab.h +grub_script.tab.c grub_script.tab.h: $(top_srcdir)/script/parser.y + $(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/script/parser.y +CLEANFILES += grub_script.tab.c grub_script.tab.h + +# For the lexer. +# See Recording Dependencies Manually in automake doc for below rules +script/sh_module-lexer.$(OBJEXT):grub_script.yy.h +grub_script.yy.c grub_script.yy.h: $(top_srcdir)/script/yylex.l + $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(top_srcdir)/script/yylex.l +CLEANFILES += grub_script.yy.c grub_script.yy.h + +include $(srcdir)/modules.am +include $(srcdir)/Makefile.kernel + +# .lst files +platform_DATA += moddep.lst +platform_DATA += fs.lst +platform_DATA += command.lst +platform_DATA += partmap.lst +platform_DATA += handler.lst +platform_DATA += terminal.lst +platform_DATA += parttool.lst +platform_DATA += video.lst +platform_DATA += crypto.lst +CLEANFILES += moddep.lst +CLEANFILES += fs.lst +CLEANFILES += command.lst +CLEANFILES += partmap.lst +CLEANFILES += handler.lst +CLEANFILES += terminal.lst +CLEANFILES += parttool.lst +CLEANFILES += video.lst +CLEANFILES += crypto.lst + +fs.lst: $(FS_FILES) + cat $^ /dev/null | sort | uniq > $@ +command.lst: $(COMMAND_FILES) + cat $^ /dev/null | sort | uniq > $@ +partmap.lst: $(PARTMAP_FILES) + cat $^ /dev/null | sort | uniq > $@ +handler.lst: $(HANDLER_FILES) + cat $^ /dev/null | sort | uniq > $@ +terminal.lst: $(TERMINAL_FILES) + cat $^ /dev/null | sort | uniq > $@ +parttool.lst: $(PARTTOOL_FILES) + cat $^ /dev/null | sort | uniq > $@ +video.lst: $(VIDEO_FILES) + cat $^ /dev/null | sort | uniq > $@ + +# but, crypto.lst is simply copied +crypto.lst: $(top_srcdir)/lib/libgcrypt-grub/cipher/crypto.lst + cp $^ $@ + +# generate global module dependencies list +moddep.lst: kernel_syms.lst genmoddep.awk $(DEF_FILES) $(UND_FILES) + cat $(DEF_FILES) kernel_syms.lst /dev/null \ + | $(AWK) -f $(top_srcdir)/genmoddep.awk $(UND_FILES) > $@ \ + || (rm -f $@; exit 1) + +if COND_i386_pc +if COND_ENABLE_EFIEMU +efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF) + -rm -f $@; \ + if test "x$(TARGET_APPLE_CC)" = x1; then \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF32 -DAPPLE_CC -m32 -Wall -Werror -nostdlib -O2 -c -o $@.bin $< || exit 1; \ + $(OBJCONV) -felf32 -nu -nd $@.bin $@ || exit 1; \ + rm -f $@.bin; \ + else \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF32 -m32 -Wall -Werror -nostdlib -O2 -c -o $@ $< || exit 1; \ + if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \ + fi + +efiemu64_c.o: efiemu/runtime/efiemu.c + if test "x$(TARGET_APPLE_CC)" = x1; then \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -DAPPLE_CC=1 -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \ + else \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \ + fi + +efiemu64_s.o: efiemu/runtime/efiemu.S + -rm -f $@ + if test "x$(TARGET_APPLE_CC)" = x1; then \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -DAPPLE_CC=1 -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \ + else \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \ + fi + +efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF) + -rm -f $@; \ + if test "x$(TARGET_APPLE_CC)" = x1; then \ + rm -f $@.bin; \ + $(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \ + $(OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \ + rm -f $@.bin; \ + else \ + $(TARGET_CC) -m64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \ + if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \ + fi + +platform_DATA += efiemu32.o efiemu64.o +CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o +endif +endif + diff --git a/grub-core/Makefile.extra-dist b/grub-core/Makefile.extra-dist new file mode 100644 index 000000000..c6516f06a --- /dev/null +++ b/grub-core/Makefile.extra-dist @@ -0,0 +1,53 @@ +# +# Extra files that need to be distributed (in .tar.gz) to build +# successfully on user site. +# +# XXX Remove wildcards; See 27.3 in automake.info +# + +EXTRA_DIST = + +EXTRA_DIST += gentpl.py +EXTRA_DIST += Makefile.tpl +EXTRA_DIST += modules.def + +EXTRA_DIST += gentrigtables.c + +EXTRA_DIST += genmoddep.awk +EXTRA_DIST += genmodsrc.sh +EXTRA_DIST += gensymlist.sh + +EXTRA_DIST += genemuinit.sh +EXTRA_DIST += genemuinitheader.sh + +EXTRA_DIST += genfslist.sh +EXTRA_DIST += gencmdlist.sh +EXTRA_DIST += genvideolist.sh +EXTRA_DIST += genhandlerlist.sh +EXTRA_DIST += genpartmaplist.sh +EXTRA_DIST += genparttoollist.sh +EXTRA_DIST += genterminallist.sh +EXTRA_DIST += lib/libgcrypt-grub/cipher/crypto.lst + +EXTRA_DIST += script/yylex.l +EXTRA_DIST += script/parser.y + +EXTRA_DIST += lib/relocator.c + +EXTRA_DIST += efiemu/loadcore.c +EXTRA_DIST += efiemu/prepare.c + +EXTRA_DIST += loader/machoXX.c + + +EXTRA_DIST += kern/i386/loader.S +EXTRA_DIST += kern/i386/realmode.S +EXTRA_DIST += loader/i386/bsdXX.c +EXTRA_DIST += loader/i386/bsd_pagetable.c +EXTRA_DIST += loader/i386/multiboot_elfxx.c +EXTRA_DIST += commands/search.c + +EXTRA_DIST += kern/i386/pc/lzma_decode.S + +EXTRA_DIST += $(shell find $(top_srcdir) -name '*.h') + diff --git a/grub-core/Makefile.kernel b/grub-core/Makefile.kernel new file mode 100644 index 000000000..58e464805 --- /dev/null +++ b/grub-core/Makefile.kernel @@ -0,0 +1,192 @@ +# -*- makefile -*- + +KERNEL_HEADER_FILES = +KERNEL_HEADER_FILES += include/grub/cache.h +KERNEL_HEADER_FILES += include/grub/command.h +KERNEL_HEADER_FILES += include/grub/device.h +KERNEL_HEADER_FILES += include/grub/disk.h +KERNEL_HEADER_FILES += include/grub/dl.h +KERNEL_HEADER_FILES += include/grub/elf.h +KERNEL_HEADER_FILES += include/grub/elfload.h +KERNEL_HEADER_FILES += include/grub/env.h +KERNEL_HEADER_FILES += include/grub/env_private.h +KERNEL_HEADER_FILES += include/grub/err.h +KERNEL_HEADER_FILES += include/grub/file.h +KERNEL_HEADER_FILES += include/grub/fs.h +KERNEL_HEADER_FILES += include/grub/handler.h +KERNEL_HEADER_FILES += include/grub/i18n.h +KERNEL_HEADER_FILES += include/grub/kernel.h +KERNEL_HEADER_FILES += include/grub/list.h +KERNEL_HEADER_FILES += include/grub/misc.h +KERNEL_HEADER_FILES += include/grub/mm.h +KERNEL_HEADER_FILES += include/grub/net.h +KERNEL_HEADER_FILES += include/grub/parser.h +KERNEL_HEADER_FILES += include/grub/partition.h +KERNEL_HEADER_FILES += include/grub/reader.h +KERNEL_HEADER_FILES += include/grub/symbol.h +KERNEL_HEADER_FILES += include/grub/term.h +KERNEL_HEADER_FILES += include/grub/time.h +KERNEL_HEADER_FILES += include/grub/types.h + +if COND_i386_pc +KERNEL_HEADER_FILES += include/grub/boot.h +KERNEL_HEADER_FILES += include/grub/loader.h +KERNEL_HEADER_FILES += include/grub/msdos_partition.h +KERNEL_HEADER_FILES += include/grub/machine/biosdisk.h +KERNEL_HEADER_FILES += include/grub/machine/boot.h +KERNEL_HEADER_FILES += include/grub/machine/console.h +KERNEL_HEADER_FILES += include/grub/machine/memory.h +KERNEL_HEADER_FILES += include/grub/machine/loader.h +KERNEL_HEADER_FILES += include/grub/machine/vga.h +KERNEL_HEADER_FILES += include/grub/machine/vbe.h +KERNEL_HEADER_FILES += include/grub/machine/kernel.h +KERNEL_HEADER_FILES += include/grub/machine/pxe.h +KERNEL_HEADER_FILES += include/grub/i386/pit.h +endif + +if COND_i386_efi +KERNEL_HEADER_FILES += include/grub/boot.h +KERNEL_HEADER_FILES += include/grub/loader.h +KERNEL_HEADER_FILES += include/grub/msdos_partition.h +KERNEL_HEADER_FILES += include/grub/efi/efi.h +KERNEL_HEADER_FILES += include/grub/efi/time.h +KERNEL_HEADER_FILES += include/grub/efi/disk.h +KERNEL_HEADER_FILES += include/grub/i386/pit.h +endif + +if COND_i386_coreboot +KERNEL_HEADER_FILES += include/grub/boot.h +KERNEL_HEADER_FILES += include/grub/loader.h +KERNEL_HEADER_FILES += include/grub/msdos_partition.h +KERNEL_HEADER_FILES += include/grub/machine/boot.h +KERNEL_HEADER_FILES += include/grub/machine/console.h +KERNEL_HEADER_FILES += include/grub/machine/init.h +KERNEL_HEADER_FILES += include/grub/machine/memory.h +KERNEL_HEADER_FILES += include/grub/machine/loader.h +endif + +if COND_i386_qemu +KERNEL_HEADER_FILES += include/grub/boot.h +KERNEL_HEADER_FILES += include/grub/loader.h +KERNEL_HEADER_FILES += include/grub/msdos_partition.h +KERNEL_HEADER_FILES += include/grub/machine/boot.h +KERNEL_HEADER_FILES += include/grub/machine/console.h +KERNEL_HEADER_FILES += include/grub/machine/init.h +KERNEL_HEADER_FILES += include/grub/machine/memory.h +KERNEL_HEADER_FILES += include/grub/machine/loader.h +endif + +if COND_i386_ieee1275 +KERNEL_HEADER_FILES += include/grub/loader.h +KERNEL_HEADER_FILES += include/grub/msdos_partition.h +KERNEL_HEADER_FILES += include/grub/ieee1275/ieee1275.h +KERNEL_HEADER_FILES += include/grub/machine/kernel.h +KERNEL_HEADER_FILES += include/grub/machine/loader.h +KERNEL_HEADER_FILES += include/grub/machine/memory.h +endif + +if COND_x86_64_efi +KERNEL_HEADER_FILES += include/grub/boot.h +KERNEL_HEADER_FILES += include/grub/loader.h +KERNEL_HEADER_FILES += include/grub/msdos_partition.h +KERNEL_HEADER_FILES += include/grub/efi/efi.h +KERNEL_HEADER_FILES += include/grub/efi/time.h +KERNEL_HEADER_FILES += include/grub/efi/disk.h +KERNEL_HEADER_FILES += include/grub/machine/loader.h +KERNEL_HEADER_FILES += include/grub/i386/pit.h +endif + +if COND_mips_yeeloong +KERNEL_HEADER_FILES += include/grub/boot.h +KERNEL_HEADER_FILES += include/grub/loader.h +KERNEL_HEADER_FILES += include/grub/msdos_partition.h +KERNEL_HEADER_FILES += include/grub/machine/kernel.h +KERNEL_HEADER_FILES += include/grub/machine/memory.h +KERNEL_HEADER_FILES += include/grub/cpu/cache.h +KERNEL_HEADER_FILES += include/grub/bitmap.h +KERNEL_HEADER_FILES += include/grub/video.h +KERNEL_HEADER_FILES += include/grub/gfxterm.h +KERNEL_HEADER_FILES += include/grub/font.h +KERNEL_HEADER_FILES += include/grub/bitmap_scale.h +KERNEL_HEADER_FILES += include/grub/bufio.h +KERNEL_HEADER_FILES += include/grub/pci.h +KERNEL_HEADER_FILES += include/grub/libgcc.h +endif + +if COND_powerpc_ieee1275 +KERNEL_HEADER_FILES += include/grub/boot.h +KERNEL_HEADER_FILES += include/grub/loader.h +KERNEL_HEADER_FILES += include/grub/msdos_partition.h +KERNEL_HEADER_FILES += include/grub/ieee1275/ieee1275.h +KERNEL_HEADER_FILES += include/grub/machine/kernel.h +KERNEL_HEADER_FILES += include/grub/libgcc.h +endif + +if COND_sparc64_ieee1275 +KERNEL_HEADER_FILES += include/grub/boot.h +KERNEL_HEADER_FILES += include/grub/loader.h +KERNEL_HEADER_FILES += include/grub/msdos_partition.h +KERNEL_HEADER_FILES += include/grub/libgcc.h +KERNEL_HEADER_FILES += include/grub/ieee1275/ieee1275.h +KERNEL_HEADER_FILES += include/grub/machine/kernel.h +KERNEL_HEADER_FILES += include/grub/sparc64/ieee1275/ieee1275.h +endif + +if COND_emu +KERNEL_HEADER_FILES += include/grub/cpu/time.h +KERNEL_HEADER_FILES += include/grub/cpu/types.h +KERNEL_HEADER_FILES += include/grub/gzio.h +KERNEL_HEADER_FILES += include/grub/menu.h +KERNEL_HEADER_FILES += include/grub/datetime.h +KERNEL_HEADER_FILES += include/grub/emu/misc.h +if COND_GRUB_EMU_SDL +KERNEL_HEADER_FILES += include/grub/sdl.h +endif +if COND_GRUB_EMU_USB +KERNEL_HEADER_FILES += include/grub/libusb.h +endif +if COND_GRUB_EMU_PCI +KERNEL_HEADER_FILES += include/grub/libpciaccess.h +endif +endif + +symlist.h: config.h $(KERNEL_HEADER_FILES) + @list='$^'; \ + for p in $$list; do \ + echo "#include <$$p>" >> $@ || (rm -f $@; exit 1); \ + done +CLEANFILES += symlist.h +BUILT_SOURCES += symlist.h + +symlist.c: symlist.h gensymlist.sh + $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1) + cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1) + rm -f symlist.p +CLEANFILES += symlist.c +BUILT_SOURCES += symlist.c + +noinst_DATA += kernel_syms.lst +kernel_syms.lst: $(KERNEL_HEADER_FILES) config.h + if grep "^#define HAVE_ASM_USCORE" config.h; then u="_"; else u=""; fi + $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input + cat kernel_syms.input | grep -v '^#' | sed -n \ + -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \ + -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \ + | sort -u >$@ + rm -f kernel_syms.input +CLEANFILES += kernel_syms.lst + +if COND_emu +kern/emu/grub_emu-main.$(OBJEXT):grub_emu_init.h +grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h +kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h +grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h + +grub_emu_init.h: genemuinitheader.sh $(MOD_FILES) + rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@ +CLEANFILES += grub_emu_init.h + +grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES) + rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(NM) > $@ +CLEANFILES += grub_emu_init.c +endif diff --git a/grub-core/Makefile.vars b/grub-core/Makefile.vars new file mode 100644 index 000000000..710a8fd0b --- /dev/null +++ b/grub-core/Makefile.vars @@ -0,0 +1,80 @@ +# -*- makefile -*- + +# Platform specific options +if COND_i386_pc + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_efi + LDFLAGS_PLATFORM = -melf_i386 +endif +if COND_x86_64_efi + LDFLAGS_PLATFORM = -melf_x86_64 +endif +if COND_i386_qemu + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_coreboot + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_ieee1275 + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_mips_yeeloong + CFLAGS_PLATFORM = -march=mips3 -mexplicit-relocs -mflush-func=grub_cpu_flush_cache + CCASFLAGS_PLATFORM = -march=mips3 +endif +if COND_sparc64_ieee1275 + CFLAGS_PLATFORM = -mno-app-regs + LDFLAGS_PLATFORM = -melf64_sparc -mno-relax +endif + +CPPFLAGS_GRUB = -I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) +CPPFLAGS_GRUB += -I$(top_srcdir)/include -I$(top_builddir)/include + +CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers +CPPFLAGS_GCRY = -I$(top_srcdir)/lib/libgcrypt_wrap + +CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" +CPPFLAGS_GNULIB = -I$(top_srcdir)/gnulib + +CFLAGS_MKISOFS = -Wno-all -Werror +CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include + +CFLAGS_POSIX = -fno-builtin +CPPFLAGS_POSIX = -I$(top_srcdir)/lib/posix_wrap + +CPPFLAGS_EFIEMU = -I$(top_srcdir)/efiemu/runtime + +grubconfdir = $(sysconfdir)/grub.d +platformdir = $(pkglibdir)/$(target_cpu)-$(platform) + +# to calm down automake +BUILT_SOURCES = +CLEANFILES = +COMMAND_FILES = +DEF_FILES = +FS_FILES = +HANDLER_FILES = +IMG_FILES = +MOD_FILES = +MODULE_FILES = +PARTMAP_FILES = +PARTTOOL_FILES = +TERMINAL_FILES = +TESTS = +UND_FILES = +VIDEO_FILES = +bin_PROGRAMS = +bin_SCRIPTS = +check_PROGRAMS = +check_SCRIPTS = +grubconf_DATA = +grubconf_SCRIPTS = +man_MANS = +noinst_DATA = +noinst_LIBRARIES = +noinst_PROGRAMS = +pkglib_SCRIPTS = +platform_DATA = +sbin_PROGRAMS = +sbin_SCRIPTS = diff --git a/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S similarity index 100% rename from boot/i386/pc/boot.S rename to grub-core/boot/i386/pc/boot.S diff --git a/boot/i386/pc/cdboot.S b/grub-core/boot/i386/pc/cdboot.S similarity index 100% rename from boot/i386/pc/cdboot.S rename to grub-core/boot/i386/pc/cdboot.S diff --git a/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S similarity index 100% rename from boot/i386/pc/diskboot.S rename to grub-core/boot/i386/pc/diskboot.S diff --git a/boot/i386/pc/lnxboot.S b/grub-core/boot/i386/pc/lnxboot.S similarity index 100% rename from boot/i386/pc/lnxboot.S rename to grub-core/boot/i386/pc/lnxboot.S diff --git a/boot/i386/pc/pxeboot.S b/grub-core/boot/i386/pc/pxeboot.S similarity index 100% rename from boot/i386/pc/pxeboot.S rename to grub-core/boot/i386/pc/pxeboot.S diff --git a/boot/i386/qemu/boot.S b/grub-core/boot/i386/qemu/boot.S similarity index 100% rename from boot/i386/qemu/boot.S rename to grub-core/boot/i386/qemu/boot.S diff --git a/boot/sparc64/ieee1275/boot.S b/grub-core/boot/sparc64/ieee1275/boot.S similarity index 100% rename from boot/sparc64/ieee1275/boot.S rename to grub-core/boot/sparc64/ieee1275/boot.S diff --git a/boot/sparc64/ieee1275/diskboot.S b/grub-core/boot/sparc64/ieee1275/diskboot.S similarity index 100% rename from boot/sparc64/ieee1275/diskboot.S rename to grub-core/boot/sparc64/ieee1275/diskboot.S diff --git a/bus/bonito.c b/grub-core/bus/bonito.c similarity index 100% rename from bus/bonito.c rename to grub-core/bus/bonito.c diff --git a/util/pci.c b/grub-core/bus/emu/pci.c similarity index 98% rename from util/pci.c rename to grub-core/bus/emu/pci.c index 420ae320b..d1beb561d 100644 --- a/util/pci.c +++ b/grub-core/bus/emu/pci.c @@ -19,6 +19,7 @@ #include #include +#include #include grub_pci_address_t diff --git a/bus/pci.c b/grub-core/bus/pci.c similarity index 100% rename from bus/pci.c rename to grub-core/bus/pci.c diff --git a/util/usb.c b/grub-core/bus/usb/emu/usb.c similarity index 100% rename from util/usb.c rename to grub-core/bus/usb/emu/usb.c diff --git a/bus/usb/ohci.c b/grub-core/bus/usb/ohci.c similarity index 100% rename from bus/usb/ohci.c rename to grub-core/bus/usb/ohci.c diff --git a/bus/usb/uhci.c b/grub-core/bus/usb/uhci.c similarity index 100% rename from bus/usb/uhci.c rename to grub-core/bus/usb/uhci.c diff --git a/bus/usb/usb.c b/grub-core/bus/usb/usb.c similarity index 100% rename from bus/usb/usb.c rename to grub-core/bus/usb/usb.c diff --git a/bus/usb/usbhub.c b/grub-core/bus/usb/usbhub.c similarity index 100% rename from bus/usb/usbhub.c rename to grub-core/bus/usb/usbhub.c diff --git a/bus/usb/usbtrans.c b/grub-core/bus/usb/usbtrans.c similarity index 100% rename from bus/usb/usbtrans.c rename to grub-core/bus/usb/usbtrans.c diff --git a/commands/acpi.c b/grub-core/commands/acpi.c similarity index 100% rename from commands/acpi.c rename to grub-core/commands/acpi.c diff --git a/commands/blocklist.c b/grub-core/commands/blocklist.c similarity index 100% rename from commands/blocklist.c rename to grub-core/commands/blocklist.c diff --git a/commands/boot.c b/grub-core/commands/boot.c similarity index 100% rename from commands/boot.c rename to grub-core/commands/boot.c diff --git a/commands/cat.c b/grub-core/commands/cat.c similarity index 100% rename from commands/cat.c rename to grub-core/commands/cat.c diff --git a/commands/cmp.c b/grub-core/commands/cmp.c similarity index 100% rename from commands/cmp.c rename to grub-core/commands/cmp.c diff --git a/commands/configfile.c b/grub-core/commands/configfile.c similarity index 100% rename from commands/configfile.c rename to grub-core/commands/configfile.c diff --git a/commands/crc.c b/grub-core/commands/crc.c similarity index 100% rename from commands/crc.c rename to grub-core/commands/crc.c diff --git a/commands/date.c b/grub-core/commands/date.c similarity index 100% rename from commands/date.c rename to grub-core/commands/date.c diff --git a/commands/echo.c b/grub-core/commands/echo.c similarity index 100% rename from commands/echo.c rename to grub-core/commands/echo.c diff --git a/commands/efi/acpi.c b/grub-core/commands/efi/acpi.c similarity index 100% rename from commands/efi/acpi.c rename to grub-core/commands/efi/acpi.c diff --git a/commands/efi/fixvideo.c b/grub-core/commands/efi/fixvideo.c similarity index 100% rename from commands/efi/fixvideo.c rename to grub-core/commands/efi/fixvideo.c diff --git a/commands/efi/loadbios.c b/grub-core/commands/efi/loadbios.c similarity index 100% rename from commands/efi/loadbios.c rename to grub-core/commands/efi/loadbios.c diff --git a/commands/extcmd.c b/grub-core/commands/extcmd.c similarity index 100% rename from commands/extcmd.c rename to grub-core/commands/extcmd.c diff --git a/commands/gptsync.c b/grub-core/commands/gptsync.c similarity index 100% rename from commands/gptsync.c rename to grub-core/commands/gptsync.c diff --git a/commands/halt.c b/grub-core/commands/halt.c similarity index 100% rename from commands/halt.c rename to grub-core/commands/halt.c diff --git a/commands/handler.c b/grub-core/commands/handler.c similarity index 100% rename from commands/handler.c rename to grub-core/commands/handler.c diff --git a/commands/hashsum.c b/grub-core/commands/hashsum.c similarity index 100% rename from commands/hashsum.c rename to grub-core/commands/hashsum.c diff --git a/commands/hdparm.c b/grub-core/commands/hdparm.c similarity index 100% rename from commands/hdparm.c rename to grub-core/commands/hdparm.c diff --git a/commands/help.c b/grub-core/commands/help.c similarity index 100% rename from commands/help.c rename to grub-core/commands/help.c diff --git a/commands/hexdump.c b/grub-core/commands/hexdump.c similarity index 100% rename from commands/hexdump.c rename to grub-core/commands/hexdump.c diff --git a/commands/i386/cpuid.c b/grub-core/commands/i386/cpuid.c similarity index 100% rename from commands/i386/cpuid.c rename to grub-core/commands/i386/cpuid.c diff --git a/commands/i386/pc/acpi.c b/grub-core/commands/i386/pc/acpi.c similarity index 100% rename from commands/i386/pc/acpi.c rename to grub-core/commands/i386/pc/acpi.c diff --git a/commands/i386/pc/drivemap.c b/grub-core/commands/i386/pc/drivemap.c similarity index 100% rename from commands/i386/pc/drivemap.c rename to grub-core/commands/i386/pc/drivemap.c diff --git a/commands/i386/pc/drivemap_int13h.S b/grub-core/commands/i386/pc/drivemap_int13h.S similarity index 100% rename from commands/i386/pc/drivemap_int13h.S rename to grub-core/commands/i386/pc/drivemap_int13h.S diff --git a/commands/i386/pc/halt.c b/grub-core/commands/i386/pc/halt.c similarity index 100% rename from commands/i386/pc/halt.c rename to grub-core/commands/i386/pc/halt.c diff --git a/commands/i386/pc/play.c b/grub-core/commands/i386/pc/play.c similarity index 100% rename from commands/i386/pc/play.c rename to grub-core/commands/i386/pc/play.c diff --git a/commands/i386/pc/pxecmd.c b/grub-core/commands/i386/pc/pxecmd.c similarity index 100% rename from commands/i386/pc/pxecmd.c rename to grub-core/commands/i386/pc/pxecmd.c diff --git a/commands/i386/pc/vbeinfo.c b/grub-core/commands/i386/pc/vbeinfo.c similarity index 100% rename from commands/i386/pc/vbeinfo.c rename to grub-core/commands/i386/pc/vbeinfo.c diff --git a/commands/i386/pc/vbetest.c b/grub-core/commands/i386/pc/vbetest.c similarity index 100% rename from commands/i386/pc/vbetest.c rename to grub-core/commands/i386/pc/vbetest.c diff --git a/commands/ieee1275/suspend.c b/grub-core/commands/ieee1275/suspend.c similarity index 100% rename from commands/ieee1275/suspend.c rename to grub-core/commands/ieee1275/suspend.c diff --git a/commands/iorw.c b/grub-core/commands/iorw.c similarity index 100% rename from commands/iorw.c rename to grub-core/commands/iorw.c diff --git a/commands/keystatus.c b/grub-core/commands/keystatus.c similarity index 100% rename from commands/keystatus.c rename to grub-core/commands/keystatus.c diff --git a/commands/loadenv.c b/grub-core/commands/loadenv.c similarity index 100% rename from commands/loadenv.c rename to grub-core/commands/loadenv.c diff --git a/commands/ls.c b/grub-core/commands/ls.c similarity index 100% rename from commands/ls.c rename to grub-core/commands/ls.c diff --git a/commands/lsmmap.c b/grub-core/commands/lsmmap.c similarity index 100% rename from commands/lsmmap.c rename to grub-core/commands/lsmmap.c diff --git a/commands/lspci.c b/grub-core/commands/lspci.c similarity index 100% rename from commands/lspci.c rename to grub-core/commands/lspci.c diff --git a/commands/memrw.c b/grub-core/commands/memrw.c similarity index 100% rename from commands/memrw.c rename to grub-core/commands/memrw.c diff --git a/commands/minicmd.c b/grub-core/commands/minicmd.c similarity index 100% rename from commands/minicmd.c rename to grub-core/commands/minicmd.c diff --git a/commands/parttool.c b/grub-core/commands/parttool.c similarity index 99% rename from commands/parttool.c rename to grub-core/commands/parttool.c index 528cf43d7..d38a8a98f 100644 --- a/commands/parttool.c +++ b/grub-core/commands/parttool.c @@ -175,7 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), } /* Load modules. */ -#if !GRUB_NO_MODULES +#if defined(GRUB_MACHINE_EMU) { const char *prefix; prefix = grub_env_get ("prefix"); diff --git a/commands/password.c b/grub-core/commands/password.c similarity index 100% rename from commands/password.c rename to grub-core/commands/password.c diff --git a/commands/password_pbkdf2.c b/grub-core/commands/password_pbkdf2.c similarity index 100% rename from commands/password_pbkdf2.c rename to grub-core/commands/password_pbkdf2.c diff --git a/commands/probe.c b/grub-core/commands/probe.c similarity index 100% rename from commands/probe.c rename to grub-core/commands/probe.c diff --git a/commands/read.c b/grub-core/commands/read.c similarity index 100% rename from commands/read.c rename to grub-core/commands/read.c diff --git a/commands/reboot.c b/grub-core/commands/reboot.c similarity index 100% rename from commands/reboot.c rename to grub-core/commands/reboot.c diff --git a/commands/regexp.c b/grub-core/commands/regexp.c similarity index 100% rename from commands/regexp.c rename to grub-core/commands/regexp.c diff --git a/commands/search.c b/grub-core/commands/search.c similarity index 100% rename from commands/search.c rename to grub-core/commands/search.c diff --git a/commands/search_file.c b/grub-core/commands/search_file.c similarity index 100% rename from commands/search_file.c rename to grub-core/commands/search_file.c diff --git a/commands/search_label.c b/grub-core/commands/search_label.c similarity index 100% rename from commands/search_label.c rename to grub-core/commands/search_label.c diff --git a/commands/search_uuid.c b/grub-core/commands/search_uuid.c similarity index 100% rename from commands/search_uuid.c rename to grub-core/commands/search_uuid.c diff --git a/commands/search_wrap.c b/grub-core/commands/search_wrap.c similarity index 100% rename from commands/search_wrap.c rename to grub-core/commands/search_wrap.c diff --git a/commands/setpci.c b/grub-core/commands/setpci.c similarity index 100% rename from commands/setpci.c rename to grub-core/commands/setpci.c diff --git a/commands/sleep.c b/grub-core/commands/sleep.c similarity index 100% rename from commands/sleep.c rename to grub-core/commands/sleep.c diff --git a/commands/terminal.c b/grub-core/commands/terminal.c similarity index 100% rename from commands/terminal.c rename to grub-core/commands/terminal.c diff --git a/commands/test.c b/grub-core/commands/test.c similarity index 100% rename from commands/test.c rename to grub-core/commands/test.c diff --git a/commands/true.c b/grub-core/commands/true.c similarity index 100% rename from commands/true.c rename to grub-core/commands/true.c diff --git a/commands/usbtest.c b/grub-core/commands/usbtest.c similarity index 100% rename from commands/usbtest.c rename to grub-core/commands/usbtest.c diff --git a/commands/videotest.c b/grub-core/commands/videotest.c similarity index 100% rename from commands/videotest.c rename to grub-core/commands/videotest.c diff --git a/commands/xnu_uuid.c b/grub-core/commands/xnu_uuid.c similarity index 100% rename from commands/xnu_uuid.c rename to grub-core/commands/xnu_uuid.c diff --git a/conf/any-emu.rmk b/grub-core/conf/any-emu.rmk similarity index 100% rename from conf/any-emu.rmk rename to grub-core/conf/any-emu.rmk diff --git a/conf/common.rmk b/grub-core/conf/common.rmk similarity index 100% rename from conf/common.rmk rename to grub-core/conf/common.rmk diff --git a/conf/i386-coreboot.rmk b/grub-core/conf/i386-coreboot.rmk similarity index 100% rename from conf/i386-coreboot.rmk rename to grub-core/conf/i386-coreboot.rmk diff --git a/conf/i386-efi.rmk b/grub-core/conf/i386-efi.rmk similarity index 100% rename from conf/i386-efi.rmk rename to grub-core/conf/i386-efi.rmk diff --git a/conf/i386-ieee1275.rmk b/grub-core/conf/i386-ieee1275.rmk similarity index 100% rename from conf/i386-ieee1275.rmk rename to grub-core/conf/i386-ieee1275.rmk diff --git a/conf/i386-multiboot.rmk b/grub-core/conf/i386-multiboot.rmk similarity index 100% rename from conf/i386-multiboot.rmk rename to grub-core/conf/i386-multiboot.rmk diff --git a/conf/i386-pc-cygwin-img-ld.sc b/grub-core/conf/i386-pc-cygwin-img-ld.sc similarity index 100% rename from conf/i386-pc-cygwin-img-ld.sc rename to grub-core/conf/i386-pc-cygwin-img-ld.sc diff --git a/conf/i386-pc.rmk b/grub-core/conf/i386-pc.rmk similarity index 100% rename from conf/i386-pc.rmk rename to grub-core/conf/i386-pc.rmk diff --git a/conf/i386-qemu.rmk b/grub-core/conf/i386-qemu.rmk similarity index 100% rename from conf/i386-qemu.rmk rename to grub-core/conf/i386-qemu.rmk diff --git a/conf/i386.rmk b/grub-core/conf/i386.rmk similarity index 100% rename from conf/i386.rmk rename to grub-core/conf/i386.rmk diff --git a/conf/mips-qemu-mips.rmk b/grub-core/conf/mips-qemu-mips.rmk similarity index 100% rename from conf/mips-qemu-mips.rmk rename to grub-core/conf/mips-qemu-mips.rmk diff --git a/conf/mips-yeeloong.rmk b/grub-core/conf/mips-yeeloong.rmk similarity index 100% rename from conf/mips-yeeloong.rmk rename to grub-core/conf/mips-yeeloong.rmk diff --git a/conf/mips.rmk b/grub-core/conf/mips.rmk similarity index 100% rename from conf/mips.rmk rename to grub-core/conf/mips.rmk diff --git a/conf/powerpc-ieee1275.rmk b/grub-core/conf/powerpc-ieee1275.rmk similarity index 100% rename from conf/powerpc-ieee1275.rmk rename to grub-core/conf/powerpc-ieee1275.rmk diff --git a/conf/sparc64-ieee1275.rmk b/grub-core/conf/sparc64-ieee1275.rmk similarity index 100% rename from conf/sparc64-ieee1275.rmk rename to grub-core/conf/sparc64-ieee1275.rmk diff --git a/conf/tests.rmk b/grub-core/conf/tests.rmk similarity index 100% rename from conf/tests.rmk rename to grub-core/conf/tests.rmk diff --git a/conf/x86-efi.rmk b/grub-core/conf/x86-efi.rmk similarity index 100% rename from conf/x86-efi.rmk rename to grub-core/conf/x86-efi.rmk diff --git a/conf/x86_64-efi.rmk b/grub-core/conf/x86_64-efi.rmk similarity index 100% rename from conf/x86_64-efi.rmk rename to grub-core/conf/x86_64-efi.rmk diff --git a/grub-core/configure.ac b/grub-core/configure.ac new file mode 100644 index 000000000..ac462ea77 --- /dev/null +++ b/grub-core/configure.ac @@ -0,0 +1,91 @@ +# Process this file with autoconf to produce a configure script. + +# Copyright (C) 2010 Free Software Foundation, Inc. +# +# This configure.ac is free software; the author +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +dnl This configure script is complicated, because GRUB needs to deal +dnl with three potentially different types: +dnl +dnl build -- the environment for building GRUB +dnl host -- the environment for running utilities +dnl target -- the environment for running GRUB +dnl +dnl In addition, GRUB needs to deal with a platform specification +dnl which specifies the system running GRUB, such as firmware. +dnl This is necessary because the target type in autoconf does not +dnl describe such a system very well. +dnl +dnl The current strategy is to build utilities using host +dnl cross-compiler and grub core and modules using target +dnl cross-compiler. For this we use nested packages approach, where +dnl top-level package grub utilities is built with HOSTCC and nested +dnl package (in grub-core directory) builds with TARGETCC. + +# NOTE: ../configure.ac must also be updated. +AC_INIT([GRUB],[1.98],[bug-grub@gnu.org]) +AC_CONFIG_AUX_DIR([.]) + +# Checks for host and target systems. +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + +AM_INIT_AUTOMAKE() +AC_PREREQ(2.60) +AC_CONFIG_SRCDIR([include/grub/dl.h]) +AC_CONFIG_HEADER([config.h]) + +m4_include([configure.common]) + +TARGET_CPP="$TARGET_CC -E" +TARGET_CCAS=$TARGET_CC + +CC=$TARGET_CC +CPP=$TARGET_CC +CCAS=$TARGET_CC + +AC_SUBST(TARGET_CC) +AC_SUBST(TARGET_CPP) +AC_SUBST(TARGET_CCAS) +AC_SUBST(TARGET_IMG_LDSCRIPT) +AC_SUBST(TARGET_IMG_LDFLAGS) +AC_SUBST(TARGET_IMG_CFLAGS) +AC_SUBST(TARGET_OBJ2ELF) +AC_SUBST(TARGET_MODULE_FORMAT) +AC_SUBST(OBJCONV) +AC_SUBST(TARGET_APPLE_CC) +AC_SUBST(ASFLAGS) +AC_SUBST(TARGET_CFLAGS) +AC_SUBST(TARGET_ASFLAGS) +AC_SUBST(TARGET_LDFLAGS) +AC_SUBST(TARGET_CPPFLAGS) + +# Output files. +grub_CHECK_LINK_DIR +if test x"$link_dir" = xyes ; then + AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu]) + if test "$platform" != emu ; then + AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform]) + fi +else + mkdir -p include/grub 2>/dev/null + rm -rf include/grub/cpu + cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null + if test "$platform" != emu ; then + rm -rf include/grub/machine + cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null + fi +fi + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([po/Makefile]) +AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) + +AC_OUTPUT diff --git a/disk/ata.c b/grub-core/disk/ata.c similarity index 100% rename from disk/ata.c rename to grub-core/disk/ata.c diff --git a/disk/ata_pthru.c b/grub-core/disk/ata_pthru.c similarity index 100% rename from disk/ata_pthru.c rename to grub-core/disk/ata_pthru.c diff --git a/disk/dmraid_nvidia.c b/grub-core/disk/dmraid_nvidia.c similarity index 100% rename from disk/dmraid_nvidia.c rename to grub-core/disk/dmraid_nvidia.c diff --git a/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c similarity index 100% rename from disk/efi/efidisk.c rename to grub-core/disk/efi/efidisk.c diff --git a/disk/host.c b/grub-core/disk/host.c similarity index 100% rename from disk/host.c rename to grub-core/disk/host.c diff --git a/disk/i386/pc/biosdisk.c b/grub-core/disk/i386/pc/biosdisk.c similarity index 100% rename from disk/i386/pc/biosdisk.c rename to grub-core/disk/i386/pc/biosdisk.c diff --git a/disk/ieee1275/nand.c b/grub-core/disk/ieee1275/nand.c similarity index 100% rename from disk/ieee1275/nand.c rename to grub-core/disk/ieee1275/nand.c diff --git a/disk/ieee1275/ofdisk.c b/grub-core/disk/ieee1275/ofdisk.c similarity index 100% rename from disk/ieee1275/ofdisk.c rename to grub-core/disk/ieee1275/ofdisk.c diff --git a/disk/loopback.c b/grub-core/disk/loopback.c similarity index 100% rename from disk/loopback.c rename to grub-core/disk/loopback.c diff --git a/disk/lvm.c b/grub-core/disk/lvm.c similarity index 100% rename from disk/lvm.c rename to grub-core/disk/lvm.c diff --git a/disk/mdraid_linux.c b/grub-core/disk/mdraid_linux.c similarity index 100% rename from disk/mdraid_linux.c rename to grub-core/disk/mdraid_linux.c diff --git a/disk/memdisk.c b/grub-core/disk/memdisk.c similarity index 100% rename from disk/memdisk.c rename to grub-core/disk/memdisk.c diff --git a/disk/raid.c b/grub-core/disk/raid.c similarity index 100% rename from disk/raid.c rename to grub-core/disk/raid.c diff --git a/disk/raid5_recover.c b/grub-core/disk/raid5_recover.c similarity index 100% rename from disk/raid5_recover.c rename to grub-core/disk/raid5_recover.c diff --git a/disk/raid6_recover.c b/grub-core/disk/raid6_recover.c similarity index 100% rename from disk/raid6_recover.c rename to grub-core/disk/raid6_recover.c diff --git a/disk/scsi.c b/grub-core/disk/scsi.c similarity index 100% rename from disk/scsi.c rename to grub-core/disk/scsi.c diff --git a/disk/usbms.c b/grub-core/disk/usbms.c similarity index 100% rename from disk/usbms.c rename to grub-core/disk/usbms.c diff --git a/efiemu/i386/coredetect.c b/grub-core/efiemu/i386/coredetect.c similarity index 100% rename from efiemu/i386/coredetect.c rename to grub-core/efiemu/i386/coredetect.c diff --git a/efiemu/i386/loadcore32.c b/grub-core/efiemu/i386/loadcore32.c similarity index 100% rename from efiemu/i386/loadcore32.c rename to grub-core/efiemu/i386/loadcore32.c diff --git a/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c similarity index 100% rename from efiemu/i386/loadcore64.c rename to grub-core/efiemu/i386/loadcore64.c diff --git a/efiemu/i386/pc/cfgtables.c b/grub-core/efiemu/i386/pc/cfgtables.c similarity index 100% rename from efiemu/i386/pc/cfgtables.c rename to grub-core/efiemu/i386/pc/cfgtables.c diff --git a/efiemu/loadcore.c b/grub-core/efiemu/loadcore.c similarity index 100% rename from efiemu/loadcore.c rename to grub-core/efiemu/loadcore.c diff --git a/efiemu/loadcore32.c b/grub-core/efiemu/loadcore32.c similarity index 100% rename from efiemu/loadcore32.c rename to grub-core/efiemu/loadcore32.c diff --git a/efiemu/loadcore64.c b/grub-core/efiemu/loadcore64.c similarity index 100% rename from efiemu/loadcore64.c rename to grub-core/efiemu/loadcore64.c diff --git a/efiemu/loadcore_common.c b/grub-core/efiemu/loadcore_common.c similarity index 100% rename from efiemu/loadcore_common.c rename to grub-core/efiemu/loadcore_common.c diff --git a/efiemu/main.c b/grub-core/efiemu/main.c similarity index 100% rename from efiemu/main.c rename to grub-core/efiemu/main.c diff --git a/efiemu/mm.c b/grub-core/efiemu/mm.c similarity index 100% rename from efiemu/mm.c rename to grub-core/efiemu/mm.c diff --git a/efiemu/pnvram.c b/grub-core/efiemu/pnvram.c similarity index 100% rename from efiemu/pnvram.c rename to grub-core/efiemu/pnvram.c diff --git a/efiemu/prepare.c b/grub-core/efiemu/prepare.c similarity index 100% rename from efiemu/prepare.c rename to grub-core/efiemu/prepare.c diff --git a/efiemu/prepare32.c b/grub-core/efiemu/prepare32.c similarity index 100% rename from efiemu/prepare32.c rename to grub-core/efiemu/prepare32.c diff --git a/efiemu/prepare64.c b/grub-core/efiemu/prepare64.c similarity index 100% rename from efiemu/prepare64.c rename to grub-core/efiemu/prepare64.c diff --git a/efiemu/runtime/config.h b/grub-core/efiemu/runtime/config.h similarity index 100% rename from efiemu/runtime/config.h rename to grub-core/efiemu/runtime/config.h diff --git a/efiemu/runtime/efiemu.S b/grub-core/efiemu/runtime/efiemu.S similarity index 100% rename from efiemu/runtime/efiemu.S rename to grub-core/efiemu/runtime/efiemu.S diff --git a/efiemu/runtime/efiemu.c b/grub-core/efiemu/runtime/efiemu.c similarity index 100% rename from efiemu/runtime/efiemu.c rename to grub-core/efiemu/runtime/efiemu.c diff --git a/efiemu/runtime/efiemu.sh b/grub-core/efiemu/runtime/efiemu.sh similarity index 100% rename from efiemu/runtime/efiemu.sh rename to grub-core/efiemu/runtime/efiemu.sh diff --git a/efiemu/symbols.c b/grub-core/efiemu/symbols.c similarity index 100% rename from efiemu/symbols.c rename to grub-core/efiemu/symbols.c diff --git a/font/font.c b/grub-core/font/font.c similarity index 100% rename from font/font.c rename to grub-core/font/font.c diff --git a/font/font_cmd.c b/grub-core/font/font_cmd.c similarity index 100% rename from font/font_cmd.c rename to grub-core/font/font_cmd.c diff --git a/fs/affs.c b/grub-core/fs/affs.c similarity index 100% rename from fs/affs.c rename to grub-core/fs/affs.c diff --git a/fs/afs.c b/grub-core/fs/afs.c similarity index 100% rename from fs/afs.c rename to grub-core/fs/afs.c diff --git a/fs/afs_be.c b/grub-core/fs/afs_be.c similarity index 100% rename from fs/afs_be.c rename to grub-core/fs/afs_be.c diff --git a/fs/befs.c b/grub-core/fs/befs.c similarity index 100% rename from fs/befs.c rename to grub-core/fs/befs.c diff --git a/fs/befs_be.c b/grub-core/fs/befs_be.c similarity index 100% rename from fs/befs_be.c rename to grub-core/fs/befs_be.c diff --git a/fs/cpio.c b/grub-core/fs/cpio.c similarity index 100% rename from fs/cpio.c rename to grub-core/fs/cpio.c diff --git a/fs/ext2.c b/grub-core/fs/ext2.c similarity index 100% rename from fs/ext2.c rename to grub-core/fs/ext2.c diff --git a/fs/fat.c b/grub-core/fs/fat.c similarity index 100% rename from fs/fat.c rename to grub-core/fs/fat.c diff --git a/fs/fshelp.c b/grub-core/fs/fshelp.c similarity index 100% rename from fs/fshelp.c rename to grub-core/fs/fshelp.c diff --git a/fs/hfs.c b/grub-core/fs/hfs.c similarity index 100% rename from fs/hfs.c rename to grub-core/fs/hfs.c diff --git a/fs/hfsplus.c b/grub-core/fs/hfsplus.c similarity index 100% rename from fs/hfsplus.c rename to grub-core/fs/hfsplus.c diff --git a/fs/i386/pc/pxe.c b/grub-core/fs/i386/pc/pxe.c similarity index 100% rename from fs/i386/pc/pxe.c rename to grub-core/fs/i386/pc/pxe.c diff --git a/fs/iso9660.c b/grub-core/fs/iso9660.c similarity index 100% rename from fs/iso9660.c rename to grub-core/fs/iso9660.c diff --git a/fs/jfs.c b/grub-core/fs/jfs.c similarity index 100% rename from fs/jfs.c rename to grub-core/fs/jfs.c diff --git a/fs/minix.c b/grub-core/fs/minix.c similarity index 100% rename from fs/minix.c rename to grub-core/fs/minix.c diff --git a/fs/nilfs2.c b/grub-core/fs/nilfs2.c similarity index 100% rename from fs/nilfs2.c rename to grub-core/fs/nilfs2.c diff --git a/fs/ntfs.c b/grub-core/fs/ntfs.c similarity index 100% rename from fs/ntfs.c rename to grub-core/fs/ntfs.c diff --git a/fs/ntfscomp.c b/grub-core/fs/ntfscomp.c similarity index 100% rename from fs/ntfscomp.c rename to grub-core/fs/ntfscomp.c diff --git a/fs/reiserfs.c b/grub-core/fs/reiserfs.c similarity index 100% rename from fs/reiserfs.c rename to grub-core/fs/reiserfs.c diff --git a/fs/sfs.c b/grub-core/fs/sfs.c similarity index 100% rename from fs/sfs.c rename to grub-core/fs/sfs.c diff --git a/fs/tar.c b/grub-core/fs/tar.c similarity index 100% rename from fs/tar.c rename to grub-core/fs/tar.c diff --git a/fs/udf.c b/grub-core/fs/udf.c similarity index 100% rename from fs/udf.c rename to grub-core/fs/udf.c diff --git a/fs/ufs.c b/grub-core/fs/ufs.c similarity index 100% rename from fs/ufs.c rename to grub-core/fs/ufs.c diff --git a/fs/ufs2.c b/grub-core/fs/ufs2.c similarity index 100% rename from fs/ufs2.c rename to grub-core/fs/ufs2.c diff --git a/fs/xfs.c b/grub-core/fs/xfs.c similarity index 100% rename from fs/xfs.c rename to grub-core/fs/xfs.c diff --git a/gencmdlist.sh b/grub-core/gencmdlist.sh similarity index 100% rename from gencmdlist.sh rename to grub-core/gencmdlist.sh diff --git a/gendistlist.sh b/grub-core/gendistlist.sh similarity index 100% rename from gendistlist.sh rename to grub-core/gendistlist.sh diff --git a/genemuinit.sh b/grub-core/genemuinit.sh similarity index 100% rename from genemuinit.sh rename to grub-core/genemuinit.sh diff --git a/genemuinitheader.sh b/grub-core/genemuinitheader.sh similarity index 100% rename from genemuinitheader.sh rename to grub-core/genemuinitheader.sh diff --git a/genfslist.sh b/grub-core/genfslist.sh similarity index 100% rename from genfslist.sh rename to grub-core/genfslist.sh diff --git a/genhandlerlist.sh b/grub-core/genhandlerlist.sh similarity index 100% rename from genhandlerlist.sh rename to grub-core/genhandlerlist.sh diff --git a/genmoddep.awk b/grub-core/genmoddep.awk similarity index 93% rename from genmoddep.awk rename to grub-core/genmoddep.awk index 48419a091..6c92e2fc7 100644 --- a/genmoddep.awk +++ b/grub-core/genmoddep.awk @@ -18,15 +18,14 @@ BEGIN { } } -# The first line contains a module name. -FNR == 1 { - module = $1 - next -}; - # The rest is undefined symbols. { - if ($1 in symtab) { + module = $2 + + # skip if empty + if ($1 == "" || $2 == "") + ; + else if ($1 in symtab) { modtab[module] = modtab[module] " " symtab[$1]; } else if ($1 != "__gnu_local_gp") { diff --git a/genmodsrc.sh b/grub-core/genmodsrc.sh similarity index 100% rename from genmodsrc.sh rename to grub-core/genmodsrc.sh diff --git a/genpartmaplist.sh b/grub-core/genpartmaplist.sh similarity index 100% rename from genpartmaplist.sh rename to grub-core/genpartmaplist.sh diff --git a/genparttoollist.sh b/grub-core/genparttoollist.sh similarity index 100% rename from genparttoollist.sh rename to grub-core/genparttoollist.sh diff --git a/gensymlist.sh.in b/grub-core/gensymlist.sh similarity index 84% rename from gensymlist.sh.in rename to grub-core/gensymlist.sh index 3c3ddfa6c..0ab56e9cb 100644 --- a/gensymlist.sh.in +++ b/grub-core/gensymlist.sh @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright (C) 2002,2006,2007,2008 Free Software Foundation, Inc. +# Copyright (C) 2002,2006,2007,2008,2009,2010 Free Software Foundation, Inc. # # This gensymlist.sh.in is free software; the author # gives unlimited permission to copy and/or distribute it, @@ -11,17 +11,11 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -### The configure script will replace these variables. - -: ${srcdir=@srcdir@} -: ${CC=@TARGET_CC@} - - cat <. */ -#include EOF for i in $*; do @@ -60,7 +53,7 @@ cat < int -main () +main (int argc __attribute__ ((unused)), + char **argv __attribute__ ((unused))) { int i; diff --git a/genvideolist.sh b/grub-core/genvideolist.sh similarity index 100% rename from genvideolist.sh rename to grub-core/genvideolist.sh diff --git a/gettext/gettext.c b/grub-core/gettext/gettext.c similarity index 100% rename from gettext/gettext.c rename to grub-core/gettext/gettext.c diff --git a/gfxmenu/gfxmenu.c b/grub-core/gfxmenu/gfxmenu.c similarity index 100% rename from gfxmenu/gfxmenu.c rename to grub-core/gfxmenu/gfxmenu.c diff --git a/gfxmenu/gui_box.c b/grub-core/gfxmenu/gui_box.c similarity index 100% rename from gfxmenu/gui_box.c rename to grub-core/gfxmenu/gui_box.c diff --git a/gfxmenu/gui_canvas.c b/grub-core/gfxmenu/gui_canvas.c similarity index 100% rename from gfxmenu/gui_canvas.c rename to grub-core/gfxmenu/gui_canvas.c diff --git a/gfxmenu/gui_circular_progress.c b/grub-core/gfxmenu/gui_circular_progress.c similarity index 100% rename from gfxmenu/gui_circular_progress.c rename to grub-core/gfxmenu/gui_circular_progress.c diff --git a/gfxmenu/gui_image.c b/grub-core/gfxmenu/gui_image.c similarity index 100% rename from gfxmenu/gui_image.c rename to grub-core/gfxmenu/gui_image.c diff --git a/gfxmenu/gui_label.c b/grub-core/gfxmenu/gui_label.c similarity index 100% rename from gfxmenu/gui_label.c rename to grub-core/gfxmenu/gui_label.c diff --git a/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c similarity index 100% rename from gfxmenu/gui_list.c rename to grub-core/gfxmenu/gui_list.c diff --git a/gfxmenu/gui_progress_bar.c b/grub-core/gfxmenu/gui_progress_bar.c similarity index 100% rename from gfxmenu/gui_progress_bar.c rename to grub-core/gfxmenu/gui_progress_bar.c diff --git a/gfxmenu/gui_string_util.c b/grub-core/gfxmenu/gui_string_util.c similarity index 100% rename from gfxmenu/gui_string_util.c rename to grub-core/gfxmenu/gui_string_util.c diff --git a/gfxmenu/gui_util.c b/grub-core/gfxmenu/gui_util.c similarity index 100% rename from gfxmenu/gui_util.c rename to grub-core/gfxmenu/gui_util.c diff --git a/gfxmenu/icon_manager.c b/grub-core/gfxmenu/icon_manager.c similarity index 100% rename from gfxmenu/icon_manager.c rename to grub-core/gfxmenu/icon_manager.c diff --git a/gfxmenu/model.c b/grub-core/gfxmenu/model.c similarity index 100% rename from gfxmenu/model.c rename to grub-core/gfxmenu/model.c diff --git a/gfxmenu/named_colors.c b/grub-core/gfxmenu/named_colors.c similarity index 100% rename from gfxmenu/named_colors.c rename to grub-core/gfxmenu/named_colors.c diff --git a/gfxmenu/theme_loader.c b/grub-core/gfxmenu/theme_loader.c similarity index 100% rename from gfxmenu/theme_loader.c rename to grub-core/gfxmenu/theme_loader.c diff --git a/gfxmenu/view.c b/grub-core/gfxmenu/view.c similarity index 100% rename from gfxmenu/view.c rename to grub-core/gfxmenu/view.c diff --git a/gfxmenu/widget-box.c b/grub-core/gfxmenu/widget-box.c similarity index 100% rename from gfxmenu/widget-box.c rename to grub-core/gfxmenu/widget-box.c diff --git a/gnulib/alloca.h b/grub-core/gnulib/alloca.h similarity index 100% rename from gnulib/alloca.h rename to grub-core/gnulib/alloca.h diff --git a/gnulib/argp-ba.c b/grub-core/gnulib/argp-ba.c similarity index 100% rename from gnulib/argp-ba.c rename to grub-core/gnulib/argp-ba.c diff --git a/gnulib/argp-eexst.c b/grub-core/gnulib/argp-eexst.c similarity index 100% rename from gnulib/argp-eexst.c rename to grub-core/gnulib/argp-eexst.c diff --git a/gnulib/argp-fmtstream.c b/grub-core/gnulib/argp-fmtstream.c similarity index 100% rename from gnulib/argp-fmtstream.c rename to grub-core/gnulib/argp-fmtstream.c diff --git a/gnulib/argp-fmtstream.h b/grub-core/gnulib/argp-fmtstream.h similarity index 100% rename from gnulib/argp-fmtstream.h rename to grub-core/gnulib/argp-fmtstream.h diff --git a/gnulib/argp-fs-xinl.c b/grub-core/gnulib/argp-fs-xinl.c similarity index 100% rename from gnulib/argp-fs-xinl.c rename to grub-core/gnulib/argp-fs-xinl.c diff --git a/gnulib/argp-help.c b/grub-core/gnulib/argp-help.c similarity index 100% rename from gnulib/argp-help.c rename to grub-core/gnulib/argp-help.c diff --git a/gnulib/argp-namefrob.h b/grub-core/gnulib/argp-namefrob.h similarity index 100% rename from gnulib/argp-namefrob.h rename to grub-core/gnulib/argp-namefrob.h diff --git a/gnulib/argp-parse.c b/grub-core/gnulib/argp-parse.c similarity index 100% rename from gnulib/argp-parse.c rename to grub-core/gnulib/argp-parse.c diff --git a/gnulib/argp-pin.c b/grub-core/gnulib/argp-pin.c similarity index 100% rename from gnulib/argp-pin.c rename to grub-core/gnulib/argp-pin.c diff --git a/gnulib/argp-pv.c b/grub-core/gnulib/argp-pv.c similarity index 100% rename from gnulib/argp-pv.c rename to grub-core/gnulib/argp-pv.c diff --git a/gnulib/argp-pvh.c b/grub-core/gnulib/argp-pvh.c similarity index 100% rename from gnulib/argp-pvh.c rename to grub-core/gnulib/argp-pvh.c diff --git a/gnulib/argp-version-etc.c b/grub-core/gnulib/argp-version-etc.c similarity index 100% rename from gnulib/argp-version-etc.c rename to grub-core/gnulib/argp-version-etc.c diff --git a/gnulib/argp-version-etc.h b/grub-core/gnulib/argp-version-etc.h similarity index 100% rename from gnulib/argp-version-etc.h rename to grub-core/gnulib/argp-version-etc.h diff --git a/gnulib/argp-xinl.c b/grub-core/gnulib/argp-xinl.c similarity index 100% rename from gnulib/argp-xinl.c rename to grub-core/gnulib/argp-xinl.c diff --git a/gnulib/argp.h b/grub-core/gnulib/argp.h similarity index 100% rename from gnulib/argp.h rename to grub-core/gnulib/argp.h diff --git a/gnulib/error.c b/grub-core/gnulib/error.c similarity index 100% rename from gnulib/error.c rename to grub-core/gnulib/error.c diff --git a/gnulib/error.h b/grub-core/gnulib/error.h similarity index 100% rename from gnulib/error.h rename to grub-core/gnulib/error.h diff --git a/gnulib/fnmatch.c b/grub-core/gnulib/fnmatch.c similarity index 100% rename from gnulib/fnmatch.c rename to grub-core/gnulib/fnmatch.c diff --git a/gnulib/fnmatch.h b/grub-core/gnulib/fnmatch.h similarity index 100% rename from gnulib/fnmatch.h rename to grub-core/gnulib/fnmatch.h diff --git a/gnulib/fnmatch_loop.c b/grub-core/gnulib/fnmatch_loop.c similarity index 100% rename from gnulib/fnmatch_loop.c rename to grub-core/gnulib/fnmatch_loop.c diff --git a/gnulib/getdelim.c b/grub-core/gnulib/getdelim.c similarity index 100% rename from gnulib/getdelim.c rename to grub-core/gnulib/getdelim.c diff --git a/gnulib/getline.c b/grub-core/gnulib/getline.c similarity index 100% rename from gnulib/getline.c rename to grub-core/gnulib/getline.c diff --git a/gnulib/getopt.c b/grub-core/gnulib/getopt.c similarity index 100% rename from gnulib/getopt.c rename to grub-core/gnulib/getopt.c diff --git a/gnulib/getopt.h b/grub-core/gnulib/getopt.h similarity index 100% rename from gnulib/getopt.h rename to grub-core/gnulib/getopt.h diff --git a/gnulib/getopt1.c b/grub-core/gnulib/getopt1.c similarity index 100% rename from gnulib/getopt1.c rename to grub-core/gnulib/getopt1.c diff --git a/gnulib/getopt_int.h b/grub-core/gnulib/getopt_int.h similarity index 100% rename from gnulib/getopt_int.h rename to grub-core/gnulib/getopt_int.h diff --git a/gnulib/gettext.h b/grub-core/gnulib/gettext.h similarity index 100% rename from gnulib/gettext.h rename to grub-core/gnulib/gettext.h diff --git a/gnulib/progname.c b/grub-core/gnulib/progname.c similarity index 100% rename from gnulib/progname.c rename to grub-core/gnulib/progname.c diff --git a/gnulib/progname.h b/grub-core/gnulib/progname.h similarity index 100% rename from gnulib/progname.h rename to grub-core/gnulib/progname.h diff --git a/gnulib/regcomp.c b/grub-core/gnulib/regcomp.c similarity index 100% rename from gnulib/regcomp.c rename to grub-core/gnulib/regcomp.c diff --git a/gnulib/regex.c b/grub-core/gnulib/regex.c similarity index 100% rename from gnulib/regex.c rename to grub-core/gnulib/regex.c diff --git a/gnulib/regex.h b/grub-core/gnulib/regex.h similarity index 100% rename from gnulib/regex.h rename to grub-core/gnulib/regex.h diff --git a/gnulib/regex_internal.c b/grub-core/gnulib/regex_internal.c similarity index 100% rename from gnulib/regex_internal.c rename to grub-core/gnulib/regex_internal.c diff --git a/gnulib/regex_internal.h b/grub-core/gnulib/regex_internal.h similarity index 100% rename from gnulib/regex_internal.h rename to grub-core/gnulib/regex_internal.h diff --git a/gnulib/regexec.c b/grub-core/gnulib/regexec.c similarity index 100% rename from gnulib/regexec.c rename to grub-core/gnulib/regexec.c diff --git a/hello/hello.c b/grub-core/hello/hello.c similarity index 100% rename from hello/hello.c rename to grub-core/hello/hello.c diff --git a/hook/datehook.c b/grub-core/hook/datehook.c similarity index 100% rename from hook/datehook.c rename to grub-core/hook/datehook.c diff --git a/util/import_gcry.py b/grub-core/import_gcry.py similarity index 100% rename from util/import_gcry.py rename to grub-core/import_gcry.py diff --git a/include/grub/acorn_filecore.h b/grub-core/include/grub/acorn_filecore.h similarity index 100% rename from include/grub/acorn_filecore.h rename to grub-core/include/grub/acorn_filecore.h diff --git a/include/grub/acpi.h b/grub-core/include/grub/acpi.h similarity index 100% rename from include/grub/acpi.h rename to grub-core/include/grub/acpi.h diff --git a/include/grub/aout.h b/grub-core/include/grub/aout.h similarity index 100% rename from include/grub/aout.h rename to grub-core/include/grub/aout.h diff --git a/include/grub/at_keyboard.h b/grub-core/include/grub/at_keyboard.h similarity index 100% rename from include/grub/at_keyboard.h rename to grub-core/include/grub/at_keyboard.h diff --git a/include/grub/ata.h b/grub-core/include/grub/ata.h similarity index 100% rename from include/grub/ata.h rename to grub-core/include/grub/ata.h diff --git a/include/grub/auth.h b/grub-core/include/grub/auth.h similarity index 100% rename from include/grub/auth.h rename to grub-core/include/grub/auth.h diff --git a/include/grub/autoefi.h b/grub-core/include/grub/autoefi.h similarity index 100% rename from include/grub/autoefi.h rename to grub-core/include/grub/autoefi.h diff --git a/include/grub/bitmap.h b/grub-core/include/grub/bitmap.h similarity index 100% rename from include/grub/bitmap.h rename to grub-core/include/grub/bitmap.h diff --git a/include/grub/bitmap_scale.h b/grub-core/include/grub/bitmap_scale.h similarity index 100% rename from include/grub/bitmap_scale.h rename to grub-core/include/grub/bitmap_scale.h diff --git a/include/grub/boot.h b/grub-core/include/grub/boot.h similarity index 100% rename from include/grub/boot.h rename to grub-core/include/grub/boot.h diff --git a/include/grub/bsdlabel.h b/grub-core/include/grub/bsdlabel.h similarity index 100% rename from include/grub/bsdlabel.h rename to grub-core/include/grub/bsdlabel.h diff --git a/include/grub/bufio.h b/grub-core/include/grub/bufio.h similarity index 100% rename from include/grub/bufio.h rename to grub-core/include/grub/bufio.h diff --git a/include/grub/cache.h b/grub-core/include/grub/cache.h similarity index 100% rename from include/grub/cache.h rename to grub-core/include/grub/cache.h diff --git a/include/grub/charset.h b/grub-core/include/grub/charset.h similarity index 100% rename from include/grub/charset.h rename to grub-core/include/grub/charset.h diff --git a/include/grub/cmos.h b/grub-core/include/grub/cmos.h similarity index 100% rename from include/grub/cmos.h rename to grub-core/include/grub/cmos.h diff --git a/include/grub/command.h b/grub-core/include/grub/command.h similarity index 100% rename from include/grub/command.h rename to grub-core/include/grub/command.h diff --git a/include/grub/crypto.h b/grub-core/include/grub/crypto.h similarity index 100% rename from include/grub/crypto.h rename to grub-core/include/grub/crypto.h diff --git a/include/grub/datetime.h b/grub-core/include/grub/datetime.h similarity index 100% rename from include/grub/datetime.h rename to grub-core/include/grub/datetime.h diff --git a/include/grub/device.h b/grub-core/include/grub/device.h similarity index 100% rename from include/grub/device.h rename to grub-core/include/grub/device.h diff --git a/include/grub/disk.h b/grub-core/include/grub/disk.h similarity index 100% rename from include/grub/disk.h rename to grub-core/include/grub/disk.h diff --git a/include/grub/dl.h b/grub-core/include/grub/dl.h similarity index 90% rename from include/grub/dl.h rename to grub-core/include/grub/dl.h index cfb7c2f99..f98539a4e 100644 --- a/include/grub/dl.h +++ b/grub-core/include/grub/dl.h @@ -25,6 +25,13 @@ #include #include +/* + * Macros GRUB_MOD_INIT and GRUB_MOD_FINI are also used by build rules + * to collect module names, so we define them only when they are not + * defined already. + */ + +#ifndef GRUB_MOD_INIT #define GRUB_MOD_INIT(name) \ static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \ void grub_##name##_init (void); \ @@ -32,7 +39,9 @@ void \ grub_##name##_init (void) { grub_mod_init (0); } \ static void \ grub_mod_init (grub_dl_t mod __attribute__ ((unused))) +#endif +#ifndef GRUB_MOD_FINI #define GRUB_MOD_FINI(name) \ static void grub_mod_fini (void) __attribute__ ((used)); \ void grub_##name##_fini (void); \ @@ -40,6 +49,7 @@ void \ grub_##name##_fini (void) { grub_mod_fini (); } \ static void \ grub_mod_fini (void) +#endif #ifdef APPLE_CC #define GRUB_MOD_NAME(name) \ @@ -91,28 +101,8 @@ grub_dl_t grub_dl_load_core (void *addr, grub_size_t size); int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod); void grub_dl_unload_unneeded (void); void grub_dl_unload_all (void); -#if defined (GRUB_UTIL) || defined (GRUB_TARGET_NO_MODULES) -#define GRUB_NO_MODULES 1 -#else -#define GRUB_NO_MODULES 0 -#endif -#if GRUB_NO_MODULES -static inline int -grub_dl_ref (grub_dl_t mod) -{ - (void) mod; - return 0; -} -static inline int -grub_dl_unref (grub_dl_t mod) -{ - (void) mod; - return 0; -} -#else int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod); int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod); -#endif void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod)); grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name); grub_err_t grub_dl_register_symbol (const char *name, void *addr, @@ -121,7 +111,7 @@ grub_err_t grub_dl_register_symbol (const char *name, void *addr, grub_err_t grub_arch_dl_check_header (void *ehdr); grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr); -#if defined (_mips) && ! GRUB_NO_MODULES +#if defined (_mips) #define GRUB_LINKER_HAVE_INIT 1 void grub_arch_dl_init_linker (void); #endif diff --git a/include/grub/efi/api.h b/grub-core/include/grub/efi/api.h similarity index 100% rename from include/grub/efi/api.h rename to grub-core/include/grub/efi/api.h diff --git a/include/grub/efi/console.h b/grub-core/include/grub/efi/console.h similarity index 100% rename from include/grub/efi/console.h rename to grub-core/include/grub/efi/console.h diff --git a/include/grub/efi/console_control.h b/grub-core/include/grub/efi/console_control.h similarity index 100% rename from include/grub/efi/console_control.h rename to grub-core/include/grub/efi/console_control.h diff --git a/include/grub/efi/disk.h b/grub-core/include/grub/efi/disk.h similarity index 100% rename from include/grub/efi/disk.h rename to grub-core/include/grub/efi/disk.h diff --git a/include/grub/efi/efi.h b/grub-core/include/grub/efi/efi.h similarity index 100% rename from include/grub/efi/efi.h rename to grub-core/include/grub/efi/efi.h diff --git a/include/grub/efi/graphics_output.h b/grub-core/include/grub/efi/graphics_output.h similarity index 100% rename from include/grub/efi/graphics_output.h rename to grub-core/include/grub/efi/graphics_output.h diff --git a/include/grub/efi/memory.h b/grub-core/include/grub/efi/memory.h similarity index 100% rename from include/grub/efi/memory.h rename to grub-core/include/grub/efi/memory.h diff --git a/include/grub/efi/pe32.h b/grub-core/include/grub/efi/pe32.h similarity index 100% rename from include/grub/efi/pe32.h rename to grub-core/include/grub/efi/pe32.h diff --git a/include/grub/efi/time.h b/grub-core/include/grub/efi/time.h similarity index 100% rename from include/grub/efi/time.h rename to grub-core/include/grub/efi/time.h diff --git a/include/grub/efi/uga_draw.h b/grub-core/include/grub/efi/uga_draw.h similarity index 100% rename from include/grub/efi/uga_draw.h rename to grub-core/include/grub/efi/uga_draw.h diff --git a/include/grub/efiemu/efiemu.h b/grub-core/include/grub/efiemu/efiemu.h similarity index 100% rename from include/grub/efiemu/efiemu.h rename to grub-core/include/grub/efiemu/efiemu.h diff --git a/include/grub/efiemu/runtime.h b/grub-core/include/grub/efiemu/runtime.h similarity index 100% rename from include/grub/efiemu/runtime.h rename to grub-core/include/grub/efiemu/runtime.h diff --git a/include/grub/elf.h b/grub-core/include/grub/elf.h similarity index 100% rename from include/grub/elf.h rename to grub-core/include/grub/elf.h diff --git a/include/grub/elfload.h b/grub-core/include/grub/elfload.h similarity index 100% rename from include/grub/elfload.h rename to grub-core/include/grub/elfload.h diff --git a/include/grub/util/console.h b/grub-core/include/grub/emu/console.h similarity index 100% rename from include/grub/util/console.h rename to grub-core/include/grub/emu/console.h diff --git a/include/grub/util/getroot.h b/grub-core/include/grub/emu/getroot.h similarity index 94% rename from include/grub/util/getroot.h rename to grub-core/include/grub/emu/getroot.h index dff7b4df7..04a2805c8 100644 --- a/include/grub/util/getroot.h +++ b/grub-core/include/grub/emu/getroot.h @@ -28,6 +28,7 @@ enum grub_dev_abstraction_types { char *grub_guess_root_device (const char *dir); int grub_util_get_dev_abstraction (const char *os_dev); char *grub_util_get_grub_dev (const char *os_dev); +char *grub_make_system_path_relative_to_its_root (const char *path); const char *grub_util_check_block_device (const char *blk_dev); const char *grub_util_check_char_device (const char *blk_dev); diff --git a/include/grub/util/hostdisk.h b/grub-core/include/grub/emu/hostdisk.h similarity index 100% rename from include/grub/util/hostdisk.h rename to grub-core/include/grub/emu/hostdisk.h diff --git a/grub-core/include/grub/emu/misc.h b/grub-core/include/grub/emu/misc.h new file mode 100644 index 000000000..29c1d4a73 --- /dev/null +++ b/grub-core/include/grub/emu/misc.h @@ -0,0 +1,22 @@ +#ifndef GRUB_EMU_MISC_H +#define GRUB_EMU_MISC_H 1 + +#include +#include + +extern int verbosity; +extern const char *program_name; + +void grub_init_all (void); +void grub_fini_all (void); + +void * EXPORT_FUNC(xmalloc) (grub_size_t size); +void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size); +char * EXPORT_FUNC(xstrdup) (const char *str); +char * EXPORT_FUNC(xasprintf) (const char *fmt, ...); + +void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...); +void EXPORT_FUNC(grub_util_info) (const char *fmt, ...); +void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn)); + +#endif /* GRUB_EMU_MISC_H */ diff --git a/include/grub/env.h b/grub-core/include/grub/env.h similarity index 100% rename from include/grub/env.h rename to grub-core/include/grub/env.h diff --git a/include/grub/env_private.h b/grub-core/include/grub/env_private.h similarity index 100% rename from include/grub/env_private.h rename to grub-core/include/grub/env_private.h diff --git a/include/grub/err.h b/grub-core/include/grub/err.h similarity index 100% rename from include/grub/err.h rename to grub-core/include/grub/err.h diff --git a/include/grub/extcmd.h b/grub-core/include/grub/extcmd.h similarity index 100% rename from include/grub/extcmd.h rename to grub-core/include/grub/extcmd.h diff --git a/include/grub/fbblit.h b/grub-core/include/grub/fbblit.h similarity index 100% rename from include/grub/fbblit.h rename to grub-core/include/grub/fbblit.h diff --git a/include/grub/fbfill.h b/grub-core/include/grub/fbfill.h similarity index 100% rename from include/grub/fbfill.h rename to grub-core/include/grub/fbfill.h diff --git a/include/grub/fbutil.h b/grub-core/include/grub/fbutil.h similarity index 100% rename from include/grub/fbutil.h rename to grub-core/include/grub/fbutil.h diff --git a/include/grub/file.h b/grub-core/include/grub/file.h similarity index 100% rename from include/grub/file.h rename to grub-core/include/grub/file.h diff --git a/include/grub/font.h b/grub-core/include/grub/font.h similarity index 100% rename from include/grub/font.h rename to grub-core/include/grub/font.h diff --git a/include/grub/fontformat.h b/grub-core/include/grub/fontformat.h similarity index 100% rename from include/grub/fontformat.h rename to grub-core/include/grub/fontformat.h diff --git a/include/grub/fs.h b/grub-core/include/grub/fs.h similarity index 100% rename from include/grub/fs.h rename to grub-core/include/grub/fs.h diff --git a/include/grub/fshelp.h b/grub-core/include/grub/fshelp.h similarity index 100% rename from include/grub/fshelp.h rename to grub-core/include/grub/fshelp.h diff --git a/include/grub/gfxmenu_model.h b/grub-core/include/grub/gfxmenu_model.h similarity index 100% rename from include/grub/gfxmenu_model.h rename to grub-core/include/grub/gfxmenu_model.h diff --git a/include/grub/gfxmenu_view.h b/grub-core/include/grub/gfxmenu_view.h similarity index 100% rename from include/grub/gfxmenu_view.h rename to grub-core/include/grub/gfxmenu_view.h diff --git a/include/grub/gfxterm.h b/grub-core/include/grub/gfxterm.h similarity index 100% rename from include/grub/gfxterm.h rename to grub-core/include/grub/gfxterm.h diff --git a/include/grub/gfxwidgets.h b/grub-core/include/grub/gfxwidgets.h similarity index 100% rename from include/grub/gfxwidgets.h rename to grub-core/include/grub/gfxwidgets.h diff --git a/include/grub/gpt_partition.h b/grub-core/include/grub/gpt_partition.h similarity index 100% rename from include/grub/gpt_partition.h rename to grub-core/include/grub/gpt_partition.h diff --git a/include/grub/gui.h b/grub-core/include/grub/gui.h similarity index 100% rename from include/grub/gui.h rename to grub-core/include/grub/gui.h diff --git a/include/grub/gui_string_util.h b/grub-core/include/grub/gui_string_util.h similarity index 100% rename from include/grub/gui_string_util.h rename to grub-core/include/grub/gui_string_util.h diff --git a/include/grub/gzio.h b/grub-core/include/grub/gzio.h similarity index 100% rename from include/grub/gzio.h rename to grub-core/include/grub/gzio.h diff --git a/include/grub/handler.h b/grub-core/include/grub/handler.h similarity index 100% rename from include/grub/handler.h rename to grub-core/include/grub/handler.h diff --git a/include/grub/hfs.h b/grub-core/include/grub/hfs.h similarity index 100% rename from include/grub/hfs.h rename to grub-core/include/grub/hfs.h diff --git a/include/grub/i18n.h b/grub-core/include/grub/i18n.h similarity index 100% rename from include/grub/i18n.h rename to grub-core/include/grub/i18n.h diff --git a/include/grub/i386/at_keyboard.h b/grub-core/include/grub/i386/at_keyboard.h similarity index 100% rename from include/grub/i386/at_keyboard.h rename to grub-core/include/grub/i386/at_keyboard.h diff --git a/include/grub/i386/bsd.h b/grub-core/include/grub/i386/bsd.h similarity index 100% rename from include/grub/i386/bsd.h rename to grub-core/include/grub/i386/bsd.h diff --git a/include/grub/i386/cmos.h b/grub-core/include/grub/i386/cmos.h similarity index 100% rename from include/grub/i386/cmos.h rename to grub-core/include/grub/i386/cmos.h diff --git a/include/grub/i386/coreboot/boot.h b/grub-core/include/grub/i386/coreboot/boot.h similarity index 100% rename from include/grub/i386/coreboot/boot.h rename to grub-core/include/grub/i386/coreboot/boot.h diff --git a/include/grub/i386/coreboot/console.h b/grub-core/include/grub/i386/coreboot/console.h similarity index 100% rename from include/grub/i386/coreboot/console.h rename to grub-core/include/grub/i386/coreboot/console.h diff --git a/include/grub/i386/coreboot/init.h b/grub-core/include/grub/i386/coreboot/init.h similarity index 100% rename from include/grub/i386/coreboot/init.h rename to grub-core/include/grub/i386/coreboot/init.h diff --git a/include/grub/i386/coreboot/kernel.h b/grub-core/include/grub/i386/coreboot/kernel.h similarity index 100% rename from include/grub/i386/coreboot/kernel.h rename to grub-core/include/grub/i386/coreboot/kernel.h diff --git a/include/grub/i386/coreboot/loader.h b/grub-core/include/grub/i386/coreboot/loader.h similarity index 100% rename from include/grub/i386/coreboot/loader.h rename to grub-core/include/grub/i386/coreboot/loader.h diff --git a/include/grub/i386/coreboot/memory.h b/grub-core/include/grub/i386/coreboot/memory.h similarity index 100% rename from include/grub/i386/coreboot/memory.h rename to grub-core/include/grub/i386/coreboot/memory.h diff --git a/include/grub/i386/coreboot/serial.h b/grub-core/include/grub/i386/coreboot/serial.h similarity index 100% rename from include/grub/i386/coreboot/serial.h rename to grub-core/include/grub/i386/coreboot/serial.h diff --git a/include/grub/i386/coreboot/time.h b/grub-core/include/grub/i386/coreboot/time.h similarity index 100% rename from include/grub/i386/coreboot/time.h rename to grub-core/include/grub/i386/coreboot/time.h diff --git a/include/grub/i386/cpuid.h b/grub-core/include/grub/i386/cpuid.h similarity index 100% rename from include/grub/i386/cpuid.h rename to grub-core/include/grub/i386/cpuid.h diff --git a/include/grub/i386/efi/kernel.h b/grub-core/include/grub/i386/efi/kernel.h similarity index 100% rename from include/grub/i386/efi/kernel.h rename to grub-core/include/grub/i386/efi/kernel.h diff --git a/include/grub/i386/efi/loader.h b/grub-core/include/grub/i386/efi/loader.h similarity index 100% rename from include/grub/i386/efi/loader.h rename to grub-core/include/grub/i386/efi/loader.h diff --git a/include/grub/i386/efi/memory.h b/grub-core/include/grub/i386/efi/memory.h similarity index 100% rename from include/grub/i386/efi/memory.h rename to grub-core/include/grub/i386/efi/memory.h diff --git a/include/grub/i386/efi/serial.h b/grub-core/include/grub/i386/efi/serial.h similarity index 100% rename from include/grub/i386/efi/serial.h rename to grub-core/include/grub/i386/efi/serial.h diff --git a/include/grub/i386/efi/time.h b/grub-core/include/grub/i386/efi/time.h similarity index 100% rename from include/grub/i386/efi/time.h rename to grub-core/include/grub/i386/efi/time.h diff --git a/include/grub/i386/efiemu.h b/grub-core/include/grub/i386/efiemu.h similarity index 100% rename from include/grub/i386/efiemu.h rename to grub-core/include/grub/i386/efiemu.h diff --git a/include/grub/i386/freebsd_linker.h b/grub-core/include/grub/i386/freebsd_linker.h similarity index 100% rename from include/grub/i386/freebsd_linker.h rename to grub-core/include/grub/i386/freebsd_linker.h diff --git a/include/grub/i386/freebsd_reboot.h b/grub-core/include/grub/i386/freebsd_reboot.h similarity index 100% rename from include/grub/i386/freebsd_reboot.h rename to grub-core/include/grub/i386/freebsd_reboot.h diff --git a/include/grub/i386/ieee1275/console.h b/grub-core/include/grub/i386/ieee1275/console.h similarity index 100% rename from include/grub/i386/ieee1275/console.h rename to grub-core/include/grub/i386/ieee1275/console.h diff --git a/include/grub/i386/ieee1275/ieee1275.h b/grub-core/include/grub/i386/ieee1275/ieee1275.h similarity index 100% rename from include/grub/i386/ieee1275/ieee1275.h rename to grub-core/include/grub/i386/ieee1275/ieee1275.h diff --git a/include/grub/i386/ieee1275/kernel.h b/grub-core/include/grub/i386/ieee1275/kernel.h similarity index 100% rename from include/grub/i386/ieee1275/kernel.h rename to grub-core/include/grub/i386/ieee1275/kernel.h diff --git a/include/grub/i386/ieee1275/loader.h b/grub-core/include/grub/i386/ieee1275/loader.h similarity index 100% rename from include/grub/i386/ieee1275/loader.h rename to grub-core/include/grub/i386/ieee1275/loader.h diff --git a/include/grub/i386/ieee1275/memory.h b/grub-core/include/grub/i386/ieee1275/memory.h similarity index 100% rename from include/grub/i386/ieee1275/memory.h rename to grub-core/include/grub/i386/ieee1275/memory.h diff --git a/include/grub/i386/ieee1275/serial.h b/grub-core/include/grub/i386/ieee1275/serial.h similarity index 100% rename from include/grub/i386/ieee1275/serial.h rename to grub-core/include/grub/i386/ieee1275/serial.h diff --git a/include/grub/i386/ieee1275/time.h b/grub-core/include/grub/i386/ieee1275/time.h similarity index 100% rename from include/grub/i386/ieee1275/time.h rename to grub-core/include/grub/i386/ieee1275/time.h diff --git a/include/grub/i386/io.h b/grub-core/include/grub/i386/io.h similarity index 100% rename from include/grub/i386/io.h rename to grub-core/include/grub/i386/io.h diff --git a/include/grub/i386/kernel.h b/grub-core/include/grub/i386/kernel.h similarity index 100% rename from include/grub/i386/kernel.h rename to grub-core/include/grub/i386/kernel.h diff --git a/include/grub/i386/linux.h b/grub-core/include/grub/i386/linux.h similarity index 100% rename from include/grub/i386/linux.h rename to grub-core/include/grub/i386/linux.h diff --git a/include/grub/i386/loader.h b/grub-core/include/grub/i386/loader.h similarity index 100% rename from include/grub/i386/loader.h rename to grub-core/include/grub/i386/loader.h diff --git a/include/grub/i386/macho.h b/grub-core/include/grub/i386/macho.h similarity index 100% rename from include/grub/i386/macho.h rename to grub-core/include/grub/i386/macho.h diff --git a/include/grub/i386/memory.h b/grub-core/include/grub/i386/memory.h similarity index 100% rename from include/grub/i386/memory.h rename to grub-core/include/grub/i386/memory.h diff --git a/include/grub/i386/multiboot.h b/grub-core/include/grub/i386/multiboot.h similarity index 100% rename from include/grub/i386/multiboot.h rename to grub-core/include/grub/i386/multiboot.h diff --git a/include/grub/i386/multiboot/boot.h b/grub-core/include/grub/i386/multiboot/boot.h similarity index 100% rename from include/grub/i386/multiboot/boot.h rename to grub-core/include/grub/i386/multiboot/boot.h diff --git a/include/grub/i386/multiboot/console.h b/grub-core/include/grub/i386/multiboot/console.h similarity index 100% rename from include/grub/i386/multiboot/console.h rename to grub-core/include/grub/i386/multiboot/console.h diff --git a/include/grub/i386/multiboot/init.h b/grub-core/include/grub/i386/multiboot/init.h similarity index 100% rename from include/grub/i386/multiboot/init.h rename to grub-core/include/grub/i386/multiboot/init.h diff --git a/include/grub/i386/multiboot/kernel.h b/grub-core/include/grub/i386/multiboot/kernel.h similarity index 100% rename from include/grub/i386/multiboot/kernel.h rename to grub-core/include/grub/i386/multiboot/kernel.h diff --git a/include/grub/i386/multiboot/loader.h b/grub-core/include/grub/i386/multiboot/loader.h similarity index 100% rename from include/grub/i386/multiboot/loader.h rename to grub-core/include/grub/i386/multiboot/loader.h diff --git a/include/grub/i386/multiboot/memory.h b/grub-core/include/grub/i386/multiboot/memory.h similarity index 100% rename from include/grub/i386/multiboot/memory.h rename to grub-core/include/grub/i386/multiboot/memory.h diff --git a/include/grub/i386/multiboot/serial.h b/grub-core/include/grub/i386/multiboot/serial.h similarity index 100% rename from include/grub/i386/multiboot/serial.h rename to grub-core/include/grub/i386/multiboot/serial.h diff --git a/include/grub/i386/multiboot/time.h b/grub-core/include/grub/i386/multiboot/time.h similarity index 100% rename from include/grub/i386/multiboot/time.h rename to grub-core/include/grub/i386/multiboot/time.h diff --git a/include/grub/i386/netbsd_bootinfo.h b/grub-core/include/grub/i386/netbsd_bootinfo.h similarity index 100% rename from include/grub/i386/netbsd_bootinfo.h rename to grub-core/include/grub/i386/netbsd_bootinfo.h diff --git a/include/grub/i386/netbsd_reboot.h b/grub-core/include/grub/i386/netbsd_reboot.h similarity index 100% rename from include/grub/i386/netbsd_reboot.h rename to grub-core/include/grub/i386/netbsd_reboot.h diff --git a/include/grub/i386/openbsd_bootarg.h b/grub-core/include/grub/i386/openbsd_bootarg.h similarity index 100% rename from include/grub/i386/openbsd_bootarg.h rename to grub-core/include/grub/i386/openbsd_bootarg.h diff --git a/include/grub/i386/openbsd_reboot.h b/grub-core/include/grub/i386/openbsd_reboot.h similarity index 100% rename from include/grub/i386/openbsd_reboot.h rename to grub-core/include/grub/i386/openbsd_reboot.h diff --git a/include/grub/i386/pc/biosdisk.h b/grub-core/include/grub/i386/pc/biosdisk.h similarity index 100% rename from include/grub/i386/pc/biosdisk.h rename to grub-core/include/grub/i386/pc/biosdisk.h diff --git a/include/grub/i386/pc/biosnum.h b/grub-core/include/grub/i386/pc/biosnum.h similarity index 100% rename from include/grub/i386/pc/biosnum.h rename to grub-core/include/grub/i386/pc/biosnum.h diff --git a/include/grub/i386/pc/boot.h b/grub-core/include/grub/i386/pc/boot.h similarity index 100% rename from include/grub/i386/pc/boot.h rename to grub-core/include/grub/i386/pc/boot.h diff --git a/include/grub/i386/pc/chainloader.h b/grub-core/include/grub/i386/pc/chainloader.h similarity index 100% rename from include/grub/i386/pc/chainloader.h rename to grub-core/include/grub/i386/pc/chainloader.h diff --git a/include/grub/i386/pc/console.h b/grub-core/include/grub/i386/pc/console.h similarity index 100% rename from include/grub/i386/pc/console.h rename to grub-core/include/grub/i386/pc/console.h diff --git a/include/grub/i386/pc/efiemu.h b/grub-core/include/grub/i386/pc/efiemu.h similarity index 100% rename from include/grub/i386/pc/efiemu.h rename to grub-core/include/grub/i386/pc/efiemu.h diff --git a/include/grub/i386/pc/init.h b/grub-core/include/grub/i386/pc/init.h similarity index 100% rename from include/grub/i386/pc/init.h rename to grub-core/include/grub/i386/pc/init.h diff --git a/include/grub/i386/pc/kernel.h b/grub-core/include/grub/i386/pc/kernel.h similarity index 100% rename from include/grub/i386/pc/kernel.h rename to grub-core/include/grub/i386/pc/kernel.h diff --git a/include/grub/i386/pc/loader.h b/grub-core/include/grub/i386/pc/loader.h similarity index 100% rename from include/grub/i386/pc/loader.h rename to grub-core/include/grub/i386/pc/loader.h diff --git a/include/grub/i386/pc/memory.h b/grub-core/include/grub/i386/pc/memory.h similarity index 100% rename from include/grub/i386/pc/memory.h rename to grub-core/include/grub/i386/pc/memory.h diff --git a/include/grub/i386/pc/pxe.h b/grub-core/include/grub/i386/pc/pxe.h similarity index 100% rename from include/grub/i386/pc/pxe.h rename to grub-core/include/grub/i386/pc/pxe.h diff --git a/include/grub/i386/pc/time.h b/grub-core/include/grub/i386/pc/time.h similarity index 100% rename from include/grub/i386/pc/time.h rename to grub-core/include/grub/i386/pc/time.h diff --git a/include/grub/i386/pc/vbe.h b/grub-core/include/grub/i386/pc/vbe.h similarity index 100% rename from include/grub/i386/pc/vbe.h rename to grub-core/include/grub/i386/pc/vbe.h diff --git a/include/grub/i386/pc/vga.h b/grub-core/include/grub/i386/pc/vga.h similarity index 100% rename from include/grub/i386/pc/vga.h rename to grub-core/include/grub/i386/pc/vga.h diff --git a/include/grub/i386/pci.h b/grub-core/include/grub/i386/pci.h similarity index 100% rename from include/grub/i386/pci.h rename to grub-core/include/grub/i386/pci.h diff --git a/include/grub/i386/pit.h b/grub-core/include/grub/i386/pit.h similarity index 100% rename from include/grub/i386/pit.h rename to grub-core/include/grub/i386/pit.h diff --git a/include/grub/i386/qemu/boot.h b/grub-core/include/grub/i386/qemu/boot.h similarity index 100% rename from include/grub/i386/qemu/boot.h rename to grub-core/include/grub/i386/qemu/boot.h diff --git a/include/grub/i386/qemu/console.h b/grub-core/include/grub/i386/qemu/console.h similarity index 100% rename from include/grub/i386/qemu/console.h rename to grub-core/include/grub/i386/qemu/console.h diff --git a/include/grub/i386/qemu/init.h b/grub-core/include/grub/i386/qemu/init.h similarity index 100% rename from include/grub/i386/qemu/init.h rename to grub-core/include/grub/i386/qemu/init.h diff --git a/include/grub/i386/qemu/kernel.h b/grub-core/include/grub/i386/qemu/kernel.h similarity index 100% rename from include/grub/i386/qemu/kernel.h rename to grub-core/include/grub/i386/qemu/kernel.h diff --git a/include/grub/i386/qemu/loader.h b/grub-core/include/grub/i386/qemu/loader.h similarity index 100% rename from include/grub/i386/qemu/loader.h rename to grub-core/include/grub/i386/qemu/loader.h diff --git a/include/grub/i386/qemu/memory.h b/grub-core/include/grub/i386/qemu/memory.h similarity index 100% rename from include/grub/i386/qemu/memory.h rename to grub-core/include/grub/i386/qemu/memory.h diff --git a/include/grub/i386/qemu/serial.h b/grub-core/include/grub/i386/qemu/serial.h similarity index 100% rename from include/grub/i386/qemu/serial.h rename to grub-core/include/grub/i386/qemu/serial.h diff --git a/include/grub/i386/qemu/time.h b/grub-core/include/grub/i386/qemu/time.h similarity index 100% rename from include/grub/i386/qemu/time.h rename to grub-core/include/grub/i386/qemu/time.h diff --git a/include/grub/i386/relocator.h b/grub-core/include/grub/i386/relocator.h similarity index 100% rename from include/grub/i386/relocator.h rename to grub-core/include/grub/i386/relocator.h diff --git a/include/grub/i386/setjmp.h b/grub-core/include/grub/i386/setjmp.h similarity index 100% rename from include/grub/i386/setjmp.h rename to grub-core/include/grub/i386/setjmp.h diff --git a/include/grub/i386/time.h b/grub-core/include/grub/i386/time.h similarity index 100% rename from include/grub/i386/time.h rename to grub-core/include/grub/i386/time.h diff --git a/include/grub/i386/tsc.h b/grub-core/include/grub/i386/tsc.h similarity index 100% rename from include/grub/i386/tsc.h rename to grub-core/include/grub/i386/tsc.h diff --git a/include/grub/i386/types.h b/grub-core/include/grub/i386/types.h similarity index 100% rename from include/grub/i386/types.h rename to grub-core/include/grub/i386/types.h diff --git a/include/grub/i386/vga_common.h b/grub-core/include/grub/i386/vga_common.h similarity index 100% rename from include/grub/i386/vga_common.h rename to grub-core/include/grub/i386/vga_common.h diff --git a/include/grub/i386/xnu.h b/grub-core/include/grub/i386/xnu.h similarity index 100% rename from include/grub/i386/xnu.h rename to grub-core/include/grub/i386/xnu.h diff --git a/include/grub/icon_manager.h b/grub-core/include/grub/icon_manager.h similarity index 100% rename from include/grub/icon_manager.h rename to grub-core/include/grub/icon_manager.h diff --git a/include/grub/ieee1275/ieee1275.h b/grub-core/include/grub/ieee1275/ieee1275.h similarity index 100% rename from include/grub/ieee1275/ieee1275.h rename to grub-core/include/grub/ieee1275/ieee1275.h diff --git a/include/grub/ieee1275/ofdisk.h b/grub-core/include/grub/ieee1275/ofdisk.h similarity index 100% rename from include/grub/ieee1275/ofdisk.h rename to grub-core/include/grub/ieee1275/ofdisk.h diff --git a/include/grub/kernel.h b/grub-core/include/grub/kernel.h similarity index 100% rename from include/grub/kernel.h rename to grub-core/include/grub/kernel.h diff --git a/include/grub/lib/LzFind.h b/grub-core/include/grub/lib/LzFind.h similarity index 100% rename from include/grub/lib/LzFind.h rename to grub-core/include/grub/lib/LzFind.h diff --git a/include/grub/lib/LzHash.h b/grub-core/include/grub/lib/LzHash.h similarity index 100% rename from include/grub/lib/LzHash.h rename to grub-core/include/grub/lib/LzHash.h diff --git a/include/grub/lib/LzmaDec.h b/grub-core/include/grub/lib/LzmaDec.h similarity index 100% rename from include/grub/lib/LzmaDec.h rename to grub-core/include/grub/lib/LzmaDec.h diff --git a/include/grub/lib/LzmaEnc.h b/grub-core/include/grub/lib/LzmaEnc.h similarity index 100% rename from include/grub/lib/LzmaEnc.h rename to grub-core/include/grub/lib/LzmaEnc.h diff --git a/include/grub/lib/LzmaTypes.h b/grub-core/include/grub/lib/LzmaTypes.h similarity index 100% rename from include/grub/lib/LzmaTypes.h rename to grub-core/include/grub/lib/LzmaTypes.h diff --git a/include/grub/lib/arg.h b/grub-core/include/grub/lib/arg.h similarity index 100% rename from include/grub/lib/arg.h rename to grub-core/include/grub/lib/arg.h diff --git a/include/grub/lib/crc.h b/grub-core/include/grub/lib/crc.h similarity index 100% rename from include/grub/lib/crc.h rename to grub-core/include/grub/lib/crc.h diff --git a/include/grub/lib/envblk.h b/grub-core/include/grub/lib/envblk.h similarity index 100% rename from include/grub/lib/envblk.h rename to grub-core/include/grub/lib/envblk.h diff --git a/include/grub/lib/hexdump.h b/grub-core/include/grub/lib/hexdump.h similarity index 100% rename from include/grub/lib/hexdump.h rename to grub-core/include/grub/lib/hexdump.h diff --git a/include/grub/libgcc.h b/grub-core/include/grub/libgcc.h similarity index 100% rename from include/grub/libgcc.h rename to grub-core/include/grub/libgcc.h diff --git a/include/grub/libpciaccess.h b/grub-core/include/grub/libpciaccess.h similarity index 100% rename from include/grub/libpciaccess.h rename to grub-core/include/grub/libpciaccess.h diff --git a/include/grub/libusb.h b/grub-core/include/grub/libusb.h similarity index 100% rename from include/grub/libusb.h rename to grub-core/include/grub/libusb.h diff --git a/include/grub/list.h b/grub-core/include/grub/list.h similarity index 100% rename from include/grub/list.h rename to grub-core/include/grub/list.h diff --git a/include/grub/loader.h b/grub-core/include/grub/loader.h similarity index 100% rename from include/grub/loader.h rename to grub-core/include/grub/loader.h diff --git a/include/grub/lvm.h b/grub-core/include/grub/lvm.h similarity index 100% rename from include/grub/lvm.h rename to grub-core/include/grub/lvm.h diff --git a/include/grub/macho.h b/grub-core/include/grub/macho.h similarity index 100% rename from include/grub/macho.h rename to grub-core/include/grub/macho.h diff --git a/include/grub/machoload.h b/grub-core/include/grub/machoload.h similarity index 100% rename from include/grub/machoload.h rename to grub-core/include/grub/machoload.h diff --git a/include/grub/memory.h b/grub-core/include/grub/memory.h similarity index 100% rename from include/grub/memory.h rename to grub-core/include/grub/memory.h diff --git a/include/grub/menu.h b/grub-core/include/grub/menu.h similarity index 100% rename from include/grub/menu.h rename to grub-core/include/grub/menu.h diff --git a/include/grub/menu_viewer.h b/grub-core/include/grub/menu_viewer.h similarity index 100% rename from include/grub/menu_viewer.h rename to grub-core/include/grub/menu_viewer.h diff --git a/include/grub/mips/at_keyboard.h b/grub-core/include/grub/mips/at_keyboard.h similarity index 100% rename from include/grub/mips/at_keyboard.h rename to grub-core/include/grub/mips/at_keyboard.h diff --git a/include/grub/mips/cache.h b/grub-core/include/grub/mips/cache.h similarity index 100% rename from include/grub/mips/cache.h rename to grub-core/include/grub/mips/cache.h diff --git a/include/grub/mips/cmos.h b/grub-core/include/grub/mips/cmos.h similarity index 100% rename from include/grub/mips/cmos.h rename to grub-core/include/grub/mips/cmos.h diff --git a/include/grub/mips/io.h b/grub-core/include/grub/mips/io.h similarity index 100% rename from include/grub/mips/io.h rename to grub-core/include/grub/mips/io.h diff --git a/include/grub/mips/kernel.h b/grub-core/include/grub/mips/kernel.h similarity index 100% rename from include/grub/mips/kernel.h rename to grub-core/include/grub/mips/kernel.h diff --git a/include/grub/mips/multiboot.h b/grub-core/include/grub/mips/multiboot.h similarity index 100% rename from include/grub/mips/multiboot.h rename to grub-core/include/grub/mips/multiboot.h diff --git a/include/grub/mips/pci.h b/grub-core/include/grub/mips/pci.h similarity index 100% rename from include/grub/mips/pci.h rename to grub-core/include/grub/mips/pci.h diff --git a/include/grub/mips/qemu-mips/boot.h b/grub-core/include/grub/mips/qemu-mips/boot.h similarity index 100% rename from include/grub/mips/qemu-mips/boot.h rename to grub-core/include/grub/mips/qemu-mips/boot.h diff --git a/include/grub/mips/qemu-mips/kernel.h b/grub-core/include/grub/mips/qemu-mips/kernel.h similarity index 100% rename from include/grub/mips/qemu-mips/kernel.h rename to grub-core/include/grub/mips/qemu-mips/kernel.h diff --git a/include/grub/mips/qemu-mips/loader.h b/grub-core/include/grub/mips/qemu-mips/loader.h similarity index 100% rename from include/grub/mips/qemu-mips/loader.h rename to grub-core/include/grub/mips/qemu-mips/loader.h diff --git a/include/grub/mips/qemu-mips/memory.h b/grub-core/include/grub/mips/qemu-mips/memory.h similarity index 100% rename from include/grub/mips/qemu-mips/memory.h rename to grub-core/include/grub/mips/qemu-mips/memory.h diff --git a/include/grub/mips/qemu-mips/serial.h b/grub-core/include/grub/mips/qemu-mips/serial.h similarity index 100% rename from include/grub/mips/qemu-mips/serial.h rename to grub-core/include/grub/mips/qemu-mips/serial.h diff --git a/include/grub/mips/qemu-mips/time.h b/grub-core/include/grub/mips/qemu-mips/time.h similarity index 100% rename from include/grub/mips/qemu-mips/time.h rename to grub-core/include/grub/mips/qemu-mips/time.h diff --git a/include/grub/mips/relocator.h b/grub-core/include/grub/mips/relocator.h similarity index 100% rename from include/grub/mips/relocator.h rename to grub-core/include/grub/mips/relocator.h diff --git a/include/grub/mips/setjmp.h b/grub-core/include/grub/mips/setjmp.h similarity index 100% rename from include/grub/mips/setjmp.h rename to grub-core/include/grub/mips/setjmp.h diff --git a/include/grub/mips/time.h b/grub-core/include/grub/mips/time.h similarity index 100% rename from include/grub/mips/time.h rename to grub-core/include/grub/mips/time.h diff --git a/include/grub/mips/types.h b/grub-core/include/grub/mips/types.h similarity index 100% rename from include/grub/mips/types.h rename to grub-core/include/grub/mips/types.h diff --git a/include/grub/mips/yeeloong/at_keyboard.h b/grub-core/include/grub/mips/yeeloong/at_keyboard.h similarity index 100% rename from include/grub/mips/yeeloong/at_keyboard.h rename to grub-core/include/grub/mips/yeeloong/at_keyboard.h diff --git a/include/grub/mips/yeeloong/boot.h b/grub-core/include/grub/mips/yeeloong/boot.h similarity index 100% rename from include/grub/mips/yeeloong/boot.h rename to grub-core/include/grub/mips/yeeloong/boot.h diff --git a/include/grub/mips/yeeloong/cmos.h b/grub-core/include/grub/mips/yeeloong/cmos.h similarity index 100% rename from include/grub/mips/yeeloong/cmos.h rename to grub-core/include/grub/mips/yeeloong/cmos.h diff --git a/include/grub/mips/yeeloong/kernel.h b/grub-core/include/grub/mips/yeeloong/kernel.h similarity index 100% rename from include/grub/mips/yeeloong/kernel.h rename to grub-core/include/grub/mips/yeeloong/kernel.h diff --git a/include/grub/mips/yeeloong/loader.h b/grub-core/include/grub/mips/yeeloong/loader.h similarity index 100% rename from include/grub/mips/yeeloong/loader.h rename to grub-core/include/grub/mips/yeeloong/loader.h diff --git a/include/grub/mips/yeeloong/memory.h b/grub-core/include/grub/mips/yeeloong/memory.h similarity index 100% rename from include/grub/mips/yeeloong/memory.h rename to grub-core/include/grub/mips/yeeloong/memory.h diff --git a/include/grub/mips/yeeloong/pci.h b/grub-core/include/grub/mips/yeeloong/pci.h similarity index 100% rename from include/grub/mips/yeeloong/pci.h rename to grub-core/include/grub/mips/yeeloong/pci.h diff --git a/include/grub/mips/yeeloong/serial.h b/grub-core/include/grub/mips/yeeloong/serial.h similarity index 100% rename from include/grub/mips/yeeloong/serial.h rename to grub-core/include/grub/mips/yeeloong/serial.h diff --git a/include/grub/mips/yeeloong/time.h b/grub-core/include/grub/mips/yeeloong/time.h similarity index 100% rename from include/grub/mips/yeeloong/time.h rename to grub-core/include/grub/mips/yeeloong/time.h diff --git a/include/grub/misc.h b/grub-core/include/grub/misc.h similarity index 100% rename from include/grub/misc.h rename to grub-core/include/grub/misc.h diff --git a/include/grub/mm.h b/grub-core/include/grub/mm.h similarity index 100% rename from include/grub/mm.h rename to grub-core/include/grub/mm.h diff --git a/include/grub/msdos_partition.h b/grub-core/include/grub/msdos_partition.h similarity index 100% rename from include/grub/msdos_partition.h rename to grub-core/include/grub/msdos_partition.h diff --git a/include/grub/multiboot.h b/grub-core/include/grub/multiboot.h similarity index 100% rename from include/grub/multiboot.h rename to grub-core/include/grub/multiboot.h diff --git a/include/grub/multiboot_loader.h b/grub-core/include/grub/multiboot_loader.h similarity index 100% rename from include/grub/multiboot_loader.h rename to grub-core/include/grub/multiboot_loader.h diff --git a/include/grub/net.h b/grub-core/include/grub/net.h similarity index 100% rename from include/grub/net.h rename to grub-core/include/grub/net.h diff --git a/include/grub/normal.h b/grub-core/include/grub/normal.h similarity index 100% rename from include/grub/normal.h rename to grub-core/include/grub/normal.h diff --git a/include/grub/ntfs.h b/grub-core/include/grub/ntfs.h similarity index 100% rename from include/grub/ntfs.h rename to grub-core/include/grub/ntfs.h diff --git a/include/grub/parser.h b/grub-core/include/grub/parser.h similarity index 100% rename from include/grub/parser.h rename to grub-core/include/grub/parser.h diff --git a/include/grub/partition.h b/grub-core/include/grub/partition.h similarity index 100% rename from include/grub/partition.h rename to grub-core/include/grub/partition.h diff --git a/include/grub/parttool.h b/grub-core/include/grub/parttool.h similarity index 100% rename from include/grub/parttool.h rename to grub-core/include/grub/parttool.h diff --git a/include/grub/pci.h b/grub-core/include/grub/pci.h similarity index 100% rename from include/grub/pci.h rename to grub-core/include/grub/pci.h diff --git a/include/grub/pciutils.h b/grub-core/include/grub/pciutils.h similarity index 100% rename from include/grub/pciutils.h rename to grub-core/include/grub/pciutils.h diff --git a/include/grub/powerpc/ieee1275/biosdisk.h b/grub-core/include/grub/powerpc/ieee1275/biosdisk.h similarity index 100% rename from include/grub/powerpc/ieee1275/biosdisk.h rename to grub-core/include/grub/powerpc/ieee1275/biosdisk.h diff --git a/include/grub/powerpc/ieee1275/console.h b/grub-core/include/grub/powerpc/ieee1275/console.h similarity index 100% rename from include/grub/powerpc/ieee1275/console.h rename to grub-core/include/grub/powerpc/ieee1275/console.h diff --git a/include/grub/powerpc/ieee1275/ieee1275.h b/grub-core/include/grub/powerpc/ieee1275/ieee1275.h similarity index 100% rename from include/grub/powerpc/ieee1275/ieee1275.h rename to grub-core/include/grub/powerpc/ieee1275/ieee1275.h diff --git a/include/grub/powerpc/ieee1275/kernel.h b/grub-core/include/grub/powerpc/ieee1275/kernel.h similarity index 100% rename from include/grub/powerpc/ieee1275/kernel.h rename to grub-core/include/grub/powerpc/ieee1275/kernel.h diff --git a/include/grub/powerpc/ieee1275/loader.h b/grub-core/include/grub/powerpc/ieee1275/loader.h similarity index 100% rename from include/grub/powerpc/ieee1275/loader.h rename to grub-core/include/grub/powerpc/ieee1275/loader.h diff --git a/include/grub/powerpc/ieee1275/memory.h b/grub-core/include/grub/powerpc/ieee1275/memory.h similarity index 100% rename from include/grub/powerpc/ieee1275/memory.h rename to grub-core/include/grub/powerpc/ieee1275/memory.h diff --git a/include/grub/powerpc/ieee1275/time.h b/grub-core/include/grub/powerpc/ieee1275/time.h similarity index 100% rename from include/grub/powerpc/ieee1275/time.h rename to grub-core/include/grub/powerpc/ieee1275/time.h diff --git a/include/grub/powerpc/ieee1275/util/biosdisk.h b/grub-core/include/grub/powerpc/ieee1275/util/biosdisk.h similarity index 100% rename from include/grub/powerpc/ieee1275/util/biosdisk.h rename to grub-core/include/grub/powerpc/ieee1275/util/biosdisk.h diff --git a/include/grub/powerpc/kernel.h b/grub-core/include/grub/powerpc/kernel.h similarity index 100% rename from include/grub/powerpc/kernel.h rename to grub-core/include/grub/powerpc/kernel.h diff --git a/include/grub/powerpc/setjmp.h b/grub-core/include/grub/powerpc/setjmp.h similarity index 100% rename from include/grub/powerpc/setjmp.h rename to grub-core/include/grub/powerpc/setjmp.h diff --git a/include/grub/powerpc/time.h b/grub-core/include/grub/powerpc/time.h similarity index 100% rename from include/grub/powerpc/time.h rename to grub-core/include/grub/powerpc/time.h diff --git a/include/grub/powerpc/types.h b/grub-core/include/grub/powerpc/types.h similarity index 100% rename from include/grub/powerpc/types.h rename to grub-core/include/grub/powerpc/types.h diff --git a/include/grub/raid.h b/grub-core/include/grub/raid.h similarity index 100% rename from include/grub/raid.h rename to grub-core/include/grub/raid.h diff --git a/include/grub/reader.h b/grub-core/include/grub/reader.h similarity index 100% rename from include/grub/reader.h rename to grub-core/include/grub/reader.h diff --git a/include/grub/script_sh.h b/grub-core/include/grub/script_sh.h similarity index 100% rename from include/grub/script_sh.h rename to grub-core/include/grub/script_sh.h diff --git a/include/grub/scsi.h b/grub-core/include/grub/scsi.h similarity index 100% rename from include/grub/scsi.h rename to grub-core/include/grub/scsi.h diff --git a/include/grub/scsicmd.h b/grub-core/include/grub/scsicmd.h similarity index 100% rename from include/grub/scsicmd.h rename to grub-core/include/grub/scsicmd.h diff --git a/include/grub/sdl.h b/grub-core/include/grub/sdl.h similarity index 100% rename from include/grub/sdl.h rename to grub-core/include/grub/sdl.h diff --git a/include/grub/search.h b/grub-core/include/grub/search.h similarity index 100% rename from include/grub/search.h rename to grub-core/include/grub/search.h diff --git a/include/grub/serial.h b/grub-core/include/grub/serial.h similarity index 100% rename from include/grub/serial.h rename to grub-core/include/grub/serial.h diff --git a/include/grub/setjmp.h b/grub-core/include/grub/setjmp.h similarity index 100% rename from include/grub/setjmp.h rename to grub-core/include/grub/setjmp.h diff --git a/include/grub/sparc64/ieee1275/boot.h b/grub-core/include/grub/sparc64/ieee1275/boot.h similarity index 100% rename from include/grub/sparc64/ieee1275/boot.h rename to grub-core/include/grub/sparc64/ieee1275/boot.h diff --git a/include/grub/sparc64/ieee1275/console.h b/grub-core/include/grub/sparc64/ieee1275/console.h similarity index 100% rename from include/grub/sparc64/ieee1275/console.h rename to grub-core/include/grub/sparc64/ieee1275/console.h diff --git a/include/grub/sparc64/ieee1275/ieee1275.h b/grub-core/include/grub/sparc64/ieee1275/ieee1275.h similarity index 100% rename from include/grub/sparc64/ieee1275/ieee1275.h rename to grub-core/include/grub/sparc64/ieee1275/ieee1275.h diff --git a/include/grub/sparc64/ieee1275/kernel.h b/grub-core/include/grub/sparc64/ieee1275/kernel.h similarity index 100% rename from include/grub/sparc64/ieee1275/kernel.h rename to grub-core/include/grub/sparc64/ieee1275/kernel.h diff --git a/include/grub/sparc64/ieee1275/loader.h b/grub-core/include/grub/sparc64/ieee1275/loader.h similarity index 100% rename from include/grub/sparc64/ieee1275/loader.h rename to grub-core/include/grub/sparc64/ieee1275/loader.h diff --git a/include/grub/sparc64/ieee1275/memory.h b/grub-core/include/grub/sparc64/ieee1275/memory.h similarity index 100% rename from include/grub/sparc64/ieee1275/memory.h rename to grub-core/include/grub/sparc64/ieee1275/memory.h diff --git a/include/grub/sparc64/ieee1275/time.h b/grub-core/include/grub/sparc64/ieee1275/time.h similarity index 100% rename from include/grub/sparc64/ieee1275/time.h rename to grub-core/include/grub/sparc64/ieee1275/time.h diff --git a/include/grub/sparc64/kernel.h b/grub-core/include/grub/sparc64/kernel.h similarity index 100% rename from include/grub/sparc64/kernel.h rename to grub-core/include/grub/sparc64/kernel.h diff --git a/include/grub/sparc64/setjmp.h b/grub-core/include/grub/sparc64/setjmp.h similarity index 100% rename from include/grub/sparc64/setjmp.h rename to grub-core/include/grub/sparc64/setjmp.h diff --git a/include/grub/sparc64/time.h b/grub-core/include/grub/sparc64/time.h similarity index 100% rename from include/grub/sparc64/time.h rename to grub-core/include/grub/sparc64/time.h diff --git a/include/grub/sparc64/types.h b/grub-core/include/grub/sparc64/types.h similarity index 100% rename from include/grub/sparc64/types.h rename to grub-core/include/grub/sparc64/types.h diff --git a/include/grub/symbol.h b/grub-core/include/grub/symbol.h similarity index 100% rename from include/grub/symbol.h rename to grub-core/include/grub/symbol.h diff --git a/include/grub/term.h b/grub-core/include/grub/term.h similarity index 100% rename from include/grub/term.h rename to grub-core/include/grub/term.h diff --git a/include/grub/terminfo.h b/grub-core/include/grub/terminfo.h similarity index 100% rename from include/grub/terminfo.h rename to grub-core/include/grub/terminfo.h diff --git a/include/grub/test.h b/grub-core/include/grub/test.h similarity index 93% rename from include/grub/test.h rename to grub-core/include/grub/test.h index 27591cca2..336d3b672 100644 --- a/include/grub/test.h +++ b/grub-core/include/grub/test.h @@ -72,14 +72,14 @@ void grub_test_nonzero (int cond, const char *file, /* Macro to define a functional test. */ #define GRUB_FUNCTIONAL_TEST(name, funp) \ - GRUB_MOD_INIT(functional_test_##funp) \ + GRUB_MOD_INIT(name) \ { \ - grub_test_register (name, funp); \ + grub_test_register (#name, funp); \ } \ \ - GRUB_MOD_FINI(functional_test_##funp) \ + GRUB_MOD_FINI(name) \ { \ - grub_test_unregister (name); \ + grub_test_unregister (#name); \ } #endif /* ! GRUB_TEST_HEADER */ diff --git a/include/grub/time.h b/grub-core/include/grub/time.h similarity index 100% rename from include/grub/time.h rename to grub-core/include/grub/time.h diff --git a/include/grub/tparm.h b/grub-core/include/grub/tparm.h similarity index 100% rename from include/grub/tparm.h rename to grub-core/include/grub/tparm.h diff --git a/include/grub/trig.h b/grub-core/include/grub/trig.h similarity index 100% rename from include/grub/trig.h rename to grub-core/include/grub/trig.h diff --git a/include/grub/types.h b/grub-core/include/grub/types.h similarity index 100% rename from include/grub/types.h rename to grub-core/include/grub/types.h diff --git a/include/grub/usb.h b/grub-core/include/grub/usb.h similarity index 100% rename from include/grub/usb.h rename to grub-core/include/grub/usb.h diff --git a/include/grub/usbdesc.h b/grub-core/include/grub/usbdesc.h similarity index 100% rename from include/grub/usbdesc.h rename to grub-core/include/grub/usbdesc.h diff --git a/include/grub/usbtrans.h b/grub-core/include/grub/usbtrans.h similarity index 100% rename from include/grub/usbtrans.h rename to grub-core/include/grub/usbtrans.h diff --git a/include/grub/util/deviceiter.h b/grub-core/include/grub/util/deviceiter.h similarity index 100% rename from include/grub/util/deviceiter.h rename to grub-core/include/grub/util/deviceiter.h diff --git a/include/grub/util/lvm.h b/grub-core/include/grub/util/lvm.h similarity index 100% rename from include/grub/util/lvm.h rename to grub-core/include/grub/util/lvm.h diff --git a/include/grub/util/misc.h b/grub-core/include/grub/util/misc.h similarity index 85% rename from include/grub/util/misc.h rename to grub-core/include/grub/util/misc.h index 8b78b92ea..ed71acdcd 100644 --- a/include/grub/util/misc.h +++ b/grub-core/include/grub/util/misc.h @@ -38,17 +38,6 @@ #define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map" -extern char *progname; -extern int verbosity; - -void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...); -void EXPORT_FUNC(grub_util_info) (const char *fmt, ...); -void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn)); - -void *xmalloc (size_t size); -void *xrealloc (void *ptr, size_t size); -char *xstrdup (const char *str); - char *grub_util_get_path (const char *dir, const char *file); size_t grub_util_get_fp_size (FILE *fp); size_t grub_util_get_image_size (const char *path); @@ -71,8 +60,6 @@ int asprintf (char **buf, const char *fmt, ...); #endif -char *xasprintf (const char *fmt, ...); - #ifdef __MINGW32__ #define fseeko fseeko64 diff --git a/include/grub/util/ofpath.h b/grub-core/include/grub/util/ofpath.h similarity index 100% rename from include/grub/util/ofpath.h rename to grub-core/include/grub/util/ofpath.h diff --git a/include/grub/util/raid.h b/grub-core/include/grub/util/raid.h similarity index 100% rename from include/grub/util/raid.h rename to grub-core/include/grub/util/raid.h diff --git a/include/grub/util/resolve.h b/grub-core/include/grub/util/resolve.h similarity index 100% rename from include/grub/util/resolve.h rename to grub-core/include/grub/util/resolve.h diff --git a/include/grub/video.h b/grub-core/include/grub/video.h similarity index 100% rename from include/grub/video.h rename to grub-core/include/grub/video.h diff --git a/include/grub/video_fb.h b/grub-core/include/grub/video_fb.h similarity index 100% rename from include/grub/video_fb.h rename to grub-core/include/grub/video_fb.h diff --git a/include/grub/x86_64/at_keyboard.h b/grub-core/include/grub/x86_64/at_keyboard.h similarity index 100% rename from include/grub/x86_64/at_keyboard.h rename to grub-core/include/grub/x86_64/at_keyboard.h diff --git a/include/grub/x86_64/efi/kernel.h b/grub-core/include/grub/x86_64/efi/kernel.h similarity index 100% rename from include/grub/x86_64/efi/kernel.h rename to grub-core/include/grub/x86_64/efi/kernel.h diff --git a/include/grub/x86_64/efi/loader.h b/grub-core/include/grub/x86_64/efi/loader.h similarity index 100% rename from include/grub/x86_64/efi/loader.h rename to grub-core/include/grub/x86_64/efi/loader.h diff --git a/include/grub/x86_64/efi/memory.h b/grub-core/include/grub/x86_64/efi/memory.h similarity index 100% rename from include/grub/x86_64/efi/memory.h rename to grub-core/include/grub/x86_64/efi/memory.h diff --git a/include/grub/x86_64/efi/serial.h b/grub-core/include/grub/x86_64/efi/serial.h similarity index 100% rename from include/grub/x86_64/efi/serial.h rename to grub-core/include/grub/x86_64/efi/serial.h diff --git a/include/grub/x86_64/efi/time.h b/grub-core/include/grub/x86_64/efi/time.h similarity index 100% rename from include/grub/x86_64/efi/time.h rename to grub-core/include/grub/x86_64/efi/time.h diff --git a/include/grub/x86_64/io.h b/grub-core/include/grub/x86_64/io.h similarity index 100% rename from include/grub/x86_64/io.h rename to grub-core/include/grub/x86_64/io.h diff --git a/include/grub/x86_64/kernel.h b/grub-core/include/grub/x86_64/kernel.h similarity index 100% rename from include/grub/x86_64/kernel.h rename to grub-core/include/grub/x86_64/kernel.h diff --git a/include/grub/x86_64/linux.h b/grub-core/include/grub/x86_64/linux.h similarity index 100% rename from include/grub/x86_64/linux.h rename to grub-core/include/grub/x86_64/linux.h diff --git a/include/grub/x86_64/macho.h b/grub-core/include/grub/x86_64/macho.h similarity index 100% rename from include/grub/x86_64/macho.h rename to grub-core/include/grub/x86_64/macho.h diff --git a/include/grub/x86_64/multiboot.h b/grub-core/include/grub/x86_64/multiboot.h similarity index 100% rename from include/grub/x86_64/multiboot.h rename to grub-core/include/grub/x86_64/multiboot.h diff --git a/include/grub/x86_64/pci.h b/grub-core/include/grub/x86_64/pci.h similarity index 100% rename from include/grub/x86_64/pci.h rename to grub-core/include/grub/x86_64/pci.h diff --git a/include/grub/x86_64/relocator.h b/grub-core/include/grub/x86_64/relocator.h similarity index 100% rename from include/grub/x86_64/relocator.h rename to grub-core/include/grub/x86_64/relocator.h diff --git a/include/grub/x86_64/setjmp.h b/grub-core/include/grub/x86_64/setjmp.h similarity index 100% rename from include/grub/x86_64/setjmp.h rename to grub-core/include/grub/x86_64/setjmp.h diff --git a/include/grub/x86_64/time.h b/grub-core/include/grub/x86_64/time.h similarity index 100% rename from include/grub/x86_64/time.h rename to grub-core/include/grub/x86_64/time.h diff --git a/include/grub/x86_64/types.h b/grub-core/include/grub/x86_64/types.h similarity index 100% rename from include/grub/x86_64/types.h rename to grub-core/include/grub/x86_64/types.h diff --git a/include/grub/x86_64/xnu.h b/grub-core/include/grub/x86_64/xnu.h similarity index 100% rename from include/grub/x86_64/xnu.h rename to grub-core/include/grub/x86_64/xnu.h diff --git a/include/grub/xnu.h b/grub-core/include/grub/xnu.h similarity index 100% rename from include/grub/xnu.h rename to grub-core/include/grub/xnu.h diff --git a/include/multiboot.h b/grub-core/include/multiboot.h similarity index 100% rename from include/multiboot.h rename to grub-core/include/multiboot.h diff --git a/include/multiboot2.h b/grub-core/include/multiboot2.h similarity index 100% rename from include/multiboot2.h rename to grub-core/include/multiboot2.h diff --git a/io/bufio.c b/grub-core/io/bufio.c similarity index 100% rename from io/bufio.c rename to grub-core/io/bufio.c diff --git a/io/gzio.c b/grub-core/io/gzio.c similarity index 100% rename from io/gzio.c rename to grub-core/io/gzio.c diff --git a/kern/command.c b/grub-core/kern/command.c similarity index 100% rename from kern/command.c rename to grub-core/kern/command.c diff --git a/kern/corecmd.c b/grub-core/kern/corecmd.c similarity index 100% rename from kern/corecmd.c rename to grub-core/kern/corecmd.c diff --git a/kern/device.c b/grub-core/kern/device.c similarity index 100% rename from kern/device.c rename to grub-core/kern/device.c diff --git a/kern/disk.c b/grub-core/kern/disk.c similarity index 100% rename from kern/disk.c rename to grub-core/kern/disk.c diff --git a/kern/dl.c b/grub-core/kern/dl.c similarity index 99% rename from kern/dl.c rename to grub-core/kern/dl.c index 19ee13243..12391ced9 100644 --- a/kern/dl.c +++ b/grub-core/kern/dl.c @@ -469,12 +469,13 @@ grub_dl_resolve_dependencies (grub_dl_t mod, Elf_Ehdr *e) return GRUB_ERR_NONE; } -#if !GRUB_NO_MODULES int grub_dl_ref (grub_dl_t mod) { grub_dl_dep_t dep; + if (!mod) return 0; + for (dep = mod->dep; dep; dep = dep->next) grub_dl_ref (dep->mod); @@ -486,12 +487,13 @@ grub_dl_unref (grub_dl_t mod) { grub_dl_dep_t dep; + if (!mod) return 0; + for (dep = mod->dep; dep; dep = dep->next) grub_dl_unref (dep->mod); return --mod->ref_count; } -#endif static void grub_dl_flush_cache (grub_dl_t mod) diff --git a/kern/efi/efi.c b/grub-core/kern/efi/efi.c similarity index 100% rename from kern/efi/efi.c rename to grub-core/kern/efi/efi.c diff --git a/kern/efi/init.c b/grub-core/kern/efi/init.c similarity index 100% rename from kern/efi/init.c rename to grub-core/kern/efi/init.c diff --git a/kern/efi/mm.c b/grub-core/kern/efi/mm.c similarity index 100% rename from kern/efi/mm.c rename to grub-core/kern/efi/mm.c diff --git a/kern/elf.c b/grub-core/kern/elf.c similarity index 100% rename from kern/elf.c rename to grub-core/kern/elf.c diff --git a/grub-core/kern/emu/cache.S b/grub-core/kern/emu/cache.S new file mode 100644 index 000000000..087b2b495 --- /dev/null +++ b/grub-core/kern/emu/cache.S @@ -0,0 +1,17 @@ +#ifndef GRUB_MACHINE_EMU +#error "This source is only meant for grub-emu platform" +#endif + +#if GRUB_CPU_I386 +#elif GRUB_CPU_X86_64 +#elif GRUB_CPU_SPARC64 +#include "../sparc64/cache.S" +#elif GRUB_CPU_MIPS +#include "../mips/cache.S" +#elif GRUB_CPU_MIPSEL +#include "../mips/cache.S" +#elif GRUB_CPU_POWERPC +#include "../powerpc/cache.S" +#else +#error "No target cpu type is defined" +#endif diff --git a/util/console.c b/grub-core/kern/emu/console.c similarity index 99% rename from util/console.c rename to grub-core/kern/emu/console.c index 382fd7f89..f7fbc899a 100644 --- a/util/console.c +++ b/grub-core/kern/emu/console.c @@ -27,7 +27,7 @@ # define A_STANDOUT 0 #endif /* ! A_STANDOUT */ -#include +#include #include #include diff --git a/grub-core/kern/emu/dl.c b/grub-core/kern/emu/dl.c new file mode 100644 index 000000000..4266376a2 --- /dev/null +++ b/grub-core/kern/emu/dl.c @@ -0,0 +1,19 @@ +#ifndef GRUB_MACHINE_EMU +#error "This source is only meant for grub-emu platform" +#endif + +#if GRUB_CPU_I386 +#include "../i386/dl.c" +#elif GRUB_CPU_X86_64 +#include "../x86_64/dl.c" +#elif GRUB_CPU_SPARC64 +#include "../sparc64/dl.c" +#elif GRUB_CPU_MIPS +#include "../mips/dl.c" +#elif GRUB_CPU_MIPSEL +#include "../mips/dl.c" +#elif GRUB_CPU_POWERPC +#include "../powerpc/dl.c" +#else +#error "No target cpu type is defined" +#endif diff --git a/grub-core/kern/emu/dummy/dl.c b/grub-core/kern/emu/dummy/dl.c new file mode 100644 index 000000000..8e9fabfc2 --- /dev/null +++ b/grub-core/kern/emu/dummy/dl.c @@ -0,0 +1,51 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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 . + */ + +#include +#include + +grub_err_t +grub_arch_dl_check_header (void *ehdr) +{ + (void) ehdr; + + return GRUB_ERR_BAD_MODULE; +} + +grub_err_t +grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) +{ + (void) mod; + (void) ehdr; + + return GRUB_ERR_BAD_MODULE; +} + +/* int */ +/* grub_dl_ref (grub_dl_t mod) */ +/* { */ +/* (void) mod; */ +/* return 0; */ +/* } */ + +/* int */ +/* grub_dl_unref (grub_dl_t mod) */ +/* { */ +/* (void) mod; */ +/* return 0; */ +/* } */ diff --git a/grub-core/kern/emu/dummy/symlist.c b/grub-core/kern/emu/dummy/symlist.c new file mode 100644 index 000000000..d1445a347 --- /dev/null +++ b/grub-core/kern/emu/dummy/symlist.c @@ -0,0 +1,26 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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 . + */ + +#include +#include +#include + +void +grub_register_exported_symbols (void) +{ +} diff --git a/util/getroot.c b/grub-core/kern/emu/getroot.c similarity index 82% rename from util/getroot.c rename to grub-core/kern/emu/getroot.c index 891bd0f10..ba357d861 100644 --- a/util/getroot.c +++ b/grub-core/kern/emu/getroot.c @@ -22,6 +22,10 @@ #include #include #include +#include +#include +#include +#include #ifdef __CYGWIN__ # include @@ -36,9 +40,11 @@ #include #endif -#include -#include -#include +#include +#include +#include +#include +#include static void strip_extra_slashes (char *dir) @@ -541,3 +547,100 @@ grub_util_check_char_device (const char *blk_dev) return 0; } +/* This function never prints trailing slashes (so that its output + can be appended a slash unconditionally). */ +char * +grub_make_system_path_relative_to_its_root (const char *path) +{ + struct stat st; + char *p, *buf, *buf2, *buf3; + uintptr_t offset = 0; + dev_t num; + size_t len; + + /* canonicalize. */ + p = canonicalize_file_name (path); + + if (p == NULL) + grub_util_error ("failed to get canonical path of %s", path); + + len = strlen (p) + 1; + buf = xstrdup (p); + free (p); + + if (stat (buf, &st) < 0) + grub_util_error ("cannot stat %s: %s", buf, strerror (errno)); + + buf2 = xstrdup (buf); + num = st.st_dev; + + /* This loop sets offset to the number of chars of the root + directory we're inspecting. */ + while (1) + { + p = strrchr (buf, '/'); + if (p == NULL) + /* This should never happen. */ + grub_util_error ("FIXME: no / in buf. (make_system_path_relative_to_its_root)"); + if (p != buf) + *p = 0; + else + *++p = 0; + + if (stat (buf, &st) < 0) + grub_util_error ("cannot stat %s: %s", buf, strerror (errno)); + + /* buf is another filesystem; we found it. */ + if (st.st_dev != num) + { + /* offset == 0 means path given is the mount point. + This works around special-casing of "/" in Un*x. This function never + prints trailing slashes (so that its output can be appended a slash + unconditionally). Each slash in is considered a preceding slash, and + therefore the root directory is an empty string. */ + if (offset == 0) + { + free (buf); + free (buf2); + return xstrdup (""); + } + else + break; + } + + offset = p - buf; + /* offset == 1 means root directory. */ + if (offset == 1) + { + /* Include leading slash. */ + offset = 0; + break; + } + } + free (buf); + buf3 = xstrdup (buf2 + offset); + free (buf2); + +#ifdef __CYGWIN__ + if (st.st_dev != (DEV_CYGDRIVE_MAJOR << 16)) + { + /* Reached some mount point not below /cygdrive. + GRUB does not know Cygwin's emulated mounts, + convert to Win32 path. */ + grub_util_info ("Cygwin path = %s\n", buf3); + char * temp = get_win32_path (buf3); + free (buf3); + buf3 = temp; + } +#endif + + /* Remove trailing slashes, return empty string if root directory. */ + len = strlen (buf3); + while (len > 0 && buf3[len - 1] == '/') + { + buf3[len - 1] = '\0'; + len--; + } + + return buf3; +} diff --git a/util/hostdisk.c b/grub-core/kern/emu/hostdisk.c similarity index 99% rename from util/hostdisk.c rename to grub-core/kern/emu/hostdisk.c index 8be487461..983f101ae 100644 --- a/util/hostdisk.c +++ b/grub-core/kern/emu/hostdisk.c @@ -22,8 +22,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/util/hostfs.c b/grub-core/kern/emu/hostfs.c similarity index 100% rename from util/hostfs.c rename to grub-core/kern/emu/hostfs.c diff --git a/grub-core/kern/emu/lite.c b/grub-core/kern/emu/lite.c new file mode 100644 index 000000000..1f06e39dc --- /dev/null +++ b/grub-core/kern/emu/lite.c @@ -0,0 +1,16 @@ +#include +#include + +/* grub-emu-lite supports dynamic module loading, so it won't have any + embedded modules. */ +void +grub_init_all(void) +{ + return; +} + +void +grub_fini_all(void) +{ + return; +} diff --git a/util/grub-emu.c b/grub-core/kern/emu/main.c similarity index 90% rename from util/grub-emu.c rename to grub-core/kern/emu/main.c index 8c53b0aca..9083e27a0 100644 --- a/util/grub-emu.c +++ b/grub-core/kern/emu/main.c @@ -16,7 +16,10 @@ * along with GRUB. If not, see . */ +#include +#include #include +#include #include #include #include @@ -27,20 +30,22 @@ #include #include #include -#include -#include -#include +#include +#include +#include +#include #include #include #include -#include +#include #include #include #include -#define ENABLE_RELOCATABLE 0 #include "progname.h" +#define ENABLE_RELOCATABLE 0 + /* Used for going back to the main function. */ static jmp_buf main_env; @@ -53,25 +58,6 @@ grub_arch_modules_addr (void) return 0; } -#if GRUB_NO_MODULES -grub_err_t -grub_arch_dl_check_header (void *ehdr) -{ - (void) ehdr; - - return GRUB_ERR_BAD_MODULE; -} - -grub_err_t -grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) -{ - (void) mod; - (void) ehdr; - - return GRUB_ERR_BAD_MODULE; -} -#endif - void grub_reboot (void) { @@ -150,10 +136,6 @@ void grub_hostfs_init (void); void grub_hostfs_fini (void); void grub_host_init (void); void grub_host_fini (void); -#if GRUB_NO_MODULES -void grub_init_all (void); -void grub_fini_all (void); -#endif int main (int argc, char *argv[]) @@ -219,9 +201,8 @@ main (int argc, char *argv[]) /* XXX: This is a bit unportable. */ grub_util_biosdisk_init (dev_map); -#if GRUB_NO_MODULES + /* Initialize all embedded modules. */ grub_init_all (); -#endif /* Make sure that there is a root device. */ if (! root_dev) @@ -242,7 +223,7 @@ main (int argc, char *argv[]) if (strcmp (root_dev, "host") == 0) dir = xstrdup (dir); else - dir = make_system_path_relative_to_its_root (dir); + dir = grub_make_system_path_relative_to_its_root (dir); prefix = xmalloc (strlen (root_dev) + 2 + strlen (dir) + 1); sprintf (prefix, "(%s)%s", root_dev, dir); free (dir); @@ -251,9 +232,7 @@ main (int argc, char *argv[]) if (setjmp (main_env) == 0) grub_main (); -#if GRUB_NO_MODULES grub_fini_all (); -#endif grub_hostfs_fini (); grub_host_fini (); @@ -261,3 +240,25 @@ main (int argc, char *argv[]) return 0; } + +#ifdef __MINGW32__ + +void +grub_millisleep (grub_uint32_t ms) +{ + Sleep (ms); +} + +#else + +void +grub_millisleep (grub_uint32_t ms) +{ + struct timespec ts; + + ts.tv_sec = ms / 1000; + ts.tv_nsec = (ms % 1000) * 1000000; + nanosleep (&ts, NULL); +} + +#endif diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c new file mode 100644 index 000000000..d8dfc938d --- /dev/null +++ b/grub-core/kern/emu/misc.c @@ -0,0 +1,199 @@ +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +int verbosity; + +void +grub_util_warn (const char *fmt, ...) +{ + va_list ap; + + fprintf (stderr, _("%s: warn:"), program_name); + fprintf (stderr, " "); + va_start (ap, fmt); + vfprintf (stderr, fmt, ap); + va_end (ap); + fprintf (stderr, ".\n"); + fflush (stderr); +} + +void +grub_util_info (const char *fmt, ...) +{ + if (verbosity > 0) + { + va_list ap; + + fprintf (stderr, _("%s: info:"), program_name); + fprintf (stderr, " "); + va_start (ap, fmt); + vfprintf (stderr, fmt, ap); + va_end (ap); + fprintf (stderr, ".\n"); + fflush (stderr); + } +} + +void +grub_util_error (const char *fmt, ...) +{ + va_list ap; + + fprintf (stderr, _("%s: error:"), program_name); + fprintf (stderr, " "); + va_start (ap, fmt); + vfprintf (stderr, fmt, ap); + va_end (ap); + fprintf (stderr, ".\n"); + exit (1); +} + +void * +grub_malloc (grub_size_t size) +{ + return malloc (size); +} + +void * +grub_zalloc (grub_size_t size) +{ + void *ret; + + ret = malloc (size); + memset (ret, 0, size); + return ret; +} + +void +grub_free (void *ptr) +{ + free (ptr); +} + +void * +grub_realloc (void *ptr, grub_size_t size) +{ + return realloc (ptr, size); +} + +void * +grub_memalign (grub_size_t align, grub_size_t size) +{ + void *p; + +#if defined(HAVE_POSIX_MEMALIGN) + if (align < sizeof (void *)) + align = sizeof (void *); + + else if (align % sizeof (void *)) + grub_fatal ("bad alignment"); + + if (posix_memalign (&p, align, size) != 0) + p = 0; +#elif defined(HAVE_MEMALIGN) + p = memalign (align, size); +#else + (void) align; + (void) size; + grub_fatal ("grub_memalign is not supported"); +#endif + + if (! p) + grub_fatal ("out of memory"); + + return p; +} + +void * +xmalloc (grub_size_t size) +{ + void *p; + + p = grub_malloc (size); + if (! p) + grub_fatal ("out of memory"); + + return p; +} + +void * +xrealloc (void *ptr, grub_size_t size) +{ + ptr = grub_realloc (ptr, size); + if (! ptr) + grub_fatal ("out of memory"); + + return ptr; +} + +char * +xstrdup (const char *str) +{ + size_t len; + char *newstr; + + len = grub_strlen (str); + newstr = (char *) xmalloc (len + 1); + grub_memcpy (newstr, str, len + 1); + + return newstr; +} + +char * +xasprintf (const char *fmt, ...) +{ + va_list ap; + char *result; + + va_start (ap, fmt); + if (vasprintf (&result, fmt, ap) < 0) + { + if (errno == ENOMEM) + grub_util_error ("out of memory"); + return NULL; + } + + return result; +} + +void +grub_exit (void) +{ + exit (1); +} + +grub_uint64_t +grub_get_time_ms (void) +{ + struct timeval tv; + + gettimeofday (&tv, 0); + + return (tv.tv_sec * 1000 + tv.tv_usec / 1000); +} + +grub_uint32_t +grub_get_rtc (void) +{ + struct timeval tv; + + gettimeofday (&tv, 0); + + return (tv.tv_sec * GRUB_TICKS_PER_SECOND + + (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec) + * GRUB_TICKS_PER_SECOND / 1000000)); +} diff --git a/util/time.c b/grub-core/kern/emu/time.c similarity index 100% rename from util/time.c rename to grub-core/kern/emu/time.c diff --git a/kern/env.c b/grub-core/kern/env.c similarity index 100% rename from kern/env.c rename to grub-core/kern/env.c diff --git a/kern/err.c b/grub-core/kern/err.c similarity index 100% rename from kern/err.c rename to grub-core/kern/err.c diff --git a/kern/file.c b/grub-core/kern/file.c similarity index 100% rename from kern/file.c rename to grub-core/kern/file.c diff --git a/kern/fs.c b/grub-core/kern/fs.c similarity index 100% rename from kern/fs.c rename to grub-core/kern/fs.c diff --git a/kern/generic/millisleep.c b/grub-core/kern/generic/millisleep.c similarity index 100% rename from kern/generic/millisleep.c rename to grub-core/kern/generic/millisleep.c diff --git a/kern/generic/rtc_get_time_ms.c b/grub-core/kern/generic/rtc_get_time_ms.c similarity index 100% rename from kern/generic/rtc_get_time_ms.c rename to grub-core/kern/generic/rtc_get_time_ms.c diff --git a/kern/handler.c b/grub-core/kern/handler.c similarity index 100% rename from kern/handler.c rename to grub-core/kern/handler.c diff --git a/kern/i386/coreboot/init.c b/grub-core/kern/i386/coreboot/init.c similarity index 100% rename from kern/i386/coreboot/init.c rename to grub-core/kern/i386/coreboot/init.c diff --git a/kern/i386/coreboot/mmap.c b/grub-core/kern/i386/coreboot/mmap.c similarity index 100% rename from kern/i386/coreboot/mmap.c rename to grub-core/kern/i386/coreboot/mmap.c diff --git a/kern/i386/coreboot/startup.S b/grub-core/kern/i386/coreboot/startup.S similarity index 100% rename from kern/i386/coreboot/startup.S rename to grub-core/kern/i386/coreboot/startup.S diff --git a/kern/i386/dl.c b/grub-core/kern/i386/dl.c similarity index 100% rename from kern/i386/dl.c rename to grub-core/kern/i386/dl.c diff --git a/kern/i386/efi/init.c b/grub-core/kern/i386/efi/init.c similarity index 100% rename from kern/i386/efi/init.c rename to grub-core/kern/i386/efi/init.c diff --git a/kern/i386/efi/startup.S b/grub-core/kern/i386/efi/startup.S similarity index 100% rename from kern/i386/efi/startup.S rename to grub-core/kern/i386/efi/startup.S diff --git a/kern/i386/halt.c b/grub-core/kern/i386/halt.c similarity index 100% rename from kern/i386/halt.c rename to grub-core/kern/i386/halt.c diff --git a/kern/i386/ieee1275/init.c b/grub-core/kern/i386/ieee1275/init.c similarity index 100% rename from kern/i386/ieee1275/init.c rename to grub-core/kern/i386/ieee1275/init.c diff --git a/kern/i386/ieee1275/startup.S b/grub-core/kern/i386/ieee1275/startup.S similarity index 100% rename from kern/i386/ieee1275/startup.S rename to grub-core/kern/i386/ieee1275/startup.S diff --git a/kern/i386/loader.S b/grub-core/kern/i386/loader.S similarity index 100% rename from kern/i386/loader.S rename to grub-core/kern/i386/loader.S diff --git a/kern/i386/misc.S b/grub-core/kern/i386/misc.S similarity index 100% rename from kern/i386/misc.S rename to grub-core/kern/i386/misc.S diff --git a/kern/i386/multiboot_mmap.c b/grub-core/kern/i386/multiboot_mmap.c similarity index 100% rename from kern/i386/multiboot_mmap.c rename to grub-core/kern/i386/multiboot_mmap.c diff --git a/kern/i386/pc/init.c b/grub-core/kern/i386/pc/init.c similarity index 100% rename from kern/i386/pc/init.c rename to grub-core/kern/i386/pc/init.c diff --git a/kern/i386/pc/lzma_decode.S b/grub-core/kern/i386/pc/lzma_decode.S similarity index 100% rename from kern/i386/pc/lzma_decode.S rename to grub-core/kern/i386/pc/lzma_decode.S diff --git a/kern/i386/pc/mmap.c b/grub-core/kern/i386/pc/mmap.c similarity index 100% rename from kern/i386/pc/mmap.c rename to grub-core/kern/i386/pc/mmap.c diff --git a/kern/i386/pc/startup.S b/grub-core/kern/i386/pc/startup.S similarity index 100% rename from kern/i386/pc/startup.S rename to grub-core/kern/i386/pc/startup.S diff --git a/kern/i386/pit.c b/grub-core/kern/i386/pit.c similarity index 100% rename from kern/i386/pit.c rename to grub-core/kern/i386/pit.c diff --git a/kern/i386/qemu/mmap.c b/grub-core/kern/i386/qemu/mmap.c similarity index 100% rename from kern/i386/qemu/mmap.c rename to grub-core/kern/i386/qemu/mmap.c diff --git a/kern/i386/qemu/startup.S b/grub-core/kern/i386/qemu/startup.S similarity index 100% rename from kern/i386/qemu/startup.S rename to grub-core/kern/i386/qemu/startup.S diff --git a/kern/i386/realmode.S b/grub-core/kern/i386/realmode.S similarity index 100% rename from kern/i386/realmode.S rename to grub-core/kern/i386/realmode.S diff --git a/kern/i386/tsc.c b/grub-core/kern/i386/tsc.c similarity index 100% rename from kern/i386/tsc.c rename to grub-core/kern/i386/tsc.c diff --git a/kern/ieee1275/cmain.c b/grub-core/kern/ieee1275/cmain.c similarity index 100% rename from kern/ieee1275/cmain.c rename to grub-core/kern/ieee1275/cmain.c diff --git a/kern/ieee1275/ieee1275.c b/grub-core/kern/ieee1275/ieee1275.c similarity index 100% rename from kern/ieee1275/ieee1275.c rename to grub-core/kern/ieee1275/ieee1275.c diff --git a/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c similarity index 100% rename from kern/ieee1275/init.c rename to grub-core/kern/ieee1275/init.c diff --git a/kern/ieee1275/mmap.c b/grub-core/kern/ieee1275/mmap.c similarity index 100% rename from kern/ieee1275/mmap.c rename to grub-core/kern/ieee1275/mmap.c diff --git a/kern/ieee1275/openfw.c b/grub-core/kern/ieee1275/openfw.c similarity index 100% rename from kern/ieee1275/openfw.c rename to grub-core/kern/ieee1275/openfw.c diff --git a/kern/list.c b/grub-core/kern/list.c similarity index 100% rename from kern/list.c rename to grub-core/kern/list.c diff --git a/kern/main.c b/grub-core/kern/main.c similarity index 100% rename from kern/main.c rename to grub-core/kern/main.c diff --git a/kern/mips/cache.S b/grub-core/kern/mips/cache.S similarity index 100% rename from kern/mips/cache.S rename to grub-core/kern/mips/cache.S diff --git a/kern/mips/cache_flush.S b/grub-core/kern/mips/cache_flush.S similarity index 100% rename from kern/mips/cache_flush.S rename to grub-core/kern/mips/cache_flush.S diff --git a/kern/mips/dl.c b/grub-core/kern/mips/dl.c similarity index 100% rename from kern/mips/dl.c rename to grub-core/kern/mips/dl.c diff --git a/kern/mips/init.c b/grub-core/kern/mips/init.c similarity index 100% rename from kern/mips/init.c rename to grub-core/kern/mips/init.c diff --git a/kern/mips/qemu-mips/init.c b/grub-core/kern/mips/qemu-mips/init.c similarity index 100% rename from kern/mips/qemu-mips/init.c rename to grub-core/kern/mips/qemu-mips/init.c diff --git a/kern/mips/startup.S b/grub-core/kern/mips/startup.S similarity index 100% rename from kern/mips/startup.S rename to grub-core/kern/mips/startup.S diff --git a/kern/mips/yeeloong/init.c b/grub-core/kern/mips/yeeloong/init.c similarity index 100% rename from kern/mips/yeeloong/init.c rename to grub-core/kern/mips/yeeloong/init.c diff --git a/kern/misc.c b/grub-core/kern/misc.c similarity index 100% rename from kern/misc.c rename to grub-core/kern/misc.c diff --git a/kern/mm.c b/grub-core/kern/mm.c similarity index 100% rename from kern/mm.c rename to grub-core/kern/mm.c diff --git a/kern/parser.c b/grub-core/kern/parser.c similarity index 100% rename from kern/parser.c rename to grub-core/kern/parser.c diff --git a/kern/partition.c b/grub-core/kern/partition.c similarity index 100% rename from kern/partition.c rename to grub-core/kern/partition.c diff --git a/kern/powerpc/cache.S b/grub-core/kern/powerpc/cache.S similarity index 100% rename from kern/powerpc/cache.S rename to grub-core/kern/powerpc/cache.S diff --git a/kern/powerpc/dl.c b/grub-core/kern/powerpc/dl.c similarity index 100% rename from kern/powerpc/dl.c rename to grub-core/kern/powerpc/dl.c diff --git a/kern/powerpc/ieee1275/startup.S b/grub-core/kern/powerpc/ieee1275/startup.S similarity index 100% rename from kern/powerpc/ieee1275/startup.S rename to grub-core/kern/powerpc/ieee1275/startup.S diff --git a/kern/rescue_parser.c b/grub-core/kern/rescue_parser.c similarity index 100% rename from kern/rescue_parser.c rename to grub-core/kern/rescue_parser.c diff --git a/kern/rescue_reader.c b/grub-core/kern/rescue_reader.c similarity index 100% rename from kern/rescue_reader.c rename to grub-core/kern/rescue_reader.c diff --git a/kern/sparc64/cache.S b/grub-core/kern/sparc64/cache.S similarity index 100% rename from kern/sparc64/cache.S rename to grub-core/kern/sparc64/cache.S diff --git a/kern/sparc64/dl.c b/grub-core/kern/sparc64/dl.c similarity index 100% rename from kern/sparc64/dl.c rename to grub-core/kern/sparc64/dl.c diff --git a/kern/sparc64/ieee1275/crt0.S b/grub-core/kern/sparc64/ieee1275/crt0.S similarity index 100% rename from kern/sparc64/ieee1275/crt0.S rename to grub-core/kern/sparc64/ieee1275/crt0.S diff --git a/kern/sparc64/ieee1275/ieee1275.c b/grub-core/kern/sparc64/ieee1275/ieee1275.c similarity index 100% rename from kern/sparc64/ieee1275/ieee1275.c rename to grub-core/kern/sparc64/ieee1275/ieee1275.c diff --git a/kern/sparc64/ieee1275/init.c b/grub-core/kern/sparc64/ieee1275/init.c similarity index 100% rename from kern/sparc64/ieee1275/init.c rename to grub-core/kern/sparc64/ieee1275/init.c diff --git a/kern/term.c b/grub-core/kern/term.c similarity index 100% rename from kern/term.c rename to grub-core/kern/term.c diff --git a/kern/time.c b/grub-core/kern/time.c similarity index 100% rename from kern/time.c rename to grub-core/kern/time.c diff --git a/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c similarity index 100% rename from kern/x86_64/dl.c rename to grub-core/kern/x86_64/dl.c diff --git a/kern/x86_64/efi/callwrap.S b/grub-core/kern/x86_64/efi/callwrap.S similarity index 100% rename from kern/x86_64/efi/callwrap.S rename to grub-core/kern/x86_64/efi/callwrap.S diff --git a/kern/x86_64/efi/startup.S b/grub-core/kern/x86_64/efi/startup.S similarity index 100% rename from kern/x86_64/efi/startup.S rename to grub-core/kern/x86_64/efi/startup.S diff --git a/lib/LzFind.c b/grub-core/lib/LzFind.c similarity index 100% rename from lib/LzFind.c rename to grub-core/lib/LzFind.c diff --git a/lib/LzmaDec.c b/grub-core/lib/LzmaDec.c similarity index 100% rename from lib/LzmaDec.c rename to grub-core/lib/LzmaDec.c diff --git a/lib/LzmaEnc.c b/grub-core/lib/LzmaEnc.c similarity index 100% rename from lib/LzmaEnc.c rename to grub-core/lib/LzmaEnc.c diff --git a/lib/arg.c b/grub-core/lib/arg.c similarity index 100% rename from lib/arg.c rename to grub-core/lib/arg.c diff --git a/lib/charset.c b/grub-core/lib/charset.c similarity index 100% rename from lib/charset.c rename to grub-core/lib/charset.c diff --git a/lib/cmos_datetime.c b/grub-core/lib/cmos_datetime.c similarity index 100% rename from lib/cmos_datetime.c rename to grub-core/lib/cmos_datetime.c diff --git a/lib/crc.c b/grub-core/lib/crc.c similarity index 100% rename from lib/crc.c rename to grub-core/lib/crc.c diff --git a/lib/crypto.c b/grub-core/lib/crypto.c similarity index 100% rename from lib/crypto.c rename to grub-core/lib/crypto.c diff --git a/lib/efi/datetime.c b/grub-core/lib/efi/datetime.c similarity index 100% rename from lib/efi/datetime.c rename to grub-core/lib/efi/datetime.c diff --git a/lib/envblk.c b/grub-core/lib/envblk.c similarity index 100% rename from lib/envblk.c rename to grub-core/lib/envblk.c diff --git a/lib/hexdump.c b/grub-core/lib/hexdump.c similarity index 100% rename from lib/hexdump.c rename to grub-core/lib/hexdump.c diff --git a/lib/i386/pc/biosnum.c b/grub-core/lib/i386/pc/biosnum.c similarity index 100% rename from lib/i386/pc/biosnum.c rename to grub-core/lib/i386/pc/biosnum.c diff --git a/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c similarity index 100% rename from lib/i386/relocator.c rename to grub-core/lib/i386/relocator.c diff --git a/lib/i386/relocator_asm.S b/grub-core/lib/i386/relocator_asm.S similarity index 100% rename from lib/i386/relocator_asm.S rename to grub-core/lib/i386/relocator_asm.S diff --git a/lib/i386/relocator_backward.S b/grub-core/lib/i386/relocator_backward.S similarity index 100% rename from lib/i386/relocator_backward.S rename to grub-core/lib/i386/relocator_backward.S diff --git a/lib/i386/setjmp.S b/grub-core/lib/i386/setjmp.S similarity index 100% rename from lib/i386/setjmp.S rename to grub-core/lib/i386/setjmp.S diff --git a/lib/ieee1275/datetime.c b/grub-core/lib/ieee1275/datetime.c similarity index 100% rename from lib/ieee1275/datetime.c rename to grub-core/lib/ieee1275/datetime.c diff --git a/lib/libgcrypt/cipher/ChangeLog b/grub-core/lib/libgcrypt/cipher/ChangeLog similarity index 100% rename from lib/libgcrypt/cipher/ChangeLog rename to grub-core/lib/libgcrypt/cipher/ChangeLog diff --git a/lib/libgcrypt/cipher/ac.c b/grub-core/lib/libgcrypt/cipher/ac.c similarity index 100% rename from lib/libgcrypt/cipher/ac.c rename to grub-core/lib/libgcrypt/cipher/ac.c diff --git a/lib/libgcrypt/cipher/arcfour.c b/grub-core/lib/libgcrypt/cipher/arcfour.c similarity index 100% rename from lib/libgcrypt/cipher/arcfour.c rename to grub-core/lib/libgcrypt/cipher/arcfour.c diff --git a/lib/libgcrypt/cipher/bithelp.h b/grub-core/lib/libgcrypt/cipher/bithelp.h similarity index 100% rename from lib/libgcrypt/cipher/bithelp.h rename to grub-core/lib/libgcrypt/cipher/bithelp.h diff --git a/lib/libgcrypt/cipher/blowfish.c b/grub-core/lib/libgcrypt/cipher/blowfish.c similarity index 100% rename from lib/libgcrypt/cipher/blowfish.c rename to grub-core/lib/libgcrypt/cipher/blowfish.c diff --git a/lib/libgcrypt/cipher/camellia-glue.c b/grub-core/lib/libgcrypt/cipher/camellia-glue.c similarity index 100% rename from lib/libgcrypt/cipher/camellia-glue.c rename to grub-core/lib/libgcrypt/cipher/camellia-glue.c diff --git a/lib/libgcrypt/cipher/camellia.c b/grub-core/lib/libgcrypt/cipher/camellia.c similarity index 100% rename from lib/libgcrypt/cipher/camellia.c rename to grub-core/lib/libgcrypt/cipher/camellia.c diff --git a/lib/libgcrypt/cipher/camellia.h b/grub-core/lib/libgcrypt/cipher/camellia.h similarity index 100% rename from lib/libgcrypt/cipher/camellia.h rename to grub-core/lib/libgcrypt/cipher/camellia.h diff --git a/lib/libgcrypt/cipher/cast5.c b/grub-core/lib/libgcrypt/cipher/cast5.c similarity index 100% rename from lib/libgcrypt/cipher/cast5.c rename to grub-core/lib/libgcrypt/cipher/cast5.c diff --git a/lib/libgcrypt/cipher/cipher.c b/grub-core/lib/libgcrypt/cipher/cipher.c similarity index 100% rename from lib/libgcrypt/cipher/cipher.c rename to grub-core/lib/libgcrypt/cipher/cipher.c diff --git a/lib/libgcrypt/cipher/crc.c b/grub-core/lib/libgcrypt/cipher/crc.c similarity index 100% rename from lib/libgcrypt/cipher/crc.c rename to grub-core/lib/libgcrypt/cipher/crc.c diff --git a/lib/libgcrypt/cipher/des.c b/grub-core/lib/libgcrypt/cipher/des.c similarity index 100% rename from lib/libgcrypt/cipher/des.c rename to grub-core/lib/libgcrypt/cipher/des.c diff --git a/lib/libgcrypt/cipher/dsa.c b/grub-core/lib/libgcrypt/cipher/dsa.c similarity index 100% rename from lib/libgcrypt/cipher/dsa.c rename to grub-core/lib/libgcrypt/cipher/dsa.c diff --git a/lib/libgcrypt/cipher/ecc.c b/grub-core/lib/libgcrypt/cipher/ecc.c similarity index 100% rename from lib/libgcrypt/cipher/ecc.c rename to grub-core/lib/libgcrypt/cipher/ecc.c diff --git a/lib/libgcrypt/cipher/elgamal.c b/grub-core/lib/libgcrypt/cipher/elgamal.c similarity index 100% rename from lib/libgcrypt/cipher/elgamal.c rename to grub-core/lib/libgcrypt/cipher/elgamal.c diff --git a/lib/libgcrypt/cipher/hash-common.c b/grub-core/lib/libgcrypt/cipher/hash-common.c similarity index 100% rename from lib/libgcrypt/cipher/hash-common.c rename to grub-core/lib/libgcrypt/cipher/hash-common.c diff --git a/lib/libgcrypt/cipher/hash-common.h b/grub-core/lib/libgcrypt/cipher/hash-common.h similarity index 100% rename from lib/libgcrypt/cipher/hash-common.h rename to grub-core/lib/libgcrypt/cipher/hash-common.h diff --git a/lib/libgcrypt/cipher/hmac-tests.c b/grub-core/lib/libgcrypt/cipher/hmac-tests.c similarity index 100% rename from lib/libgcrypt/cipher/hmac-tests.c rename to grub-core/lib/libgcrypt/cipher/hmac-tests.c diff --git a/lib/libgcrypt/cipher/md.c b/grub-core/lib/libgcrypt/cipher/md.c similarity index 100% rename from lib/libgcrypt/cipher/md.c rename to grub-core/lib/libgcrypt/cipher/md.c diff --git a/lib/libgcrypt/cipher/md4.c b/grub-core/lib/libgcrypt/cipher/md4.c similarity index 100% rename from lib/libgcrypt/cipher/md4.c rename to grub-core/lib/libgcrypt/cipher/md4.c diff --git a/lib/libgcrypt/cipher/md5.c b/grub-core/lib/libgcrypt/cipher/md5.c similarity index 100% rename from lib/libgcrypt/cipher/md5.c rename to grub-core/lib/libgcrypt/cipher/md5.c diff --git a/lib/libgcrypt/cipher/primegen.c b/grub-core/lib/libgcrypt/cipher/primegen.c similarity index 100% rename from lib/libgcrypt/cipher/primegen.c rename to grub-core/lib/libgcrypt/cipher/primegen.c diff --git a/lib/libgcrypt/cipher/pubkey.c b/grub-core/lib/libgcrypt/cipher/pubkey.c similarity index 100% rename from lib/libgcrypt/cipher/pubkey.c rename to grub-core/lib/libgcrypt/cipher/pubkey.c diff --git a/lib/libgcrypt/cipher/rfc2268.c b/grub-core/lib/libgcrypt/cipher/rfc2268.c similarity index 100% rename from lib/libgcrypt/cipher/rfc2268.c rename to grub-core/lib/libgcrypt/cipher/rfc2268.c diff --git a/lib/libgcrypt/cipher/rijndael-tables.h b/grub-core/lib/libgcrypt/cipher/rijndael-tables.h similarity index 100% rename from lib/libgcrypt/cipher/rijndael-tables.h rename to grub-core/lib/libgcrypt/cipher/rijndael-tables.h diff --git a/lib/libgcrypt/cipher/rijndael.c b/grub-core/lib/libgcrypt/cipher/rijndael.c similarity index 100% rename from lib/libgcrypt/cipher/rijndael.c rename to grub-core/lib/libgcrypt/cipher/rijndael.c diff --git a/lib/libgcrypt/cipher/rmd.h b/grub-core/lib/libgcrypt/cipher/rmd.h similarity index 100% rename from lib/libgcrypt/cipher/rmd.h rename to grub-core/lib/libgcrypt/cipher/rmd.h diff --git a/lib/libgcrypt/cipher/rmd160.c b/grub-core/lib/libgcrypt/cipher/rmd160.c similarity index 100% rename from lib/libgcrypt/cipher/rmd160.c rename to grub-core/lib/libgcrypt/cipher/rmd160.c diff --git a/lib/libgcrypt/cipher/rsa.c b/grub-core/lib/libgcrypt/cipher/rsa.c similarity index 100% rename from lib/libgcrypt/cipher/rsa.c rename to grub-core/lib/libgcrypt/cipher/rsa.c diff --git a/lib/libgcrypt/cipher/seed.c b/grub-core/lib/libgcrypt/cipher/seed.c similarity index 100% rename from lib/libgcrypt/cipher/seed.c rename to grub-core/lib/libgcrypt/cipher/seed.c diff --git a/lib/libgcrypt/cipher/serpent.c b/grub-core/lib/libgcrypt/cipher/serpent.c similarity index 100% rename from lib/libgcrypt/cipher/serpent.c rename to grub-core/lib/libgcrypt/cipher/serpent.c diff --git a/lib/libgcrypt/cipher/sha1.c b/grub-core/lib/libgcrypt/cipher/sha1.c similarity index 100% rename from lib/libgcrypt/cipher/sha1.c rename to grub-core/lib/libgcrypt/cipher/sha1.c diff --git a/lib/libgcrypt/cipher/sha256.c b/grub-core/lib/libgcrypt/cipher/sha256.c similarity index 100% rename from lib/libgcrypt/cipher/sha256.c rename to grub-core/lib/libgcrypt/cipher/sha256.c diff --git a/lib/libgcrypt/cipher/sha512.c b/grub-core/lib/libgcrypt/cipher/sha512.c similarity index 100% rename from lib/libgcrypt/cipher/sha512.c rename to grub-core/lib/libgcrypt/cipher/sha512.c diff --git a/lib/libgcrypt/cipher/tiger.c b/grub-core/lib/libgcrypt/cipher/tiger.c similarity index 100% rename from lib/libgcrypt/cipher/tiger.c rename to grub-core/lib/libgcrypt/cipher/tiger.c diff --git a/lib/libgcrypt/cipher/twofish.c b/grub-core/lib/libgcrypt/cipher/twofish.c similarity index 100% rename from lib/libgcrypt/cipher/twofish.c rename to grub-core/lib/libgcrypt/cipher/twofish.c diff --git a/lib/libgcrypt/cipher/whirlpool.c b/grub-core/lib/libgcrypt/cipher/whirlpool.c similarity index 100% rename from lib/libgcrypt/cipher/whirlpool.c rename to grub-core/lib/libgcrypt/cipher/whirlpool.c diff --git a/lib/libgcrypt_wrap/cipher_wrap.h b/grub-core/lib/libgcrypt_wrap/cipher_wrap.h similarity index 100% rename from lib/libgcrypt_wrap/cipher_wrap.h rename to grub-core/lib/libgcrypt_wrap/cipher_wrap.h diff --git a/lib/mips/relocator.c b/grub-core/lib/mips/relocator.c similarity index 100% rename from lib/mips/relocator.c rename to grub-core/lib/mips/relocator.c diff --git a/lib/mips/relocator_asm.S b/grub-core/lib/mips/relocator_asm.S similarity index 100% rename from lib/mips/relocator_asm.S rename to grub-core/lib/mips/relocator_asm.S diff --git a/lib/mips/setjmp.S b/grub-core/lib/mips/setjmp.S similarity index 100% rename from lib/mips/setjmp.S rename to grub-core/lib/mips/setjmp.S diff --git a/lib/pbkdf2.c b/grub-core/lib/pbkdf2.c similarity index 100% rename from lib/pbkdf2.c rename to grub-core/lib/pbkdf2.c diff --git a/lib/posix_wrap/assert.h b/grub-core/lib/posix_wrap/assert.h similarity index 100% rename from lib/posix_wrap/assert.h rename to grub-core/lib/posix_wrap/assert.h diff --git a/lib/posix_wrap/ctype.h b/grub-core/lib/posix_wrap/ctype.h similarity index 100% rename from lib/posix_wrap/ctype.h rename to grub-core/lib/posix_wrap/ctype.h diff --git a/lib/posix_wrap/errno.h b/grub-core/lib/posix_wrap/errno.h similarity index 100% rename from lib/posix_wrap/errno.h rename to grub-core/lib/posix_wrap/errno.h diff --git a/lib/posix_wrap/langinfo.h b/grub-core/lib/posix_wrap/langinfo.h similarity index 100% rename from lib/posix_wrap/langinfo.h rename to grub-core/lib/posix_wrap/langinfo.h diff --git a/lib/posix_wrap/limits.h b/grub-core/lib/posix_wrap/limits.h similarity index 100% rename from lib/posix_wrap/limits.h rename to grub-core/lib/posix_wrap/limits.h diff --git a/lib/posix_wrap/localcharset.h b/grub-core/lib/posix_wrap/localcharset.h similarity index 100% rename from lib/posix_wrap/localcharset.h rename to grub-core/lib/posix_wrap/localcharset.h diff --git a/lib/posix_wrap/locale.h b/grub-core/lib/posix_wrap/locale.h similarity index 100% rename from lib/posix_wrap/locale.h rename to grub-core/lib/posix_wrap/locale.h diff --git a/lib/posix_wrap/stdint.h b/grub-core/lib/posix_wrap/stdint.h similarity index 100% rename from lib/posix_wrap/stdint.h rename to grub-core/lib/posix_wrap/stdint.h diff --git a/lib/posix_wrap/stdio.h b/grub-core/lib/posix_wrap/stdio.h similarity index 100% rename from lib/posix_wrap/stdio.h rename to grub-core/lib/posix_wrap/stdio.h diff --git a/lib/posix_wrap/stdlib.h b/grub-core/lib/posix_wrap/stdlib.h similarity index 98% rename from lib/posix_wrap/stdlib.h rename to grub-core/lib/posix_wrap/stdlib.h index 5ef6159ef..4c725f6e2 100644 --- a/lib/posix_wrap/stdlib.h +++ b/grub-core/lib/posix_wrap/stdlib.h @@ -20,6 +20,7 @@ #define GRUB_POSIX_STDLIB_H 1 #include +#include static inline void free (void *ptr) diff --git a/lib/posix_wrap/string.h b/grub-core/lib/posix_wrap/string.h similarity index 97% rename from lib/posix_wrap/string.h rename to grub-core/lib/posix_wrap/string.h index 7bb6f1e6f..4224836e2 100644 --- a/lib/posix_wrap/string.h +++ b/grub-core/lib/posix_wrap/string.h @@ -19,6 +19,8 @@ #ifndef GRUB_POSIX_STRING_H #define GRUB_POSIX_STRING_H 1 +#include + static inline grub_size_t strlen (const char *s) { diff --git a/lib/posix_wrap/sys/types.h b/grub-core/lib/posix_wrap/sys/types.h similarity index 100% rename from lib/posix_wrap/sys/types.h rename to grub-core/lib/posix_wrap/sys/types.h diff --git a/lib/posix_wrap/unistd.h b/grub-core/lib/posix_wrap/unistd.h similarity index 100% rename from lib/posix_wrap/unistd.h rename to grub-core/lib/posix_wrap/unistd.h diff --git a/lib/posix_wrap/wchar.h b/grub-core/lib/posix_wrap/wchar.h similarity index 100% rename from lib/posix_wrap/wchar.h rename to grub-core/lib/posix_wrap/wchar.h diff --git a/lib/posix_wrap/wctype.h b/grub-core/lib/posix_wrap/wctype.h similarity index 100% rename from lib/posix_wrap/wctype.h rename to grub-core/lib/posix_wrap/wctype.h diff --git a/lib/powerpc/setjmp.S b/grub-core/lib/powerpc/setjmp.S similarity index 100% rename from lib/powerpc/setjmp.S rename to grub-core/lib/powerpc/setjmp.S diff --git a/lib/relocator.c b/grub-core/lib/relocator.c similarity index 100% rename from lib/relocator.c rename to grub-core/lib/relocator.c diff --git a/lib/sparc64/setjmp.S b/grub-core/lib/sparc64/setjmp.S similarity index 100% rename from lib/sparc64/setjmp.S rename to grub-core/lib/sparc64/setjmp.S diff --git a/lib/x86_64/setjmp.S b/grub-core/lib/x86_64/setjmp.S similarity index 100% rename from lib/x86_64/setjmp.S rename to grub-core/lib/x86_64/setjmp.S diff --git a/loader/aout.c b/grub-core/loader/aout.c similarity index 100% rename from loader/aout.c rename to grub-core/loader/aout.c diff --git a/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c similarity index 100% rename from loader/efi/appleloader.c rename to grub-core/loader/efi/appleloader.c diff --git a/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c similarity index 100% rename from loader/efi/chainloader.c rename to grub-core/loader/efi/chainloader.c diff --git a/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c similarity index 100% rename from loader/i386/bsd.c rename to grub-core/loader/i386/bsd.c diff --git a/loader/i386/bsd32.c b/grub-core/loader/i386/bsd32.c similarity index 100% rename from loader/i386/bsd32.c rename to grub-core/loader/i386/bsd32.c diff --git a/loader/i386/bsd64.c b/grub-core/loader/i386/bsd64.c similarity index 100% rename from loader/i386/bsd64.c rename to grub-core/loader/i386/bsd64.c diff --git a/loader/i386/bsdXX.c b/grub-core/loader/i386/bsdXX.c similarity index 100% rename from loader/i386/bsdXX.c rename to grub-core/loader/i386/bsdXX.c diff --git a/loader/i386/bsd_helper.S b/grub-core/loader/i386/bsd_helper.S similarity index 100% rename from loader/i386/bsd_helper.S rename to grub-core/loader/i386/bsd_helper.S diff --git a/loader/i386/bsd_pagetable.c b/grub-core/loader/i386/bsd_pagetable.c similarity index 100% rename from loader/i386/bsd_pagetable.c rename to grub-core/loader/i386/bsd_pagetable.c diff --git a/loader/i386/bsd_trampoline.S b/grub-core/loader/i386/bsd_trampoline.S similarity index 100% rename from loader/i386/bsd_trampoline.S rename to grub-core/loader/i386/bsd_trampoline.S diff --git a/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c similarity index 100% rename from loader/i386/efi/linux.c rename to grub-core/loader/i386/efi/linux.c diff --git a/loader/i386/efi/xnu.c b/grub-core/loader/i386/efi/xnu.c similarity index 100% rename from loader/i386/efi/xnu.c rename to grub-core/loader/i386/efi/xnu.c diff --git a/loader/i386/ieee1275/linux.c b/grub-core/loader/i386/ieee1275/linux.c similarity index 100% rename from loader/i386/ieee1275/linux.c rename to grub-core/loader/i386/ieee1275/linux.c diff --git a/loader/i386/linux.c b/grub-core/loader/i386/linux.c similarity index 100% rename from loader/i386/linux.c rename to grub-core/loader/i386/linux.c diff --git a/loader/i386/linux_trampoline.S b/grub-core/loader/i386/linux_trampoline.S similarity index 100% rename from loader/i386/linux_trampoline.S rename to grub-core/loader/i386/linux_trampoline.S diff --git a/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c similarity index 100% rename from loader/i386/multiboot_mbi.c rename to grub-core/loader/i386/multiboot_mbi.c diff --git a/loader/i386/pc/chainloader.c b/grub-core/loader/i386/pc/chainloader.c similarity index 100% rename from loader/i386/pc/chainloader.c rename to grub-core/loader/i386/pc/chainloader.c diff --git a/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c similarity index 100% rename from loader/i386/pc/linux.c rename to grub-core/loader/i386/pc/linux.c diff --git a/loader/i386/pc/xnu.c b/grub-core/loader/i386/pc/xnu.c similarity index 100% rename from loader/i386/pc/xnu.c rename to grub-core/loader/i386/pc/xnu.c diff --git a/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c similarity index 100% rename from loader/i386/xnu.c rename to grub-core/loader/i386/xnu.c diff --git a/loader/macho.c b/grub-core/loader/macho.c similarity index 100% rename from loader/macho.c rename to grub-core/loader/macho.c diff --git a/loader/macho32.c b/grub-core/loader/macho32.c similarity index 100% rename from loader/macho32.c rename to grub-core/loader/macho32.c diff --git a/loader/macho64.c b/grub-core/loader/macho64.c similarity index 100% rename from loader/macho64.c rename to grub-core/loader/macho64.c diff --git a/loader/machoXX.c b/grub-core/loader/machoXX.c similarity index 100% rename from loader/machoXX.c rename to grub-core/loader/machoXX.c diff --git a/loader/mips/linux.c b/grub-core/loader/mips/linux.c similarity index 100% rename from loader/mips/linux.c rename to grub-core/loader/mips/linux.c diff --git a/loader/multiboot.c b/grub-core/loader/multiboot.c similarity index 100% rename from loader/multiboot.c rename to grub-core/loader/multiboot.c diff --git a/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c similarity index 100% rename from loader/multiboot_elfxx.c rename to grub-core/loader/multiboot_elfxx.c diff --git a/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c similarity index 100% rename from loader/multiboot_mbi2.c rename to grub-core/loader/multiboot_mbi2.c diff --git a/loader/powerpc/ieee1275/linux.c b/grub-core/loader/powerpc/ieee1275/linux.c similarity index 100% rename from loader/powerpc/ieee1275/linux.c rename to grub-core/loader/powerpc/ieee1275/linux.c diff --git a/loader/sparc64/ieee1275/linux.c b/grub-core/loader/sparc64/ieee1275/linux.c similarity index 100% rename from loader/sparc64/ieee1275/linux.c rename to grub-core/loader/sparc64/ieee1275/linux.c diff --git a/loader/xnu.c b/grub-core/loader/xnu.c similarity index 100% rename from loader/xnu.c rename to grub-core/loader/xnu.c diff --git a/loader/xnu_resume.c b/grub-core/loader/xnu_resume.c similarity index 100% rename from loader/xnu_resume.c rename to grub-core/loader/xnu_resume.c diff --git a/mmap/efi/mmap.c b/grub-core/mmap/efi/mmap.c similarity index 100% rename from mmap/efi/mmap.c rename to grub-core/mmap/efi/mmap.c diff --git a/mmap/i386/mmap.c b/grub-core/mmap/i386/mmap.c similarity index 100% rename from mmap/i386/mmap.c rename to grub-core/mmap/i386/mmap.c diff --git a/mmap/i386/pc/mmap.c b/grub-core/mmap/i386/pc/mmap.c similarity index 100% rename from mmap/i386/pc/mmap.c rename to grub-core/mmap/i386/pc/mmap.c diff --git a/mmap/i386/pc/mmap_helper.S b/grub-core/mmap/i386/pc/mmap_helper.S similarity index 100% rename from mmap/i386/pc/mmap_helper.S rename to grub-core/mmap/i386/pc/mmap_helper.S diff --git a/mmap/i386/uppermem.c b/grub-core/mmap/i386/uppermem.c similarity index 100% rename from mmap/i386/uppermem.c rename to grub-core/mmap/i386/uppermem.c diff --git a/mmap/mips/yeeloong/uppermem.c b/grub-core/mmap/mips/yeeloong/uppermem.c similarity index 100% rename from mmap/mips/yeeloong/uppermem.c rename to grub-core/mmap/mips/yeeloong/uppermem.c diff --git a/mmap/mmap.c b/grub-core/mmap/mmap.c similarity index 100% rename from mmap/mmap.c rename to grub-core/mmap/mmap.c diff --git a/grub-core/modules.def b/grub-core/modules.def new file mode 100644 index 000000000..ae3ede5f1 --- /dev/null +++ b/grub-core/modules.def @@ -0,0 +1,1592 @@ +AutoGen definitions Makefile.tpl; + +kernel = { + name = kernel; + + emu_ldflags = '-Wl,-r'; + x86_efi_ldflags = '-Wl,-r'; + i386_pc_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + i386_coreboot_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + i386_qemu_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + i386_ieee1275_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + mips_yeeloong_ldflags = '-Wl,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + powerpc_ieee1275_ldflags = '-Wl,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + + mips_yeeloong_cppflags = '-DUSE_ASCII_FAILBACK'; + i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)'; + i386_qemu_ccasflags = '-DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + + mips_ldadd = '-lgcc'; + powerpc_ldadd = '-lgcc'; + sparc64_ldadd = '-lgcc'; + + nonemu_nodist = symlist.c; + + shared = kern/command.c; + shared = kern/corecmd.c; + shared = kern/device.c; + shared = kern/disk.c; + shared = kern/dl.c; + shared = kern/env.c; + shared = kern/err.c; + shared = kern/file.c; + shared = kern/fs.c; + shared = kern/handler.c; + shared = kern/list.c; + shared = kern/main.c; + shared = kern/misc.c; + shared = kern/parser.c; + shared = kern/partition.c; + shared = kern/rescue_parser.c; + shared = kern/rescue_reader.c; + shared = kern/term.c; + + i386_pc = kern/i386/pc/startup.S; + i386_pc = kern/i386/misc.S; + i386_pc = kern/mm.c; + i386_pc = kern/time.c; + i386_pc = kern/i386/dl.c; + i386_pc = kern/i386/pc/init.c; + i386_pc = kern/i386/pc/mmap.c; + i386_pc = kern/i386/tsc.c; + i386_pc = kern/i386/pit.c; + i386_pc = kern/generic/rtc_get_time_ms.c; + i386_pc = kern/generic/millisleep.c; + i386_pc = term/i386/pc/console.c; + i386_pc = term/i386/vga_common.c; + + i386_efi = kern/i386/efi/startup.S; + i386_efi = kern/mm.c; + i386_efi = kern/i386/dl.c; + i386_efi = kern/i386/efi/init.c; + i386_efi = kern/efi/efi.c; + i386_efi = kern/efi/init.c; + i386_efi = kern/efi/mm.c; + i386_efi = kern/time.c; + i386_efi = kern/i386/tsc.c; + i386_efi = kern/i386/pit.c; + i386_efi = kern/generic/rtc_get_time_ms.c; + i386_efi = kern/generic/millisleep.c; + i386_efi = term/efi/console.c; + i386_efi = disk/efi/efidisk.c; + + i386_coreboot = kern/i386/coreboot/startup.S; + i386_coreboot = kern/i386/misc.S; + i386_coreboot = kern/i386/coreboot/init.c; + i386_coreboot = kern/i386/coreboot/mmap.c; + i386_coreboot = kern/i386/halt.c; + i386_coreboot = kern/mm.c; + i386_coreboot = kern/time.c; + i386_coreboot = kern/i386/dl.c; + i386_coreboot = kern/i386/tsc.c; + i386_coreboot = kern/i386/pit.c; + i386_coreboot = kern/generic/rtc_get_time_ms.c; + i386_coreboot = kern/generic/millisleep.c; + i386_coreboot = term/i386/pc/vga_text.c; + i386_coreboot = term/i386/vga_common.c; + + i386_qemu = kern/i386/qemu/startup.S; + i386_qemu = kern/i386/misc.S; + i386_qemu = kern/i386/coreboot/init.c; + i386_qemu = kern/i386/qemu/mmap.c; + i386_qemu = kern/i386/halt.c; + i386_qemu = kern/mm.c; + i386_qemu = kern/time.c; + i386_qemu = kern/i386/dl.c; + i386_qemu = kern/i386/tsc.c; + i386_qemu = kern/i386/pit.c; + i386_qemu = kern/generic/rtc_get_time_ms.c; + i386_qemu = kern/generic/millisleep.c; + i386_qemu = term/i386/pc/vga_text.c; + i386_qemu = term/i386/vga_common.c; + + i386_ieee1275 = kern/i386/ieee1275/startup.S; + i386_ieee1275 = kern/i386/misc.S; + i386_ieee1275 = kern/i386/ieee1275/init.c; + i386_ieee1275 = kern/ieee1275/init.c; + i386_ieee1275 = kern/ieee1275/mmap.c; + i386_ieee1275 = kern/ieee1275/cmain.c; + i386_ieee1275 = kern/ieee1275/openfw.c; + i386_ieee1275 = kern/mm.c; + i386_ieee1275 = kern/i386/dl.c; + i386_ieee1275 = kern/time.c; + i386_ieee1275 = kern/generic/millisleep.c; + i386_ieee1275 = kern/ieee1275/ieee1275.c; + i386_ieee1275 = term/ieee1275/ofconsole.c; + i386_ieee1275 = disk/ieee1275/ofdisk.c; + + x86_64_efi = kern/x86_64/efi/startup.S; + x86_64_efi = kern/x86_64/efi/callwrap.S; + x86_64_efi = kern/mm.c; + x86_64_efi = kern/x86_64/dl.c; + x86_64_efi = kern/i386/efi/init.c; + x86_64_efi = kern/efi/efi.c; + x86_64_efi = kern/efi/init.c; + x86_64_efi = kern/efi/mm.c; + x86_64_efi = kern/time.c; + x86_64_efi = kern/i386/tsc.c; + x86_64_efi = kern/i386/pit.c; + x86_64_efi = kern/generic/millisleep.c; + x86_64_efi = kern/generic/rtc_get_time_ms.c; + x86_64_efi = term/efi/console.c; + x86_64_efi = disk/efi/efidisk.c; + + mips_yeeloong = kern/mips/startup.S; + mips_yeeloong = kern/mips/init.c; + mips_yeeloong = kern/mips/yeeloong/init.c; + mips_yeeloong = kern/mm.c; + mips_yeeloong = kern/mips/dl.c; + mips_yeeloong = kern/generic/millisleep.c; + mips_yeeloong = kern/generic/rtc_get_time_ms.c; + mips_yeeloong = kern/time.c; + mips_yeeloong = kern/mips/cache.S; + mips_yeeloong = io/bufio.c; + mips_yeeloong = lib/arg.c; + mips_yeeloong = commands/extcmd.c; + mips_yeeloong = bus/pci.c; + mips_yeeloong = bus/bonito.c; + mips_yeeloong = font/font_cmd.c; + mips_yeeloong = font/font.c; + mips_yeeloong = term/at_keyboard.c; + mips_yeeloong = term/gfxterm.c; + mips_yeeloong = video/video.c; + mips_yeeloong = video/fb/video_fb.c; + mips_yeeloong = video/fb/fbblit.c; + mips_yeeloong = video/fb/fbfill.c; + mips_yeeloong = video/fb/fbutil.c; + mips_yeeloong = video/bitmap.c; + mips_yeeloong = video/bitmap_scale.c; + mips_yeeloong = video/sm712.c; + + powerpc_ieee1275 = kern/powerpc/ieee1275/startup.S; + powerpc_ieee1275 = kern/ieee1275/cmain.c; + powerpc_ieee1275 = kern/ieee1275/ieee1275.c; + powerpc_ieee1275 = kern/mm.c; + powerpc_ieee1275 = kern/ieee1275/init.c; + powerpc_ieee1275 = kern/ieee1275/mmap.c; + powerpc_ieee1275 = kern/ieee1275/openfw.c; + powerpc_ieee1275 = kern/powerpc/dl.c; + powerpc_ieee1275 = kern/generic/millisleep.c; + powerpc_ieee1275 = kern/time.c; + powerpc_ieee1275 = kern/powerpc/cache.S; + powerpc_ieee1275 = term/ieee1275/ofconsole.c; + powerpc_ieee1275 = disk/ieee1275/ofdisk.c; + + sparc64_ieee1275 = kern/sparc64/ieee1275/crt0.S; + sparc64_ieee1275 = kern/ieee1275/cmain.c; + sparc64_ieee1275 = kern/ieee1275/ieee1275.c; + sparc64_ieee1275 = kern/mm.c; + sparc64_ieee1275 = kern/sparc64/ieee1275/ieee1275.c; + sparc64_ieee1275 = kern/sparc64/ieee1275/init.c; + sparc64_ieee1275 = kern/ieee1275/mmap.c; + sparc64_ieee1275 = kern/ieee1275/openfw.c; + sparc64_ieee1275 = kern/sparc64/dl.c; + sparc64_ieee1275 = kern/generic/millisleep.c; + sparc64_ieee1275 = kern/time.c; + sparc64_ieee1275 = kern/sparc64/cache.S; + sparc64_ieee1275 = disk/ieee1275/ofdisk.c; + sparc64_ieee1275 = term/ieee1275/ofconsole.c; + + emu = kern/emu/misc.c; + emu = kern/emu/getroot.c; + emu = kern/emu/time.c; + emu = kern/emu/hostdisk.c; + emu = kern/emu/hostfs.c; + emu = kern/emu/console.c; + emu = disk/host.c; + + image_nostrip = { emu; }; + image_strip_keep_kernel = { i386_efi; x86_64_efi; }; + image_strip = { powerpc_ieee1275; i386_coreboot; i386_ieee1275; }; + image_strip_macho2img = { mips_yeeloong; i386_pc; i386_qemu; sparc64_ieee1275; }; +}; + +program = { + name = grub-emu; + mansection = 1; + + source = kern/emu/main.c; + source = kern/emu/dummy/dl.c; + source = kern/emu/dummy/symlist.c; + source = gnulib/progname.c; + + nodist = grub_emu_init.c; + + cflags = '$(CFLAGS_GNULIB)'; + cppflags = '$(CPPFLAGS_GNULIB)'; + + ldadd = kernel.exec; + ldadd = '$(MODULE_FILES)'; + ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS)'; + + emu; +}; + +program = { + name = grub-emu-lite; + + source = kern/emu/main.c; + source = kern/emu/lite.c; + source = kern/emu/dl.c; + source = kern/emu/cache.S; + source = gnulib/progname.c; + nodist = symlist.c; + + cflags = '$(CFLAGS_GNULIB)'; + cppflags = '$(CPPFLAGS_GNULIB)'; + + ldadd = kernel.exec; + ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS)'; + + emu; +}; + +module = { + name = trig; + nodist = trigtables.c; + common; +}; + +image = { + name = boot; + i386_pc = boot/i386/pc/boot.S; + i386_pc_ldflags = "-Wl,-Ttext=0x7C00"; + + i386_qemu = boot/i386/qemu/boot.S; + i386_qemu_ldflags = '-Wl,-Ttext,$(GRUB_BOOT_MACHINE_LINK_ADDR)'; + i386_qemu_ccasflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)'; + + sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S; + sparc64_ieee1275_format = a.out-sunos-big; + sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000'; +}; + +image = { + name = cdboot; + source = boot/i386/pc/cdboot.S; + ldflags = "-Wl,-Ttext=0x7C00"; + + i386_pc; +}; + +image = { + name = pxeboot; + source = boot/i386/pc/pxeboot.S; + ldflags = '-Wl,-Ttext=0x7C00'; + + i386_pc; +}; + +image = { + name = diskboot; + i386_pc = boot/i386/pc/diskboot.S; + i386_pc_ldflags = '-Wl,-Ttext=0x8000'; + + sparc64_ieee1275 = boot/sparc64/ieee1275/diskboot.S; + sparc64_ieee1275_ldflags = '-Wl,-Ttext=0x4200'; +}; + +image = { + name = lnxboot; + source = boot/i386/pc/lnxboot.S; + ldflags = '-Wl,-Ttext=0x6000'; + + i386_pc; +}; + +module = { + name = libusb; + source = bus/usb/emu/usb.c; + emu; + enable = COND_GRUB_EMU_USB; +}; + +module = { + name = pci; + source = bus/emu/pci.c; + source = commands/lspci.c; + emu; + enable = COND_GRUB_EMU_PCI; +}; + +module = { + name = usb; + source = bus/usb/usb.c; + source = bus/usb/usbtrans.c; + source = bus/usb/usbhub.c; + i386; +}; + +module = { + name = usb; + source = bus/usb/usb.c; + emu; + enable = COND_GRUB_EMU_USB; +}; + +module = { + name = uhci; + source = bus/usb/uhci.c; + x86; +}; + +module = { + name = ohci; + source = bus/usb/ohci.c; + x86; +}; + +module = { + name = pci; + source = bus/pci.c; + x86; +}; + +library = { + name = libgnulib.a; + source = gnulib/regex.c; + cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; + cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; + common; +}; + +module = { + name = iorw; + source = commands/iorw.c; + i386; +}; + +module = { + name = regexp; + source = commands/regexp.c; + ldadd = libgnulib.a; + cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; + cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; + common; +}; + +module = { + name = acpi; + + x86_efi = commands/acpi.c; + x86_efi = commands/efi/acpi.c; + + i386_pc = commands/acpi.c; + i386_pc = commands/i386/pc/acpi.c; +}; + +module = { + common; + name = blocklist; + source = commands/blocklist.c; +}; + +module = { + common; + name = boot; + source = commands/boot.c; + + i386_pc = commands/boot.c; + i386_pc = lib/i386/pc/biosnum.c; +}; + +module = { + common; + name = cat; + source = commands/cat.c; +}; + +module = { + common; + name = cmp; + source = commands/cmp.c; +}; + +module = { + common; + name = configfile; + source = commands/configfile.c; +}; + +module = { + name = cpuid; + source = commands/i386/cpuid.c; + + x86; +}; + +module = { + common; + name = crc; + source = commands/crc.c; + source = lib/crc.c; +}; + +module = { + common; + name = date; + source = commands/date.c; + + x86; + mips; +}; + +module = { + name = drivemap; + + i386_pc = commands/i386/pc/drivemap.c; + i386_pc = commands/i386/pc/drivemap_int13h.S; +}; + +module = { + common; + name = echo; + source = commands/echo.c; +}; + +module = { + common; + name = extcmd; + source = commands/extcmd.c; + source = lib/arg.c; +}; + +module = { + name = fixvideo; + x86_efi = commands/efi/fixvideo.c; +}; + +module = { + common; + name = gptsync; + source = commands/gptsync.c; +}; + +module = { + name = halt; + source = commands/halt.c; + + i386_pc = commands/i386/pc/halt.c; + emu; + x86; + sparc64; + powerpc; +}; + +module = { + common; + name = handler; + source = commands/handler.c; +}; + +module = { + common; + name = hashsum; + source = commands/hashsum.c; +}; + +module = { + name = hdparm; + source = commands/hdparm.c; + source = lib/hexdump.c; + + i386_pc; +}; + +module = { + common; + name = help; + source = commands/help.c; +}; + +module = { + common; + name = hexdump; + source = commands/hexdump.c; + source = lib/hexdump.c; +}; + +module = { + common; + name = keystatus; + source = commands/keystatus.c; +}; + +module = { + name = loadbios; + x86_efi = commands/efi/loadbios.c; +}; + +module = { + common; + name = loadenv; + source = commands/loadenv.c; + source = lib/envblk.c; +}; + +module = { + common; + name = ls; + source = commands/ls.c; +}; + +module = { + common; + name = lsmmap; + source = commands/lsmmap.c; + + i386_pc; + i386_qemu; + i386_coreboot; + i386_ieee1275; + mips_yeeloong; + powerpc_ieee1275; +}; + +module = { + name = lspci; + source = commands/lspci.c; + + x86; + mips; +}; + +module = { + common; + name = memrw; + source = commands/memrw.c; +}; + +module = { + common; + name = minicmd; + source = commands/minicmd.c; +}; + +module = { + common; + name = parttool; + source = commands/parttool.c; +}; + +module = { + common; + name = password; + source = commands/password.c; +}; + +module = { + common; + name = password_pbkdf2; + source = commands/password_pbkdf2.c; +}; + +module = { + name = play; + source = commands/i386/pc/play.c; + i386; +}; + +module = { + common; + name = probe; + source = commands/probe.c; +}; + +module = { + name = pxecmd; + i386_pc = commands/i386/pc/pxecmd.c; +}; + +module = { + common; + name = read; + source = commands/read.c; +}; + +module = { + common; + name = reboot; + source = commands/reboot.c; + + x86; powerpc; sparc64; +}; + +module = { + common; + name = search; + source = commands/search_wrap.c; +}; + +module = { + common; + name = search_fs_file; + source = commands/search_file.c; +}; + +module = { + common; + name = search_fs_uuid; + source = commands/search_uuid.c; +}; + +module = { + common; + name = search_label; + source = commands/search_label.c; +}; + +module = { + name = setpci; + source = commands/setpci.c; + + x86; +}; + +module = { + common; + name = sleep; + source = commands/sleep.c; +}; + +module = { + name = suspend; + source = commands/ieee1275/suspend.c; + i386_ieee1275; + powerpc_ieee1275; +}; + +module = { + common; + name = terminal; + source = commands/terminal.c; +}; + +module = { + common; + name = test; + source = commands/test.c; +}; + +module = { + common; + name = true; + source = commands/true.c; +}; + +module = { + name = usbtest; + source = commands/usbtest.c; + i386_pc; +}; + +module = { + name = usbtest; + source = commands/usbtest.c; + emu; + enable = COND_GRUB_EMU_USB; +}; + +module = { + name = vbeinfo; + i386_pc = commands/i386/pc/vbeinfo.c; +}; + +module = { + name = vbetest; + i386_pc = commands/i386/pc/vbetest.c; +}; + +module = { + common; + name = videotest; + source = commands/videotest.c; +}; + +module = { + common; + name = xnu_uuid; + source = commands/xnu_uuid.c; +}; + +module = { + common; + name = dm_nv; + source = disk/dmraid_nvidia.c; +}; + +module = { + common; + name = loopback; + source = disk/loopback.c; +}; + +module = { + common; + name = lvm; + source = disk/lvm.c; +}; + +module = { + common; + name = mdraid; + source = disk/mdraid_linux.c; +}; + +module = { + common; + name = raid; + source = disk/raid.c; +}; + +module = { + common; + name = raid5rec; + source = disk/raid5_recover.c; +}; + +module = { + common; + name = raid6rec; + source = disk/raid6_recover.c; +}; + +module = { + common; + name = scsi; + source = disk/scsi.c; +}; + +module = { + common; + name = memdisk; + source = disk/memdisk.c; +}; + +module = { + name = ata; + source = disk/ata.c; + + x86; + mips; +}; + +module = { + name = ata_pthru; + source = disk/ata_pthru.c; + + x86; + mips_yeeloong; +}; + +module = { + name = biosdisk; + i386_pc = disk/i386/pc/biosdisk.c; +}; + +module = { + name = usbms; + source = disk/usbms.c; + i386_pc; +}; + +module = { + name = usbms; + source = disk/usbms.c; + emu; + enable = COND_GRUB_EMU_USB; +}; + +module = { + name = nand; + source = disk/ieee1275/nand.c; + + i386_ieee1275; +}; + +module = { + name = efiemu; + i386_pc = efiemu/main.c; + i386_pc = efiemu/i386/loadcore32.c; + i386_pc = efiemu/i386/loadcore64.c; + i386_pc = efiemu/i386/pc/cfgtables.c; + i386_pc = efiemu/mm.c; + i386_pc = efiemu/loadcore_common.c; + i386_pc = efiemu/symbols.c; + i386_pc = efiemu/loadcore32.c; + i386_pc = efiemu/loadcore64.c; + i386_pc = efiemu/prepare32.c; + i386_pc = efiemu/prepare64.c; + i386_pc = efiemu/pnvram.c; + i386_pc = efiemu/i386/coredetect.c; +}; + +module = { + name = font; + source = font/font.c; + source = font/font_cmd.c; + emu; + x86; + sparc64; + powerpc; +}; + +module = { + common; + name = affs; + source = fs/affs.c; +}; + +module = { + common; + name = afs; + source = fs/afs.c; +}; + +module = { + common; + name = afs_be; + source = fs/afs_be.c; +}; + +module = { + common; + name = befs; + source = fs/befs.c; +}; + +module = { + common; + name = befs_be; + source = fs/befs_be.c; +}; + +module = { + common; + name = cpio; + source = fs/cpio.c; +}; + +module = { + common; + name = ext2; + source = fs/ext2.c; +}; + +module = { + common; + name = fat; + source = fs/fat.c; +}; + +module = { + common; + name = fshelp; + source = fs/fshelp.c; +}; + +module = { + common; + name = hfs; + source = fs/hfs.c; +}; + +module = { + common; + name = hfsplus; + source = fs/hfsplus.c; +}; + +module = { + common; + name = iso9660; + source = fs/iso9660.c; +}; + +module = { + common; + name = jfs; + source = fs/jfs.c; +}; + +module = { + common; + name = minix; + source = fs/minix.c; +}; + +module = { + common; + name = nilfs2; + source = fs/nilfs2.c; +}; + +module = { + common; + name = ntfs; + source = fs/ntfs.c; +}; + +module = { + common; + name = ntfscomp; + source = fs/ntfscomp.c; +}; + +module = { + common; + name = reiserfs; + source = fs/reiserfs.c; +}; + +module = { + common; + name = sfs; + source = fs/sfs.c; +}; + +module = { + common; + name = tar; + source = fs/tar.c; +}; + +module = { + common; + name = udf; + source = fs/udf.c; +}; + +module = { + common; + name = ufs1; + source = fs/ufs.c; +}; + +module = { + common; + name = ufs2; + source = fs/ufs2.c; +}; + +module = { + common; + name = xfs; + source = fs/xfs.c; +}; + +module = { + name = pxe; + i386_pc = fs/i386/pc/pxe.c; +}; + +module = { + name = gettext; + source = gettext/gettext.c; + common; +}; + +module = { + common; + name = gfxmenu; + source = gfxmenu/gfxmenu.c; + source = gfxmenu/model.c; + source = gfxmenu/view.c; + source = gfxmenu/icon_manager.c; + source = gfxmenu/theme_loader.c; + source = gfxmenu/widget-box.c; + source = gfxmenu/gui_canvas.c; + source = gfxmenu/gui_circular_progress.c; + source = gfxmenu/gui_box.c; + source = gfxmenu/gui_label.c; + source = gfxmenu/gui_list.c; + source = gfxmenu/gui_image.c; + source = gfxmenu/gui_progress_bar.c; + source = gfxmenu/gui_util.c; + source = gfxmenu/gui_string_util.c; + source = gfxmenu/named_colors.c; +}; + +module = { + common; + name = hello; + source = hello/hello.c; +}; + +module = { + common; + name = gzio; + source = io/gzio.c; +}; + +module = { + name = bufio; + source = io/bufio.c; + emu; + x86; + sparc64; + powerpc; +}; + +module = { + common; + name = elf; + source = kern/elf.c; +}; + +module = { + common; + name = charset; + source = lib/charset.c; +}; + +module = { + common; + name = crypto; + source = lib/crypto.c; +}; + +module = { + common; + name = gcry_arcfour; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/arcfour.c; +}; + +module = { + common; + name = gcry_blowfish; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/blowfish.c; +}; + +module = { + common; + name = gcry_camellia; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/camellia.c; + source = lib/libgcrypt-grub/cipher/camellia-glue.c; +}; + +module = { + common; + name = gcry_cast5; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/cast5.c; +}; + +module = { + common; + name = gcry_crc; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/crc.c; +}; + +module = { + common; + name = gcry_des; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/des.c; +}; + +module = { + common; + name = gcry_md4; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/md4.c; +}; + +module = { + common; + name = gcry_md5; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/md5.c; +}; + +module = { + common; + name = gcry_rfc2268; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/rfc2268.c; +}; + +module = { + common; + name = gcry_rijndael; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/rijndael.c; +}; + +module = { + common; + name = gcry_rmd160; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/rmd160.c; +}; + +module = { + common; + name = gcry_seed; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/seed.c; +}; + +module = { + common; + name = gcry_serpent; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/serpent.c; +}; + +module = { + common; + name = gcry_sha1; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/sha1.c; +}; + +module = { + common; + name = gcry_sha256; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/sha256.c; +}; + +module = { + common; + name = gcry_sha512; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/sha512.c; +}; + +module = { + common; + name = gcry_tiger; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/tiger.c; +}; + +module = { + common; + name = gcry_twofish; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/twofish.c; +}; + +module = { + common; + name = gcry_whirlpool; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + source = lib/libgcrypt-grub/cipher/whirlpool.c; +}; + +module = { + common; + name = pbkdf2; + source = lib/pbkdf2.c; +}; + +module = { + name = relocator; + mips = lib/mips/relocator.c; + mips = lib/mips/relocator_asm.S; + x86 = lib/i386/relocator.c; + x86 = lib/i386/relocator_asm.S; + x86 = lib/i386/relocator_backward.S; +}; + +module = { + name = datetime; + source = lib/cmos_datetime.c; + x86_efi = lib/efi/datetime.c; + sparc64_ieee1275 = lib/ieee1275/datetime.c; + powerpc_ieee1275 = lib/ieee1275/datetime.c; + x86; + mips; +}; + +module = { + name = setjmp; + i386 = lib/i386/setjmp.S; + x86_64 = lib/x86_64/setjmp.S; + mips = lib/mips/setjmp.S; + sparc64 = lib/sparc64/setjmp.S; + powerpc = lib/powerpc/setjmp.S; +}; + +module = { + name = aout; + source = loader/aout.c; + i386_pc; + i386_qemu; + i386_coreboot; + i386_ieee1275; +}; + +module = { + name = bsd; + source = loader/i386/bsd.c; + source = loader/i386/bsd32.c; + source = loader/i386/bsd64.c; + source = loader/i386/bsd_helper.S; + source = loader/i386/bsd_trampoline.S; + i386_pc; + i386_qemu; + i386_coreboot; +}; + +module = { + name = linux16; + source = loader/i386/pc/linux.c; + i386_pc; +}; + +module = { + name = multiboot2; + cppflags = "-DGRUB_USE_MULTIBOOT2"; + + source = loader/multiboot.c; + source = loader/multiboot_mbi2.c; + x86; + mips; +}; + +module = { + name = multiboot; + source = loader/multiboot.c; + source = loader/i386/multiboot_mbi.c; + x86; +}; + +module = { + name = linux; + i386 = loader/i386/linux.c; + i386_efi = loader/i386/efi/linux.c; + i386_ieee1275 = loader/i386/ieee1275/linux.c; + x86_64_efi = loader/i386/efi/linux.c; + x86_64_efi = loader/i386/linux_trampoline.S; + mips = loader/mips/linux.c; + powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c; + sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c; +}; + +module = { + name = xnu; + x86_efi = loader/xnu_resume.c; + x86_efi = loader/i386/xnu.c; + x86_efi = loader/i386/efi/xnu.c; + x86_efi = loader/macho32.c; + x86_efi = loader/macho64.c; + x86_efi = loader/macho.c; + x86_efi = loader/xnu.c; + + i386_pc = loader/xnu_resume.c; + i386_pc = loader/i386/xnu.c; + i386_pc = loader/i386/pc/xnu.c; + i386_pc = loader/macho32.c; + i386_pc = loader/macho64.c; + i386_pc = loader/macho.c; + i386_pc = loader/xnu.c; +}; + +module = { + name = appleldr; + x86_efi = loader/efi/appleloader.c; +}; + +module = { + name = chain; + x86_efi = loader/efi/chainloader.c; + i386_pc = loader/i386/pc/chainloader.c; +}; + +module = { + name = mmap; + i386_pc = mmap/mmap.c; + i386_pc = mmap/i386/uppermem.c; + i386_pc = mmap/i386/mmap.c; + i386_pc = mmap/i386/pc/mmap.c; + i386_pc = mmap/i386/pc/mmap_helper.S; + + x86_efi = mmap/mmap.c; + x86_efi = mmap/i386/uppermem.c; + x86_efi = mmap/i386/mmap.c; + x86_efi = mmap/efi/mmap.c; + + i386_coreboot = mmap/mmap.c; + i386_coreboot = mmap/i386/uppermem.c; + i386_coreboot = mmap/i386/mmap.c; + + i386_qemu = mmap/mmap.c; + i386_qemu = mmap/i386/uppermem.c; + i386_qemu = mmap/i386/mmap.c; + + i386_ieee1275 = mmap/mmap.c; + i386_ieee1275 = mmap/i386/uppermem.c; + i386_ieee1275 = mmap/i386/mmap.c; + + mips_yeeloong = mmap/mmap.c; + mips_yeeloong = mmap/mips/yeeloong/uppermem.c; +}; + +module = { + common; + name = normal; + source = normal/main.c; + source = normal/cmdline.c; + source = normal/dyncmd.c; + source = normal/auth.c; + source = normal/autofs.c; + source = normal/handler.c; + source = normal/color.c; + source = normal/completion.c; + source = normal/datetime.c; + source = normal/menu.c; + source = normal/menu_entry.c; + source = normal/menu_text.c; + source = normal/misc.c; + source = normal/crypto.c; + source = normal/term.c; + source = normal/context.c; +}; + +module = { + common; + name = part_acorn; + source = partmap/acorn.c; +}; + +module = { + common; + name = part_amiga; + source = partmap/amiga.c; +}; + +module = { + common; + name = part_apple; + source = partmap/apple.c; +}; + +module = { + common; + name = part_gpt; + source = partmap/gpt.c; +}; + +module = { + common; + name = part_msdos; + source = partmap/msdos.c; +}; + +module = { + common; + name = part_sun; + source = partmap/sun.c; +}; + +module = { + common; + name = part_bsd; + source = partmap/bsdlabel.c; +}; + +module = { + common; + name = part_sunpc; + source = partmap/sunpc.c; +}; + +module = { + common; + name = msdospart; + source = parttool/msdospart.c; +}; + +module = { + common; + name = sh; + source = script/main.c; + source = script/script.c; + source = script/execute.c; + source = script/function.c; + source = script/lexer.c; + nodist = grub_script.tab.c; + nodist = grub_script.yy.c; + nodist = grub_script.tab.h; + nodist = grub_script.yy.h; + cflags = '$(CFLAGS_POSIX) -Wno-error'; + cppflags = '$(CPPFLAGS_POSIX)'; +}; + +module = { + name = at_keyboard; + source = term/at_keyboard.c; + x86; +}; + +module = { + name = gfxterm; + source = term/gfxterm.c; + emu; + x86; + sparc64; + powerpc; +}; + +module = { + name = serial; + source = term/serial.c; + mips; + i386; +}; + +module = { + common; + name = terminfo; + source = term/terminfo.c; + source = term/tparm.c; +}; + +module = { + name = usb_keyboard; + source = term/usb_keyboard.c; + i386_pc; +}; + +module = { + name = vga; + i386_pc = term/i386/pc/vga.c; +}; + +module = { + name = vga_text; + x86 = term/i386/pc/vga_text.c; + x86 = term/i386/vga_common.c; +}; + +module = { + name = functional_test; + source = tests/lib/functional_test.c; + source = tests/lib/test.c; + common; +}; + +module = { + name = example_functional_test; + source = tests/example_functional_test.c; + cflags = -Wno-format; + common; +}; + +module = { + name = bitmap; + source = video/bitmap.c; + emu; + x86; + sparc64; + powerpc; +}; + +module = { + name = bitmap_scale; + source = video/bitmap_scale.c; + emu; + x86; + sparc64; + powerpc; +}; + +module = { + name = efi_gop; + x86_efi = video/efi_gop.c; +}; + +module = { + name = efi_uga; + x86_efi = video/efi_uga.c; +}; + +module = { + common; + name = jpeg; + source = video/readers/jpeg.c; +}; + +module = { + common; + name = png; + source = video/readers/png.c; +}; + +module = { + common; + name = tga; + source = video/readers/tga.c; +}; + +module = { + name = vbe; + i386_pc = video/i386/pc/vbe.c; +}; + +module = { + name = video_fb; + source = video/fb/video_fb.c; + source = video/fb/fbblit.c; + source = video/fb/fbfill.c; + source = video/fb/fbutil.c; + emu; + x86; + sparc64; + powerpc; +}; + +module = { + name = video; + source = video/video.c; + emu; + x86; + sparc64; + powerpc; +}; + +module = { + name = ieee1275_fb; + source = video/ieee1275.c; + powerpc; + sparc64; +}; + +module = { + name = sdl; + source = video/emu/sdl.c; + enable = COND_GRUB_EMU_SDL; + emu; +}; + +module = { + name = datehook; + source = hook/datehook.c; + common; +}; diff --git a/normal/auth.c b/grub-core/normal/auth.c similarity index 100% rename from normal/auth.c rename to grub-core/normal/auth.c diff --git a/normal/autofs.c b/grub-core/normal/autofs.c similarity index 100% rename from normal/autofs.c rename to grub-core/normal/autofs.c diff --git a/normal/cmdline.c b/grub-core/normal/cmdline.c similarity index 100% rename from normal/cmdline.c rename to grub-core/normal/cmdline.c diff --git a/normal/color.c b/grub-core/normal/color.c similarity index 100% rename from normal/color.c rename to grub-core/normal/color.c diff --git a/normal/completion.c b/grub-core/normal/completion.c similarity index 100% rename from normal/completion.c rename to grub-core/normal/completion.c diff --git a/normal/context.c b/grub-core/normal/context.c similarity index 100% rename from normal/context.c rename to grub-core/normal/context.c diff --git a/normal/crypto.c b/grub-core/normal/crypto.c similarity index 100% rename from normal/crypto.c rename to grub-core/normal/crypto.c diff --git a/normal/datetime.c b/grub-core/normal/datetime.c similarity index 100% rename from normal/datetime.c rename to grub-core/normal/datetime.c diff --git a/normal/dyncmd.c b/grub-core/normal/dyncmd.c similarity index 100% rename from normal/dyncmd.c rename to grub-core/normal/dyncmd.c diff --git a/normal/handler.c b/grub-core/normal/handler.c similarity index 100% rename from normal/handler.c rename to grub-core/normal/handler.c diff --git a/normal/main.c b/grub-core/normal/main.c similarity index 100% rename from normal/main.c rename to grub-core/normal/main.c diff --git a/normal/menu.c b/grub-core/normal/menu.c similarity index 100% rename from normal/menu.c rename to grub-core/normal/menu.c diff --git a/normal/menu_entry.c b/grub-core/normal/menu_entry.c similarity index 100% rename from normal/menu_entry.c rename to grub-core/normal/menu_entry.c diff --git a/normal/menu_text.c b/grub-core/normal/menu_text.c similarity index 100% rename from normal/menu_text.c rename to grub-core/normal/menu_text.c diff --git a/normal/misc.c b/grub-core/normal/misc.c similarity index 100% rename from normal/misc.c rename to grub-core/normal/misc.c diff --git a/normal/term.c b/grub-core/normal/term.c similarity index 100% rename from normal/term.c rename to grub-core/normal/term.c diff --git a/partmap/acorn.c b/grub-core/partmap/acorn.c similarity index 100% rename from partmap/acorn.c rename to grub-core/partmap/acorn.c diff --git a/partmap/amiga.c b/grub-core/partmap/amiga.c similarity index 100% rename from partmap/amiga.c rename to grub-core/partmap/amiga.c diff --git a/partmap/apple.c b/grub-core/partmap/apple.c similarity index 100% rename from partmap/apple.c rename to grub-core/partmap/apple.c diff --git a/partmap/bsdlabel.c b/grub-core/partmap/bsdlabel.c similarity index 100% rename from partmap/bsdlabel.c rename to grub-core/partmap/bsdlabel.c diff --git a/partmap/gpt.c b/grub-core/partmap/gpt.c similarity index 100% rename from partmap/gpt.c rename to grub-core/partmap/gpt.c diff --git a/partmap/msdos.c b/grub-core/partmap/msdos.c similarity index 100% rename from partmap/msdos.c rename to grub-core/partmap/msdos.c diff --git a/partmap/sun.c b/grub-core/partmap/sun.c similarity index 100% rename from partmap/sun.c rename to grub-core/partmap/sun.c diff --git a/partmap/sunpc.c b/grub-core/partmap/sunpc.c similarity index 100% rename from partmap/sunpc.c rename to grub-core/partmap/sunpc.c diff --git a/parttool/msdospart.c b/grub-core/parttool/msdospart.c similarity index 100% rename from parttool/msdospart.c rename to grub-core/parttool/msdospart.c diff --git a/grub-core/po/Makefile.am b/grub-core/po/Makefile.am new file mode 100644 index 000000000..e69de29bb diff --git a/po/POTFILES b/grub-core/po/POTFILES similarity index 100% rename from po/POTFILES rename to grub-core/po/POTFILES diff --git a/po/POTFILES-shell b/grub-core/po/POTFILES-shell similarity index 100% rename from po/POTFILES-shell rename to grub-core/po/POTFILES-shell diff --git a/po/README b/grub-core/po/README similarity index 100% rename from po/README rename to grub-core/po/README diff --git a/script/execute.c b/grub-core/script/execute.c similarity index 100% rename from script/execute.c rename to grub-core/script/execute.c diff --git a/script/function.c b/grub-core/script/function.c similarity index 100% rename from script/function.c rename to grub-core/script/function.c diff --git a/script/lexer.c b/grub-core/script/lexer.c similarity index 100% rename from script/lexer.c rename to grub-core/script/lexer.c diff --git a/script/main.c b/grub-core/script/main.c similarity index 100% rename from script/main.c rename to grub-core/script/main.c diff --git a/script/parser.y b/grub-core/script/parser.y similarity index 100% rename from script/parser.y rename to grub-core/script/parser.y diff --git a/script/script.c b/grub-core/script/script.c similarity index 100% rename from script/script.c rename to grub-core/script/script.c diff --git a/script/yylex.l b/grub-core/script/yylex.l similarity index 100% rename from script/yylex.l rename to grub-core/script/yylex.l diff --git a/term/at_keyboard.c b/grub-core/term/at_keyboard.c similarity index 100% rename from term/at_keyboard.c rename to grub-core/term/at_keyboard.c diff --git a/term/efi/console.c b/grub-core/term/efi/console.c similarity index 100% rename from term/efi/console.c rename to grub-core/term/efi/console.c diff --git a/term/gfxterm.c b/grub-core/term/gfxterm.c similarity index 100% rename from term/gfxterm.c rename to grub-core/term/gfxterm.c diff --git a/term/i386/pc/console.c b/grub-core/term/i386/pc/console.c similarity index 100% rename from term/i386/pc/console.c rename to grub-core/term/i386/pc/console.c diff --git a/term/i386/pc/vga.c b/grub-core/term/i386/pc/vga.c similarity index 100% rename from term/i386/pc/vga.c rename to grub-core/term/i386/pc/vga.c diff --git a/term/i386/pc/vga_text.c b/grub-core/term/i386/pc/vga_text.c similarity index 100% rename from term/i386/pc/vga_text.c rename to grub-core/term/i386/pc/vga_text.c diff --git a/term/i386/vga_common.c b/grub-core/term/i386/vga_common.c similarity index 100% rename from term/i386/vga_common.c rename to grub-core/term/i386/vga_common.c diff --git a/term/ieee1275/ofconsole.c b/grub-core/term/ieee1275/ofconsole.c similarity index 100% rename from term/ieee1275/ofconsole.c rename to grub-core/term/ieee1275/ofconsole.c diff --git a/term/serial.c b/grub-core/term/serial.c similarity index 100% rename from term/serial.c rename to grub-core/term/serial.c diff --git a/term/terminfo.c b/grub-core/term/terminfo.c similarity index 100% rename from term/terminfo.c rename to grub-core/term/terminfo.c diff --git a/term/tparm.c b/grub-core/term/tparm.c similarity index 100% rename from term/tparm.c rename to grub-core/term/tparm.c diff --git a/term/usb_keyboard.c b/grub-core/term/usb_keyboard.c similarity index 100% rename from term/usb_keyboard.c rename to grub-core/term/usb_keyboard.c diff --git a/tests/example_functional_test.c b/grub-core/tests/example_functional_test.c similarity index 95% rename from tests/example_functional_test.c rename to grub-core/tests/example_functional_test.c index 6802d2d53..525988145 100644 --- a/tests/example_functional_test.c +++ b/grub-core/tests/example_functional_test.c @@ -32,4 +32,4 @@ example_test (void) } /* Register example_test method as a functional test. */ -GRUB_FUNCTIONAL_TEST ("example_functional_test", example_test); +GRUB_FUNCTIONAL_TEST (example_functional_test, example_test); diff --git a/tests/lib/functional_test.c b/grub-core/tests/lib/functional_test.c similarity index 100% rename from tests/lib/functional_test.c rename to grub-core/tests/lib/functional_test.c diff --git a/tests/lib/test.c b/grub-core/tests/lib/test.c similarity index 100% rename from tests/lib/test.c rename to grub-core/tests/lib/test.c diff --git a/video/bitmap.c b/grub-core/video/bitmap.c similarity index 100% rename from video/bitmap.c rename to grub-core/video/bitmap.c diff --git a/video/bitmap_scale.c b/grub-core/video/bitmap_scale.c similarity index 100% rename from video/bitmap_scale.c rename to grub-core/video/bitmap_scale.c diff --git a/video/efi_gop.c b/grub-core/video/efi_gop.c similarity index 100% rename from video/efi_gop.c rename to grub-core/video/efi_gop.c diff --git a/video/efi_uga.c b/grub-core/video/efi_uga.c similarity index 100% rename from video/efi_uga.c rename to grub-core/video/efi_uga.c diff --git a/util/sdl.c b/grub-core/video/emu/sdl.c similarity index 100% rename from util/sdl.c rename to grub-core/video/emu/sdl.c diff --git a/video/fb/fbblit.c b/grub-core/video/fb/fbblit.c similarity index 100% rename from video/fb/fbblit.c rename to grub-core/video/fb/fbblit.c diff --git a/video/fb/fbfill.c b/grub-core/video/fb/fbfill.c similarity index 100% rename from video/fb/fbfill.c rename to grub-core/video/fb/fbfill.c diff --git a/video/fb/fbutil.c b/grub-core/video/fb/fbutil.c similarity index 100% rename from video/fb/fbutil.c rename to grub-core/video/fb/fbutil.c diff --git a/video/fb/video_fb.c b/grub-core/video/fb/video_fb.c similarity index 100% rename from video/fb/video_fb.c rename to grub-core/video/fb/video_fb.c diff --git a/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c similarity index 100% rename from video/i386/pc/vbe.c rename to grub-core/video/i386/pc/vbe.c diff --git a/video/ieee1275.c b/grub-core/video/ieee1275.c similarity index 100% rename from video/ieee1275.c rename to grub-core/video/ieee1275.c diff --git a/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c similarity index 100% rename from video/readers/jpeg.c rename to grub-core/video/readers/jpeg.c diff --git a/video/readers/png.c b/grub-core/video/readers/png.c similarity index 100% rename from video/readers/png.c rename to grub-core/video/readers/png.c diff --git a/video/readers/tga.c b/grub-core/video/readers/tga.c similarity index 100% rename from video/readers/tga.c rename to grub-core/video/readers/tga.c diff --git a/video/sm712.c b/grub-core/video/sm712.c similarity index 100% rename from video/sm712.c rename to grub-core/video/sm712.c diff --git a/video/video.c b/grub-core/video/video.c similarity index 100% rename from video/video.c rename to grub-core/video/video.c diff --git a/modules.def b/modules.def new file mode 100644 index 000000000..4877533ef --- /dev/null +++ b/modules.def @@ -0,0 +1,497 @@ +AutoGen definitions Makefile.tpl; + +library = { + name = libutil.a; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + + nodist = grub_script.tab.c; + nodist = grub_script.yy.c; + nodist = libutil_a_init.c; + + source = grub-core/gnulib/error.c; + source = grub-core/gnulib/fnmatch.c; + source = grub-core/gnulib/getdelim.c; + source = grub-core/gnulib/getline.c; + source = grub-core/gnulib/getopt1.c; + source = grub-core/gnulib/getopt.c; + source = grub-core/gnulib/progname.c; + + source = util/misc.c; + source = grub-core/kern/misc.c; + source = grub-core/kern/emu/misc.c; + source = grub-core/kern/emu/hostfs.c; + source = grub-core/kern/emu/getroot.c; + source = grub-core/kern/emu/hostdisk.c; + + source = grub-core/commands/blocklist.c; + source = grub-core/commands/extcmd.c; + source = grub-core/commands/ls.c; + source = grub-core/disk/dmraid_nvidia.c; + source = grub-core/disk/host.c; + source = grub-core/disk/loopback.c; + source = grub-core/disk/lvm.c; + source = grub-core/disk/mdraid_linux.c; + source = grub-core/disk/raid5_recover.c; + source = grub-core/disk/raid6_recover.c; + source = grub-core/disk/raid.c; + source = grub-core/fs/affs.c; + source = grub-core/fs/afs_be.c; + source = grub-core/fs/afs.c; + source = grub-core/fs/befs_be.c; + source = grub-core/fs/befs.c; + source = grub-core/fs/cpio.c; + source = grub-core/fs/ext2.c; + source = grub-core/fs/fat.c; + source = grub-core/fs/fshelp.c; + source = grub-core/fs/hfs.c; + source = grub-core/fs/hfsplus.c; + source = grub-core/fs/iso9660.c; + source = grub-core/fs/jfs.c; + source = grub-core/fs/minix.c; + source = grub-core/fs/nilfs2.c; + source = grub-core/fs/ntfs.c; + source = grub-core/fs/ntfscomp.c; + source = grub-core/fs/reiserfs.c; + source = grub-core/fs/sfs.c; + source = grub-core/fs/tar.c; + source = grub-core/fs/udf.c; + source = grub-core/fs/ufs2.c; + source = grub-core/fs/ufs.c; + source = grub-core/fs/xfs.c; + source = grub-core/kern/command.c; + source = grub-core/kern/device.c; + source = grub-core/kern/disk.c; + source = grub-core/kern/env.c; + source = grub-core/kern/err.c; + source = grub-core/kern/file.c; + source = grub-core/kern/fs.c; + source = grub-core/kern/handler.c; + source = grub-core/kern/list.c; + source = grub-core/kern/parser.c; + source = grub-core/kern/partition.c; + source = grub-core/lib/arg.c; + source = grub-core/lib/crc.c; + source = grub-core/lib/crypto.c; + source = grub-core/lib/envblk.c; + source = grub-core/lib/hexdump.c; + source = grub-core/lib/libgcrypt-grub/cipher/sha512.c; + source = grub-core/lib/LzFind.c; + source = grub-core/lib/LzmaEnc.c; + source = grub-core/lib/pbkdf2.c; + source = grub-core/normal/datetime.c; + source = grub-core/normal/misc.c; + source = grub-core/partmap/acorn.c; + source = grub-core/partmap/amiga.c; + source = grub-core/partmap/apple.c; + source = grub-core/partmap/gpt.c; + source = grub-core/partmap/msdos.c; + source = grub-core/partmap/sun.c; + source = grub-core/script/function.c; + source = grub-core/script/lexer.c; + source = grub-core/script/main.c; + source = grub-core/script/script.c; + common; +}; + +program = { + name = grub-bin2h; + source = util/bin2h.c; + ldadd = libutil.a; + mansection = 1; + common; +}; + +program = { + name = grub-mkimage; + mansection = 1; + + source = util/grub-mkrawimage.c; + source = util/resolve.c; + + x86_efi = util/i386/efi/grub-mkimage.c; + x86_efi = util/resolve.c; + + ldadd = libutil.a; + + sparc64_ieee1275_cppflags = '-DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + mips_cppflags = '-DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + i386_pc_cppflags = '-DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + i386_qemu_cppflags = '-DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + + i386_pc; i386_qemu; mips; sparc64_ieee1275; +}; + +program = { + name = grub-mkelfimage; + mansection = 1; + source = util/elf/grub-mkimage.c; + source = util/resolve.c; + + ldadd = libutil.a; + common; +}; + +program = { + name = grub-mkisofs; + mansection = 1; + source = util/mkisofs/eltorito.c; + source = util/mkisofs/hash.c; + source = util/mkisofs/joliet.c; + source = util/mkisofs/match.c; + source = util/mkisofs/mkisofs.c; + source = util/mkisofs/multi.c; + source = util/mkisofs/name.c; + source = util/mkisofs/rock.c; + source = util/mkisofs/tree.c; + source = util/mkisofs/write.c; + source = grub-core/gnulib/progname.c; + source = grub-core/gnulib/error.c; + cflags = '$(CFLAGS_MKISOFS)'; + cppflags = '$(CPPFLAGS_MKISOFS)'; + common; +}; + +program = { + name = grub-mkrelpath; + mansection = 1; + + source = util/grub-mkrelpath.c; + + ldadd = libutil.a; + common; +}; + +program = { + name = grub-script-check; + mansection = 1; + + source = util/grub-script-check.c; + + ldadd = libutil.a; + common; +}; + +program = { + name = grub-editenv; + mansection = 1; + + source = util/grub-editenv.c; + + ldadd = libutil.a; + common; +}; + +program = { + name = grub-mkpasswd-pbkdf2; + mansection = 1; + + source = util/grub-mkpasswd-pbkdf2.c; + + ldadd = libutil.a; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + common; +}; + +program = { + name = grub-macho2img; + mansection = 1; + source = util/grub-macho2img.c; +}; + +program = { + name = grub-pe2elf; + mansection = 1; + source = util/grub-pe2elf.c; + + ldadd = libutil.a; +}; + +program = { + name = grub-fstest; + mansection = 1; + source = util/grub-fstest.c; + + ldadd = libutil.a; + enable = COND_GRUB_FSTEST; + common; +}; + +program = { + name = grub-mkfont; + mansection = 1; + source = util/grub-mkfont.c; + + ldadd = libutil.a; + cflags = '$(freetype_cflags)'; + ldflags = '$(freetype_libs)'; + common; + enable = COND_GRUB_MKFONT; +}; + +program = { + name = grub-mkdevicemap; + installdir = sbin; + mansection = 8; + source = util/grub-mkdevicemap.c; + source = util/deviceiter.c; + source = util/devicemap.c; + + sparc64_ieee1275 = util/grub-mkdevicemap.c; + sparc64_ieee1275 = util/deviceiter.c; + sparc64_ieee1275 = util/ieee1275/ofpath.c; + sparc64_ieee1275 = util/ieee1275/devicemap.c; + + ldadd = libutil.a; + common; +}; + +program = { + name = grub-probe; + installdir = sbin; + mansection = 8; + source = util/grub-probe.c; + + ldadd = libutil.a; + common; +}; + +program = { + name = grub-setup; + installdir = sbin; + mansection = 8; + i386_pc = util/i386/pc/grub-setup.c; + i386_pc = util/raid.c; + i386_pc = util/lvm.c; + + sparc64_ieee1275 = util/ieee1275/ofpath.c; + sparc64_ieee1275 = util/sparc64/ieee1275/grub-setup.c; + sparc64_ieee1275 = util/raid.c; + sparc64_ieee1275 = util/lvm.c; + + ldadd = libutil.a; +}; + +program = { + name = grub-ofpathname; + installdir = sbin; + source = util/ieee1275/grub-ofpathname.c; + source = util/ieee1275/ofpath.c; + + ldadd = libutil.a; + sparc64_ieee1275; +}; + +data = { + source = util/grub.d/README; + installdir = grubconf; + common; +}; + +script = { + name = '00_header'; + source = util/grub.d/00_header.in; + installdir = grubconf; + common; +}; + +script = { + name = '10_windows'; + source = util/grub.d/10_windows.in; + installdir = grubconf; +}; + +script = { + name = '10_hurd'; + source = util/grub.d/10_hurd.in; + installdir = grubconf; +}; + +script = { + name = '10_linux'; + source = util/grub.d/10_linux.in; + installdir = grubconf; + common; +}; + +script = { + name = '30_os-prober'; + source = util/grub.d/30_os-prober.in; + installdir = grubconf; + common; +}; + +script = { + name = '40_custom'; + source = util/grub.d/40_custom.in; + installdir = grubconf; + common; +}; + +script = { + mansection = 1; + name = grub-mkrescue; + source = util/grub-mkrescue.in; + powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in; + i386_pc; + i386_qemu; + i386_coreboot; +}; + +script = { + mansection = 8; + installdir = sbin; + name = grub-install; + source = util/grub-install.in; + x86_efi = util/i386/efi/grub-install.in; + i386_ieee1275 = util/ieee1275/grub-install.in; + powerpc_ieee1275 = util/ieee1275/grub-install.in; + mips; + i386_pc; + i386_qemu; + i386_coreboot; +}; + +script = { + name = grub-mkconfig; + source = util/grub-mkconfig.in; + mansection = 8; + installdir = sbin; + common; +}; + +script = { + name = grub-set-default; + source = util/grub-set-default.in; + mansection = 8; + installdir = sbin; + common; +}; + +script = { + name = grub-reboot; + source = util/grub-reboot.in; + mansection = 8; + installdir = sbin; + common; +}; + +script = { + name = grub-mkconfig_lib; + source = util/grub-mkconfig_lib.in; + installdir = pkglib; + common; +}; + +script = { + name = update-grub_lib; + source = util/update-grub_lib.in; + installdir = pkglib; + common; +}; + +test_script = { + name = grub-shell; + source = tests/util/grub-shell.in; + common; +}; + +test_script = { + name = grub-shell-tester; + source = tests/util/grub-shell-tester.in; + common; +}; + +test_script = { + name = example_scripted_test; + source = tests/example_scripted_test.in; + common; +}; + +test_script = { + name = example_grub_script_test; + source = tests/example_grub_script_test.in; + common; +}; + +test_script = { + name = grub_script_echo1; + source = tests/grub_script_echo1.in; + common; + enable; +}; + +test_script = { + name = grub_script_echo_keywords; + source = tests/grub_script_echo_keywords.in; + common; + enable; +}; + +test_script = { + name = grub_script_vars1; + source = tests/grub_script_vars1.in; + common; + enable; +}; + +test_script = { + name = grub_script_for1; + source = tests/grub_script_for1.in; + common; + enable; +}; + +test_script = { + name = grub_script_while1; + source = tests/grub_script_while1.in; + common; + enable; +}; + +test_script = { + name = grub_script_if; + source = tests/grub_script_if.in; + common; + enable; +}; + +test_script = { + name = grub_script_blanklines; + source = tests/grub_script_blanklines.in; + common; + enable; +}; + +test_script = { + name = grub_script_final_semicolon; + source = tests/grub_script_final_semicolon.in; + common; + enable; +}; + +test_script = { + name = grub_script_dollar; + source = tests/grub_script_dollar.in; + common; + enable; +}; + +test_script = { + name = grub_script_comments; + source = tests/grub_script_comments.in; + common; + enable; +}; + +test_program = { + name = example_unit_test; + source = tests/example_unit_test.c; + source = tests/lib/unit_test.c; + source = grub-core/kern/list.c; + source = grub-core/kern/misc.c; + source = grub-core/tests/lib/test.c; + cflags = -Wno-format; + common; +}; diff --git a/po/Makefile.am b/po/Makefile.am new file mode 100644 index 000000000..e69de29bb diff --git a/tests/example_grub_script_test.in b/tests/example_grub_script_test.in index 93a90a18e..6fa3dc98a 100644 --- a/tests/example_grub_script_test.in +++ b/tests/example_grub_script_test.in @@ -1,3 +1,3 @@ -#! @builddir@/grub-shell-tester --modules=echo +#! @abs_top_builddir@/grub-shell-tester --modules=echo echo "hello world" diff --git a/tests/lib/unit_test.c b/tests/lib/unit_test.c index e461150de..92c8ae33a 100644 --- a/tests/lib/unit_test.c +++ b/tests/lib/unit_test.c @@ -105,5 +105,4 @@ grub_exit (void) exit (1); } -struct grub_handler_class grub_term_input_class; -struct grub_handler_class grub_term_output_class; +struct grub_term_input *grub_term_inputs; diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in index e9507c8f5..f1e91f561 100644 --- a/tests/util/grub-shell-tester.in +++ b/tests/util/grub-shell-tester.in @@ -91,7 +91,7 @@ if [ "x${source}" = x ] ; then fi outfile1=`mktemp` -@builddir@/grub-shell --qemu-opts="${qemuopts}" --modules=${modules} ${source} >${outfile1} +@abs_top_builddir@/grub-shell --qemu-opts="${qemuopts}" --modules=${modules} ${source} >${outfile1} outfile2=`mktemp` bash ${source} >${outfile2} diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index a41a6f6f4..8324beb97 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -123,10 +123,14 @@ source /boot/grub/testcase.cfg halt EOF +rootdir=`mktemp -d` +(cd @abs_top_builddir@ && make DESTDIR=$rootdir install) >/dev/null 2>&1 + isofile=`mktemp` -grub-mkrescue --output=${isofile} --override-directory=${builddir} \ - /boot/grub/grub.cfg=${cfgfile} /boot/grub/testcase.cfg=${source} \ - >/dev/null 2>&1 +sh @abs_top_builddir@/grub-mkrescue --output=${isofile} \ + --root-directory=${rootdir} /boot/grub/grub.cfg=${cfgfile} \ + /boot/grub/testcase.cfg=${source} >/dev/null 2>&1 +rm -rf $rootdir hdafile=`mktemp` cp ${isofile} ${hdafile} diff --git a/util/elf/grub-mkimage.c b/util/elf/grub-mkimage.c index 04a19bc4e..fa9b202eb 100644 --- a/util/elf/grub-mkimage.c +++ b/util/elf/grub-mkimage.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/util/grub-editenv.c b/util/grub-editenv.c index f21042c97..24c36329c 100644 --- a/util/grub-editenv.c +++ b/util/grub-editenv.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -34,24 +35,6 @@ #define DEFAULT_ENVBLK_SIZE 1024 -void -grub_putchar (int c) -{ - putchar (c); -} - -void -grub_refresh (void) -{ - fflush (stdout); -} - -int -grub_getkey (void) -{ - return 0; -} - char * grub_env_get (const char *name __attribute__ ((unused))) { diff --git a/util/grub-fstest.c b/util/grub-fstest.c index c03c43451..9ac5cf550 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -33,8 +34,6 @@ #include #include -#include - #include #include #include @@ -43,27 +42,6 @@ #include "progname.h" -void -grub_putchar (int c) -{ - putchar (c); -} - -int -grub_getkey (void) -{ - return -1; -} - -struct grub_handler_class grub_term_input_class; -struct grub_handler_class grub_term_output_class; - -void -grub_refresh (void) -{ - fflush (stdout); -} - static grub_err_t execute_command (char *name, int n, char **args) { diff --git a/util/grub-mkdevicemap.c b/util/grub-mkdevicemap.c index c68482af1..d534ff9ef 100644 --- a/util/grub-mkdevicemap.c +++ b/util/grub-mkdevicemap.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include diff --git a/util/grub-mkfont.c b/util/grub-mkfont.c index 51e2e494c..30dd96a21 100644 --- a/util/grub-mkfont.c +++ b/util/grub-mkfont.c @@ -18,6 +18,8 @@ #include #include +#include +#include #include #include #include diff --git a/util/grub-mkpasswd-pbkdf2.c b/util/grub-mkpasswd-pbkdf2.c index a00b1e990..4a218bc82 100644 --- a/util/grub-mkpasswd-pbkdf2.c +++ b/util/grub-mkpasswd-pbkdf2.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -30,37 +31,6 @@ #include "progname.h" -/* Few functions to make crypto happy. */ -void * -grub_memmove (void *dest, const void *src, grub_size_t n) -{ - return memmove (dest, src, n); -} - -void * -grub_memset (void *s, int c, grub_size_t n) -{ - return memset (s, c, n); -} - -int -grub_vprintf (const char *fmt, va_list args) -{ - return vprintf (fmt, args); -} - -int -grub_vsnprintf (char *str, grub_size_t n, const char *fmt, va_list args) -{ - return vsnprintf (str, n, fmt, args); -} - -void -grub_abort (void) -{ - abort (); -} - static struct option options[] = { {"iteration_count", required_argument, 0, 'c'}, diff --git a/util/grub-mkrawimage.c b/util/grub-mkrawimage.c index 20a344d04..ff3b9df83 100644 --- a/util/grub-mkrawimage.c +++ b/util/grub-mkrawimage.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/util/grub-mkrelpath.c b/util/grub-mkrelpath.c index 327f0c866..4e9d0ed63 100644 --- a/util/grub-mkrelpath.c +++ b/util/grub-mkrelpath.c @@ -18,6 +18,7 @@ */ #include +#include #include #include @@ -97,7 +98,7 @@ main (int argc, char *argv[]) argument = argv[optind]; - relpath = make_system_path_relative_to_its_root (argument); + relpath = grub_make_system_path_relative_to_its_root (argument); printf ("%s\n", relpath); free (relpath); diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 44e80b106..2fdb58114 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -1,7 +1,7 @@ #! /bin/sh -e # Make GRUB rescue image -# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 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 # it under the terms of the GNU General Public License as published by @@ -28,8 +28,11 @@ PACKAGE_TARNAME=@PACKAGE_TARNAME@ PACKAGE_VERSION=@PACKAGE_VERSION@ target_cpu=@target_cpu@ native_platform=@platform@ -pkglib_DATA="@pkglib_DATA@" +pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst" +mkimage=${bindir}/grub-mkimage +mkisofs=${bindir}/grub-mkisofs +mkelfimage=${bindir}/grub-mkelfimage multiboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-multiboot pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc @@ -70,6 +73,8 @@ for option in "$@"; do PATH=${override_dir}:$PATH export PATH ;; + --root-directory=*) + rootdir=`echo "${option}/" | sed 's/--root-directory=//'` ;; -*) echo "Unrecognized option \`$option'" 1>&2 usage @@ -121,6 +126,14 @@ process_input_dir () done } +if [ "${rootdir}" != "" ] ; then + coreboot_dir="${rootdir}/${coreboot_dir}" + pc_dir="${rootdir}/${pc_dir}" + mkimage="${rootdir}/${mkimage}" + mkisofs="${rootdir}/${mkisofs}" + mkelfimage="${rootdir}/${mkelfimage}" +fi + if [ "${override_dir}" = "" ] ; then if test -e "${multiboot_dir}" ; then process_input_dir ${multiboot_dir} multiboot @@ -160,7 +173,7 @@ EOF tar -C ${memdisk_dir} -cf ${memdisk_img} boot rm -rf ${memdisk_dir} - grub-mkelfimage -d ${multiboot_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \ + ${mkelfimage} -d ${multiboot_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \ memdisk tar search iso9660 configfile sh \ ata at_keyboard rm -f ${memdisk_img} @@ -171,7 +184,7 @@ fi if test -e "${pc_dir}" ; then echo "Enabling BIOS support ..." core_img=`mktemp "$MKTEMP_TEMPLATE"` - grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \ + ${mkimage} -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \ iso9660 biosdisk cat ${pc_dir}/cdboot.img ${core_img} > ${iso9660_dir}/boot/grub/i386-pc/eltorito.img @@ -192,7 +205,7 @@ if test -e "${pc_dir}" ; then fi # build iso image -grub-mkisofs ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} ${source} +${mkisofs} ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} ${source} rm -rf ${iso9660_dir} rm -f ${embed_img} diff --git a/util/grub-probe.c b/util/grub-probe.c index bb41480e2..0cc35d4c5 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -26,15 +27,13 @@ #include #include #include -#include -#include +#include +#include #include #include #include #include -#include - #include #include #include @@ -58,27 +57,6 @@ enum { int print = PRINT_FS; static unsigned int argument_is_device = 0; -void -grub_putchar (int c) -{ - putchar (c); -} - -int -grub_getkey (void) -{ - return -1; -} - -struct grub_handler_class grub_term_input_class; -struct grub_handler_class grub_term_output_class; - -void -grub_refresh (void) -{ - fflush (stdout); -} - static void probe_partmap (grub_disk_t disk) { @@ -261,7 +239,7 @@ probe (const char *path, char *device_name) grub_util_info ("reading %s via OS facilities", path); filebuf_via_sys = grub_util_read_image (path); - rel_path = make_system_path_relative_to_its_root (path); + rel_path = grub_make_system_path_relative_to_its_root (path); grub_path = xasprintf ("(%s)%s", drive_name, rel_path); free (rel_path); grub_util_info ("reading %s via GRUB facilities", grub_path); diff --git a/util/grub-script-check.c b/util/grub-script-check.c index dc732aa01..fa2459306 100644 --- a/util/grub-script-check.c +++ b/util/grub-script-check.c @@ -21,13 +21,12 @@ #include #include #include +#include #include #include #include #include -#include - #define _GNU_SOURCE 1 #include @@ -39,75 +38,6 @@ #include "progname.h" -void -grub_putchar (int c) -{ - putchar (c); -} - -int -grub_getkey (void) -{ - return -1; -} - -void -grub_refresh (void) -{ - fflush (stdout); -} - -char * -grub_script_execute_argument_to_string (struct grub_script_arg *arg __attribute__ ((unused))) -{ - return 0; -} - -grub_err_t -grub_script_execute_cmdline (struct grub_script_cmd *cmd __attribute__ ((unused))) -{ - return 0; -} - -grub_err_t -grub_script_execute_cmdblock (struct grub_script_cmd *cmd __attribute__ ((unused))) -{ - return 0; -} - -grub_err_t -grub_script_execute_cmdif (struct grub_script_cmd *cmd __attribute__ ((unused))) -{ - return 0; -} - -grub_err_t -grub_script_execute_cmdfor (struct grub_script_cmd *cmd __attribute__ ((unused))) -{ - return 0; -} - -grub_err_t -grub_script_execute_cmdwhile (struct grub_script_cmd *cmd __attribute__ ((unused))) -{ - return 0; -} - -grub_err_t -grub_script_execute_menuentry (struct grub_script_cmd *cmd __attribute__ ((unused))) -{ - return 0; -} - -grub_err_t -grub_script_execute (struct grub_script *script) -{ - if (script == 0 || script->cmd == 0) - return 0; - - return script->cmd->exec (script->cmd); -} - static struct option options[] = { {"help", no_argument, 0, 'h'}, @@ -145,7 +75,7 @@ main (int argc, char *argv[]) char *input; FILE *file = 0; int verbose = 0; - struct grub_script *script; + struct grub_script *script = 0; auto grub_err_t get_config_line (char **line, int cont); grub_err_t get_config_line (char **line, int cont __attribute__ ((unused))) diff --git a/util/i386/efi/grub-mkimage.c b/util/i386/efi/grub-mkimage.c index f8c0f152e..57fba9168 100644 --- a/util/i386/efi/grub-mkimage.c +++ b/util/i386/efi/grub-mkimage.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/util/i386/pc/grub-setup.c b/util/i386/pc/grub-setup.c index 63fa8c328..66d45620c 100644 --- a/util/i386/pc/grub-setup.c +++ b/util/i386/pc/grub-setup.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -28,19 +29,17 @@ #include #include #include -#include +#include #include #include #include #include #include #include -#include +#include static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_PARTITION_TYPE_BIOS_BOOT; -#include - #include #include #include @@ -57,27 +56,6 @@ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_P #define DEFAULT_BOOT_FILE "boot.img" #define DEFAULT_CORE_FILE "core.img" -void -grub_putchar (int c) -{ - putchar (c); -} - -int -grub_getkey (void) -{ - return -1; -} - -struct grub_handler_class grub_term_input_class; -struct grub_handler_class grub_term_output_class; - -void -grub_refresh (void) -{ - fflush (stdout); -} - static void setup (const char *dir, const char *boot_file, const char *core_file, @@ -423,7 +401,7 @@ unable_to_embed: /* Make sure that GRUB reads the identical image as the OS. */ tmp_img = xmalloc (core_size); core_path_dev_full = grub_util_get_path (dir, core_file); - core_path_dev = make_system_path_relative_to_its_root (core_path_dev_full); + core_path_dev = grub_make_system_path_relative_to_its_root (core_path_dev_full); free (core_path_dev_full); /* It is a Good Thing to sync two times. */ diff --git a/util/lvm.c b/util/lvm.c index 0a0916344..bb2c19fe3 100644 --- a/util/lvm.c +++ b/util/lvm.c @@ -19,7 +19,7 @@ /* We only support LVM on Linux. */ #ifdef __linux__ - +#include #include #include diff --git a/util/misc.c b/util/misc.c index f9d860d9a..a7d555092 100644 --- a/util/misc.c +++ b/util/misc.c @@ -38,11 +38,13 @@ #include #include #include +#include #include #include #include #include #include +#include #define ENABLE_RELOCATABLE 0 #include "progname.h" @@ -63,53 +65,6 @@ #include #endif -int verbosity = 0; - -void -grub_util_warn (const char *fmt, ...) -{ - va_list ap; - - fprintf (stderr, _("%s: warn:"), program_name); - fprintf (stderr, " "); - va_start (ap, fmt); - vfprintf (stderr, fmt, ap); - va_end (ap); - fprintf (stderr, ".\n"); - fflush (stderr); -} - -void -grub_util_info (const char *fmt, ...) -{ - if (verbosity > 0) - { - va_list ap; - - fprintf (stderr, _("%s: info:"), program_name); - fprintf (stderr, " "); - va_start (ap, fmt); - vfprintf (stderr, fmt, ap); - va_end (ap); - fprintf (stderr, ".\n"); - fflush (stderr); - } -} - -void -grub_util_error (const char *fmt, ...) -{ - va_list ap; - - fprintf (stderr, _("%s: error:"), program_name); - fprintf (stderr, " "); - va_start (ap, fmt); - vfprintf (stderr, fmt, ap); - va_end (ap); - fprintf (stderr, ".\n"); - exit (1); -} - #ifdef GRUB_UTIL int grub_err_printf (const char *fmt, ...) @@ -125,41 +80,6 @@ grub_err_printf (const char *fmt, ...) } #endif -void * -xmalloc (size_t size) -{ - void *p; - - p = malloc (size); - if (! p) - grub_util_error ("out of memory"); - - return p; -} - -void * -xrealloc (void *ptr, size_t size) -{ - ptr = realloc (ptr, size); - if (! ptr) - grub_util_error ("out of memory"); - - return ptr; -} - -char * -xstrdup (const char *str) -{ - size_t len; - char *newstr; - - len = strlen (str); - newstr = (char *) xmalloc (len + 1); - memcpy (newstr, str, len + 1); - - return newstr; -} - char * grub_util_get_path (const char *dir, const char *file) { @@ -268,6 +188,89 @@ grub_util_write_image (const char *img, size_t size, FILE *out) grub_util_error ("write failed"); } +char * +grub_script_execute_argument_to_string (struct grub_script_arg *arg __attribute__ ((unused))) +{ + return 0; +} + +grub_err_t +grub_script_execute_cmdline (struct grub_script_cmd *cmd __attribute__ ((unused))) +{ + return 0; +} + +grub_err_t +grub_script_execute_cmdblock (struct grub_script_cmd *cmd __attribute__ ((unused))) +{ + return 0; +} + +grub_err_t +grub_script_execute_cmdif (struct grub_script_cmd *cmd __attribute__ ((unused))) +{ + return 0; +} + +grub_err_t +grub_script_execute_cmdfor (struct grub_script_cmd *cmd __attribute__ ((unused))) +{ + return 0; +} + +grub_err_t +grub_script_execute_cmdwhile (struct grub_script_cmd *cmd __attribute__ ((unused))) +{ + return 0; +} + +grub_err_t +grub_script_execute_menuentry (struct grub_script_cmd *cmd __attribute__ ((unused))) +{ + return 0; +} + +grub_err_t +grub_script_execute (struct grub_script *script) +{ + if (script == 0 || script->cmd == 0) + return 0; + + return script->cmd->exec (script->cmd); +} + +void +grub_putchar (int c) +{ + putchar (c); +} + +int +grub_getkey (void) +{ + return -1; +} + +void +grub_refresh (void) +{ + fflush (stdout); +} + +int +grub_dl_ref (grub_dl_t mod) +{ + (void) mod; + return 0; +} + +int +grub_dl_unref (grub_dl_t mod) +{ + (void) mod; + return 0; +} + /* Some functions that we don't use. */ void grub_mm_init_region (void *addr __attribute__ ((unused)), @@ -275,64 +278,7 @@ grub_mm_init_region (void *addr __attribute__ ((unused)), { } -#if GRUB_NO_MODULES -void -grub_register_exported_symbols (void) -{ -} -#endif - -void -grub_exit (void) -{ - exit (1); -} - -grub_uint32_t -grub_get_rtc (void) -{ - struct timeval tv; - - gettimeofday (&tv, 0); - - return (tv.tv_sec * GRUB_TICKS_PER_SECOND - + (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec) - * GRUB_TICKS_PER_SECOND / 1000000)); -} - -grub_uint64_t -grub_get_time_ms (void) -{ - struct timeval tv; - - gettimeofday (&tv, 0); - - return (tv.tv_sec * 1000 + tv.tv_usec / 1000); -} - -#ifdef __MINGW32__ - -void -grub_millisleep (grub_uint32_t ms) -{ - Sleep (ms); -} - -#else - -void -grub_millisleep (grub_uint32_t ms) -{ - struct timespec ts; - - ts.tv_sec = ms / 1000; - ts.tv_nsec = (ms % 1000) * 1000000; - nanosleep (&ts, NULL); -} - -#endif - -#if !(defined (__i386__) || defined (__x86_64__)) && GRUB_NO_MODULES +#if !(defined (__i386__) || defined (__x86_64__)) void grub_arch_sync_caches (void *address __attribute__ ((unused)), grub_size_t len __attribute__ ((unused))) @@ -340,19 +286,6 @@ grub_arch_sync_caches (void *address __attribute__ ((unused)), } #endif -#ifndef HAVE_VASPRINTF - -int -vasprintf (char **buf, const char *fmt, va_list ap) -{ - /* Should be large enough. */ - *buf = xmalloc (512); - - return vsprintf (*buf, fmt, ap); -} - -#endif - #ifndef HAVE_ASPRINTF int @@ -370,23 +303,6 @@ asprintf (char **buf, const char *fmt, ...) #endif -char * -xasprintf (const char *fmt, ...) -{ - va_list ap; - char *result; - - va_start (ap, fmt); - if (vasprintf (&result, fmt, ap) < 0) - { - if (errno == ENOMEM) - grub_util_error ("out of memory"); - return NULL; - } - - return result; -} - #ifdef __MINGW32__ void sync (void) @@ -482,104 +398,6 @@ get_win32_path (const char *path) } #endif -/* This function never prints trailing slashes (so that its output - can be appended a slash unconditionally). */ -char * -make_system_path_relative_to_its_root (const char *path) -{ - struct stat st; - char *p, *buf, *buf2, *buf3; - uintptr_t offset = 0; - dev_t num; - size_t len; - - /* canonicalize. */ - p = canonicalize_file_name (path); - - if (p == NULL) - grub_util_error ("failed to get canonical path of %s", path); - - len = strlen (p) + 1; - buf = xstrdup (p); - free (p); - - if (stat (buf, &st) < 0) - grub_util_error ("cannot stat %s: %s", buf, strerror (errno)); - - buf2 = xstrdup (buf); - num = st.st_dev; - - /* This loop sets offset to the number of chars of the root - directory we're inspecting. */ - while (1) - { - p = strrchr (buf, '/'); - if (p == NULL) - /* This should never happen. */ - grub_util_error ("FIXME: no / in buf. (make_system_path_relative_to_its_root)"); - if (p != buf) - *p = 0; - else - *++p = 0; - - if (stat (buf, &st) < 0) - grub_util_error ("cannot stat %s: %s", buf, strerror (errno)); - - /* buf is another filesystem; we found it. */ - if (st.st_dev != num) - { - /* offset == 0 means path given is the mount point. - This works around special-casing of "/" in Un*x. This function never - prints trailing slashes (so that its output can be appended a slash - unconditionally). Each slash in is considered a preceding slash, and - therefore the root directory is an empty string. */ - if (offset == 0) - { - free (buf); - free (buf2); - return xstrdup (""); - } - else - break; - } - - offset = p - buf; - /* offset == 1 means root directory. */ - if (offset == 1) - { - /* Include leading slash. */ - offset = 0; - break; - } - } - free (buf); - buf3 = xstrdup (buf2 + offset); - free (buf2); - -#ifdef __CYGWIN__ - if (st.st_dev != (DEV_CYGDRIVE_MAJOR << 16)) - { - /* Reached some mount point not below /cygdrive. - GRUB does not know Cygwin's emulated mounts, - convert to Win32 path. */ - grub_util_info ("Cygwin path = %s\n", buf3); - char * temp = get_win32_path (buf3); - free (buf3); - buf3 = temp; - } -#endif - - /* Remove trailing slashes, return empty string if root directory. */ - len = strlen (buf3); - while (len > 0 && buf3[len - 1] == '/') - { - buf3[len - 1] = '\0'; - len--; - } - - return buf3; -} - #ifdef GRUB_UTIL void grub_util_init_nls (void) diff --git a/util/raid.c b/util/raid.c index ec3ecd26e..edf865aa7 100644 --- a/util/raid.c +++ b/util/raid.c @@ -19,6 +19,7 @@ /* We only support RAID on Linux. */ #ifdef __linux__ +#include #include #include diff --git a/util/resolve.c b/util/resolve.c index 8b33beba0..7eadffd38 100644 --- a/util/resolve.c +++ b/util/resolve.c @@ -21,8 +21,9 @@ #include #include -#include +#include #include +#include /* Module. */ struct mod_list diff --git a/util/sparc64/ieee1275/grub-setup.c b/util/sparc64/ieee1275/grub-setup.c index 06bc16795..7051fd078 100644 --- a/util/sparc64/ieee1275/grub-setup.c +++ b/util/sparc64/ieee1275/grub-setup.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -29,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -37,8 +38,6 @@ #include #include -#include - #include #include #include @@ -46,7 +45,7 @@ #include #include #include -#include +#include #define _GNU_SOURCE 1 #include @@ -83,27 +82,6 @@ struct boot_blocklist grub_uint32_t len; } __attribute__ ((packed)); -void -grub_putchar (int c) -{ - putchar (c); -} - -int -grub_getkey (void) -{ - return -1; -} - -struct grub_handler_class grub_term_input_class; -struct grub_handler_class grub_term_output_class; - -void -grub_refresh (void) -{ - fflush (stdout); -} - static void setup (const char *prefix, const char *dir, const char *boot_file, const char *core_file, @@ -627,8 +605,8 @@ main (int argc, char *argv[]) find_dest_dev (&ginfo, argv); - ginfo.prefix = make_system_path_relative_to_its_root (ginfo.dir ? - : DEFAULT_DIRECTORY); + ginfo.prefix = grub_make_system_path_relative_to_its_root (ginfo.dir ? + : DEFAULT_DIRECTORY); check_root_dev (&ginfo); From 7ad9681655c4203a2a38e5a0b97ae7d654b1f609 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 6 May 2010 11:38:35 +0530 Subject: [PATCH 006/174] add missing files --- kern/emu/cache.S | 19 ++++++++++++++++++ kern/emu/dl.c | 19 ++++++++++++++++++ kern/emu/full.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ kern/emu/lite.c | 42 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 130 insertions(+) create mode 100644 kern/emu/cache.S create mode 100644 kern/emu/dl.c create mode 100644 kern/emu/full.c create mode 100644 kern/emu/lite.c diff --git a/kern/emu/cache.S b/kern/emu/cache.S new file mode 100644 index 000000000..9975578b8 --- /dev/null +++ b/kern/emu/cache.S @@ -0,0 +1,19 @@ +#ifndef GRUB_MACHINE_EMU +#error "This source is only meant for grub-emu platform" +#endif + +#if defined(GRUB_CPU_I386) +/* Nothing is necessary. */ +#elif defined(GRUB_CPU_X86_64) +/* Nothing is necessary. */ +#elif defined(GRUB_CPU_SPARC64) +#include "../sparc64/cache.S" +#elif defined(GRUB_CPU_MIPS) +#include "../mips/cache.S" +#elif defined(GRUB_CPU_MIPSEL) +#include "../mips/cache.S" +#elif defined(GRUB_CPU_POWERPC) +#include "../powerpc/cache.S" +#else +#error "No target cpu type is defined" +#endif diff --git a/kern/emu/dl.c b/kern/emu/dl.c new file mode 100644 index 000000000..09e2f4a7a --- /dev/null +++ b/kern/emu/dl.c @@ -0,0 +1,19 @@ +#ifndef GRUB_MACHINE_EMU +#error "This source is only meant for grub-emu platform" +#endif + +#if defined(GRUB_CPU_I386) +#include "../i386/dl.c" +#elif defined(GRUB_CPU_X86_64) +#include "../x86_64/dl.c" +#elif defined(GRUB_CPU_SPARC64) +#include "../sparc64/dl.c" +#elif defined(GRUB_CPU_MIPS) +#include "../mips/dl.c" +#elif defined(GRUB_CPU_MIPSEL) +#include "../mips/dl.c" +#elif defined(GRUB_CPU_POWERPC) +#include "../powerpc/dl.c" +#else +#error "No target cpu type is defined" +#endif diff --git a/kern/emu/full.c b/kern/emu/full.c new file mode 100644 index 000000000..0bd33337f --- /dev/null +++ b/kern/emu/full.c @@ -0,0 +1,50 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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 . + */ + +#include +#include +#include +#include +#include +#include + +void +grub_register_exported_symbols (void) +{ +} + +grub_err_t +grub_arch_dl_check_header (void *ehdr) +{ + (void) ehdr; + return GRUB_ERR_BAD_MODULE; +} + +grub_err_t +grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) +{ + (void) mod; + (void) ehdr; + return GRUB_ERR_BAD_MODULE; +} + +void +grub_emu_init (void) +{ + grub_no_autoload = 1; +} diff --git a/kern/emu/lite.c b/kern/emu/lite.c new file mode 100644 index 000000000..884ddee10 --- /dev/null +++ b/kern/emu/lite.c @@ -0,0 +1,42 @@ +#include +#include + +#ifndef GRUB_MACHINE_EMU +#error "This source is only meant for grub-emu platform" +#endif + +#if defined(GRUB_CPU_I386) +#include "../i386/dl.c" +#elif defined(GRUB_CPU_X86_64) +#include "../x86_64/dl.c" +#elif defined(GRUB_CPU_SPARC64) +#include "../sparc64/dl.c" +#elif defined(GRUB_CPU_MIPS) +#include "../mips/dl.c" +#elif defined(GRUB_CPU_MIPSEL) +#include "../mips/dl.c" +#elif defined(GRUB_CPU_POWERPC) +#include "../powerpc/dl.c" +#else +#error "No target cpu type is defined" +#endif + +/* grub-emu-lite supports dynamic module loading, so it won't have any + embedded modules. */ +void +grub_init_all (void) +{ + return; +} + +void +grub_fini_all (void) +{ + return; +} + +void +grub_emu_init (void) +{ + return; +} From e9efa0fe368d21bd6bc6eed7b8427341dbe5de71 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 7 May 2010 10:08:09 +0530 Subject: [PATCH 007/174] shift command support --- conf/common.rmk | 2 +- conf/tests.rmk | 4 +++ include/grub/script_sh.h | 5 +++ script/execute.c | 33 ++++++++++++++++-- script/main.c | 3 ++ tests/grub_script_shift.in | 69 ++++++++++++++++++++++++++++++++++++++ util/grub-script-check.c | 8 +++++ 7 files changed, 121 insertions(+), 3 deletions(-) create mode 100644 tests/grub_script_shift.in diff --git a/conf/common.rmk b/conf/common.rmk index 4b39e9b71..01f15dc59 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -106,7 +106,7 @@ 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/handler.c kern/err.c kern/parser.c kern/list.c kern/command.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) diff --git a/conf/tests.rmk b/conf/tests.rmk index 9144e5528..9cda007db 100644 --- a/conf/tests.rmk +++ b/conf/tests.rmk @@ -74,6 +74,9 @@ grub_script_comments_SOURCES = tests/grub_script_comments.in check_SCRIPTS += grub_script_functions grub_script_functions_SOURCES = tests/grub_script_functions.in +check_SCRIPTS += grub_script_shift +grub_script_shift_SOURCES = tests/grub_script_shift.in + # List of tests to execute on "make check" # SCRIPTED_TESTS = example_scripted_test # SCRIPTED_TESTS += example_grub_script_test @@ -91,6 +94,7 @@ SCRIPTED_TESTS += grub_script_final_semicolon SCRIPTED_TESTS += grub_script_dollar SCRIPTED_TESTS += grub_script_comments SCRIPTED_TESTS += grub_script_functions +SCRIPTED_TESTS += grub_script_shift # dependencies between tests and testing-tools $(SCRIPTED_TESTS): grub-shell grub-shell-tester diff --git a/include/grub/script_sh.h b/include/grub/script_sh.h index 730aa3005..8610348f6 100644 --- a/include/grub/script_sh.h +++ b/include/grub/script_sh.h @@ -23,6 +23,7 @@ #include #include #include +#include struct grub_script_mem; @@ -80,6 +81,7 @@ struct grub_script_scope char **args; unsigned int argc; + unsigned int shift; }; /* A single command line. */ @@ -308,6 +310,9 @@ grub_err_t grub_script_execute_menuentry (struct grub_script_cmd *cmd); /* Execute any GRUB pre-parsed command or script. */ grub_err_t grub_script_execute (struct grub_script *script); +/* SHIFT command for GRUB script. */ +grub_err_t grub_script_cmd_shift (grub_command_t cmd, int argc, char *argv[]); + /* This variable points to the parsed command. This is used to communicate with the bison code. */ extern struct grub_script_cmd *grub_script_parsed; diff --git a/script/execute.c b/script/execute.c index 571b6785b..d3f8e9b25 100644 --- a/script/execute.c +++ b/script/execute.c @@ -32,6 +32,31 @@ static struct grub_script_scope *scope = 0; +grub_err_t +grub_script_cmd_shift (grub_command_t cmd __attribute__((unused)), + int argc, char *argv[]) +{ + char *p = 0; + unsigned long n = 0; + + if (! scope) + return GRUB_ERR_NONE; + + if (argc == 0) + n = 1; + else if (argc > 1) + return GRUB_ERR_BAD_ARGUMENT; + else + { + n = grub_strtoul (argv[0], &p, 10); + if (*p != '\0') + return GRUB_ERR_BAD_ARGUMENT; + } + + scope->shift = (unsigned int)(n > scope->argc ? 0 : n); + return GRUB_ERR_NONE; +} + static char * grub_script_env_get (const char *name) { @@ -49,7 +74,10 @@ grub_script_env_get (const char *name) if (num == 0) return 0; /* XXX no file name, for now. */ - return (num > scope->argc ? 0 : scope->args[num - 1]); + if (num > scope->argc - scope->shift) + return 0; + else + return scope->args[num - 1 + scope->shift]; } else { @@ -60,7 +88,7 @@ grub_script_env_get (const char *name) else if (grub_strcmp (name, "#") == 0) { static char buf[32]; /* Rewritten everytime. */ - grub_snprintf (buf, sizeof (buf), "%u", scope->argc); + grub_snprintf (buf, sizeof (buf), "%u", scope->argc - scope->shift); return buf; } else @@ -244,6 +272,7 @@ grub_script_function_call (grub_script_function_t func, int argc, char **args) grub_err_t ret = 0; struct grub_script_scope new_scope; + new_scope.shift = 0; new_scope.argc = argc; new_scope.args = args; grub_list_push (GRUB_AS_LIST_P (&scope), GRUB_AS_LIST (&new_scope)); diff --git a/script/main.c b/script/main.c index b5159dc7d..ef810611c 100644 --- a/script/main.c +++ b/script/main.c @@ -17,6 +17,7 @@ */ #include +#include #include #include @@ -49,6 +50,8 @@ static struct grub_parser grub_sh_parser = GRUB_MOD_INIT(sh) { grub_parser_register ("grub", &grub_sh_parser); + grub_register_command ("shift", grub_script_cmd_shift, + N_("[n]"), N_("Shift positional parameters.")); } GRUB_MOD_FINI(sh) diff --git a/tests/grub_script_shift.in b/tests/grub_script_shift.in new file mode 100644 index 000000000..542e72974 --- /dev/null +++ b/tests/grub_script_shift.in @@ -0,0 +1,69 @@ +#! @builddir@/grub-shell-tester + +# Run GRUB script in a Qemu instance +# Copyright (C) 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 . + +function f1 { + echo f1 $# $1 $2 $3 + shift + echo f1 $# $1 $2 $3 +} + +function f2 { + echo f2 $# $1 $2 $3 + shift 1 + echo f2 $# $1 $2 $3 +} + +function f3 { + echo f3 $# $1 $2 $3 + shift 3 + echo f3 $# $1 $2 $3 +} + +function f4 { + echo f4 $# $1 $2 $3 + shift 100 + echo f4 $# $1 $2 $3 +} + +f1 +f1 a +f1 a b +f1 a b c +f1 a b c d +f1 a b c d e + +f2 +f2 a +f2 a b +f2 a b c +f2 a b c d +f2 a b c d e + +f3 +f3 a +f3 a b +f3 a b c +f3 a b c d +f3 a b c d e + +f4 +f4 a +f4 a b +f4 a b c +f4 a b c d +f4 a b c d e diff --git a/util/grub-script-check.c b/util/grub-script-check.c index 3b7ab295d..1d9ebd57f 100644 --- a/util/grub-script-check.c +++ b/util/grub-script-check.c @@ -57,6 +57,14 @@ grub_refresh (void) fflush (stdout); } +grub_err_t +grub_script_cmd_shift (grub_command_t cmd __attribute__((unused)), + int argc __attribute__((unused)), + char *argv[] __attribute__((unused))) +{ + return 0; +} + char * grub_script_execute_argument_to_string (struct grub_script_arg *arg __attribute__ ((unused))) { From 062cdbc1ca22c1cfb5c984da0872c18f1ce97036 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 10 May 2010 13:50:43 +0530 Subject: [PATCH 008/174] added i386-multiboot support --- configure.common | 7 +++++-- gentpl.py | 5 +++-- grub-core/Makefile.kernel | 11 +++++++++++ grub-core/modules.def | 25 ++++++++++++++++++++++++- 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/configure.common b/configure.common index cf40fca0f..a18bc803f 100644 --- a/configure.common +++ b/configure.common @@ -766,6 +766,8 @@ AS_IF([test x$target_cpu = xi386 -a x$platform = xpc], [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)]) AS_IF([test x$target_cpu = xi386 -a x$platform = xcoreboot], [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)]) +AS_IF([test x$target_cpu = xi386 -a x$platform = xmultiboot], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)]) AS_IF([test x$target_cpu = xmips -a x$platform = xyeeloong], [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x80200000)]) AS_IF([test x$target_cpu = xpowerpc -a x$platform = xieee1275], @@ -784,9 +786,10 @@ AS_IF([test x$TARGET_APPLE_CC = x1], AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi]) -AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot]) -AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275]) AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu]) +AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275]) +AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot]) +AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot]) AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi]) AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong]) AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips]) diff --git a/gentpl.py b/gentpl.py index 214b58afd..d6043d05c 100644 --- a/gentpl.py +++ b/gentpl.py @@ -5,11 +5,12 @@ # GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", - "i386_ieee1275", "x86_64_efi", "mips_yeeloong", "sparc64_ieee1275", + "i386_multiboot", "i386_ieee1275", "x86_64_efi", + "mips_yeeloong", "sparc64_ieee1275", "powerpc_ieee1275" ] GROUPS = {} -GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_ieee1275" ] +GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ] GROUPS["x86_64"] = [ "x86_64_efi" ] GROUPS["mips"] = [ "mips_yeeloong" ] GROUPS["sparc64"] = [ "sparc64_ieee1275" ] diff --git a/grub-core/Makefile.kernel b/grub-core/Makefile.kernel index 58e464805..38e2e0ab7 100644 --- a/grub-core/Makefile.kernel +++ b/grub-core/Makefile.kernel @@ -65,6 +65,17 @@ KERNEL_HEADER_FILES += include/grub/machine/memory.h KERNEL_HEADER_FILES += include/grub/machine/loader.h endif +if COND_i386_multiboot +KERNEL_HEADER_FILES += include/grub/boot.h +KERNEL_HEADER_FILES += include/grub/loader.h +KERNEL_HEADER_FILES += include/grub/msdos_partition.h +KERNEL_HEADER_FILES += include/grub/machine/boot.h +KERNEL_HEADER_FILES += include/grub/machine/console.h +KERNEL_HEADER_FILES += include/grub/machine/init.h +KERNEL_HEADER_FILES += include/grub/machine/memory.h +KERNEL_HEADER_FILES += include/grub/machine/loader.h +endif + if COND_i386_qemu KERNEL_HEADER_FILES += include/grub/boot.h KERNEL_HEADER_FILES += include/grub/loader.h diff --git a/grub-core/modules.def b/grub-core/modules.def index c3d90009b..b09516294 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -7,6 +7,7 @@ kernel = { x86_efi_ldflags = '-Wl,-r'; i386_pc_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; i386_coreboot_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + i386_multiboot_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; i386_qemu_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; i386_ieee1275_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; mips_yeeloong_ldflags = '-Wl,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; @@ -87,6 +88,21 @@ kernel = { i386_coreboot = term/i386/pc/vga_text.c; i386_coreboot = term/i386/vga_common.c; + i386_multiboot = kern/i386/coreboot/startup.S; + i386_multiboot = kern/i386/misc.S; + i386_multiboot = kern/i386/coreboot/init.c; + i386_multiboot = kern/i386/multiboot_mmap.c; + i386_multiboot = kern/i386/halt.c; + i386_multiboot = kern/mm.c; + i386_multiboot = kern/time.c; + i386_multiboot = kern/i386/dl.c; + i386_multiboot = kern/i386/tsc.c; + i386_multiboot = kern/i386/pit.c; + i386_multiboot = kern/generic/rtc_get_time_ms.c; + i386_multiboot = kern/generic/millisleep.c; + i386_multiboot = term/i386/pc/vga_text.c; + i386_multiboot = term/i386/vga_common.c; + i386_qemu = kern/i386/qemu/startup.S; i386_qemu = kern/i386/misc.S; i386_qemu = kern/i386/coreboot/init.c; @@ -202,7 +218,7 @@ kernel = { image_nostrip = { emu; }; image_strip_keep_kernel = { i386_efi; x86_64_efi; }; - image_strip = { powerpc_ieee1275; i386_coreboot; i386_ieee1275; }; + image_strip = { powerpc_ieee1275; i386_coreboot; i386_multiboot; i386_ieee1275; }; image_strip_macho2img = { mips_yeeloong; i386_pc; i386_qemu; sparc64_ieee1275; }; }; @@ -530,6 +546,7 @@ module = { i386_pc; i386_qemu; i386_coreboot; + i386_multiboot; i386_ieee1275; mips_yeeloong; powerpc_ieee1275; @@ -1231,6 +1248,7 @@ module = { i386_pc; i386_qemu; i386_coreboot; + i386_multiboot; i386_ieee1275; }; @@ -1244,6 +1262,7 @@ module = { i386_pc; i386_qemu; i386_coreboot; + i386_multiboot; }; module = { @@ -1328,6 +1347,10 @@ module = { i386_coreboot = mmap/i386/uppermem.c; i386_coreboot = mmap/i386/mmap.c; + i386_multiboot = mmap/mmap.c; + i386_multiboot = mmap/i386/uppermem.c; + i386_multiboot = mmap/i386/mmap.c; + i386_qemu = mmap/mmap.c; i386_qemu = mmap/i386/uppermem.c; i386_qemu = mmap/i386/mmap.c; From 8be3ced19f8b81fcfa852a63b857a2328248ff6c Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 10 May 2010 14:05:10 +0530 Subject: [PATCH 009/174] fix mips build --- grub-core/include/grub/dl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/include/grub/dl.h b/grub-core/include/grub/dl.h index 8c5f4bb2d..218de996c 100644 --- a/grub-core/include/grub/dl.h +++ b/grub-core/include/grub/dl.h @@ -111,7 +111,7 @@ grub_err_t EXPORT_FUNC(grub_dl_register_symbol) (const char *name, void *addr, grub_err_t grub_arch_dl_check_header (void *ehdr); grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr); -#if defined (_mips) && ! GRUB_MACHINE_EMU +#if defined (_mips) && ! defined (GRUB_MACHINE_EMU) #define GRUB_LINKER_HAVE_INIT 1 void grub_arch_dl_init_linker (void); #endif From 1426af206ccb5cd61930d208de7b46f3359ece30 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 10 May 2010 15:08:02 +0530 Subject: [PATCH 010/174] fix vga.c --- grub-core/modules.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/modules.def b/grub-core/modules.def index b09516294..fe77c4cbd 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -1491,7 +1491,7 @@ module = { module = { name = vga; - i386_pc = term/i386/pc/vga.c; + i386_pc = video/i386/pc/vga.c; }; module = { From 2e33ae0d1b334535ecb113fc5c36ac0e6965741d Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 10 May 2010 15:37:18 +0530 Subject: [PATCH 011/174] few minor fixes --- Makefile.am | 4 ++-- gentpl.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index d962963c1..c0d6d003b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,6 +33,8 @@ AM_LDFLAGS = AM_CPPFLAGS = $(CPPFLAGS_GRUB) -DGRUB_FILE=\"$(subst $(top_srcdir)/,,$<)\" AM_CCASFLAGS = -DASM_FILE=1 +include $(srcdir)/modules.am + # XXX Use Automake's LEX & YACC support grub_script.tab.c grub_script.tab.h: $(top_srcdir)/grub-core/script/parser.y $(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/grub-core/script/parser.y @@ -83,5 +85,3 @@ ascii.h: ascii.bitmaps grub-bin2h CLEANFILES += ascii.h $(top_builddir)/grub-core/include/ascii.h platform_HEADERS = config.h - -include $(srcdir)/modules.am diff --git a/gentpl.py b/gentpl.py index d6043d05c..f906bd6d1 100644 --- a/gentpl.py +++ b/gentpl.py @@ -329,7 +329,7 @@ def installdir(default="bin"): def manpage(): r = "if COND_MAN_PAGES\n" - r += "man_MANS += [+ name +].[+ mansection +]\n" + r += gvar_add("man_MANS", "[+ name +].[+ mansection +]\n") r += rule("[+ name +].[+ mansection +]", "", """ $(MAKE) $(AM_MAKEFLAGS) [+ name +] chmod a+x [+ name +] From b4cd82945a8f2ce728e160c316fb4d1b79c7c330 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 12 May 2010 17:43:49 +0530 Subject: [PATCH 012/174] minor fix --- script/execute.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/execute.c b/script/execute.c index d83f51914..d2e8753c3 100644 --- a/script/execute.c +++ b/script/execute.c @@ -47,9 +47,6 @@ grub_script_cmd_shift (grub_command_t cmd __attribute__((unused)), if (! scope) return GRUB_ERR_NONE; - if (scope->argv.argc == 0) - return GRUB_ERR_NONE; - if (argc == 0) n = 1; @@ -59,10 +56,13 @@ grub_script_cmd_shift (grub_command_t cmd __attribute__((unused)), else { n = grub_strtoul (argv[0], &p, 10); - if (*p != '\0' || n > scope->argv.argc) + if (*p != '\0') return GRUB_ERR_BAD_ARGUMENT; } + if (n > scope->argv.argc) + return GRUB_ERR_BAD_ARGUMENT; + scope->argv.argc -= n; scope->argv.args += n; return GRUB_ERR_NONE; From 7b252ac27c439528e54f9c127d912b3afad76b64 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 12 May 2010 17:46:49 +0530 Subject: [PATCH 013/174] few more testcases --- tests/grub_script_shift.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/grub_script_shift.in b/tests/grub_script_shift.in index c7c94ab18..785b9c396 100644 --- a/tests/grub_script_shift.in +++ b/tests/grub_script_shift.in @@ -17,8 +17,12 @@ # along with GRUB. If not, see . function f1 { + echo f1 '$@' $@ + echo f1 '$*' $* echo f1 $# $1 $2 $3 shift + echo f1 '$@' $@ + echo f1 '$*' $* echo f1 $# $1 $2 $3 } @@ -30,8 +34,12 @@ f1 a b c d f1 a b c d e function f2 { + echo f1 '$@' $@ + echo f1 '$*' $* echo f2 $# $1 $2 $3 shift 1 + echo f1 '$@' $@ + echo f1 '$*' $* echo f2 $# $1 $2 $3 } @@ -43,8 +51,12 @@ f2 a b c d f2 a b c d e function f3 { + echo f1 '$@' $@ + echo f1 '$*' $* echo f3 $# $1 $2 $3 shift 3 + echo f1 '$@' $@ + echo f1 '$*' $* echo f3 $# $1 $2 $3 } @@ -56,8 +68,12 @@ f3 a b c d f3 a b c d e function f4 { + echo f1 '$@' $@ + echo f1 '$*' $* echo f4 $# $1 $2 $3 shift 100 + echo f1 '$@' $@ + echo f1 '$*' $* echo f4 $# $1 $2 $3 } From 5f02926bbcebc1acaa7475a4c3d39c915605c147 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 26 May 2010 09:56:59 +0530 Subject: [PATCH 014/174] emu build fixes for sparc64 and freebsd --- conf/any-emu.rmk | 7 ++++++- include/grub/cache.h | 3 ++- include/grub/emu/misc.h | 1 + util/misc.c | 8 -------- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk index 3f0df06aa..17abc8911 100644 --- a/conf/any-emu.rmk +++ b/conf/any-emu.rmk @@ -1,6 +1,8 @@ # -*- makefile -*- -COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include) +ifeq ($(target_cpu), sparc64) +COMMON_LDFLAGS += -mno-relax +endif kernel_img_RELOCATABLE = yes pkglib_PROGRAMS = kernel.img @@ -45,6 +47,9 @@ cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS) endif grub_emu_LDFLAGS = $(LIBCURSES) +ifeq ($(target_cpu), sparc64) +grub_emu_LDFLAGS += -m64 -mno-relax +endif ifeq ($(enable_grub_emu_usb), yes) kernel_img_HEADERS += libusb.h diff --git a/include/grub/cache.h b/include/grub/cache.h index 27e44f0a2..a54bc00f8 100644 --- a/include/grub/cache.h +++ b/include/grub/cache.h @@ -23,7 +23,8 @@ #include #include -#if defined (__i386__) || defined (__x86_64__) +#if defined (__i386__) || defined (__x86_64__) || \ + (defined (GRUB_MACHINE_EMU) && GRUB_MACHINE_EMU) static inline void grub_arch_sync_caches (void *address __attribute__ ((unused)), grub_size_t len __attribute__ ((unused))) diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index e037e6be7..1492e757a 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -46,5 +46,6 @@ int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...); #endif char * EXPORT_FUNC(xasprintf) (const char *fmt, ...); +char * canonicalize_file_name (const char *path); #endif /* GRUB_EMU_MISC_H */ diff --git a/util/misc.c b/util/misc.c index 91bc25a55..dd0077d72 100644 --- a/util/misc.c +++ b/util/misc.c @@ -214,14 +214,6 @@ grub_millisleep (grub_uint32_t ms) #endif -#if !(defined (__i386__) || defined (__x86_64__)) && GRUB_NO_MODULES -void -grub_arch_sync_caches (void *address __attribute__ ((unused)), - grub_size_t len __attribute__ ((unused))) -{ -} -#endif - #ifdef __MINGW32__ void sync (void) From c53fe8dfbbf70dcc7f46963015d1636afb3a464a Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 26 May 2010 16:53:43 +0530 Subject: [PATCH 015/174] build fixes for sparc64 and freebsd platforms --- conf/any-emu.rmk | 5 ++++- configure.ac | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk index 7560c8aba..77ba4f2b7 100644 --- a/conf/any-emu.rmk +++ b/conf/any-emu.rmk @@ -1,6 +1,7 @@ # -*- makefile -*- ifeq ($(target_cpu), sparc64) +COMMON_CFLAGS += -mno-app-regs COMMON_LDFLAGS += -mno-relax endif @@ -25,10 +26,12 @@ TARGET_NO_STRIP = yes noinst_MODULES = emu-full.mod emu_full_mod_SOURCES = kern/emu/full.c emu_full_mod_CFLAGS = $(COMMON_CFLAGS) +emu_full_mod_LDFLAGS = $(COMMON_LDFLAGS) noinst_MODULES = emu-lite.mod emu_lite_mod_SOURCES = kern/emu/lite.c kern/emu/cache.S symlist.c emu_lite_mod_CFLAGS = $(COMMON_CFLAGS) +emu_lite_mod_LDFLAGS = $(COMMON_LDFLAGS) # For halt.mod. pkglib_MODULES += halt.mod @@ -45,7 +48,7 @@ endif grub_emu_LDFLAGS = $(LIBCURSES) ifeq ($(target_cpu), sparc64) -grub_emu_LDFLAGS += -m64 -mno-relax +grub_emu_LDFLAGS += -m64 -melf64_sparc -mno-relax endif ifeq ($(enable_grub_emu_usb), yes) diff --git a/configure.ac b/configure.ac index 9448f792d..54622e5e9 100644 --- a/configure.ac +++ b/configure.ac @@ -155,7 +155,7 @@ esac machine_CPPFLAGS="$machine_CPPFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" CPPFLAGS="$CPPFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" -TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CPPFLAGS" +TARGET_ASFLAGS="$TARGET_ASFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" TARGET_CFLAGS="$TARGET_CFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" AC_SUBST(host_cpu) From ac4d5ab78330f12c253f39fb6ac6d5a0a244d64b Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 26 May 2010 16:58:29 +0530 Subject: [PATCH 016/174] removed kern/emu/dl.c --- kern/emu/dl.c | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 kern/emu/dl.c diff --git a/kern/emu/dl.c b/kern/emu/dl.c deleted file mode 100644 index 09e2f4a7a..000000000 --- a/kern/emu/dl.c +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef GRUB_MACHINE_EMU -#error "This source is only meant for grub-emu platform" -#endif - -#if defined(GRUB_CPU_I386) -#include "../i386/dl.c" -#elif defined(GRUB_CPU_X86_64) -#include "../x86_64/dl.c" -#elif defined(GRUB_CPU_SPARC64) -#include "../sparc64/dl.c" -#elif defined(GRUB_CPU_MIPS) -#include "../mips/dl.c" -#elif defined(GRUB_CPU_MIPSEL) -#include "../mips/dl.c" -#elif defined(GRUB_CPU_POWERPC) -#include "../powerpc/dl.c" -#else -#error "No target cpu type is defined" -#endif From f17ead43f9e1a27b7b92694c464f61216e2770d5 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 27 May 2010 17:04:31 -0700 Subject: [PATCH 017/174] cygwin fixes --- conf/any-emu.rmk | 30 ++++++++++++++++++------------ genmk.rb | 1 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk index 77ba4f2b7..0324898d3 100644 --- a/conf/any-emu.rmk +++ b/conf/any-emu.rmk @@ -23,16 +23,6 @@ kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-char-subscripts -Wn kernel_img_LDFLAGS = $(COMMON_LDFLAGS) TARGET_NO_STRIP = yes -noinst_MODULES = emu-full.mod -emu_full_mod_SOURCES = kern/emu/full.c -emu_full_mod_CFLAGS = $(COMMON_CFLAGS) -emu_full_mod_LDFLAGS = $(COMMON_LDFLAGS) - -noinst_MODULES = emu-lite.mod -emu_lite_mod_SOURCES = kern/emu/lite.c kern/emu/cache.S symlist.c -emu_lite_mod_CFLAGS = $(COMMON_CFLAGS) -emu_lite_mod_LDFLAGS = $(COMMON_LDFLAGS) - # For halt.mod. pkglib_MODULES += halt.mod halt_mod_SOURCES = commands/halt.c @@ -111,12 +101,28 @@ grub_emu_init.o: grub_emu_init.c grub_emu_init.h rm -f $@; $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"grub_init.c\" -c -o $@ $< CLEANFILES += grub_emu_init.o +kern_emu_lite.o: kern/emu/lite.c + $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"kern/emu/lite.c\" -c -o $@ $< +CLEANFILES += kern_emu_lite.o + +kern_emu_full.o: kern/emu/full.c + $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"kern/emu/full.c\" -c -o $@ $< +CLEANFILES += kern_emu_full.o + +kern_emu_cache.o: kern/emu/cache.S + $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(TARGET_ASFLAGS) -DGRUB_FILE=\"kern/emu/cache.S\" -c -o $@ $< +CLEANFILES += kern_emu_cache.o + +symlist.o: symlist.c + $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"symlist.c\" -c -o $@ $< +CLEANFILES += symlist.o + CLEANFILES += grub-emu-lite -grub-emu-lite: $(pkglib_PROGRAMS) emu-lite.mod +grub-emu-lite: kern_emu_lite.o kern_emu_cache.o symlist.o kernel.img $(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS) GRUB_EMU_LITE=grub-emu-lite CLEANFILES += grub-emu -grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS) emu-full.mod grub_emu_init.o +grub-emu: $(PREMODFILES) kern_emu_full.o grub_emu_init.o kernel.img $(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS) GRUB_EMU=grub-emu diff --git a/genmk.rb b/genmk.rb index 6b5ecd1d4..5d06d1153 100644 --- a/genmk.rb +++ b/genmk.rb @@ -161,6 +161,7 @@ endif #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str} -rm -f $@ $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{objs_str} +PREMODFILES += #{pre_obj} #{mod_obj}: #{mod_src} $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -DGRUB_FILE=\\\"#{mod_src}\\\" -c -o $@ $< From 16eaf6f7c6470e2a7d065ae92e3022f2b640755e Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 28 May 2010 16:18:22 +0530 Subject: [PATCH 018/174] fixes for netbsd build --- kern/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kern/misc.c b/kern/misc.c index ccc01d43f..be50c671b 100644 --- a/kern/misc.c +++ b/kern/misc.c @@ -1058,7 +1058,7 @@ grub_abort (void) void abort (void) __attribute__ ((alias ("grub_abort"))); #endif -#if defined(NEED_ENABLE_EXECUTE_STACK) && !defined(GRUB_UTIL) +#if defined(NEED_ENABLE_EXECUTE_STACK) && !defined(GRUB_UTIL) && !defined(GRUB_MACHINE_EMU) /* Some gcc versions generate a call to this function in trampolines for nested functions. */ void __enable_execute_stack (void *addr __attribute__ ((unused))) From e5089776308459f799a0c6fc8be6a512373a6417 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 2 Jun 2010 13:51:05 +0530 Subject: [PATCH 019/174] review fixes --- commands/parttool.c | 6 ++++++ configure.ac | 44 ++++++++++++++++++++--------------------- include/grub/cache.h | 3 +-- include/grub/emu/misc.h | 3 +++ include/grub/misc.h | 3 --- kern/emu/cache.S | 12 ++++------- kern/emu/lite.c | 12 +++++------ kern/emu/main.c | 3 +++ kern/main.c | 2 -- normal/main.c | 6 ++++++ 10 files changed, 49 insertions(+), 45 deletions(-) diff --git a/commands/parttool.c b/commands/parttool.c index f2a62e581..3dbe129bf 100644 --- a/commands/parttool.c +++ b/commands/parttool.c @@ -31,6 +31,10 @@ #include #include +#if defined (GRUB_MACHINE_EMU) +#include +#endif + static struct grub_parttool *parts = 0; static int curhandle = 0; static grub_dl_t mymod; @@ -175,7 +179,9 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), } /* Load modules. */ +#if defined(GRUB_MACHINE_EMU) if (! grub_no_autoload) +#endif { const char *prefix; prefix = grub_env_get ("prefix"); diff --git a/configure.ac b/configure.ac index 12f89d85e..4cfa29308 100644 --- a/configure.ac +++ b/configure.ac @@ -54,12 +54,14 @@ case "$target_cpu" in amd64) target_cpu=x86_64 ;; sparc) target_cpu=sparc64 ;; mipsel|mips64el) - target_cpu=mips; - cpu_CPPFLAGS="-DGRUB_CPU_MIPSEL=1"; + target_cpu=mips; + TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPSEL=1"; + CFLAGS="$CFLAGS -DGRUB_CPU_MIPSEL=1"; ;; mips|mips64) - target_cpu=mips; - cpu_CPPFLAGS="-DGRUB_CPU_MIPS=1"; + target_cpu=mips; + TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPS=1"; + CFLAGS="$CFLAGS -DGRUB_CPU_MIPS=1"; ;; esac @@ -134,29 +136,25 @@ case "$host_os" in esac case "$platform" in - coreboot) machine_CPPFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; - multiboot) machine_CPPFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;; - efi) machine_CPPFLAGS="-DGRUB_MACHINE_EFI=1" ;; - ieee1275) machine_CPPFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; - qemu) machine_CPPFLAGS="-DGRUB_MACHINE_QEMU=1" ;; - pc) machine_CPPFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; - emu) machine_CPPFLAGS="-DGRUB_MACHINE_EMU=1" ;; - yeeloong) machine_CPPFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; - qemu-mips) machine_CPPFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; + coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; + multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;; + efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;; + ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; + qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;; + pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; + emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;; + 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 case "$target_cpu" in - i386) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_I386";; - x86_64) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_X86_64";; - powerpc) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_POWERPC";; - mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;; # cpu_CPPFLAGS handled above - sparc64) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_SPARC64"; - machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;; + mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;; + sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;; esac -machine_CPPFLAGS="$machine_CPPFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" +machine_CFLAGS="$machine_CFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" -CPPFLAGS="$CPPFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" -TARGET_ASFLAGS="$TARGET_ASFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" -TARGET_CFLAGS="$TARGET_CFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" +CFLAGS="$CFLAGS $machine_CFLAGS" +TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS" +TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS" AC_SUBST(host_cpu) AC_SUBST(host_os) diff --git a/include/grub/cache.h b/include/grub/cache.h index a54bc00f8..27e44f0a2 100644 --- a/include/grub/cache.h +++ b/include/grub/cache.h @@ -23,8 +23,7 @@ #include #include -#if defined (__i386__) || defined (__x86_64__) || \ - (defined (GRUB_MACHINE_EMU) && GRUB_MACHINE_EMU) +#if defined (__i386__) || defined (__x86_64__) static inline void grub_arch_sync_caches (void *address __attribute__ ((unused)), grub_size_t len __attribute__ ((unused))) diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index bad00de71..32a5e29f8 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -49,4 +49,7 @@ int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...); char * EXPORT_FUNC(xasprintf) (const char *fmt, ...); extern char * canonicalize_file_name (const char *path); +/* Flag to control module autoloading in normal mode. */ +extern int EXPORT_VAR(grub_no_autoload); + #endif /* GRUB_EMU_MISC_H */ diff --git a/include/grub/misc.h b/include/grub/misc.h index 1ec8bbc5a..9bfc6974e 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -50,9 +50,6 @@ /* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */ #define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n)) -/* Flag to control module autoloading in normal mode. */ -extern int EXPORT_VAR(grub_no_autoload); - void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n); char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src); char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c); diff --git a/kern/emu/cache.S b/kern/emu/cache.S index 9975578b8..90a5b5396 100644 --- a/kern/emu/cache.S +++ b/kern/emu/cache.S @@ -2,17 +2,13 @@ #error "This source is only meant for grub-emu platform" #endif -#if defined(GRUB_CPU_I386) +#if defined(__i386__) || defined(__x86_64__) /* Nothing is necessary. */ -#elif defined(GRUB_CPU_X86_64) -/* Nothing is necessary. */ -#elif defined(GRUB_CPU_SPARC64) +#elif defined(__sparc__) #include "../sparc64/cache.S" -#elif defined(GRUB_CPU_MIPS) +#elif defined(__mips__) #include "../mips/cache.S" -#elif defined(GRUB_CPU_MIPSEL) -#include "../mips/cache.S" -#elif defined(GRUB_CPU_POWERPC) +#elif defined(__powerpc__) #include "../powerpc/cache.S" #else #error "No target cpu type is defined" diff --git a/kern/emu/lite.c b/kern/emu/lite.c index 884ddee10..9b3728717 100644 --- a/kern/emu/lite.c +++ b/kern/emu/lite.c @@ -5,17 +5,15 @@ #error "This source is only meant for grub-emu platform" #endif -#if defined(GRUB_CPU_I386) +#if defined(__i386__) #include "../i386/dl.c" -#elif defined(GRUB_CPU_X86_64) +#elif defined(__x86_64__) #include "../x86_64/dl.c" -#elif defined(GRUB_CPU_SPARC64) +#elif defined(__sparc__) #include "../sparc64/dl.c" -#elif defined(GRUB_CPU_MIPS) +#elif defined(__mips__) #include "../mips/dl.c" -#elif defined(GRUB_CPU_MIPSEL) -#include "../mips/dl.c" -#elif defined(GRUB_CPU_POWERPC) +#elif defined(__powerpc__) #include "../powerpc/dl.c" #else #error "No target cpu type is defined" diff --git a/kern/emu/main.c b/kern/emu/main.c index 8d6118c93..1915e1a7c 100644 --- a/kern/emu/main.c +++ b/kern/emu/main.c @@ -51,6 +51,9 @@ static jmp_buf main_env; /* Store the prefix specified by an argument. */ static char *prefix = NULL; +/* Flag to control module autoloading in normal mode. */ +int grub_no_autoload; + grub_addr_t grub_arch_modules_addr (void) { diff --git a/kern/main.c b/kern/main.c index 2541d3295..1fdf4ab07 100644 --- a/kern/main.c +++ b/kern/main.c @@ -30,8 +30,6 @@ #include #include -int grub_no_autoload; - void grub_module_iterate (int (*hook) (struct grub_module_header *header)) { diff --git a/normal/main.c b/normal/main.c index b3544b99f..d1e95d9b5 100644 --- a/normal/main.c +++ b/normal/main.c @@ -32,6 +32,10 @@ #include #include +#if defined (GRUB_MACHINE_EMU) +#include +#endif + #define GRUB_DEFAULT_HISTORY_SIZE 50 static int nested_level = 0; @@ -476,7 +480,9 @@ grub_normal_init_page (struct grub_term_output *term) static void read_lists (const char *val) { +#if defined(GRUB_MACHINE_EMU) if (! grub_no_autoload) +#endif { read_command_list (val); read_fs_list (val); From 6d6f13934992f6f59b626b0fab49ef260659a112 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 2 Jun 2010 14:45:07 +0530 Subject: [PATCH 020/174] review fixes --- commands/parttool.c | 6 ------ include/grub/dl.h | 6 +++--- include/grub/emu/misc.h | 3 --- include/grub/misc.h | 7 +++++++ kern/emu/main.c | 1 - normal/main.c | 6 ------ 6 files changed, 10 insertions(+), 19 deletions(-) diff --git a/commands/parttool.c b/commands/parttool.c index 3dbe129bf..f2a62e581 100644 --- a/commands/parttool.c +++ b/commands/parttool.c @@ -31,10 +31,6 @@ #include #include -#if defined (GRUB_MACHINE_EMU) -#include -#endif - static struct grub_parttool *parts = 0; static int curhandle = 0; static grub_dl_t mymod; @@ -179,9 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)), } /* Load modules. */ -#if defined(GRUB_MACHINE_EMU) if (! grub_no_autoload) -#endif { const char *prefix; prefix = grub_env_get ("prefix"); diff --git a/include/grub/dl.h b/include/grub/dl.h index 9d5f2af2d..b66b7641e 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -95,13 +95,13 @@ int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod); int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod); void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod)); grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name); -grub_err_t EXPORT_FUNC(grub_dl_register_symbol) (const char *name, void *addr, - grub_dl_t mod); +grub_err_t grub_dl_register_symbol (const char *name, void *addr, + grub_dl_t mod); grub_err_t grub_arch_dl_check_header (void *ehdr); grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr); -#if defined (_mips) && (! defined (GRUB_MACHINE_EMU) || ! GRUB_MACHINE_EMU) +#if defined (_mips) #define GRUB_LINKER_HAVE_INIT 1 void grub_arch_dl_init_linker (void); #endif diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index 32a5e29f8..bad00de71 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -49,7 +49,4 @@ int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...); char * EXPORT_FUNC(xasprintf) (const char *fmt, ...); extern char * canonicalize_file_name (const char *path); -/* Flag to control module autoloading in normal mode. */ -extern int EXPORT_VAR(grub_no_autoload); - #endif /* GRUB_EMU_MISC_H */ diff --git a/include/grub/misc.h b/include/grub/misc.h index 9bfc6974e..077069934 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -308,4 +308,11 @@ void EXPORT_FUNC (grub_halt) (int no_apm); void EXPORT_FUNC (grub_halt) (void); #endif +#ifdef GRUB_MACHINE_EMU +/* Flag to control module autoloading in normal mode. */ +extern int EXPORT_VAR(grub_no_autoload); +#else +#define grub_no_autoload 0 +#endif + #endif /* ! GRUB_MISC_HEADER */ diff --git a/kern/emu/main.c b/kern/emu/main.c index 1915e1a7c..e2efd262f 100644 --- a/kern/emu/main.c +++ b/kern/emu/main.c @@ -51,7 +51,6 @@ static jmp_buf main_env; /* Store the prefix specified by an argument. */ static char *prefix = NULL; -/* Flag to control module autoloading in normal mode. */ int grub_no_autoload; grub_addr_t diff --git a/normal/main.c b/normal/main.c index d1e95d9b5..b3544b99f 100644 --- a/normal/main.c +++ b/normal/main.c @@ -32,10 +32,6 @@ #include #include -#if defined (GRUB_MACHINE_EMU) -#include -#endif - #define GRUB_DEFAULT_HISTORY_SIZE 50 static int nested_level = 0; @@ -480,9 +476,7 @@ grub_normal_init_page (struct grub_term_output *term) static void read_lists (const char *val) { -#if defined(GRUB_MACHINE_EMU) if (! grub_no_autoload) -#endif { read_command_list (val); read_fs_list (val); From a60f6ee1ac67f2145259ab9674789bbced6078cb Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 3 Jun 2010 11:52:33 +0530 Subject: [PATCH 021/174] cleanup --- Makefile.am | 27 ++---- autogen.sh | 42 +++++---- configure.ac | 19 +--- configure.common | 55 +++++++----- gentpl.py | 35 +++++--- grub-core/Makefile.extra-dist | 14 +-- grub-core/Makefile.vars | 11 +-- grub-core/configure.ac | 24 +---- grub-core/gendistlist.sh | 46 ---------- grub-core/genmoddep.awk | 5 +- grub-core/include/grub/dl.h | 4 +- grub-core/modules.def | 26 ++++++ mkinstalldirs | 161 ---------------------------------- modules.def | 1 + tests/util/grub-shell.in | 4 - 15 files changed, 131 insertions(+), 343 deletions(-) delete mode 100755 grub-core/gendistlist.sh delete mode 100644 mkinstalldirs diff --git a/Makefile.am b/Makefile.am index c0d6d003b..6b6f9e10c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,19 +1,6 @@ AUTOMAKE_OPTIONS = subdir-objects DEPDIR = .deps-util - -EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def \ - \ - geninit.sh \ - \ - gnulib/progname.h gnulib/fnmatch_loop.c gnulib/alloca.h \ - gnulib/error.h gnulib/fnmatch.h gnulib/getopt.h \ - gnulib/getopt_int.h gnulib/gettext.h gnulib/progname.h \ - \ - util/mkisofs/mkisofs.h util/mkisofs/iso9660.h \ - util/mkisofs/include/prototyp.h util/mkisofs/defaults.h \ - util/mkisofs/match.h util/mkisofs/exclude.h \ - util/mkisofs/msdos_partition.h util/mkisofs/include/fctldefs.h \ - util/mkisofs/include/mconfig.h util/mkisofs/include/statdefs.h +EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def geninit.sh SUBDIRS = . grub-core po docs @@ -46,15 +33,17 @@ grub_script.yy.c grub_script.yy.h: $(top_srcdir)/grub-core/script/yylex.l CLEANFILES += grub_script.yy.c grub_script.yy.h # For libutil.a -libutil_a_init.lst: grub_script.tab.h grub_script.yy.h $(libutil_a_SOURCES) - rm -f $@ +libutil.pp: grub_script.tab.h grub_script.yy.h $(libutil_a_SOURCES) $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutil_a_CPPFLAGS) $(CPPFLAGS) \ - -D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ \ - | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1) + -D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1) +CLEANFILES += libutil.pp + +libutil_a_init.lst: libutil.pp + cat $< | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1) CLEANFILES += libutil_a_init.lst libutil_a_init.c: libutil_a_init.lst $(top_srcdir)/geninit.sh - rm -f $@; sh $(top_srcdir)/geninit.sh `cat $<` > $@ || (rm -f $@; exit 1) + sh $(top_srcdir)/geninit.sh `cat $<` > $@ || (rm -f $@; exit 1) CLEANFILES += libutil_a_init.c if COND_GRUB_MKFONT diff --git a/autogen.sh b/autogen.sh index 5358d45f1..db640702b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -2,33 +2,39 @@ set -e -ln -sf ../NEWS grub-core/ -ln -sf ../README grub-core/ -ln -sf ../INSTALL grub-core/ -ln -sf ../AUTHORS grub-core/ -ln -sf ../COPYING grub-core/ -ln -sf ../ABOUT-NLS grub-core/ -ln -sf ../ChangeLog grub-core/ -ln -sf ../aclocal.m4 grub-core/ -ln -sf ../acinclude.m4 grub-core/ -ln -sf ../config.rpath grub-core/ -ln -sf ../gentpl.py grub-core/ -ln -sf ../configure.common grub-core/ - -ln -sf grub-core/include . -ln -sf grub-core/gnulib . -ln -sf grub-core/lib . +echo "Creating symlinks..." +ln -svf ../NEWS grub-core/ +ln -svf ../TODO grub-core/ +ln -svf ../THANKS grub-core/ +ln -svf ../README grub-core/ +ln -svf ../INSTALL grub-core/ +ln -svf ../AUTHORS grub-core/ +ln -svf ../COPYING grub-core/ +ln -svf ../ABOUT-NLS grub-core/ +ln -svf ../ChangeLog grub-core/ +ln -svf ../aclocal.m4 grub-core/ +ln -svf ../acinclude.m4 grub-core/ +ln -svf ../config.rpath grub-core/ +ln -svf ../gentpl.py grub-core/ +ln -svf ../configure.common grub-core/ +echo "Creating Makefile.tpl..." python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl +echo "Running autogen..." autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am +echo "Creating grub-core/Makefile.tpl..." (cd grub-core && python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl) +echo "Running autogen..." (cd grub-core && autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am) -(cd grub-core && echo timestamp > stamp-h.in) +echo "Importing libgcrypt..." (cd grub-core && python import_gcry.py lib/libgcrypt/ .) +echo "Saving timestamps..." echo timestamp > stamp-h.in -autoreconf -vi +(cd grub-core && echo timestamp > stamp-h.in) +echo "Running autoreconf..." +autoreconf -vi exit 0 diff --git a/configure.ac b/configure.ac index 10c527565..dfbc6b8be 100644 --- a/configure.ac +++ b/configure.ac @@ -44,23 +44,10 @@ AC_CONFIG_HEADER([config.h]) m4_include([configure.common]) -# Output files. -grub_CHECK_LINK_DIR -if test x"$link_dir" = xyes ; then - AC_CONFIG_LINKS([include/grub/cpu:grub-core/include/grub/$target_cpu]) - if test "$platform" != emu ; then - AC_CONFIG_LINKS([include/grub/machine:grub-core/include/grub/$target_cpu/$platform]) - fi -else - mkdir -p include/grub 2>/dev/null - rm -rf include/grub/cpu - cp -rp $srcdir/grub-core/include/grub/$target_cpu include/grub/cpu 2>/dev/null - if test "$platform" != emu ; then - rm -rf include/grub/machine - cp -rp $srcdir/grub-core/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null - fi -fi +grub_coredir='grub-core' +AC_SUBST(grub_coredir) +# Output files. AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([po/Makefile]) AC_CONFIG_FILES([docs/Makefile]) diff --git a/configure.common b/configure.common index 8c100e2da..ecd9ff190 100644 --- a/configure.common +++ b/configure.common @@ -19,12 +19,11 @@ AC_ARG_PROGRAM # Optimization flag. Allow user to override. -if test "x$CFLAGS" = x; then - CFLAGS="$CFLAGS -Os" +if test "x$TARGET_CFLAGS" = x; then + TARGET_CFLAGS="$TARGET_CFLAGS -Os" fi # Default HOST_CPPFLAGS -CPPFLAGS='' HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W" HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_srcdir)/grub-core/include" HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" @@ -43,11 +42,13 @@ case "$target_cpu" in sparc) target_cpu=sparc64 ;; mipsel|mips64el) target_cpu=mips; - cpu_CPPFLAGS="-DGRUB_CPU_MIPSEL=1"; + HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; + TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; ;; mips|mips64) target_cpu=mips; - cpu_CPPFLAGS="-DGRUB_CPU_MIPS=1"; + HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_CPU_MIPS=1"; + TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_CPU_MIPS=1"; ;; esac @@ -122,28 +123,24 @@ case "$host_os" in esac case "$platform" in - coreboot) machine_CPPFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; - multiboot) machine_CPPFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;; - efi) machine_CPPFLAGS="-DGRUB_MACHINE_EFI=1" ;; - ieee1275) machine_CPPFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; - qemu) machine_CPPFLAGS="-DGRUB_MACHINE_QEMU=1" ;; - pc) machine_CPPFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; - emu) machine_CPPFLAGS="-DGRUB_MACHINE_EMU=1" ;; - yeeloong) machine_CPPFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; - qemu-mips) machine_CPPFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; + coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; + multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;; + efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;; + ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; + qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;; + pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; + emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;; + 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 case "$target_cpu" in - i386) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_I386";; - x86_64) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_X86_64";; - powerpc) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_POWERPC";; - mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;; # cpu_CPPFLAGS handled above - sparc64) cpu_CPPFLAGS="$cpu_CPPFLAGS -DGRUB_CPU_SPARC64"; - machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;; + mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;; + sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;; esac -machine_CPPFLAGS="$machine_CPPFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" +machine_CFLAGS="$machine_CFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" -HOST_CPPFLAGS="$HOST_CPPFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" -TARGET_CPPFLAGS="$TARGET_CPPFLAGS $cpu_CPPFLAGS $machine_CPPFLAGS" +HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CFLAGS" +TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CFLAGS" AC_SUBST(host_cpu) AC_SUBST(host_os) @@ -464,15 +461,25 @@ if test x"$enable_werror" != xno ; then TARGET_CFLAGS="$TARGET_CFLAGS -Werror" fi -AC_SUBST(TARGET_MODULE_FORMAT) +TARGET_CPP="$TARGET_CC -E" +TARGET_CCAS=$TARGET_CC + AC_SUBST(OBJCONV) +AC_SUBST(TARGET_CPP) +AC_SUBST(TARGET_CCAS) +AC_SUBST(TARGET_OBJ2ELF) AC_SUBST(TARGET_APPLE_CC) +AC_SUBST(TARGET_MODULE_FORMAT) AC_SUBST(TARGET_CFLAGS) AC_SUBST(TARGET_LDFLAGS) AC_SUBST(TARGET_CPPFLAGS) AC_SUBST(TARGET_CCASFLAGS) +AC_SUBST(TARGET_IMG_LDSCRIPT) +AC_SUBST(TARGET_IMG_LDFLAGS) +AC_SUBST(TARGET_IMG_CFLAGS) + AC_SUBST(HOST_CFLAGS) AC_SUBST(HOST_LDFLAGS) AC_SUBST(HOST_CPPFLAGS) diff --git a/gentpl.py b/gentpl.py index 9f1828d49..02369d843 100644 --- a/gentpl.py +++ b/gentpl.py @@ -131,11 +131,12 @@ def shared_nodist_sources(prefix=""): return collect_values("nodist_shared", pre def default_sources(prefix=""): return collect_values("source", prefix) def default_nodist_sources(prefix=""): return collect_values("nodist", prefix) -def default_ldadd(): return collect_values("ldadd") -def default_cflags(): return collect_values("cflags") -def default_ldflags(): return collect_values("ldflags") -def default_cppflags(): return collect_values("cppflags") -def default_ccasflags(): return collect_values("ccasflags") +def default_ldadd(): return collect_values("ldadd") +def default_cflags(): return collect_values("cflags") +def default_ldflags(): return collect_values("ldflags") +def default_cppflags(): return collect_values("cppflags") +def default_ccasflags(): return collect_values("ccasflags") +def default_extra_dist(): return collect_values("extra_dist") def group_sources(group, prefix=""): return collect_values(group, prefix) if group else default_sources(prefix) def group_nodist_sources(group, prefix=""): return collect_values(group + "_nodist", prefix) if group else default_nodist_sources(prefix) @@ -143,12 +144,13 @@ def group_nodist_sources(group, prefix=""): return collect_values(group + "_nodi def platform_sources(platform, prefix=""): return each_group(platform, "", lambda g: collect_values(g, prefix) if g else default_sources(prefix)) def platform_nodist_sources(platform, prefix=""): return each_group(platform, "_nodist", lambda g: collect_values(g + "_nodist", prefix) if g else default_nodist_sources(prefix)) -def platform_ldadd(platform): return each_group(platform, "_ldadd", lambda g: collect_values(g + "_ldadd") if g else default_ldadd()) -def platform_cflags(platform): return each_group(platform, "_cflags", lambda g: collect_values(g + "_cflags") if g else default_cflags()) -def platform_ldflags(platform): return each_group(platform, "_ldflags", lambda g: collect_values(g + "_ldflags") if g else default_ldflags()) -def platform_cppflags(platform): return each_group(platform, "_cppflags", lambda g: collect_values(g + "_cppflags") if g else default_cppflags()) -def platform_ccasflags(platform): return each_group(platform, "_ccasflags", lambda g: collect_values(g + "_ccasflags") if g else default_ccasflags()) -def platform_format(platform): return each_group(platform, "_format", lambda g: collect_values(g + "_format") if g else "binary") +def platform_ldadd(platform): return each_group(platform, "_ldadd", lambda g: collect_values(g + "_ldadd") if g else default_ldadd()) +def platform_cflags(platform): return each_group(platform, "_cflags", lambda g: collect_values(g + "_cflags") if g else default_cflags()) +def platform_ldflags(platform): return each_group(platform, "_ldflags", lambda g: collect_values(g + "_ldflags") if g else default_ldflags()) +def platform_cppflags(platform): return each_group(platform, "_cppflags", lambda g: collect_values(g + "_cppflags") if g else default_cppflags()) +def platform_ccasflags(platform): return each_group(platform, "_ccasflags", lambda g: collect_values(g + "_ccasflags") if g else default_ccasflags()) +def platform_extra_dist(platform): return each_group(platform, "_extra_dist", lambda g: collect_values(g + "_extra_dist") if g else default_extra_dist()) +def platform_format(platform): return each_group(platform, "_format", lambda g: collect_values(g + "_format") if g else "binary") def module(platform): r = gvar_add("noinst_PROGRAMS", "[+ name +].module") @@ -164,6 +166,7 @@ def module(platform): r += var_set(canonical_module() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_MODULE) " + platform_cppflags(platform)) r += var_set(canonical_module() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(platform)) + r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_module() + "_SOURCES)") r += gvar_add("CLEANFILES", "$(nodist_" + canonical_module() + "_SOURCES)") @@ -275,6 +278,7 @@ def kernel(platform): r += var_set(canonical_kernel() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) " + platform_cppflags(platform)) r += var_set(canonical_kernel() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_KERNEL) " + platform_ccasflags(platform)) + r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_kernel() + "_SOURCES)") r += gvar_add("CLEANFILES", "$(nodist_" + canonical_kernel() + "_SOURCES)") @@ -293,10 +297,12 @@ def image(platform): r += var_set(canonical_image() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_IMAGE) " + platform_cppflags(platform)) r += var_set(canonical_image() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_IMAGE) " + platform_ccasflags(platform)) + r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_image() + "_SOURCES)") r += gvar_add("CLEANFILES", "$(nodist_" + canonical_image() + "_SOURCES)") r += gvar_add("platform_DATA", "[+ name +].img") + r += gvar_add("CLEANFILES", "[+ name +].img") r += rule("[+ name +].img", "[+ name +].image", """ if test x$(USE_APPLE_CC_FIXES) = xyes; then \ $(MACHO2IMG) $< $@; \ @@ -316,6 +322,7 @@ def library(platform): r += var_set(canonical_name() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) " + platform_cppflags(platform)) r += var_set(canonical_name() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) " + platform_ccasflags(platform)) + r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_name() + "_SOURCES)") r += gvar_add("CLEANFILES", "$(nodist_" + canonical_name() + "_SOURCES)") @@ -352,6 +359,7 @@ def program(platform, test=False): r += var_set(canonical_name() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM) " + platform_cppflags(platform)) r += var_set(canonical_name() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM) " + platform_ccasflags(platform)) + r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_name() + "_SOURCES)") r += gvar_add("CLEANFILES", "$(nodist_" + canonical_name() + "_SOURCES)") @@ -366,7 +374,10 @@ def test_program(platform): return program(platform, True) def data(platform): - return gvar_add(installdir() + "_DATA", platform_sources(platform)) + r = gvar_add("EXTRA_DIST", platform_sources(platform)) + r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) + r += gvar_add(installdir() + "_DATA", platform_sources(platform)) + return r def script(platform, test=False): if test: diff --git a/grub-core/Makefile.extra-dist b/grub-core/Makefile.extra-dist index c6516f06a..9979c875b 100644 --- a/grub-core/Makefile.extra-dist +++ b/grub-core/Makefile.extra-dist @@ -27,24 +27,14 @@ EXTRA_DIST += genhandlerlist.sh EXTRA_DIST += genpartmaplist.sh EXTRA_DIST += genparttoollist.sh EXTRA_DIST += genterminallist.sh + +EXTRA_DIST += lib/libgcrypt_wrap/cipher_wrap.h EXTRA_DIST += lib/libgcrypt-grub/cipher/crypto.lst -EXTRA_DIST += script/yylex.l -EXTRA_DIST += script/parser.y - -EXTRA_DIST += lib/relocator.c - -EXTRA_DIST += efiemu/loadcore.c -EXTRA_DIST += efiemu/prepare.c - -EXTRA_DIST += loader/machoXX.c - - EXTRA_DIST += kern/i386/loader.S EXTRA_DIST += kern/i386/realmode.S EXTRA_DIST += loader/i386/bsdXX.c EXTRA_DIST += loader/i386/bsd_pagetable.c -EXTRA_DIST += loader/i386/multiboot_elfxx.c EXTRA_DIST += commands/search.c EXTRA_DIST += kern/i386/pc/lzma_decode.S diff --git a/grub-core/Makefile.vars b/grub-core/Makefile.vars index dd4ee8d56..7d398b4c9 100644 --- a/grub-core/Makefile.vars +++ b/grub-core/Makefile.vars @@ -33,21 +33,22 @@ if COND_sparc64_ieee1275 endif CPPFLAGS_GRUB = -I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) -CPPFLAGS_GRUB += -I$(top_srcdir)/include -I$(top_builddir)/include +CPPFLAGS_GRUB += -I$(top_srcdir)/$(grub_coredir)/include +CPPFLAGS_GRUB += -I$(top_builddir)/$(grub_coredir)/include CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -CPPFLAGS_GCRY = -I$(top_srcdir)/lib/libgcrypt_wrap +CPPFLAGS_GCRY = -I$(top_srcdir)/$(grub_coredir)/lib/libgcrypt_wrap CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" -CPPFLAGS_GNULIB = -I$(top_srcdir)/gnulib +CPPFLAGS_GNULIB = -I$(top_srcdir)/$(grub_coredir)/gnulib CFLAGS_MKISOFS = -Wno-all -Werror CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include CFLAGS_POSIX = -fno-builtin -CPPFLAGS_POSIX = -I$(top_srcdir)/lib/posix_wrap +CPPFLAGS_POSIX = -I$(top_srcdir)/$(grub_coredir)/lib/posix_wrap -CPPFLAGS_EFIEMU = -I$(top_srcdir)/efiemu/runtime +CPPFLAGS_EFIEMU = -I$(top_srcdir)/$(grub_coredir)/efiemu/runtime # to calm down automake BUILT_SOURCES = diff --git a/grub-core/configure.ac b/grub-core/configure.ac index ac462ea77..6cac2e75c 100644 --- a/grub-core/configure.ac +++ b/grub-core/configure.ac @@ -44,28 +44,12 @@ AC_CONFIG_HEADER([config.h]) m4_include([configure.common]) -TARGET_CPP="$TARGET_CC -E" -TARGET_CCAS=$TARGET_CC - CC=$TARGET_CC CPP=$TARGET_CC CCAS=$TARGET_CC -AC_SUBST(TARGET_CC) -AC_SUBST(TARGET_CPP) -AC_SUBST(TARGET_CCAS) -AC_SUBST(TARGET_IMG_LDSCRIPT) -AC_SUBST(TARGET_IMG_LDFLAGS) -AC_SUBST(TARGET_IMG_CFLAGS) -AC_SUBST(TARGET_OBJ2ELF) -AC_SUBST(TARGET_MODULE_FORMAT) -AC_SUBST(OBJCONV) -AC_SUBST(TARGET_APPLE_CC) -AC_SUBST(ASFLAGS) -AC_SUBST(TARGET_CFLAGS) -AC_SUBST(TARGET_ASFLAGS) -AC_SUBST(TARGET_LDFLAGS) -AC_SUBST(TARGET_CPPFLAGS) +grub_coredir='.' +AC_SUBST(grub_coredir) # Output files. grub_CHECK_LINK_DIR @@ -77,10 +61,10 @@ if test x"$link_dir" = xyes ; then else mkdir -p include/grub 2>/dev/null rm -rf include/grub/cpu - cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null + cp -rp $srcdir/grub-core/include/grub/$target_cpu include/grub/cpu 2>/dev/null if test "$platform" != emu ; then rm -rf include/grub/machine - cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null + cp -rp $srcdir/grub-core/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null fi fi diff --git a/grub-core/gendistlist.sh b/grub-core/gendistlist.sh deleted file mode 100755 index 102c0c11c..000000000 --- a/grub-core/gendistlist.sh +++ /dev/null @@ -1,46 +0,0 @@ -#! /bin/sh -# -# Copyright (C) 2005, 2008, 2009 Free Software Foundation, Inc. -# -# This gendistlist.sh is free software; the author -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Generate a list of distributed files. - -EXTRA_DISTFILES="AUTHORS COPYING ChangeLog DISTLIST INSTALL NEWS README \ - THANKS TODO Makefile.in aclocal.m4 autogen.sh config.guess \ - config.h.in config.sub configure configure.ac gencmdlist.sh \ - gendistlist.sh genfslist.sh genhandlerlist.sh geninit.sh \ - geninitheader.sh genkernsyms.sh.in genmk.rb genmoddep.awk \ - genmodsrc.sh genpartmaplist.sh genparttoollist.sh \ - genvideolist.sh \ - gensymlist.sh.in install-sh mkinstalldirs stamp-h.in" - -DISTDIRS="boot bus commands conf disk docs efiemu font fs hello hook include io \ - kern lib loader mmap normal partmap parttool script term util video" - -LC_COLLATE=C -export LC_COLLATE - -for f in $EXTRA_DISTFILES; do - echo $f -done - -dir=`dirname $0` -cd $dir - -for dir in $DISTDIRS; do - for d in `find $dir -type d ! -name .svn ! -name .bzr | sort`; do - find $d -maxdepth 1 -name '*.[chSy]' -o -name '*.mk' -o -name '*.rmk' \ - -o -name '*.rb' -o -name '*.in' -o -name '*.tex' -o -name '*.texi' \ - -o -name '*.info' -o -name 'grub.cfg' -o -name 'README' \ - -o -name '*.sc' -o -name 'mdate-sh' -o -name '*.sh' \ - -o -name 'grub-dumpdevtree' -o -name '*.lua' | sort - done -done diff --git a/grub-core/genmoddep.awk b/grub-core/genmoddep.awk index 6c92e2fc7..74487eabf 100644 --- a/grub-core/genmoddep.awk +++ b/grub-core/genmoddep.awk @@ -22,10 +22,7 @@ BEGIN { { module = $2 - # skip if empty - if ($1 == "" || $2 == "") - ; - else if ($1 in symtab) { + if ($1 in symtab) { modtab[module] = modtab[module] " " symtab[$1]; } else if ($1 != "__gnu_local_gp") { diff --git a/grub-core/include/grub/dl.h b/grub-core/include/grub/dl.h index 4ed68b69a..f98539a4e 100644 --- a/grub-core/include/grub/dl.h +++ b/grub-core/include/grub/dl.h @@ -105,8 +105,8 @@ int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod); int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod); void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod)); grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name); -grub_err_t EXPORT_FUNC(grub_dl_register_symbol) (const char *name, void *addr, - grub_dl_t mod); +grub_err_t grub_dl_register_symbol (const char *name, void *addr, + grub_dl_t mod); grub_err_t grub_arch_dl_check_header (void *ehdr); grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr); diff --git a/grub-core/modules.def b/grub-core/modules.def index 80bb1cbdd..348738971 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -348,6 +348,19 @@ module = { library = { name = libgnulib.a; source = gnulib/regex.c; + + extra_dist = gnulib/progname.h; + extra_dist = gnulib/alloca.h; + extra_dist = gnulib/error.h; + extra_dist = gnulib/fnmatch.h; + extra_dist = gnulib/getopt.h; + extra_dist = gnulib/getopt_int.h; + extra_dist = gnulib/gettext.h; + extra_dist = gnulib/regcomp.c; + extra_dist = gnulib/regexec.c; + extra_dist = gnulib/fnmatch_loop.c; + extra_dist = gnulib/regex_internal.c; + cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; common; @@ -823,6 +836,11 @@ module = { i386_pc = efiemu/prepare64.c; i386_pc = efiemu/pnvram.c; i386_pc = efiemu/i386/coredetect.c; + + extra_dist = efiemu/prepare.c; + extra_dist = efiemu/loadcore.c; + extra_dist = efiemu/runtime/efiemu.S; + extra_dist = efiemu/runtime/efiemu.c; }; module = { @@ -1216,6 +1234,7 @@ module = { x86 = lib/i386/relocator.c; x86 = lib/i386/relocator_asm.S; x86 = lib/i386/relocator_backward.S; + extra_dist = lib/relocator.c; }; module = { @@ -1280,6 +1299,7 @@ module = { name = multiboot; source = loader/multiboot.c; source = loader/i386/multiboot_mbi.c; + extra_dist = loader/multiboot_elfxx.c; x86; }; @@ -1312,6 +1332,8 @@ module = { i386_pc = loader/macho64.c; i386_pc = loader/macho.c; i386_pc = loader/xnu.c; + + extra_dist = loader/machoXX.c; }; module = { @@ -1445,6 +1467,10 @@ module = { nodist = grub_script.yy.c; nodist = grub_script.tab.h; nodist = grub_script.yy.h; + + extra_dist = script/yylex.l; + extra_dist = script/parser.y; + cflags = '$(CFLAGS_POSIX) -Wno-error'; cppflags = '$(CPPFLAGS_POSIX)'; }; diff --git a/mkinstalldirs b/mkinstalldirs deleted file mode 100644 index ef7e16fda..000000000 --- a/mkinstalldirs +++ /dev/null @@ -1,161 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy - -scriptversion=2006-05-11.19 - -# Original author: Noah Friedman -# Created: 1993-05-16 -# Public domain. -# -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -nl=' -' -IFS=" "" $nl" -errstatus=0 -dirmode= - -usage="\ -Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... - -Create each directory DIR (with mode MODE, if specified), including all -leading file name components. - -Report bugs to ." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" - exit $? - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --version) - echo "$0 $scriptversion" - exit $? - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and -# mkdir -p a/c at the same time, both will detect that a is missing, -# one will create a, then the other will try to create a and die with -# a "File exists" error. This is a problem when calling mkinstalldirs -# from a parallel make. We use --version in the probe to restrict -# ourselves to GNU mkdir, which is thread-safe. -case $dirmode in - '') - if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - test -d ./-p && rmdir ./-p - test -d ./--version && rmdir ./--version - fi - ;; - *) - if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && - test ! -d ./--version; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - else - # Clean up after NextStep and OpenStep mkdir. - for d in ./-m ./-p ./--version "./$dirmode"; - do - test -d $d && rmdir $d - done - fi - ;; -esac - -for file -do - case $file in - /*) pathcomp=/ ;; - *) pathcomp= ;; - esac - oIFS=$IFS - IFS=/ - set fnord $file - shift - IFS=$oIFS - - for d - do - test "x$d" = x && continue - - pathcomp=$pathcomp$d - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - lasterr= - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp=$pathcomp/ - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/modules.def b/modules.def index d9758423f..a91aed83e 100644 --- a/modules.def +++ b/modules.def @@ -109,6 +109,7 @@ program = { source = util/grub-mkimage.c; source = util/resolve.c; + extra_dist = util/grub-mkimagexx.c; ldadd = libutil.a; diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index 4af6a71e3..670494031 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -123,15 +123,11 @@ source /boot/grub/testcase.cfg halt EOF -rootdir=`mktemp -d` -(cd @abs_top_builddir@ && make DESTDIR=$rootdir install) >/dev/null 2>&1 - isofile=`mktemp` sh @abs_top_builddir@/grub-mkrescue --grub-mkimage=${builddir}/grub-mkimage \ --override-directory=${builddir}/grub-core --output=${isofile} \ boot/grub/grub.cfg=${cfgfile} \ /boot/grub/testcase.cfg=${source} >/dev/null 2>&1 -rm -rf $rootdir hdafile=`mktemp` cp ${isofile} ${hdafile} From 610c1efd103a09991eb8123490a812f6900e0f02 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 3 Jun 2010 15:30:15 +0530 Subject: [PATCH 022/174] more cleanup --- Makefile.am | 5 ++-- configure.common | 6 +++-- grub-core/Makefile.am | 12 ++++++---- grub-core/Makefile.extra-dist | 43 ----------------------------------- grub-core/Makefile.vars | 7 +++--- grub-core/modules.def | 19 ++++++++++------ 6 files changed, 31 insertions(+), 61 deletions(-) delete mode 100644 grub-core/Makefile.extra-dist diff --git a/Makefile.am b/Makefile.am index 6b6f9e10c..9ced44636 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,8 +17,8 @@ CCASFLAGS_LIBRARY = $(CCASFLAGS_PROGRAM) AM_CFLAGS = AM_LDFLAGS = -AM_CPPFLAGS = $(CPPFLAGS_GRUB) -DGRUB_FILE=\"$(subst $(top_srcdir)/,,$<)\" -AM_CCASFLAGS = -DASM_FILE=1 +AM_CPPFLAGS = $(CPPFLAGS_GRUB) +AM_CCASFLAGS = $(CCASFLAGS_GRUB) include $(srcdir)/modules.am @@ -73,4 +73,5 @@ ascii.h: ascii.bitmaps grub-bin2h cp $@ $(top_builddir)/grub-core/include CLEANFILES += ascii.h $(top_builddir)/grub-core/include/ascii.h +# Install config.h into platformdir platform_HEADERS = config.h diff --git a/configure.common b/configure.common index ecd9ff190..815c76c53 100644 --- a/configure.common +++ b/configure.common @@ -779,12 +779,14 @@ fi if test x"$device_mapper_excuse" = x ; then # Check for device-mapper library. AC_CHECK_LIB([devmapper], [dm_task_create], - [LDFLAGS="$LDFLAGS -ldevmapper" + [HOST_LDFLAGS="$HOST_LDFLAGS -ldevmapper" AC_DEFINE([HAVE_DEVICE_MAPPER], [1], [Define to 1 if you have the devmapper library.])], [device_mapper_excuse="need devmapper library"]) fi -AC_SUBST(ASFLAGS) + +pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"` +AC_SUBST(pkglibrootdir) AC_SUBST([FONT_SOURCE]) AS_IF([test x$target_cpu = xi386 -a x$platform = xpc], diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 1f2657656..71abb5a7a 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -1,8 +1,12 @@ AUTOMAKE_OPTIONS = subdir-objects SUBDIRS = po DEPDIR = .deps-core +EXTRA_DIST = gentpl.py modules.def Makefile.tpl genmoddep.awk +EXTRA_DIST += genmodsrc.sh gensymlist.sh genemuinit.sh genemuinitheader.sh +EXTRA_DIST += genfslist.sh gencmdlist.sh genvideolist.sh genhandlerlist.sh +EXTRA_DIST += genpartmaplist.sh genparttoollist.sh genterminallist.sh +EXTRA_DIST += $(shell find $(top_srcdir) -name '*.h') -include $(top_srcdir)/Makefile.extra-dist include $(top_srcdir)/Makefile.vars LDADD_KERNEL = -lgcc @@ -30,10 +34,10 @@ LDFLAGS_PROGRAM = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) CPPFLAGS_PROGRAM = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) CCASFLAGS_PROGRAM = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) -AM_CFLAGS = +AM_CFLAGS = AM_LDFLAGS = -AM_CPPFLAGS = $(CPPFLAGS_GRUB) -DGRUB_FILE=\"$(subst $(top_srcdir)/,,$<)\" -AM_CCASFLAGS = -DASM_FILE=1 +AM_CPPFLAGS = $(CPPFLAGS_GRUB) +AM_CCASFLAGS = $(CCASFLAGS_GRUB) # gentrigtables gentrigtables: $(top_srcdir)/gentrigtables.c diff --git a/grub-core/Makefile.extra-dist b/grub-core/Makefile.extra-dist deleted file mode 100644 index 9979c875b..000000000 --- a/grub-core/Makefile.extra-dist +++ /dev/null @@ -1,43 +0,0 @@ -# -# Extra files that need to be distributed (in .tar.gz) to build -# successfully on user site. -# -# XXX Remove wildcards; See 27.3 in automake.info -# - -EXTRA_DIST = - -EXTRA_DIST += gentpl.py -EXTRA_DIST += Makefile.tpl -EXTRA_DIST += modules.def - -EXTRA_DIST += gentrigtables.c - -EXTRA_DIST += genmoddep.awk -EXTRA_DIST += genmodsrc.sh -EXTRA_DIST += gensymlist.sh - -EXTRA_DIST += genemuinit.sh -EXTRA_DIST += genemuinitheader.sh - -EXTRA_DIST += genfslist.sh -EXTRA_DIST += gencmdlist.sh -EXTRA_DIST += genvideolist.sh -EXTRA_DIST += genhandlerlist.sh -EXTRA_DIST += genpartmaplist.sh -EXTRA_DIST += genparttoollist.sh -EXTRA_DIST += genterminallist.sh - -EXTRA_DIST += lib/libgcrypt_wrap/cipher_wrap.h -EXTRA_DIST += lib/libgcrypt-grub/cipher/crypto.lst - -EXTRA_DIST += kern/i386/loader.S -EXTRA_DIST += kern/i386/realmode.S -EXTRA_DIST += loader/i386/bsdXX.c -EXTRA_DIST += loader/i386/bsd_pagetable.c -EXTRA_DIST += commands/search.c - -EXTRA_DIST += kern/i386/pc/lzma_decode.S - -EXTRA_DIST += $(shell find $(top_srcdir) -name '*.h') - diff --git a/grub-core/Makefile.vars b/grub-core/Makefile.vars index 7d398b4c9..db3c2a7db 100644 --- a/grub-core/Makefile.vars +++ b/grub-core/Makefile.vars @@ -1,8 +1,7 @@ # -*- makefile -*- -pkglibroot = $(libdir)/$(shell echo $(PACKAGE) | sed "$(transform)") grubconfdir = $(sysconfdir)/grub.d -platformdir = $(pkglibroot)/$(target_cpu)-$(platform) +platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform) # Platform specific options if COND_i386_pc @@ -32,9 +31,11 @@ if COND_sparc64_ieee1275 LDFLAGS_PLATFORM = -melf64_sparc -mno-relax endif -CPPFLAGS_GRUB = -I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) +CPPFLAGS_GRUB = -DGRUB_FILE=\"`basename $<`\" +CPPFLAGS_GRUB += -I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) CPPFLAGS_GRUB += -I$(top_srcdir)/$(grub_coredir)/include CPPFLAGS_GRUB += -I$(top_builddir)/$(grub_coredir)/include +CCASFLAGS_GRUB = -DASM_FILE=1 CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers CPPFLAGS_GCRY = -I$(top_srcdir)/$(grub_coredir)/lib/libgcrypt_wrap diff --git a/grub-core/modules.def b/grub-core/modules.def index 348738971..c64217d5d 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -215,6 +215,10 @@ kernel = { emu = kern/emu/console.c; emu = disk/host.c; emu = gnulib/progname.c; + + extra_dist = kern/i386/loader.S; + extra_dist = kern/i386/realmode.S; + extra_dist = kern/i386/pc/lzma_decode.S; }; program = { @@ -247,6 +251,7 @@ program = { module = { name = trig; nodist = trigtables.c; + extra_dist = gentrigtables.c; common; }; @@ -349,13 +354,6 @@ library = { name = libgnulib.a; source = gnulib/regex.c; - extra_dist = gnulib/progname.h; - extra_dist = gnulib/alloca.h; - extra_dist = gnulib/error.h; - extra_dist = gnulib/fnmatch.h; - extra_dist = gnulib/getopt.h; - extra_dist = gnulib/getopt_int.h; - extra_dist = gnulib/gettext.h; extra_dist = gnulib/regcomp.c; extra_dist = gnulib/regexec.c; extra_dist = gnulib/fnmatch_loop.c; @@ -633,6 +631,7 @@ module = { common; name = search; source = commands/search_wrap.c; + extra_dist = commands/search.c; }; module = { @@ -1066,6 +1065,8 @@ module = { common; name = crypto; source = lib/crypto.c; + + extra_dist = lib/libgcrypt-grub/cipher/crypto.lst; }; module = { @@ -1273,6 +1274,10 @@ module = { source = loader/i386/bsd64.c; source = loader/i386/bsd_helper.S; source = loader/i386/bsd_trampoline.S; + + extra_dist = loader/i386/bsdXX.c; + extra_dist = loader/i386/bsd_pagetable.c; + i386_pc; i386_qemu; i386_coreboot; From 1896a4aacb5ab8e6b446039f88b6536e4f8fb265 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 3 Jun 2010 15:32:21 +0530 Subject: [PATCH 023/174] bzignore updates --- .bzrignore | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.bzrignore b/.bzrignore index f91e72efa..a2fdef858 100644 --- a/.bzrignore +++ b/.bzrignore @@ -76,4 +76,29 @@ modules.am GPATH GRTAGS GSYMS -GTAGS \ No newline at end of file +GTAGS +Makefile.tpl +compile +depcomp +mdate-sh +texinfo.tex +grub-core/ABOUT-NLS +grub-core/AUTHORS +grub-core/COPYING +grub-core/ChangeLog +grub-core/INSTALL +grub-core/Makefile.tpl +grub-core/NEWS +grub-core/README +grub-core/THANKS +grub-core/TODO +grub-core/acinclude.m4 +grub-core/compile +grub-core/config.rpath +grub-core/configure.common +grub-core/depcomp +grub-core/gentpl.py +grub-core/conf/gcry.rmk +grub-core/lib/libgcrypt-grub +grub-core/include/grub/cpu +grub-core/include/grub/machine From d5c3b7ce0144fc8bc566b2a069a6af3a6efd8671 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 4 Jun 2010 09:34:28 +0530 Subject: [PATCH 024/174] rename libutil to libgrub --- Makefile.am | 20 ++++++++++---------- grub-core/Makefile.am | 1 + modules.def | 30 +++++++++++++++--------------- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9ced44636..99fd490c2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,8 +1,8 @@ AUTOMAKE_OPTIONS = subdir-objects -DEPDIR = .deps-util -EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def geninit.sh +DEPDIR = .deps-util SUBDIRS = . grub-core po docs +EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def geninit.sh include $(top_srcdir)/grub-core/Makefile.vars @@ -32,19 +32,19 @@ grub_script.yy.c grub_script.yy.h: $(top_srcdir)/grub-core/script/yylex.l $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(top_srcdir)/grub-core/script/yylex.l CLEANFILES += grub_script.yy.c grub_script.yy.h -# For libutil.a -libutil.pp: grub_script.tab.h grub_script.yy.h $(libutil_a_SOURCES) - $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libutil_a_CPPFLAGS) $(CPPFLAGS) \ +# For libgrub.a +libgrub.pp: grub_script.tab.h grub_script.yy.h $(libgrub_a_SOURCES) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrub_a_CPPFLAGS) $(CPPFLAGS) \ -D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1) -CLEANFILES += libutil.pp +CLEANFILES += libgrub.pp -libutil_a_init.lst: libutil.pp +libgrub_a_init.lst: libgrub.pp cat $< | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1) -CLEANFILES += libutil_a_init.lst +CLEANFILES += libgrub_a_init.lst -libutil_a_init.c: libutil_a_init.lst $(top_srcdir)/geninit.sh +libgrub_a_init.c: libgrub_a_init.lst $(top_srcdir)/geninit.sh sh $(top_srcdir)/geninit.sh `cat $<` > $@ || (rm -f $@; exit 1) -CLEANFILES += libutil_a_init.c +CLEANFILES += libgrub_a_init.c if COND_GRUB_MKFONT if COND_HAVE_FONT_SOURCE diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 71abb5a7a..61a69fca6 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -1,4 +1,5 @@ AUTOMAKE_OPTIONS = subdir-objects + SUBDIRS = po DEPDIR = .deps-core EXTRA_DIST = gentpl.py modules.def Makefile.tpl genmoddep.awk diff --git a/modules.def b/modules.def index a91aed83e..5a485f9a5 100644 --- a/modules.def +++ b/modules.def @@ -1,13 +1,13 @@ AutoGen definitions Makefile.tpl; library = { - name = libutil.a; + name = libgrub.a; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; nodist = grub_script.tab.c; nodist = grub_script.yy.c; - nodist = libutil_a_init.c; + nodist = libgrub_a_init.c; source = grub-core/gnulib/error.c; source = grub-core/gnulib/fnmatch.c; @@ -98,7 +98,7 @@ library = { program = { name = grub-bin2h; source = util/bin2h.c; - ldadd = libutil.a; + ldadd = libgrub.a; mansection = 1; common; }; @@ -111,7 +111,7 @@ program = { source = util/resolve.c; extra_dist = util/grub-mkimagexx.c; - ldadd = libutil.a; + ldadd = libgrub.a; cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibroot)\"'; common; @@ -123,7 +123,7 @@ program = { source = util/grub-mkrelpath.c; - ldadd = libutil.a; + ldadd = libgrub.a; common; }; @@ -133,7 +133,7 @@ program = { source = util/grub-script-check.c; - ldadd = libutil.a; + ldadd = libgrub.a; common; }; @@ -143,7 +143,7 @@ program = { source = util/grub-editenv.c; - ldadd = libutil.a; + ldadd = libgrub.a; common; }; @@ -153,7 +153,7 @@ program = { source = util/grub-mkpasswd-pbkdf2.c; - ldadd = libutil.a; + ldadd = libgrub.a; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; common; @@ -170,7 +170,7 @@ program = { mansection = 1; source = util/grub-pe2elf.c; - ldadd = libutil.a; + ldadd = libgrub.a; }; program = { @@ -178,7 +178,7 @@ program = { mansection = 1; source = util/grub-fstest.c; - ldadd = libutil.a; + ldadd = libgrub.a; enable = COND_GRUB_FSTEST; common; }; @@ -188,7 +188,7 @@ program = { mansection = 1; source = util/grub-mkfont.c; - ldadd = libutil.a; + ldadd = libgrub.a; cflags = '$(freetype_cflags)'; ldflags = '$(freetype_libs)'; common; @@ -208,7 +208,7 @@ program = { sparc64_ieee1275 = util/ieee1275/ofpath.c; sparc64_ieee1275 = util/ieee1275/devicemap.c; - ldadd = libutil.a; + ldadd = libgrub.a; common; }; @@ -218,7 +218,7 @@ program = { mansection = 8; source = util/grub-probe.c; - ldadd = libutil.a; + ldadd = libgrub.a; common; }; @@ -235,7 +235,7 @@ program = { sparc64_ieee1275 = util/raid.c; sparc64_ieee1275 = util/lvm.c; - ldadd = libutil.a; + ldadd = libgrub.a; }; program = { @@ -244,7 +244,7 @@ program = { source = util/ieee1275/grub-ofpathname.c; source = util/ieee1275/ofpath.c; - ldadd = libutil.a; + ldadd = libgrub.a; sparc64_ieee1275; }; From c0bb7fb68fd1ea581d135a5f9ebef14e52289c92 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 4 Jun 2010 10:30:25 +0530 Subject: [PATCH 025/174] add -lutil for netbsd --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 99fd490c2..8e26d3403 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def geninit.sh include $(top_srcdir)/grub-core/Makefile.vars CFLAGS_PROGRAM = $(HOST_CFLAGS) $(CFLAGS_GNULIB) -LDFLAGS_PROGRAM = $(HOST_LDFLAGS) $(LDFLAGS_GNULIB) $(LIBINTL) +LDFLAGS_PROGRAM = $(HOST_LDFLAGS) $(LDFLAGS_GNULIB) $(LIBINTL) $(LIBUTIL) CPPFLAGS_PROGRAM = $(HOST_CPPFLAGS) $(CPPFLAGS_GNULIB) CCASFLAGS_PROGRAM = $(HOST_CCASFLAGS) $(CCASFLAGS_GNULIB) From b89561390ca9464072f373de1963758c20090cf5 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 4 Jun 2010 15:00:59 +0530 Subject: [PATCH 026/174] remove Ruby requirement from INSTALL --- INSTALL | 1 - 1 file changed, 1 deletion(-) diff --git a/INSTALL b/INSTALL index 7186d20db..585c7e0b4 100644 --- a/INSTALL +++ b/INSTALL @@ -22,7 +22,6 @@ configuring the GRUB. If you use a development snapshot or want to hack on GRUB you may need the following. -* Ruby 1.6 or later * Python 2.5.2 or later * Autoconf 2.60 or later * Automake 1.10.1 or later From d3ff5a05ebd200dad68632fbed0d408a8633335a Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 4 Jun 2010 16:48:42 +0530 Subject: [PATCH 027/174] fix for cygwin build --- configure.ac | 4 ++-- configure.common | 6 +++--- grub-core/Makefile.am | 1 + grub-core/configure.ac | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index dfbc6b8be..9ea1486b7 100644 --- a/configure.ac +++ b/configure.ac @@ -42,11 +42,11 @@ AC_PREREQ(2.60) AC_CONFIG_SRCDIR([grub-core/include/grub/dl.h]) AC_CONFIG_HEADER([config.h]) -m4_include([configure.common]) - grub_coredir='grub-core' AC_SUBST(grub_coredir) +m4_include([configure.common]) + # Output files. AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([po/Makefile]) diff --git a/configure.common b/configure.common index 815c76c53..ac3c4edd4 100644 --- a/configure.common +++ b/configure.common @@ -356,10 +356,10 @@ if test x$grub_cv_apple_target_cc = xyes ; then else TARGET_APPLE_CC=0 # Use linker script if present, otherwise use builtin -N script. -if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then - TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" +if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then + TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext," - TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext," + TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext," else TARGET_IMG_LDSCRIPT= TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,' diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 61a69fca6..85433431d 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -6,6 +6,7 @@ EXTRA_DIST = gentpl.py modules.def Makefile.tpl genmoddep.awk EXTRA_DIST += genmodsrc.sh gensymlist.sh genemuinit.sh genemuinitheader.sh EXTRA_DIST += genfslist.sh gencmdlist.sh genvideolist.sh genhandlerlist.sh EXTRA_DIST += genpartmaplist.sh genparttoollist.sh genterminallist.sh +EXTRA_DIST += conf/i386-pc-cygwin-img-ld.sc EXTRA_DIST += $(shell find $(top_srcdir) -name '*.h') include $(top_srcdir)/Makefile.vars diff --git a/grub-core/configure.ac b/grub-core/configure.ac index 6cac2e75c..8d7d760ac 100644 --- a/grub-core/configure.ac +++ b/grub-core/configure.ac @@ -42,15 +42,15 @@ AC_PREREQ(2.60) AC_CONFIG_SRCDIR([include/grub/dl.h]) AC_CONFIG_HEADER([config.h]) +grub_coredir='.' +AC_SUBST(grub_coredir) + m4_include([configure.common]) CC=$TARGET_CC CPP=$TARGET_CC CCAS=$TARGET_CC -grub_coredir='.' -AC_SUBST(grub_coredir) - # Output files. grub_CHECK_LINK_DIR if test x"$link_dir" = xyes ; then From 40f8acbc5b0bc14ca023e071013283f76dd24b64 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 5 Jun 2010 11:40:25 +0530 Subject: [PATCH 028/174] cleanup --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 8e26d3403..181f3e9ca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def geninit.sh include $(top_srcdir)/grub-core/Makefile.vars CFLAGS_PROGRAM = $(HOST_CFLAGS) $(CFLAGS_GNULIB) -LDFLAGS_PROGRAM = $(HOST_LDFLAGS) $(LDFLAGS_GNULIB) $(LIBINTL) $(LIBUTIL) +LDFLAGS_PROGRAM = $(HOST_LDFLAGS) $(LDFLAGS_GNULIB) CPPFLAGS_PROGRAM = $(HOST_CPPFLAGS) $(CPPFLAGS_GNULIB) CCASFLAGS_PROGRAM = $(HOST_CCASFLAGS) $(CCASFLAGS_GNULIB) From bf14a41c81b2c743d60a208bf45bd4ff3a2aa1fa Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 5 Jun 2010 12:20:37 +0530 Subject: [PATCH 029/174] fixes for netbsd --- modules.def | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules.def b/modules.def index 5a485f9a5..910065083 100644 --- a/modules.def +++ b/modules.def @@ -209,6 +209,7 @@ program = { sparc64_ieee1275 = util/ieee1275/devicemap.c; ldadd = libgrub.a; + ldadd = '$(LIBUTIL)'; common; }; @@ -219,6 +220,7 @@ program = { source = util/grub-probe.c; ldadd = libgrub.a; + ldadd = '$(LIBUTIL)'; common; }; @@ -236,6 +238,7 @@ program = { sparc64_ieee1275 = util/lvm.c; ldadd = libgrub.a; + ldadd = '$(LIBUTIL)'; }; program = { From 83fb6e1d48ab01a197986056b51303ba870ec6ba Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 5 Jun 2010 13:15:18 +0530 Subject: [PATCH 030/174] freebsd fixes --- modules.def | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules.def b/modules.def index 910065083..d62c5566f 100644 --- a/modules.def +++ b/modules.def @@ -99,6 +99,7 @@ program = { name = grub-bin2h; source = util/bin2h.c; ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; mansection = 1; common; }; @@ -112,6 +113,7 @@ program = { extra_dist = util/grub-mkimagexx.c; ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibroot)\"'; common; @@ -124,6 +126,7 @@ program = { source = util/grub-mkrelpath.c; ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; common; }; @@ -134,6 +137,7 @@ program = { source = util/grub-script-check.c; ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; common; }; @@ -144,6 +148,7 @@ program = { source = util/grub-editenv.c; ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; common; }; @@ -154,6 +159,7 @@ program = { source = util/grub-mkpasswd-pbkdf2.c; ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; common; @@ -179,6 +185,7 @@ program = { source = util/grub-fstest.c; ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; enable = COND_GRUB_FSTEST; common; }; @@ -188,6 +195,7 @@ program = { mansection = 1; source = util/grub-mkfont.c; + ldadd = '$(LIBINTL)'; ldadd = libgrub.a; cflags = '$(freetype_cflags)'; ldflags = '$(freetype_libs)'; @@ -209,6 +217,7 @@ program = { sparc64_ieee1275 = util/ieee1275/devicemap.c; ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; ldadd = '$(LIBUTIL)'; common; }; @@ -220,6 +229,7 @@ program = { source = util/grub-probe.c; ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; ldadd = '$(LIBUTIL)'; common; }; @@ -238,6 +248,7 @@ program = { sparc64_ieee1275 = util/lvm.c; ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; ldadd = '$(LIBUTIL)'; }; From 2d465fb052397edff7b3f1b0c72d552b26d3d367 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 7 Jun 2010 17:23:54 +0530 Subject: [PATCH 031/174] cygwin fixes --- acinclude.m4 | 2 +- configure.ac | 3 +++ configure.common | 21 ++++++++++++-------- grub-core/Makefile.kernel | 2 +- grub-core/configure.ac | 3 +++ grub-core/modules.def | 41 ++++++++++++++++++++++++--------------- modules.def | 11 ++++++++--- 7 files changed, 54 insertions(+), 29 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 72483b5d0..0615c863a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -93,7 +93,7 @@ else fi grub_cv_prog_objcopy_absolute=yes for link_addr in 0x2000 0x8000 0x7C00; do - if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC}$link_addr conftest.o -o conftest.exec]); then : + if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},$link_addr conftest.o -o conftest.exec]); then : else AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr]) fi diff --git a/configure.ac b/configure.ac index 9ea1486b7..9b9db0ac4 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,9 @@ AC_CONFIG_HEADER([config.h]) grub_coredir='grub-core' AC_SUBST(grub_coredir) +grub_utildir='.' +AC_SUBST(grub_utildir) + m4_include([configure.common]) # Output files. diff --git a/configure.common b/configure.common index ac3c4edd4..f19e107b1 100644 --- a/configure.common +++ b/configure.common @@ -351,19 +351,22 @@ if test x$grub_cv_apple_target_cc = xyes ; then fi TARGET_IMG_LDSCRIPT= TARGET_IMG_CFLAGS="-static" - TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' - TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,' + TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20' + TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20' + TARGET_IMG_BASE_LDOPT="-Wl,-image_base" else TARGET_APPLE_CC=0 # Use linker script if present, otherwise use builtin -N script. if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" - TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext," - TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext," + TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}" + TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" + TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" else TARGET_IMG_LDSCRIPT= - TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,' - TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,' + TARGET_IMG_LDFLAGS='-Wl,-N' + TARGET_IMG_LDFLAGS_AC='-Wl,-N' + TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" fi TARGET_IMG_CFLAGS= fi @@ -371,7 +374,7 @@ fi # For platforms where ELF is not the default link format. AC_MSG_CHECKING([for command to convert module to ELF format]) case "${host_os}" in - cygwin) TARGET_OBJ2ELF='grub-pe2elf'; + cygwin) TARGET_OBJ2ELF='$(grub_utildir)/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()]) @@ -479,6 +482,7 @@ AC_SUBST(TARGET_CCASFLAGS) AC_SUBST(TARGET_IMG_LDSCRIPT) AC_SUBST(TARGET_IMG_LDFLAGS) AC_SUBST(TARGET_IMG_CFLAGS) +AC_SUBST(TARGET_IMG_BASE_LDOPT) AC_SUBST(HOST_CFLAGS) AC_SUBST(HOST_LDFLAGS) @@ -523,7 +527,7 @@ if test "x$target_cpu" = xi386; then if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then if test ! -z "$TARGET_IMG_LDSCRIPT"; then # Check symbols provided by linker script. - CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100" + CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},8000 -Wl,--defsym,___main=0x8100" fi grub_CHECK_BSS_START_SYMBOL grub_CHECK_END_SYMBOL @@ -830,4 +834,5 @@ AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) AM_CONDITIONAL([COND_GRUB_FSTEST], [test x$enable_grub_fstest = xyes]) +AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x]) AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) diff --git a/grub-core/Makefile.kernel b/grub-core/Makefile.kernel index 8b48cf153..866626c7a 100644 --- a/grub-core/Makefile.kernel +++ b/grub-core/Makefile.kernel @@ -176,8 +176,8 @@ BUILT_SOURCES += symlist.c noinst_DATA += kernel_syms.lst kernel_syms.lst: $(KERNEL_HEADER_FILES) config.h - if grep "^#define HAVE_ASM_USCORE" config.h; then u="_"; else u=""; fi $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input + if grep "^#define HAVE_ASM_USCORE" config.h; then u="_"; else u=""; fi; \ cat kernel_syms.input | grep -v '^#' | sed -n \ -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \ -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \ diff --git a/grub-core/configure.ac b/grub-core/configure.ac index 8d7d760ac..7c3175fea 100644 --- a/grub-core/configure.ac +++ b/grub-core/configure.ac @@ -45,6 +45,9 @@ AC_CONFIG_HEADER([config.h]) grub_coredir='.' AC_SUBST(grub_coredir) +grub_utildir='..' +AC_SUBST(grub_utildir) + m4_include([configure.common]) CC=$TARGET_CC diff --git a/grub-core/modules.def b/grub-core/modules.def index c64217d5d..0e3b53fd8 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -5,10 +5,15 @@ kernel = { emu_ldflags = '-Wl,-r'; x86_efi_ldflags = '-Wl,-r'; - i386_pc_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + + i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + i386_coreboot_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; i386_multiboot_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; - i386_qemu_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; i386_ieee1275_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; mips_yeeloong_ldflags = '-Wl,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; powerpc_ieee1275_ldflags = '-Wl,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; @@ -258,10 +263,13 @@ module = { image = { name = boot; i386_pc = boot/i386/pc/boot.S; - i386_pc_ldflags = "-Wl,-Ttext=0x7C00"; - i386_qemu = boot/i386/qemu/boot.S; - i386_qemu_ldflags = '-Wl,-Ttext,$(GRUB_BOOT_MACHINE_LINK_ADDR)'; + + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + + i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_BOOT_MACHINE_LINK_ADDR)'; i386_qemu_ccasflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)'; sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S; @@ -271,24 +279,25 @@ image = { image = { name = cdboot; - source = boot/i386/pc/cdboot.S; - ldflags = "-Wl,-Ttext=0x7C00"; - - i386_pc; + i386_pc = boot/i386/pc/cdboot.S; + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; }; image = { name = pxeboot; - source = boot/i386/pc/pxeboot.S; - ldflags = '-Wl,-Ttext=0x7C00'; + i386_pc = boot/i386/pc/pxeboot.S; - i386_pc; + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; }; image = { name = diskboot; i386_pc = boot/i386/pc/diskboot.S; - i386_pc_ldflags = '-Wl,-Ttext=0x8000'; + + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8000'; sparc64_ieee1275 = boot/sparc64/ieee1275/diskboot.S; sparc64_ieee1275_ldflags = '-Wl,-Ttext=0x4200'; @@ -296,10 +305,10 @@ image = { image = { name = lnxboot; - source = boot/i386/pc/lnxboot.S; - ldflags = '-Wl,-Ttext=0x6000'; + i386_pc = boot/i386/pc/lnxboot.S; - i386_pc; + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x6000'; }; module = { diff --git a/modules.def b/modules.def index d62c5566f..766c8a604 100644 --- a/modules.def +++ b/modules.def @@ -177,6 +177,9 @@ program = { source = util/grub-pe2elf.c; ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; + enable = COND_GRUB_PE2ELF; + common; }; program = { @@ -195,10 +198,12 @@ program = { mansection = 1; source = util/grub-mkfont.c; - ldadd = '$(LIBINTL)'; - ldadd = libgrub.a; cflags = '$(freetype_cflags)'; - ldflags = '$(freetype_libs)'; + + ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; + ldadd = '$(freetype_libs)'; + common; enable = COND_GRUB_MKFONT; }; From e235a2289dcdb5181a91e78cffeb78a65880a71e Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 7 Jun 2010 21:28:37 +0530 Subject: [PATCH 032/174] more cygwin fixes --- gentpl.py | 12 ++++++------ grub-core/modules.def | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gentpl.py b/gentpl.py index 02369d843..7a5986a9e 100644 --- a/gentpl.py +++ b/gentpl.py @@ -154,7 +154,7 @@ def platform_format(platform): return each_group(platform, "_format", lamb def module(platform): r = gvar_add("noinst_PROGRAMS", "[+ name +].module") - r += gvar_add("MODULE_FILES", "[+ name +].module") + r += gvar_add("MODULE_FILES", "[+ name +].module$(EXEEXT)") r += var_set(canonical_module() + "_SOURCES", platform_sources(platform) + "## platform sources") r += var_add(canonical_module() + "_SOURCES", shared_sources() + "## shared sources") @@ -192,23 +192,23 @@ def module(platform): [+ name +].pp: $(""" + canonical_module() + """_SOURCES) $(nodist_""" + canonical_module() + """_SOURCES) $(TARGET_CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + canonical_module() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@ || (rm -f $@; exit 1) -def-[+ name +].lst: [+ name +].module +def-[+ name +].lst: [+ name +].module$(EXEEXT) if test x$(USE_APPLE_CC_FIXES) = xyes; then \ $(NM) -g -P -p $< | grep -E '^[a-zA-Z0-9_]* [TDS]' | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@; \ else \ $(NM) -g --defined-only -P -p $< | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@; \ fi -und-[+ name +].lst: [+ name +].module +und-[+ name +].lst: [+ name +].module$(EXEEXT) $(NM) -u -P -p $< | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@ -mod-[+ name +].c: [+ name +].module $(top_builddir)/moddep.lst $(top_srcdir)/genmodsrc.sh +mod-[+ name +].c: [+ name +].module$(EXEEXT) $(top_builddir)/moddep.lst $(top_srcdir)/genmodsrc.sh sh $(top_srcdir)/genmodsrc.sh [+ name +] $(top_builddir)/moddep.lst > $@ || (rm -f $@; exit 1) mod-[+ name +].o: mod-[+ name +].c $(TARGET_CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS_MODULE) $(CPPFLAGS) $(CFLAGS_MODULE) $(CFLAGS) -c -o $@ $< -[+ name +].mod: [+ name +].module mod-[+ name +].o +[+ name +].mod: [+ name +].module$(EXEEXT) mod-[+ name +].o if test x$(USE_APPLE_CC_FIXES) = xyes; then \ $(CCLD) $(LDFLAGS_MODULE) $(LDFLAGS) -o $@.bin $^; \ $(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -nu -nd $@.bin $@; \ @@ -303,7 +303,7 @@ def image(platform): r += gvar_add("platform_DATA", "[+ name +].img") r += gvar_add("CLEANFILES", "[+ name +].img") - r += rule("[+ name +].img", "[+ name +].image", """ + r += rule("[+ name +].img", "[+ name +].image$(EXEEXT)", """ if test x$(USE_APPLE_CC_FIXES) = xyes; then \ $(MACHO2IMG) $< $@; \ else \ diff --git a/grub-core/modules.def b/grub-core/modules.def index 0e3b53fd8..42c6398a1 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -233,7 +233,7 @@ program = { source = kern/emu/full.c; nodist = grub_emu_init.c; - ldadd = kernel.img; + ldadd = 'kernel.img$(EXEEXT)'; ldadd = '$(MODULE_FILES)'; ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS)'; @@ -247,19 +247,12 @@ program = { source = kern/emu/cache.S; nodist = symlist.c; - ldadd = kernel.img; + ldadd = 'kernel.img$(EXEEXT)'; ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS)'; emu; }; -module = { - name = trig; - nodist = trigtables.c; - extra_dist = gentrigtables.c; - common; -}; - image = { name = boot; i386_pc = boot/i386/pc/boot.S; @@ -311,6 +304,13 @@ image = { i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x6000'; }; +module = { + name = trig; + nodist = trigtables.c; + extra_dist = gentrigtables.c; + common; +}; + module = { name = libusb; source = bus/usb/emu/usb.c; From ff174dbea117ef33d06176e09b8ce648c3d4ae72 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 8 Jun 2010 17:37:17 +0530 Subject: [PATCH 033/174] add autogen to INSTALL --- INSTALL | 1 + autogen.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/INSTALL b/INSTALL index 418b3002d..bbfa01f0a 100644 --- a/INSTALL +++ b/INSTALL @@ -40,6 +40,7 @@ need the following. * Python 2.5.2 or later * Autoconf 2.60 or later * Automake 1.10.1 or later +* Autogen 5.10 or later Prerequisites for make-check: diff --git a/autogen.sh b/autogen.sh index db640702b..46ccc0627 100755 --- a/autogen.sh +++ b/autogen.sh @@ -2,6 +2,8 @@ set -e +autogen --version >/dev/null || (echo autogen missing; exit 1) + echo "Creating symlinks..." ln -svf ../NEWS grub-core/ ln -svf ../TODO grub-core/ From d270972ab046a49798cabe73d1e9c1bacc5aad18 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 8 Jun 2010 18:08:45 +0530 Subject: [PATCH 034/174] fix pkglibrootdir for grub-mkimage --- modules.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules.def b/modules.def index 766c8a604..8b709a869 100644 --- a/modules.def +++ b/modules.def @@ -115,7 +115,7 @@ program = { ldadd = libgrub.a; ldadd = '$(LIBINTL)'; - cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibroot)\"'; + cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"'; common; }; From 911bd64013d0f9398df278e41dd53ca8995a34eb Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 13 Jul 2010 23:35:24 +0530 Subject: [PATCH 035/174] make build by default --- configure.common | 1 + gentpl.py | 350 ++++++++++++++++--------------------- grub-core/configure.ac | 2 + grub-core/modules.def | 381 +++++++++++++++++------------------------ modules.def | 119 +++++-------- 5 files changed, 354 insertions(+), 499 deletions(-) diff --git a/configure.common b/configure.common index 46a3fd5e4..a9e5665dd 100644 --- a/configure.common +++ b/configure.common @@ -848,4 +848,5 @@ AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) AM_CONDITIONAL([COND_GRUB_FSTEST], [test x$enable_grub_fstest = xyes]) AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x]) +AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC != x]) AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) diff --git a/gentpl.py b/gentpl.py index de2efe80a..5081cf483 100644 --- a/gentpl.py +++ b/gentpl.py @@ -17,7 +17,6 @@ GROUPS["sparc64"] = [ "sparc64_ieee1275" ] GROUPS["powerpc"] = [ "powerpc_ieee1275" ] GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"] GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ] -GROUPS["common"] = GRUB_PLATFORMS[:] GROUPS["nonemu"] = GRUB_PLATFORMS[:] GROUPS["nonemu"].remove("emu") @@ -75,100 +74,92 @@ def var_add(var, value): # Autogen constructs # -def if_tag(tag, closure): - return "[+ IF " + tag + " +]" + closure() + "[+ ENDIF +]" +def set_canonical_name_suffix(suffix): return "[+ % name `export cname=$(echo -n %s" + suffix + " | sed -e 's/[^0-9A-Za-z@_]/_/g')` +]" +def cname(): return "[+ % name `echo $cname` +]" -def if_tag_defined(tag, closure): - return "[+ IF " + tag + " defined +]" + closure() + "[+ ENDIF +]" - -def for_tag(tag, closure): - return "[+ FOR ." + tag + " +]" + closure() + "[+ ENDFOR +]" - -def collect_values(tag, prefix=""): - return for_tag(tag, lambda: prefix + "[+ ." + tag + " +] ") - -def each_group(platform, suffix, closure): - r = None - for group in RMAP[platform]: - if r == None: - r = "[+ IF ." + group + suffix + " +]" - else: - r += "[+ ELIF ." + group + suffix + " +]" - - r += closure(group) - - if r: - r += "[+ ELSE +]" - r += closure(None) - r += "[+ ENDIF +]" +def rule(target, source, cmd): + if cmd[0] == "\n": + return "\n" + target + ": " + source + cmd.replace("\n", "\n\t") + "\n" else: - r = closure(None) + return "\n" + target + ": " + source + "\n\t" + cmd.replace("\n", "\n\t") + "\n" +def if_platform_tagged(platform, tag, closure, c2=None): + r = "" + r += "[+ IF " + tag + " defined +]" + r += "[+ FOR " + tag + " +][+ CASE " + tag + " +]" + for group in RMAP[platform]: + r += "[+ = \"" + group + "\" +]" + closure() + r += "[+ ESAC +][+ ENDFOR +]" + + if c2 == None: + r += "[+ ENDIF +]" + return r + + r += "[+ ELSE +]" + c2() + "[+ ENDIF +]" return r +def platform_values(platform, group_tag, default_tag): + r = "" + for group in RMAP[platform]: + gtag = group + group_tag + + if group == RMAP[platform][0]: + r += "[+ IF " + gtag + " +]" + else: + r += "[+ ELIF " + gtag + " +]" + + r += "[+ FOR " + gtag + " +][+ ." + gtag + " +] [+ ENDFOR +]" + r += "[+ ELSE +][+ FOR " + default_tag + " +][+ ." + default_tag + " +] [+ ENDFOR +][+ ENDIF +]" + return r + +def under_conditional(x): + return "[+ IF condition +]\nif [+ condition +]\n[+ ENDIF +]" + x + "[+ IF condition +]\nendif\n[+ ENDIF +]" + def each_platform(closure): - r = "" + r = "[+ IF - enable undefined +]" for platform in GRUB_PLATFORMS: - for group in RMAP[platform]: - if group == RMAP[platform][0]: - r += "[+ IF ." + group + " defined +]" - else: - r += "[+ ELIF ." + group + " defined +]" + r += "\nif COND_" + platform + "\n" + closure(platform) + "endif\n" + r += "[+ ELSE +]" + for platform in GRUB_PLATFORMS: + x = "\nif COND_" + platform + "\n" + closure(platform) + "endif\n" + r += if_platform_tagged(platform, "enable", lambda: x) + r += "[+ ENDIF +]" + return r; - r += "if COND_" + platform + "\n" - r += closure(platform) - r += "endif\n" - r += "[+ ENDIF +]" - return r +def shared_sources(): return "[+ FOR shared +][+ .shared +] [+ ENDFOR +]" +def shared_nodist_sources(): return "[+ FOR nodist_shared +] [+ .nodist_shared +][+ ENDFOR +]" -def canonical_name(): return "[+ % name `echo -n %s | sed -e 's/[^0-9A-Za-z@_]/_/g'` +]" -def canonical_module(): return canonical_name() + "_module" -def canonical_kernel(): return canonical_name() + "_img" -def canonical_image(): return canonical_name() + "_image" +def platform_sources(p): return platform_values(p, "", "source") +def platform_nodist_sources(p): return platform_values(p, "_nodist", "nodist") +def platform_extra_dist(p): return platform_values(p, "_extra_dist", "extra_dist") -def shared_sources(prefix=""): return collect_values("shared", prefix) -def shared_nodist_sources(prefix=""): return collect_values("nodist_shared", prefix) - -def default_sources(prefix=""): return collect_values("source", prefix) -def default_nodist_sources(prefix=""): return collect_values("nodist", prefix) -def default_ldadd(): return collect_values("ldadd") -def default_cflags(): return collect_values("cflags") -def default_ldflags(): return collect_values("ldflags") -def default_cppflags(): return collect_values("cppflags") -def default_ccasflags(): return collect_values("ccasflags") -def default_extra_dist(): return collect_values("extra_dist") - -def group_sources(group, prefix=""): return collect_values(group, prefix) if group else default_sources(prefix) -def group_nodist_sources(group, prefix=""): return collect_values(group + "_nodist", prefix) if group else default_nodist_sources(prefix) - -def platform_sources(platform, prefix=""): return each_group(platform, "", lambda g: collect_values(g, prefix) if g else default_sources(prefix)) -def platform_nodist_sources(platform, prefix=""): return each_group(platform, "_nodist", lambda g: collect_values(g + "_nodist", prefix) if g else default_nodist_sources(prefix)) - -def platform_ldadd(platform): return each_group(platform, "_ldadd", lambda g: collect_values(g + "_ldadd") if g else default_ldadd()) -def platform_cflags(platform): return each_group(platform, "_cflags", lambda g: collect_values(g + "_cflags") if g else default_cflags()) -def platform_ldflags(platform): return each_group(platform, "_ldflags", lambda g: collect_values(g + "_ldflags") if g else default_ldflags()) -def platform_cppflags(platform): return each_group(platform, "_cppflags", lambda g: collect_values(g + "_cppflags") if g else default_cppflags()) -def platform_ccasflags(platform): return each_group(platform, "_ccasflags", lambda g: collect_values(g + "_ccasflags") if g else default_ccasflags()) -def platform_extra_dist(platform): return each_group(platform, "_extra_dist", lambda g: collect_values(g + "_extra_dist") if g else default_extra_dist()) -def platform_format(platform): return each_group(platform, "_format", lambda g: collect_values(g + "_format") if g else "binary") +def platform_ldadd(p): return platform_values(p, "_ldadd", "ldadd") +def platform_cflags(p): return platform_values(p, "_cflags", "cflags") +def platform_ldflags(p): return platform_values(p, "_ldflags", "ldflags") +def platform_cppflags(p): return platform_values(p, "_cppflags", "cppflags") +def platform_ccasflags(p): return platform_values(p, "_ccasflags", "ccasflags") +def platform_stripflags(p): return platform_values(p, "_stripflags", "stripflags") +def platform_objcopyflags(p): return platform_values(p, "_objcopyflags", "objcopyflags") def module(platform): - r = gvar_add("noinst_PROGRAMS", "[+ name +].module") + r = set_canonical_name_suffix(".module") + + r += gvar_add("noinst_PROGRAMS", "[+ name +].module") r += gvar_add("MODULE_FILES", "[+ name +].module$(EXEEXT)") - r += var_set(canonical_module() + "_SOURCES", platform_sources(platform) + "## platform sources") - r += var_add(canonical_module() + "_SOURCES", shared_sources() + "## shared sources") - r += var_set("nodist_" + canonical_module() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources") - r += var_add("nodist_" + canonical_module() + "_SOURCES", shared_nodist_sources() + "## shared nodist sources") - r += var_set(canonical_module() + "_LDADD", platform_ldadd(platform)) - r += var_set(canonical_module() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_MODULE) " + platform_cflags(platform)) - r += var_set(canonical_module() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_MODULE) " + platform_ldflags(platform)) - r += var_set(canonical_module() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_MODULE) " + platform_cppflags(platform)) - r += var_set(canonical_module() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(platform)) + r += var_set(cname() + "_SOURCES", platform_sources(platform) + " ## platform sources") + r += var_add(cname() + "_SOURCES", shared_sources() + " ## shared sources") + r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## platform nodist sources") + r += var_add("nodist_" + cname() + "_SOURCES", shared_nodist_sources() + " ## shared nodist sources") + r += var_set(cname() + "_LDADD", platform_ldadd(platform)) + r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_MODULE) " + platform_cflags(platform)) + r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_MODULE) " + platform_ldflags(platform)) + r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_MODULE) " + platform_cppflags(platform)) + r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) - r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_module() + "_SOURCES)") - r += gvar_add("CLEANFILES", "$(nodist_" + canonical_module() + "_SOURCES)") + r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") + r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)") r += gvar_add("DEF_FILES", "def-[+ name +].lst") r += gvar_add("UND_FILES", "und-[+ name +].lst") @@ -189,8 +180,8 @@ def module(platform): r += gvar_add("CLEANFILES", "[+ name +].pp") r += """ -[+ name +].pp: $(""" + canonical_module() + """_SOURCES) $(nodist_""" + canonical_module() + """_SOURCES) - $(TARGET_CPP) -DGRUB_LST_GENERATOR $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + canonical_module() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@ || (rm -f $@; exit 1) +[+ name +].pp: $(""" + cname() + """_SOURCES) $(nodist_""" + cname() + """_SOURCES) + $(TARGET_CPP) -DGRUB_LST_GENERATOR $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@ || (rm -f $@; exit 1) def-[+ name +].lst: [+ name +].module$(EXEEXT) if test x$(USE_APPLE_CC_FIXES) = xyes; then \ @@ -242,64 +233,47 @@ terminal-[+ name +].lst: [+ name +].pp $(top_srcdir)/genterminallist.sh """ return r -def rule(target, source, cmd): - if cmd[0] == "\n": - return "\n" + target + ": " + source + cmd.replace("\n", "\n\t") + "\n" - else: - return "\n" + target + ": " + source + "\n\t" + cmd.replace("\n", "\n\t") + "\n" - -def image_nostrip(platform): - return if_tag_defined("image_nostrip." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", "cp $< $@")) - -def image_strip(platform): - return if_tag_defined("image_strip." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", "$(STRIP) -o $@ -R .rel.dyn -R .reginfo -R .note -R .comment $<")) - -def image_strip_keep_kernel(platform): - return if_tag_defined("image_strip_keep_kernel." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", "$(STRIP) -o $@ --strip-unneeded -K start -R .note -R .comment $<")) - -def image_strip_macho2img(platform): - return if_tag_defined("image_strip_macho2img." + platform, lambda: rule("[+ name +].img", "[+ name +].exec", """ -if test "x$(TARGET_APPLE_CC)" = x1; then \ - $(MACHO2IMG) --bss $< $@ || exit 1; \ -else \ - $(STRIP) -o $@ -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< || exit 1; \ -fi -""")) - def kernel(platform): - r = gvar_add("noinst_PROGRAMS", "[+ name +].img") - r += var_set(canonical_kernel() + "_SOURCES", platform_sources(platform)) - r += var_add(canonical_kernel() + "_SOURCES", shared_sources()) - r += var_set("nodist_" + canonical_kernel() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources") - r += var_add("nodist_" + canonical_kernel() + "_SOURCES", shared_nodist_sources() + "## shared nodist sources") - r += var_set(canonical_kernel() + "_LDADD", platform_ldadd(platform)) - r += var_set(canonical_kernel() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_KERNEL) " + platform_cflags(platform)) - r += var_set(canonical_kernel() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_KERNEL) " + platform_ldflags(platform)) - r += var_set(canonical_kernel() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) " + platform_cppflags(platform)) - r += var_set(canonical_kernel() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_KERNEL) " + platform_ccasflags(platform)) + r = set_canonical_name_suffix(".exec") + r += gvar_add("noinst_PROGRAMS", "[+ name +].exec") + r += var_set(cname() + "_SOURCES", platform_sources(platform)) + r += var_add(cname() + "_SOURCES", shared_sources()) + r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## platform nodist sources") + r += var_add("nodist_" + cname() + "_SOURCES", shared_nodist_sources() + " ## shared nodist sources") + r += var_set(cname() + "_LDADD", platform_ldadd(platform)) + r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_KERNEL) " + platform_cflags(platform)) + r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_KERNEL) " + platform_ldflags(platform)) + r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) " + platform_cppflags(platform)) + r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_KERNEL) " + platform_ccasflags(platform)) + r += var_set(cname() + "_STRIPFLAGS", "$(AM_STRIPFLAGS) $(STRIPFLAGS_KERNEL) " + platform_stripflags(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) - r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_kernel() + "_SOURCES)") - r += gvar_add("CLEANFILES", "$(nodist_" + canonical_kernel() + "_SOURCES)") + r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") + r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)") r += gvar_add("platform_DATA", "[+ name +].img") + r += gvar_add("CLEANFILES", "[+ name +].img") + r += rule("[+ name +].img", "[+ name +].exec$(EXEEXT)", + if_platform_tagged(platform, "nostrip", lambda: "cp $@ $<", + lambda: "$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<")) return r def image(platform): - r = gvar_add("noinst_PROGRAMS", "[+ name +].image") - r += var_set(canonical_image() + "_SOURCES", platform_sources(platform)) - r += var_add(canonical_image() + "_SOURCES", shared_sources()) - r += var_set("nodist_" + canonical_image() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources") - r += var_add("nodist_" + canonical_image() + "_SOURCES", shared_nodist_sources() + "## shared nodist sources") - r += var_set(canonical_image() + "_LDADD", platform_ldadd(platform)) - r += var_set(canonical_image() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_IMAGE) " + platform_cflags(platform)) - r += var_set(canonical_image() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_IMAGE) " + platform_ldflags(platform)) - r += var_set(canonical_image() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_IMAGE) " + platform_cppflags(platform)) - r += var_set(canonical_image() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_IMAGE) " + platform_ccasflags(platform)) + r = set_canonical_name_suffix(".image") + r += gvar_add("noinst_PROGRAMS", "[+ name +].image") + r += var_set(cname() + "_SOURCES", platform_sources(platform)) + r += var_add(cname() + "_SOURCES", shared_sources()) + r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources") + r += var_add("nodist_" + cname() + "_SOURCES", shared_nodist_sources() + "## shared nodist sources") + r += var_set(cname() + "_LDADD", platform_ldadd(platform)) + r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_IMAGE) " + platform_cflags(platform)) + r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_IMAGE) " + platform_ldflags(platform)) + r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_IMAGE) " + platform_cppflags(platform)) + r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_IMAGE) " + platform_ccasflags(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) - r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_image() + "_SOURCES)") - r += gvar_add("CLEANFILES", "$(nodist_" + canonical_image() + "_SOURCES)") + r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") + r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)") r += gvar_add("platform_DATA", "[+ name +].img") r += gvar_add("CLEANFILES", "[+ name +].img") @@ -307,24 +281,25 @@ def image(platform): if test x$(USE_APPLE_CC_FIXES) = xyes; then \ $(MACHO2IMG) $< $@; \ else \ - $(OBJCOPY) -O """ + platform_format(platform) + """ --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@; \ + $(OBJCOPY) """ + platform_objcopyflags(platform) + """ --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@; \ fi """) return r def library(platform): - r = gvar_add("noinst_LIBRARIES", "[+ name +]") - r += var_set(canonical_name() + "_SOURCES", platform_sources(platform)) - r += var_add(canonical_name() + "_SOURCES", shared_sources()) - r += var_set("nodist_" + canonical_name() + "_SOURCES", platform_nodist_sources(platform)) - r += var_add("nodist_" + canonical_name() + "_SOURCES", shared_nodist_sources()) - r += var_set(canonical_name() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_LIBRARY) " + platform_cflags(platform)) - r += var_set(canonical_name() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) " + platform_cppflags(platform)) - r += var_set(canonical_name() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) " + platform_ccasflags(platform)) + r = set_canonical_name_suffix("") + r += gvar_add("noinst_LIBRARIES", "[+ name +]") + r += var_set(cname() + "_SOURCES", platform_sources(platform)) + r += var_add(cname() + "_SOURCES", shared_sources()) + r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform)) + r += var_add("nodist_" + cname() + "_SOURCES", shared_nodist_sources()) + r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_LIBRARY) " + platform_cflags(platform)) + r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) " + platform_cppflags(platform)) + r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) " + platform_ccasflags(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) - r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_name() + "_SOURCES)") - r += gvar_add("CLEANFILES", "$(nodist_" + canonical_name() + "_SOURCES)") + r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") + r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)") return r @@ -344,46 +319,45 @@ PATH=$(builddir):$$PATH $(HELP2MAN) --section=[+ mansection +] -i $(top_srcdir)/ return r def program(platform, test=False): - if test: - r = gvar_add("check_PROGRAMS", "[+ name +]") - else: - r = gvar_add(installdir() + "_PROGRAMS", "[+ name +]") + r = set_canonical_name_suffix("") - r += var_set(canonical_name() + "_SOURCES", platform_sources(platform)) - r += var_add(canonical_name() + "_SOURCES", shared_sources()) - r += var_set("nodist_" + canonical_name() + "_SOURCES", platform_nodist_sources(platform)) - r += var_add("nodist_" + canonical_name() + "_SOURCES", shared_nodist_sources()) - r += var_set(canonical_name() + "_LDADD", platform_ldadd(platform)) - r += var_set(canonical_name() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_PROGRAM) " + platform_cflags(platform)) - r += var_set(canonical_name() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_PROGRAM) " + platform_ldflags(platform)) - r += var_set(canonical_name() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM) " + platform_cppflags(platform)) - r += var_set(canonical_name() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM) " + platform_ccasflags(platform)) + r += "[+ IF testcase defined +]" + r += gvar_add("check_PROGRAMS", "[+ name +]") + r += gvar_add("TESTS", "[+ name +]") + r += "[+ ELSE +]" + r += gvar_add(installdir() + "_PROGRAMS", "[+ name +]") + r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]" + r += "[+ ENDIF +]" + + r += var_set(cname() + "_SOURCES", platform_sources(platform)) + r += var_add(cname() + "_SOURCES", shared_sources()) + r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform)) + r += var_add("nodist_" + cname() + "_SOURCES", shared_nodist_sources()) + r += var_set(cname() + "_LDADD", platform_ldadd(platform)) + r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_PROGRAM) " + platform_cflags(platform)) + r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_PROGRAM) " + platform_ldflags(platform)) + r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM) " + platform_cppflags(platform)) + r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM) " + platform_ccasflags(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) - r += gvar_add("BUILT_SOURCES", "$(nodist_" + canonical_name() + "_SOURCES)") - r += gvar_add("CLEANFILES", "$(nodist_" + canonical_name() + "_SOURCES)") - - if test: - r += if_tag_defined("enable", lambda: gvar_add("TESTS", "[+ name +]")) - else: - r += if_tag("mansection", lambda: manpage()) - + r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") + r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)") return r -def test_program(platform): - return program(platform, True) - def data(platform): r = gvar_add("EXTRA_DIST", platform_sources(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add(installdir() + "_DATA", platform_sources(platform)) return r -def script(platform, test=False): - if test: - r = gvar_add("check_SCRIPTS", "[+ name +]") - else: - r = gvar_add(installdir() + "_SCRIPTS", "[+ name +]") +def script(platform): + r = "[+ IF testcase defined +]" + r += gvar_add("check_SCRIPTS", "[+ name +]") + r += gvar_add ("TESTS", "[+ name +]") + r += "[+ ELSE +]" + r += gvar_add(installdir() + "_SCRIPTS", "[+ name +]") + r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]" + r += "[+ ENDIF +]" r += rule("[+ name +]", "$(top_builddir)/config.status " + platform_sources(platform), """ $(top_builddir)/config.status --file=-:""" + platform_sources(platform) + """ \ @@ -393,46 +367,28 @@ chmod a+x [+ name +] r += gvar_add("CLEANFILES", "[+ name +]") r += gvar_add("EXTRA_DIST", platform_sources(platform)) - - if test: - r += if_tag_defined("enable", lambda: gvar_add("TESTS", "[+ name +]")) - else: - r += if_tag("mansection", lambda: manpage()) - return r -def test_script(platform): - return script(platform, True) - -def with_enable_condition(x): - return "[+ IF enable +]if [+ enable +]\n" + x + "endif\n[+ ELSE +]" + x + "[+ ENDIF +]" - def module_rules(): - return for_tag("module", lambda: with_enable_condition(each_platform(lambda p: module(p)))) + return "[+ FOR module +]" + under_conditional(each_platform(lambda p: module(p))) + "[+ ENDFOR +]" def kernel_rules(): - return for_tag("kernel", lambda: with_enable_condition(each_platform(lambda p: kernel(p)))) + return "[+ FOR kernel +]" + under_conditional(each_platform(lambda p: kernel(p))) + "[+ ENDFOR +]" def image_rules(): - return for_tag("image", lambda: with_enable_condition(each_platform(lambda p: image(p)))) + return "[+ FOR image +]" + under_conditional(each_platform(lambda p: image(p))) + "[+ ENDFOR +]" def library_rules(): - return for_tag("library", lambda: with_enable_condition(each_platform(lambda p: library(p)))) + return "[+ FOR library +]" + under_conditional(each_platform(lambda p: library(p))) + "[+ ENDFOR +]" def program_rules(): - return for_tag("program", lambda: with_enable_condition(each_platform(lambda p: program(p)))) + return "[+ FOR program +]" + under_conditional(each_platform(lambda p: program(p))) + "[+ ENDFOR +]" def script_rules(): - return for_tag("script", lambda: with_enable_condition(each_platform(lambda p: script(p)))) + return "[+ FOR script +]" + under_conditional(each_platform(lambda p: script(p))) + "[+ ENDFOR +]" def data_rules(): - return for_tag("data", lambda: with_enable_condition(each_platform(lambda p: data(p)))) - -def test_program_rules(): - return for_tag("test_program", lambda: with_enable_condition(each_platform(lambda p: test_program(p)))) - -def test_script_rules(): - return for_tag("test_script", lambda: with_enable_condition(each_platform(lambda p: test_script(p)))) + return "[+ FOR data +]" + under_conditional(each_platform(lambda p: data(p))) + "[+ ENDFOR +]" print "[+ AutoGen5 template +]\n" a = module_rules() @@ -442,11 +398,9 @@ d = library_rules() e = program_rules() f = script_rules() g = data_rules() -h = test_program_rules() -i = test_script_rules() z = global_variable_initializers() -print z # initializer for all vars +# print z # initializer for all vars print a print b print c @@ -454,8 +408,6 @@ print d print e print f print g -print h -print i print """.PRECIOUS: modules.am $(srcdir)/modules.am: $(srcdir)/modules.def $(top_srcdir)/Makefile.tpl diff --git a/grub-core/configure.ac b/grub-core/configure.ac index 7c3175fea..5ba5962a3 100644 --- a/grub-core/configure.ac +++ b/grub-core/configure.ac @@ -33,6 +33,8 @@ dnl package (in grub-core directory) builds with TARGETCC. AC_INIT([GRUB],[1.98],[bug-grub@gnu.org]) AC_CONFIG_AUX_DIR([.]) +: ${CFLAGS=""} # We don't want -g -O2 + # Checks for host and target systems. AC_CANONICAL_HOST AC_CANONICAL_TARGET diff --git a/grub-core/modules.def b/grub-core/modules.def index 08eb6e4ea..b63c70922 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -3,8 +3,9 @@ AutoGen definitions Makefile.tpl; kernel = { name = kernel; - emu_ldflags = '-Wl,-r'; - x86_efi_ldflags = '-Wl,-r'; + emu_ldflags = '-Wl,-r,-d'; + x86_efi_ldflags = '-Wl,-r,-d'; + x86_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment'; i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; @@ -246,7 +247,7 @@ program = { ldadd = '$(MODULE_FILES)'; ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS)'; - emu; + enable = emu; }; program = { @@ -259,7 +260,7 @@ program = { ldadd = 'kernel.img$(EXEEXT)'; ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS)'; - emu; + enable = emu; }; image = { @@ -275,8 +276,13 @@ image = { i386_qemu_ccasflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)'; sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S; - sparc64_ieee1275_format = a.out-sunos-big; + sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big'; sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000'; + + objcopyflags = '-O binary'; + enable = i386_pc; + enable = i386_qemu; + enable = sparc64_ieee1275; }; image = { @@ -284,6 +290,8 @@ image = { i386_pc = boot/i386/pc/cdboot.S; i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + objcopyflags = '-O binary'; + enable = i386_pc; }; image = { @@ -292,6 +300,9 @@ image = { i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + + objcopyflags = '-O binary'; + enable = i386_pc; }; image = { @@ -303,6 +314,11 @@ image = { sparc64_ieee1275 = boot/sparc64/ieee1275/diskboot.S; sparc64_ieee1275_ldflags = '-Wl,-Ttext=0x4200'; + + objcopyflags = '-O binary'; + + enable = i386_pc; + enable = sparc64_ieee1275; }; image = { @@ -311,44 +327,49 @@ image = { i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x6000'; + + objcopyflags = '-O binary'; + enable = i386_pc; }; image = { name = fwstart; mips_yeeloong = boot/mips/yeeloong/fwstart.S; + objcopyflags = '-O binary'; + enable = mips_yeeloong; }; module = { name = trig; nodist = trigtables.c; extra_dist = gentrigtables.c; - common; }; module = { name = cs5536; source = bus/cs5536.c; - i386; + enable = i386; }; module = { name = libusb; source = bus/usb/emu/usb.c; - emu; - enable = COND_GRUB_EMU_USB; + enable = emu; + condition = COND_GRUB_EMU_USB; }; module = { name = lsspd; mips_yeeloong = commands/mips/yeeloong/lsspd.c; + enable = mips_yeeloong; }; module = { name = pci; source = bus/emu/pci.c; source = commands/lspci.c; - emu; - enable = COND_GRUB_EMU_PCI; + enable = emu; + condition = COND_GRUB_EMU_PCI; }; module = { @@ -356,37 +377,37 @@ module = { source = bus/usb/usb.c; source = bus/usb/usbtrans.c; source = bus/usb/usbhub.c; - i386; - mips_yeeloong; + enable = i386; + enable = mips_yeeloong; }; module = { name = usb; source = bus/usb/usb.c; - emu; - enable = COND_GRUB_EMU_USB; + enable = emu; + condition = COND_GRUB_EMU_USB; }; module = { name = uhci; source = bus/usb/uhci.c; - x86; + enable = x86; }; module = { name = ohci; source = bus/usb/ohci.c; - x86; - mips_yeeloong; + enable = x86; + enable = mips_yeeloong; }; module = { name = pci; source = bus/pci.c; - i386_pc; - i386_efi; - i386_ieee1275; - i386_coreboot; + enable = i386_pc; + enable = i386_efi; + enable = i386_ieee1275; + enable = i386_coreboot; }; library = { @@ -400,13 +421,12 @@ library = { cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; - common; }; module = { name = iorw; source = commands/iorw.c; - i386; + enable = i386; }; module = { @@ -415,7 +435,6 @@ module = { ldadd = libgnulib.a; cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; - common; }; module = { @@ -426,16 +445,17 @@ module = { i386_pc = commands/acpi.c; i386_pc = commands/i386/pc/acpi.c; + + enable = x86_efi; + enable = i386_pc; }; module = { - common; name = blocklist; source = commands/blocklist.c; }; module = { - common; name = boot; source = commands/boot.c; @@ -444,19 +464,16 @@ module = { }; module = { - common; name = cat; source = commands/cat.c; }; module = { - common; name = cmp; source = commands/cmp.c; }; module = { - common; name = configfile; source = commands/configfile.c; }; @@ -465,23 +482,18 @@ module = { name = cpuid; source = commands/i386/cpuid.c; - x86; + enable = x86; }; module = { - common; name = crc; source = commands/crc.c; source = lib/crc.c; }; module = { - common; name = date; source = commands/date.c; - - x86; - mips; }; module = { @@ -489,16 +501,15 @@ module = { i386_pc = commands/i386/pc/drivemap.c; i386_pc = commands/i386/pc/drivemap_int13h.S; + enable = i386_pc; }; module = { - common; name = echo; source = commands/echo.c; }; module = { - common; name = extcmd; source = commands/extcmd.c; source = lib/arg.c; @@ -507,10 +518,10 @@ module = { module = { name = fixvideo; x86_efi = commands/efi/fixvideo.c; + enable = x86_efi; }; module = { - common; name = gptsync; source = commands/gptsync.c; }; @@ -520,15 +531,9 @@ module = { source = commands/halt.c; i386_pc = commands/i386/pc/halt.c; - emu; - x86; - sparc64; - powerpc; - mips_yeeloong; }; module = { - common; name = hashsum; source = commands/hashsum.c; }; @@ -538,24 +543,21 @@ module = { source = commands/hdparm.c; source = lib/hexdump.c; - i386_pc; + enable = i386_pc; }; module = { - common; name = help; source = commands/help.c; }; module = { - common; name = hexdump; source = commands/hexdump.c; source = lib/hexdump.c; }; module = { - common; name = keystatus; source = commands/keystatus.c; }; @@ -563,69 +565,62 @@ module = { module = { name = loadbios; x86_efi = commands/efi/loadbios.c; + enable = x86_efi; }; module = { - common; name = loadenv; source = commands/loadenv.c; source = lib/envblk.c; }; module = { - common; name = ls; source = commands/ls.c; }; module = { - common; name = lsmmap; source = commands/lsmmap.c; - i386_pc; - i386_qemu; - i386_coreboot; - i386_multiboot; - i386_ieee1275; - mips_yeeloong; - powerpc_ieee1275; + enable = i386_pc; + enable = i386_qemu; + enable = i386_coreboot; + enable = i386_multiboot; + enable = i386_ieee1275; + enable = mips_yeeloong; + enable = powerpc_ieee1275; }; module = { name = lspci; source = commands/lspci.c; - x86; - mips; + enable = x86; + enable = mips; }; module = { - common; name = memrw; source = commands/memrw.c; }; module = { - common; name = minicmd; source = commands/minicmd.c; }; module = { - common; name = parttool; source = commands/parttool.c; }; module = { - common; name = password; source = commands/password.c; }; module = { - common; name = password_pbkdf2; source = commands/password_pbkdf2.c; }; @@ -633,11 +628,10 @@ module = { module = { name = play; source = commands/i386/pc/play.c; - i386; + enable = i386; }; module = { - common; name = probe; source = commands/probe.c; }; @@ -645,43 +639,36 @@ module = { module = { name = pxecmd; i386_pc = commands/i386/pc/pxecmd.c; + enable = i386_pc; }; module = { - common; name = read; source = commands/read.c; }; module = { - common; name = reboot; source = commands/reboot.c; - - x86; powerpc; sparc64; }; module = { - common; name = search; source = commands/search_wrap.c; extra_dist = commands/search.c; }; module = { - common; name = search_fs_file; source = commands/search_file.c; }; module = { - common; name = search_fs_uuid; source = commands/search_uuid.c; }; module = { - common; name = search_label; source = commands/search_label.c; }; @@ -690,11 +677,10 @@ module = { name = setpci; source = commands/setpci.c; - x86; + enable = x86; }; module = { - common; name = sleep; source = commands/sleep.c; }; @@ -702,24 +688,21 @@ module = { module = { name = suspend; source = commands/ieee1275/suspend.c; - i386_ieee1275; - powerpc_ieee1275; + enable = i386_ieee1275; + enable = powerpc_ieee1275; }; module = { - common; name = terminal; source = commands/terminal.c; }; module = { - common; name = test; source = commands/test.c; }; module = { - common; name = true; source = commands/true.c; }; @@ -727,89 +710,80 @@ module = { module = { name = usbtest; source = commands/usbtest.c; - i386_pc; - mips_yeeloong; + enable = i386_pc; + enable = mips_yeeloong; }; module = { name = usbtest; source = commands/usbtest.c; - emu; - enable = COND_GRUB_EMU_USB; + enable = emu; + condition = COND_GRUB_EMU_USB; }; module = { name = vbeinfo; i386_pc = commands/i386/pc/vbeinfo.c; + enable = i386_pc; }; module = { name = vbetest; i386_pc = commands/i386/pc/vbetest.c; + enable = i386_pc; }; module = { - common; name = videotest; source = commands/videotest.c; }; module = { - common; name = xnu_uuid; source = commands/xnu_uuid.c; }; module = { - common; name = dm_nv; source = disk/dmraid_nvidia.c; }; module = { - common; name = loopback; source = disk/loopback.c; }; module = { - common; name = lvm; source = disk/lvm.c; }; module = { - common; name = mdraid; source = disk/mdraid_linux.c; }; module = { - common; name = raid; source = disk/raid.c; }; module = { - common; name = raid5rec; source = disk/raid5_recover.c; }; module = { - common; name = raid6rec; source = disk/raid6_recover.c; }; module = { - common; name = scsi; source = disk/scsi.c; }; module = { - common; name = memdisk; source = disk/memdisk.c; }; @@ -818,42 +792,43 @@ module = { name = ata; source = disk/ata.c; - x86; - mips; + enable = x86; + enable = mips; }; module = { name = ata_pthru; source = disk/ata_pthru.c; - x86; - mips_yeeloong; + enable = x86; + enable = mips_yeeloong; }; module = { name = biosdisk; i386_pc = disk/i386/pc/biosdisk.c; + enable = i386_pc; }; module = { name = usbms; source = disk/usbms.c; - i386_pc; - mips_yeeloong; + enable = i386_pc; + enable = mips_yeeloong; }; module = { name = usbms; source = disk/usbms.c; - emu; - enable = COND_GRUB_EMU_USB; + enable = emu; + condition = COND_GRUB_EMU_USB; }; module = { name = nand; source = disk/ieee1275/nand.c; - i386_ieee1275; + enable = i386_ieee1275; }; module = { @@ -876,158 +851,136 @@ module = { extra_dist = efiemu/loadcore.c; extra_dist = efiemu/runtime/efiemu.S; extra_dist = efiemu/runtime/efiemu.c; + + enable = i386_pc; }; module = { name = font; source = font/font.c; source = font/font_cmd.c; - emu; - x86; - sparc64; - powerpc; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; }; module = { - common; name = affs; source = fs/affs.c; }; module = { - common; name = afs; source = fs/afs.c; }; module = { - common; name = afs_be; source = fs/afs_be.c; }; module = { - common; name = befs; source = fs/befs.c; }; module = { - common; name = befs_be; source = fs/befs_be.c; }; module = { - common; name = cpio; source = fs/cpio.c; }; module = { - common; name = ext2; source = fs/ext2.c; }; module = { - common; name = fat; source = fs/fat.c; }; module = { - common; name = fshelp; source = fs/fshelp.c; }; module = { - common; name = hfs; source = fs/hfs.c; }; module = { - common; name = hfsplus; source = fs/hfsplus.c; }; module = { - common; name = iso9660; source = fs/iso9660.c; }; module = { - common; name = jfs; source = fs/jfs.c; }; module = { - common; name = minix; source = fs/minix.c; }; module = { - common; name = nilfs2; source = fs/nilfs2.c; }; module = { - common; name = ntfs; source = fs/ntfs.c; }; module = { - common; name = ntfscomp; source = fs/ntfscomp.c; }; module = { - common; name = reiserfs; source = fs/reiserfs.c; }; module = { - common; name = sfs; source = fs/sfs.c; }; module = { - common; name = tar; source = fs/tar.c; }; module = { - common; name = udf; source = fs/udf.c; }; module = { - common; name = ufs1; source = fs/ufs.c; }; module = { - common; name = ufs2; source = fs/ufs2.c; }; module = { - common; name = xfs; source = fs/xfs.c; }; @@ -1035,16 +988,15 @@ module = { module = { name = pxe; i386_pc = fs/i386/pc/pxe.c; + enable = i386_pc; }; module = { name = gettext; source = gettext/gettext.c; - common; }; module = { - common; name = gfxmenu; source = gfxmenu/gfxmenu.c; source = gfxmenu/model.c; @@ -1066,13 +1018,11 @@ module = { }; module = { - common; name = hello; source = hello/hello.c; }; module = { - common; name = gzio; source = io/gzio.c; }; @@ -1080,20 +1030,18 @@ module = { module = { name = bufio; source = io/bufio.c; - emu; - x86; - sparc64; - powerpc; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; }; module = { - common; name = elf; source = kern/elf.c; }; module = { - common; name = crypto; source = lib/crypto.c; @@ -1101,7 +1049,6 @@ module = { }; module = { - common; name = gcry_arcfour; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1109,7 +1056,6 @@ module = { }; module = { - common; name = gcry_blowfish; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1117,7 +1063,6 @@ module = { }; module = { - common; name = gcry_camellia; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1126,7 +1071,6 @@ module = { }; module = { - common; name = gcry_cast5; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1134,7 +1078,6 @@ module = { }; module = { - common; name = gcry_crc; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1142,7 +1085,6 @@ module = { }; module = { - common; name = gcry_des; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1150,7 +1092,6 @@ module = { }; module = { - common; name = gcry_md4; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1158,7 +1099,6 @@ module = { }; module = { - common; name = gcry_md5; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1166,7 +1106,6 @@ module = { }; module = { - common; name = gcry_rfc2268; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1174,7 +1113,6 @@ module = { }; module = { - common; name = gcry_rijndael; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1182,7 +1120,6 @@ module = { }; module = { - common; name = gcry_rmd160; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1190,7 +1127,6 @@ module = { }; module = { - common; name = gcry_seed; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1198,7 +1134,6 @@ module = { }; module = { - common; name = gcry_serpent; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1206,7 +1141,6 @@ module = { }; module = { - common; name = gcry_sha1; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1214,7 +1148,6 @@ module = { }; module = { - common; name = gcry_sha256; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1222,7 +1155,6 @@ module = { }; module = { - common; name = gcry_sha512; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1230,7 +1162,6 @@ module = { }; module = { - common; name = gcry_tiger; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1238,7 +1169,6 @@ module = { }; module = { - common; name = gcry_twofish; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1246,7 +1176,6 @@ module = { }; module = { - common; name = gcry_whirlpool; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; @@ -1254,7 +1183,6 @@ module = { }; module = { - common; name = pbkdf2; source = lib/pbkdf2.c; }; @@ -1267,6 +1195,8 @@ module = { x86 = lib/i386/relocator_asm.S; x86 = lib/i386/relocator_backward.S; extra_dist = lib/relocator.c; + enable = mips; + enable = x86; }; module = { @@ -1275,8 +1205,10 @@ module = { x86_efi = lib/efi/datetime.c; sparc64_ieee1275 = lib/ieee1275/datetime.c; powerpc_ieee1275 = lib/ieee1275/datetime.c; - x86; - mips; + enable = x86; + enable = mips; + enable = sparc64_ieee1275; + enable = powerpc_ieee1275; }; module = { @@ -1291,11 +1223,11 @@ module = { module = { name = aout; source = loader/aout.c; - i386_pc; - i386_qemu; - i386_coreboot; - i386_multiboot; - i386_ieee1275; + enable = i386_pc; + enable = i386_qemu; + enable = i386_coreboot; + enable = i386_multiboot; + enable = i386_ieee1275; }; module = { @@ -1309,16 +1241,16 @@ module = { extra_dist = loader/i386/bsdXX.c; extra_dist = loader/i386/bsd_pagetable.c; - i386_pc; - i386_qemu; - i386_coreboot; - i386_multiboot; + enable = i386_pc; + enable = i386_qemu; + enable = i386_coreboot; + enable = i386_multiboot; }; module = { name = linux16; source = loader/i386/pc/linux.c; - i386_pc; + enable = i386_pc; }; module = { @@ -1327,8 +1259,8 @@ module = { source = loader/multiboot.c; source = loader/multiboot_mbi2.c; - x86; - mips; + enable = x86; + enable = mips; }; module = { @@ -1336,7 +1268,7 @@ module = { source = loader/multiboot.c; source = loader/i386/multiboot_mbi.c; extra_dist = loader/multiboot_elfxx.c; - x86; + enable = x86; }; module = { @@ -1349,6 +1281,7 @@ module = { mips = loader/mips/linux.c; powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c; sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c; + enable = nonemu; }; module = { @@ -1368,17 +1301,22 @@ module = { i386_pc = loader/xnu.c; extra_dist = loader/machoXX.c; + enable = i386_pc; + enable = x86_efi; }; module = { name = appleldr; x86_efi = loader/efi/appleloader.c; + enable = x86_efi; }; module = { name = chain; x86_efi = loader/efi/chainloader.c; i386_pc = loader/i386/pc/chainloader.c; + enable = i386_pc; + enable = x86_efi; }; module = { @@ -1412,10 +1350,12 @@ module = { mips_yeeloong = mmap/mmap.c; mips_yeeloong = mmap/mips/yeeloong/uppermem.c; + + enable = x86; + enable = mips_yeeloong; }; module = { - common; name = normal; source = normal/main.c; source = normal/cmdline.c; @@ -1454,55 +1394,46 @@ module = { }; module = { - common; name = part_acorn; source = partmap/acorn.c; }; module = { - common; name = part_amiga; source = partmap/amiga.c; }; module = { - common; name = part_apple; source = partmap/apple.c; }; module = { - common; name = part_gpt; source = partmap/gpt.c; }; module = { - common; name = part_msdos; source = partmap/msdos.c; }; module = { - common; name = part_sun; source = partmap/sun.c; }; module = { - common; name = part_bsd; source = partmap/bsdlabel.c; }; module = { - common; name = part_sunpc; source = partmap/sunpc.c; }; module = { - common; name = msdospart; source = parttool/msdospart.c; }; @@ -1510,26 +1441,25 @@ module = { module = { name = at_keyboard; source = term/at_keyboard.c; - x86; + enable = x86; }; module = { name = gfxterm; source = term/gfxterm.c; - emu; - x86; - sparc64; - powerpc; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; }; module = { name = serial; source = term/serial.c; - i386; + enable = i386; }; module = { - common; name = terminfo; source = term/terminfo.c; source = term/tparm.c; @@ -1538,87 +1468,88 @@ module = { module = { name = usb_keyboard; source = term/usb_keyboard.c; - i386_pc; - mips_yeeloong; + enable = i386_pc; + enable = mips_yeeloong; }; module = { name = vga; i386_pc = video/i386/pc/vga.c; + enable = i386_pc; }; module = { name = vga_text; x86 = term/i386/pc/vga_text.c; x86 = term/i386/vga_common.c; + enable = x86; }; module = { name = video_cirrus; i386 = video/cirrus.c; + enable = i386; }; module = { name = video_bochs; i386 = video/bochs.c; + enable = i386; }; module = { name = functional_test; source = tests/lib/functional_test.c; source = tests/lib/test.c; - common; }; module = { name = example_functional_test; source = tests/example_functional_test.c; cflags = -Wno-format; - common; }; module = { name = bitmap; source = video/bitmap.c; - emu; - x86; - sparc64; - powerpc; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; }; module = { name = bitmap_scale; source = video/bitmap_scale.c; - emu; - x86; - sparc64; - powerpc; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; }; module = { name = efi_gop; x86_efi = video/efi_gop.c; + enable = x86_efi; }; module = { name = efi_uga; x86_efi = video/efi_uga.c; + enable = x86_efi; }; module = { - common; name = jpeg; source = video/readers/jpeg.c; }; module = { - common; name = png; source = video/readers/png.c; }; module = { - common; name = tga; source = video/readers/tga.c; }; @@ -1626,6 +1557,7 @@ module = { module = { name = vbe; i386_pc = video/i386/pc/vbe.c; + enable = i386_pc; }; module = { @@ -1634,37 +1566,36 @@ module = { source = video/fb/fbblit.c; source = video/fb/fbfill.c; source = video/fb/fbutil.c; - emu; - x86; - sparc64; - powerpc; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; }; module = { name = video; source = video/video.c; - emu; - x86; - sparc64; - powerpc; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; }; module = { name = ieee1275_fb; source = video/ieee1275.c; - powerpc; - sparc64; + enable = powerpc; + enable = sparc64; }; module = { name = sdl; source = video/emu/sdl.c; - enable = COND_GRUB_EMU_SDL; - emu; + condition = COND_GRUB_EMU_SDL; + enable = emu; }; module = { name = datehook; source = hook/datehook.c; - common; }; diff --git a/modules.def b/modules.def index c8ce44cbe..23d7d14cd 100644 --- a/modules.def +++ b/modules.def @@ -90,7 +90,6 @@ library = { source = grub-core/script/lexer.c; source = grub-core/script/main.c; source = grub-core/script/script.c; - common; }; program = { @@ -99,7 +98,6 @@ program = { ldadd = libgrub.a; ldadd = '$(LIBINTL)'; mansection = 1; - common; }; program = { @@ -114,7 +112,6 @@ program = { ldadd = '$(LIBINTL)'; cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"'; - common; }; program = { @@ -125,7 +122,6 @@ program = { ldadd = libgrub.a; ldadd = '$(LIBINTL)'; - common; }; program = { @@ -136,7 +132,6 @@ program = { ldadd = libgrub.a; ldadd = '$(LIBINTL)'; - common; }; program = { @@ -147,7 +142,6 @@ program = { ldadd = libgrub.a; ldadd = '$(LIBINTL)'; - common; }; program = { @@ -160,13 +154,13 @@ program = { ldadd = '$(LIBINTL)'; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; - common; }; program = { name = grub-macho2img; mansection = 1; source = util/grub-macho2img.c; + condition = COND_APPLE_CC; }; program = { @@ -176,8 +170,7 @@ program = { ldadd = libgrub.a; ldadd = '$(LIBINTL)'; - enable = COND_GRUB_PE2ELF; - common; + condition = COND_GRUB_PE2ELF; }; program = { @@ -187,8 +180,7 @@ program = { ldadd = libgrub.a; ldadd = '$(LIBINTL)'; - enable = COND_GRUB_FSTEST; - common; + condition = COND_GRUB_FSTEST; }; program = { @@ -202,9 +194,7 @@ program = { ldadd = libgrub.a; ldadd = '$(LIBINTL)'; ldadd = '$(freetype_libs)'; - - common; - enable = COND_GRUB_MKFONT; + condition = COND_GRUB_MKFONT; }; program = { @@ -223,7 +213,6 @@ program = { ldadd = libgrub.a; ldadd = '$(LIBINTL)'; ldadd = '$(LIBUTIL)'; - common; }; program = { @@ -235,7 +224,6 @@ program = { ldadd = libgrub.a; ldadd = '$(LIBINTL)'; ldadd = '$(LIBUTIL)'; - common; }; program = { @@ -254,6 +242,9 @@ program = { ldadd = libgrub.a; ldadd = '$(LIBINTL)'; ldadd = '$(LIBUTIL)'; + + enable = i386_pc; + enable = sparc64_ieee1275; }; program = { @@ -263,20 +254,18 @@ program = { source = util/ieee1275/ofpath.c; ldadd = libgrub.a; - sparc64_ieee1275; + enable = sparc64_ieee1275; }; data = { source = util/grub.d/README; installdir = grubconf; - common; }; script = { name = '00_header'; source = util/grub.d/00_header.in; installdir = grubconf; - common; }; script = { @@ -295,28 +284,24 @@ script = { name = '10_linux'; source = util/grub.d/10_linux.in; installdir = grubconf; - common; }; script = { name = '30_os-prober'; source = util/grub.d/30_os-prober.in; installdir = grubconf; - common; }; script = { name = '40_custom'; source = util/grub.d/40_custom.in; installdir = grubconf; - common; }; script = { name = '41_custom'; source = util/grub.d/41_custom.in; installdir = grubconf; - common; }; script = { @@ -324,9 +309,10 @@ script = { name = grub-mkrescue; source = util/grub-mkrescue.in; powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in; - i386_pc; - i386_qemu; - i386_coreboot; + enable = i386_pc; + enable = i386_qemu; + enable = i386_coreboot; + enable = powerpc_ieee1275; }; script = { @@ -337,10 +323,10 @@ script = { x86_efi = util/i386/efi/grub-install.in; i386_ieee1275 = util/ieee1275/grub-install.in; powerpc_ieee1275 = util/ieee1275/grub-install.in; - mips; - i386_pc; - i386_qemu; - i386_coreboot; + + enable = x86; + enable = mips; + enable = powerpc_ieee1275; }; script = { @@ -348,7 +334,6 @@ script = { source = util/grub-mkconfig.in; mansection = 8; installdir = sbin; - common; }; script = { @@ -356,7 +341,6 @@ script = { source = util/grub-set-default.in; mansection = 8; installdir = sbin; - common; }; script = { @@ -364,118 +348,104 @@ script = { source = util/grub-reboot.in; mansection = 8; installdir = sbin; - common; }; script = { name = grub-mkconfig_lib; source = util/grub-mkconfig_lib.in; installdir = pkglib; - common; }; script = { name = update-grub_lib; source = util/update-grub_lib.in; installdir = pkglib; - common; }; -test_script = { +script = { name = grub-shell; source = tests/util/grub-shell.in; - common; }; -test_script = { +script = { name = grub-shell-tester; source = tests/util/grub-shell-tester.in; - common; }; -test_script = { +script = { + testcase; name = example_scripted_test; source = tests/example_scripted_test.in; - common; }; -test_script = { +script = { + testcase; name = example_grub_script_test; source = tests/example_grub_script_test.in; - common; }; -test_script = { +script = { + testcase; name = grub_script_echo1; source = tests/grub_script_echo1.in; - common; - enable; }; -test_script = { +script = { + testcase; name = grub_script_echo_keywords; source = tests/grub_script_echo_keywords.in; - common; - enable; }; -test_script = { +script = { + testcase; name = grub_script_vars1; source = tests/grub_script_vars1.in; - common; - enable; }; -test_script = { +script = { + testcase; name = grub_script_for1; source = tests/grub_script_for1.in; - common; - enable; }; -test_script = { +script = { + testcase; name = grub_script_while1; source = tests/grub_script_while1.in; - common; - enable; }; -test_script = { +script = { + testcase; name = grub_script_if; source = tests/grub_script_if.in; - common; - enable; }; -test_script = { +script = { + testcase; name = grub_script_blanklines; source = tests/grub_script_blanklines.in; - common; - enable; }; -test_script = { +script = { + testcase; name = grub_script_final_semicolon; source = tests/grub_script_final_semicolon.in; - common; - enable; }; -test_script = { +script = { + testcase; name = grub_script_dollar; source = tests/grub_script_dollar.in; - common; - enable; }; -test_script = { +script = { + testcase; name = grub_script_comments; source = tests/grub_script_comments.in; - common; - enable; }; -test_program = { +program = { + testcase; name = example_unit_test; source = tests/example_unit_test.c; source = tests/lib/unit_test.c; @@ -484,5 +454,4 @@ test_program = { source = grub-core/tests/lib/test.c; cflags = -Wno-format; ldadd = libgrub.a; - common; }; From c1c6e4c0176baf20a4dc60296a1ac781bb93ab8b Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 13 Jul 2010 23:58:30 +0530 Subject: [PATCH 036/174] emu platform fixes --- gentpl.py | 2 +- grub-core/modules.def | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gentpl.py b/gentpl.py index 5081cf483..a85dd3ed9 100644 --- a/gentpl.py +++ b/gentpl.py @@ -254,7 +254,7 @@ def kernel(platform): r += gvar_add("platform_DATA", "[+ name +].img") r += gvar_add("CLEANFILES", "[+ name +].img") r += rule("[+ name +].img", "[+ name +].exec$(EXEEXT)", - if_platform_tagged(platform, "nostrip", lambda: "cp $@ $<", + if_platform_tagged(platform, "nostrip", lambda: "cp $< $@", lambda: "$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<")) return r diff --git a/grub-core/modules.def b/grub-core/modules.def index b63c70922..b2d57a6fd 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -3,6 +3,8 @@ AutoGen definitions Makefile.tpl; kernel = { name = kernel; + nostrip = emu; + emu_ldflags = '-Wl,-r,-d'; x86_efi_ldflags = '-Wl,-r,-d'; x86_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment'; @@ -1218,6 +1220,7 @@ module = { mips = lib/mips/setjmp.S; sparc64 = lib/sparc64/setjmp.S; powerpc = lib/powerpc/setjmp.S; + emu = 'lib/$(target_cpu)/setjmp.S'; }; module = { From d9b78bce4a1c8d9334712890fc44008197cd4b92 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 15 Jul 2010 02:02:01 +0530 Subject: [PATCH 037/174] more build fixes --- .bzrignore | 2 + autogen.sh | 3 ++ gentpl.py | 98 ++++++++++++++++++++++++++++--------------- grub-core/modules.def | 22 +++++----- 4 files changed, 81 insertions(+), 44 deletions(-) diff --git a/.bzrignore b/.bzrignore index a1835ce07..ac5e3f86d 100644 --- a/.bzrignore +++ b/.bzrignore @@ -105,6 +105,8 @@ grub-core/configure.common grub-core/depcomp grub-core/gentpl.py grub-core/conf/gcry.rmk +grub-core/docs +grub-core/docs/man grub-core/lib/libgcrypt-grub grub-core/include/grub/cpu grub-core/include/grub/machine diff --git a/autogen.sh b/autogen.sh index e41caa5f2..49cd1fca5 100755 --- a/autogen.sh +++ b/autogen.sh @@ -20,6 +20,9 @@ ln -svf ../config.rpath grub-core/ ln -svf ../gentpl.py grub-core/ ln -svf ../configure.common grub-core/ +mkdir -vp grub-core/docs/man +ln -svf ../../../docs/man/grub-emu.h2m grub-core/docs/man + echo "Creating Makefile.tpl..." python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl echo "Running autogen..." diff --git a/gentpl.py b/gentpl.py index a85dd3ed9..baaae51bc 100644 --- a/gentpl.py +++ b/gentpl.py @@ -83,38 +83,53 @@ def rule(target, source, cmd): else: return "\n" + target + ": " + source + "\n\t" + cmd.replace("\n", "\n\t") + "\n" -def if_platform_tagged(platform, tag, closure, c2=None): +# +# Template for keys with platform names as values, for example: +# +# kernel = { +# nostrip = emu; +# nostrip = i386_pc; +# } +# +def if_platform_tagged(platform, tag, snippet_if, snippet_else=None): r = "" r += "[+ IF " + tag + " defined +]" r += "[+ FOR " + tag + " +][+ CASE " + tag + " +]" for group in RMAP[platform]: - r += "[+ = \"" + group + "\" +]" + closure() + r += "[+ = \"" + group + "\" +]" + snippet_if + + if snippet_else != None: r += "[+ * +]" + snippet_if r += "[+ ESAC +][+ ENDFOR +]" - if c2 == None: + if snippet_else == None: r += "[+ ENDIF +]" return r - r += "[+ ELSE +]" + c2() + "[+ ENDIF +]" + r += "[+ ELSE +]" + snippet_else + "[+ ENDIF +]" return r -def platform_values(platform, group_tag, default_tag): +# +# Template for handling platform specific values, for example: +# +# module = { +# cflags = '-Wall'; +# emu_cflags = '-Wall -DGRUB_EMU=1'; +# } +# +def foreach_platform_value(platform, tag, suffix, closure): r = "" for group in RMAP[platform]: - gtag = group + group_tag + gtag = group + suffix if group == RMAP[platform][0]: r += "[+ IF " + gtag + " +]" else: r += "[+ ELIF " + gtag + " +]" - r += "[+ FOR " + gtag + " +][+ ." + gtag + " +] [+ ENDFOR +]" - r += "[+ ELSE +][+ FOR " + default_tag + " +][+ ." + default_tag + " +] [+ ENDFOR +][+ ENDIF +]" + r += "[+ FOR " + gtag + " +]" + closure("[+ ." + gtag + " +]") + "[+ ENDFOR +]" + r += "[+ ELSE +][+ FOR " + tag + " +]" + closure("[+ ." + tag + " +]") + "[+ ENDFOR +][+ ENDIF +]" return r -def under_conditional(x): - return "[+ IF condition +]\nif [+ condition +]\n[+ ENDIF +]" + x + "[+ IF condition +]\nendif\n[+ ENDIF +]" - def each_platform(closure): r = "[+ IF - enable undefined +]" for platform in GRUB_PLATFORMS: @@ -122,24 +137,33 @@ def each_platform(closure): r += "[+ ELSE +]" for platform in GRUB_PLATFORMS: x = "\nif COND_" + platform + "\n" + closure(platform) + "endif\n" - r += if_platform_tagged(platform, "enable", lambda: x) + r += if_platform_tagged(platform, "enable", x) r += "[+ ENDIF +]" - return r; + return r + +def under_platform_specific_conditionals(platform, snippet): + r = foreach_platform_value(platform, "condition", "_condition", lambda cond: "if " + cond + "\n") + r += snippet + r += foreach_platform_value(platform, "condition", "_condition", lambda cond: "endif " + cond + "\n") + return r + +def platform_specific_values(platform, tag, suffix): + return foreach_platform_value(platform, tag, suffix, lambda value: value + " ") def shared_sources(): return "[+ FOR shared +][+ .shared +] [+ ENDFOR +]" def shared_nodist_sources(): return "[+ FOR nodist_shared +] [+ .nodist_shared +][+ ENDFOR +]" -def platform_sources(p): return platform_values(p, "", "source") -def platform_nodist_sources(p): return platform_values(p, "_nodist", "nodist") -def platform_extra_dist(p): return platform_values(p, "_extra_dist", "extra_dist") +def platform_sources(p): return platform_specific_values(p, "source", "") +def platform_nodist_sources(p): return platform_specific_values(p, "nodist", "_nodist") +def platform_extra_dist(p): return platform_specific_values(p, "extra_dist", "_extra_dist") -def platform_ldadd(p): return platform_values(p, "_ldadd", "ldadd") -def platform_cflags(p): return platform_values(p, "_cflags", "cflags") -def platform_ldflags(p): return platform_values(p, "_ldflags", "ldflags") -def platform_cppflags(p): return platform_values(p, "_cppflags", "cppflags") -def platform_ccasflags(p): return platform_values(p, "_ccasflags", "ccasflags") -def platform_stripflags(p): return platform_values(p, "_stripflags", "stripflags") -def platform_objcopyflags(p): return platform_values(p, "_objcopyflags", "objcopyflags") +def platform_ldadd(p): return platform_specific_values(p, "ldadd", "_ldadd") +def platform_cflags(p): return platform_specific_values(p, "cflags", "_cflags") +def platform_ldflags(p): return platform_specific_values(p, "ldflags", "_ldflags") +def platform_cppflags(p): return platform_specific_values(p, "cppflags", "_cppflags") +def platform_ccasflags(p): return platform_specific_values(p, "ccasflags", "_ccasflags") +def platform_stripflags(p): return platform_specific_values(p, "stripflags", "_stripflags") +def platform_objcopyflags(p): return platform_specific_values(p, "objcopyflags", "_objcopyflags") def module(platform): r = set_canonical_name_suffix(".module") @@ -254,8 +278,8 @@ def kernel(platform): r += gvar_add("platform_DATA", "[+ name +].img") r += gvar_add("CLEANFILES", "[+ name +].img") r += rule("[+ name +].img", "[+ name +].exec$(EXEEXT)", - if_platform_tagged(platform, "nostrip", lambda: "cp $< $@", - lambda: "$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<")) + if_platform_tagged(platform, "nostrip", "cp $< $@", + "$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<")) return r def image(platform): @@ -270,6 +294,7 @@ def image(platform): r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_IMAGE) " + platform_ldflags(platform)) r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_IMAGE) " + platform_cppflags(platform)) r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_IMAGE) " + platform_ccasflags(platform)) + r += var_set(cname() + "_OBJCOPYFLAGS", "$(OBJCOPYFLAGS_IMAGE) " + platform_objcopyflags(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") @@ -281,7 +306,7 @@ def image(platform): if test x$(USE_APPLE_CC_FIXES) = xyes; then \ $(MACHO2IMG) $< $@; \ else \ - $(OBJCOPY) """ + platform_objcopyflags(platform) + """ --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@; \ + $(OBJCOPY) $(""" + cname() + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@; \ fi """) return r @@ -370,25 +395,32 @@ chmod a+x [+ name +] return r def module_rules(): - return "[+ FOR module +]" + under_conditional(each_platform(lambda p: module(p))) + "[+ ENDFOR +]" + return "[+ FOR module +]" + each_platform( + lambda p: under_platform_specific_conditionals(p, module(p))) + "[+ ENDFOR +]" def kernel_rules(): - return "[+ FOR kernel +]" + under_conditional(each_platform(lambda p: kernel(p))) + "[+ ENDFOR +]" + return "[+ FOR kernel +]" + each_platform( + lambda p: under_platform_specific_conditionals(p, kernel(p))) + "[+ ENDFOR +]" def image_rules(): - return "[+ FOR image +]" + under_conditional(each_platform(lambda p: image(p))) + "[+ ENDFOR +]" + return "[+ FOR image +]" + each_platform( + lambda p: under_platform_specific_conditionals(p, image(p))) + "[+ ENDFOR +]" def library_rules(): - return "[+ FOR library +]" + under_conditional(each_platform(lambda p: library(p))) + "[+ ENDFOR +]" + return "[+ FOR library +]" + each_platform( + lambda p: under_platform_specific_conditionals(p, library(p))) + "[+ ENDFOR +]" def program_rules(): - return "[+ FOR program +]" + under_conditional(each_platform(lambda p: program(p))) + "[+ ENDFOR +]" + return "[+ FOR program +]" + each_platform( + lambda p: under_platform_specific_conditionals(p, program(p))) + "[+ ENDFOR +]" def script_rules(): - return "[+ FOR script +]" + under_conditional(each_platform(lambda p: script(p))) + "[+ ENDFOR +]" + return "[+ FOR script +]" + each_platform( + lambda p: under_platform_specific_conditionals(p, script(p))) + "[+ ENDFOR +]" def data_rules(): - return "[+ FOR data +]" + under_conditional(each_platform(lambda p: data(p))) + "[+ ENDFOR +]" + return "[+ FOR data +]" + each_platform( + lambda p: under_platform_specific_conditionals(p, data(p))) + "[+ ENDFOR +]" print "[+ AutoGen5 template +]\n" a = module_rules() diff --git a/grub-core/modules.def b/grub-core/modules.def index b2d57a6fd..4e4db8d36 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -141,6 +141,8 @@ kernel = { i386_ieee1275 = kern/ieee1275/ieee1275.c; i386_ieee1275 = term/ieee1275/ofconsole.c; i386_ieee1275 = disk/ieee1275/ofdisk.c; + i386_ieee1275 = term/terminfo.c; + i386_ieee1275 = term/tparm.c; x86_64_efi = kern/x86_64/efi/startup.S; x86_64_efi = kern/x86_64/efi/callwrap.S; @@ -366,14 +368,6 @@ module = { enable = mips_yeeloong; }; -module = { - name = pci; - source = bus/emu/pci.c; - source = commands/lspci.c; - enable = emu; - condition = COND_GRUB_EMU_PCI; -}; - module = { name = usb; source = bus/usb/usb.c; @@ -393,23 +387,29 @@ module = { module = { name = uhci; source = bus/usb/uhci.c; - enable = x86; + enable = i386_pc; }; module = { name = ohci; source = bus/usb/ohci.c; - enable = x86; + enable = i386_pc; enable = mips_yeeloong; }; module = { name = pci; source = bus/pci.c; + emu = bus/emu/pci.c; + emu = commands/lspci.c; + + enable = emu; enable = i386_pc; - enable = i386_efi; + enable = x86_efi; enable = i386_ieee1275; enable = i386_coreboot; + + emu_condition = COND_GRUB_EMU_PCI; }; library = { From f6023b613f46ae5bd884a656d3d9b054244a72b3 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 17 Jul 2010 01:32:36 +0530 Subject: [PATCH 038/174] comments --- gentpl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gentpl.py b/gentpl.py index baaae51bc..d584a0b7d 100644 --- a/gentpl.py +++ b/gentpl.py @@ -88,7 +88,7 @@ def rule(target, source, cmd): # # kernel = { # nostrip = emu; -# nostrip = i386_pc; +# ... # } # def if_platform_tagged(platform, tag, snippet_if, snippet_else=None): @@ -114,6 +114,7 @@ def if_platform_tagged(platform, tag, snippet_if, snippet_else=None): # module = { # cflags = '-Wall'; # emu_cflags = '-Wall -DGRUB_EMU=1'; +# ... # } # def foreach_platform_value(platform, tag, suffix, closure): From 3a2537696721bc0bf6a90bdc27b327768e79e635 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 17 Jul 2010 03:57:59 +0200 Subject: [PATCH 039/174] Detect usb keyboard properly, support keyboard hotpluanad multiple keyboards --- term/usb_keyboard.c | 116 +++++++++++++++++++++++++++++++------------- 1 file changed, 82 insertions(+), 34 deletions(-) diff --git a/term/usb_keyboard.c b/term/usb_keyboard.c index ae9c41035..f010aa9e4 100644 --- a/term/usb_keyboard.c +++ b/term/usb_keyboard.c @@ -54,7 +54,6 @@ static char keyboard_map_shift[128] = '?' }; -static grub_usb_device_t usbdev; /* Valid values for bmRequestType. See HID definition version 1.11 section 7.2. */ @@ -69,36 +68,64 @@ static grub_usb_device_t usbdev; #define USB_HID_SET_IDLE 0x0A #define USB_HID_SET_PROTOCOL 0x0B +static int grub_usb_keyboard_checkkey (struct grub_term_input *term); +static int grub_usb_keyboard_getkey (struct grub_term_input *term); +static int grub_usb_keyboard_getkeystatus (struct grub_term_input *term); + +static struct grub_term_input grub_usb_keyboard_term = + { + .checkkey = grub_usb_keyboard_checkkey, + .getkey = grub_usb_keyboard_getkey, + .getkeystatus = grub_usb_keyboard_getkeystatus, + .next = 0 + }; + +static struct grub_term_input grub_usb_keyboards[16]; + static void -grub_usb_hid (void) +grub_usb_keyboard_detach (grub_usb_device_t usbdev, + int config __attribute__ ((unused)), + int interface __attribute__ ((unused))) { - struct grub_usb_desc_device *descdev; + unsigned i; + for (i = 0; i < ARRAY_SIZE (grub_usb_keyboards); i++) + if (grub_usb_keyboards[i].data && grub_usb_keyboards[i].data == usbdev) + { + grub_term_unregister_input (&grub_usb_keyboards[i]); + grub_free ((char *) grub_usb_keyboards[i].name); + grub_usb_keyboards[i].name = NULL; + grub_usb_keyboards[i].data = 0; + } +} - auto int usb_iterate (grub_usb_device_t dev); - int usb_iterate (grub_usb_device_t dev) - { - descdev = &dev->descdev; +static int +grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) +{ + unsigned curnum; - grub_dprintf ("usb_keyboard", "%x %x %x\n", - descdev->class, descdev->subclass, descdev->protocol); + grub_dprintf ("usb_keyboard", "%x %x %x %d %d\n", + usbdev->descdev.class, usbdev->descdev.subclass, + usbdev->descdev.protocol, configno, interfno); + + for (curnum = 0; curnum < ARRAY_SIZE (grub_usb_keyboards); curnum++) + if (!grub_usb_keyboards[curnum].data) + break; + + if (curnum == ARRAY_SIZE (grub_usb_keyboards)) + return 0; #if 0 - if (descdev->class != 0x09 - || descdev->subclass == 0x01 - || descdev->protocol != 0x02) + if (descdev->class != 0x09 + || descdev->subclass == 0x01 + || descdev->protocol != 0x02) return 0; #endif - if (descdev->class != 0 || descdev->subclass != 0 || descdev->protocol != 0) - return 0; + if (usbdev->descdev.class != 0 + || usbdev->descdev.subclass != 0 || usbdev->descdev.protocol != 0) + return 0; - grub_printf ("HID found!\n"); - - usbdev = dev; - - return 1; - } - grub_usb_iterate (usb_iterate); + grub_printf ("HID found!\n"); /* Place the device in boot mode. */ grub_usb_control_msg (usbdev, USB_HID_HOST_TO_DEVICE, USB_HID_SET_PROTOCOL, @@ -107,6 +134,19 @@ grub_usb_hid (void) /* Reports every time an event occurs and not more often than that. */ grub_usb_control_msg (usbdev, USB_HID_HOST_TO_DEVICE, USB_HID_SET_IDLE, 0<<8, 0, 0, 0); + + grub_memcpy (&grub_usb_keyboards[curnum], &grub_usb_keyboard_term, + sizeof (grub_usb_keyboards[curnum])); + grub_usb_keyboards[curnum].data = usbdev; + usbdev->config[configno].interf[interfno].detach_hook + = grub_usb_keyboard_detach; + grub_usb_keyboards[curnum].name = grub_xasprintf ("usb_keyboard%d", curnum); + if (!grub_usb_keyboards[curnum].name) + return 0; + grub_term_register_input_active ("usb_keyboard", &grub_usb_keyboards[curnum]); + + + return 1; } static grub_err_t @@ -119,13 +159,14 @@ grub_usb_keyboard_getreport (grub_usb_device_t dev, grub_uint8_t *report) static int -grub_usb_keyboard_checkkey (struct grub_term_input *term __attribute__ ((unused))) +grub_usb_keyboard_checkkey (struct grub_term_input *term) { grub_uint8_t data[8]; int key; grub_err_t err; grub_uint64_t currtime; int timeout = 50; + grub_usb_device_t usbdev = term->data; data[2] = 0; currtime = grub_get_time_ms (); @@ -196,6 +237,7 @@ grub_usb_keyboard_getkey (struct grub_term_input *term) grub_uint64_t currtime; int timeout; static grub_usb_keyboard_repeat_t repeat = GRUB_HIDBOOT_REPEAT_NONE; + grub_usb_device_t usbdev = term->data; again: @@ -253,13 +295,14 @@ grub_usb_keyboard_getkey (struct grub_term_input *term) } static int -grub_usb_keyboard_getkeystatus (struct grub_term_input *term __attribute__ ((unused))) +grub_usb_keyboard_getkeystatus (struct grub_term_input *term) { grub_uint8_t data[8]; int mods = 0; grub_err_t err; grub_uint64_t currtime; int timeout = 50; + grub_usb_device_t usbdev = term->data; /* Set idle time to the minimum offered by the spec (4 milliseconds) so that we can find out the current state. */ @@ -307,22 +350,27 @@ grub_usb_keyboard_getkeystatus (struct grub_term_input *term __attribute__ ((unu return mods; } -static struct grub_term_input grub_usb_keyboard_term = - { - .name = "usb_keyboard", - .checkkey = grub_usb_keyboard_checkkey, - .getkey = grub_usb_keyboard_getkey, - .getkeystatus = grub_usb_keyboard_getkeystatus, - .next = 0 - }; +struct grub_usb_attach_desc attach_hook = +{ + .class = GRUB_USB_CLASS_HID, + .hook = grub_usb_keyboard_attach +}; GRUB_MOD_INIT(usb_keyboard) { - grub_usb_hid (); - grub_term_register_input ("usb_keyboard", &grub_usb_keyboard_term); + grub_usb_register_attach_hook_class (&attach_hook); } GRUB_MOD_FINI(usb_keyboard) { - grub_term_unregister_input (&grub_usb_keyboard_term); + unsigned i; + for (i = 0; i < ARRAY_SIZE (grub_usb_keyboards); i++) + if (grub_usb_keyboards[i].data) + { + grub_term_unregister_input (&grub_usb_keyboards[i]); + grub_free ((char *) grub_usb_keyboards[i].name); + grub_usb_keyboards[i].name = NULL; + grub_usb_keyboards[i].data = 0; + } + grub_usb_unregister_attach_hook_class (&attach_hook); } From a17b90f0ec5802967577ed71ab825c915d7e2ab6 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 17 Jul 2010 03:58:23 +0200 Subject: [PATCH 040/174] Support USB device drivers autoloading --- bus/usb/usb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bus/usb/usb.c b/bus/usb/usb.c index f6a0a8b56..804cbaff0 100644 --- a/bus/usb/usb.c +++ b/bus/usb/usb.c @@ -22,6 +22,7 @@ #include #include #include +#include static grub_usb_controller_dev_t grub_usb_list; struct grub_usb_attach_desc *attach_hooks; @@ -256,6 +257,19 @@ void grub_usb_device_attach (grub_usb_device_t dev) for (desc = attach_hooks; desc; desc = desc->next) if (interf->class == desc->class && desc->hook (dev, 0, i)) dev->config[0].interf[i].attached = 1; + + if (dev->config[0].interf[i].attached) + continue; + + switch (interf->class) + { + case GRUB_USB_CLASS_MASS_STORAGE: + grub_dl_load ("usbms"); + break; + case GRUB_USB_CLASS_HID: + grub_dl_load ("usb_keyboard"); + break; + } } } From 03f286ea9fc4336eaf4b56f3412c794f78238a65 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 01:35:55 +0200 Subject: [PATCH 041/174] Always show class --- commands/usbtest.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/commands/usbtest.c b/commands/usbtest.c index 213288b52..7f00c8856 100644 --- a/commands/usbtest.c +++ b/commands/usbtest.c @@ -29,11 +29,11 @@ static const char *usb_classes[] = { - "", + "Unknown", "Audio", "Communication Interface", "HID", - "", + "Unknown", "Physical", "Image", "Printer", @@ -138,10 +138,10 @@ usb_iterate (grub_usb_device_t dev) usb_print_str ("Vendor", dev, descdev->strvendor); usb_print_str ("Serial", dev, descdev->strserial); - if (descdev->class > 0 && descdev->class <= 0x0E) - grub_printf ("Class: (0x%02x) %s, Subclass: 0x%02x, Protocol: 0x%02x\n", - descdev->class, usb_classes[descdev->class], - descdev->subclass, descdev->protocol); + grub_printf ("Class: (0x%02x) %s, Subclass: 0x%02x, Protocol: 0x%02x\n", + descdev->class, descdev->class < ARRAY_SIZE (usb_classes) + ? usb_classes[descdev->class] : "Unknown", + descdev->subclass, descdev->protocol); grub_printf ("USB version %d.%d, VendorID: 0x%02x, ProductID: 0x%02x, #conf: %d\n", descdev->usbrel >> 8, (descdev->usbrel >> 4) & 0x0F, descdev->vendorid, descdev->prodid, descdev->configcnt); @@ -164,10 +164,10 @@ usb_iterate (grub_usb_device_t dev) grub_printf ("Interface #%d: #Endpoints: %d ", i, interf->endpointcnt); - if (interf->class > 0 && interf->class <= 0x0E) - grub_printf ("Class: (0x%02x) %s, Subclass: 0x%02x, Protocol: 0x%02x\n", - interf->class, usb_classes[interf->class], - interf->subclass, interf->protocol); + grub_printf ("Class: (0x%02x) %s, Subclass: 0x%02x, Protocol: 0x%02x\n", + interf->class, interf->class < ARRAY_SIZE (usb_classes) + ? usb_classes[interf->class] : "Unknown", + interf->subclass, interf->protocol); usb_print_str ("Interface", dev, interf->strif); From 75eb7d11168d9fcf70b9e7f6d861c4809160db7b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 01:37:19 +0200 Subject: [PATCH 042/174] Restructure serial in order to prepare for usbserial. As a byproduct simultaneous serial consoles are possible --- commands/terminal.c | 15 +- conf/i386.rmk | 2 +- include/grub/ns8250.h | 67 ++++++ include/grub/serial.h | 100 +++++---- include/grub/terminfo.h | 4 +- include/grub/usb.h | 1 + term/ns8250.c | 212 +++++++++++++++++++ term/serial.c | 439 ++++++++++++++++++---------------------- term/terminfo.c | 23 ++- term/usbserial.c | 165 +++++++++++++++ 10 files changed, 733 insertions(+), 295 deletions(-) create mode 100644 include/grub/ns8250.h create mode 100644 term/ns8250.c create mode 100644 term/usbserial.c diff --git a/commands/terminal.c b/commands/terminal.c index d34602a1b..c8b1b6315 100644 --- a/commands/terminal.c +++ b/commands/terminal.c @@ -59,11 +59,17 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled, for (aut = autoloads; aut; aut = aut->next) { for (term = *disabled; term; term = term->next) - if (grub_strcmp (term->name, aut->name) == 0) + if (grub_strcmp (term->name, aut->name) == 0 + || (aut->name[0] && aut->name[grub_strlen (aut->name) - 1] == '*' + && grub_memcmp (term->name, aut->name, + grub_strlen (aut->name) - 1) == 0)) break; if (!term) for (term = *enabled; term; term = term->next) - if (grub_strcmp (term->name, aut->name) == 0) + if (grub_strcmp (term->name, aut->name) == 0 + || (aut->name[0] && aut->name[grub_strlen (aut->name) - 1] == '*' + && grub_memcmp (term->name, aut->name, + grub_strlen (aut->name) - 1) == 0)) break; if (!term) grub_printf ("%s ", aut->name); @@ -98,7 +104,10 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled, return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n", args[i]); for (aut = autoloads; aut; aut = aut->next) - if (grub_strcmp (args[i], aut->name) == 0) + if (grub_strcmp (args[i], aut->name) == 0 + || (aut->name[0] && aut->name[grub_strlen (aut->name) - 1] == '*' + && grub_memcmp (args[i], aut->name, + grub_strlen (aut->name) - 1) == 0)) { grub_dl_t mod; mod = grub_dl_load (aut->modname); diff --git a/conf/i386.rmk b/conf/i386.rmk index b1df584a6..6bf1b3410 100644 --- a/conf/i386.rmk +++ b/conf/i386.rmk @@ -56,7 +56,7 @@ multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS) # For serial.mod. pkglib_MODULES += serial.mod -serial_mod_SOURCES = term/serial.c +serial_mod_SOURCES = term/serial.c term/ns8250.c serial_mod_CFLAGS = $(COMMON_CFLAGS) serial_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/include/grub/ns8250.h b/include/grub/ns8250.h new file mode 100644 index 000000000..f21a1a3e3 --- /dev/null +++ b/include/grub/ns8250.h @@ -0,0 +1,67 @@ +/* serial.h - serial device interface */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002,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 . + */ + +#ifndef GRUB_NS8250_HEADER +#define GRUB_NS8250_HEADER 1 + +/* Macros. */ + +/* The offsets of UART registers. */ +#define UART_TX 0 +#define UART_RX 0 +#define UART_DLL 0 +#define UART_IER 1 +#define UART_DLH 1 +#define UART_IIR 2 +#define UART_FCR 2 +#define UART_LCR 3 +#define UART_MCR 4 +#define UART_LSR 5 +#define UART_MSR 6 +#define UART_SR 7 + +/* For LSR bits. */ +#define UART_DATA_READY 0x01 +#define UART_EMPTY_TRANSMITTER 0x20 + +/* The type of parity. */ +#define UART_NO_PARITY 0x00 +#define UART_ODD_PARITY 0x08 +#define UART_EVEN_PARITY 0x18 + +/* The type of the length of stop bit. */ +#define UART_1_STOP_BIT 0x00 +#define UART_2_STOP_BITS 0x04 + +/* the switch of DLAB. */ +#define UART_DLAB 0x80 + +/* Enable the FIFO. */ +#define UART_ENABLE_FIFO_TRIGGER14 0xC7 + +/* Enable the FIFO. */ +#define UART_ENABLE_FIFO_TRIGGER1 0x07 + +/* Turn on DTR, RTS, and OUT2. */ +#define UART_ENABLE_DTRRTS 0x03 + +/* Turn on DTR, RTS, and OUT2. */ +#define UART_ENABLE_OUT2 0x08 + +#endif /* ! GRUB_SERIAL_MACHINE_HEADER */ diff --git a/include/grub/serial.h b/include/grub/serial.h index 758b6fb3e..063282112 100644 --- a/include/grub/serial.h +++ b/include/grub/serial.h @@ -1,7 +1,7 @@ /* serial.h - serial device interface */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000,2001,2002,2005,2007 Free Software Foundation, Inc. + * Copyright (C) 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 @@ -20,30 +20,51 @@ #ifndef GRUB_SERIAL_HEADER #define GRUB_SERIAL_HEADER 1 -/* Macros. */ +#include +#include +#include +#include -/* The offsets of UART registers. */ -#define UART_TX 0 -#define UART_RX 0 -#define UART_DLL 0 -#define UART_IER 1 -#define UART_DLH 1 -#define UART_IIR 2 -#define UART_FCR 2 -#define UART_LCR 3 -#define UART_MCR 4 -#define UART_LSR 5 -#define UART_MSR 6 -#define UART_SR 7 +struct grub_serial_port; -/* For LSR bits. */ -#define UART_DATA_READY 0x01 -#define UART_EMPTY_TRANSMITTER 0x20 +struct grub_serial_driver +{ + grub_err_t (*configure) (struct grub_serial_port *port, + unsigned speed, + unsigned short word_len, + unsigned int parity, + unsigned short stop_bits); + int (*fetch) (struct grub_serial_port *port); + void (*put) (struct grub_serial_port *port, const int c); +}; -/* The type of parity. */ -#define UART_NO_PARITY 0x00 -#define UART_ODD_PARITY 0x08 -#define UART_EVEN_PARITY 0x18 +struct grub_serial_port +{ + struct grub_serial_port *next; + char *name; + unsigned speed; + unsigned short word_len; + unsigned int parity; + unsigned short stop_bits; + struct grub_serial_driver *driver; + /* This should be void *data but since serial is useful as an early console + when malloc isn't available it's a union. + */ + union + { + grub_port_t port; + struct + { + grub_usb_device_t dev; + int in_endp; + int out_endp; + }; + }; +}; + +grub_err_t grub_serial_register (struct grub_serial_port *port); + +void grub_serial_unregister (struct grub_serial_port *port); /* The type of word length. */ #define UART_5BITS_WORD 0x00 @@ -51,23 +72,30 @@ #define UART_7BITS_WORD 0x02 #define UART_8BITS_WORD 0x03 +/* The type of parity. */ +#define UART_NO_PARITY 0x00 +#define UART_ODD_PARITY 0x08 +#define UART_EVEN_PARITY 0x18 + /* The type of the length of stop bit. */ #define UART_1_STOP_BIT 0x00 #define UART_2_STOP_BITS 0x04 -/* the switch of DLAB. */ -#define UART_DLAB 0x80 +static inline void +grub_serial_fill_defaults (struct grub_serial_port *port) +{ + /* Set default settings. */ +#ifdef GRUB_MACHINE_MIPS_YEELOONG + port->speed = 115200; +#else + port->speed = 9600; +#endif + port->word_len = UART_8BITS_WORD; + port->parity = UART_NO_PARITY; + port->stop_bits = UART_1_STOP_BIT; +} -/* Enable the FIFO. */ -#define UART_ENABLE_FIFO_TRIGGER14 0xC7 +void grub_ns8250_init (void); +char *grub_serial_ns8250_add_port (grub_port_t port); -/* Enable the FIFO. */ -#define UART_ENABLE_FIFO_TRIGGER1 0x07 - -/* Turn on DTR, RTS, and OUT2. */ -#define UART_ENABLE_DTRRTS 0x03 - -/* Turn on DTR, RTS, and OUT2. */ -#define UART_ENABLE_OUT2 0x08 - -#endif /* ! GRUB_SERIAL_MACHINE_HEADER */ +#endif diff --git a/include/grub/terminfo.h b/include/grub/terminfo.h index d6907d7f0..85ddb5779 100644 --- a/include/grub/terminfo.h +++ b/include/grub/terminfo.h @@ -32,7 +32,7 @@ struct grub_terminfo_input_state { int input_buf[GRUB_TERMINFO_READKEY_MAX_LEN]; int npending; - int (*readkey) (void); + int (*readkey) (struct grub_term_input *term); }; struct grub_terminfo_output_state @@ -51,7 +51,7 @@ struct grub_terminfo_output_state unsigned int xpos, ypos; - void (*put) (const int c); + void (*put) (struct grub_term_output *term, const int c); }; void EXPORT_FUNC(grub_terminfo_gotoxy) (grub_term_output_t term, diff --git a/include/grub/usb.h b/include/grub/usb.h index 3c17318fc..f9c3d61ff 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -19,6 +19,7 @@ #ifndef GRUB_USB_H #define GRUB_USB_H 1 +#include #include #include diff --git a/term/ns8250.c b/term/ns8250.c new file mode 100644 index 000000000..4f09c7606 --- /dev/null +++ b/term/ns8250.c @@ -0,0 +1,212 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,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 . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef GRUB_MACHINE_PCBIOS +static const unsigned short *serial_hw_io_addr = (const unsigned short *) GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR; +#define GRUB_SERIAL_PORT_NUM 4 +#else +#include +static const grub_port_t serial_hw_io_addr[] = GRUB_MACHINE_SERIAL_PORTS; +#define GRUB_SERIAL_PORT_NUM (ARRAY_SIZE(serial_hw_io_addr)) +#endif + +/* Fetch a key. */ +static int +serial_hw_fetch (struct grub_serial_port *port) +{ + if (grub_inb (port->port + UART_LSR) & UART_DATA_READY) + return grub_inb (port->port + UART_RX); + + return -1; +} + +/* Put a character. */ +static void +serial_hw_put (struct grub_serial_port *port, const int c) +{ + unsigned int timeout = 100000; + + /* Wait until the transmitter holding register is empty. */ + while ((grub_inb (port->port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0) + { + if (--timeout == 0) + /* There is something wrong. But what can I do? */ + return; + } + + grub_outb (c, port->port + UART_TX); +} + +/* Convert speed to divisor. */ +static unsigned short +serial_get_divisor (unsigned int speed) +{ + unsigned int i; + + /* The structure for speed vs. divisor. */ + struct divisor + { + unsigned int speed; + unsigned short div; + }; + + /* The table which lists common configurations. */ + /* 1843200 / (speed * 16) */ + static struct divisor divisor_tab[] = + { + { 2400, 0x0030 }, + { 4800, 0x0018 }, + { 9600, 0x000C }, + { 19200, 0x0006 }, + { 38400, 0x0003 }, + { 57600, 0x0002 }, + { 115200, 0x0001 } + }; + + /* Set the baud rate. */ + for (i = 0; i < sizeof (divisor_tab) / sizeof (divisor_tab[0]); i++) + if (divisor_tab[i].speed == speed) + /* UART in Yeeloong runs twice the usual rate. */ +#ifdef GRUB_MACHINE_MIPS_YEELOONG + return 2 * divisor_tab[i].div; +#else + return divisor_tab[i].div; +#endif + return 0; +} + +/* Initialize a serial device. PORT is the port number for a serial device. + SPEED is a DTE-DTE speed which must be one of these: 2400, 4800, 9600, + 19200, 38400, 57600 and 115200. WORD_LEN is the word length to be used + for the device. Likewise, PARITY is the type of the parity and + STOP_BIT_LEN is the length of the stop bit. The possible values for + WORD_LEN, PARITY and STOP_BIT_LEN are defined in the header file as + macros. */ +static grub_err_t +serial_hw_configure (struct grub_serial_port *port, + unsigned speed, unsigned short word_len, + unsigned int parity, unsigned short stop_bits) +{ + unsigned char status = 0; + unsigned short divisor; + + divisor = serial_get_divisor (speed); + if (divisor == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed"); + + port->speed = speed; + port->word_len = word_len; + port->parity = parity; + port->stop_bits = stop_bits; + + /* Turn off the interrupt. */ + grub_outb (0, port->port + UART_IER); + + /* Set DLAB. */ + grub_outb (UART_DLAB, port->port + UART_LCR); + + /* Set the baud rate. */ + grub_outb (divisor & 0xFF, port->port + UART_DLL); + grub_outb (divisor >> 8, port->port + UART_DLH); + + /* Set the line status. */ + status |= (port->parity | port->word_len | port->stop_bits); + grub_outb (status, port->port + UART_LCR); + + /* In Yeeloong serial port has only 3 wires. */ +#ifndef GRUB_MACHINE_MIPS_YEELOONG + /* Enable the FIFO. */ + grub_outb (UART_ENABLE_FIFO_TRIGGER1, port->port + UART_FCR); + + /* Turn on DTR and RTS. */ + grub_outb (UART_ENABLE_DTRRTS, port->port + UART_MCR); +#else + /* Enable the FIFO. */ + grub_outb (UART_ENABLE_FIFO_TRIGGER14, port->port + UART_FCR); + + /* Turn on DTR, RTS, and OUT2. */ + grub_outb (UART_ENABLE_DTRRTS | UART_ENABLE_OUT2, port->port + UART_MCR); +#endif + + /* Drain the input buffer. */ + while (serial_hw_fetch (port) != -1); + + /* FIXME: should check if the serial terminal was found. */ + + return GRUB_ERR_NONE; +} + +static struct grub_serial_driver grub_ns8250_driver = + { + .configure = serial_hw_configure, + .fetch = serial_hw_fetch, + .put = serial_hw_put + }; + +static char com_names[GRUB_SERIAL_PORT_NUM][20]; +static struct grub_serial_port com_ports[GRUB_SERIAL_PORT_NUM]; + +void +grub_ns8250_init (void) +{ + int i; + for (i = 0; i < GRUB_SERIAL_PORT_NUM; i++) + //if (serial_hw_io_addr[i]) + { + grub_snprintf (com_names[i], sizeof (com_names[i]), "com%d", i); + com_ports[i].name = com_names[i]; + com_ports[i].driver = &grub_ns8250_driver; + grub_serial_fill_defaults (&com_ports[i]); + com_ports[i].port = serial_hw_io_addr[i]; + grub_serial_register (&com_ports[i]); + } +} + +char * +grub_serial_ns8250_add_port (grub_port_t port) +{ + struct grub_serial_port *p; + int i; + for (i = 0; i < GRUB_SERIAL_PORT_NUM; i++) + if (com_ports[i].port == port) + return com_names[i]; + p = grub_malloc (sizeof (*p)); + if (!p) + return NULL; + p->name = grub_xasprintf ("port%lx", (unsigned long) port); + if (!p->name) + { + grub_free (p); + return NULL; + } + p->driver = &grub_ns8250_driver; + grub_serial_fill_defaults (p); + p->port = port; + grub_serial_register (p); + + return p->name; +} diff --git a/term/serial.c b/term/serial.c index cf7759ef2..1f54a83ec 100644 --- a/term/serial.c +++ b/term/serial.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,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 @@ -16,7 +16,6 @@ * along with GRUB. If not, see . */ -#include #include #include #include @@ -26,8 +25,9 @@ #include #include #include +#include -static unsigned int registered = 0; +#define FOR_SERIAL_PORTS(var) FOR_LIST_ELEMENTS((var), (grub_serial_ports)) /* Argument options. */ static const struct grub_arg_option options[] = @@ -41,154 +41,19 @@ static const struct grub_arg_option options[] = {0, 0, 0, 0, 0, 0} }; -/* Serial port settings. */ -struct serial_port +struct grub_serial_port *grub_serial_ports; + +struct grub_serial_output_state { - grub_port_t port; - unsigned short divisor; - unsigned short word_len; - unsigned int parity; - unsigned short stop_bits; + struct grub_terminfo_output_state tinfo; + struct grub_serial_port *port; }; -/* Serial port settings. */ -static struct serial_port serial_settings; - -#ifdef GRUB_MACHINE_PCBIOS -static const unsigned short *serial_hw_io_addr = (const unsigned short *) GRUB_MEMORY_MACHINE_BIOS_DATA_AREA_ADDR; -#define GRUB_SERIAL_PORT_NUM 4 -#else -#include -static const grub_port_t serial_hw_io_addr[] = GRUB_MACHINE_SERIAL_PORTS; -#define GRUB_SERIAL_PORT_NUM (ARRAY_SIZE(serial_hw_io_addr)) -#endif - -/* Return the port number for the UNITth serial device. */ -static inline grub_port_t -serial_hw_get_port (const unsigned int unit) +struct grub_serial_input_state { - if (unit < GRUB_SERIAL_PORT_NUM) - return serial_hw_io_addr[unit]; - else - return 0; -} - -/* Fetch a key. */ -static int -serial_hw_fetch (void) -{ - if (grub_inb (serial_settings.port + UART_LSR) & UART_DATA_READY) - return grub_inb (serial_settings.port + UART_RX); - - return -1; -} - -/* Put a character. */ -static void -serial_hw_put (const int c) -{ - unsigned int timeout = 100000; - - /* Wait until the transmitter holding register is empty. */ - while ((grub_inb (serial_settings.port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0) - { - if (--timeout == 0) - /* There is something wrong. But what can I do? */ - return; - } - - grub_outb (c, serial_settings.port + UART_TX); -} - -/* Convert speed to divisor. */ -static unsigned short -serial_get_divisor (unsigned int speed) -{ - unsigned int i; - - /* The structure for speed vs. divisor. */ - struct divisor - { - unsigned int speed; - unsigned short div; - }; - - /* The table which lists common configurations. */ - /* 1843200 / (speed * 16) */ - static struct divisor divisor_tab[] = - { - { 2400, 0x0030 }, - { 4800, 0x0018 }, - { 9600, 0x000C }, - { 19200, 0x0006 }, - { 38400, 0x0003 }, - { 57600, 0x0002 }, - { 115200, 0x0001 } - }; - - /* Set the baud rate. */ - for (i = 0; i < sizeof (divisor_tab) / sizeof (divisor_tab[0]); i++) - if (divisor_tab[i].speed == speed) - /* UART in Yeeloong runs twice the usual rate. */ -#ifdef GRUB_MACHINE_MIPS_YEELOONG - return 2 * divisor_tab[i].div; -#else - return divisor_tab[i].div; -#endif - return 0; -} - -/* Initialize a serial device. PORT is the port number for a serial device. - SPEED is a DTE-DTE speed which must be one of these: 2400, 4800, 9600, - 19200, 38400, 57600 and 115200. WORD_LEN is the word length to be used - for the device. Likewise, PARITY is the type of the parity and - STOP_BIT_LEN is the length of the stop bit. The possible values for - WORD_LEN, PARITY and STOP_BIT_LEN are defined in the header file as - macros. */ -static grub_err_t -serial_hw_init (void) -{ - unsigned char status = 0; - - /* Turn off the interrupt. */ - grub_outb (0, serial_settings.port + UART_IER); - - /* Set DLAB. */ - grub_outb (UART_DLAB, serial_settings.port + UART_LCR); - - /* Set the baud rate. */ - grub_outb (serial_settings.divisor & 0xFF, serial_settings.port + UART_DLL); - grub_outb (serial_settings.divisor >> 8, serial_settings.port + UART_DLH); - - /* Set the line status. */ - status |= (serial_settings.parity - | serial_settings.word_len - | serial_settings.stop_bits); - grub_outb (status, serial_settings.port + UART_LCR); - - /* In Yeeloong serial port has only 3 wires. */ -#ifndef GRUB_MACHINE_MIPS_YEELOONG - /* Enable the FIFO. */ - grub_outb (UART_ENABLE_FIFO_TRIGGER1, serial_settings.port + UART_FCR); - - /* Turn on DTR and RTS. */ - grub_outb (UART_ENABLE_DTRRTS, serial_settings.port + UART_MCR); -#else - /* Enable the FIFO. */ - grub_outb (UART_ENABLE_FIFO_TRIGGER14, serial_settings.port + UART_FCR); - - /* Turn on DTR, RTS, and OUT2. */ - grub_outb (UART_ENABLE_DTRRTS | UART_ENABLE_OUT2, - serial_settings.port + UART_MCR); -#endif - - /* Drain the input buffer. */ - while (serial_hw_fetch () != -1); - - /* FIXME: should check if the serial terminal was found. */ - - return GRUB_ERR_NONE; -} + struct grub_terminfo_input_state tinfo; + struct grub_serial_port *port; +}; static grub_uint16_t grub_serial_getwh (struct grub_term_output *term __attribute__ ((unused))) @@ -198,16 +63,38 @@ grub_serial_getwh (struct grub_term_output *term __attribute__ ((unused))) return (TEXT_WIDTH << 8) | TEXT_HEIGHT; } -struct grub_terminfo_input_state grub_serial_terminfo_input = +static void +serial_put (grub_term_output_t term, const int c) +{ + struct grub_serial_output_state *data = term->data; + data->port->driver->put (data->port, c); +} + +static int +serial_fetch (grub_term_input_t term) +{ + struct grub_serial_input_state *data = term->data; + return data->port->driver->fetch (data->port); +} + +struct grub_serial_input_state grub_serial_terminfo_input = { - .readkey = serial_hw_fetch + .tinfo = + { + .readkey = serial_fetch + } }; -struct grub_terminfo_output_state grub_serial_terminfo_output = +struct grub_serial_output_state grub_serial_terminfo_output = { - .put = serial_hw_put + .tinfo = + { + .put = serial_put + } }; +int registered = 0; + static struct grub_term_input grub_serial_term_input = { .name = "serial", @@ -235,122 +122,200 @@ static struct grub_term_output grub_serial_term_output = +static struct grub_serial_port * +grub_serial_find (char *name) +{ + struct grub_serial_port *port; + + FOR_SERIAL_PORTS (port) + if (grub_strcmp (port->name, name) == 0) + break; + + if (!port && grub_memcmp (name, "port", sizeof ("port") - 1) == 0 + && grub_isdigit (name [sizeof ("port") - 1])) + { + name = grub_serial_ns8250_add_port (grub_strtoul (&name[sizeof ("port") - 1], + 0, 16)); + if (!name) + return NULL; + + FOR_SERIAL_PORTS (port) + if (grub_strcmp (port->name, name) == 0) + break; + } + + return port; +} + static grub_err_t -grub_cmd_serial (grub_extcmd_t cmd, - int argc __attribute__ ((unused)), - char **args __attribute__ ((unused))) +grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) { struct grub_arg_list *state = cmd->state; - struct serial_port backup_settings = serial_settings; - grub_err_t hwiniterr; + char pname[40]; + char *name = NULL; + struct grub_serial_port *port; + signed speed = -1; + signed short word_len = -1; + signed int parity = -1; + signed short stop_bits = -1; + grub_err_t err; if (state[0].set) { - unsigned int unit; - - unit = grub_strtoul (state[0].arg, 0, 0); - serial_settings.port = serial_hw_get_port (unit); - if (!serial_settings.port) - return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad unit number"); + grub_snprintf (pname, sizeof (pname), "com%ld", + grub_strtoul (state[0].arg, 0, 0)); + name = pname; } if (state[1].set) - serial_settings.port = (grub_port_t) grub_strtoul (state[1].arg, 0, 0); + { + grub_snprintf (pname, sizeof (pname), "port%lx", + grub_strtoul (state[1].arg, 0, 0)); + name = pname; + } + + if (argc >= 1) + name = args[0]; + + if (!name) + name = "com0"; + + port = grub_serial_find (name); + if (!port) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown serial port"); + + speed = port->speed; + word_len = port->word_len; + parity = port->parity; + stop_bits = port->stop_bits; if (state[2].set) - { - unsigned long speed; - - speed = grub_strtoul (state[2].arg, 0, 0); - serial_settings.divisor = serial_get_divisor ((unsigned int) speed); - if (serial_settings.divisor == 0) - { - serial_settings = backup_settings; - return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed"); - } - } + speed = grub_strtoul (state[2].arg, 0, 0); if (state[3].set) { if (! grub_strcmp (state[3].arg, "5")) - serial_settings.word_len = UART_5BITS_WORD; + word_len = UART_5BITS_WORD; else if (! grub_strcmp (state[3].arg, "6")) - serial_settings.word_len = UART_6BITS_WORD; + word_len = UART_6BITS_WORD; else if (! grub_strcmp (state[3].arg, "7")) - serial_settings.word_len = UART_7BITS_WORD; + word_len = UART_7BITS_WORD; else if (! grub_strcmp (state[3].arg, "8")) - serial_settings.word_len = UART_8BITS_WORD; + word_len = UART_8BITS_WORD; else - { - serial_settings = backup_settings; - return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad word length"); - } + return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad word length"); } if (state[4].set) { if (! grub_strcmp (state[4].arg, "no")) - serial_settings.parity = UART_NO_PARITY; + parity = UART_NO_PARITY; else if (! grub_strcmp (state[4].arg, "odd")) - serial_settings.parity = UART_ODD_PARITY; + parity = UART_ODD_PARITY; else if (! grub_strcmp (state[4].arg, "even")) - serial_settings.parity = UART_EVEN_PARITY; + parity = UART_EVEN_PARITY; else - { - serial_settings = backup_settings; - return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad parity"); - } + return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad parity"); } if (state[5].set) { if (! grub_strcmp (state[5].arg, "1")) - serial_settings.stop_bits = UART_1_STOP_BIT; + stop_bits = UART_1_STOP_BIT; else if (! grub_strcmp (state[5].arg, "2")) - serial_settings.stop_bits = UART_2_STOP_BITS; + stop_bits = UART_2_STOP_BITS; else - { - serial_settings = backup_settings; - return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad number of stop bits"); - } + return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad number of stop bits"); } /* Initialize with new settings. */ - hwiniterr = serial_hw_init (); - - if (hwiniterr == GRUB_ERR_NONE) + err = port->driver->configure (port, speed, word_len, parity, stop_bits); + if (err) + return err; + if (!registered) { - /* Register terminal if not yet registered. */ - if (registered == 0) - { - grub_term_register_input ("serial", &grub_serial_term_input); - grub_term_register_output ("serial", &grub_serial_term_output); - grub_terminfo_output_register (&grub_serial_term_output, "vt100"); - registered = 1; - } + grub_term_register_input ("serial", &grub_serial_term_input); + grub_term_register_output ("serial", &grub_serial_term_output); } - else - { - /* Initialization with new settings failed. */ - if (registered == 1) - { - /* If the terminal is registered, attempt to restore previous - settings. */ - serial_settings = backup_settings; - if (serial_hw_init () != GRUB_ERR_NONE) - { - /* If unable to restore settings, unregister terminal. */ - grub_term_unregister_input (&grub_serial_term_input); - grub_term_unregister_output (&grub_serial_term_output); - grub_terminfo_output_unregister (&grub_serial_term_output); - registered = 0; - } - } - } - - return hwiniterr; + grub_serial_terminfo_output.port = port; + grub_serial_terminfo_input.port = port; + registered = 1; + return GRUB_ERR_NONE; } +grub_err_t +grub_serial_register (struct grub_serial_port *port) +{ + struct grub_term_input *in; + struct grub_term_output *out; + struct grub_serial_input_state *indata; + struct grub_serial_output_state *outdata; + + in = grub_malloc (sizeof (*in)); + if (!in) + return grub_errno; + + indata = grub_malloc (sizeof (*indata)); + if (!indata) + { + grub_free (in); + return grub_errno; + } + + grub_memcpy (in, &grub_serial_term_input, sizeof (*in)); + in->data = indata; + in->name = grub_xasprintf ("serial_%s", port->name); + grub_memcpy (indata, &grub_serial_terminfo_input, sizeof (*indata)); + + if (!in->name) + { + grub_free (in); + grub_free (indata); + return grub_errno; + } + + out = grub_malloc (sizeof (*out)); + if (!out) + { + grub_free (in); + grub_free (indata); + grub_free ((char *) in->name); + return grub_errno; + } + + outdata = grub_malloc (sizeof (*outdata)); + if (!outdata) + { + grub_free (in); + grub_free (indata); + grub_free ((char *) in->name); + grub_free (out); + return grub_errno; + } + + grub_memcpy (out, &grub_serial_term_output, sizeof (*out)); + out->data = outdata; + out->name = in->name; + grub_memcpy (outdata, &grub_serial_terminfo_output, sizeof (*outdata)); + + grub_list_push (GRUB_AS_LIST_P (&grub_serial_ports), GRUB_AS_LIST (port)); + ((struct grub_serial_input_state *) in->data)->port = port; + ((struct grub_serial_output_state *) out->data)->port = port; + grub_term_register_input ("serial_*", in); + grub_term_register_output ("serial_*", out); + grub_terminfo_output_register (out, "vt100"); + + return GRUB_ERR_NONE; +} + +void +grub_serial_unregister (struct grub_serial_port *port) +{ + grub_list_remove (GRUB_AS_LIST_P (&grub_serial_ports), GRUB_AS_LIST (port)); + /* FIXME */ +} + + static grub_extcmd_t cmd; GRUB_MOD_INIT(serial) @@ -360,21 +325,13 @@ GRUB_MOD_INIT(serial) N_("[OPTIONS...]"), N_("Configure serial port."), options); - /* Set default settings. */ - serial_settings.port = serial_hw_get_port (0); -#ifdef GRUB_MACHINE_MIPS_YEELOONG - serial_settings.divisor = serial_get_divisor (115200); -#else - serial_settings.divisor = serial_get_divisor (9600); -#endif - serial_settings.word_len = UART_8BITS_WORD; - serial_settings.parity = UART_NO_PARITY; - serial_settings.stop_bits = UART_1_STOP_BIT; + grub_ns8250_init (); #ifdef GRUB_MACHINE_MIPS_YEELOONG { grub_err_t hwiniterr; - hwiniterr = serial_hw_init (); + hwiniterr = grub_ns8250_driver.init ("com0", &serial_settings); + serial_settings.driver = &grub_ns8250_driver; if (hwiniterr == GRUB_ERR_NONE) { @@ -389,11 +346,7 @@ GRUB_MOD_INIT(serial) GRUB_MOD_FINI(serial) { + while (grub_serial_ports) + grub_serial_unregister (grub_serial_ports); grub_unregister_extcmd (cmd); - if (registered == 1) /* Unregister terminal only if registered. */ - { - grub_term_unregister_input (&grub_serial_term_input); - grub_term_unregister_output (&grub_serial_term_output); - grub_terminfo_output_unregister (&grub_serial_term_output); - } } diff --git a/term/terminfo.c b/term/terminfo.c index ff54e5dba..5691b9cc6 100644 --- a/term/terminfo.c +++ b/term/terminfo.c @@ -195,7 +195,7 @@ putstr (struct grub_term_output *term, const char *str) struct grub_terminfo_output_state *data = (struct grub_terminfo_output_state *) term->data; while (*str) - data->put (*str++); + data->put (term, *str++); } grub_uint16_t @@ -225,7 +225,7 @@ grub_terminfo_gotoxy (struct grub_term_output *term, else { if ((y == data->ypos) && (x == data->xpos - 1)) - data->put ('\b'); + data->put (term, '\b'); } data->xpos = x; @@ -348,20 +348,21 @@ grub_terminfo_putchar (struct grub_term_output *term, data->xpos = 0; if (data->ypos < grub_term_height (term) - 1) data->ypos++; - data->put ('\r'); - data->put ('\n'); + data->put (term, '\r'); + data->put (term, '\n'); } data->xpos += c->estimated_width; break; } - data->put (c->base); + data->put (term, c->base); } #define ANSI_C0 0x9b static void -grub_terminfo_readkey (int *keys, int *len, int (*readkey) (void)) +grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, + int (*readkey) (struct grub_term_input *term)) { int c; @@ -371,7 +372,7 @@ grub_terminfo_readkey (int *keys, int *len, int (*readkey) (void)) /* On 9600 we have to wait up to 12 milliseconds. */ \ start = grub_get_time_ms (); \ do \ - c = readkey (); \ + c = readkey (term); \ while (c == -1 && grub_get_time_ms () - start < 12); \ if (c == -1) \ return; \ @@ -380,7 +381,7 @@ grub_terminfo_readkey (int *keys, int *len, int (*readkey) (void)) (*len)++; \ } - c = readkey (); + c = readkey (term); if (c < 0) { *len = 0; @@ -475,7 +476,8 @@ grub_terminfo_checkkey (struct grub_term_input *termi) if (data->npending) return data->input_buf[0]; - grub_terminfo_readkey (data->input_buf, &data->npending, data->readkey); + grub_terminfo_readkey (termi, data->input_buf, + &data->npending, data->readkey); if (data->npending) return data->input_buf[0]; @@ -491,7 +493,8 @@ grub_terminfo_getkey (struct grub_term_input *termi) = (struct grub_terminfo_input_state *) (termi->data); int ret; while (! data->npending) - grub_terminfo_readkey (data->input_buf, &data->npending, data->readkey); + grub_terminfo_readkey (termi, data->input_buf, &data->npending, + data->readkey); ret = data->input_buf[0]; data->npending--; diff --git a/term/usbserial.c b/term/usbserial.c new file mode 100644 index 000000000..5a63348fb --- /dev/null +++ b/term/usbserial.c @@ -0,0 +1,165 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * 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 . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static unsigned int registered = 0; + +/* Argument options. */ +static const struct grub_arg_option options[] = +{ + {"unit", 'u', 0, N_("Set the serial unit."), 0, ARG_TYPE_INT}, + {"speed", 's', 0, N_("Set the serial port speed."), 0, ARG_TYPE_INT}, + {"word", 'w', 0, N_("Set the serial port word length."), 0, ARG_TYPE_INT}, + {"parity", 'r', 0, N_("Set the serial port parity."), 0, ARG_TYPE_STRING}, + {"stop", 't', 0, N_("Set the serial port stop bits."), 0, ARG_TYPE_INT}, + {0, 0, 0, 0, 0, 0} +}; + +/* Serial port settings. */ +struct usbserial_port +{ + grub_usb_device_t usbdev; + int in_endp; + int out_endp; + unsigned short divisor; + unsigned short word_len; + unsigned int parity; + unsigned short stop_bits; +}; + +/* Serial port settings. */ +static struct serial_port serial_settings; + +/* Fetch a key. */ +static int +serial_hw_fetch (void) +{ + /* FIXME */ + return -1; +} + +/* Put a character. */ +static void +usbserial_hw_put (struct usbserial_port *port, const int c) +{ + char cc = c; + grub_usb_bulk_write (port->usbdev, port->out_endp, 1, &cc); +} + +static grub_uint16_t +grub_serial_getwh (struct grub_term_output *term __attribute__ ((unused))) +{ + const grub_uint8_t TEXT_WIDTH = 80; + const grub_uint8_t TEXT_HEIGHT = 24; + return (TEXT_WIDTH << 8) | TEXT_HEIGHT; +} + +struct grub_terminfo_input_state grub_serial_terminfo_input = + { + .readkey = serial_hw_fetch + }; + +struct grub_terminfo_output_state grub_serial_terminfo_output = + { + .put = usbserial_hw_put + }; + +static struct grub_term_input grub_serial_term_input = +{ + .name = "usbserial", + .init = grub_terminfo_input_init, + .checkkey = grub_terminfo_checkkey, + .getkey = grub_terminfo_getkey, + .data = &grub_serial_terminfo_input +}; + +static struct grub_term_output grub_serial_term_output = +{ + .name = "usbserial", + .putchar = grub_terminfo_putchar, + .getwh = grub_serial_getwh, + .getxy = grub_terminfo_getxy, + .gotoxy = grub_terminfo_gotoxy, + .cls = grub_terminfo_cls, + .setcolorstate = grub_terminfo_setcolorstate, + .setcursor = grub_terminfo_setcursor, + .flags = GRUB_TERM_CODE_TYPE_ASCII, + .data = &grub_serial_terminfo_output, + .normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR, + .highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR, +}; + + + + +static grub_extcmd_t cmd; + +GRUB_MOD_INIT(serial) +{ + cmd = grub_register_extcmd ("serial", grub_cmd_serial, + GRUB_COMMAND_FLAG_BOTH, + N_("[OPTIONS...]"), + N_("Configure serial port."), options); + + /* Set default settings. */ + serial_settings.port = serial_hw_get_port (0); +#ifdef GRUB_MACHINE_MIPS_YEELOONG + serial_settings.divisor = serial_get_divisor (115200); +#else + serial_settings.divisor = serial_get_divisor (9600); +#endif + serial_settings.word_len = UART_8BITS_WORD; + serial_settings.parity = UART_NO_PARITY; + serial_settings.stop_bits = UART_1_STOP_BIT; + +#ifdef GRUB_MACHINE_MIPS_YEELOONG + { + grub_err_t hwiniterr; + hwiniterr = serial_hw_init (); + + if (hwiniterr == GRUB_ERR_NONE) + { + grub_term_register_input_active ("serial", &grub_serial_term_input); + grub_term_register_output_active ("serial", &grub_serial_term_output); + + registered = 1; + } + } +#endif +} + +GRUB_MOD_FINI(serial) +{ + grub_unregister_extcmd (cmd); + if (registered == 1) /* Unregister terminal only if registered. */ + { + grub_term_unregister_input (&grub_serial_term_input); + grub_term_unregister_output (&grub_serial_term_output); + grub_terminfo_output_unregister (&grub_serial_term_output); + } +} From 7b5502f30b0e8a110f91fc2be6286bc303269649 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 01:41:08 +0200 Subject: [PATCH 043/174] Remove debug comment-out --- term/ns8250.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/term/ns8250.c b/term/ns8250.c index 4f09c7606..ee2eeb8f5 100644 --- a/term/ns8250.c +++ b/term/ns8250.c @@ -175,7 +175,7 @@ grub_ns8250_init (void) { int i; for (i = 0; i < GRUB_SERIAL_PORT_NUM; i++) - //if (serial_hw_io_addr[i]) + if (serial_hw_io_addr[i]) { grub_snprintf (com_names[i], sizeof (com_names[i]), "com%d", i); com_ports[i].name = com_names[i]; From cbf41813b307e62fcb8ca424429d26a2084c8704 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 12:53:08 +0200 Subject: [PATCH 044/174] Don't check transaction active flag as it's not updated and creates problems for usbserial --- bus/usb/uhci.c | 51 +++++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/bus/usb/uhci.c b/bus/usb/uhci.c index efdf3aceb..5b4432018 100644 --- a/bus/usb/uhci.c +++ b/bus/usb/uhci.c @@ -512,42 +512,37 @@ grub_uhci_transfer (grub_usb_controller_t dev, grub_dprintf ("uhci", "t status=0x%02x\n", errtd->ctrl_status); - /* Check if the TD is not longer active. */ - if (! (errtd->ctrl_status & (1 << 23))) - { - grub_dprintf ("uhci", ">>t status=0x%02x\n", errtd->ctrl_status); + /* Check if the endpoint is stalled. */ + if (errtd->ctrl_status & (1 << 22)) + err = GRUB_USB_ERR_STALL; - /* Check if the endpoint is stalled. */ - if (errtd->ctrl_status & (1 << 22)) - err = GRUB_USB_ERR_STALL; + /* Check if an error related to the data buffer occurred. */ + if (errtd->ctrl_status & (1 << 21)) + err = GRUB_USB_ERR_DATA; - /* Check if an error related to the data buffer occurred. */ - if (errtd->ctrl_status & (1 << 21)) - err = GRUB_USB_ERR_DATA; + /* Check if a babble error occurred. */ + if (errtd->ctrl_status & (1 << 20)) + err = GRUB_USB_ERR_BABBLE; - /* Check if a babble error occurred. */ - if (errtd->ctrl_status & (1 << 20)) - err = GRUB_USB_ERR_BABBLE; + /* Check if a NAK occurred. */ + if (errtd->ctrl_status & (1 << 19)) + err = GRUB_USB_ERR_NAK; - /* Check if a NAK occurred. */ - if (errtd->ctrl_status & (1 << 19)) - err = GRUB_USB_ERR_NAK; + /* Check if a timeout occurred. */ + if (errtd->ctrl_status & (1 << 18)) + err = GRUB_USB_ERR_TIMEOUT; - /* Check if a timeout occurred. */ - if (errtd->ctrl_status & (1 << 18)) - err = GRUB_USB_ERR_TIMEOUT; + /* Check if a bitstuff error occurred. */ + if (errtd->ctrl_status & (1 << 17)) + err = GRUB_USB_ERR_BITSTUFF; - /* Check if a bitstuff error occurred. */ - if (errtd->ctrl_status & (1 << 17)) - err = GRUB_USB_ERR_BITSTUFF; + if (err) + goto fail; - if (err) - goto fail; + /* Fall through, no errors occurred, so the QH might be + updated. */ + grub_dprintf ("uhci", "transaction fallthrough\n"); - /* Fall through, no errors occurred, so the QH might be - updated. */ - grub_dprintf ("uhci", "transaction fallthrough\n"); - } if (grub_get_time_ms () > endtime) { err = GRUB_USB_ERR_STALL; From 34364df689ec64226f3d5de06e08a1844166a926 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 12:53:35 +0200 Subject: [PATCH 045/174] usbserial basic support. Works in qemu --- bus/usb/usb.c | 3 + conf/i386-pc.rmk | 6 ++ include/grub/serial.h | 24 ++--- term/ns8250.c | 124 ++++++++++++++---------- term/serial.c | 1 - term/usbserial.c | 212 ++++++++++++++++++------------------------ 6 files changed, 189 insertions(+), 181 deletions(-) diff --git a/bus/usb/usb.c b/bus/usb/usb.c index 804cbaff0..ba052e5ee 100644 --- a/bus/usb/usb.c +++ b/bus/usb/usb.c @@ -269,6 +269,9 @@ void grub_usb_device_attach (grub_usb_device_t dev) case GRUB_USB_CLASS_HID: grub_dl_load ("usb_keyboard"); break; + case 0xff: + grub_dl_load ("usbserial"); + break; } } } diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index c157aaf01..e1cfe1468 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -195,6 +195,12 @@ usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c usb_mod_CFLAGS = $(COMMON_CFLAGS) usb_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For serial.mod. +pkglib_MODULES += usbserial.mod +usbserial_mod_SOURCES = term/usbserial.c +usbserial_mod_CFLAGS = $(COMMON_CFLAGS) +usbserial_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For usbtest.mod usbtest_mod_SOURCES = commands/usbtest.c usbtest_mod_CFLAGS = $(COMMON_CFLAGS) diff --git a/include/grub/serial.h b/include/grub/serial.h index 063282112..97e97004c 100644 --- a/include/grub/serial.h +++ b/include/grub/serial.h @@ -47,6 +47,7 @@ struct grub_serial_port unsigned int parity; unsigned short stop_bits; struct grub_serial_driver *driver; + int configured; /* This should be void *data but since serial is useful as an early console when malloc isn't available it's a union. */ @@ -55,9 +56,9 @@ struct grub_serial_port grub_port_t port; struct { - grub_usb_device_t dev; - int in_endp; - int out_endp; + grub_usb_device_t usbdev; + struct grub_usb_desc_endp *in_endp; + struct grub_usb_desc_endp *out_endp; }; }; }; @@ -81,18 +82,19 @@ void grub_serial_unregister (struct grub_serial_port *port); #define UART_1_STOP_BIT 0x00 #define UART_2_STOP_BITS 0x04 -static inline void -grub_serial_fill_defaults (struct grub_serial_port *port) -{ /* Set default settings. */ +static inline grub_err_t +grub_serial_config_defaults (struct grub_serial_port *port) +{ + return port->driver->configure (port, + #ifdef GRUB_MACHINE_MIPS_YEELOONG - port->speed = 115200; + 115200, #else - port->speed = 9600; + 9600, #endif - port->word_len = UART_8BITS_WORD; - port->parity = UART_NO_PARITY; - port->stop_bits = UART_1_STOP_BIT; + UART_8BITS_WORD, UART_NO_PARITY, + UART_1_STOP_BIT); } void grub_ns8250_init (void); diff --git a/term/ns8250.c b/term/ns8250.c index ee2eeb8f5..53e94b899 100644 --- a/term/ns8250.c +++ b/term/ns8250.c @@ -34,33 +34,6 @@ static const grub_port_t serial_hw_io_addr[] = GRUB_MACHINE_SERIAL_PORTS; #define GRUB_SERIAL_PORT_NUM (ARRAY_SIZE(serial_hw_io_addr)) #endif -/* Fetch a key. */ -static int -serial_hw_fetch (struct grub_serial_port *port) -{ - if (grub_inb (port->port + UART_LSR) & UART_DATA_READY) - return grub_inb (port->port + UART_RX); - - return -1; -} - -/* Put a character. */ -static void -serial_hw_put (struct grub_serial_port *port, const int c) -{ - unsigned int timeout = 100000; - - /* Wait until the transmitter holding register is empty. */ - while ((grub_inb (port->port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0) - { - if (--timeout == 0) - /* There is something wrong. But what can I do? */ - return; - } - - grub_outb (c, port->port + UART_TX); -} - /* Convert speed to divisor. */ static unsigned short serial_get_divisor (unsigned int speed) @@ -99,29 +72,19 @@ serial_get_divisor (unsigned int speed) return 0; } -/* Initialize a serial device. PORT is the port number for a serial device. - SPEED is a DTE-DTE speed which must be one of these: 2400, 4800, 9600, - 19200, 38400, 57600 and 115200. WORD_LEN is the word length to be used - for the device. Likewise, PARITY is the type of the parity and - STOP_BIT_LEN is the length of the stop bit. The possible values for - WORD_LEN, PARITY and STOP_BIT_LEN are defined in the header file as - macros. */ -static grub_err_t -serial_hw_configure (struct grub_serial_port *port, - unsigned speed, unsigned short word_len, - unsigned int parity, unsigned short stop_bits) +static void +do_real_config (struct grub_serial_port *port) { + int divisor; unsigned char status = 0; - unsigned short divisor; - divisor = serial_get_divisor (speed); + if (port->configured) + return; + + divisor = serial_get_divisor (port->speed); + /* Shouldn't happen. */ if (divisor == 0) - return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed"); - - port->speed = speed; - port->word_len = word_len; - port->parity = parity; - port->stop_bits = stop_bits; + return; /* Turn off the interrupt. */ grub_outb (0, port->port + UART_IER); @@ -153,7 +116,66 @@ serial_hw_configure (struct grub_serial_port *port, #endif /* Drain the input buffer. */ - while (serial_hw_fetch (port) != -1); + while (grub_inb (port->port + UART_LSR) & UART_DATA_READY) + grub_inb (port->port + UART_RX); + + port->configured = 1; +} + +/* Fetch a key. */ +static int +serial_hw_fetch (struct grub_serial_port *port) +{ + do_real_config (port); + if (grub_inb (port->port + UART_LSR) & UART_DATA_READY) + return grub_inb (port->port + UART_RX); + + return -1; +} + +/* Put a character. */ +static void +serial_hw_put (struct grub_serial_port *port, const int c) +{ + unsigned int timeout = 100000; + + do_real_config (port); + + /* Wait until the transmitter holding register is empty. */ + while ((grub_inb (port->port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0) + { + if (--timeout == 0) + /* There is something wrong. But what can I do? */ + return; + } + + grub_outb (c, port->port + UART_TX); +} + +/* Initialize a serial device. PORT is the port number for a serial device. + SPEED is a DTE-DTE speed which must be one of these: 2400, 4800, 9600, + 19200, 38400, 57600 and 115200. WORD_LEN is the word length to be used + for the device. Likewise, PARITY is the type of the parity and + STOP_BIT_LEN is the length of the stop bit. The possible values for + WORD_LEN, PARITY and STOP_BIT_LEN are defined in the header file as + macros. */ +static grub_err_t +serial_hw_configure (struct grub_serial_port *port, + unsigned speed, unsigned short word_len, + unsigned int parity, unsigned short stop_bits) +{ + unsigned short divisor; + + divisor = serial_get_divisor (speed); + if (divisor == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed"); + + port->speed = speed; + port->word_len = word_len; + port->parity = parity; + port->stop_bits = stop_bits; + + port->configured = 0; /* FIXME: should check if the serial terminal was found. */ @@ -177,11 +199,15 @@ grub_ns8250_init (void) for (i = 0; i < GRUB_SERIAL_PORT_NUM; i++) if (serial_hw_io_addr[i]) { + grub_err_t err; grub_snprintf (com_names[i], sizeof (com_names[i]), "com%d", i); com_ports[i].name = com_names[i]; com_ports[i].driver = &grub_ns8250_driver; - grub_serial_fill_defaults (&com_ports[i]); com_ports[i].port = serial_hw_io_addr[i]; + err = grub_serial_config_defaults (&com_ports[i]); + if (err) + grub_print_error (); + grub_serial_register (&com_ports[i]); } } @@ -204,7 +230,7 @@ grub_serial_ns8250_add_port (grub_port_t port) return NULL; } p->driver = &grub_ns8250_driver; - grub_serial_fill_defaults (p); + grub_serial_config_defaults (p); p->port = port; grub_serial_register (p); diff --git a/term/serial.c b/term/serial.c index 1f54a83ec..d3b2ba143 100644 --- a/term/serial.c +++ b/term/serial.c @@ -315,7 +315,6 @@ grub_serial_unregister (struct grub_serial_port *port) /* FIXME */ } - static grub_extcmd_t cmd; GRUB_MOD_INIT(serial) diff --git a/term/usbserial.c b/term/usbserial.c index 5a63348fb..e25084548 100644 --- a/term/usbserial.c +++ b/term/usbserial.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc. + * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,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 @@ -16,150 +16,122 @@ * along with GRUB. If not, see . */ -#include #include -#include #include #include #include -#include -#include -#include -#include - -static unsigned int registered = 0; - -/* Argument options. */ -static const struct grub_arg_option options[] = -{ - {"unit", 'u', 0, N_("Set the serial unit."), 0, ARG_TYPE_INT}, - {"speed", 's', 0, N_("Set the serial port speed."), 0, ARG_TYPE_INT}, - {"word", 'w', 0, N_("Set the serial port word length."), 0, ARG_TYPE_INT}, - {"parity", 'r', 0, N_("Set the serial port parity."), 0, ARG_TYPE_STRING}, - {"stop", 't', 0, N_("Set the serial port stop bits."), 0, ARG_TYPE_INT}, - {0, 0, 0, 0, 0, 0} -}; - -/* Serial port settings. */ -struct usbserial_port -{ - grub_usb_device_t usbdev; - int in_endp; - int out_endp; - unsigned short divisor; - unsigned short word_len; - unsigned int parity; - unsigned short stop_bits; -}; - -/* Serial port settings. */ -static struct serial_port serial_settings; +#include +#include /* Fetch a key. */ static int -serial_hw_fetch (void) +usbserial_hw_fetch (struct grub_serial_port *port) { - /* FIXME */ - return -1; + char cc[3]; + grub_usb_err_t err; + err = grub_usb_bulk_read (port->usbdev, port->in_endp->endp_addr, 2, cc); + if (err != GRUB_USB_ERR_NAK) + return -1; + + err = grub_usb_bulk_read (port->usbdev, port->in_endp->endp_addr, 3, cc); + if (err != GRUB_USB_ERR_NONE) + return -1; + + return cc[2]; } /* Put a character. */ static void -usbserial_hw_put (struct usbserial_port *port, const int c) +usbserial_hw_put (struct grub_serial_port *port, const int c) { char cc = c; - grub_usb_bulk_write (port->usbdev, port->out_endp, 1, &cc); + grub_usb_bulk_write (port->usbdev, port->out_endp->endp_addr, 1, &cc); } -static grub_uint16_t -grub_serial_getwh (struct grub_term_output *term __attribute__ ((unused))) +/* FIXME */ +static grub_err_t +usbserial_hw_configure (struct grub_serial_port *port, + unsigned speed, unsigned short word_len, + unsigned int parity, unsigned short stop_bits) { - const grub_uint8_t TEXT_WIDTH = 80; - const grub_uint8_t TEXT_HEIGHT = 24; - return (TEXT_WIDTH << 8) | TEXT_HEIGHT; + port->speed = speed; + port->word_len = word_len; + port->parity = parity; + port->stop_bits = stop_bits; + + port->configured = 0; + + return GRUB_ERR_NONE; } -struct grub_terminfo_input_state grub_serial_terminfo_input = - { - .readkey = serial_hw_fetch - }; - -struct grub_terminfo_output_state grub_serial_terminfo_output = +static struct grub_serial_driver grub_usbserial_driver = { + .configure = usbserial_hw_configure, + .fetch = usbserial_hw_fetch, .put = usbserial_hw_put }; -static struct grub_term_input grub_serial_term_input = +static int +grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno) { - .name = "usbserial", - .init = grub_terminfo_input_init, - .checkkey = grub_terminfo_checkkey, - .getkey = grub_terminfo_getkey, - .data = &grub_serial_terminfo_input -}; + static struct grub_serial_port *port; + int j; + struct grub_usb_desc_if *interf + = usbdev->config[configno].interf[interfno].descif; -static struct grub_term_output grub_serial_term_output = -{ - .name = "usbserial", - .putchar = grub_terminfo_putchar, - .getwh = grub_serial_getwh, - .getxy = grub_terminfo_getxy, - .gotoxy = grub_terminfo_gotoxy, - .cls = grub_terminfo_cls, - .setcolorstate = grub_terminfo_setcolorstate, - .setcursor = grub_terminfo_setcursor, - .flags = GRUB_TERM_CODE_TYPE_ASCII, - .data = &grub_serial_terminfo_output, - .normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR, - .highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR, -}; - - - - -static grub_extcmd_t cmd; - -GRUB_MOD_INIT(serial) -{ - cmd = grub_register_extcmd ("serial", grub_cmd_serial, - GRUB_COMMAND_FLAG_BOTH, - N_("[OPTIONS...]"), - N_("Configure serial port."), options); - - /* Set default settings. */ - serial_settings.port = serial_hw_get_port (0); -#ifdef GRUB_MACHINE_MIPS_YEELOONG - serial_settings.divisor = serial_get_divisor (115200); -#else - serial_settings.divisor = serial_get_divisor (9600); -#endif - serial_settings.word_len = UART_8BITS_WORD; - serial_settings.parity = UART_NO_PARITY; - serial_settings.stop_bits = UART_1_STOP_BIT; - -#ifdef GRUB_MACHINE_MIPS_YEELOONG - { - grub_err_t hwiniterr; - hwiniterr = serial_hw_init (); - - if (hwiniterr == GRUB_ERR_NONE) - { - grub_term_register_input_active ("serial", &grub_serial_term_input); - grub_term_register_output_active ("serial", &grub_serial_term_output); - - registered = 1; - } - } -#endif -} - -GRUB_MOD_FINI(serial) -{ - grub_unregister_extcmd (cmd); - if (registered == 1) /* Unregister terminal only if registered. */ + port = grub_malloc (sizeof (*port)); + if (!port) { - grub_term_unregister_input (&grub_serial_term_input); - grub_term_unregister_output (&grub_serial_term_output); - grub_terminfo_output_unregister (&grub_serial_term_output); + grub_print_error (); + return 0; } + + port->name = grub_xasprintf ("usb%d", usbdev->addr); + if (!port->name) + { + grub_free (port); + grub_print_error (); + return 0; + } + + port->usbdev = usbdev; + port->driver = &grub_usbserial_driver; + for (j = 0; j < interf->endpointcnt; j++) + { + struct grub_usb_desc_endp *endp; + endp = &usbdev->config[0].interf[interfno].descendp[j]; + + if ((endp->endp_addr & 128) && (endp->attrib & 3) == 2) + { + /* Bulk IN endpoint. */ + port->in_endp = endp; + } + else if (!(endp->endp_addr & 128) && (endp->attrib & 3) == 2) + { + /* Bulk OUT endpoint. */ + port->out_endp = endp; + } + } + if (!port->out_endp || !port->in_endp) + { + grub_free (port->name); + grub_free (port); + return 0; + } + + grub_serial_config_defaults (port); + grub_serial_register (port); + + return 1; +} + +struct grub_usb_attach_desc attach_hook = +{ + .class = 0xff, + .hook = grub_usbserial_attach +}; + +GRUB_MOD_INIT(usbserial) +{ + grub_usb_register_attach_hook_class (&attach_hook); } From 8c8e2699068c433c069004431354d4f3361924f5 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 13:40:48 +0200 Subject: [PATCH 046/174] Encapsulate serial config in dedicated structure --- include/grub/serial.h | 35 +++++++++++++++++++++-------------- include/grub/usb.h | 5 +++++ term/ns8250.c | 16 ++++++---------- term/serial.c | 32 +++++++++++++------------------- term/usbserial.c | 24 +++++++++++++++++------- 5 files changed, 62 insertions(+), 50 deletions(-) diff --git a/include/grub/serial.h b/include/grub/serial.h index 97e97004c..7828a7c98 100644 --- a/include/grub/serial.h +++ b/include/grub/serial.h @@ -26,27 +26,30 @@ #include struct grub_serial_port; +struct grub_serial_config; struct grub_serial_driver { grub_err_t (*configure) (struct grub_serial_port *port, - unsigned speed, - unsigned short word_len, - unsigned int parity, - unsigned short stop_bits); + struct grub_serial_config *config); int (*fetch) (struct grub_serial_port *port); void (*put) (struct grub_serial_port *port, const int c); }; +struct grub_serial_config +{ + unsigned speed; + unsigned short word_len; + unsigned int parity; + unsigned short stop_bits; +}; + struct grub_serial_port { struct grub_serial_port *next; char *name; - unsigned speed; - unsigned short word_len; - unsigned int parity; - unsigned short stop_bits; struct grub_serial_driver *driver; + struct grub_serial_config config; int configured; /* This should be void *data but since serial is useful as an early console when malloc isn't available it's a union. @@ -86,15 +89,19 @@ void grub_serial_unregister (struct grub_serial_port *port); static inline grub_err_t grub_serial_config_defaults (struct grub_serial_port *port) { - return port->driver->configure (port, - + struct grub_serial_config config = + { #ifdef GRUB_MACHINE_MIPS_YEELOONG - 115200, + .speed = 115200, #else - 9600, + .speed = 9600, #endif - UART_8BITS_WORD, UART_NO_PARITY, - UART_1_STOP_BIT); + .word_len = UART_8BITS_WORD, + .parity = UART_NO_PARITY, + .stop_bits = UART_1_STOP_BIT + }; + + return port->driver->configure (port, &config); } void grub_ns8250_init (void); diff --git a/include/grub/usb.h b/include/grub/usb.h index f9c3d61ff..b3acd3c5e 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -48,6 +48,11 @@ typedef enum GRUB_USB_SPEED_HIGH } grub_usb_speed_t; +enum + { + GRUB_USB_REQTYPE_VENDOR_OUT = 0x40 + }; + /* Call HOOK with each device, until HOOK returns non-zero. */ int grub_usb_iterate (int (*hook) (grub_usb_device_t dev)); diff --git a/term/ns8250.c b/term/ns8250.c index 53e94b899..c63bc6494 100644 --- a/term/ns8250.c +++ b/term/ns8250.c @@ -81,7 +81,7 @@ do_real_config (struct grub_serial_port *port) if (port->configured) return; - divisor = serial_get_divisor (port->speed); + divisor = serial_get_divisor (port->config.speed); /* Shouldn't happen. */ if (divisor == 0) return; @@ -97,7 +97,8 @@ do_real_config (struct grub_serial_port *port) grub_outb (divisor >> 8, port->port + UART_DLH); /* Set the line status. */ - status |= (port->parity | port->word_len | port->stop_bits); + status |= (port->config.parity | port->config.word_len + | port->config.stop_bits); grub_outb (status, port->port + UART_LCR); /* In Yeeloong serial port has only 3 wires. */ @@ -161,20 +162,15 @@ serial_hw_put (struct grub_serial_port *port, const int c) macros. */ static grub_err_t serial_hw_configure (struct grub_serial_port *port, - unsigned speed, unsigned short word_len, - unsigned int parity, unsigned short stop_bits) + struct grub_serial_config *config) { unsigned short divisor; - divisor = serial_get_divisor (speed); + divisor = serial_get_divisor (config->speed); if (divisor == 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed"); - port->speed = speed; - port->word_len = word_len; - port->parity = parity; - port->stop_bits = stop_bits; - + port->config = *config; port->configured = 0; /* FIXME: should check if the serial terminal was found. */ diff --git a/term/serial.c b/term/serial.c index d3b2ba143..00214cb4c 100644 --- a/term/serial.c +++ b/term/serial.c @@ -154,10 +154,7 @@ grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) char pname[40]; char *name = NULL; struct grub_serial_port *port; - signed speed = -1; - signed short word_len = -1; - signed int parity = -1; - signed short stop_bits = -1; + struct grub_serial_config config; grub_err_t err; if (state[0].set) @@ -184,24 +181,21 @@ grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) if (!port) return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown serial port"); - speed = port->speed; - word_len = port->word_len; - parity = port->parity; - stop_bits = port->stop_bits; + config = port->config; if (state[2].set) - speed = grub_strtoul (state[2].arg, 0, 0); + config.speed = grub_strtoul (state[2].arg, 0, 0); if (state[3].set) { if (! grub_strcmp (state[3].arg, "5")) - word_len = UART_5BITS_WORD; + config.word_len = UART_5BITS_WORD; else if (! grub_strcmp (state[3].arg, "6")) - word_len = UART_6BITS_WORD; + config.word_len = UART_6BITS_WORD; else if (! grub_strcmp (state[3].arg, "7")) - word_len = UART_7BITS_WORD; + config.word_len = UART_7BITS_WORD; else if (! grub_strcmp (state[3].arg, "8")) - word_len = UART_8BITS_WORD; + config.word_len = UART_8BITS_WORD; else return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad word length"); } @@ -209,11 +203,11 @@ grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) if (state[4].set) { if (! grub_strcmp (state[4].arg, "no")) - parity = UART_NO_PARITY; + config.parity = UART_NO_PARITY; else if (! grub_strcmp (state[4].arg, "odd")) - parity = UART_ODD_PARITY; + config.parity = UART_ODD_PARITY; else if (! grub_strcmp (state[4].arg, "even")) - parity = UART_EVEN_PARITY; + config.parity = UART_EVEN_PARITY; else return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad parity"); } @@ -221,15 +215,15 @@ grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) if (state[5].set) { if (! grub_strcmp (state[5].arg, "1")) - stop_bits = UART_1_STOP_BIT; + config.stop_bits = UART_1_STOP_BIT; else if (! grub_strcmp (state[5].arg, "2")) - stop_bits = UART_2_STOP_BITS; + config.stop_bits = UART_2_STOP_BITS; else return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad number of stop bits"); } /* Initialize with new settings. */ - err = port->driver->configure (port, speed, word_len, parity, stop_bits); + err = port->driver->configure (port, &config); if (err) return err; if (!registered) diff --git a/term/usbserial.c b/term/usbserial.c index e25084548..258187ff9 100644 --- a/term/usbserial.c +++ b/term/usbserial.c @@ -23,12 +23,24 @@ #include #include +static void +real_config (struct grub_serial_port *port) +{ + if (port->configured) + return; + + port->configured = 1; +} + /* Fetch a key. */ static int usbserial_hw_fetch (struct grub_serial_port *port) { char cc[3]; grub_usb_err_t err; + + real_config (port); + err = grub_usb_bulk_read (port->usbdev, port->in_endp->endp_addr, 2, cc); if (err != GRUB_USB_ERR_NAK) return -1; @@ -45,20 +57,18 @@ static void usbserial_hw_put (struct grub_serial_port *port, const int c) { char cc = c; + + real_config (port); + grub_usb_bulk_write (port->usbdev, port->out_endp->endp_addr, 1, &cc); } /* FIXME */ static grub_err_t usbserial_hw_configure (struct grub_serial_port *port, - unsigned speed, unsigned short word_len, - unsigned int parity, unsigned short stop_bits) + struct grub_serial_config *config) { - port->speed = speed; - port->word_len = word_len; - port->parity = parity; - port->stop_bits = stop_bits; - + port->config = *config; port->configured = 0; return GRUB_ERR_NONE; From 1da07b142b14c60c5527c5bbdd644335fd3a76ee Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 14:43:23 +0200 Subject: [PATCH 047/174] some serial config support --- include/grub/serial.h | 31 +++++++++------- term/ns8250.c | 25 ++++++++++--- term/serial.c | 10 +++--- term/usbserial.c | 82 ++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 124 insertions(+), 24 deletions(-) diff --git a/include/grub/serial.h b/include/grub/serial.h index 7828a7c98..5afc1f172 100644 --- a/include/grub/serial.h +++ b/include/grub/serial.h @@ -36,12 +36,26 @@ struct grub_serial_driver void (*put) (struct grub_serial_port *port, const int c); }; +/* The type of parity. */ +typedef enum + { + GRUB_SERIAL_PARITY_NONE, + GRUB_SERIAL_PARITY_ODD, + GRUB_SERIAL_PARITY_EVEN, + } grub_serial_parity_t; + +typedef enum + { + GRUB_SERIAL_STOP_BITS_1, + GRUB_SERIAL_STOP_BITS_2, + } grub_serial_stop_bits_t; + struct grub_serial_config { unsigned speed; unsigned short word_len; - unsigned int parity; - unsigned short stop_bits; + grub_serial_parity_t parity; + grub_serial_stop_bits_t stop_bits; }; struct grub_serial_port @@ -76,15 +90,6 @@ void grub_serial_unregister (struct grub_serial_port *port); #define UART_7BITS_WORD 0x02 #define UART_8BITS_WORD 0x03 -/* The type of parity. */ -#define UART_NO_PARITY 0x00 -#define UART_ODD_PARITY 0x08 -#define UART_EVEN_PARITY 0x18 - -/* The type of the length of stop bit. */ -#define UART_1_STOP_BIT 0x00 -#define UART_2_STOP_BITS 0x04 - /* Set default settings. */ static inline grub_err_t grub_serial_config_defaults (struct grub_serial_port *port) @@ -97,8 +102,8 @@ grub_serial_config_defaults (struct grub_serial_port *port) .speed = 9600, #endif .word_len = UART_8BITS_WORD, - .parity = UART_NO_PARITY, - .stop_bits = UART_1_STOP_BIT + .parity = GRUB_SERIAL_PARITY_NONE, + .stop_bits = GRUB_SERIAL_STOP_BITS_1 }; return port->driver->configure (port, &config); diff --git a/term/ns8250.c b/term/ns8250.c index c63bc6494..a69c683f2 100644 --- a/term/ns8250.c +++ b/term/ns8250.c @@ -77,14 +77,20 @@ do_real_config (struct grub_serial_port *port) { int divisor; unsigned char status = 0; + const unsigned char parities[] = { + [GRUB_SERIAL_PARITY_NONE] = UART_NO_PARITY, + [GRUB_SERIAL_PARITY_ODD] = UART_ODD_PARITY, + [GRUB_SERIAL_PARITY_EVEN] = UART_EVEN_PARITY + }; + const unsigned char stop_bits[] = { + [GRUB_SERIAL_STOP_BITS_1] = UART_1_STOP_BIT, + [GRUB_SERIAL_STOP_BITS_2] = UART_2_STOP_BITS, + }; if (port->configured) return; divisor = serial_get_divisor (port->config.speed); - /* Shouldn't happen. */ - if (divisor == 0) - return; /* Turn off the interrupt. */ grub_outb (0, port->port + UART_IER); @@ -97,8 +103,8 @@ do_real_config (struct grub_serial_port *port) grub_outb (divisor >> 8, port->port + UART_DLH); /* Set the line status. */ - status |= (port->config.parity | port->config.word_len - | port->config.stop_bits); + status |= (parities[port->config.parity] + | port->config.word_len | stop_bits[port->config.stop_bits]); grub_outb (status, port->port + UART_LCR); /* In Yeeloong serial port has only 3 wires. */ @@ -170,6 +176,15 @@ serial_hw_configure (struct grub_serial_port *port, if (divisor == 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed"); + if (config->parity != GRUB_SERIAL_PARITY_NONE + && config->parity != GRUB_SERIAL_PARITY_ODD + && config->parity != GRUB_SERIAL_PARITY_EVEN) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported parity"); + + if (config->stop_bits != GRUB_SERIAL_STOP_BITS_1 + && config->stop_bits != GRUB_SERIAL_STOP_BITS_2) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported stop bits"); + port->config = *config; port->configured = 0; diff --git a/term/serial.c b/term/serial.c index 00214cb4c..5f27b16b6 100644 --- a/term/serial.c +++ b/term/serial.c @@ -203,11 +203,11 @@ grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) if (state[4].set) { if (! grub_strcmp (state[4].arg, "no")) - config.parity = UART_NO_PARITY; + config.parity = GRUB_SERIAL_PARITY_NONE; else if (! grub_strcmp (state[4].arg, "odd")) - config.parity = UART_ODD_PARITY; + config.parity = GRUB_SERIAL_PARITY_ODD; else if (! grub_strcmp (state[4].arg, "even")) - config.parity = UART_EVEN_PARITY; + config.parity = GRUB_SERIAL_PARITY_EVEN; else return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad parity"); } @@ -215,9 +215,9 @@ grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) if (state[5].set) { if (! grub_strcmp (state[5].arg, "1")) - config.stop_bits = UART_1_STOP_BIT; + config.stop_bits = GRUB_SERIAL_STOP_BITS_1; else if (! grub_strcmp (state[5].arg, "2")) - config.stop_bits = UART_2_STOP_BITS; + config.stop_bits = GRUB_SERIAL_STOP_BITS_2; else return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad number of stop bits"); } diff --git a/term/usbserial.c b/term/usbserial.c index 258187ff9..b2a89d56c 100644 --- a/term/usbserial.c +++ b/term/usbserial.c @@ -23,12 +23,78 @@ #include #include +enum + { + GRUB_USBSERIAL_MODEM_CTRL = 0x01, + GRUB_USBSERIAL_FLOW_CTRL = 0x02, + GRUB_USBSERIAL_SPEED_CTRL = 0x03, + GRUB_USBSERIAL_DATA_CTRL = 0x04 + }; + +#define GRUB_USBSERIAL_MODEM_CTRL_DTRRTS 3 +#define GRUB_USBSERIAL_FLOW_CTRL_DTRRTS 3 + +/* Convert speed to divisor. */ +static grub_uint32_t +get_divisor (unsigned int speed) +{ + unsigned int i; + + /* The structure for speed vs. divisor. */ + struct divisor + { + unsigned int speed; + grub_uint32_t div; + }; + + /* The table which lists common configurations. */ + static struct divisor divisor_tab[] = + { + { 9600, 0x4138 }, + }; + + /* Set the baud rate. */ + for (i = 0; i < sizeof (divisor_tab) / sizeof (divisor_tab[0]); i++) + if (divisor_tab[i].speed == speed) + return divisor_tab[i].div; + return 0; +} + static void real_config (struct grub_serial_port *port) { + grub_uint32_t divisor; + const grub_uint16_t parities[] = { + [GRUB_SERIAL_PARITY_NONE] = 0x0000, + [GRUB_SERIAL_PARITY_ODD] = 0x0100, + [GRUB_SERIAL_PARITY_EVEN] = 0x0200 + }; + const grub_uint16_t stop_bits[] = { + [GRUB_SERIAL_STOP_BITS_1] = 0x0000, + [GRUB_SERIAL_STOP_BITS_2] = 0x1000, + }; + if (port->configured) return; + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + GRUB_USBSERIAL_MODEM_CTRL, + GRUB_USBSERIAL_MODEM_CTRL_DTRRTS, 0, 0, 0); + + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + GRUB_USBSERIAL_FLOW_CTRL, + GRUB_USBSERIAL_FLOW_CTRL_DTRRTS, 0, 0, 0); + + divisor = get_divisor (port->config.speed); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + GRUB_USBSERIAL_SPEED_CTRL, + divisor & 0xffff, divisor >> 16, 0, 0); + + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + GRUB_USBSERIAL_DATA_CTRL, + parities[port->config.parity] + | stop_bits[port->config.stop_bits] , 0, 0, 0); + port->configured = 1; } @@ -63,11 +129,25 @@ usbserial_hw_put (struct grub_serial_port *port, const int c) grub_usb_bulk_write (port->usbdev, port->out_endp->endp_addr, 1, &cc); } -/* FIXME */ static grub_err_t usbserial_hw_configure (struct grub_serial_port *port, struct grub_serial_config *config) { + grub_uint16_t divisor; + + divisor = get_divisor (config->speed); + if (divisor == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed"); + + if (config->parity != GRUB_SERIAL_PARITY_NONE + && config->parity != GRUB_SERIAL_PARITY_ODD + && config->parity != GRUB_SERIAL_PARITY_EVEN) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported parity"); + + if (config->stop_bits != GRUB_SERIAL_STOP_BITS_1 + && config->stop_bits != GRUB_SERIAL_STOP_BITS_2) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported stop bits"); + port->config = *config; port->configured = 0; From 91d135a12c6be53cd67f9b45b7c4d9c6f957aea7 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 15:00:50 +0200 Subject: [PATCH 048/174] Support variable speed --- term/ns8250.c | 2 +- term/usbserial.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/term/ns8250.c b/term/ns8250.c index a69c683f2..9677913be 100644 --- a/term/ns8250.c +++ b/term/ns8250.c @@ -61,7 +61,7 @@ serial_get_divisor (unsigned int speed) }; /* Set the baud rate. */ - for (i = 0; i < sizeof (divisor_tab) / sizeof (divisor_tab[0]); i++) + for (i = 0; i < ARRAY_SIZE (divisor_tab); i++) if (divisor_tab[i].speed == speed) /* UART in Yeeloong runs twice the usual rate. */ #ifdef GRUB_MACHINE_MIPS_YEELOONG diff --git a/term/usbserial.c b/term/usbserial.c index b2a89d56c..7a5aead2c 100644 --- a/term/usbserial.c +++ b/term/usbserial.c @@ -48,13 +48,20 @@ get_divisor (unsigned int speed) }; /* The table which lists common configurations. */ + /* Computed with a division formula with 3MHz as base frequency. */ static struct divisor divisor_tab[] = { + { 2400, 0x04e2 }, + { 4800, 0x0271 }, { 9600, 0x4138 }, + { 19200, 0x809c }, + { 38400, 0xc04e }, + { 57600, 0xc034 }, + { 115200, 0x001a } }; /* Set the baud rate. */ - for (i = 0; i < sizeof (divisor_tab) / sizeof (divisor_tab[0]); i++) + for (i = 0; i < ARRAY_SIZE (divisor_tab); i++) if (divisor_tab[i].speed == speed) return divisor_tab[i].div; return 0; From fd5b6637939816e80ed8bb7fc6efb68b9f174a7b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 15:07:59 +0200 Subject: [PATCH 049/174] Configure word length --- include/grub/ns8250.h | 6 ++++++ include/grub/serial.h | 10 ++-------- term/ns8250.c | 6 +++++- term/serial.c | 13 +------------ term/usbserial.c | 6 +++++- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/include/grub/ns8250.h b/include/grub/ns8250.h index f21a1a3e3..f8b9c3a8c 100644 --- a/include/grub/ns8250.h +++ b/include/grub/ns8250.h @@ -45,6 +45,12 @@ #define UART_ODD_PARITY 0x08 #define UART_EVEN_PARITY 0x18 +/* The type of word length. */ +#define UART_5BITS_WORD 0x00 +#define UART_6BITS_WORD 0x01 +#define UART_7BITS_WORD 0x02 +#define UART_8BITS_WORD 0x03 + /* The type of the length of stop bit. */ #define UART_1_STOP_BIT 0x00 #define UART_2_STOP_BITS 0x04 diff --git a/include/grub/serial.h b/include/grub/serial.h index 5afc1f172..e66dcf80d 100644 --- a/include/grub/serial.h +++ b/include/grub/serial.h @@ -53,7 +53,7 @@ typedef enum struct grub_serial_config { unsigned speed; - unsigned short word_len; + int word_len; grub_serial_parity_t parity; grub_serial_stop_bits_t stop_bits; }; @@ -84,12 +84,6 @@ grub_err_t grub_serial_register (struct grub_serial_port *port); void grub_serial_unregister (struct grub_serial_port *port); -/* The type of word length. */ -#define UART_5BITS_WORD 0x00 -#define UART_6BITS_WORD 0x01 -#define UART_7BITS_WORD 0x02 -#define UART_8BITS_WORD 0x03 - /* Set default settings. */ static inline grub_err_t grub_serial_config_defaults (struct grub_serial_port *port) @@ -101,7 +95,7 @@ grub_serial_config_defaults (struct grub_serial_port *port) #else .speed = 9600, #endif - .word_len = UART_8BITS_WORD, + .word_len = 8, .parity = GRUB_SERIAL_PARITY_NONE, .stop_bits = GRUB_SERIAL_STOP_BITS_1 }; diff --git a/term/ns8250.c b/term/ns8250.c index 9677913be..93a5e215e 100644 --- a/term/ns8250.c +++ b/term/ns8250.c @@ -104,7 +104,8 @@ do_real_config (struct grub_serial_port *port) /* Set the line status. */ status |= (parities[port->config.parity] - | port->config.word_len | stop_bits[port->config.stop_bits]); + | (port->config.word_len - 5) + | stop_bits[port->config.stop_bits]); grub_outb (status, port->port + UART_LCR); /* In Yeeloong serial port has only 3 wires. */ @@ -185,6 +186,9 @@ serial_hw_configure (struct grub_serial_port *port, && config->stop_bits != GRUB_SERIAL_STOP_BITS_2) return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported stop bits"); + if (config->word_len < 5 || config->word_len > 8) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported word length"); + port->config = *config; port->configured = 0; diff --git a/term/serial.c b/term/serial.c index 5f27b16b6..aeaec5c88 100644 --- a/term/serial.c +++ b/term/serial.c @@ -187,18 +187,7 @@ grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) config.speed = grub_strtoul (state[2].arg, 0, 0); if (state[3].set) - { - if (! grub_strcmp (state[3].arg, "5")) - config.word_len = UART_5BITS_WORD; - else if (! grub_strcmp (state[3].arg, "6")) - config.word_len = UART_6BITS_WORD; - else if (! grub_strcmp (state[3].arg, "7")) - config.word_len = UART_7BITS_WORD; - else if (! grub_strcmp (state[3].arg, "8")) - config.word_len = UART_8BITS_WORD; - else - return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad word length"); - } + config.word_len = grub_strtoul (state[3].arg, 0, 0); if (state[4].set) { diff --git a/term/usbserial.c b/term/usbserial.c index 7a5aead2c..b27df8ae2 100644 --- a/term/usbserial.c +++ b/term/usbserial.c @@ -100,7 +100,8 @@ real_config (struct grub_serial_port *port) grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, GRUB_USBSERIAL_DATA_CTRL, parities[port->config.parity] - | stop_bits[port->config.stop_bits] , 0, 0, 0); + | stop_bits[port->config.stop_bits] + | port->config.word_len, 0, 0, 0); port->configured = 1; } @@ -155,6 +156,9 @@ usbserial_hw_configure (struct grub_serial_port *port, && config->stop_bits != GRUB_SERIAL_STOP_BITS_2) return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported stop bits"); + if (config->word_len < 5 || config->word_len > 8) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported word length"); + port->config = *config; port->configured = 0; From dd20a7868b291fd5fe6cfc8625f5eca733bf1b74 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 16:31:42 +0200 Subject: [PATCH 050/174] Rename usbserial to usbserial_ftdi --- term/usbserial.c => bus/usb/serial/ftdi.c | 32 ++++++++++++++++++++--- bus/usb/usb.c | 3 ++- conf/i386-pc.rmk | 8 +++--- 3 files changed, 34 insertions(+), 9 deletions(-) rename term/usbserial.c => bus/usb/serial/ftdi.c (90%) diff --git a/term/usbserial.c b/bus/usb/serial/ftdi.c similarity index 90% rename from term/usbserial.c rename to bus/usb/serial/ftdi.c index b27df8ae2..c7a7554ee 100644 --- a/term/usbserial.c +++ b/bus/usb/serial/ftdi.c @@ -172,13 +172,22 @@ static struct grub_serial_driver grub_usbserial_driver = .put = usbserial_hw_put }; +static const struct +{ + grub_uint16_t vendor, product; +} products[] = + { + {0x0403, 0x6001} /* QEMU virtual USBserial. */ + }; + static int -grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno) +grub_ftdi_attach (grub_usb_device_t usbdev, int configno, int interfno) { static struct grub_serial_port *port; int j; - struct grub_usb_desc_if *interf - = usbdev->config[configno].interf[interfno].descif; + struct grub_usb_desc_if *interf; + + interf = usbdev->config[configno].interf[interfno].descif; port = grub_malloc (sizeof (*port)); if (!port) @@ -226,13 +235,28 @@ grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno) return 1; } +static int +grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno) +{ + unsigned j; + + for (j = 0; j < ARRAY_SIZE (products); j++) + if (usbdev->descdev.vendorid == products[j].vendor + && usbdev->descdev.prodid == products[j].product) + break; + if (j == ARRAY_SIZE (products)) + return 0; + + return grub_ftdi_attach (usbdev, configno, interfno); +} + struct grub_usb_attach_desc attach_hook = { .class = 0xff, .hook = grub_usbserial_attach }; -GRUB_MOD_INIT(usbserial) +GRUB_MOD_INIT(usbserial_ftdi) { grub_usb_register_attach_hook_class (&attach_hook); } diff --git a/bus/usb/usb.c b/bus/usb/usb.c index ba052e5ee..b49caacdb 100644 --- a/bus/usb/usb.c +++ b/bus/usb/usb.c @@ -270,7 +270,8 @@ void grub_usb_device_attach (grub_usb_device_t dev) grub_dl_load ("usb_keyboard"); break; case 0xff: - grub_dl_load ("usbserial"); + /* FIXME: don't load useless modules. */ + grub_dl_load ("usbserial_ftdi"); break; } } diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index e1cfe1468..2e95133f3 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -196,10 +196,10 @@ usb_mod_CFLAGS = $(COMMON_CFLAGS) usb_mod_LDFLAGS = $(COMMON_LDFLAGS) # For serial.mod. -pkglib_MODULES += usbserial.mod -usbserial_mod_SOURCES = term/usbserial.c -usbserial_mod_CFLAGS = $(COMMON_CFLAGS) -usbserial_mod_LDFLAGS = $(COMMON_LDFLAGS) +pkglib_MODULES += usbserial_ftdi.mod +usbserial_ftdi_mod_SOURCES = bus/usb/serial/ftdi.c +usbserial_ftdi_mod_CFLAGS = $(COMMON_CFLAGS) +usbserial_ftdi_mod_LDFLAGS = $(COMMON_LDFLAGS) # For usbtest.mod usbtest_mod_SOURCES = commands/usbtest.c From 24494d478adad49868af2a75d7afa307379e6547 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 17:40:42 +0200 Subject: [PATCH 051/174] Add fini routines for usbserial and rename grub_usbserial to grub_ftdi --- bus/usb/serial/ftdi.c | 87 ++++++++++++++++++++++++++++--------------- include/grub/serial.h | 8 ++++ include/grub/usb.h | 5 +-- term/ns8250.c | 2 +- term/serial.c | 74 +++++++++++++++++++++++------------- 5 files changed, 118 insertions(+), 58 deletions(-) diff --git a/bus/usb/serial/ftdi.c b/bus/usb/serial/ftdi.c index c7a7554ee..4495b055c 100644 --- a/bus/usb/serial/ftdi.c +++ b/bus/usb/serial/ftdi.c @@ -25,14 +25,14 @@ enum { - GRUB_USBSERIAL_MODEM_CTRL = 0x01, - GRUB_USBSERIAL_FLOW_CTRL = 0x02, - GRUB_USBSERIAL_SPEED_CTRL = 0x03, - GRUB_USBSERIAL_DATA_CTRL = 0x04 + GRUB_FTDI_MODEM_CTRL = 0x01, + GRUB_FTDI_FLOW_CTRL = 0x02, + GRUB_FTDI_SPEED_CTRL = 0x03, + GRUB_FTDI_DATA_CTRL = 0x04 }; -#define GRUB_USBSERIAL_MODEM_CTRL_DTRRTS 3 -#define GRUB_USBSERIAL_FLOW_CTRL_DTRRTS 3 +#define GRUB_FTDI_MODEM_CTRL_DTRRTS 3 +#define GRUB_FTDI_FLOW_CTRL_DTRRTS 3 /* Convert speed to divisor. */ static grub_uint32_t @@ -85,20 +85,20 @@ real_config (struct grub_serial_port *port) return; grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_USBSERIAL_MODEM_CTRL, - GRUB_USBSERIAL_MODEM_CTRL_DTRRTS, 0, 0, 0); + GRUB_FTDI_MODEM_CTRL, + GRUB_FTDI_MODEM_CTRL_DTRRTS, 0, 0, 0); grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_USBSERIAL_FLOW_CTRL, - GRUB_USBSERIAL_FLOW_CTRL_DTRRTS, 0, 0, 0); + GRUB_FTDI_FLOW_CTRL, + GRUB_FTDI_FLOW_CTRL_DTRRTS, 0, 0, 0); divisor = get_divisor (port->config.speed); grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_USBSERIAL_SPEED_CTRL, + GRUB_FTDI_SPEED_CTRL, divisor & 0xffff, divisor >> 16, 0, 0); grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_USBSERIAL_DATA_CTRL, + GRUB_FTDI_DATA_CTRL, parities[port->config.parity] | stop_bits[port->config.stop_bits] | port->config.word_len, 0, 0, 0); @@ -108,17 +108,13 @@ real_config (struct grub_serial_port *port) /* Fetch a key. */ static int -usbserial_hw_fetch (struct grub_serial_port *port) +ftdi_hw_fetch (struct grub_serial_port *port) { char cc[3]; grub_usb_err_t err; real_config (port); - err = grub_usb_bulk_read (port->usbdev, port->in_endp->endp_addr, 2, cc); - if (err != GRUB_USB_ERR_NAK) - return -1; - err = grub_usb_bulk_read (port->usbdev, port->in_endp->endp_addr, 3, cc); if (err != GRUB_USB_ERR_NONE) return -1; @@ -128,7 +124,7 @@ usbserial_hw_fetch (struct grub_serial_port *port) /* Put a character. */ static void -usbserial_hw_put (struct grub_serial_port *port, const int c) +ftdi_hw_put (struct grub_serial_port *port, const int c) { char cc = c; @@ -138,7 +134,7 @@ usbserial_hw_put (struct grub_serial_port *port, const int c) } static grub_err_t -usbserial_hw_configure (struct grub_serial_port *port, +ftdi_hw_configure (struct grub_serial_port *port, struct grub_serial_config *config) { grub_uint16_t divisor; @@ -165,11 +161,19 @@ usbserial_hw_configure (struct grub_serial_port *port, return GRUB_ERR_NONE; } -static struct grub_serial_driver grub_usbserial_driver = +static void +ftdi_fini (struct grub_serial_port *port) +{ + port->usbdev->config[port->configno].interf[port->interfno].detach_hook = 0; + port->usbdev->config[port->configno].interf[port->interfno].attached = 0; +} + +static struct grub_serial_driver grub_ftdi_driver = { - .configure = usbserial_hw_configure, - .fetch = usbserial_hw_fetch, - .put = usbserial_hw_put + .configure = ftdi_hw_configure, + .fetch = ftdi_hw_fetch, + .put = ftdi_hw_put, + .fini = ftdi_fini }; static const struct @@ -180,8 +184,19 @@ static const struct {0x0403, 0x6001} /* QEMU virtual USBserial. */ }; +static int ftdinum = 0; + +static void +ftdi_detach (grub_usb_device_t usbdev, int configno, int interfno) +{ + static struct grub_serial_port *port; + port = usbdev->config[configno].interf[interfno].detach_data; + + grub_serial_unregister (port); +} + static int -grub_ftdi_attach (grub_usb_device_t usbdev, int configno, int interfno) +grub_ftdi_attach_real (grub_usb_device_t usbdev, int configno, int interfno) { static struct grub_serial_port *port; int j; @@ -196,7 +211,7 @@ grub_ftdi_attach (grub_usb_device_t usbdev, int configno, int interfno) return 0; } - port->name = grub_xasprintf ("usb%d", usbdev->addr); + port->name = grub_xasprintf ("ftdi%d", ftdinum++); if (!port->name) { grub_free (port); @@ -205,7 +220,7 @@ grub_ftdi_attach (grub_usb_device_t usbdev, int configno, int interfno) } port->usbdev = usbdev; - port->driver = &grub_usbserial_driver; + port->driver = &grub_ftdi_driver; for (j = 0; j < interf->endpointcnt; j++) { struct grub_usb_desc_endp *endp; @@ -229,14 +244,22 @@ grub_ftdi_attach (grub_usb_device_t usbdev, int configno, int interfno) return 0; } + port->configno = configno; + port->interfno = interfno; + grub_serial_config_defaults (port); grub_serial_register (port); + port->usbdev->config[port->configno].interf[port->interfno].detach_hook + = ftdi_detach; + port->usbdev->config[port->configno].interf[port->interfno].detach_data + = port; + return 1; } static int -grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno) +grub_ftdi_attach (grub_usb_device_t usbdev, int configno, int interfno) { unsigned j; @@ -247,16 +270,22 @@ grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno) if (j == ARRAY_SIZE (products)) return 0; - return grub_ftdi_attach (usbdev, configno, interfno); + return grub_ftdi_attach_real (usbdev, configno, interfno); } struct grub_usb_attach_desc attach_hook = { .class = 0xff, - .hook = grub_usbserial_attach + .hook = grub_ftdi_attach }; GRUB_MOD_INIT(usbserial_ftdi) { grub_usb_register_attach_hook_class (&attach_hook); } + +GRUB_MOD_FINI(usbserial_ftdi) +{ + grub_serial_unregister_driver (&grub_ftdi_driver); + grub_usb_unregister_attach_hook_class (&attach_hook); +} diff --git a/include/grub/serial.h b/include/grub/serial.h index e66dcf80d..fd601a6d9 100644 --- a/include/grub/serial.h +++ b/include/grub/serial.h @@ -24,6 +24,7 @@ #include #include #include +#include struct grub_serial_port; struct grub_serial_config; @@ -34,6 +35,7 @@ struct grub_serial_driver struct grub_serial_config *config); int (*fetch) (struct grub_serial_port *port); void (*put) (struct grub_serial_port *port, const int c); + void (*fini) (struct grub_serial_port *port); }; /* The type of parity. */ @@ -74,10 +76,14 @@ struct grub_serial_port struct { grub_usb_device_t usbdev; + int configno; + int interfno; struct grub_usb_desc_endp *in_endp; struct grub_usb_desc_endp *out_endp; }; }; + grub_term_output_t term_out; + grub_term_input_t term_in; }; grub_err_t grub_serial_register (struct grub_serial_port *port); @@ -105,5 +111,7 @@ grub_serial_config_defaults (struct grub_serial_port *port) void grub_ns8250_init (void); char *grub_serial_ns8250_add_port (grub_port_t port); +extern struct grub_serial_driver grub_ns8250_driver; +void grub_serial_unregister_driver (struct grub_serial_driver *driver); #endif diff --git a/include/grub/usb.h b/include/grub/usb.h index b3acd3c5e..595cbd6d3 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -138,6 +138,8 @@ struct grub_usb_interface int attached; void (*detach_hook) (struct grub_usb_device *dev, int config, int interface); + + void *detach_data; }; struct grub_usb_configuration @@ -171,9 +173,6 @@ struct grub_usb_device /* Data toggle values (used for bulk transfers only). */ int toggle[256]; - - /* Device-specific data. */ - void *data; }; diff --git a/term/ns8250.c b/term/ns8250.c index 93a5e215e..6bf8c5b59 100644 --- a/term/ns8250.c +++ b/term/ns8250.c @@ -197,7 +197,7 @@ serial_hw_configure (struct grub_serial_port *port, return GRUB_ERR_NONE; } -static struct grub_serial_driver grub_ns8250_driver = +struct grub_serial_driver grub_ns8250_driver = { .configure = serial_hw_configure, .fetch = serial_hw_fetch, diff --git a/term/serial.c b/term/serial.c index aeaec5c88..20dec7347 100644 --- a/term/serial.c +++ b/term/serial.c @@ -215,14 +215,18 @@ grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) err = port->driver->configure (port, &config); if (err) return err; - if (!registered) + /* Compatibility kludge. */ + if (port->driver == &grub_ns8250_driver) { - grub_term_register_input ("serial", &grub_serial_term_input); - grub_term_register_output ("serial", &grub_serial_term_output); + if (!registered) + { + grub_term_register_input ("serial", &grub_serial_term_input); + grub_term_register_output ("serial", &grub_serial_term_output); + } + grub_serial_terminfo_output.port = port; + grub_serial_terminfo_input.port = port; + registered = 1; } - grub_serial_terminfo_output.port = port; - grub_serial_terminfo_input.port = port; - registered = 1; return GRUB_ERR_NONE; } @@ -284,9 +288,21 @@ grub_serial_register (struct grub_serial_port *port) grub_list_push (GRUB_AS_LIST_P (&grub_serial_ports), GRUB_AS_LIST (port)); ((struct grub_serial_input_state *) in->data)->port = port; ((struct grub_serial_output_state *) out->data)->port = port; - grub_term_register_input ("serial_*", in); - grub_term_register_output ("serial_*", out); + port->term_in = in; + port->term_out = out; grub_terminfo_output_register (out, "vt100"); +#ifdef GRUB_MACHINE_MIPS_YEELOONG + if (grub_strcmp (port->name, "com0") == 0) + { + grub_term_register_input_active ("serial_*", in); + grub_term_register_output_active ("serial_*", out); + } + else +#endif + { + grub_term_register_input ("serial_*", in); + grub_term_register_output ("serial_*", out); + } return GRUB_ERR_NONE; } @@ -294,8 +310,27 @@ grub_serial_register (struct grub_serial_port *port) void grub_serial_unregister (struct grub_serial_port *port) { + if (port->driver->fini) + port->driver->fini (port); + + if (port->term_in) + grub_term_unregister_input (port->term_in); + if (port->term_out) + grub_term_unregister_output (port->term_out); + grub_list_remove (GRUB_AS_LIST_P (&grub_serial_ports), GRUB_AS_LIST (port)); - /* FIXME */ +} + +void +grub_serial_unregister_driver (struct grub_serial_driver *driver) +{ + struct grub_serial_port *port, *next; + for (port = grub_serial_ports; port; port = next) + { + next = port->next; + if (port->driver == driver) + grub_serial_unregister (port); + } } static grub_extcmd_t cmd; @@ -308,27 +343,16 @@ GRUB_MOD_INIT(serial) N_("Configure serial port."), options); grub_ns8250_init (); - -#ifdef GRUB_MACHINE_MIPS_YEELOONG - { - grub_err_t hwiniterr; - hwiniterr = grub_ns8250_driver.init ("com0", &serial_settings); - serial_settings.driver = &grub_ns8250_driver; - - if (hwiniterr == GRUB_ERR_NONE) - { - grub_term_register_input_active ("serial", &grub_serial_term_input); - grub_term_register_output_active ("serial", &grub_serial_term_output); - - registered = 1; - } - } -#endif } GRUB_MOD_FINI(serial) { while (grub_serial_ports) grub_serial_unregister (grub_serial_ports); + if (registered) + { + grub_term_unregister_input (&grub_serial_term_input); + grub_term_unregister_output (&grub_serial_term_output); + } grub_unregister_extcmd (cmd); } From 44e7b8cb491aafc0e1b238b2aedb671e40ef9947 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 19:09:54 +0200 Subject: [PATCH 052/174] account for absence of NS8250 on emu --- term/serial.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/term/serial.c b/term/serial.c index 20dec7347..2268788af 100644 --- a/term/serial.c +++ b/term/serial.c @@ -131,6 +131,7 @@ grub_serial_find (char *name) if (grub_strcmp (port->name, name) == 0) break; +#ifndef GRUB_MACHINE_EMU if (!port && grub_memcmp (name, "port", sizeof ("port") - 1) == 0 && grub_isdigit (name [sizeof ("port") - 1])) { @@ -143,6 +144,7 @@ grub_serial_find (char *name) if (grub_strcmp (port->name, name) == 0) break; } +#endif return port; } @@ -215,6 +217,7 @@ grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) err = port->driver->configure (port, &config); if (err) return err; +#ifndef GRUB_MACHINE_EMU /* Compatibility kludge. */ if (port->driver == &grub_ns8250_driver) { @@ -227,6 +230,7 @@ grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) grub_serial_terminfo_input.port = port; registered = 1; } +#endif return GRUB_ERR_NONE; } @@ -341,8 +345,9 @@ GRUB_MOD_INIT(serial) GRUB_COMMAND_FLAG_BOTH, N_("[OPTIONS...]"), N_("Configure serial port."), options); - +#ifndef GRUB_MACHINE_EMU grub_ns8250_init (); +#endif } GRUB_MOD_FINI(serial) From a531fd134de9e809444af4d5dad09d793621a029 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 19:10:57 +0200 Subject: [PATCH 053/174] Split common usbserial function. PL2303 skeleton --- bus/usb/serial/common.c | 102 +++++++++++++++++++ bus/usb/serial/ftdi.c | 89 +--------------- bus/usb/serial/pl2303.c | 212 +++++++++++++++++++++++++++++++++++++++ conf/i386-pc.rmk | 12 +++ include/grub/usbserial.h | 31 ++++++ 5 files changed, 362 insertions(+), 84 deletions(-) create mode 100644 bus/usb/serial/common.c create mode 100644 bus/usb/serial/pl2303.c create mode 100644 include/grub/usbserial.h diff --git a/bus/usb/serial/common.c b/bus/usb/serial/common.c new file mode 100644 index 000000000..1da1c5bcf --- /dev/null +++ b/bus/usb/serial/common.c @@ -0,0 +1,102 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,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 . + */ + +#include +#include + +void +grub_usbserial_fini (struct grub_serial_port *port) +{ + port->usbdev->config[port->configno].interf[port->interfno].detach_hook = 0; + port->usbdev->config[port->configno].interf[port->interfno].attached = 0; +} + +void +grub_usbserial_detach (grub_usb_device_t usbdev, int configno, int interfno) +{ + static struct grub_serial_port *port; + port = usbdev->config[configno].interf[interfno].detach_data; + + grub_serial_unregister (port); +} + +static int usbnum = 0; + +int +grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno, + struct grub_serial_driver *driver) +{ + struct grub_serial_port *port; + int j; + struct grub_usb_desc_if *interf; + + interf = usbdev->config[configno].interf[interfno].descif; + + port = grub_malloc (sizeof (*port)); + if (!port) + { + grub_print_error (); + return 0; + } + + port->name = grub_xasprintf ("usb%d", usbnum++); + if (!port->name) + { + grub_free (port); + grub_print_error (); + return 0; + } + + port->usbdev = usbdev; + port->driver = driver; + for (j = 0; j < interf->endpointcnt; j++) + { + struct grub_usb_desc_endp *endp; + endp = &usbdev->config[0].interf[interfno].descendp[j]; + + if ((endp->endp_addr & 128) && (endp->attrib & 3) == 2) + { + /* Bulk IN endpoint. */ + port->in_endp = endp; + } + else if (!(endp->endp_addr & 128) && (endp->attrib & 3) == 2) + { + /* Bulk OUT endpoint. */ + port->out_endp = endp; + } + } + if (!port->out_endp || !port->in_endp) + { + grub_free (port->name); + grub_free (port); + return 0; + } + + port->configno = configno; + port->interfno = interfno; + + grub_serial_config_defaults (port); + grub_serial_register (port); + + port->usbdev->config[port->configno].interf[port->interfno].detach_hook + = grub_usbserial_detach; + port->usbdev->config[port->configno].interf[port->interfno].detach_data + = port; + + return 1; +} diff --git a/bus/usb/serial/ftdi.c b/bus/usb/serial/ftdi.c index 4495b055c..a4d88dbae 100644 --- a/bus/usb/serial/ftdi.c +++ b/bus/usb/serial/ftdi.c @@ -22,6 +22,7 @@ #include #include #include +#include enum { @@ -161,19 +162,12 @@ ftdi_hw_configure (struct grub_serial_port *port, return GRUB_ERR_NONE; } -static void -ftdi_fini (struct grub_serial_port *port) -{ - port->usbdev->config[port->configno].interf[port->interfno].detach_hook = 0; - port->usbdev->config[port->configno].interf[port->interfno].attached = 0; -} - static struct grub_serial_driver grub_ftdi_driver = { .configure = ftdi_hw_configure, .fetch = ftdi_hw_fetch, .put = ftdi_hw_put, - .fini = ftdi_fini + .fini = grub_usbserial_fini }; static const struct @@ -184,80 +178,6 @@ static const struct {0x0403, 0x6001} /* QEMU virtual USBserial. */ }; -static int ftdinum = 0; - -static void -ftdi_detach (grub_usb_device_t usbdev, int configno, int interfno) -{ - static struct grub_serial_port *port; - port = usbdev->config[configno].interf[interfno].detach_data; - - grub_serial_unregister (port); -} - -static int -grub_ftdi_attach_real (grub_usb_device_t usbdev, int configno, int interfno) -{ - static struct grub_serial_port *port; - int j; - struct grub_usb_desc_if *interf; - - interf = usbdev->config[configno].interf[interfno].descif; - - port = grub_malloc (sizeof (*port)); - if (!port) - { - grub_print_error (); - return 0; - } - - port->name = grub_xasprintf ("ftdi%d", ftdinum++); - if (!port->name) - { - grub_free (port); - grub_print_error (); - return 0; - } - - port->usbdev = usbdev; - port->driver = &grub_ftdi_driver; - for (j = 0; j < interf->endpointcnt; j++) - { - struct grub_usb_desc_endp *endp; - endp = &usbdev->config[0].interf[interfno].descendp[j]; - - if ((endp->endp_addr & 128) && (endp->attrib & 3) == 2) - { - /* Bulk IN endpoint. */ - port->in_endp = endp; - } - else if (!(endp->endp_addr & 128) && (endp->attrib & 3) == 2) - { - /* Bulk OUT endpoint. */ - port->out_endp = endp; - } - } - if (!port->out_endp || !port->in_endp) - { - grub_free (port->name); - grub_free (port); - return 0; - } - - port->configno = configno; - port->interfno = interfno; - - grub_serial_config_defaults (port); - grub_serial_register (port); - - port->usbdev->config[port->configno].interf[port->interfno].detach_hook - = ftdi_detach; - port->usbdev->config[port->configno].interf[port->interfno].detach_data - = port; - - return 1; -} - static int grub_ftdi_attach (grub_usb_device_t usbdev, int configno, int interfno) { @@ -270,10 +190,11 @@ grub_ftdi_attach (grub_usb_device_t usbdev, int configno, int interfno) if (j == ARRAY_SIZE (products)) return 0; - return grub_ftdi_attach_real (usbdev, configno, interfno); + return grub_usbserial_attach (usbdev, configno, interfno, + &grub_ftdi_driver); } -struct grub_usb_attach_desc attach_hook = +static struct grub_usb_attach_desc attach_hook = { .class = 0xff, .hook = grub_ftdi_attach diff --git a/bus/usb/serial/pl2303.c b/bus/usb/serial/pl2303.c new file mode 100644 index 000000000..eeb53402e --- /dev/null +++ b/bus/usb/serial/pl2303.c @@ -0,0 +1,212 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,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 . + */ + +#include +#include +#include +#include +#include +#include +#include + +enum + { + GRUB_FTDI_MODEM_CTRL = 0x01, + GRUB_FTDI_FLOW_CTRL = 0x02, + GRUB_FTDI_SPEED_CTRL = 0x03, + GRUB_FTDI_DATA_CTRL = 0x04 + }; + +#define GRUB_FTDI_MODEM_CTRL_DTRRTS 3 +#define GRUB_FTDI_FLOW_CTRL_DTRRTS 3 + +/* Convert speed to divisor. */ +static grub_uint32_t +get_divisor (unsigned int speed) +{ + unsigned int i; + + /* The structure for speed vs. divisor. */ + struct divisor + { + unsigned int speed; + grub_uint32_t div; + }; + + /* The table which lists common configurations. */ + /* Computed with a division formula with 3MHz as base frequency. */ + static struct divisor divisor_tab[] = + { + { 2400, 0x04e2 }, + { 4800, 0x0271 }, + { 9600, 0x4138 }, + { 19200, 0x809c }, + { 38400, 0xc04e }, + { 57600, 0xc034 }, + { 115200, 0x001a } + }; + + /* Set the baud rate. */ + for (i = 0; i < ARRAY_SIZE (divisor_tab); i++) + if (divisor_tab[i].speed == speed) + return divisor_tab[i].div; + return 0; +} + +static void +real_config (struct grub_serial_port *port) +{ + grub_uint32_t divisor; + const grub_uint16_t parities[] = { + [GRUB_SERIAL_PARITY_NONE] = 0x0000, + [GRUB_SERIAL_PARITY_ODD] = 0x0100, + [GRUB_SERIAL_PARITY_EVEN] = 0x0200 + }; + const grub_uint16_t stop_bits[] = { + [GRUB_SERIAL_STOP_BITS_1] = 0x0000, + [GRUB_SERIAL_STOP_BITS_2] = 0x1000, + }; + + // if (port->configured) + return; + + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + GRUB_FTDI_MODEM_CTRL, + GRUB_FTDI_MODEM_CTRL_DTRRTS, 0, 0, 0); + + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + GRUB_FTDI_FLOW_CTRL, + GRUB_FTDI_FLOW_CTRL_DTRRTS, 0, 0, 0); + + divisor = get_divisor (port->config.speed); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + GRUB_FTDI_SPEED_CTRL, + divisor & 0xffff, divisor >> 16, 0, 0); + + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + GRUB_FTDI_DATA_CTRL, + parities[port->config.parity] + | stop_bits[port->config.stop_bits] + | port->config.word_len, 0, 0, 0); + + port->configured = 1; +} + +/* Fetch a key. */ +static int +pl2303_hw_fetch (struct grub_serial_port *port) +{ + char cc; + grub_usb_err_t err; + + real_config (port); + + err = grub_usb_bulk_read (port->usbdev, port->in_endp->endp_addr, 1, &cc); + if (err != GRUB_USB_ERR_NONE) + return -1; + + return cc; +} + +/* Put a character. */ +static void +pl2303_hw_put (struct grub_serial_port *port, const int c) +{ + char cc = c; + + real_config (port); + + grub_usb_bulk_write (port->usbdev, port->out_endp->endp_addr, 1, &cc); +} + +static grub_err_t +pl2303_hw_configure (struct grub_serial_port *port, + struct grub_serial_config *config) +{ + grub_uint16_t divisor; + + divisor = get_divisor (config->speed); + if (divisor == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed"); + + if (config->parity != GRUB_SERIAL_PARITY_NONE + && config->parity != GRUB_SERIAL_PARITY_ODD + && config->parity != GRUB_SERIAL_PARITY_EVEN) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported parity"); + + if (config->stop_bits != GRUB_SERIAL_STOP_BITS_1 + && config->stop_bits != GRUB_SERIAL_STOP_BITS_2) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported stop bits"); + + if (config->word_len < 5 || config->word_len > 8) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported word length"); + + port->config = *config; + port->configured = 0; + + return GRUB_ERR_NONE; +} + +static struct grub_serial_driver grub_pl2303_driver = + { + .configure = pl2303_hw_configure, + .fetch = pl2303_hw_fetch, + .put = pl2303_hw_put, + .fini = grub_usbserial_fini + }; + +static const struct +{ + grub_uint16_t vendor, product; +} products[] = + { + {0x067b, 0x2303} + }; + +static int +grub_pl2303_attach (grub_usb_device_t usbdev, int configno, int interfno) +{ + unsigned j; + + for (j = 0; j < ARRAY_SIZE (products); j++) + if (usbdev->descdev.vendorid == products[j].vendor + && usbdev->descdev.prodid == products[j].product) + break; + if (j == ARRAY_SIZE (products)) + return 0; + + return grub_usbserial_attach (usbdev, configno, interfno, + &grub_pl2303_driver); +} + +static struct grub_usb_attach_desc attach_hook = +{ + .class = 0xff, + .hook = grub_pl2303_attach +}; + +GRUB_MOD_INIT(usbserial_pl2303) +{ + grub_usb_register_attach_hook_class (&attach_hook); +} + +GRUB_MOD_FINI(usbserial_pl2303) +{ + grub_serial_unregister_driver (&grub_pl2303_driver); + grub_usb_unregister_attach_hook_class (&attach_hook); +} diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index 2e95133f3..9c77a9d1d 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -195,6 +195,18 @@ usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c usb_mod_CFLAGS = $(COMMON_CFLAGS) usb_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For serial.mod. +pkglib_MODULES += usbserial_common.mod +usbserial_common_mod_SOURCES = bus/usb/serial/common.c +usbserial_common_mod_CFLAGS = $(COMMON_CFLAGS) +usbserial_common_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For serial.mod. +pkglib_MODULES += usbserial_pl2303.mod +usbserial_pl2303_mod_SOURCES = bus/usb/serial/pl2303.c +usbserial_pl2303_mod_CFLAGS = $(COMMON_CFLAGS) +usbserial_pl2303_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For serial.mod. pkglib_MODULES += usbserial_ftdi.mod usbserial_ftdi_mod_SOURCES = bus/usb/serial/ftdi.c diff --git a/include/grub/usbserial.h b/include/grub/usbserial.h new file mode 100644 index 000000000..786eff7fe --- /dev/null +++ b/include/grub/usbserial.h @@ -0,0 +1,31 @@ +/* serial.h - serial device interface */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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 . + */ + +#ifndef GRUB_USBSERIAL_HEADER +#define GRUB_USBSERIAL_HEADER 1 + +void grub_usbserial_fini (struct grub_serial_port *port); + +void grub_usbserial_detach (grub_usb_device_t usbdev, int configno, + int interfno); + +int +grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno, + struct grub_serial_driver *driver); +#endif From aa86530e3897931e90011e1d4bf388155d701361 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 19:11:09 +0200 Subject: [PATCH 054/174] enable usbserial on grub-emu --- conf/any-emu.rmk | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk index 958da2bee..8272bf25e 100644 --- a/conf/any-emu.rmk +++ b/conf/any-emu.rmk @@ -70,6 +70,30 @@ usbms_mod_SOURCES = disk/usbms.c usbms_mod_CFLAGS = $(COMMON_CFLAGS) usbms_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For serial.mod. +pkglib_MODULES += usbserial_common.mod +usbserial_common_mod_SOURCES = bus/usb/serial/common.c +usbserial_common_mod_CFLAGS = $(COMMON_CFLAGS) +usbserial_common_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For serial.mod. +pkglib_MODULES += usbserial_pl2303.mod +usbserial_pl2303_mod_SOURCES = bus/usb/serial/pl2303.c +usbserial_pl2303_mod_CFLAGS = $(COMMON_CFLAGS) +usbserial_pl2303_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For serial.mod. +pkglib_MODULES += usbserial_ftdi.mod +usbserial_ftdi_mod_SOURCES = bus/usb/serial/ftdi.c +usbserial_ftdi_mod_CFLAGS = $(COMMON_CFLAGS) +usbserial_ftdi_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For serial.mod. +pkglib_MODULES += serial.mod +serial_mod_SOURCES = term/serial.c +serial_mod_CFLAGS = $(COMMON_CFLAGS) +serial_mod_LDFLAGS = $(COMMON_LDFLAGS) + grub_emu_LDFLAGS += $(LIBUSB) endif From d5562777511a3718d43a03eb86954d06acd012ce Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 21:35:22 +0200 Subject: [PATCH 055/174] Add possibility of bulk reading with short timeout --- bus/usb/ohci.c | 4 ++-- bus/usb/uhci.c | 5 +++-- bus/usb/usbtrans.c | 19 ++++++++++++++----- include/grub/usb.h | 8 +++++++- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/bus/usb/ohci.c b/bus/usb/ohci.c index 57ca24065..73e3e01e8 100644 --- a/bus/usb/ohci.c +++ b/bus/usb/ohci.c @@ -654,7 +654,7 @@ grub_ohci_transaction (grub_ohci_td_t td, static grub_usb_err_t grub_ohci_transfer (grub_usb_controller_t dev, - grub_usb_transfer_t transfer) + grub_usb_transfer_t transfer, int timeout) { struct grub_ohci *o = (struct grub_ohci *) dev->data; grub_ohci_ed_t ed_virt; @@ -832,7 +832,7 @@ grub_ohci_transfer (grub_usb_controller_t dev, } /* Safety measure to avoid a hang. */ - maxtime = grub_get_time_ms () + 1000; + maxtime = grub_get_time_ms () + timeout; /* Wait until the transfer is completed or STALLs. */ do diff --git a/bus/usb/uhci.c b/bus/usb/uhci.c index 5b4432018..d211de369 100644 --- a/bus/usb/uhci.c +++ b/bus/usb/uhci.c @@ -436,7 +436,8 @@ grub_uhci_transaction (struct grub_uhci *u, unsigned int endp, static grub_usb_err_t grub_uhci_transfer (grub_usb_controller_t dev, - grub_usb_transfer_t transfer) + grub_usb_transfer_t transfer, + int timeout) { struct grub_uhci *u = (struct grub_uhci *) dev->data; grub_uhci_qh_t qh; @@ -496,7 +497,7 @@ grub_uhci_transfer (grub_usb_controller_t dev, /* Wait until either the transaction completed or an error occurred. */ - endtime = grub_get_time_ms () + 1000; + endtime = grub_get_time_ms () + timeout; for (;;) { grub_uhci_td_t errtd; diff --git a/bus/usb/usbtrans.c b/bus/usb/usbtrans.c index 4a55cab11..9dfef509f 100644 --- a/bus/usb/usbtrans.c +++ b/bus/usb/usbtrans.c @@ -145,7 +145,7 @@ grub_usb_control_msg (grub_usb_device_t dev, transfer->transactions[datablocks + 1].toggle = 1; - err = dev->controller.dev->transfer (&dev->controller, transfer); + err = dev->controller.dev->transfer (&dev->controller, transfer, 1000); grub_dprintf ("usb", "control: err=%d\n", err); grub_free (transfer->transactions); @@ -162,7 +162,7 @@ grub_usb_control_msg (grub_usb_device_t dev, static grub_usb_err_t grub_usb_bulk_readwrite (grub_usb_device_t dev, int endpoint, grub_size_t size0, char *data_in, - grub_transfer_type_t type) + grub_transfer_type_t type, int timeout) { int i; grub_usb_transfer_t transfer; @@ -243,7 +243,7 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev, size -= tr->size; } - err = dev->controller.dev->transfer (&dev->controller, transfer); + err = dev->controller.dev->transfer (&dev->controller, transfer, timeout); /* We must remember proper toggle value even if some transactions * were not processed - correct value should be inversion of last * processed transaction (TD). */ @@ -269,7 +269,7 @@ grub_usb_bulk_write (grub_usb_device_t dev, int endpoint, grub_size_t size, char *data) { return grub_usb_bulk_readwrite (dev, endpoint, size, data, - GRUB_USB_TRANSFER_TYPE_OUT); + GRUB_USB_TRANSFER_TYPE_OUT, 1000); } grub_usb_err_t @@ -277,5 +277,14 @@ grub_usb_bulk_read (grub_usb_device_t dev, int endpoint, grub_size_t size, char *data) { return grub_usb_bulk_readwrite (dev, endpoint, size, data, - GRUB_USB_TRANSFER_TYPE_IN); + GRUB_USB_TRANSFER_TYPE_IN, 1000); +} + +grub_usb_err_t +grub_usb_bulk_read_timeout (grub_usb_device_t dev, + int endpoint, grub_size_t size, char *data, + int timeout) +{ + return grub_usb_bulk_readwrite (dev, endpoint, size, data, + GRUB_USB_TRANSFER_TYPE_IN, timeout); } diff --git a/include/grub/usb.h b/include/grub/usb.h index 595cbd6d3..aba2fccc7 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -50,6 +50,7 @@ typedef enum enum { + GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT = 0x21, GRUB_USB_REQTYPE_VENDOR_OUT = 0x40 }; @@ -103,7 +104,8 @@ struct grub_usb_controller_dev int (*iterate) (int (*hook) (grub_usb_controller_t dev)); grub_usb_err_t (*transfer) (grub_usb_controller_t dev, - grub_usb_transfer_t transfer); + grub_usb_transfer_t transfer, + int timeout); int (*hubports) (grub_usb_controller_t dev); @@ -235,5 +237,9 @@ void grub_usb_unregister_attach_hook_class (struct grub_usb_attach_desc *desc); void grub_usb_poll_devices (void); void grub_usb_device_attach (grub_usb_device_t dev); +grub_usb_err_t +grub_usb_bulk_read_timeout (grub_usb_device_t dev, + int endpoint, grub_size_t size, char *data, + int timeout); #endif /* GRUB_USB_H */ From 9edd681bbc114fbcf22e78de10092b650ead9653 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 21:36:00 +0200 Subject: [PATCH 056/174] Somewhat working although a lot of hardcoding pl2303 --- bus/usb/serial/pl2303.c | 59 +++++++++++++++-------------------------- bus/usb/usb.c | 1 + 2 files changed, 23 insertions(+), 37 deletions(-) diff --git a/bus/usb/serial/pl2303.c b/bus/usb/serial/pl2303.c index eeb53402e..b7b25daf3 100644 --- a/bus/usb/serial/pl2303.c +++ b/bus/usb/serial/pl2303.c @@ -24,17 +24,6 @@ #include #include -enum - { - GRUB_FTDI_MODEM_CTRL = 0x01, - GRUB_FTDI_FLOW_CTRL = 0x02, - GRUB_FTDI_SPEED_CTRL = 0x03, - GRUB_FTDI_DATA_CTRL = 0x04 - }; - -#define GRUB_FTDI_MODEM_CTRL_DTRRTS 3 -#define GRUB_FTDI_FLOW_CTRL_DTRRTS 3 - /* Convert speed to divisor. */ static grub_uint32_t get_divisor (unsigned int speed) @@ -68,41 +57,36 @@ get_divisor (unsigned int speed) return 0; } +#define GRUB_PL2303_REQUEST_CONFIG 1 + static void real_config (struct grub_serial_port *port) { - grub_uint32_t divisor; - const grub_uint16_t parities[] = { - [GRUB_SERIAL_PARITY_NONE] = 0x0000, - [GRUB_SERIAL_PARITY_ODD] = 0x0100, - [GRUB_SERIAL_PARITY_EVEN] = 0x0200 - }; - const grub_uint16_t stop_bits[] = { - [GRUB_SERIAL_STOP_BITS_1] = 0x0000, - [GRUB_SERIAL_STOP_BITS_2] = 0x1000, - }; + struct req20 + { + char data[7]; + } req20; - // if (port->configured) + if (port->configured) return; grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_FTDI_MODEM_CTRL, - GRUB_FTDI_MODEM_CTRL_DTRRTS, 0, 0, 0); - + GRUB_PL2303_REQUEST_CONFIG, 0, 0x61, 0, 0); grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_FTDI_FLOW_CTRL, - GRUB_FTDI_FLOW_CTRL_DTRRTS, 0, 0, 0); - - divisor = get_divisor (port->config.speed); + GRUB_PL2303_REQUEST_CONFIG, 1, 0, 0, 0); grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_FTDI_SPEED_CTRL, - divisor & 0xffff, divisor >> 16, 0, 0); - + GRUB_PL2303_REQUEST_CONFIG, 2, 0x44, 0, 0); grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_FTDI_DATA_CTRL, - parities[port->config.parity] - | stop_bits[port->config.stop_bits] - | port->config.word_len, 0, 0, 0); + GRUB_PL2303_REQUEST_CONFIG, 8, 0, 0, 0); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + GRUB_PL2303_REQUEST_CONFIG, 9, 0, 0, 0); + + grub_memset (&req20, 0, sizeof (req20)); + req20.data[6] = 8; + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, + 0x20, 0, 0, sizeof (req20), (char *) &req20); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, + 0x22, 3, 0, 0, 0); port->configured = 1; } @@ -116,7 +100,8 @@ pl2303_hw_fetch (struct grub_serial_port *port) real_config (port); - err = grub_usb_bulk_read (port->usbdev, port->in_endp->endp_addr, 1, &cc); + err = grub_usb_bulk_read_timeout (port->usbdev, port->in_endp->endp_addr, + 1, &cc, 10); if (err != GRUB_USB_ERR_NONE) return -1; diff --git a/bus/usb/usb.c b/bus/usb/usb.c index b49caacdb..a961e0b48 100644 --- a/bus/usb/usb.c +++ b/bus/usb/usb.c @@ -272,6 +272,7 @@ void grub_usb_device_attach (grub_usb_device_t dev) case 0xff: /* FIXME: don't load useless modules. */ grub_dl_load ("usbserial_ftdi"); + grub_dl_load ("usbserial_pl2303"); break; } } From 9685412782b19c0a771151d9057a302baa3a0c39 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 18 Jul 2010 23:12:08 +0200 Subject: [PATCH 057/174] PL2303 works and is configurable. But sometime input is lost --- bus/usb/serial/pl2303.c | 121 +++++++++++++++++++++++++--------------- include/grub/usb.h | 3 +- 2 files changed, 77 insertions(+), 47 deletions(-) diff --git a/bus/usb/serial/pl2303.c b/bus/usb/serial/pl2303.c index b7b25daf3..ae1a4c1b3 100644 --- a/bus/usb/serial/pl2303.c +++ b/bus/usb/serial/pl2303.c @@ -26,68 +26,100 @@ /* Convert speed to divisor. */ static grub_uint32_t -get_divisor (unsigned int speed) +is_speed_supported (unsigned int speed) { unsigned int i; + unsigned int supported[] = { 2400, 4800, 9600, 19200, 38400, 57600, 115200}; - /* The structure for speed vs. divisor. */ - struct divisor - { - unsigned int speed; - grub_uint32_t div; - }; - - /* The table which lists common configurations. */ - /* Computed with a division formula with 3MHz as base frequency. */ - static struct divisor divisor_tab[] = - { - { 2400, 0x04e2 }, - { 4800, 0x0271 }, - { 9600, 0x4138 }, - { 19200, 0x809c }, - { 38400, 0xc04e }, - { 57600, 0xc034 }, - { 115200, 0x001a } - }; - - /* Set the baud rate. */ - for (i = 0; i < ARRAY_SIZE (divisor_tab); i++) - if (divisor_tab[i].speed == speed) - return divisor_tab[i].div; + for (i = 0; i < ARRAY_SIZE (supported); i++) + if (supported[i] == speed) + return 1; return 0; } -#define GRUB_PL2303_REQUEST_CONFIG 1 +#define GRUB_PL2303_REQUEST_SET_CONFIG 0x20 +#define GRUB_PL2303_STOP_BITS_1 0x0 +#define GRUB_PL2303_STOP_BITS_2 0x2 + +#define GRUB_PL2303_PARITY_NONE 0 +#define GRUB_PL2303_PARITY_ODD 1 +#define GRUB_PL2303_PARITY_EVEN 2 + +struct grub_pl2303_config +{ + grub_uint32_t speed; + grub_uint8_t stop_bits; + grub_uint8_t parity; + grub_uint8_t word_len; +} __attribute__ ((packed)); static void real_config (struct grub_serial_port *port) { - struct req20 - { - char data[7]; - } req20; + struct grub_pl2303_config config_pl2303; + char xx; if (port->configured) return; + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, + 1, 0x8484, 0, 1, &xx); grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_PL2303_REQUEST_CONFIG, 0, 0x61, 0, 0); - grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_PL2303_REQUEST_CONFIG, 1, 0, 0, 0); - grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_PL2303_REQUEST_CONFIG, 2, 0x44, 0, 0); - grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_PL2303_REQUEST_CONFIG, 8, 0, 0, 0); - grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, - GRUB_PL2303_REQUEST_CONFIG, 9, 0, 0, 0); + 1, 0x0404, 0, 0, 0); - grub_memset (&req20, 0, sizeof (req20)); - req20.data[6] = 8; + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, + 1, 0x8484, 0, 1, &xx); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, + 1, 0x8383, 0, 1, &xx); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, + 1, 0x8484, 0, 1, &xx); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + 1, 0x0404, 1, 0, 0); + + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, + 1, 0x8484, 0, 1, &xx); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, + 1, 0x8383, 0, 1, &xx); + + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + 1, 0, 1, 0, 0); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + 1, 1, 0, 0, 0); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + 1, 2, 0x44, 0, 0); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + 1, 8, 0, 0, 0); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + 1, 9, 0, 0, 0); + + if (port->config.stop_bits == GRUB_SERIAL_STOP_BITS_2) + config_pl2303.stop_bits = GRUB_PL2303_STOP_BITS_2; + else + config_pl2303.stop_bits = GRUB_PL2303_STOP_BITS_1; + + switch (port->config.parity) + { + case GRUB_SERIAL_PARITY_NONE: + config_pl2303.parity = GRUB_PL2303_PARITY_NONE; + break; + case GRUB_SERIAL_PARITY_ODD: + config_pl2303.parity = GRUB_PL2303_PARITY_ODD; + break; + case GRUB_SERIAL_PARITY_EVEN: + config_pl2303.parity = GRUB_PL2303_PARITY_EVEN; + break; + } + + config_pl2303.word_len = port->config.word_len; + config_pl2303.speed = port->config.speed; grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, - 0x20, 0, 0, sizeof (req20), (char *) &req20); + GRUB_PL2303_REQUEST_SET_CONFIG, 0, 0, + sizeof (config_pl2303), (char *) &config_pl2303); grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, 0x22, 3, 0, 0, 0); + grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, + 1, 0, 0x61, 0, 0); port->configured = 1; } @@ -123,10 +155,7 @@ static grub_err_t pl2303_hw_configure (struct grub_serial_port *port, struct grub_serial_config *config) { - grub_uint16_t divisor; - - divisor = get_divisor (config->speed); - if (divisor == 0) + if (!is_speed_supported (config->speed)) return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed"); if (config->parity != GRUB_SERIAL_PARITY_NONE diff --git a/include/grub/usb.h b/include/grub/usb.h index aba2fccc7..8b54e869f 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -51,7 +51,8 @@ typedef enum enum { GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT = 0x21, - GRUB_USB_REQTYPE_VENDOR_OUT = 0x40 + GRUB_USB_REQTYPE_VENDOR_OUT = 0x40, + GRUB_USB_REQTYPE_VENDOR_IN = 0xc0 }; /* Call HOOK with each device, until HOOK returns non-zero. */ From ac2534273bd10fde16fcd367a65e9fe575e20872 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 19 Jul 2010 00:12:59 +0200 Subject: [PATCH 058/174] fix losing pl2303 input at the price of losing some input bytes sometimes. --- bus/usb/serial/pl2303.c | 15 ++++++++++++--- include/grub/serial.h | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bus/usb/serial/pl2303.c b/bus/usb/serial/pl2303.c index ae1a4c1b3..e2dcd606e 100644 --- a/bus/usb/serial/pl2303.c +++ b/bus/usb/serial/pl2303.c @@ -127,17 +127,26 @@ real_config (struct grub_serial_port *port) static int pl2303_hw_fetch (struct grub_serial_port *port) { - char cc; grub_usb_err_t err; real_config (port); + if (port->bufstart < port->bufend) + return port->buf[port->bufstart++]; + err = grub_usb_bulk_read_timeout (port->usbdev, port->in_endp->endp_addr, - 1, &cc, 10); + sizeof (port->buf), port->buf, 10); if (err != GRUB_USB_ERR_NONE) return -1; - return cc; + port->bufstart = 0; + /* FIXME: nearly always only one byte is transfered. + It happens however that more are transfered. + Setting sizeof (port->buf) to 1 leads code to stop reading after + such transfer. */ + port->bufend = 1; + + return port->buf[port->bufstart++]; } /* Put a character. */ diff --git a/include/grub/serial.h b/include/grub/serial.h index fd601a6d9..a7d37c7de 100644 --- a/include/grub/serial.h +++ b/include/grub/serial.h @@ -67,6 +67,8 @@ struct grub_serial_port struct grub_serial_driver *driver; struct grub_serial_config config; int configured; + char buf[64]; + int bufstart, bufend; /* This should be void *data but since serial is useful as an early console when malloc isn't available it's a union. */ From 824e1447accec3af43d6b0f31adab4a99523b8cb Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 19 Jul 2010 00:13:06 +0200 Subject: [PATCH 059/174] Use generic description of HID endpoints --- include/grub/usb.h | 1 + term/usb_keyboard.c | 27 +++++++++++---------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/include/grub/usb.h b/include/grub/usb.h index 8b54e869f..0ebb39478 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -52,6 +52,7 @@ enum { GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT = 0x21, GRUB_USB_REQTYPE_VENDOR_OUT = 0x40, + GRUB_USB_REQTYPE_CLASS_INTERFACE_IN = 0xa1, GRUB_USB_REQTYPE_VENDOR_IN = 0xc0 }; diff --git a/term/usb_keyboard.c b/term/usb_keyboard.c index f010aa9e4..1c0ce228f 100644 --- a/term/usb_keyboard.c +++ b/term/usb_keyboard.c @@ -55,11 +55,6 @@ static char keyboard_map_shift[128] = }; -/* Valid values for bmRequestType. See HID definition version 1.11 section - 7.2. */ -#define USB_HID_HOST_TO_DEVICE 0x21 -#define USB_HID_DEVICE_TO_HOST 0xA1 - /* Valid values for bRequest. See HID definition version 1.11 section 7.2. */ #define USB_HID_GET_REPORT 0x01 #define USB_HID_GET_IDLE 0x02 @@ -128,12 +123,12 @@ grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) grub_printf ("HID found!\n"); /* Place the device in boot mode. */ - grub_usb_control_msg (usbdev, USB_HID_HOST_TO_DEVICE, USB_HID_SET_PROTOCOL, - 0, 0, 0, 0); + grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, + USB_HID_SET_PROTOCOL, 0, 0, 0, 0); /* Reports every time an event occurs and not more often than that. */ - grub_usb_control_msg (usbdev, USB_HID_HOST_TO_DEVICE, USB_HID_SET_IDLE, - 0<<8, 0, 0, 0); + grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, + USB_HID_SET_IDLE, 0<<8, 0, 0, 0); grub_memcpy (&grub_usb_keyboards[curnum], &grub_usb_keyboard_term, sizeof (grub_usb_keyboards[curnum])); @@ -152,8 +147,8 @@ grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) static grub_err_t grub_usb_keyboard_getreport (grub_usb_device_t dev, grub_uint8_t *report) { - return grub_usb_control_msg (dev, USB_HID_DEVICE_TO_HOST, USB_HID_GET_REPORT, - 0, 0, 8, (char *) report); + return grub_usb_control_msg (dev, GRUB_USB_REQTYPE_CLASS_INTERFACE_IN, + USB_HID_GET_REPORT, 0, 0, 8, (char *) report); } @@ -205,7 +200,7 @@ grub_usb_keyboard_checkkey (struct grub_term_input *term) /* Wait until the key is released. */ while (!err && data[2]) { - err = grub_usb_control_msg (usbdev, USB_HID_DEVICE_TO_HOST, + err = grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_IN, USB_HID_GET_REPORT, 0, 0, sizeof (data), (char *) data); grub_dprintf ("usb_keyboard", @@ -306,8 +301,8 @@ grub_usb_keyboard_getkeystatus (struct grub_term_input *term) /* Set idle time to the minimum offered by the spec (4 milliseconds) so that we can find out the current state. */ - grub_usb_control_msg (usbdev, USB_HID_HOST_TO_DEVICE, USB_HID_SET_IDLE, - 0<<8, 0, 0, 0); + grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, + USB_HID_SET_IDLE, 0<<8, 0, 0, 0); currtime = grub_get_time_ms (); do @@ -323,8 +318,8 @@ grub_usb_keyboard_getkeystatus (struct grub_term_input *term) /* Go back to reporting every time an event occurs and not more often than that. */ - grub_usb_control_msg (usbdev, USB_HID_HOST_TO_DEVICE, USB_HID_SET_IDLE, - 0<<8, 0, 0, 0); + grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, + USB_HID_SET_IDLE, 0<<8, 0, 0, 0); /* We allowed a while for modifiers to show up in the report, but it is not an error if they never did. */ From 34787305df83999507efdab0cc9279de8f243f47 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 19 Jul 2010 08:43:01 +0200 Subject: [PATCH 060/174] Allow psartial transfers and use them for usbserial --- bus/usb/ohci.c | 23 ++++++++++++++--------- bus/usb/serial/common.c | 23 +++++++++++++++++++++++ bus/usb/serial/ftdi.c | 9 +-------- bus/usb/serial/pl2303.c | 19 +------------------ bus/usb/uhci.c | 23 ++++++++++++++++------- bus/usb/usbtrans.c | 39 ++++++++++++++++++++++++++++----------- include/grub/serial.h | 4 ++-- include/grub/usb.h | 8 ++++---- include/grub/usbserial.h | 3 +++ include/grub/usbtrans.h | 1 + 10 files changed, 93 insertions(+), 59 deletions(-) diff --git a/bus/usb/ohci.c b/bus/usb/ohci.c index 73e3e01e8..d8abb343a 100644 --- a/bus/usb/ohci.c +++ b/bus/usb/ohci.c @@ -654,7 +654,8 @@ grub_ohci_transaction (grub_ohci_td_t td, static grub_usb_err_t grub_ohci_transfer (grub_usb_controller_t dev, - grub_usb_transfer_t transfer, int timeout) + grub_usb_transfer_t transfer, int timeout, + grub_size_t *actual) { struct grub_ohci *o = (struct grub_ohci *) dev->data; grub_ohci_ed_t ed_virt; @@ -680,6 +681,8 @@ grub_ohci_transfer (grub_usb_controller_t dev, int err_unrec = 0; grub_uint32_t intstatus; + *actual = 0; + /* Pre-set target for ED - we need it to find proper ED */ /* Set the device address. */ target = transfer->devaddr; @@ -1078,12 +1081,14 @@ grub_ohci_transfer (grub_usb_controller_t dev, case 9: /* XXX: Data underrun error. */ - err = GRUB_USB_ERR_DATA; grub_dprintf ("ohci", "Underrun, failed TD address: %p, index: %d\n", tderr_virt, tderr_virt->tr_index); - grub_dprintf ("ohci", "Underrun, number of not transferred bytes: %d\n", - 1 + grub_le_to_cpu32 (tderr_virt->buffer_end) - - grub_le_to_cpu32 (tderr_virt->buffer)); + if (transfer->last_trans == -1) + break; + *actual = transfer->transactions[transfer->last_trans].size + - (grub_le_to_cpu32 (tderr_virt->buffer_end) + - grub_le_to_cpu32 (tderr_virt->buffer)) + + transfer->transactions[transfer->last_trans].preceding; break; case 10: @@ -1172,12 +1177,12 @@ grub_ohci_transfer (grub_usb_controller_t dev, transfer->last_trans = tderr_virt->tr_index; else transfer->last_trans = -1; - } + else + *actual = transfer->size; - /* Set empty ED - set HEAD = TAIL = last (not processed) TD */ - ed_virt->td_head = grub_cpu_to_le32 ( grub_le_to_cpu32 ( - ed_virt->td_tail) & ~0xf); + /* Set empty ED - set HEAD = TAIL = last (not processed) TD */ + ed_virt->td_head = grub_cpu_to_le32 (grub_le_to_cpu32 (ed_virt->td_tail) & ~0xf); /* At this point always should be: * ED has skip bit set and halted or empty or after next SOF, diff --git a/bus/usb/serial/common.c b/bus/usb/serial/common.c index 1da1c5bcf..6b5b90059 100644 --- a/bus/usb/serial/common.c +++ b/bus/usb/serial/common.c @@ -100,3 +100,26 @@ grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno, return 1; } + +int +grub_usbserial_fetch (struct grub_serial_port *port, grub_size_t header_size) +{ + grub_usb_err_t err; + grub_size_t actual; + + if (port->bufstart < port->bufend) + return port->buf[port->bufstart++]; + + err = grub_usb_bulk_read_extended (port->usbdev, port->in_endp->endp_addr, + sizeof (port->buf), port->buf, 10, + &actual); + if (err != GRUB_USB_ERR_NONE) + return -1; + + port->bufstart = header_size; + port->bufend = actual; + if (port->bufstart >= port->bufend) + return -1; + + return port->buf[port->bufstart++]; +} diff --git a/bus/usb/serial/ftdi.c b/bus/usb/serial/ftdi.c index a4d88dbae..bd1713b27 100644 --- a/bus/usb/serial/ftdi.c +++ b/bus/usb/serial/ftdi.c @@ -111,16 +111,9 @@ real_config (struct grub_serial_port *port) static int ftdi_hw_fetch (struct grub_serial_port *port) { - char cc[3]; - grub_usb_err_t err; - real_config (port); - err = grub_usb_bulk_read (port->usbdev, port->in_endp->endp_addr, 3, cc); - if (err != GRUB_USB_ERR_NONE) - return -1; - - return cc[2]; + return grub_usbserial_fetch (port, 2); } /* Put a character. */ diff --git a/bus/usb/serial/pl2303.c b/bus/usb/serial/pl2303.c index e2dcd606e..9e3b9ae7e 100644 --- a/bus/usb/serial/pl2303.c +++ b/bus/usb/serial/pl2303.c @@ -127,26 +127,9 @@ real_config (struct grub_serial_port *port) static int pl2303_hw_fetch (struct grub_serial_port *port) { - grub_usb_err_t err; - real_config (port); - if (port->bufstart < port->bufend) - return port->buf[port->bufstart++]; - - err = grub_usb_bulk_read_timeout (port->usbdev, port->in_endp->endp_addr, - sizeof (port->buf), port->buf, 10); - if (err != GRUB_USB_ERR_NONE) - return -1; - - port->bufstart = 0; - /* FIXME: nearly always only one byte is transfered. - It happens however that more are transfered. - Setting sizeof (port->buf) to 1 leads code to stop reading after - such transfer. */ - port->bufend = 1; - - return port->buf[port->bufstart++]; + return grub_usbserial_fetch (port, 0); } /* Put a character. */ diff --git a/bus/usb/uhci.c b/bus/usb/uhci.c index d211de369..69fae60fd 100644 --- a/bus/usb/uhci.c +++ b/bus/usb/uhci.c @@ -75,8 +75,10 @@ struct grub_uhci_td This is GRUB specific. */ grub_uint32_t linkptr2; - /* 3 additional 32 bits words reserved for the Host Controller Driver. */ - grub_uint32_t data[3]; + grub_uint32_t buffer0; + + /* 2 additional 32 bits words reserved for the Host Controller Driver. */ + grub_uint32_t data[2]; } __attribute__ ((packed)); typedef volatile struct grub_uhci_td *grub_uhci_td_t; @@ -333,9 +335,11 @@ grub_free_td (struct grub_uhci *u, grub_uhci_td_t td) static void grub_free_queue (struct grub_uhci *u, grub_uhci_td_t td, - grub_usb_transfer_t transfer) + grub_usb_transfer_t transfer, grub_size_t *actual) { int i; /* Index of TD in transfer */ + + *actual = 0; /* Free the TDs in this queue and set last_trans. */ for (i=0; td; i++) @@ -345,6 +349,8 @@ grub_free_queue (struct grub_uhci *u, grub_uhci_td_t td, /* Check state of TD and possibly set last_trans */ if (transfer && (td->linkptr & 1)) transfer->last_trans = i; + + *actual += (td->ctrl_status + 1) & 0x7ff; /* Unlink the queue. */ tdprev = td; @@ -430,6 +436,7 @@ grub_uhci_transaction (struct grub_uhci *u, unsigned int endp, | (addr << 8) | tf[type]); td->buffer = data; + td->buffer0 = data; return td; } @@ -437,7 +444,7 @@ grub_uhci_transaction (struct grub_uhci *u, unsigned int endp, static grub_usb_err_t grub_uhci_transfer (grub_usb_controller_t dev, grub_usb_transfer_t transfer, - int timeout) + int timeout, grub_size_t *actual) { struct grub_uhci *u = (struct grub_uhci *) dev->data; grub_uhci_qh_t qh; @@ -448,10 +455,12 @@ grub_uhci_transfer (grub_usb_controller_t dev, int i; grub_uint64_t endtime; + *actual = 0; + /* Allocate a queue head for the transfer queue. */ qh = grub_alloc_qh (u, GRUB_USB_TRANSACTION_TYPE_CONTROL); if (! qh) - return grub_errno; + return GRUB_USB_ERR_INTERNAL; grub_dprintf ("uhci", "transfer, iobase:%08x\n", u->iobase); @@ -469,7 +478,7 @@ grub_uhci_transfer (grub_usb_controller_t dev, td_prev->linkptr = 1; if (td_first) - grub_free_queue (u, td_first, NULL); + grub_free_queue (u, td_first, NULL, actual); return GRUB_USB_ERR_INTERNAL; } @@ -563,7 +572,7 @@ grub_uhci_transfer (grub_usb_controller_t dev, /* Place the QH back in the free list and deallocate the associated TDs. */ qh->elinkptr = 1; - grub_free_queue (u, td_first, transfer); + grub_free_queue (u, td_first, transfer, actual); return err; } diff --git a/bus/usb/usbtrans.c b/bus/usb/usbtrans.c index 9dfef509f..db2ec097a 100644 --- a/bus/usb/usbtrans.c +++ b/bus/usb/usbtrans.c @@ -43,6 +43,7 @@ grub_usb_control_msg (grub_usb_device_t dev, volatile char *data; grub_uint32_t data_addr; grub_size_t size = size0; + grub_size_t actual; /* FIXME: avoid allocation any kind of buffer in a first place. */ data_chunk = grub_memalign_dma32 (128, size ? : 16); @@ -132,6 +133,7 @@ grub_usb_control_msg (grub_usb_device_t dev, else tr->pid = GRUB_USB_TRANSFER_TYPE_OUT; tr->data = data_addr + i * max; + tr->preceding = i * max; size -= max; } @@ -145,7 +147,8 @@ grub_usb_control_msg (grub_usb_device_t dev, transfer->transactions[datablocks + 1].toggle = 1; - err = dev->controller.dev->transfer (&dev->controller, transfer, 1000); + err = dev->controller.dev->transfer (&dev->controller, transfer, + 1000, &actual); grub_dprintf ("usb", "control: err=%d\n", err); grub_free (transfer->transactions); @@ -162,7 +165,8 @@ grub_usb_control_msg (grub_usb_device_t dev, static grub_usb_err_t grub_usb_bulk_readwrite (grub_usb_device_t dev, int endpoint, grub_size_t size0, char *data_in, - grub_transfer_type_t type, int timeout) + grub_transfer_type_t type, int timeout, + grub_size_t *actual) { int i; grub_usb_transfer_t transfer; @@ -240,10 +244,12 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev, toggle = toggle ? 0 : 1; tr->pid = type; tr->data = data_addr + i * max; + tr->preceding = i * max; size -= tr->size; } - err = dev->controller.dev->transfer (&dev->controller, transfer, timeout); + err = dev->controller.dev->transfer (&dev->controller, transfer, timeout, + actual); /* We must remember proper toggle value even if some transactions * were not processed - correct value should be inversion of last * processed transaction (TD). */ @@ -268,23 +274,34 @@ grub_usb_err_t grub_usb_bulk_write (grub_usb_device_t dev, int endpoint, grub_size_t size, char *data) { - return grub_usb_bulk_readwrite (dev, endpoint, size, data, - GRUB_USB_TRANSFER_TYPE_OUT, 1000); + grub_size_t actual; + grub_usb_err_t err; + + err = grub_usb_bulk_readwrite (dev, endpoint, size, data, + GRUB_USB_TRANSFER_TYPE_OUT, 1000, &actual); + if (!err && actual != size) + err = GRUB_USB_ERR_DATA; + return err; } grub_usb_err_t grub_usb_bulk_read (grub_usb_device_t dev, int endpoint, grub_size_t size, char *data) { - return grub_usb_bulk_readwrite (dev, endpoint, size, data, - GRUB_USB_TRANSFER_TYPE_IN, 1000); + grub_size_t actual; + grub_usb_err_t err; + err = grub_usb_bulk_readwrite (dev, endpoint, size, data, + GRUB_USB_TRANSFER_TYPE_IN, 1000, &actual); + if (!err && actual != size) + err = GRUB_USB_ERR_DATA; + return err; } grub_usb_err_t -grub_usb_bulk_read_timeout (grub_usb_device_t dev, - int endpoint, grub_size_t size, char *data, - int timeout) +grub_usb_bulk_read_extended (grub_usb_device_t dev, + int endpoint, grub_size_t size, char *data, + int timeout, grub_size_t *actual) { return grub_usb_bulk_readwrite (dev, endpoint, size, data, - GRUB_USB_TRANSFER_TYPE_IN, timeout); + GRUB_USB_TRANSFER_TYPE_IN, timeout, actual); } diff --git a/include/grub/serial.h b/include/grub/serial.h index a7d37c7de..68cec6fdf 100644 --- a/include/grub/serial.h +++ b/include/grub/serial.h @@ -67,8 +67,6 @@ struct grub_serial_port struct grub_serial_driver *driver; struct grub_serial_config config; int configured; - char buf[64]; - int bufstart, bufend; /* This should be void *data but since serial is useful as an early console when malloc isn't available it's a union. */ @@ -80,6 +78,8 @@ struct grub_serial_port grub_usb_device_t usbdev; int configno; int interfno; + char buf[64]; + int bufstart, bufend; struct grub_usb_desc_endp *in_endp; struct grub_usb_desc_endp *out_endp; }; diff --git a/include/grub/usb.h b/include/grub/usb.h index 0ebb39478..b2dc77ce4 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -107,7 +107,7 @@ struct grub_usb_controller_dev grub_usb_err_t (*transfer) (grub_usb_controller_t dev, grub_usb_transfer_t transfer, - int timeout); + int timeout, grub_size_t *actual); int (*hubports) (grub_usb_controller_t dev); @@ -240,8 +240,8 @@ void grub_usb_poll_devices (void); void grub_usb_device_attach (grub_usb_device_t dev); grub_usb_err_t -grub_usb_bulk_read_timeout (grub_usb_device_t dev, - int endpoint, grub_size_t size, char *data, - int timeout); +grub_usb_bulk_read_extended (grub_usb_device_t dev, + int endpoint, grub_size_t size, char *data, + int timeout, grub_size_t *actual); #endif /* GRUB_USB_H */ diff --git a/include/grub/usbserial.h b/include/grub/usbserial.h index 786eff7fe..74201256e 100644 --- a/include/grub/usbserial.h +++ b/include/grub/usbserial.h @@ -28,4 +28,7 @@ void grub_usbserial_detach (grub_usb_device_t usbdev, int configno, int grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno, struct grub_serial_driver *driver); +int +grub_usbserial_fetch (struct grub_serial_port *port, grub_size_t header_size); + #endif diff --git a/include/grub/usbtrans.h b/include/grub/usbtrans.h index e68698c1d..a5bb2e8b2 100644 --- a/include/grub/usbtrans.h +++ b/include/grub/usbtrans.h @@ -38,6 +38,7 @@ struct grub_usb_transaction int toggle; grub_transfer_type_t pid; grub_uint32_t data; + grub_size_t preceding; }; typedef struct grub_usb_transaction *grub_usb_transaction_t; From a9600892c190269c25613fede79892a17f0490e0 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Thu, 22 Jul 2010 09:38:06 +0100 Subject: [PATCH 061/174] * disk/raid.c (insert_array): Don't count named arrays when looking for unused array numbers. Reported and tested by: maru. --- ChangeLog | 6 ++++++ disk/raid.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c05891b96..e3677b0e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-07-22 Colin Watson + + * disk/raid.c (insert_array): Don't count named arrays when looking + for unused array numbers. + Reported and tested by: maru. + 2010-07-20 Colin Watson * bus/usb/emu/usb.c (grub_usb_poll_devices): Add a dummy diff --git a/disk/raid.c b/disk/raid.c index 43d2a29ff..7dfd4bd81 100644 --- a/disk/raid.c +++ b/disk/raid.c @@ -533,7 +533,7 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array, /* Check whether we don't have multiple arrays with the same number. */ for (p = array_list; p != NULL; p = p->next) { - if (p->number == array->number) + if (! p->name && p->number == array->number) break; } @@ -546,7 +546,7 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array, { for (p = array_list; p != NULL; p = p->next) { - if (p->number == i) + if (! p->name && p->number == i) break; } From 697e053c44e75734ad4ae7520e63a80a83df4059 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Thu, 22 Jul 2010 09:44:19 +0100 Subject: [PATCH 062/174] real name for Michael Guntsche --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e3677b0e2..e0c2096bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ * disk/raid.c (insert_array): Don't count named arrays when looking for unused array numbers. - Reported and tested by: maru. + Reported and tested by: Michael Guntsche. 2010-07-20 Colin Watson From 0ac33bf5eb13bd185c903ac29a3ec36f0502c74f Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 21 Jul 2010 06:44:38 +0200 Subject: [PATCH 063/174] * util/grub.d/00_header.in: Remove compatibility with terminal.mod prior to terminal_input/terminal_output separation. It's been over 1.5 years and those versions weren't widely deployed. --- ChangeLog | 6 ++++++ util/grub.d/00_header.in | 12 ++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0c2096bb..de1edebb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,12 @@ (grub_efi_console_fini): New function. (grub_console_term_output): Register init and fini methods. +2010-07-20 Vladimir Serbinenko + + * util/grub.d/00_header.in: Remove compatibility with terminal.mod + prior to terminal_input/terminal_output separation. It's been over 1.5 + years and those versions weren't widely deployed. + 2010-07-20 Vladimir Serbinenko * tests/util/grub-shell-tester.in: Remove bashism and declare as diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in index 75c8b0fa2..2f39650e9 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -137,11 +137,7 @@ case x${GRUB_TERMINAL_INPUT} in ;; x*) cat << EOF -if terminal_input ${GRUB_TERMINAL_INPUT} ; then true ; else - # For backward compatibility with versions of terminal.mod that don't - # understand terminal_input - terminal ${GRUB_TERMINAL_INPUT} -fi +terminal_input ${GRUB_TERMINAL_INPUT} EOF ;; esac @@ -152,11 +148,7 @@ case x${GRUB_TERMINAL_OUTPUT} in ;; x*) cat << EOF -if terminal_output ${GRUB_TERMINAL_OUTPUT} ; then true ; else - # For backward compatibility with versions of terminal.mod that don't - # understand terminal_output - terminal ${GRUB_TERMINAL_OUTPUT} -fi +terminal_output ${GRUB_TERMINAL_OUTPUT} EOF ;; esac From f2bf127859506b888cd81ed52f684a5b9a69a78c Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 23 Jul 2010 04:05:15 +0530 Subject: [PATCH 064/174] add comment --- script/argv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/script/argv.c b/script/argv.c index 69322779d..b69ee39c5 100644 --- a/script/argv.c +++ b/script/argv.c @@ -20,6 +20,7 @@ #include #include +/* Return nearest power of two that is >= v. */ static unsigned round_up_exp (unsigned v) { From 463711215f2420d12fad9b45d9a02b8a01668651 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 28 Jul 2010 18:25:48 +0300 Subject: [PATCH 065/174] * util/ieee1275/grub-install.in: Don't use empty grub_device. Reported by: Lennart Sorensen. --- ChangeLog | 17 +++++++++++------ util/ieee1275/grub-install.in | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index de1edebb1..a2b6a2bc1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2010-07-28 Vladimir Serbinenko + + * util/ieee1275/grub-install.in: Don't use empty grub_device. + Reported by: Lennart Sorensen. + +2010-07-20 Vladimir Serbinenko + + * util/grub.d/00_header.in: Remove compatibility with terminal.mod + prior to terminal_input/terminal_output separation. It's been over 1.5 + years and those versions weren't widely deployed. + 2010-07-22 Colin Watson * disk/raid.c (insert_array): Don't count named arrays when looking @@ -29,12 +40,6 @@ (grub_efi_console_fini): New function. (grub_console_term_output): Register init and fini methods. -2010-07-20 Vladimir Serbinenko - - * util/grub.d/00_header.in: Remove compatibility with terminal.mod - prior to terminal_input/terminal_output separation. It's been over 1.5 - years and those versions weren't widely deployed. - 2010-07-20 Vladimir Serbinenko * tests/util/grub-shell-tester.in: Remove bashism and declare as diff --git a/util/ieee1275/grub-install.in b/util/ieee1275/grub-install.in index 98fd5d65a..98de5f348 100644 --- a/util/ieee1275/grub-install.in +++ b/util/ieee1275/grub-install.in @@ -212,7 +212,7 @@ fi # this command is allowed to fail (--target=fs already grants us that the # filesystem will be accessible). partmap_module= -for x in `$grub_probe --target=partmap --device ${grub_device} 2> /dev/null`; do +for x in `$grub_probe --target=partmap --device-map=${device_map} ${grubdir} 2> /dev/null`; do partmap_module="$partmap_module part_$x"; done From 9f841f5cbfcdf52cb7a5e0f51e5239466f6fd67f Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Thu, 29 Jul 2010 15:06:39 +0200 Subject: [PATCH 066/174] 2010-07-29 Robert Millan * configure.ac: Remove grub-mkisofs checks. --- ChangeLog | 4 ++++ configure.ac | 7 ------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2b6a2bc1..af48d4039 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-07-29 Robert Millan + + * configure.ac: Remove grub-mkisofs checks. + 2010-07-28 Vladimir Serbinenko * util/ieee1275/grub-install.in: Don't use empty grub_device. diff --git a/configure.ac b/configure.ac index 55c2625cb..aa7f3a151 100644 --- a/configure.ac +++ b/configure.ac @@ -249,13 +249,6 @@ fi # Check for functions. AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf) -# For grub-mkisofs -AC_HEADER_MAJOR -AC_HEADER_DIRENT -AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid) -AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h) -AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h limits.h) - # For opendisk() and getrawpartition() on NetBSD. # Used in util/deviceiter.c and in util/hostdisk.c. AC_CHECK_HEADER([util.h], [ From 0806b63c0964c456e667415a1d8d3fa8521ac14b Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Thu, 29 Jul 2010 18:46:42 +0200 Subject: [PATCH 067/174] 2010-07-29 Robert Millan * util/grub-probe.c (PRINT_FS_LABEL): New enum value. (probe): Handle `PRINT_FS_LABEL'. (main): Handle `-t fs_label'. --- ChangeLog | 6 ++++++ util/grub-probe.c | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index af48d4039..94b6741d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-07-29 Robert Millan + + * util/grub-probe.c (PRINT_FS_LABEL): New enum value. + (probe): Handle `PRINT_FS_LABEL'. + (main): Handle `-t fs_label'. + 2010-07-29 Robert Millan * configure.ac: Remove grub-mkisofs checks. diff --git a/util/grub-probe.c b/util/grub-probe.c index dff87907a..56cbc5592 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -50,6 +50,7 @@ enum { PRINT_FS, PRINT_FS_UUID, + PRINT_FS_LABEL, PRINT_DRIVE, PRINT_DEVICE, PRINT_PARTMAP, @@ -291,6 +292,16 @@ probe (const char *path, char *device_name) printf ("%s\n", uuid); } + else if (print == PRINT_FS_LABEL) + { + char *label; + if (! fs->label) + grub_util_error ("%s does not support labels", fs->name); + + fs->label (dev, &label); + + printf ("%s\n", label); + } end: if (dev) @@ -326,7 +337,7 @@ Probe device information for a given path (or device, if the -d option is given) \n\ -d, --device given argument is a system device, not a path\n\ -m, --device-map=FILE use FILE as the device map [default=%s]\n\ - -t, --target=(fs|fs_uuid|drive|device|partmap|abstraction)\n\ + -t, --target=(fs|fs_uuid|fs_label|drive|device|partmap|abstraction)\n\ print filesystem module, GRUB drive, system device, partition map module or abstraction module [default=fs]\n\ -h, --help display this message and exit\n\ -V, --version print version information and exit\n\ @@ -375,6 +386,8 @@ main (int argc, char *argv[]) print = PRINT_FS; else if (!strcmp (optarg, "fs_uuid")) print = PRINT_FS_UUID; + else if (!strcmp (optarg, "fs_label")) + print = PRINT_FS_LABEL; else if (!strcmp (optarg, "drive")) print = PRINT_DRIVE; else if (!strcmp (optarg, "device")) From f7790cdd5d0b97b2246478ec15efb25898fbb253 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Fri, 30 Jul 2010 11:27:02 +0200 Subject: [PATCH 068/174] 2010-07-30 Robert Millan * include/grub/emu/misc.h (grub_make_system_path_relative_to_its_root) (xmalloc, xrealloc, xstrdup, xasprintf): Add `warn_unused_result' attribute. * include/grub/misc.h (grub_strdup, grub_strndup, grub_strlen) (grub_xasprintf, grub_xvasprintf): Likewise. * include/grub/emu/misc.h (xasprintf): Remove duplicate prototype. --- ChangeLog | 9 +++++++++ include/grub/emu/misc.h | 11 +++++------ include/grub/misc.h | 10 +++++----- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 94b6741d3..4026428a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-07-30 Robert Millan + + * include/grub/emu/misc.h (grub_make_system_path_relative_to_its_root) + (xmalloc, xrealloc, xstrdup, xasprintf): Add + `warn_unused_result' attribute. + * include/grub/misc.h (grub_strdup, grub_strndup, grub_strlen) + (grub_xasprintf, grub_xvasprintf): Likewise. + * include/grub/emu/misc.h (xasprintf): Remove duplicate prototype. + 2010-07-29 Robert Millan * util/grub-probe.c (PRINT_FS_LABEL): New enum value. diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index f34cd4287..07257e511 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -26,12 +26,12 @@ extern const char *program_name; void grub_init_all (void); void grub_fini_all (void); -char *grub_make_system_path_relative_to_its_root (const char *path); +char *grub_make_system_path_relative_to_its_root (const char *path) __attribute__ ((warn_unused_result)); -void * EXPORT_FUNC(xmalloc) (grub_size_t size); -void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size); -char * EXPORT_FUNC(xstrdup) (const char *str); -char * EXPORT_FUNC(xasprintf) (const char *fmt, ...); +void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result)); +void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result)); +char * EXPORT_FUNC(xstrdup) (const char *str) __attribute__ ((warn_unused_result)); +char * EXPORT_FUNC(xasprintf) (const char *fmt, ...) __attribute__ ((warn_unused_result)); void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...); void EXPORT_FUNC(grub_util_info) (const char *fmt, ...); @@ -45,7 +45,6 @@ int EXPORT_FUNC(vasprintf) (char **buf, const char *fmt, va_list ap); int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...); #endif -char * EXPORT_FUNC(xasprintf) (const char *fmt, ...); extern char * canonicalize_file_name (const char *path); #ifdef HAVE_DEVICE_MAPPER diff --git a/include/grub/misc.h b/include/grub/misc.h index 9194ca8ad..eab01b0fb 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -231,10 +231,10 @@ grub_strtol (const char *str, char **end, int base) } } -char *EXPORT_FUNC(grub_strdup) (const char *s); -char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n); +char *EXPORT_FUNC(grub_strdup) (const char *s) __attribute__ ((warn_unused_result)); +char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n) __attribute__ ((warn_unused_result)); void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n); -grub_size_t EXPORT_FUNC(grub_strlen) (const char *s); +grub_size_t EXPORT_FUNC(grub_strlen) (const char *s) __attribute__ ((warn_unused_result)); int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); @@ -261,8 +261,8 @@ int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...) int EXPORT_FUNC(grub_vsnprintf) (char *str, grub_size_t n, const char *fmt, va_list args); char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...) - __attribute__ ((format (printf, 1, 2))); -char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args); + __attribute__ ((format (printf, 1, 2))) __attribute__ ((warn_unused_result)); +char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args) __attribute__ ((warn_unused_result)); void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn)); void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn)); grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n, From a184f9c80105bafacccbfaea596d406db3bce362 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Fri, 30 Jul 2010 21:43:12 +0200 Subject: [PATCH 069/174] 2010-07-30 Robert Millan Enable `grub-probe -t device' resolution on ZFS. * configure.ac: Check for getfsstat(), libzfs and libnvpair. * include/grub/util/libnvpair.h: New file. * include/grub/util/libzfs.h: New file. * kern/emu/getroot.c: Include `' and `'. [HAVE_LIBZFS && HAVE_LIBNVPAIR]: Include `' and `'. [HAVE_GETFSSTAT]: Include `'. (find_mount_point_from_dir): New static function. [HAVE_LIBZFS && HAVE_LIBNVPAIR] (find_root_device_from_libzfs): New function. [HAVE_LIBZFS && HAVE_LIBNVPAIR] (grub_guess_root_device): Use find_root_device_from_libzfs() before ressorting to find_root_device(). * include/grub/util/misc.h (grub_util_init_libzfs): New function prototype. * util/misc.c: Include `'. (grub_util_init_libzfs): New function. [HAVE_LIBZFS] (libzfs_handle): New global variable. [HAVE_LIBZFS] (fini_libzfs): New static function. (grub_util_init_libzfs): New function. * util/grub-probe.c (main): Call grub_util_init_libzfs(). --- ChangeLog | 28 ++++++ configure.ac | 11 ++- include/grub/util/libnvpair.h | 31 +++++++ include/grub/util/libzfs.h | 39 +++++++++ include/grub/util/misc.h | 1 + kern/emu/getroot.c | 155 ++++++++++++++++++++++++++++++++++ util/grub-probe.c | 1 + util/misc.c | 20 +++++ 8 files changed, 285 insertions(+), 1 deletion(-) create mode 100644 include/grub/util/libnvpair.h create mode 100644 include/grub/util/libzfs.h diff --git a/ChangeLog b/ChangeLog index 4026428a7..041f9cadd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2010-07-30 Robert Millan + + Enable `grub-probe -t device' resolution on ZFS. + + * configure.ac: Check for getfsstat(), libzfs and libnvpair. + * include/grub/util/libnvpair.h: New file. + * include/grub/util/libzfs.h: New file. + + * kern/emu/getroot.c: Include `' and `'. + [HAVE_LIBZFS && HAVE_LIBNVPAIR]: Include `' and + `'. + [HAVE_GETFSSTAT]: Include `'. + + (find_mount_point_from_dir): New static function. + [HAVE_LIBZFS && HAVE_LIBNVPAIR] (find_root_device_from_libzfs): New + function. + [HAVE_LIBZFS && HAVE_LIBNVPAIR] (grub_guess_root_device): Use + find_root_device_from_libzfs() before ressorting to find_root_device(). + + * include/grub/util/misc.h (grub_util_init_libzfs): New function + prototype. + * util/misc.c: Include `'. + (grub_util_init_libzfs): New function. + [HAVE_LIBZFS] (libzfs_handle): New global variable. + [HAVE_LIBZFS] (fini_libzfs): New static function. + (grub_util_init_libzfs): New function. + * util/grub-probe.c (main): Call grub_util_init_libzfs(). + 2010-07-30 Robert Millan * include/grub/emu/misc.h (grub_make_system_path_relative_to_its_root) diff --git a/configure.ac b/configure.ac index aa7f3a151..cc97c7f77 100644 --- a/configure.ac +++ b/configure.ac @@ -247,7 +247,7 @@ else fi # Check for functions. -AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf) +AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getfsstat) # For opendisk() and getrawpartition() on NetBSD. # Used in util/deviceiter.c and in util/hostdisk.c. @@ -799,6 +799,15 @@ if test x"$device_mapper_excuse" = x ; then [device_mapper_excuse="need devmapper library"]) fi +AC_CHECK_LIB([zfs], [libzfs_init], + [LDFLAGS="$LDFLAGS -lzfs" + AC_DEFINE([HAVE_LIBZFS], [1], + [Define to 1 if you have the ZFS library.])],) +AC_CHECK_LIB([nvpair], [nvlist_print], + [LDFLAGS="$LDFLAGS -lnvpair" + AC_DEFINE([HAVE_LIBNVPAIR], [1], + [Define to 1 if you have the NVPAIR library.])],) + AC_SUBST(ASFLAGS) # Output files. diff --git a/include/grub/util/libnvpair.h b/include/grub/util/libnvpair.h new file mode 100644 index 000000000..c4fe174ea --- /dev/null +++ b/include/grub/util/libnvpair.h @@ -0,0 +1,31 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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 . + */ + +#ifndef GRUB_LIBNVPAIR_UTIL_HEADER +#define GRUB_LIBNVPAIR_UTIL_HEADER 1 + +#include /* FILE */ + +typedef void nvlist_t; + +int nvlist_lookup_string (nvlist_t *, const char *, char **); +int nvlist_lookup_nvlist (nvlist_t *, const char *, nvlist_t **); +int nvlist_lookup_nvlist_array (nvlist_t *, const char *, nvlist_t ***, unsigned int *); +void nvlist_print (FILE *, nvlist_t *); + +#endif diff --git a/include/grub/util/libzfs.h b/include/grub/util/libzfs.h new file mode 100644 index 000000000..a17c47e20 --- /dev/null +++ b/include/grub/util/libzfs.h @@ -0,0 +1,39 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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 . + */ + +#ifndef GRUB_LIBZFS_UTIL_HEADER +#define GRUB_LIBZFS_UTIL_HEADER 1 + +#include + +typedef void libzfs_handle_t; +typedef void zpool_handle_t; + +extern libzfs_handle_t *libzfs_init (); +extern void libzfs_fini (libzfs_handle_t *); + +extern zpool_handle_t *zpool_open (libzfs_handle_t *, const char *); +extern void zpool_close (zpool_handle_t *); + +extern int zpool_get_physpath (zpool_handle_t *, const char *); + +extern nvlist_t *zpool_get_config (zpool_handle_t *, nvlist_t **); + +extern libzfs_handle_t *libzfs_handle; + +#endif diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h index 48dfbb868..699b9cf2c 100644 --- a/include/grub/util/misc.h +++ b/include/grub/util/misc.h @@ -59,5 +59,6 @@ char *make_system_path_relative_to_its_root (const char *path); char *canonicalize_file_name (const char *path); void grub_util_init_nls (void); +void grub_util_init_libzfs (void); #endif /* ! GRUB_UTIL_MISC_HEADER */ diff --git a/kern/emu/getroot.c b/kern/emu/getroot.c index 58dbac9b4..f2f6311ff 100644 --- a/kern/emu/getroot.c +++ b/kern/emu/getroot.c @@ -20,11 +20,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -41,6 +43,15 @@ # include #endif +#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) +# include +# include +#endif + +#ifdef HAVE_GETFSSTAT +# include +#endif + #include #include #include @@ -86,6 +97,62 @@ xgetcwd (void) return path; } +static char * +find_mount_point_from_dir (const char *dir) +{ + struct stat st; + typeof (st.st_dev) fs; + char *prev, *next, *slash, *statdir; + + if (stat (dir, &st) == -1) + error (1, errno, "stat (%s)", dir); + + fs = st.st_dev; + + prev = xstrdup (dir); + + while (1) + { + /* Remove last slash. */ + next = xstrdup (prev); + slash = strrchr (next, '/'); + if (! slash) + { + free (next); + free (prev); + return NULL; + } + *slash = '\0'; + + /* A next empty string counts as /. */ + if (next[0] == '\0') + statdir = "/"; + else + statdir = next; + + if (stat (statdir, &st) == -1) + error (1, errno, "stat (%s)", next); + + if (st.st_dev != fs) + { + /* Found mount point. */ + free (next); + return prev; + } + + free (prev); + prev = next; + + /* We've already seen an empty string, which means we + reached /. Nothing left to do. */ + if (prev[0] == '\0') + { + free (prev); + return xstrdup ("/"); + } + } +} + #ifdef __linux__ /* Statting something on a btrfs filesystem always returns a virtual device @@ -166,6 +233,88 @@ find_root_device_from_mountinfo (const char *dir) #endif /* __linux__ */ +#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) + +/* ZFS has similar problems to those of btrfs (see above). */ +static char * +find_root_device_from_libzfs (const char *dir) +{ + char *device = NULL; + char *poolname = NULL; + char *poolfs = NULL; + char *mnt_point; + char *slash; + + mnt_point = find_mount_point_from_dir (dir); + +#ifdef HAVE_GETFSSTAT + { + int mnt_count = getfsstat (NULL, 0, MNT_WAIT); + if (mnt_count == -1) + error (1, errno, "getfsstat"); + + struct statfs *mnt = xmalloc (mnt_count * sizeof (*mnt)); + + mnt_count = getfsstat (mnt, mnt_count * sizeof (*mnt), MNT_WAIT); + if (mnt_count == -1) + error (1, errno, "getfsstat"); + + unsigned int i; + for (i = 0; i < (unsigned) mnt_count; i++) + if (!strcmp (mnt[i].f_fstypename, "zfs") + && !strcmp (mnt[i].f_mntonname, mnt_point)) + { + poolname = xstrdup (mnt[i].f_mntfromname); + break; + } + + free (mnt); + } +#endif + + if (! poolname) + return NULL; + + slash = strchr (poolname, '/'); + if (slash) + { + *slash = '\0'; + poolfs = slash + 1; + } + + { + zpool_handle_t *zpool; + nvlist_t *nvlist; + nvlist_t **nvlist_array; + unsigned int nvlist_count; + + zpool = zpool_open (libzfs_handle, poolname); + nvlist = zpool_get_config (zpool, NULL); + + if (nvlist_lookup_nvlist (nvlist, "vdev_tree", &nvlist) != 0) + error (1, errno, "nvlist_lookup_nvlist (\"vdev_tree\")"); + + if (nvlist_lookup_nvlist_array (nvlist, "children", &nvlist_array, &nvlist_count) != 0) + error (1, errno, "nvlist_lookup_nvlist_array (\"children\")"); + + do + { + assert (nvlist_count > 0); + } while (nvlist_lookup_nvlist_array (nvlist_array[0], "children", + &nvlist_array, &nvlist_count) == 0); + + if (nvlist_lookup_string (nvlist_array[0], "path", &device) != 0) + error (1, errno, "nvlist_lookup_string (\"path\")"); + + zpool_close (zpool); + } + + free (poolname); + + return device; +} +#endif + #ifdef __MINGW32__ static char * @@ -458,6 +607,12 @@ grub_guess_root_device (const char *dir) return os_dev; #endif /* __linux__ */ +#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) + os_dev = find_root_device_from_libzfs (dir); + if (os_dev) + return os_dev; +#endif + if (stat (dir, &st) < 0) grub_util_error ("cannot stat `%s'", dir); diff --git a/util/grub-probe.c b/util/grub-probe.c index 56cbc5592..52f2b3747 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -359,6 +359,7 @@ main (int argc, char *argv[]) set_program_name (argv[0]); grub_util_init_nls (); + grub_util_init_libzfs (); /* Check for options. */ while (1) diff --git a/util/misc.c b/util/misc.c index 91bc25a55..0859197bf 100644 --- a/util/misc.c +++ b/util/misc.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -293,6 +294,25 @@ grub_util_init_nls (void) textdomain (PACKAGE); #endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */ } + +#ifdef HAVE_LIBZFS +libzfs_handle_t *libzfs_handle; + +static void +fini_libzfs (void) +{ + libzfs_fini (libzfs_handle); +} +#endif + +void +grub_util_init_libzfs (void) +{ +#ifdef HAVE_LIBZFS + libzfs_handle = libzfs_init (); + atexit (fini_libzfs); +#endif +} #endif int From c9a00aeeaa0d9c4d6b254fe2e221b67b951a48e7 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Fri, 30 Jul 2010 22:01:10 +0200 Subject: [PATCH 070/174] 2010-07-30 Robert Millan * include/grub/emu/misc.h: Add missing license header. --- ChangeLog | 4 ++++ include/grub/emu/misc.h | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index 041f9cadd..86aba2914 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-07-30 Robert Millan + + * include/grub/emu/misc.h: Add missing license header. + 2010-07-30 Robert Millan Enable `grub-probe -t device' resolution on ZFS. diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index 07257e511..dc48d91a8 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -1,3 +1,21 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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 . + */ + #ifndef GRUB_EMU_MISC_H #define GRUB_EMU_MISC_H 1 From 3169f4c76a37a1545d7382a5dd483e36d00da5c3 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sat, 31 Jul 2010 12:22:01 +0200 Subject: [PATCH 071/174] 2010-07-31 Robert Millan * configure.ac: Check for `libzfs.h' and `libnvpair.h'. * include/grub/util/libnvpair.h: Include `'. [HAVE_LIBNVPAIR_H]: Include `' instead of declaring libnvpair prototypes ourselves. * include/grub/util/libzfs.h: Include `'. [HAVE_LIBZFS_H]: Include `' instead of declaring libzfs prototypes ourselves. (libzfs_handle): Moved to ... * include/grub/util/misc.h (libzfs_handle): ... here. Include `'. --- ChangeLog | 15 +++++++++++++++ configure.ac | 3 ++- include/grub/util/libnvpair.h | 8 ++++++++ include/grub/util/libzfs.h | 8 +++++++- include/grub/util/misc.h | 3 +++ 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86aba2914..58b821da9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2010-07-31 Robert Millan + + * configure.ac: Check for `libzfs.h' and `libnvpair.h'. + + * include/grub/util/libnvpair.h: Include `'. + [HAVE_LIBNVPAIR_H]: Include `' instead of + declaring libnvpair prototypes ourselves. + * include/grub/util/libzfs.h: Include `'. + [HAVE_LIBZFS_H]: Include `' instead of + declaring libzfs prototypes ourselves. + + (libzfs_handle): Moved to ... + * include/grub/util/misc.h (libzfs_handle): ... here. + Include `'. + 2010-07-30 Robert Millan * include/grub/emu/misc.h: Add missing license header. diff --git a/configure.ac b/configure.ac index cc97c7f77..6169a2fb5 100644 --- a/configure.ac +++ b/configure.ac @@ -246,8 +246,9 @@ else AC_PATH_PROG(HELP2MAN, help2man) fi -# Check for functions. +# Check for functions and headers. AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getfsstat) +AC_CHECK_HEADERS(libzfs.h libnvpair.h) # For opendisk() and getrawpartition() on NetBSD. # Used in util/deviceiter.c and in util/hostdisk.c. diff --git a/include/grub/util/libnvpair.h b/include/grub/util/libnvpair.h index c4fe174ea..26f7e9d0f 100644 --- a/include/grub/util/libnvpair.h +++ b/include/grub/util/libnvpair.h @@ -19,6 +19,12 @@ #ifndef GRUB_LIBNVPAIR_UTIL_HEADER #define GRUB_LIBNVPAIR_UTIL_HEADER 1 +#include + +#ifdef HAVE_LIBNVPAIR_H +#include +#else /* ! HAVE_LIBNVPAIR_H */ + #include /* FILE */ typedef void nvlist_t; @@ -28,4 +34,6 @@ int nvlist_lookup_nvlist (nvlist_t *, const char *, nvlist_t **); int nvlist_lookup_nvlist_array (nvlist_t *, const char *, nvlist_t ***, unsigned int *); void nvlist_print (FILE *, nvlist_t *); +#endif /* ! HAVE_LIBNVPAIR_H */ + #endif diff --git a/include/grub/util/libzfs.h b/include/grub/util/libzfs.h index a17c47e20..9fbfd40d1 100644 --- a/include/grub/util/libzfs.h +++ b/include/grub/util/libzfs.h @@ -19,6 +19,12 @@ #ifndef GRUB_LIBZFS_UTIL_HEADER #define GRUB_LIBZFS_UTIL_HEADER 1 +#include + +#ifdef HAVE_LIBZFS_H +#include +#else /* ! HAVE_LIBZFS_H */ + #include typedef void libzfs_handle_t; @@ -34,6 +40,6 @@ extern int zpool_get_physpath (zpool_handle_t *, const char *); extern nvlist_t *zpool_get_config (zpool_handle_t *, nvlist_t **); -extern libzfs_handle_t *libzfs_handle; +#endif /* ! HAVE_LIBZFS_H */ #endif diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h index 699b9cf2c..3614c79c2 100644 --- a/include/grub/util/misc.h +++ b/include/grub/util/misc.h @@ -29,6 +29,7 @@ #include #include #include +#include char *grub_util_get_path (const char *dir, const char *file); size_t grub_util_get_fp_size (FILE *fp); @@ -59,6 +60,8 @@ char *make_system_path_relative_to_its_root (const char *path); char *canonicalize_file_name (const char *path); void grub_util_init_nls (void); + void grub_util_init_libzfs (void); +extern libzfs_handle_t *libzfs_handle; #endif /* ! GRUB_UTIL_MISC_HEADER */ From 8072efebf210fbc610ae852750e3f400305dfc69 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sat, 31 Jul 2010 18:45:57 +0200 Subject: [PATCH 072/174] 2010-07-31 Robert Millan * kern/emu/misc.c: Add missing license header. --- ChangeLog | 4 ++++ kern/emu/misc.c | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index 58b821da9..24303ff17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-07-31 Robert Millan + + * kern/emu/misc.c: Add missing license header. + 2010-07-31 Robert Millan * configure.ac: Check for `libzfs.h' and `libnvpair.h'. diff --git a/kern/emu/misc.c b/kern/emu/misc.c index 38395fca8..851da7a07 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -1,3 +1,21 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002,2003,2005,2006,2007,2008,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 . + */ + #include #include From 3710bb6b96ba84767e9315b8eecfd31c8b2386de Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 1 Aug 2010 02:14:07 +0200 Subject: [PATCH 073/174] 2010-07-31 Robert Millan * util/grub.d/10_kfreebsd.in: Make module handling more generic. --- ChangeLog | 4 ++++ util/grub.d/10_kfreebsd.in | 25 ++++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24303ff17..249256083 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-07-31 Robert Millan + + * util/grub.d/10_kfreebsd.in: Make module handling more generic. + 2010-07-31 Robert Millan * kern/emu/misc.c: Add missing license header. diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in index 9915abdf1..f32da3013 100644 --- a/util/grub.d/10_kfreebsd.in +++ b/util/grub.d/10_kfreebsd.in @@ -51,6 +51,10 @@ kfreebsd_entry () if [ -z "${prepare_boot_cache}" ]; then prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" fi + if [ -z "${prepare_module_dir_cache}" ]; then + prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | sed -e "s/^/\t/")" + fi + printf '%s\n' "${prepare_boot_cache}" cat << EOF echo '$(printf "$(gettext_quoted "Loading kernel of FreeBSD %s ...")" ${version})' @@ -63,9 +67,10 @@ EOF EOF fi - if test -n "${acpi_ko}" ; then + if test -e "${module_dir}/acpi.ko" ; then + printf '%s\n' "${prepare_module_dir_cache}" cat << EOF - kfreebsd_module_elf ${acpi_ko_rel_dirname}/${acpi_ko_basename} + kfreebsd_module_elf ${module_dir_rel}/acpi.ko EOF fi @@ -103,19 +108,17 @@ while [ "x$list" != "x" ] ; do version=`echo $basename | sed -e "s,^[^0-9]*-,,g;s/\.gz$//g"` alt_version=`echo $version | sed -e "s,\.old$,,g"` - acpi_ko= - for i in "/lib/modules/${version}/acpi.ko" "/lib/modules/${alt_version}/acpi.ko" \ - "/boot/kernel/acpi.ko"; do + module_dir= + for i in "/lib/modules/${version}" "/lib/modules/${alt_version}" \ + "/boot/kernel"; do if test -e "$i" ; then - acpi_ko="$i" + module_dir="$i" break fi done - if test -n "${acpi_ko}" ; then - echo "Found ACPI module: ${acpi_ko}" >&2 - acpi_ko_basename=`basename ${acpi_ko}` - acpi_ko_dirname=`dirname ${acpi_ko}` - acpi_ko_rel_dirname=`make_system_path_relative_to_its_root $acpi_ko_dirname` + if test -n "${module_dir}" ; then + echo "Found kernel module directory: ${module_dir}" >&2 + module_dir_rel=$(make_system_path_relative_to_its_root $module_dir) fi kfreebsd_entry "${OS}" "${version}" From ebf53056b8e17487c9f56effe9130f5772a93e02 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 1 Aug 2010 14:47:14 +0200 Subject: [PATCH 074/174] 2010-08-01 Robert Millan * kern/emu/getroot.c: Include `'. --- ChangeLog | 4 ++++ kern/emu/getroot.c | 1 + 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 249256083..f34ed35c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-01 Robert Millan + + * kern/emu/getroot.c: Include `'. + 2010-07-31 Robert Millan * util/grub.d/10_kfreebsd.in: Make module handling more generic. diff --git a/kern/emu/getroot.c b/kern/emu/getroot.c index f2f6311ff..6caae08e6 100644 --- a/kern/emu/getroot.c +++ b/kern/emu/getroot.c @@ -30,6 +30,7 @@ #include #include #include +#include #ifdef __GNU__ #include From ce04ef47e2ef22cc3886b88beba2e58e8d115702 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 1 Aug 2010 08:54:10 -0500 Subject: [PATCH 075/174] * util/grub.d/20_linux_xen.in: Don't use UUID for LVM root (matching util/grub.d/10_linux.in). Fixes Debian bug #591093. --- ChangeLog | 5 +++++ util/grub.d/20_linux_xen.in | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f34ed35c9..abe698574 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-01 Colin Watson + + * util/grub.d/20_linux_xen.in: Don't use UUID for LVM root (matching + util/grub.d/10_linux.in). Fixes Debian bug #591093. + 2010-08-01 Robert Millan * kern/emu/getroot.c: Include `'. diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in index 8612c96b0..e631c0a4a 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -44,7 +44,8 @@ case ${GRUB_DEVICE} in esac if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ - || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then + || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ + || uses_abstraction "${GRUB_DEVICE}" lvm; then LINUX_ROOT_DEVICE=${GRUB_DEVICE} else LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} From deb0caa38ebc69aa7135d56896a6e61d0642ba3c Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 1 Aug 2010 15:23:44 +0200 Subject: [PATCH 076/174] 2010-08-01 Robert Millan Prevent accidental use of uninitialized libzfs_handle. * util/grub-probe.c (main): Move grub_util_init_libzfs() call to ... * kern/emu/getroot.c (find_root_device_from_libzfs): ... here. * util/misc.c (grub_util_init_libzfs): Make this function idempotent. --- ChangeLog | 8 ++++++++ kern/emu/getroot.c | 2 ++ util/grub-probe.c | 1 - util/misc.c | 7 +++++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index abe698574..20094fec8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-08-01 Robert Millan + + Prevent accidental use of uninitialized libzfs_handle. + + * util/grub-probe.c (main): Move grub_util_init_libzfs() call to ... + * kern/emu/getroot.c (find_root_device_from_libzfs): ... here. + * util/misc.c (grub_util_init_libzfs): Make this function idempotent. + 2010-08-01 Colin Watson * util/grub.d/20_linux_xen.in: Don't use UUID for LVM root (matching diff --git a/kern/emu/getroot.c b/kern/emu/getroot.c index 6caae08e6..f8eda2294 100644 --- a/kern/emu/getroot.c +++ b/kern/emu/getroot.c @@ -289,6 +289,8 @@ find_root_device_from_libzfs (const char *dir) nvlist_t **nvlist_array; unsigned int nvlist_count; + grub_util_init_libzfs (); + zpool = zpool_open (libzfs_handle, poolname); nvlist = zpool_get_config (zpool, NULL); diff --git a/util/grub-probe.c b/util/grub-probe.c index 52f2b3747..56cbc5592 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -359,7 +359,6 @@ main (int argc, char *argv[]) set_program_name (argv[0]); grub_util_init_nls (); - grub_util_init_libzfs (); /* Check for options. */ while (1) diff --git a/util/misc.c b/util/misc.c index 0859197bf..2eff256bf 100644 --- a/util/misc.c +++ b/util/misc.c @@ -309,8 +309,11 @@ void grub_util_init_libzfs (void) { #ifdef HAVE_LIBZFS - libzfs_handle = libzfs_init (); - atexit (fini_libzfs); + if (! libzfs_handle) + { + libzfs_handle = libzfs_init (); + atexit (fini_libzfs); + } #endif } #endif From 7decd202a72cbed9d1e1d445d6fbea9532703866 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 1 Aug 2010 09:44:36 -0500 Subject: [PATCH 077/174] * kern/misc.c (grub_memset): Optimise to reduce cache stalls. Also-By: Colin Watson --- ChangeLog | 5 +++++ kern/misc.c | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 20094fec8..d00fd9d51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-01 Vladimir Serbinenko +2010-08-01 Colin Watson + + * kern/misc.c (grub_memset): Optimise to reduce cache stalls. + 2010-08-01 Robert Millan Prevent accidental use of uninitialized libzfs_handle. diff --git a/kern/misc.c b/kern/misc.c index c13c96e30..b37ef230c 100644 --- a/kern/misc.c +++ b/kern/misc.c @@ -518,12 +518,39 @@ grub_strndup (const char *s, grub_size_t n) } void * -grub_memset (void *s, int c, grub_size_t n) +grub_memset (void *s, int c, grub_size_t len) { - unsigned char *p = (unsigned char *) s; + void *p = s; + grub_uint8_t pattern8 = c; - while (n--) - *p++ = (unsigned char) c; + if (len >= 3 * sizeof (unsigned long)) + { + unsigned long patternl = 0; + grub_size_t i; + + for (i = 0; i < sizeof (unsigned long); i++) + patternl |= ((unsigned long) pattern8) << (8 * i); + + while (len > 0 && (((grub_addr_t) p) & (sizeof (unsigned long) - 1))) + { + *(grub_uint8_t *) p = pattern8; + p = (grub_uint8_t *) p + 1; + len--; + } + while (len >= sizeof (unsigned long)) + { + *(unsigned long *) p = patternl; + p = (unsigned long *) p + 1; + len -= sizeof (unsigned long); + } + } + + while (len > 0) + { + *(grub_uint8_t *) p = pattern8; + p = (grub_uint8_t *) p + 1; + len--; + } return s; } From 2cfb45df5ed7be7b55c69dc0f809343e189afdb9 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 1 Aug 2010 11:25:09 -0500 Subject: [PATCH 078/174] * docs/grub.texi (Simple configuration): Document GRUB_CMDLINE_XEN and GRUB_CMDLINE_XEN_DEFAULT. Recommend setting GRUB_GFXPAYLOAD_LINUX=text rather than unsetting it in order to disable gfxpayload. (Shell-like scripting): Add real content. (Serial terminal): Suggest `terminal_input serial; terminal_output serial' rather than putting the two commands on separate lines, since console input will be inoperative after the first command. (menuentry): Document --class, --users, and --hotkey options. (terminfo): Describe what `visually-ordered UTF-8' means (thanks, Vladimir Serbinenko). --- ChangeLog | 14 ++++ docs/grub.texi | 182 ++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 186 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index d00fd9d51..1c1533841 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2010-08-01 Colin Watson + + * docs/grub.texi (Simple configuration): Document GRUB_CMDLINE_XEN + and GRUB_CMDLINE_XEN_DEFAULT. Recommend setting + GRUB_GFXPAYLOAD_LINUX=text rather than unsetting it in order to + disable gfxpayload. + (Shell-like scripting): Add real content. + (Serial terminal): Suggest `terminal_input serial; terminal_output + serial' rather than putting the two commands on separate lines, + since console input will be inoperative after the first command. + (menuentry): Document --class, --users, and --hotkey options. + (terminfo): Describe what `visually-ordered UTF-8' means (thanks, + Vladimir Serbinenko). + 2010-08-01 Vladimir Serbinenko 2010-08-01 Colin Watson diff --git a/docs/grub.texi b/docs/grub.texi index a191ef9ef..583cf98cb 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1062,6 +1062,11 @@ only to the default menu entry, after those listed in As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for NetBSD. +@item GRUB_CMDLINE_XEN +@itemx GRUB_CMDLINE_XEN_DEFAULT +As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for +Linux and Xen. + @item GRUB_DISABLE_LINUX_UUID Normally, @command{grub-mkconfig} will generate menu entries that use universally-unique identifiers (UUIDs) to identify the root filesystem to @@ -1113,8 +1118,8 @@ try several modes in sequence. Depending on your kernel, your distribution, your graphics card, and the phase of the moon, note that using this option may cause GNU/Linux to suffer from various display problems, particularly during the early part of the -boot sequence. If you have problems, simply unset this option and GRUB will -tell Linux to boot in normal text mode. +boot sequence. If you have problems, set this option to @samp{text} and +GRUB will tell Linux to boot in normal text mode. @item GRUB_DISABLE_OS_PROBER Normally, @command{grub-mkconfig} will try to use the external @@ -1143,6 +1148,142 @@ that file, making sure to leave at least the first two lines intact. @node Shell-like scripting @section Writing full configuration files directly +@c Some of this section is derived from the GNU Bash manual page, also +@c copyrighted by the FSF. + +@file{grub.cfg} is written in GRUB's built-in scripting language, which has +a syntax quite similar to that of GNU Bash and other Bourne shell +derivatives. + +@heading Words + +A @dfn{word} is a sequence of characters considered as a single unit by +GRUB. Words are separated by @dfn{metacharacters}, which are the following +plus space, tab, and newline: + +@example +@{ @} | & $ ; < > +@end example + +Quoting may be used to include metacharacters in words; see below. + +@heading Reserved words + +Reserved words have a special meaning to GRUB. The following words are +recognised as reserved when unquoted and either the first word of a simple +command or the third word of a @code{for} command: + +@example +! [[ ]] @{ @} +case do done elif else esac fi for function +if in menuentry select then time until while +@end example + +Not all of these reserved words have a useful purpose yet; some are reserved +for future expansion. + +@heading Quoting + +Quoting is used to remove the special meaning of certain characters or +words. It can be used to treat metacharacters as part of a word, to prevent +reserved words from being recognised as such, and to prevent variable +expansion. + +There are three quoting mechanisms: the escape character, single quotes, and +double quotes. + +A non-quoted backslash (\) is the @dfn{escape character}. It preserves the +literal value of the next character that follows, with the exception of +newline. + +Enclosing characters in single quotes preserves the literal value of each +character within the quotes. A single quote may not occur between single +quotes, even when preceded by a backslash. + +Enclosing characters in double quotes preserves the literal value of all +characters within the quotes, with the exception of @samp{$} and @samp{\}. +The @samp{$} character retains its special meaning within double quotes. +The backslash retains its special meaning only when followed by one of the +following characters: @samp{$}, @samp{"}, @samp{\}, or newline. A +backslash-newline pair is treated as a line continuation (that is, it is +removed from the input stream and effectively ignored). A double quote may +be quoted within double quotes by preceding it with a backslash. + +@heading Variable expansion + +The @samp{$} character introduces variable expansion. The variable name to +be expanded may be enclosed in braces, which are optional but serve to +protect the variable to be expanded from characters immediately following it +which could be interpreted as part of the name. + +Normal variable names begin with an alphabetic character, followed by zero +or more alphanumeric characters. + +Positional variable names consist of one or more digits. These are reserved +for future expansion. + +The special variable name @samp{?} expands to the exit status of the most +recently executed command. + +@heading Comments + +A word beginning with @samp{#} causes that word and all remaining characters +on that line to be ignored. + +@heading Simple commands + +A @dfn{simple command} is a sequence of words separated by spaces or tabs +and terminated by a semicolon or a newline. The first word specifies the +command to be executed. The remaining words are passed as arguments to the +invoked command. + +The return value of a simple command is its exit status. + +@heading Compound commands + +A @dfn{compound command} is one of the following: + +@table @asis +@item for @var{name} in @var{word} @dots{}; do @var{list}; done +The list of words following @code{in} is expanded, generating a list of +items. The variable @var{name} is set to each element of this list in turn, +and @var{list} is executed each time. The return value is the exit status +of the last command that executes. If the expansion of the items following +@code{in} results in an empty list, no commands are executed, and the return +status is 0. + +@item if @var{list}; then @var{list}; [elif @var{list}; then @var{list};] @dots{} [else @var{list};] fi +The @code{if} @var{list} is executed. If its exit status is zero, the +@code{then} @var{list} is executed. Otherwise, each @code{elif} @var{list} +is executed in turn, and if its exit status is zero, the corresponding +@code{then} @var{list} is executed and the command completes. Otherwise, +the @code{else} @var{list} is executed, if present. The exit status is the +exit status of the last command executed, or zero if no condition tested +true. + +@item while @var{cond}; do @var{list}; done +@itemx until @var{cond}; do @var{list}; done +The @code{while} command continuously executes the @code{do} @var{list} as +long as the last command in @var{cond} returns an exit status of zero. The +@code{until} command is identical to the @code{while} command, except that +the test is negated; the @code{do} @var{list} is executed as long as the +last command in @var{cond} returns a non-zero exit status. The exit status +of the @code{while} and @code{until} commands is the exit status of the last +@code{do} @var{list} command executed, or zero if none was executed. + +@item function @var{name} @{ @var{command}; @dots{} @} +This defines a function named @var{name}. The @dfn{body} of the function is +the list of commands within braces, each of which must be terminated with a +semicolon or a newline. This list of commands will be executed whenever +@var{name} is specified as the name of a simple command. Function +definitions do not affect the exit status in @code{$?}. When executed, the +exit status of a function is the exit status of the last command executed in +the body. + +@item menuentry @var{title} [@option{--class=class} @dots{}] [@option{--users=users}] [@option{--hotkey=key}] @{ @var{command}; @dots{} @} +@xref{menuentry}. +@end table + @node Embedded configuration @section Embedding a configuration file into GRUB @@ -1308,8 +1449,7 @@ simple. Here is an example: @example @group grub> @kbd{serial --unit=0 --speed=9600} -grub> @kbd{terminal_input serial} -grub> @kbd{terminal_output serial} +grub> @kbd{terminal_input serial; terminal_output serial} @end group @end example @@ -1320,11 +1460,14 @@ command accepts many other options, so please refer to @ref{serial}, for more details. The commands @command{terminal_input} (@pxref{terminal_input}) and -@command{terminal_output} (@pxref{terminal_output} choose which type of +@command{terminal_output} (@pxref{terminal_output}) choose which type of terminal you want to use. In the case above, the terminal will be a serial terminal, but you can also pass @code{console} to the command, as @samp{terminal serial console}. In this case, a terminal in which -you press any key will be selected as a GRUB terminal. +you press any key will be selected as a GRUB terminal. In the example above, +note that you need to put both commands on the same command line, as you +will lose the ability to type commands on the console after the first +command. However, note that GRUB assumes that your terminal emulator is compatible with VT100 by default. This is true for most terminal @@ -1789,9 +1932,26 @@ These commands can only be used in the menu: @node menuentry @subsection menuentry -@deffn Command title name @dots{} -Start a new boot entry, and set its name to the contents of the rest of -the line, starting with the first non-space character. +@deffn Command menuentry @var{title} @ + [@option{--class=class} @dots{}] [@option{--users=users}] @ + [@option{--hotkey=key}] @ + @{ @var{command}; @dots{} @} +This defines a GRUB menu entry named @var{title}. When this entry is +selected from the menu, GRUB will set the @var{chosen} environment variable +to @var{title}, execute the list of commands given within braces, and if the +last command in the list returned successfully and a kernel was loaded it +will execute the @command{boot} command. + +The @option{--class} option may be used any number of times to group menu +entries into classes. Menu themes may display different classes using +different styles. + +The @option{--users} option grants specific users access to specific menu +entries. @xref{Security}. + +The @option{--hotkey} option associates a hotkey with a menu entry. +@var{key} may be a single letter, or one of the aliases @samp{backspace}, +@samp{tab}, or @samp{delete}. @end deffn @@ -1885,7 +2045,9 @@ The @option{-a} (@option{--ascii}), @option{-u} (@option{--utf8}), and @option{-v} (@option{--visual-utf8}) options control how non-ASCII text is displayed. @option{-a} specifies an ASCII-only terminal; @option{-u} specifies logically-ordered UTF-8; and @option{-v} specifies -visually-ordered UTF-8. +"visually-ordered UTF-8" (in other words, arranged such that a terminal +emulator without bidirectional text support will display right-to-left text +in the proper order; this is not really proper UTF-8, but a workaround). If no option or terminal type is specified, the current terminal type is printed. From 6eea041aa4dae2be3ffe42786dce894d8d89dfba Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 1 Aug 2010 11:28:12 -0500 Subject: [PATCH 079/174] * script/yylex.l (NAME): Remove [:digit:], redundant with [:alnum:]. --- ChangeLog | 4 ++++ script/yylex.l | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1c1533841..83ac0b37b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-01 Colin Watson + + * script/yylex.l (NAME): Remove [:digit:], redundant with [:alnum:]. + 2010-08-01 Colin Watson * docs/grub.texi (Simple configuration): Document GRUB_CMDLINE_XEN diff --git a/script/yylex.l b/script/yylex.l index 7d4ea9e4e..e9659832b 100644 --- a/script/yylex.l +++ b/script/yylex.l @@ -116,7 +116,7 @@ COMMENT #.*$ CHAR [^{}|&$;<> \t\n\'\"\\] DIGITS [[:digit:]]+ -NAME [[:alpha:]_][[:alnum:][:digit:]_]* +NAME [[:alpha:]_][[:alnum:]_]* ESC \\. VARIABLE ${NAME}|$\{{NAME}\}|${DIGITS}|$\{{DIGITS}\}|$\?|$\{\?\} From ea9be8eadb4d899eb6bc740b360de292695aacf9 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 1 Aug 2010 11:30:03 -0500 Subject: [PATCH 080/174] * util/grub-mkrescue.in: Remove ${efi_dir} after building efi.img. --- ChangeLog | 4 ++++ util/grub-mkrescue.in | 1 + 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 83ac0b37b..9729f71d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-01 Colin Watson + + * util/grub-mkrescue.in: Remove ${efi_dir} after building efi.img. + 2010-08-01 Colin Watson * script/yylex.l (NAME): Remove [:digit:], redundant with [:alnum:]. diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index e498acee7..b7d9eb4eb 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -296,6 +296,7 @@ if test -e "${efi64_dir}" || test -e "${efi32_dir}"; then mformat -C -f 2880 -L 16 -i "${iso9660_dir}"/efi.img :: mcopy -s -i "${iso9660_dir}"/efi.img ${efi_dir}/efi ::/ + rm -rf ${efi_dir} grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img" fi From 8687cf071e646a5c949b7cbcf14f6ea9334ec466 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 1 Aug 2010 16:11:27 +0200 Subject: [PATCH 081/174] * kern/emu/getroot.c (find_mount_point_from_dir): Compile only if [HAVE_LIBZFS && HAVE_LIBNVPAIR] --- ChangeLog | 7 ++++++- kern/emu/getroot.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9729f71d8..2e8c0daa5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-01 Vladimir Serbinenko + + * kern/emu/getroot.c (find_mount_point_from_dir): Compile only if + [HAVE_LIBZFS && HAVE_LIBNVPAIR] + 2010-08-01 Colin Watson * util/grub-mkrescue.in: Remove ${efi_dir} after building efi.img. @@ -41,7 +46,7 @@ 2010-08-01 Robert Millan * kern/emu/getroot.c: Include `'. - + 2010-07-31 Robert Millan * util/grub.d/10_kfreebsd.in: Make module handling more generic. diff --git a/kern/emu/getroot.c b/kern/emu/getroot.c index f8eda2294..032608d1b 100644 --- a/kern/emu/getroot.c +++ b/kern/emu/getroot.c @@ -98,6 +98,8 @@ xgetcwd (void) return path; } +#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) + static char * find_mount_point_from_dir (const char *dir) { @@ -154,6 +156,8 @@ find_mount_point_from_dir (const char *dir) } } +#endif + #ifdef __linux__ /* Statting something on a btrfs filesystem always returns a virtual device From 553df63d76cf4a5b6fa63042021320e5b6d6a5d4 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 1 Aug 2010 21:01:05 +0200 Subject: [PATCH 082/174] * lib/arg.c (grub_arg_show_help): Add the necessary spacing. --- ChangeLog | 4 ++++ lib/arg.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e8c0daa5..bc6b8fd18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-01 Vladimir Serbinenko + + * lib/arg.c (grub_arg_show_help): Add the necessary spacing. + 2010-08-01 Vladimir Serbinenko * kern/emu/getroot.c (find_mount_point_from_dir): Compile only if diff --git a/lib/arg.c b/lib/arg.c index 400314d30..a9b8a520e 100644 --- a/lib/arg.c +++ b/lib/arg.c @@ -144,8 +144,10 @@ grub_arg_show_help (grub_extcmd_t cmd) } } - /* FIXME: add spacing back. */ - grub_xputs (_(opt->doc)); + while (spacing--) + grub_xputs (" "); + + grub_printf ("%s\n", _(opt->doc)); switch (opt->shortarg) { From 8bfe31d82b187f4dbaa9df652bd170bd5915c818 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 1 Aug 2010 16:41:46 -0500 Subject: [PATCH 083/174] * include/grub/util/libzfs.h (libzfs_init): Set argument list to (void) rather than () so that this is a proper prototype. --- ChangeLog | 5 +++++ include/grub/util/libzfs.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bc6b8fd18..daf5517dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-01 Colin Watson + + * include/grub/util/libzfs.h (libzfs_init): Set argument list to + (void) rather than () so that this is a proper prototype. + 2010-08-01 Vladimir Serbinenko * lib/arg.c (grub_arg_show_help): Add the necessary spacing. diff --git a/include/grub/util/libzfs.h b/include/grub/util/libzfs.h index 9fbfd40d1..0500f70d7 100644 --- a/include/grub/util/libzfs.h +++ b/include/grub/util/libzfs.h @@ -30,7 +30,7 @@ typedef void libzfs_handle_t; typedef void zpool_handle_t; -extern libzfs_handle_t *libzfs_init (); +extern libzfs_handle_t *libzfs_init (void); extern void libzfs_fini (libzfs_handle_t *); extern zpool_handle_t *zpool_open (libzfs_handle_t *, const char *); From c882acc031c3ee096c01ee73963ab4628155f3cc Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 1 Aug 2010 22:59:02 +0200 Subject: [PATCH 084/174] 2010-08-01 Robert Millan * include/grub/emu/misc.h (grub_find_mount_point_from_dir) (grub_find_zpool_from_mount_point): New function prototypes. * kern/emu/getroot.c [HAVE_GETFSSTAT]: Move `' to ... * kern/emu/misc.c [HAVE_GETFSSTAT]: ... here. * kern/emu/getroot.c (find_mount_point_from_dir): Move to ... * kern/emu/misc.c (grub_find_mount_point_from_dir): ... this. Remove `static' attribute. * kern/emu/getroot.c (find_root_device_from_libzfs): Split code for finding zpool from mount point into ... * kern/emu/misc.c (grub_find_zpool_from_mount_point): ... this. * kern/emu/misc.c (grub_make_system_path_relative_to_its_root): When requested path is part of a ZFS pool, use grub_find_zpool_from_mount_point() to detect its filesystem name, and generate a path with `/fsname@path' syntax. --- ChangeLog | 42 ++++++++++++ include/grub/emu/misc.h | 8 ++- kern/emu/getroot.c | 112 +++----------------------------- kern/emu/misc.c | 140 +++++++++++++++++++++++++++++++++++++++- 4 files changed, 196 insertions(+), 106 deletions(-) diff --git a/ChangeLog b/ChangeLog index daf5517dc..2956129b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2010-08-01 Robert Millan + + * include/grub/emu/misc.h (grub_find_mount_point_from_dir) + (grub_find_zpool_from_mount_point): New function prototypes. + + * kern/emu/getroot.c [HAVE_GETFSSTAT]: Move `' to ... + * kern/emu/misc.c [HAVE_GETFSSTAT]: ... here. + + * kern/emu/getroot.c (find_mount_point_from_dir): Move to ... + * kern/emu/misc.c (grub_find_mount_point_from_dir): ... this. Remove + `static' attribute. + + * kern/emu/getroot.c (find_root_device_from_libzfs): Split code for + finding zpool from mount point into ... + * kern/emu/misc.c (grub_find_zpool_from_mount_point): ... this. + + * kern/emu/misc.c (grub_make_system_path_relative_to_its_root): When + requested path is part of a ZFS pool, use + grub_find_zpool_from_mount_point() to detect its filesystem name, + and generate a path with `/fsname@path' syntax. + 2010-08-01 Colin Watson * include/grub/util/libzfs.h (libzfs_init): Set argument list to @@ -39,6 +60,27 @@ * kern/misc.c (grub_memset): Optimise to reduce cache stalls. +2010-08-01 Robert Millan + + * include/grub/emu/misc.h (grub_find_mount_point_from_dir) + (grub_find_zpool_from_mount_point): New function prototypes. + + * kern/emu/getroot.c [HAVE_GETFSSTAT]: Move `' to ... + * kern/emu/misc.c [HAVE_GETFSSTAT]: ... here. + + * kern/emu/getroot.c (find_mount_point_from_dir): Move to ... + * kern/emu/misc.c (grub_find_mount_point_from_dir): ... this. Remove + `static' attribute. + + * kern/emu/getroot.c (find_root_device_from_libzfs): Split code for + finding zpool from mount point into ... + * kern/emu/misc.c (grub_find_zpool_from_mount_point): ... this. + + * kern/emu/misc.c (grub_make_system_path_relative_to_its_root): When + requested path is part of a ZFS pool, use + grub_find_zpool_from_mount_point() to detect its filesystem name, + and generate a path with `/fsname@path' syntax. + 2010-08-01 Robert Millan Prevent accidental use of uninitialized libzfs_handle. diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index dc48d91a8..5047a9406 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -44,7 +44,13 @@ extern const char *program_name; void grub_init_all (void); void grub_fini_all (void); -char *grub_make_system_path_relative_to_its_root (const char *path) __attribute__ ((warn_unused_result)); +char *grub_find_mount_point_from_dir (const char *dir) + __attribute__ ((warn_unused_result)); +void grub_find_zpool_from_mount_point (const char *mnt_point, + char **poolname, char **poolfs); + +char *grub_make_system_path_relative_to_its_root (const char *path) + __attribute__ ((warn_unused_result)); void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result)); void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result)); diff --git a/kern/emu/getroot.c b/kern/emu/getroot.c index 032608d1b..32044536d 100644 --- a/kern/emu/getroot.c +++ b/kern/emu/getroot.c @@ -49,10 +49,6 @@ # include #endif -#ifdef HAVE_GETFSSTAT -# include -#endif - #include #include #include @@ -98,66 +94,6 @@ xgetcwd (void) return path; } -#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) - -static char * -find_mount_point_from_dir (const char *dir) -{ - struct stat st; - typeof (st.st_dev) fs; - char *prev, *next, *slash, *statdir; - - if (stat (dir, &st) == -1) - error (1, errno, "stat (%s)", dir); - - fs = st.st_dev; - - prev = xstrdup (dir); - - while (1) - { - /* Remove last slash. */ - next = xstrdup (prev); - slash = strrchr (next, '/'); - if (! slash) - { - free (next); - free (prev); - return NULL; - } - *slash = '\0'; - - /* A next empty string counts as /. */ - if (next[0] == '\0') - statdir = "/"; - else - statdir = next; - - if (stat (statdir, &st) == -1) - error (1, errno, "stat (%s)", next); - - if (st.st_dev != fs) - { - /* Found mount point. */ - free (next); - return prev; - } - - free (prev); - prev = next; - - /* We've already seen an empty string, which means we - reached /. Nothing left to do. */ - if (prev[0] == '\0') - { - free (prev); - return xstrdup ("/"); - } - } -} - -#endif - #ifdef __linux__ /* Statting something on a btrfs filesystem always returns a virtual device @@ -239,52 +175,20 @@ find_root_device_from_mountinfo (const char *dir) #endif /* __linux__ */ #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) - -/* ZFS has similar problems to those of btrfs (see above). */ static char * find_root_device_from_libzfs (const char *dir) { - char *device = NULL; - char *poolname = NULL; - char *poolfs = NULL; + char *device; + char *poolname; + char *poolfs; char *mnt_point; - char *slash; - - mnt_point = find_mount_point_from_dir (dir); - -#ifdef HAVE_GETFSSTAT - { - int mnt_count = getfsstat (NULL, 0, MNT_WAIT); - if (mnt_count == -1) - error (1, errno, "getfsstat"); - - struct statfs *mnt = xmalloc (mnt_count * sizeof (*mnt)); - - mnt_count = getfsstat (mnt, mnt_count * sizeof (*mnt), MNT_WAIT); - if (mnt_count == -1) - error (1, errno, "getfsstat"); - - unsigned int i; - for (i = 0; i < (unsigned) mnt_count; i++) - if (!strcmp (mnt[i].f_fstypename, "zfs") - && !strcmp (mnt[i].f_mntonname, mnt_point)) - { - poolname = xstrdup (mnt[i].f_mntfromname); - break; - } - - free (mnt); - } -#endif + mnt_point = grub_find_mount_point_from_dir (dir); + grub_find_zpool_from_mount_point (mnt_point, &poolname, &poolfs); if (! poolname) - return NULL; - - slash = strchr (poolname, '/'); - if (slash) { - *slash = '\0'; - poolfs = slash + 1; + free (mnt_point); + return NULL; } { @@ -317,6 +221,8 @@ find_root_device_from_libzfs (const char *dir) } free (poolname); + if (poolfs) + free (poolfs); return device; } diff --git a/kern/emu/misc.c b/kern/emu/misc.c index 851da7a07..0d71ef3d6 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -44,6 +45,15 @@ # include #endif +#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) +# include +# include +#endif + +#ifdef HAVE_GETFSSTAT +# include +#endif + int verbosity; void @@ -236,6 +246,114 @@ get_win32_path (const char *path) } #endif +#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) +/* Not ZFS-specific in itself, but for now it's only used by ZFS-related code. */ +char * +grub_find_mount_point_from_dir (const char *dir) +{ + struct stat st; + typeof (st.st_dev) fs; + char *prev, *next, *slash, *statdir; + + if (stat (dir, &st) == -1) + error (1, errno, "stat (%s)", dir); + + fs = st.st_dev; + + prev = xstrdup (dir); + + while (1) + { + /* Remove last slash. */ + next = xstrdup (prev); + slash = strrchr (next, '/'); + if (! slash) + { + free (next); + free (prev); + return NULL; + } + *slash = '\0'; + + /* A next empty string counts as /. */ + if (next[0] == '\0') + statdir = "/"; + else + statdir = next; + + if (stat (statdir, &st) == -1) + error (1, errno, "stat (%s)", next); + + if (st.st_dev != fs) + { + /* Found mount point. */ + free (next); + return prev; + } + + free (prev); + prev = next; + + /* We've already seen an empty string, which means we + reached /. Nothing left to do. */ + if (prev[0] == '\0') + { + free (prev); + return xstrdup ("/"); + } + } +} +#endif + +#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) + +/* ZFS has similar problems to those of btrfs (see above). */ +void +grub_find_zpool_from_mount_point (const char *mnt_point, char **poolname, char **poolfs) +{ + char *slash; + + *poolname = *poolfs = NULL; + +#ifdef HAVE_GETFSSTAT + { + int mnt_count = getfsstat (NULL, 0, MNT_WAIT); + if (mnt_count == -1) + error (1, errno, "getfsstat"); + + struct statfs *mnt = xmalloc (mnt_count * sizeof (*mnt)); + + mnt_count = getfsstat (mnt, mnt_count * sizeof (*mnt), MNT_WAIT); + if (mnt_count == -1) + error (1, errno, "getfsstat"); + + unsigned int i; + for (i = 0; i < (unsigned) mnt_count; i++) + if (!strcmp (mnt[i].f_fstypename, "zfs") + && !strcmp (mnt[i].f_mntonname, mnt_point)) + { + *poolname = xstrdup (mnt[i].f_mntfromname); + break; + } + + free (mnt); + } +#endif + + if (! *poolname) + return; + + slash = strchr (*poolname, '/'); + if (slash) + { + *slash = '\0'; + *poolfs = xstrdup (slash + 1); + } + else + *poolfs = xstrdup (""); +} +#endif + /* This function never prints trailing slashes (so that its output can be appended a slash unconditionally). */ char * @@ -243,16 +361,26 @@ grub_make_system_path_relative_to_its_root (const char *path) { struct stat st; char *p, *buf, *buf2, *buf3; + char *mnt_point, *poolname = NULL, *poolfs = NULL, *ret; uintptr_t offset = 0; dev_t num; size_t len; /* canonicalize. */ p = canonicalize_file_name (path); - if (p == NULL) grub_util_error ("failed to get canonical path of %s", path); +#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) + /* For ZFS sub-pool filesystems, could be extended to others (btrfs?). */ + mnt_point = grub_find_mount_point_from_dir (p); + if (mnt_point) + { + grub_find_zpool_from_mount_point (mnt_point, &poolname, &poolfs); + free (mnt_point); + } +#endif + len = strlen (p) + 1; buf = xstrdup (p); free (p); @@ -331,7 +459,15 @@ grub_make_system_path_relative_to_its_root (const char *path) len--; } - return buf3; + if (poolfs) + { + ret = xasprintf ("/%s@%s", poolfs, buf3); + free (buf3); + } + else + ret = buf3; + + return ret; } #ifdef HAVE_DEVICE_MAPPER From 443a6c4b21198a80b9723c2aff7b787fad6c291c Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 1 Aug 2010 23:08:03 +0200 Subject: [PATCH 085/174] Skip unexpected descriptors --- bus/usb/usb.c | 13 +++++++++++-- include/grub/usbdesc.h | 6 ++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bus/usb/usb.c b/bus/usb/usb.c index a961e0b48..b3eaeba0e 100644 --- a/bus/usb/usb.c +++ b/bus/usb/usb.c @@ -209,14 +209,23 @@ grub_usb_device_initialize (grub_usb_device_t dev) goto fail; /* Skip the configuration descriptor. */ - pos = sizeof (struct grub_usb_desc_config); + pos = dev->config[i].descconf->length; /* Read all interfaces. */ for (currif = 0; currif < dev->config[i].descconf->numif; currif++) { + while (pos < config.totallen + && ((struct grub_usb_desc *)&data[pos])->type + != GRUB_USB_DESCRIPTOR_INTERFACE) + pos += ((struct grub_usb_desc *)&data[pos])->length; dev->config[i].interf[currif].descif = (struct grub_usb_desc_if *) &data[pos]; - pos += sizeof (struct grub_usb_desc_if); + pos += dev->config[i].interf[currif].descif->length; + + while (pos < config.totallen + && ((struct grub_usb_desc *)&data[pos])->type + != GRUB_USB_DESCRIPTOR_ENDPOINT) + pos += ((struct grub_usb_desc *)&data[pos])->length; /* Point to the first endpoint. */ dev->config[i].interf[currif].descendp diff --git a/include/grub/usbdesc.h b/include/grub/usbdesc.h index 2f711d755..84b723a62 100644 --- a/include/grub/usbdesc.h +++ b/include/grub/usbdesc.h @@ -31,6 +31,12 @@ typedef enum { GRUB_USB_DESCRIPTOR_HUB = 0x29 } grub_usb_descriptor_t; +struct grub_usb_desc +{ + grub_uint8_t length; + grub_uint8_t type; +} __attribute__ ((packed)); + struct grub_usb_desc_device { grub_uint8_t length; From 9c98ae89113d5ccfa1aedf3277805c82f2b5909e Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 1 Aug 2010 23:08:33 +0200 Subject: [PATCH 086/174] Skip non-boot usb_keyboard interface --- term/usb_keyboard.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/term/usb_keyboard.c b/term/usb_keyboard.c index 1c0ce228f..f2d74d71c 100644 --- a/term/usb_keyboard.c +++ b/term/usb_keyboard.c @@ -63,6 +63,9 @@ static char keyboard_map_shift[128] = #define USB_HID_SET_IDLE 0x0A #define USB_HID_SET_PROTOCOL 0x0B +#define USB_HID_BOOT_SUBCLASS 0x01 +#define USB_HID_KBD_PROTOCOL 0x01 + static int grub_usb_keyboard_checkkey (struct grub_term_input *term); static int grub_usb_keyboard_getkey (struct grub_term_input *term); static int grub_usb_keyboard_getkeystatus (struct grub_term_input *term); @@ -120,6 +123,12 @@ grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) || usbdev->descdev.subclass != 0 || usbdev->descdev.protocol != 0) return 0; + if (usbdev->config[configno].interf[interfno].descif->subclass + != USB_HID_BOOT_SUBCLASS + || usbdev->config[configno].interf[interfno].descif->protocol + != USB_HID_KBD_PROTOCOL) + return 0; + grub_printf ("HID found!\n"); /* Place the device in boot mode. */ From f7abdefbdd861ec752cf3df6eda42c26c522cdb9 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 1 Aug 2010 23:12:24 +0200 Subject: [PATCH 087/174] 2010-08-01 Robert Millan Make it even harder to use uninitialized `libzfs_handle' (and make the interface a bit simpler). * include/grub/util/misc.h (grub_util_init_libzfs) (libzfs_handle): Remove. (grub_get_libzfs_handle): New prototype. * util/misc.c [HAVE_LIBZFS] (libzfs_handle): Add `static' attribute. (grub_util_init_libzfs): Remove. (grub_get_libzfs_handle): New function. * kern/emu/getroot.c (find_root_device_from_libzfs): Use grub_get_libzfs_handle() to obtain a libzfs handle instead of accessing `libzfs_handle' directly. --- ChangeLog | 18 ++++++++++++++++++ include/grub/util/misc.h | 3 +-- kern/emu/getroot.c | 4 +--- util/misc.c | 14 +++++++------- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2956129b3..d4a63c4ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2010-08-01 Robert Millan + + Make it even harder to use uninitialized `libzfs_handle' (and + make the interface a bit simpler). + + * include/grub/util/misc.h (grub_util_init_libzfs) + (libzfs_handle): Remove. + (grub_get_libzfs_handle): New prototype. + + * util/misc.c [HAVE_LIBZFS] (libzfs_handle): Add `static' + attribute. + (grub_util_init_libzfs): Remove. + (grub_get_libzfs_handle): New function. + + * kern/emu/getroot.c (find_root_device_from_libzfs): Use + grub_get_libzfs_handle() to obtain a libzfs handle instead of + accessing `libzfs_handle' directly. + 2010-08-01 Robert Millan * include/grub/emu/misc.h (grub_find_mount_point_from_dir) diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h index 3614c79c2..7ce3d3291 100644 --- a/include/grub/util/misc.h +++ b/include/grub/util/misc.h @@ -61,7 +61,6 @@ char *canonicalize_file_name (const char *path); void grub_util_init_nls (void); -void grub_util_init_libzfs (void); -extern libzfs_handle_t *libzfs_handle; +libzfs_handle_t *grub_get_libzfs_handle (void); #endif /* ! GRUB_UTIL_MISC_HEADER */ diff --git a/kern/emu/getroot.c b/kern/emu/getroot.c index 32044536d..ee6e1c7ba 100644 --- a/kern/emu/getroot.c +++ b/kern/emu/getroot.c @@ -197,9 +197,7 @@ find_root_device_from_libzfs (const char *dir) nvlist_t **nvlist_array; unsigned int nvlist_count; - grub_util_init_libzfs (); - - zpool = zpool_open (libzfs_handle, poolname); + zpool = zpool_open (grub_get_libzfs_handle (), poolname); nvlist = zpool_get_config (zpool, NULL); if (nvlist_lookup_nvlist (nvlist, "vdev_tree", &nvlist) != 0) diff --git a/util/misc.c b/util/misc.c index 2eff256bf..274c182c2 100644 --- a/util/misc.c +++ b/util/misc.c @@ -296,27 +296,27 @@ grub_util_init_nls (void) } #ifdef HAVE_LIBZFS -libzfs_handle_t *libzfs_handle; +static libzfs_handle_t *libzfs_handle; static void fini_libzfs (void) { libzfs_fini (libzfs_handle); } -#endif -void -grub_util_init_libzfs (void) +libzfs_handle_t * +grub_get_libzfs_handle (void) { -#ifdef HAVE_LIBZFS if (! libzfs_handle) { libzfs_handle = libzfs_init (); atexit (fini_libzfs); } -#endif + + return libzfs_handle; } -#endif +#endif /* HAVE_LIBZFS */ +#endif /* GRUB_UTIL */ int grub_dl_ref (grub_dl_t mod) From c7db243b92d530b870bc71ae85e74bb8e3377cf0 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 1 Aug 2010 23:21:09 +0200 Subject: [PATCH 088/174] 2010-08-01 Robert Millan * util/grub.d/10_kfreebsd.in: Initialize ${kfreebsd_device} as the kFreeBSD device name, except on ZFS where the filesystem label is used. (kfreebsd_entry): On ZFS root, load `opensolaris.ko', `zfs.ko' and `/boot/zfs/zpool.cache'. Set mountfrom kernel variable using ${kfreebsd_device}. --- ChangeLog | 9 +++++++++ util/grub.d/10_kfreebsd.in | 26 +++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d4a63c4ec..65d6cb667 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-08-01 Robert Millan + + * util/grub.d/10_kfreebsd.in: Initialize ${kfreebsd_device} as the + kFreeBSD device name, except on ZFS where the filesystem label is + used. + (kfreebsd_entry): On ZFS root, load `opensolaris.ko', `zfs.ko' and + `/boot/zfs/zpool.cache'. + Set mountfrom kernel variable using ${kfreebsd_device}. + 2010-08-01 Robert Millan Make it even harder to use uninitialized `libzfs_handle' (and diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in index f32da3013..bc5201ab9 100644 --- a/util/grub.d/10_kfreebsd.in +++ b/util/grub.d/10_kfreebsd.in @@ -74,8 +74,27 @@ EOF EOF fi + case "${kfreebsd_fs}" in + zfs) + test -e "${module_dir}/opensolaris.ko" + test -e "${module_dir}/zfs.ko" + test -e "${dirname}/zfs/zpool.cache" + + printf '%s\n' "${prepare_module_dir_cache}" + cat << EOF + kfreebsd_module_elf ${module_dir_rel}/opensolaris.ko + kfreebsd_module_elf ${module_dir_rel}/zfs.ko +EOF + + printf '%s\n' "${prepare_boot_cache}" cat << EOF - set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${GRUB_DEVICE} + kfreebsd_module ${rel_dirname}/zfs/zpool.cache type=/boot/zfs/zpool.cache +EOF + ;; + esac + + cat << EOF + set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${kfreebsd_device} set kFreeBSD.vfs.root.mountfrom.options=rw } EOF @@ -105,6 +124,11 @@ while [ "x$list" != "x" ] ; do *) kfreebsd_fs=${GRUB_FS} ;; esac + case ${GRUB_FS} in + zfs) kfreebsd_device=$(grub-probe -t label --device ${GRUB_DEVICE}) ;; + *) kfreebsd_device=${GRUB_DEVICE} ;; + esac + version=`echo $basename | sed -e "s,^[^0-9]*-,,g;s/\.gz$//g"` alt_version=`echo $version | sed -e "s,\.old$,,g"` From a870a783be2eed43b59c7d537a37484ea05a668c Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 2 Aug 2010 09:51:23 -0500 Subject: [PATCH 089/174] * disk/raid.c (insert_array): Select unique numbers for named arrays as well, for use as keys in the disk cache. --- ChangeLog | 5 +++++ disk/raid.c | 29 ++++++++++++++++------------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65d6cb667..83afffca3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-02 Colin Watson + + * disk/raid.c (insert_array): Select unique numbers for named arrays + as well, for use as keys in the disk cache. + 2010-08-01 Robert Millan * util/grub.d/10_kfreebsd.in: Initialize ${kfreebsd_device} as the diff --git a/disk/raid.c b/disk/raid.c index 7dfd4bd81..51a4b00e2 100644 --- a/disk/raid.c +++ b/disk/raid.c @@ -528,25 +528,28 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array, grub_memset (&array->device, 0, sizeof (array->device)); grub_memset (&array->start_sector, 0, sizeof (array->start_sector)); - if (array->name) - goto skip_duplicate_check; - /* Check whether we don't have multiple arrays with the same number. */ - for (p = array_list; p != NULL; p = p->next) - { - if (! p->name && p->number == array->number) - break; - } + if (! array->name) + { + for (p = array_list; p != NULL; p = p->next) + { + if (! p->name && p->number == array->number) + break; + } + } - if (p) + if (array->name || p) { - /* The number is already in use, so we need to find a new one. */ - int i = 0; + /* The number is already in use, so we need to find a new one. + (Or, in the case of named arrays, the array doesn't have its + own number, but we need one that doesn't clash for use as a key + in the disk cache. */ + int i = array->name ? 0x40000000 : 0; while (1) { for (p = array_list; p != NULL; p = p->next) { - if (! p->name && p->number == i) + if (p->number == i) break; } @@ -560,7 +563,7 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array, i++; } } - skip_duplicate_check: + /* mdraid 1.x superblocks have only a name stored not a number. Use it directly as GRUB device. */ if (! array->name) From c9f7ff97cfa5107da90469beb01058c952a433e4 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 3 Aug 2010 11:56:36 +0530 Subject: [PATCH 090/174] * script/execute.c (grub_script_execute_cmdline): Check for NULL as command name case. --- ChangeLog | 5 +++++ script/execute.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 83afffca3..d4da9f96c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-03 BVK Chaitanya + + * script/execute.c (grub_script_execute_cmdline): Check for NULL + as command name case. + 2010-08-02 Colin Watson * disk/raid.c (insert_array): Select unique numbers for named arrays diff --git a/script/execute.c b/script/execute.c index 40f161267..c45a15d29 100644 --- a/script/execute.c +++ b/script/execute.c @@ -207,7 +207,7 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd) /* Lookup the command. */ args = grub_script_execute_arglist_to_argv (cmdline->arglist, &argcount); - if (!args) + if (! args || ! args[0]) return grub_errno; cmdname = args[0]; From 9dd6fd50b4e69a3e4b68120ece98e5657a453a5b Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Tue, 3 Aug 2010 23:51:48 +0200 Subject: [PATCH 091/174] 2010-08-03 Robert Millan Fix grub-emu build. * include/grub/util/misc.h: Move `' to ... * include/grub/emu/misc.h: ... here. * include/grub/util/misc.h (grub_get_libzfs_handle): Move function ... * include/grub/emu/misc.h (grub_get_libzfs_handle): ... here. * util/misc.c: Remove `'. [HAVE_LIBZFS] (libzfs_handle, fini_libzfs) (grub_get_libzfs_handle): Move to ... * kern/emu/misc.c [HAVE_LIBZFS] (__libzfs_handle, fini_libzfs) (grub_get_libzfs_handle): ... here. --- ChangeLog | 16 ++++++++++++++++ include/grub/emu/misc.h | 3 +++ include/grub/util/misc.h | 3 --- kern/emu/misc.c | 27 ++++++++++++++++++++++++++- util/misc.c | 22 ---------------------- 5 files changed, 45 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index d4da9f96c..b3e7bc67f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2010-08-03 Robert Millan + + Fix grub-emu build. + + * include/grub/util/misc.h: Move `' to ... + * include/grub/emu/misc.h: ... here. + + * include/grub/util/misc.h (grub_get_libzfs_handle): Move function ... + * include/grub/emu/misc.h (grub_get_libzfs_handle): ... here. + + * util/misc.c: Remove `'. + [HAVE_LIBZFS] (libzfs_handle, fini_libzfs) + (grub_get_libzfs_handle): Move to ... + * kern/emu/misc.c [HAVE_LIBZFS] (__libzfs_handle, fini_libzfs) + (grub_get_libzfs_handle): ... here. + 2010-08-03 BVK Chaitanya * script/execute.c (grub_script_execute_cmdline): Check for NULL diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index 5047a9406..70cf05e0d 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -21,6 +21,7 @@ #include #include +#include #ifdef __CYGWIN__ # include @@ -75,4 +76,6 @@ extern char * canonicalize_file_name (const char *path); int grub_device_mapper_supported (void); #endif +libzfs_handle_t *grub_get_libzfs_handle (void); + #endif /* GRUB_EMU_MISC_H */ diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h index 7ce3d3291..48dfbb868 100644 --- a/include/grub/util/misc.h +++ b/include/grub/util/misc.h @@ -29,7 +29,6 @@ #include #include #include -#include char *grub_util_get_path (const char *dir, const char *file); size_t grub_util_get_fp_size (FILE *fp); @@ -61,6 +60,4 @@ char *canonicalize_file_name (const char *path); void grub_util_init_nls (void); -libzfs_handle_t *grub_get_libzfs_handle (void); - #endif /* ! GRUB_UTIL_MISC_HEADER */ diff --git a/kern/emu/misc.c b/kern/emu/misc.c index 0d71ef3d6..0838dc3c0 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -45,8 +45,11 @@ # include #endif -#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) +#ifdef HAVE_LIBZFS # include +#endif + +#ifdef HAVE_LIBNVPAIR # include #endif @@ -246,6 +249,28 @@ get_win32_path (const char *path) } #endif +#ifdef HAVE_LIBZFS +static libzfs_handle_t *__libzfs_handle; + +static void +fini_libzfs (void) +{ + libzfs_fini (__libzfs_handle); +} + +libzfs_handle_t * +grub_get_libzfs_handle (void) +{ + if (! __libzfs_handle) + { + __libzfs_handle = libzfs_init (); + atexit (fini_libzfs); + } + + return __libzfs_handle; +} +#endif /* HAVE_LIBZFS */ + #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) /* Not ZFS-specific in itself, but for now it's only used by ZFS-related code. */ char * diff --git a/util/misc.c b/util/misc.c index 274c182c2..21dd211e1 100644 --- a/util/misc.c +++ b/util/misc.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -295,27 +294,6 @@ grub_util_init_nls (void) #endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */ } -#ifdef HAVE_LIBZFS -static libzfs_handle_t *libzfs_handle; - -static void -fini_libzfs (void) -{ - libzfs_fini (libzfs_handle); -} - -libzfs_handle_t * -grub_get_libzfs_handle (void) -{ - if (! libzfs_handle) - { - libzfs_handle = libzfs_init (); - atexit (fini_libzfs); - } - - return libzfs_handle; -} -#endif /* HAVE_LIBZFS */ #endif /* GRUB_UTIL */ int From 62858144fe582fe4a908d277842cd50e00eba634 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Wed, 4 Aug 2010 00:15:29 +0200 Subject: [PATCH 092/174] 2010-08-04 Robert Millan Support OpenSolaris in ZFS device resolution. * configure.ac: Check for getmntany(). * kern/emu/misc.c [HAVE_GETMNTANY]: Include `'. [HAVE_GETMNTANY] (grub_find_zpool_from_mount_point): Add OpenSolaris support. --- ChangeLog | 9 +++++++++ configure.ac | 2 +- kern/emu/misc.c | 24 +++++++++++++++++++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b3e7bc67f..958c55c79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-08-04 Robert Millan + + Support OpenSolaris in ZFS device resolution. + + * configure.ac: Check for getmntany(). + * kern/emu/misc.c [HAVE_GETMNTANY]: Include `'. + [HAVE_GETMNTANY] (grub_find_zpool_from_mount_point): Add OpenSolaris + support. + 2010-08-03 Robert Millan Fix grub-emu build. diff --git a/configure.ac b/configure.ac index 6169a2fb5..41072eb4f 100644 --- a/configure.ac +++ b/configure.ac @@ -247,7 +247,7 @@ else fi # Check for functions and headers. -AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getfsstat) +AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getfsstat getmntany) AC_CHECK_HEADERS(libzfs.h libnvpair.h) # For opendisk() and getrawpartition() on NetBSD. diff --git a/kern/emu/misc.c b/kern/emu/misc.c index 0838dc3c0..5a148c708 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -32,6 +32,10 @@ #include #endif +#ifdef HAVE_GETMNTANY +# include +#endif + #include #include #include @@ -340,7 +344,7 @@ grub_find_zpool_from_mount_point (const char *mnt_point, char **poolname, char * *poolname = *poolfs = NULL; -#ifdef HAVE_GETFSSTAT +#if defined(HAVE_GETFSSTAT) /* FreeBSD and GNU/kFreeBSD */ { int mnt_count = getfsstat (NULL, 0, MNT_WAIT); if (mnt_count == -1) @@ -363,6 +367,24 @@ grub_find_zpool_from_mount_point (const char *mnt_point, char **poolname, char * free (mnt); } +#elif defined(HAVE_GETMNTANY) /* OpenSolaris */ + { + FILE *mnttab = fopen ("/etc/mnttab", "r"); + struct mnttab mp; + struct mnttab mpref = + { + .mnt_special = NULL, + .mnt_mountp = mnt_point, + .mnt_fstype = "zfs", + .mnt_mntopts = NULL, + .mnt_time = NULL, + }; + + if (getmntany (mnttab, &mp, &mpref) == 0) + *poolname = xstrdup (mp.mnt_special); + + fclose (mnttab); + } #endif if (! *poolname) From 0de22aa997fa162d626ed1c4f472bad4915e8e7f Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Wed, 4 Aug 2010 13:29:13 +0200 Subject: [PATCH 093/174] 2010-08-04 Robert Millan * include/grub/emu/misc.h (grub_find_mount_point_from_dir) (grub_find_zpool_from_mount_point): Merge into ... (grub_find_zpool_from_dir): ... this. * kern/emu/misc.c: Likewise. * kern/emu/misc.c (grub_make_system_path_relative_to_its_root): Replace grub_find_mount_point_from_dir() / grub_find_zpool_from_mount_point() with grub_find_zpool_from_dir(). * kern/emu/getroot.c (find_root_device_from_libzfs): Likewise. --- ChangeLog | 13 +++++++++++++ include/grub/emu/misc.h | 6 ++---- kern/emu/getroot.c | 9 ++------- kern/emu/misc.c | 21 ++++++++------------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 958c55c79..daa85e4a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2010-08-04 Robert Millan + + * include/grub/emu/misc.h (grub_find_mount_point_from_dir) + (grub_find_zpool_from_mount_point): Merge into ... + (grub_find_zpool_from_dir): ... this. + * kern/emu/misc.c: Likewise. + + * kern/emu/misc.c + (grub_make_system_path_relative_to_its_root): Replace + grub_find_mount_point_from_dir() / grub_find_zpool_from_mount_point() + with grub_find_zpool_from_dir(). + * kern/emu/getroot.c (find_root_device_from_libzfs): Likewise. + 2010-08-04 Robert Millan Support OpenSolaris in ZFS device resolution. diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h index 70cf05e0d..ebb81a37f 100644 --- a/include/grub/emu/misc.h +++ b/include/grub/emu/misc.h @@ -45,10 +45,8 @@ extern const char *program_name; void grub_init_all (void); void grub_fini_all (void); -char *grub_find_mount_point_from_dir (const char *dir) - __attribute__ ((warn_unused_result)); -void grub_find_zpool_from_mount_point (const char *mnt_point, - char **poolname, char **poolfs); +void grub_find_zpool_from_dir (const char *dir, + char **poolname, char **poolfs); char *grub_make_system_path_relative_to_its_root (const char *path) __attribute__ ((warn_unused_result)); diff --git a/kern/emu/getroot.c b/kern/emu/getroot.c index ee6e1c7ba..321b33bb3 100644 --- a/kern/emu/getroot.c +++ b/kern/emu/getroot.c @@ -181,15 +181,10 @@ find_root_device_from_libzfs (const char *dir) char *device; char *poolname; char *poolfs; - char *mnt_point; - mnt_point = grub_find_mount_point_from_dir (dir); - grub_find_zpool_from_mount_point (mnt_point, &poolname, &poolfs); + grub_find_zpool_from_dir (dir, &poolname, &poolfs); if (! poolname) - { - free (mnt_point); - return NULL; - } + return NULL; { zpool_handle_t *zpool; diff --git a/kern/emu/misc.c b/kern/emu/misc.c index 5a148c708..de22e3bff 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -277,8 +277,8 @@ grub_get_libzfs_handle (void) #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) /* Not ZFS-specific in itself, but for now it's only used by ZFS-related code. */ -char * -grub_find_mount_point_from_dir (const char *dir) +static char * +find_mount_point_from_dir (const char *dir) { struct stat st; typeof (st.st_dev) fs; @@ -332,18 +332,18 @@ grub_find_mount_point_from_dir (const char *dir) } } } -#endif - -#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) /* ZFS has similar problems to those of btrfs (see above). */ void -grub_find_zpool_from_mount_point (const char *mnt_point, char **poolname, char **poolfs) +grub_find_zpool_from_dir (const char *dir, char **poolname, char **poolfs) { char *slash; + char *mnt_point; *poolname = *poolfs = NULL; + mnt_point = find_mount_point_from_dir (dir); + #if defined(HAVE_GETFSSTAT) /* FreeBSD and GNU/kFreeBSD */ { int mnt_count = getfsstat (NULL, 0, MNT_WAIT); @@ -408,7 +408,7 @@ grub_make_system_path_relative_to_its_root (const char *path) { struct stat st; char *p, *buf, *buf2, *buf3; - char *mnt_point, *poolname = NULL, *poolfs = NULL, *ret; + char *poolname = NULL, *poolfs = NULL, *ret; uintptr_t offset = 0; dev_t num; size_t len; @@ -420,12 +420,7 @@ grub_make_system_path_relative_to_its_root (const char *path) #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) /* For ZFS sub-pool filesystems, could be extended to others (btrfs?). */ - mnt_point = grub_find_mount_point_from_dir (p); - if (mnt_point) - { - grub_find_zpool_from_mount_point (mnt_point, &poolname, &poolfs); - free (mnt_point); - } + grub_find_zpool_from_dir (p, &poolname, &poolfs); #endif len = strlen (p) + 1; From d3dd9e80f63b76ad061b02b1c2aac4ed1af67662 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Wed, 4 Aug 2010 14:45:58 +0200 Subject: [PATCH 094/174] 2010-08-04 Robert Millan * configure.ac: Remove checks for getfsstat() and getmntany(). Add checks for `' and `'. * kern/emu/misc.c [HAVE_GETMNTANY]: Remove `'. [HAVE_SYS_PARAM_H]: Include `'. [HAVE_SYS_MOUNT_H]: Include `'. [HAVE_LIBZFS && HAVE_LIBNVPAIR] (find_mount_point_from_dir): Remove function. (grub_find_zpool_from_dir): Use statfs() instead of indirect matching via find_mount_point_from_dir() and getfsstat() / getmntany(). --- ChangeLog | 12 +++++ configure.ac | 4 +- kern/emu/misc.c | 118 ++++-------------------------------------------- 3 files changed, 23 insertions(+), 111 deletions(-) diff --git a/ChangeLog b/ChangeLog index daa85e4a3..417cc4a6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2010-08-04 Robert Millan + + * configure.ac: Remove checks for getfsstat() and getmntany(). + Add checks for `' and `'. + * kern/emu/misc.c [HAVE_GETMNTANY]: Remove `'. + [HAVE_SYS_PARAM_H]: Include `'. + [HAVE_SYS_MOUNT_H]: Include `'. + [HAVE_LIBZFS && HAVE_LIBNVPAIR] (find_mount_point_from_dir): Remove + function. + (grub_find_zpool_from_dir): Use statfs() instead of indirect matching + via find_mount_point_from_dir() and getfsstat() / getmntany(). + 2010-08-04 Robert Millan * include/grub/emu/misc.h (grub_find_mount_point_from_dir) diff --git a/configure.ac b/configure.ac index 41072eb4f..19d782609 100644 --- a/configure.ac +++ b/configure.ac @@ -247,8 +247,8 @@ else fi # Check for functions and headers. -AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getfsstat getmntany) -AC_CHECK_HEADERS(libzfs.h libnvpair.h) +AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf) +AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h) # For opendisk() and getrawpartition() on NetBSD. # Used in util/deviceiter.c and in util/hostdisk.c. diff --git a/kern/emu/misc.c b/kern/emu/misc.c index de22e3bff..b9afa167f 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -32,10 +32,6 @@ #include #endif -#ifdef HAVE_GETMNTANY -# include -#endif - #include #include #include @@ -57,7 +53,11 @@ # include #endif -#ifdef HAVE_GETFSSTAT +#ifdef HAVE_SYS_PARAM_H +# include +#endif + +#ifdef HAVE_SYS_MOUNT_H # include #endif @@ -276,120 +276,20 @@ grub_get_libzfs_handle (void) #endif /* HAVE_LIBZFS */ #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) -/* Not ZFS-specific in itself, but for now it's only used by ZFS-related code. */ -static char * -find_mount_point_from_dir (const char *dir) -{ - struct stat st; - typeof (st.st_dev) fs; - char *prev, *next, *slash, *statdir; - - if (stat (dir, &st) == -1) - error (1, errno, "stat (%s)", dir); - - fs = st.st_dev; - - prev = xstrdup (dir); - - while (1) - { - /* Remove last slash. */ - next = xstrdup (prev); - slash = strrchr (next, '/'); - if (! slash) - { - free (next); - free (prev); - return NULL; - } - *slash = '\0'; - - /* A next empty string counts as /. */ - if (next[0] == '\0') - statdir = "/"; - else - statdir = next; - - if (stat (statdir, &st) == -1) - error (1, errno, "stat (%s)", next); - - if (st.st_dev != fs) - { - /* Found mount point. */ - free (next); - return prev; - } - - free (prev); - prev = next; - - /* We've already seen an empty string, which means we - reached /. Nothing left to do. */ - if (prev[0] == '\0') - { - free (prev); - return xstrdup ("/"); - } - } -} - /* ZFS has similar problems to those of btrfs (see above). */ void grub_find_zpool_from_dir (const char *dir, char **poolname, char **poolfs) { + struct statfs mnt; char *slash; - char *mnt_point; *poolname = *poolfs = NULL; - mnt_point = find_mount_point_from_dir (dir); - -#if defined(HAVE_GETFSSTAT) /* FreeBSD and GNU/kFreeBSD */ - { - int mnt_count = getfsstat (NULL, 0, MNT_WAIT); - if (mnt_count == -1) - error (1, errno, "getfsstat"); - - struct statfs *mnt = xmalloc (mnt_count * sizeof (*mnt)); - - mnt_count = getfsstat (mnt, mnt_count * sizeof (*mnt), MNT_WAIT); - if (mnt_count == -1) - error (1, errno, "getfsstat"); - - unsigned int i; - for (i = 0; i < (unsigned) mnt_count; i++) - if (!strcmp (mnt[i].f_fstypename, "zfs") - && !strcmp (mnt[i].f_mntonname, mnt_point)) - { - *poolname = xstrdup (mnt[i].f_mntfromname); - break; - } - - free (mnt); - } -#elif defined(HAVE_GETMNTANY) /* OpenSolaris */ - { - FILE *mnttab = fopen ("/etc/mnttab", "r"); - struct mnttab mp; - struct mnttab mpref = - { - .mnt_special = NULL, - .mnt_mountp = mnt_point, - .mnt_fstype = "zfs", - .mnt_mntopts = NULL, - .mnt_time = NULL, - }; - - if (getmntany (mnttab, &mp, &mpref) == 0) - *poolname = xstrdup (mp.mnt_special); - - fclose (mnttab); - } -#endif - - if (! *poolname) + if (statfs (dir, &mnt) != 0) return; + *poolname = xstrdup (mnt.f_mntfromname); + slash = strchr (*poolname, '/'); if (slash) { From 02c9030aaeced235008b7ea8a01bf0ab450884a6 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 6 Aug 2010 10:01:54 +0530 Subject: [PATCH 095/174] builds w/o custom DEPDIR --- Makefile.am | 7 ++++--- docs/Makefile.am | 2 +- gentpl.py | 8 ++++++++ grub-core/Makefile.am | 11 ++++------- grub-core/configure.ac | 4 +++- grub-core/modules.def | 36 ++++++++---------------------------- modules.def | 38 ++++++++++++++++++++------------------ 7 files changed, 48 insertions(+), 58 deletions(-) diff --git a/Makefile.am b/Makefile.am index c181a5f77..c7f3614d4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,5 @@ AUTOMAKE_OPTIONS = subdir-objects -DEPDIR = .deps-util SUBDIRS = . grub-core po docs EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def geninit.sh @@ -23,13 +22,15 @@ AM_CCASFLAGS = $(CCASFLAGS_GRUB) include $(srcdir)/modules.am # XXX Use Automake's LEX & YACC support -grub_script.tab.c grub_script.tab.h: $(top_srcdir)/grub-core/script/parser.y +grub_script.tab.h: $(top_srcdir)/grub-core/script/parser.y $(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/grub-core/script/parser.y +grub_script.tab.c: grub_script.tab.h CLEANFILES += grub_script.tab.c grub_script.tab.h # For the lexer. -grub_script.yy.c grub_script.yy.h: $(top_srcdir)/grub-core/script/yylex.l +grub_script.yy.h: $(top_srcdir)/grub-core/script/yylex.l $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(top_srcdir)/grub-core/script/yylex.l +grub_script.yy.c: grub_script.yy.h CLEANFILES += grub_script.yy.c grub_script.yy.h # For libgrub.a diff --git a/docs/Makefile.am b/docs/Makefile.am index ab65a8dd2..1b302d262 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = subdir-objects -AM_MAKEINFOFLAGS = --force --no-split --no-validate +AM_MAKEINFOFLAGS = --force --no-split --no-validate info_TEXINFOS = grub.texi grub_TEXINFOS = fdl.texi diff --git a/gentpl.py b/gentpl.py index d584a0b7d..ba776d642 100644 --- a/gentpl.py +++ b/gentpl.py @@ -17,6 +17,8 @@ GROUPS["sparc64"] = [ "sparc64_ieee1275" ] GROUPS["powerpc"] = [ "powerpc_ieee1275" ] GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"] GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ] +GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ] +GROUPS["pci"] = GROUPS["x86"] + GROUPS["mips"] GROUPS["nonemu"] = GRUB_PLATFORMS[:] GROUPS["nonemu"].remove("emu") @@ -157,6 +159,7 @@ def shared_nodist_sources(): return "[+ FOR nodist_shared +] [+ .nodist_shared + def platform_sources(p): return platform_specific_values(p, "source", "") def platform_nodist_sources(p): return platform_specific_values(p, "nodist", "_nodist") def platform_extra_dist(p): return platform_specific_values(p, "extra_dist", "_extra_dist") +def platform_dependencies(p): return platform_specific_values(p, "dependencies", "_dependencies") def platform_ldadd(p): return platform_specific_values(p, "ldadd", "_ldadd") def platform_cflags(p): return platform_specific_values(p, "cflags", "_cflags") @@ -181,6 +184,7 @@ def module(platform): r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_MODULE) " + platform_ldflags(platform)) r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_MODULE) " + platform_cppflags(platform)) r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(platform)) + # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") @@ -271,6 +275,7 @@ def kernel(platform): r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) " + platform_cppflags(platform)) r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_KERNEL) " + platform_ccasflags(platform)) r += var_set(cname() + "_STRIPFLAGS", "$(AM_STRIPFLAGS) $(STRIPFLAGS_KERNEL) " + platform_stripflags(platform)) + # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") @@ -296,6 +301,7 @@ def image(platform): r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_IMAGE) " + platform_cppflags(platform)) r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_IMAGE) " + platform_ccasflags(platform)) r += var_set(cname() + "_OBJCOPYFLAGS", "$(OBJCOPYFLAGS_IMAGE) " + platform_objcopyflags(platform)) + # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") @@ -322,6 +328,7 @@ def library(platform): r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_LIBRARY) " + platform_cflags(platform)) r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) " + platform_cppflags(platform)) r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) " + platform_ccasflags(platform)) + # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") @@ -364,6 +371,7 @@ def program(platform, test=False): r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_PROGRAM) " + platform_ldflags(platform)) r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM) " + platform_cppflags(platform)) r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM) " + platform_ccasflags(platform)) + # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform)) r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 85433431d..654a7e9a4 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -1,7 +1,6 @@ AUTOMAKE_OPTIONS = subdir-objects SUBDIRS = po -DEPDIR = .deps-core EXTRA_DIST = gentpl.py modules.def Makefile.tpl genmoddep.awk EXTRA_DIST += genmodsrc.sh gensymlist.sh genemuinit.sh genemuinitheader.sh EXTRA_DIST += genfslist.sh gencmdlist.sh genvideolist.sh genhandlerlist.sh @@ -53,17 +52,15 @@ trigtables.c: gentrigtables.c configure.ac CLEANFILES += trigtables.c # XXX Use Automake's LEX & YACC support -# See Recording Dependencies Manually in automake doc for below rules -script/sh_module-lexer.$(OBJEXT):grub_script.tab.h -grub_script.tab.c grub_script.tab.h: $(top_srcdir)/script/parser.y +grub_script.tab.h: $(top_srcdir)/script/parser.y $(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/script/parser.y +grub_script.tab.c: grub_script.tab.h CLEANFILES += grub_script.tab.c grub_script.tab.h # For the lexer. -# See Recording Dependencies Manually in automake doc for below rules -script/sh_module-lexer.$(OBJEXT):grub_script.yy.h -grub_script.yy.c grub_script.yy.h: $(top_srcdir)/script/yylex.l +grub_script.yy.h: $(top_srcdir)/script/yylex.l $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(top_srcdir)/script/yylex.l +grub_script.yy.c: grub_script.yy.h CLEANFILES += grub_script.yy.c grub_script.yy.h include $(srcdir)/modules.am diff --git a/grub-core/configure.ac b/grub-core/configure.ac index 5ba5962a3..691876cac 100644 --- a/grub-core/configure.ac +++ b/grub-core/configure.ac @@ -60,13 +60,15 @@ CCAS=$TARGET_CC grub_CHECK_LINK_DIR if test x"$link_dir" = xyes ; then AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu]) + cp -rp $srcdir/lib/$target_cpu lib/target_cpu if test "$platform" != emu ; then AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform]) fi else mkdir -p include/grub 2>/dev/null rm -rf include/grub/cpu - cp -rp $srcdir/grub-core/include/grub/$target_cpu include/grub/cpu 2>/dev/null + cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null + cp -rp $srcdir/lib/$target_cpu lib/target_cpu 2>/dev/null if test "$platform" != emu ; then rm -rf include/grub/machine cp -rp $srcdir/grub-core/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null diff --git a/grub-core/modules.def b/grub-core/modules.def index 4e4db8d36..8e65f277c 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -584,14 +584,6 @@ module = { module = { name = lsmmap; source = commands/lsmmap.c; - - enable = i386_pc; - enable = i386_qemu; - enable = i386_coreboot; - enable = i386_multiboot; - enable = i386_ieee1275; - enable = mips_yeeloong; - enable = powerpc_ieee1275; }; module = { @@ -1215,12 +1207,7 @@ module = { module = { name = setjmp; - i386 = lib/i386/setjmp.S; - x86_64 = lib/x86_64/setjmp.S; - mips = lib/mips/setjmp.S; - sparc64 = lib/sparc64/setjmp.S; - powerpc = lib/powerpc/setjmp.S; - emu = 'lib/$(target_cpu)/setjmp.S'; + source = lib/target_cpu/setjmp.S; }; module = { @@ -1289,19 +1276,12 @@ module = { module = { name = xnu; - x86_efi = loader/xnu_resume.c; - x86_efi = loader/i386/xnu.c; - x86_efi = loader/macho32.c; - x86_efi = loader/macho64.c; - x86_efi = loader/macho.c; - x86_efi = loader/xnu.c; - - i386_pc = loader/xnu_resume.c; - i386_pc = loader/i386/xnu.c; - i386_pc = loader/macho32.c; - i386_pc = loader/macho64.c; - i386_pc = loader/macho.c; - i386_pc = loader/xnu.c; + source = loader/xnu_resume.c; + source = loader/i386/xnu.c; + source = loader/macho32.c; + source = loader/macho64.c; + source = loader/macho.c; + source = loader/xnu.c; extra_dist = loader/machoXX.c; enable = i386_pc; @@ -1383,7 +1363,7 @@ module = { source = script/function.c; source = script/lexer.c; - nodist = unidata.c; + source = unidata.c; nodist = grub_script.tab.c; nodist = grub_script.yy.c; nodist = grub_script.tab.h; diff --git a/modules.def b/modules.def index 23d7d14cd..8fb97cd40 100644 --- a/modules.def +++ b/modules.def @@ -90,13 +90,16 @@ library = { source = grub-core/script/lexer.c; source = grub-core/script/main.c; source = grub-core/script/script.c; + + nodist = grub_script.yy.h; + nodist = grub_script.tab.h; }; program = { name = grub-bin2h; source = util/bin2h.c; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; + ldflags = '$(LIBINTL)'; mansection = 1; }; @@ -109,8 +112,7 @@ program = { extra_dist = util/grub-mkimagexx.c; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; - + ldflags = '$(LIBINTL)'; cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"'; }; @@ -121,7 +123,7 @@ program = { source = util/grub-mkrelpath.c; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; + ldflags = '$(LIBINTL)'; }; program = { @@ -131,7 +133,7 @@ program = { source = util/grub-script-check.c; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; + ldflags = '$(LIBINTL)'; }; program = { @@ -141,7 +143,7 @@ program = { source = util/grub-editenv.c; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; + ldflags = '$(LIBINTL)'; }; program = { @@ -151,7 +153,7 @@ program = { source = util/grub-mkpasswd-pbkdf2.c; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; + ldflags = '$(LIBINTL)'; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; }; @@ -169,7 +171,7 @@ program = { source = util/grub-pe2elf.c; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; + ldflags = '$(LIBINTL)'; condition = COND_GRUB_PE2ELF; }; @@ -179,7 +181,7 @@ program = { source = util/grub-fstest.c; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; + ldflags = '$(LIBINTL)'; condition = COND_GRUB_FSTEST; }; @@ -187,13 +189,13 @@ program = { name = grub-mkfont; mansection = 1; source = util/grub-mkfont.c; - nodist = grub-core/unidata.c; + source = grub-core/unidata.c; cflags = '$(freetype_cflags)'; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; - ldadd = '$(freetype_libs)'; + ldflags = '$(LIBINTL)'; + ldflags = '$(freetype_libs)'; condition = COND_GRUB_MKFONT; }; @@ -211,8 +213,8 @@ program = { sparc64_ieee1275 = util/ieee1275/devicemap.c; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; - ldadd = '$(LIBUTIL)'; + ldflags = '$(LIBINTL)'; + ldflags = '$(LIBUTIL)'; }; program = { @@ -222,8 +224,8 @@ program = { source = util/grub-probe.c; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; - ldadd = '$(LIBUTIL)'; + ldflags = '$(LIBINTL)'; + ldflags = '$(LIBUTIL)'; }; program = { @@ -240,8 +242,8 @@ program = { sparc64_ieee1275 = util/lvm.c; ldadd = libgrub.a; - ldadd = '$(LIBINTL)'; - ldadd = '$(LIBUTIL)'; + ldflags = '$(LIBINTL)'; + ldflags = '$(LIBUTIL)'; enable = i386_pc; enable = sparc64_ieee1275; From 55dd292477766438556c92fd614cd437c90971f7 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 8 Aug 2010 15:45:33 +0200 Subject: [PATCH 096/174] 2010-08-08 Robert Millan Fix grub-probe invocation. * util/grub.d/10_kfreebsd.in: s/label/fs_label/g. --- ChangeLog | 6 ++++++ util/grub.d/10_kfreebsd.in | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 417cc4a6a..65120fc25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-08-08 Robert Millan + + Fix grub-probe invocation. + + * util/grub.d/10_kfreebsd.in: s/label/fs_label/g. + 2010-08-04 Robert Millan * configure.ac: Remove checks for getfsstat() and getmntany(). diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in index bc5201ab9..29737f990 100644 --- a/util/grub.d/10_kfreebsd.in +++ b/util/grub.d/10_kfreebsd.in @@ -125,7 +125,7 @@ while [ "x$list" != "x" ] ; do esac case ${GRUB_FS} in - zfs) kfreebsd_device=$(grub-probe -t label --device ${GRUB_DEVICE}) ;; + zfs) kfreebsd_device=$(grub-probe -t fs_label --device ${GRUB_DEVICE}) ;; *) kfreebsd_device=${GRUB_DEVICE} ;; esac From 0d8286f32816067967817eceade37e5924b16c5d Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 8 Aug 2010 16:27:58 +0200 Subject: [PATCH 097/174] 2010-08-08 Robert Millan * util/grub.d/10_kfreebsd.in: When files required for ZFS do not exist, issue a proper error message (rely on `ls' for translated strings). --- ChangeLog | 6 ++++++ util/grub.d/10_kfreebsd.in | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65120fc25..df8d040fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-08-08 Robert Millan + + * util/grub.d/10_kfreebsd.in: When files required for ZFS do not + exist, issue a proper error message (rely on `ls' for translated + strings). + 2010-08-08 Robert Millan Fix grub-probe invocation. diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in index 29737f990..3a42de529 100644 --- a/util/grub.d/10_kfreebsd.in +++ b/util/grub.d/10_kfreebsd.in @@ -76,9 +76,10 @@ EOF case "${kfreebsd_fs}" in zfs) - test -e "${module_dir}/opensolaris.ko" - test -e "${module_dir}/zfs.ko" - test -e "${dirname}/zfs/zpool.cache" + for i in "${module_dir}/opensolaris.ko" "${module_dir}/zfs.ko" \ + "${dirname}/zfs/zpool.cache" ; do + ls "$i" > /dev/null + done printf '%s\n' "${prepare_module_dir_cache}" cat << EOF From 7117542069db6660f2d40d5f79a51ab2db0fa89e Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 8 Aug 2010 22:47:32 +0200 Subject: [PATCH 098/174] 2010-08-08 Robert Millan * util/grub-fstest.c (read_file, cmd_cmp): Improve error message. --- ChangeLog | 4 ++++ util/grub-fstest.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index df8d040fd..4d7361472 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-08 Robert Millan + + * util/grub-fstest.c (read_file, cmd_cmp): Improve error message. + 2010-08-08 Robert Millan * util/grub.d/10_kfreebsd.in: When files required for ZFS do not diff --git a/util/grub-fstest.c b/util/grub-fstest.c index f1692c0a3..2c80b964c 100644 --- a/util/grub-fstest.c +++ b/util/grub-fstest.c @@ -157,7 +157,7 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len)) sz = grub_file_read (file, buf, (len > BUF_SIZE) ? BUF_SIZE : len); if (sz < 0) { - grub_util_error ("read error at offset %llu", ofs); + grub_util_error ("read error at offset %llu: %s", ofs, grub_errmsg); break; } @@ -211,7 +211,7 @@ cmd_cmp (char *src, char *dest) { if ((int) fread (buf_1, 1, len, ff) != len) { - grub_util_error ("read error at offset %llu", ofs); + grub_util_error ("read error at offset %llu: %s", ofs, grub_errmsg); return 1; } From 346c207240bf1a21ba212601b3a3647e2e4a17d1 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Mon, 9 Aug 2010 00:11:19 +0200 Subject: [PATCH 099/174] 2010-08-08 Robert Millan Fix path generation for sub-filesystems in ZFS. * kern/emu/misc.c (grub_make_system_path_relative_to_its_root): Add missing slash. --- ChangeLog | 7 +++++++ kern/emu/misc.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4d7361472..3619b00fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-08-08 Robert Millan + + Fix path generation for sub-filesystems in ZFS. + + * kern/emu/misc.c (grub_make_system_path_relative_to_its_root): Add + missing slash. + 2010-08-08 Robert Millan * util/grub-fstest.c (read_file, cmd_cmp): Improve error message. diff --git a/kern/emu/misc.c b/kern/emu/misc.c index b9afa167f..d1a92de30 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -403,7 +403,7 @@ grub_make_system_path_relative_to_its_root (const char *path) if (poolfs) { - ret = xasprintf ("/%s@%s", poolfs, buf3); + ret = xasprintf ("/%s/@%s", poolfs, buf3); free (buf3); } else From 07f360e92dda7197912b1ba4340e3cdbadf7d8af Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Mon, 9 Aug 2010 17:44:24 +0200 Subject: [PATCH 100/174] 2010-08-09 Robert Millan * kern/emu/misc.c (grub_make_system_path_relative_to_its_root): Filter out unused variables on non-ZFS build. --- ChangeLog | 5 +++++ kern/emu/misc.c | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3619b00fa..b0cbd54a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-09 Robert Millan + + * kern/emu/misc.c (grub_make_system_path_relative_to_its_root): Filter + out unused variables on non-ZFS build. + 2010-08-08 Robert Millan Fix path generation for sub-filesystems in ZFS. diff --git a/kern/emu/misc.c b/kern/emu/misc.c index d1a92de30..760471ebb 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -307,12 +307,15 @@ char * grub_make_system_path_relative_to_its_root (const char *path) { struct stat st; - char *p, *buf, *buf2, *buf3; - char *poolname = NULL, *poolfs = NULL, *ret; + char *p, *buf, *buf2, *buf3, *ret; uintptr_t offset = 0; dev_t num; size_t len; +#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) + char *poolfs = NULL; +#endif + /* canonicalize. */ p = canonicalize_file_name (path); if (p == NULL) @@ -320,7 +323,10 @@ grub_make_system_path_relative_to_its_root (const char *path) #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) /* For ZFS sub-pool filesystems, could be extended to others (btrfs?). */ - grub_find_zpool_from_dir (p, &poolname, &poolfs); + { + char *dummy; + grub_find_zpool_from_dir (p, &dummy, &poolfs); + } #endif len = strlen (p) + 1; @@ -401,12 +407,14 @@ grub_make_system_path_relative_to_its_root (const char *path) len--; } +#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) if (poolfs) { ret = xasprintf ("/%s/@%s", poolfs, buf3); free (buf3); } else +#endif ret = buf3; return ret; From cf0c775ed41b7ee256ef496588f5ee2871d63dac Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Tue, 10 Aug 2010 13:43:43 +0200 Subject: [PATCH 101/174] * include/grub/vga.h (grub_vga_gr_write): Add GRUB_MACHINE_PCI_IO_BASE. (grub_vga_gr_read): Likewise. (grub_vga_cr_write): Likewise. (grub_vga_cr_read): Likewise. (grub_vga_sr_write): Likewise. (grub_vga_sr_read): Likewise. (grub_vga_palette_read): Likewise. (grub_vga_palette_write): Likewise. * video/sm712.c (GRUB_SM712_REG_BASE): New definition. (grub_sm712_sr_read): New function. (grub_video_sm712_setup): Use grub_vga_sr_write and grub_sm712_sr_read. * video/sm712_init.c (sm712_init): Substract GRUB_MACHINE_PCI_IO_BASE. --- ChangeLog | 15 + include/grub/vga.h | 41 +- video/sm712.c | 35 +- video/sm712_init.c | 1068 ++++++++++++++++++++++---------------------- 4 files changed, 589 insertions(+), 570 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0cbd54a0..0829eb83e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2010-08-10 Vladimir Serbinenko + + * include/grub/vga.h (grub_vga_gr_write): Add GRUB_MACHINE_PCI_IO_BASE. + (grub_vga_gr_read): Likewise. + (grub_vga_cr_write): Likewise. + (grub_vga_cr_read): Likewise. + (grub_vga_sr_write): Likewise. + (grub_vga_sr_read): Likewise. + (grub_vga_palette_read): Likewise. + (grub_vga_palette_write): Likewise. + * video/sm712.c (GRUB_SM712_REG_BASE): New definition. + (grub_sm712_sr_read): New function. + (grub_video_sm712_setup): Use grub_vga_sr_write and grub_sm712_sr_read. + * video/sm712_init.c (sm712_init): Substract GRUB_MACHINE_PCI_IO_BASE. + 2010-08-09 Robert Millan * kern/emu/misc.c (grub_make_system_path_relative_to_its_root): Filter diff --git a/include/grub/vga.h b/include/grub/vga.h index d4a1523a7..0ca56e37f 100644 --- a/include/grub/vga.h +++ b/include/grub/vga.h @@ -132,64 +132,63 @@ enum static inline void grub_vga_gr_write (grub_uint8_t val, grub_uint8_t addr) { - grub_outb (addr, GRUB_VGA_IO_GR_INDEX); - grub_outb (val, GRUB_VGA_IO_GR_DATA); + grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_GR_INDEX); + grub_outb (val, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_GR_DATA); } static inline grub_uint8_t grub_vga_gr_read (grub_uint8_t addr) { - grub_outb (addr, GRUB_VGA_IO_GR_INDEX); - return grub_inb (GRUB_VGA_IO_GR_DATA); + grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_GR_INDEX); + return grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_GR_DATA); } static inline void grub_vga_cr_write (grub_uint8_t val, grub_uint8_t addr) { - grub_outb (addr, GRUB_VGA_IO_CR_INDEX); - grub_outb (val, GRUB_VGA_IO_CR_DATA); + grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_INDEX); + grub_outb (val, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_DATA); } static inline grub_uint8_t grub_vga_cr_read (grub_uint8_t addr) { - grub_outb (addr, GRUB_VGA_IO_CR_INDEX); - return grub_inb (GRUB_VGA_IO_CR_DATA); + grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_INDEX); + return grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_CR_DATA); } static inline void grub_vga_sr_write (grub_uint8_t val, grub_uint8_t addr) { - grub_outb (addr, GRUB_VGA_IO_SR_INDEX); - grub_outb (val, GRUB_VGA_IO_SR_DATA); + grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_INDEX); + grub_outb (val, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_DATA); } static inline grub_uint8_t grub_vga_sr_read (grub_uint8_t addr) { - grub_outb (addr, GRUB_VGA_IO_SR_INDEX); - return grub_inb (GRUB_VGA_IO_SR_DATA); + grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_INDEX); + return grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_DATA); } static inline void grub_vga_palette_read (grub_uint8_t addr, grub_uint8_t *r, grub_uint8_t *g, grub_uint8_t *b) { - grub_outb (addr, GRUB_VGA_IO_PALLETTE_READ_INDEX); - *r = grub_inb (GRUB_VGA_IO_PALLETTE_DATA); - *g = grub_inb (GRUB_VGA_IO_PALLETTE_DATA); - *b = grub_inb (GRUB_VGA_IO_PALLETTE_DATA); + grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_READ_INDEX); + *r = grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA); + *g = grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA); + *b = grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA); } static inline void grub_vga_palette_write (grub_uint8_t addr, grub_uint8_t r, grub_uint8_t g, grub_uint8_t b) { - grub_outb (addr, GRUB_VGA_IO_PALLETTE_WRITE_INDEX); - grub_outb (r, GRUB_VGA_IO_PALLETTE_DATA); - grub_outb (g, GRUB_VGA_IO_PALLETTE_DATA); - grub_outb (b, GRUB_VGA_IO_PALLETTE_DATA); + grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_WRITE_INDEX); + grub_outb (r, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA); + grub_outb (g, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA); + grub_outb (b, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA); } - #endif diff --git a/video/sm712.c b/video/sm712.c index a58032c42..db7494a62 100644 --- a/video/sm712.c +++ b/video/sm712.c @@ -26,10 +26,12 @@ #include #include #include +#include #include "sm712_init.c" #define GRUB_SM712_TOTAL_MEMORY_SPACE 0x700400 +#define GRUB_SM712_REG_BASE 0x700000 static struct { @@ -61,6 +63,15 @@ grub_video_sm712_video_fini (void) return grub_video_fb_fini (); } +static inline grub_uint8_t +grub_sm712_sr_read (grub_uint8_t addr) +{ + *(volatile grub_uint8_t *) (framebuffer.ptr + GRUB_SM712_REG_BASE + + GRUB_VGA_IO_SR_INDEX) = addr; + return *(volatile grub_uint8_t *) (framebuffer.ptr + GRUB_SM712_REG_BASE + + GRUB_VGA_IO_SR_DATA); +} + static grub_err_t grub_video_sm712_setup (unsigned int width, unsigned int height, unsigned int mode_type, unsigned int mode_mask __attribute__ ((unused))) @@ -148,8 +159,7 @@ grub_video_sm712_setup (unsigned int width, unsigned int height, framebuffer.mapped = 1; /* Initialise SM712. */ - grub_outb (0x18, GRUB_MACHINE_PCI_IO_BASE + 0x3c4); - grub_outb (0x11, GRUB_MACHINE_PCI_IO_BASE + 0x3c5); + grub_vga_sr_write (0x11, 0x18); /* Prevent garbage from appearing on the screen. */ grub_memset (framebuffer.ptr, 0, @@ -159,26 +169,27 @@ grub_video_sm712_setup (unsigned int width, unsigned int height, switch (sm712_init[i].directive) { case 1: - *(volatile grub_uint8_t *) ((char *) framebuffer.ptr + *(volatile grub_uint8_t *) ((char *) framebuffer.ptr + + GRUB_SM712_REG_BASE + sm712_init[i].addr) = sm712_init[i].val; break; case -1: { grub_uint8_t val = *(volatile grub_uint8_t *) - ((char *) framebuffer.ptr + sm712_init[i].addr); + ((char *) framebuffer.ptr + GRUB_SM712_REG_BASE + + sm712_init[i].addr); (void) val; } break; - case 2: - *(volatile grub_uint16_t *) ((char *) framebuffer.ptr - + sm712_init[i].addr) = sm712_init[i].val; - break; - case 4: - *(volatile grub_uint32_t *) ((char *) framebuffer.ptr - + sm712_init[i].addr) = sm712_init[i].val; - break; } + *(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c00c) = 0; + *(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c040) = 0; + *(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c000) = 0x20000; + *(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c010) = 0x1020100; + + (void) grub_sm712_sr_read (0x16); + err = grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target, &framebuffer.mode_info, framebuffer.ptr); if (err) diff --git a/video/sm712_init.c b/video/sm712_init.c index 02c64c453..58dbbbbf9 100644 --- a/video/sm712_init.c +++ b/video/sm712_init.c @@ -6,541 +6,535 @@ static struct grub_uint32_t val; } sm712_init[] = { - {1, 0x7003c4, 0x21}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x62}, - {1, 0x7003c5, 0x7a}, - {1, 0x7003c4, 0x6a}, - {1, 0x7003c5, 0x16}, - {1, 0x7003c4, 0x6b}, - {1, 0x7003c5, 0x2}, - {1, 0x7003c6, 0x0}, - {1, 0x7003c4, 0x0}, - {1, 0x7003c5, 0x1}, - {1, 0x7003c2, 0xeb}, - {1, 0x7003c4, 0x0}, - {1, 0x7003c5, 0x3}, - {1, 0x7003c4, 0x1}, - {1, 0x7003c5, 0x1}, - {1, 0x7003c4, 0x2}, - {1, 0x7003c5, 0xf}, - {1, 0x7003c4, 0x3}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x4}, - {1, 0x7003c5, 0xe}, - {1, 0x7003c4, 0x10}, - {1, 0x7003c5, 0xc8}, - {1, 0x7003c4, 0x11}, - {1, 0x7003c5, 0x40}, - {1, 0x7003c4, 0x12}, - {1, 0x7003c5, 0x14}, - {1, 0x7003c4, 0x13}, - {1, 0x7003c5, 0x60}, - {1, 0x7003c4, 0x14}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x15}, - {1, 0x7003c5, 0xa}, - {1, 0x7003c4, 0x16}, - {1, 0x7003c5, 0x92}, - {1, 0x7003c4, 0x17}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x18}, - {1, 0x7003c5, 0x51}, - {1, 0x7003c4, 0x19}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x1a}, - {1, 0x7003c5, 0x1}, - {1, 0x7003c4, 0x1b}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x1c}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x1d}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x1e}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x1f}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x20}, - {1, 0x7003c5, 0xc4}, - {1, 0x7003c4, 0x21}, - {1, 0x7003c5, 0x30}, - {1, 0x7003c4, 0x22}, - {1, 0x7003c5, 0x2}, - {1, 0x7003c4, 0x23}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x24}, - {1, 0x7003c5, 0x1}, - {1, 0x7003c4, 0x30}, - {1, 0x7003c5, 0x28}, - {1, 0x7003c4, 0x31}, - {1, 0x7003c5, 0x3}, - {1, 0x7003c4, 0x32}, - {1, 0x7003c5, 0x24}, - {1, 0x7003c4, 0x33}, - {1, 0x7003c5, 0x9}, - {1, 0x7003c4, 0x34}, - {1, 0x7003c5, 0xc0}, - {1, 0x7003c4, 0x35}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x36}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x37}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x38}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x39}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x3a}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x3b}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x3c}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x3d}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x3e}, - {1, 0x7003c5, 0x3}, - {1, 0x7003c4, 0x3f}, - {1, 0x7003c5, 0xff}, - {1, 0x7003c4, 0x40}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x41}, - {1, 0x7003c5, 0xfc}, - {1, 0x7003c4, 0x42}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x43}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x44}, - {1, 0x7003c5, 0x20}, - {1, 0x7003c4, 0x45}, - {1, 0x7003c5, 0x18}, - {1, 0x7003c4, 0x46}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x47}, - {1, 0x7003c5, 0xfc}, - {1, 0x7003c4, 0x48}, - {1, 0x7003c5, 0x20}, - {1, 0x7003c4, 0x49}, - {1, 0x7003c5, 0xc}, - {1, 0x7003c4, 0x4a}, - {1, 0x7003c5, 0x44}, - {1, 0x7003c4, 0x4b}, - {1, 0x7003c5, 0x20}, - {1, 0x7003c4, 0x4c}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x4d}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x4e}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x4f}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x50}, - {1, 0x7003c5, 0x6}, - {1, 0x7003c4, 0x51}, - {1, 0x7003c5, 0x68}, - {1, 0x7003c4, 0x52}, - {1, 0x7003c5, 0xa7}, - {1, 0x7003c4, 0x53}, - {1, 0x7003c5, 0x7f}, - {1, 0x7003c4, 0x54}, - {1, 0x7003c5, 0x83}, - {1, 0x7003c4, 0x55}, - {1, 0x7003c5, 0x24}, - {1, 0x7003c4, 0x56}, - {1, 0x7003c5, 0xff}, - {1, 0x7003c4, 0x57}, - {1, 0x7003c5, 0x3}, - {1, 0x7003c4, 0x58}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x59}, - {1, 0x7003c5, 0x60}, - {1, 0x7003c4, 0x5a}, - {1, 0x7003c5, 0x59}, - {1, 0x7003c4, 0x5b}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x5c}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x5d}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x5e}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x5f}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x60}, - {1, 0x7003c5, 0x1}, - {1, 0x7003c4, 0x61}, - {1, 0x7003c5, 0x80}, - {1, 0x7003c4, 0x63}, - {1, 0x7003c5, 0x1a}, - {1, 0x7003c4, 0x64}, - {1, 0x7003c5, 0x1a}, - {1, 0x7003c4, 0x65}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x66}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x67}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x68}, - {1, 0x7003c5, 0x50}, - {1, 0x7003c4, 0x69}, - {1, 0x7003c5, 0x3}, - {1, 0x7003c4, 0x6c}, - {1, 0x7003c5, 0x52}, - {1, 0x7003c4, 0x6d}, - {1, 0x7003c5, 0x89}, - {1, 0x7003c4, 0x6e}, - {1, 0x7003c5, 0x9}, - {1, 0x7003c4, 0x6f}, - {1, 0x7003c5, 0x2}, - {1, 0x7003c4, 0x70}, - {1, 0x7003c5, 0x4}, - {1, 0x7003c4, 0x71}, - {1, 0x7003c5, 0x45}, - {1, 0x7003c4, 0x72}, - {1, 0x7003c5, 0x30}, - {1, 0x7003c4, 0x73}, - {1, 0x7003c5, 0x30}, - {1, 0x7003c4, 0x74}, - {1, 0x7003c5, 0x40}, - {1, 0x7003c4, 0x75}, - {1, 0x7003c5, 0x20}, - {1, 0x7003c4, 0x80}, - {1, 0x7003c5, 0xff}, - {1, 0x7003c4, 0x81}, - {1, 0x7003c5, 0x7}, - {1, 0x7003c4, 0x82}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x83}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x84}, - {1, 0x7003c5, 0x8}, - {1, 0x7003c4, 0x85}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x86}, - {1, 0x7003c5, 0x42}, - {1, 0x7003c4, 0x87}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x88}, - {1, 0x7003c5, 0x59}, - {1, 0x7003c4, 0x89}, - {1, 0x7003c5, 0x2}, - {1, 0x7003c4, 0x8a}, - {1, 0x7003c5, 0x44}, - {1, 0x7003c4, 0x8b}, - {1, 0x7003c5, 0x2}, - {1, 0x7003c4, 0x8c}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x8d}, - {1, 0x7003c5, 0xff}, - {1, 0x7003c4, 0x8e}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x8f}, - {1, 0x7003c5, 0x3a}, - {1, 0x7003c4, 0x90}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x91}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x92}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0x93}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0xa0}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0xa1}, - {1, 0x7003c5, 0x10}, - {1, 0x7003c4, 0xa2}, - {1, 0x7003c5, 0x8}, - {1, 0x7003c4, 0xa3}, - {1, 0x7003c5, 0x0}, - {1, 0x7003c4, 0xa4}, - {1, 0x7003c5, 0x2}, - {1, 0x7003c4, 0xa5}, - {1, 0x7003c5, 0xed}, - {1, 0x7003c4, 0xa6}, - {1, 0x7003c5, 0xed}, - {1, 0x7003c4, 0xa7}, - {1, 0x7003c5, 0xed}, - {1, 0x7003c4, 0xa8}, - {1, 0x7003c5, 0x7b}, - {1, 0x7003c4, 0xa9}, - {1, 0x7003c5, 0xfb}, - {1, 0x7003c4, 0xaa}, - {1, 0x7003c5, 0xff}, - {1, 0x7003c4, 0xab}, - {1, 0x7003c5, 0xff}, - {1, 0x7003c4, 0xac}, - {1, 0x7003c5, 0x97}, - {1, 0x7003c4, 0xad}, - {1, 0x7003c5, 0xef}, - {1, 0x7003c4, 0xae}, - {1, 0x7003c5, 0xbf}, - {1, 0x7003c4, 0xaf}, - {1, 0x7003c5, 0xdf}, - {1, 0x7003ce, 0x0}, - {1, 0x7003cf, 0x0}, - {1, 0x7003ce, 0x1}, - {1, 0x7003cf, 0x0}, - {1, 0x7003ce, 0x2}, - {1, 0x7003cf, 0x0}, - {1, 0x7003ce, 0x3}, - {1, 0x7003cf, 0x0}, - {1, 0x7003ce, 0x4}, - {1, 0x7003cf, 0x0}, - {1, 0x7003ce, 0x5}, - {1, 0x7003cf, 0x40}, - {1, 0x7003ce, 0x6}, - {1, 0x7003cf, 0x5}, - {1, 0x7003ce, 0x7}, - {1, 0x7003cf, 0xf}, - {1, 0x7003ce, 0x8}, - {1, 0x7003cf, 0xff}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x0}, - {-1, 0x7003c1, 0x3e}, - {1, 0x7003c0, 0x0}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x1}, - {-1, 0x7003c1, 0x3b}, - {1, 0x7003c0, 0x1}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x2}, - {-1, 0x7003c1, 0x3f}, - {1, 0x7003c0, 0x2}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x3}, - {-1, 0x7003c1, 0x3f}, - {1, 0x7003c0, 0x3}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x4}, - {-1, 0x7003c1, 0x3b}, - {1, 0x7003c0, 0x4}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x5}, - {-1, 0x7003c1, 0x2f}, - {1, 0x7003c0, 0x5}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x6}, - {-1, 0x7003c1, 0x3f}, - {1, 0x7003c0, 0x6}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x7}, - {-1, 0x7003c1, 0x3f}, - {1, 0x7003c0, 0x7}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x8}, - {-1, 0x7003c1, 0x3f}, - {1, 0x7003c0, 0x8}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x9}, - {-1, 0x7003c1, 0x3d}, - {1, 0x7003c0, 0x9}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0xa}, - {-1, 0x7003c1, 0x1f}, - {1, 0x7003c0, 0xa}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0xb}, - {-1, 0x7003c1, 0x1f}, - {1, 0x7003c0, 0xb}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0xc}, - {-1, 0x7003c1, 0x3f}, - {1, 0x7003c0, 0xc}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0xd}, - {-1, 0x7003c1, 0x3f}, - {1, 0x7003c0, 0xd}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0xe}, - {-1, 0x7003c1, 0x3f}, - {1, 0x7003c0, 0xe}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0xf}, - {-1, 0x7003c1, 0x2e}, - {1, 0x7003c0, 0xf}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x10}, - {-1, 0x7003c1, 0x0}, - {1, 0x7003c0, 0x41}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x11}, - {-1, 0x7003c1, 0x0}, - {1, 0x7003c0, 0x0}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x12}, - {-1, 0x7003c1, 0x0}, - {1, 0x7003c0, 0xf}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x13}, - {-1, 0x7003c1, 0x0}, - {1, 0x7003c0, 0x0}, - {-1, 0x7003da, 0x5}, - {1, 0x7003c0, 0x14}, - {-1, 0x7003c1, 0x0}, - {1, 0x7003c0, 0x0}, - {1, 0x7003d4, 0x0}, - {1, 0x7003d5, 0xa3}, - {1, 0x7003d4, 0x1}, - {1, 0x7003d5, 0x7f}, - {1, 0x7003d4, 0x2}, - {1, 0x7003d5, 0x7f}, - {1, 0x7003d4, 0x3}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x4}, - {1, 0x7003d5, 0x85}, - {1, 0x7003d4, 0x5}, - {1, 0x7003d5, 0x16}, - {1, 0x7003d4, 0x6}, - {1, 0x7003d5, 0x24}, - {1, 0x7003d4, 0x7}, - {1, 0x7003d5, 0xf5}, - {1, 0x7003d4, 0x8}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x9}, - {1, 0x7003d5, 0x60}, - {1, 0x7003d4, 0xa}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0xb}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0xc}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0xd}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0xe}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0xf}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x10}, - {1, 0x7003d5, 0x3}, - {1, 0x7003d4, 0x11}, - {1, 0x7003d5, 0x9}, - {1, 0x7003d4, 0x12}, - {1, 0x7003d5, 0xff}, - {1, 0x7003d4, 0x13}, - {1, 0x7003d5, 0x80}, - {1, 0x7003d4, 0x14}, - {1, 0x7003d5, 0x40}, - {1, 0x7003d4, 0x15}, - {1, 0x7003d5, 0xff}, - {1, 0x7003d4, 0x16}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x17}, - {1, 0x7003d5, 0xe3}, - {1, 0x7003d4, 0x18}, - {1, 0x7003d5, 0xff}, - {1, 0x7003d4, 0x30}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x31}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x32}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x33}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x34}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x35}, - {1, 0x7003d5, 0x80}, - {1, 0x7003d4, 0x36}, - {1, 0x7003d5, 0x2}, - {1, 0x7003d4, 0x37}, - {1, 0x7003d5, 0x20}, - {1, 0x7003d4, 0x38}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x39}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x3a}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x3b}, - {1, 0x7003d5, 0x40}, - {1, 0x7003d4, 0x3c}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x3d}, - {1, 0x7003d5, 0xff}, - {1, 0x7003d4, 0x3e}, - {1, 0x7003d5, 0x46}, - {1, 0x7003d4, 0x3f}, - {1, 0x7003d5, 0x91}, - {1, 0x7003d4, 0x40}, - {1, 0x7003d5, 0xa3}, - {1, 0x7003d4, 0x41}, - {1, 0x7003d5, 0x7f}, - {1, 0x7003d4, 0x42}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x43}, - {1, 0x7003d5, 0x86}, - {1, 0x7003d4, 0x44}, - {1, 0x7003d5, 0x15}, - {1, 0x7003d4, 0x45}, - {1, 0x7003d5, 0x24}, - {1, 0x7003d4, 0x46}, - {1, 0x7003d5, 0xff}, - {1, 0x7003d4, 0x47}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x48}, - {1, 0x7003d5, 0x1}, - {1, 0x7003d4, 0x49}, - {1, 0x7003d5, 0x7}, - {1, 0x7003d4, 0x4a}, - {1, 0x7003d5, 0xe5}, - {1, 0x7003d4, 0x4b}, - {1, 0x7003d5, 0x20}, - {1, 0x7003d4, 0x4c}, - {1, 0x7003d5, 0x7f}, - {1, 0x7003d4, 0x4d}, - {1, 0x7003d5, 0x57}, - {1, 0x7003d4, 0x90}, - {1, 0x7003d5, 0x55}, - {1, 0x7003d4, 0x91}, - {1, 0x7003d5, 0xd5}, - {1, 0x7003d4, 0x92}, - {1, 0x7003d5, 0x5d}, - {1, 0x7003d4, 0x93}, - {1, 0x7003d5, 0xdd}, - {1, 0x7003d4, 0x94}, - {1, 0x7003d5, 0x86}, - {1, 0x7003d4, 0x95}, - {1, 0x7003d5, 0x17}, - {1, 0x7003d4, 0x96}, - {1, 0x7003d5, 0x8e}, - {1, 0x7003d4, 0x97}, - {1, 0x7003d5, 0xaa}, - {1, 0x7003d4, 0x98}, - {1, 0x7003d5, 0x8a}, - {1, 0x7003d4, 0x99}, - {1, 0x7003d5, 0xa3}, - {1, 0x7003d4, 0x9a}, - {1, 0x7003d5, 0xde}, - {1, 0x7003d4, 0x9b}, - {1, 0x7003d5, 0xab}, - {1, 0x7003d4, 0x9c}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x9d}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x9e}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0x9f}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0xa0}, - {1, 0x7003d5, 0x2}, - {1, 0x7003d4, 0xa1}, - {1, 0x7003d5, 0x2}, - {1, 0x7003d4, 0xa2}, - {1, 0x7003d5, 0x2}, - {1, 0x7003d4, 0xa3}, - {1, 0x7003d5, 0x15}, - {1, 0x7003d4, 0xa4}, - {1, 0x7003d5, 0x2}, - {1, 0x7003d4, 0xa5}, - {1, 0x7003d5, 0x6}, - {1, 0x7003d4, 0xa6}, - {1, 0x7003d5, 0x0}, - {1, 0x7003d4, 0xa7}, - {1, 0x7003d5, 0x0}, - {1, 0x7003c2, 0x67}, - {4, 0x40c00c, 0x0}, - {4, 0x40c040, 0x0}, - {4, 0x40c000, 0x20000}, - {4, 0x40c010, 0x1020100}, - {1, 0x7003c4, 0x16}, - {-1, 0x7003c5, 0x17} + {1, 0x3c4, 0x21}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x62}, + {1, 0x3c5, 0x7a}, + {1, 0x3c4, 0x6a}, + {1, 0x3c5, 0x16}, + {1, 0x3c4, 0x6b}, + {1, 0x3c5, 0x2}, + {1, 0x3c6, 0x0}, + {1, 0x3c4, 0x0}, + {1, 0x3c5, 0x1}, + {1, 0x3c2, 0xeb}, + {1, 0x3c4, 0x0}, + {1, 0x3c5, 0x3}, + {1, 0x3c4, 0x1}, + {1, 0x3c5, 0x1}, + {1, 0x3c4, 0x2}, + {1, 0x3c5, 0xf}, + {1, 0x3c4, 0x3}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x4}, + {1, 0x3c5, 0xe}, + {1, 0x3c4, 0x10}, + {1, 0x3c5, 0xc8}, + {1, 0x3c4, 0x11}, + {1, 0x3c5, 0x40}, + {1, 0x3c4, 0x12}, + {1, 0x3c5, 0x14}, + {1, 0x3c4, 0x13}, + {1, 0x3c5, 0x60}, + {1, 0x3c4, 0x14}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x15}, + {1, 0x3c5, 0xa}, + {1, 0x3c4, 0x16}, + {1, 0x3c5, 0x92}, + {1, 0x3c4, 0x17}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x18}, + {1, 0x3c5, 0x51}, + {1, 0x3c4, 0x19}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x1a}, + {1, 0x3c5, 0x1}, + {1, 0x3c4, 0x1b}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x1c}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x1d}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x1e}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x1f}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x20}, + {1, 0x3c5, 0xc4}, + {1, 0x3c4, 0x21}, + {1, 0x3c5, 0x30}, + {1, 0x3c4, 0x22}, + {1, 0x3c5, 0x2}, + {1, 0x3c4, 0x23}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x24}, + {1, 0x3c5, 0x1}, + {1, 0x3c4, 0x30}, + {1, 0x3c5, 0x28}, + {1, 0x3c4, 0x31}, + {1, 0x3c5, 0x3}, + {1, 0x3c4, 0x32}, + {1, 0x3c5, 0x24}, + {1, 0x3c4, 0x33}, + {1, 0x3c5, 0x9}, + {1, 0x3c4, 0x34}, + {1, 0x3c5, 0xc0}, + {1, 0x3c4, 0x35}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x36}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x37}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x38}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x39}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x3a}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x3b}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x3c}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x3d}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x3e}, + {1, 0x3c5, 0x3}, + {1, 0x3c4, 0x3f}, + {1, 0x3c5, 0xff}, + {1, 0x3c4, 0x40}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x41}, + {1, 0x3c5, 0xfc}, + {1, 0x3c4, 0x42}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x43}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x44}, + {1, 0x3c5, 0x20}, + {1, 0x3c4, 0x45}, + {1, 0x3c5, 0x18}, + {1, 0x3c4, 0x46}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x47}, + {1, 0x3c5, 0xfc}, + {1, 0x3c4, 0x48}, + {1, 0x3c5, 0x20}, + {1, 0x3c4, 0x49}, + {1, 0x3c5, 0xc}, + {1, 0x3c4, 0x4a}, + {1, 0x3c5, 0x44}, + {1, 0x3c4, 0x4b}, + {1, 0x3c5, 0x20}, + {1, 0x3c4, 0x4c}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x4d}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x4e}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x4f}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x50}, + {1, 0x3c5, 0x6}, + {1, 0x3c4, 0x51}, + {1, 0x3c5, 0x68}, + {1, 0x3c4, 0x52}, + {1, 0x3c5, 0xa7}, + {1, 0x3c4, 0x53}, + {1, 0x3c5, 0x7f}, + {1, 0x3c4, 0x54}, + {1, 0x3c5, 0x83}, + {1, 0x3c4, 0x55}, + {1, 0x3c5, 0x24}, + {1, 0x3c4, 0x56}, + {1, 0x3c5, 0xff}, + {1, 0x3c4, 0x57}, + {1, 0x3c5, 0x3}, + {1, 0x3c4, 0x58}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x59}, + {1, 0x3c5, 0x60}, + {1, 0x3c4, 0x5a}, + {1, 0x3c5, 0x59}, + {1, 0x3c4, 0x5b}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x5c}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x5d}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x5e}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x5f}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x60}, + {1, 0x3c5, 0x1}, + {1, 0x3c4, 0x61}, + {1, 0x3c5, 0x80}, + {1, 0x3c4, 0x63}, + {1, 0x3c5, 0x1a}, + {1, 0x3c4, 0x64}, + {1, 0x3c5, 0x1a}, + {1, 0x3c4, 0x65}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x66}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x67}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x68}, + {1, 0x3c5, 0x50}, + {1, 0x3c4, 0x69}, + {1, 0x3c5, 0x3}, + {1, 0x3c4, 0x6c}, + {1, 0x3c5, 0x52}, + {1, 0x3c4, 0x6d}, + {1, 0x3c5, 0x89}, + {1, 0x3c4, 0x6e}, + {1, 0x3c5, 0x9}, + {1, 0x3c4, 0x6f}, + {1, 0x3c5, 0x2}, + {1, 0x3c4, 0x70}, + {1, 0x3c5, 0x4}, + {1, 0x3c4, 0x71}, + {1, 0x3c5, 0x45}, + {1, 0x3c4, 0x72}, + {1, 0x3c5, 0x30}, + {1, 0x3c4, 0x73}, + {1, 0x3c5, 0x30}, + {1, 0x3c4, 0x74}, + {1, 0x3c5, 0x40}, + {1, 0x3c4, 0x75}, + {1, 0x3c5, 0x20}, + {1, 0x3c4, 0x80}, + {1, 0x3c5, 0xff}, + {1, 0x3c4, 0x81}, + {1, 0x3c5, 0x7}, + {1, 0x3c4, 0x82}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x83}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x84}, + {1, 0x3c5, 0x8}, + {1, 0x3c4, 0x85}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x86}, + {1, 0x3c5, 0x42}, + {1, 0x3c4, 0x87}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x88}, + {1, 0x3c5, 0x59}, + {1, 0x3c4, 0x89}, + {1, 0x3c5, 0x2}, + {1, 0x3c4, 0x8a}, + {1, 0x3c5, 0x44}, + {1, 0x3c4, 0x8b}, + {1, 0x3c5, 0x2}, + {1, 0x3c4, 0x8c}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x8d}, + {1, 0x3c5, 0xff}, + {1, 0x3c4, 0x8e}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x8f}, + {1, 0x3c5, 0x3a}, + {1, 0x3c4, 0x90}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x91}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x92}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0x93}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0xa0}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0xa1}, + {1, 0x3c5, 0x10}, + {1, 0x3c4, 0xa2}, + {1, 0x3c5, 0x8}, + {1, 0x3c4, 0xa3}, + {1, 0x3c5, 0x0}, + {1, 0x3c4, 0xa4}, + {1, 0x3c5, 0x2}, + {1, 0x3c4, 0xa5}, + {1, 0x3c5, 0xed}, + {1, 0x3c4, 0xa6}, + {1, 0x3c5, 0xed}, + {1, 0x3c4, 0xa7}, + {1, 0x3c5, 0xed}, + {1, 0x3c4, 0xa8}, + {1, 0x3c5, 0x7b}, + {1, 0x3c4, 0xa9}, + {1, 0x3c5, 0xfb}, + {1, 0x3c4, 0xaa}, + {1, 0x3c5, 0xff}, + {1, 0x3c4, 0xab}, + {1, 0x3c5, 0xff}, + {1, 0x3c4, 0xac}, + {1, 0x3c5, 0x97}, + {1, 0x3c4, 0xad}, + {1, 0x3c5, 0xef}, + {1, 0x3c4, 0xae}, + {1, 0x3c5, 0xbf}, + {1, 0x3c4, 0xaf}, + {1, 0x3c5, 0xdf}, + {1, 0x3ce, 0x0}, + {1, 0x3cf, 0x0}, + {1, 0x3ce, 0x1}, + {1, 0x3cf, 0x0}, + {1, 0x3ce, 0x2}, + {1, 0x3cf, 0x0}, + {1, 0x3ce, 0x3}, + {1, 0x3cf, 0x0}, + {1, 0x3ce, 0x4}, + {1, 0x3cf, 0x0}, + {1, 0x3ce, 0x5}, + {1, 0x3cf, 0x40}, + {1, 0x3ce, 0x6}, + {1, 0x3cf, 0x5}, + {1, 0x3ce, 0x7}, + {1, 0x3cf, 0xf}, + {1, 0x3ce, 0x8}, + {1, 0x3cf, 0xff}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x0}, + {-1, 0x3c1, 0x3e}, + {1, 0x3c0, 0x0}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x1}, + {-1, 0x3c1, 0x3b}, + {1, 0x3c0, 0x1}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x2}, + {-1, 0x3c1, 0x3f}, + {1, 0x3c0, 0x2}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x3}, + {-1, 0x3c1, 0x3f}, + {1, 0x3c0, 0x3}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x4}, + {-1, 0x3c1, 0x3b}, + {1, 0x3c0, 0x4}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x5}, + {-1, 0x3c1, 0x2f}, + {1, 0x3c0, 0x5}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x6}, + {-1, 0x3c1, 0x3f}, + {1, 0x3c0, 0x6}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x7}, + {-1, 0x3c1, 0x3f}, + {1, 0x3c0, 0x7}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x8}, + {-1, 0x3c1, 0x3f}, + {1, 0x3c0, 0x8}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x9}, + {-1, 0x3c1, 0x3d}, + {1, 0x3c0, 0x9}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0xa}, + {-1, 0x3c1, 0x1f}, + {1, 0x3c0, 0xa}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0xb}, + {-1, 0x3c1, 0x1f}, + {1, 0x3c0, 0xb}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0xc}, + {-1, 0x3c1, 0x3f}, + {1, 0x3c0, 0xc}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0xd}, + {-1, 0x3c1, 0x3f}, + {1, 0x3c0, 0xd}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0xe}, + {-1, 0x3c1, 0x3f}, + {1, 0x3c0, 0xe}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0xf}, + {-1, 0x3c1, 0x2e}, + {1, 0x3c0, 0xf}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x10}, + {-1, 0x3c1, 0x0}, + {1, 0x3c0, 0x41}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x11}, + {-1, 0x3c1, 0x0}, + {1, 0x3c0, 0x0}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x12}, + {-1, 0x3c1, 0x0}, + {1, 0x3c0, 0xf}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x13}, + {-1, 0x3c1, 0x0}, + {1, 0x3c0, 0x0}, + {-1, 0x3da, 0x5}, + {1, 0x3c0, 0x14}, + {-1, 0x3c1, 0x0}, + {1, 0x3c0, 0x0}, + {1, 0x3d4, 0x0}, + {1, 0x3d5, 0xa3}, + {1, 0x3d4, 0x1}, + {1, 0x3d5, 0x7f}, + {1, 0x3d4, 0x2}, + {1, 0x3d5, 0x7f}, + {1, 0x3d4, 0x3}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x4}, + {1, 0x3d5, 0x85}, + {1, 0x3d4, 0x5}, + {1, 0x3d5, 0x16}, + {1, 0x3d4, 0x6}, + {1, 0x3d5, 0x24}, + {1, 0x3d4, 0x7}, + {1, 0x3d5, 0xf5}, + {1, 0x3d4, 0x8}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x9}, + {1, 0x3d5, 0x60}, + {1, 0x3d4, 0xa}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0xb}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0xc}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0xd}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0xe}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0xf}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x10}, + {1, 0x3d5, 0x3}, + {1, 0x3d4, 0x11}, + {1, 0x3d5, 0x9}, + {1, 0x3d4, 0x12}, + {1, 0x3d5, 0xff}, + {1, 0x3d4, 0x13}, + {1, 0x3d5, 0x80}, + {1, 0x3d4, 0x14}, + {1, 0x3d5, 0x40}, + {1, 0x3d4, 0x15}, + {1, 0x3d5, 0xff}, + {1, 0x3d4, 0x16}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x17}, + {1, 0x3d5, 0xe3}, + {1, 0x3d4, 0x18}, + {1, 0x3d5, 0xff}, + {1, 0x3d4, 0x30}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x31}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x32}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x33}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x34}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x35}, + {1, 0x3d5, 0x80}, + {1, 0x3d4, 0x36}, + {1, 0x3d5, 0x2}, + {1, 0x3d4, 0x37}, + {1, 0x3d5, 0x20}, + {1, 0x3d4, 0x38}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x39}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x3a}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x3b}, + {1, 0x3d5, 0x40}, + {1, 0x3d4, 0x3c}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x3d}, + {1, 0x3d5, 0xff}, + {1, 0x3d4, 0x3e}, + {1, 0x3d5, 0x46}, + {1, 0x3d4, 0x3f}, + {1, 0x3d5, 0x91}, + {1, 0x3d4, 0x40}, + {1, 0x3d5, 0xa3}, + {1, 0x3d4, 0x41}, + {1, 0x3d5, 0x7f}, + {1, 0x3d4, 0x42}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x43}, + {1, 0x3d5, 0x86}, + {1, 0x3d4, 0x44}, + {1, 0x3d5, 0x15}, + {1, 0x3d4, 0x45}, + {1, 0x3d5, 0x24}, + {1, 0x3d4, 0x46}, + {1, 0x3d5, 0xff}, + {1, 0x3d4, 0x47}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x48}, + {1, 0x3d5, 0x1}, + {1, 0x3d4, 0x49}, + {1, 0x3d5, 0x7}, + {1, 0x3d4, 0x4a}, + {1, 0x3d5, 0xe5}, + {1, 0x3d4, 0x4b}, + {1, 0x3d5, 0x20}, + {1, 0x3d4, 0x4c}, + {1, 0x3d5, 0x7f}, + {1, 0x3d4, 0x4d}, + {1, 0x3d5, 0x57}, + {1, 0x3d4, 0x90}, + {1, 0x3d5, 0x55}, + {1, 0x3d4, 0x91}, + {1, 0x3d5, 0xd5}, + {1, 0x3d4, 0x92}, + {1, 0x3d5, 0x5d}, + {1, 0x3d4, 0x93}, + {1, 0x3d5, 0xdd}, + {1, 0x3d4, 0x94}, + {1, 0x3d5, 0x86}, + {1, 0x3d4, 0x95}, + {1, 0x3d5, 0x17}, + {1, 0x3d4, 0x96}, + {1, 0x3d5, 0x8e}, + {1, 0x3d4, 0x97}, + {1, 0x3d5, 0xaa}, + {1, 0x3d4, 0x98}, + {1, 0x3d5, 0x8a}, + {1, 0x3d4, 0x99}, + {1, 0x3d5, 0xa3}, + {1, 0x3d4, 0x9a}, + {1, 0x3d5, 0xde}, + {1, 0x3d4, 0x9b}, + {1, 0x3d5, 0xab}, + {1, 0x3d4, 0x9c}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x9d}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x9e}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0x9f}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0xa0}, + {1, 0x3d5, 0x2}, + {1, 0x3d4, 0xa1}, + {1, 0x3d5, 0x2}, + {1, 0x3d4, 0xa2}, + {1, 0x3d5, 0x2}, + {1, 0x3d4, 0xa3}, + {1, 0x3d5, 0x15}, + {1, 0x3d4, 0xa4}, + {1, 0x3d5, 0x2}, + {1, 0x3d4, 0xa5}, + {1, 0x3d5, 0x6}, + {1, 0x3d4, 0xa6}, + {1, 0x3d5, 0x0}, + {1, 0x3d4, 0xa7}, + {1, 0x3d5, 0x0}, + {1, 0x3c2, 0x67}, }; From 2764da3ba20d7a5a1cf9d1b905810cb885937cfb Mon Sep 17 00:00:00 2001 From: Yves Blusseau Date: Tue, 10 Aug 2010 16:32:48 +0200 Subject: [PATCH 102/174] 2010-08-10 Yves Blusseau * util/grub-macho2img.c (main): fix typo --- ChangeLog | 4 ++++ util/grub-macho2img.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0829eb83e..86f3246bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-10 Yves Blusseau + + * util/grub-macho2img.c (main): fix typo + 2010-08-10 Vladimir Serbinenko * include/grub/vga.h (grub_vga_gr_write): Add GRUB_MACHINE_PCI_IO_BASE. diff --git a/util/grub-macho2img.c b/util/grub-macho2img.c index 8683587be..23ffafb04 100644 --- a/util/grub-macho2img.c +++ b/util/grub-macho2img.c @@ -79,7 +79,7 @@ main (int argc, char **argv) fclose (in); fclose (out); free (buf); - printf ("Invalid Mach-O fle\n"); + printf ("Invalid Mach-O file\n"); return 4; } curcmd = (struct grub_macho_segment32 *) (buf + sizeof (*head)); From f0206638bf28aa05a8971cb9318a3e126233a6bc Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 11 Aug 2010 04:00:06 +0200 Subject: [PATCH 103/174] * include/grub/vga.h: Add missing grub/pci.h include. --- ChangeLog | 4 ++++ include/grub/vga.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 86f3246bd..1f5efd32a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-10 Vladimir Serbinenko + + * include/grub/vga.h: Add missing grub/pci.h include. + 2010-08-10 Yves Blusseau * util/grub-macho2img.c (main): fix typo diff --git a/include/grub/vga.h b/include/grub/vga.h index 0ca56e37f..5f321d589 100644 --- a/include/grub/vga.h +++ b/include/grub/vga.h @@ -19,6 +19,8 @@ #ifndef GRUB_VGA_HEADER #define GRUB_VGA_HEADER 1 +#include + enum { GRUB_VGA_IO_ARX = 0x3c0, From f947ab49b03350df958528214304ccafd8599b71 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 11 Aug 2010 04:18:07 +0200 Subject: [PATCH 104/174] Remove the dump of sm712 initialisation sequence. * include/grub/pci.h (GRUB_PCI_CLASS_SUBCLASS_VGA): New const. * include/grub/vga.h (GRUB_VGA_IO_ARX_READ): New register. (GRUB_VGA_IO_MISC_WRITE): Likewise. (GRUB_VGA_CR_*): Added many registers. (GRUB_VGA_SR_*): Likewise. (GRUB_VGA_GR_*): Likewise. (grub_vga_write_arx): New function. (grub_video_hw_config): New struct. (grub_vga_set_geometry): New function. * kern/i386/qemu/init.c (load_palette): Use grub_vga_write_arx and GRUB_PCI_CLASS_SUBCLASS_VGA. * video/cirrus.c (grub_video_cirrus_setup): Use grub_vga_set_geometry. * video/sm712.c (grub_sm712_write_reg): New function (grub_sm712_read_reg): Likewise. (grub_sm712_sr_write): Likewise. (grub_sm712_gr_write): Likewise. (grub_sm712_cr_write): Likewise. (grub_sm712_write_arx): Likewise. (grub_sm712_cr_shadow_write): Likewise. (grub_sm712_write_dda_lookup): Likewise. (grub_video_sm712_setup): Initialise the video rather then blindly replay the dump. (main) [TEST]: Add a routine to be able to compile as standalone for tests. * video/sm712_init.c (sm712_init): Removed. (sm712_sr_seq1): New array. (sm712_sr_seq2): Likewise. --- ChangeLog | 32 +++ include/grub/pci.h | 1 + include/grub/vga.h | 183 +++++++++++++- kern/i386/qemu/init.c | 15 +- video/cirrus.c | 35 +-- video/sm712.c | 558 ++++++++++++++++++++++++++++++++++++++++-- video/sm712_init.c | 552 +---------------------------------------- 7 files changed, 772 insertions(+), 604 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f5efd32a..5d9d7a759 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2010-08-11 Vladimir Serbinenko + + Remove the dump of sm712 initialisation sequence. + + * include/grub/pci.h (GRUB_PCI_CLASS_SUBCLASS_VGA): New const. + * include/grub/vga.h (GRUB_VGA_IO_ARX_READ): New register. + (GRUB_VGA_IO_MISC_WRITE): Likewise. + (GRUB_VGA_CR_*): Added many registers. + (GRUB_VGA_SR_*): Likewise. + (GRUB_VGA_GR_*): Likewise. + (grub_vga_write_arx): New function. + (grub_video_hw_config): New struct. + (grub_vga_set_geometry): New function. + * kern/i386/qemu/init.c (load_palette): Use grub_vga_write_arx and + GRUB_PCI_CLASS_SUBCLASS_VGA. + * video/cirrus.c (grub_video_cirrus_setup): Use grub_vga_set_geometry. + * video/sm712.c (grub_sm712_write_reg): New function + (grub_sm712_read_reg): Likewise. + (grub_sm712_sr_write): Likewise. + (grub_sm712_gr_write): Likewise. + (grub_sm712_cr_write): Likewise. + (grub_sm712_write_arx): Likewise. + (grub_sm712_cr_shadow_write): Likewise. + (grub_sm712_write_dda_lookup): Likewise. + (grub_video_sm712_setup): Initialise the video rather then + blindly replay the dump. + (main) [TEST]: Add a routine to be able to compile as standalone for + tests. + * video/sm712_init.c (sm712_init): Removed. + (sm712_sr_seq1): New array. + (sm712_sr_seq2): Likewise. + 2010-08-10 Vladimir Serbinenko * include/grub/vga.h: Add missing grub/pci.h include. diff --git a/include/grub/pci.h b/include/grub/pci.h index e6d6488f0..f34e3d907 100644 --- a/include/grub/pci.h +++ b/include/grub/pci.h @@ -80,6 +80,7 @@ #define GRUB_PCI_STATUS_DEVSEL_TIMING_SHIFT 9 #define GRUB_PCI_STATUS_DEVSEL_TIMING_MASK 0x0600 +#define GRUB_PCI_CLASS_SUBCLASS_VGA 0x0300 #ifndef ASM_FILE typedef grub_uint32_t grub_pci_id_t; diff --git a/include/grub/vga.h b/include/grub/vga.h index 5f321d589..7f112d83a 100644 --- a/include/grub/vga.h +++ b/include/grub/vga.h @@ -24,6 +24,8 @@ enum { GRUB_VGA_IO_ARX = 0x3c0, + GRUB_VGA_IO_ARX_READ = 0x3c1, + GRUB_VGA_IO_MISC_WRITE = 0x3c2, GRUB_VGA_IO_SR_INDEX = 0x3c4, GRUB_VGA_IO_SR_DATA = 0x3c5, GRUB_VGA_IO_PIXEL_MASK = 0x3c6, @@ -41,8 +43,15 @@ enum enum { - GRUB_VGA_CR_WIDTH = 0x01, + GRUB_VGA_CR_HTOTAL = 0x00, + GRUB_VGA_CR_HORIZ_END = 0x01, + GRUB_VGA_CR_HBLANK_START = 0x02, + GRUB_VGA_CR_HBLANK_END = 0x03, + GRUB_VGA_CR_HORIZ_SYNC_PULSE_START = 0x04, + GRUB_VGA_CR_HORIZ_SYNC_PULSE_END = 0x05, + GRUB_VGA_CR_VERT_TOTAL = 0x06, GRUB_VGA_CR_OVERFLOW = 0x07, + GRUB_VGA_CR_BYTE_PANNING = 0x08, GRUB_VGA_CR_CELL_HEIGHT = 0x09, GRUB_VGA_CR_CURSOR_START = 0x0a, GRUB_VGA_CR_CURSOR_END = 0x0b, @@ -50,14 +59,71 @@ enum GRUB_VGA_CR_START_ADDR_LOW_REGISTER = 0x0d, GRUB_VGA_CR_CURSOR_ADDR_HIGH = 0x0e, GRUB_VGA_CR_CURSOR_ADDR_LOW = 0x0f, + GRUB_VGA_CR_VSYNC_START = 0x10, GRUB_VGA_CR_VSYNC_END = 0x11, - GRUB_VGA_CR_HEIGHT = 0x12, + GRUB_VGA_CR_VDISPLAY_END = 0x12, GRUB_VGA_CR_PITCH = 0x13, + GRUB_VGA_CR_UNDERLINE_LOCATION = 0x14, + GRUB_VGA_CR_VERTICAL_BLANK_START = 0x15, + GRUB_VGA_CR_VERTICAL_BLANK_END = 0x16, GRUB_VGA_CR_MODE = 0x17, GRUB_VGA_CR_LINE_COMPARE = 0x18, }; +enum + { + GRUB_VGA_CR_BYTE_PANNING_NORMAL = 0 + }; + +enum + { + GRUB_VGA_CR_UNDERLINE_LOCATION_DWORD_MODE = 0x40 + }; + +enum + { + GRUB_VGA_IO_MISC_COLOR = 0x01, + GRUB_VGA_IO_MISC_ENABLE_VRAM_ACCESS = 0x02, + GRUB_VGA_IO_MISC_EXTERNAL_CLOCK_0 = 0x08, + GRUB_VGA_IO_MISC_28MHZ = 0x04, + GRUB_VGA_IO_MISC_UPPER_64K = 0x20, + GRUB_VGA_IO_MISC_NEGATIVE_HORIZ_POLARITY = 0x40, + GRUB_VGA_IO_MISC_NEGATIVE_VERT_POLARITY = 0x80, + }; + +enum + { + GRUB_VGA_ARX_MODE = 0x10, + GRUB_VGA_ARX_OVERSCAN = 0x11, + GRUB_VGA_ARX_COLOR_PLANE_ENABLE = 0x12, + GRUB_VGA_ARX_HORIZONTAL_PANNING = 0x13, + GRUB_VGA_ARX_COLOR_SELECT = 0x14 + }; + +enum + { + GRUB_VGA_ARX_MODE_TEXT = 0x00, + GRUB_VGA_ARX_MODE_GRAPHICS = 0x01, + GRUB_VGA_ARX_MODE_ENABLE_256COLOR = 0x40 + }; + #define GRUB_VGA_CR_WIDTH_DIVISOR 8 + +#define GRUB_VGA_CR_OVERFLOW_VERT_DISPLAY_ENABLE_END1_SHIFT 7 +#define GRUB_VGA_CR_OVERFLOW_VERT_DISPLAY_ENABLE_END1_MASK 0x02 +#define GRUB_VGA_CR_OVERFLOW_VERT_DISPLAY_ENABLE_END2_SHIFT 3 +#define GRUB_VGA_CR_OVERFLOW_VERT_DISPLAY_ENABLE_END2_MASK 0x40 + +#define GRUB_VGA_CR_OVERFLOW_VERT_TOTAL1_SHIFT 8 +#define GRUB_VGA_CR_OVERFLOW_VERT_TOTAL1_MASK 0x01 +#define GRUB_VGA_CR_OVERFLOW_VERT_TOTAL2_SHIFT 4 +#define GRUB_VGA_CR_OVERFLOW_VERT_TOTAL2_MASK 0x20 + +#define GRUB_VGA_CR_OVERFLOW_VSYNC_START1_SHIFT 6 +#define GRUB_VGA_CR_OVERFLOW_VSYNC_START1_MASK 0x04 +#define GRUB_VGA_CR_OVERFLOW_VSYNC_START2_SHIFT 2 +#define GRUB_VGA_CR_OVERFLOW_VSYNC_START2_MASK 0x80 + #define GRUB_VGA_CR_OVERFLOW_HEIGHT1_SHIFT 7 #define GRUB_VGA_CR_OVERFLOW_HEIGHT1_MASK 0x02 #define GRUB_VGA_CR_OVERFLOW_HEIGHT2_SHIFT 3 @@ -67,7 +133,9 @@ enum #define GRUB_VGA_CR_CELL_HEIGHT_LINE_COMPARE_MASK 0x40 #define GRUB_VGA_CR_CELL_HEIGHT_LINE_COMPARE_SHIFT 3 - +#define GRUB_VGA_CR_CELL_HEIGHT_VERTICAL_BLANK_MASK 0x20 +#define GRUB_VGA_CR_CELL_HEIGHT_VERTICAL_BLANK_SHIFT 4 +#define GRUB_VGA_CR_CELL_HEIGHT_DOUBLE_SCAN 0x80 enum { GRUB_VGA_CR_CURSOR_START_DISABLE = (1 << 5) @@ -79,17 +147,26 @@ enum { GRUB_VGA_CR_MODE_NO_CGA = 0x01, GRUB_VGA_CR_MODE_NO_HERCULES = 0x02, + GRUB_VGA_CR_MODE_ADDRESS_WRAP = 0x20, GRUB_VGA_CR_MODE_BYTE_MODE = 0x40, GRUB_VGA_CR_MODE_TIMING_ENABLE = 0x80 }; enum { + GRUB_VGA_SR_RESET = 0, GRUB_VGA_SR_CLOCKING_MODE = 1, GRUB_VGA_SR_MAP_MASK_REGISTER = 2, + GRUB_VGA_SR_CHAR_MAP_SELECT = 3, GRUB_VGA_SR_MEMORY_MODE = 4, }; +enum + { + GRUB_VGA_SR_RESET_ASYNC = 1, + GRUB_VGA_SR_RESET_SYNC = 2 + }; + enum { GRUB_VGA_SR_CLOCKING_MODE_8_DOT_CLOCK = 1 @@ -98,19 +175,33 @@ enum enum { GRUB_VGA_SR_MEMORY_MODE_NORMAL = 0, - GRUB_VGA_SR_MEMORY_MODE_CHAIN4 = 8 + GRUB_VGA_SR_MEMORY_MODE_EXTERNAL_VIDEO_MEMORY = 2, + GRUB_VGA_SR_MEMORY_MODE_SEQUENTIAL_ADDRESSING = 4, + GRUB_VGA_SR_MEMORY_MODE_CHAIN4 = 8, }; enum { + GRUB_VGA_GR_SET_RESET_PLANE = 0, + GRUB_VGA_GR_SET_RESET_PLANE_ENABLE = 1, + GRUB_VGA_GR_COLOR_COMPARE = 2, GRUB_VGA_GR_DATA_ROTATE = 3, GRUB_VGA_GR_READ_MAP_REGISTER = 4, GRUB_VGA_GR_MODE = 5, GRUB_VGA_GR_GR6 = 6, + GRUB_VGA_GR_COLOR_COMPARE_DISABLE = 7, GRUB_VGA_GR_BITMASK = 8, GRUB_VGA_GR_MAX }; +#define GRUB_VGA_ALL_PLANES 0xf +#define GRUB_VGA_NO_PLANES 0x0 + +enum + { + GRUB_VGA_GR_DATA_ROTATE_NOP = 0 + }; + enum { GRUB_VGA_TEXT_TEXT_PLANE = 0, @@ -121,6 +212,7 @@ enum enum { GRUB_VGA_GR_GR6_GRAPHICS_MODE = 1, + GRUB_VGA_GR_GR6_MMAP_A0 = (1 << 2), GRUB_VGA_GR_GR6_MMAP_CGA = (3 << 2) }; @@ -128,6 +220,7 @@ enum { GRUB_VGA_GR_MODE_READ_MODE1 = 0x08, GRUB_VGA_GR_MODE_ODD_EVEN = 0x10, + GRUB_VGA_GR_MODE_ODD_EVEN_SHIFT = 0x20, GRUB_VGA_GR_MODE_256_COLOR = 0x40 }; @@ -193,4 +286,86 @@ grub_vga_palette_write (grub_uint8_t addr, grub_uint8_t r, grub_uint8_t g, grub_outb (b, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_PALLETTE_DATA); } +static inline void +grub_vga_write_arx (grub_uint8_t val, grub_uint8_t addr) +{ + grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_INPUT_STATUS1_REGISTER); + grub_outb (addr, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_ARX); + grub_inb (GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_ARX_READ); + grub_outb (val, GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_ARX); +} + +struct grub_video_hw_config +{ + unsigned vertical_total; + unsigned vertical_blank_start; + unsigned vertical_blank_end; + unsigned vertical_sync_start; + unsigned vertical_sync_end; + unsigned line_compare; + unsigned vdisplay_end; + unsigned pitch; + unsigned horizontal_total; + unsigned horizontal_blank_start; + unsigned horizontal_blank_end; + unsigned horizontal_sync_pulse_start; + unsigned horizontal_sync_pulse_end; + unsigned horizontal_end; +}; + +static inline void +grub_vga_set_geometry (struct grub_video_hw_config *config, + void (*cr_write) (grub_uint8_t val, grub_uint8_t addr)) +{ + unsigned vertical_total = config->vertical_total - 2; + unsigned vertical_blank_start = config->vertical_blank_start - 1; + unsigned vdisplay_end = config->vdisplay_end - 1; + grub_uint8_t overflow, cell_height_reg; + + /* Disable CR0-7 write protection. */ + cr_write (0, GRUB_VGA_CR_VSYNC_END); + + overflow = ((vertical_total >> GRUB_VGA_CR_OVERFLOW_VERT_TOTAL1_SHIFT) + & GRUB_VGA_CR_OVERFLOW_VERT_TOTAL1_MASK) + | ((vertical_total >> GRUB_VGA_CR_OVERFLOW_VERT_TOTAL2_SHIFT) + & GRUB_VGA_CR_OVERFLOW_VERT_TOTAL2_MASK) + | ((config->vertical_sync_start >> GRUB_VGA_CR_OVERFLOW_VSYNC_START2_SHIFT) + & GRUB_VGA_CR_OVERFLOW_VSYNC_START2_MASK) + | ((config->vertical_sync_start >> GRUB_VGA_CR_OVERFLOW_VSYNC_START1_SHIFT) + & GRUB_VGA_CR_OVERFLOW_VSYNC_START1_MASK) + | ((vdisplay_end >> GRUB_VGA_CR_OVERFLOW_VERT_DISPLAY_ENABLE_END1_SHIFT) + & GRUB_VGA_CR_OVERFLOW_VERT_DISPLAY_ENABLE_END1_MASK) + | ((vdisplay_end >> GRUB_VGA_CR_OVERFLOW_VERT_DISPLAY_ENABLE_END2_SHIFT) + & GRUB_VGA_CR_OVERFLOW_VERT_DISPLAY_ENABLE_END2_MASK) + | ((config->vertical_sync_start >> GRUB_VGA_CR_OVERFLOW_VSYNC_START1_SHIFT) + & GRUB_VGA_CR_OVERFLOW_VSYNC_START1_MASK) + | ((config->line_compare >> GRUB_VGA_CR_OVERFLOW_LINE_COMPARE_SHIFT) + & GRUB_VGA_CR_OVERFLOW_LINE_COMPARE_MASK); + + cell_height_reg = ((vertical_blank_start + >> GRUB_VGA_CR_CELL_HEIGHT_VERTICAL_BLANK_SHIFT) + & GRUB_VGA_CR_CELL_HEIGHT_VERTICAL_BLANK_MASK) + | ((config->line_compare >> GRUB_VGA_CR_CELL_HEIGHT_LINE_COMPARE_SHIFT) + & GRUB_VGA_CR_CELL_HEIGHT_LINE_COMPARE_MASK); + + cr_write (config->horizontal_total - 1, GRUB_VGA_CR_HTOTAL); + cr_write (config->horizontal_end - 1, GRUB_VGA_CR_HORIZ_END); + cr_write (config->horizontal_blank_start - 1, GRUB_VGA_CR_HBLANK_START); + cr_write (config->horizontal_blank_end, GRUB_VGA_CR_HBLANK_END); + cr_write (config->horizontal_sync_pulse_start, + GRUB_VGA_CR_HORIZ_SYNC_PULSE_START); + cr_write (config->horizontal_sync_pulse_end, + GRUB_VGA_CR_HORIZ_SYNC_PULSE_END); + cr_write (vertical_total & 0xff, GRUB_VGA_CR_VERT_TOTAL); + cr_write (overflow, GRUB_VGA_CR_OVERFLOW); + cr_write (cell_height_reg, GRUB_VGA_CR_CELL_HEIGHT); + cr_write (config->vertical_sync_start & 0xff, GRUB_VGA_CR_VSYNC_START); + cr_write (config->vertical_sync_end & 0x0f, GRUB_VGA_CR_VSYNC_END); + cr_write (vdisplay_end & 0xff, GRUB_VGA_CR_VDISPLAY_END); + cr_write (config->pitch & 0xff, GRUB_VGA_CR_PITCH); + cr_write (vertical_blank_start & 0xff, GRUB_VGA_CR_VERTICAL_BLANK_START); + cr_write (config->vertical_blank_end & 0xff, GRUB_VGA_CR_VERTICAL_BLANK_END); + cr_write (config->line_compare & 0xff, GRUB_VGA_CR_LINE_COMPARE); +} + #endif diff --git a/kern/i386/qemu/init.c b/kern/i386/qemu/init.c index 201ba3633..bd12953df 100644 --- a/kern/i386/qemu/init.c +++ b/kern/i386/qemu/init.c @@ -69,10 +69,7 @@ load_palette (void) { unsigned i; for (i = 0; i < 16; i++) - { - grub_outb (i, GRUB_VGA_IO_ARX); - grub_outb (i, GRUB_VGA_IO_ARX); - } + grub_vga_write_arx (i, i); for (i = 0; i < ARRAY_SIZE (colors); i++) grub_vga_palette_write (i, colors[i].r, colors[i].g, colors[i].b); @@ -90,7 +87,7 @@ grub_qemu_init_cirrus (void) addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS); class = grub_pci_read (addr); - if (((class >> 16) & 0xffff) != 0x0300) + if (((class >> 16) & 0xffff) != GRUB_PCI_CLASS_SUBCLASS_VGA) return 0; /* FIXME: chooose addresses dynamically. */ @@ -110,7 +107,7 @@ grub_qemu_init_cirrus (void) grub_pci_iterate (find_card); - grub_outb (1, 0x3c2); + grub_outb (GRUB_VGA_IO_MISC_COLOR, GRUB_VGA_IO_MISC_WRITE); load_font (); @@ -137,10 +134,8 @@ grub_qemu_init_cirrus (void) load_palette (); - grub_outb (0x10, 0x3c0); - grub_outb (0, 0x3c1); - grub_outb (0x14, 0x3c0); - grub_outb (0, 0x3c1); + grub_vga_write_arx (GRUB_VGA_ARX_MODE_TEXT, GRUB_VGA_ARX_MODE); + grub_vga_write_arx (0, GRUB_VGA_ARX_COLOR_SELECT); grub_vga_sr_write (GRUB_VGA_SR_CLOCKING_MODE_8_DOT_CLOCK, GRUB_VGA_SR_CLOCKING_MODE); diff --git a/video/cirrus.c b/video/cirrus.c index ccbab9d15..b8b0142ad 100644 --- a/video/cirrus.c +++ b/video/cirrus.c @@ -334,43 +334,26 @@ grub_video_cirrus_setup (unsigned int width, unsigned int height, } { - int pitch_reg, overflow_reg = 0, line_compare = 0x3ff; + struct grub_video_hw_config config = { + .pitch = pitch / GRUB_VGA_CR_PITCH_DIVISOR, + .line_compare = 0x3ff, + .vdisplay_end = height - 1, + .horizontal_end = width / GRUB_VGA_CR_WIDTH_DIVISOR + }; grub_uint8_t sr_ext = 0, hidden_dac = 0; - pitch_reg = pitch / GRUB_VGA_CR_PITCH_DIVISOR; - + grub_vga_set_geometry (&config, grub_vga_cr_write); + grub_vga_gr_write (GRUB_VGA_GR_MODE_256_COLOR | GRUB_VGA_GR_MODE_READ_MODE1, GRUB_VGA_GR_MODE); grub_vga_gr_write (GRUB_VGA_GR_GR6_GRAPHICS_MODE, GRUB_VGA_GR_GR6); grub_vga_sr_write (GRUB_VGA_SR_MEMORY_MODE_NORMAL, GRUB_VGA_SR_MEMORY_MODE); - /* Disable CR0-7 write protection. */ - grub_vga_cr_write (0, GRUB_VGA_CR_VSYNC_END); - - grub_vga_cr_write (width / GRUB_VGA_CR_WIDTH_DIVISOR - 1, - GRUB_VGA_CR_WIDTH); - grub_vga_cr_write ((height - 1) & 0xff, GRUB_VGA_CR_HEIGHT); - overflow_reg |= (((height - 1) >> GRUB_VGA_CR_OVERFLOW_HEIGHT1_SHIFT) & - GRUB_VGA_CR_OVERFLOW_HEIGHT1_MASK) - | (((height - 1) >> GRUB_VGA_CR_OVERFLOW_HEIGHT2_SHIFT) & - GRUB_VGA_CR_OVERFLOW_HEIGHT2_MASK); - - grub_vga_cr_write (pitch_reg & 0xff, GRUB_VGA_CR_PITCH); - - grub_vga_cr_write (line_compare & 0xff, GRUB_VGA_CR_LINE_COMPARE); - overflow_reg |= (line_compare >> GRUB_VGA_CR_OVERFLOW_LINE_COMPARE_SHIFT) - & GRUB_VGA_CR_OVERFLOW_LINE_COMPARE_MASK; - - grub_vga_cr_write (overflow_reg, GRUB_VGA_CR_OVERFLOW); - - grub_vga_cr_write ((pitch_reg >> CIRRUS_CR_EXTENDED_DISPLAY_PITCH_SHIFT) + grub_vga_cr_write ((config.pitch >> CIRRUS_CR_EXTENDED_DISPLAY_PITCH_SHIFT) & CIRRUS_CR_EXTENDED_DISPLAY_PITCH_MASK, CIRRUS_CR_EXTENDED_DISPLAY); - grub_vga_cr_write ((line_compare >> GRUB_VGA_CR_CELL_HEIGHT_LINE_COMPARE_SHIFT) - & GRUB_VGA_CR_CELL_HEIGHT_LINE_COMPARE_MASK, GRUB_VGA_CR_CELL_HEIGHT); - grub_vga_cr_write (GRUB_VGA_CR_MODE_TIMING_ENABLE | GRUB_VGA_CR_MODE_BYTE_MODE | GRUB_VGA_CR_MODE_NO_HERCULES | GRUB_VGA_CR_MODE_NO_CGA, diff --git a/video/sm712.c b/video/sm712.c index db7494a62..60f2c9089 100644 --- a/video/sm712.c +++ b/video/sm712.c @@ -32,6 +32,162 @@ #define GRUB_SM712_TOTAL_MEMORY_SPACE 0x700400 #define GRUB_SM712_REG_BASE 0x700000 +#define GRUB_SM712_PCIID 0x0712126f + +enum + { + GRUB_SM712_SR_TV_CONTROL = 0x65, + GRUB_SM712_SR_RAM_LUT = 0x66, + GRUB_SM712_SR_CLOCK_CONTROL1 = 0x68, + GRUB_SM712_SR_CLOCK_CONTROL2 = 0x69, + GRUB_SM712_SR_VCLK_NUM = 0x6c, + GRUB_SM712_SR_VCLK_DENOM = 0x6d, + GRUB_SM712_SR_VCLK2_NUM = 0x6e, + GRUB_SM712_SR_VCLK2_DENOM = 0x6f, + GRUB_SM712_SR_POPUP_ICON_LOW = 0x80, + GRUB_SM712_SR_POPUP_ICON_HIGH = 0x81, + GRUB_SM712_SR_POPUP_ICON_CTRL = 0x82, + GRUB_SM712_SR_POPUP_ICON_COLOR1 = 0x84, + GRUB_SM712_SR_POPUP_ICON_COLOR2 = 0x85, + GRUB_SM712_SR_POPUP_ICON_COLOR3 = 0x86, + + GRUB_SM712_SR_HW_CURSOR_UPPER_LEFT_X_LOW = 0x88, + GRUB_SM712_SR_HW_CURSOR_UPPER_LEFT_X_HIGH = 0x89, + GRUB_SM712_SR_HW_CURSOR_UPPER_LEFT_Y_LOW = 0x8a, + GRUB_SM712_SR_HW_CURSOR_UPPER_LEFT_Y_HIGH = 0x8b, + GRUB_SM712_SR_HW_CURSOR_FG_COLOR = 0x8c, + GRUB_SM712_SR_HW_CURSOR_BG_COLOR = 0x8d, + + GRUB_SM712_SR_POPUP_ICON_X_LOW = 0x90, + GRUB_SM712_SR_POPUP_ICON_X_HIGH = 0x91, + GRUB_SM712_SR_POPUP_ICON_Y_LOW = 0x92, + GRUB_SM712_SR_POPUP_ICON_Y_HIGH = 0x93, + GRUB_SM712_SR_PANEL_HW_VIDEO_CONTROL = 0xa0, + GRUB_SM712_SR_PANEL_HW_VIDEO_COLOR_KEY_LOW = 0xa1, + GRUB_SM712_SR_PANEL_HW_VIDEO_COLOR_KEY_HIGH = 0xa2, + GRUB_SM712_SR_PANEL_HW_VIDEO_COLOR_KEY_MASK_LOW = 0xa3, + GRUB_SM712_SR_PANEL_HW_VIDEO_COLOR_KEY_MASK_HIGH = 0xa4, + GRUB_SM712_SR_PANEL_HW_VIDEO_RED_CONSTANT = 0xa5, + GRUB_SM712_SR_PANEL_HW_VIDEO_GREEN_CONSTANT = 0xa6, + GRUB_SM712_SR_PANEL_HW_VIDEO_BLUE_CONSTANT = 0xa7, + GRUB_SM712_SR_PANEL_HW_VIDEO_TOP_BOUNDARY = 0xa8, + GRUB_SM712_SR_PANEL_HW_VIDEO_LEFT_BOUNDARY = 0xa9, + GRUB_SM712_SR_PANEL_HW_VIDEO_BOTTOM_BOUNDARY = 0xaa, + GRUB_SM712_SR_PANEL_HW_VIDEO_RIGHT_BOUNDARY = 0xab, + GRUB_SM712_SR_PANEL_HW_VIDEO_TOP_LEFT_OVERFLOW_BOUNDARY = 0xac, + GRUB_SM712_SR_PANEL_HW_VIDEO_BOTTOM_RIGHT_OVERFLOW_BOUNDARY = 0xad, + GRUB_SM712_SR_PANEL_HW_VIDEO_VERTICAL_STRETCH_FACTOR = 0xae, + GRUB_SM712_SR_PANEL_HW_VIDEO_HORIZONTAL_STRETCH_FACTOR = 0xaf, + }; +enum + { + GRUB_SM712_SR_TV_CRT_SRAM = 0x00, + GRUB_SM712_SR_TV_LCD_SRAM = 0x08 + }; +enum + { + GRUB_SM712_SR_TV_ALT_CLOCK = 0x00, + GRUB_SM712_SR_TV_FREE_RUN_CLOCK = 0x04 + }; +enum + { + GRUB_SM712_SR_TV_CLOCK_CKIN_NTSC = 0x00, + GRUB_SM712_SR_TV_CLOCK_REFCLK_PAL = 0x04 + }; +enum + { + GRUB_SM712_SR_TV_HSYNC = 0x00, + GRUB_SM712_SR_TV_COMPOSITE_HSYNC = 0x01 + }; +enum + { + GRUB_SM712_SR_RAM_LUT_NORMAL = 0, + GRUB_SM712_SR_RAM_LUT_LCD_RAM_OFF = 0x80, + GRUB_SM712_SR_RAM_LUT_CRT_RAM_OFF = 0x40, + GRUB_SM712_SR_RAM_LUT_LCD_RAM_NO_WRITE = 0x20, + GRUB_SM712_SR_RAM_LUT_CRT_RAM_NO_WRITE = 0x10, + GRUB_SM712_SR_RAM_LUT_CRT_8BIT = 0x08, + GRUB_SM712_SR_RAM_LUT_CRT_GAMMA = 0x04 + }; + +enum + { + GRUB_SM712_SR_CLOCK_CONTROL1_VCLK_FROM_CCR = 0x40, + GRUB_SM712_SR_CLOCK_CONTROL1_8DOT_CLOCK = 0x10, + }; + +enum + { + GRUB_SM712_SR_CLOCK_CONTROL2_PROGRAM_VCLOCK = 0x03 + }; + +#define GRUB_SM712_SR_POPUP_ICON_HIGH_MASK 0x7 +#define GRUB_SM712_SR_POPUP_ICON_HIGH_HW_CURSOR_EN 0x80 + enum + { + GRUB_SM712_SR_POPUP_ICON_CTRL_DISABLED = 0, + GRUB_SM712_SR_POPUP_ICON_CTRL_ZOOM_ENABLED = 0x40, + GRUB_SM712_SR_POPUP_ICON_CTRL_ENABLED = 0x80 + }; +#define RGB332_BLACK 0 +#define RGB332_WHITE 0xff + + enum + { + GRUB_SM712_CR_OVERFLOW_INTERLACE = 0x30, + GRUB_SM712_CR_INTERLACE_RETRACE = 0x31, + GRUB_SM712_CR_TV_VDISPLAY_START = 0x32, + GRUB_SM712_CR_TV_VDISPLAY_END_HIGH = 0x33, + GRUB_SM712_CR_TV_VDISPLAY_END_LOW = 0x34, + GRUB_SM712_CR_DDA_CONTROL_LOW = 0x35, + GRUB_SM712_CR_DDA_CONTROL_HIGH = 0x36, + GRUB_SM712_CR_TV_EQUALIZER = 0x38, + GRUB_SM712_CR_TV_SERRATION = 0x39, + GRUB_SM712_CR_HSYNC_CTRL = 0x3a, + GRUB_SM712_CR_DEBUG = 0x3c, + GRUB_SM712_CR_SHADOW_VGA_HTOTAL = 0x40, + GRUB_SM712_CR_SHADOW_VGA_HBLANK_START = 0x41, + GRUB_SM712_CR_SHADOW_VGA_HBLANK_END = 0x42, + GRUB_SM712_CR_SHADOW_VGA_HRETRACE_START = 0x43, + GRUB_SM712_CR_SHADOW_VGA_HRETRACE_END = 0x44, + GRUB_SM712_CR_SHADOW_VGA_VERTICAL_TOTAL = 0x45, + GRUB_SM712_CR_SHADOW_VGA_VBLANK_START = 0x46, + GRUB_SM712_CR_SHADOW_VGA_VBLANK_END = 0x47, + GRUB_SM712_CR_SHADOW_VGA_VRETRACE_START = 0x48, + GRUB_SM712_CR_SHADOW_VGA_VRETRACE_END = 0x49, + GRUB_SM712_CR_SHADOW_VGA_OVERFLOW = 0x4a, + GRUB_SM712_CR_SHADOW_VGA_CELL_HEIGHT = 0x4b, + GRUB_SM712_CR_SHADOW_VGA_HDISPLAY_END = 0x4c, + GRUB_SM712_CR_SHADOW_VGA_VDISPLAY_END = 0x4d, + GRUB_SM712_CR_DDA_LOOKUP_REG3_START = 0x90, + GRUB_SM712_CR_DDA_LOOKUP_REG2_START = 0x91, + GRUB_SM712_CR_DDA_LOOKUP_REG1_START = 0xa0, + GRUB_SM712_CR_VCENTERING_OFFSET = 0xa6, + GRUB_SM712_CR_HCENTERING_OFFSET = 0xa7, + }; + +#define GRUB_SM712_CR_DEBUG_NONE 0 + +#define SM712_DDA_REG3_COMPARE_SHIFT 2 +#define SM712_DDA_REG3_COMPARE_MASK 0xfc +#define SM712_DDA_REG3_DDA_SHIFT 8 +#define SM712_DDA_REG3_DDA_MASK 0x3 +#define SM712_DDA_REG2_DDA_MASK 0xff +#define SM712_DDA_REG2_VCENTER_MASK 0x3f + +static struct +{ + grub_uint8_t compare; + grub_uint16_t dda; + grub_uint8_t vcentering; +} dda_lookups[] = { + { 21, 469, 2}, + { 23, 477, 2}, + { 33, 535, 2}, + { 35, 682, 21}, + { 34, 675, 2}, + { 55, 683, 6}, +}; static struct { @@ -44,6 +200,7 @@ static struct grub_pci_device_t dev; } framebuffer; +#ifndef TEST static grub_err_t grub_video_sm712_video_init (void) { @@ -62,14 +219,117 @@ grub_video_sm712_video_fini (void) return grub_video_fb_fini (); } +#endif + +static inline void +grub_sm712_write_reg (grub_uint8_t val, grub_uint16_t addr) +{ +#ifdef TEST + printf (" {1, 0x%x, 0x%x},\n", addr, val); +#else + *(volatile grub_uint8_t *) (framebuffer.ptr + GRUB_SM712_REG_BASE + + addr) = val; +#endif +} + +static inline grub_uint8_t +grub_sm712_read_reg (grub_uint16_t addr) +{ +#ifdef TEST + printf (" {-1, 0x%x, 0x5},\n", addr); +#else + return *(volatile grub_uint8_t *) (framebuffer.ptr + GRUB_SM712_REG_BASE + + addr); +#endif +} static inline grub_uint8_t grub_sm712_sr_read (grub_uint8_t addr) { - *(volatile grub_uint8_t *) (framebuffer.ptr + GRUB_SM712_REG_BASE - + GRUB_VGA_IO_SR_INDEX) = addr; - return *(volatile grub_uint8_t *) (framebuffer.ptr + GRUB_SM712_REG_BASE - + GRUB_VGA_IO_SR_DATA); + grub_sm712_write_reg (addr, GRUB_VGA_IO_SR_INDEX); + return grub_sm712_read_reg (GRUB_VGA_IO_SR_DATA); +} + +static inline void +grub_sm712_sr_write (grub_uint8_t val, grub_uint8_t addr) +{ + grub_sm712_write_reg (addr, GRUB_VGA_IO_SR_INDEX); + grub_sm712_write_reg (val, GRUB_VGA_IO_SR_DATA); +} + +static inline void +grub_sm712_gr_write (grub_uint8_t val, grub_uint8_t addr) +{ + grub_sm712_write_reg (addr, GRUB_VGA_IO_GR_INDEX); + grub_sm712_write_reg (val, GRUB_VGA_IO_GR_DATA); +} + +static inline void +grub_sm712_cr_write (grub_uint8_t val, grub_uint8_t addr) +{ + grub_sm712_write_reg (addr, GRUB_VGA_IO_CR_INDEX); + grub_sm712_write_reg (val, GRUB_VGA_IO_CR_DATA); +} + +static inline void +grub_sm712_write_arx (grub_uint8_t val, grub_uint8_t addr) +{ + grub_sm712_read_reg (GRUB_VGA_IO_INPUT_STATUS1_REGISTER); + grub_sm712_write_reg (addr, GRUB_VGA_IO_ARX); + grub_sm712_read_reg (GRUB_VGA_IO_ARX_READ); + grub_sm712_write_reg (val, GRUB_VGA_IO_ARX); +} + +static inline void +grub_sm712_cr_shadow_write (grub_uint8_t val, grub_uint8_t addr) +{ + grub_uint8_t mapping[] = + { + [GRUB_VGA_CR_HTOTAL] = GRUB_SM712_CR_SHADOW_VGA_HTOTAL, + [GRUB_VGA_CR_HORIZ_END] = 0xff, + [GRUB_VGA_CR_HBLANK_START] = GRUB_SM712_CR_SHADOW_VGA_HBLANK_START, + [GRUB_VGA_CR_HBLANK_END] = GRUB_SM712_CR_SHADOW_VGA_HBLANK_END, + [GRUB_VGA_CR_HORIZ_SYNC_PULSE_START] = GRUB_SM712_CR_SHADOW_VGA_HRETRACE_START, + [GRUB_VGA_CR_HORIZ_SYNC_PULSE_END] = GRUB_SM712_CR_SHADOW_VGA_HRETRACE_END, + [GRUB_VGA_CR_VERT_TOTAL] = GRUB_SM712_CR_SHADOW_VGA_VERTICAL_TOTAL, + [GRUB_VGA_CR_OVERFLOW] = GRUB_SM712_CR_SHADOW_VGA_OVERFLOW, + [GRUB_VGA_CR_BYTE_PANNING] = 0xff, + [GRUB_VGA_CR_CELL_HEIGHT] = GRUB_SM712_CR_SHADOW_VGA_CELL_HEIGHT, + [GRUB_VGA_CR_CURSOR_START] = 0xff, + [GRUB_VGA_CR_CURSOR_END] = 0xff, + [GRUB_VGA_CR_START_ADDR_HIGH_REGISTER] = 0xff, + [GRUB_VGA_CR_START_ADDR_LOW_REGISTER] = 0xff, + [GRUB_VGA_CR_CURSOR_ADDR_HIGH] = 0xff, + [GRUB_VGA_CR_CURSOR_ADDR_LOW] = 0xff, + [GRUB_VGA_CR_VSYNC_START] = GRUB_SM712_CR_SHADOW_VGA_VRETRACE_START, + [GRUB_VGA_CR_VSYNC_END] = GRUB_SM712_CR_SHADOW_VGA_VRETRACE_END, + [GRUB_VGA_CR_VDISPLAY_END] = GRUB_SM712_CR_SHADOW_VGA_VDISPLAY_END, + [GRUB_VGA_CR_PITCH] = GRUB_SM712_CR_SHADOW_VGA_HDISPLAY_END, + [GRUB_VGA_CR_UNDERLINE_LOCATION] = 0xff, + + [GRUB_VGA_CR_VERTICAL_BLANK_START] = GRUB_SM712_CR_SHADOW_VGA_VBLANK_START, + [GRUB_VGA_CR_VERTICAL_BLANK_END] = GRUB_SM712_CR_SHADOW_VGA_VBLANK_END, + [GRUB_VGA_CR_MODE] = 0xff, + [GRUB_VGA_CR_LINE_COMPARE] = 0xff + }; + if (addr >= ARRAY_SIZE (mapping) || mapping[addr] == 0xff) + return; + grub_sm712_cr_write (val, mapping[addr]); +} + +static inline void +grub_sm712_write_dda_lookup (int idx, grub_uint8_t compare, grub_uint16_t dda, + grub_uint8_t vcentering) +{ + grub_sm712_cr_write (((compare << SM712_DDA_REG3_COMPARE_SHIFT) + & SM712_DDA_REG3_COMPARE_MASK) + | ((dda >> SM712_DDA_REG3_DDA_SHIFT) + & SM712_DDA_REG3_DDA_MASK), + GRUB_SM712_CR_DDA_LOOKUP_REG3_START + 2 * idx); + grub_sm712_cr_write (dda & SM712_DDA_REG2_DDA_MASK, + GRUB_SM712_CR_DDA_LOOKUP_REG2_START + 2 * idx); + grub_sm712_cr_write (vcentering & SM712_DDA_REG2_VCENTER_MASK, + GRUB_SM712_CR_DDA_LOOKUP_REG1_START + idx); } static grub_err_t @@ -81,6 +341,7 @@ grub_video_sm712_setup (unsigned int width, unsigned int height, int found = 0; unsigned i; +#ifndef TEST auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused))); int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused))) { @@ -90,7 +351,8 @@ grub_video_sm712_setup (unsigned int width, unsigned int height, addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS); class = grub_pci_read (addr); - if (((class >> 16) & 0xffff) != 0x0300 || pciid != 0x0712126f) + if (((class >> 16) & 0xffff) != GRUB_PCI_CLASS_SUBCLASS_VGA + || pciid != GRUB_SM712_PCIID) return 0; found = 1; @@ -114,7 +376,7 @@ grub_video_sm712_setup (unsigned int width, unsigned int height, grub_pci_iterate (find_card); if (!found) return grub_error (GRUB_ERR_IO, "Couldn't find graphics card"); - +#endif /* Fill mode info details. */ framebuffer.mode_info.width = 1024; framebuffer.mode_info.height = 600; @@ -131,8 +393,12 @@ grub_video_sm712_setup (unsigned int width, unsigned int height, framebuffer.mode_info.blue_field_pos = 0; framebuffer.mode_info.reserved_mask_size = 0; framebuffer.mode_info.reserved_field_pos = 0; - framebuffer.mode_info.blit_format = grub_video_get_blit_format (&framebuffer.mode_info); +#ifndef TEST + framebuffer.mode_info.blit_format + = grub_video_get_blit_format (&framebuffer.mode_info); +#endif +#ifndef TEST if (found && framebuffer.base == 0) { grub_pci_address_t addr; @@ -150,47 +416,280 @@ grub_video_sm712_setup (unsigned int width, unsigned int height, addr = grub_pci_make_address (framebuffer.dev, GRUB_PCI_REG_COMMAND); grub_pci_write (addr, 0x7); } +#endif /* We can safely discard volatile attribute. */ +#ifndef TEST framebuffer.ptr = (void *) grub_pci_device_map_range (framebuffer.dev, framebuffer.base, GRUB_SM712_TOTAL_MEMORY_SPACE); +#endif framebuffer.mapped = 1; /* Initialise SM712. */ +#ifndef TEST + /* FIXME */ grub_vga_sr_write (0x11, 0x18); +#endif +#ifndef TEST /* Prevent garbage from appearing on the screen. */ grub_memset (framebuffer.ptr, 0, framebuffer.mode_info.height * framebuffer.mode_info.pitch); +#endif - for (i = 0; i < ARRAY_SIZE (sm712_init); i++) - switch (sm712_init[i].directive) + /* FIXME */ + grub_sm712_sr_write (0, 0x21); + grub_sm712_sr_write (0x7a, 0x62); + grub_sm712_sr_write (0x16, 0x6a); + grub_sm712_sr_write (0x2, 0x6b); + grub_sm712_write_reg (0, GRUB_VGA_IO_PIXEL_MASK); + grub_sm712_sr_write (GRUB_VGA_SR_RESET_ASYNC, GRUB_VGA_SR_RESET); + grub_sm712_write_reg (GRUB_VGA_IO_MISC_NEGATIVE_VERT_POLARITY + | GRUB_VGA_IO_MISC_NEGATIVE_HORIZ_POLARITY + | GRUB_VGA_IO_MISC_UPPER_64K + | GRUB_VGA_IO_MISC_EXTERNAL_CLOCK_0 + | GRUB_VGA_IO_MISC_ENABLE_VRAM_ACCESS + | GRUB_VGA_IO_MISC_COLOR, GRUB_VGA_IO_MISC_WRITE); + grub_sm712_sr_write (GRUB_VGA_SR_RESET_ASYNC | GRUB_VGA_SR_RESET_SYNC, + GRUB_VGA_SR_RESET); + grub_sm712_sr_write (GRUB_VGA_SR_CLOCKING_MODE_8_DOT_CLOCK, + GRUB_VGA_SR_CLOCKING_MODE); + grub_sm712_sr_write (GRUB_VGA_ALL_PLANES, GRUB_VGA_SR_MAP_MASK_REGISTER); + grub_sm712_sr_write (0, GRUB_VGA_SR_CHAR_MAP_SELECT); + grub_sm712_sr_write (GRUB_VGA_SR_MEMORY_MODE_CHAIN4 + | GRUB_VGA_SR_MEMORY_MODE_SEQUENTIAL_ADDRESSING + | GRUB_VGA_SR_MEMORY_MODE_EXTERNAL_VIDEO_MEMORY, + GRUB_VGA_SR_MEMORY_MODE); + + for (i = 0; i < ARRAY_SIZE (sm712_sr_seq1); i++) + grub_sm712_sr_write (sm712_sr_seq1[i], 0x10 + i); + + for (i = 0; i < ARRAY_SIZE (sm712_sr_seq2); i++) + grub_sm712_sr_write (sm712_sr_seq2[i], 0x30 + i); + + /* Undocumented. */ + grub_sm712_sr_write (0x1a, 0x63); + /* Undocumented. */ + grub_sm712_sr_write (0x1a, 0x64); + + grub_sm712_sr_write (GRUB_SM712_SR_TV_CRT_SRAM | GRUB_SM712_SR_TV_ALT_CLOCK + | GRUB_SM712_SR_TV_CLOCK_CKIN_NTSC + | GRUB_SM712_SR_TV_HSYNC, + GRUB_SM712_SR_TV_CONTROL); + + grub_sm712_sr_write (GRUB_SM712_SR_RAM_LUT_NORMAL, GRUB_SM712_SR_RAM_LUT); + + /* Undocumented. */ + grub_sm712_sr_write (0x00, 0x67); + + grub_sm712_sr_write (GRUB_SM712_SR_CLOCK_CONTROL1_VCLK_FROM_CCR + | GRUB_SM712_SR_CLOCK_CONTROL1_8DOT_CLOCK, + GRUB_SM712_SR_CLOCK_CONTROL1); + grub_sm712_sr_write (GRUB_SM712_SR_CLOCK_CONTROL2_PROGRAM_VCLOCK, + GRUB_SM712_SR_CLOCK_CONTROL2); + + grub_sm712_sr_write (82, GRUB_SM712_SR_VCLK_NUM); + grub_sm712_sr_write (137, GRUB_SM712_SR_VCLK_DENOM); + + grub_sm712_sr_write (9, GRUB_SM712_SR_VCLK2_NUM); + grub_sm712_sr_write (2, GRUB_SM712_SR_VCLK2_DENOM); + /* FIXME */ + grub_sm712_sr_write (0x04, 0x70); + /* FIXME */ + grub_sm712_sr_write (0x45, 0x71); + /* Undocumented */ + grub_sm712_sr_write (0x30, 0x72); + /* Undocumented */ + grub_sm712_sr_write (0x30, 0x73); + /* Undocumented */ + grub_sm712_sr_write (0x40, 0x74); + /* Undocumented */ + grub_sm712_sr_write (0x20, 0x75); + + grub_sm712_sr_write (0xff, GRUB_SM712_SR_POPUP_ICON_LOW); + grub_sm712_sr_write (GRUB_SM712_SR_POPUP_ICON_HIGH_MASK, + GRUB_SM712_SR_POPUP_ICON_HIGH); + grub_sm712_sr_write (GRUB_SM712_SR_POPUP_ICON_CTRL_DISABLED, + GRUB_SM712_SR_POPUP_ICON_CTRL); + /* Undocumented */ + grub_sm712_sr_write (0x0, 0x83); + + grub_sm712_sr_write (8, GRUB_SM712_SR_POPUP_ICON_COLOR1); + grub_sm712_sr_write (0, GRUB_SM712_SR_POPUP_ICON_COLOR2); + grub_sm712_sr_write (0x42, GRUB_SM712_SR_POPUP_ICON_COLOR3); + + /* Undocumented */ + grub_sm712_sr_write (0x3a, 0x87); + + /* Why theese coordinates? */ + grub_sm712_sr_write (0x59, GRUB_SM712_SR_HW_CURSOR_UPPER_LEFT_X_LOW); + grub_sm712_sr_write (0x02, GRUB_SM712_SR_HW_CURSOR_UPPER_LEFT_X_HIGH); + grub_sm712_sr_write (0x44, GRUB_SM712_SR_HW_CURSOR_UPPER_LEFT_Y_LOW); + grub_sm712_sr_write (0x02, GRUB_SM712_SR_HW_CURSOR_UPPER_LEFT_Y_HIGH); + + grub_sm712_sr_write (RGB332_BLACK, GRUB_SM712_SR_HW_CURSOR_FG_COLOR); + grub_sm712_sr_write (RGB332_WHITE, GRUB_SM712_SR_HW_CURSOR_BG_COLOR); + + /* Undocumented */ + grub_sm712_sr_write (0x3a, 0x8e); + grub_sm712_sr_write (0x3a, 0x8f); + + grub_sm712_sr_write (0, GRUB_SM712_SR_POPUP_ICON_X_LOW); + grub_sm712_sr_write (0, GRUB_SM712_SR_POPUP_ICON_X_HIGH); + grub_sm712_sr_write (0, GRUB_SM712_SR_POPUP_ICON_Y_LOW); + grub_sm712_sr_write (0, GRUB_SM712_SR_POPUP_ICON_Y_HIGH); + + grub_sm712_sr_write (0, GRUB_SM712_SR_PANEL_HW_VIDEO_CONTROL); + grub_sm712_sr_write (0x10, GRUB_SM712_SR_PANEL_HW_VIDEO_COLOR_KEY_LOW); + grub_sm712_sr_write (0x08, GRUB_SM712_SR_PANEL_HW_VIDEO_COLOR_KEY_HIGH); + grub_sm712_sr_write (0x00, GRUB_SM712_SR_PANEL_HW_VIDEO_COLOR_KEY_MASK_LOW); + grub_sm712_sr_write (0x02, GRUB_SM712_SR_PANEL_HW_VIDEO_COLOR_KEY_MASK_HIGH); + grub_sm712_sr_write (0xed, GRUB_SM712_SR_PANEL_HW_VIDEO_RED_CONSTANT); + grub_sm712_sr_write (0xed, GRUB_SM712_SR_PANEL_HW_VIDEO_GREEN_CONSTANT); + grub_sm712_sr_write (0xed, GRUB_SM712_SR_PANEL_HW_VIDEO_BLUE_CONSTANT); + + grub_sm712_sr_write (0x7b, GRUB_SM712_SR_PANEL_HW_VIDEO_TOP_BOUNDARY); + grub_sm712_sr_write (0xfb, GRUB_SM712_SR_PANEL_HW_VIDEO_LEFT_BOUNDARY); + grub_sm712_sr_write (0xff, GRUB_SM712_SR_PANEL_HW_VIDEO_BOTTOM_BOUNDARY); + grub_sm712_sr_write (0xff, GRUB_SM712_SR_PANEL_HW_VIDEO_RIGHT_BOUNDARY); + /* Doesn't match documentation? */ + grub_sm712_sr_write (0x97, GRUB_SM712_SR_PANEL_HW_VIDEO_TOP_LEFT_OVERFLOW_BOUNDARY); + grub_sm712_sr_write (0xef, GRUB_SM712_SR_PANEL_HW_VIDEO_BOTTOM_RIGHT_OVERFLOW_BOUNDARY); + + grub_sm712_sr_write (0xbf, GRUB_SM712_SR_PANEL_HW_VIDEO_VERTICAL_STRETCH_FACTOR); + grub_sm712_sr_write (0xdf, GRUB_SM712_SR_PANEL_HW_VIDEO_HORIZONTAL_STRETCH_FACTOR); + + grub_sm712_gr_write (GRUB_VGA_NO_PLANES, GRUB_VGA_GR_SET_RESET_PLANE); + grub_sm712_gr_write (GRUB_VGA_NO_PLANES, GRUB_VGA_GR_SET_RESET_PLANE_ENABLE); + grub_sm712_gr_write (GRUB_VGA_NO_PLANES, GRUB_VGA_GR_COLOR_COMPARE); + grub_sm712_gr_write (GRUB_VGA_GR_DATA_ROTATE_NOP, GRUB_VGA_GR_DATA_ROTATE); + grub_sm712_gr_write (GRUB_VGA_NO_PLANES, GRUB_VGA_GR_READ_MAP_REGISTER); + grub_sm712_gr_write (GRUB_VGA_GR_MODE_256_COLOR, GRUB_VGA_GR_MODE); + grub_sm712_gr_write (GRUB_VGA_GR_GR6_MMAP_A0 + | GRUB_VGA_GR_GR6_GRAPHICS_MODE, GRUB_VGA_GR_GR6); + grub_sm712_gr_write (GRUB_VGA_ALL_PLANES, GRUB_VGA_GR_COLOR_COMPARE_DISABLE); + grub_sm712_gr_write (0xff, GRUB_VGA_GR_BITMASK); + + /* Write palette mapping. */ + for (i = 0; i < 16; i++) + grub_sm712_write_arx (i, i); + + grub_sm712_write_arx (GRUB_VGA_ARX_MODE_ENABLE_256COLOR + | GRUB_VGA_ARX_MODE_GRAPHICS, GRUB_VGA_ARX_MODE); + grub_sm712_write_arx (0, GRUB_VGA_ARX_OVERSCAN); + grub_sm712_write_arx (GRUB_VGA_ALL_PLANES, GRUB_VGA_ARX_COLOR_PLANE_ENABLE); + grub_sm712_write_arx (0, GRUB_VGA_ARX_HORIZONTAL_PANNING); + grub_sm712_write_arx (0, GRUB_VGA_ARX_COLOR_SELECT); + + /* FIXME: compute this generically. */ + { + struct grub_video_hw_config config = { - case 1: - *(volatile grub_uint8_t *) ((char *) framebuffer.ptr - + GRUB_SM712_REG_BASE - + sm712_init[i].addr) = sm712_init[i].val; - break; - case -1: - { - grub_uint8_t val = *(volatile grub_uint8_t *) - ((char *) framebuffer.ptr + GRUB_SM712_REG_BASE - + sm712_init[i].addr); - (void) val; - } - break; - } + .vertical_total = 806, + .vertical_blank_start = 0x300, + .vertical_blank_end = 0, + .vertical_sync_start = 0x303, + .vertical_sync_end = 0x9, + .line_compare = 0x3ff, + .vdisplay_end = 0x300, + .pitch = 0x80, + .horizontal_total = 164, + .horizontal_end = 128, + .horizontal_blank_start = 128, + .horizontal_blank_end = 0, + .horizontal_sync_pulse_start = 133, + .horizontal_sync_pulse_end = 22 + }; + grub_vga_set_geometry (&config, grub_sm712_cr_write); + config.horizontal_sync_pulse_start = 134; + config.horizontal_sync_pulse_end = 21; + config.vertical_sync_start = 0x301; + config.vertical_sync_end = 0x0; + config.line_compare = 0x0ff; + config.vdisplay_end = 0x258; + config.pitch = 0x7f; + grub_vga_set_geometry (&config, grub_sm712_cr_shadow_write); + } + grub_sm712_cr_write (GRUB_VGA_CR_BYTE_PANNING_NORMAL, + GRUB_VGA_CR_BYTE_PANNING); + grub_sm712_cr_write (0, GRUB_VGA_CR_CURSOR_START); + grub_sm712_cr_write (0, GRUB_VGA_CR_CURSOR_END); + grub_sm712_cr_write (0, GRUB_VGA_CR_START_ADDR_HIGH_REGISTER); + grub_sm712_cr_write (0, GRUB_VGA_CR_START_ADDR_LOW_REGISTER); + grub_sm712_cr_write (0, GRUB_VGA_CR_CURSOR_ADDR_HIGH); + grub_sm712_cr_write (0, GRUB_VGA_CR_CURSOR_ADDR_LOW); + grub_sm712_cr_write (GRUB_VGA_CR_UNDERLINE_LOCATION_DWORD_MODE, + GRUB_VGA_CR_UNDERLINE_LOCATION); + grub_sm712_cr_write (GRUB_VGA_CR_MODE_ADDRESS_WRAP + | GRUB_VGA_CR_MODE_BYTE_MODE + | GRUB_VGA_CR_MODE_TIMING_ENABLE + | GRUB_VGA_CR_MODE_NO_CGA + | GRUB_VGA_CR_MODE_NO_HERCULES, + GRUB_VGA_CR_MODE); + + grub_sm712_cr_write (0, GRUB_SM712_CR_OVERFLOW_INTERLACE); + grub_sm712_cr_write (0, GRUB_SM712_CR_INTERLACE_RETRACE); + grub_sm712_cr_write (0, GRUB_SM712_CR_TV_VDISPLAY_START); + grub_sm712_cr_write (0, GRUB_SM712_CR_TV_VDISPLAY_END_HIGH); + grub_sm712_cr_write (0, GRUB_SM712_CR_TV_VDISPLAY_END_LOW); + grub_sm712_cr_write (0x80, GRUB_SM712_CR_DDA_CONTROL_LOW); + grub_sm712_cr_write (0x02, GRUB_SM712_CR_DDA_CONTROL_HIGH); + + /* Undocumented */ + grub_sm712_cr_write (0x20, 0x37); + + grub_sm712_cr_write (0, GRUB_SM712_CR_TV_EQUALIZER); + grub_sm712_cr_write (0, GRUB_SM712_CR_TV_SERRATION); + grub_sm712_cr_write (0, GRUB_SM712_CR_HSYNC_CTRL); + + /* Undocumented */ + grub_sm712_cr_write (0x40, 0x3b); + + grub_sm712_cr_write (GRUB_SM712_CR_DEBUG_NONE, GRUB_SM712_CR_DEBUG); + + /* Undocumented */ + grub_sm712_cr_write (0xff, 0x3d); + grub_sm712_cr_write (0x46, 0x3e); + grub_sm712_cr_write (0x91, 0x3f); + + for (i = 0; i < ARRAY_SIZE (dda_lookups); i++) + grub_sm712_write_dda_lookup (i, dda_lookups[i].compare, dda_lookups[i].dda, + dda_lookups[i].vcentering); + + /* Undocumented */ + grub_sm712_cr_write (0, 0x9c); + grub_sm712_cr_write (0, 0x9d); + grub_sm712_cr_write (0, 0x9e); + grub_sm712_cr_write (0, 0x9f); + + grub_sm712_cr_write (0, GRUB_SM712_CR_VCENTERING_OFFSET); + grub_sm712_cr_write (0, GRUB_SM712_CR_HCENTERING_OFFSET); + + grub_sm712_write_reg (GRUB_VGA_IO_MISC_NEGATIVE_HORIZ_POLARITY + | GRUB_VGA_IO_MISC_UPPER_64K + | GRUB_VGA_IO_MISC_28MHZ + | GRUB_VGA_IO_MISC_ENABLE_VRAM_ACCESS + | GRUB_VGA_IO_MISC_COLOR, + GRUB_VGA_IO_MISC_WRITE); + +#ifndef TEST + /* Undocumented? */ *(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c00c) = 0; *(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c040) = 0; *(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c000) = 0x20000; *(volatile grub_uint32_t *) ((char *) framebuffer.ptr + 0x40c010) = 0x1020100; +#endif (void) grub_sm712_sr_read (0x16); - err = grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target, &framebuffer.mode_info, framebuffer.ptr); +#ifndef TEST + err = grub_video_fb_create_render_target_from_pointer (&framebuffer + .render_target, + &framebuffer.mode_info, + framebuffer.ptr); if (err) return err; @@ -203,9 +702,12 @@ grub_video_sm712_setup (unsigned int width, unsigned int height, /* Copy default palette to initialize emulated palette. */ err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS, grub_video_fbstd_colors); +#endif return err; } +#ifndef TEST + static grub_err_t grub_video_sm712_swap_buffers (void) { @@ -234,7 +736,6 @@ grub_video_sm712_get_info_and_fini (struct grub_video_mode_info *mode_info, return GRUB_ERR_NONE; } - static struct grub_video_adapter grub_video_sm712_adapter = { .name = "SM712 Video Driver", @@ -277,3 +778,10 @@ GRUB_MOD_FINI(video_sm712) { grub_video_unregister (&grub_video_sm712_adapter); } +#else +int +main () +{ + grub_video_sm712_setup (1024, 600, 0, 0); +} +#endif diff --git a/video/sm712_init.c b/video/sm712_init.c index 58dbbbbf9..cdb0b7383 100644 --- a/video/sm712_init.c +++ b/video/sm712_init.c @@ -1,540 +1,14 @@ /* Following sequence is a capture of sm712 initialisation sequence. */ -static struct -{ - int directive; - grub_uint32_t addr; - grub_uint32_t val; -} sm712_init[] = -{ - {1, 0x3c4, 0x21}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x62}, - {1, 0x3c5, 0x7a}, - {1, 0x3c4, 0x6a}, - {1, 0x3c5, 0x16}, - {1, 0x3c4, 0x6b}, - {1, 0x3c5, 0x2}, - {1, 0x3c6, 0x0}, - {1, 0x3c4, 0x0}, - {1, 0x3c5, 0x1}, - {1, 0x3c2, 0xeb}, - {1, 0x3c4, 0x0}, - {1, 0x3c5, 0x3}, - {1, 0x3c4, 0x1}, - {1, 0x3c5, 0x1}, - {1, 0x3c4, 0x2}, - {1, 0x3c5, 0xf}, - {1, 0x3c4, 0x3}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x4}, - {1, 0x3c5, 0xe}, - {1, 0x3c4, 0x10}, - {1, 0x3c5, 0xc8}, - {1, 0x3c4, 0x11}, - {1, 0x3c5, 0x40}, - {1, 0x3c4, 0x12}, - {1, 0x3c5, 0x14}, - {1, 0x3c4, 0x13}, - {1, 0x3c5, 0x60}, - {1, 0x3c4, 0x14}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x15}, - {1, 0x3c5, 0xa}, - {1, 0x3c4, 0x16}, - {1, 0x3c5, 0x92}, - {1, 0x3c4, 0x17}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x18}, - {1, 0x3c5, 0x51}, - {1, 0x3c4, 0x19}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x1a}, - {1, 0x3c5, 0x1}, - {1, 0x3c4, 0x1b}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x1c}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x1d}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x1e}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x1f}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x20}, - {1, 0x3c5, 0xc4}, - {1, 0x3c4, 0x21}, - {1, 0x3c5, 0x30}, - {1, 0x3c4, 0x22}, - {1, 0x3c5, 0x2}, - {1, 0x3c4, 0x23}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x24}, - {1, 0x3c5, 0x1}, - {1, 0x3c4, 0x30}, - {1, 0x3c5, 0x28}, - {1, 0x3c4, 0x31}, - {1, 0x3c5, 0x3}, - {1, 0x3c4, 0x32}, - {1, 0x3c5, 0x24}, - {1, 0x3c4, 0x33}, - {1, 0x3c5, 0x9}, - {1, 0x3c4, 0x34}, - {1, 0x3c5, 0xc0}, - {1, 0x3c4, 0x35}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x36}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x37}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x38}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x39}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x3a}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x3b}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x3c}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x3d}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x3e}, - {1, 0x3c5, 0x3}, - {1, 0x3c4, 0x3f}, - {1, 0x3c5, 0xff}, - {1, 0x3c4, 0x40}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x41}, - {1, 0x3c5, 0xfc}, - {1, 0x3c4, 0x42}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x43}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x44}, - {1, 0x3c5, 0x20}, - {1, 0x3c4, 0x45}, - {1, 0x3c5, 0x18}, - {1, 0x3c4, 0x46}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x47}, - {1, 0x3c5, 0xfc}, - {1, 0x3c4, 0x48}, - {1, 0x3c5, 0x20}, - {1, 0x3c4, 0x49}, - {1, 0x3c5, 0xc}, - {1, 0x3c4, 0x4a}, - {1, 0x3c5, 0x44}, - {1, 0x3c4, 0x4b}, - {1, 0x3c5, 0x20}, - {1, 0x3c4, 0x4c}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x4d}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x4e}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x4f}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x50}, - {1, 0x3c5, 0x6}, - {1, 0x3c4, 0x51}, - {1, 0x3c5, 0x68}, - {1, 0x3c4, 0x52}, - {1, 0x3c5, 0xa7}, - {1, 0x3c4, 0x53}, - {1, 0x3c5, 0x7f}, - {1, 0x3c4, 0x54}, - {1, 0x3c5, 0x83}, - {1, 0x3c4, 0x55}, - {1, 0x3c5, 0x24}, - {1, 0x3c4, 0x56}, - {1, 0x3c5, 0xff}, - {1, 0x3c4, 0x57}, - {1, 0x3c5, 0x3}, - {1, 0x3c4, 0x58}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x59}, - {1, 0x3c5, 0x60}, - {1, 0x3c4, 0x5a}, - {1, 0x3c5, 0x59}, - {1, 0x3c4, 0x5b}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x5c}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x5d}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x5e}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x5f}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x60}, - {1, 0x3c5, 0x1}, - {1, 0x3c4, 0x61}, - {1, 0x3c5, 0x80}, - {1, 0x3c4, 0x63}, - {1, 0x3c5, 0x1a}, - {1, 0x3c4, 0x64}, - {1, 0x3c5, 0x1a}, - {1, 0x3c4, 0x65}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x66}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x67}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x68}, - {1, 0x3c5, 0x50}, - {1, 0x3c4, 0x69}, - {1, 0x3c5, 0x3}, - {1, 0x3c4, 0x6c}, - {1, 0x3c5, 0x52}, - {1, 0x3c4, 0x6d}, - {1, 0x3c5, 0x89}, - {1, 0x3c4, 0x6e}, - {1, 0x3c5, 0x9}, - {1, 0x3c4, 0x6f}, - {1, 0x3c5, 0x2}, - {1, 0x3c4, 0x70}, - {1, 0x3c5, 0x4}, - {1, 0x3c4, 0x71}, - {1, 0x3c5, 0x45}, - {1, 0x3c4, 0x72}, - {1, 0x3c5, 0x30}, - {1, 0x3c4, 0x73}, - {1, 0x3c5, 0x30}, - {1, 0x3c4, 0x74}, - {1, 0x3c5, 0x40}, - {1, 0x3c4, 0x75}, - {1, 0x3c5, 0x20}, - {1, 0x3c4, 0x80}, - {1, 0x3c5, 0xff}, - {1, 0x3c4, 0x81}, - {1, 0x3c5, 0x7}, - {1, 0x3c4, 0x82}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x83}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x84}, - {1, 0x3c5, 0x8}, - {1, 0x3c4, 0x85}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x86}, - {1, 0x3c5, 0x42}, - {1, 0x3c4, 0x87}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x88}, - {1, 0x3c5, 0x59}, - {1, 0x3c4, 0x89}, - {1, 0x3c5, 0x2}, - {1, 0x3c4, 0x8a}, - {1, 0x3c5, 0x44}, - {1, 0x3c4, 0x8b}, - {1, 0x3c5, 0x2}, - {1, 0x3c4, 0x8c}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x8d}, - {1, 0x3c5, 0xff}, - {1, 0x3c4, 0x8e}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x8f}, - {1, 0x3c5, 0x3a}, - {1, 0x3c4, 0x90}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x91}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x92}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0x93}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0xa0}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0xa1}, - {1, 0x3c5, 0x10}, - {1, 0x3c4, 0xa2}, - {1, 0x3c5, 0x8}, - {1, 0x3c4, 0xa3}, - {1, 0x3c5, 0x0}, - {1, 0x3c4, 0xa4}, - {1, 0x3c5, 0x2}, - {1, 0x3c4, 0xa5}, - {1, 0x3c5, 0xed}, - {1, 0x3c4, 0xa6}, - {1, 0x3c5, 0xed}, - {1, 0x3c4, 0xa7}, - {1, 0x3c5, 0xed}, - {1, 0x3c4, 0xa8}, - {1, 0x3c5, 0x7b}, - {1, 0x3c4, 0xa9}, - {1, 0x3c5, 0xfb}, - {1, 0x3c4, 0xaa}, - {1, 0x3c5, 0xff}, - {1, 0x3c4, 0xab}, - {1, 0x3c5, 0xff}, - {1, 0x3c4, 0xac}, - {1, 0x3c5, 0x97}, - {1, 0x3c4, 0xad}, - {1, 0x3c5, 0xef}, - {1, 0x3c4, 0xae}, - {1, 0x3c5, 0xbf}, - {1, 0x3c4, 0xaf}, - {1, 0x3c5, 0xdf}, - {1, 0x3ce, 0x0}, - {1, 0x3cf, 0x0}, - {1, 0x3ce, 0x1}, - {1, 0x3cf, 0x0}, - {1, 0x3ce, 0x2}, - {1, 0x3cf, 0x0}, - {1, 0x3ce, 0x3}, - {1, 0x3cf, 0x0}, - {1, 0x3ce, 0x4}, - {1, 0x3cf, 0x0}, - {1, 0x3ce, 0x5}, - {1, 0x3cf, 0x40}, - {1, 0x3ce, 0x6}, - {1, 0x3cf, 0x5}, - {1, 0x3ce, 0x7}, - {1, 0x3cf, 0xf}, - {1, 0x3ce, 0x8}, - {1, 0x3cf, 0xff}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x0}, - {-1, 0x3c1, 0x3e}, - {1, 0x3c0, 0x0}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x1}, - {-1, 0x3c1, 0x3b}, - {1, 0x3c0, 0x1}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x2}, - {-1, 0x3c1, 0x3f}, - {1, 0x3c0, 0x2}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x3}, - {-1, 0x3c1, 0x3f}, - {1, 0x3c0, 0x3}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x4}, - {-1, 0x3c1, 0x3b}, - {1, 0x3c0, 0x4}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x5}, - {-1, 0x3c1, 0x2f}, - {1, 0x3c0, 0x5}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x6}, - {-1, 0x3c1, 0x3f}, - {1, 0x3c0, 0x6}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x7}, - {-1, 0x3c1, 0x3f}, - {1, 0x3c0, 0x7}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x8}, - {-1, 0x3c1, 0x3f}, - {1, 0x3c0, 0x8}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x9}, - {-1, 0x3c1, 0x3d}, - {1, 0x3c0, 0x9}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0xa}, - {-1, 0x3c1, 0x1f}, - {1, 0x3c0, 0xa}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0xb}, - {-1, 0x3c1, 0x1f}, - {1, 0x3c0, 0xb}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0xc}, - {-1, 0x3c1, 0x3f}, - {1, 0x3c0, 0xc}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0xd}, - {-1, 0x3c1, 0x3f}, - {1, 0x3c0, 0xd}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0xe}, - {-1, 0x3c1, 0x3f}, - {1, 0x3c0, 0xe}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0xf}, - {-1, 0x3c1, 0x2e}, - {1, 0x3c0, 0xf}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x10}, - {-1, 0x3c1, 0x0}, - {1, 0x3c0, 0x41}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x11}, - {-1, 0x3c1, 0x0}, - {1, 0x3c0, 0x0}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x12}, - {-1, 0x3c1, 0x0}, - {1, 0x3c0, 0xf}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x13}, - {-1, 0x3c1, 0x0}, - {1, 0x3c0, 0x0}, - {-1, 0x3da, 0x5}, - {1, 0x3c0, 0x14}, - {-1, 0x3c1, 0x0}, - {1, 0x3c0, 0x0}, - {1, 0x3d4, 0x0}, - {1, 0x3d5, 0xa3}, - {1, 0x3d4, 0x1}, - {1, 0x3d5, 0x7f}, - {1, 0x3d4, 0x2}, - {1, 0x3d5, 0x7f}, - {1, 0x3d4, 0x3}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x4}, - {1, 0x3d5, 0x85}, - {1, 0x3d4, 0x5}, - {1, 0x3d5, 0x16}, - {1, 0x3d4, 0x6}, - {1, 0x3d5, 0x24}, - {1, 0x3d4, 0x7}, - {1, 0x3d5, 0xf5}, - {1, 0x3d4, 0x8}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x9}, - {1, 0x3d5, 0x60}, - {1, 0x3d4, 0xa}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0xb}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0xc}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0xd}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0xe}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0xf}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x10}, - {1, 0x3d5, 0x3}, - {1, 0x3d4, 0x11}, - {1, 0x3d5, 0x9}, - {1, 0x3d4, 0x12}, - {1, 0x3d5, 0xff}, - {1, 0x3d4, 0x13}, - {1, 0x3d5, 0x80}, - {1, 0x3d4, 0x14}, - {1, 0x3d5, 0x40}, - {1, 0x3d4, 0x15}, - {1, 0x3d5, 0xff}, - {1, 0x3d4, 0x16}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x17}, - {1, 0x3d5, 0xe3}, - {1, 0x3d4, 0x18}, - {1, 0x3d5, 0xff}, - {1, 0x3d4, 0x30}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x31}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x32}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x33}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x34}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x35}, - {1, 0x3d5, 0x80}, - {1, 0x3d4, 0x36}, - {1, 0x3d5, 0x2}, - {1, 0x3d4, 0x37}, - {1, 0x3d5, 0x20}, - {1, 0x3d4, 0x38}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x39}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x3a}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x3b}, - {1, 0x3d5, 0x40}, - {1, 0x3d4, 0x3c}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x3d}, - {1, 0x3d5, 0xff}, - {1, 0x3d4, 0x3e}, - {1, 0x3d5, 0x46}, - {1, 0x3d4, 0x3f}, - {1, 0x3d5, 0x91}, - {1, 0x3d4, 0x40}, - {1, 0x3d5, 0xa3}, - {1, 0x3d4, 0x41}, - {1, 0x3d5, 0x7f}, - {1, 0x3d4, 0x42}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x43}, - {1, 0x3d5, 0x86}, - {1, 0x3d4, 0x44}, - {1, 0x3d5, 0x15}, - {1, 0x3d4, 0x45}, - {1, 0x3d5, 0x24}, - {1, 0x3d4, 0x46}, - {1, 0x3d5, 0xff}, - {1, 0x3d4, 0x47}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x48}, - {1, 0x3d5, 0x1}, - {1, 0x3d4, 0x49}, - {1, 0x3d5, 0x7}, - {1, 0x3d4, 0x4a}, - {1, 0x3d5, 0xe5}, - {1, 0x3d4, 0x4b}, - {1, 0x3d5, 0x20}, - {1, 0x3d4, 0x4c}, - {1, 0x3d5, 0x7f}, - {1, 0x3d4, 0x4d}, - {1, 0x3d5, 0x57}, - {1, 0x3d4, 0x90}, - {1, 0x3d5, 0x55}, - {1, 0x3d4, 0x91}, - {1, 0x3d5, 0xd5}, - {1, 0x3d4, 0x92}, - {1, 0x3d5, 0x5d}, - {1, 0x3d4, 0x93}, - {1, 0x3d5, 0xdd}, - {1, 0x3d4, 0x94}, - {1, 0x3d5, 0x86}, - {1, 0x3d4, 0x95}, - {1, 0x3d5, 0x17}, - {1, 0x3d4, 0x96}, - {1, 0x3d5, 0x8e}, - {1, 0x3d4, 0x97}, - {1, 0x3d5, 0xaa}, - {1, 0x3d4, 0x98}, - {1, 0x3d5, 0x8a}, - {1, 0x3d4, 0x99}, - {1, 0x3d5, 0xa3}, - {1, 0x3d4, 0x9a}, - {1, 0x3d5, 0xde}, - {1, 0x3d4, 0x9b}, - {1, 0x3d5, 0xab}, - {1, 0x3d4, 0x9c}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x9d}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x9e}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0x9f}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0xa0}, - {1, 0x3d5, 0x2}, - {1, 0x3d4, 0xa1}, - {1, 0x3d5, 0x2}, - {1, 0x3d4, 0xa2}, - {1, 0x3d5, 0x2}, - {1, 0x3d4, 0xa3}, - {1, 0x3d5, 0x15}, - {1, 0x3d4, 0xa4}, - {1, 0x3d5, 0x2}, - {1, 0x3d4, 0xa5}, - {1, 0x3d5, 0x6}, - {1, 0x3d4, 0xa6}, - {1, 0x3d5, 0x0}, - {1, 0x3d4, 0xa7}, - {1, 0x3d5, 0x0}, - {1, 0x3c2, 0x67}, -}; +static grub_uint8_t sm712_sr_seq1[] = + { 0xc8, 0x40, 0x14, 0x60, 0x0, 0xa, 0x92, 0x0, + 0x51, 0x00, 0x01, 0x00, 0x0, 0x0, 0x00, 0x0, + 0xc4, 0x30, 0x02, 0x00, 0x1 }; + +static grub_uint8_t sm712_sr_seq2[] = + { 0x28, 0x03, 0x24, 0x09, 0xc0, 0x3a, 0x3a, 0x3a, + 0x3a, 0x3a, 0x3a, 0x3a, 0x00, 0x00, 0x03, 0xff, + 0x00, 0xfc, 0x00, 0x00, 0x20, 0x18, 0x00, 0xfc, + 0x20, 0x0c, 0x44, 0x20, 0x00, 0x00, 0x00, 0x3a, + 0x06, 0x68, 0xa7, 0x7f, 0x83, 0x24, 0xff, 0x03, + 0x00, 0x60, 0x59, 0x3a, 0x3a, 0x00, 0x00, 0x3a, + 0x01, 0x80 }; From d04b9414a8ab42944596950514f6353c8734eb60 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 11 Aug 2010 04:25:56 +0200 Subject: [PATCH 105/174] * kern/i386/qemu/init.c (grub_qemu_init_cirrus): Fix compilation error. --- ChangeLog | 4 ++++ kern/i386/qemu/init.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d9d7a759..dae79ab7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-11 Vladimir Serbinenko + + * kern/i386/qemu/init.c (grub_qemu_init_cirrus): Fix compilation error. + 2010-08-11 Vladimir Serbinenko Remove the dump of sm712 initialisation sequence. diff --git a/kern/i386/qemu/init.c b/kern/i386/qemu/init.c index bd12953df..054dfa86b 100644 --- a/kern/i386/qemu/init.c +++ b/kern/i386/qemu/init.c @@ -121,11 +121,11 @@ grub_qemu_init_cirrus (void) GRUB_VGA_SR_MAP_MASK_REGISTER); grub_vga_cr_write (15, GRUB_VGA_CR_CELL_HEIGHT); - grub_vga_cr_write (79, GRUB_VGA_CR_WIDTH); + grub_vga_cr_write (79, GRUB_VGA_CR_HORIZ_END); grub_vga_cr_write (40, GRUB_VGA_CR_PITCH); int vert = 25 * 16; - grub_vga_cr_write (vert & 0xff, GRUB_VGA_CR_HEIGHT); + grub_vga_cr_write (vert & 0xff, GRUB_VGA_CR_VDISPLAY_END); grub_vga_cr_write (((vert >> GRUB_VGA_CR_OVERFLOW_HEIGHT1_SHIFT) & GRUB_VGA_CR_OVERFLOW_HEIGHT1_MASK) | ((vert >> GRUB_VGA_CR_OVERFLOW_HEIGHT2_SHIFT) From 79a6ba6101bfbcab861d0e2cb9bcc4552b042cd6 Mon Sep 17 00:00:00 2001 From: Yves Blusseau Date: Wed, 11 Aug 2010 13:24:37 +0200 Subject: [PATCH 106/174] 2010-08-11 Yves Blusseau * .bzrignore: add grub-macho2img --- .bzrignore | 1 + ChangeLog | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.bzrignore b/.bzrignore index 32b96b154..26558087a 100644 --- a/.bzrignore +++ b/.bzrignore @@ -40,6 +40,7 @@ grub-fstest grub_fstest_init.c grub_fstest_init.h grub-install +grub-macho2img grub-mk* grub-pbkdf2 grub-pe2elf diff --git a/ChangeLog b/ChangeLog index dae79ab7e..005428b5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-11 Yves Blusseau + + * .bzrignore: add grub-macho2img + 2010-08-11 Vladimir Serbinenko * kern/i386/qemu/init.c (grub_qemu_init_cirrus): Fix compilation error. From 681440aa5bda1d517158d7f1fd821971419b9ea8 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 12 Aug 2010 20:45:55 +0530 Subject: [PATCH 107/174] fix bad color name handling --- include/grub/normal.h | 2 +- normal/color.c | 25 ++++++++++++++----------- normal/main.c | 4 ++++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/include/grub/normal.h b/include/grub/normal.h index a33e42e61..2a0298bc6 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -73,7 +73,7 @@ grub_err_t grub_normal_print_device_info (const char *name); /* Defined in `color.c'. */ char *grub_env_write_color_normal (struct grub_env_var *var, const char *val); char *grub_env_write_color_highlight (struct grub_env_var *var, const char *val); -void grub_parse_color_name_pair (grub_uint8_t *ret, const char *name); +int grub_parse_color_name_pair (grub_uint8_t *ret, const char *name); /* Defined in `menu_text.c'. */ void grub_wait_after_message (void); diff --git a/normal/color.c b/normal/color.c index bae082911..a16d1c2f9 100644 --- a/normal/color.c +++ b/normal/color.c @@ -56,22 +56,23 @@ parse_color_name (grub_uint8_t *ret, char *name) return -1; } -void -grub_parse_color_name_pair (grub_uint8_t *ret, const char *name) +int +grub_parse_color_name_pair (grub_uint8_t *color, const char *name) { + int result = 1; grub_uint8_t fg, bg; char *fg_name, *bg_name; /* nothing specified by user */ if (name == NULL) - return; + return result; fg_name = grub_strdup (name); if (fg_name == NULL) { /* "out of memory" message was printed by grub_strdup() */ grub_wait_after_message (); - return; + return result; } bg_name = grub_strchr (fg_name, '/'); @@ -97,10 +98,12 @@ grub_parse_color_name_pair (grub_uint8_t *ret, const char *name) goto free_and_return; } - *ret = (bg << 4) | fg; + *color = (bg << 4) | fg; + result = 0; free_and_return: grub_free (fg_name); + return result; } static grub_uint8_t color_normal, color_highlight; @@ -122,10 +125,10 @@ set_colors (void) /* Replace default `normal' colors with the ones specified by user (if any). */ char * -grub_env_write_color_normal (struct grub_env_var *var __attribute__ ((unused)), - const char *val) +grub_env_write_color_normal (struct grub_env_var *var, const char *val) { - grub_parse_color_name_pair (&color_normal, val); + if (grub_parse_color_name_pair (&color_normal, val)) + return 0; set_colors (); @@ -134,10 +137,10 @@ grub_env_write_color_normal (struct grub_env_var *var __attribute__ ((unused)), /* Replace default `highlight' colors with the ones specified by user (if any). */ char * -grub_env_write_color_highlight (struct grub_env_var *var __attribute__ ((unused)), - const char *val) +grub_env_write_color_highlight (struct grub_env_var *var, const char *val) { - grub_parse_color_name_pair (&color_highlight, val); + if (grub_parse_color_name_pair (&color_highlight, val)) + return 0; set_colors (); diff --git a/normal/main.c b/normal/main.c index 5df889466..49658fd24 100644 --- a/normal/main.c +++ b/normal/main.c @@ -705,6 +705,10 @@ GRUB_MOD_INIT(normal) /* Preserve hooks after context changes. */ grub_env_export ("color_normal"); grub_env_export ("color_highlight"); + + /* Set default color names. */ + grub_env_set ("color_normal", "white/black"); + grub_env_set ("color_highlight", "black/white"); } GRUB_MOD_FINI(normal) From f3710e088ce80dcc038b6c890191f7646461a101 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sat, 14 Aug 2010 16:53:25 +0200 Subject: [PATCH 108/174] 2010-08-14 Robert Millan * kern/emu/misc.c (grub_find_zpool_from_dir): Abort function if filesystem is not ZFS. --- ChangeLog | 5 +++++ kern/emu/misc.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3703337d8..b88eae46f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-14 Robert Millan + + * kern/emu/misc.c (grub_find_zpool_from_dir): Abort function if + filesystem is not ZFS. + 2010-08-12 BVK Chaitanya Fix for misspelled color names defaulting to black/black (bug diff --git a/kern/emu/misc.c b/kern/emu/misc.c index 760471ebb..29be87720 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -288,6 +288,9 @@ grub_find_zpool_from_dir (const char *dir, char **poolname, char **poolfs) if (statfs (dir, &mnt) != 0) return; + if (strcmp (mnt.f_fstypename, "zfs") != 0) + return; + *poolname = xstrdup (mnt.f_mntfromname); slash = strchr (*poolname, '/'); From db4122ba305f95060232e80c5b8c5578cad3e970 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sun, 15 Aug 2010 20:40:24 +0530 Subject: [PATCH 109/174] fix for grub-core parallel build failure --- grub-core/configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/configure.ac b/grub-core/configure.ac index 691876cac..eed7f354f 100644 --- a/grub-core/configure.ac +++ b/grub-core/configure.ac @@ -60,7 +60,7 @@ CCAS=$TARGET_CC grub_CHECK_LINK_DIR if test x"$link_dir" = xyes ; then AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu]) - cp -rp $srcdir/lib/$target_cpu lib/target_cpu + cp -r $srcdir/lib/$target_cpu/* lib/target_cpu if test "$platform" != emu ; then AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform]) fi From 0a4fc180ec48e4a84c23b83ebd664b764a3bea25 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sun, 15 Aug 2010 21:09:37 +0530 Subject: [PATCH 110/174] parallel build fix for utils --- gentpl.py | 3 +-- grub-core/configure.ac | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gentpl.py b/gentpl.py index ba776d642..6dd5e84a2 100644 --- a/gentpl.py +++ b/gentpl.py @@ -342,8 +342,7 @@ def installdir(default="bin"): def manpage(): r = "if COND_MAN_PAGES\n" r += gvar_add("man_MANS", "[+ name +].[+ mansection +]\n") - r += rule("[+ name +].[+ mansection +]", "", """ -$(MAKE) $(AM_MAKEFLAGS) [+ name +] + r += rule("[+ name +].[+ mansection +]", "[+ name +]", """ chmod a+x [+ name +] PATH=$(builddir):$$PATH $(HELP2MAN) --section=[+ mansection +] -i $(top_srcdir)/docs/man/[+ name +].h2m -o $@ [+ name +] """) diff --git a/grub-core/configure.ac b/grub-core/configure.ac index eed7f354f..6a84c16e1 100644 --- a/grub-core/configure.ac +++ b/grub-core/configure.ac @@ -60,6 +60,7 @@ CCAS=$TARGET_CC grub_CHECK_LINK_DIR if test x"$link_dir" = xyes ; then AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu]) + mkdir -p lib/target_cpu cp -r $srcdir/lib/$target_cpu/* lib/target_cpu if test "$platform" != emu ; then AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform]) From 729a0f2e0c59b342292ceb47fbc014f00c409524 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 15 Aug 2010 22:48:23 +0200 Subject: [PATCH 111/174] 2010-08-15 Robert Millan * kern/emu/misc.c (grub_get_libzfs_handle): Handle libzfs_init() errors. * kern/emu/getroot.c (find_root_device_from_libzfs): Handle grub_get_libzfs_handle() errors. --- ChangeLog | 7 +++++++ kern/emu/getroot.c | 7 ++++++- kern/emu/misc.c | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b88eae46f..b662428bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-08-15 Robert Millan + + * kern/emu/misc.c (grub_get_libzfs_handle): Handle libzfs_init() + errors. + * kern/emu/getroot.c (find_root_device_from_libzfs): Handle + grub_get_libzfs_handle() errors. + 2010-08-14 Robert Millan * kern/emu/misc.c (grub_find_zpool_from_dir): Abort function if diff --git a/kern/emu/getroot.c b/kern/emu/getroot.c index 321b33bb3..c0a10d22b 100644 --- a/kern/emu/getroot.c +++ b/kern/emu/getroot.c @@ -188,11 +188,16 @@ find_root_device_from_libzfs (const char *dir) { zpool_handle_t *zpool; + libzfs_handle_t *libzfs; nvlist_t *nvlist; nvlist_t **nvlist_array; unsigned int nvlist_count; - zpool = zpool_open (grub_get_libzfs_handle (), poolname); + libzfs = grub_get_libzfs_handle (); + if (! libzfs) + return NULL; + + zpool = zpool_open (libzfs, poolname); nvlist = zpool_get_config (zpool, NULL); if (nvlist_lookup_nvlist (nvlist, "vdev_tree", &nvlist) != 0) diff --git a/kern/emu/misc.c b/kern/emu/misc.c index 29be87720..82f579616 100644 --- a/kern/emu/misc.c +++ b/kern/emu/misc.c @@ -268,7 +268,9 @@ grub_get_libzfs_handle (void) if (! __libzfs_handle) { __libzfs_handle = libzfs_init (); - atexit (fini_libzfs); + + if (__libzfs_handle) + atexit (fini_libzfs); } return __libzfs_handle; From 1ec4a279280d34ad2c5f19ef8a8024321aff8607 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 16 Aug 2010 15:04:30 +0530 Subject: [PATCH 112/174] export command supports multiple args --- normal/context.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/normal/context.c b/normal/context.c index 27adf287a..68f7626b9 100644 --- a/normal/context.c +++ b/normal/context.c @@ -158,11 +158,15 @@ static grub_err_t grub_cmd_export (struct grub_command *cmd __attribute__ ((unused)), int argc, char **args) { + int i; + if (argc < 1) return grub_error (GRUB_ERR_BAD_ARGUMENT, "no environment variable specified"); - grub_env_export (args[0]); + for (i = 0; i < argc; i++) + grub_env_export (args[i]); + return 0; } @@ -173,7 +177,8 @@ grub_context_init (void) grub_env_export ("prefix"); export_cmd = grub_register_command ("export", grub_cmd_export, - N_("ENVVAR"), N_("Export a variable.")); + N_("ENVVAR..."), + N_("Export variables.")); } void From 6304d2925501183585ad37573ba2a88dc9e8b640 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 17 Aug 2010 19:03:22 +0530 Subject: [PATCH 113/174] working copy, wo nested packaging --- autogen.sh | 29 +- {grub-core/conf => conf}/any-emu.rmk | 0 {grub-core/conf => conf}/common.rmk | 0 {grub-core/conf => conf}/i386-coreboot.rmk | 0 {grub-core/conf => conf}/i386-efi.rmk | 0 {grub-core/conf => conf}/i386-ieee1275.rmk | 0 {grub-core/conf => conf}/i386-multiboot.rmk | 0 .../conf => conf}/i386-pc-cygwin-img-ld.sc | 0 {grub-core/conf => conf}/i386-pc.rmk | 0 {grub-core/conf => conf}/i386-qemu.rmk | 0 {grub-core/conf => conf}/i386.rmk | 0 {grub-core/conf => conf}/mips-qemu-mips.rmk | 0 {grub-core/conf => conf}/mips-yeeloong.rmk | 0 {grub-core/conf => conf}/mips.rmk | 0 {grub-core/conf => conf}/powerpc-ieee1275.rmk | 0 {grub-core/conf => conf}/sparc64-ieee1275.rmk | 0 {grub-core/conf => conf}/tests.rmk | 0 {grub-core/conf => conf}/x86-efi.rmk | 0 {grub-core/conf => conf}/x86_64-efi.rmk | 0 configure.ac | 25 +- gentpl.py | 32 +- grub-core/Makefile.am | 326 +++++++++++++++++- grub-core/Makefile.kernel | 250 +++++++------- grub-core/Makefile.vars | 4 +- .../include => include}/grub/acorn_filecore.h | 0 {grub-core/include => include}/grub/acpi.h | 0 {grub-core/include => include}/grub/aout.h | 0 .../include => include}/grub/at_keyboard.h | 0 {grub-core/include => include}/grub/ata.h | 0 {grub-core/include => include}/grub/auth.h | 0 {grub-core/include => include}/grub/autoefi.h | 0 {grub-core/include => include}/grub/bitmap.h | 0 .../include => include}/grub/bitmap_scale.h | 0 {grub-core/include => include}/grub/boot.h | 0 .../include => include}/grub/bsdlabel.h | 0 {grub-core/include => include}/grub/bufio.h | 0 {grub-core/include => include}/grub/cache.h | 0 {grub-core/include => include}/grub/charset.h | 0 {grub-core/include => include}/grub/cmos.h | 0 {grub-core/include => include}/grub/command.h | 0 {grub-core/include => include}/grub/crypto.h | 0 {grub-core/include => include}/grub/cs5536.h | 0 .../include => include}/grub/datetime.h | 0 {grub-core/include => include}/grub/device.h | 0 {grub-core/include => include}/grub/disk.h | 0 {grub-core/include => include}/grub/dl.h | 0 {grub-core/include => include}/grub/efi/api.h | 0 .../include => include}/grub/efi/console.h | 0 .../grub/efi/console_control.h | 0 .../include => include}/grub/efi/disk.h | 0 {grub-core/include => include}/grub/efi/efi.h | 0 .../grub/efi/graphics_output.h | 0 .../include => include}/grub/efi/memory.h | 0 .../include => include}/grub/efi/pe32.h | 0 .../include => include}/grub/efi/time.h | 0 .../include => include}/grub/efi/uga_draw.h | 0 .../include => include}/grub/efiemu/efiemu.h | 0 .../include => include}/grub/efiemu/runtime.h | 0 {grub-core/include => include}/grub/elf.h | 0 {grub-core/include => include}/grub/elfload.h | 0 .../include => include}/grub/emu/console.h | 0 .../include => include}/grub/emu/getroot.h | 0 .../include => include}/grub/emu/hostdisk.h | 0 .../include => include}/grub/emu/misc.h | 0 {grub-core/include => include}/grub/env.h | 0 .../include => include}/grub/env_private.h | 0 {grub-core/include => include}/grub/err.h | 0 {grub-core/include => include}/grub/extcmd.h | 0 {grub-core/include => include}/grub/fbblit.h | 0 {grub-core/include => include}/grub/fbfill.h | 0 {grub-core/include => include}/grub/fbutil.h | 0 {grub-core/include => include}/grub/file.h | 0 {grub-core/include => include}/grub/font.h | 0 .../include => include}/grub/fontformat.h | 0 {grub-core/include => include}/grub/fs.h | 0 {grub-core/include => include}/grub/fshelp.h | 0 .../include => include}/grub/gfxmenu_model.h | 0 .../include => include}/grub/gfxmenu_view.h | 0 {grub-core/include => include}/grub/gfxterm.h | 0 .../include => include}/grub/gfxwidgets.h | 0 .../include => include}/grub/gpt_partition.h | 0 {grub-core/include => include}/grub/gui.h | 0 .../grub/gui_string_util.h | 0 {grub-core/include => include}/grub/gzio.h | 0 {grub-core/include => include}/grub/hfs.h | 0 {grub-core/include => include}/grub/i18n.h | 0 .../grub/i386/at_keyboard.h | 0 .../include => include}/grub/i386/bsd.h | 0 .../include => include}/grub/i386/cmos.h | 0 .../grub/i386/coreboot/boot.h | 0 .../grub/i386/coreboot/console.h | 0 .../grub/i386/coreboot/init.h | 0 .../grub/i386/coreboot/loader.h | 0 .../grub/i386/coreboot/memory.h | 0 .../grub/i386/coreboot/serial.h | 0 .../grub/i386/coreboot/time.h | 0 .../include => include}/grub/i386/cpuid.h | 0 .../grub/i386/efi/loader.h | 0 .../grub/i386/efi/memory.h | 0 .../grub/i386/efi/serial.h | 0 .../include => include}/grub/i386/efi/time.h | 0 .../include => include}/grub/i386/efiemu.h | 0 .../grub/i386/freebsd_linker.h | 0 .../grub/i386/freebsd_reboot.h | 0 .../grub/i386/ieee1275/ieee1275.h | 0 .../grub/i386/ieee1275/loader.h | 0 .../grub/i386/ieee1275/memory.h | 0 .../grub/i386/ieee1275/serial.h | 0 .../grub/i386/ieee1275/time.h | 0 {grub-core/include => include}/grub/i386/io.h | 0 .../include => include}/grub/i386/linux.h | 0 .../include => include}/grub/i386/loader.h | 0 .../include => include}/grub/i386/macho.h | 0 .../include => include}/grub/i386/memory.h | 0 .../include => include}/grub/i386/multiboot.h | 0 .../grub/i386/multiboot/boot.h | 0 .../grub/i386/multiboot/console.h | 0 .../grub/i386/multiboot/init.h | 0 .../grub/i386/multiboot/kernel.h | 0 .../grub/i386/multiboot/loader.h | 0 .../grub/i386/multiboot/memory.h | 0 .../grub/i386/multiboot/serial.h | 0 .../grub/i386/multiboot/time.h | 0 .../grub/i386/netbsd_bootinfo.h | 0 .../grub/i386/netbsd_reboot.h | 0 .../grub/i386/openbsd_bootarg.h | 0 .../grub/i386/openbsd_reboot.h | 0 .../grub/i386/pc/biosdisk.h | 0 .../grub/i386/pc/biosnum.h | 0 .../include => include}/grub/i386/pc/boot.h | 0 .../grub/i386/pc/chainloader.h | 0 .../grub/i386/pc/console.h | 0 .../include => include}/grub/i386/pc/efiemu.h | 0 .../include => include}/grub/i386/pc/init.h | 0 .../include => include}/grub/i386/pc/kernel.h | 0 .../include => include}/grub/i386/pc/loader.h | 0 .../include => include}/grub/i386/pc/memory.h | 0 .../include => include}/grub/i386/pc/pxe.h | 0 .../include => include}/grub/i386/pc/time.h | 0 .../include => include}/grub/i386/pc/vbe.h | 0 .../include => include}/grub/i386/pc/vga.h | 0 .../include => include}/grub/i386/pci.h | 0 .../include => include}/grub/i386/pit.h | 0 .../include => include}/grub/i386/qemu/boot.h | 0 .../grub/i386/qemu/console.h | 0 .../include => include}/grub/i386/qemu/init.h | 0 .../grub/i386/qemu/kernel.h | 0 .../grub/i386/qemu/loader.h | 0 .../grub/i386/qemu/memory.h | 0 .../grub/i386/qemu/serial.h | 0 .../include => include}/grub/i386/qemu/time.h | 0 .../include => include}/grub/i386/relocator.h | 0 .../include => include}/grub/i386/setjmp.h | 0 .../include => include}/grub/i386/time.h | 0 .../include => include}/grub/i386/tsc.h | 0 .../include => include}/grub/i386/types.h | 0 .../grub/i386/vga_common.h | 0 .../include => include}/grub/i386/xnu.h | 0 .../include => include}/grub/icon_manager.h | 0 .../grub/ieee1275/console.h | 0 .../grub/ieee1275/ieee1275.h | 0 .../grub/ieee1275/ofdisk.h | 0 {grub-core/include => include}/grub/kernel.h | 0 .../include => include}/grub/lib/LzFind.h | 0 .../include => include}/grub/lib/LzHash.h | 0 .../include => include}/grub/lib/LzmaDec.h | 0 .../include => include}/grub/lib/LzmaEnc.h | 0 .../include => include}/grub/lib/LzmaTypes.h | 0 {grub-core/include => include}/grub/lib/arg.h | 0 {grub-core/include => include}/grub/lib/crc.h | 0 .../include => include}/grub/lib/envblk.h | 0 .../include => include}/grub/lib/hexdump.h | 0 {grub-core/include => include}/grub/libgcc.h | 0 .../include => include}/grub/libpciaccess.h | 0 {grub-core/include => include}/grub/libusb.h | 0 {grub-core/include => include}/grub/list.h | 0 {grub-core/include => include}/grub/loader.h | 0 {grub-core/include => include}/grub/lvm.h | 0 {grub-core/include => include}/grub/macho.h | 0 .../include => include}/grub/machoload.h | 0 {grub-core/include => include}/grub/memory.h | 0 {grub-core/include => include}/grub/menu.h | 0 .../include => include}/grub/menu_viewer.h | 0 .../grub/mips/at_keyboard.h | 0 .../include => include}/grub/mips/cache.h | 0 .../include => include}/grub/mips/cmos.h | 0 {grub-core/include => include}/grub/mips/io.h | 0 .../include => include}/grub/mips/loongson.h | 0 .../include => include}/grub/mips/multiboot.h | 0 .../include => include}/grub/mips/pci.h | 0 .../grub/mips/qemu-mips/kernel.h | 0 .../grub/mips/qemu-mips/loader.h | 0 .../grub/mips/qemu-mips/memory.h | 0 .../grub/mips/qemu-mips/serial.h | 0 .../grub/mips/qemu-mips/time.h | 0 .../include => include}/grub/mips/relocator.h | 0 .../include => include}/grub/mips/setjmp.h | 0 .../include => include}/grub/mips/time.h | 0 .../include => include}/grub/mips/types.h | 0 .../grub/mips/yeeloong/at_keyboard.h | 0 .../grub/mips/yeeloong/cmos.h | 0 .../grub/mips/yeeloong/ec.h | 0 .../grub/mips/yeeloong/kernel.h | 0 .../grub/mips/yeeloong/loader.h | 0 .../grub/mips/yeeloong/memory.h | 0 .../grub/mips/yeeloong/pci.h | 0 .../grub/mips/yeeloong/serial.h | 0 .../grub/mips/yeeloong/time.h | 0 {grub-core/include => include}/grub/misc.h | 0 {grub-core/include => include}/grub/mm.h | 0 .../grub/msdos_partition.h | 0 .../include => include}/grub/multiboot.h | 0 .../grub/multiboot_loader.h | 0 {grub-core/include => include}/grub/net.h | 0 {grub-core/include => include}/grub/normal.h | 0 {grub-core/include => include}/grub/ntfs.h | 0 {grub-core/include => include}/grub/offsets.h | 0 {grub-core/include => include}/grub/parser.h | 0 .../include => include}/grub/partition.h | 0 .../include => include}/grub/parttool.h | 0 {grub-core/include => include}/grub/pci.h | 0 .../include => include}/grub/pciutils.h | 0 .../grub/powerpc/ieee1275/biosdisk.h | 0 .../grub/powerpc/ieee1275/ieee1275.h | 0 .../grub/powerpc/ieee1275/loader.h | 0 .../grub/powerpc/ieee1275/memory.h | 0 .../grub/powerpc/ieee1275/time.h | 0 .../grub/powerpc/ieee1275/util/biosdisk.h | 0 .../include => include}/grub/powerpc/kernel.h | 0 .../include => include}/grub/powerpc/setjmp.h | 0 .../include => include}/grub/powerpc/time.h | 0 .../include => include}/grub/powerpc/types.h | 0 {grub-core/include => include}/grub/raid.h | 0 {grub-core/include => include}/grub/reader.h | 0 .../include => include}/grub/script_sh.h | 0 {grub-core/include => include}/grub/scsi.h | 0 {grub-core/include => include}/grub/scsicmd.h | 0 {grub-core/include => include}/grub/sdl.h | 0 {grub-core/include => include}/grub/search.h | 0 {grub-core/include => include}/grub/serial.h | 0 {grub-core/include => include}/grub/setjmp.h | 0 {grub-core/include => include}/grub/smbus.h | 0 .../grub/sparc64/ieee1275/boot.h | 0 .../grub/sparc64/ieee1275/ieee1275.h | 0 .../grub/sparc64/ieee1275/kernel.h | 0 .../grub/sparc64/ieee1275/loader.h | 0 .../grub/sparc64/ieee1275/memory.h | 0 .../grub/sparc64/ieee1275/time.h | 0 .../include => include}/grub/sparc64/setjmp.h | 0 .../include => include}/grub/sparc64/time.h | 0 .../include => include}/grub/sparc64/types.h | 0 {grub-core/include => include}/grub/symbol.h | 0 {grub-core/include => include}/grub/term.h | 0 .../include => include}/grub/terminfo.h | 0 {grub-core/include => include}/grub/test.h | 0 {grub-core/include => include}/grub/time.h | 0 {grub-core/include => include}/grub/tparm.h | 0 {grub-core/include => include}/grub/trig.h | 0 {grub-core/include => include}/grub/types.h | 0 {grub-core/include => include}/grub/unicode.h | 0 {grub-core/include => include}/grub/usb.h | 0 {grub-core/include => include}/grub/usbdesc.h | 0 .../include => include}/grub/usbtrans.h | 0 .../grub/util/deviceiter.h | 0 .../include => include}/grub/util/lvm.h | 0 .../include => include}/grub/util/misc.h | 0 .../include => include}/grub/util/ofpath.h | 0 .../include => include}/grub/util/raid.h | 0 .../include => include}/grub/util/resolve.h | 0 {grub-core/include => include}/grub/vga.h | 0 {grub-core/include => include}/grub/video.h | 0 .../include => include}/grub/video_fb.h | 0 .../grub/x86_64/at_keyboard.h | 0 .../grub/x86_64/efi/boot.h | 0 .../grub/x86_64/efi/loader.h | 0 .../grub/x86_64/efi/memory.h | 0 .../grub/x86_64/efi/serial.h | 0 .../grub/x86_64/efi/time.h | 0 .../include => include}/grub/x86_64/io.h | 0 .../include => include}/grub/x86_64/linux.h | 0 .../include => include}/grub/x86_64/macho.h | 0 .../grub/x86_64/multiboot.h | 0 .../include => include}/grub/x86_64/pci.h | 0 .../grub/x86_64/relocator.h | 0 .../include => include}/grub/x86_64/setjmp.h | 0 .../include => include}/grub/x86_64/time.h | 0 .../include => include}/grub/x86_64/types.h | 0 .../include => include}/grub/x86_64/xnu.h | 0 {grub-core/include => include}/grub/xnu.h | 0 {grub-core/include => include}/multiboot.h | 0 {grub-core/include => include}/multiboot2.h | 0 {grub-core => util}/import_gcry.py | 2 +- 292 files changed, 481 insertions(+), 187 deletions(-) rename {grub-core/conf => conf}/any-emu.rmk (100%) rename {grub-core/conf => conf}/common.rmk (100%) rename {grub-core/conf => conf}/i386-coreboot.rmk (100%) rename {grub-core/conf => conf}/i386-efi.rmk (100%) rename {grub-core/conf => conf}/i386-ieee1275.rmk (100%) rename {grub-core/conf => conf}/i386-multiboot.rmk (100%) rename {grub-core/conf => conf}/i386-pc-cygwin-img-ld.sc (100%) rename {grub-core/conf => conf}/i386-pc.rmk (100%) rename {grub-core/conf => conf}/i386-qemu.rmk (100%) rename {grub-core/conf => conf}/i386.rmk (100%) rename {grub-core/conf => conf}/mips-qemu-mips.rmk (100%) rename {grub-core/conf => conf}/mips-yeeloong.rmk (100%) rename {grub-core/conf => conf}/mips.rmk (100%) rename {grub-core/conf => conf}/powerpc-ieee1275.rmk (100%) rename {grub-core/conf => conf}/sparc64-ieee1275.rmk (100%) rename {grub-core/conf => conf}/tests.rmk (100%) rename {grub-core/conf => conf}/x86-efi.rmk (100%) rename {grub-core/conf => conf}/x86_64-efi.rmk (100%) rename {grub-core/include => include}/grub/acorn_filecore.h (100%) rename {grub-core/include => include}/grub/acpi.h (100%) rename {grub-core/include => include}/grub/aout.h (100%) rename {grub-core/include => include}/grub/at_keyboard.h (100%) rename {grub-core/include => include}/grub/ata.h (100%) rename {grub-core/include => include}/grub/auth.h (100%) rename {grub-core/include => include}/grub/autoefi.h (100%) rename {grub-core/include => include}/grub/bitmap.h (100%) rename {grub-core/include => include}/grub/bitmap_scale.h (100%) rename {grub-core/include => include}/grub/boot.h (100%) rename {grub-core/include => include}/grub/bsdlabel.h (100%) rename {grub-core/include => include}/grub/bufio.h (100%) rename {grub-core/include => include}/grub/cache.h (100%) rename {grub-core/include => include}/grub/charset.h (100%) rename {grub-core/include => include}/grub/cmos.h (100%) rename {grub-core/include => include}/grub/command.h (100%) rename {grub-core/include => include}/grub/crypto.h (100%) rename {grub-core/include => include}/grub/cs5536.h (100%) rename {grub-core/include => include}/grub/datetime.h (100%) rename {grub-core/include => include}/grub/device.h (100%) rename {grub-core/include => include}/grub/disk.h (100%) rename {grub-core/include => include}/grub/dl.h (100%) rename {grub-core/include => include}/grub/efi/api.h (100%) rename {grub-core/include => include}/grub/efi/console.h (100%) rename {grub-core/include => include}/grub/efi/console_control.h (100%) rename {grub-core/include => include}/grub/efi/disk.h (100%) rename {grub-core/include => include}/grub/efi/efi.h (100%) rename {grub-core/include => include}/grub/efi/graphics_output.h (100%) rename {grub-core/include => include}/grub/efi/memory.h (100%) rename {grub-core/include => include}/grub/efi/pe32.h (100%) rename {grub-core/include => include}/grub/efi/time.h (100%) rename {grub-core/include => include}/grub/efi/uga_draw.h (100%) rename {grub-core/include => include}/grub/efiemu/efiemu.h (100%) rename {grub-core/include => include}/grub/efiemu/runtime.h (100%) rename {grub-core/include => include}/grub/elf.h (100%) rename {grub-core/include => include}/grub/elfload.h (100%) rename {grub-core/include => include}/grub/emu/console.h (100%) rename {grub-core/include => include}/grub/emu/getroot.h (100%) rename {grub-core/include => include}/grub/emu/hostdisk.h (100%) rename {grub-core/include => include}/grub/emu/misc.h (100%) rename {grub-core/include => include}/grub/env.h (100%) rename {grub-core/include => include}/grub/env_private.h (100%) rename {grub-core/include => include}/grub/err.h (100%) rename {grub-core/include => include}/grub/extcmd.h (100%) rename {grub-core/include => include}/grub/fbblit.h (100%) rename {grub-core/include => include}/grub/fbfill.h (100%) rename {grub-core/include => include}/grub/fbutil.h (100%) rename {grub-core/include => include}/grub/file.h (100%) rename {grub-core/include => include}/grub/font.h (100%) rename {grub-core/include => include}/grub/fontformat.h (100%) rename {grub-core/include => include}/grub/fs.h (100%) rename {grub-core/include => include}/grub/fshelp.h (100%) rename {grub-core/include => include}/grub/gfxmenu_model.h (100%) rename {grub-core/include => include}/grub/gfxmenu_view.h (100%) rename {grub-core/include => include}/grub/gfxterm.h (100%) rename {grub-core/include => include}/grub/gfxwidgets.h (100%) rename {grub-core/include => include}/grub/gpt_partition.h (100%) rename {grub-core/include => include}/grub/gui.h (100%) rename {grub-core/include => include}/grub/gui_string_util.h (100%) rename {grub-core/include => include}/grub/gzio.h (100%) rename {grub-core/include => include}/grub/hfs.h (100%) rename {grub-core/include => include}/grub/i18n.h (100%) rename {grub-core/include => include}/grub/i386/at_keyboard.h (100%) rename {grub-core/include => include}/grub/i386/bsd.h (100%) rename {grub-core/include => include}/grub/i386/cmos.h (100%) rename {grub-core/include => include}/grub/i386/coreboot/boot.h (100%) rename {grub-core/include => include}/grub/i386/coreboot/console.h (100%) rename {grub-core/include => include}/grub/i386/coreboot/init.h (100%) rename {grub-core/include => include}/grub/i386/coreboot/loader.h (100%) rename {grub-core/include => include}/grub/i386/coreboot/memory.h (100%) rename {grub-core/include => include}/grub/i386/coreboot/serial.h (100%) rename {grub-core/include => include}/grub/i386/coreboot/time.h (100%) rename {grub-core/include => include}/grub/i386/cpuid.h (100%) rename {grub-core/include => include}/grub/i386/efi/loader.h (100%) rename {grub-core/include => include}/grub/i386/efi/memory.h (100%) rename {grub-core/include => include}/grub/i386/efi/serial.h (100%) rename {grub-core/include => include}/grub/i386/efi/time.h (100%) rename {grub-core/include => include}/grub/i386/efiemu.h (100%) rename {grub-core/include => include}/grub/i386/freebsd_linker.h (100%) rename {grub-core/include => include}/grub/i386/freebsd_reboot.h (100%) rename {grub-core/include => include}/grub/i386/ieee1275/ieee1275.h (100%) rename {grub-core/include => include}/grub/i386/ieee1275/loader.h (100%) rename {grub-core/include => include}/grub/i386/ieee1275/memory.h (100%) rename {grub-core/include => include}/grub/i386/ieee1275/serial.h (100%) rename {grub-core/include => include}/grub/i386/ieee1275/time.h (100%) rename {grub-core/include => include}/grub/i386/io.h (100%) rename {grub-core/include => include}/grub/i386/linux.h (100%) rename {grub-core/include => include}/grub/i386/loader.h (100%) rename {grub-core/include => include}/grub/i386/macho.h (100%) rename {grub-core/include => include}/grub/i386/memory.h (100%) rename {grub-core/include => include}/grub/i386/multiboot.h (100%) rename {grub-core/include => include}/grub/i386/multiboot/boot.h (100%) rename {grub-core/include => include}/grub/i386/multiboot/console.h (100%) rename {grub-core/include => include}/grub/i386/multiboot/init.h (100%) rename {grub-core/include => include}/grub/i386/multiboot/kernel.h (100%) rename {grub-core/include => include}/grub/i386/multiboot/loader.h (100%) rename {grub-core/include => include}/grub/i386/multiboot/memory.h (100%) rename {grub-core/include => include}/grub/i386/multiboot/serial.h (100%) rename {grub-core/include => include}/grub/i386/multiboot/time.h (100%) rename {grub-core/include => include}/grub/i386/netbsd_bootinfo.h (100%) rename {grub-core/include => include}/grub/i386/netbsd_reboot.h (100%) rename {grub-core/include => include}/grub/i386/openbsd_bootarg.h (100%) rename {grub-core/include => include}/grub/i386/openbsd_reboot.h (100%) rename {grub-core/include => include}/grub/i386/pc/biosdisk.h (100%) rename {grub-core/include => include}/grub/i386/pc/biosnum.h (100%) rename {grub-core/include => include}/grub/i386/pc/boot.h (100%) rename {grub-core/include => include}/grub/i386/pc/chainloader.h (100%) rename {grub-core/include => include}/grub/i386/pc/console.h (100%) rename {grub-core/include => include}/grub/i386/pc/efiemu.h (100%) rename {grub-core/include => include}/grub/i386/pc/init.h (100%) rename {grub-core/include => include}/grub/i386/pc/kernel.h (100%) rename {grub-core/include => include}/grub/i386/pc/loader.h (100%) rename {grub-core/include => include}/grub/i386/pc/memory.h (100%) rename {grub-core/include => include}/grub/i386/pc/pxe.h (100%) rename {grub-core/include => include}/grub/i386/pc/time.h (100%) rename {grub-core/include => include}/grub/i386/pc/vbe.h (100%) rename {grub-core/include => include}/grub/i386/pc/vga.h (100%) rename {grub-core/include => include}/grub/i386/pci.h (100%) rename {grub-core/include => include}/grub/i386/pit.h (100%) rename {grub-core/include => include}/grub/i386/qemu/boot.h (100%) rename {grub-core/include => include}/grub/i386/qemu/console.h (100%) rename {grub-core/include => include}/grub/i386/qemu/init.h (100%) rename {grub-core/include => include}/grub/i386/qemu/kernel.h (100%) rename {grub-core/include => include}/grub/i386/qemu/loader.h (100%) rename {grub-core/include => include}/grub/i386/qemu/memory.h (100%) rename {grub-core/include => include}/grub/i386/qemu/serial.h (100%) rename {grub-core/include => include}/grub/i386/qemu/time.h (100%) rename {grub-core/include => include}/grub/i386/relocator.h (100%) rename {grub-core/include => include}/grub/i386/setjmp.h (100%) rename {grub-core/include => include}/grub/i386/time.h (100%) rename {grub-core/include => include}/grub/i386/tsc.h (100%) rename {grub-core/include => include}/grub/i386/types.h (100%) rename {grub-core/include => include}/grub/i386/vga_common.h (100%) rename {grub-core/include => include}/grub/i386/xnu.h (100%) rename {grub-core/include => include}/grub/icon_manager.h (100%) rename {grub-core/include => include}/grub/ieee1275/console.h (100%) rename {grub-core/include => include}/grub/ieee1275/ieee1275.h (100%) rename {grub-core/include => include}/grub/ieee1275/ofdisk.h (100%) rename {grub-core/include => include}/grub/kernel.h (100%) rename {grub-core/include => include}/grub/lib/LzFind.h (100%) rename {grub-core/include => include}/grub/lib/LzHash.h (100%) rename {grub-core/include => include}/grub/lib/LzmaDec.h (100%) rename {grub-core/include => include}/grub/lib/LzmaEnc.h (100%) rename {grub-core/include => include}/grub/lib/LzmaTypes.h (100%) rename {grub-core/include => include}/grub/lib/arg.h (100%) rename {grub-core/include => include}/grub/lib/crc.h (100%) rename {grub-core/include => include}/grub/lib/envblk.h (100%) rename {grub-core/include => include}/grub/lib/hexdump.h (100%) rename {grub-core/include => include}/grub/libgcc.h (100%) rename {grub-core/include => include}/grub/libpciaccess.h (100%) rename {grub-core/include => include}/grub/libusb.h (100%) rename {grub-core/include => include}/grub/list.h (100%) rename {grub-core/include => include}/grub/loader.h (100%) rename {grub-core/include => include}/grub/lvm.h (100%) rename {grub-core/include => include}/grub/macho.h (100%) rename {grub-core/include => include}/grub/machoload.h (100%) rename {grub-core/include => include}/grub/memory.h (100%) rename {grub-core/include => include}/grub/menu.h (100%) rename {grub-core/include => include}/grub/menu_viewer.h (100%) rename {grub-core/include => include}/grub/mips/at_keyboard.h (100%) rename {grub-core/include => include}/grub/mips/cache.h (100%) rename {grub-core/include => include}/grub/mips/cmos.h (100%) rename {grub-core/include => include}/grub/mips/io.h (100%) rename {grub-core/include => include}/grub/mips/loongson.h (100%) rename {grub-core/include => include}/grub/mips/multiboot.h (100%) rename {grub-core/include => include}/grub/mips/pci.h (100%) rename {grub-core/include => include}/grub/mips/qemu-mips/kernel.h (100%) rename {grub-core/include => include}/grub/mips/qemu-mips/loader.h (100%) rename {grub-core/include => include}/grub/mips/qemu-mips/memory.h (100%) rename {grub-core/include => include}/grub/mips/qemu-mips/serial.h (100%) rename {grub-core/include => include}/grub/mips/qemu-mips/time.h (100%) rename {grub-core/include => include}/grub/mips/relocator.h (100%) rename {grub-core/include => include}/grub/mips/setjmp.h (100%) rename {grub-core/include => include}/grub/mips/time.h (100%) rename {grub-core/include => include}/grub/mips/types.h (100%) rename {grub-core/include => include}/grub/mips/yeeloong/at_keyboard.h (100%) rename {grub-core/include => include}/grub/mips/yeeloong/cmos.h (100%) rename {grub-core/include => include}/grub/mips/yeeloong/ec.h (100%) rename {grub-core/include => include}/grub/mips/yeeloong/kernel.h (100%) rename {grub-core/include => include}/grub/mips/yeeloong/loader.h (100%) rename {grub-core/include => include}/grub/mips/yeeloong/memory.h (100%) rename {grub-core/include => include}/grub/mips/yeeloong/pci.h (100%) rename {grub-core/include => include}/grub/mips/yeeloong/serial.h (100%) rename {grub-core/include => include}/grub/mips/yeeloong/time.h (100%) rename {grub-core/include => include}/grub/misc.h (100%) rename {grub-core/include => include}/grub/mm.h (100%) rename {grub-core/include => include}/grub/msdos_partition.h (100%) rename {grub-core/include => include}/grub/multiboot.h (100%) rename {grub-core/include => include}/grub/multiboot_loader.h (100%) rename {grub-core/include => include}/grub/net.h (100%) rename {grub-core/include => include}/grub/normal.h (100%) rename {grub-core/include => include}/grub/ntfs.h (100%) rename {grub-core/include => include}/grub/offsets.h (100%) rename {grub-core/include => include}/grub/parser.h (100%) rename {grub-core/include => include}/grub/partition.h (100%) rename {grub-core/include => include}/grub/parttool.h (100%) rename {grub-core/include => include}/grub/pci.h (100%) rename {grub-core/include => include}/grub/pciutils.h (100%) rename {grub-core/include => include}/grub/powerpc/ieee1275/biosdisk.h (100%) rename {grub-core/include => include}/grub/powerpc/ieee1275/ieee1275.h (100%) rename {grub-core/include => include}/grub/powerpc/ieee1275/loader.h (100%) rename {grub-core/include => include}/grub/powerpc/ieee1275/memory.h (100%) rename {grub-core/include => include}/grub/powerpc/ieee1275/time.h (100%) rename {grub-core/include => include}/grub/powerpc/ieee1275/util/biosdisk.h (100%) rename {grub-core/include => include}/grub/powerpc/kernel.h (100%) rename {grub-core/include => include}/grub/powerpc/setjmp.h (100%) rename {grub-core/include => include}/grub/powerpc/time.h (100%) rename {grub-core/include => include}/grub/powerpc/types.h (100%) rename {grub-core/include => include}/grub/raid.h (100%) rename {grub-core/include => include}/grub/reader.h (100%) rename {grub-core/include => include}/grub/script_sh.h (100%) rename {grub-core/include => include}/grub/scsi.h (100%) rename {grub-core/include => include}/grub/scsicmd.h (100%) rename {grub-core/include => include}/grub/sdl.h (100%) rename {grub-core/include => include}/grub/search.h (100%) rename {grub-core/include => include}/grub/serial.h (100%) rename {grub-core/include => include}/grub/setjmp.h (100%) rename {grub-core/include => include}/grub/smbus.h (100%) rename {grub-core/include => include}/grub/sparc64/ieee1275/boot.h (100%) rename {grub-core/include => include}/grub/sparc64/ieee1275/ieee1275.h (100%) rename {grub-core/include => include}/grub/sparc64/ieee1275/kernel.h (100%) rename {grub-core/include => include}/grub/sparc64/ieee1275/loader.h (100%) rename {grub-core/include => include}/grub/sparc64/ieee1275/memory.h (100%) rename {grub-core/include => include}/grub/sparc64/ieee1275/time.h (100%) rename {grub-core/include => include}/grub/sparc64/setjmp.h (100%) rename {grub-core/include => include}/grub/sparc64/time.h (100%) rename {grub-core/include => include}/grub/sparc64/types.h (100%) rename {grub-core/include => include}/grub/symbol.h (100%) rename {grub-core/include => include}/grub/term.h (100%) rename {grub-core/include => include}/grub/terminfo.h (100%) rename {grub-core/include => include}/grub/test.h (100%) rename {grub-core/include => include}/grub/time.h (100%) rename {grub-core/include => include}/grub/tparm.h (100%) rename {grub-core/include => include}/grub/trig.h (100%) rename {grub-core/include => include}/grub/types.h (100%) rename {grub-core/include => include}/grub/unicode.h (100%) rename {grub-core/include => include}/grub/usb.h (100%) rename {grub-core/include => include}/grub/usbdesc.h (100%) rename {grub-core/include => include}/grub/usbtrans.h (100%) rename {grub-core/include => include}/grub/util/deviceiter.h (100%) rename {grub-core/include => include}/grub/util/lvm.h (100%) rename {grub-core/include => include}/grub/util/misc.h (100%) rename {grub-core/include => include}/grub/util/ofpath.h (100%) rename {grub-core/include => include}/grub/util/raid.h (100%) rename {grub-core/include => include}/grub/util/resolve.h (100%) rename {grub-core/include => include}/grub/vga.h (100%) rename {grub-core/include => include}/grub/video.h (100%) rename {grub-core/include => include}/grub/video_fb.h (100%) rename {grub-core/include => include}/grub/x86_64/at_keyboard.h (100%) rename {grub-core/include => include}/grub/x86_64/efi/boot.h (100%) rename {grub-core/include => include}/grub/x86_64/efi/loader.h (100%) rename {grub-core/include => include}/grub/x86_64/efi/memory.h (100%) rename {grub-core/include => include}/grub/x86_64/efi/serial.h (100%) rename {grub-core/include => include}/grub/x86_64/efi/time.h (100%) rename {grub-core/include => include}/grub/x86_64/io.h (100%) rename {grub-core/include => include}/grub/x86_64/linux.h (100%) rename {grub-core/include => include}/grub/x86_64/macho.h (100%) rename {grub-core/include => include}/grub/x86_64/multiboot.h (100%) rename {grub-core/include => include}/grub/x86_64/pci.h (100%) rename {grub-core/include => include}/grub/x86_64/relocator.h (100%) rename {grub-core/include => include}/grub/x86_64/setjmp.h (100%) rename {grub-core/include => include}/grub/x86_64/time.h (100%) rename {grub-core/include => include}/grub/x86_64/types.h (100%) rename {grub-core/include => include}/grub/x86_64/xnu.h (100%) rename {grub-core/include => include}/grub/xnu.h (100%) rename {grub-core/include => include}/multiboot.h (100%) rename {grub-core/include => include}/multiboot2.h (100%) rename {grub-core => util}/import_gcry.py (99%) diff --git a/autogen.sh b/autogen.sh index 49cd1fca5..60139cfb3 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,44 +4,21 @@ set -e autogen --version >/dev/null || (echo autogen missing; exit 1) -echo "Creating symlinks..." -ln -svf ../NEWS grub-core/ -ln -svf ../TODO grub-core/ -ln -svf ../THANKS grub-core/ -ln -svf ../README grub-core/ -ln -svf ../INSTALL grub-core/ -ln -svf ../AUTHORS grub-core/ -ln -svf ../COPYING grub-core/ -ln -svf ../ABOUT-NLS grub-core/ -ln -svf ../ChangeLog grub-core/ -ln -svf ../aclocal.m4 grub-core/ -ln -svf ../acinclude.m4 grub-core/ -ln -svf ../config.rpath grub-core/ -ln -svf ../gentpl.py grub-core/ -ln -svf ../configure.common grub-core/ - -mkdir -vp grub-core/docs/man -ln -svf ../../../docs/man/grub-emu.h2m grub-core/docs/man - echo "Creating Makefile.tpl..." python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl + echo "Running autogen..." autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am - -echo "Creating grub-core/Makefile.tpl..." -(cd grub-core && python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl) -echo "Running autogen..." -(cd grub-core && autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am) +autogen -T Makefile.tpl grub-core/modules.def | sed -e '/^$/{N;/^\n$/D;}' > grub-core/modules.am echo "Importing unicode..." python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c echo "Importing libgcrypt..." -(cd grub-core && python import_gcry.py lib/libgcrypt/ .) +python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core echo "Saving timestamps..." echo timestamp > stamp-h.in -(cd grub-core && echo timestamp > stamp-h.in) echo "Running autoreconf..." autoreconf -vi diff --git a/grub-core/conf/any-emu.rmk b/conf/any-emu.rmk similarity index 100% rename from grub-core/conf/any-emu.rmk rename to conf/any-emu.rmk diff --git a/grub-core/conf/common.rmk b/conf/common.rmk similarity index 100% rename from grub-core/conf/common.rmk rename to conf/common.rmk diff --git a/grub-core/conf/i386-coreboot.rmk b/conf/i386-coreboot.rmk similarity index 100% rename from grub-core/conf/i386-coreboot.rmk rename to conf/i386-coreboot.rmk diff --git a/grub-core/conf/i386-efi.rmk b/conf/i386-efi.rmk similarity index 100% rename from grub-core/conf/i386-efi.rmk rename to conf/i386-efi.rmk diff --git a/grub-core/conf/i386-ieee1275.rmk b/conf/i386-ieee1275.rmk similarity index 100% rename from grub-core/conf/i386-ieee1275.rmk rename to conf/i386-ieee1275.rmk diff --git a/grub-core/conf/i386-multiboot.rmk b/conf/i386-multiboot.rmk similarity index 100% rename from grub-core/conf/i386-multiboot.rmk rename to conf/i386-multiboot.rmk diff --git a/grub-core/conf/i386-pc-cygwin-img-ld.sc b/conf/i386-pc-cygwin-img-ld.sc similarity index 100% rename from grub-core/conf/i386-pc-cygwin-img-ld.sc rename to conf/i386-pc-cygwin-img-ld.sc diff --git a/grub-core/conf/i386-pc.rmk b/conf/i386-pc.rmk similarity index 100% rename from grub-core/conf/i386-pc.rmk rename to conf/i386-pc.rmk diff --git a/grub-core/conf/i386-qemu.rmk b/conf/i386-qemu.rmk similarity index 100% rename from grub-core/conf/i386-qemu.rmk rename to conf/i386-qemu.rmk diff --git a/grub-core/conf/i386.rmk b/conf/i386.rmk similarity index 100% rename from grub-core/conf/i386.rmk rename to conf/i386.rmk diff --git a/grub-core/conf/mips-qemu-mips.rmk b/conf/mips-qemu-mips.rmk similarity index 100% rename from grub-core/conf/mips-qemu-mips.rmk rename to conf/mips-qemu-mips.rmk diff --git a/grub-core/conf/mips-yeeloong.rmk b/conf/mips-yeeloong.rmk similarity index 100% rename from grub-core/conf/mips-yeeloong.rmk rename to conf/mips-yeeloong.rmk diff --git a/grub-core/conf/mips.rmk b/conf/mips.rmk similarity index 100% rename from grub-core/conf/mips.rmk rename to conf/mips.rmk diff --git a/grub-core/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk similarity index 100% rename from grub-core/conf/powerpc-ieee1275.rmk rename to conf/powerpc-ieee1275.rmk diff --git a/grub-core/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk similarity index 100% rename from grub-core/conf/sparc64-ieee1275.rmk rename to conf/sparc64-ieee1275.rmk diff --git a/grub-core/conf/tests.rmk b/conf/tests.rmk similarity index 100% rename from grub-core/conf/tests.rmk rename to conf/tests.rmk diff --git a/grub-core/conf/x86-efi.rmk b/conf/x86-efi.rmk similarity index 100% rename from grub-core/conf/x86-efi.rmk rename to conf/x86-efi.rmk diff --git a/grub-core/conf/x86_64-efi.rmk b/conf/x86_64-efi.rmk similarity index 100% rename from grub-core/conf/x86_64-efi.rmk rename to conf/x86_64-efi.rmk diff --git a/configure.ac b/configure.ac index 9b9db0ac4..dafea4545 100644 --- a/configure.ac +++ b/configure.ac @@ -33,13 +33,15 @@ dnl package (in grub-core directory) builds with TARGETCC. AC_INIT([GRUB],[1.98],[bug-grub@gnu.org]) AC_CONFIG_AUX_DIR([.]) +: ${CFLAGS=""} # We don't want -g -O2 + # Checks for host and target systems. AC_CANONICAL_HOST AC_CANONICAL_TARGET AM_INIT_AUTOMAKE() AC_PREREQ(2.60) -AC_CONFIG_SRCDIR([grub-core/include/grub/dl.h]) +AC_CONFIG_SRCDIR([include/grub/dl.h]) AC_CONFIG_HEADER([config.h]) grub_coredir='grub-core' @@ -51,12 +53,31 @@ AC_SUBST(grub_utildir) m4_include([configure.common]) # Output files. +grub_CHECK_LINK_DIR +if test x"$link_dir" = xyes ; then + AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu]) + mkdir -p grub-core/lib + cp -rp $srcdir/grub-core/lib/$target_cpu grub-core/lib/target_cpu + if test "$platform" != emu ; then + AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform]) + fi +else + mkdir -p include/grub 2>/dev/null + rm -rf include/grub/cpu + cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null + cp -rp $srcdir/grub-core/lib/$target_cpu grub-core/lib/target_cpu 2>/dev/null + if test "$platform" != emu ; then + rm -rf include/grub/machine + cp -rp $srcdir/grub-core/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null + fi +fi + AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([grub-core/Makefile]) AC_CONFIG_FILES([po/Makefile]) AC_CONFIG_FILES([docs/Makefile]) AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) -AC_CONFIG_SUBDIRS([grub-core]) AC_OUTPUT [ echo "*******************************************************" diff --git a/gentpl.py b/gentpl.py index 6dd5e84a2..4d7ed0aa3 100644 --- a/gentpl.py +++ b/gentpl.py @@ -222,8 +222,8 @@ def-[+ name +].lst: [+ name +].module$(EXEEXT) und-[+ name +].lst: [+ name +].module$(EXEEXT) $(NM) -u -P -p $< | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@ -mod-[+ name +].c: [+ name +].module$(EXEEXT) $(top_builddir)/moddep.lst $(top_srcdir)/genmodsrc.sh - sh $(top_srcdir)/genmodsrc.sh [+ name +] $(top_builddir)/moddep.lst > $@ || (rm -f $@; exit 1) +mod-[+ name +].c: [+ name +].module$(EXEEXT) moddep.lst genmodsrc.sh + sh $(srcdir)/genmodsrc.sh [+ name +] moddep.lst > $@ || (rm -f $@; exit 1) mod-[+ name +].o: mod-[+ name +].c $(TARGET_CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS_MODULE) $(CPPFLAGS) $(CFLAGS_MODULE) $(CFLAGS) -c -o $@ $< @@ -239,26 +239,26 @@ mod-[+ name +].o: mod-[+ name +].c $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; \ fi -command-[+ name +].lst: [+ name +].pp $(top_srcdir)/gencmdlist.sh - cat $< | sh $(top_srcdir)/gencmdlist.sh [+ name +] > $@ || (rm -f $@; exit 1) +command-[+ name +].lst: [+ name +].pp $(srcdir)/gencmdlist.sh + cat $< | sh $(srcdir)/gencmdlist.sh [+ name +] > $@ || (rm -f $@; exit 1) -fs-[+ name +].lst: [+ name +].pp $(top_srcdir)/genfslist.sh - cat $< | sh $(top_srcdir)/genfslist.sh [+ name +] > $@ || (rm -f $@; exit 1) +fs-[+ name +].lst: [+ name +].pp $(srcdir)/genfslist.sh + cat $< | sh $(srcdir)/genfslist.sh [+ name +] > $@ || (rm -f $@; exit 1) -video-[+ name +].lst: [+ name +].pp $(top_srcdir)/genvideolist.sh - cat $< | sh $(top_srcdir)/genvideolist.sh [+ name +] > $@ || (rm -f $@; exit 1) +video-[+ name +].lst: [+ name +].pp $(srcdir)/genvideolist.sh + cat $< | sh $(srcdir)/genvideolist.sh [+ name +] > $@ || (rm -f $@; exit 1) -partmap-[+ name +].lst: [+ name +].pp $(top_srcdir)/genpartmaplist.sh - cat $< | sh $(top_srcdir)/genpartmaplist.sh [+ name +] > $@ || (rm -f $@; exit 1) +partmap-[+ name +].lst: [+ name +].pp $(srcdir)/genpartmaplist.sh + cat $< | sh $(srcdir)/genpartmaplist.sh [+ name +] > $@ || (rm -f $@; exit 1) -parttool-[+ name +].lst: [+ name +].pp $(top_srcdir)/genparttoollist.sh - cat $< | sh $(top_srcdir)/genparttoollist.sh [+ name +] > $@ || (rm -f $@; exit 1) +parttool-[+ name +].lst: [+ name +].pp $(srcdir)/genparttoollist.sh + cat $< | sh $(srcdir)/genparttoollist.sh [+ name +] > $@ || (rm -f $@; exit 1) -handler-[+ name +].lst: [+ name +].pp $(top_srcdir)/genhandlerlist.sh - cat $< | sh $(top_srcdir)/genhandlerlist.sh [+ name +] > $@ || (rm -f $@; exit 1) +handler-[+ name +].lst: [+ name +].pp $(srcdir)/genhandlerlist.sh + cat $< | sh $(srcdir)/genhandlerlist.sh [+ name +] > $@ || (rm -f $@; exit 1) -terminal-[+ name +].lst: [+ name +].pp $(top_srcdir)/genterminallist.sh - cat $< | sh $(top_srcdir)/genterminallist.sh [+ name +] > $@ || (rm -f $@; exit 1) +terminal-[+ name +].lst: [+ name +].pp $(srcdir)/genterminallist.sh + cat $< | sh $(srcdir)/genterminallist.sh [+ name +] > $@ || (rm -f $@; exit 1) """ return r diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 654a7e9a4..437835c83 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -1,6 +1,9 @@ AUTOMAKE_OPTIONS = subdir-objects -SUBDIRS = po +CC=$(TARGET_CC) +CPP=$(TARGET_CC) +CCAS=$(TARGET_CC) + EXTRA_DIST = gentpl.py modules.def Makefile.tpl genmoddep.awk EXTRA_DIST += genmodsrc.sh gensymlist.sh genemuinit.sh genemuinitheader.sh EXTRA_DIST += genfslist.sh gencmdlist.sh genvideolist.sh genhandlerlist.sh @@ -8,7 +11,88 @@ EXTRA_DIST += genpartmaplist.sh genparttoollist.sh genterminallist.sh EXTRA_DIST += conf/i386-pc-cygwin-img-ld.sc EXTRA_DIST += $(shell find $(top_srcdir) -name '*.h') -include $(top_srcdir)/Makefile.vars +grubconfdir = $(sysconfdir)/grub.d +platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform) + +# to calm down automake +BUILT_SOURCES = +CLEANFILES = +COMMAND_FILES = +DEF_FILES = +FS_FILES = +HANDLER_FILES = +IMG_FILES = +MOD_FILES = +MODULE_FILES = +PARTMAP_FILES = +PARTTOOL_FILES = +TERMINAL_FILES = +TESTS = +UND_FILES = +VIDEO_FILES = +bin_PROGRAMS = +bin_SCRIPTS = +check_PROGRAMS = +check_SCRIPTS = +grubconf_DATA = +grubconf_SCRIPTS = +man_MANS = +noinst_DATA = +noinst_LIBRARIES = +noinst_PROGRAMS = +pkglib_SCRIPTS = +platform_DATA = +sbin_PROGRAMS = +sbin_SCRIPTS = +KERNEL_HEADER_FILES = + +# Platform specific options +if COND_i386_pc + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_efi + LDFLAGS_PLATFORM = -melf_i386 +endif +if COND_x86_64_efi + LDFLAGS_PLATFORM = -melf_x86_64 +endif +if COND_i386_qemu + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_coreboot + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_ieee1275 + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_mips_yeeloong + CFLAGS_PLATFORM = -march=mips3 -mexplicit-relocs -mflush-func=grub_cpu_flush_cache + CCASFLAGS_PLATFORM = -march=mips3 +endif +if COND_sparc64_ieee1275 + CFLAGS_PLATFORM = -mno-app-regs + LDFLAGS_PLATFORM = -melf64_sparc -mno-relax +endif + +CPPFLAGS_GRUB = -DGRUB_FILE=\"`basename $<`\" +CPPFLAGS_GRUB += -I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) +CPPFLAGS_GRUB += -I$(top_srcdir)/include +CPPFLAGS_GRUB += -I$(top_builddir)/include +CCASFLAGS_GRUB = -DASM_FILE=1 + +CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers +CPPFLAGS_GCRY = -I$(top_srcdir)/$(grub_coredir)/lib/libgcrypt_wrap + +CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" +CPPFLAGS_GNULIB = -I$(top_srcdir)/$(grub_coredir)/gnulib + +CFLAGS_MKISOFS = -Wno-all -Werror +CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include + +CFLAGS_POSIX = -fno-builtin +CPPFLAGS_POSIX = -I$(top_srcdir)/$(grub_coredir)/lib/posix_wrap + +CPPFLAGS_EFIEMU = -I$(top_srcdir)/$(grub_coredir)/efiemu/runtime LDADD_KERNEL = -lgcc CFLAGS_KERNEL = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding @@ -41,30 +125,231 @@ AM_CPPFLAGS = $(CPPFLAGS_GRUB) AM_CCASFLAGS = $(CCASFLAGS_GRUB) # gentrigtables -gentrigtables: $(top_srcdir)/gentrigtables.c +gentrigtables: gentrigtables.c $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(CPPFLAGS) -lm $< CLEANFILES += gentrigtables # trigtables.c -trigtables.c: gentrigtables.c configure.ac +trigtables.c: gentrigtables.c $(top_srcdir)/configure.ac $(MAKE) $(AM_MAKEFLAGS) gentrigtables - $(top_builddir)/gentrigtables > $@ + $(builddir)/gentrigtables > $@ CLEANFILES += trigtables.c # XXX Use Automake's LEX & YACC support -grub_script.tab.h: $(top_srcdir)/script/parser.y - $(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/script/parser.y +grub_script.tab.h: script/parser.y + $(YACC) -d -p grub_script_yy -b grub_script $< grub_script.tab.c: grub_script.tab.h CLEANFILES += grub_script.tab.c grub_script.tab.h # For the lexer. -grub_script.yy.h: $(top_srcdir)/script/yylex.l - $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(top_srcdir)/script/yylex.l +grub_script.yy.h: script/yylex.l + $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $< grub_script.yy.c: grub_script.yy.h CLEANFILES += grub_script.yy.c grub_script.yy.h include $(srcdir)/modules.am -include $(srcdir)/Makefile.kernel + +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/elf.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/elfload.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/reader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/symbol.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/types.h + +if COND_i386_pc +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/biosdisk.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/vga.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/vbe.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pxe.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h +endif + +if COND_i386_efi +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h +endif + +if COND_i386_coreboot +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h +endif + +if COND_i386_multiboot +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h +endif + +if COND_i386_qemu +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h +endif + +if COND_i386_ieee1275 +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h +endif + +if COND_x86_64_efi +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h +endif + +if COND_mips_yeeloong +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap_scale.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h +endif + +if COND_powerpc_ieee1275 +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h +endif + +if COND_sparc64_ieee1275 +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h +endif + +if COND_emu +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/time.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/types.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gzio.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/menu.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h +if COND_GRUB_EMU_SDL +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h +endif +if COND_GRUB_EMU_USB +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libusb.h +endif +if COND_GRUB_EMU_PCI +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h +endif +endif + +symlist.h: $(top_builddir)/config.h $(KERNEL_HEADER_FILES) + @list='$^'; \ + for p in $$list; do \ + echo "#include <$$p>" >> $@ || (rm -f $@; exit 1); \ + done +CLEANFILES += symlist.h +BUILT_SOURCES += symlist.h + +symlist.c: symlist.h gensymlist.sh + $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1) + cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1) + rm -f symlist.p +CLEANFILES += symlist.c +BUILT_SOURCES += symlist.c + +noinst_DATA += kernel_syms.lst +kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h + $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input + if grep "^#define HAVE_ASM_USCORE" $(top_builddir)/config.h; then u="_"; else u=""; fi; \ + cat kernel_syms.input | grep -v '^#' | sed -n \ + -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \ + -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \ + | sort -u >$@ + rm -f kernel_syms.input +CLEANFILES += kernel_syms.lst + +if COND_emu +kern/emu/grub_emu-main.$(OBJEXT):grub_emu_init.h +grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h +kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h +grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h + +grub_emu_init.h: genemuinitheader.sh $(MOD_FILES) + rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@ +CLEANFILES += grub_emu_init.h + +grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES) + rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(NM) > $@ +CLEANFILES += grub_emu_init.c +endif # .lst files platform_DATA += moddep.lst @@ -77,9 +362,6 @@ platform_DATA += parttool.lst platform_DATA += video.lst platform_DATA += crypto.lst CLEANFILES += moddep.lst -CLEANFILES += fs.lst -CLEANFILES += command.lst -CLEANFILES += partmap.lst CLEANFILES += handler.lst CLEANFILES += terminal.lst CLEANFILES += parttool.lst @@ -88,27 +370,41 @@ CLEANFILES += crypto.lst fs.lst: $(FS_FILES) cat $^ /dev/null | sort | uniq > $@ +CLEANFILES += fs.lst + command.lst: $(COMMAND_FILES) cat $^ /dev/null | sort | uniq > $@ +CLEANFILES += command.lst + partmap.lst: $(PARTMAP_FILES) cat $^ /dev/null | sort | uniq > $@ +CLEANFILES += partmap.lst + handler.lst: $(HANDLER_FILES) cat $^ /dev/null | sort | uniq > $@ +CLEANFILES += handler.lst + terminal.lst: $(TERMINAL_FILES) cat $^ /dev/null | sort | uniq > $@ +CLEANFILES += terminal.lst + parttool.lst: $(PARTTOOL_FILES) cat $^ /dev/null | sort | uniq > $@ +CLEANFILES += parttool.lst + video.lst: $(VIDEO_FILES) cat $^ /dev/null | sort | uniq > $@ +CLEANFILES += video.lst # but, crypto.lst is simply copied -crypto.lst: $(top_srcdir)/lib/libgcrypt-grub/cipher/crypto.lst +crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst cp $^ $@ +CLEANFILES += crypto.lst # generate global module dependencies list moddep.lst: kernel_syms.lst genmoddep.awk $(DEF_FILES) $(UND_FILES) cat $(DEF_FILES) kernel_syms.lst /dev/null \ - | $(AWK) -f $(top_srcdir)/genmoddep.awk $(UND_FILES) > $@ \ + | $(AWK) -f $(srcdir)/genmoddep.awk $(UND_FILES) > $@ \ || (rm -f $@; exit 1) if COND_i386_pc diff --git a/grub-core/Makefile.kernel b/grub-core/Makefile.kernel index b03563676..69c20a4fc 100644 --- a/grub-core/Makefile.kernel +++ b/grub-core/Makefile.kernel @@ -1,168 +1,168 @@ # -*- makefile -*- KERNEL_HEADER_FILES = -KERNEL_HEADER_FILES += include/grub/cache.h -KERNEL_HEADER_FILES += include/grub/command.h -KERNEL_HEADER_FILES += include/grub/device.h -KERNEL_HEADER_FILES += include/grub/disk.h -KERNEL_HEADER_FILES += include/grub/dl.h -KERNEL_HEADER_FILES += include/grub/elf.h -KERNEL_HEADER_FILES += include/grub/elfload.h -KERNEL_HEADER_FILES += include/grub/env.h -KERNEL_HEADER_FILES += include/grub/env_private.h -KERNEL_HEADER_FILES += include/grub/err.h -KERNEL_HEADER_FILES += include/grub/file.h -KERNEL_HEADER_FILES += include/grub/fs.h -KERNEL_HEADER_FILES += include/grub/i18n.h -KERNEL_HEADER_FILES += include/grub/kernel.h -KERNEL_HEADER_FILES += include/grub/list.h -KERNEL_HEADER_FILES += include/grub/misc.h -KERNEL_HEADER_FILES += include/grub/mm.h -KERNEL_HEADER_FILES += include/grub/net.h -KERNEL_HEADER_FILES += include/grub/parser.h -KERNEL_HEADER_FILES += include/grub/partition.h -KERNEL_HEADER_FILES += include/grub/reader.h -KERNEL_HEADER_FILES += include/grub/symbol.h -KERNEL_HEADER_FILES += include/grub/term.h -KERNEL_HEADER_FILES += include/grub/time.h -KERNEL_HEADER_FILES += include/grub/types.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/elf.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/elfload.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/reader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/symbol.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/types.h if COND_i386_pc -KERNEL_HEADER_FILES += include/grub/boot.h -KERNEL_HEADER_FILES += include/grub/loader.h -KERNEL_HEADER_FILES += include/grub/msdos_partition.h -KERNEL_HEADER_FILES += include/grub/machine/biosdisk.h -KERNEL_HEADER_FILES += include/grub/machine/boot.h -KERNEL_HEADER_FILES += include/grub/machine/console.h -KERNEL_HEADER_FILES += include/grub/machine/memory.h -KERNEL_HEADER_FILES += include/grub/machine/loader.h -KERNEL_HEADER_FILES += include/grub/machine/vga.h -KERNEL_HEADER_FILES += include/grub/machine/vbe.h -KERNEL_HEADER_FILES += include/grub/machine/kernel.h -KERNEL_HEADER_FILES += include/grub/machine/pxe.h -KERNEL_HEADER_FILES += include/grub/i386/pit.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/biosdisk.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/vga.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/vbe.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pxe.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h endif if COND_i386_efi -KERNEL_HEADER_FILES += include/grub/boot.h -KERNEL_HEADER_FILES += include/grub/loader.h -KERNEL_HEADER_FILES += include/grub/msdos_partition.h -KERNEL_HEADER_FILES += include/grub/efi/efi.h -KERNEL_HEADER_FILES += include/grub/efi/time.h -KERNEL_HEADER_FILES += include/grub/efi/disk.h -KERNEL_HEADER_FILES += include/grub/i386/pit.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h endif if COND_i386_coreboot -KERNEL_HEADER_FILES += include/grub/boot.h -KERNEL_HEADER_FILES += include/grub/loader.h -KERNEL_HEADER_FILES += include/grub/msdos_partition.h -KERNEL_HEADER_FILES += include/grub/machine/boot.h -KERNEL_HEADER_FILES += include/grub/machine/console.h -KERNEL_HEADER_FILES += include/grub/machine/init.h -KERNEL_HEADER_FILES += include/grub/machine/memory.h -KERNEL_HEADER_FILES += include/grub/machine/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h endif if COND_i386_multiboot -KERNEL_HEADER_FILES += include/grub/boot.h -KERNEL_HEADER_FILES += include/grub/loader.h -KERNEL_HEADER_FILES += include/grub/msdos_partition.h -KERNEL_HEADER_FILES += include/grub/machine/boot.h -KERNEL_HEADER_FILES += include/grub/machine/console.h -KERNEL_HEADER_FILES += include/grub/machine/init.h -KERNEL_HEADER_FILES += include/grub/machine/memory.h -KERNEL_HEADER_FILES += include/grub/machine/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h endif if COND_i386_qemu -KERNEL_HEADER_FILES += include/grub/boot.h -KERNEL_HEADER_FILES += include/grub/loader.h -KERNEL_HEADER_FILES += include/grub/msdos_partition.h -KERNEL_HEADER_FILES += include/grub/machine/boot.h -KERNEL_HEADER_FILES += include/grub/machine/console.h -KERNEL_HEADER_FILES += include/grub/machine/init.h -KERNEL_HEADER_FILES += include/grub/machine/memory.h -KERNEL_HEADER_FILES += include/grub/machine/loader.h -KERNEL_HEADER_FILES += include/grub/pci.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h endif if COND_i386_ieee1275 -KERNEL_HEADER_FILES += include/grub/loader.h -KERNEL_HEADER_FILES += include/grub/msdos_partition.h -KERNEL_HEADER_FILES += include/grub/ieee1275/ieee1275.h -KERNEL_HEADER_FILES += include/grub/machine/loader.h -KERNEL_HEADER_FILES += include/grub/machine/memory.h -KERNEL_HEADER_FILES += include/grub/terminfo.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h endif if COND_x86_64_efi -KERNEL_HEADER_FILES += include/grub/boot.h -KERNEL_HEADER_FILES += include/grub/loader.h -KERNEL_HEADER_FILES += include/grub/msdos_partition.h -KERNEL_HEADER_FILES += include/grub/efi/efi.h -KERNEL_HEADER_FILES += include/grub/efi/time.h -KERNEL_HEADER_FILES += include/grub/efi/disk.h -KERNEL_HEADER_FILES += include/grub/machine/loader.h -KERNEL_HEADER_FILES += include/grub/i386/pit.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h endif if COND_mips_yeeloong -KERNEL_HEADER_FILES += include/grub/boot.h -KERNEL_HEADER_FILES += include/grub/loader.h -KERNEL_HEADER_FILES += include/grub/msdos_partition.h -KERNEL_HEADER_FILES += include/grub/machine/kernel.h -KERNEL_HEADER_FILES += include/grub/machine/memory.h -KERNEL_HEADER_FILES += include/grub/cpu/cache.h -KERNEL_HEADER_FILES += include/grub/bitmap.h -KERNEL_HEADER_FILES += include/grub/video.h -KERNEL_HEADER_FILES += include/grub/gfxterm.h -KERNEL_HEADER_FILES += include/grub/font.h -KERNEL_HEADER_FILES += include/grub/bitmap_scale.h -KERNEL_HEADER_FILES += include/grub/bufio.h -KERNEL_HEADER_FILES += include/grub/pci.h -KERNEL_HEADER_FILES += include/grub/libgcc.h -KERNEL_HEADER_FILES += include/grub/cs5536.h -KERNEL_HEADER_FILES += include/grub/machine/pci.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap_scale.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h endif if COND_powerpc_ieee1275 -KERNEL_HEADER_FILES += include/grub/boot.h -KERNEL_HEADER_FILES += include/grub/loader.h -KERNEL_HEADER_FILES += include/grub/msdos_partition.h -KERNEL_HEADER_FILES += include/grub/ieee1275/ieee1275.h -KERNEL_HEADER_FILES += include/grub/libgcc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h endif if COND_sparc64_ieee1275 -KERNEL_HEADER_FILES += include/grub/boot.h -KERNEL_HEADER_FILES += include/grub/loader.h -KERNEL_HEADER_FILES += include/grub/msdos_partition.h -KERNEL_HEADER_FILES += include/grub/libgcc.h -KERNEL_HEADER_FILES += include/grub/ieee1275/ieee1275.h -KERNEL_HEADER_FILES += include/grub/machine/kernel.h -KERNEL_HEADER_FILES += include/grub/sparc64/ieee1275/ieee1275.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h endif if COND_emu -KERNEL_HEADER_FILES += include/grub/cpu/time.h -KERNEL_HEADER_FILES += include/grub/cpu/types.h -KERNEL_HEADER_FILES += include/grub/gzio.h -KERNEL_HEADER_FILES += include/grub/menu.h -KERNEL_HEADER_FILES += include/grub/datetime.h -KERNEL_HEADER_FILES += include/grub/emu/misc.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/time.h +KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/types.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gzio.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/menu.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h if COND_GRUB_EMU_SDL -KERNEL_HEADER_FILES += include/grub/sdl.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h endif if COND_GRUB_EMU_USB -KERNEL_HEADER_FILES += include/grub/libusb.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libusb.h endif if COND_GRUB_EMU_PCI -KERNEL_HEADER_FILES += include/grub/libpciaccess.h +KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h endif endif -symlist.h: config.h $(KERNEL_HEADER_FILES) +symlist.h: $(top_builddir)/config.h $(KERNEL_HEADER_FILES) @list='$^'; \ for p in $$list; do \ echo "#include <$$p>" >> $@ || (rm -f $@; exit 1); \ @@ -172,15 +172,15 @@ BUILT_SOURCES += symlist.h symlist.c: symlist.h gensymlist.sh $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1) - cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1) + cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1) rm -f symlist.p CLEANFILES += symlist.c BUILT_SOURCES += symlist.c noinst_DATA += kernel_syms.lst -kernel_syms.lst: $(KERNEL_HEADER_FILES) config.h +kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input - if grep "^#define HAVE_ASM_USCORE" config.h; then u="_"; else u=""; fi; \ + if grep "^#define HAVE_ASM_USCORE" $(top_builddir)/config.h; then u="_"; else u=""; fi; \ cat kernel_syms.input | grep -v '^#' | sed -n \ -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \ -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \ diff --git a/grub-core/Makefile.vars b/grub-core/Makefile.vars index db3c2a7db..6dc536139 100644 --- a/grub-core/Makefile.vars +++ b/grub-core/Makefile.vars @@ -33,8 +33,8 @@ endif CPPFLAGS_GRUB = -DGRUB_FILE=\"`basename $<`\" CPPFLAGS_GRUB += -I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) -CPPFLAGS_GRUB += -I$(top_srcdir)/$(grub_coredir)/include -CPPFLAGS_GRUB += -I$(top_builddir)/$(grub_coredir)/include +CPPFLAGS_GRUB += -I$(top_srcdir)/include +CPPFLAGS_GRUB += -I$(top_builddir)/include CCASFLAGS_GRUB = -DASM_FILE=1 CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers diff --git a/grub-core/include/grub/acorn_filecore.h b/include/grub/acorn_filecore.h similarity index 100% rename from grub-core/include/grub/acorn_filecore.h rename to include/grub/acorn_filecore.h diff --git a/grub-core/include/grub/acpi.h b/include/grub/acpi.h similarity index 100% rename from grub-core/include/grub/acpi.h rename to include/grub/acpi.h diff --git a/grub-core/include/grub/aout.h b/include/grub/aout.h similarity index 100% rename from grub-core/include/grub/aout.h rename to include/grub/aout.h diff --git a/grub-core/include/grub/at_keyboard.h b/include/grub/at_keyboard.h similarity index 100% rename from grub-core/include/grub/at_keyboard.h rename to include/grub/at_keyboard.h diff --git a/grub-core/include/grub/ata.h b/include/grub/ata.h similarity index 100% rename from grub-core/include/grub/ata.h rename to include/grub/ata.h diff --git a/grub-core/include/grub/auth.h b/include/grub/auth.h similarity index 100% rename from grub-core/include/grub/auth.h rename to include/grub/auth.h diff --git a/grub-core/include/grub/autoefi.h b/include/grub/autoefi.h similarity index 100% rename from grub-core/include/grub/autoefi.h rename to include/grub/autoefi.h diff --git a/grub-core/include/grub/bitmap.h b/include/grub/bitmap.h similarity index 100% rename from grub-core/include/grub/bitmap.h rename to include/grub/bitmap.h diff --git a/grub-core/include/grub/bitmap_scale.h b/include/grub/bitmap_scale.h similarity index 100% rename from grub-core/include/grub/bitmap_scale.h rename to include/grub/bitmap_scale.h diff --git a/grub-core/include/grub/boot.h b/include/grub/boot.h similarity index 100% rename from grub-core/include/grub/boot.h rename to include/grub/boot.h diff --git a/grub-core/include/grub/bsdlabel.h b/include/grub/bsdlabel.h similarity index 100% rename from grub-core/include/grub/bsdlabel.h rename to include/grub/bsdlabel.h diff --git a/grub-core/include/grub/bufio.h b/include/grub/bufio.h similarity index 100% rename from grub-core/include/grub/bufio.h rename to include/grub/bufio.h diff --git a/grub-core/include/grub/cache.h b/include/grub/cache.h similarity index 100% rename from grub-core/include/grub/cache.h rename to include/grub/cache.h diff --git a/grub-core/include/grub/charset.h b/include/grub/charset.h similarity index 100% rename from grub-core/include/grub/charset.h rename to include/grub/charset.h diff --git a/grub-core/include/grub/cmos.h b/include/grub/cmos.h similarity index 100% rename from grub-core/include/grub/cmos.h rename to include/grub/cmos.h diff --git a/grub-core/include/grub/command.h b/include/grub/command.h similarity index 100% rename from grub-core/include/grub/command.h rename to include/grub/command.h diff --git a/grub-core/include/grub/crypto.h b/include/grub/crypto.h similarity index 100% rename from grub-core/include/grub/crypto.h rename to include/grub/crypto.h diff --git a/grub-core/include/grub/cs5536.h b/include/grub/cs5536.h similarity index 100% rename from grub-core/include/grub/cs5536.h rename to include/grub/cs5536.h diff --git a/grub-core/include/grub/datetime.h b/include/grub/datetime.h similarity index 100% rename from grub-core/include/grub/datetime.h rename to include/grub/datetime.h diff --git a/grub-core/include/grub/device.h b/include/grub/device.h similarity index 100% rename from grub-core/include/grub/device.h rename to include/grub/device.h diff --git a/grub-core/include/grub/disk.h b/include/grub/disk.h similarity index 100% rename from grub-core/include/grub/disk.h rename to include/grub/disk.h diff --git a/grub-core/include/grub/dl.h b/include/grub/dl.h similarity index 100% rename from grub-core/include/grub/dl.h rename to include/grub/dl.h diff --git a/grub-core/include/grub/efi/api.h b/include/grub/efi/api.h similarity index 100% rename from grub-core/include/grub/efi/api.h rename to include/grub/efi/api.h diff --git a/grub-core/include/grub/efi/console.h b/include/grub/efi/console.h similarity index 100% rename from grub-core/include/grub/efi/console.h rename to include/grub/efi/console.h diff --git a/grub-core/include/grub/efi/console_control.h b/include/grub/efi/console_control.h similarity index 100% rename from grub-core/include/grub/efi/console_control.h rename to include/grub/efi/console_control.h diff --git a/grub-core/include/grub/efi/disk.h b/include/grub/efi/disk.h similarity index 100% rename from grub-core/include/grub/efi/disk.h rename to include/grub/efi/disk.h diff --git a/grub-core/include/grub/efi/efi.h b/include/grub/efi/efi.h similarity index 100% rename from grub-core/include/grub/efi/efi.h rename to include/grub/efi/efi.h diff --git a/grub-core/include/grub/efi/graphics_output.h b/include/grub/efi/graphics_output.h similarity index 100% rename from grub-core/include/grub/efi/graphics_output.h rename to include/grub/efi/graphics_output.h diff --git a/grub-core/include/grub/efi/memory.h b/include/grub/efi/memory.h similarity index 100% rename from grub-core/include/grub/efi/memory.h rename to include/grub/efi/memory.h diff --git a/grub-core/include/grub/efi/pe32.h b/include/grub/efi/pe32.h similarity index 100% rename from grub-core/include/grub/efi/pe32.h rename to include/grub/efi/pe32.h diff --git a/grub-core/include/grub/efi/time.h b/include/grub/efi/time.h similarity index 100% rename from grub-core/include/grub/efi/time.h rename to include/grub/efi/time.h diff --git a/grub-core/include/grub/efi/uga_draw.h b/include/grub/efi/uga_draw.h similarity index 100% rename from grub-core/include/grub/efi/uga_draw.h rename to include/grub/efi/uga_draw.h diff --git a/grub-core/include/grub/efiemu/efiemu.h b/include/grub/efiemu/efiemu.h similarity index 100% rename from grub-core/include/grub/efiemu/efiemu.h rename to include/grub/efiemu/efiemu.h diff --git a/grub-core/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h similarity index 100% rename from grub-core/include/grub/efiemu/runtime.h rename to include/grub/efiemu/runtime.h diff --git a/grub-core/include/grub/elf.h b/include/grub/elf.h similarity index 100% rename from grub-core/include/grub/elf.h rename to include/grub/elf.h diff --git a/grub-core/include/grub/elfload.h b/include/grub/elfload.h similarity index 100% rename from grub-core/include/grub/elfload.h rename to include/grub/elfload.h diff --git a/grub-core/include/grub/emu/console.h b/include/grub/emu/console.h similarity index 100% rename from grub-core/include/grub/emu/console.h rename to include/grub/emu/console.h diff --git a/grub-core/include/grub/emu/getroot.h b/include/grub/emu/getroot.h similarity index 100% rename from grub-core/include/grub/emu/getroot.h rename to include/grub/emu/getroot.h diff --git a/grub-core/include/grub/emu/hostdisk.h b/include/grub/emu/hostdisk.h similarity index 100% rename from grub-core/include/grub/emu/hostdisk.h rename to include/grub/emu/hostdisk.h diff --git a/grub-core/include/grub/emu/misc.h b/include/grub/emu/misc.h similarity index 100% rename from grub-core/include/grub/emu/misc.h rename to include/grub/emu/misc.h diff --git a/grub-core/include/grub/env.h b/include/grub/env.h similarity index 100% rename from grub-core/include/grub/env.h rename to include/grub/env.h diff --git a/grub-core/include/grub/env_private.h b/include/grub/env_private.h similarity index 100% rename from grub-core/include/grub/env_private.h rename to include/grub/env_private.h diff --git a/grub-core/include/grub/err.h b/include/grub/err.h similarity index 100% rename from grub-core/include/grub/err.h rename to include/grub/err.h diff --git a/grub-core/include/grub/extcmd.h b/include/grub/extcmd.h similarity index 100% rename from grub-core/include/grub/extcmd.h rename to include/grub/extcmd.h diff --git a/grub-core/include/grub/fbblit.h b/include/grub/fbblit.h similarity index 100% rename from grub-core/include/grub/fbblit.h rename to include/grub/fbblit.h diff --git a/grub-core/include/grub/fbfill.h b/include/grub/fbfill.h similarity index 100% rename from grub-core/include/grub/fbfill.h rename to include/grub/fbfill.h diff --git a/grub-core/include/grub/fbutil.h b/include/grub/fbutil.h similarity index 100% rename from grub-core/include/grub/fbutil.h rename to include/grub/fbutil.h diff --git a/grub-core/include/grub/file.h b/include/grub/file.h similarity index 100% rename from grub-core/include/grub/file.h rename to include/grub/file.h diff --git a/grub-core/include/grub/font.h b/include/grub/font.h similarity index 100% rename from grub-core/include/grub/font.h rename to include/grub/font.h diff --git a/grub-core/include/grub/fontformat.h b/include/grub/fontformat.h similarity index 100% rename from grub-core/include/grub/fontformat.h rename to include/grub/fontformat.h diff --git a/grub-core/include/grub/fs.h b/include/grub/fs.h similarity index 100% rename from grub-core/include/grub/fs.h rename to include/grub/fs.h diff --git a/grub-core/include/grub/fshelp.h b/include/grub/fshelp.h similarity index 100% rename from grub-core/include/grub/fshelp.h rename to include/grub/fshelp.h diff --git a/grub-core/include/grub/gfxmenu_model.h b/include/grub/gfxmenu_model.h similarity index 100% rename from grub-core/include/grub/gfxmenu_model.h rename to include/grub/gfxmenu_model.h diff --git a/grub-core/include/grub/gfxmenu_view.h b/include/grub/gfxmenu_view.h similarity index 100% rename from grub-core/include/grub/gfxmenu_view.h rename to include/grub/gfxmenu_view.h diff --git a/grub-core/include/grub/gfxterm.h b/include/grub/gfxterm.h similarity index 100% rename from grub-core/include/grub/gfxterm.h rename to include/grub/gfxterm.h diff --git a/grub-core/include/grub/gfxwidgets.h b/include/grub/gfxwidgets.h similarity index 100% rename from grub-core/include/grub/gfxwidgets.h rename to include/grub/gfxwidgets.h diff --git a/grub-core/include/grub/gpt_partition.h b/include/grub/gpt_partition.h similarity index 100% rename from grub-core/include/grub/gpt_partition.h rename to include/grub/gpt_partition.h diff --git a/grub-core/include/grub/gui.h b/include/grub/gui.h similarity index 100% rename from grub-core/include/grub/gui.h rename to include/grub/gui.h diff --git a/grub-core/include/grub/gui_string_util.h b/include/grub/gui_string_util.h similarity index 100% rename from grub-core/include/grub/gui_string_util.h rename to include/grub/gui_string_util.h diff --git a/grub-core/include/grub/gzio.h b/include/grub/gzio.h similarity index 100% rename from grub-core/include/grub/gzio.h rename to include/grub/gzio.h diff --git a/grub-core/include/grub/hfs.h b/include/grub/hfs.h similarity index 100% rename from grub-core/include/grub/hfs.h rename to include/grub/hfs.h diff --git a/grub-core/include/grub/i18n.h b/include/grub/i18n.h similarity index 100% rename from grub-core/include/grub/i18n.h rename to include/grub/i18n.h diff --git a/grub-core/include/grub/i386/at_keyboard.h b/include/grub/i386/at_keyboard.h similarity index 100% rename from grub-core/include/grub/i386/at_keyboard.h rename to include/grub/i386/at_keyboard.h diff --git a/grub-core/include/grub/i386/bsd.h b/include/grub/i386/bsd.h similarity index 100% rename from grub-core/include/grub/i386/bsd.h rename to include/grub/i386/bsd.h diff --git a/grub-core/include/grub/i386/cmos.h b/include/grub/i386/cmos.h similarity index 100% rename from grub-core/include/grub/i386/cmos.h rename to include/grub/i386/cmos.h diff --git a/grub-core/include/grub/i386/coreboot/boot.h b/include/grub/i386/coreboot/boot.h similarity index 100% rename from grub-core/include/grub/i386/coreboot/boot.h rename to include/grub/i386/coreboot/boot.h diff --git a/grub-core/include/grub/i386/coreboot/console.h b/include/grub/i386/coreboot/console.h similarity index 100% rename from grub-core/include/grub/i386/coreboot/console.h rename to include/grub/i386/coreboot/console.h diff --git a/grub-core/include/grub/i386/coreboot/init.h b/include/grub/i386/coreboot/init.h similarity index 100% rename from grub-core/include/grub/i386/coreboot/init.h rename to include/grub/i386/coreboot/init.h diff --git a/grub-core/include/grub/i386/coreboot/loader.h b/include/grub/i386/coreboot/loader.h similarity index 100% rename from grub-core/include/grub/i386/coreboot/loader.h rename to include/grub/i386/coreboot/loader.h diff --git a/grub-core/include/grub/i386/coreboot/memory.h b/include/grub/i386/coreboot/memory.h similarity index 100% rename from grub-core/include/grub/i386/coreboot/memory.h rename to include/grub/i386/coreboot/memory.h diff --git a/grub-core/include/grub/i386/coreboot/serial.h b/include/grub/i386/coreboot/serial.h similarity index 100% rename from grub-core/include/grub/i386/coreboot/serial.h rename to include/grub/i386/coreboot/serial.h diff --git a/grub-core/include/grub/i386/coreboot/time.h b/include/grub/i386/coreboot/time.h similarity index 100% rename from grub-core/include/grub/i386/coreboot/time.h rename to include/grub/i386/coreboot/time.h diff --git a/grub-core/include/grub/i386/cpuid.h b/include/grub/i386/cpuid.h similarity index 100% rename from grub-core/include/grub/i386/cpuid.h rename to include/grub/i386/cpuid.h diff --git a/grub-core/include/grub/i386/efi/loader.h b/include/grub/i386/efi/loader.h similarity index 100% rename from grub-core/include/grub/i386/efi/loader.h rename to include/grub/i386/efi/loader.h diff --git a/grub-core/include/grub/i386/efi/memory.h b/include/grub/i386/efi/memory.h similarity index 100% rename from grub-core/include/grub/i386/efi/memory.h rename to include/grub/i386/efi/memory.h diff --git a/grub-core/include/grub/i386/efi/serial.h b/include/grub/i386/efi/serial.h similarity index 100% rename from grub-core/include/grub/i386/efi/serial.h rename to include/grub/i386/efi/serial.h diff --git a/grub-core/include/grub/i386/efi/time.h b/include/grub/i386/efi/time.h similarity index 100% rename from grub-core/include/grub/i386/efi/time.h rename to include/grub/i386/efi/time.h diff --git a/grub-core/include/grub/i386/efiemu.h b/include/grub/i386/efiemu.h similarity index 100% rename from grub-core/include/grub/i386/efiemu.h rename to include/grub/i386/efiemu.h diff --git a/grub-core/include/grub/i386/freebsd_linker.h b/include/grub/i386/freebsd_linker.h similarity index 100% rename from grub-core/include/grub/i386/freebsd_linker.h rename to include/grub/i386/freebsd_linker.h diff --git a/grub-core/include/grub/i386/freebsd_reboot.h b/include/grub/i386/freebsd_reboot.h similarity index 100% rename from grub-core/include/grub/i386/freebsd_reboot.h rename to include/grub/i386/freebsd_reboot.h diff --git a/grub-core/include/grub/i386/ieee1275/ieee1275.h b/include/grub/i386/ieee1275/ieee1275.h similarity index 100% rename from grub-core/include/grub/i386/ieee1275/ieee1275.h rename to include/grub/i386/ieee1275/ieee1275.h diff --git a/grub-core/include/grub/i386/ieee1275/loader.h b/include/grub/i386/ieee1275/loader.h similarity index 100% rename from grub-core/include/grub/i386/ieee1275/loader.h rename to include/grub/i386/ieee1275/loader.h diff --git a/grub-core/include/grub/i386/ieee1275/memory.h b/include/grub/i386/ieee1275/memory.h similarity index 100% rename from grub-core/include/grub/i386/ieee1275/memory.h rename to include/grub/i386/ieee1275/memory.h diff --git a/grub-core/include/grub/i386/ieee1275/serial.h b/include/grub/i386/ieee1275/serial.h similarity index 100% rename from grub-core/include/grub/i386/ieee1275/serial.h rename to include/grub/i386/ieee1275/serial.h diff --git a/grub-core/include/grub/i386/ieee1275/time.h b/include/grub/i386/ieee1275/time.h similarity index 100% rename from grub-core/include/grub/i386/ieee1275/time.h rename to include/grub/i386/ieee1275/time.h diff --git a/grub-core/include/grub/i386/io.h b/include/grub/i386/io.h similarity index 100% rename from grub-core/include/grub/i386/io.h rename to include/grub/i386/io.h diff --git a/grub-core/include/grub/i386/linux.h b/include/grub/i386/linux.h similarity index 100% rename from grub-core/include/grub/i386/linux.h rename to include/grub/i386/linux.h diff --git a/grub-core/include/grub/i386/loader.h b/include/grub/i386/loader.h similarity index 100% rename from grub-core/include/grub/i386/loader.h rename to include/grub/i386/loader.h diff --git a/grub-core/include/grub/i386/macho.h b/include/grub/i386/macho.h similarity index 100% rename from grub-core/include/grub/i386/macho.h rename to include/grub/i386/macho.h diff --git a/grub-core/include/grub/i386/memory.h b/include/grub/i386/memory.h similarity index 100% rename from grub-core/include/grub/i386/memory.h rename to include/grub/i386/memory.h diff --git a/grub-core/include/grub/i386/multiboot.h b/include/grub/i386/multiboot.h similarity index 100% rename from grub-core/include/grub/i386/multiboot.h rename to include/grub/i386/multiboot.h diff --git a/grub-core/include/grub/i386/multiboot/boot.h b/include/grub/i386/multiboot/boot.h similarity index 100% rename from grub-core/include/grub/i386/multiboot/boot.h rename to include/grub/i386/multiboot/boot.h diff --git a/grub-core/include/grub/i386/multiboot/console.h b/include/grub/i386/multiboot/console.h similarity index 100% rename from grub-core/include/grub/i386/multiboot/console.h rename to include/grub/i386/multiboot/console.h diff --git a/grub-core/include/grub/i386/multiboot/init.h b/include/grub/i386/multiboot/init.h similarity index 100% rename from grub-core/include/grub/i386/multiboot/init.h rename to include/grub/i386/multiboot/init.h diff --git a/grub-core/include/grub/i386/multiboot/kernel.h b/include/grub/i386/multiboot/kernel.h similarity index 100% rename from grub-core/include/grub/i386/multiboot/kernel.h rename to include/grub/i386/multiboot/kernel.h diff --git a/grub-core/include/grub/i386/multiboot/loader.h b/include/grub/i386/multiboot/loader.h similarity index 100% rename from grub-core/include/grub/i386/multiboot/loader.h rename to include/grub/i386/multiboot/loader.h diff --git a/grub-core/include/grub/i386/multiboot/memory.h b/include/grub/i386/multiboot/memory.h similarity index 100% rename from grub-core/include/grub/i386/multiboot/memory.h rename to include/grub/i386/multiboot/memory.h diff --git a/grub-core/include/grub/i386/multiboot/serial.h b/include/grub/i386/multiboot/serial.h similarity index 100% rename from grub-core/include/grub/i386/multiboot/serial.h rename to include/grub/i386/multiboot/serial.h diff --git a/grub-core/include/grub/i386/multiboot/time.h b/include/grub/i386/multiboot/time.h similarity index 100% rename from grub-core/include/grub/i386/multiboot/time.h rename to include/grub/i386/multiboot/time.h diff --git a/grub-core/include/grub/i386/netbsd_bootinfo.h b/include/grub/i386/netbsd_bootinfo.h similarity index 100% rename from grub-core/include/grub/i386/netbsd_bootinfo.h rename to include/grub/i386/netbsd_bootinfo.h diff --git a/grub-core/include/grub/i386/netbsd_reboot.h b/include/grub/i386/netbsd_reboot.h similarity index 100% rename from grub-core/include/grub/i386/netbsd_reboot.h rename to include/grub/i386/netbsd_reboot.h diff --git a/grub-core/include/grub/i386/openbsd_bootarg.h b/include/grub/i386/openbsd_bootarg.h similarity index 100% rename from grub-core/include/grub/i386/openbsd_bootarg.h rename to include/grub/i386/openbsd_bootarg.h diff --git a/grub-core/include/grub/i386/openbsd_reboot.h b/include/grub/i386/openbsd_reboot.h similarity index 100% rename from grub-core/include/grub/i386/openbsd_reboot.h rename to include/grub/i386/openbsd_reboot.h diff --git a/grub-core/include/grub/i386/pc/biosdisk.h b/include/grub/i386/pc/biosdisk.h similarity index 100% rename from grub-core/include/grub/i386/pc/biosdisk.h rename to include/grub/i386/pc/biosdisk.h diff --git a/grub-core/include/grub/i386/pc/biosnum.h b/include/grub/i386/pc/biosnum.h similarity index 100% rename from grub-core/include/grub/i386/pc/biosnum.h rename to include/grub/i386/pc/biosnum.h diff --git a/grub-core/include/grub/i386/pc/boot.h b/include/grub/i386/pc/boot.h similarity index 100% rename from grub-core/include/grub/i386/pc/boot.h rename to include/grub/i386/pc/boot.h diff --git a/grub-core/include/grub/i386/pc/chainloader.h b/include/grub/i386/pc/chainloader.h similarity index 100% rename from grub-core/include/grub/i386/pc/chainloader.h rename to include/grub/i386/pc/chainloader.h diff --git a/grub-core/include/grub/i386/pc/console.h b/include/grub/i386/pc/console.h similarity index 100% rename from grub-core/include/grub/i386/pc/console.h rename to include/grub/i386/pc/console.h diff --git a/grub-core/include/grub/i386/pc/efiemu.h b/include/grub/i386/pc/efiemu.h similarity index 100% rename from grub-core/include/grub/i386/pc/efiemu.h rename to include/grub/i386/pc/efiemu.h diff --git a/grub-core/include/grub/i386/pc/init.h b/include/grub/i386/pc/init.h similarity index 100% rename from grub-core/include/grub/i386/pc/init.h rename to include/grub/i386/pc/init.h diff --git a/grub-core/include/grub/i386/pc/kernel.h b/include/grub/i386/pc/kernel.h similarity index 100% rename from grub-core/include/grub/i386/pc/kernel.h rename to include/grub/i386/pc/kernel.h diff --git a/grub-core/include/grub/i386/pc/loader.h b/include/grub/i386/pc/loader.h similarity index 100% rename from grub-core/include/grub/i386/pc/loader.h rename to include/grub/i386/pc/loader.h diff --git a/grub-core/include/grub/i386/pc/memory.h b/include/grub/i386/pc/memory.h similarity index 100% rename from grub-core/include/grub/i386/pc/memory.h rename to include/grub/i386/pc/memory.h diff --git a/grub-core/include/grub/i386/pc/pxe.h b/include/grub/i386/pc/pxe.h similarity index 100% rename from grub-core/include/grub/i386/pc/pxe.h rename to include/grub/i386/pc/pxe.h diff --git a/grub-core/include/grub/i386/pc/time.h b/include/grub/i386/pc/time.h similarity index 100% rename from grub-core/include/grub/i386/pc/time.h rename to include/grub/i386/pc/time.h diff --git a/grub-core/include/grub/i386/pc/vbe.h b/include/grub/i386/pc/vbe.h similarity index 100% rename from grub-core/include/grub/i386/pc/vbe.h rename to include/grub/i386/pc/vbe.h diff --git a/grub-core/include/grub/i386/pc/vga.h b/include/grub/i386/pc/vga.h similarity index 100% rename from grub-core/include/grub/i386/pc/vga.h rename to include/grub/i386/pc/vga.h diff --git a/grub-core/include/grub/i386/pci.h b/include/grub/i386/pci.h similarity index 100% rename from grub-core/include/grub/i386/pci.h rename to include/grub/i386/pci.h diff --git a/grub-core/include/grub/i386/pit.h b/include/grub/i386/pit.h similarity index 100% rename from grub-core/include/grub/i386/pit.h rename to include/grub/i386/pit.h diff --git a/grub-core/include/grub/i386/qemu/boot.h b/include/grub/i386/qemu/boot.h similarity index 100% rename from grub-core/include/grub/i386/qemu/boot.h rename to include/grub/i386/qemu/boot.h diff --git a/grub-core/include/grub/i386/qemu/console.h b/include/grub/i386/qemu/console.h similarity index 100% rename from grub-core/include/grub/i386/qemu/console.h rename to include/grub/i386/qemu/console.h diff --git a/grub-core/include/grub/i386/qemu/init.h b/include/grub/i386/qemu/init.h similarity index 100% rename from grub-core/include/grub/i386/qemu/init.h rename to include/grub/i386/qemu/init.h diff --git a/grub-core/include/grub/i386/qemu/kernel.h b/include/grub/i386/qemu/kernel.h similarity index 100% rename from grub-core/include/grub/i386/qemu/kernel.h rename to include/grub/i386/qemu/kernel.h diff --git a/grub-core/include/grub/i386/qemu/loader.h b/include/grub/i386/qemu/loader.h similarity index 100% rename from grub-core/include/grub/i386/qemu/loader.h rename to include/grub/i386/qemu/loader.h diff --git a/grub-core/include/grub/i386/qemu/memory.h b/include/grub/i386/qemu/memory.h similarity index 100% rename from grub-core/include/grub/i386/qemu/memory.h rename to include/grub/i386/qemu/memory.h diff --git a/grub-core/include/grub/i386/qemu/serial.h b/include/grub/i386/qemu/serial.h similarity index 100% rename from grub-core/include/grub/i386/qemu/serial.h rename to include/grub/i386/qemu/serial.h diff --git a/grub-core/include/grub/i386/qemu/time.h b/include/grub/i386/qemu/time.h similarity index 100% rename from grub-core/include/grub/i386/qemu/time.h rename to include/grub/i386/qemu/time.h diff --git a/grub-core/include/grub/i386/relocator.h b/include/grub/i386/relocator.h similarity index 100% rename from grub-core/include/grub/i386/relocator.h rename to include/grub/i386/relocator.h diff --git a/grub-core/include/grub/i386/setjmp.h b/include/grub/i386/setjmp.h similarity index 100% rename from grub-core/include/grub/i386/setjmp.h rename to include/grub/i386/setjmp.h diff --git a/grub-core/include/grub/i386/time.h b/include/grub/i386/time.h similarity index 100% rename from grub-core/include/grub/i386/time.h rename to include/grub/i386/time.h diff --git a/grub-core/include/grub/i386/tsc.h b/include/grub/i386/tsc.h similarity index 100% rename from grub-core/include/grub/i386/tsc.h rename to include/grub/i386/tsc.h diff --git a/grub-core/include/grub/i386/types.h b/include/grub/i386/types.h similarity index 100% rename from grub-core/include/grub/i386/types.h rename to include/grub/i386/types.h diff --git a/grub-core/include/grub/i386/vga_common.h b/include/grub/i386/vga_common.h similarity index 100% rename from grub-core/include/grub/i386/vga_common.h rename to include/grub/i386/vga_common.h diff --git a/grub-core/include/grub/i386/xnu.h b/include/grub/i386/xnu.h similarity index 100% rename from grub-core/include/grub/i386/xnu.h rename to include/grub/i386/xnu.h diff --git a/grub-core/include/grub/icon_manager.h b/include/grub/icon_manager.h similarity index 100% rename from grub-core/include/grub/icon_manager.h rename to include/grub/icon_manager.h diff --git a/grub-core/include/grub/ieee1275/console.h b/include/grub/ieee1275/console.h similarity index 100% rename from grub-core/include/grub/ieee1275/console.h rename to include/grub/ieee1275/console.h diff --git a/grub-core/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h similarity index 100% rename from grub-core/include/grub/ieee1275/ieee1275.h rename to include/grub/ieee1275/ieee1275.h diff --git a/grub-core/include/grub/ieee1275/ofdisk.h b/include/grub/ieee1275/ofdisk.h similarity index 100% rename from grub-core/include/grub/ieee1275/ofdisk.h rename to include/grub/ieee1275/ofdisk.h diff --git a/grub-core/include/grub/kernel.h b/include/grub/kernel.h similarity index 100% rename from grub-core/include/grub/kernel.h rename to include/grub/kernel.h diff --git a/grub-core/include/grub/lib/LzFind.h b/include/grub/lib/LzFind.h similarity index 100% rename from grub-core/include/grub/lib/LzFind.h rename to include/grub/lib/LzFind.h diff --git a/grub-core/include/grub/lib/LzHash.h b/include/grub/lib/LzHash.h similarity index 100% rename from grub-core/include/grub/lib/LzHash.h rename to include/grub/lib/LzHash.h diff --git a/grub-core/include/grub/lib/LzmaDec.h b/include/grub/lib/LzmaDec.h similarity index 100% rename from grub-core/include/grub/lib/LzmaDec.h rename to include/grub/lib/LzmaDec.h diff --git a/grub-core/include/grub/lib/LzmaEnc.h b/include/grub/lib/LzmaEnc.h similarity index 100% rename from grub-core/include/grub/lib/LzmaEnc.h rename to include/grub/lib/LzmaEnc.h diff --git a/grub-core/include/grub/lib/LzmaTypes.h b/include/grub/lib/LzmaTypes.h similarity index 100% rename from grub-core/include/grub/lib/LzmaTypes.h rename to include/grub/lib/LzmaTypes.h diff --git a/grub-core/include/grub/lib/arg.h b/include/grub/lib/arg.h similarity index 100% rename from grub-core/include/grub/lib/arg.h rename to include/grub/lib/arg.h diff --git a/grub-core/include/grub/lib/crc.h b/include/grub/lib/crc.h similarity index 100% rename from grub-core/include/grub/lib/crc.h rename to include/grub/lib/crc.h diff --git a/grub-core/include/grub/lib/envblk.h b/include/grub/lib/envblk.h similarity index 100% rename from grub-core/include/grub/lib/envblk.h rename to include/grub/lib/envblk.h diff --git a/grub-core/include/grub/lib/hexdump.h b/include/grub/lib/hexdump.h similarity index 100% rename from grub-core/include/grub/lib/hexdump.h rename to include/grub/lib/hexdump.h diff --git a/grub-core/include/grub/libgcc.h b/include/grub/libgcc.h similarity index 100% rename from grub-core/include/grub/libgcc.h rename to include/grub/libgcc.h diff --git a/grub-core/include/grub/libpciaccess.h b/include/grub/libpciaccess.h similarity index 100% rename from grub-core/include/grub/libpciaccess.h rename to include/grub/libpciaccess.h diff --git a/grub-core/include/grub/libusb.h b/include/grub/libusb.h similarity index 100% rename from grub-core/include/grub/libusb.h rename to include/grub/libusb.h diff --git a/grub-core/include/grub/list.h b/include/grub/list.h similarity index 100% rename from grub-core/include/grub/list.h rename to include/grub/list.h diff --git a/grub-core/include/grub/loader.h b/include/grub/loader.h similarity index 100% rename from grub-core/include/grub/loader.h rename to include/grub/loader.h diff --git a/grub-core/include/grub/lvm.h b/include/grub/lvm.h similarity index 100% rename from grub-core/include/grub/lvm.h rename to include/grub/lvm.h diff --git a/grub-core/include/grub/macho.h b/include/grub/macho.h similarity index 100% rename from grub-core/include/grub/macho.h rename to include/grub/macho.h diff --git a/grub-core/include/grub/machoload.h b/include/grub/machoload.h similarity index 100% rename from grub-core/include/grub/machoload.h rename to include/grub/machoload.h diff --git a/grub-core/include/grub/memory.h b/include/grub/memory.h similarity index 100% rename from grub-core/include/grub/memory.h rename to include/grub/memory.h diff --git a/grub-core/include/grub/menu.h b/include/grub/menu.h similarity index 100% rename from grub-core/include/grub/menu.h rename to include/grub/menu.h diff --git a/grub-core/include/grub/menu_viewer.h b/include/grub/menu_viewer.h similarity index 100% rename from grub-core/include/grub/menu_viewer.h rename to include/grub/menu_viewer.h diff --git a/grub-core/include/grub/mips/at_keyboard.h b/include/grub/mips/at_keyboard.h similarity index 100% rename from grub-core/include/grub/mips/at_keyboard.h rename to include/grub/mips/at_keyboard.h diff --git a/grub-core/include/grub/mips/cache.h b/include/grub/mips/cache.h similarity index 100% rename from grub-core/include/grub/mips/cache.h rename to include/grub/mips/cache.h diff --git a/grub-core/include/grub/mips/cmos.h b/include/grub/mips/cmos.h similarity index 100% rename from grub-core/include/grub/mips/cmos.h rename to include/grub/mips/cmos.h diff --git a/grub-core/include/grub/mips/io.h b/include/grub/mips/io.h similarity index 100% rename from grub-core/include/grub/mips/io.h rename to include/grub/mips/io.h diff --git a/grub-core/include/grub/mips/loongson.h b/include/grub/mips/loongson.h similarity index 100% rename from grub-core/include/grub/mips/loongson.h rename to include/grub/mips/loongson.h diff --git a/grub-core/include/grub/mips/multiboot.h b/include/grub/mips/multiboot.h similarity index 100% rename from grub-core/include/grub/mips/multiboot.h rename to include/grub/mips/multiboot.h diff --git a/grub-core/include/grub/mips/pci.h b/include/grub/mips/pci.h similarity index 100% rename from grub-core/include/grub/mips/pci.h rename to include/grub/mips/pci.h diff --git a/grub-core/include/grub/mips/qemu-mips/kernel.h b/include/grub/mips/qemu-mips/kernel.h similarity index 100% rename from grub-core/include/grub/mips/qemu-mips/kernel.h rename to include/grub/mips/qemu-mips/kernel.h diff --git a/grub-core/include/grub/mips/qemu-mips/loader.h b/include/grub/mips/qemu-mips/loader.h similarity index 100% rename from grub-core/include/grub/mips/qemu-mips/loader.h rename to include/grub/mips/qemu-mips/loader.h diff --git a/grub-core/include/grub/mips/qemu-mips/memory.h b/include/grub/mips/qemu-mips/memory.h similarity index 100% rename from grub-core/include/grub/mips/qemu-mips/memory.h rename to include/grub/mips/qemu-mips/memory.h diff --git a/grub-core/include/grub/mips/qemu-mips/serial.h b/include/grub/mips/qemu-mips/serial.h similarity index 100% rename from grub-core/include/grub/mips/qemu-mips/serial.h rename to include/grub/mips/qemu-mips/serial.h diff --git a/grub-core/include/grub/mips/qemu-mips/time.h b/include/grub/mips/qemu-mips/time.h similarity index 100% rename from grub-core/include/grub/mips/qemu-mips/time.h rename to include/grub/mips/qemu-mips/time.h diff --git a/grub-core/include/grub/mips/relocator.h b/include/grub/mips/relocator.h similarity index 100% rename from grub-core/include/grub/mips/relocator.h rename to include/grub/mips/relocator.h diff --git a/grub-core/include/grub/mips/setjmp.h b/include/grub/mips/setjmp.h similarity index 100% rename from grub-core/include/grub/mips/setjmp.h rename to include/grub/mips/setjmp.h diff --git a/grub-core/include/grub/mips/time.h b/include/grub/mips/time.h similarity index 100% rename from grub-core/include/grub/mips/time.h rename to include/grub/mips/time.h diff --git a/grub-core/include/grub/mips/types.h b/include/grub/mips/types.h similarity index 100% rename from grub-core/include/grub/mips/types.h rename to include/grub/mips/types.h diff --git a/grub-core/include/grub/mips/yeeloong/at_keyboard.h b/include/grub/mips/yeeloong/at_keyboard.h similarity index 100% rename from grub-core/include/grub/mips/yeeloong/at_keyboard.h rename to include/grub/mips/yeeloong/at_keyboard.h diff --git a/grub-core/include/grub/mips/yeeloong/cmos.h b/include/grub/mips/yeeloong/cmos.h similarity index 100% rename from grub-core/include/grub/mips/yeeloong/cmos.h rename to include/grub/mips/yeeloong/cmos.h diff --git a/grub-core/include/grub/mips/yeeloong/ec.h b/include/grub/mips/yeeloong/ec.h similarity index 100% rename from grub-core/include/grub/mips/yeeloong/ec.h rename to include/grub/mips/yeeloong/ec.h diff --git a/grub-core/include/grub/mips/yeeloong/kernel.h b/include/grub/mips/yeeloong/kernel.h similarity index 100% rename from grub-core/include/grub/mips/yeeloong/kernel.h rename to include/grub/mips/yeeloong/kernel.h diff --git a/grub-core/include/grub/mips/yeeloong/loader.h b/include/grub/mips/yeeloong/loader.h similarity index 100% rename from grub-core/include/grub/mips/yeeloong/loader.h rename to include/grub/mips/yeeloong/loader.h diff --git a/grub-core/include/grub/mips/yeeloong/memory.h b/include/grub/mips/yeeloong/memory.h similarity index 100% rename from grub-core/include/grub/mips/yeeloong/memory.h rename to include/grub/mips/yeeloong/memory.h diff --git a/grub-core/include/grub/mips/yeeloong/pci.h b/include/grub/mips/yeeloong/pci.h similarity index 100% rename from grub-core/include/grub/mips/yeeloong/pci.h rename to include/grub/mips/yeeloong/pci.h diff --git a/grub-core/include/grub/mips/yeeloong/serial.h b/include/grub/mips/yeeloong/serial.h similarity index 100% rename from grub-core/include/grub/mips/yeeloong/serial.h rename to include/grub/mips/yeeloong/serial.h diff --git a/grub-core/include/grub/mips/yeeloong/time.h b/include/grub/mips/yeeloong/time.h similarity index 100% rename from grub-core/include/grub/mips/yeeloong/time.h rename to include/grub/mips/yeeloong/time.h diff --git a/grub-core/include/grub/misc.h b/include/grub/misc.h similarity index 100% rename from grub-core/include/grub/misc.h rename to include/grub/misc.h diff --git a/grub-core/include/grub/mm.h b/include/grub/mm.h similarity index 100% rename from grub-core/include/grub/mm.h rename to include/grub/mm.h diff --git a/grub-core/include/grub/msdos_partition.h b/include/grub/msdos_partition.h similarity index 100% rename from grub-core/include/grub/msdos_partition.h rename to include/grub/msdos_partition.h diff --git a/grub-core/include/grub/multiboot.h b/include/grub/multiboot.h similarity index 100% rename from grub-core/include/grub/multiboot.h rename to include/grub/multiboot.h diff --git a/grub-core/include/grub/multiboot_loader.h b/include/grub/multiboot_loader.h similarity index 100% rename from grub-core/include/grub/multiboot_loader.h rename to include/grub/multiboot_loader.h diff --git a/grub-core/include/grub/net.h b/include/grub/net.h similarity index 100% rename from grub-core/include/grub/net.h rename to include/grub/net.h diff --git a/grub-core/include/grub/normal.h b/include/grub/normal.h similarity index 100% rename from grub-core/include/grub/normal.h rename to include/grub/normal.h diff --git a/grub-core/include/grub/ntfs.h b/include/grub/ntfs.h similarity index 100% rename from grub-core/include/grub/ntfs.h rename to include/grub/ntfs.h diff --git a/grub-core/include/grub/offsets.h b/include/grub/offsets.h similarity index 100% rename from grub-core/include/grub/offsets.h rename to include/grub/offsets.h diff --git a/grub-core/include/grub/parser.h b/include/grub/parser.h similarity index 100% rename from grub-core/include/grub/parser.h rename to include/grub/parser.h diff --git a/grub-core/include/grub/partition.h b/include/grub/partition.h similarity index 100% rename from grub-core/include/grub/partition.h rename to include/grub/partition.h diff --git a/grub-core/include/grub/parttool.h b/include/grub/parttool.h similarity index 100% rename from grub-core/include/grub/parttool.h rename to include/grub/parttool.h diff --git a/grub-core/include/grub/pci.h b/include/grub/pci.h similarity index 100% rename from grub-core/include/grub/pci.h rename to include/grub/pci.h diff --git a/grub-core/include/grub/pciutils.h b/include/grub/pciutils.h similarity index 100% rename from grub-core/include/grub/pciutils.h rename to include/grub/pciutils.h diff --git a/grub-core/include/grub/powerpc/ieee1275/biosdisk.h b/include/grub/powerpc/ieee1275/biosdisk.h similarity index 100% rename from grub-core/include/grub/powerpc/ieee1275/biosdisk.h rename to include/grub/powerpc/ieee1275/biosdisk.h diff --git a/grub-core/include/grub/powerpc/ieee1275/ieee1275.h b/include/grub/powerpc/ieee1275/ieee1275.h similarity index 100% rename from grub-core/include/grub/powerpc/ieee1275/ieee1275.h rename to include/grub/powerpc/ieee1275/ieee1275.h diff --git a/grub-core/include/grub/powerpc/ieee1275/loader.h b/include/grub/powerpc/ieee1275/loader.h similarity index 100% rename from grub-core/include/grub/powerpc/ieee1275/loader.h rename to include/grub/powerpc/ieee1275/loader.h diff --git a/grub-core/include/grub/powerpc/ieee1275/memory.h b/include/grub/powerpc/ieee1275/memory.h similarity index 100% rename from grub-core/include/grub/powerpc/ieee1275/memory.h rename to include/grub/powerpc/ieee1275/memory.h diff --git a/grub-core/include/grub/powerpc/ieee1275/time.h b/include/grub/powerpc/ieee1275/time.h similarity index 100% rename from grub-core/include/grub/powerpc/ieee1275/time.h rename to include/grub/powerpc/ieee1275/time.h diff --git a/grub-core/include/grub/powerpc/ieee1275/util/biosdisk.h b/include/grub/powerpc/ieee1275/util/biosdisk.h similarity index 100% rename from grub-core/include/grub/powerpc/ieee1275/util/biosdisk.h rename to include/grub/powerpc/ieee1275/util/biosdisk.h diff --git a/grub-core/include/grub/powerpc/kernel.h b/include/grub/powerpc/kernel.h similarity index 100% rename from grub-core/include/grub/powerpc/kernel.h rename to include/grub/powerpc/kernel.h diff --git a/grub-core/include/grub/powerpc/setjmp.h b/include/grub/powerpc/setjmp.h similarity index 100% rename from grub-core/include/grub/powerpc/setjmp.h rename to include/grub/powerpc/setjmp.h diff --git a/grub-core/include/grub/powerpc/time.h b/include/grub/powerpc/time.h similarity index 100% rename from grub-core/include/grub/powerpc/time.h rename to include/grub/powerpc/time.h diff --git a/grub-core/include/grub/powerpc/types.h b/include/grub/powerpc/types.h similarity index 100% rename from grub-core/include/grub/powerpc/types.h rename to include/grub/powerpc/types.h diff --git a/grub-core/include/grub/raid.h b/include/grub/raid.h similarity index 100% rename from grub-core/include/grub/raid.h rename to include/grub/raid.h diff --git a/grub-core/include/grub/reader.h b/include/grub/reader.h similarity index 100% rename from grub-core/include/grub/reader.h rename to include/grub/reader.h diff --git a/grub-core/include/grub/script_sh.h b/include/grub/script_sh.h similarity index 100% rename from grub-core/include/grub/script_sh.h rename to include/grub/script_sh.h diff --git a/grub-core/include/grub/scsi.h b/include/grub/scsi.h similarity index 100% rename from grub-core/include/grub/scsi.h rename to include/grub/scsi.h diff --git a/grub-core/include/grub/scsicmd.h b/include/grub/scsicmd.h similarity index 100% rename from grub-core/include/grub/scsicmd.h rename to include/grub/scsicmd.h diff --git a/grub-core/include/grub/sdl.h b/include/grub/sdl.h similarity index 100% rename from grub-core/include/grub/sdl.h rename to include/grub/sdl.h diff --git a/grub-core/include/grub/search.h b/include/grub/search.h similarity index 100% rename from grub-core/include/grub/search.h rename to include/grub/search.h diff --git a/grub-core/include/grub/serial.h b/include/grub/serial.h similarity index 100% rename from grub-core/include/grub/serial.h rename to include/grub/serial.h diff --git a/grub-core/include/grub/setjmp.h b/include/grub/setjmp.h similarity index 100% rename from grub-core/include/grub/setjmp.h rename to include/grub/setjmp.h diff --git a/grub-core/include/grub/smbus.h b/include/grub/smbus.h similarity index 100% rename from grub-core/include/grub/smbus.h rename to include/grub/smbus.h diff --git a/grub-core/include/grub/sparc64/ieee1275/boot.h b/include/grub/sparc64/ieee1275/boot.h similarity index 100% rename from grub-core/include/grub/sparc64/ieee1275/boot.h rename to include/grub/sparc64/ieee1275/boot.h diff --git a/grub-core/include/grub/sparc64/ieee1275/ieee1275.h b/include/grub/sparc64/ieee1275/ieee1275.h similarity index 100% rename from grub-core/include/grub/sparc64/ieee1275/ieee1275.h rename to include/grub/sparc64/ieee1275/ieee1275.h diff --git a/grub-core/include/grub/sparc64/ieee1275/kernel.h b/include/grub/sparc64/ieee1275/kernel.h similarity index 100% rename from grub-core/include/grub/sparc64/ieee1275/kernel.h rename to include/grub/sparc64/ieee1275/kernel.h diff --git a/grub-core/include/grub/sparc64/ieee1275/loader.h b/include/grub/sparc64/ieee1275/loader.h similarity index 100% rename from grub-core/include/grub/sparc64/ieee1275/loader.h rename to include/grub/sparc64/ieee1275/loader.h diff --git a/grub-core/include/grub/sparc64/ieee1275/memory.h b/include/grub/sparc64/ieee1275/memory.h similarity index 100% rename from grub-core/include/grub/sparc64/ieee1275/memory.h rename to include/grub/sparc64/ieee1275/memory.h diff --git a/grub-core/include/grub/sparc64/ieee1275/time.h b/include/grub/sparc64/ieee1275/time.h similarity index 100% rename from grub-core/include/grub/sparc64/ieee1275/time.h rename to include/grub/sparc64/ieee1275/time.h diff --git a/grub-core/include/grub/sparc64/setjmp.h b/include/grub/sparc64/setjmp.h similarity index 100% rename from grub-core/include/grub/sparc64/setjmp.h rename to include/grub/sparc64/setjmp.h diff --git a/grub-core/include/grub/sparc64/time.h b/include/grub/sparc64/time.h similarity index 100% rename from grub-core/include/grub/sparc64/time.h rename to include/grub/sparc64/time.h diff --git a/grub-core/include/grub/sparc64/types.h b/include/grub/sparc64/types.h similarity index 100% rename from grub-core/include/grub/sparc64/types.h rename to include/grub/sparc64/types.h diff --git a/grub-core/include/grub/symbol.h b/include/grub/symbol.h similarity index 100% rename from grub-core/include/grub/symbol.h rename to include/grub/symbol.h diff --git a/grub-core/include/grub/term.h b/include/grub/term.h similarity index 100% rename from grub-core/include/grub/term.h rename to include/grub/term.h diff --git a/grub-core/include/grub/terminfo.h b/include/grub/terminfo.h similarity index 100% rename from grub-core/include/grub/terminfo.h rename to include/grub/terminfo.h diff --git a/grub-core/include/grub/test.h b/include/grub/test.h similarity index 100% rename from grub-core/include/grub/test.h rename to include/grub/test.h diff --git a/grub-core/include/grub/time.h b/include/grub/time.h similarity index 100% rename from grub-core/include/grub/time.h rename to include/grub/time.h diff --git a/grub-core/include/grub/tparm.h b/include/grub/tparm.h similarity index 100% rename from grub-core/include/grub/tparm.h rename to include/grub/tparm.h diff --git a/grub-core/include/grub/trig.h b/include/grub/trig.h similarity index 100% rename from grub-core/include/grub/trig.h rename to include/grub/trig.h diff --git a/grub-core/include/grub/types.h b/include/grub/types.h similarity index 100% rename from grub-core/include/grub/types.h rename to include/grub/types.h diff --git a/grub-core/include/grub/unicode.h b/include/grub/unicode.h similarity index 100% rename from grub-core/include/grub/unicode.h rename to include/grub/unicode.h diff --git a/grub-core/include/grub/usb.h b/include/grub/usb.h similarity index 100% rename from grub-core/include/grub/usb.h rename to include/grub/usb.h diff --git a/grub-core/include/grub/usbdesc.h b/include/grub/usbdesc.h similarity index 100% rename from grub-core/include/grub/usbdesc.h rename to include/grub/usbdesc.h diff --git a/grub-core/include/grub/usbtrans.h b/include/grub/usbtrans.h similarity index 100% rename from grub-core/include/grub/usbtrans.h rename to include/grub/usbtrans.h diff --git a/grub-core/include/grub/util/deviceiter.h b/include/grub/util/deviceiter.h similarity index 100% rename from grub-core/include/grub/util/deviceiter.h rename to include/grub/util/deviceiter.h diff --git a/grub-core/include/grub/util/lvm.h b/include/grub/util/lvm.h similarity index 100% rename from grub-core/include/grub/util/lvm.h rename to include/grub/util/lvm.h diff --git a/grub-core/include/grub/util/misc.h b/include/grub/util/misc.h similarity index 100% rename from grub-core/include/grub/util/misc.h rename to include/grub/util/misc.h diff --git a/grub-core/include/grub/util/ofpath.h b/include/grub/util/ofpath.h similarity index 100% rename from grub-core/include/grub/util/ofpath.h rename to include/grub/util/ofpath.h diff --git a/grub-core/include/grub/util/raid.h b/include/grub/util/raid.h similarity index 100% rename from grub-core/include/grub/util/raid.h rename to include/grub/util/raid.h diff --git a/grub-core/include/grub/util/resolve.h b/include/grub/util/resolve.h similarity index 100% rename from grub-core/include/grub/util/resolve.h rename to include/grub/util/resolve.h diff --git a/grub-core/include/grub/vga.h b/include/grub/vga.h similarity index 100% rename from grub-core/include/grub/vga.h rename to include/grub/vga.h diff --git a/grub-core/include/grub/video.h b/include/grub/video.h similarity index 100% rename from grub-core/include/grub/video.h rename to include/grub/video.h diff --git a/grub-core/include/grub/video_fb.h b/include/grub/video_fb.h similarity index 100% rename from grub-core/include/grub/video_fb.h rename to include/grub/video_fb.h diff --git a/grub-core/include/grub/x86_64/at_keyboard.h b/include/grub/x86_64/at_keyboard.h similarity index 100% rename from grub-core/include/grub/x86_64/at_keyboard.h rename to include/grub/x86_64/at_keyboard.h diff --git a/grub-core/include/grub/x86_64/efi/boot.h b/include/grub/x86_64/efi/boot.h similarity index 100% rename from grub-core/include/grub/x86_64/efi/boot.h rename to include/grub/x86_64/efi/boot.h diff --git a/grub-core/include/grub/x86_64/efi/loader.h b/include/grub/x86_64/efi/loader.h similarity index 100% rename from grub-core/include/grub/x86_64/efi/loader.h rename to include/grub/x86_64/efi/loader.h diff --git a/grub-core/include/grub/x86_64/efi/memory.h b/include/grub/x86_64/efi/memory.h similarity index 100% rename from grub-core/include/grub/x86_64/efi/memory.h rename to include/grub/x86_64/efi/memory.h diff --git a/grub-core/include/grub/x86_64/efi/serial.h b/include/grub/x86_64/efi/serial.h similarity index 100% rename from grub-core/include/grub/x86_64/efi/serial.h rename to include/grub/x86_64/efi/serial.h diff --git a/grub-core/include/grub/x86_64/efi/time.h b/include/grub/x86_64/efi/time.h similarity index 100% rename from grub-core/include/grub/x86_64/efi/time.h rename to include/grub/x86_64/efi/time.h diff --git a/grub-core/include/grub/x86_64/io.h b/include/grub/x86_64/io.h similarity index 100% rename from grub-core/include/grub/x86_64/io.h rename to include/grub/x86_64/io.h diff --git a/grub-core/include/grub/x86_64/linux.h b/include/grub/x86_64/linux.h similarity index 100% rename from grub-core/include/grub/x86_64/linux.h rename to include/grub/x86_64/linux.h diff --git a/grub-core/include/grub/x86_64/macho.h b/include/grub/x86_64/macho.h similarity index 100% rename from grub-core/include/grub/x86_64/macho.h rename to include/grub/x86_64/macho.h diff --git a/grub-core/include/grub/x86_64/multiboot.h b/include/grub/x86_64/multiboot.h similarity index 100% rename from grub-core/include/grub/x86_64/multiboot.h rename to include/grub/x86_64/multiboot.h diff --git a/grub-core/include/grub/x86_64/pci.h b/include/grub/x86_64/pci.h similarity index 100% rename from grub-core/include/grub/x86_64/pci.h rename to include/grub/x86_64/pci.h diff --git a/grub-core/include/grub/x86_64/relocator.h b/include/grub/x86_64/relocator.h similarity index 100% rename from grub-core/include/grub/x86_64/relocator.h rename to include/grub/x86_64/relocator.h diff --git a/grub-core/include/grub/x86_64/setjmp.h b/include/grub/x86_64/setjmp.h similarity index 100% rename from grub-core/include/grub/x86_64/setjmp.h rename to include/grub/x86_64/setjmp.h diff --git a/grub-core/include/grub/x86_64/time.h b/include/grub/x86_64/time.h similarity index 100% rename from grub-core/include/grub/x86_64/time.h rename to include/grub/x86_64/time.h diff --git a/grub-core/include/grub/x86_64/types.h b/include/grub/x86_64/types.h similarity index 100% rename from grub-core/include/grub/x86_64/types.h rename to include/grub/x86_64/types.h diff --git a/grub-core/include/grub/x86_64/xnu.h b/include/grub/x86_64/xnu.h similarity index 100% rename from grub-core/include/grub/x86_64/xnu.h rename to include/grub/x86_64/xnu.h diff --git a/grub-core/include/grub/xnu.h b/include/grub/xnu.h similarity index 100% rename from grub-core/include/grub/xnu.h rename to include/grub/xnu.h diff --git a/grub-core/include/multiboot.h b/include/multiboot.h similarity index 100% rename from grub-core/include/multiboot.h rename to include/multiboot.h diff --git a/grub-core/include/multiboot2.h b/include/multiboot2.h similarity index 100% rename from grub-core/include/multiboot2.h rename to include/multiboot2.h diff --git a/grub-core/import_gcry.py b/util/import_gcry.py similarity index 99% rename from grub-core/import_gcry.py rename to util/import_gcry.py index b9c3edcde..b63fb5501 100644 --- a/grub-core/import_gcry.py +++ b/util/import_gcry.py @@ -40,7 +40,7 @@ except: print ("WARNING: %s already exists" % cipher_dir_out) cipher_files = os.listdir (cipher_dir_in) -conf = open (os.path.join (outdir, "conf", "gcry.rmk"), "w") +conf = open (os.path.join ("conf", "gcry.rmk"), "w") conf.write ("# -*- makefile -*-\n\n") chlog = "" From 5c2d039c58dc40e2d559ac7bd0f1cdd4676463e4 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 17 Aug 2010 19:04:35 +0530 Subject: [PATCH 114/174] update .bzrignore --- .bzrignore | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.bzrignore b/.bzrignore index ac5e3f86d..7347c0950 100644 --- a/.bzrignore +++ b/.bzrignore @@ -88,26 +88,5 @@ compile depcomp mdate-sh texinfo.tex -grub-core/ABOUT-NLS -grub-core/AUTHORS -grub-core/COPYING -grub-core/ChangeLog -grub-core/INSTALL -grub-core/Makefile.tpl -grub-core/NEWS -grub-core/README -grub-core/THANKS -grub-core/TODO -grub-core/acinclude.m4 -grub-core/compile -grub-core/config.rpath -grub-core/configure.common -grub-core/depcomp -grub-core/gentpl.py -grub-core/conf/gcry.rmk -grub-core/docs -grub-core/docs/man grub-core/lib/libgcrypt-grub -grub-core/include/grub/cpu -grub-core/include/grub/machine From c49e5dfff81d1e4af75c5fe6bd9c0ab096503950 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 17 Aug 2010 19:17:57 +0530 Subject: [PATCH 115/174] remove Makefile.kernel and Makefile.vars --- Makefile.am | 82 ++++++++++++++- grub-core/Makefile.kernel | 204 -------------------------------------- grub-core/Makefile.vars | 83 ---------------- 3 files changed, 81 insertions(+), 288 deletions(-) delete mode 100644 grub-core/Makefile.kernel delete mode 100644 grub-core/Makefile.vars diff --git a/Makefile.am b/Makefile.am index c7f3614d4..51203c00d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,87 @@ AUTOMAKE_OPTIONS = subdir-objects SUBDIRS = . grub-core po docs EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def geninit.sh -include $(top_srcdir)/grub-core/Makefile.vars +grubconfdir = $(sysconfdir)/grub.d +platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform) + +# Platform specific options +if COND_i386_pc + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_efi + LDFLAGS_PLATFORM = -melf_i386 +endif +if COND_x86_64_efi + LDFLAGS_PLATFORM = -melf_x86_64 +endif +if COND_i386_qemu + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_coreboot + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_ieee1275 + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_mips_yeeloong + CFLAGS_PLATFORM = -march=mips3 -mexplicit-relocs -mflush-func=grub_cpu_flush_cache + CCASFLAGS_PLATFORM = -march=mips3 +endif +if COND_sparc64_ieee1275 + CFLAGS_PLATFORM = -mno-app-regs + LDFLAGS_PLATFORM = -melf64_sparc -mno-relax +endif + +CPPFLAGS_GRUB = -DGRUB_FILE=\"`basename $<`\" +CPPFLAGS_GRUB += -I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) +CPPFLAGS_GRUB += -I$(top_srcdir)/include +CPPFLAGS_GRUB += -I$(top_builddir)/include +CCASFLAGS_GRUB = -DASM_FILE=1 + +CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers +CPPFLAGS_GCRY = -I$(top_srcdir)/$(grub_coredir)/lib/libgcrypt_wrap + +CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" +CPPFLAGS_GNULIB = -I$(top_srcdir)/$(grub_coredir)/gnulib + +CFLAGS_MKISOFS = -Wno-all -Werror +CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include + +CFLAGS_POSIX = -fno-builtin +CPPFLAGS_POSIX = -I$(top_srcdir)/$(grub_coredir)/lib/posix_wrap + +CPPFLAGS_EFIEMU = -I$(top_srcdir)/$(grub_coredir)/efiemu/runtime + +# to calm down automake +BUILT_SOURCES = +CLEANFILES = +COMMAND_FILES = +DEF_FILES = +FS_FILES = +HANDLER_FILES = +IMG_FILES = +MOD_FILES = +MODULE_FILES = +PARTMAP_FILES = +PARTTOOL_FILES = +TERMINAL_FILES = +TESTS = +UND_FILES = +VIDEO_FILES = +bin_PROGRAMS = +bin_SCRIPTS = +check_PROGRAMS = +check_SCRIPTS = +grubconf_DATA = +grubconf_SCRIPTS = +man_MANS = +noinst_DATA = +noinst_LIBRARIES = +noinst_PROGRAMS = +pkglib_SCRIPTS = +platform_DATA = +sbin_PROGRAMS = +sbin_SCRIPTS = CFLAGS_PROGRAM = $(HOST_CFLAGS) $(CFLAGS_GNULIB) LDFLAGS_PROGRAM = $(HOST_LDFLAGS) $(LDFLAGS_GNULIB) diff --git a/grub-core/Makefile.kernel b/grub-core/Makefile.kernel deleted file mode 100644 index 69c20a4fc..000000000 --- a/grub-core/Makefile.kernel +++ /dev/null @@ -1,204 +0,0 @@ -# -*- makefile -*- - -KERNEL_HEADER_FILES = -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/elf.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/elfload.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/reader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/symbol.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/types.h - -if COND_i386_pc -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/biosdisk.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/vga.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/vbe.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pxe.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h -endif - -if COND_i386_efi -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h -endif - -if COND_i386_coreboot -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h -endif - -if COND_i386_multiboot -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h -endif - -if COND_i386_qemu -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h -endif - -if COND_i386_ieee1275 -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h -endif - -if COND_x86_64_efi -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h -endif - -if COND_mips_yeeloong -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap_scale.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h -endif - -if COND_powerpc_ieee1275 -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h -endif - -if COND_sparc64_ieee1275 -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h -endif - -if COND_emu -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/time.h -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/types.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gzio.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/menu.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h -if COND_GRUB_EMU_SDL -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h -endif -if COND_GRUB_EMU_USB -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libusb.h -endif -if COND_GRUB_EMU_PCI -KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h -endif -endif - -symlist.h: $(top_builddir)/config.h $(KERNEL_HEADER_FILES) - @list='$^'; \ - for p in $$list; do \ - echo "#include <$$p>" >> $@ || (rm -f $@; exit 1); \ - done -CLEANFILES += symlist.h -BUILT_SOURCES += symlist.h - -symlist.c: symlist.h gensymlist.sh - $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1) - cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1) - rm -f symlist.p -CLEANFILES += symlist.c -BUILT_SOURCES += symlist.c - -noinst_DATA += kernel_syms.lst -kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h - $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input - if grep "^#define HAVE_ASM_USCORE" $(top_builddir)/config.h; then u="_"; else u=""; fi; \ - cat kernel_syms.input | grep -v '^#' | sed -n \ - -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \ - -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \ - | sort -u >$@ - rm -f kernel_syms.input -CLEANFILES += kernel_syms.lst - -if COND_emu -kern/emu/grub_emu-main.$(OBJEXT):grub_emu_init.h -grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h -kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h -grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h - -grub_emu_init.h: genemuinitheader.sh $(MOD_FILES) - rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@ -CLEANFILES += grub_emu_init.h - -grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES) - rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(NM) > $@ -CLEANFILES += grub_emu_init.c -endif diff --git a/grub-core/Makefile.vars b/grub-core/Makefile.vars deleted file mode 100644 index 6dc536139..000000000 --- a/grub-core/Makefile.vars +++ /dev/null @@ -1,83 +0,0 @@ -# -*- makefile -*- - -grubconfdir = $(sysconfdir)/grub.d -platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform) - -# Platform specific options -if COND_i386_pc - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_i386_efi - LDFLAGS_PLATFORM = -melf_i386 -endif -if COND_x86_64_efi - LDFLAGS_PLATFORM = -melf_x86_64 -endif -if COND_i386_qemu - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_i386_coreboot - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_i386_ieee1275 - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_mips_yeeloong - CFLAGS_PLATFORM = -march=mips3 -mexplicit-relocs -mflush-func=grub_cpu_flush_cache - CCASFLAGS_PLATFORM = -march=mips3 -endif -if COND_sparc64_ieee1275 - CFLAGS_PLATFORM = -mno-app-regs - LDFLAGS_PLATFORM = -melf64_sparc -mno-relax -endif - -CPPFLAGS_GRUB = -DGRUB_FILE=\"`basename $<`\" -CPPFLAGS_GRUB += -I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) -CPPFLAGS_GRUB += -I$(top_srcdir)/include -CPPFLAGS_GRUB += -I$(top_builddir)/include -CCASFLAGS_GRUB = -DASM_FILE=1 - -CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -CPPFLAGS_GCRY = -I$(top_srcdir)/$(grub_coredir)/lib/libgcrypt_wrap - -CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" -CPPFLAGS_GNULIB = -I$(top_srcdir)/$(grub_coredir)/gnulib - -CFLAGS_MKISOFS = -Wno-all -Werror -CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include - -CFLAGS_POSIX = -fno-builtin -CPPFLAGS_POSIX = -I$(top_srcdir)/$(grub_coredir)/lib/posix_wrap - -CPPFLAGS_EFIEMU = -I$(top_srcdir)/$(grub_coredir)/efiemu/runtime - -# to calm down automake -BUILT_SOURCES = -CLEANFILES = -COMMAND_FILES = -DEF_FILES = -FS_FILES = -HANDLER_FILES = -IMG_FILES = -MOD_FILES = -MODULE_FILES = -PARTMAP_FILES = -PARTTOOL_FILES = -TERMINAL_FILES = -TESTS = -UND_FILES = -VIDEO_FILES = -bin_PROGRAMS = -bin_SCRIPTS = -check_PROGRAMS = -check_SCRIPTS = -grubconf_DATA = -grubconf_SCRIPTS = -man_MANS = -noinst_DATA = -noinst_LIBRARIES = -noinst_PROGRAMS = -pkglib_SCRIPTS = -platform_DATA = -sbin_PROGRAMS = -sbin_SCRIPTS = From a6b384931412a218326b3eb2e488eceb6af2fc18 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 17 Aug 2010 19:23:26 +0530 Subject: [PATCH 116/174] move grub-core/po back --- grub-core/po/Makefile.am | 0 po/Makefile.am | 0 {grub-core/po => po}/POTFILES | 0 {grub-core/po => po}/POTFILES-shell | 0 {grub-core/po => po}/README | 0 5 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 grub-core/po/Makefile.am delete mode 100644 po/Makefile.am rename {grub-core/po => po}/POTFILES (100%) rename {grub-core/po => po}/POTFILES-shell (100%) rename {grub-core/po => po}/README (100%) diff --git a/grub-core/po/Makefile.am b/grub-core/po/Makefile.am deleted file mode 100644 index e69de29bb..000000000 diff --git a/po/Makefile.am b/po/Makefile.am deleted file mode 100644 index e69de29bb..000000000 diff --git a/grub-core/po/POTFILES b/po/POTFILES similarity index 100% rename from grub-core/po/POTFILES rename to po/POTFILES diff --git a/grub-core/po/POTFILES-shell b/po/POTFILES-shell similarity index 100% rename from grub-core/po/POTFILES-shell rename to po/POTFILES-shell diff --git a/grub-core/po/README b/po/README similarity index 100% rename from grub-core/po/README rename to po/README From adf4ef86af926513d1480b0c31187b642338a53d Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 17 Aug 2010 19:23:50 +0530 Subject: [PATCH 117/174] add po/Makefile.am --- po/Makefile.am | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 po/Makefile.am diff --git a/po/Makefile.am b/po/Makefile.am new file mode 100644 index 000000000..e69de29bb From 76ed06b92156e16e34837183616ec71dce4df4eb Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 17 Aug 2010 19:41:43 +0530 Subject: [PATCH 118/174] moved configure.common back to configure.ac --- Makefile.am | 8 +- configure.ac | 865 ++++++++++++++++++++++++++++++++++++++++-- configure.common | 852 ----------------------------------------- grub-core/Makefile.am | 8 +- 4 files changed, 846 insertions(+), 887 deletions(-) delete mode 100644 configure.common diff --git a/Makefile.am b/Makefile.am index 51203c00d..4063a6476 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,18 +41,18 @@ CPPFLAGS_GRUB += -I$(top_builddir)/include CCASFLAGS_GRUB = -DASM_FILE=1 CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -CPPFLAGS_GCRY = -I$(top_srcdir)/$(grub_coredir)/lib/libgcrypt_wrap +CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" -CPPFLAGS_GNULIB = -I$(top_srcdir)/$(grub_coredir)/gnulib +CPPFLAGS_GNULIB = -I$(top_srcdir)/grub-core/gnulib CFLAGS_MKISOFS = -Wno-all -Werror CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include CFLAGS_POSIX = -fno-builtin -CPPFLAGS_POSIX = -I$(top_srcdir)/$(grub_coredir)/lib/posix_wrap +CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap -CPPFLAGS_EFIEMU = -I$(top_srcdir)/$(grub_coredir)/efiemu/runtime +CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime # to calm down automake BUILT_SOURCES = diff --git a/configure.ac b/configure.ac index dafea4545..ee01049ac 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,8 @@ +# -*- autoconf -*- + # Process this file with autoconf to produce a configure script. -# Copyright (C) 2010 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 # gives unlimited permission to copy and/or distribute it, @@ -11,29 +13,10 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -dnl This configure script is complicated, because GRUB needs to deal -dnl with three potentially different types: -dnl -dnl build -- the environment for building GRUB -dnl host -- the environment for running utilities -dnl target -- the environment for running GRUB -dnl -dnl In addition, GRUB needs to deal with a platform specification -dnl which specifies the system running GRUB, such as firmware. -dnl This is necessary because the target type in autoconf does not -dnl describe such a system very well. -dnl -dnl The current strategy is to build utilities using host -dnl cross-compiler and grub core and modules using target -dnl cross-compiler. For this we use nested packages approach, where -dnl top-level package grub utilities is built with HOSTCC and nested -dnl package (in grub-core directory) builds with TARGETCC. - -# NOTE: grub-core/configure.ac must also be updated. AC_INIT([GRUB],[1.98],[bug-grub@gnu.org]) -AC_CONFIG_AUX_DIR([.]) -: ${CFLAGS=""} # We don't want -g -O2 +# We don't want -g -O2 by default in CFLAGS +: ${CFLAGS=""} # Checks for host and target systems. AC_CANONICAL_HOST @@ -44,13 +27,841 @@ AC_PREREQ(2.60) AC_CONFIG_SRCDIR([include/grub/dl.h]) AC_CONFIG_HEADER([config.h]) -grub_coredir='grub-core' -AC_SUBST(grub_coredir) +# Program name transformations +AC_ARG_PROGRAM -grub_utildir='.' -AC_SUBST(grub_utildir) +# Optimization flag. Allow user to override. +if test "x$TARGET_CFLAGS" = x; then + TARGET_CFLAGS="$TARGET_CFLAGS -Os" +fi -m4_include([configure.common]) +# Default HOST_CPPFLAGS +HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W" +HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_srcdir)/grub-core/include" +HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" +HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_srcdir)/grub-core/gnulib" +HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1" +HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\"" +HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\"" + +TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W" +TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" +TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" + +case "$target_cpu" in + i[[3456]]86) target_cpu=i386 ;; + amd64) target_cpu=x86_64 ;; + sparc) target_cpu=sparc64 ;; + mipsel|mips64el) + target_cpu=mips; + HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; + TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; + ;; + mips|mips64) + target_cpu=mips; + HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_CPU_MIPS=1"; + TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_CPU_MIPS=1"; + ;; +esac + +# Specify the platform (such as firmware). +AC_ARG_WITH([platform], + AS_HELP_STRING([--with-platform=PLATFORM], + [select the host platform [[guessed]]])) + +# Guess the platform if not specified. +if test "x$with_platform" = x; then + case "$target_cpu"-"$target_vendor" in + i386-apple) platform=efi ;; + i386-*) platform=pc ;; + x86_64-apple) platform=efi ;; + x86_64-*) platform=pc ;; + powerpc-*) platform=ieee1275 ;; + powerpc64-*) platform=ieee1275 ;; + sparc64-*) platform=ieee1275 ;; + mips-*) platform=yeeloong ;; + *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;; + esac +else + platform="$with_platform" +fi + +# Adjust CPU unless target was explicitly specified. +if test -z "$target_alias"; then + case "$target_cpu"-"$platform" in + x86_64-efi) ;; + x86_64-emu) ;; + x86_64-*) target_cpu=i386 ;; + powerpc64-ieee1275) target_cpu=powerpc ;; + esac +fi + +# Check if the platform is supported, make final adjustments. +case "$target_cpu"-"$platform" in + i386-efi) ;; + x86_64-efi) ;; + i386-pc) ;; + i386-multiboot) ;; + i386-coreboot) ;; + i386-linuxbios) platform=coreboot ;; + i386-ieee1275) ;; + i386-qemu) ;; + powerpc-ieee1275) ;; + sparc64-ieee1275) ;; + mips-qemu-mips) ;; + mips-yeeloong) ;; + *-emu) ;; + *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; +esac + +case "$target_cpu" in + i386 | powerpc) target_m32=1 ;; + x86_64 | sparc64) target_m64=1 ;; +esac + +case "$host_os" in + mingw32*) host_os=cygwin ;; +esac + +# This normalizes the names, and creates a new variable ("host_kernel") +# while at it, since the mapping is not always 1:1 (e.g. different OSes +# using the same kernel type). +case "$host_os" in + gnu*) host_kernel=hurd ;; + linux*) host_kernel=linux ;; + freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;; + netbsd*) host_kernel=netbsd ;; + cygwin) host_kernel=windows ;; +esac + +case "$platform" in + coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; + multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;; + efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;; + ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; + qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;; + pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; + emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;; + 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 +case "$target_cpu" in + mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;; + sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;; +esac +machine_CFLAGS="$machine_CFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" + +HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CFLAGS" +TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CFLAGS" + +AC_SUBST(host_cpu) +AC_SUBST(host_os) +AC_SUBST(host_kernel) + +AC_SUBST(target_cpu) +AC_SUBST(platform) + +# +# Checks for build programs. +# + +# Although cmp is listed in the GNU Coding Standards as a command which +# can used directly, OpenBSD lacks cmp in the default installation. +AC_CHECK_PROGS([CMP], [cmp]) +if test "x$CMP" = x; then + AC_MSG_ERROR([cmp is not found]) +fi + +AC_CHECK_PROGS([YACC], [bison]) +if test "x$YACC" = x; then + AC_MSG_ERROR([bison is not found]) +fi + +FONT_SOURCE= + +for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do + for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do + if test -f "$dir/unifont.$ext"; then + FONT_SOURCE="$dir/unifont.$ext" + break 2 + fi + done +done + +if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xyeeloong ); then + AC_MSG_ERROR([qemu and yeeloong ports need unifont]) +fi + +AC_SUBST([FONT_SOURCE]) + +AC_PROG_RANLIB +AC_PROG_INSTALL +AC_PROG_AWK +AC_PROG_LEX +AC_PROG_YACC +AC_PROG_MAKE_SET +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". +AC_PATH_PROG(MAKEINFO, makeinfo) + +# +# Checks for host programs. +# + +AC_PROG_CC +AM_PROG_CC_C_O +AM_PROG_AS + +# Must be GCC. +test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) + +AC_GNU_SOURCE +AM_GNU_GETTEXT([external]) +AC_SYS_LARGEFILE + +# Identify characteristics of the host architecture. +AC_C_BIGENDIAN +AC_CHECK_SIZEOF(void *) +AC_CHECK_SIZEOF(long) + +grub_apple_cc +if test x$grub_cv_apple_cc = xyes ; then + HOST_CPPFLAGS="$HOST_CPPFLAGS -DAPPLE_CC=1" + HOST_CFLAGS="$HOST_CFLAGS -fnested-functions" +fi + +if test "x$cross_compiling" = xyes; then + AC_MSG_WARN([cannot generate manual pages while cross compiling]) +else + AC_PATH_PROG(HELP2MAN, help2man) +fi + +# Check for functions. +AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf) + +# For grub-mkisofs +AC_HEADER_MAJOR +AC_HEADER_DIRENT +AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid) +AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h) +AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h 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 host and build compilers. +# +HOST_CC=$CC +AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc], + [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])]) + +# +# Check for target programs. +# + +# Find tools for the target. +if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then + tmp_ac_tool_prefix="$ac_tool_prefix" + ac_tool_prefix=$target_alias- + + AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc], + [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])]) + AC_CHECK_TOOL(OBJCOPY, objcopy) + AC_CHECK_TOOL(STRIP, strip) + AC_CHECK_TOOL(NM, nm) + + ac_tool_prefix="$tmp_ac_tool_prefix" +else + if test "x$TARGET_CC" = x; then + TARGET_CC=$CC + fi + AC_CHECK_TOOL(OBJCOPY, objcopy) + AC_CHECK_TOOL(STRIP, strip) + AC_CHECK_TOOL(NM, nm) +fi +AC_SUBST(HOST_CC) +AC_SUBST(BUILD_CC) +AC_SUBST(TARGET_CC) + +# Test the C compiler for the target environment. +tmp_CC="$CC" +tmp_CFLAGS="$CFLAGS" +tmp_LDFLAGS="$LDFLAGS" +tmp_CPPFLAGS="$CPPFLAGS" +tmp_LIBS="$LIBS" +CC="$TARGET_CC" +CFLAGS="$TARGET_CFLAGS" +CPPFLAGS="$TARGET_CPPFLAGS" +LDFLAGS="$TARGET_LDFLAGS" +LIBS="" + +# debug flags. +TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g" +TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" + +# Force no alignment to save space on i386. +if test "x$target_cpu" = xi386; then + AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ + CFLAGS="$CFLAGS -falign-loops=1" + 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 + TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" + else + TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" + fi + + # Some toolchains enable these features by default, but they need + # registers that aren't set up properly in GRUB. + 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 + +grub_apple_target_cc +if test x$grub_cv_apple_target_cc = xyes ; then + TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1" + TARGET_CFLAGS="$TARGET_CFLAGS -fnested-functions" + + CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" + TARGET_APPLE_CC=1 + AC_CHECK_PROG([OBJCONV], [objconv], [objconv], []) + if test "x$OBJCONV" = x ; then + AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.]) + fi + if test "x$OBJCONV" = x ; then + AC_MSG_ERROR([objconv not found which is required when building with apple compiler]) + fi + TARGET_IMG_LDSCRIPT= + TARGET_IMG_CFLAGS="-static" + TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20' + TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20' + TARGET_IMG_BASE_LDOPT="-Wl,-image_base" +else + TARGET_APPLE_CC=0 +# Use linker script if present, otherwise use builtin -N script. +if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then + TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" + TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}" + TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" + TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" +else + TARGET_IMG_LDSCRIPT= + TARGET_IMG_LDFLAGS='-Wl,-N' + TARGET_IMG_LDFLAGS_AC='-Wl,-N' + TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" +fi +TARGET_IMG_CFLAGS= +fi + +# For platforms where ELF is not the default link format. +AC_MSG_CHECKING([for command to convert module to ELF format]) +case "${host_os}" in + cygwin) TARGET_OBJ2ELF='$(grub_utildir)/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 +AC_MSG_RESULT([$TARGET_OBJ2ELF]) + +if test "x$target_m32" = x1; then + # Force 32-bit mode. + TARGET_CFLAGS="$TARGET_CFLAGS -m32" + TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32" + TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" + TARGET_MODULE_FORMAT="elf32" +fi + +if test "x$target_m64" = x1; then + # Force 64-bit mode. + TARGET_CFLAGS="$TARGET_CFLAGS -m64" + TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64" + TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" + TARGET_MODULE_FORMAT="elf64" +fi + +if test "$target_cpu"-"$platform" = x86_64-efi; then + # Use large model to support 4G memory + AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ + SAVED_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -m64 -mcmodel=large" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_mcmodel=yes], + [grub_cv_cc_mcmodel=no]) + ]) + if test "x$grub_cv_cc_mcmodel" = xno; then + AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.]) + else + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" + fi + + # EFI writes to stack below %rsp, we must not use the red zone + AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ + CFLAGS="$CFLAGS -m64 -mno-red-zone" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_no_red_zone=yes], + [grub_cv_cc_no_red_zone=no]) + ]) + if test "x$grub_cv_cc_no_red_zone" = xno; then + AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc]) + fi + + TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone" +fi + +# +# Compiler features. +# + +# Need __enable_execute_stack() for nested function trampolines? +grub_CHECK_ENABLE_EXECUTE_STACK + +# Position independent executable. +grub_CHECK_PIE +[# Need that, because some distributions ship compilers that include +# `-fPIE' in the default specs. +if [ x"$pie_possible" = xyes ]; then + TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE" +fi] + +# Smashing stack protector. +grub_CHECK_STACK_PROTECTOR +# Need that, because some distributions ship compilers that include +# `-fstack-protector' in the default specs. +if test "x$ssp_possible" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector" +fi +grub_CHECK_STACK_ARG_PROBE +# Cygwin's GCC uses alloca() to probe the stackframe on static +# stack allocations above some threshold. +if test x"$sap_possible" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" +fi + +AC_ARG_ENABLE([werror], + [AS_HELP_STRING([--disable-werror], + [do not use -Werror when building GRUB])]) +if test x"$enable_werror" != xno ; then + TARGET_CFLAGS="$TARGET_CFLAGS -Werror" +fi + +TARGET_CPP="$TARGET_CC -E" +TARGET_CCAS=$TARGET_CC + +AC_SUBST(OBJCONV) +AC_SUBST(TARGET_CPP) +AC_SUBST(TARGET_CCAS) +AC_SUBST(TARGET_OBJ2ELF) +AC_SUBST(TARGET_APPLE_CC) +AC_SUBST(TARGET_MODULE_FORMAT) + +AC_SUBST(TARGET_CFLAGS) +AC_SUBST(TARGET_LDFLAGS) +AC_SUBST(TARGET_CPPFLAGS) +AC_SUBST(TARGET_CCASFLAGS) + +AC_SUBST(TARGET_IMG_LDSCRIPT) +AC_SUBST(TARGET_IMG_LDFLAGS) +AC_SUBST(TARGET_IMG_CFLAGS) +AC_SUBST(TARGET_IMG_BASE_LDOPT) + +AC_SUBST(HOST_CFLAGS) +AC_SUBST(HOST_LDFLAGS) +AC_SUBST(HOST_CPPFLAGS) +AC_SUBST(HOST_CCASFLAGS) + +# Set them to their new values for the tests below. +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 +CFLAGS="$TARGET_CFLAGS -nostdlib" +else +CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100" +fi +LIBS="" + +# Defined in aclocal.m4. +grub_PROG_TARGET_CC +if test "x$TARGET_APPLE_CC" != x1 ; then +grub_PROG_OBJCOPY_ABSOLUTE +fi +grub_PROG_LD_BUILD_ID_NONE +if test "x$target_cpu" = xi386; then + if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then + if test ! -z "$TARGET_IMG_LDSCRIPT"; then + # Check symbols provided by linker script. + CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},8000 -Wl,--defsym,___main=0x8100" + fi + grub_CHECK_BSS_START_SYMBOL + grub_CHECK_END_SYMBOL + fi + CFLAGS="$TARGET_CFLAGS" + grub_I386_ASM_PREFIX_REQUIREMENT + grub_I386_ASM_ADDR32 + grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK +else + AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug]) +fi + +AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL) +#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1))) +#else +#define NESTED_FUNC_ATTR +#endif]) + +AC_ARG_ENABLE([efiemu], + [AS_HELP_STRING([--enable-efiemu], + [build and install the efiemu runtimes (default=guessed)])]) +if test x"$enable_efiemu" = xno ; then + efiemu_excuse="explicitly disabled" +fi +if test x"$efiemu_excuse" = x ; then + AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [ + CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_efiemu=yes], + [grub_cv_cc_efiemu=no]) + ]) + if test x$grub_cv_cc_efiemu = xno; then + efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" + fi +fi +if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then + AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled]) +fi +if test x"$efiemu_excuse" = x ; then +enable_efiemu=yes +else +enable_efiemu=no +fi +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 +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. +CC="$tmp_CC" +CFLAGS="$tmp_CFLAGS" +CPPFLAGS="$tmp_CPPFLAGS" +LDFLAGS="$tmp_LDFLAGS" +LIBS="$tmp_LIBS" + +# +# Check for options. +# + +# Memory manager debugging. +AC_ARG_ENABLE([mm-debug], + AS_HELP_STRING([--enable-mm-debug], + [include memory manager debugging]), + [AC_DEFINE([MM_DEBUG], [1], + [Define to 1 if you enable memory manager debugging.])]) + +AC_ARG_ENABLE([grub-emu-usb], + [AS_HELP_STRING([--enable-grub-emu-usb], + [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) + +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)])]) + +if test "$platform" = emu; then + missing_ncurses= +[# Check for curses libraries.] + AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], + [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], + [missing_ncurses=[true]])]) + AC_SUBST([LIBCURSES]) +[if [ x"$missing_ncurses" = x ]; then ] + [# Check for headers.] + AC_CHECK_HEADERS([ncurses/curses.h], [], + [AC_CHECK_HEADERS([ncurses.h], [], + [AC_CHECK_HEADERS([curses.h], [], + [missing_ncurses=[true]])])]) +[fi] +if test x"$missing_ncurses" = xtrue ; then + AC_MSG_ERROR([grub-emu can't be compiled without ncurses]) +fi + +if test x"$enable_grub_emu_usb" = xno ; then + grub_emu_usb_excuse="explicitly disabled" +fi + +if test x"$enable_grub_emu_pci" = xyes ; then + grub_emu_usb_excuse="conflicts with PCI support" +fi + +[if [ x"$grub_emu_usb_excuse" = x ]; then + # Check for libusb libraries.] +AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], + [grub_emu_usb_excuse=["need libusb library"]]) + AC_SUBST([LIBUSB]) +[fi] +[if [ x"$grub_emu_usb_excuse" = x ]; then + # Check for headers.] + AC_CHECK_HEADERS([usb.h], [], + [grub_emu_usb_excuse=["need libusb headers"]]) +[fi] +if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then + AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled]) +fi +if test x"$grub_emu_usb_excuse" = x ; then +enable_grub_emu_usb=yes +else +enable_grub_emu_usb=no +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_pci]) +fi + +AC_ARG_ENABLE([grub-fstest], + [AS_HELP_STRING([--enable-grub-fstest], + [build and install the `grub-fstest' debugging utility (default=guessed)])]) +if test x"$enable_grub_fstest" = xno ; then + grub_fstest_excuse="explicitly disabled" +fi +if test x"$grub_fstest_excuse" = x ; then +enable_grub_fstest=yes +else +enable_grub_fstest=no +fi +AC_SUBST([enable_grub_fstest]) + +AC_ARG_ENABLE([grub-mkfont], + [AS_HELP_STRING([--enable-grub-mkfont], + [build and install the `grub-mkfont' utility (default=guessed)])]) +if test x"$enable_grub_mkfont" = xno ; then + grub_mkfont_excuse="explicitly disabled" +fi + +if test x"$grub_mkfont_excuse" = x ; then + # Check for freetype libraries. + AC_CHECK_PROGS([FREETYPE], [freetype-config]) + if test "x$FREETYPE" = x ; then + grub_mkfont_excuse=["need freetype2 library"] + fi + freetype_cflags=`freetype-config --cflags` + freetype_libs=`freetype-config --libs` +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 + AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled]) +fi +if test x"$grub_mkfont_excuse" = x ; then +enable_grub_mkfont=yes +else +enable_grub_mkfont=no +fi +AC_SUBST([enable_grub_mkfont]) +AC_SUBST([freetype_cflags]) +AC_SUBST([freetype_libs]) + +AC_ARG_ENABLE([device-mapper], + [AS_HELP_STRING([--enable-device-mapper], + [enable Linux device-mapper support (default=guessed)])]) +if test x"$enable_device_mapper" = xno ; then + device_mapper_excuse="explicitly disabled" +fi + +if test x"$device_mapper_excuse" = x ; then + # Check for device-mapper library. + AC_CHECK_LIB([devmapper], [dm_task_create], + [HOST_LDFLAGS="$HOST_LDFLAGS -ldevmapper" + AC_DEFINE([HAVE_DEVICE_MAPPER], [1], + [Define to 1 if you have the devmapper library.])], + [device_mapper_excuse="need devmapper library"]) +fi + +pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"` +AC_SUBST(pkglibrootdir) + +AC_SUBST([FONT_SOURCE]) +AS_IF([test x$target_cpu = xi386 -a x$platform = xpc], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)]) +AS_IF([test x$target_cpu = xi386 -a x$platform = xcoreboot], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)]) +AS_IF([test x$target_cpu = xi386 -a x$platform = xmultiboot], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)]) +AS_IF([test x$target_cpu = xmips -a x$platform = xyeeloong], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x80200000)]) +AS_IF([test x$target_cpu = xpowerpc -a x$platform = xieee1275], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x200000)]) +AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu], + [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)]) +AS_IF([test x$target_cpu = xi386 -a x$platform = xieee1275], + [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x10000)]) +AS_IF([test x$TARGET_APPLE_CC = x1], + [AC_SUBST([USE_APPLE_CC_FIXES], yes)]) + +# +# Automake conditionals +# + +AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) +AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) +AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi]) +AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu]) +AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275]) +AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot]) +AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot]) +AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi]) +AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong]) +AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips]) +AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) +AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) + +AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x]) +AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes]) +AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) +AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) +AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) +AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) +AM_CONDITIONAL([COND_GRUB_FSTEST], [test x$enable_grub_fstest = xyes]) +AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x]) +AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC != x]) +AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) # Output files. grub_CHECK_LINK_DIR diff --git a/configure.common b/configure.common deleted file mode 100644 index a9e5665dd..000000000 --- a/configure.common +++ /dev/null @@ -1,852 +0,0 @@ -# -*- autoconf -*- - -# Process this file with autoconf to produce a configure script. - -# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. -# -# This configure.ac is free software; the author -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# This file is shared between grub-core and util configure scripts. - -# Program name transformations -AC_ARG_PROGRAM - -# Optimization flag. Allow user to override. -if test "x$TARGET_CFLAGS" = x; then - TARGET_CFLAGS="$TARGET_CFLAGS -Os" -fi - -# Default HOST_CPPFLAGS -HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W" -HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_srcdir)/grub-core/include" -HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" -HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_srcdir)/grub-core/gnulib" -HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1" -HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\"" -HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\"" - -TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W" -TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include" -TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include" - -case "$target_cpu" in - i[[3456]]86) target_cpu=i386 ;; - amd64) target_cpu=x86_64 ;; - sparc) target_cpu=sparc64 ;; - mipsel|mips64el) - target_cpu=mips; - HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; - TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; - ;; - mips|mips64) - target_cpu=mips; - HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_CPU_MIPS=1"; - TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_CPU_MIPS=1"; - ;; -esac - -# Specify the platform (such as firmware). -AC_ARG_WITH([platform], - AS_HELP_STRING([--with-platform=PLATFORM], - [select the host platform [[guessed]]])) - -# Guess the platform if not specified. -if test "x$with_platform" = x; then - case "$target_cpu"-"$target_vendor" in - i386-apple) platform=efi ;; - i386-*) platform=pc ;; - x86_64-apple) platform=efi ;; - x86_64-*) platform=pc ;; - powerpc-*) platform=ieee1275 ;; - powerpc64-*) platform=ieee1275 ;; - sparc64-*) platform=ieee1275 ;; - mips-*) platform=yeeloong ;; - *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;; - esac -else - platform="$with_platform" -fi - -# Adjust CPU unless target was explicitly specified. -if test -z "$target_alias"; then - case "$target_cpu"-"$platform" in - x86_64-efi) ;; - x86_64-emu) ;; - x86_64-*) target_cpu=i386 ;; - powerpc64-ieee1275) target_cpu=powerpc ;; - esac -fi - -# Check if the platform is supported, make final adjustments. -case "$target_cpu"-"$platform" in - i386-efi) ;; - x86_64-efi) ;; - i386-pc) ;; - i386-multiboot) ;; - i386-coreboot) ;; - i386-linuxbios) platform=coreboot ;; - i386-ieee1275) ;; - i386-qemu) ;; - powerpc-ieee1275) ;; - sparc64-ieee1275) ;; - mips-qemu-mips) ;; - mips-yeeloong) ;; - *-emu) ;; - *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;; -esac - -case "$target_cpu" in - i386 | powerpc) target_m32=1 ;; - x86_64 | sparc64) target_m64=1 ;; -esac - -case "$host_os" in - mingw32*) host_os=cygwin ;; -esac - -# This normalizes the names, and creates a new variable ("host_kernel") -# while at it, since the mapping is not always 1:1 (e.g. different OSes -# using the same kernel type). -case "$host_os" in - gnu*) host_kernel=hurd ;; - linux*) host_kernel=linux ;; - freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;; - netbsd*) host_kernel=netbsd ;; - cygwin) host_kernel=windows ;; -esac - -case "$platform" in - coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; - multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;; - efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;; - ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; - qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;; - pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; - emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;; - 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 -case "$target_cpu" in - mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;; - sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;; -esac -machine_CFLAGS="$machine_CFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" - -HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CFLAGS" -TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CFLAGS" - -AC_SUBST(host_cpu) -AC_SUBST(host_os) -AC_SUBST(host_kernel) - -AC_SUBST(target_cpu) -AC_SUBST(platform) - -# -# Checks for build programs. -# - -# Although cmp is listed in the GNU Coding Standards as a command which -# can used directly, OpenBSD lacks cmp in the default installation. -AC_CHECK_PROGS([CMP], [cmp]) -if test "x$CMP" = x; then - AC_MSG_ERROR([cmp is not found]) -fi - -AC_CHECK_PROGS([YACC], [bison]) -if test "x$YACC" = x; then - AC_MSG_ERROR([bison is not found]) -fi - -FONT_SOURCE= - -for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do - for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do - if test -f "$dir/unifont.$ext"; then - FONT_SOURCE="$dir/unifont.$ext" - break 2 - fi - done -done - -if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xyeeloong ); then - AC_MSG_ERROR([qemu and yeeloong ports need unifont]) -fi - -AC_SUBST([FONT_SOURCE]) - -AC_PROG_RANLIB -AC_PROG_INSTALL -AC_PROG_AWK -AC_PROG_LEX -AC_PROG_YACC -AC_PROG_MAKE_SET -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". -AC_PATH_PROG(MAKEINFO, makeinfo) - -# -# Checks for host programs. -# - -AC_PROG_CC -AM_PROG_CC_C_O -AM_PROG_AS - -# Must be GCC. -test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required]) - -AC_GNU_SOURCE -AM_GNU_GETTEXT([external]) -AC_SYS_LARGEFILE - -# Identify characteristics of the host architecture. -AC_C_BIGENDIAN -AC_CHECK_SIZEOF(void *) -AC_CHECK_SIZEOF(long) - -grub_apple_cc -if test x$grub_cv_apple_cc = xyes ; then - HOST_CPPFLAGS="$HOST_CPPFLAGS -DAPPLE_CC=1" - HOST_CFLAGS="$HOST_CFLAGS -fnested-functions" -fi - -if test "x$cross_compiling" = xyes; then - AC_MSG_WARN([cannot generate manual pages while cross compiling]) -else - AC_PATH_PROG(HELP2MAN, help2man) -fi - -# Check for functions. -AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf) - -# For grub-mkisofs -AC_HEADER_MAJOR -AC_HEADER_DIRENT -AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid) -AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h) -AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h 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 host and build compilers. -# -HOST_CC=$CC -AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc], - [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])]) - -# -# Check for target programs. -# - -# Find tools for the target. -if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then - tmp_ac_tool_prefix="$ac_tool_prefix" - ac_tool_prefix=$target_alias- - - AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc], - [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])]) - AC_CHECK_TOOL(OBJCOPY, objcopy) - AC_CHECK_TOOL(STRIP, strip) - AC_CHECK_TOOL(NM, nm) - - ac_tool_prefix="$tmp_ac_tool_prefix" -else - if test "x$TARGET_CC" = x; then - TARGET_CC=$CC - fi - AC_CHECK_TOOL(OBJCOPY, objcopy) - AC_CHECK_TOOL(STRIP, strip) - AC_CHECK_TOOL(NM, nm) -fi -AC_SUBST(HOST_CC) -AC_SUBST(BUILD_CC) -AC_SUBST(TARGET_CC) - -# Test the C compiler for the target environment. -tmp_CC="$CC" -tmp_CFLAGS="$CFLAGS" -tmp_LDFLAGS="$LDFLAGS" -tmp_CPPFLAGS="$CPPFLAGS" -tmp_LIBS="$LIBS" -CC="$TARGET_CC" -CFLAGS="$TARGET_CFLAGS" -CPPFLAGS="$TARGET_CPPFLAGS" -LDFLAGS="$TARGET_LDFLAGS" -LIBS="" - -# debug flags. -TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g" -TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" - -# Force no alignment to save space on i386. -if test "x$target_cpu" = xi386; then - AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [ - CFLAGS="$CFLAGS -falign-loops=1" - 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 - TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1" - else - TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1" - fi - - # Some toolchains enable these features by default, but they need - # registers that aren't set up properly in GRUB. - 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 - -grub_apple_target_cc -if test x$grub_cv_apple_target_cc = xyes ; then - TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1" - TARGET_CFLAGS="$TARGET_CFLAGS -fnested-functions" - - CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions" - TARGET_APPLE_CC=1 - AC_CHECK_PROG([OBJCONV], [objconv], [objconv], []) - if test "x$OBJCONV" = x ; then - AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.]) - fi - if test "x$OBJCONV" = x ; then - AC_MSG_ERROR([objconv not found which is required when building with apple compiler]) - fi - TARGET_IMG_LDSCRIPT= - TARGET_IMG_CFLAGS="-static" - TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20' - TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20' - TARGET_IMG_BASE_LDOPT="-Wl,-image_base" -else - TARGET_APPLE_CC=0 -# Use linker script if present, otherwise use builtin -N script. -if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then - TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" - TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}" - TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc" - TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" -else - TARGET_IMG_LDSCRIPT= - TARGET_IMG_LDFLAGS='-Wl,-N' - TARGET_IMG_LDFLAGS_AC='-Wl,-N' - TARGET_IMG_BASE_LDOPT="-Wl,-Ttext" -fi -TARGET_IMG_CFLAGS= -fi - -# For platforms where ELF is not the default link format. -AC_MSG_CHECKING([for command to convert module to ELF format]) -case "${host_os}" in - cygwin) TARGET_OBJ2ELF='$(grub_utildir)/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 -AC_MSG_RESULT([$TARGET_OBJ2ELF]) - -if test "x$target_m32" = x1; then - # Force 32-bit mode. - TARGET_CFLAGS="$TARGET_CFLAGS -m32" - TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32" - TARGET_LDFLAGS="$TARGET_LDFLAGS -m32" - TARGET_MODULE_FORMAT="elf32" -fi - -if test "x$target_m64" = x1; then - # Force 64-bit mode. - TARGET_CFLAGS="$TARGET_CFLAGS -m64" - TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64" - TARGET_LDFLAGS="$TARGET_LDFLAGS -m64" - TARGET_MODULE_FORMAT="elf64" -fi - -if test "$target_cpu"-"$platform" = x86_64-efi; then - # Use large model to support 4G memory - AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ - SAVED_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -m64 -mcmodel=large" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_mcmodel=yes], - [grub_cv_cc_mcmodel=no]) - ]) - if test "x$grub_cv_cc_mcmodel" = xno; then - AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.]) - else - TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" - fi - - # EFI writes to stack below %rsp, we must not use the red zone - AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [ - CFLAGS="$CFLAGS -m64 -mno-red-zone" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_no_red_zone=yes], - [grub_cv_cc_no_red_zone=no]) - ]) - if test "x$grub_cv_cc_no_red_zone" = xno; then - AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc]) - fi - - TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone" -fi - -# -# Compiler features. -# - -# Need __enable_execute_stack() for nested function trampolines? -grub_CHECK_ENABLE_EXECUTE_STACK - -# Position independent executable. -grub_CHECK_PIE -[# Need that, because some distributions ship compilers that include -# `-fPIE' in the default specs. -if [ x"$pie_possible" = xyes ]; then - TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE" -fi] - -# Smashing stack protector. -grub_CHECK_STACK_PROTECTOR -# Need that, because some distributions ship compilers that include -# `-fstack-protector' in the default specs. -if test "x$ssp_possible" = xyes; then - TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector" -fi -grub_CHECK_STACK_ARG_PROBE -# Cygwin's GCC uses alloca() to probe the stackframe on static -# stack allocations above some threshold. -if test x"$sap_possible" = xyes; then - TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" -fi - -AC_ARG_ENABLE([werror], - [AS_HELP_STRING([--disable-werror], - [do not use -Werror when building GRUB])]) -if test x"$enable_werror" != xno ; then - TARGET_CFLAGS="$TARGET_CFLAGS -Werror" -fi - -TARGET_CPP="$TARGET_CC -E" -TARGET_CCAS=$TARGET_CC - -AC_SUBST(OBJCONV) -AC_SUBST(TARGET_CPP) -AC_SUBST(TARGET_CCAS) -AC_SUBST(TARGET_OBJ2ELF) -AC_SUBST(TARGET_APPLE_CC) -AC_SUBST(TARGET_MODULE_FORMAT) - -AC_SUBST(TARGET_CFLAGS) -AC_SUBST(TARGET_LDFLAGS) -AC_SUBST(TARGET_CPPFLAGS) -AC_SUBST(TARGET_CCASFLAGS) - -AC_SUBST(TARGET_IMG_LDSCRIPT) -AC_SUBST(TARGET_IMG_LDFLAGS) -AC_SUBST(TARGET_IMG_CFLAGS) -AC_SUBST(TARGET_IMG_BASE_LDOPT) - -AC_SUBST(HOST_CFLAGS) -AC_SUBST(HOST_LDFLAGS) -AC_SUBST(HOST_CPPFLAGS) -AC_SUBST(HOST_CCASFLAGS) - -# Set them to their new values for the tests below. -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 -CFLAGS="$TARGET_CFLAGS -nostdlib" -else -CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100" -fi -LIBS="" - -# Defined in aclocal.m4. -grub_PROG_TARGET_CC -if test "x$TARGET_APPLE_CC" != x1 ; then -grub_PROG_OBJCOPY_ABSOLUTE -fi -grub_PROG_LD_BUILD_ID_NONE -if test "x$target_cpu" = xi386; then - if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then - if test ! -z "$TARGET_IMG_LDSCRIPT"; then - # Check symbols provided by linker script. - CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},8000 -Wl,--defsym,___main=0x8100" - fi - grub_CHECK_BSS_START_SYMBOL - grub_CHECK_END_SYMBOL - fi - CFLAGS="$TARGET_CFLAGS" - grub_I386_ASM_PREFIX_REQUIREMENT - grub_I386_ASM_ADDR32 - grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK -else - AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug]) -fi - -AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL) -#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1))) -#else -#define NESTED_FUNC_ATTR -#endif]) - -AC_ARG_ENABLE([efiemu], - [AS_HELP_STRING([--enable-efiemu], - [build and install the efiemu runtimes (default=guessed)])]) -if test x"$enable_efiemu" = xno ; then - efiemu_excuse="explicitly disabled" -fi -if test x"$efiemu_excuse" = x ; then - AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [ - CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [grub_cv_cc_efiemu=yes], - [grub_cv_cc_efiemu=no]) - ]) - if test x$grub_cv_cc_efiemu = xno; then - efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib" - fi -fi -if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then - AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled]) -fi -if test x"$efiemu_excuse" = x ; then -enable_efiemu=yes -else -enable_efiemu=no -fi -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 -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. -CC="$tmp_CC" -CFLAGS="$tmp_CFLAGS" -CPPFLAGS="$tmp_CPPFLAGS" -LDFLAGS="$tmp_LDFLAGS" -LIBS="$tmp_LIBS" - -# -# Check for options. -# - -# Memory manager debugging. -AC_ARG_ENABLE([mm-debug], - AS_HELP_STRING([--enable-mm-debug], - [include memory manager debugging]), - [AC_DEFINE([MM_DEBUG], [1], - [Define to 1 if you enable memory manager debugging.])]) - -AC_ARG_ENABLE([grub-emu-usb], - [AS_HELP_STRING([--enable-grub-emu-usb], - [build and install the `grub-emu' debugging utility with USB support (default=guessed)])]) - -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)])]) - -if test "$platform" = emu; then - missing_ncurses= -[# Check for curses libraries.] - AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"], - [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"], - [missing_ncurses=[true]])]) - AC_SUBST([LIBCURSES]) -[if [ x"$missing_ncurses" = x ]; then ] - [# Check for headers.] - AC_CHECK_HEADERS([ncurses/curses.h], [], - [AC_CHECK_HEADERS([ncurses.h], [], - [AC_CHECK_HEADERS([curses.h], [], - [missing_ncurses=[true]])])]) -[fi] -if test x"$missing_ncurses" = xtrue ; then - AC_MSG_ERROR([grub-emu can't be compiled without ncurses]) -fi - -if test x"$enable_grub_emu_usb" = xno ; then - grub_emu_usb_excuse="explicitly disabled" -fi - -if test x"$enable_grub_emu_pci" = xyes ; then - grub_emu_usb_excuse="conflicts with PCI support" -fi - -[if [ x"$grub_emu_usb_excuse" = x ]; then - # Check for libusb libraries.] -AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"], - [grub_emu_usb_excuse=["need libusb library"]]) - AC_SUBST([LIBUSB]) -[fi] -[if [ x"$grub_emu_usb_excuse" = x ]; then - # Check for headers.] - AC_CHECK_HEADERS([usb.h], [], - [grub_emu_usb_excuse=["need libusb headers"]]) -[fi] -if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then - AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled]) -fi -if test x"$grub_emu_usb_excuse" = x ; then -enable_grub_emu_usb=yes -else -enable_grub_emu_usb=no -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_pci]) -fi - -AC_ARG_ENABLE([grub-fstest], - [AS_HELP_STRING([--enable-grub-fstest], - [build and install the `grub-fstest' debugging utility (default=guessed)])]) -if test x"$enable_grub_fstest" = xno ; then - grub_fstest_excuse="explicitly disabled" -fi -if test x"$grub_fstest_excuse" = x ; then -enable_grub_fstest=yes -else -enable_grub_fstest=no -fi -AC_SUBST([enable_grub_fstest]) - -AC_ARG_ENABLE([grub-mkfont], - [AS_HELP_STRING([--enable-grub-mkfont], - [build and install the `grub-mkfont' utility (default=guessed)])]) -if test x"$enable_grub_mkfont" = xno ; then - grub_mkfont_excuse="explicitly disabled" -fi - -if test x"$grub_mkfont_excuse" = x ; then - # Check for freetype libraries. - AC_CHECK_PROGS([FREETYPE], [freetype-config]) - if test "x$FREETYPE" = x ; then - grub_mkfont_excuse=["need freetype2 library"] - fi - freetype_cflags=`freetype-config --cflags` - freetype_libs=`freetype-config --libs` -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 - AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled]) -fi -if test x"$grub_mkfont_excuse" = x ; then -enable_grub_mkfont=yes -else -enable_grub_mkfont=no -fi -AC_SUBST([enable_grub_mkfont]) -AC_SUBST([freetype_cflags]) -AC_SUBST([freetype_libs]) - -AC_ARG_ENABLE([device-mapper], - [AS_HELP_STRING([--enable-device-mapper], - [enable Linux device-mapper support (default=guessed)])]) -if test x"$enable_device_mapper" = xno ; then - device_mapper_excuse="explicitly disabled" -fi - -if test x"$device_mapper_excuse" = x ; then - # Check for device-mapper library. - AC_CHECK_LIB([devmapper], [dm_task_create], - [HOST_LDFLAGS="$HOST_LDFLAGS -ldevmapper" - AC_DEFINE([HAVE_DEVICE_MAPPER], [1], - [Define to 1 if you have the devmapper library.])], - [device_mapper_excuse="need devmapper library"]) -fi - -pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"` -AC_SUBST(pkglibrootdir) - -AC_SUBST([FONT_SOURCE]) -AS_IF([test x$target_cpu = xi386 -a x$platform = xpc], - [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)]) -AS_IF([test x$target_cpu = xi386 -a x$platform = xcoreboot], - [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)]) -AS_IF([test x$target_cpu = xi386 -a x$platform = xmultiboot], - [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x8200)]) -AS_IF([test x$target_cpu = xmips -a x$platform = xyeeloong], - [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x80200000)]) -AS_IF([test x$target_cpu = xpowerpc -a x$platform = xieee1275], - [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x200000)]) -AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu], - [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)]) -AS_IF([test x$target_cpu = xi386 -a x$platform = xieee1275], - [AC_SUBST([GRUB_KERNEL_MACHINE_LINK_ADDR], 0x10000)]) -AS_IF([test x$TARGET_APPLE_CC = x1], - [AC_SUBST([USE_APPLE_CC_FIXES], yes)]) - -# -# Automake conditionals -# - -AM_CONDITIONAL([COND_emu], [test x$platform = xemu]) -AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc]) -AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi]) -AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu]) -AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275]) -AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot]) -AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot]) -AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi]) -AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong]) -AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips]) -AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) -AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) - -AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x]) -AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes]) -AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes]) -AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes]) -AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) -AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) -AM_CONDITIONAL([COND_GRUB_FSTEST], [test x$enable_grub_fstest = xyes]) -AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x]) -AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC != x]) -AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 437835c83..0f7886b3a 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -81,18 +81,18 @@ CPPFLAGS_GRUB += -I$(top_builddir)/include CCASFLAGS_GRUB = -DASM_FILE=1 CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -CPPFLAGS_GCRY = -I$(top_srcdir)/$(grub_coredir)/lib/libgcrypt_wrap +CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" -CPPFLAGS_GNULIB = -I$(top_srcdir)/$(grub_coredir)/gnulib +CPPFLAGS_GNULIB = -I$(top_srcdir)/grub-core/gnulib CFLAGS_MKISOFS = -Wno-all -Werror CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include CFLAGS_POSIX = -fno-builtin -CPPFLAGS_POSIX = -I$(top_srcdir)/$(grub_coredir)/lib/posix_wrap +CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap -CPPFLAGS_EFIEMU = -I$(top_srcdir)/$(grub_coredir)/efiemu/runtime +CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime LDADD_KERNEL = -lgcc CFLAGS_KERNEL = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding From a525bb9ae47d64b94e2d260d5095f577c10cd405 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 17 Aug 2010 19:43:37 +0530 Subject: [PATCH 119/174] rm grub-core/configure.ac --- grub-core/configure.ac | 83 ------------------------------------------ 1 file changed, 83 deletions(-) delete mode 100644 grub-core/configure.ac diff --git a/grub-core/configure.ac b/grub-core/configure.ac deleted file mode 100644 index 6a84c16e1..000000000 --- a/grub-core/configure.ac +++ /dev/null @@ -1,83 +0,0 @@ -# Process this file with autoconf to produce a configure script. - -# Copyright (C) 2010 Free Software Foundation, Inc. -# -# This configure.ac is free software; the author -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -dnl This configure script is complicated, because GRUB needs to deal -dnl with three potentially different types: -dnl -dnl build -- the environment for building GRUB -dnl host -- the environment for running utilities -dnl target -- the environment for running GRUB -dnl -dnl In addition, GRUB needs to deal with a platform specification -dnl which specifies the system running GRUB, such as firmware. -dnl This is necessary because the target type in autoconf does not -dnl describe such a system very well. -dnl -dnl The current strategy is to build utilities using host -dnl cross-compiler and grub core and modules using target -dnl cross-compiler. For this we use nested packages approach, where -dnl top-level package grub utilities is built with HOSTCC and nested -dnl package (in grub-core directory) builds with TARGETCC. - -# NOTE: ../configure.ac must also be updated. -AC_INIT([GRUB],[1.98],[bug-grub@gnu.org]) -AC_CONFIG_AUX_DIR([.]) - -: ${CFLAGS=""} # We don't want -g -O2 - -# Checks for host and target systems. -AC_CANONICAL_HOST -AC_CANONICAL_TARGET - -AM_INIT_AUTOMAKE() -AC_PREREQ(2.60) -AC_CONFIG_SRCDIR([include/grub/dl.h]) -AC_CONFIG_HEADER([config.h]) - -grub_coredir='.' -AC_SUBST(grub_coredir) - -grub_utildir='..' -AC_SUBST(grub_utildir) - -m4_include([configure.common]) - -CC=$TARGET_CC -CPP=$TARGET_CC -CCAS=$TARGET_CC - -# Output files. -grub_CHECK_LINK_DIR -if test x"$link_dir" = xyes ; then - AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu]) - mkdir -p lib/target_cpu - cp -r $srcdir/lib/$target_cpu/* lib/target_cpu - if test "$platform" != emu ; then - AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform]) - fi -else - mkdir -p include/grub 2>/dev/null - rm -rf include/grub/cpu - cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null - cp -rp $srcdir/lib/$target_cpu lib/target_cpu 2>/dev/null - if test "$platform" != emu ; then - rm -rf include/grub/machine - cp -rp $srcdir/grub-core/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null - fi -fi - -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([po/Makefile]) -AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) - -AC_OUTPUT From f99b0464dfd9273744238040c69368ad34054b0e Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 17 Aug 2010 19:46:13 +0530 Subject: [PATCH 120/174] rm grub-core/video/emu.moved From 2b6c00842db2f2fcb74fdc0f0ea393de38c3fb91 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 18 Aug 2010 11:57:51 +0530 Subject: [PATCH 121/174] distcheck almost done --- Makefile.am | 1 + configure.ac | 9 ++++++-- docs/Makefile.am | 3 +++ grub-core/Makefile.am | 49 ++++++++++++++++++++++++++++++++++++++++--- grub-core/modules.def | 7 ++++++- 5 files changed, 63 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4063a6476..09c2fa43e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,6 +2,7 @@ AUTOMAKE_OPTIONS = subdir-objects SUBDIRS = . grub-core po docs EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def geninit.sh +EXTRA_DIST += include conf/i386-pc-cygwin-img-ld.sc grubconfdir = $(sysconfdir)/grub.d platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform) diff --git a/configure.ac b/configure.ac index ee01049ac..23988a17e 100644 --- a/configure.ac +++ b/configure.ac @@ -867,8 +867,6 @@ AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) grub_CHECK_LINK_DIR if test x"$link_dir" = xyes ; then AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu]) - mkdir -p grub-core/lib - cp -rp $srcdir/grub-core/lib/$target_cpu grub-core/lib/target_cpu if test "$platform" != emu ; then AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform]) fi @@ -883,6 +881,13 @@ else fi fi +# Copy */setjmp.S to target_cpu/ +AC_CONFIG_COMMANDS([grub-core/lib/target_cpu], + [mkdir -p grub-core/lib/target_cpu]) +AC_CONFIG_COMMANDS([setjmp.S], + [cp -rp $srcdir/grub-core/lib/$target_cpu/setjmp.S grub-core/lib/target_cpu/], + [target_cpu=$target_cpu srcdir=$srcdir]) + AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([grub-core/Makefile]) AC_CONFIG_FILES([po/Makefile]) diff --git a/docs/Makefile.am b/docs/Makefile.am index 1b302d262..a2e83dcd6 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,6 +1,9 @@ AUTOMAKE_OPTIONS = subdir-objects +EXTRA_DIST = grub.cfg man + AM_MAKEINFOFLAGS = --force --no-split --no-validate info_TEXINFOS = grub.texi grub_TEXINFOS = fdl.texi + diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 0f7886b3a..efce4d22e 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -4,12 +4,55 @@ CC=$(TARGET_CC) CPP=$(TARGET_CC) CCAS=$(TARGET_CC) -EXTRA_DIST = gentpl.py modules.def Makefile.tpl genmoddep.awk +EXTRA_DIST = +EXTRA_DIST += modules.def genmoddep.awk EXTRA_DIST += genmodsrc.sh gensymlist.sh genemuinit.sh genemuinitheader.sh EXTRA_DIST += genfslist.sh gencmdlist.sh genvideolist.sh genhandlerlist.sh EXTRA_DIST += genpartmaplist.sh genparttoollist.sh genterminallist.sh -EXTRA_DIST += conf/i386-pc-cygwin-img-ld.sc -EXTRA_DIST += $(shell find $(top_srcdir) -name '*.h') +EXTRA_DIST += lib/libgcrypt_wrap/cipher_wrap.h +EXTRA_DIST += lib/libgcrypt/cipher/rijndael-tables.h +EXTRA_DIST += lib/libgcrypt/cipher/bithelp.h +EXTRA_DIST += lib/libgcrypt/cipher/rmd.h +EXTRA_DIST += lib/libgcrypt/cipher/hash-common.h +EXTRA_DIST += lib/libgcrypt/cipher/camellia.h +EXTRA_DIST += lib/posix_wrap/localcharset.h +EXTRA_DIST += lib/posix_wrap/ctype.h +EXTRA_DIST += lib/posix_wrap/limits.h +EXTRA_DIST += lib/posix_wrap/stdio.h +EXTRA_DIST += lib/posix_wrap/sys/types.h +EXTRA_DIST += lib/posix_wrap/unistd.h +EXTRA_DIST += lib/posix_wrap/locale.h +EXTRA_DIST += lib/posix_wrap/wchar.h +EXTRA_DIST += lib/posix_wrap/string.h +EXTRA_DIST += lib/posix_wrap/langinfo.h +EXTRA_DIST += lib/posix_wrap/wctype.h +EXTRA_DIST += lib/posix_wrap/stdint.h +EXTRA_DIST += lib/posix_wrap/stdlib.h +EXTRA_DIST += lib/posix_wrap/assert.h +EXTRA_DIST += lib/posix_wrap/errno.h +EXTRA_DIST += lib/libgcrypt-grub/cipher/types.h +EXTRA_DIST += lib/libgcrypt-grub/cipher/cipher.h +EXTRA_DIST += lib/libgcrypt-grub/cipher/rijndael-tables.h +EXTRA_DIST += lib/libgcrypt-grub/cipher/memory.h +EXTRA_DIST += lib/libgcrypt-grub/cipher/bithelp.h +EXTRA_DIST += lib/libgcrypt-grub/cipher/g10lib.h +EXTRA_DIST += lib/libgcrypt-grub/cipher/rmd.h +EXTRA_DIST += lib/libgcrypt-grub/cipher/hash-common.h +EXTRA_DIST += lib/libgcrypt-grub/cipher/camellia.h +EXTRA_DIST += efiemu/runtime/config.h +EXTRA_DIST += gnulib/getopt.h +EXTRA_DIST += gnulib/argp-version-etc.h +EXTRA_DIST += gnulib/fnmatch.h +EXTRA_DIST += gnulib/error.h +EXTRA_DIST += gnulib/argp-namefrob.h +EXTRA_DIST += gnulib/argp.h +EXTRA_DIST += gnulib/argp-fmtstream.h +EXTRA_DIST += gnulib/gettext.h +EXTRA_DIST += gnulib/regex_internal.h +EXTRA_DIST += gnulib/progname.h +EXTRA_DIST += gnulib/regex.h +EXTRA_DIST += gnulib/alloca.h +EXTRA_DIST += gnulib/getopt_int.h grubconfdir = $(sysconfdir)/grub.d platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform) diff --git a/grub-core/modules.def b/grub-core/modules.def index 8e65f277c..3d222dd74 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -1207,7 +1207,12 @@ module = { module = { name = setjmp; - source = lib/target_cpu/setjmp.S; + nodist = lib/target_cpu/setjmp.S; + extra_dist = lib/i386/setjmp.S; + extra_dist = lib/mips/setjmp.S; + extra_dist = lib/x86_64/setjmp.S; + extra_dist = lib/sparc64/setjmp.S; + extra_dist = lib/powerpc/setjmp.S; }; module = { From 9da94e0576bb2f0f5d24ab8972a5a4b6de239d8f Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 18 Aug 2010 11:08:00 +0100 Subject: [PATCH 122/174] * acinclude.m4 (grub_ASM_USCORE): Use a more accurate grep pattern, to avoid false positives with some assemblers that output things like "someprefix_func" as part of their output. --- ChangeLog | 6 ++++++ acinclude.m4 | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b662428bc..d5e67639e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-08-18 Colin Watson + + * acinclude.m4 (grub_ASM_USCORE): Use a more accurate grep pattern, + to avoid false positives with some assemblers that output things + like "someprefix_func" as part of their output. + 2010-08-15 Robert Millan * kern/emu/misc.c (grub_get_libzfs_handle): Handle libzfs_init() diff --git a/acinclude.m4 b/acinclude.m4 index 72483b5d0..49760d5f0 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -38,6 +38,7 @@ dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by dnl Erich Boleyn and modified by Yoshinori K. Okuji. AC_DEFUN([grub_ASM_USCORE], [AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_EGREP]) AC_MSG_CHECKING([if C symbols get an underscore after compilation]) AC_CACHE_VAL(grub_cv_asm_uscore, [cat > conftest.c <<\EOF @@ -56,7 +57,7 @@ else AC_MSG_ERROR([${CC-cc} failed to produce assembly code]) fi -if grep _func conftest.s >/dev/null 2>&1; then +if $EGREP '(^|[^_[:alnum]])_func' conftest.s >/dev/null 2>&1; then grub_cv_asm_uscore=yes else grub_cv_asm_uscore=no From 51f1f5afab3f3e581c54b78af0b91780c4f78b68 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 18 Aug 2010 11:15:08 +0100 Subject: [PATCH 123/174] * configure.ac: Move AM_INIT_AUTOMAKE after AC_CANONICAL_TARGET to fix warnings from Autoconf. --- ChangeLog | 5 +++++ configure.ac | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d5e67639e..bf1a0cfbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-18 Colin Watson + + * configure.ac: Move AM_INIT_AUTOMAKE after AC_CANONICAL_TARGET to + fix warnings from Autoconf. + 2010-08-18 Colin Watson * acinclude.m4 (grub_ASM_USCORE): Use a more accurate grep pattern, diff --git a/configure.ac b/configure.ac index 19d782609..4091b4fa2 100644 --- a/configure.ac +++ b/configure.ac @@ -32,7 +32,6 @@ dnl type. AC_INIT([GRUB],[1.98],[bug-grub@gnu.org]) -AM_INIT_AUTOMAKE() AC_PREREQ(2.60) AC_CONFIG_SRCDIR([include/grub/dl.h]) AC_CONFIG_HEADER([config.h]) @@ -41,6 +40,8 @@ AC_CONFIG_HEADER([config.h]) AC_CANONICAL_HOST AC_CANONICAL_TARGET +AM_INIT_AUTOMAKE() + # Program name transformations AC_ARG_PROGRAM From 019be613d094e6b25759c959a1a96ad29a8e225e Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 18 Aug 2010 16:53:11 +0530 Subject: [PATCH 124/174] fixed distcheck --- Makefile.am | 2 +- configure.ac | 2 -- grub-core/Makefile.am | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 09c2fa43e..e96a540da 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,6 @@ AUTOMAKE_OPTIONS = subdir-objects +DEPDIR = .deps-util SUBDIRS = . grub-core po docs EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def geninit.sh EXTRA_DIST += include conf/i386-pc-cygwin-img-ld.sc @@ -152,7 +153,6 @@ CLEANFILES += ascii.bitmaps ascii.h: ascii.bitmaps grub-bin2h $(builddir)/grub-bin2h ascii_bitmaps < $< > $@ - cp $@ $(top_builddir)/grub-core/include CLEANFILES += ascii.h $(top_builddir)/grub-core/include/ascii.h widthspec.bin: $(FONT_SOURCE) grub-mkfont diff --git a/configure.ac b/configure.ac index 23988a17e..c0cd11b65 100644 --- a/configure.ac +++ b/configure.ac @@ -37,9 +37,7 @@ fi # Default HOST_CPPFLAGS HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W" -HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_srcdir)/grub-core/include" HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include" -HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_srcdir)/grub-core/gnulib" HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1" HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\"" HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\"" diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index efce4d22e..e1f45eb38 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -3,6 +3,7 @@ AUTOMAKE_OPTIONS = subdir-objects CC=$(TARGET_CC) CPP=$(TARGET_CC) CCAS=$(TARGET_CC) +DEPDIR=.deps-core EXTRA_DIST = EXTRA_DIST += modules.def genmoddep.awk From 62f7d20835799167be1561b5803b8c858f99a054 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 18 Aug 2010 20:25:16 +0530 Subject: [PATCH 125/174] fixed grub-emu build --- configure.ac | 3 ++- grub-core/modules.def | 4 ++-- modules.def | 25 +++++++++++-------------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index c0cd11b65..b4dd0e9e0 100644 --- a/configure.ac +++ b/configure.ac @@ -806,11 +806,12 @@ fi if test x"$device_mapper_excuse" = x ; then # Check for device-mapper library. AC_CHECK_LIB([devmapper], [dm_task_create], - [HOST_LDFLAGS="$HOST_LDFLAGS -ldevmapper" + [LIBDEVMAPPER="-ldevmapper" AC_DEFINE([HAVE_DEVICE_MAPPER], [1], [Define to 1 if you have the devmapper library.])], [device_mapper_excuse="need devmapper library"]) fi +AC_SUBST([LIBDEVMAPPER]) pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"` AC_SUBST(pkglibrootdir) diff --git a/grub-core/modules.def b/grub-core/modules.def index 3d222dd74..416e20dd1 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -249,7 +249,7 @@ program = { ldadd = 'kernel.img$(EXEEXT)'; ldadd = '$(MODULE_FILES)'; - ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS)'; + ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)'; enable = emu; }; @@ -262,7 +262,7 @@ program = { nodist = symlist.c; ldadd = 'kernel.img$(EXEEXT)'; - ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS)'; + ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)'; enable = emu; }; diff --git a/modules.def b/modules.def index 8fb97cd40..a3de5877d 100644 --- a/modules.def +++ b/modules.def @@ -99,7 +99,7 @@ program = { name = grub-bin2h; source = util/bin2h.c; ldadd = libgrub.a; - ldflags = '$(LIBINTL)'; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; mansection = 1; }; @@ -112,7 +112,7 @@ program = { extra_dist = util/grub-mkimagexx.c; ldadd = libgrub.a; - ldflags = '$(LIBINTL)'; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"'; }; @@ -123,7 +123,7 @@ program = { source = util/grub-mkrelpath.c; ldadd = libgrub.a; - ldflags = '$(LIBINTL)'; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; }; program = { @@ -133,7 +133,7 @@ program = { source = util/grub-script-check.c; ldadd = libgrub.a; - ldflags = '$(LIBINTL)'; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; }; program = { @@ -143,7 +143,7 @@ program = { source = util/grub-editenv.c; ldadd = libgrub.a; - ldflags = '$(LIBINTL)'; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; }; program = { @@ -153,7 +153,7 @@ program = { source = util/grub-mkpasswd-pbkdf2.c; ldadd = libgrub.a; - ldflags = '$(LIBINTL)'; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; }; @@ -181,7 +181,7 @@ program = { source = util/grub-fstest.c; ldadd = libgrub.a; - ldflags = '$(LIBINTL)'; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; condition = COND_GRUB_FSTEST; }; @@ -194,7 +194,7 @@ program = { cflags = '$(freetype_cflags)'; ldadd = libgrub.a; - ldflags = '$(LIBINTL)'; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; ldflags = '$(freetype_libs)'; condition = COND_GRUB_MKFONT; }; @@ -213,8 +213,7 @@ program = { sparc64_ieee1275 = util/ieee1275/devicemap.c; ldadd = libgrub.a; - ldflags = '$(LIBINTL)'; - ldflags = '$(LIBUTIL)'; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)'; }; program = { @@ -224,8 +223,7 @@ program = { source = util/grub-probe.c; ldadd = libgrub.a; - ldflags = '$(LIBINTL)'; - ldflags = '$(LIBUTIL)'; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)'; }; program = { @@ -242,8 +240,7 @@ program = { sparc64_ieee1275 = util/lvm.c; ldadd = libgrub.a; - ldflags = '$(LIBINTL)'; - ldflags = '$(LIBUTIL)'; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)'; enable = i386_pc; enable = sparc64_ieee1275; From 7afdce98a64663ff8f07d64c95383ee801d960e1 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 19 Aug 2010 15:47:38 +0530 Subject: [PATCH 126/174] fix example_unit_test build --- modules.def | 1 + 1 file changed, 1 insertion(+) diff --git a/modules.def b/modules.def index a3de5877d..c7574e928 100644 --- a/modules.def +++ b/modules.def @@ -453,4 +453,5 @@ program = { source = grub-core/tests/lib/test.c; cflags = -Wno-format; ldadd = libgrub.a; + ldflags = '$(LIBDEVMAPPER)'; }; From 34980574fc30594028d132b1414f155e71fdf9b2 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Thu, 19 Aug 2010 17:50:05 +0530 Subject: [PATCH 127/174] minor cleanups --- configure.ac | 22 ++++++++++++++++++++-- tests/example_grub_script_test.in | 2 +- tests/util/grub-shell-tester.in | 2 +- tests/util/grub-shell.in | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 9b918f1bc..0923bf08f 100644 --- a/configure.ac +++ b/configure.ac @@ -13,6 +13,25 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +dnl This configure script is complicated, because GRUB needs to deal +dnl with three potentially different types: +dnl +dnl build -- the environment for building GRUB +dnl host -- the environment for running utilities +dnl target -- the environment for running GRUB +dnl +dnl In addition, GRUB needs to deal with a platform specification +dnl which specifies the system running GRUB, such as firmware. +dnl This is necessary because the target type in autoconf does not +dnl describe such a system very well. +dnl +dnl The current strategy is to use variables with no prefix (such as +dnl CC, CFLAGS, etc.) for the host type as well as the build type, +dnl because GRUB does not need to use those variables for the build +dnl type, so there is no conflict. Variables with the prefix "TARGET_" +dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target +dnl type. + AC_INIT([GRUB],[1.98],[bug-grub@gnu.org]) # We don't want -g -O2 by default in CFLAGS @@ -879,10 +898,9 @@ else mkdir -p include/grub 2>/dev/null rm -rf include/grub/cpu cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null - cp -rp $srcdir/grub-core/lib/$target_cpu grub-core/lib/target_cpu 2>/dev/null if test "$platform" != emu ; then rm -rf include/grub/machine - cp -rp $srcdir/grub-core/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null + cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null fi fi diff --git a/tests/example_grub_script_test.in b/tests/example_grub_script_test.in index 6fa3dc98a..93a90a18e 100644 --- a/tests/example_grub_script_test.in +++ b/tests/example_grub_script_test.in @@ -1,3 +1,3 @@ -#! @abs_top_builddir@/grub-shell-tester --modules=echo +#! @builddir@/grub-shell-tester --modules=echo echo "hello world" diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in index d2a9af3ab..ed34a5e17 100644 --- a/tests/util/grub-shell-tester.in +++ b/tests/util/grub-shell-tester.in @@ -91,7 +91,7 @@ if [ "x${source}" = x ] ; then fi outfile1=`mktemp` -@abs_top_builddir@/grub-shell --qemu-opts="${qemuopts}" --modules=${modules} ${source} >${outfile1} +@builddir@/grub-shell --qemu-opts="${qemuopts}" --modules=${modules} ${source} >${outfile1} outfile2=`mktemp` bash ${source} >${outfile2} diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in index fc1e01ef5..3f25fe7bb 100644 --- a/tests/util/grub-shell.in +++ b/tests/util/grub-shell.in @@ -124,7 +124,7 @@ halt EOF isofile=`mktemp` -sh @abs_top_builddir@/grub-mkrescue --grub-mkimage=${builddir}/grub-mkimage \ +sh @builddir@/grub-mkrescue --grub-mkimage=${builddir}/grub-mkimage \ --override-directory=${builddir}/grub-core --output=${isofile} \ boot/grub/grub.cfg=${cfgfile} \ /boot/grub/testcase.cfg=${source} >/dev/null 2>&1 From b4ece5e11ea3db37861db6767202abcde693ffc4 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 19 Aug 2010 21:03:14 +0200 Subject: [PATCH 128/174] Implement sendkey support. * commands/i386/pc/sendkey.c: New file. * conf/i386-pc.rmk (pkglib_MODULES): Add sendkey.mod. (sendkey_mod_SOURCES): New variable. (sendkey_mod_CFLAGS): Likewise. (sendkey_mod_LDFLAGS): Likewise. --- ChangeLog | 10 + commands/i386/pc/sendkey.c | 381 +++++++++++++++++++++++++++++++++++++ conf/i386-pc.rmk | 6 + 3 files changed, 397 insertions(+) create mode 100644 commands/i386/pc/sendkey.c diff --git a/ChangeLog b/ChangeLog index bf1a0cfbf..a20e76892 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-08-19 Vladimir Serbinenko + + Implement sendkey support. + + * commands/i386/pc/sendkey.c: New file. + * conf/i386-pc.rmk (pkglib_MODULES): Add sendkey.mod. + (sendkey_mod_SOURCES): New variable. + (sendkey_mod_CFLAGS): Likewise. + (sendkey_mod_LDFLAGS): Likewise. + 2010-08-18 Colin Watson * configure.ac: Move AM_INIT_AUTOMAKE after AC_CANONICAL_TARGET to diff --git a/commands/i386/pc/sendkey.c b/commands/i386/pc/sendkey.c new file mode 100644 index 000000000..aa7ffdb59 --- /dev/null +++ b/commands/i386/pc/sendkey.c @@ -0,0 +1,381 @@ +/* sendkey.c - fake keystroke. */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static char sendkey[0x20]; +/* Length of sendkey. */ +static int keylen = 0; +static int noled = 0; +static const struct grub_arg_option options[] = + { + {"num", 'n', 0, "set numlock mode", "[keep|on|off]", ARG_TYPE_STRING}, + {"caps", 'c', 0, "set capslock mode", "[keep|on|off]", ARG_TYPE_STRING}, + {"scroll", 's', 0, "set scrolllock mode", "[keep|on|off]", ARG_TYPE_STRING}, + {"insert", 0, 0, "set insert mode", "[keep|on|off]", ARG_TYPE_STRING}, + {"wait", 0, 0, "set wait mode", "[keep|on|off]", ARG_TYPE_STRING}, + {"left-shift", 0, 0, "press left shift", "[keep|on|off]", ARG_TYPE_STRING}, + {"right-shift", 0, 0, "press right shift", "[keep|on|off]", ARG_TYPE_STRING}, + {"sysreq", 0, 0, "press sysreq", "[keep|on|off]", ARG_TYPE_STRING}, + {"numkey", 0, 0, "press NumLock key", "[keep|on|off]", ARG_TYPE_STRING}, + {"capskey", 0, 0, "press CapsLock key", "[keep|on|off]", ARG_TYPE_STRING}, + {"scrollkey", 0, 0, "press ScrollLock key", "[keep|on|off]", ARG_TYPE_STRING}, + {"inserkey", 0, 0, "press Insert key", "[keep|on|off]", ARG_TYPE_STRING}, + {"left-alt", 0, 0, "press left alt", "[keep|on|off]", ARG_TYPE_STRING}, + {"right-alt", 0, 0, "press rightt alt", "[keep|on|off]", ARG_TYPE_STRING}, + {"left-ctrl", 0, 0, "press left ctrl", "[keep|on|off]", ARG_TYPE_STRING}, + {"right-ctrl", 0, 0, "press rightt ctrl", "[keep|on|off]", ARG_TYPE_STRING}, + {"no-led", 0, 0, "don't update LED state", 0, 0}, + {0, 0, 0, 0, 0, 0} + }; +static int simple_flag_offsets[] += {5, 6, 4, 7, 11, 1, 0, 10, 13, 14, 12, 15, 9, 3, 8, 2}; + +static grub_uint32_t andmask = 0xffffffff, ormask = 0; + +struct +keysym +{ + char *unshifted_name; /* the name in unshifted state */ + char *shifted_name; /* the name in shifted state */ + unsigned char unshifted_ascii; /* the ascii code in unshifted state */ + unsigned char shifted_ascii; /* the ascii code in shifted state */ + unsigned char keycode; /* keyboard scancode */ +}; + +/* The table for key symbols. If the "shifted" member of an entry is + NULL, the entry does not have shifted state. Copied from GRUB Legacy setkey fuction */ +static struct keysym keysym_table[] = +{ + {"escape", 0, 0x1b, 0, 0x01}, + {"1", "exclam", '1', '!', 0x02}, + {"2", "at", '2', '@', 0x03}, + {"3", "numbersign", '3', '#', 0x04}, + {"4", "dollar", '4', '$', 0x05}, + {"5", "percent", '5', '%', 0x06}, + {"6", "caret", '6', '^', 0x07}, + {"7", "ampersand", '7', '&', 0x08}, + {"8", "asterisk", '8', '*', 0x09}, + {"9", "parenleft", '9', '(', 0x0a}, + {"0", "parenright", '0', ')', 0x0b}, + {"minus", "underscore", '-', '_', 0x0c}, + {"equal", "plus", '=', '+', 0x0d}, + {"backspace", 0, '\b', 0, 0x0e}, + {"tab", 0, '\t', 0, 0x0f}, + {"q", "Q", 'q', 'Q', 0x10}, + {"w", "W", 'w', 'W', 0x11}, + {"e", "E", 'e', 'E', 0x12}, + {"r", "R", 'r', 'R', 0x13}, + {"t", "T", 't', 'T', 0x14}, + {"y", "Y", 'y', 'Y', 0x15}, + {"u", "U", 'u', 'U', 0x16}, + {"i", "I", 'i', 'I', 0x17}, + {"o", "O", 'o', 'O', 0x18}, + {"p", "P", 'p', 'P', 0x19}, + {"bracketleft", "braceleft", '[', '{', 0x1a}, + {"bracketright", "braceright", ']', '}', 0x1b}, + {"enter", 0, '\r', 0, 0x1c}, + {"control", 0, 0, 0, 0x1d}, + {"a", "A", 'a', 'A', 0x1e}, + {"s", "S", 's', 'S', 0x1f}, + {"d", "D", 'd', 'D', 0x20}, + {"f", "F", 'f', 'F', 0x21}, + {"g", "G", 'g', 'G', 0x22}, + {"h", "H", 'h', 'H', 0x23}, + {"j", "J", 'j', 'J', 0x24}, + {"k", "K", 'k', 'K', 0x25}, + {"l", "L", 'l', 'L', 0x26}, + {"semicolon", "colon", ';', ':', 0x27}, + {"quote", "doublequote", '\'', '"', 0x28}, + {"backquote", "tilde", '`', '~', 0x29}, + {"shift", 0, 0, 0, 0x2a}, + {"backslash", "bar", '\\', '|', 0x2b}, + {"z", "Z", 'z', 'Z', 0x2c}, + {"x", "X", 'x', 'X', 0x2d}, + {"c", "C", 'c', 'C', 0x2e}, + {"v", "V", 'v', 'V', 0x2f}, + {"b", "B", 'b', 'B', 0x30}, + {"n", "N", 'n', 'N', 0x31}, + {"m", "M", 'm', 'M', 0x32}, + {"comma", "less", ',', '<', 0x33}, + {"period", "greater", '.', '>', 0x34}, + {"slash", "question", '/', '?', 0x35}, + {"rshift", 0, 0, 0, 0x36}, + {"numasterisk", 0, '*', 0, 0x37}, + {"alt", 0, 0, 0, 0x38}, + {"space", 0, ' ', 0, 0x39}, + {"capslock", 0, 0, 0, 0x3a}, + {"F1", 0, 0, 0, 0x3b}, + {"F2", 0, 0, 0, 0x3c}, + {"F3", 0, 0, 0, 0x3d}, + {"F4", 0, 0, 0, 0x3e}, + {"F5", 0, 0, 0, 0x3f}, + {"F6", 0, 0, 0, 0x40}, + {"F7", 0, 0, 0, 0x41}, + {"F8", 0, 0, 0, 0x42}, + {"F9", 0, 0, 0, 0x43}, + {"F10", 0, 0, 0, 0x44}, + {"num7", "numhome", '7', 0, 0x47}, + {"num8", "numup", '8', 0, 0x48}, + {"num9", "numpgup", '9', 0, 0x49}, + {"numminus", 0, '-', 0, 0x4a}, + {"num4", "numleft", '4', 0, 0x4b}, + {"num5", "num5numlock", '5', 0, 0x4c}, + {"num6", "numright", '6', 0, 0x4d}, + {"numplus", 0, '-', 0, 0x4e}, + {"num1", "numend", '1', 0, 0x4f}, + {"num2", "numdown", '2', 0, 0x50}, + {"num3", "numpgdown", '3', 0, 0x51}, + {"num0", "numinsert", '0', 0, 0x52}, + {"numperiod", "numdelete", 0, 0x7f, 0x53}, + {"F11", 0, 0, 0, 0x57}, + {"F12", 0, 0, 0, 0x58}, + {"numenter", 0, '\r', 0, 0xe0}, + {"numslash", 0, '/', 0, 0xe0}, + {"delete", 0, 0x7f, 0, 0xe0}, + {"insert", 0, 0xe0, 0, 0x52}, + {"home", 0, 0xe0, 0, 0x47}, + {"end", 0, 0xe0, 0, 0x4f}, + {"pgdown", 0, 0xe0, 0, 0x51}, + {"pgup", 0, 0xe0, 0, 0x49}, + {"down", 0, 0xe0, 0, 0x50}, + {"up", 0, 0xe0, 0, 0x48}, + {"left", 0, 0xe0, 0, 0x4b}, + {"right", 0, 0xe0, 0, 0x4d} +}; + +/* Set a simple flag in flags variable + OUTOFFSET - offset of flag in FLAGS, + OP - action id +*/ +static void +grub_sendkey_set_simple_flag (int outoffset, int op) +{ + if (op == 2) + { + andmask |= (1 << outoffset); + ormask &= ~(1 << outoffset); + } + else + { + andmask &= (~(1 << outoffset)); + if (op == 1) + ormask |= (1 << outoffset); + else + ormask &= ~(1 << outoffset); + } +} + +static int +grub_sendkey_parse_op (struct grub_arg_list state) +{ + if (! state.set) + return 2; + + if (grub_strcmp (state.arg, "off") == 0 || grub_strcmp (state.arg, "0") == 0 + || grub_strcmp (state.arg, "unpress") == 0) + return 0; + + if (grub_strcmp (state.arg, "on") == 0 || grub_strcmp (state.arg, "1") == 0 + || grub_strcmp (state.arg, "press") == 0) + return 1; + + return 2; +} + +static grub_uint32_t oldflags; + +static grub_err_t +grub_sendkey_postboot (void) +{ + /* For convention: pointer to flags. */ + grub_uint32_t *flags = (grub_uint32_t *) 0x417; + + *flags = oldflags; + + *((char *) 0x41a) = 0x1e; + *((char *) 0x41c) = 0x1e; + + return GRUB_ERR_NONE; +} + +/* Set keyboard buffer to our sendkey */ +static grub_err_t +grub_sendkey_preboot (int noret __attribute__ ((unused))) +{ + /* For convention: pointer to flags. */ + grub_uint32_t *flags = (grub_uint32_t *) 0x417; + + oldflags = *flags; + + /* Set the sendkey. */ + *((char *) 0x41a) = 0x1e; + *((char *) 0x41c) = keylen + 0x1e; + grub_memcpy ((char *) 0x41e, sendkey, 0x20); + + /* Transform "any ctrl" to "right ctrl" flag. */ + if (*flags & (1 << 8)) + *flags &= ~(1 << 2); + + /* Transform "any alt" to "right alt" flag. */ + if (*flags & (1 << 9)) + *flags &= ~(1 << 3); + + *flags = (*flags & andmask) | ormask; + + /* Transform "right ctrl" to "any ctrl" flag. */ + if (*flags & (1 << 8)) + *flags |= (1 << 2); + + /* Transform "right alt" to "any alt" flag. */ + if (*flags & (1 << 9)) + *flags |= (1 << 3); + + /* Write new LED state */ + if (!noled) + { + int value = 0; + int failed; + /* Try 5 times */ + for (failed = 0; failed < 5; failed++) + { + value = 0; + /* Send command change LEDs */ + grub_outb (0xed, 0x60); + + /* Wait */ + do + value = grub_inb (0x60); + while ((value != 0xfa) && (value != 0xfe)); + + if (value == 0xfa) + { + /* Set new LEDs*/ + grub_outb ((*flags >> 4) & 7, 0x60); + break; + } + } + } + return GRUB_ERR_NONE; +} + +static grub_err_t +grub_cmd_sendkey (grub_extcmd_t cmd, int argc, char **args) +{ + struct grub_arg_list *state = cmd->state; + + auto int find_key_code (char *key); + auto int find_ascii_code (char *key); + + int find_key_code (char *key) + { + unsigned i; + + for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) + { + if (keysym_table[i].unshifted_name + && grub_strcmp (key, keysym_table[i].unshifted_name) == 0) + return keysym_table[i].keycode; + else if (keysym_table[i].shifted_name + && grub_strcmp (key, keysym_table[i].shifted_name) == 0) + return keysym_table[i].keycode; + } + + return 0; + } + + int find_ascii_code (char *key) + { + unsigned i; + + for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) + { + if (keysym_table[i].unshifted_name + && grub_strcmp (key, keysym_table[i].unshifted_name) == 0) + return keysym_table[i].unshifted_ascii; + else if (keysym_table[i].shifted_name + && grub_strcmp (key, keysym_table[i].shifted_name) == 0) + return keysym_table[i].shifted_ascii; + } + + return 0; + } + + { + int i; + + keylen = 0; + + for (i = 0; i < argc && keylen < 0x20; i++) + { + int key_code; + + key_code = find_key_code (args[i]); + if (key_code) + { + sendkey[keylen++] = find_ascii_code (args[i]); + sendkey[keylen++] = key_code; + } + } + } + + { + unsigned i; + for (i = 0; i < sizeof (simple_flag_offsets) + / sizeof (simple_flag_offsets[0]); i++) + grub_sendkey_set_simple_flag (simple_flag_offsets[i], + grub_sendkey_parse_op(state[i])); + } + + /* Set noled. */ + noled = (state[sizeof (simple_flag_offsets) + / sizeof (simple_flag_offsets[0])].set); + + return GRUB_ERR_NONE; +} + +static grub_extcmd_t cmd; +static void *preboot_hook; + +GRUB_MOD_INIT (sendkey) +{ + cmd = grub_register_extcmd ("sendkey", grub_cmd_sendkey, + GRUB_COMMAND_FLAG_BOTH, + "sendkey [KEYSTROKE1] [KEYSTROKE2] ...", + "Emulate a keystroke", options); + + preboot_hook + = grub_loader_register_preboot_hook (grub_sendkey_preboot, + grub_sendkey_postboot, + GRUB_LOADER_PREBOOT_HOOK_PRIO_CONSOLE); +} + +GRUB_MOD_FINI (sendkey) +{ + grub_unregister_extcmd (cmd); + grub_loader_unregister_preboot_hook (preboot_hook); +} diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index c157aaf01..5e9ec882f 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -235,6 +235,12 @@ datetime_mod_SOURCES = lib/cmos_datetime.c datetime_mod_CFLAGS = $(COMMON_CFLAGS) datetime_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For sendkey.mod +pkglib_MODULES += sendkey.mod +sendkey_mod_SOURCES = commands/i386/pc/sendkey.c +sendkey_mod_CFLAGS = $(COMMON_CFLAGS) +sendkey_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For ata_pthru.mod. ata_pthru_mod_SOURCES = disk/ata_pthru.c ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS) From 93541d660df8aa3c5afdec7b26d57d08bb098b91 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Thu, 19 Aug 2010 21:53:50 +0100 Subject: [PATCH 129/174] * commands/i386/pc/sendkey.c (options): Fix three typos. --- ChangeLog | 4 ++++ commands/i386/pc/sendkey.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a20e76892..0eba757db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-19 Colin Watson + + * commands/i386/pc/sendkey.c (options): Fix three typos. + 2010-08-19 Vladimir Serbinenko Implement sendkey support. diff --git a/commands/i386/pc/sendkey.c b/commands/i386/pc/sendkey.c index aa7ffdb59..60cb5c902 100644 --- a/commands/i386/pc/sendkey.c +++ b/commands/i386/pc/sendkey.c @@ -44,11 +44,11 @@ static const struct grub_arg_option options[] = {"numkey", 0, 0, "press NumLock key", "[keep|on|off]", ARG_TYPE_STRING}, {"capskey", 0, 0, "press CapsLock key", "[keep|on|off]", ARG_TYPE_STRING}, {"scrollkey", 0, 0, "press ScrollLock key", "[keep|on|off]", ARG_TYPE_STRING}, - {"inserkey", 0, 0, "press Insert key", "[keep|on|off]", ARG_TYPE_STRING}, + {"insertkey", 0, 0, "press Insert key", "[keep|on|off]", ARG_TYPE_STRING}, {"left-alt", 0, 0, "press left alt", "[keep|on|off]", ARG_TYPE_STRING}, - {"right-alt", 0, 0, "press rightt alt", "[keep|on|off]", ARG_TYPE_STRING}, + {"right-alt", 0, 0, "press right alt", "[keep|on|off]", ARG_TYPE_STRING}, {"left-ctrl", 0, 0, "press left ctrl", "[keep|on|off]", ARG_TYPE_STRING}, - {"right-ctrl", 0, 0, "press rightt ctrl", "[keep|on|off]", ARG_TYPE_STRING}, + {"right-ctrl", 0, 0, "press right ctrl", "[keep|on|off]", ARG_TYPE_STRING}, {"no-led", 0, 0, "don't update LED state", 0, 0}, {0, 0, 0, 0, 0, 0} }; From c4d165425604a43f9a32f97e157d2e4298c5a6c7 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 20 Aug 2010 00:05:14 +0100 Subject: [PATCH 130/174] * commands/i386/pc/sendkey.c (options): Remove "keep" from all status flag options; simply omitting the option is equivalent and simpler. Rename "wait" to "pause". Rename "sysreq" to "sysrq". (keysym_table): Rename "num5numlock" to "numlock". (grub_cmd_sendkey): Reinitialise `andmask' and `ormask', so that we can uniformly say that only the last of multiple `sendkey' invocations has any effect. * docs/grub.texi (sendkey): New section. --- ChangeLog | 11 +++ commands/i386/pc/sendkey.c | 37 ++++----- docs/grub.texi | 149 +++++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0eba757db..a8f4c6f47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2010-08-20 Colin Watson + + * commands/i386/pc/sendkey.c (options): Remove "keep" from all + status flag options; simply omitting the option is equivalent and + simpler. Rename "wait" to "pause". Rename "sysreq" to "sysrq". + (keysym_table): Rename "num5numlock" to "numlock". + (grub_cmd_sendkey): Reinitialise `andmask' and `ormask', so that we + can uniformly say that only the last of multiple `sendkey' + invocations has any effect. + * docs/grub.texi (sendkey): New section. + 2010-08-19 Colin Watson * commands/i386/pc/sendkey.c (options): Fix three typos. diff --git a/commands/i386/pc/sendkey.c b/commands/i386/pc/sendkey.c index 60cb5c902..32e0e2551 100644 --- a/commands/i386/pc/sendkey.c +++ b/commands/i386/pc/sendkey.c @@ -33,22 +33,22 @@ static int keylen = 0; static int noled = 0; static const struct grub_arg_option options[] = { - {"num", 'n', 0, "set numlock mode", "[keep|on|off]", ARG_TYPE_STRING}, - {"caps", 'c', 0, "set capslock mode", "[keep|on|off]", ARG_TYPE_STRING}, - {"scroll", 's', 0, "set scrolllock mode", "[keep|on|off]", ARG_TYPE_STRING}, - {"insert", 0, 0, "set insert mode", "[keep|on|off]", ARG_TYPE_STRING}, - {"wait", 0, 0, "set wait mode", "[keep|on|off]", ARG_TYPE_STRING}, - {"left-shift", 0, 0, "press left shift", "[keep|on|off]", ARG_TYPE_STRING}, - {"right-shift", 0, 0, "press right shift", "[keep|on|off]", ARG_TYPE_STRING}, - {"sysreq", 0, 0, "press sysreq", "[keep|on|off]", ARG_TYPE_STRING}, - {"numkey", 0, 0, "press NumLock key", "[keep|on|off]", ARG_TYPE_STRING}, - {"capskey", 0, 0, "press CapsLock key", "[keep|on|off]", ARG_TYPE_STRING}, - {"scrollkey", 0, 0, "press ScrollLock key", "[keep|on|off]", ARG_TYPE_STRING}, - {"insertkey", 0, 0, "press Insert key", "[keep|on|off]", ARG_TYPE_STRING}, - {"left-alt", 0, 0, "press left alt", "[keep|on|off]", ARG_TYPE_STRING}, - {"right-alt", 0, 0, "press right alt", "[keep|on|off]", ARG_TYPE_STRING}, - {"left-ctrl", 0, 0, "press left ctrl", "[keep|on|off]", ARG_TYPE_STRING}, - {"right-ctrl", 0, 0, "press right ctrl", "[keep|on|off]", ARG_TYPE_STRING}, + {"num", 'n', 0, "set numlock mode", "[on|off]", ARG_TYPE_STRING}, + {"caps", 'c', 0, "set capslock mode", "[on|off]", ARG_TYPE_STRING}, + {"scroll", 's', 0, "set scrolllock mode", "[on|off]", ARG_TYPE_STRING}, + {"insert", 0, 0, "set insert mode", "[on|off]", ARG_TYPE_STRING}, + {"pause", 0, 0, "set pause mode", "[on|off]", ARG_TYPE_STRING}, + {"left-shift", 0, 0, "press left shift", "[on|off]", ARG_TYPE_STRING}, + {"right-shift", 0, 0, "press right shift", "[on|off]", ARG_TYPE_STRING}, + {"sysrq", 0, 0, "press SysRq", "[on|off]", ARG_TYPE_STRING}, + {"numkey", 0, 0, "press NumLock key", "[on|off]", ARG_TYPE_STRING}, + {"capskey", 0, 0, "press CapsLock key", "[on|off]", ARG_TYPE_STRING}, + {"scrollkey", 0, 0, "press ScrollLock key", "[on|off]", ARG_TYPE_STRING}, + {"insertkey", 0, 0, "press Insert key", "[on|off]", ARG_TYPE_STRING}, + {"left-alt", 0, 0, "press left alt", "[on|off]", ARG_TYPE_STRING}, + {"right-alt", 0, 0, "press right alt", "[on|off]", ARG_TYPE_STRING}, + {"left-ctrl", 0, 0, "press left ctrl", "[on|off]", ARG_TYPE_STRING}, + {"right-ctrl", 0, 0, "press right ctrl", "[on|off]", ARG_TYPE_STRING}, {"no-led", 0, 0, "don't update LED state", 0, 0}, {0, 0, 0, 0, 0, 0} }; @@ -144,7 +144,7 @@ static struct keysym keysym_table[] = {"num9", "numpgup", '9', 0, 0x49}, {"numminus", 0, '-', 0, 0x4a}, {"num4", "numleft", '4', 0, 0x4b}, - {"num5", "num5numlock", '5', 0, 0x4c}, + {"num5", "numlock", '5', 0, 0x4c}, {"num6", "numright", '6', 0, 0x4d}, {"numplus", 0, '-', 0, 0x4e}, {"num1", "numend", '1', 0, 0x4f}, @@ -325,6 +325,9 @@ grub_cmd_sendkey (grub_extcmd_t cmd, int argc, char **args) return 0; } + andmask = 0xffffffff; + ormask = 0; + { int i; diff --git a/docs/grub.texi b/docs/grub.texi index 583cf98cb..725807c56 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -2094,6 +2094,7 @@ you forget a command, you can run the command @command{help} * pxe_unload:: Unload the PXE environment * reboot:: Reboot your computer * search:: Search devices by file, label, or UUID +* sendkey:: Emulate keystrokes * set:: Set an environment variable * unset:: Unset an environment variable * uppermem:: Set the upper memory size @@ -2604,6 +2605,154 @@ commands are aliases for @samp{search --file}, @samp{search --label}, and @end deffn +@node sendkey +@subsection sendkey + +@deffn Command sendkey @ + [@option{--num}|@option{--caps}|@option{--scroll}|@option{--insert}|@ +@option{--pause}|@option{--left-shift}|@option{--right-shift}|@ +@option{--sysrq}|@option{--numkey}|@option{--capskey}|@option{--scrollkey}|@ +@option{--insertkey}|@option{--left-alt}|@option{--right-alt}|@ +@option{--left-ctrl}|@option{--right-ctrl} @ + @samp{on}|@samp{off}]@dots{} @ + [@option{no-led}] @ + keystroke +Insert keystrokes into the keyboard buffer when booting. Sometimes an +operating system or chainloaded boot loader requires particular keys to be +pressed: for example, one might need to press a particular key to enter +"safe mode", or when chainloading another boot loader one might send +keystrokes to it to navigate its menu. + +You may provide up to 16 keystrokes (the length of the BIOS keyboard +buffer). Keystroke names may be upper-case or lower-case letters, digits, +or taken from the following table: + +@c Please keep this table in the same order as in +@c commands/i386/pc/sendkey.c, for ease of maintenance. +@c Exception: The function and numeric keys are sorted, for aesthetics. + +@multitable @columnfractions .4 .5 +@headitem Name @tab Key +@item escape @tab Escape +@item exclam @tab ! +@item at @tab @@ +@item numbersign @tab # +@item dollar @tab $ +@item percent @tab % +@item caret @tab ^ +@item ampersand @tab & +@item asterisk @tab * +@item parenleft @tab ( +@item parenright @tab ) +@item minus @tab - +@item underscore @tab _ +@item equal @tab = +@item plus @tab + +@item backspace @tab Backspace +@item tab @tab Tab +@item bracketleft @tab [ +@item braceleft @tab @{ +@item bracketright @tab ] +@item braceright @tab @} +@item enter @tab Enter +@item control @tab press and release Control +@item semicolon @tab ; +@item colon @tab : +@item quote @tab ' +@item doublequote @tab " +@item backquote @tab ` +@item tilde @tab ~ +@item shift @tab press and release left Shift +@item backslash @tab \ +@item bar @tab | +@item comma @tab , +@item less @tab < +@item period @tab . +@item greater @tab > +@item slash @tab / +@item question @tab ? +@item rshift @tab press and release right Shift +@item alt @tab press and release Alt +@item space @tab space bar +@item capslock @tab Caps Lock +@item F1 @tab F1 +@item F2 @tab F2 +@item F3 @tab F3 +@item F4 @tab F4 +@item F5 @tab F5 +@item F6 @tab F6 +@item F7 @tab F7 +@item F8 @tab F8 +@item F9 @tab F9 +@item F10 @tab F10 +@item F11 @tab F11 +@item F12 @tab F12 +@item num1 @tab 1 (numeric keypad) +@item num2 @tab 2 (numeric keypad) +@item num3 @tab 3 (numeric keypad) +@item num4 @tab 4 (numeric keypad) +@item num5 @tab 5 (numeric keypad) +@item num6 @tab 6 (numeric keypad) +@item num7 @tab 7 (numeric keypad) +@item num8 @tab 8 (numeric keypad) +@item num9 @tab 9 (numeric keypad) +@item num0 @tab 0 (numeric keypad) +@item numperiod @tab . (numeric keypad) +@item numend @tab End (numeric keypad) +@item numdown @tab Down (numeric keypad) +@item numpgdown @tab Page Down (numeric keypad) +@item numleft @tab Left (numeric keypad) +@item numlock @tab Num Lock (numeric keypad) +@item numright @tab Right (numeric keypad) +@item numhome @tab Home (numeric keypad) +@item numup @tab Up (numeric keypad) +@item numpgup @tab Page Up (numeric keypad) +@item numinsert @tab Insert (numeric keypad) +@item numdelete @tab Delete (numeric keypad) +@item numasterisk @tab * (numeric keypad) +@item numminus @tab - (numeric keypad) +@item numplus @tab + (numeric keypad) +@item numslash @tab / (numeric keypad) +@item numenter @tab Enter (numeric keypad) +@item delete @tab Delete +@item insert @tab Insert +@item home @tab Home +@item end @tab End +@item pgdown @tab Page Down +@item pgup @tab Page Up +@item down @tab Down +@item up @tab Up +@item left @tab Left +@item right @tab Right +@end multitable + +As well as keystrokes, the @command{sendkey} command takes various options +that affect the BIOS keyboard status flags. These options take an @samp{on} +or @samp{off} parameter, specifying that the corresponding status flag be +set or unset; omitting the option for a given status flag will leave that +flag at its initial state at boot. The @option{--num}, @option{--caps}, +@option{--scroll}, and @option{--insert} options emulate setting the +corresponding mode, while the @option{--numkey}, @option{--capskey}, +@option{--scrollkey}, and @option{--insertkey} options emulate pressing and +holding the corresponding key. The other status flag options are +self-explanatory. + +If the @option{--no-led} option is given, the status flag options will have +no effect on keyboard LEDs. + +If the @command{sendkey} command is given multiple times, then only the last +invocation has any effect. + +Since @command{sendkey} manipulates the BIOS keyboard buffer, it may cause +hangs, reboots, or other misbehaviour on some systems. If the operating +system or boot loader that runs after GRUB uses its own keyboard driver +rather than the BIOS keyboard functions, then @command{sendkey} will have no +effect. + +This command is only available on PC BIOS systems. +@end deffn + + @node set @subsection set From 63c734a63ed766ef0f8b0ab5b73fd3626b28de50 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 20 Aug 2010 00:15:23 +0100 Subject: [PATCH 131/174] * commands/i386/pc/sendkey.c (keysym_table): Rename "numlock" to "numcenter" (I misunderstood the purpose of this entry). * docs/grub.texi (sendkey): Likewise. --- ChangeLog | 6 ++++++ commands/i386/pc/sendkey.c | 2 +- docs/grub.texi | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8f4c6f47..7d82e08fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-08-20 Colin Watson + + * commands/i386/pc/sendkey.c (keysym_table): Rename "numlock" to + "numcenter" (I misunderstood the purpose of this entry). + * docs/grub.texi (sendkey): Likewise. + 2010-08-20 Colin Watson * commands/i386/pc/sendkey.c (options): Remove "keep" from all diff --git a/commands/i386/pc/sendkey.c b/commands/i386/pc/sendkey.c index 32e0e2551..6c5602dec 100644 --- a/commands/i386/pc/sendkey.c +++ b/commands/i386/pc/sendkey.c @@ -144,7 +144,7 @@ static struct keysym keysym_table[] = {"num9", "numpgup", '9', 0, 0x49}, {"numminus", 0, '-', 0, 0x4a}, {"num4", "numleft", '4', 0, 0x4b}, - {"num5", "numlock", '5', 0, 0x4c}, + {"num5", "numcenter", '5', 0, 0x4c}, {"num6", "numright", '6', 0, 0x4d}, {"numplus", 0, '-', 0, 0x4e}, {"num1", "numend", '1', 0, 0x4f}, diff --git a/docs/grub.texi b/docs/grub.texi index 725807c56..9845c7a6f 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -2702,7 +2702,7 @@ or taken from the following table: @item numdown @tab Down (numeric keypad) @item numpgdown @tab Page Down (numeric keypad) @item numleft @tab Left (numeric keypad) -@item numlock @tab Num Lock (numeric keypad) +@item numcenter @tab 5 with Num Lock inactive (numeric keypad) @item numright @tab Right (numeric keypad) @item numhome @tab Home (numeric keypad) @item numup @tab Up (numeric keypad) From a5a3bccd54e0a34595086f461a462d0039292809 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 20 Aug 2010 10:14:29 +0530 Subject: [PATCH 132/174] added conf/Makefile.common and conf/Makefile.extra-dist --- Makefile.am | 105 +++------------------- conf/Makefile.common | 118 ++++++++++++++++++++++++ conf/Makefile.extra-dist | 75 ++++++++++++++++ docs/Makefile.am | 2 - gentpl.py | 6 +- grub-core/Makefile.am | 188 +++++---------------------------------- 6 files changed, 227 insertions(+), 267 deletions(-) create mode 100644 conf/Makefile.common create mode 100644 conf/Makefile.extra-dist diff --git a/Makefile.am b/Makefile.am index e96a540da..ed482eea2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,104 +2,19 @@ AUTOMAKE_OPTIONS = subdir-objects DEPDIR = .deps-util SUBDIRS = . grub-core po docs -EXTRA_DIST = autogen.sh gentpl.py Makefile.tpl modules.def geninit.sh -EXTRA_DIST += include conf/i386-pc-cygwin-img-ld.sc -grubconfdir = $(sysconfdir)/grub.d -platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform) +include $(top_srcdir)/conf/Makefile.common +include $(top_srcdir)/conf/Makefile.extra-dist -# Platform specific options -if COND_i386_pc - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_i386_efi - LDFLAGS_PLATFORM = -melf_i386 -endif -if COND_x86_64_efi - LDFLAGS_PLATFORM = -melf_x86_64 -endif -if COND_i386_qemu - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_i386_coreboot - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_i386_ieee1275 - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_mips_yeeloong - CFLAGS_PLATFORM = -march=mips3 -mexplicit-relocs -mflush-func=grub_cpu_flush_cache - CCASFLAGS_PLATFORM = -march=mips3 -endif -if COND_sparc64_ieee1275 - CFLAGS_PLATFORM = -mno-app-regs - LDFLAGS_PLATFORM = -melf64_sparc -mno-relax -endif +AM_CFLAGS = $(HOST_CFLAGS) +AM_LDFLAGS = $(HOST_LDFLAGS) +AM_CPPFLAGS = $(HOST_CPPFLAGS) $(CPPFLAGS_DEFAULT) +AM_CCASFLAGS = $(HOST_CCASFLAGS) $(CCASFLAGS_DEFAULT) -CPPFLAGS_GRUB = -DGRUB_FILE=\"`basename $<`\" -CPPFLAGS_GRUB += -I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) -CPPFLAGS_GRUB += -I$(top_srcdir)/include -CPPFLAGS_GRUB += -I$(top_builddir)/include -CCASFLAGS_GRUB = -DASM_FILE=1 - -CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap - -CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" -CPPFLAGS_GNULIB = -I$(top_srcdir)/grub-core/gnulib - -CFLAGS_MKISOFS = -Wno-all -Werror -CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include - -CFLAGS_POSIX = -fno-builtin -CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap - -CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime - -# to calm down automake -BUILT_SOURCES = -CLEANFILES = -COMMAND_FILES = -DEF_FILES = -FS_FILES = -HANDLER_FILES = -IMG_FILES = -MOD_FILES = -MODULE_FILES = -PARTMAP_FILES = -PARTTOOL_FILES = -TERMINAL_FILES = -TESTS = -UND_FILES = -VIDEO_FILES = -bin_PROGRAMS = -bin_SCRIPTS = -check_PROGRAMS = -check_SCRIPTS = -grubconf_DATA = -grubconf_SCRIPTS = -man_MANS = -noinst_DATA = -noinst_LIBRARIES = -noinst_PROGRAMS = -pkglib_SCRIPTS = -platform_DATA = -sbin_PROGRAMS = -sbin_SCRIPTS = - -CFLAGS_PROGRAM = $(HOST_CFLAGS) $(CFLAGS_GNULIB) -LDFLAGS_PROGRAM = $(HOST_LDFLAGS) $(LDFLAGS_GNULIB) -CPPFLAGS_PROGRAM = $(HOST_CPPFLAGS) $(CPPFLAGS_GNULIB) -CCASFLAGS_PROGRAM = $(HOST_CCASFLAGS) $(CCASFLAGS_GNULIB) - -CFLAGS_LIBRARY = $(CFLAGS_PROGRAM) -CPPFLAGS_LIBRARY = $(CPPFLAGS_PROGRAM) -CCASFLAGS_LIBRARY = $(CCASFLAGS_PROGRAM) - -AM_CFLAGS = -AM_LDFLAGS = -AM_CPPFLAGS = $(CPPFLAGS_GRUB) -AM_CCASFLAGS = $(CCASFLAGS_GRUB) +CFLAGS_PROGRAM += $(CFLAGS_GNULIB) +LDFLAGS_PROGRAM += $(LDFLAGS_GNULIB) +CPPFLAGS_PROGRAM += $(CPPFLAGS_GNULIB) +CCASFLAGS_PROGRAM += $(CCASFLAGS_GNULIB) include $(srcdir)/modules.am diff --git a/conf/Makefile.common b/conf/Makefile.common new file mode 100644 index 000000000..db3c13c73 --- /dev/null +++ b/conf/Makefile.common @@ -0,0 +1,118 @@ +# Platform specific options +if COND_i386_pc + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_efi + LDFLAGS_PLATFORM = -melf_i386 +endif +if COND_x86_64_efi + LDFLAGS_PLATFORM = -melf_x86_64 +endif +if COND_i386_qemu + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_coreboot + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_i386_ieee1275 + CFLAGS_PLATFORM = -mrtd -mregparm=3 +endif +if COND_mips_yeeloong + CFLAGS_PLATFORM = -march=mips3 -mexplicit-relocs -mflush-func=grub_cpu_flush_cache + CCASFLAGS_PLATFORM = -march=mips3 +endif +if COND_sparc64_ieee1275 + CFLAGS_PLATFORM = -mno-app-regs + LDFLAGS_PLATFORM = -melf64_sparc -mno-relax +endif + +# Other options + +CPPFLAGS_DEFAULT = -DGRUB_FILE=\"`basename $<`\" +CPPFLAGS_DEFAULT += -I$(builddir) +CPPFLAGS_DEFAULT += -I$(srcdir) +CPPFLAGS_DEFAULT += -I$(top_builddir) +CPPFLAGS_DEFAULT += -I$(top_srcdir) +CPPFLAGS_DEFAULT += -I$(top_srcdir)/include +CPPFLAGS_DEFAULT += -I$(top_builddir)/include +CCASFLAGS_DEFAULT = -DASM_FILE=1 + +LDADD_KERNEL = -lgcc +CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding +LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc +CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) +CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) + +CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding +LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d +CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) +CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) + +CFLAGS_IMAGE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin +LDFLAGS_IMAGE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-S +CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) +CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) + +CFLAGS_PROGRAM = +LDFLAGS_PROGRAM = +CPPFLAGS_PROGRAM = +CCASFLAGS_PROGRAM = + +CFLAGS_LIBRARY = $(CFLAGS_PROGRAM) +CPPFLAGS_LIBRARY = $(CPPFLAGS_PROGRAM) +CCASFLAGS_LIBRARY = $(CCASFLAGS_PROGRAM) + +# Other variables + +grubconfdir = $(sysconfdir)/grub.d +platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform) + +CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers +CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap + +CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" +CPPFLAGS_GNULIB = -I$(top_srcdir)/grub-core/gnulib + +CFLAGS_MKISOFS = -Wno-all -Werror +CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include + +CFLAGS_POSIX = -fno-builtin +CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap + +CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime + +# Define these variables to calm down automake + +FS_FILES = +DEF_FILES = +UND_FILES = +IMG_FILES = +MOD_FILES = +VIDEO_FILES = +MODULE_FILES = +HANDLER_FILES = +PARTMAP_FILES = +COMMAND_FILES = +PARTTOOL_FILES = +TERMINAL_FILES = +KERNEL_HEADER_FILES = + +man_MANS = +noinst_DATA = +bin_SCRIPTS = +sbin_SCRIPTS = +bin_PROGRAMS = +platform_DATA = +sbin_PROGRAMS = +check_SCRIPTS = +grubconf_DATA = +check_PROGRAMS = +pkglib_SCRIPTS = +noinst_PROGRAMS = +grubconf_SCRIPTS = +noinst_LIBRARIES = + +TESTS = +EXTRA_DIST = +CLEANFILES = +BUILT_SOURCES = diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist new file mode 100644 index 000000000..ae4b8fbde --- /dev/null +++ b/conf/Makefile.extra-dist @@ -0,0 +1,75 @@ +EXTRA_DIST += include + +EXTRA_DIST += autogen.sh +EXTRA_DIST += geninit.sh + +EXTRA_DIST += gentpl.py +EXTRA_DIST += modules.def +EXTRA_DIST += Makefile.tpl + +EXTRA_DIST += docs/man +EXTRA_DIST += docs/grub.cfg + +EXTRA_DIST += conf/i386-pc-cygwin-img-ld.sc + +EXTRA_DIST += grub-core/modules.def +EXTRA_DIST += grub-core/genmoddep.awk +EXTRA_DIST += grub-core/genmodsrc.sh +EXTRA_DIST += grub-core/genfslist.sh +EXTRA_DIST += grub-core/gencmdlist.sh +EXTRA_DIST += grub-core/gensymlist.sh +EXTRA_DIST += grub-core/genemuinit.sh +EXTRA_DIST += grub-core/genvideolist.sh +EXTRA_DIST += grub-core/genhandlerlist.sh +EXTRA_DIST += grub-core/genpartmaplist.sh +EXTRA_DIST += grub-core/genterminallist.sh +EXTRA_DIST += grub-core/genparttoollist.sh +EXTRA_DIST += grub-core/genemuinitheader.sh + +EXTRA_DIST += grub-core/gnulib/getopt.h +EXTRA_DIST += grub-core/gnulib/argp-version-etc.h +EXTRA_DIST += grub-core/gnulib/fnmatch.h +EXTRA_DIST += grub-core/gnulib/error.h +EXTRA_DIST += grub-core/gnulib/argp-namefrob.h +EXTRA_DIST += grub-core/gnulib/argp.h +EXTRA_DIST += grub-core/gnulib/argp-fmtstream.h +EXTRA_DIST += grub-core/gnulib/gettext.h +EXTRA_DIST += grub-core/gnulib/regex_internal.h +EXTRA_DIST += grub-core/gnulib/progname.h +EXTRA_DIST += grub-core/gnulib/regex.h +EXTRA_DIST += grub-core/gnulib/alloca.h +EXTRA_DIST += grub-core/gnulib/getopt_int.h +EXTRA_DIST += grub-core/efiemu/runtime/config.h + +EXTRA_DIST += grub-core/lib/posix_wrap/localcharset.h +EXTRA_DIST += grub-core/lib/posix_wrap/ctype.h +EXTRA_DIST += grub-core/lib/posix_wrap/limits.h +EXTRA_DIST += grub-core/lib/posix_wrap/stdio.h +EXTRA_DIST += grub-core/lib/posix_wrap/sys/types.h +EXTRA_DIST += grub-core/lib/posix_wrap/unistd.h +EXTRA_DIST += grub-core/lib/posix_wrap/locale.h +EXTRA_DIST += grub-core/lib/posix_wrap/wchar.h +EXTRA_DIST += grub-core/lib/posix_wrap/string.h +EXTRA_DIST += grub-core/lib/posix_wrap/langinfo.h +EXTRA_DIST += grub-core/lib/posix_wrap/wctype.h +EXTRA_DIST += grub-core/lib/posix_wrap/stdint.h +EXTRA_DIST += grub-core/lib/posix_wrap/stdlib.h +EXTRA_DIST += grub-core/lib/posix_wrap/assert.h +EXTRA_DIST += grub-core/lib/posix_wrap/errno.h + +EXTRA_DIST += grub-core/lib/libgcrypt_wrap/cipher_wrap.h +EXTRA_DIST += grub-core/lib/libgcrypt/cipher/rijndael-tables.h +EXTRA_DIST += grub-core/lib/libgcrypt/cipher/bithelp.h +EXTRA_DIST += grub-core/lib/libgcrypt/cipher/rmd.h +EXTRA_DIST += grub-core/lib/libgcrypt/cipher/hash-common.h +EXTRA_DIST += grub-core/lib/libgcrypt/cipher/camellia.h + +EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/types.h +EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/cipher.h +EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/rijndael-tables.h +EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/memory.h +EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/bithelp.h +EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/g10lib.h +EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/rmd.h +EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/hash-common.h +EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/camellia.h diff --git a/docs/Makefile.am b/docs/Makefile.am index a2e83dcd6..103240bcc 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,7 +1,5 @@ AUTOMAKE_OPTIONS = subdir-objects -EXTRA_DIST = grub.cfg man - AM_MAKEINFOFLAGS = --force --no-split --no-validate info_TEXINFOS = grub.texi grub_TEXINFOS = fdl.texi diff --git a/gentpl.py b/gentpl.py index 4d7ed0aa3..eb790751c 100644 --- a/gentpl.py +++ b/gentpl.py @@ -226,15 +226,15 @@ mod-[+ name +].c: [+ name +].module$(EXEEXT) moddep.lst genmodsrc.sh sh $(srcdir)/genmodsrc.sh [+ name +] moddep.lst > $@ || (rm -f $@; exit 1) mod-[+ name +].o: mod-[+ name +].c - $(TARGET_CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS_MODULE) $(CPPFLAGS) $(CFLAGS_MODULE) $(CFLAGS) -c -o $@ $< + $(TARGET_CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname() + """_CPPFLAGS) $(CPPFLAGS) $(""" + cname() + """_CFLAGS) $(CFLAGS) -c -o $@ $< [+ name +].mod: [+ name +].module$(EXEEXT) mod-[+ name +].o if test x$(USE_APPLE_CC_FIXES) = xyes; then \ - $(CCLD) $(LDFLAGS_MODULE) $(LDFLAGS) -o $@.bin $^; \ + $(CCLD) $(""" + cname() + """_LDFLAGS) $(LDFLAGS) -o $@.bin $^; \ $(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -nu -nd $@.bin $@; \ rm -f $@.bin; \ else \ - $(CCLD) -o $@ $(LDFLAGS_MODULE) $(LDFLAGS) $^; \ + $(CCLD) -o $@ $(""" + cname() + """_LDFLAGS) $(LDFLAGS) $^; \ if test ! -z '$(TARGET_OBJ2ELF)'; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \ $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; \ fi diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index e1f45eb38..d91448149 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -1,172 +1,26 @@ AUTOMAKE_OPTIONS = subdir-objects +DEPDIR=.deps-core + +include $(top_srcdir)/conf/Makefile.common + CC=$(TARGET_CC) CPP=$(TARGET_CC) CCAS=$(TARGET_CC) -DEPDIR=.deps-core -EXTRA_DIST = -EXTRA_DIST += modules.def genmoddep.awk -EXTRA_DIST += genmodsrc.sh gensymlist.sh genemuinit.sh genemuinitheader.sh -EXTRA_DIST += genfslist.sh gencmdlist.sh genvideolist.sh genhandlerlist.sh -EXTRA_DIST += genpartmaplist.sh genparttoollist.sh genterminallist.sh -EXTRA_DIST += lib/libgcrypt_wrap/cipher_wrap.h -EXTRA_DIST += lib/libgcrypt/cipher/rijndael-tables.h -EXTRA_DIST += lib/libgcrypt/cipher/bithelp.h -EXTRA_DIST += lib/libgcrypt/cipher/rmd.h -EXTRA_DIST += lib/libgcrypt/cipher/hash-common.h -EXTRA_DIST += lib/libgcrypt/cipher/camellia.h -EXTRA_DIST += lib/posix_wrap/localcharset.h -EXTRA_DIST += lib/posix_wrap/ctype.h -EXTRA_DIST += lib/posix_wrap/limits.h -EXTRA_DIST += lib/posix_wrap/stdio.h -EXTRA_DIST += lib/posix_wrap/sys/types.h -EXTRA_DIST += lib/posix_wrap/unistd.h -EXTRA_DIST += lib/posix_wrap/locale.h -EXTRA_DIST += lib/posix_wrap/wchar.h -EXTRA_DIST += lib/posix_wrap/string.h -EXTRA_DIST += lib/posix_wrap/langinfo.h -EXTRA_DIST += lib/posix_wrap/wctype.h -EXTRA_DIST += lib/posix_wrap/stdint.h -EXTRA_DIST += lib/posix_wrap/stdlib.h -EXTRA_DIST += lib/posix_wrap/assert.h -EXTRA_DIST += lib/posix_wrap/errno.h -EXTRA_DIST += lib/libgcrypt-grub/cipher/types.h -EXTRA_DIST += lib/libgcrypt-grub/cipher/cipher.h -EXTRA_DIST += lib/libgcrypt-grub/cipher/rijndael-tables.h -EXTRA_DIST += lib/libgcrypt-grub/cipher/memory.h -EXTRA_DIST += lib/libgcrypt-grub/cipher/bithelp.h -EXTRA_DIST += lib/libgcrypt-grub/cipher/g10lib.h -EXTRA_DIST += lib/libgcrypt-grub/cipher/rmd.h -EXTRA_DIST += lib/libgcrypt-grub/cipher/hash-common.h -EXTRA_DIST += lib/libgcrypt-grub/cipher/camellia.h -EXTRA_DIST += efiemu/runtime/config.h -EXTRA_DIST += gnulib/getopt.h -EXTRA_DIST += gnulib/argp-version-etc.h -EXTRA_DIST += gnulib/fnmatch.h -EXTRA_DIST += gnulib/error.h -EXTRA_DIST += gnulib/argp-namefrob.h -EXTRA_DIST += gnulib/argp.h -EXTRA_DIST += gnulib/argp-fmtstream.h -EXTRA_DIST += gnulib/gettext.h -EXTRA_DIST += gnulib/regex_internal.h -EXTRA_DIST += gnulib/progname.h -EXTRA_DIST += gnulib/regex.h -EXTRA_DIST += gnulib/alloca.h -EXTRA_DIST += gnulib/getopt_int.h +AM_CFLAGS = $(TARGET_CFLAGS) +AM_LDFLAGS = $(TARGET_LDFLAGS) +AM_CPPFLAGS = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT) +AM_CCASFLAGS = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT) -grubconfdir = $(sysconfdir)/grub.d -platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform) +CFLAGS_PROGRAM += $(CFLAGS_PLATFORM) +LDFLAGS_PROGRAM += $(LDFLAGS_PLATFORM) +CPPFLAGS_PROGRAM += $(CPPFLAGS_PLATFORM) +CCASFLAGS_PROGRAM += $(CCASFLAGS_PLATFORM) -# to calm down automake -BUILT_SOURCES = -CLEANFILES = -COMMAND_FILES = -DEF_FILES = -FS_FILES = -HANDLER_FILES = -IMG_FILES = -MOD_FILES = -MODULE_FILES = -PARTMAP_FILES = -PARTTOOL_FILES = -TERMINAL_FILES = -TESTS = -UND_FILES = -VIDEO_FILES = -bin_PROGRAMS = -bin_SCRIPTS = -check_PROGRAMS = -check_SCRIPTS = -grubconf_DATA = -grubconf_SCRIPTS = -man_MANS = -noinst_DATA = -noinst_LIBRARIES = -noinst_PROGRAMS = -pkglib_SCRIPTS = -platform_DATA = -sbin_PROGRAMS = -sbin_SCRIPTS = -KERNEL_HEADER_FILES = - -# Platform specific options -if COND_i386_pc - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_i386_efi - LDFLAGS_PLATFORM = -melf_i386 -endif -if COND_x86_64_efi - LDFLAGS_PLATFORM = -melf_x86_64 -endif -if COND_i386_qemu - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_i386_coreboot - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_i386_ieee1275 - CFLAGS_PLATFORM = -mrtd -mregparm=3 -endif -if COND_mips_yeeloong - CFLAGS_PLATFORM = -march=mips3 -mexplicit-relocs -mflush-func=grub_cpu_flush_cache - CCASFLAGS_PLATFORM = -march=mips3 -endif -if COND_sparc64_ieee1275 - CFLAGS_PLATFORM = -mno-app-regs - LDFLAGS_PLATFORM = -melf64_sparc -mno-relax -endif - -CPPFLAGS_GRUB = -DGRUB_FILE=\"`basename $<`\" -CPPFLAGS_GRUB += -I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) -CPPFLAGS_GRUB += -I$(top_srcdir)/include -CPPFLAGS_GRUB += -I$(top_builddir)/include -CCASFLAGS_GRUB = -DASM_FILE=1 - -CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers -CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap - -CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" -CPPFLAGS_GNULIB = -I$(top_srcdir)/grub-core/gnulib - -CFLAGS_MKISOFS = -Wno-all -Werror -CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include - -CFLAGS_POSIX = -fno-builtin -CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap - -CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime - -LDADD_KERNEL = -lgcc -CFLAGS_KERNEL = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding -LDFLAGS_KERNEL = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc -CPPFLAGS_KERNEL = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -CCASFLAGS_KERNEL = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) - -CFLAGS_MODULE = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding -LDFLAGS_MODULE = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d -CPPFLAGS_MODULE = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -CCASFLAGS_MODULE = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) - -CFLAGS_IMAGE = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin -LDFLAGS_IMAGE = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-S -CPPFLAGS_IMAGE = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -CCASFLAGS_IMAGE = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) - -CFLAGS_LIBRARY = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin -CPPFLAGS_LIBRARY = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -CCASFLAGS_LIBRARY = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) - -CFLAGS_PROGRAM = $(TARGET_CFLAGS) $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -LDFLAGS_PROGRAM = $(TARGET_LDFLAGS) $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -CPPFLAGS_PROGRAM = $(TARGET_CPPFLAGS) $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -CCASFLAGS_PROGRAM = $(TARGET_CCASFLAGS) $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) - -AM_CFLAGS = -AM_LDFLAGS = -AM_CPPFLAGS = $(CPPFLAGS_GRUB) -AM_CCASFLAGS = $(CCASFLAGS_GRUB) +CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin +CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM) +CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM) # gentrigtables gentrigtables: gentrigtables.c @@ -456,27 +310,27 @@ if COND_ENABLE_EFIEMU efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF) -rm -f $@; \ if test "x$(TARGET_APPLE_CC)" = x1; then \ - $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF32 -DAPPLE_CC -m32 -Wall -Werror -nostdlib -O2 -c -o $@.bin $< || exit 1; \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF32 -DAPPLE_CC -m32 -Wall -Werror -nostdlib -O2 -c -o $@.bin $< || exit 1; \ $(OBJCONV) -felf32 -nu -nd $@.bin $@ || exit 1; \ rm -f $@.bin; \ else \ - $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF32 -m32 -Wall -Werror -nostdlib -O2 -c -o $@ $< || exit 1; \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF32 -m32 -Wall -Werror -nostdlib -O2 -c -o $@ $< || exit 1; \ if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \ fi efiemu64_c.o: efiemu/runtime/efiemu.c if test "x$(TARGET_APPLE_CC)" = x1; then \ - $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -DAPPLE_CC=1 -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -DAPPLE_CC=1 -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \ else \ - $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \ fi efiemu64_s.o: efiemu/runtime/efiemu.S -rm -f $@ if test "x$(TARGET_APPLE_CC)" = x1; then \ - $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -DAPPLE_CC=1 -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -DAPPLE_CC=1 -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \ else \ - $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_GRUB) -DELF64 -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \ + $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \ fi efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF) From 02a6605e7e9528b06ae466893784a35a5eb20342 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 20 Aug 2010 11:10:42 +0530 Subject: [PATCH 133/174] minor fixes --- conf/Makefile.common | 3 ++- gentpl.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/Makefile.common b/conf/Makefile.common index db3c13c73..47067596b 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -28,7 +28,7 @@ endif # Other options -CPPFLAGS_DEFAULT = -DGRUB_FILE=\"`basename $<`\" +CPPFLAGS_DEFAULT = -DGRUB_FILE=\"`echo $< | sed "s@$(top_srcdir)/@@g"`\" CPPFLAGS_DEFAULT += -I$(builddir) CPPFLAGS_DEFAULT += -I$(srcdir) CPPFLAGS_DEFAULT += -I$(top_builddir) @@ -42,6 +42,7 @@ CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM) +STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d diff --git a/gentpl.py b/gentpl.py index eb790751c..632b4c13e 100644 --- a/gentpl.py +++ b/gentpl.py @@ -100,7 +100,7 @@ def if_platform_tagged(platform, tag, snippet_if, snippet_else=None): for group in RMAP[platform]: r += "[+ = \"" + group + "\" +]" + snippet_if - if snippet_else != None: r += "[+ * +]" + snippet_if + if snippet_else != None: r += "[+ * +]" + snippet_else r += "[+ ESAC +][+ ENDFOR +]" if snippet_else == None: From a26187d7c0d39e05f0c8df5e1d5d3a57ab5ee8cb Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 20 Aug 2010 11:13:37 +0530 Subject: [PATCH 134/174] update .bzrignore --- .bzrignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.bzrignore b/.bzrignore index cdc55d00b..1672efd65 100644 --- a/.bzrignore +++ b/.bzrignore @@ -91,4 +91,5 @@ depcomp mdate-sh texinfo.tex grub-core/lib/libgcrypt-grub - +**/.deps-util +**/.deps-core From 07daa815afa40e8ced4da557b6e9c9efecdab794 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 20 Aug 2010 11:39:47 +0530 Subject: [PATCH 135/174] better fix for setjmp module --- configure.ac | 7 ------- grub-core/lib/setjmp.S | 13 +++++++++++++ grub-core/modules.def | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 grub-core/lib/setjmp.S diff --git a/configure.ac b/configure.ac index 0923bf08f..9c1440775 100644 --- a/configure.ac +++ b/configure.ac @@ -904,13 +904,6 @@ else fi fi -# Copy */setjmp.S to target_cpu/ -AC_CONFIG_COMMANDS([grub-core/lib/target_cpu], - [mkdir -p grub-core/lib/target_cpu]) -AC_CONFIG_COMMANDS([setjmp.S], - [cp -rp $srcdir/grub-core/lib/$target_cpu/setjmp.S grub-core/lib/target_cpu/], - [target_cpu=$target_cpu srcdir=$srcdir]) - AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([grub-core/Makefile]) AC_CONFIG_FILES([po/Makefile]) diff --git a/grub-core/lib/setjmp.S b/grub-core/lib/setjmp.S new file mode 100644 index 000000000..c39c91b9c --- /dev/null +++ b/grub-core/lib/setjmp.S @@ -0,0 +1,13 @@ +#if defined(__i386__) +#include "./i386/setjmp.S" +#elif defined(__x86_64__) +#include "./x86_64/setjmp.S" +#elif defined(__sparc__) +#include "./sparc64/setjmp.S" +#elif defined(__mips__) +#include "./mips/setjmp.S" +#elif defined(__powerpc__) +#include "./powerpc/setjmp.S" +#else +#error "Unknwon target cpu type" +#endif diff --git a/grub-core/modules.def b/grub-core/modules.def index 71215aba0..fa830e779 100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@ -1214,7 +1214,7 @@ module = { module = { name = setjmp; - nodist = lib/target_cpu/setjmp.S; + source = lib/setjmp.S; extra_dist = lib/i386/setjmp.S; extra_dist = lib/mips/setjmp.S; extra_dist = lib/x86_64/setjmp.S; From 771111e53dd69d2a2026bceea4da9336079388fe Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 20 Aug 2010 13:00:11 +0530 Subject: [PATCH 136/174] fix COND_APPLE_CC definition --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9c1440775..cd0869187 100644 --- a/configure.ac +++ b/configure.ac @@ -884,7 +884,7 @@ AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes]) AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x]) AM_CONDITIONAL([COND_GRUB_FSTEST], [test x$enable_grub_fstest = xyes]) AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x]) -AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC != x]) +AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1]) AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) # Output files. From 537f3753211bfe432032aaa060824a64000f04e8 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 12:22:23 +0200 Subject: [PATCH 137/174] Fix control msg type --- term/usb_keyboard.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/term/usb_keyboard.c b/term/usb_keyboard.c index f2d74d71c..2157e26d7 100644 --- a/term/usb_keyboard.c +++ b/term/usb_keyboard.c @@ -133,11 +133,11 @@ grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) /* Place the device in boot mode. */ grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, - USB_HID_SET_PROTOCOL, 0, 0, 0, 0); + USB_HID_SET_PROTOCOL, 0, 0, 0, 0); /* Reports every time an event occurs and not more often than that. */ grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, - USB_HID_SET_IDLE, 0<<8, 0, 0, 0); + USB_HID_SET_IDLE, 0<<8, 0, 0, 0); grub_memcpy (&grub_usb_keyboards[curnum], &grub_usb_keyboard_term, sizeof (grub_usb_keyboards[curnum])); @@ -157,7 +157,7 @@ static grub_err_t grub_usb_keyboard_getreport (grub_usb_device_t dev, grub_uint8_t *report) { return grub_usb_control_msg (dev, GRUB_USB_REQTYPE_CLASS_INTERFACE_IN, - USB_HID_GET_REPORT, 0, 0, 8, (char *) report); + USB_HID_GET_REPORT, 0x0100, 0, 8, (char *) report); } From a17e3c978b05b40124b0f1501f6865be8756384f Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 14:36:29 +0200 Subject: [PATCH 138/174] Use GetReport only at initialisation as specified in the USBHID spec --- term/usb_keyboard.c | 233 ++++++++++++++------------------------------ 1 file changed, 73 insertions(+), 160 deletions(-) diff --git a/term/usb_keyboard.c b/term/usb_keyboard.c index 2157e26d7..d318a04ff 100644 --- a/term/usb_keyboard.c +++ b/term/usb_keyboard.c @@ -78,6 +78,13 @@ static struct grub_term_input grub_usb_keyboard_term = .next = 0 }; +struct grub_usb_keyboard_data +{ + grub_usb_device_t usbdev; + grub_uint8_t status; + int key; +}; + static struct grub_term_input grub_usb_keyboards[16]; static void @@ -92,6 +99,7 @@ grub_usb_keyboard_detach (grub_usb_device_t usbdev, grub_term_unregister_input (&grub_usb_keyboards[i]); grub_free ((char *) grub_usb_keyboards[i].name); grub_usb_keyboards[i].name = NULL; + grub_free (grub_usb_keyboards[i].data); grub_usb_keyboards[i].data = 0; } } @@ -100,6 +108,7 @@ static int grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) { unsigned curnum; + struct grub_usb_keyboard_data *data; grub_dprintf ("usb_keyboard", "%x %x %x %d %d\n", usbdev->descdev.class, usbdev->descdev.subclass, @@ -112,13 +121,6 @@ grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) if (curnum == ARRAY_SIZE (grub_usb_keyboards)) return 0; -#if 0 - if (descdev->class != 0x09 - || descdev->subclass == 0x01 - || descdev->protocol != 0x02) - return 0; -#endif - if (usbdev->descdev.class != 0 || usbdev->descdev.subclass != 0 || usbdev->descdev.protocol != 0) return 0; @@ -131,6 +133,15 @@ grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) grub_printf ("HID found!\n"); + data = grub_malloc (sizeof (*data)); + if (!data) + { + grub_print_error (); + return 0; + } + + data->usbdev = usbdev; + /* Place the device in boot mode. */ grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, USB_HID_SET_PROTOCOL, 0, 0, 0, 0); @@ -141,51 +152,64 @@ grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) grub_memcpy (&grub_usb_keyboards[curnum], &grub_usb_keyboard_term, sizeof (grub_usb_keyboards[curnum])); - grub_usb_keyboards[curnum].data = usbdev; + grub_usb_keyboards[curnum].data = data; usbdev->config[configno].interf[interfno].detach_hook = grub_usb_keyboard_detach; grub_usb_keyboards[curnum].name = grub_xasprintf ("usb_keyboard%d", curnum); if (!grub_usb_keyboards[curnum].name) - return 0; + { + grub_print_error (); + return 0; + } + + { + grub_uint8_t report[8]; + grub_usb_err_t err; + grub_memset (report, 0, sizeof (report)); + err = grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_IN, + USB_HID_GET_REPORT, 0x0000, interfno, + sizeof (report), (char *) report); + if (err) + { + data->status = 0; + data->key = -1; + } + else + { + data->status = report[0]; + data->key = report[2] ? : -1; + } + } + grub_term_register_input_active ("usb_keyboard", &grub_usb_keyboards[curnum]); - return 1; } -static grub_err_t -grub_usb_keyboard_getreport (grub_usb_device_t dev, grub_uint8_t *report) -{ - return grub_usb_control_msg (dev, GRUB_USB_REQTYPE_CLASS_INTERFACE_IN, - USB_HID_GET_REPORT, 0x0100, 0, 8, (char *) report); -} - static int grub_usb_keyboard_checkkey (struct grub_term_input *term) { grub_uint8_t data[8]; - int key; - grub_err_t err; - grub_uint64_t currtime; - int timeout = 50; - grub_usb_device_t usbdev = term->data; + grub_usb_err_t err; + struct grub_usb_keyboard_data *termdata = term->data; + grub_size_t actual; + + if (termdata->key != -1) + return termdata->key; data[2] = 0; - currtime = grub_get_time_ms (); - do - { - /* Get_Report. */ - err = grub_usb_keyboard_getreport (usbdev, data); + /* Poll interrupt pipe. */ + err = grub_usb_bulk_read_extended (termdata->usbdev, 1, sizeof (data), + (char *) data, 1, &actual); - /* Implement a timeout. */ - if (grub_get_time_ms () > currtime + timeout) - break; - } - while (err || !data[2]); + if (err) + return -1; - if (err || !data[2]) + termdata->status = data[0]; + + if (actual < 3 || !data[2]) return -1; grub_dprintf ("usb_keyboard", @@ -196,161 +220,50 @@ grub_usb_keyboard_checkkey (struct grub_term_input *term) /* Check if the Control or Shift key was pressed. */ if (data[0] & 0x01 || data[0] & 0x10) - key = keyboard_map[data[2]] - 'a' + 1; + termdata->key = keyboard_map[data[2]] - 'a' + 1; else if (data[0] & 0x02 || data[0] & 0x20) - key = keyboard_map_shift[data[2]]; + termdata->key = keyboard_map_shift[data[2]]; else - key = keyboard_map[data[2]]; + termdata->key = keyboard_map[data[2]]; - if (key == 0) + if (termdata->key == 0) grub_printf ("Unknown key 0x%x detected\n", data[2]); -#if 0 - /* Wait until the key is released. */ - while (!err && data[2]) - { - err = grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_IN, - USB_HID_GET_REPORT, 0, 0, - sizeof (data), (char *) data); - grub_dprintf ("usb_keyboard", - "report2: 0x%02x 0x%02x 0x%02x 0x%02x" - " 0x%02x 0x%02x 0x%02x 0x%02x\n", - data[0], data[1], data[2], data[3], - data[4], data[5], data[6], data[7]); - } -#endif - grub_errno = GRUB_ERR_NONE; - return key; + return termdata->key; } -typedef enum -{ - GRUB_HIDBOOT_REPEAT_NONE, - GRUB_HIDBOOT_REPEAT_FIRST, - GRUB_HIDBOOT_REPEAT -} grub_usb_keyboard_repeat_t; - static int grub_usb_keyboard_getkey (struct grub_term_input *term) { - int key; - grub_err_t err; - grub_uint8_t data[8]; - grub_uint64_t currtime; - int timeout; - static grub_usb_keyboard_repeat_t repeat = GRUB_HIDBOOT_REPEAT_NONE; - grub_usb_device_t usbdev = term->data; + int ret; + struct grub_usb_keyboard_data *termdata = term->data; - again: + while (termdata->key == -1) + grub_usb_keyboard_checkkey (term); - do - { - key = grub_usb_keyboard_checkkey (term); - } while (key == -1); + ret = termdata->key; - data[2] = !0; /* Or whatever. */ - err = 0; + termdata->key = -1; - switch (repeat) - { - case GRUB_HIDBOOT_REPEAT_FIRST: - timeout = 500; - break; - case GRUB_HIDBOOT_REPEAT: - timeout = 50; - break; - default: - timeout = 100; - break; - } - - /* Wait until the key is released. */ - currtime = grub_get_time_ms (); - while (!err && data[2]) - { - /* Implement a timeout. */ - if (grub_get_time_ms () > currtime + timeout) - { - if (repeat == 0) - repeat = 1; - else - repeat = 2; - - grub_errno = GRUB_ERR_NONE; - return key; - } - - err = grub_usb_keyboard_getreport (usbdev, data); - } - - if (repeat) - { - repeat = 0; - goto again; - } - - repeat = 0; - - grub_errno = GRUB_ERR_NONE; - - return key; + return ret; } static int grub_usb_keyboard_getkeystatus (struct grub_term_input *term) { - grub_uint8_t data[8]; + struct grub_usb_keyboard_data *termdata = term->data; int mods = 0; - grub_err_t err; - grub_uint64_t currtime; - int timeout = 50; - grub_usb_device_t usbdev = term->data; - - /* Set idle time to the minimum offered by the spec (4 milliseconds) so - that we can find out the current state. */ - grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, - USB_HID_SET_IDLE, 0<<8, 0, 0, 0); - - currtime = grub_get_time_ms (); - do - { - /* Get_Report. */ - err = grub_usb_keyboard_getreport (usbdev, data); - - /* Implement a timeout. */ - if (grub_get_time_ms () > currtime + timeout) - break; - } - while (err || !data[0]); - - /* Go back to reporting every time an event occurs and not more often than - that. */ - grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, - USB_HID_SET_IDLE, 0<<8, 0, 0, 0); - - /* We allowed a while for modifiers to show up in the report, but it is - not an error if they never did. */ - if (err) - return -1; - - grub_dprintf ("usb_keyboard", - "report: 0x%02x 0x%02x 0x%02x 0x%02x" - " 0x%02x 0x%02x 0x%02x 0x%02x\n", - data[0], data[1], data[2], data[3], - data[4], data[5], data[6], data[7]); /* Check Shift, Control, and Alt status. */ - if (data[0] & 0x02 || data[0] & 0x20) + if (termdata->status & 0x02 || termdata->status & 0x20) mods |= GRUB_TERM_STATUS_SHIFT; - if (data[0] & 0x01 || data[0] & 0x10) + if (termdata->status & 0x01 || termdata->status & 0x10) mods |= GRUB_TERM_STATUS_CTRL; - if (data[0] & 0x04 || data[0] & 0x40) + if (termdata->status & 0x04 || termdata->status & 0x40) mods |= GRUB_TERM_STATUS_ALT; - grub_errno = GRUB_ERR_NONE; - return mods; } From 3d9d3542972693ecedc0d3de595c18ef61472298 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 20 Aug 2010 18:21:31 +0530 Subject: [PATCH 139/174] generate gcry rules from import_gcry --- .bzrignore | 6 +- Makefile.am | 3 +- modules.def => Makefile.util.def | 0 autogen.sh | 15 ++- conf/Makefile.common | 24 ++++ gentpl.py | 11 -- grub-core/Makefile.am | 3 +- grub-core/{modules.def => Makefile.core.def} | 134 ------------------- util/import_gcry.py | 18 +-- 9 files changed, 49 insertions(+), 165 deletions(-) rename modules.def => Makefile.util.def (100%) rename grub-core/{modules.def => Makefile.core.def} (90%) diff --git a/.bzrignore b/.bzrignore index 1672efd65..3c7150afb 100644 --- a/.bzrignore +++ b/.bzrignore @@ -19,7 +19,6 @@ config.status config.sub configure conf/*.mk -conf/gcry.rmk *.d DISTLIST docs/*.info @@ -80,7 +79,6 @@ trigtables.c update-grub_lib unidata.c Makefile.in -modules.am GPATH GRTAGS GSYMS @@ -93,3 +91,7 @@ texinfo.tex grub-core/lib/libgcrypt-grub **/.deps-util **/.deps-core +Makefile.util.am +grub-core/Makefile.core.am +grub-core/Makefile.gcry.am +grub-core/Makefile.gcry.def diff --git a/Makefile.am b/Makefile.am index ed482eea2..b0d374b75 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,7 +16,7 @@ LDFLAGS_PROGRAM += $(LDFLAGS_GNULIB) CPPFLAGS_PROGRAM += $(CPPFLAGS_GNULIB) CCASFLAGS_PROGRAM += $(CCASFLAGS_GNULIB) -include $(srcdir)/modules.am +include $(srcdir)/Makefile.util.am # XXX Use Automake's LEX & YACC support grub_script.tab.h: $(top_srcdir)/grub-core/script/parser.y @@ -82,3 +82,4 @@ CLEANFILES += widthspec.h # Install config.h into platformdir platform_HEADERS = config.h + diff --git a/modules.def b/Makefile.util.def similarity index 100% rename from modules.def rename to Makefile.util.def diff --git a/autogen.sh b/autogen.sh index 60139cfb3..31a269e0f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,19 +4,20 @@ set -e autogen --version >/dev/null || (echo autogen missing; exit 1) -echo "Creating Makefile.tpl..." -python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl - -echo "Running autogen..." -autogen -T Makefile.tpl modules.def | sed -e '/^$/{N;/^\n$/D;}' > modules.am -autogen -T Makefile.tpl grub-core/modules.def | sed -e '/^$/{N;/^\n$/D;}' > grub-core/modules.am - echo "Importing unicode..." python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c echo "Importing libgcrypt..." python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core +echo "Creating Makefile.tpl..." +python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl + +echo "Running autogen..." +autogen -T Makefile.tpl Makefile.util.def | sed -e '/^$/{N;/^\n$/D;}' > Makefile.util.am +autogen -T Makefile.tpl grub-core/Makefile.core.def | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.core.am +autogen -T Makefile.tpl grub-core/Makefile.gcry.def | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.gcry.am + echo "Saving timestamps..." echo timestamp > stamp-h.in diff --git a/conf/Makefile.common b/conf/Makefile.common index 47067596b..3bb8b9c0e 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -1,3 +1,5 @@ +# -*- makefile -*- + # Platform specific options if COND_i386_pc CFLAGS_PLATFORM = -mrtd -mregparm=3 @@ -117,3 +119,25 @@ TESTS = EXTRA_DIST = CLEANFILES = BUILT_SOURCES = + +# Rules for autogen definition files + +.PRECIOUS: $(top_srcdir)/Makefile.tpl +$(top_srcdir)/Makefile.tpl: $(top_srcdir)/gentpl.py + python $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) + mv $@.new $@ + +.PRECIOUS: $(top_srcdir)/Makefile.util.am +$(top_srcdir)/Makefile.util.am: $(top_srcdir)/Makefile.util.def $(top_srcdir)/Makefile.tpl + autogen -T $(top_srcdir)/Makefile.tpl $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) + mv $@.new $@ + +.PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am +$(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/Makefile.tpl + autogen -T $(top_srcdir)/Makefile.tpl $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) + mv $@.new $@ + +.PRECIOUS: $(top_srcdir)/grub-core/Makefile.gcry.am +$(top_srcdir)/grub-core/Makefile.gcry.am: $(top_srcdir)/grub-core/Makefile.gcry.def $(top_srcdir)/Makefile.tpl + autogen -T $(top_srcdir)/Makefile.tpl $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) + mv $@.new $@ diff --git a/gentpl.py b/gentpl.py index 632b4c13e..59950bb0e 100644 --- a/gentpl.py +++ b/gentpl.py @@ -448,14 +448,3 @@ print d print e print f print g - -print """.PRECIOUS: modules.am -$(srcdir)/modules.am: $(srcdir)/modules.def $(top_srcdir)/Makefile.tpl - autogen -T $(top_srcdir)/Makefile.tpl $(srcdir)/modules.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) - mv $@.new $@ - -.PRECIOUS: $(top_srcdir)/Makefile.tpl -$(top_srcdir)/Makefile.tpl: $(top_srcdir)/gentpl.py - python $(top_srcdir)/gentpl.py | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1) - mv $@.new $@ -""" diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index d91448149..770f1a6bb 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -45,7 +45,8 @@ grub_script.yy.h: script/yylex.l grub_script.yy.c: grub_script.yy.h CLEANFILES += grub_script.yy.c grub_script.yy.h -include $(srcdir)/modules.am +include $(srcdir)/Makefile.core.am +include $(srcdir)/Makefile.gcry.am KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h diff --git a/grub-core/modules.def b/grub-core/Makefile.core.def similarity index 90% rename from grub-core/modules.def rename to grub-core/Makefile.core.def index fa830e779..73caf0771 100644 --- a/grub-core/modules.def +++ b/grub-core/Makefile.core.def @@ -1049,140 +1049,6 @@ module = { extra_dist = lib/libgcrypt-grub/cipher/crypto.lst; }; -module = { - name = gcry_arcfour; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/arcfour.c; -}; - -module = { - name = gcry_blowfish; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/blowfish.c; -}; - -module = { - name = gcry_camellia; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/camellia.c; - source = lib/libgcrypt-grub/cipher/camellia-glue.c; -}; - -module = { - name = gcry_cast5; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/cast5.c; -}; - -module = { - name = gcry_crc; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/crc.c; -}; - -module = { - name = gcry_des; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/des.c; -}; - -module = { - name = gcry_md4; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/md4.c; -}; - -module = { - name = gcry_md5; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/md5.c; -}; - -module = { - name = gcry_rfc2268; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/rfc2268.c; -}; - -module = { - name = gcry_rijndael; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/rijndael.c; -}; - -module = { - name = gcry_rmd160; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/rmd160.c; -}; - -module = { - name = gcry_seed; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/seed.c; -}; - -module = { - name = gcry_serpent; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/serpent.c; -}; - -module = { - name = gcry_sha1; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/sha1.c; -}; - -module = { - name = gcry_sha256; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/sha256.c; -}; - -module = { - name = gcry_sha512; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/sha512.c; -}; - -module = { - name = gcry_tiger; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/tiger.c; -}; - -module = { - name = gcry_twofish; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/twofish.c; -}; - -module = { - name = gcry_whirlpool; - cflags = '$(CFLAGS_GCRY)'; - cppflags = '$(CPPFLAGS_GCRY)'; - source = lib/libgcrypt-grub/cipher/whirlpool.c; -}; - module = { name = pbkdf2; source = lib/pbkdf2.c; diff --git a/util/import_gcry.py b/util/import_gcry.py index b63fb5501..6280f001e 100644 --- a/util/import_gcry.py +++ b/util/import_gcry.py @@ -40,8 +40,8 @@ except: print ("WARNING: %s already exists" % cipher_dir_out) cipher_files = os.listdir (cipher_dir_in) -conf = open (os.path.join ("conf", "gcry.rmk"), "w") -conf.write ("# -*- makefile -*-\n\n") +conf = open (os.path.join ("grub-core", "Makefile.gcry.def"), "w") +conf.write ("AutoGen definitions Makefile.tpl;\n\n") chlog = "" # Strictly speaking CRC32/CRC24 work on bytes so this value should be 1 @@ -62,7 +62,6 @@ mdblocksizes = {"_gcry_digest_spec_crc32" : 64, "_gcry_digest_spec_whirlpool" : 64} cryptolist = open (os.path.join (cipher_dir_out, "crypto.lst"), "w") -conf.write ("MAINTAINER_CLEANFILES += $(srcdir)/conf/gcry.rmk $(srcdir)/lib/libgcrypt-grub/cipher/ChangeLog $(srcdir)/lib/libgcrypt-grub/cipher/cipher.h $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst $(srcdir)/lib/libgcrypt-grub/cipher/g10lib.h $(srcdir)/lib/libgcrypt-grub/cipher/memory.h $(srcdir)/lib/libgcrypt-grub/cipher/types.h\n"); # rijndael is the only cipher using aliases. So no need for mangling, just # hardcode it @@ -88,7 +87,6 @@ for cipher_file in cipher_files: continue nch = False if re.match (".*\.[ch]$", cipher_file): - conf.write ("MAINTAINER_CLEANFILES += $(srcdir)/lib/libgcrypt-grub/cipher/" + cipher_file + "\n"); isc = re.match (".*\.c$", cipher_file) f = open (infile, "r") fw = open (outfile, "w") @@ -276,11 +274,13 @@ for cipher_file in cipher_files: chlognew = "%s\n %s" % (chlognew, chmsg) fw.write (" grub_md_unregister (&%s);\n" % mdname) fw.write ("}\n") - conf.write ("pkglib_MODULES += %s.mod\n" % modname) - conf.write ("%s_mod_SOURCES = %s\n" %\ - (modname, modfiles)) - conf.write ("%s_mod_CFLAGS = $(COMMON_CFLAGS) -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap\n" % modname) - conf.write ("%s_mod_LDFLAGS = $(COMMON_LDFLAGS)\n\n" % modname) + conf.write ("module = {\n") + conf.write (" name = %s;\n" % modname) + for src in modfiles.split(): + conf.write (" source = %s;\n" % src) + conf.write (" cflags = '$(CFLAGS_GCRY)';\n"); + conf.write (" cppflags = '$(CPPFLAGS_GCRY)';\n"); + conf.write ("};\n\n") elif isc and cipher_file != "camellia.c": print ("WARNING: C file isn't a module: %s" % cipher_file) f.close () From 34cf2b8aea3dd9434a894185437eeccd41dafc2f Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 20 Aug 2010 18:47:22 +0530 Subject: [PATCH 140/174] fix distcheck --- conf/Makefile.extra-dist | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist index ae4b8fbde..60feea34f 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -4,15 +4,17 @@ EXTRA_DIST += autogen.sh EXTRA_DIST += geninit.sh EXTRA_DIST += gentpl.py -EXTRA_DIST += modules.def EXTRA_DIST += Makefile.tpl +EXTRA_DIST += Makefile.util.def EXTRA_DIST += docs/man EXTRA_DIST += docs/grub.cfg EXTRA_DIST += conf/i386-pc-cygwin-img-ld.sc -EXTRA_DIST += grub-core/modules.def +EXTRA_DIST += grub-core/Makefile.core.def +EXTRA_DIST += grub-core/Makefile.gcry.def + EXTRA_DIST += grub-core/genmoddep.awk EXTRA_DIST += grub-core/genmodsrc.sh EXTRA_DIST += grub-core/genfslist.sh From 9ba74de61a9c6adfe14bf51a3226111e645a6c18 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 16:34:34 +0200 Subject: [PATCH 141/174] Scan descriptor rather than elying on hardcoded endpoint number --- include/grub/usb.h | 14 ++++++++++++++ term/usb_keyboard.c | 21 +++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/include/grub/usb.h b/include/grub/usb.h index b2dc77ce4..5d0eb2082 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -181,6 +181,20 @@ struct grub_usb_device +typedef enum grub_usb_ep_type + { + GRUB_USB_EP_CONTROL, + GRUB_USB_EP_ISOCHRONOUS, + GRUB_USB_EP_BULK, + GRUB_USB_EP_INTERRUPT + } grub_usb_ep_type_t; + +static inline enum grub_usb_ep_type +grub_usb_get_ep_type (struct grub_usb_desc_endp *ep) +{ + return ep->attrib & 3; +} + typedef enum { GRUB_USB_CLASS_NOTHERE, diff --git a/term/usb_keyboard.c b/term/usb_keyboard.c index d318a04ff..5fcb570b7 100644 --- a/term/usb_keyboard.c +++ b/term/usb_keyboard.c @@ -83,6 +83,7 @@ struct grub_usb_keyboard_data grub_usb_device_t usbdev; grub_uint8_t status; int key; + struct grub_usb_desc_endp *endp; }; static struct grub_term_input grub_usb_keyboards[16]; @@ -109,6 +110,8 @@ grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) { unsigned curnum; struct grub_usb_keyboard_data *data; + struct grub_usb_desc_endp *endp = NULL; + int j; grub_dprintf ("usb_keyboard", "%x %x %x %d %d\n", usbdev->descdev.class, usbdev->descdev.subclass, @@ -131,6 +134,18 @@ grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) != USB_HID_KBD_PROTOCOL) return 0; + for (j = 0; j < usbdev->config[configno].interf[interfno].descif->endpointcnt; + j++) + { + endp = &usbdev->config[configno].interf[interfno].descendp[j]; + + if ((endp->endp_addr & 128) && grub_usb_get_ep_type(endp) + == GRUB_USB_EP_INTERRUPT) + break; + } + if (j == usbdev->config[configno].interf[interfno].descif->endpointcnt) + return 0; + grub_printf ("HID found!\n"); data = grub_malloc (sizeof (*data)); @@ -141,6 +156,7 @@ grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) } data->usbdev = usbdev; + data->endp = endp; /* Place the device in boot mode. */ grub_usb_control_msg (usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, @@ -201,8 +217,9 @@ grub_usb_keyboard_checkkey (struct grub_term_input *term) data[2] = 0; /* Poll interrupt pipe. */ - err = grub_usb_bulk_read_extended (termdata->usbdev, 1, sizeof (data), - (char *) data, 1, &actual); + err = grub_usb_bulk_read_extended (termdata->usbdev, + termdata->endp->endp_addr, sizeof (data), + (char *) data, 10, &actual); if (err) return -1; From 21a313dedc50ebb175f930199de4d915882cc14b Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Fri, 20 Aug 2010 16:36:07 +0200 Subject: [PATCH 142/174] 2010-08-20 Robert Millan Make kFreeBSD code more generic to support ext2fs as root, ufs as a separate module and maybe other interesting combinations. * util/grub.d/10_kfreebsd.in (load_kfreebsd_module): New function. (kfreebsd_entry): Use load_kfreebsd_module() to load modules. (kfreebsd_entry): Add generic filesystem module load routine. Map GRUB `ext2' to kFreeBSD `ext2fs'. --- ChangeLog | 10 +++++++ util/grub.d/10_kfreebsd.in | 54 +++++++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d82e08fb..fa2178875 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-08-20 Robert Millan + + Make kFreeBSD code more generic to support ext2fs as root, ufs as + a separate module and maybe other interesting combinations. + + * util/grub.d/10_kfreebsd.in (load_kfreebsd_module): New function. + (kfreebsd_entry): Use load_kfreebsd_module() to load modules. + (kfreebsd_entry): Add generic filesystem module load routine. + Map GRUB `ext2' to kFreeBSD `ext2fs'. + 2010-08-20 Colin Watson * commands/i386/pc/sendkey.c (keysym_table): Rename "numlock" to diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in index 3a42de529..40ac240c7 100644 --- a/util/grub.d/10_kfreebsd.in +++ b/util/grub.d/10_kfreebsd.in @@ -39,6 +39,31 @@ case "${GRUB_DISTRIBUTOR}" in ;; esac +load_kfreebsd_module () +{ + mod="$1" + allow_fail="$2" + + if ! test -e "${module_dir}/${mod}.ko" ; then + if [ "${allow_fail}" = "true" ] ; then + # Return silently + return + else + # Print an error and fail. + ls "${module_dir}/${mod}.ko" > /dev/null + fi + fi + + if [ -z "${prepare_module_dir_cache}" ]; then + prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | sed -e "s/^/\t/")" + fi + + printf '%s\n' "${prepare_module_dir_cache}" + cat << EOF + kfreebsd_module_elf ${module_dir_rel}/${mod}.ko +EOF +} + kfreebsd_entry () { os="$1" @@ -51,9 +76,6 @@ kfreebsd_entry () if [ -z "${prepare_boot_cache}" ]; then prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" fi - if [ -z "${prepare_module_dir_cache}" ]; then - prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | sed -e "s/^/\t/")" - fi printf '%s\n' "${prepare_boot_cache}" cat << EOF @@ -67,26 +89,13 @@ EOF EOF fi - if test -e "${module_dir}/acpi.ko" ; then - printf '%s\n' "${prepare_module_dir_cache}" - cat << EOF - kfreebsd_module_elf ${module_dir_rel}/acpi.ko -EOF - fi + load_kfreebsd_module acpi true case "${kfreebsd_fs}" in zfs) - for i in "${module_dir}/opensolaris.ko" "${module_dir}/zfs.ko" \ - "${dirname}/zfs/zpool.cache" ; do - ls "$i" > /dev/null - done - - printf '%s\n' "${prepare_module_dir_cache}" - cat << EOF - kfreebsd_module_elf ${module_dir_rel}/opensolaris.ko - kfreebsd_module_elf ${module_dir_rel}/zfs.ko -EOF + load_kfreebsd_module opensolaris false + ls "${dirname}/zfs/zpool.cache" > /dev/null printf '%s\n' "${prepare_boot_cache}" cat << EOF kfreebsd_module ${rel_dirname}/zfs/zpool.cache type=/boot/zfs/zpool.cache @@ -94,6 +103,8 @@ EOF ;; esac + load_kfreebsd_module ${kfreebsd_fs} false + cat << EOF set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${kfreebsd_device} set kFreeBSD.vfs.root.mountfrom.options=rw @@ -121,8 +132,9 @@ while [ "x$list" != "x" ] ; do fi case ${GRUB_FS} in - ufs1 | ufs2) kfreebsd_fs=ufs ;; - *) kfreebsd_fs=${GRUB_FS} ;; + ufs1 | ufs2) kfreebsd_fs=ufs ;; + ext2) kfreebsd_fs=ext2fs ;; + *) kfreebsd_fs=${GRUB_FS} ;; esac case ${GRUB_FS} in From 15bd1f9ccfa4405626b9e733505497ed3899758b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 16:49:24 +0200 Subject: [PATCH 143/174] Don't update status on 0 message --- term/usb_keyboard.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/term/usb_keyboard.c b/term/usb_keyboard.c index 5fcb570b7..62f5df352 100644 --- a/term/usb_keyboard.c +++ b/term/usb_keyboard.c @@ -220,8 +220,7 @@ grub_usb_keyboard_checkkey (struct grub_term_input *term) err = grub_usb_bulk_read_extended (termdata->usbdev, termdata->endp->endp_addr, sizeof (data), (char *) data, 10, &actual); - - if (err) + if (err || actual < 1) return -1; termdata->status = data[0]; From 24582ab39b8353f4acae89f2a377f3f8eca60977 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 16:56:03 +0200 Subject: [PATCH 144/174] Correct *actual counting in OHCI --- bus/usb/ohci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bus/usb/ohci.c b/bus/usb/ohci.c index aa96ed5e6..39e47ffee 100644 --- a/bus/usb/ohci.c +++ b/bus/usb/ohci.c @@ -989,6 +989,7 @@ grub_ohci_transfer (grub_usb_controller_t dev, transfer->last_trans = tderr_virt->tr_index; else transfer->last_trans = -1; + *actual = transfer->size; } else if (err_halt) /* error, ED is halted by OHCI, i.e. can be modified */ @@ -1178,8 +1179,6 @@ grub_ohci_transfer (grub_usb_controller_t dev, else transfer->last_trans = -1; } - else - *actual = transfer->size; /* Set empty ED - set HEAD = TAIL = last (not processed) TD */ ed_virt->td_head = grub_cpu_to_le32 (grub_le_to_cpu32 (ed_virt->td_tail) & ~0xf); From a71e47197598e709e23281a07b2af99337aa51fa Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 20 Aug 2010 21:01:13 +0530 Subject: [PATCH 145/174] fix distcheck from source tree --- conf/Makefile.extra-dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist index 60feea34f..17a169284 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -1,4 +1,4 @@ -EXTRA_DIST += include +EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h') EXTRA_DIST += autogen.sh EXTRA_DIST += geninit.sh From 00d064849105356cbb239ded246d257eaeb79f68 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Fri, 20 Aug 2010 22:34:19 +0530 Subject: [PATCH 146/174] fix emu build on netbsd --- grub-core/Makefile.core.def | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 73caf0771..83aa3b1db 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -249,7 +249,7 @@ program = { ldadd = 'kernel.img$(EXEEXT)'; ldadd = '$(MODULE_FILES)'; - ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)'; + ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)'; enable = emu; }; @@ -262,7 +262,7 @@ program = { nodist = symlist.c; ldadd = 'kernel.img$(EXEEXT)'; - ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)'; + ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)'; enable = emu; }; From 60c1ffdfdc325c571bab525e2608a943f87343b5 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 19:33:44 +0200 Subject: [PATCH 147/174] Fix OHCI error message --- bus/usb/ohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bus/usb/ohci.c b/bus/usb/ohci.c index 39e47ffee..974bed6cd 100644 --- a/bus/usb/ohci.c +++ b/bus/usb/ohci.c @@ -1036,7 +1036,7 @@ grub_ohci_transfer (grub_usb_controller_t dev, { case 0: /* XXX: Should not happen! */ - grub_error (GRUB_ERR_IO, "OHCI without reporting the reason"); + grub_error (GRUB_ERR_IO, "OHCI failed without reporting the reason"); err = GRUB_USB_ERR_INTERNAL; break; From 52d8255d2021ce28ce89a351750c50b27b273cf6 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 19:34:29 +0200 Subject: [PATCH 148/174] Support hot unplugging --- bus/usb/usb.c | 13 +++++- bus/usb/usbhub.c | 107 +++++++++++++++++++++++++++++--------------- disk/usbms.c | 10 ++--- include/grub/term.h | 1 + include/grub/usb.h | 6 +++ kern/term.c | 11 +++++ term/usb_keyboard.c | 23 ++++++---- 7 files changed, 120 insertions(+), 51 deletions(-) diff --git a/bus/usb/usb.c b/bus/usb/usb.c index b3eaeba0e..2bd805ef2 100644 --- a/bus/usb/usb.c +++ b/bus/usb/usb.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include static grub_usb_controller_dev_t grub_usb_list; struct grub_usb_attach_desc *attach_hooks; @@ -334,3 +334,14 @@ grub_usb_unregister_attach_hook_class (struct grub_usb_attach_desc *desc) { grub_list_remove (GRUB_AS_LIST_P (&attach_hooks), GRUB_AS_LIST (desc)); } + + +GRUB_MOD_INIT(usb) +{ + grub_term_poll_usb = grub_usb_poll_devices; +} + +GRUB_MOD_FINI(usb) +{ + grub_term_poll_usb = NULL; +} diff --git a/bus/usb/usbhub.c b/bus/usb/usbhub.c index 6c14f4b8d..7f2c8d24b 100644 --- a/bus/usb/usbhub.c +++ b/bus/usb/usbhub.c @@ -33,7 +33,7 @@ struct grub_usb_hub struct grub_usb_hub *next; grub_usb_controller_t controller; int nports; - grub_usb_speed_t *speed; + struct grub_usb_device **devices; grub_usb_device_t dev; }; @@ -104,7 +104,7 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed) } -static grub_err_t +static grub_usb_err_t grub_usb_add_hub (grub_usb_device_t dev) { struct grub_usb_usb_hubdesc hubdesc; @@ -112,6 +112,7 @@ grub_usb_add_hub (grub_usb_device_t dev) int i; grub_uint64_t timeout; grub_usb_device_t next_dev; + grub_usb_device_t *attached_devices; err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN | GRUB_USB_REQTYPE_CLASS @@ -130,6 +131,13 @@ grub_usb_add_hub (grub_usb_device_t dev) grub_dprintf ("usb", "Hub set configuration\n"); grub_usb_set_configuration (dev, 1); + attached_devices = grub_zalloc (hubdesc.portcnt + * sizeof (attached_devices[0])); + if (!attached_devices) + return GRUB_USB_ERR_INTERNAL; + dev->children = attached_devices; + dev->nports = hubdesc.portcnt; + /* Power on all Hub ports. */ for (i = 1; i <= hubdesc.portcnt; i++) { @@ -236,6 +244,8 @@ grub_usb_add_hub (grub_usb_device_t dev) if (! next_dev) continue; + attached_devices[i - 1] = next_dev; + /* If the device is a Hub, scan it for more devices. */ if (next_dev->descdev.class == 0x09) grub_usb_add_hub (next_dev); @@ -246,27 +256,29 @@ grub_usb_add_hub (grub_usb_device_t dev) } static void -attach_root_port (grub_usb_controller_t controller, int portno, +attach_root_port (struct grub_usb_hub *hub, int portno, grub_usb_speed_t speed) { grub_usb_device_t dev; grub_err_t err; /* Disable the port. XXX: Why? */ - err = controller->dev->portstatus (controller, portno, 0); + err = hub->controller->dev->portstatus (hub->controller, portno, 0); if (err) return; /* Enable the port. */ - err = controller->dev->portstatus (controller, portno, 1); + err = hub->controller->dev->portstatus (hub->controller, portno, 1); if (err) return; /* Enable the port and create a device. */ - dev = grub_usb_hub_add_dev (controller, speed); + dev = grub_usb_hub_add_dev (hub->controller, speed); if (! dev) return; + hub->devices[portno] = dev; + /* If the device is a Hub, scan it for more devices. */ if (dev->descdev.class == 0x09) grub_usb_add_hub (dev); @@ -297,8 +309,8 @@ grub_usb_root_hub (grub_usb_controller_t controller) /* Query the number of ports the root Hub has. */ hub->nports = controller->dev->hubports (controller); - hub->speed = grub_malloc (sizeof (hub->speed[0]) * hub->nports); - if (!hub->speed) + hub->devices = grub_zalloc (sizeof (hub->devices[0]) * hub->nports); + if (!hub->devices) { grub_free (hub->controller); grub_free (hub); @@ -307,36 +319,54 @@ grub_usb_root_hub (grub_usb_controller_t controller) for (i = 0; i < hub->nports; i++) { - hub->speed[i] = controller->dev->detect_dev (hub->controller, i, - &changed); + grub_usb_speed_t speed; + speed = controller->dev->detect_dev (hub->controller, i, + &changed); - if (hub->speed[i] != GRUB_USB_SPEED_NONE) - attach_root_port (hub->controller, i, hub->speed[i]); + if (speed != GRUB_USB_SPEED_NONE) + attach_root_port (hub, i, speed); } return GRUB_USB_ERR_NONE; } +static void detach_device (grub_usb_device_t dev); + +static void +detach_device (grub_usb_device_t dev) +{ + unsigned i; + int k; + if (!dev) + return; + if (dev->descdev.class == GRUB_USB_CLASS_HUB) + { + for (i = 0; i < dev->nports; i++) + detach_device (dev->children[i]); + grub_free (dev->children); + } + for (i = 0; i < ARRAY_SIZE (dev->config); i++) + if (dev->config[i].descconf) + for (k = 0; k < dev->config[i].descconf->numif; k++) + { + struct grub_usb_interface *inter = &dev->config[i].interf[k]; + if (inter && inter->detach_hook) + inter->detach_hook (dev, i, k); + } + grub_usb_devs[dev->addr] = 0; +} + static void poll_nonroot_hub (grub_usb_device_t dev) { - struct grub_usb_usb_hubdesc hubdesc; grub_err_t err; - int i; + unsigned i; grub_uint64_t timeout; grub_usb_device_t next_dev; - - err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN - | GRUB_USB_REQTYPE_CLASS - | GRUB_USB_REQTYPE_TARGET_DEV), - GRUB_USB_REQ_GET_DESCRIPTOR, - (GRUB_USB_DESCRIPTOR_HUB << 8) | 0, - 0, sizeof (hubdesc), (char *) &hubdesc); - if (err) - return; - + grub_usb_device_t *attached_devices = dev->children; + /* Iterate over the Hub ports. */ - for (i = 1; i <= hubdesc.portcnt; i++) + for (i = 1; i <= dev->nports; i++) { grub_uint32_t status; @@ -350,6 +380,12 @@ poll_nonroot_hub (grub_usb_device_t dev) status. */ if (err) continue; + + if (status & GRUB_USB_HUB_STATUS_C_CONNECTED) + { + detach_device (attached_devices[i-1]); + attached_devices[i - 1] = NULL; + } /* Connected and status of connection changed ? */ if ((status & GRUB_USB_HUB_STATUS_CONNECTED) @@ -417,6 +453,8 @@ poll_nonroot_hub (grub_usb_device_t dev) if (! next_dev) continue; + attached_devices[i - 1] = next_dev; + /* If the device is a Hub, scan it for more devices. */ if (next_dev->descdev.class == 0x09) grub_usb_add_hub (next_dev); @@ -434,26 +472,23 @@ grub_usb_poll_devices (void) for (hub = hubs; hub; hub = hub->next) { - int changed=0; /* Do we have to recheck number of ports? */ /* No, it should be never changed, it should be constant. */ for (i = 0; i < hub->nports; i++) { grub_usb_speed_t speed; + int changed = 0; speed = hub->controller->dev->detect_dev (hub->controller, i, &changed); - if (speed != GRUB_USB_SPEED_NONE) + if (changed) { - if (changed) - attach_root_port (hub->controller, i, speed); + detach_device (hub->devices[i]); + hub->devices[i] = NULL; + if (speed != GRUB_USB_SPEED_NONE) + attach_root_port (hub, i, speed); } - - /* XXX: There should be also handling - * of disconnected devices. */ - - hub->speed[i] = speed; } } @@ -463,9 +498,7 @@ grub_usb_poll_devices (void) grub_usb_device_t dev = grub_usb_devs[i]; if (dev && dev->descdev.class == 0x09) - { - poll_nonroot_hub (dev); - } + poll_nonroot_hub (dev); } } diff --git a/disk/usbms.c b/disk/usbms.c index 225761e0f..e63105ccc 100644 --- a/disk/usbms.c +++ b/disk/usbms.c @@ -65,6 +65,7 @@ typedef struct grub_usbms_dev *grub_usbms_dev_t; /* FIXME: remove limit. */ #define MAX_USBMS_DEVICES 128 static grub_usbms_dev_t grub_usbms_devices[MAX_USBMS_DEVICES]; +static int first_available_slot = 0; static grub_err_t grub_usbms_reset (grub_usb_device_t dev, int interface) @@ -96,13 +97,12 @@ grub_usbms_attach (grub_usb_device_t usbdev, int configno, int interfno) unsigned curnum; grub_usb_err_t err; - for (curnum = 0; curnum < ARRAY_SIZE (grub_usbms_devices); curnum++) - if (!grub_usbms_devices[curnum]) - break; - - if (curnum == ARRAY_SIZE (grub_usbms_devices)) + if (first_available_slot == ARRAY_SIZE (grub_usbms_devices)) return 0; + curnum = first_available_slot; + first_available_slot++; + interf = usbdev->config[configno].interf[interfno].descif; if ((interf->subclass != GRUB_USBMS_SUBCLASS_BULK diff --git a/include/grub/term.h b/include/grub/term.h index f40d935e4..734e4ab17 100644 --- a/include/grub/term.h +++ b/include/grub/term.h @@ -459,6 +459,7 @@ grub_print_spaces (struct grub_term_output *term, int number_spaces) grub_putcode (' ', term); } +extern void (*EXPORT_VAR (grub_term_poll_usb)) (void); /* For convenience. */ #define GRUB_TERM_ASCII_CHAR(c) ((c) & 0xff) diff --git a/include/grub/usb.h b/include/grub/usb.h index 5d0eb2082..674f7ec46 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -177,6 +177,12 @@ struct grub_usb_device /* Data toggle values (used for bulk transfers only). */ int toggle[256]; + + /* Array of children for a hub. */ + grub_usb_device_t *children; + + /* Number of hub ports. */ + unsigned nports; }; diff --git a/kern/term.c b/kern/term.c index 47bd426fd..360539e50 100644 --- a/kern/term.c +++ b/kern/term.c @@ -28,6 +28,8 @@ struct grub_term_input *grub_term_inputs_disabled; struct grub_term_output *grub_term_outputs; struct grub_term_input *grub_term_inputs; +void (*grub_term_poll_usb) (void) = NULL; + /* Put a Unicode character. */ static void grub_putcode_dumb (grub_uint32_t code, @@ -85,6 +87,9 @@ grub_getkey (void) while (1) { + if (grub_term_poll_usb) + grub_term_poll_usb (); + FOR_ACTIVE_TERM_INPUTS(term) { int key = term->checkkey (term); @@ -101,6 +106,9 @@ grub_checkkey (void) { grub_term_input_t term; + if (grub_term_poll_usb) + grub_term_poll_usb (); + FOR_ACTIVE_TERM_INPUTS(term) { int key = term->checkkey (term); @@ -117,6 +125,9 @@ grub_getkeystatus (void) int status = 0; grub_term_input_t term; + if (grub_term_poll_usb) + grub_term_poll_usb (); + FOR_ACTIVE_TERM_INPUTS(term) { if (term->getkeystatus) diff --git a/term/usb_keyboard.c b/term/usb_keyboard.c index 62f5df352..b6bc05dbe 100644 --- a/term/usb_keyboard.c +++ b/term/usb_keyboard.c @@ -95,14 +95,21 @@ grub_usb_keyboard_detach (grub_usb_device_t usbdev, { unsigned i; for (i = 0; i < ARRAY_SIZE (grub_usb_keyboards); i++) - if (grub_usb_keyboards[i].data && grub_usb_keyboards[i].data == usbdev) - { - grub_term_unregister_input (&grub_usb_keyboards[i]); - grub_free ((char *) grub_usb_keyboards[i].name); - grub_usb_keyboards[i].name = NULL; - grub_free (grub_usb_keyboards[i].data); - grub_usb_keyboards[i].data = 0; - } + { + struct grub_usb_keyboard_data *data = grub_usb_keyboards[i].data; + + if (!data) + continue; + + if (data->usbdev != usbdev) + continue; + + grub_term_unregister_input (&grub_usb_keyboards[i]); + grub_free ((char *) grub_usb_keyboards[i].name); + grub_usb_keyboards[i].name = NULL; + grub_free (grub_usb_keyboards[i].data); + grub_usb_keyboards[i].data = 0; + } } static int From 2823526d28c3467accc7965fa8bd9fcce8df5fec Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 19:54:40 +0200 Subject: [PATCH 149/174] Acount for transfer->size being size-1 when counting *actual --- bus/usb/ohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bus/usb/ohci.c b/bus/usb/ohci.c index 974bed6cd..7f757485c 100644 --- a/bus/usb/ohci.c +++ b/bus/usb/ohci.c @@ -989,7 +989,7 @@ grub_ohci_transfer (grub_usb_controller_t dev, transfer->last_trans = tderr_virt->tr_index; else transfer->last_trans = -1; - *actual = transfer->size; + *actual = transfer->size + 1; } else if (err_halt) /* error, ED is halted by OHCI, i.e. can be modified */ From ccedc09bc702c4c7a1110b5527ebd2ae9ffac71d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 20:26:57 +0200 Subject: [PATCH 150/174] Make HID found dprintf instead of printf --- term/usb_keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/term/usb_keyboard.c b/term/usb_keyboard.c index b6bc05dbe..d875ac00a 100644 --- a/term/usb_keyboard.c +++ b/term/usb_keyboard.c @@ -153,7 +153,7 @@ grub_usb_keyboard_attach (grub_usb_device_t usbdev, int configno, int interfno) if (j == usbdev->config[configno].interf[interfno].descif->endpointcnt) return 0; - grub_printf ("HID found!\n"); + grub_dprintf ("usb_keyboard", "HID found!\n"); data = grub_malloc (sizeof (*data)); if (!data) From 2bd591d03ec75699072725f7993b8cd8d13b8728 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 21 Aug 2010 00:50:12 +0530 Subject: [PATCH 151/174] add USE_ASCII_FAILBACK define --- Makefile.am | 2 -- conf/Makefile.common | 1 + grub-core/Makefile.am | 6 ++++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index b0d374b75..a5c4a874d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -78,8 +78,6 @@ widthspec.h: widthspec.bin grub-bin2h $(builddir)/grub-bin2h widthspec < $< > $@ CLEANFILES += widthspec.h -# XXX: TARGET_CFLAGS += -DUSE_ASCII_FAILBACK=1 -DHAVE_UNIFONT_WIDTHSPEC=1 - # Install config.h into platformdir platform_HEADERS = config.h diff --git a/conf/Makefile.common b/conf/Makefile.common index 3bb8b9c0e..511813404 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -21,6 +21,7 @@ if COND_i386_ieee1275 endif if COND_mips_yeeloong CFLAGS_PLATFORM = -march=mips3 -mexplicit-relocs -mflush-func=grub_cpu_flush_cache + CPPFLAGS_PLATFORM = -DUSE_ASCII_FAILBACK CCASFLAGS_PLATFORM = -march=mips3 endif if COND_sparc64_ieee1275 diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index 770f1a6bb..cea7014b1 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -8,6 +8,12 @@ CC=$(TARGET_CC) CPP=$(TARGET_CC) CCAS=$(TARGET_CC) +if COND_GRUB_MKFONT +if COND_HAVE_FONT_SOURCE +TARGET_CFLAGS += -DUSE_ASCII_FAILBACK=1 -DHAVE_UNIFONT_WIDTHSPEC=1 +endif +endif + AM_CFLAGS = $(TARGET_CFLAGS) AM_LDFLAGS = $(TARGET_LDFLAGS) AM_CPPFLAGS = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT) From 1420c1d54a33ae75a8bd6b902fc8f9cb961d804d Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 21:25:20 +0200 Subject: [PATCH 152/174] Remove unused buffer0 --- bus/usb/uhci.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bus/usb/uhci.c b/bus/usb/uhci.c index 69fae60fd..0bba24b54 100644 --- a/bus/usb/uhci.c +++ b/bus/usb/uhci.c @@ -75,10 +75,8 @@ struct grub_uhci_td This is GRUB specific. */ grub_uint32_t linkptr2; - grub_uint32_t buffer0; - - /* 2 additional 32 bits words reserved for the Host Controller Driver. */ - grub_uint32_t data[2]; + /* 3 additional 32 bits words reserved for the Host Controller Driver. */ + grub_uint32_t data[3]; } __attribute__ ((packed)); typedef volatile struct grub_uhci_td *grub_uhci_td_t; @@ -436,7 +434,6 @@ grub_uhci_transaction (struct grub_uhci *u, unsigned int endp, | (addr << 8) | tf[type]); td->buffer = data; - td->buffer0 = data; return td; } From 41e46ae6484ba99a0a94965e393977fe941b681c Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 21:26:04 +0200 Subject: [PATCH 153/174] Enable usbserial on yeeloong --- conf/mips-yeeloong.rmk | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/conf/mips-yeeloong.rmk b/conf/mips-yeeloong.rmk index 365ca1ca5..90949866c 100644 --- a/conf/mips-yeeloong.rmk +++ b/conf/mips-yeeloong.rmk @@ -97,6 +97,24 @@ usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c usb_mod_CFLAGS = $(COMMON_CFLAGS) usb_mod_LDFLAGS = $(COMMON_LDFLAGS) +# For serial.mod. +pkglib_MODULES += usbserial_common.mod +usbserial_common_mod_SOURCES = bus/usb/serial/common.c +usbserial_common_mod_CFLAGS = $(COMMON_CFLAGS) +usbserial_common_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For serial.mod. +pkglib_MODULES += usbserial_pl2303.mod +usbserial_pl2303_mod_SOURCES = bus/usb/serial/pl2303.c +usbserial_pl2303_mod_CFLAGS = $(COMMON_CFLAGS) +usbserial_pl2303_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For serial.mod. +pkglib_MODULES += usbserial_ftdi.mod +usbserial_ftdi_mod_SOURCES = bus/usb/serial/ftdi.c +usbserial_ftdi_mod_CFLAGS = $(COMMON_CFLAGS) +usbserial_ftdi_mod_LDFLAGS = $(COMMON_LDFLAGS) + # For usbtest.mod pkglib_MODULES += usbtest.mod usbtest_mod_SOURCES = commands/usbtest.c From fb1d7b7975e3a6dde8e01cbbad43ba32c8f4b3e7 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 21:26:27 +0200 Subject: [PATCH 154/174] Add ChangeLog --- ChangeLog | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7d82e08fb..72a8d3601 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,82 @@ +2010-08-20 Vladimir Serbinenko + + USB hotunplugging and USB serial support. + + * bus/usb/ohci.c (grub_ohci_transfer): Fill *actual and respect timeout. + * bus/usb/uhci.c (grub_free_queue): Compute *actual. + (grub_uhci_transfer): Respect timeout and set *actual. + * bus/usb/usb.c (grub_usb_device_initialize): Correctly skip fields of + non-standard length. + (grub_usb_device_attach): Autoload modules. + (GRUB_MOD_INIT): Set grub_term_poll_usb. + (GRUB_MOD_FINI): Unset grub_term_poll_usb. + * bus/usb/usbhub.c (grub_usb_hub): Replace speed with devices. All + users updated. + (grub_usb_add_hub): Fill nports and children. + (attach_root_port): Receive hub instead of controller. + All users updated. Fill hub->devices. + (grub_usb_root_hub): Allocate hub->devices. + (detach_device): New function. + (poll_nonroot_hub): Fill children and detach devices. + * bus/usb/usbtrans.c (grub_usb_bulk_readwrite): Accept timeout and + actual arguments. All users updated. + (grub_usb_bulk_read_extended): New function. + * bus/usb/serial/common.c: New file. + * bus/usb/serial/ftdi.c: Likewise. + * bus/usb/serial/pl2303.c: Likewise. + * commands/terminal.c (handle_command): Support wildcard. + * commands/usbtest.c: Output "Unknown" instead of empty string. + * conf/any-emu.rmk (pkglib_MODULES): Add usbserial_common.mod. + (usbserial_common_mod_SOURCES): New variable. + (usbserial_common_mod_CFLAGS): Likewise. + (usbserial_common_mod_LDFLAGS): Likewise. + (pkglib_MODULES): Add usbserial_pl2303.mod. + (usbserial_pl2303_mod_SOURCES): New variable. + (usbserial_pl2303_mod_CFLAGS): Likewise. + (usbserial_pl2303_mod_LDFLAGS): Likewise. + (pkglib_MODULES): Add usbserial_ftdi.mod. + (usbserial_ftdi_mod_SOURCES): New variable. + (usbserial_ftdi_mod_CFLAGS): Likewise. + (usbserial_ftdi_mod_LDFLAGS): Likewise. + (pkglib_MODULES): Add serial.mod. + (serial_mod_SOURCES): New variable. + (serial_mod_CFLAGS): Likewise. + (serial_mod_LDFLAGS): Likewise. + * conf/i386-pc.rmk: Likewise. + * conf/mips-yeeloong.rmk: Likewise. + * conf/i386.rmk (serial_mod_SOURCES): Add term/ns8250.c. + * conf/mips-yeeloong.rmk (kernel_img_SOURCES): Likewise. + * disk/usbms.c (first_available_slot): New variable. + (grub_usbms_attach): Don't reuse free slots due to potential cache + problems. + * include/grub/serial.h: Moved to .. + * include/grub/ns8250.h: ...this. + * include/grub/serial.h: New file. + * include/grub/term.h (grub_term_poll_usb): New variable. + * include/grub/terminfo.h (grub_terminfo_input_state): Pass term to + readkey. All users updated. + (grub_terminfo_output_state): Pass term to put. + * include/grub/usb.h (GRUB_USB_REQTYPE): New enum. + (grub_usb_controller_dev): Add timeout and actual arguments to + transfer. All users updated. + (grub_usb_interface): New field detach_data. + (grub_usb_device): New fields children and nports. + (grub_usb_ep_type_t): New type. + (grub_usb_get_ep_type): New function. + (grub_usb_bulk_read_extended): Likewise. + * include/grub/usbdesc.h (grub_usb_desc): New type. + * include/grub/usbserial.h: New file. + * include/grub/usbtrans.h (grub_usb_transaction): New field preceding. + * kern/term.c (grub_term_poll_usb): New variable. + (grub_getkey): Call grub_term_poll_usb if set. + (grub_checkkey): Likewise. + (grub_getkeystatus): Likewise. + * term/serial.c: Moved controller-specific parts to ... + * term/ns8250.c: ... here. + * term/serial.c: Mostly rewritten. + * term/usb_keyboard.c: Reorganised to use GET_REPORT only on attaching + according to spec. + 2010-08-20 Colin Watson * commands/i386/pc/sendkey.c (keysym_table): Rename "numlock" to From d6f66ca2a0c9f4934f9512601da3b251d09dcfd0 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 20 Aug 2010 21:31:33 +0200 Subject: [PATCH 155/174] Export serial-related functions from kernel --- conf/mips-yeeloong.rmk | 2 +- include/grub/serial.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/mips-yeeloong.rmk b/conf/mips-yeeloong.rmk index 90949866c..9cbbdf472 100644 --- a/conf/mips-yeeloong.rmk +++ b/conf/mips-yeeloong.rmk @@ -5,7 +5,7 @@ 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 cs5536.h machine/pci.h + bitmap_scale.h bufio.h cs5536.h machine/pci.h serial.h include $(srcdir)/conf/mips.mk diff --git a/include/grub/serial.h b/include/grub/serial.h index 68cec6fdf..652268b2e 100644 --- a/include/grub/serial.h +++ b/include/grub/serial.h @@ -88,9 +88,9 @@ struct grub_serial_port grub_term_input_t term_in; }; -grub_err_t grub_serial_register (struct grub_serial_port *port); +grub_err_t EXPORT_FUNC(grub_serial_register) (struct grub_serial_port *port); -void grub_serial_unregister (struct grub_serial_port *port); +void EXPORT_FUNC(grub_serial_unregister) (struct grub_serial_port *port); /* Set default settings. */ static inline grub_err_t @@ -114,6 +114,6 @@ grub_serial_config_defaults (struct grub_serial_port *port) void grub_ns8250_init (void); char *grub_serial_ns8250_add_port (grub_port_t port); extern struct grub_serial_driver grub_ns8250_driver; -void grub_serial_unregister_driver (struct grub_serial_driver *driver); +void EXPORT_FUNC(grub_serial_unregister_driver) (struct grub_serial_driver *driver); #endif From dee5057594f6d3a20f9d574a3fd74e91193dffa1 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 21 Aug 2010 00:57:12 +0200 Subject: [PATCH 156/174] * loader/multiboot.c (grub_cmd_module): Don't unzip module if --nounzip is passed. --- ChangeLog | 5 +++++ loader/multiboot.c | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e840254ec..71a62267b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-21 Vladimir Serbinenko + + * loader/multiboot.c (grub_cmd_module): Don't unzip module if + --nounzip is passed. + 2010-08-20 Vladimir Serbinenko USB hotunplugging and USB serial support. diff --git a/loader/multiboot.c b/loader/multiboot.c index 77a732838..b4ea8bf21 100644 --- a/loader/multiboot.c +++ b/loader/multiboot.c @@ -295,6 +295,17 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), grub_ssize_t size; char *module = 0; grub_err_t err; + int nounzip = 0; + + if (argc == 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified"); + + if (grub_strcmp (argv[0], "--nounzip") == 0) + { + argv++; + argc--; + nounzip = 1; + } if (argc == 0) return grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified"); @@ -303,7 +314,10 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)), return grub_error (GRUB_ERR_BAD_ARGUMENT, "you need to load the multiboot kernel first"); - file = grub_gzfile_open (argv[0], 1); + if (nounzip) + file = grub_file_open (argv[0]); + else + file = grub_gzfile_open (argv[0], 1); if (! file) return grub_errno; From b40ea81bc7924e4c0d25840ab545d2bb100ca9b6 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 21 Aug 2010 01:36:02 +0200 Subject: [PATCH 157/174] 2010-08-21 Samuel Thibault * docs/grub.texi (GNU/Hurd): Document booting GNU/Hurd. --- ChangeLog | 4 ++++ docs/grub.texi | 25 ++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 71a62267b..89ebcce1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-08-21 Samuel Thibault + + * docs/grub.texi (GNU/Hurd): Document booting GNU/Hurd. + 2010-08-21 Vladimir Serbinenko * loader/multiboot.c (grub_cmd_module): Don't unzip module if diff --git a/docs/grub.texi b/docs/grub.texi index 9845c7a6f..f533a029c 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -828,11 +828,30 @@ Since GNU/Hurd is Multiboot-compliant, it is easy to boot it; there is nothing special about it. But do not forget that you have to specify a root partition to the kernel. -FIXME: this section is incomplete. - @enumerate @item -Run the command @command{boot} (@pxref{boot}). +Set GRUB's root device to the same drive as GNU/Hurd's. The command +@code{search --file --set /boot/gnumach.gz} or similar may help you +(@pxref{search}). + +@item +Load the kernel and the modules, like this: + +@example +@group +grub> @kbd{multiboot /boot/gnumach.gz root=device:hd0s1} +grub> @kbd{module /hurd/ext2fs.static ext2fs --readonly \ + --multiboot-command-line='$@{kernel-command-line@}' \ + --host-priv-port='$@{host-port@}' \ + --device-master-port='$@{device-port@}' \ + --exec-server-task='$@{exec-task@}' -T typed '$@{root@}' \ + '$(task-create)' '$(task-resume)'} +grub> @kbd{module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'} +@end group +@end example + +@item +Finally, run the command @command{boot} (@pxref{boot}). @end enumerate From df2624193935a23459b39d27334a8fe714b78057 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 21 Aug 2010 02:09:16 +0200 Subject: [PATCH 158/174] * include/grub/usb.h (grub_usb_device): Add 'data' field back. It's needed by libusb wrapper. --- ChangeLog | 5 +++++ include/grub/usb.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 89ebcce1a..6b6a82a35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-21 Vladimir Serbinenko + + * include/grub/usb.h (grub_usb_device): Add 'data' field back. It's + needed by libusb wrapper. + 2010-08-21 Samuel Thibault * docs/grub.texi (GNU/Hurd): Document booting GNU/Hurd. diff --git a/include/grub/usb.h b/include/grub/usb.h index 674f7ec46..bb3336580 100644 --- a/include/grub/usb.h +++ b/include/grub/usb.h @@ -178,6 +178,9 @@ struct grub_usb_device /* Data toggle values (used for bulk transfers only). */ int toggle[256]; + /* Used by libusb wrapper. Schedulded for removal. */ + void *data; + /* Array of children for a hub. */ grub_usb_device_t *children; From bdf0d623215fb98d5c910f632978f5c90d8e3563 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 21 Aug 2010 09:48:27 +0530 Subject: [PATCH 159/174] review comments --- Makefile.am | 2 +- Makefile.util.def | 2 ++ conf/Makefile.common | 3 --- conf/Makefile.extra-dist | 54 ++++------------------------------------ configure.ac | 6 ++--- docs/Makefile.am | 2 +- grub-core/Makefile.am | 3 +-- 7 files changed, 12 insertions(+), 60 deletions(-) diff --git a/Makefile.am b/Makefile.am index a5c4a874d..4b7aa5e3a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,7 +46,7 @@ CLEANFILES += libgrub_a_init.c if COND_GRUB_MKFONT if COND_HAVE_FONT_SOURCE -pkgdata_DATA = unicode.pf2 ascii.pf2 ascii.h +pkgdata_DATA = unicode.pf2 ascii.pf2 ascii.h widthspec.h endif endif diff --git a/Makefile.util.def b/Makefile.util.def index 50b5ac0d6..d44fbabdf 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -268,6 +268,7 @@ script = { installdir = grubconf; }; +/* script = { name = '10_windows'; source = util/grub.d/10_windows.in; @@ -279,6 +280,7 @@ script = { source = util/grub.d/10_hurd.in; installdir = grubconf; }; +*/ script = { name = '10_linux'; diff --git a/conf/Makefile.common b/conf/Makefile.common index 511813404..9637c0f7c 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -77,9 +77,6 @@ CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))" CPPFLAGS_GNULIB = -I$(top_srcdir)/grub-core/gnulib -CFLAGS_MKISOFS = -Wno-all -Werror -CPPFLAGS_MKISOFS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/util/mkisofs/include - CFLAGS_POSIX = -fno-builtin CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist index 17a169284..3acef7af7 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -1,5 +1,3 @@ -EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h') - EXTRA_DIST += autogen.sh EXTRA_DIST += geninit.sh @@ -28,50 +26,8 @@ EXTRA_DIST += grub-core/genterminallist.sh EXTRA_DIST += grub-core/genparttoollist.sh EXTRA_DIST += grub-core/genemuinitheader.sh -EXTRA_DIST += grub-core/gnulib/getopt.h -EXTRA_DIST += grub-core/gnulib/argp-version-etc.h -EXTRA_DIST += grub-core/gnulib/fnmatch.h -EXTRA_DIST += grub-core/gnulib/error.h -EXTRA_DIST += grub-core/gnulib/argp-namefrob.h -EXTRA_DIST += grub-core/gnulib/argp.h -EXTRA_DIST += grub-core/gnulib/argp-fmtstream.h -EXTRA_DIST += grub-core/gnulib/gettext.h -EXTRA_DIST += grub-core/gnulib/regex_internal.h -EXTRA_DIST += grub-core/gnulib/progname.h -EXTRA_DIST += grub-core/gnulib/regex.h -EXTRA_DIST += grub-core/gnulib/alloca.h -EXTRA_DIST += grub-core/gnulib/getopt_int.h -EXTRA_DIST += grub-core/efiemu/runtime/config.h - -EXTRA_DIST += grub-core/lib/posix_wrap/localcharset.h -EXTRA_DIST += grub-core/lib/posix_wrap/ctype.h -EXTRA_DIST += grub-core/lib/posix_wrap/limits.h -EXTRA_DIST += grub-core/lib/posix_wrap/stdio.h -EXTRA_DIST += grub-core/lib/posix_wrap/sys/types.h -EXTRA_DIST += grub-core/lib/posix_wrap/unistd.h -EXTRA_DIST += grub-core/lib/posix_wrap/locale.h -EXTRA_DIST += grub-core/lib/posix_wrap/wchar.h -EXTRA_DIST += grub-core/lib/posix_wrap/string.h -EXTRA_DIST += grub-core/lib/posix_wrap/langinfo.h -EXTRA_DIST += grub-core/lib/posix_wrap/wctype.h -EXTRA_DIST += grub-core/lib/posix_wrap/stdint.h -EXTRA_DIST += grub-core/lib/posix_wrap/stdlib.h -EXTRA_DIST += grub-core/lib/posix_wrap/assert.h -EXTRA_DIST += grub-core/lib/posix_wrap/errno.h - -EXTRA_DIST += grub-core/lib/libgcrypt_wrap/cipher_wrap.h -EXTRA_DIST += grub-core/lib/libgcrypt/cipher/rijndael-tables.h -EXTRA_DIST += grub-core/lib/libgcrypt/cipher/bithelp.h -EXTRA_DIST += grub-core/lib/libgcrypt/cipher/rmd.h -EXTRA_DIST += grub-core/lib/libgcrypt/cipher/hash-common.h -EXTRA_DIST += grub-core/lib/libgcrypt/cipher/camellia.h - -EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/types.h -EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/cipher.h -EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/rijndael-tables.h -EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/memory.h -EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/bithelp.h -EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/g10lib.h -EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/rmd.h -EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/hash-common.h -EXTRA_DIST += grub-core/lib/libgcrypt-grub/cipher/camellia.h +EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h') +EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/gnulib -name '*.h') +EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/efiemu -name '*.h') +EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/lib/posix_wrap -name '*.h') +EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/lib/libgcrypt_wrap -name '*.h') diff --git a/configure.ac b/configure.ac index cd0869187..b57a8580a 100644 --- a/configure.ac +++ b/configure.ac @@ -71,13 +71,11 @@ case "$target_cpu" in sparc) target_cpu=sparc64 ;; mipsel|mips64el) target_cpu=mips; - HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; - TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; + machine_CFLAGS="-DGRUB_CPU_MIPSEL=1"; ;; mips|mips64) target_cpu=mips; - HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_CPU_MIPS=1"; - TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_CPU_MIPS=1"; + machine_CFLAGS="-DGRUB_CPU_MIPS=1"; ;; esac diff --git a/docs/Makefile.am b/docs/Makefile.am index 103240bcc..8d9fb8445 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,6 +1,6 @@ AUTOMAKE_OPTIONS = subdir-objects -AM_MAKEINFOFLAGS = --force --no-split --no-validate +# AM_MAKEINFOFLAGS = --no-split --no-validate info_TEXINFOS = grub.texi grub_TEXINFOS = fdl.texi diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am index cea7014b1..83101e650 100644 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@ -34,8 +34,7 @@ gentrigtables: gentrigtables.c CLEANFILES += gentrigtables # trigtables.c -trigtables.c: gentrigtables.c $(top_srcdir)/configure.ac - $(MAKE) $(AM_MAKEFLAGS) gentrigtables +trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac $(builddir)/gentrigtables > $@ CLEANFILES += trigtables.c From 8427685faa8304f13c75ca0185584b05b610a449 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 21 Aug 2010 14:27:31 +0530 Subject: [PATCH 160/174] *_sources now collect all values of all its groups --- Makefile.util.def | 286 +++++++------- gentpl.py | 195 +++++++--- grub-core/Makefile.core.def | 739 ++++++++++++++++-------------------- util/import_gcry.py | 2 +- 4 files changed, 606 insertions(+), 616 deletions(-) diff --git a/Makefile.util.def b/Makefile.util.def index d44fbabdf..04b3d6f1c 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -5,100 +5,99 @@ library = { cflags = '$(CFLAGS_GCRY)'; cppflags = '$(CPPFLAGS_GCRY)'; - nodist = grub_script.tab.c; - nodist = grub_script.yy.c; - nodist = libgrub_a_init.c; + common_nodist = grub_script.tab.c; + common_nodist = grub_script.yy.c; + common_nodist = libgrub_a_init.c; + common_nodist = grub_script.yy.h; + common_nodist = grub_script.tab.h; - source = grub-core/gnulib/error.c; - source = grub-core/gnulib/fnmatch.c; - source = grub-core/gnulib/getdelim.c; - source = grub-core/gnulib/getline.c; - source = grub-core/gnulib/getopt1.c; - source = grub-core/gnulib/getopt.c; - source = grub-core/gnulib/progname.c; + common = grub-core/gnulib/error.c; + common = grub-core/gnulib/fnmatch.c; + common = grub-core/gnulib/getdelim.c; + common = grub-core/gnulib/getline.c; + common = grub-core/gnulib/getopt1.c; + common = grub-core/gnulib/getopt.c; + common = grub-core/gnulib/progname.c; - source = util/misc.c; - source = grub-core/kern/misc.c; - source = grub-core/kern/emu/mm.c; - source = grub-core/kern/emu/misc.c; - source = grub-core/kern/emu/hostfs.c; - source = grub-core/kern/emu/getroot.c; - source = grub-core/kern/emu/hostdisk.c; + common = util/misc.c; + common = grub-core/kern/misc.c; + common = grub-core/kern/emu/mm.c; + common = grub-core/kern/emu/misc.c; + common = grub-core/kern/emu/hostfs.c; + common = grub-core/kern/emu/getroot.c; + common = grub-core/kern/emu/hostdisk.c; - source = grub-core/commands/blocklist.c; - source = grub-core/commands/extcmd.c; - source = grub-core/commands/ls.c; - source = grub-core/disk/dmraid_nvidia.c; - source = grub-core/disk/host.c; - source = grub-core/disk/loopback.c; - source = grub-core/disk/lvm.c; - source = grub-core/disk/mdraid_linux.c; - source = grub-core/disk/raid5_recover.c; - source = grub-core/disk/raid6_recover.c; - source = grub-core/disk/raid.c; - source = grub-core/fs/affs.c; - source = grub-core/fs/afs_be.c; - source = grub-core/fs/afs.c; - source = grub-core/fs/befs_be.c; - source = grub-core/fs/befs.c; - source = grub-core/fs/cpio.c; - source = grub-core/fs/ext2.c; - source = grub-core/fs/fat.c; - source = grub-core/fs/fshelp.c; - source = grub-core/fs/hfs.c; - source = grub-core/fs/hfsplus.c; - source = grub-core/fs/iso9660.c; - source = grub-core/fs/jfs.c; - source = grub-core/fs/minix.c; - source = grub-core/fs/nilfs2.c; - source = grub-core/fs/ntfs.c; - source = grub-core/fs/ntfscomp.c; - source = grub-core/fs/reiserfs.c; - source = grub-core/fs/sfs.c; - source = grub-core/fs/tar.c; - source = grub-core/fs/udf.c; - source = grub-core/fs/ufs2.c; - source = grub-core/fs/ufs.c; - source = grub-core/fs/xfs.c; - source = grub-core/kern/command.c; - source = grub-core/kern/device.c; - source = grub-core/kern/disk.c; - source = grub-core/kern/env.c; - source = grub-core/kern/err.c; - source = grub-core/kern/file.c; - source = grub-core/kern/fs.c; - source = grub-core/kern/list.c; - source = grub-core/kern/partition.c; - source = grub-core/lib/arg.c; - source = grub-core/lib/crc.c; - source = grub-core/lib/crypto.c; - source = grub-core/lib/envblk.c; - source = grub-core/lib/hexdump.c; - source = grub-core/lib/libgcrypt-grub/cipher/sha512.c; - source = grub-core/lib/LzFind.c; - source = grub-core/lib/LzmaEnc.c; - source = grub-core/lib/pbkdf2.c; - source = grub-core/normal/datetime.c; - source = grub-core/normal/misc.c; - source = grub-core/partmap/acorn.c; - source = grub-core/partmap/amiga.c; - source = grub-core/partmap/apple.c; - source = grub-core/partmap/gpt.c; - source = grub-core/partmap/msdos.c; - source = grub-core/partmap/sun.c; - source = grub-core/script/function.c; - source = grub-core/script/lexer.c; - source = grub-core/script/main.c; - source = grub-core/script/script.c; - source = grub-core/script/argv.c; - - nodist = grub_script.yy.h; - nodist = grub_script.tab.h; + common = grub-core/commands/blocklist.c; + common = grub-core/commands/extcmd.c; + common = grub-core/commands/ls.c; + common = grub-core/disk/dmraid_nvidia.c; + common = grub-core/disk/host.c; + common = grub-core/disk/loopback.c; + common = grub-core/disk/lvm.c; + common = grub-core/disk/mdraid_linux.c; + common = grub-core/disk/raid5_recover.c; + common = grub-core/disk/raid6_recover.c; + common = grub-core/disk/raid.c; + common = grub-core/fs/affs.c; + common = grub-core/fs/afs_be.c; + common = grub-core/fs/afs.c; + common = grub-core/fs/befs_be.c; + common = grub-core/fs/befs.c; + common = grub-core/fs/cpio.c; + common = grub-core/fs/ext2.c; + common = grub-core/fs/fat.c; + common = grub-core/fs/fshelp.c; + common = grub-core/fs/hfs.c; + common = grub-core/fs/hfsplus.c; + common = grub-core/fs/iso9660.c; + common = grub-core/fs/jfs.c; + common = grub-core/fs/minix.c; + common = grub-core/fs/nilfs2.c; + common = grub-core/fs/ntfs.c; + common = grub-core/fs/ntfscomp.c; + common = grub-core/fs/reiserfs.c; + common = grub-core/fs/sfs.c; + common = grub-core/fs/tar.c; + common = grub-core/fs/udf.c; + common = grub-core/fs/ufs2.c; + common = grub-core/fs/ufs.c; + common = grub-core/fs/xfs.c; + common = grub-core/kern/command.c; + common = grub-core/kern/device.c; + common = grub-core/kern/disk.c; + common = grub-core/kern/env.c; + common = grub-core/kern/err.c; + common = grub-core/kern/file.c; + common = grub-core/kern/fs.c; + common = grub-core/kern/list.c; + common = grub-core/kern/partition.c; + common = grub-core/lib/arg.c; + common = grub-core/lib/crc.c; + common = grub-core/lib/crypto.c; + common = grub-core/lib/envblk.c; + common = grub-core/lib/hexdump.c; + common = grub-core/lib/libgcrypt-grub/cipher/sha512.c; + common = grub-core/lib/LzFind.c; + common = grub-core/lib/LzmaEnc.c; + common = grub-core/lib/pbkdf2.c; + common = grub-core/normal/datetime.c; + common = grub-core/normal/misc.c; + common = grub-core/partmap/acorn.c; + common = grub-core/partmap/amiga.c; + common = grub-core/partmap/apple.c; + common = grub-core/partmap/gpt.c; + common = grub-core/partmap/msdos.c; + common = grub-core/partmap/sun.c; + common = grub-core/script/function.c; + common = grub-core/script/lexer.c; + common = grub-core/script/main.c; + common = grub-core/script/script.c; + common = grub-core/script/argv.c; }; program = { name = grub-bin2h; - source = util/bin2h.c; + common = util/bin2h.c; ldadd = libgrub.a; ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; mansection = 1; @@ -108,8 +107,8 @@ program = { name = grub-mkimage; mansection = 1; - source = util/grub-mkimage.c; - source = util/resolve.c; + common = util/grub-mkimage.c; + common = util/resolve.c; extra_dist = util/grub-mkimagexx.c; ldadd = libgrub.a; @@ -121,7 +120,7 @@ program = { name = grub-mkrelpath; mansection = 1; - source = util/grub-mkrelpath.c; + common = util/grub-mkrelpath.c; ldadd = libgrub.a; ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; @@ -131,7 +130,7 @@ program = { name = grub-script-check; mansection = 1; - source = util/grub-script-check.c; + common = util/grub-script-check.c; ldadd = libgrub.a; ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; @@ -141,7 +140,7 @@ program = { name = grub-editenv; mansection = 1; - source = util/grub-editenv.c; + common = util/grub-editenv.c; ldadd = libgrub.a; ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; @@ -151,7 +150,7 @@ program = { name = grub-mkpasswd-pbkdf2; mansection = 1; - source = util/grub-mkpasswd-pbkdf2.c; + common = util/grub-mkpasswd-pbkdf2.c; ldadd = libgrub.a; ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; @@ -162,14 +161,14 @@ program = { program = { name = grub-macho2img; mansection = 1; - source = util/grub-macho2img.c; + common = util/grub-macho2img.c; condition = COND_APPLE_CC; }; program = { name = grub-pe2elf; mansection = 1; - source = util/grub-pe2elf.c; + common = util/grub-pe2elf.c; ldadd = libgrub.a; ldflags = '$(LIBINTL)'; @@ -179,7 +178,7 @@ program = { program = { name = grub-fstest; mansection = 1; - source = util/grub-fstest.c; + common = util/grub-fstest.c; ldadd = libgrub.a; ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; @@ -189,8 +188,8 @@ program = { program = { name = grub-mkfont; mansection = 1; - source = util/grub-mkfont.c; - source = grub-core/unidata.c; + common = util/grub-mkfont.c; + common = grub-core/unidata.c; cflags = '$(freetype_cflags)'; @@ -204,9 +203,9 @@ program = { name = grub-mkdevicemap; installdir = sbin; mansection = 8; - source = util/grub-mkdevicemap.c; - source = util/deviceiter.c; - source = util/devicemap.c; + nosparc64 = util/grub-mkdevicemap.c; + nosparc64 = util/deviceiter.c; + nosparc64 = util/devicemap.c; sparc64_ieee1275 = util/grub-mkdevicemap.c; sparc64_ieee1275 = util/deviceiter.c; @@ -221,7 +220,7 @@ program = { name = grub-probe; installdir = sbin; mansection = 8; - source = util/grub-probe.c; + common = util/grub-probe.c; ldadd = libgrub.a; ldflags = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)'; @@ -250,66 +249,66 @@ program = { program = { name = grub-ofpathname; installdir = sbin; - source = util/ieee1275/grub-ofpathname.c; - source = util/ieee1275/ofpath.c; + ieee1275 = util/ieee1275/grub-ofpathname.c; + ieee1275 = util/ieee1275/ofpath.c; ldadd = libgrub.a; enable = sparc64_ieee1275; }; data = { - source = util/grub.d/README; + common = util/grub.d/README; installdir = grubconf; }; script = { name = '00_header'; - source = util/grub.d/00_header.in; + common = util/grub.d/00_header.in; installdir = grubconf; }; /* script = { name = '10_windows'; - source = util/grub.d/10_windows.in; + common = util/grub.d/10_windows.in; installdir = grubconf; }; script = { name = '10_hurd'; - source = util/grub.d/10_hurd.in; + common = util/grub.d/10_hurd.in; installdir = grubconf; }; */ script = { name = '10_linux'; - source = util/grub.d/10_linux.in; + common = util/grub.d/10_linux.in; installdir = grubconf; }; script = { name = '30_os-prober'; - source = util/grub.d/30_os-prober.in; + common = util/grub.d/30_os-prober.in; installdir = grubconf; }; script = { name = '40_custom'; - source = util/grub.d/40_custom.in; + common = util/grub.d/40_custom.in; installdir = grubconf; }; script = { name = '41_custom'; - source = util/grub.d/41_custom.in; + common = util/grub.d/41_custom.in; installdir = grubconf; }; script = { mansection = 1; name = grub-mkrescue; - source = util/grub-mkrescue.in; + i386_pc_qemu_coreboot = util/grub-mkrescue.in; powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in; enable = i386_pc; enable = i386_qemu; @@ -321,7 +320,10 @@ script = { mansection = 8; installdir = sbin; name = grub-install; - source = util/grub-install.in; + + mips = util/grub-install.in; + i386_noefi_noieee1275 = util/grub-install.in; + x86_efi = util/i386/efi/grub-install.in; i386_ieee1275 = util/ieee1275/grub-install.in; powerpc_ieee1275 = util/ieee1275/grub-install.in; @@ -333,151 +335,151 @@ script = { script = { name = grub-mkconfig; - source = util/grub-mkconfig.in; + common = util/grub-mkconfig.in; mansection = 8; installdir = sbin; }; script = { name = grub-set-default; - source = util/grub-set-default.in; + common = util/grub-set-default.in; mansection = 8; installdir = sbin; }; script = { name = grub-reboot; - source = util/grub-reboot.in; + common = util/grub-reboot.in; mansection = 8; installdir = sbin; }; script = { name = grub-mkconfig_lib; - source = util/grub-mkconfig_lib.in; + common = util/grub-mkconfig_lib.in; installdir = pkglib; }; script = { name = update-grub_lib; - source = util/update-grub_lib.in; + common = util/update-grub_lib.in; installdir = pkglib; }; script = { name = grub-shell; - source = tests/util/grub-shell.in; + common = tests/util/grub-shell.in; }; script = { name = grub-shell-tester; - source = tests/util/grub-shell-tester.in; + common = tests/util/grub-shell-tester.in; }; script = { testcase; name = example_scripted_test; - source = tests/example_scripted_test.in; + common = tests/example_scripted_test.in; }; script = { testcase; name = example_grub_script_test; - source = tests/example_grub_script_test.in; + common = tests/example_grub_script_test.in; }; script = { testcase; name = grub_script_echo1; - source = tests/grub_script_echo1.in; + common = tests/grub_script_echo1.in; }; script = { testcase; name = grub_script_echo_keywords; - source = tests/grub_script_echo_keywords.in; + common = tests/grub_script_echo_keywords.in; }; script = { testcase; name = grub_script_vars1; - source = tests/grub_script_vars1.in; + common = tests/grub_script_vars1.in; }; script = { testcase; name = grub_script_for1; - source = tests/grub_script_for1.in; + common = tests/grub_script_for1.in; }; script = { testcase; name = grub_script_while1; - source = tests/grub_script_while1.in; + common = tests/grub_script_while1.in; }; script = { testcase; name = grub_script_if; - source = tests/grub_script_if.in; + common = tests/grub_script_if.in; }; script = { testcase; name = grub_script_blanklines; - source = tests/grub_script_blanklines.in; + common = tests/grub_script_blanklines.in; }; script = { testcase; name = grub_script_final_semicolon; - source = tests/grub_script_final_semicolon.in; + common = tests/grub_script_final_semicolon.in; }; script = { testcase; name = grub_script_dollar; - source = tests/grub_script_dollar.in; + common = tests/grub_script_dollar.in; }; script = { testcase; name = grub_script_comments; - source = tests/grub_script_comments.in; + common = tests/grub_script_comments.in; }; script = { testcase; name = grub_script_functions; - source = tests/grub_script_functions.in; + common = tests/grub_script_functions.in; }; script = { testcase; name = grub_script_break; - source = tests/grub_script_break.in; + common = tests/grub_script_break.in; }; script = { testcase; name = grub_script_continue; - source = tests/grub_script_continue.in; + common = tests/grub_script_continue.in; }; script = { testcase; name = grub_script_shift; - source = tests/grub_script_shift.in; + common = tests/grub_script_shift.in; }; program = { testcase; name = example_unit_test; - source = tests/example_unit_test.c; - source = tests/lib/unit_test.c; - source = grub-core/kern/list.c; - source = grub-core/kern/misc.c; - source = grub-core/tests/lib/test.c; + common = tests/example_unit_test.c; + common = tests/lib/unit_test.c; + common = grub-core/kern/list.c; + common = grub-core/kern/misc.c; + common = grub-core/tests/lib/test.c; cflags = -Wno-format; ldadd = libgrub.a; ldflags = '$(LIBDEVMAPPER)'; diff --git a/gentpl.py b/gentpl.py index 59950bb0e..18672bdcd 100644 --- a/gentpl.py +++ b/gentpl.py @@ -10,17 +10,44 @@ GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "powerpc_ieee1275" ] GROUPS = {} -GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ] -GROUPS["x86_64"] = [ "x86_64_efi" ] -GROUPS["mips"] = [ "mips_yeeloong" ] -GROUPS["sparc64"] = [ "sparc64_ieee1275" ] -GROUPS["powerpc"] = [ "powerpc_ieee1275" ] -GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"] -GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ] -GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ] +GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ] +GROUPS["x86_64"] = [ "x86_64_efi" ] +GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"] +GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ] + +GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc") + +GROUPS["x86_noefi"] = GROUPS["x86"][:]; GROUPS["x86_noefi"].remove("i386_efi"); GROUPS["x86_noefi"].remove("x86_64_efi") +GROUPS["i386_noefi"] = GROUPS["i386"][:]; GROUPS["i386_noefi"].remove("i386_efi") + +GROUPS["x86_noieee1275"] = GROUPS["x86"][:]; GROUPS["x86_noieee1275"].remove("i386_ieee1275") +GROUPS["i386_noieee1275"] = GROUPS["i386"][:]; GROUPS["i386_noieee1275"].remove("i386_ieee1275") + +GROUPS["i386_noefi_noieee1275"] = GROUPS["i386_noefi"][:]; GROUPS["i386_noefi_noieee1275"].remove("i386_ieee1275") + +GROUPS["i386_pc_qemu_coreboot"] = ["i386_pc", "i386_qemu", "i386_coreboot"] +GROUPS["i386_coreboot_multiboot"] = ["i386_coreboot", "i386_multiboot"] +GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"] +GROUPS["i386_pc_coreboot_multiboot_qemu"] = ["i386_pc", "i386_coreboot", "i386_multiboot", "i386_qemu"] + +GROUPS["mips"] = [ "mips_yeeloong" ] +GROUPS["sparc64"] = [ "sparc64_ieee1275" ] +GROUPS["powerpc"] = [ "powerpc_ieee1275" ] + +GROUPS["nosparc64"] = GRUB_PLATFORMS[:]; GROUPS["nosparc64"].remove("sparc64_ieee1275") +GROUPS["x86_noefi_mips"] = GROUPS["x86_noefi"] + GROUPS["mips"] + +GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ] +GROUPS["noieee1275"] = GRUB_PLATFORMS[:] +for i in GROUPS["ieee1275"]: GROUPS["noieee1275"].remove(i) + GROUPS["pci"] = GROUPS["x86"] + GROUPS["mips"] -GROUPS["nonemu"] = GRUB_PLATFORMS[:] -GROUPS["nonemu"].remove("emu") + +GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu") +GROUPS["noemu_noieee1275"] = GRUB_PLATFORMS[:] +for i in ["emu"] + GROUPS["ieee1275"]: GROUPS["noemu_noieee1275"].remove(i) + +GROUPS["common"] = GRUB_PLATFORMS[:] # # Create platform => groups reverse map, where groups covering that @@ -111,7 +138,19 @@ def if_platform_tagged(platform, tag, snippet_if, snippet_else=None): return r # -# Template for handling platform specific values, for example: +# Template for tagged values +# +# module = { +# extra_dist = ... +# extra_dist = ... +# ... +# }; +# +def foreach_value(tag, closure): + return "[+ FOR " + tag + " +]" + closure("[+ ." + tag + " +]") + "[+ ENDFOR +]" + +# +# Template for handling best matched values for a platform, for example: # # module = { # cflags = '-Wall'; @@ -119,7 +158,7 @@ def if_platform_tagged(platform, tag, snippet_if, snippet_else=None): # ... # } # -def foreach_platform_value(platform, tag, suffix, closure): +def foreach_platform_specific_value(platform, suffix, nonetag, closure): r = "" for group in RMAP[platform]: gtag = group + suffix @@ -130,10 +169,46 @@ def foreach_platform_value(platform, tag, suffix, closure): r += "[+ ELIF " + gtag + " +]" r += "[+ FOR " + gtag + " +]" + closure("[+ ." + gtag + " +]") + "[+ ENDFOR +]" - r += "[+ ELSE +][+ FOR " + tag + " +]" + closure("[+ ." + tag + " +]") + "[+ ENDFOR +][+ ENDIF +]" + r += "[+ ELSE +][+ FOR " + nonetag + " +]" + closure("[+ ." + nonetag + " +]") + "[+ ENDFOR +][+ ENDIF +]" return r -def each_platform(closure): +# +# Template for handling values from sum of all groups for a platform, +# for example: +# +# module = { +# common = kern/misc.c; +# emu = kern/emu/misc.c; +# ... +# } +# +def foreach_platform_value (platform, suffix, closure): + r = "" + for group in RMAP[platform]: + gtag = group + suffix + + r += "[+ IF " + gtag + " +]" + r += "[+ FOR " + gtag + " +]" + closure("[+ ." + gtag + " +]") + "[+ ENDFOR +]" + r += "[+ ENDIF +]" + return r + +# +# Template for gaurding with platform specific "enable" keys, for example: +# +# module = { +# name = pci; +# noemu = bus/pci.c; +# emu = bus/emu/pci.c; +# emu = commands/lspci.c; +# +# enable = emu; +# enable = i386_pc; +# enable = x86_efi; +# enable = i386_ieee1275; +# enable = i386_coreboot; +# }; +# +def foreach_enabled_platform(closure): r = "[+ IF - enable undefined +]" for platform in GRUB_PLATFORMS: r += "\nif COND_" + platform + "\n" + closure(platform) + "endif\n" @@ -144,30 +219,49 @@ def each_platform(closure): r += "[+ ENDIF +]" return r +# +# Template for gaurding with platform specific automake conditionals, +# for example: +# +# module = { +# name = usb; +# common = bus/usb/usb.c; +# noemu = bus/usb/usbtrans.c; +# noemu = bus/usb/usbhub.c; +# enable = emu; +# enable = i386; +# enable = mips_yeeloong; +# emu_condition = COND_GRUB_EMU_USB; +# }; +# def under_platform_specific_conditionals(platform, snippet): - r = foreach_platform_value(platform, "condition", "_condition", lambda cond: "if " + cond + "\n") + r = foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n") r += snippet - r += foreach_platform_value(platform, "condition", "_condition", lambda cond: "endif " + cond + "\n") + r += foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n") return r -def platform_specific_values(platform, tag, suffix): - return foreach_platform_value(platform, tag, suffix, lambda value: value + " ") +def platform_specific_values(platform, suffix, nonetag): + return foreach_platform_specific_value(platform, suffix, nonetag, + lambda value: value + " ") -def shared_sources(): return "[+ FOR shared +][+ .shared +] [+ ENDFOR +]" -def shared_nodist_sources(): return "[+ FOR nodist_shared +] [+ .nodist_shared +][+ ENDFOR +]" +def platform_values(platform, suffix): + return foreach_platform_value(platform, suffix, lambda value: value + " ") -def platform_sources(p): return platform_specific_values(p, "source", "") -def platform_nodist_sources(p): return platform_specific_values(p, "nodist", "_nodist") -def platform_extra_dist(p): return platform_specific_values(p, "extra_dist", "_extra_dist") -def platform_dependencies(p): return platform_specific_values(p, "dependencies", "_dependencies") +def extra_dist(): + return foreach_value("extra_dist", lambda value: value + " ") -def platform_ldadd(p): return platform_specific_values(p, "ldadd", "_ldadd") -def platform_cflags(p): return platform_specific_values(p, "cflags", "_cflags") -def platform_ldflags(p): return platform_specific_values(p, "ldflags", "_ldflags") -def platform_cppflags(p): return platform_specific_values(p, "cppflags", "_cppflags") -def platform_ccasflags(p): return platform_specific_values(p, "ccasflags", "_ccasflags") -def platform_stripflags(p): return platform_specific_values(p, "stripflags", "_stripflags") -def platform_objcopyflags(p): return platform_specific_values(p, "objcopyflags", "_objcopyflags") +def platform_sources(p): return platform_values(p, "") +def platform_nodist_sources(p): return platform_values(p, "_nodist") +def platform_dependencies(p): return platform_values(p, "dependencies", "_dependencies") + +def platform_startup(p): return platform_specific_values(p, "_startup", "startup") +def platform_ldadd(p): return platform_specific_values(p, "_ldadd", "ldadd") +def platform_cflags(p): return platform_specific_values(p, "_cflags", "cflags") +def platform_ldflags(p): return platform_specific_values(p, "_ldflags", "ldflags") +def platform_cppflags(p): return platform_specific_values(p, "_cppflags", "cppflags") +def platform_ccasflags(p): return platform_specific_values(p, "_ccasflags", "ccasflags") +def platform_stripflags(p): return platform_specific_values(p, "_stripflags", "stripflags") +def platform_objcopyflags(p): return platform_specific_values(p, "_objcopyflags", "objcopyflags") def module(platform): r = set_canonical_name_suffix(".module") @@ -176,9 +270,7 @@ def module(platform): r += gvar_add("MODULE_FILES", "[+ name +].module$(EXEEXT)") r += var_set(cname() + "_SOURCES", platform_sources(platform) + " ## platform sources") - r += var_add(cname() + "_SOURCES", shared_sources() + " ## shared sources") r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## platform nodist sources") - r += var_add("nodist_" + cname() + "_SOURCES", shared_nodist_sources() + " ## shared nodist sources") r += var_set(cname() + "_LDADD", platform_ldadd(platform)) r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_MODULE) " + platform_cflags(platform)) r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_MODULE) " + platform_ldflags(platform)) @@ -186,7 +278,7 @@ def module(platform): r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(platform)) # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform)) - r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) + r += gvar_add("EXTRA_DIST", extra_dist()) r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)") @@ -265,10 +357,9 @@ terminal-[+ name +].lst: [+ name +].pp $(srcdir)/genterminallist.sh def kernel(platform): r = set_canonical_name_suffix(".exec") r += gvar_add("noinst_PROGRAMS", "[+ name +].exec") - r += var_set(cname() + "_SOURCES", platform_sources(platform)) - r += var_add(cname() + "_SOURCES", shared_sources()) + r += var_set(cname() + "_SOURCES", platform_startup(platform)) + r += var_add(cname() + "_SOURCES", platform_sources(platform)) r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## platform nodist sources") - r += var_add("nodist_" + cname() + "_SOURCES", shared_nodist_sources() + " ## shared nodist sources") r += var_set(cname() + "_LDADD", platform_ldadd(platform)) r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_KERNEL) " + platform_cflags(platform)) r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_KERNEL) " + platform_ldflags(platform)) @@ -277,7 +368,7 @@ def kernel(platform): r += var_set(cname() + "_STRIPFLAGS", "$(AM_STRIPFLAGS) $(STRIPFLAGS_KERNEL) " + platform_stripflags(platform)) # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform)) - r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) + r += gvar_add("EXTRA_DIST", extra_dist()) r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)") @@ -292,9 +383,7 @@ def image(platform): r = set_canonical_name_suffix(".image") r += gvar_add("noinst_PROGRAMS", "[+ name +].image") r += var_set(cname() + "_SOURCES", platform_sources(platform)) - r += var_add(cname() + "_SOURCES", shared_sources()) r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources") - r += var_add("nodist_" + cname() + "_SOURCES", shared_nodist_sources() + "## shared nodist sources") r += var_set(cname() + "_LDADD", platform_ldadd(platform)) r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_IMAGE) " + platform_cflags(platform)) r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_IMAGE) " + platform_ldflags(platform)) @@ -303,7 +392,7 @@ def image(platform): r += var_set(cname() + "_OBJCOPYFLAGS", "$(OBJCOPYFLAGS_IMAGE) " + platform_objcopyflags(platform)) # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform)) - r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) + r += gvar_add("EXTRA_DIST", extra_dist()) r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)") @@ -322,15 +411,13 @@ def library(platform): r = set_canonical_name_suffix("") r += gvar_add("noinst_LIBRARIES", "[+ name +]") r += var_set(cname() + "_SOURCES", platform_sources(platform)) - r += var_add(cname() + "_SOURCES", shared_sources()) r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform)) - r += var_add("nodist_" + cname() + "_SOURCES", shared_nodist_sources()) r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_LIBRARY) " + platform_cflags(platform)) r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) " + platform_cppflags(platform)) r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) " + platform_ccasflags(platform)) # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform)) - r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) + r += gvar_add("EXTRA_DIST", extra_dist()) r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)") @@ -362,9 +449,7 @@ def program(platform, test=False): r += "[+ ENDIF +]" r += var_set(cname() + "_SOURCES", platform_sources(platform)) - r += var_add(cname() + "_SOURCES", shared_sources()) r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform)) - r += var_add("nodist_" + cname() + "_SOURCES", shared_nodist_sources()) r += var_set(cname() + "_LDADD", platform_ldadd(platform)) r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_PROGRAM) " + platform_cflags(platform)) r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_PROGRAM) " + platform_ldflags(platform)) @@ -372,14 +457,14 @@ def program(platform, test=False): r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM) " + platform_ccasflags(platform)) # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform)) - r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) + r += gvar_add("EXTRA_DIST", extra_dist()) r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)") r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)") return r def data(platform): r = gvar_add("EXTRA_DIST", platform_sources(platform)) - r += gvar_add("EXTRA_DIST", platform_extra_dist(platform)) + r += gvar_add("EXTRA_DIST", extra_dist()) r += gvar_add(installdir() + "_DATA", platform_sources(platform)) return r @@ -403,31 +488,31 @@ chmod a+x [+ name +] return r def module_rules(): - return "[+ FOR module +]" + each_platform( + return "[+ FOR module +]" + foreach_enabled_platform( lambda p: under_platform_specific_conditionals(p, module(p))) + "[+ ENDFOR +]" def kernel_rules(): - return "[+ FOR kernel +]" + each_platform( + return "[+ FOR kernel +]" + foreach_enabled_platform( lambda p: under_platform_specific_conditionals(p, kernel(p))) + "[+ ENDFOR +]" def image_rules(): - return "[+ FOR image +]" + each_platform( + return "[+ FOR image +]" + foreach_enabled_platform( lambda p: under_platform_specific_conditionals(p, image(p))) + "[+ ENDFOR +]" def library_rules(): - return "[+ FOR library +]" + each_platform( + return "[+ FOR library +]" + foreach_enabled_platform( lambda p: under_platform_specific_conditionals(p, library(p))) + "[+ ENDFOR +]" def program_rules(): - return "[+ FOR program +]" + each_platform( + return "[+ FOR program +]" + foreach_enabled_platform( lambda p: under_platform_specific_conditionals(p, program(p))) + "[+ ENDFOR +]" def script_rules(): - return "[+ FOR script +]" + each_platform( + return "[+ FOR script +]" + foreach_enabled_platform( lambda p: under_platform_specific_conditionals(p, script(p))) + "[+ ENDFOR +]" def data_rules(): - return "[+ FOR data +]" + each_platform( + return "[+ FOR data +]" + foreach_enabled_platform( lambda p: under_platform_specific_conditionals(p, data(p))) + "[+ ENDFOR +]" print "[+ AutoGen5 template +]\n" diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 83aa3b1db..b7c52b9d7 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -31,209 +31,139 @@ kernel = { powerpc_ldadd = '-lgcc'; sparc64_ldadd = '-lgcc'; - nonemu_nodist = symlist.c; + i386_pc_startup = kern/i386/pc/startup.S; + i386_efi_startup = kern/i386/efi/startup.S; + x86_64_efi_startup = kern/x86_64/efi/startup.S; + i386_qemu_startup = kern/i386/qemu/startup.S; + i386_ieee1275_startup = kern/i386/ieee1275/startup.S; + i386_coreboot_multiboot_startup = kern/i386/coreboot/startup.S; + mips_yeeloong_startup = kern/mips/startup.S; + sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S; + powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S; - shared = kern/command.c; - shared = kern/corecmd.c; - shared = kern/device.c; - shared = kern/disk.c; - shared = kern/dl.c; - shared = kern/env.c; - shared = kern/err.c; - shared = kern/file.c; - shared = kern/fs.c; - shared = kern/list.c; - shared = kern/main.c; - shared = kern/misc.c; - shared = kern/parser.c; - shared = kern/partition.c; - shared = kern/rescue_parser.c; - shared = kern/rescue_reader.c; - shared = kern/term.c; + common = kern/command.c; + common = kern/corecmd.c; + common = kern/device.c; + common = kern/disk.c; + common = kern/dl.c; + common = kern/env.c; + common = kern/err.c; + common = kern/file.c; + common = kern/fs.c; + common = kern/list.c; + common = kern/main.c; + common = kern/misc.c; + common = kern/parser.c; + common = kern/partition.c; + common = kern/rescue_parser.c; + common = kern/rescue_reader.c; + common = kern/term.c; + + noemu = kern/mm.c; + noemu = kern/time.c; + noemu = kern/generic/millisleep.c; + + noemu_nodist = symlist.c; + + noemu_noieee1275 = kern/generic/rtc_get_time_ms.c; + + ieee1275 = disk/ieee1275/ofdisk.c; + ieee1275 = kern/ieee1275/cmain.c; + ieee1275 = kern/ieee1275/ieee1275.c; + ieee1275 = kern/ieee1275/mmap.c; + ieee1275 = kern/ieee1275/openfw.c; + ieee1275 = term/ieee1275/ofconsole.c; + + ieee1275_mips = term/terminfo.c; + ieee1275_mips = term/tparm.c; + + i386 = kern/i386/dl.c; + + i386_coreboot_multiboot_qemu = kern/i386/coreboot/init.c; + i386_coreboot_multiboot_qemu = kern/i386/halt.c; + i386_coreboot_multiboot_qemu = term/i386/pc/vga_text.c; + + i386_pc_coreboot_multiboot_qemu = term/i386/vga_common.c; + + i386_noefi = kern/i386/misc.S; + + x86_noieee1275 = kern/i386/pit.c; + + x86_efi = disk/efi/efidisk.c; + x86_efi = kern/efi/efi.c; + x86_efi = kern/efi/init.c; + x86_efi = kern/efi/mm.c; + x86_efi = kern/i386/efi/init.c; + x86_efi = term/efi/console.c; + + i386_efi = kern/i386/tsc.c; + + x86_64_efi = kern/i386/tsc.c; + x86_64_efi = kern/x86_64/dl.c; + x86_64_efi = kern/x86_64/efi/callwrap.S; - i386_pc = kern/i386/pc/startup.S; - i386_pc = kern/i386/misc.S; - i386_pc = kern/mm.c; - i386_pc = kern/time.c; - i386_pc = kern/i386/dl.c; i386_pc = kern/i386/pc/init.c; i386_pc = kern/i386/pc/mmap.c; i386_pc = kern/i386/tsc.c; - i386_pc = kern/i386/pit.c; - i386_pc = kern/generic/rtc_get_time_ms.c; - i386_pc = kern/generic/millisleep.c; i386_pc = term/i386/pc/console.c; - i386_pc = term/i386/vga_common.c; - i386_efi = kern/i386/efi/startup.S; - i386_efi = kern/mm.c; - i386_efi = kern/i386/dl.c; - i386_efi = kern/i386/efi/init.c; - i386_efi = kern/efi/efi.c; - i386_efi = kern/efi/init.c; - i386_efi = kern/efi/mm.c; - i386_efi = kern/time.c; - i386_efi = kern/i386/tsc.c; - i386_efi = kern/i386/pit.c; - i386_efi = kern/generic/rtc_get_time_ms.c; - i386_efi = kern/generic/millisleep.c; - i386_efi = term/efi/console.c; - i386_efi = disk/efi/efidisk.c; - - i386_coreboot = kern/i386/coreboot/startup.S; - i386_coreboot = kern/i386/misc.S; - i386_coreboot = kern/i386/coreboot/init.c; - i386_coreboot = kern/i386/coreboot/mmap.c; - i386_coreboot = kern/i386/halt.c; - i386_coreboot = kern/mm.c; - i386_coreboot = kern/time.c; - i386_coreboot = kern/i386/dl.c; - i386_coreboot = kern/i386/tsc.c; - i386_coreboot = kern/i386/pit.c; - i386_coreboot = kern/generic/rtc_get_time_ms.c; - i386_coreboot = kern/generic/millisleep.c; - i386_coreboot = term/i386/pc/vga_text.c; - i386_coreboot = term/i386/vga_common.c; - - i386_multiboot = kern/i386/coreboot/startup.S; - i386_multiboot = kern/i386/misc.S; - i386_multiboot = kern/i386/coreboot/init.c; - i386_multiboot = kern/i386/multiboot_mmap.c; - i386_multiboot = kern/i386/halt.c; - i386_multiboot = kern/mm.c; - i386_multiboot = kern/time.c; - i386_multiboot = kern/i386/dl.c; - i386_multiboot = kern/i386/tsc.c; - i386_multiboot = kern/i386/pit.c; - i386_multiboot = kern/generic/rtc_get_time_ms.c; - i386_multiboot = kern/generic/millisleep.c; - i386_multiboot = term/i386/pc/vga_text.c; - i386_multiboot = term/i386/vga_common.c; - - i386_qemu = kern/i386/qemu/startup.S; - i386_qemu = kern/i386/misc.S; - i386_qemu = kern/i386/qemu/init.c; - i386_qemu = kern/i386/coreboot/init.c; - i386_qemu = kern/i386/qemu/mmap.c; - i386_qemu = kern/i386/halt.c; - i386_qemu = kern/mm.c; - i386_qemu = kern/time.c; - i386_qemu = kern/i386/dl.c; - i386_qemu = kern/i386/tsc.c; - i386_qemu = kern/i386/pit.c; - i386_qemu = kern/generic/rtc_get_time_ms.c; - i386_qemu = kern/generic/millisleep.c; - i386_qemu = term/i386/pc/vga_text.c; - i386_qemu = term/i386/vga_common.c; i386_qemu = bus/pci.c; + i386_qemu = kern/i386/qemu/init.c; + i386_qemu = kern/i386/qemu/mmap.c; + i386_qemu = kern/i386/tsc.c; + + i386_coreboot = kern/i386/coreboot/mmap.c; + i386_coreboot = kern/i386/tsc.c; + + i386_multiboot = kern/i386/multiboot_mmap.c; + i386_multiboot = kern/i386/tsc.c; - i386_ieee1275 = kern/i386/ieee1275/startup.S; - i386_ieee1275 = kern/i386/misc.S; i386_ieee1275 = kern/i386/ieee1275/init.c; i386_ieee1275 = kern/ieee1275/init.c; - i386_ieee1275 = kern/ieee1275/mmap.c; - i386_ieee1275 = kern/ieee1275/cmain.c; - i386_ieee1275 = kern/ieee1275/openfw.c; - i386_ieee1275 = kern/mm.c; - i386_ieee1275 = kern/i386/dl.c; - i386_ieee1275 = kern/time.c; - i386_ieee1275 = kern/generic/millisleep.c; - i386_ieee1275 = kern/ieee1275/ieee1275.c; - i386_ieee1275 = term/ieee1275/ofconsole.c; - i386_ieee1275 = disk/ieee1275/ofdisk.c; - i386_ieee1275 = term/terminfo.c; - i386_ieee1275 = term/tparm.c; - x86_64_efi = kern/x86_64/efi/startup.S; - x86_64_efi = kern/x86_64/efi/callwrap.S; - x86_64_efi = kern/mm.c; - x86_64_efi = kern/x86_64/dl.c; - x86_64_efi = kern/i386/efi/init.c; - x86_64_efi = kern/efi/efi.c; - x86_64_efi = kern/efi/init.c; - x86_64_efi = kern/efi/mm.c; - x86_64_efi = kern/time.c; - x86_64_efi = kern/i386/tsc.c; - x86_64_efi = kern/i386/pit.c; - x86_64_efi = kern/generic/millisleep.c; - x86_64_efi = kern/generic/rtc_get_time_ms.c; - x86_64_efi = term/efi/console.c; - x86_64_efi = disk/efi/efidisk.c; - - mips_yeeloong = kern/mips/startup.S; + mips_yeeloong = bus/bonito.c; + mips_yeeloong = bus/cs5536.c; + mips_yeeloong = bus/pci.c; + mips_yeeloong = commands/extcmd.c; + mips_yeeloong = font/font.c; + mips_yeeloong = font/font_cmd.c; + mips_yeeloong = io/bufio.c; + mips_yeeloong = kern/mips/cache.S; + mips_yeeloong = kern/mips/dl.c; mips_yeeloong = kern/mips/init.c; mips_yeeloong = kern/mips/yeeloong/init.c; - mips_yeeloong = kern/mm.c; - mips_yeeloong = kern/mips/dl.c; - mips_yeeloong = kern/generic/millisleep.c; - mips_yeeloong = kern/generic/rtc_get_time_ms.c; - mips_yeeloong = kern/time.c; - mips_yeeloong = kern/mips/cache.S; - mips_yeeloong = io/bufio.c; mips_yeeloong = lib/arg.c; - mips_yeeloong = commands/extcmd.c; - mips_yeeloong = bus/pci.c; - mips_yeeloong = bus/bonito.c; - mips_yeeloong = font/font_cmd.c; - mips_yeeloong = font/font.c; mips_yeeloong = term/at_keyboard.c; mips_yeeloong = term/gfxterm.c; - mips_yeeloong = video/video.c; - mips_yeeloong = video/fb/video_fb.c; + mips_yeeloong = term/serial.c; + mips_yeeloong = video/bitmap.c; + mips_yeeloong = video/bitmap_scale.c; mips_yeeloong = video/fb/fbblit.c; mips_yeeloong = video/fb/fbfill.c; mips_yeeloong = video/fb/fbutil.c; - mips_yeeloong = video/bitmap.c; - mips_yeeloong = video/bitmap_scale.c; + mips_yeeloong = video/fb/video_fb.c; mips_yeeloong = video/sm712.c; - mips_yeeloong = bus/cs5536.c; - mips_yeeloong = term/serial.c; - mips_yeeloong = term/terminfo.c; - mips_yeeloong = term/tparm.c; + mips_yeeloong = video/video.c; - powerpc_ieee1275 = kern/powerpc/ieee1275/startup.S; - powerpc_ieee1275 = kern/ieee1275/cmain.c; - powerpc_ieee1275 = kern/ieee1275/ieee1275.c; - powerpc_ieee1275 = kern/mm.c; powerpc_ieee1275 = kern/ieee1275/init.c; - powerpc_ieee1275 = kern/ieee1275/mmap.c; - powerpc_ieee1275 = kern/ieee1275/openfw.c; - powerpc_ieee1275 = kern/powerpc/dl.c; - powerpc_ieee1275 = kern/generic/millisleep.c; - powerpc_ieee1275 = kern/time.c; powerpc_ieee1275 = kern/powerpc/cache.S; - powerpc_ieee1275 = term/ieee1275/ofconsole.c; - powerpc_ieee1275 = disk/ieee1275/ofdisk.c; - powerpc_ieee1275 = term/terminfo.c; - powerpc_ieee1275 = term/tparm.c; + powerpc_ieee1275 = kern/powerpc/dl.c; - sparc64_ieee1275 = kern/sparc64/ieee1275/crt0.S; - sparc64_ieee1275 = kern/ieee1275/cmain.c; - sparc64_ieee1275 = kern/ieee1275/ieee1275.c; - sparc64_ieee1275 = kern/mm.c; + sparc64_ieee1275 = kern/sparc64/cache.S; + sparc64_ieee1275 = kern/sparc64/dl.c; sparc64_ieee1275 = kern/sparc64/ieee1275/ieee1275.c; sparc64_ieee1275 = kern/sparc64/ieee1275/init.c; - sparc64_ieee1275 = kern/ieee1275/mmap.c; - sparc64_ieee1275 = kern/ieee1275/openfw.c; - sparc64_ieee1275 = kern/sparc64/dl.c; - sparc64_ieee1275 = kern/generic/millisleep.c; - sparc64_ieee1275 = kern/time.c; - sparc64_ieee1275 = kern/sparc64/cache.S; - sparc64_ieee1275 = disk/ieee1275/ofdisk.c; - sparc64_ieee1275 = term/ieee1275/ofconsole.c; - sparc64_ieee1275 = term/terminfo.c; - sparc64_ieee1275 = term/tparm.c; - emu = kern/emu/mm.c; - emu = kern/emu/main.c; - emu = kern/emu/misc.c; - emu = kern/emu/getroot.c; - emu = kern/emu/time.c; - emu = kern/emu/hostdisk.c; - emu = kern/emu/hostfs.c; - emu = kern/emu/console.c; emu = disk/host.c; emu = gnulib/progname.c; + emu = kern/emu/console.c; + emu = kern/emu/getroot.c; + emu = kern/emu/hostdisk.c; + emu = kern/emu/hostfs.c; + emu = kern/emu/main.c; + emu = kern/emu/misc.c; + emu = kern/emu/mm.c; + emu = kern/emu/time.c; extra_dist = kern/i386/loader.S; extra_dist = kern/i386/realmode.S; @@ -244,8 +174,8 @@ program = { name = grub-emu; mansection = 1; - source = kern/emu/full.c; - nodist = grub_emu_init.c; + emu = kern/emu/full.c; + emu_nodist = grub_emu_init.c; ldadd = 'kernel.img$(EXEEXT)'; ldadd = '$(MODULE_FILES)'; @@ -257,9 +187,9 @@ program = { program = { name = grub-emu-lite; - source = kern/emu/lite.c; - source = kern/emu/cache.S; - nodist = symlist.c; + emu = kern/emu/lite.c; + emu = kern/emu/cache.S; + emu_nodist = symlist.c; ldadd = 'kernel.img$(EXEEXT)'; ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)'; @@ -271,6 +201,7 @@ image = { name = boot; i386_pc = boot/i386/pc/boot.S; i386_qemu = boot/i386/qemu/boot.S; + sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S; i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; @@ -279,7 +210,6 @@ image = { i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_BOOT_MACHINE_LINK_ADDR)'; i386_qemu_ccasflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)'; - sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S; sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big'; sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000'; @@ -345,19 +275,19 @@ image = { module = { name = trig; - nodist = trigtables.c; + common_nodist = trigtables.c; extra_dist = gentrigtables.c; }; module = { name = cs5536; - source = bus/cs5536.c; + i386 = bus/cs5536.c; enable = i386; }; module = { name = libusb; - source = bus/usb/emu/usb.c; + emu = bus/usb/emu/usb.c; enable = emu; condition = COND_GRUB_EMU_USB; }; @@ -370,36 +300,31 @@ module = { module = { name = usb; - source = bus/usb/usb.c; - source = bus/usb/usbtrans.c; - source = bus/usb/usbhub.c; + common = bus/usb/usb.c; + noemu = bus/usb/usbtrans.c; + noemu = bus/usb/usbhub.c; + enable = emu; enable = i386; enable = mips_yeeloong; -}; - -module = { - name = usb; - source = bus/usb/usb.c; - enable = emu; - condition = COND_GRUB_EMU_USB; + emu_condition = COND_GRUB_EMU_USB; }; module = { name = uhci; - source = bus/usb/uhci.c; + common = bus/usb/uhci.c; enable = i386_pc; }; module = { name = ohci; - source = bus/usb/ohci.c; + common = bus/usb/ohci.c; enable = i386_pc; enable = mips_yeeloong; }; module = { name = pci; - source = bus/pci.c; + noemu = bus/pci.c; emu = bus/emu/pci.c; emu = commands/lspci.c; @@ -408,13 +333,12 @@ module = { enable = x86_efi; enable = i386_ieee1275; enable = i386_coreboot; - emu_condition = COND_GRUB_EMU_PCI; }; library = { name = libgnulib.a; - source = gnulib/regex.c; + common = gnulib/regex.c; extra_dist = gnulib/regcomp.c; extra_dist = gnulib/regexec.c; @@ -427,20 +351,20 @@ library = { module = { name = cmostest; - source = commands/i386/cmostest.c; + i386 = commands/i386/cmostest.c; enable = i386_pc; enable = i386_coreboot; }; module = { name = iorw; - source = commands/iorw.c; + common = commands/iorw.c; enable = i386; }; module = { name = regexp; - source = commands/regexp.c; + common = commands/regexp.c; ldadd = libgnulib.a; cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; @@ -449,10 +373,8 @@ module = { module = { name = acpi; - x86_efi = commands/acpi.c; + i386 = commands/acpi.c; x86_efi = commands/efi/acpi.c; - - i386_pc = commands/acpi.c; i386_pc = commands/i386/pc/acpi.c; enable = x86_efi; @@ -461,48 +383,45 @@ module = { module = { name = blocklist; - source = commands/blocklist.c; + common = commands/blocklist.c; }; module = { name = boot; - source = commands/boot.c; - - i386_pc = commands/boot.c; + common = commands/boot.c; i386_pc = lib/i386/pc/biosnum.c; }; module = { name = cat; - source = commands/cat.c; + common = commands/cat.c; }; module = { name = cmp; - source = commands/cmp.c; + common = commands/cmp.c; }; module = { name = configfile; - source = commands/configfile.c; + common = commands/configfile.c; }; module = { name = cpuid; - source = commands/i386/cpuid.c; - + i386 = commands/i386/cpuid.c; enable = x86; }; module = { name = crc; - source = commands/crc.c; - source = lib/crc.c; + common = commands/crc.c; + common = lib/crc.c; }; module = { name = date; - source = commands/date.c; + common = commands/date.c; }; module = { @@ -515,13 +434,13 @@ module = { module = { name = echo; - source = commands/echo.c; + common = commands/echo.c; }; module = { name = extcmd; - source = commands/extcmd.c; - source = lib/arg.c; + common = commands/extcmd.c; + common = lib/arg.c; }; module = { @@ -532,43 +451,41 @@ module = { module = { name = gptsync; - source = commands/gptsync.c; + common = commands/gptsync.c; }; module = { name = halt; - source = commands/halt.c; - + nopc = commands/halt.c; i386_pc = commands/i386/pc/halt.c; }; module = { name = hashsum; - source = commands/hashsum.c; + common = commands/hashsum.c; }; module = { name = hdparm; - source = commands/hdparm.c; - source = lib/hexdump.c; - + common = commands/hdparm.c; + common = lib/hexdump.c; enable = i386_pc; }; module = { name = help; - source = commands/help.c; + common = commands/help.c; }; module = { name = hexdump; - source = commands/hexdump.c; - source = lib/hexdump.c; + common = commands/hexdump.c; + common = lib/hexdump.c; }; module = { name = keystatus; - source = commands/keystatus.c; + common = commands/keystatus.c; }; module = { @@ -579,23 +496,23 @@ module = { module = { name = loadenv; - source = commands/loadenv.c; - source = lib/envblk.c; + common = commands/loadenv.c; + common = lib/envblk.c; }; module = { name = ls; - source = commands/ls.c; + common = commands/ls.c; }; module = { name = lsmmap; - source = commands/lsmmap.c; + common = commands/lsmmap.c; }; module = { name = lspci; - source = commands/lspci.c; + common = commands/lspci.c; enable = x86; enable = mips; @@ -603,38 +520,38 @@ module = { module = { name = memrw; - source = commands/memrw.c; + common = commands/memrw.c; }; module = { name = minicmd; - source = commands/minicmd.c; + common = commands/minicmd.c; }; module = { name = parttool; - source = commands/parttool.c; + common = commands/parttool.c; }; module = { name = password; - source = commands/password.c; + common = commands/password.c; }; module = { name = password_pbkdf2; - source = commands/password_pbkdf2.c; + common = commands/password_pbkdf2.c; }; module = { name = play; - source = commands/i386/pc/play.c; + i386 = commands/i386/pc/play.c; enable = i386; }; module = { name = probe; - source = commands/probe.c; + common = commands/probe.c; }; module = { @@ -645,81 +562,75 @@ module = { module = { name = read; - source = commands/read.c; + common = commands/read.c; }; module = { name = reboot; - source = commands/reboot.c; + common = commands/reboot.c; }; module = { name = search; - source = commands/search_wrap.c; + common = commands/search_wrap.c; extra_dist = commands/search.c; }; module = { name = search_fs_file; - source = commands/search_file.c; + common = commands/search_file.c; }; module = { name = search_fs_uuid; - source = commands/search_uuid.c; + common = commands/search_uuid.c; }; module = { name = search_label; - source = commands/search_label.c; + common = commands/search_label.c; }; module = { name = setpci; - source = commands/setpci.c; - + common = commands/setpci.c; enable = x86; }; module = { name = sleep; - source = commands/sleep.c; + common = commands/sleep.c; }; module = { name = suspend; - source = commands/ieee1275/suspend.c; + ieee1275 = commands/ieee1275/suspend.c; enable = i386_ieee1275; enable = powerpc_ieee1275; }; module = { name = terminal; - source = commands/terminal.c; + common = commands/terminal.c; }; module = { name = test; - source = commands/test.c; + common = commands/test.c; }; module = { name = true; - source = commands/true.c; + common = commands/true.c; }; module = { name = usbtest; - source = commands/usbtest.c; + common = commands/usbtest.c; enable = i386_pc; enable = mips_yeeloong; -}; - -module = { - name = usbtest; - source = commands/usbtest.c; enable = emu; - condition = COND_GRUB_EMU_USB; + emu_condition = COND_GRUB_EMU_USB; }; module = { @@ -736,71 +647,69 @@ module = { module = { name = videotest; - source = commands/videotest.c; + common = commands/videotest.c; }; module = { name = xnu_uuid; - source = commands/xnu_uuid.c; + common = commands/xnu_uuid.c; }; module = { name = dm_nv; - source = disk/dmraid_nvidia.c; + common = disk/dmraid_nvidia.c; }; module = { name = loopback; - source = disk/loopback.c; + common = disk/loopback.c; }; module = { name = lvm; - source = disk/lvm.c; + common = disk/lvm.c; }; module = { name = mdraid; - source = disk/mdraid_linux.c; + common = disk/mdraid_linux.c; }; module = { name = raid; - source = disk/raid.c; + common = disk/raid.c; }; module = { name = raid5rec; - source = disk/raid5_recover.c; + common = disk/raid5_recover.c; }; module = { name = raid6rec; - source = disk/raid6_recover.c; + common = disk/raid6_recover.c; }; module = { name = scsi; - source = disk/scsi.c; + common = disk/scsi.c; }; module = { name = memdisk; - source = disk/memdisk.c; + common = disk/memdisk.c; }; module = { name = ata; - source = disk/ata.c; - + common = disk/ata.c; enable = x86; enable = mips; }; module = { name = ata_pthru; - source = disk/ata_pthru.c; - + common = disk/ata_pthru.c; enable = x86; enable = mips_yeeloong; }; @@ -813,22 +722,16 @@ module = { module = { name = usbms; - source = disk/usbms.c; + common = disk/usbms.c; enable = i386_pc; enable = mips_yeeloong; -}; - -module = { - name = usbms; - source = disk/usbms.c; enable = emu; - condition = COND_GRUB_EMU_USB; + emu_condition = COND_GRUB_EMU_USB; }; module = { name = nand; - source = disk/ieee1275/nand.c; - + ieee1275 = disk/ieee1275/nand.c; enable = i386_ieee1275; }; @@ -858,8 +761,8 @@ module = { module = { name = font; - source = font/font.c; - source = font/font_cmd.c; + common = font/font.c; + common = font/font_cmd.c; enable = emu; enable = x86; enable = sparc64; @@ -868,122 +771,122 @@ module = { module = { name = affs; - source = fs/affs.c; + common = fs/affs.c; }; module = { name = afs; - source = fs/afs.c; + common = fs/afs.c; }; module = { name = afs_be; - source = fs/afs_be.c; + common = fs/afs_be.c; }; module = { name = befs; - source = fs/befs.c; + common = fs/befs.c; }; module = { name = befs_be; - source = fs/befs_be.c; + common = fs/befs_be.c; }; module = { name = cpio; - source = fs/cpio.c; + common = fs/cpio.c; }; module = { name = ext2; - source = fs/ext2.c; + common = fs/ext2.c; }; module = { name = fat; - source = fs/fat.c; + common = fs/fat.c; }; module = { name = fshelp; - source = fs/fshelp.c; + common = fs/fshelp.c; }; module = { name = hfs; - source = fs/hfs.c; + common = fs/hfs.c; }; module = { name = hfsplus; - source = fs/hfsplus.c; + common = fs/hfsplus.c; }; module = { name = iso9660; - source = fs/iso9660.c; + common = fs/iso9660.c; }; module = { name = jfs; - source = fs/jfs.c; + common = fs/jfs.c; }; module = { name = minix; - source = fs/minix.c; + common = fs/minix.c; }; module = { name = nilfs2; - source = fs/nilfs2.c; + common = fs/nilfs2.c; }; module = { name = ntfs; - source = fs/ntfs.c; + common = fs/ntfs.c; }; module = { name = ntfscomp; - source = fs/ntfscomp.c; + common = fs/ntfscomp.c; }; module = { name = reiserfs; - source = fs/reiserfs.c; + common = fs/reiserfs.c; }; module = { name = sfs; - source = fs/sfs.c; + common = fs/sfs.c; }; module = { name = tar; - source = fs/tar.c; + common = fs/tar.c; }; module = { name = udf; - source = fs/udf.c; + common = fs/udf.c; }; module = { name = ufs1; - source = fs/ufs.c; + common = fs/ufs.c; }; module = { name = ufs2; - source = fs/ufs2.c; + common = fs/ufs2.c; }; module = { name = xfs; - source = fs/xfs.c; + common = fs/xfs.c; }; module = { @@ -994,43 +897,43 @@ module = { module = { name = gettext; - source = gettext/gettext.c; + common = gettext/gettext.c; }; module = { name = gfxmenu; - source = gfxmenu/gfxmenu.c; - source = gfxmenu/model.c; - source = gfxmenu/view.c; - source = gfxmenu/font.c; - source = gfxmenu/icon_manager.c; - source = gfxmenu/theme_loader.c; - source = gfxmenu/widget-box.c; - source = gfxmenu/gui_canvas.c; - source = gfxmenu/gui_circular_progress.c; - source = gfxmenu/gui_box.c; - source = gfxmenu/gui_label.c; - source = gfxmenu/gui_list.c; - source = gfxmenu/gui_image.c; - source = gfxmenu/gui_progress_bar.c; - source = gfxmenu/gui_util.c; - source = gfxmenu/gui_string_util.c; - source = gfxmenu/named_colors.c; + common = gfxmenu/gfxmenu.c; + common = gfxmenu/model.c; + common = gfxmenu/view.c; + common = gfxmenu/font.c; + common = gfxmenu/icon_manager.c; + common = gfxmenu/theme_loader.c; + common = gfxmenu/widget-box.c; + common = gfxmenu/gui_canvas.c; + common = gfxmenu/gui_circular_progress.c; + common = gfxmenu/gui_box.c; + common = gfxmenu/gui_label.c; + common = gfxmenu/gui_list.c; + common = gfxmenu/gui_image.c; + common = gfxmenu/gui_progress_bar.c; + common = gfxmenu/gui_util.c; + common = gfxmenu/gui_string_util.c; + common = gfxmenu/named_colors.c; }; module = { name = hello; - source = hello/hello.c; + common = hello/hello.c; }; module = { name = gzio; - source = io/gzio.c; + common = io/gzio.c; }; module = { name = bufio; - source = io/bufio.c; + common = io/bufio.c; enable = emu; enable = x86; enable = sparc64; @@ -1039,19 +942,19 @@ module = { module = { name = elf; - source = kern/elf.c; + common = kern/elf.c; }; module = { name = crypto; - source = lib/crypto.c; + common = lib/crypto.c; extra_dist = lib/libgcrypt-grub/cipher/crypto.lst; }; module = { name = pbkdf2; - source = lib/pbkdf2.c; + common = lib/pbkdf2.c; }; module = { @@ -1068,7 +971,7 @@ module = { module = { name = datetime; - source = lib/cmos_datetime.c; + x86_noefi_mips = lib/cmos_datetime.c; x86_efi = lib/efi/datetime.c; sparc64_ieee1275 = lib/ieee1275/datetime.c; powerpc_ieee1275 = lib/ieee1275/datetime.c; @@ -1080,7 +983,7 @@ module = { module = { name = setjmp; - source = lib/setjmp.S; + common = lib/setjmp.S; extra_dist = lib/i386/setjmp.S; extra_dist = lib/mips/setjmp.S; extra_dist = lib/x86_64/setjmp.S; @@ -1090,7 +993,7 @@ module = { module = { name = aout; - source = loader/aout.c; + common = loader/aout.c; enable = i386_pc; enable = i386_qemu; enable = i386_coreboot; @@ -1100,11 +1003,11 @@ module = { module = { name = bsd; - source = loader/i386/bsd.c; - source = loader/i386/bsd32.c; - source = loader/i386/bsd64.c; - source = loader/i386/bsd_helper.S; - source = loader/i386/bsd_trampoline.S; + i386 = loader/i386/bsd.c; + i386 = loader/i386/bsd32.c; + i386 = loader/i386/bsd64.c; + i386 = loader/i386/bsd_helper.S; + i386 = loader/i386/bsd_trampoline.S; extra_dist = loader/i386/bsdXX.c; extra_dist = loader/i386/bsd_pagetable.c; @@ -1117,7 +1020,7 @@ module = { module = { name = linux16; - source = loader/i386/pc/linux.c; + i386_pc = loader/i386/pc/linux.c; enable = i386_pc; }; @@ -1125,41 +1028,41 @@ module = { name = multiboot2; cppflags = "-DGRUB_USE_MULTIBOOT2"; - source = loader/multiboot.c; - source = loader/multiboot_mbi2.c; + common = loader/multiboot.c; + common = loader/multiboot_mbi2.c; enable = x86; enable = mips; }; module = { name = multiboot; - source = loader/multiboot.c; - source = loader/i386/multiboot_mbi.c; + common = loader/multiboot.c; + x86 = loader/i386/multiboot_mbi.c; extra_dist = loader/multiboot_elfxx.c; enable = x86; }; module = { name = linux; - i386 = loader/i386/linux.c; - i386_efi = loader/i386/efi/linux.c; - i386_ieee1275 = loader/i386/ieee1275/linux.c; - x86_64_efi = loader/i386/efi/linux.c; + i386_noefi_noieee1275 = loader/i386/linux.c; + + x86_efi = loader/i386/efi/linux.c; x86_64_efi = loader/i386/linux_trampoline.S; + i386_ieee1275 = loader/i386/ieee1275/linux.c; mips = loader/mips/linux.c; powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c; sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c; - enable = nonemu; + enable = noemu; }; module = { name = xnu; - source = loader/xnu_resume.c; - source = loader/i386/xnu.c; - source = loader/macho32.c; - source = loader/macho64.c; - source = loader/macho.c; - source = loader/xnu.c; + i386 = loader/xnu_resume.c; + i386 = loader/i386/xnu.c; + i386 = loader/macho32.c; + i386 = loader/macho64.c; + i386 = loader/macho.c; + i386 = loader/xnu.c; extra_dist = loader/machoXX.c; enable = i386_pc; @@ -1218,35 +1121,35 @@ module = { module = { name = normal; - source = normal/main.c; - source = normal/cmdline.c; - source = normal/dyncmd.c; - source = normal/auth.c; - source = normal/autofs.c; - source = normal/color.c; - source = normal/completion.c; - source = normal/datetime.c; - source = normal/menu.c; - source = normal/menu_entry.c; - source = normal/menu_text.c; - source = normal/misc.c; - source = normal/crypto.c; - source = normal/term.c; - source = normal/context.c; - source = normal/charset.c; + common = normal/main.c; + common = normal/cmdline.c; + common = normal/dyncmd.c; + common = normal/auth.c; + common = normal/autofs.c; + common = normal/color.c; + common = normal/completion.c; + common = normal/datetime.c; + common = normal/menu.c; + common = normal/menu_entry.c; + common = normal/menu_text.c; + common = normal/misc.c; + common = normal/crypto.c; + common = normal/term.c; + common = normal/context.c; + common = normal/charset.c; - source = script/main.c; - source = script/script.c; - source = script/execute.c; - source = script/function.c; - source = script/lexer.c; - source = script/argv.c; + common = script/main.c; + common = script/script.c; + common = script/execute.c; + common = script/function.c; + common = script/lexer.c; + common = script/argv.c; - source = unidata.c; - nodist = grub_script.tab.c; - nodist = grub_script.yy.c; - nodist = grub_script.tab.h; - nodist = grub_script.yy.h; + common = unidata.c; + common_nodist = grub_script.tab.c; + common_nodist = grub_script.yy.c; + common_nodist = grub_script.tab.h; + common_nodist = grub_script.yy.h; extra_dist = script/yylex.l; extra_dist = script/parser.y; @@ -1257,58 +1160,58 @@ module = { module = { name = part_acorn; - source = partmap/acorn.c; + common = partmap/acorn.c; }; module = { name = part_amiga; - source = partmap/amiga.c; + common = partmap/amiga.c; }; module = { name = part_apple; - source = partmap/apple.c; + common = partmap/apple.c; }; module = { name = part_gpt; - source = partmap/gpt.c; + common = partmap/gpt.c; }; module = { name = part_msdos; - source = partmap/msdos.c; + common = partmap/msdos.c; }; module = { name = part_sun; - source = partmap/sun.c; + common = partmap/sun.c; }; module = { name = part_bsd; - source = partmap/bsdlabel.c; + common = partmap/bsdlabel.c; }; module = { name = part_sunpc; - source = partmap/sunpc.c; + common = partmap/sunpc.c; }; module = { name = msdospart; - source = parttool/msdospart.c; + common = parttool/msdospart.c; }; module = { name = at_keyboard; - source = term/at_keyboard.c; + common = term/at_keyboard.c; enable = x86; }; module = { name = gfxterm; - source = term/gfxterm.c; + common = term/gfxterm.c; enable = emu; enable = x86; enable = sparc64; @@ -1317,19 +1220,19 @@ module = { module = { name = serial; - source = term/serial.c; + common = term/serial.c; enable = i386; }; module = { name = terminfo; - source = term/terminfo.c; - source = term/tparm.c; + common = term/terminfo.c; + common = term/tparm.c; }; module = { name = usb_keyboard; - source = term/usb_keyboard.c; + common = term/usb_keyboard.c; enable = i386_pc; enable = mips_yeeloong; }; @@ -1361,19 +1264,19 @@ module = { module = { name = functional_test; - source = tests/lib/functional_test.c; - source = tests/lib/test.c; + common = tests/lib/functional_test.c; + common = tests/lib/test.c; }; module = { name = example_functional_test; - source = tests/example_functional_test.c; + common = tests/example_functional_test.c; cflags = -Wno-format; }; module = { name = bitmap; - source = video/bitmap.c; + common = video/bitmap.c; enable = emu; enable = x86; enable = sparc64; @@ -1382,7 +1285,7 @@ module = { module = { name = bitmap_scale; - source = video/bitmap_scale.c; + common = video/bitmap_scale.c; enable = emu; enable = x86; enable = sparc64; @@ -1403,17 +1306,17 @@ module = { module = { name = jpeg; - source = video/readers/jpeg.c; + common = video/readers/jpeg.c; }; module = { name = png; - source = video/readers/png.c; + common = video/readers/png.c; }; module = { name = tga; - source = video/readers/tga.c; + common = video/readers/tga.c; }; module = { @@ -1424,10 +1327,10 @@ module = { module = { name = video_fb; - source = video/fb/video_fb.c; - source = video/fb/fbblit.c; - source = video/fb/fbfill.c; - source = video/fb/fbutil.c; + common = video/fb/video_fb.c; + common = video/fb/fbblit.c; + common = video/fb/fbfill.c; + common = video/fb/fbutil.c; enable = emu; enable = x86; enable = sparc64; @@ -1436,7 +1339,7 @@ module = { module = { name = video; - source = video/video.c; + common = video/video.c; enable = emu; enable = x86; enable = sparc64; @@ -1445,19 +1348,19 @@ module = { module = { name = ieee1275_fb; - source = video/ieee1275.c; + ieee1275 = video/ieee1275.c; enable = powerpc; enable = sparc64; }; module = { name = sdl; - source = video/emu/sdl.c; - condition = COND_GRUB_EMU_SDL; + emu = video/emu/sdl.c; enable = emu; + condition = COND_GRUB_EMU_SDL; }; module = { name = datehook; - source = hook/datehook.c; + common = hook/datehook.c; }; diff --git a/util/import_gcry.py b/util/import_gcry.py index 6280f001e..494a4ae7b 100644 --- a/util/import_gcry.py +++ b/util/import_gcry.py @@ -277,7 +277,7 @@ for cipher_file in cipher_files: conf.write ("module = {\n") conf.write (" name = %s;\n" % modname) for src in modfiles.split(): - conf.write (" source = %s;\n" % src) + conf.write (" common = %s;\n" % src) conf.write (" cflags = '$(CFLAGS_GCRY)';\n"); conf.write (" cppflags = '$(CPPFLAGS_GCRY)';\n"); conf.write ("};\n\n") From c721825b4fc6ad3d1e3f869bc7291037195f320e Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 21 Aug 2010 17:11:40 +0530 Subject: [PATCH 161/174] build fixes for mips and ieee1275 platforms --- configure.ac | 32 ++++++++++++++++---------------- gentpl.py | 1 + 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index b57a8580a..c05b506c7 100644 --- a/configure.ac +++ b/configure.ac @@ -71,11 +71,11 @@ case "$target_cpu" in sparc) target_cpu=sparc64 ;; mipsel|mips64el) target_cpu=mips; - machine_CFLAGS="-DGRUB_CPU_MIPSEL=1"; + machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1"; ;; mips|mips64) target_cpu=mips; - machine_CFLAGS="-DGRUB_CPU_MIPS=1"; + machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1"; ;; esac @@ -150,24 +150,24 @@ case "$host_os" in esac case "$platform" in - coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;; - multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;; - efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;; - ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;; - qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;; - pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;; - emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;; - 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" ;; + coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;; + multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;; + efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;; + ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;; + qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;; + pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;; + emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;; + yeeloong) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; + qemu-mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;; esac case "$target_cpu" in - mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;; - sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;; + mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;; + sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;; esac -machine_CFLAGS="$machine_CFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" +machine_CPPFLAGS="$machine_CPPFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`" -HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CFLAGS" -TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CFLAGS" +HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CPPFLAGS" +TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS" AC_SUBST(host_cpu) AC_SUBST(host_os) diff --git a/gentpl.py b/gentpl.py index 18672bdcd..bbec62413 100644 --- a/gentpl.py +++ b/gentpl.py @@ -40,6 +40,7 @@ GROUPS["x86_noefi_mips"] = GROUPS["x86_noefi"] + GROUPS["mips"] GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ] GROUPS["noieee1275"] = GRUB_PLATFORMS[:] for i in GROUPS["ieee1275"]: GROUPS["noieee1275"].remove(i) +GROUPS["ieee1275_mips"] = GROUPS["ieee1275"] + GROUPS["mips"] GROUPS["pci"] = GROUPS["x86"] + GROUPS["mips"] From 354128c8af84945e43a2d4a5ff6b0284d778cc56 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 21 Aug 2010 17:22:19 +0530 Subject: [PATCH 162/174] fix x86_64_efi build --- gentpl.py | 1 + grub-core/Makefile.core.def | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gentpl.py b/gentpl.py index bbec62413..5b7987390 100644 --- a/gentpl.py +++ b/gentpl.py @@ -16,6 +16,7 @@ GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"] GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ] GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc") +GROUPS["x86_efi_pc"] = GROUPS["x86_efi"] + ["i386_pc"] GROUPS["x86_noefi"] = GROUPS["x86"][:]; GROUPS["x86_noefi"].remove("i386_efi"); GROUPS["x86_noefi"].remove("x86_64_efi") GROUPS["i386_noefi"] = GROUPS["i386"][:]; GROUPS["i386_noefi"].remove("i386_efi") diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index b7c52b9d7..fd07012f7 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -409,7 +409,7 @@ module = { module = { name = cpuid; - i386 = commands/i386/cpuid.c; + x86 = commands/i386/cpuid.c; enable = x86; }; @@ -1057,12 +1057,12 @@ module = { module = { name = xnu; - i386 = loader/xnu_resume.c; - i386 = loader/i386/xnu.c; - i386 = loader/macho32.c; - i386 = loader/macho64.c; - i386 = loader/macho.c; - i386 = loader/xnu.c; + x86_efi_pc = loader/xnu_resume.c; + x86_efi_pc = loader/i386/xnu.c; + x86_efi_pc = loader/macho32.c; + x86_efi_pc = loader/macho64.c; + x86_efi_pc = loader/macho.c; + x86_efi_pc = loader/xnu.c; extra_dist = loader/machoXX.c; enable = i386_pc; From 5815f2c19a74ff4ad566163680fa915875a2acea Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 21 Aug 2010 21:03:26 +0530 Subject: [PATCH 163/174] picks 10_${host_kernel} script --- Makefile.util.def | 26 ++++++++++++++++++++------ configure.ac | 5 +++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Makefile.util.def b/Makefile.util.def index 04b3d6f1c..2ad7f6a57 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -203,12 +203,11 @@ program = { name = grub-mkdevicemap; installdir = sbin; mansection = 8; - nosparc64 = util/grub-mkdevicemap.c; - nosparc64 = util/deviceiter.c; + + common = util/grub-mkdevicemap.c; + common = util/deviceiter.c; nosparc64 = util/devicemap.c; - sparc64_ieee1275 = util/grub-mkdevicemap.c; - sparc64_ieee1275 = util/deviceiter.c; sparc64_ieee1275 = util/ieee1275/ofpath.c; sparc64_ieee1275 = util/ieee1275/devicemap.c; @@ -267,24 +266,39 @@ script = { installdir = grubconf; }; -/* script = { name = '10_windows'; common = util/grub.d/10_windows.in; installdir = grubconf; + condition = COND_host_windows; }; script = { name = '10_hurd'; common = util/grub.d/10_hurd.in; installdir = grubconf; + condition = COND_host_hurd; +}; + +script = { + name = '10_kfreebsd.in'; + common = util/grub.d/10_kfreebsd.in; + installdir = grubconf; + condition = COND_host_kfreebsd; +}; + +script = { + name = '10_netbsd.in'; + common = util/grub.d/10_netbsd.in; + installdir = grubconf; + condition = COND_host_netbsd; }; -*/ script = { name = '10_linux'; common = util/grub.d/10_linux.in; installdir = grubconf; + condition = COND_host_linux; }; script = { diff --git a/configure.ac b/configure.ac index c05b506c7..19ea08c9d 100644 --- a/configure.ac +++ b/configure.ac @@ -873,6 +873,11 @@ AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips]) AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) +AM_CONDITIONAL([COND_host_hurd], [test x$host_kernel = xhurd]) +AM_CONDITIONAL([COND_host_linux], [test x$host_kernel = xlinux]) +AM_CONDITIONAL([COND_host_netbsd], [test x$host_kernel = xnetbsd]) +AM_CONDITIONAL([COND_host_windows], [test x$host_kernel = xwindows]) +AM_CONDITIONAL([COND_host_kfreebsd], [test x$host_kernel = xkfreebsd]) AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x]) AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes]) From f51c98c48531f4bb9b936a7c7c2c339a42e252d3 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 21 Aug 2010 21:23:42 +0530 Subject: [PATCH 164/174] remove wrong extension --- Makefile.util.def | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.util.def b/Makefile.util.def index 2ad7f6a57..357722797 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -281,14 +281,14 @@ script = { }; script = { - name = '10_kfreebsd.in'; + name = '10_kfreebsd'; common = util/grub.d/10_kfreebsd.in; installdir = grubconf; condition = COND_host_kfreebsd; }; script = { - name = '10_netbsd.in'; + name = '10_netbsd'; common = util/grub.d/10_netbsd.in; installdir = grubconf; condition = COND_host_netbsd; From 0677694455a056b1a45ddcc6ad5044a1b08f5902 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sun, 22 Aug 2010 17:10:39 +0200 Subject: [PATCH 165/174] * term/at_keyboard.c (grub_at_keyboard_getkey_noblock): Don't discard a key after CapsLock or NumLock. It's just a qemu bug. --- ChangeLog | 5 +++++ term/at_keyboard.c | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b6a82a35..758b5cb5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-22 Vladimir Serbinenko + + * term/at_keyboard.c (grub_at_keyboard_getkey_noblock): Don't discard + a key after CapsLock or NumLock. It's just a qemu bug. + 2010-08-21 Vladimir Serbinenko * include/grub/usb.h (grub_usb_device): Add 'data' field back. It's diff --git a/term/at_keyboard.c b/term/at_keyboard.c index c3e71ea2d..25f32a0a5 100644 --- a/term/at_keyboard.c +++ b/term/at_keyboard.c @@ -181,9 +181,6 @@ grub_at_keyboard_getkey_noblock (void) switch (code) { case CAPS_LOCK: - /* Caps lock sends scan code twice. Get the second one and discard it. */ - while (grub_keyboard_getkey () == -1); - at_keyboard_status ^= KEYBOARD_STATUS_CAPS_LOCK; led_status ^= KEYBOARD_LED_CAPS; keyboard_controller_led (led_status); @@ -194,9 +191,6 @@ grub_at_keyboard_getkey_noblock (void) key = -1; break; case NUM_LOCK: - /* Num lock sends scan code twice. Get the second one and discard it. */ - while (grub_keyboard_getkey () == -1); - at_keyboard_status ^= KEYBOARD_STATUS_NUM_LOCK; led_status ^= KEYBOARD_LED_NUM; keyboard_controller_led (led_status); From 30c4f234ccf699a7b6668ee5a0efdfce49ba7333 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 23 Aug 2010 10:31:08 +0530 Subject: [PATCH 166/174] fix emu build --- grub-core/Makefile.core.def | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index fd1fb3d24..0733ef1c2 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -316,6 +316,7 @@ module = { enable = emu; enable = i386_pc; enable = mips_yeeloong; + emu_condition = COND_GRUB_EMU_USB; }; module = { @@ -324,6 +325,7 @@ module = { enable = emu; enable = i386_pc; enable = mips_yeeloong; + emu_condition = COND_GRUB_EMU_USB; }; module = { @@ -332,6 +334,7 @@ module = { enable = emu; enable = i386_pc; enable = mips_yeeloong; + emu_condition = COND_GRUB_EMU_USB; }; module = { From f7711f5ef1b493530e9127a22909d626b3aeb26d Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 23 Aug 2010 13:23:56 +0530 Subject: [PATCH 167/174] final touches --- Makefile.am | 4 +- Makefile.util.def | 26 +- conf/Makefile.common | 3 + conf/any-emu.rmk | 152 ------- conf/common.rmk | 837 ------------------------------------ conf/i386-coreboot.rmk | 78 ---- conf/i386-efi.rmk | 5 - conf/i386-ieee1275.rmk | 82 ---- conf/i386-multiboot.rmk | 74 ---- conf/i386-pc.rmk | 325 -------------- conf/i386-qemu.rmk | 86 ---- conf/i386.rmk | 94 ---- conf/mips-yeeloong.rmk | 143 ------ conf/mips.rmk | 27 -- conf/powerpc-ieee1275.rmk | 68 --- conf/sparc64-ieee1275.rmk | 104 ----- conf/tests.rmk | 110 ----- conf/x86-efi.rmk | 112 ----- conf/x86_64-efi.rmk | 5 - configure.ac | 11 +- grub-core/Makefile.core.def | 19 +- 21 files changed, 40 insertions(+), 2325 deletions(-) delete mode 100644 conf/any-emu.rmk delete mode 100644 conf/common.rmk delete mode 100644 conf/i386-coreboot.rmk delete mode 100644 conf/i386-efi.rmk delete mode 100644 conf/i386-ieee1275.rmk delete mode 100644 conf/i386-multiboot.rmk delete mode 100644 conf/i386-pc.rmk delete mode 100644 conf/i386-qemu.rmk delete mode 100644 conf/i386.rmk delete mode 100644 conf/mips-yeeloong.rmk delete mode 100644 conf/mips.rmk delete mode 100644 conf/powerpc-ieee1275.rmk delete mode 100644 conf/sparc64-ieee1275.rmk delete mode 100644 conf/tests.rmk delete mode 100644 conf/x86-efi.rmk delete mode 100644 conf/x86_64-efi.rmk diff --git a/Makefile.am b/Makefile.am index 4b7aa5e3a..f49a92ead 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,7 +46,7 @@ CLEANFILES += libgrub_a_init.c if COND_GRUB_MKFONT if COND_HAVE_FONT_SOURCE -pkgdata_DATA = unicode.pf2 ascii.pf2 ascii.h widthspec.h +grubdata_DATA = unicode.pf2 ascii.pf2 ascii.h widthspec.h endif endif @@ -81,3 +81,5 @@ CLEANFILES += widthspec.h # Install config.h into platformdir platform_HEADERS = config.h +pkglib_DATA += grub-mkconfig_lib +pkglib_DATA += update-grub_lib \ No newline at end of file diff --git a/Makefile.util.def b/Makefile.util.def index 357722797..89328d619 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -270,35 +270,42 @@ script = { name = '10_windows'; common = util/grub.d/10_windows.in; installdir = grubconf; - condition = COND_host_windows; + condition = COND_HOST_WINDOWS; }; script = { name = '10_hurd'; common = util/grub.d/10_hurd.in; installdir = grubconf; - condition = COND_host_hurd; + condition = COND_HOST_HURD; }; script = { name = '10_kfreebsd'; common = util/grub.d/10_kfreebsd.in; installdir = grubconf; - condition = COND_host_kfreebsd; + condition = COND_HOST_KFREEBSD; }; script = { name = '10_netbsd'; common = util/grub.d/10_netbsd.in; installdir = grubconf; - condition = COND_host_netbsd; + condition = COND_HOST_NETBSD; }; script = { name = '10_linux'; common = util/grub.d/10_linux.in; installdir = grubconf; - condition = COND_host_linux; + condition = COND_HOST_LINUX; +}; + +script = { + name = '20_linux_xen'; + common = util/grub.d/20_linux_xen.in; + installdir = grubconf; + condition = COND_HOST_LINUX; }; script = { @@ -322,9 +329,10 @@ script = { script = { mansection = 1; name = grub-mkrescue; - i386_pc_qemu_coreboot = util/grub-mkrescue.in; + i386_noieee1275 = util/grub-mkrescue.in; powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in; enable = i386_pc; + enable = x86_efi; enable = i386_qemu; enable = i386_coreboot; enable = powerpc_ieee1275; @@ -371,23 +379,25 @@ script = { script = { name = grub-mkconfig_lib; common = util/grub-mkconfig_lib.in; - installdir = pkglib; + installdir = noinst; }; script = { name = update-grub_lib; common = util/update-grub_lib.in; - installdir = pkglib; + installdir = noinst; }; script = { name = grub-shell; common = tests/util/grub-shell.in; + installdir = noinst; }; script = { name = grub-shell-tester; common = tests/util/grub-shell-tester.in; + installdir = noinst; }; script = { diff --git a/conf/Makefile.common b/conf/Makefile.common index 9e8d64361..eb70f7f77 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -69,6 +69,7 @@ CCASFLAGS_LIBRARY = $(CCASFLAGS_PROGRAM) # Other variables grubconfdir = $(sysconfdir)/grub.d +grubdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'` platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform) CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers @@ -100,6 +101,7 @@ KERNEL_HEADER_FILES = man_MANS = noinst_DATA = +pkglib_DATA = bin_SCRIPTS = sbin_SCRIPTS = bin_PROGRAMS = @@ -108,6 +110,7 @@ sbin_PROGRAMS = check_SCRIPTS = grubconf_DATA = check_PROGRAMS = +noinst_SCRIPTS = pkglib_SCRIPTS = noinst_PROGRAMS = grubconf_SCRIPTS = diff --git a/conf/any-emu.rmk b/conf/any-emu.rmk deleted file mode 100644 index 1b98a0e40..000000000 --- a/conf/any-emu.rmk +++ /dev/null @@ -1,152 +0,0 @@ -# -*- makefile -*- - -ifeq ($(target_cpu), sparc64) -COMMON_CFLAGS += -mno-app-regs -COMMON_LDFLAGS += -mno-relax -endif - -kernel_img_RELOCATABLE = yes -pkglib_PROGRAMS = kernel.img -kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \ - kern/err.c kern/list.c kern/command.c \ - kern/corecmd.c kern/file.c kern/fs.c kern/main.c kern/misc.c \ - kern/parser.c kern/partition.c kern/term.c \ - kern/rescue_reader.c kern/rescue_parser.c \ - \ - kern/emu/main.c kern/emu/mm.c kern/emu/misc.c \ - kern/emu/getroot.c kern/emu/time.c kern/emu/hostdisk.c \ - kern/emu/hostfs.c kern/emu/console.c \ - \ - gnulib/progname.c disk/host.c -kernel_img_HEADERS += datetime.h emu/misc.h -kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-char-subscripts -Wno-unused -Wno-deprecated-declarations -Wno-undef -I$(srcdir)/gnulib -kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -TARGET_NO_STRIP = yes - -# 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) -pkglib_MODULES += cpuid.mod -cpuid_mod_SOURCES = commands/i386/cpuid.c -cpuid_mod_CFLAGS = $(COMMON_CFLAGS) -cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS) -endif - -grub_emu_LDFLAGS = $(LIBCURSES) -ifeq ($(target_cpu), sparc64) -grub_emu_LDFLAGS += -m64 -melf64_sparc -mno-relax -endif - -ifeq ($(enable_grub_emu_usb), yes) -kernel_img_HEADERS += libusb.h - -pkglib_MODULES += libusb.mod -libusb_mod_SOURCES = bus/usb/emu/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) - -# For serial.mod. -pkglib_MODULES += usbserial_common.mod -usbserial_common_mod_SOURCES = bus/usb/serial/common.c -usbserial_common_mod_CFLAGS = $(COMMON_CFLAGS) -usbserial_common_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For serial.mod. -pkglib_MODULES += usbserial_pl2303.mod -usbserial_pl2303_mod_SOURCES = bus/usb/serial/pl2303.c -usbserial_pl2303_mod_CFLAGS = $(COMMON_CFLAGS) -usbserial_pl2303_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For serial.mod. -pkglib_MODULES += usbserial_ftdi.mod -usbserial_ftdi_mod_SOURCES = bus/usb/serial/ftdi.c -usbserial_ftdi_mod_CFLAGS = $(COMMON_CFLAGS) -usbserial_ftdi_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For serial.mod. -pkglib_MODULES += serial.mod -serial_mod_SOURCES = term/serial.c -serial_mod_CFLAGS = $(COMMON_CFLAGS) -serial_mod_LDFLAGS = $(COMMON_LDFLAGS) - -grub_emu_LDFLAGS += $(LIBUSB) -endif - -ifeq ($(enable_grub_emu_sdl), yes) -pkglib_MODULES += sdl.mod -sdl_mod_SOURCES = video/emu/sdl.c -sdl_mod_CFLAGS = -sdl_mod_LDFLAGS = $(COMMON_LDFLAGS) -grub_emu_LDFLAGS += $(LIBSDL) -kernel_img_HEADERS += sdl.h -endif - -ifeq ($(enable_grub_emu_pci), yes) -pkglib_MODULES += pci.mod -pci_mod_SOURCES = bus/emu/pci.c commands/lspci.c -pci_mod_LDFLAGS = $(COMMON_LDFLAGS) -grub_emu_LDFLAGS += $(LIBPCIACCESS) -kernel_img_HEADERS += libpciaccess.h -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 - -grub_emu_init.c: genemuinit.sh $(pkglib_MODULES) grub_emu_init.h - rm -f $@; echo $(pkglib_MODULES) | sh $(srcdir)/genemuinit.sh $(NM) > $@ -DISTCLEANFILES += grub_emu_init.c - -grub_emu_init.o: grub_emu_init.c grub_emu_init.h - rm -f $@; $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"grub_init.c\" -c -o $@ $< -CLEANFILES += grub_emu_init.o - -kern_emu_lite.o: kern/emu/lite.c - $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"kern/emu/lite.c\" -c -o $@ $< -CLEANFILES += kern_emu_lite.o - -kern_emu_full.o: kern/emu/full.c - $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"kern/emu/full.c\" -c -o $@ $< -CLEANFILES += kern_emu_full.o - -kern_emu_cache.o: kern/emu/cache.S - $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(TARGET_ASFLAGS) -DGRUB_FILE=\"kern/emu/cache.S\" -c -o $@ $< -CLEANFILES += kern_emu_cache.o - -symlist.o: symlist.c - $(TARGET_CC) $(COMMON_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -DGRUB_FILE=\"symlist.c\" -c -o $@ $< -CLEANFILES += symlist.o - -CLEANFILES += grub-emu-lite -grub-emu-lite: kern_emu_lite.o kern_emu_cache.o symlist.o kernel.img - $(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS) -GRUB_EMU_LITE=grub-emu-lite - -CLEANFILES += grub-emu -grub-emu: $(PREMODFILES) kern_emu_full.o grub_emu_init.o kernel.img - $(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS) -GRUB_EMU=grub-emu diff --git a/conf/common.rmk b/conf/common.rmk deleted file mode 100644 index 908bd74e8..000000000 --- a/conf/common.rmk +++ /dev/null @@ -1,837 +0,0 @@ -# -*- makefile -*- - -# Used by various components. These rules need to precede them. -script/lexer.c_DEPENDENCIES = grub_script.tab.h grub_script.yy.h - -sbin_UTILITIES += grub-mkdevicemap -grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \ - util/deviceiter.c \ - util/misc.c kern/emu/misc.c \ - kern/env.c kern/err.c kern/list.c kern/misc.c kern/emu/mm.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-mkimage. -bin_UTILITIES += grub-mkimage -grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkimage.c util/misc.c \ - util/resolve.c kern/emu/misc.c lib/LzmaEnc.c lib/LzFind.c -util/grub-mkimage.c_DEPENDENCIES = Makefile - -# For grub-probe. -sbin_UTILITIES += grub-probe -util/grub-probe.c_DEPENDENCIES = grub_probe_init.h -grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \ - kern/emu/hostdisk.c util/misc.c kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c \ - kern/device.c kern/disk.c kern/err.c kern/misc.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/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/nilfs2.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 \ - \ - 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 \ - disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ - disk/mdraid_linux.c disk/lvm.c grub_probe_init.c - -ifeq ($(enable_grub_fstest), yes) -bin_UTILITIES += grub-fstest -endif - -# For grub-fstest. -util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h -grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c kern/emu/hostfs.c \ - util/misc.c kern/emu/misc.c kern/emu/mm.c \ - kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \ - disk/host.c disk/loopback.c kern/list.c kern/command.c \ - lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \ - lib/hexdump.c lib/crc.c commands/blocklist.c commands/ls.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/nilfs2.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 \ - \ - kern/partition.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 disk/raid.c \ - disk/raid5_recover.c disk/raid6_recover.c \ - disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \ - grub_fstest_init.c - -# For grub-mkfont. -ifeq ($(enable_grub_mkfont), yes) -bin_UTILITIES += grub-mkfont -grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c \ - unidata.c kern/emu/misc.c -grub_mkfont_CFLAGS = $(freetype_cflags) -grub_mkfont_LDFLAGS = $(freetype_libs) -endif - -# For grub-mkrelpath. -bin_UTILITIES += grub-mkrelpath -grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c kern/emu/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 -grub_script_check_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c \ - util/grub-script-check.c util/misc.c kern/emu/misc.c kern/emu/mm.c \ - script/main.c script/script.c script/function.c script/lexer.c \ - kern/err.c kern/list.c \ - kern/command.c kern/misc.c kern/env.c grub_script.tab.c \ - grub_script.yy.c -grub_script_check_CFLAGS = $(GNULIB_UTIL_CFLAGS) -grub_script_check_DEPENDENCIES = grub_script.tab.h -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 command.h i18n.h env_private.h libgcc.h - -ifneq ($(platform), emu) -kernel_img_HEADERS += machine/memory.h machine/loader.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. -grub_script.tab.c grub_script.tab.h: script/parser.y - $(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y -DISTCLEANFILES += grub_script.tab.c grub_script.tab.h - -# For grub-probe. -grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES)) - rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@ -DISTCLEANFILES += grub_probe_init.lst - -grub_probe_init.h: grub_probe_init.lst $(filter-out grub_probe_init.c,$(grub_probe_SOURCES)) geninitheader.sh - rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@ -DISTCLEANFILES += grub_probe_init.h - -grub_probe_init.c: grub_probe_init.lst $(filter-out grub_probe_init.c,$(grub_probe_SOURCES)) geninit.sh grub_probe_init.h - rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@ -DISTCLEANFILES += grub_probe_init.c - -# For grub-setup. -grub_setup_init.lst: geninit.sh $(filter-out grub_setup_init.c,$(grub_setup_SOURCES)) - rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@ -DISTCLEANFILES += grub_setup_init.lst - -grub_setup_init.h: grub_setup_init.lst $(filter-out grub_setup_init.c,$(grub_setup_SOURCES)) geninitheader.sh - rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@ -DISTCLEANFILES += grub_setup_init.h - -grub_setup_init.c: grub_setup_init.lst $(filter-out grub_setup_init.c,$(grub_setup_SOURCES)) geninit.sh grub_setup_init.h - rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@ -DISTCLEANFILES += grub_setup_init.c - -# For grub-fstest. -grub_fstest_init.lst: geninit.sh $(filter-out grub_fstest_init.c,$(grub_fstest_SOURCES)) - rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@ -DISTCLEANFILES += grub_fstest_init.lst - -grub_fstest_init.h: grub_fstest_init.lst $(filter-out grub_fstest_init.c,$(grub_fstest_SOURCES)) geninitheader.sh - rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@ -DISTCLEANFILES += grub_fstest_init.h - -grub_fstest_init.c: grub_fstest_init.lst $(filter-out grub_fstest_init.c,$(grub_fstest_SOURCES)) geninit.sh grub_fstest_init.h - rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@ -DISTCLEANFILES += grub_fstest_init.c - -# for grub-editenv -bin_UTILITIES += grub-editenv -grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c kern/emu/misc.c kern/emu/mm.c kern/misc.c kern/err.c -CLEANFILES += grub-editenv - -# Needed for genmk.rb to work -ifeq (0,1) -bin_UTILITIES += grub-macho2img grub-pe2elf -endif - -grub_pe2elf_SOURCES = gnulib/progname.c util/grub-pe2elf.c util/misc.c kern/emu/misc.c -CLEANFILES += grub-pe2elf - -grub_macho2img_SOURCES = util/grub-macho2img.c -CLEANFILES += grub-macho2img - -# For grub-mkconfig -grub-mkconfig: util/grub-mkconfig.in config.status - ./config.status --file=$@:$< - chmod +x $@ -sbin_SCRIPTS += grub-mkconfig -CLEANFILES += grub-mkconfig - -grub-mkconfig_lib: util/grub-mkconfig_lib.in config.status - ./config.status --file=$@:$< - chmod +x $@ -lib_SCRIPTS += grub-mkconfig_lib -CLEANFILES += grub-mkconfig_lib - -update-grub_lib: util/update-grub_lib.in config.status - ./config.status --file=$@:$< - chmod +x $@ -lib_SCRIPTS += update-grub_lib -CLEANFILES += update-grub_lib - -grub-gettext_lib: util/grub-gettext_lib.in config.status - ./config.status --file=$@:$< - chmod +x $@ -lib_DATA += grub-gettext_lib -CLEANFILES += grub-gettext_lib - -%: util/grub.d/%.in config.status - ./config.status --file=$@:$< - chmod +x $@ -grub-mkconfig_SCRIPTS = 00_header 30_os-prober 40_custom 41_custom -ifneq (, $(host_kernel)) -grub-mkconfig_SCRIPTS += 10_$(host_kernel) -endif -ifeq (linux, $(host_kernel)) -grub-mkconfig_SCRIPTS += 20_linux_xen -endif - -CLEANFILES += $(grub-mkconfig_SCRIPTS) - -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. -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 \ - affs.mod sfs.mod hfsplus.mod reiserfs.mod cpio.mod tar.mod \ - udf.mod afs.mod afs_be.mod befs.mod befs_be.mod - -# For fshelp.mod. -fshelp_mod_SOURCES = fs/fshelp.c -fshelp_mod_CFLAGS = $(COMMON_CFLAGS) -fshelp_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For fat.mod. -fat_mod_SOURCES = fs/fat.c -fat_mod_CFLAGS = $(COMMON_CFLAGS) -fat_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For ufs1.mod. -ufs1_mod_SOURCES = fs/ufs.c -ufs1_mod_CFLAGS = $(COMMON_CFLAGS) -ufs1_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For ufs2.mod. -ufs2_mod_SOURCES = fs/ufs2.c -ufs2_mod_CFLAGS = $(COMMON_CFLAGS) -ufs2_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For ext2.mod. -ext2_mod_SOURCES = fs/ext2.c -ext2_mod_CFLAGS = $(COMMON_CFLAGS) -ext2_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For ntfs.mod. -ntfs_mod_SOURCES = fs/ntfs.c -ntfs_mod_CFLAGS = $(COMMON_CFLAGS) -ntfs_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For ntfscomp.mod. -ntfscomp_mod_SOURCES = fs/ntfscomp.c -ntfscomp_mod_CFLAGS = $(COMMON_CFLAGS) -ntfscomp_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For minix.mod. -minix_mod_SOURCES = fs/minix.c -minix_mod_CFLAGS = $(COMMON_CFLAGS) -minix_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For nilfs2.mod. -pkglib_MODULES += nilfs2.mod -nilfs2_mod_SOURCES = fs/nilfs2.c -nilfs2_mod_CFLAGS = $(COMMON_CFLAGS) -nilfs2_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For hfs.mod. -hfs_mod_SOURCES = fs/hfs.c -hfs_mod_CFLAGS = $(COMMON_CFLAGS) -hfs_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For jfs.mod. -jfs_mod_SOURCES = fs/jfs.c -jfs_mod_CFLAGS = $(COMMON_CFLAGS) -jfs_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For iso9660.mod. -iso9660_mod_SOURCES = fs/iso9660.c -iso9660_mod_CFLAGS = $(COMMON_CFLAGS) -iso9660_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For xfs.mod. -xfs_mod_SOURCES = fs/xfs.c -xfs_mod_CFLAGS = $(COMMON_CFLAGS) -xfs_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For affs.mod. -affs_mod_SOURCES = fs/affs.c -affs_mod_CFLAGS = $(COMMON_CFLAGS) -affs_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For sfs.mod. -sfs_mod_SOURCES = fs/sfs.c -sfs_mod_CFLAGS = $(COMMON_CFLAGS) -sfs_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For hfsplus.mod. -hfsplus_mod_SOURCES = fs/hfsplus.c -hfsplus_mod_CFLAGS = $(COMMON_CFLAGS) -hfsplus_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For reiserfs.mod. -reiserfs_mod_SOURCES = fs/reiserfs.c -reiserfs_mod_CFLAGS = $(COMMON_CFLAGS) -reiserfs_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For cpio.mod. -cpio_mod_SOURCES = fs/cpio.c -cpio_mod_CFLAGS = $(COMMON_CFLAGS) -cpio_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For tar.mod. -tar_mod_SOURCES = fs/tar.c -tar_mod_CFLAGS = $(COMMON_CFLAGS) -tar_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For udf.mod. -udf_mod_SOURCES = fs/udf.c -udf_mod_CFLAGS = $(COMMON_CFLAGS) -udf_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For afs.mod. -afs_mod_SOURCES = fs/afs.c -afs_mod_CFLAGS = $(COMMON_CFLAGS) -afs_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For afs_be.mod. -afs_be_mod_SOURCES = fs/afs_be.c -afs_be_mod_CFLAGS = $(COMMON_CFLAGS) -afs_be_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For befs.mod. -befs_mod_SOURCES = fs/befs.c -befs_mod_CFLAGS = $(COMMON_CFLAGS) -befs_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For befs_be.mod. -befs_be_mod_SOURCES = fs/befs_be.c -befs_be_mod_CFLAGS = $(COMMON_CFLAGS) -befs_be_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# Partition maps. - -pkglib_MODULES += part_amiga.mod -part_amiga_mod_SOURCES = partmap/amiga.c -part_amiga_mod_CFLAGS = $(COMMON_CFLAGS) -part_amiga_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += part_apple.mod -part_apple_mod_SOURCES = partmap/apple.c -part_apple_mod_CFLAGS = $(COMMON_CFLAGS) -part_apple_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += part_msdos.mod -part_msdos_mod_SOURCES = partmap/msdos.c -part_msdos_mod_CFLAGS = $(COMMON_CFLAGS) -part_msdos_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += part_sun.mod -part_sun_mod_SOURCES = partmap/sun.c -part_sun_mod_CFLAGS = $(COMMON_CFLAGS) -part_sun_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += part_acorn.mod -part_acorn_mod_SOURCES = partmap/acorn.c -part_acorn_mod_CFLAGS = $(COMMON_CFLAGS) -part_acorn_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += part_gpt.mod -part_gpt_mod_SOURCES = partmap/gpt.c -part_gpt_mod_CFLAGS = $(COMMON_CFLAGS) -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 - -pkglib_MODULES += raid.mod raid5rec.mod raid6rec.mod mdraid.mod dm_nv.mod \ - lvm.mod scsi.mod - -# For raid.mod -raid_mod_SOURCES = disk/raid.c -raid_mod_CFLAGS = $(COMMON_CFLAGS) -raid_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For raid5rec.mod -raid5rec_mod_SOURCES = disk/raid5_recover.c -raid5rec_mod_CFLAGS = $(COMMON_CFLAGS) -raid5rec_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For raid6rec.mod -raid6rec_mod_SOURCES = disk/raid6_recover.c -raid6rec_mod_CFLAGS = $(COMMON_CFLAGS) -raid6rec_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For mdraid.mod -mdraid_mod_SOURCES = disk/mdraid_linux.c -mdraid_mod_CFLAGS = $(COMMON_CFLAGS) -mdraid_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For dm_nv.mod -dm_nv_mod_SOURCES = disk/dmraid_nvidia.c -dm_nv_mod_CFLAGS = $(COMMON_CFLAGS) -dm_nv_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For lvm.mod -lvm_mod_SOURCES = disk/lvm.c -lvm_mod_CFLAGS = $(COMMON_CFLAGS) -lvm_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For scsi.mod -scsi_mod_SOURCES = disk/scsi.c -scsi_mod_CFLAGS = $(COMMON_CFLAGS) -scsi_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# Commands. -pkglib_MODULES += minicmd.mod extcmd.mod hello.mod \ - ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod \ - configfile.mod echo.mod \ - test.mod blocklist.mod hexdump.mod \ - read.mod sleep.mod loadenv.mod crc.mod parttool.mod \ - msdospart.mod memrw.mod normal.mod \ - gptsync.mod true.mod probe.mod password.mod \ - keystatus.mod - -# For password.mod. -password_mod_SOURCES = commands/password.c -password_mod_CFLAGS = $(COMMON_CFLAGS) -password_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For gptsync.mod. -gptsync_mod_SOURCES = commands/gptsync.c -gptsync_mod_CFLAGS = $(COMMON_CFLAGS) -gptsync_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For minicmd.mod. -minicmd_mod_SOURCES = commands/minicmd.c -minicmd_mod_CFLAGS = $(COMMON_CFLAGS) -minicmd_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For extcmd.mod. -extcmd_mod_SOURCES = commands/extcmd.c lib/arg.c -extcmd_mod_CFLAGS = $(COMMON_CFLAGS) -extcmd_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For hello.mod. -hello_mod_SOURCES = hello/hello.c -hello_mod_CFLAGS = $(COMMON_CFLAGS) -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/font.c -gfxmenu_mod_CFLAGS = $(COMMON_CFLAGS) -gfxmenu_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For parttool.mod. -parttool_mod_SOURCES = commands/parttool.c -parttool_mod_CFLAGS = $(COMMON_CFLAGS) -parttool_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For msdospart.mod. -msdospart_mod_SOURCES = parttool/msdospart.c -msdospart_mod_CFLAGS = $(COMMON_CFLAGS) -msdospart_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For ls.mod. -ls_mod_SOURCES = commands/ls.c -ls_mod_CFLAGS = $(COMMON_CFLAGS) -ls_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For cmp.mod. -cmp_mod_SOURCES = commands/cmp.c -cmp_mod_CFLAGS = $(COMMON_CFLAGS) -cmp_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For cat.mod. -cat_mod_SOURCES = commands/cat.c -cat_mod_CFLAGS = $(COMMON_CFLAGS) -cat_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For echo.mod -echo_mod_SOURCES = commands/echo.c -echo_mod_CFLAGS = $(COMMON_CFLAGS) -echo_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For help.mod. -help_mod_SOURCES = commands/help.c -help_mod_CFLAGS = $(COMMON_CFLAGS) -help_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For search.mod. -search_mod_SOURCES = commands/search_wrap.c -search_mod_CFLAGS = $(COMMON_CFLAGS) -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. -test_mod_SOURCES = commands/test.c -test_mod_CFLAGS = $(COMMON_CFLAGS) -test_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For loopback.mod -loopback_mod_SOURCES = disk/loopback.c -loopback_mod_CFLAGS = $(COMMON_CFLAGS) -loopback_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For configfile.mod -configfile_mod_SOURCES = commands/configfile.c -configfile_mod_CFLAGS = $(COMMON_CFLAGS) -configfile_mod_LDFLAGS = $(COMMON_LDFLAGS) - -ifneq ($(platform), ieee1275) -# For terminfo.mod. -pkglib_MODULES += terminfo.mod -terminfo_mod_SOURCES = term/terminfo.c term/tparm.c -terminfo_mod_CFLAGS = $(COMMON_CFLAGS) -terminfo_mod_LDFLAGS = $(COMMON_LDFLAGS) -endif - -# For blocklist.mod. -blocklist_mod_SOURCES = commands/blocklist.c -blocklist_mod_CFLAGS = $(COMMON_CFLAGS) -blocklist_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For hexdump.mod. -hexdump_mod_SOURCES = commands/hexdump.c lib/hexdump.c -hexdump_mod_CFLAGS = $(COMMON_CFLAGS) -hexdump_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For read.mod. -read_mod_SOURCES = commands/read.c -read_mod_CFLAGS = $(COMMON_CFLAGS) -read_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For sleep.mod. -sleep_mod_SOURCES = commands/sleep.c -sleep_mod_CFLAGS = $(COMMON_CFLAGS) -sleep_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For loadenv.mod. -loadenv_mod_SOURCES = commands/loadenv.c lib/envblk.c -loadenv_mod_CFLAGS = $(COMMON_CFLAGS) -loadenv_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For crc.mod. -crc_mod_SOURCES = commands/crc.c lib/crc.c -crc_mod_CFLAGS = $(COMMON_CFLAGS) -crc_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For memrw.mod. -memrw_mod_SOURCES = commands/memrw.c -memrw_mod_CFLAGS = $(COMMON_CFLAGS) -memrw_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For true.mod -true_mod_SOURCES = commands/true.c -true_mod_CFLAGS = $(COMMON_CFLAGS) -true_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For probe.mod. -probe_mod_SOURCES = commands/probe.c -probe_mod_CFLAGS = $(COMMON_CFLAGS) -probe_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For keystatus.mod. -keystatus_mod_SOURCES = commands/keystatus.c -keystatus_mod_CFLAGS = $(COMMON_CFLAGS) -keystatus_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For normal.mod. -ifneq (, $(FONT_SOURCE)) -normal/charset.c_DEPENDENCIES = widthspec.h -endif -normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \ - normal/auth.c normal/autofs.c \ - normal/color.c normal/completion.c normal/datetime.c normal/menu.c \ - normal/menu_entry.c normal/menu_text.c normal/charset.c \ - normal/misc.c normal/crypto.c normal/term.c normal/context.c \ - script/main.c script/script.c script/execute.c script/argv.c unidata.c \ - script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c -normal_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error -normal_mod_LDFLAGS = $(COMMON_LDFLAGS) - -ifneq (, $(FONT_SOURCE)) -font/font.c_DEPENDENCIES = ascii.h -endif - -# Common Video Subsystem specific modules. -# On Yeeloong it's part of kernel -ifneq ($(platform), yeeloong) - -# For video.mod. -pkglib_MODULES += video.mod -video_mod_SOURCES = video/video.c -video_mod_CFLAGS = $(COMMON_CFLAGS) -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/fbfill.c video/fb/fbutil.c -video_fb_mod_CFLAGS = $(COMMON_CFLAGS) -video_fb_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For bitmap.mod -pkglib_MODULES += bitmap.mod -bitmap_mod_SOURCES = video/bitmap.c -bitmap_mod_CFLAGS = $(COMMON_CFLAGS) -bitmap_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For bitmap_scale.mod -pkglib_MODULES += bitmap_scale.mod -bitmap_scale_mod_SOURCES = video/bitmap_scale.c -bitmap_scale_mod_CFLAGS = $(COMMON_CFLAGS) -bitmap_scale_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += font.mod -font_mod_SOURCES = font/font_cmd.c font/font.c -font_mod_CFLAGS = $(COMMON_CFLAGS) -font_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For gfxterm.mod. -pkglib_MODULES += gfxterm.mod -gfxterm_mod_SOURCES = term/gfxterm.c -gfxterm_mod_CFLAGS = $(COMMON_CFLAGS) -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. -pkglib_MODULES += gzio.mod elf.mod - -# For elf.mod. -elf_mod_SOURCES = kern/elf.c -elf_mod_CFLAGS = $(COMMON_CFLAGS) -elf_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For gzio.mod. -gzio_mod_SOURCES = io/gzio.c -gzio_mod_CFLAGS = $(COMMON_CFLAGS) -gzio_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# On Yeeloong it's part of kernel -ifneq ($(platform), yeeloong) -# For bufio.mod. -pkglib_MODULES += bufio.mod -bufio_mod_SOURCES = io/bufio.c -bufio_mod_CFLAGS = $(COMMON_CFLAGS) -bufio_mod_LDFLAGS = $(COMMON_LDFLAGS) -endif - -# For gettext.mod. -pkglib_MODULES += gettext.mod -gettext_mod_SOURCES = gettext/gettext.c -gettext_mod_CFLAGS = $(COMMON_CFLAGS) -gettext_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# Misc. -pkglib_MODULES += xnu_uuid.mod - -# For elf.mod. -xnu_uuid_mod_SOURCES = commands/xnu_uuid.c -xnu_uuid_mod_CFLAGS = $(COMMON_CFLAGS) -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 -setjmp_mod_SOURCES = lib/$(target_cpu)/setjmp.S -setjmp_mod_ASFLAGS = $(COMMON_ASFLAGS) -setjmp_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. -pkglib_MODULES += memdisk.mod -memdisk_mod_SOURCES = disk/memdisk.c -memdisk_mod_CFLAGS = $(COMMON_CFLAGS) -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 kern/emu/misc.c kern/emu/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 diff --git a/conf/i386-coreboot.rmk b/conf/i386-coreboot.rmk deleted file mode 100644 index 259f4e162..000000000 --- a/conf/i386-coreboot.rmk +++ /dev/null @@ -1,78 +0,0 @@ -# -*- makefile -*- - -COMMON_CFLAGS = -mrtd -mregparm=3 - -# Images. - -pkglib_PROGRAMS += kernel.img -kernel_img_SOURCES = kern/i386/coreboot/startup.S \ - kern/i386/misc.S \ - kern/i386/coreboot/init.c \ - kern/i386/coreboot/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/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) -kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x8200,-Bstatic - -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) - -# For cmostest.mod -pkglib_MODULES += cmostest.mod -cmostest_mod_SOURCES = commands/i386/cmostest.c -cmostest_mod_CFLAGS = $(COMMON_CFLAGS) -cmostest_mod_LDFLAGS = $(COMMON_LDFLAGS) - -include $(srcdir)/conf/i386.mk -include $(srcdir)/conf/common.mk diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk deleted file mode 100644 index e826cb333..000000000 --- a/conf/i386-efi.rmk +++ /dev/null @@ -1,5 +0,0 @@ -# -*- makefile -*- - -COMMON_LDFLAGS = -melf_i386 - -include $(srcdir)/conf/x86-efi.mk diff --git a/conf/i386-ieee1275.rmk b/conf/i386-ieee1275.rmk deleted file mode 100644 index 29b3ade3c..000000000 --- a/conf/i386-ieee1275.rmk +++ /dev/null @@ -1,82 +0,0 @@ -# -*- makefile -*- - -COMMON_CFLAGS = -mrtd -mregparm=3 - -# Images. -pkglib_PROGRAMS = kernel.img - -# For kernel.img. -kernel_img_SOURCES = kern/i386/ieee1275/startup.S \ - kern/i386/misc.S \ - kern/i386/ieee1275/init.c \ - kern/ieee1275/init.c \ - kern/ieee1275/mmap.c \ - kern/ieee1275/cmain.c kern/ieee1275/openfw.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/$(target_cpu)/dl.c kern/parser.c kern/partition.c \ - kern/env.c \ - kern/time.c kern/list.c kern/command.c kern/corecmd.c \ - kern/generic/millisleep.c \ - kern/ieee1275/ieee1275.c \ - term/ieee1275/ofconsole.c \ - term/terminfo.c term/tparm.c \ - disk/ieee1275/ofdisk.c \ - symlist.c -kernel_img_HEADERS += ieee1275/ieee1275.h terminfo.h -kernel_img_CFLAGS = $(COMMON_CFLAGS) -kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x10000,-Bstatic - -# Scripts. -sbin_SCRIPTS = grub-install - -# For grub-install. -grub_install_SOURCES = util/ieee1275/grub-install.in - -# Modules. -pkglib_MODULES = halt.mod suspend.mod \ - aout.mod linux.mod \ - nand.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 aout.mod. -aout_mod_SOURCES = loader/aout.c -aout_mod_CFLAGS = $(COMMON_CFLAGS) -aout_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For suspend.mod -suspend_mod_SOURCES = commands/ieee1275/suspend.c -suspend_mod_CFLAGS = $(COMMON_CFLAGS) -suspend_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For halt.mod -halt_mod_SOURCES = commands/halt.c -halt_mod_CFLAGS = $(COMMON_CFLAGS) -halt_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For linux.mod. -linux_mod_SOURCES = loader/i386/ieee1275/linux.c -linux_mod_CFLAGS = $(COMMON_CFLAGS) -linux_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For nand.mod. -nand_mod_SOURCES = disk/ieee1275/nand.c -nand_mod_CFLAGS = $(COMMON_CFLAGS) -nand_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# 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 diff --git a/conf/i386-multiboot.rmk b/conf/i386-multiboot.rmk deleted file mode 100644 index 69b8e9a48..000000000 --- a/conf/i386-multiboot.rmk +++ /dev/null @@ -1,74 +0,0 @@ -# -*- makefile -*- - -COMMON_CFLAGS = -mrtd -mregparm=3 - -# Images. - -GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200 - -pkglib_PROGRAMS += kernel.img -kernel_img_SOURCES = kern/i386/coreboot/startup.S \ - kern/i386/misc.S \ - kern/i386/coreboot/init.c \ - kern/i386/multiboot_mmap.c \ - kern/i386/halt.c \ - kern/main.c kern/device.c \ - kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ - kern/misc.c kern/mm.c kern/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) -kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic - -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 diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk deleted file mode 100644 index e9c0b4202..000000000 --- a/conf/i386-pc.rmk +++ /dev/null @@ -1,325 +0,0 @@ -# -*- makefile -*- - -COMMON_CFLAGS = -mrtd -mregparm=3 - -# Images. -pkglib_IMAGES = boot.img cdboot.img diskboot.img lnxboot.img pxeboot.img - -# For boot.img. -boot_img_SOURCES = boot/i386/pc/boot.S -boot_img_ASFLAGS = $(COMMON_ASFLAGS) -boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00 -boot_img_FORMAT = binary - -# For pxeboot.img -pxeboot_img_SOURCES = boot/i386/pc/pxeboot.S -pxeboot_img_ASFLAGS = $(COMMON_ASFLAGS) -pxeboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00 -pxeboot_img_FORMAT = binary - -# For diskboot.img. -diskboot_img_SOURCES = boot/i386/pc/diskboot.S -diskboot_img_ASFLAGS = $(COMMON_ASFLAGS) -diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x8000 -diskboot_img_FORMAT = binary - -# For lnxboot.img. -lnxboot_img_SOURCES = boot/i386/pc/lnxboot.S -lnxboot_img_ASFLAGS = $(COMMON_ASFLAGS) -lnxboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x6000 -lnxboot_img_FORMAT = binary - -# For cdboot.img. -cdboot_img_SOURCES = boot/i386/pc/cdboot.S -cdboot_img_ASFLAGS = $(COMMON_ASFLAGS) -cdboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00 -cdboot_img_FORMAT = binary - -# For kernel.img. -pkglib_PROGRAMS = kernel.img -kernel_img_SOURCES = kern/i386/pc/startup.S \ - kern/i386/misc.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/time.c kern/list.c kern/command.c kern/corecmd.c \ - kern/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.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/console.c term/i386/vga_common.c \ - symlist.c -kernel_img_HEADERS += machine/biosdisk.h machine/vga.h machine/vbe.h \ - machine/pxe.h i386/pit.h machine/kernel.h -kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS) -kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x8200 $(COMMON_CFLAGS) - -# Utilities. -sbin_UTILITIES = grub-setup - -# For grub-setup. -util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h -grub_setup_SOURCES = gnulib/progname.c util/i386/pc/grub-setup.c \ - util/misc.c kern/emu/misc.c kern/emu/getroot.c \ - kern/emu/hostdisk.c kern/device.c kern/disk.c kern/err.c \ - kern/misc.c kern/partition.c kern/file.c \ - kern/emu/mm.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/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/nilfs2.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 \ - \ - partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \ - partmap/gpt.c \ - \ - disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ - disk/mdraid_linux.c disk/lvm.c \ - util/raid.c util/lvm.c \ - grub_setup_init.c - -sbin_SCRIPTS += grub-install -grub_install_SOURCES = util/grub-install.in - -bin_SCRIPTS += grub-mkrescue -grub_mkrescue_SOURCES = util/grub-mkrescue.in - -pkglib_MODULES = biosdisk.mod chain.mod \ - halt.mod \ - vbe.mod vbetest.mod vbeinfo.mod \ - vga.mod \ - aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod \ - ata_pthru.mod hdparm.mod \ - usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \ - efiemu.mod mmap.mod acpi.mod drivemap.mod - -# For drivemap.mod. -drivemap_mod_SOURCES = commands/i386/pc/drivemap.c \ - commands/i386/pc/drivemap_int13h.S -drivemap_mod_ASFLAGS = $(COMMON_ASFLAGS) -drivemap_mod_CFLAGS = $(COMMON_CFLAGS) -drivemap_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For efiemu.mod. -efiemu_mod_SOURCES = efiemu/main.c efiemu/i386/loadcore32.c \ - efiemu/i386/loadcore64.c efiemu/i386/pc/cfgtables.c \ - efiemu/mm.c efiemu/loadcore_common.c efiemu/symbols.c \ - efiemu/loadcore32.c efiemu/loadcore64.c \ - efiemu/prepare32.c efiemu/prepare64.c efiemu/pnvram.c \ - efiemu/i386/coredetect.c -efiemu_mod_CFLAGS = $(COMMON_CFLAGS) -efiemu_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For acpi.mod. -acpi_mod_SOURCES = commands/acpi.c commands/i386/pc/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/i386/pc/mmap.c mmap/i386/pc/mmap_helper.S -mmap_mod_CFLAGS = $(COMMON_CFLAGS) -mmap_mod_LDFLAGS = $(COMMON_LDFLAGS) -mmap_mod_ASFLAGS = $(COMMON_ASFLAGS) - -# For biosdisk.mod. -biosdisk_mod_SOURCES = disk/i386/pc/biosdisk.c -biosdisk_mod_CFLAGS = $(COMMON_CFLAGS) -biosdisk_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For chain.mod. -chain_mod_SOURCES = loader/i386/pc/chainloader.c -chain_mod_CFLAGS = $(COMMON_CFLAGS) -chain_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += linux16.mod -linux16_mod_SOURCES = loader/i386/pc/linux.c -linux16_mod_CFLAGS = $(COMMON_CFLAGS) -linux16_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += linux.mod -linux_mod_SOURCES = loader/i386/linux.c -linux_mod_CFLAGS = $(COMMON_CFLAGS) -linux_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += xnu.mod -xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c \ - loader/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) - -# For halt.mod. -halt_mod_SOURCES = commands/i386/pc/halt.c -halt_mod_CFLAGS = $(COMMON_CFLAGS) -halt_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For vbe.mod. -vbe_mod_SOURCES = video/i386/pc/vbe.c -vbe_mod_CFLAGS = $(COMMON_CFLAGS) -vbe_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For vbeinfo.mod. -vbeinfo_mod_SOURCES = commands/i386/pc/vbeinfo.c -vbeinfo_mod_CFLAGS = $(COMMON_CFLAGS) -vbeinfo_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For vbetest.mod. -vbetest_mod_SOURCES = commands/i386/pc/vbetest.c -vbetest_mod_CFLAGS = $(COMMON_CFLAGS) -vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For vga.mod. -vga_mod_SOURCES = video/i386/pc/vga.c -vga_mod_CFLAGS = $(COMMON_CFLAGS) -vga_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 -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 usb.mod -usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c -usb_mod_CFLAGS = $(COMMON_CFLAGS) -usb_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For serial.mod. -pkglib_MODULES += usbserial_common.mod -usbserial_common_mod_SOURCES = bus/usb/serial/common.c -usbserial_common_mod_CFLAGS = $(COMMON_CFLAGS) -usbserial_common_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For serial.mod. -pkglib_MODULES += usbserial_pl2303.mod -usbserial_pl2303_mod_SOURCES = bus/usb/serial/pl2303.c -usbserial_pl2303_mod_CFLAGS = $(COMMON_CFLAGS) -usbserial_pl2303_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For serial.mod. -pkglib_MODULES += usbserial_ftdi.mod -usbserial_ftdi_mod_SOURCES = bus/usb/serial/ftdi.c -usbserial_ftdi_mod_CFLAGS = $(COMMON_CFLAGS) -usbserial_ftdi_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For usbtest.mod -usbtest_mod_SOURCES = commands/usbtest.c -usbtest_mod_CFLAGS = $(COMMON_CFLAGS) -usbtest_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For uhci.mod -uhci_mod_SOURCES = bus/usb/uhci.c -uhci_mod_CFLAGS = $(COMMON_CFLAGS) -uhci_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For ohci.mod -ohci_mod_SOURCES = bus/usb/ohci.c -ohci_mod_CFLAGS = $(COMMON_CFLAGS) -ohci_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For usbms.mod -usbms_mod_SOURCES = disk/usbms.c -usbms_mod_CFLAGS = $(COMMON_CFLAGS) -usbms_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For usb_keyboard.mod -usb_keyboard_mod_SOURCES = term/usb_keyboard.c -usb_keyboard_mod_CFLAGS = $(COMMON_CFLAGS) -usb_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For pxe.mod -pxe_mod_SOURCES = fs/i386/pc/pxe.c -pxe_mod_CFLAGS = $(COMMON_CFLAGS) -pxe_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For pxecmd.mod -pxecmd_mod_SOURCES = commands/i386/pc/pxecmd.c -pxecmd_mod_CFLAGS = $(COMMON_CFLAGS) -pxecmd_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For datetime.mod -datetime_mod_SOURCES = lib/cmos_datetime.c -datetime_mod_CFLAGS = $(COMMON_CFLAGS) -datetime_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For sendkey.mod -pkglib_MODULES += sendkey.mod -sendkey_mod_SOURCES = commands/i386/pc/sendkey.c -sendkey_mod_CFLAGS = $(COMMON_CFLAGS) -sendkey_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For ata_pthru.mod. -ata_pthru_mod_SOURCES = disk/ata_pthru.c -ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS) -ata_pthru_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For hdparm.mod. -hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c -hdparm_mod_CFLAGS = $(COMMON_CFLAGS) -hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For cmostest.mod -pkglib_MODULES += cmostest.mod -cmostest_mod_SOURCES = commands/i386/cmostest.c -cmostest_mod_CFLAGS = $(COMMON_CFLAGS) -cmostest_mod_LDFLAGS = $(COMMON_LDFLAGS) - -ifeq ($(enable_efiemu), yes) - -efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF) - -rm -f $@ -ifeq ($(TARGET_APPLE_CC), 1) - -rm -f $@.bin - $(TARGET_CC) -c -m32 -DELF32 -DAPPLE_CC -o $@.bin -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude - $(OBJCONV) -felf32 -nu -nd $@.bin $@ - -rm -f $@.bin -else - $(TARGET_CC) -c -m32 -DELF32 -o $@ -Wall -Werror $< -nostdlib -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude - if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi -endif - -efiemu64_c.o: efiemu/runtime/efiemu.c -ifeq ($(TARGET_APPLE_CC), 1) - $(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude -else - $(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude -endif - -efiemu64_s.o: efiemu/runtime/efiemu.S - -rm -f $@ -ifeq ($(TARGET_APPLE_CC), 1) - $(TARGET_CC) -c -m64 -DAPPLE_CC=1 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude -else - $(TARGET_CC) -c -m64 -DELF64 -o $@ -Wall -Werror $< -nostdlib -mcmodel=large -mno-red-zone -O2 -I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude -endif - -efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELF) - -rm -f $@ -ifeq ($(TARGET_APPLE_CC), 1) - -rm -f $@.bin - $(TARGET_CC) -m64 -o $@.bin -Wl,-r $^ -nostdlib - $(OBJCONV) -felf64 -nu -nd $@.bin $@ - -rm -f $@.bin -else - $(TARGET_CC) -m64 -o $@ -Wl,-r $^ -nostdlib - if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi -endif - -CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o -pkglib_DATA += efiemu32.o efiemu64.o - -endif - -include $(srcdir)/conf/i386.mk -include $(srcdir)/conf/common.mk diff --git a/conf/i386-qemu.rmk b/conf/i386-qemu.rmk deleted file mode 100644 index adb5f7f0f..000000000 --- a/conf/i386-qemu.rmk +++ /dev/null @@ -1,86 +0,0 @@ -# -*- makefile -*- - -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 - -kern/i386/qemu/init.c_DEPENDENCIES = ascii.h - -pkglib_PROGRAMS += kernel.img -kernel_img_SOURCES = kern/i386/qemu/startup.S \ - kern/i386/misc.S \ - kern/i386/coreboot/init.c \ - kern/i386/qemu/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/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 bus/pci.c \ - symlist.c -kernel_img_HEADERS += pci.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 - -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 diff --git a/conf/i386.rmk b/conf/i386.rmk deleted file mode 100644 index 6bf1b3410..000000000 --- a/conf/i386.rmk +++ /dev/null @@ -1,94 +0,0 @@ -# -*- makefile -*- - -pkglib_MODULES += cpuid.mod -cpuid_mod_SOURCES = commands/i386/cpuid.c -cpuid_mod_CFLAGS = $(COMMON_CFLAGS) -cpuid_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += at_keyboard.mod -at_keyboard_mod_SOURCES = term/at_keyboard.c -at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS) -at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += vga_text.mod -vga_text_mod_SOURCES = term/i386/pc/vga_text.c term/i386/vga_common.c -vga_text_mod_CFLAGS = $(COMMON_CFLAGS) -vga_text_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += video_cirrus.mod -video_cirrus_mod_SOURCES = video/cirrus.c -video_cirrus_mod_CFLAGS = $(COMMON_CFLAGS) -video_cirrus_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += video_bochs.mod -video_bochs_mod_SOURCES = video/bochs.c -video_bochs_mod_CFLAGS = $(COMMON_CFLAGS) -video_bochs_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += relocator.mod -relocator_mod_SOURCES = lib/i386/relocator.c lib/i386/relocator_asm.S lib/i386/relocator_backward.S -relocator_mod_CFLAGS = $(COMMON_CFLAGS) -relocator_mod_ASFLAGS = $(COMMON_ASFLAGS) -relocator_mod_LDFLAGS = $(COMMON_LDFLAGS) - -pkglib_MODULES += ata.mod -ata_mod_SOURCES = disk/ata.c -ata_mod_CFLAGS = $(COMMON_CFLAGS) -ata_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# 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 term/ns8250.c -serial_mod_CFLAGS = $(COMMON_CFLAGS) -serial_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# On qemu it's compiled in -ifneq ($(platform), qemu) -# For pci.mod -pkglib_MODULES += pci.mod -pci_mod_SOURCES = bus/pci.c -pci_mod_CFLAGS = $(COMMON_CFLAGS) -pci_mod_LDFLAGS = $(COMMON_LDFLAGS) -endif - -# For cs5536.mod -pkglib_MODULES += cs5536.mod -cs5536_mod_SOURCES = bus/cs5536.c -cs5536_mod_CFLAGS = $(COMMON_CFLAGS) -cs5536_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) - -# For iorw.mod. -pkglib_MODULES += iorw.mod -iorw_mod_SOURCES = commands/iorw.c -iorw_mod_CFLAGS = $(COMMON_CFLAGS) -iorw_mod_LDFLAGS = $(COMMON_LDFLAGS) diff --git a/conf/mips-yeeloong.rmk b/conf/mips-yeeloong.rmk deleted file mode 100644 index 9cbbdf472..000000000 --- a/conf/mips-yeeloong.rmk +++ /dev/null @@ -1,143 +0,0 @@ -# -*- 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 cs5536.h machine/pci.h serial.h - -include $(srcdir)/conf/mips.mk - -pkglib_PROGRAMS = 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/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 \ - bus/cs5536.c term/serial.c term/ns8250.c term/terminfo.c term/tparm.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 - -pkglib_IMAGES += fwstart.img -fwstart_img_SOURCES = boot/$(target_cpu)/$(target_machine)/fwstart.S -fwstart_img_CFLAGS = $(COMMON_CFLAGS) -fwstart_img_ASFLAGS = $(COMMON_ASFLAGS) -fwstart_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \ - -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic -fwstart_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) - -# For lsspd.mod -pkglib_MODULES += lsspd.mod -lsspd_mod_SOURCES = commands/mips/yeeloong/lsspd.c -lsspd_mod_CFLAGS = $(COMMON_CFLAGS) -lsspd_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) - -# For halt.mod. -pkglib_MODULES += halt.mod -halt_mod_SOURCES = commands/halt.c -halt_mod_CFLAGS = $(COMMON_CFLAGS) -halt_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For usb.mod -pkglib_MODULES += usb.mod -usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c -usb_mod_CFLAGS = $(COMMON_CFLAGS) -usb_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For serial.mod. -pkglib_MODULES += usbserial_common.mod -usbserial_common_mod_SOURCES = bus/usb/serial/common.c -usbserial_common_mod_CFLAGS = $(COMMON_CFLAGS) -usbserial_common_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For serial.mod. -pkglib_MODULES += usbserial_pl2303.mod -usbserial_pl2303_mod_SOURCES = bus/usb/serial/pl2303.c -usbserial_pl2303_mod_CFLAGS = $(COMMON_CFLAGS) -usbserial_pl2303_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For serial.mod. -pkglib_MODULES += usbserial_ftdi.mod -usbserial_ftdi_mod_SOURCES = bus/usb/serial/ftdi.c -usbserial_ftdi_mod_CFLAGS = $(COMMON_CFLAGS) -usbserial_ftdi_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 ohci.mod -pkglib_MODULES += ohci.mod -ohci_mod_SOURCES = bus/usb/ohci.c -ohci_mod_CFLAGS = $(COMMON_CFLAGS) -ohci_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) - -# For usb_keyboard.mod -pkglib_MODULES += usb_keyboard.mod -usb_keyboard_mod_SOURCES = term/usb_keyboard.c -usb_keyboard_mod_CFLAGS = $(COMMON_CFLAGS) -usb_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS) - -sbin_SCRIPTS += grub-install -grub_install_SOURCES = util/grub-install.in diff --git a/conf/mips.rmk b/conf/mips.rmk deleted file mode 100644 index 26c516fc4..000000000 --- a/conf/mips.rmk +++ /dev/null @@ -1,27 +0,0 @@ - -# -*- makefile -*- - -COMMON_CFLAGS += -mexplicit-relocs -mflush-func=grub_cpu_flush_cache - -# Images. -kernel_img_HEADERS += cpu/cache.h - -# Scripts. -sbin_SCRIPTS = -bin_SCRIPTS = - -# 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 diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk deleted file mode 100644 index 3ec5ec906..000000000 --- a/conf/powerpc-ieee1275.rmk +++ /dev/null @@ -1,68 +0,0 @@ - -# -*- makefile -*- - -# Images. - -kernel_img_HEADERS += ieee1275/ieee1275.h - -# Programs -pkglib_PROGRAMS = kernel.img - -kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \ - kern/ieee1275/ieee1275.c kern/main.c kern/device.c \ - kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \ - kern/misc.c kern/mm.c kern/term.c \ - kern/rescue_parser.c kern/rescue_reader.c \ - kern/list.c kern/command.c kern/corecmd.c \ - kern/ieee1275/init.c \ - kern/ieee1275/mmap.c \ - term/ieee1275/ofconsole.c term/terminfo.c term/tparm.c \ - kern/ieee1275/openfw.c disk/ieee1275/ofdisk.c \ - kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \ - kern/generic/millisleep.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,0x200000,-Bstatic - -# Scripts. -sbin_SCRIPTS = grub-install -bin_SCRIPTS = grub-mkrescue - -# For grub-install. -grub_install_SOURCES = util/ieee1275/grub-install.in - -# For grub-mkrescue. -grub_mkrescue_SOURCES = util/powerpc/ieee1275/grub-mkrescue.in - -# Modules. -pkglib_MODULES += ieee1275_fb.mod -ieee1275_fb_mod_SOURCES = video/ieee1275.c -ieee1275_fb_mod_CFLAGS = $(COMMON_CFLAGS) -ieee1275_fb_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For linux.mod. -pkglib_MODULES += linux.mod -linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c -linux_mod_CFLAGS = $(COMMON_CFLAGS) -linux_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For suspend.mod -pkglib_MODULES += suspend.mod -suspend_mod_SOURCES = commands/ieee1275/suspend.c -suspend_mod_CFLAGS = $(COMMON_CFLAGS) -suspend_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For halt.mod -pkglib_MODULES += halt.mod -halt_mod_SOURCES = commands/halt.c -halt_mod_CFLAGS = $(COMMON_CFLAGS) -halt_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For datetime.mod -pkglib_MODULES += datetime.mod -datetime_mod_SOURCES = lib/ieee1275/datetime.c -datetime_mod_CFLAGS = $(COMMON_CFLAGS) -datetime_mod_LDFLAGS = $(COMMON_LDFLAGS) - -include $(srcdir)/conf/common.mk diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk deleted file mode 100644 index d343ac349..000000000 --- a/conf/sparc64-ieee1275.rmk +++ /dev/null @@ -1,104 +0,0 @@ - -# -*- makefile -*- - -COMMON_CFLAGS = -mno-app-regs -COMMON_LDFLAGS = -melf64_sparc -mno-relax - -# Images. -pkglib_IMAGES = boot.img diskboot.img -pkglib_PROGRAMS = kernel.img - -# For boot.img. -boot_img_SOURCES = boot/sparc64/ieee1275/boot.S -boot_img_ASFLAGS = $(COMMON_ASFLAGS) -boot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4000 -boot_img_FORMAT = a.out-sunos-big - -# For diskboot.img. -diskboot_img_SOURCES = boot/sparc64/ieee1275/diskboot.S -diskboot_img_ASFLAGS = $(COMMON_ASFLAGS) -diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-Ttext,0x4200 -diskboot_img_FORMAT = binary - -kernel_img_HEADERS += ieee1275/ieee1275.h cpu/ieee1275/ieee1275.h -kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \ - kern/ieee1275/ieee1275.c kern/main.c kern/device.c \ - kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \ - kern/misc.c kern/mm.c kern/term.c \ - kern/rescue_parser.c kern/rescue_reader.c \ - kern/list.c kern/command.c kern/corecmd.c \ - kern/sparc64/ieee1275/ieee1275.c \ - kern/sparc64/ieee1275/init.c \ - kern/ieee1275/mmap.c \ - term/ieee1275/ofconsole.c \ - kern/ieee1275/openfw.c term/terminfo.c term/tparm.c \ - disk/ieee1275/ofdisk.c \ - kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \ - kern/generic/millisleep.c kern/time.c \ - symlist.c kern/$(target_cpu)/cache.S -kernel_img_CFLAGS = $(COMMON_CFLAGS) -kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS += -nostdlib -Wl,-N,-Ttext,0x4400,-Bstatic,-melf64_sparc -kernel_img_FORMAT = binary - -# Utilities. -sbin_UTILITIES = grub-setup grub-ofpathname - -# For grub-setup. -util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h -grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c \ - util/ieee1275/ofpath.c util/misc.c kern/emu/hostdisk.c \ - kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c kern/device.c \ - kern/disk.c kern/err.c kern/misc.c \ - kern/partition.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/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \ - fs/nilfs2.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 \ - \ - partmap/amiga.c partmap/apple.c partmap/msdos.c \ - partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \ - \ - disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \ - disk/mdraid_linux.c disk/lvm.c util/raid.c \ - util/lvm.c gnulib/progname.c grub_setup_init.c - -# For grub-ofpathname. -grub_ofpathname_SOURCES = util/ieee1275/grub-ofpathname.c \ - util/ieee1275/ofpath.c util/misc.c kern/emu/misc.c \ - gnulib/progname.c - -# Scripts. -sbin_SCRIPTS = grub-install - -# For grub-install. -grub_install_SOURCES = util/grub-install.in - -# Modules. -pkglib_MODULES += ieee1275_fb.mod -ieee1275_fb_mod_SOURCES = video/ieee1275.c -ieee1275_fb_mod_CFLAGS = $(COMMON_CFLAGS) -ieee1275_fb_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For linux.mod. -pkglib_MODULES += linux.mod -linux_mod_SOURCES = loader/sparc64/ieee1275/linux.c -linux_mod_CFLAGS = $(COMMON_CFLAGS) -linux_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For halt.mod. -pkglib_MODULES += halt.mod -halt_mod_SOURCES = commands/halt.c -halt_mod_CFLAGS = $(COMMON_CFLAGS) -halt_mod_LDFLAGS = $(COMMON_LDFLAGS) - -# For datetime.mod -pkglib_MODULES += datetime.mod -datetime_mod_SOURCES = lib/ieee1275/datetime.c -datetime_mod_CFLAGS = $(COMMON_CFLAGS) -datetime_mod_LDFLAGS = $(COMMON_LDFLAGS) - -include $(srcdir)/conf/common.mk diff --git a/conf/tests.rmk b/conf/tests.rmk deleted file mode 100644 index c14fe0fda..000000000 --- a/conf/tests.rmk +++ /dev/null @@ -1,110 +0,0 @@ -# -*- 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 - -check_SCRIPTS += grub_script_dollar -grub_script_dollar_SOURCES = tests/grub_script_dollar.in - -check_SCRIPTS += grub_script_comments -grub_script_comments_SOURCES = tests/grub_script_comments.in - -check_SCRIPTS += grub_script_functions -grub_script_functions_SOURCES = tests/grub_script_functions.in - -check_SCRIPTS += grub_script_break -grub_script_break_SOURCES = tests/grub_script_break.in - -check_SCRIPTS += grub_script_continue -grub_script_continue_SOURCES = tests/grub_script_continue.in - -check_SCRIPTS += grub_script_shift -grub_script_shift_SOURCES = tests/grub_script_shift.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 -SCRIPTED_TESTS += grub_script_dollar -SCRIPTED_TESTS += grub_script_comments -SCRIPTED_TESTS += grub_script_functions -SCRIPTED_TESTS += grub_script_break -SCRIPTED_TESTS += grub_script_continue -SCRIPTED_TESTS += grub_script_shift - -# dependencies between tests and testing-tools -$(SCRIPTED_TESTS): grub-shell grub-shell-tester -$(FUNCTIONAL_TESTS): functional_test.mod - diff --git a/conf/x86-efi.rmk b/conf/x86-efi.rmk deleted file mode 100644 index f9f07684e..000000000 --- a/conf/x86-efi.rmk +++ /dev/null @@ -1,112 +0,0 @@ -# -*- 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/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. -ifeq ($(target_cpu), x86_64) -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) -else -linux_mod_SOURCES = loader/i386/efi/linux.c -linux_mod_CFLAGS = $(COMMON_CFLAGS) -linux_mod_ASFLAGS = $(COMMON_ASFLAGS) -linux_mod_LDFLAGS = $(COMMON_LDFLAGS) -endif - -# 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/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 diff --git a/conf/x86_64-efi.rmk b/conf/x86_64-efi.rmk deleted file mode 100644 index 200621280..000000000 --- a/conf/x86_64-efi.rmk +++ /dev/null @@ -1,5 +0,0 @@ -# -*- makefile -*- - -COMMON_LDFLAGS = -melf_x86_64 - -include $(srcdir)/conf/x86-efi.mk diff --git a/configure.ac b/configure.ac index 19ea08c9d..dd2e82e3b 100644 --- a/configure.ac +++ b/configure.ac @@ -873,11 +873,12 @@ AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips]) AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275]) AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275]) -AM_CONDITIONAL([COND_host_hurd], [test x$host_kernel = xhurd]) -AM_CONDITIONAL([COND_host_linux], [test x$host_kernel = xlinux]) -AM_CONDITIONAL([COND_host_netbsd], [test x$host_kernel = xnetbsd]) -AM_CONDITIONAL([COND_host_windows], [test x$host_kernel = xwindows]) -AM_CONDITIONAL([COND_host_kfreebsd], [test x$host_kernel = xkfreebsd]) + +AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd]) +AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux]) +AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd]) +AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows]) +AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd]) AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x]) AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes]) diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 0733ef1c2..0257bbac4 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -282,8 +282,8 @@ module = { module = { name = cs5536; - i386 = bus/cs5536.c; - enable = i386; + x86 = bus/cs5536.c; + enable = x86; }; module = { @@ -387,7 +387,7 @@ module = { module = { name = iorw; common = commands/iorw.c; - enable = i386; + enable = x86; }; module = { @@ -573,8 +573,8 @@ module = { module = { name = play; - i386 = commands/i386/pc/play.c; - enable = i386; + x86 = commands/i386/pc/play.c; + enable = x86; }; module = { @@ -1254,6 +1254,7 @@ module = { enable = emu; enable = i386; enable = x86_64_efi; + emu_condition = COND_GRUB_EMU_USB; }; module = { @@ -1290,14 +1291,14 @@ module = { module = { name = video_cirrus; - i386 = video/cirrus.c; - enable = i386; + x86 = video/cirrus.c; + enable = x86; }; module = { name = video_bochs; - i386 = video/bochs.c; - enable = i386; + x86 = video/bochs.c; + enable = x86; }; module = { From 40a4a8a9ed704686f95c05c582921c1c3b91d274 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 23 Aug 2010 13:32:59 +0530 Subject: [PATCH 168/174] fix exit 1 in autogen.sh --- autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 31a269e0f..adc457ea5 100755 --- a/autogen.sh +++ b/autogen.sh @@ -2,7 +2,7 @@ set -e -autogen --version >/dev/null || (echo autogen missing; exit 1) +autogen --version >/dev/null || exit 1 echo "Importing unicode..." python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c From 9e860d5437f2027303d0641c168598d7a71a337a Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 23 Aug 2010 14:07:29 +0530 Subject: [PATCH 169/174] force bash for autogen.sh --- autogen.sh | 2 +- gentpl.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index adc457ea5..f052499ae 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#! /usr/bin/env bash set -e diff --git a/gentpl.py b/gentpl.py index 5b7987390..17bda02c6 100644 --- a/gentpl.py +++ b/gentpl.py @@ -105,7 +105,7 @@ def var_add(var, value): # Autogen constructs # -def set_canonical_name_suffix(suffix): return "[+ % name `export cname=$(echo -n %s" + suffix + " | sed -e 's/[^0-9A-Za-z@_]/_/g')` +]" +def set_canonical_name_suffix(suffix): return "[+ % name `export cname=$(echo %s" + suffix + " | sed -e 's/[^0-9A-Za-z@_]/_/g')` +]" def cname(): return "[+ % name `echo $cname` +]" def rule(target, source, cmd): From f86a4030ed43240e5d3ebb4d26822772e2b06acf Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 23 Aug 2010 12:55:47 +0100 Subject: [PATCH 170/174] * kern/mips/startup.S (grub_prefix): Update comment to refer to grub-mkimage rather than grub-mkelfimage. * kern/powerpc/ieee1275/startup.S (grub_prefix): Likewise. --- ChangeLog | 6 ++++++ kern/mips/startup.S | 2 +- kern/powerpc/ieee1275/startup.S | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 758b5cb5f..241b59b76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-08-23 Colin Watson + + * kern/mips/startup.S (grub_prefix): Update comment to refer to + grub-mkimage rather than grub-mkelfimage. + * kern/powerpc/ieee1275/startup.S (grub_prefix): Likewise. + 2010-08-22 Vladimir Serbinenko * term/at_keyboard.c (grub_at_keyboard_getkey_noblock): Don't discard diff --git a/kern/mips/startup.S b/kern/mips/startup.S index c67bb9742..134853a9d 100644 --- a/kern/mips/startup.S +++ b/kern/mips/startup.S @@ -148,7 +148,7 @@ compressed: VARIABLE(grub_prefix) - /* to be filled by grub-mkelfimage */ + /* to be filled by grub-mkimage */ /* * Leave some breathing room for the prefix. diff --git a/kern/powerpc/ieee1275/startup.S b/kern/powerpc/ieee1275/startup.S index 96d153778..526df1d91 100644 --- a/kern/powerpc/ieee1275/startup.S +++ b/kern/powerpc/ieee1275/startup.S @@ -33,7 +33,7 @@ _start: . = _start + GRUB_KERNEL_MACHINE_PREFIX VARIABLE(grub_prefix) - /* to be filled by grub-mkelfimage */ + /* to be filled by grub-mkimage */ /* * Leave some breathing room for the prefix. From 41b016a481f590258fdba25f8e184f83a8db0600 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 23 Aug 2010 21:23:39 +0530 Subject: [PATCH 171/174] fix x86_64-efi build --- Makefile.util.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.util.def b/Makefile.util.def index 89328d619..fd3428e76 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -329,7 +329,7 @@ script = { script = { mansection = 1; name = grub-mkrescue; - i386_noieee1275 = util/grub-mkrescue.in; + x86_noieee1275 = util/grub-mkrescue.in; powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in; enable = i386_pc; enable = x86_efi; From 04ddcc6a8855138cd2fa6925eb2c597cc5e58111 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 23 Aug 2010 22:41:14 +0200 Subject: [PATCH 172/174] 2010-08-23 Samuel Thibault * util/grub.d/30_os-prober.in: Fix conversion from grub-probe --target=drive output to Mach device name. --- ChangeLog | 5 +++++ util/grub.d/30_os-prober.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2db022484..3887cc5bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-08-23 Samuel Thibault + + * util/grub.d/30_os-prober.in: Fix conversion from grub-probe + --target=drive output to Mach device name. + 2010-08-23 BVK Chaitanya New Automake based build system for GRUB. diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index ecd87bb1c..76857aeea 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -179,7 +179,7 @@ EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" grub_device="`${grub_probe} --device ${DEVICE} --target=drive`" - mach_device="`echo "${grub_device}" | tr -d '()' | tr , s`" + mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`" grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`" case "${grub_fs}" in *fs) hurd_fs="${grub_fs}" ;; From d24c6190aedb2e60401b915675bdf9b4698162b7 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 25 Aug 2010 18:34:20 +0530 Subject: [PATCH 173/174] add changelog --- ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2db022484..bd03c490e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-08-25 BVK Chaitanya + + Multiple variable names support to "export" command. + + * normal/context.c (grub_cmd_export): "export" command supports + multiple variable names. + 2010-08-23 BVK Chaitanya New Automake based build system for GRUB. From cd6891117fee18f2a6c594ed39a5fccb85afd8fc Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Wed, 25 Aug 2010 18:39:00 +0530 Subject: [PATCH 174/174] review comment fixes --- grub-core/normal/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/normal/context.c b/grub-core/normal/context.c index 68f7626b9..ec718952d 100644 --- a/grub-core/normal/context.c +++ b/grub-core/normal/context.c @@ -177,7 +177,7 @@ grub_context_init (void) grub_env_export ("prefix"); export_cmd = grub_register_command ("export", grub_cmd_export, - N_("ENVVAR..."), + N_("ENVVAR [ENVVAR] ..."), N_("Export variables.")); }