From: BVK Chaitanya Date: Mon, 12 Jul 2010 19:13:28 +0000 (+0530) Subject: merge with mainline X-Git-Tag: 1.99~647^2~44 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=297f0c2b6e8f693c85eef748afcd50dc3d657ad0;p=thirdparty%2Fgrub.git merge with mainline --- 297f0c2b6e8f693c85eef748afcd50dc3d657ad0 diff --cc .bzrignore index a2fdef858,daf9da53a..a1835ce07 --- a/.bzrignore +++ b/.bzrignore @@@ -71,34 -76,4 +76,36 @@@ stamp-h.i symlist.c trigtables.c update-grub_lib + unidata.c +Makefile.in +modules.am +GPATH +GRTAGS +GSYMS +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 ++ diff --cc Makefile.am index 181f3e9ca,000000000..c181a5f77 mode 100644,000000..100644 --- a/Makefile.am +++ b/Makefile.am @@@ -1,77 -1,0 +1,87 @@@ +AUTOMAKE_OPTIONS = subdir-objects + +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 + +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) + +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 +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 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 += libgrub.pp + +libgrub_a_init.lst: libgrub.pp + cat $< | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1) +CLEANFILES += libgrub_a_init.lst + +libgrub_a_init.c: libgrub_a_init.lst $(top_srcdir)/geninit.sh + sh $(top_srcdir)/geninit.sh `cat $<` > $@ || (rm -f $@; exit 1) +CLEANFILES += libgrub_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 + ++widthspec.bin: $(FONT_SOURCE) grub-mkfont ++ $(builddir)/grub-mkfont --width-spec -o $@ $(FONT_SOURCE) ++CLEANFILES += widthspec.bin ++ ++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 --cc autogen.sh index 46ccc0627,f9d55318f..e41caa5f2 --- a/autogen.sh +++ b/autogen.sh @@@ -2,41 -2,24 +2,44 @@@ set -e -aclocal -autoconf -autoheader - -# FIXME: automake doesn't like that there's no Makefile.am -automake -a -c -f || true - +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/ + +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) + ++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/ .) + +echo "Saving timestamps..." echo timestamp > stamp-h.in +(cd grub-core && echo timestamp > stamp-h.in) -python util/import_gcry.py lib/libgcrypt/ . - -python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt unidata.c - -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 - +echo "Running autoreconf..." +autoreconf -vi exit 0 diff --cc configure.common index f19e107b1,000000000..46a3fd5e4 mode 100644,000000..100644 --- a/configure.common +++ b/configure.common @@@ -1,838 -1,0 +1,851 @@@ +# -*- 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 + - 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 ++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_ENABLE_EFIEMU], [test x$enable_efiemu = xyes]) diff --cc gentpl.py index 7a5986a9e,000000000..de2efe80a mode 100644,000000..100644 --- a/gentpl.py +++ b/gentpl.py @@@ -1,469 -1,0 +1,469 @@@ +#! /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_multiboot", "i386_ieee1275", "x86_64_efi", + "mips_yeeloong", "sparc64_ieee1275", + "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["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() + "_img" +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 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 module(platform): + 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 += 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("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 += gvar_add("CLEANFILES", "[+ name +].pp") + r += """ +[+ name +].pp: $(""" + canonical_module() + """_SOURCES) $(nodist_""" + canonical_module() + """_SOURCES) - $(TARGET_CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + canonical_module() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@ || (rm -f $@; exit 1) ++ $(TARGET_CPP) -DGRUB_LST_GENERATOR $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + canonical_module() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@ || (rm -f $@; exit 1) + +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$(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 +].o: mod-[+ name +].c + $(TARGET_CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS_MODULE) $(CPPFLAGS) $(CFLAGS_MODULE) $(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 $^; \ + $(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 +].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 += 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("platform_DATA", "[+ name +].img") + 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("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$(EXEEXT)", """ +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("EXTRA_DIST", platform_extra_dist(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 += gvar_add("man_MANS", "[+ name +].[+ mansection +]\n") + r += rule("[+ name +].[+ mansection +]", "", """ +$(MAKE) $(AM_MAKEFLAGS) [+ name +] +chmod a+x [+ name +] - $(HELP2MAN) --section=[+ mansection +] -o $@ ./[+ name +] ++PATH=$(builddir):$$PATH $(HELP2MAN) --section=[+ mansection +] -i $(top_srcdir)/docs/man/[+ name +].h2m -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("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()) + + 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 +]") + + 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 --cc grub-core/Makefile.kernel index b7c7277bd,000000000..b03563676 mode 100644,000000..100644 --- a/grub-core/Makefile.kernel +++ b/grub-core/Makefile.kernel @@@ -1,203 -1,0 +1,204 @@@ +# -*- 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_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 +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 +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 +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 +KERNEL_HEADER_FILES += include/grub/cs5536.h +KERNEL_HEADER_FILES += 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 +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 + $(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;}' \ + | 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 --cc grub-core/boot/mips/yeeloong/fwstart.S index 000000000,7fe5d7ac2..7fe5d7ac2 mode 000000,100644..100644 --- a/grub-core/boot/mips/yeeloong/fwstart.S +++ b/grub-core/boot/mips/yeeloong/fwstart.S diff --cc grub-core/commands/mips/yeeloong/lsspd.c index 000000000,539cda34c..539cda34c mode 000000,100644..100644 --- a/grub-core/commands/mips/yeeloong/lsspd.c +++ b/grub-core/commands/mips/yeeloong/lsspd.c diff --cc grub-core/gfxmenu/font.c index 000000000,3c15e19fa..3c15e19fa mode 000000,100644..100644 --- a/grub-core/gfxmenu/font.c +++ b/grub-core/gfxmenu/font.c diff --cc grub-core/include/grub/dl.h index f98539a4e,351cca64d..9db610467 --- a/grub-core/include/grub/dl.h +++ b/grub-core/include/grub/dl.h @@@ -101,9 -92,17 +102,12 @@@ grub_dl_t grub_dl_load_core (void *addr 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)); + extern grub_dl_t EXPORT_VAR(grub_dl_head); + + #define FOR_DL_MODULES(var) FOR_LIST_ELEMENTS ((var), (grub_dl_head)) + 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); diff --cc grub-core/include/grub/mips/loongson.h index 000000000,6cb1178d5..6cb1178d5 mode 000000,100644..100644 --- a/grub-core/include/grub/mips/loongson.h +++ b/grub-core/include/grub/mips/loongson.h diff --cc grub-core/include/grub/mips/yeeloong/ec.h index 000000000,62d1d33d9..62d1d33d9 mode 000000,100644..100644 --- a/grub-core/include/grub/mips/yeeloong/ec.h +++ b/grub-core/include/grub/mips/yeeloong/ec.h diff --cc grub-core/include/grub/misc.h index 077069934,9194ca8ad..056bd1a65 --- a/grub-core/include/grub/misc.h +++ b/grub-core/include/grub/misc.h @@@ -303,16 -310,9 +310,16 @@@ void EXPORT_FUNC (grub_reboot) (void) _ #ifdef GRUB_MACHINE_PCBIOS /* Halt the system, using APM if possible. If NO_APM is true, don't * use APM even if it is available. */ - void EXPORT_FUNC (grub_halt) (int no_apm); + void EXPORT_FUNC (grub_halt) (int no_apm) __attribute__ ((noreturn)); #else - void EXPORT_FUNC (grub_halt) (void); + void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn)); #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 --cc grub-core/include/grub/unicode.h index 000000000,64769258a..64769258a mode 000000,100644..100644 --- a/grub-core/include/grub/unicode.h +++ b/grub-core/include/grub/unicode.h diff --cc grub-core/include/grub/vga.h index 000000000,d4a1523a7..d4a1523a7 mode 000000,100644..100644 --- a/grub-core/include/grub/vga.h +++ b/grub-core/include/grub/vga.h diff --cc grub-core/kern/emu/misc.c index 9437169e0,38395fca8..03ceae8f9 --- a/grub-core/kern/emu/misc.c +++ b/grub-core/kern/emu/misc.c @@@ -136,18 -140,18 +140,18 @@@ asprintf (char **buf, const char *fmt, 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; } diff --cc grub-core/kern/i386/qemu/init.c index 000000000,201ba3633..201ba3633 mode 000000,100644..100644 --- a/grub-core/kern/i386/qemu/init.c +++ b/grub-core/kern/i386/qemu/init.c diff --cc grub-core/modules.def index ae621fa7d,000000000..08eb6e4ea mode 100644,000000..100644 --- a/grub-core/modules.def +++ b/grub-core/modules.def @@@ -1,1654 -1,0 +1,1670 @@@ +AutoGen definitions Makefile.tpl; + +kernel = { + name = kernel; + + emu_ldflags = '-Wl,-r'; + x86_efi_ldflags = '-Wl,-r'; + + 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_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)'; + emu_cflags = '$(CFLAGS_GNULIB)'; + emu_cppflags = '$(CPPFLAGS_GNULIB)'; + + 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_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_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; + mips_yeeloong = bus/cs5536.c; ++ mips_yeeloong = term/serial.c; ++ mips_yeeloong = term/terminfo.c; ++ mips_yeeloong = term/tparm.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; + + 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; ++ 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; + + extra_dist = kern/i386/loader.S; + extra_dist = kern/i386/realmode.S; + extra_dist = kern/i386/pc/lzma_decode.S; +}; + +program = { + name = grub-emu; + mansection = 1; + + source = kern/emu/full.c; + nodist = grub_emu_init.c; + + ldadd = 'kernel.img$(EXEEXT)'; + ldadd = '$(MODULE_FILES)'; + ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS)'; + + emu; +}; + +program = { + name = grub-emu-lite; + + source = kern/emu/lite.c; + source = kern/emu/cache.S; + nodist = symlist.c; + + ldadd = 'kernel.img$(EXEEXT)'; + ldadd = '$(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS)'; + + emu; +}; + +image = { + name = boot; + i386_pc = boot/i386/pc/boot.S; + i386_qemu = boot/i386/qemu/boot.S; + + 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; + sparc64_ieee1275_format = a.out-sunos-big; + sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000'; +}; + +image = { + name = cdboot; + i386_pc = boot/i386/pc/cdboot.S; + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; +}; + +image = { + name = pxeboot; + i386_pc = boot/i386/pc/pxeboot.S; + + 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 = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8000'; + + sparc64_ieee1275 = boot/sparc64/ieee1275/diskboot.S; + sparc64_ieee1275_ldflags = '-Wl,-Ttext=0x4200'; +}; + +image = { + name = lnxboot; + i386_pc = boot/i386/pc/lnxboot.S; + + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x6000'; +}; + ++image = { ++ name = fwstart; ++ mips_yeeloong = boot/mips/yeeloong/fwstart.S; ++}; ++ +module = { + name = trig; + nodist = trigtables.c; + extra_dist = gentrigtables.c; + common; +}; + +module = { + name = cs5536; + source = bus/cs5536.c; + i386; +}; + +module = { + name = libusb; + source = bus/usb/emu/usb.c; + emu; + enable = COND_GRUB_EMU_USB; +}; + ++module = { ++ name = lsspd; ++ mips_yeeloong = commands/mips/yeeloong/lsspd.c; ++}; ++ +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; + mips_yeeloong; +}; + +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; + mips_yeeloong; +}; + +module = { + name = pci; + source = bus/pci.c; - x86; ++ i386_pc; ++ i386_efi; ++ i386_ieee1275; ++ i386_coreboot; +}; + +library = { + name = libgnulib.a; + source = gnulib/regex.c; + + 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; +}; + +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; ++ mips_yeeloong; +}; + +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_multiboot; + 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; + 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; +}; + +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; + mips_yeeloong; +}; + +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; + mips_yeeloong; +}; + +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; + + extra_dist = efiemu/prepare.c; + extra_dist = efiemu/loadcore.c; + extra_dist = efiemu/runtime/efiemu.S; + extra_dist = efiemu/runtime/efiemu.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/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; +}; + +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; + + extra_dist = lib/libgcrypt-grub/cipher/crypto.lst; +}; + +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; + extra_dist = lib/relocator.c; +}; + +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_multiboot; + 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; + + extra_dist = loader/i386/bsdXX.c; + extra_dist = loader/i386/bsd_pagetable.c; + + i386_pc; + i386_qemu; + i386_coreboot; + i386_multiboot; +}; + +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; + extra_dist = loader/multiboot_elfxx.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; + + extra_dist = loader/machoXX.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_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; + + 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; ++ source = normal/charset.c; ++ ++ source = script/main.c; ++ source = script/script.c; ++ source = script/execute.c; ++ source = script/function.c; ++ source = script/lexer.c; ++ ++ nodist = unidata.c; ++ nodist = grub_script.tab.c; ++ 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)'; +}; + +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; - - extra_dist = script/yylex.l; - extra_dist = script/parser.y; - - 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; + mips_yeeloong; +}; + +module = { + name = vga; + i386_pc = video/i386/pc/vga.c; +}; + +module = { + name = vga_text; + x86 = term/i386/pc/vga_text.c; + x86 = term/i386/vga_common.c; +}; + ++module = { ++ name = video_cirrus; ++ i386 = video/cirrus.c; ++}; ++ ++module = { ++ name = video_bochs; ++ i386 = video/bochs.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 --cc grub-core/normal/charset.c index 000000000,fd377e1c6..fd377e1c6 mode 000000,100644..100644 --- a/grub-core/normal/charset.c +++ b/grub-core/normal/charset.c diff --cc grub-core/video/bochs.c index 000000000,5def0985b..5def0985b mode 000000,100644..100644 --- a/grub-core/video/bochs.c +++ b/grub-core/video/bochs.c diff --cc grub-core/video/cirrus.c index 000000000,ccbab9d15..ccbab9d15 mode 000000,100644..100644 --- a/grub-core/video/cirrus.c +++ b/grub-core/video/cirrus.c diff --cc grub-core/video/sm712_init.c index 000000000,02c64c453..02c64c453 mode 000000,100644..100644 --- a/grub-core/video/sm712_init.c +++ b/grub-core/video/sm712_init.c diff --cc modules.def index 8b709a869,000000000..c8ce44cbe mode 100644,000000..100644 --- a/modules.def +++ b/modules.def @@@ -1,481 -1,0 +1,488 @@@ +AutoGen definitions Makefile.tpl; + +library = { + name = libgrub.a; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + + nodist = grub_script.tab.c; + nodist = grub_script.yy.c; + nodist = libgrub_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/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; + + 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 = libgrub.a; + ldadd = '$(LIBINTL)'; + mansection = 1; + common; +}; + +program = { + name = grub-mkimage; + mansection = 1; + + source = util/grub-mkimage.c; + source = util/resolve.c; + extra_dist = util/grub-mkimagexx.c; + + ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; + + cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"'; + common; +}; + +program = { + name = grub-mkrelpath; + mansection = 1; + + source = util/grub-mkrelpath.c; + + ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; + common; +}; + +program = { + name = grub-script-check; + mansection = 1; + + source = util/grub-script-check.c; + + ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; + common; +}; + +program = { + name = grub-editenv; + mansection = 1; + + source = util/grub-editenv.c; + + ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; + common; +}; + +program = { + name = grub-mkpasswd-pbkdf2; + mansection = 1; + + source = util/grub-mkpasswd-pbkdf2.c; + + ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; + 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 = libgrub.a; + ldadd = '$(LIBINTL)'; + enable = COND_GRUB_PE2ELF; + common; +}; + +program = { + name = grub-fstest; + mansection = 1; + source = util/grub-fstest.c; + + ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; + enable = COND_GRUB_FSTEST; + common; +}; + +program = { + name = grub-mkfont; + mansection = 1; + source = util/grub-mkfont.c; ++ nodist = grub-core/unidata.c; + + cflags = '$(freetype_cflags)'; + + ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; + ldadd = '$(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 = libgrub.a; + ldadd = '$(LIBINTL)'; + ldadd = '$(LIBUTIL)'; + common; +}; + +program = { + name = grub-probe; + installdir = sbin; + mansection = 8; + source = util/grub-probe.c; + + ldadd = libgrub.a; + ldadd = '$(LIBINTL)'; + ldadd = '$(LIBUTIL)'; + 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 = libgrub.a; + ldadd = '$(LIBINTL)'; + ldadd = '$(LIBUTIL)'; +}; + +program = { + name = grub-ofpathname; + installdir = sbin; + source = util/ieee1275/grub-ofpathname.c; + source = util/ieee1275/ofpath.c; + + ldadd = libgrub.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 = { ++ name = '41_custom'; ++ source = util/grub.d/41_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; ++ ldadd = libgrub.a; + common; +}; diff --cc tests/lib/unit_test.c index 92c8ae33a,e8b97b1f4..a780d6862 --- a/tests/lib/unit_test.c +++ b/tests/lib/unit_test.c @@@ -23,7 -23,7 +23,6 @@@ #include #include --#include int main (int argc __attribute__ ((unused)), @@@ -48,61 -44,62 +43,3 @@@ exit (status); } -- --/* Other misc. functions necessary for successful linking. */ -- --void --grub_free (void *ptr) --{ -- free (ptr); --} -- --char * --grub_env_get (const char *name __attribute__ ((unused))) --{ -- return NULL; --} -- --grub_err_t --grub_error (grub_err_t n, const char *fmt, ...) --{ -- va_list ap; -- -- va_start (ap, fmt); -- vfprintf (stderr, fmt, ap); -- va_end (ap); -- -- return n; --} -- --void * --grub_malloc (grub_size_t size) --{ -- return malloc (size); --} -- --void --grub_refresh (void) --{ -- fflush (stdout); --} -- --void --grub_putchar (int c) --{ -- putchar (c); --} -- --int --grub_getkey (void) --{ -- return -1; --} -- --void --grub_exit (void) --{ -- exit (1); --} -- - struct grub_term_input *grub_term_inputs; -struct grub_handler_class grub_term_input_class; -struct grub_handler_class grub_term_output_class; diff --cc util/grub-editenv.c index 24c36329c,2cef2b8a8..75cccd04e --- a/util/grub-editenv.c +++ b/util/grub-editenv.c @@@ -19,10 -19,8 +19,9 @@@ #include #include +#include #include #include - #include #include #include @@@ -35,12 -33,32 +34,6 @@@ #define DEFAULT_ENVBLK_SIZE 1024 -void -grub_refresh (void) -{ - fflush (stdout); -} - -int -grub_getkey (void) -{ - return 0; -} - -void -grub_xputs_real (const char *str) -{ - fputs (str, stdout); -} - -void (*grub_xputs) (const char *str) = grub_xputs_real; - --char * --grub_env_get (const char *name __attribute__ ((unused))) --{ -- return NULL; --} -- static struct option options[] = { {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'V'}, diff --cc util/grub-mkfont.c index 30dd96a21,970cc4aca..3e24380d1 --- a/util/grub-mkfont.c +++ b/util/grub-mkfont.c @@@ -18,11 -18,12 +18,14 @@@ #include #include +#include +#include #include + #include #include #include + #include + #include #include #include diff --cc util/grub-mkrescue.in index aace48684,e498acee7..43d128033 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@@ -1,7 -1,8 +1,8 @@@ - #! /bin/sh -e + #! /bin/sh + set -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 -29,10 +29,10 @@@ 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" + self=`basename $0` + multiboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-multiboot coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-coreboot qemu_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-qemu diff --cc util/misc.c index 73d4d659d,91bc25a55..3413c051a --- a/util/misc.c +++ b/util/misc.c @@@ -180,89 -178,6 +180,97 @@@ grub_util_write_image (const char *img 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); +} + ++static void ++grub_xputs_real (const char *str) ++{ ++ fputs (str, stdout); ++} ++ ++void (*grub_xputs) (const char *str) = grub_xputs_real; ++ +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)),