]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
merge mainline into ia64
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 31 Aug 2010 19:47:26 +0000 (21:47 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 31 Aug 2010 19:47:26 +0000 (21:47 +0200)
36 files changed:
1  2 
Makefile.util.def
configure.ac
gentpl.py
grub-core/Makefile.am
grub-core/Makefile.core.def
grub-core/commands/efi/acpi2.c
grub-core/commands/efi/memmap.c
grub-core/commands/efi/systab.c
grub-core/commands/handler.c
grub-core/efiemu/runtime/efiemu.sh
grub-core/kern/dl.c
grub-core/kern/handler.c
grub-core/kern/i386/ieee1275/init.c
grub-core/kern/i386/loader.S
grub-core/kern/i386/misc.S
grub-core/kern/ia64/efi/elf_ia64_efi.lds
grub-core/kern/ia64/efi/init.c
grub-core/kern/ia64/efi/startup.S
grub-core/kern/ia64/trampoline.S
grub-core/kern/main.c
grub-core/kern/mm.c
grub-core/lib/ia64/longjmp.S
grub-core/lib/ia64/setjmp.S
grub-core/loader/i386/bsd_helper.S
grub-core/loader/i386/bsd_trampoline.S
grub-core/loader/i386/efi/linux.c
grub-core/loader/i386/efi/xnu.c
grub-core/loader/i386/ieee1275/linux.c
grub-core/loader/i386/linux_trampoline.S
grub-core/loader/i386/pc/xnu.c
grub-core/loader/ia64/efi/linux.c
grub-core/loader/multiboot_loader.c
grub-core/normal/handler.c
grub-core/term/i386/pc/vesafb.c
include/grub/dl.h
include/grub/efi/efi.h

index 0000000000000000000000000000000000000000,9565dde65cade8e2361d00c65dcba7b25fd24716..28e66a06753c1b041d1a7e2a6d9334c354c13df1
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,514 +1,526 @@@
 -  enable = x86_efi;
+ AutoGen definitions Makefile.tpl;
+ library = {
+   name = libgrub.a;
+   cflags = '$(CFLAGS_GCRY)';
+   cppflags = '$(CPPFLAGS_GCRY)';
+   common_nodist = grub_script.tab.c;
+   common_nodist = grub_script.yy.c;
+   common_nodist = libgrub_a_init.c;
+   common_nodist = grub_script.yy.h;
+   common_nodist = grub_script.tab.h;
+   common = grub-core/gnulib/error.c;
+   common = grub-core/gnulib/fnmatch.c;
+   common = grub-core/gnulib/getdelim.c;
+   common = grub-core/gnulib/getline.c;
+   common = grub-core/gnulib/getopt1.c;
+   common = grub-core/gnulib/getopt.c;
+   common = grub-core/gnulib/progname.c;
+   common = util/misc.c;
+   common = grub-core/kern/misc.c;
+   common = grub-core/kern/emu/mm.c;
+   common = grub-core/kern/emu/misc.c;
+   common = grub-core/kern/emu/hostfs.c;
+   common = grub-core/kern/emu/getroot.c;
+   common = grub-core/kern/emu/hostdisk.c;
+   common = grub-core/commands/blocklist.c;
+   common = grub-core/commands/extcmd.c;
+   common = grub-core/commands/ls.c;
+   common = grub-core/disk/dmraid_nvidia.c;
+   common = grub-core/disk/host.c;
+   common = grub-core/disk/loopback.c;
+   common = grub-core/disk/lvm.c;
+   common = grub-core/disk/mdraid_linux.c;
+   common = grub-core/disk/raid5_recover.c;
+   common = grub-core/disk/raid6_recover.c;
+   common = grub-core/disk/raid.c;
+   common = grub-core/fs/affs.c;
+   common = grub-core/fs/afs_be.c;
+   common = grub-core/fs/afs.c;
+   common = grub-core/fs/befs_be.c;
+   common = grub-core/fs/befs.c;
+   common = grub-core/fs/cpio.c;
+   common = grub-core/fs/ext2.c;
+   common = grub-core/fs/fat.c;
+   common = grub-core/fs/fshelp.c;
+   common = grub-core/fs/hfs.c;
+   common = grub-core/fs/hfsplus.c;
+   common = grub-core/fs/iso9660.c;
+   common = grub-core/fs/jfs.c;
+   common = grub-core/fs/minix.c;
+   common = grub-core/fs/nilfs2.c;
+   common = grub-core/fs/ntfs.c;
+   common = grub-core/fs/ntfscomp.c;
+   common = grub-core/fs/reiserfs.c;
+   common = grub-core/fs/sfs.c;
+   common = grub-core/fs/tar.c;
+   common = grub-core/fs/udf.c;
+   common = grub-core/fs/ufs2.c;
+   common = grub-core/fs/ufs.c;
+   common = grub-core/fs/xfs.c;
+   common = grub-core/kern/command.c;
+   common = grub-core/kern/device.c;
+   common = grub-core/kern/disk.c;
+   common = grub-core/kern/env.c;
+   common = grub-core/kern/err.c;
+   common = grub-core/kern/file.c;
+   common = grub-core/kern/fs.c;
+   common = grub-core/kern/list.c;
+   common = grub-core/kern/partition.c;
+   common = grub-core/lib/arg.c;
+   common = grub-core/lib/crc.c;
+   common = grub-core/lib/crypto.c;
+   common = grub-core/lib/envblk.c;
+   common = grub-core/lib/hexdump.c;
+   common = grub-core/lib/libgcrypt-grub/cipher/sha512.c;
+   common = grub-core/lib/LzFind.c;
+   common = grub-core/lib/LzmaEnc.c;
+   common = grub-core/lib/pbkdf2.c;
+   common = grub-core/normal/datetime.c;
+   common = grub-core/normal/misc.c;
+   common = grub-core/partmap/acorn.c;
+   common = grub-core/partmap/amiga.c;
+   common = grub-core/partmap/apple.c;
+   common = grub-core/partmap/gpt.c;
+   common = grub-core/partmap/msdos.c;
+   common = grub-core/partmap/sun.c;
+   common = grub-core/script/function.c;
+   common = grub-core/script/lexer.c;
+   common = grub-core/script/main.c;
+   common = grub-core/script/script.c;
+   common = grub-core/script/argv.c;
+ };
+ program = {
+   name = grub-bin2h;
+   common = util/bin2h.c;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
+   mansection = 1;
+ };
+ program = {
+   name = grub-mkimage;
+   mansection = 1;
+   common = util/grub-mkimage.c;
+   common = util/resolve.c;
+   extra_dist = util/grub-mkimagexx.c;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
+   cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"';
+ };
+ program = {
+   name = grub-mkrelpath;
+   mansection = 1;
+   common = util/grub-mkrelpath.c;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
+ };
+ program = {
+   name = grub-script-check;
+   mansection = 1;
+   common = util/grub-script-check.c;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
+ };
+ program = {
+   name = grub-editenv;
+   mansection = 1;
+   common = util/grub-editenv.c;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
+ };
+ program = {
+   name = grub-mkpasswd-pbkdf2;
+   mansection = 1;
+   common = util/grub-mkpasswd-pbkdf2.c;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
+   cflags = '$(CFLAGS_GCRY)';
+   cppflags = '$(CPPFLAGS_GCRY)';
+ };
+ program = {
+   name = grub-macho2img;
+   mansection = 1;
+   common = util/grub-macho2img.c;
+   condition = COND_APPLE_CC;
+ };
+ program = {
+   name = grub-pe2elf;
+   mansection = 1;
+   common = util/grub-pe2elf.c;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL)';
+   condition = COND_GRUB_PE2ELF;
+ };
+ program = {
+   name = grub-fstest;
+   mansection = 1;
+   common = util/grub-fstest.c;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
+   condition = COND_GRUB_FSTEST;
+ };
+ program = {
+   name = grub-mkfont;
+   mansection = 1;
+   common = util/grub-mkfont.c;
+   common = grub-core/unidata.c;
+   cflags = '$(freetype_cflags)';
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
+   ldadd = '$(freetype_libs)';
+   condition = COND_GRUB_MKFONT;
+ };
+ program = {
+   name = grub-mkdevicemap;
+   installdir = sbin;
+   mansection = 8;
+   common = util/grub-mkdevicemap.c;
+   common = util/deviceiter.c;
+   nosparc64 = util/devicemap.c;
+   sparc64_ieee1275 = util/ieee1275/ofpath.c;
+   sparc64_ieee1275 = util/ieee1275/devicemap.c;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)';
+ };
+ program = {
+   name = grub-probe;
+   installdir = sbin;
+   mansection = 8;
+   common = util/grub-probe.c;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)';
+ };
+ 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) $(LIBDEVMAPPER) $(LIBUTIL)';
+   enable = i386_pc;
+   enable = sparc64_ieee1275;
+ };
+ program = {
+   name = grub-ofpathname;
+   installdir = sbin;
+   ieee1275 = util/ieee1275/grub-ofpathname.c;
+   ieee1275 = util/ieee1275/ofpath.c;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)';
+   enable = sparc64_ieee1275;
+ };
++program = {
++  name = grub-elf2pe;
++  common = util/ia64/efi/elf2pe.c;
++  cppflags = '-DELF2PE_IA64';
++  ldadd = libgrub.a;
++  ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
++  mansection = 1;
++  enable = ia64_efi;
++};
++
+ data = {
+   common = util/grub.d/README;
+   installdir = grubconf;
+ };
+ script = {
+   name = '00_header';
+   common = util/grub.d/00_header.in;
+   installdir = grubconf;
+ };
+ script = {
+   name = '10_windows';
+   common = util/grub.d/10_windows.in;
+   installdir = grubconf;
+   condition = COND_HOST_WINDOWS;
+ };
+ script = {
+   name = '10_hurd';
+   common = util/grub.d/10_hurd.in;
+   installdir = grubconf;
+   condition = COND_HOST_HURD;
+ };
+ script = {
+   name = '10_kfreebsd';
+   common = util/grub.d/10_kfreebsd.in;
+   installdir = grubconf;
+   condition = COND_HOST_KFREEBSD;
+ };
+ script = {
+   name = '10_netbsd';
+   common = util/grub.d/10_netbsd.in;
+   installdir = grubconf;
+   condition = COND_HOST_NETBSD;
+ };
+ script = {
+   name = '10_linux';
+   common = util/grub.d/10_linux.in;
+   installdir = grubconf;
+   condition = COND_HOST_LINUX;
+ };
+ script = {
+   name = '20_linux_xen';
+   common = util/grub.d/20_linux_xen.in;
+   installdir = grubconf;
+   condition = COND_HOST_LINUX;
+ };
+ script = {
+   name = '30_os-prober';
+   common = util/grub.d/30_os-prober.in;
+   installdir = grubconf;
+ };
+ script = {
+   name = '40_custom';
+   common = util/grub.d/40_custom.in;
+   installdir = grubconf;
+ };
+ script = {
+   name = '41_custom';
+   common = util/grub.d/41_custom.in;
+   installdir = grubconf;
+ };
+ script = {
+   mansection = 1;
+   name = grub-mkrescue;
+   x86 = util/grub-mkrescue.in;
+   powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in;
+   enable = i386_pc;
 -  x86_efi = util/i386/efi/grub-install.in;
++  enable = i386_efi;
++  enable = x86_64_efi;
+   enable = i386_qemu;
+   enable = i386_multiboot;
+   enable = i386_coreboot;
+   enable = powerpc_ieee1275;
+ };
+ script = {
+   mansection = 8;
+   installdir = sbin;
+   name = grub-install;
+   mips = util/grub-install.in;
+   i386_pc = util/grub-install.in;
+   i386_qemu = util/grub-install.in;
+   i386_coreboot = util/grub-install.in;
+   i386_multiboot = util/grub-install.in;
+   sparc64_ieee1275 = util/grub-install.in;
++  i386_efi = util/i386/efi/grub-install.in;
++  x86_64_efi = util/i386/efi/grub-install.in;
+   i386_ieee1275 = util/ieee1275/grub-install.in;
+   powerpc_ieee1275 = util/ieee1275/grub-install.in;
+   enable = noemu;
+ };
+ script = {
+   name = grub-mkconfig;
+   common = util/grub-mkconfig.in;
+   mansection = 8;
+   installdir = sbin;
+ };
+ script = {
+   name = grub-set-default;
+   common = util/grub-set-default.in;
+   mansection = 8;
+   installdir = sbin;
+ };
+ script = {
+   name = grub-reboot;
+   common = util/grub-reboot.in;
+   mansection = 8;
+   installdir = sbin;
+ };
+ script = {
+   name = grub-mkconfig_lib;
+   common = util/grub-mkconfig_lib.in;
+   installdir = noinst;
+ };
+ script = {
+   name = update-grub_lib;
+   common = util/update-grub_lib.in;
+   installdir = noinst;
+ };
+ script = {
+   name = grub-shell;
+   common = tests/util/grub-shell.in;
+   installdir = noinst;
+ };
+ script = {
+   name = grub-shell-tester;
+   common = tests/util/grub-shell-tester.in;
+   installdir = noinst;
+ };
+ script = {
+   testcase;
+   name = example_scripted_test;
+   common = tests/example_scripted_test.in;
+ };
+ script = {
+   testcase;
+   name = example_grub_script_test;
+   common = tests/example_grub_script_test.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_echo1;
+   common = tests/grub_script_echo1.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_echo_keywords;
+   common = tests/grub_script_echo_keywords.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_vars1;
+   common = tests/grub_script_vars1.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_for1;
+   common = tests/grub_script_for1.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_while1;
+   common = tests/grub_script_while1.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_if;
+   common = tests/grub_script_if.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_blanklines;
+   common = tests/grub_script_blanklines.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_final_semicolon;
+   common = tests/grub_script_final_semicolon.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_dollar;
+   common = tests/grub_script_dollar.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_comments;
+   common = tests/grub_script_comments.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_functions;
+   common = tests/grub_script_functions.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_break;
+   common = tests/grub_script_break.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_continue;
+   common = tests/grub_script_continue.in;
+ };
+ script = {
+   testcase;
+   name = grub_script_shift;
+   common = tests/grub_script_shift.in;
+ };
+ program = {
+   testcase;
+   name = example_unit_test;
+   common = tests/example_unit_test.c;
+   common = tests/lib/unit_test.c;
+   common = grub-core/kern/list.c;
+   common = grub-core/kern/misc.c;
+   common = grub-core/tests/lib/test.c;
+   cflags = -Wno-format;
+   ldadd = libgrub.a;
+   ldadd = '$(LIBDEVMAPPER)';
+ };
diff --cc configure.ac
index ee35b53f09249808d3f120c449ab5e36b4a07c1c,9fa460620f2c54a1afd4ccc8e5f9a5d04f33b9e2..435670522d0f75141a518c0f5669833d0ef47987
@@@ -69,7 -94,7 +94,8 @@@ if test "x$with_platform" = x; the
      powerpc-*) platform=ieee1275 ;;
      powerpc64-*) platform=ieee1275 ;;
      sparc64-*) platform=ieee1275 ;;
 +    ia64-*) platform=efi ;;
+     mips-*) platform=yeeloong ;;
      *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
    esac
  else
@@@ -96,7 -123,8 +124,9 @@@ case "$target_cpu"-"$platform" i
    i386-qemu) ;;
    powerpc-ieee1275) ;;
    sparc64-ieee1275) ;;
 +  ia64-efi) ;;
+   mips-qemu-mips) ;;
+   mips-yeeloong) ;;
    *-emu) ;;
    *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
  esac
@@@ -639,7 -813,89 +815,90 @@@ AC_SUBST([enable_grub_mkfont]
  AC_SUBST([freetype_cflags])
  AC_SUBST([freetype_libs])
  
- AC_SUBST(ASFLAGS)
+ 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],
+                [LIBDEVMAPPER="-ldevmapper"
+                 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
+                           [Define to 1 if you have the devmapper library.])],
+                [device_mapper_excuse="need devmapper library"])
+ fi
+ AC_SUBST([LIBDEVMAPPER])
+ AC_CHECK_LIB([zfs], [libzfs_init],
+              [LIBZFS="-lzfs"
+               AC_DEFINE([HAVE_LIBZFS], [1],
+                         [Define to 1 if you have the ZFS library.])],)
+ AC_SUBST([LIBZFS])
+ AC_CHECK_LIB([nvpair], [nvlist_print],
+              [LIBNVPAIR="-lnvpair"
+               AC_DEFINE([HAVE_LIBNVPAIR], [1],
+                         [Define to 1 if you have the NVPAIR library.])],)
+ AC_SUBST([LIBNVPAIR])
+ 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_ia64_efi], [test x$target_cpu = xia64 -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_HOST_HURD], [test x$host_kernel = xhurd])
+ AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
+ AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
+ AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
+ AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
+ AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
+ AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
+ AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
+ AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
+ AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
+ AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
+ AM_CONDITIONAL([COND_GRUB_FSTEST], [test x$enable_grub_fstest = xyes])
+ AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
+ AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
+ AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
  
  # Output files.
  grub_CHECK_LINK_DIR
diff --cc gentpl.py
index 0000000000000000000000000000000000000000,abfb2044455cf1ba046afe34807e8c8ce4c64ee0..61c3c6463cde81ce3fcb244090896759a6c83744
mode 000000,100644..100644
--- /dev/null
+++ b/gentpl.py
@@@ -1,0 -1,529 +1,529 @@@
 -                   "powerpc_ieee1275" ]
+ #! /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",
 -GROUPS["x86_efi"]  = [ "i386_efi", "x86_64_efi" ]
++                   "powerpc_ieee1275", "ia64_efi" ]
+ GROUPS = {}
+ GROUPS["common"]   = GRUB_PLATFORMS[:]
+ # Groups based on CPU
+ GROUPS["i386"]     = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ]
+ GROUPS["x86_64"]   = [ "x86_64_efi" ]
+ GROUPS["x86"]      = GROUPS["i386"] + GROUPS["x86_64"]
+ GROUPS["mips"]     = [ "mips_yeeloong" ]
+ GROUPS["sparc64"]  = [ "sparc64_ieee1275" ]
+ GROUPS["powerpc"]  = [ "powerpc_ieee1275" ]
+ # Groups based on firmware
++GROUPS["efi"]  = [ "i386_efi", "x86_64_efi", "ia64_efi" ]
+ GROUPS["ieee1275"]   = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]
+ # emu is a special case so many core functionality isn't needed on this platform
+ GROUPS["noemu"]   = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
+ # Groups based on hardware features
+ GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_yeeloong"]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
+ GROUPS["pci"]      = GROUPS["x86"] + GROUPS["mips"]
+ GROUPS["usb"]      = GROUPS["pci"]
+ # If gfxterm is main output console integrate it into kernel
+ GROUPS["videoinkernel"] = ["mips_yeeloong"]
+ GROUPS["videomodules"]   = GRUB_PLATFORMS[:];
+ for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
+ # Miscelaneous groups schedulded to disappear in future
+ GROUPS["nosparc64"] = GRUB_PLATFORMS[:]; GROUPS["nosparc64"].remove("sparc64_ieee1275")
+ GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
+ GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc")
+ #
+ # 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 set_canonical_name_suffix(suffix): return "[+ % name `export cname=$(echo %s" + suffix + " | sed -e 's/[^0-9A-Za-z@_]/_/g')` +]"
+ def cname(): return "[+ % name `echo $cname` +]"
+ def rule(target, source, cmd):
+     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"
+ #
+ # Template for keys with platform names as values, for example:
+ #
+ # kernel = {
+ #   nostrip = emu;
+ #   ...
+ # }
+ #
+ def if_platform_tagged(platform, tag, snippet_if, snippet_else=None):
+     r = ""
+     r += "[+ IF " + tag + " defined +]"
+     r += "[+ FOR " + tag + " +][+ CASE " + tag + " +]"
+     for group in RMAP[platform]:
+         r += "[+ = \"" + group + "\" +]" + snippet_if
+     if snippet_else != None: r += "[+ * +]" + snippet_else
+     r += "[+ ESAC +][+ ENDFOR +]"
+     if snippet_else == None:
+         r += "[+ ENDIF +]"
+         return r
+     r += "[+ ELSE +]" + snippet_else + "[+ ENDIF +]"
+     return r
+ #
+ # Template for tagged values
+ #
+ # module = {
+ #   extra_dist = ...
+ #   extra_dist = ...
+ #   ...
+ # };
+ #
+ def foreach_value(tag, closure):
+     return "[+ FOR " + tag + " +]" + closure("[+ ." + tag + " +]") + "[+ ENDFOR +]"
+ #
+ # Template for handling best matched values for a platform, for example:
+ #
+ # module = {
+ #   cflags = '-Wall';
+ #   emu_cflags = '-Wall -DGRUB_EMU=1';
+ #   ...
+ # }
+ #
+ def foreach_platform_specific_value(platform, suffix, nonetag, closure):
+     r = ""
+     for group in RMAP[platform]:
+         gtag = group + suffix
+         if group == RMAP[platform][0]:
+             r += "[+ IF " + gtag + " +]"
+         else:
+             r += "[+ ELIF " + gtag + " +]"
+         r += "[+ FOR " + gtag + " +]" + closure("[+ ." + gtag + " +]") + "[+ ENDFOR +]"
+     r += "[+ ELSE +][+ FOR " + nonetag + " +]" + closure("[+ ." + nonetag + " +]") + "[+ ENDFOR +][+ ENDIF +]"
+     return r
+ #
+ # Template for handling values from sum of all groups for a platform,
+ # for example:
+ #
+ # module = {
+ #   common = kern/misc.c;
+ #   emu = kern/emu/misc.c;
+ #   ...
+ # }
+ #
+ def foreach_platform_value (platform, suffix, closure):
+     r = ""
+     for group in RMAP[platform]:
+         gtag = group + suffix
+         r += "[+ IF " + gtag + " +]"
+         r += "[+ FOR " + gtag + " +]" + closure("[+ ." + gtag + " +]") + "[+ ENDFOR +]"
+         r += "[+ ENDIF +]"
+     return r
+ #
+ # Template for gaurding with platform specific "enable" keys, for example:
+ #
+ #  module = {
+ #    name = pci;
+ #    noemu = bus/pci.c;
+ #    emu = bus/emu/pci.c;
+ #    emu = commands/lspci.c;
+ #
+ #    enable = emu;
+ #    enable = i386_pc;
+ #    enable = x86_efi;
+ #    enable = i386_ieee1275;
+ #    enable = i386_coreboot;
+ #  };
+ #
+ def foreach_enabled_platform(closure):
+     r = "[+ IF - enable undefined +]"
+     for platform in GRUB_PLATFORMS:
+         r += "\nif COND_" + platform + "\n" + closure(platform) + "endif\n"
+     r += "[+ ELSE +]"
+     for platform in GRUB_PLATFORMS:
+         x = "\nif COND_" + platform + "\n" + closure(platform) + "endif\n"
+         r += if_platform_tagged(platform, "enable", x)
+     r += "[+ ENDIF +]"
+     return r
+ #
+ # Template for gaurding with platform specific automake conditionals,
+ # for example:
+ #
+ #  module = {
+ #    name = usb;
+ #    common = bus/usb/usb.c;
+ #    noemu = bus/usb/usbtrans.c;
+ #    noemu = bus/usb/usbhub.c;
+ #    enable = emu;
+ #    enable = i386;
+ #    enable = mips_yeeloong;
+ #    emu_condition = COND_GRUB_EMU_USB;
+ #  };
+ #
+ def under_platform_specific_conditionals(platform, snippet):
+     r  = foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n")
+     r += snippet
+     r += foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n")
+     return r
+ def platform_specific_values(platform, suffix, nonetag):
+     return foreach_platform_specific_value(platform, suffix, nonetag,
+                                            lambda value: value + " ")
+ def platform_values(platform, suffix):
+     return foreach_platform_value(platform, suffix, lambda value: value + " ")
+ def extra_dist():
+     return foreach_value("extra_dist", lambda value: value + " ")
+ def platform_sources(p): return platform_values(p, "")
+ def platform_nodist_sources(p): return platform_values(p, "_nodist")
+ def platform_dependencies(p): return platform_values(p, "dependencies", "_dependencies")
+ def platform_startup(p): return platform_specific_values(p, "_startup", "startup")
+ def platform_ldadd(p): return platform_specific_values(p, "_ldadd", "ldadd")
+ def platform_cflags(p): return platform_specific_values(p, "_cflags", "cflags")
+ def platform_ldflags(p): return platform_specific_values(p, "_ldflags", "ldflags")
+ def platform_cppflags(p): return platform_specific_values(p, "_cppflags", "cppflags")
+ def platform_ccasflags(p): return platform_specific_values(p, "_ccasflags", "ccasflags")
+ def platform_stripflags(p): return platform_specific_values(p, "_stripflags", "stripflags")
+ def platform_objcopyflags(p): return platform_specific_values(p, "_objcopyflags", "objcopyflags")
+ def module(platform):
+     r = set_canonical_name_suffix(".module")
+     r += gvar_add("noinst_PROGRAMS", "[+ name +].module")
+     r += gvar_add("MODULE_FILES", "[+ name +].module$(EXEEXT)")
+     r += var_set(cname() + "_SOURCES", platform_sources(platform) + " ## platform sources")
+     r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## platform nodist sources")
+     r += var_set(cname() + "_LDADD", platform_ldadd(platform))
+     r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_MODULE) " + platform_cflags(platform))
+     r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_MODULE) " + platform_ldflags(platform))
+     r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_MODULE) " + platform_cppflags(platform))
+     r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_MODULE) " + platform_ccasflags(platform))
+     # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
+     r += gvar_add("EXTRA_DIST", extra_dist())
+     r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
+     r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
+     r += gvar_add("DEF_FILES", "def-[+ name +].lst")
+     r += gvar_add("UND_FILES", "und-[+ name +].lst")
+     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: $(""" + cname() + """_SOURCES) $(nodist_""" + cname() + """_SOURCES)
+       $(TARGET_CPP) -DGRUB_LST_GENERATOR $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@ || (rm -f $@; exit 1)
+ def-[+ name +].lst: [+ name +].module$(EXEEXT)
+       if test x$(USE_APPLE_CC_FIXES) = xyes; then \
+         $(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) moddep.lst genmodsrc.sh
+       sh $(srcdir)/genmodsrc.sh [+ name +] moddep.lst > $@ || (rm -f $@; exit 1)
+ mod-[+ name +].o: mod-[+ name +].c
+       $(TARGET_CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname() + """_CPPFLAGS) $(CPPFLAGS) $(""" + cname() + """_CFLAGS) $(CFLAGS) -c -o $@ $<
+ [+ name +].mod: [+ name +].module$(EXEEXT) mod-[+ name +].o
+       if test x$(USE_APPLE_CC_FIXES) = xyes; then \
+         $(CCLD) $(""" + cname() + """_LDFLAGS) $(LDFLAGS) -o $@.bin $^; \
+         $(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -nu -nd $@.bin $@; \
+         rm -f $@.bin; \
+       else \
+         $(CCLD) -o $@ $(""" + cname() + """_LDFLAGS) $(LDFLAGS) $^; \
+         if test ! -z '$(TARGET_OBJ2ELF)'; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
+         $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; \
+       fi
+ command-[+ name +].lst: [+ name +].pp $(srcdir)/gencmdlist.sh
+       cat $< | sh $(srcdir)/gencmdlist.sh [+ name +] > $@ || (rm -f $@; exit 1)
+ fs-[+ name +].lst: [+ name +].pp $(srcdir)/genfslist.sh
+       cat $< | sh $(srcdir)/genfslist.sh [+ name +] > $@ || (rm -f $@; exit 1)
+ video-[+ name +].lst: [+ name +].pp $(srcdir)/genvideolist.sh
+       cat $< | sh $(srcdir)/genvideolist.sh [+ name +] > $@ || (rm -f $@; exit 1)
+ partmap-[+ name +].lst: [+ name +].pp $(srcdir)/genpartmaplist.sh
+       cat $< | sh $(srcdir)/genpartmaplist.sh [+ name +] > $@ || (rm -f $@; exit 1)
+ parttool-[+ name +].lst: [+ name +].pp $(srcdir)/genparttoollist.sh
+       cat $< | sh $(srcdir)/genparttoollist.sh [+ name +] > $@ || (rm -f $@; exit 1)
+ handler-[+ name +].lst: [+ name +].pp $(srcdir)/genhandlerlist.sh
+       cat $< | sh $(srcdir)/genhandlerlist.sh [+ name +] > $@ || (rm -f $@; exit 1)
+ terminal-[+ name +].lst: [+ name +].pp $(srcdir)/genterminallist.sh
+       cat $< | sh $(srcdir)/genterminallist.sh [+ name +] > $@ || (rm -f $@; exit 1)
+ """
+     return r
+ def kernel(platform):
+     r = set_canonical_name_suffix(".exec")
+     r += gvar_add("noinst_PROGRAMS", "[+ name +].exec")
+     r += var_set(cname() + "_SOURCES", platform_startup(platform))
+     r += var_add(cname() + "_SOURCES", platform_sources(platform))
+     r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## platform nodist sources")
+     r += var_set(cname() + "_LDADD", platform_ldadd(platform))
+     r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_KERNEL) " + platform_cflags(platform))
+     r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_KERNEL) " + platform_ldflags(platform))
+     r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) " + platform_cppflags(platform))
+     r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_KERNEL) " + platform_ccasflags(platform))
+     r += var_set(cname() + "_STRIPFLAGS", "$(AM_STRIPFLAGS) $(STRIPFLAGS_KERNEL) " + platform_stripflags(platform))
+     # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
+     r += gvar_add("EXTRA_DIST", extra_dist())
+     r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
+     r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
+     r += gvar_add("platform_DATA", "[+ name +].img")
+     r += gvar_add("CLEANFILES", "[+ name +].img")
+     r += rule("[+ name +].img", "[+ name +].exec$(EXEEXT)",
+               if_platform_tagged(platform, "nostrip", "cp $< $@",
+                                  "$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<"))
+     return r
+ def image(platform):
+     r = set_canonical_name_suffix(".image")
+     r += gvar_add("noinst_PROGRAMS", "[+ name +].image")
+     r += var_set(cname() + "_SOURCES", platform_sources(platform))
+     r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources")
+     r += var_set(cname() + "_LDADD", platform_ldadd(platform))
+     r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_IMAGE) " + platform_cflags(platform))
+     r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_IMAGE) " + platform_ldflags(platform))
+     r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_IMAGE) " + platform_cppflags(platform))
+     r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_IMAGE) " + platform_ccasflags(platform))
+     r += var_set(cname() + "_OBJCOPYFLAGS", "$(OBJCOPYFLAGS_IMAGE) " + platform_objcopyflags(platform))
+     # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
+     r += gvar_add("EXTRA_DIST", extra_dist())
+     r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
+     r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
+     r += gvar_add("platform_DATA", "[+ name +].img")
+     r += gvar_add("CLEANFILES", "[+ name +].img")
+     r += rule("[+ name +].img", "[+ name +].image$(EXEEXT)", """
+ if test x$(USE_APPLE_CC_FIXES) = xyes; then \
+   $(MACHO2IMG) $< $@; \
+ else \
+   $(OBJCOPY) $(""" + cname() + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@; \
+ fi
+ """)
+     return r
+ def library(platform):
+     r = set_canonical_name_suffix("")
+     r += gvar_add("noinst_LIBRARIES", "[+ name +]")
+     r += var_set(cname() + "_SOURCES", platform_sources(platform))
+     r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform))
+     r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_LIBRARY) " + platform_cflags(platform))
+     r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) " + platform_cppflags(platform))
+     r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) " + platform_ccasflags(platform))
+     # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
+     r += gvar_add("EXTRA_DIST", extra_dist())
+     r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
+     r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_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 +]", "[+ name +]", """
+ chmod a+x [+ 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):
+     r = set_canonical_name_suffix("")
+     r += "[+ IF testcase defined +]"
+     r += gvar_add("check_PROGRAMS", "[+ name +]")
+     r += gvar_add("TESTS", "[+ name +]")
+     r += "[+ ELSE +]"
+     r += gvar_add(installdir() + "_PROGRAMS", "[+ name +]")
+     r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
+     r += "[+ ENDIF +]"
+     r += var_set(cname() + "_SOURCES", platform_sources(platform))
+     r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform))
+     r += var_set(cname() + "_LDADD", platform_ldadd(platform))
+     r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_PROGRAM) " + platform_cflags(platform))
+     r += var_set(cname() + "_LDFLAGS", "$(AM_LDFLAGS) $(LDFLAGS_PROGRAM) " + platform_ldflags(platform))
+     r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_PROGRAM) " + platform_cppflags(platform))
+     r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_PROGRAM) " + platform_ccasflags(platform))
+     # r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
+     r += gvar_add("EXTRA_DIST", extra_dist())
+     r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
+     r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
+     return r
+ def data(platform):
+     r  = gvar_add("EXTRA_DIST", platform_sources(platform))
+     r += gvar_add("EXTRA_DIST", extra_dist())
+     r += gvar_add(installdir() + "_DATA", platform_sources(platform))
+     return r
+ def script(platform):
+     r  = "[+ IF testcase defined +]"
+     r += gvar_add("check_SCRIPTS", "[+ name +]")
+     r += gvar_add ("TESTS", "[+ name +]")
+     r += "[+ ELSE +]"
+     r += gvar_add(installdir() + "_SCRIPTS", "[+ name +]")
+     r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
+     r += "[+ ENDIF +]"
+     r += rule("[+ name +]", "$(top_builddir)/config.status " + platform_sources(platform), """
+ $(top_builddir)/config.status --file=-:""" + platform_sources(platform) + """ \
+   | 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))
+     return r
+ def module_rules():
+     return "[+ FOR module +]" + foreach_enabled_platform(
+         lambda p: under_platform_specific_conditionals(p, module(p))) + "[+ ENDFOR +]"
+ def kernel_rules():
+     return "[+ FOR kernel +]" + foreach_enabled_platform(
+         lambda p: under_platform_specific_conditionals(p, kernel(p))) + "[+ ENDFOR +]"
+ def image_rules():
+     return "[+ FOR image +]" + foreach_enabled_platform(
+         lambda p: under_platform_specific_conditionals(p, image(p))) + "[+ ENDFOR +]"
+ def library_rules():
+     return "[+ FOR library +]" + foreach_enabled_platform(
+         lambda p: under_platform_specific_conditionals(p, library(p))) + "[+ ENDFOR +]"
+ def program_rules():
+     return "[+ FOR program +]" + foreach_enabled_platform(
+         lambda p: under_platform_specific_conditionals(p, program(p))) + "[+ ENDFOR +]"
+ def script_rules():
+     return "[+ FOR script +]" + foreach_enabled_platform(
+         lambda p: under_platform_specific_conditionals(p, script(p))) + "[+ ENDFOR +]"
+ def data_rules():
+     return "[+ FOR data +]" + foreach_enabled_platform(
+         lambda p: under_platform_specific_conditionals(p, data(p))) + "[+ ENDFOR +]"
+ 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()
+ z = global_variable_initializers()
+ # print z # initializer for all vars
+ print a
+ print b
+ print c
+ print d
+ print e
+ print f
+ print g
index 0000000000000000000000000000000000000000,5d13d031329a015f2f0fe085a607992670fe389e..c1a4b54c05437249f4e5168934bbc9c1abd66e3d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,304 +1,312 @@@
+ AUTOMAKE_OPTIONS = subdir-objects
+ DEPDIR=.deps-core
+ include $(top_srcdir)/conf/Makefile.common
+ CC=$(TARGET_CC)
+ CPP=$(TARGET_CC)
+ CCAS=$(TARGET_CC)
+ if COND_GRUB_MKFONT
+ if COND_HAVE_FONT_SOURCE
+ TARGET_CFLAGS += -DUSE_ASCII_FAILBACK=1 -DHAVE_UNIFONT_WIDTHSPEC=1
+ endif
+ endif
+ AM_CFLAGS = $(TARGET_CFLAGS)
+ AM_LDFLAGS = $(TARGET_LDFLAGS)
+ AM_CPPFLAGS = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT)
+ AM_CCASFLAGS = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT)
+ CFLAGS_PROGRAM += $(CFLAGS_PLATFORM)
+ LDFLAGS_PROGRAM += $(LDFLAGS_PLATFORM)
+ CPPFLAGS_PROGRAM += $(CPPFLAGS_PLATFORM)
+ CCASFLAGS_PROGRAM += $(CCASFLAGS_PLATFORM)
+ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
+ CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
+ CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
+ # gentrigtables
+ gentrigtables: gentrigtables.c
+       $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(CPPFLAGS) -lm $<
+ CLEANFILES += gentrigtables
+ # trigtables.c
+ trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac
+       $(builddir)/gentrigtables > $@
+ CLEANFILES += trigtables.c
+ # XXX Use Automake's LEX & YACC support
+ grub_script.tab.h: script/parser.y
+       $(YACC) -d -p grub_script_yy -b grub_script $<
+ grub_script.tab.c: grub_script.tab.h
+ CLEANFILES += grub_script.tab.c grub_script.tab.h
+ # For the lexer.
+ grub_script.yy.h: script/yylex.l
+       $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $<
+ grub_script.yy.c: grub_script.yy.h
+ CLEANFILES += grub_script.yy.c grub_script.yy.h
+ include $(srcdir)/Makefile.core.am
+ include $(srcdir)/Makefile.gcry.am
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
+ if COND_i386_pc
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pxe.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
+ endif
+ if COND_i386_efi
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
+ endif
+ if COND_i386_coreboot
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
+ endif
+ if COND_i386_multiboot
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
+ endif
+ if COND_i386_qemu
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
+ endif
+ if COND_i386_ieee1275
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
+ endif
+ if COND_x86_64_efi
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
+ endif
++
++if COND_ia64_efi
++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
++KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ia64/efi/misc.h
++endif
++
+ if COND_mips_yeeloong
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap_scale.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/serial.h
+ endif
+ if COND_powerpc_ieee1275
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
+ endif
+ if COND_sparc64_ieee1275
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h
+ endif
+ if COND_emu
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h
+ if COND_GRUB_EMU_SDL
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
+ endif
+ if COND_GRUB_EMU_USB
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libusb.h
+ endif
+ if COND_GRUB_EMU_PCI
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h
+ endif
+ endif
+ symlist.h: $(top_builddir)/config.h $(KERNEL_HEADER_FILES)
+       @list='$^'; \
+       for p in $$list; do \
+         echo "#include <$$p>" >> $@ || (rm -f $@; exit 1); \
+       done
+ CLEANFILES += symlist.h
+ BUILT_SOURCES += symlist.h
+ symlist.c: symlist.h gensymlist.sh
+       $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1)
+       cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1)
+       rm -f symlist.p
+ CLEANFILES += symlist.c
+ BUILT_SOURCES += symlist.c
+ noinst_DATA += kernel_syms.lst
+ kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h
+       $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input
+       if grep "^#define HAVE_ASM_USCORE" $(top_builddir)/config.h; then u="_"; else u=""; fi; \
+       cat kernel_syms.input | grep -v '^#' | sed -n \
+         -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \
+         -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \
+         | sort -u >$@
+       rm -f kernel_syms.input
+ CLEANFILES += kernel_syms.lst
+ if COND_emu
+ kern/emu/grub_emu-main.$(OBJEXT):grub_emu_init.h
+ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
+ kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
+ grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
+ grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
+       rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@
+ CLEANFILES += grub_emu_init.h
+ grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
+       rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(NM) > $@
+ CLEANFILES += grub_emu_init.c
+ endif
+ # .lst files
+ platform_DATA += moddep.lst
+ platform_DATA += fs.lst
+ platform_DATA += command.lst
+ platform_DATA += partmap.lst
+ platform_DATA += handler.lst
+ platform_DATA += terminal.lst
+ platform_DATA += parttool.lst
+ platform_DATA += video.lst
+ platform_DATA += crypto.lst
+ CLEANFILES += moddep.lst
+ CLEANFILES += handler.lst
+ CLEANFILES += terminal.lst
+ CLEANFILES += parttool.lst
+ CLEANFILES += video.lst
+ CLEANFILES += crypto.lst
+ fs.lst: $(FS_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += fs.lst
+ command.lst: $(COMMAND_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += command.lst
+ partmap.lst: $(PARTMAP_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += partmap.lst
+ handler.lst: $(HANDLER_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += handler.lst
+ terminal.lst: $(TERMINAL_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += terminal.lst
+ parttool.lst: $(PARTTOOL_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += parttool.lst
+ video.lst: $(VIDEO_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += video.lst
+ # but, crypto.lst is simply copied
+ crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst
+       cp $^ $@
+ CLEANFILES += crypto.lst
+ # generate global module dependencies list
+ moddep.lst: kernel_syms.lst genmoddep.awk $(DEF_FILES) $(UND_FILES)
+       cat $(DEF_FILES) kernel_syms.lst /dev/null \
+         | $(AWK) -f $(srcdir)/genmoddep.awk $(UND_FILES) > $@ \
+         || (rm -f $@; exit 1)
+ if COND_ENABLE_EFIEMU
+ efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
+       -rm -f $@; \
+       if test "x$(TARGET_APPLE_CC)" = x1; then \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF32 -DAPPLE_CC -m32 -Wall -Werror -nostdlib -O2 -c -o $@.bin $< || exit 1; \
+         $(OBJCONV) -felf32 -nu -nd $@.bin $@ || exit 1; \
+         rm -f $@.bin; \
+       else \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF32 -m32 -Wall -Werror -nostdlib -O2 -c -o $@ $< || exit 1; \
+         if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
+       fi
+ efiemu64_c.o: efiemu/runtime/efiemu.c
+       if test "x$(TARGET_APPLE_CC)" = x1; then \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -DAPPLE_CC=1 -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \
+       else \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
+       fi
+ efiemu64_s.o: efiemu/runtime/efiemu.S
+       -rm -f $@
+       if test "x$(TARGET_APPLE_CC)" = x1; then \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -DAPPLE_CC=1 -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \
+       else \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
+       fi
+ efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
+       -rm -f $@; \
+       if test "x$(TARGET_APPLE_CC)" = x1; then \
+         rm -f $@.bin; \
+         $(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \
+         $(OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
+         rm -f $@.bin; \
+       else \
+         $(TARGET_CC) -m64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \
+         if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
+       fi
+ platform_DATA += efiemu32.o efiemu64.o
+ CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
+ endif
index 0000000000000000000000000000000000000000,353b9d123b65695401793e9fc43d7dc7bdb086af..9e84af28318508ef9033652ee598ad11e81f8874
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,1378 +1,1412 @@@
 -  x86_efi_ldflags          = '-Wl,-r,-d';
 -  x86_efi_stripflags       = '--strip-unneeded -K start -R .note -R .comment';
+ AutoGen definitions Makefile.tpl;
+ kernel = {
+   name = kernel;
+   nostrip = emu;
+   emu_ldflags              = '-Wl,-r,-d';
 -  x86_efi = kern/generic/rtc_get_time_ms.c;
++  i386_efi_ldflags         = '-Wl,-r,-d';
++  i386_efi_stripflags      = '--strip-unneeded -K start -R .note -R .comment';
++  x86_64_efi_ldflags       = '-Wl,-r,-d';
++  x86_64_efi_stripflags    = '--strip-unneeded -K start -R .note -R .comment';
++
++  ia64_efi_cflags = '-fno-builtin -fpic -minline-int-divide-max-throughput';
++  ia64_efi_ldflags = '-melf_64';
++  ia64_efi_stripflags = '-R .note -R .comment -X';
+   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';
+   i386_pc_startup = kern/i386/pc/startup.S;
+   i386_efi_startup = kern/i386/efi/startup.S;
+   x86_64_efi_startup = kern/x86_64/efi/startup.S;
+   i386_qemu_startup = kern/i386/qemu/startup.S;
+   i386_ieee1275_startup = kern/i386/ieee1275/startup.S;
+   i386_coreboot_startup = kern/i386/coreboot/startup.S;
+   i386_multiboot_startup = kern/i386/coreboot/startup.S;
+   mips_yeeloong_startup = kern/mips/startup.S;
+   sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S;
+   powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S;
+   common = kern/command.c;
+   common = kern/corecmd.c;
+   common = kern/device.c;
+   common = kern/disk.c;
+   common = kern/dl.c;
+   common = kern/env.c;
+   common = kern/err.c;
+   common = kern/file.c;
+   common = kern/fs.c;
+   common = kern/list.c;
+   common = kern/main.c;
+   common = kern/misc.c;
+   common = kern/parser.c;
+   common = kern/partition.c;
+   common = kern/rescue_parser.c;
+   common = kern/rescue_reader.c;
+   common = kern/term.c;
+   noemu = kern/mm.c;
+   noemu = kern/time.c;
+   noemu = kern/generic/millisleep.c;
+   noemu_nodist = symlist.c;
+   i386_pc = kern/generic/rtc_get_time_ms.c;
 -  x86_efi = disk/efi/efidisk.c;
 -  x86_efi = kern/efi/efi.c;
 -  x86_efi = kern/efi/init.c;
 -  x86_efi = kern/efi/mm.c;
 -  x86_efi = kern/i386/efi/init.c;
 -  x86_efi = term/efi/console.c;
++  efi = kern/generic/rtc_get_time_ms.c;
+   i386_qemu = kern/generic/rtc_get_time_ms.c;
+   i386_coreboot = kern/generic/rtc_get_time_ms.c;
+   i386_multiboot = kern/generic/rtc_get_time_ms.c;
+   mips_yeeloong = kern/generic/rtc_get_time_ms.c;
+   ieee1275 = disk/ieee1275/ofdisk.c;
+   ieee1275 = kern/ieee1275/cmain.c;
+   ieee1275 = kern/ieee1275/ieee1275.c;
+   ieee1275 = kern/ieee1275/mmap.c;
+   ieee1275 = kern/ieee1275/openfw.c;
+   ieee1275 = term/ieee1275/ofconsole.c;
+   ieee1275 = term/terminfo.c;
+   ieee1275 = term/tparm.c;
+   mips = term/terminfo.c;
+   mips = term/tparm.c;
+   i386 = kern/i386/dl.c;
+   i386_coreboot_multiboot_qemu = kern/i386/coreboot/init.c;
+   i386_coreboot_multiboot_qemu = term/i386/pc/vga_text.c;
+   i386_coreboot_multiboot_qemu = term/i386/vga_common.c;
+   i386_pc = term/i386/vga_common.c;
+   x86 = kern/i386/pit.c;
 -  enable = x86_efi;
++  efi = disk/efi/efidisk.c;
++  efi = kern/efi/efi.c;
++  efi = kern/efi/init.c;
++  efi = kern/efi/mm.c;
++  efi = term/efi/console.c;
+   i386_efi = kern/i386/tsc.c;
++  i386_efi = kern/i386/efi/init.c;
+   x86_64_efi = kern/i386/tsc.c;
+   x86_64_efi = kern/x86_64/dl.c;
+   x86_64_efi = kern/x86_64/efi/callwrap.S;
++  x86_64_efi = kern/i386/efi/init.c;
++
++  ia64_efi = kern/ia64/efi/startup.S;
++  ia64_efi = kern/ia64/trampoline.S;
++  ia64_efi = kern/ia64/efi/init.c;
+   i386_pc = kern/i386/pc/init.c;
+   i386_pc = kern/i386/pc/mmap.c;
+   i386_pc = kern/i386/tsc.c;
+   i386_pc = term/i386/pc/console.c;
+   i386_qemu = bus/pci.c;
+   i386_qemu = kern/i386/qemu/init.c;
+   i386_qemu = kern/i386/qemu/mmap.c;
+   i386_qemu = kern/i386/tsc.c;
+   i386_coreboot = kern/i386/coreboot/mmap.c;
+   i386_coreboot = kern/i386/tsc.c;
+   i386_multiboot = kern/i386/multiboot_mmap.c;
+   i386_multiboot = kern/i386/tsc.c;
+   i386_ieee1275 = kern/ieee1275/init.c;
+   mips_yeeloong = term/ns8250.c;
+   mips_yeeloong = bus/bonito.c;
+   mips_yeeloong = bus/cs5536.c;
+   mips_yeeloong = bus/pci.c;
+   mips_yeeloong = kern/mips/cache.S;
+   mips_yeeloong = kern/mips/dl.c;
+   mips_yeeloong = kern/mips/init.c;
+   mips_yeeloong = kern/mips/yeeloong/init.c;
+   mips_yeeloong = term/at_keyboard.c;
+   mips_yeeloong = term/serial.c;
+   mips_yeeloong = video/sm712.c;
+   powerpc_ieee1275 = kern/ieee1275/init.c;
+   powerpc_ieee1275 = kern/powerpc/cache.S;
+   powerpc_ieee1275 = kern/powerpc/dl.c;
+   sparc64_ieee1275 = kern/sparc64/cache.S;
+   sparc64_ieee1275 = kern/sparc64/dl.c;
+   sparc64_ieee1275 = kern/sparc64/ieee1275/ieee1275.c;
+   sparc64_ieee1275 = kern/sparc64/ieee1275/init.c;
+   emu = disk/host.c;
+   emu = gnulib/progname.c;
+   emu = kern/emu/console.c;
+   emu = kern/emu/getroot.c;
+   emu = kern/emu/hostdisk.c;
+   emu = kern/emu/hostfs.c;
+   emu = kern/emu/main.c;
+   emu = kern/emu/misc.c;
+   emu = kern/emu/mm.c;
+   emu = kern/emu/time.c;
+   videoinkernel = lib/arg.c;
+   videoinkernel = term/gfxterm.c;
+   videoinkernel = commands/extcmd.c;
+   videoinkernel = font/font.c;
+   videoinkernel = font/font_cmd.c;
+   videoinkernel = io/bufio.c;
+   videoinkernel = video/bitmap.c;
+   videoinkernel = video/bitmap_scale.c;
+   videoinkernel = video/fb/fbblit.c;
+   videoinkernel = video/fb/fbfill.c;
+   videoinkernel = video/fb/fbutil.c;
+   videoinkernel = video/fb/video_fb.c;
+   videoinkernel = video/video.c;
+   extra_dist = kern/i386/realmode.S;
+   extra_dist = kern/i386/pc/lzma_decode.S;
+   extra_dist = kern/mips/cache_flush.S;
+ };
+ program = {
+   name = grub-emu;
+   mansection = 1;
+   emu = kern/emu/full.c;
+   emu_nodist = grub_emu_init.c;
+   ldadd = 'kernel.img$(EXEEXT)';
+   ldadd = '$(MODULE_FILES)';
+   ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)';
+   enable = emu;
+ };
+ program = {
+   name = grub-emu-lite;
+   emu = kern/emu/lite.c;
+   emu = kern/emu/cache.S;
+   emu_nodist = symlist.c;
+   ldadd = 'kernel.img$(EXEEXT)';
+   ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)';
+   enable = emu;
+ };
+ image = {
+   name = boot;
+   i386_pc = boot/i386/pc/boot.S;
+   i386_qemu = boot/i386/qemu/boot.S;
+   sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S;
+   i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
+   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
+   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_objcopyflags = '-O a.out-sunos-big';
+   sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+   objcopyflags = '-O binary';
+   enable = i386_pc;
+   enable = i386_qemu;
+   enable = sparc64_ieee1275;
+ };
+ image = {
+   name = cdboot;
+   i386_pc = boot/i386/pc/cdboot.S;
+   i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
+   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
+   objcopyflags = '-O binary';
+   enable = i386_pc;
+ };
+ image = {
+   name = pxeboot;
+   i386_pc = boot/i386/pc/pxeboot.S;
+   i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
+   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
+   objcopyflags = '-O binary';
+   enable = i386_pc;
+ };
+ 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';
+   objcopyflags = '-O binary';
+   enable = i386_pc;
+   enable = sparc64_ieee1275;
+ };
+ image = {
+   name = lnxboot;
+   i386_pc = boot/i386/pc/lnxboot.S;
+   i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
+   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x6000';
+   objcopyflags = '-O binary';
+   enable = i386_pc;
+ };
+ image = {
+   name = fwstart;
+   mips_yeeloong = boot/mips/yeeloong/fwstart.S;
+   objcopyflags = '-O binary';
+   enable = mips_yeeloong;
+ };
+ module = {
+   name = trig;
+   common_nodist = trigtables.c;
+   extra_dist = gentrigtables.c;
+ };
+ module = {
+   name = cs5536;
+   x86 = bus/cs5536.c;
+   enable = x86;
+ };
+ module = {
+   name = libusb;
+   emu = bus/usb/emu/usb.c;
+   enable = emu;
+   condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = lsspd;
+   mips_yeeloong = commands/mips/yeeloong/lsspd.c;
+   enable = mips_yeeloong;
+ };
+ module = {
+   name = usb;
+   common = bus/usb/usb.c;
+   noemu = bus/usb/usbtrans.c;
+   noemu = bus/usb/usbhub.c;
+   enable = emu;
+   enable = usb;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = usbserial_common;
+   common = bus/usb/serial/common.c;
+   enable = emu;
+   enable = usb;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = usbserial_pl2303;
+   common = bus/usb/serial/pl2303.c;
+   enable = emu;
+   enable = usb;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = usbserial_ftdi;
+   common = bus/usb/serial/ftdi.c;
+   enable = emu;
+   enable = usb;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = uhci;
+   common = bus/usb/uhci.c;
+   enable = x86;
+ };
+ module = {
+   name = ohci;
+   common = bus/usb/ohci.c;
+   enable = pci;
+ };
+ module = {
+   name = pci;
+   noemu = bus/pci.c;
+   emu = bus/emu/pci.c;
+   emu = commands/lspci.c;
+   enable = emu;
+   enable = i386_pc;
 -  x86_efi = commands/efi/acpi.c;
++  enable = i386_efi;
++  enable = x86_64_efi;
+   enable = i386_ieee1275;
+   enable = i386_coreboot;
+   enable = i386_multiboot;
+   emu_condition = COND_GRUB_EMU_PCI;
+ };
+ library = {
+   name = libgnulib.a;
+   common = 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)';
+ };
+ module = {
+   name = cmostest;
+   common = commands/i386/cmostest.c;
+   enable = cmos;
+ };
+ module = {
+   name = iorw;
+   common = commands/iorw.c;
+   enable = x86;
+ };
+ module = {
+   name = regexp;
+   common = commands/regexp.c;
+   ldadd = libgnulib.a;
+   cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
+   cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)';
+ };
+ module = {
+   name = acpi;
+   x86 = commands/acpi.c;
 -  enable = x86_efi;
++  efi = commands/efi/acpi.c;
+   i386_pc = commands/i386/pc/acpi.c;
+   i386_coreboot = commands/i386/pc/acpi.c;
+   i386_multiboot = commands/i386/pc/acpi.c;
 -  x86_efi = commands/efi/fixvideo.c;
 -  enable = x86_efi;
++  enable = efi;
+   enable = i386_pc;
+   enable = i386_coreboot;
+   enable = i386_multiboot;
+ };
+ module = {
+   name = blocklist;
+   common = commands/blocklist.c;
+ };
+ module = {
+   name = boot;
+   common = commands/boot.c;
+   i386_pc = lib/i386/pc/biosnum.c;
+ };
+ module = {
+   name = cat;
+   common = commands/cat.c;
+ };
+ module = {
+   name = cmp;
+   common = commands/cmp.c;
+ };
+ module = {
+   name = configfile;
+   common = commands/configfile.c;
+ };
+ module = {
+   name = cpuid;
+   x86 = commands/i386/cpuid.c;
+   enable = x86;
+ };
+ module = {
+   name = crc;
+   common = commands/crc.c;
+   common = lib/crc.c;
+ };
+ module = {
+   name = date;
+   common = commands/date.c;
+ };
+ module = {
+   name = drivemap;
+   i386_pc = commands/i386/pc/drivemap.c;
+   i386_pc = commands/i386/pc/drivemap_int13h.S;
+   enable = i386_pc;
+ };
+ module = {
+   name = echo;
+   common = commands/echo.c;
+ };
+ module = {
+   name = extcmd;
+   common = commands/extcmd.c;
+   common = lib/arg.c;
+ };
+ module = {
+   name = fixvideo;
 -  x86_efi = lib/efi/halt.c;
++  common = commands/efi/fixvideo.c;
++  enable = i386_efi;
++  enable = x86_64_efi;
+ };
+ module = {
+   name = gptsync;
+   common = commands/gptsync.c;
+ };
+ module = {
+   name = halt;
+   nopc = commands/halt.c;
+   i386_pc = commands/i386/pc/halt.c;
+   i386_multiboot = lib/i386/halt.c;
+   i386_coreboot = lib/i386/halt.c;
+   i386_qemu = lib/i386/halt.c;
 -  x86_efi = commands/efi/loadbios.c;
 -  enable = x86_efi;
++  efi = lib/efi/halt.c;
+   ieee1275 = lib/ieee1275/halt.c;
+   emu = lib/emu/halt.c;
+ };
+ module = {
+   name = hashsum;
+   common = commands/hashsum.c;
+ };
+ module = {
+   name = hdparm;
+   common = commands/hdparm.c;
+   common = lib/hexdump.c;
+   enable = pci;
+ };
+ module = {
+   name = help;
+   common = commands/help.c;
+ };
+ module = {
+   name = hexdump;
+   common = commands/hexdump.c;
+   common = lib/hexdump.c;
+ };
+ module = {
+   name = keystatus;
+   common = commands/keystatus.c;
+ };
+ module = {
+   name = loadbios;
 -  x86_efi = lib/efi/relocator.c;
++  common = commands/efi/loadbios.c;
++  enable = i386_efi;
++  enable = x86_64_efi;
+ };
+ module = {
+   name = loadenv;
+   common = commands/loadenv.c;
+   common = lib/envblk.c;
+ };
+ module = {
+   name = ls;
+   common = commands/ls.c;
+ };
+ module = {
+   name = lsmmap;
+   common = commands/lsmmap.c;
+ };
+ module = {
+   name = lspci;
+   common = commands/lspci.c;
+   enable = pci;
+ };
+ module = {
+   name = memrw;
+   common = commands/memrw.c;
+ };
+ module = {
+   name = minicmd;
+   common = commands/minicmd.c;
+ };
+ module = {
+   name = parttool;
+   common = commands/parttool.c;
+ };
+ module = {
+   name = password;
+   common = commands/password.c;
+ };
+ module = {
+   name = password_pbkdf2;
+   common = commands/password_pbkdf2.c;
+ };
+ module = {
+   name = play;
+   x86 = commands/i386/pc/play.c;
+   enable = x86;
+ };
+ module = {
+   name = probe;
+   common = commands/probe.c;
+ };
+ module = {
+   name = pxecmd;
+   i386_pc = commands/i386/pc/pxecmd.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = read;
+   common = commands/read.c;
+ };
+ module = {
+   name = reboot;
+   common = commands/reboot.c;
+ };
+ module = {
+   name = search;
+   common = commands/search_wrap.c;
+   extra_dist = commands/search.c;
+ };
+ module = {
+   name = search_fs_file;
+   common = commands/search_file.c;
+ };
+ module = {
+   name = search_fs_uuid;
+   common = commands/search_uuid.c;
+ };
+ module = {
+   name = search_label;
+   common = commands/search_label.c;
+ };
+ module = {
+   name = setpci;
+   common = commands/setpci.c;
+   enable = x86;
+ };
+ module = {
+   name = sleep;
+   common = commands/sleep.c;
+ };
+ module = {
+   name = suspend;
+   ieee1275 = commands/ieee1275/suspend.c;
+   enable = i386_ieee1275;
+   enable = powerpc_ieee1275;
+ };
+ module = {
+   name = terminal;
+   common = commands/terminal.c;
+ };
+ module = {
+   name = test;
+   common = commands/test.c;
+ };
+ module = {
+   name = true;
+   common = commands/true.c;
+ };
+ module = {
+   name = usbtest;
+   common = commands/usbtest.c;
+   enable = usb;
+   enable = emu;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = vbeinfo;
+   i386_pc = commands/i386/pc/vbeinfo.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = vbetest;
+   i386_pc = commands/i386/pc/vbetest.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = videotest;
+   common = commands/videotest.c;
+ };
+ module = {
+   name = xnu_uuid;
+   common = commands/xnu_uuid.c;
+ };
+ module = {
+   name = dm_nv;
+   common = disk/dmraid_nvidia.c;
+ };
+ module = {
+   name = loopback;
+   common = disk/loopback.c;
+ };
+ module = {
+   name = lvm;
+   common = disk/lvm.c;
+ };
+ module = {
+   name = mdraid;
+   common = disk/mdraid_linux.c;
+ };
+ module = {
+   name = raid;
+   common = disk/raid.c;
+ };
+ module = {
+   name = raid5rec;
+   common = disk/raid5_recover.c;
+ };
+ module = {
+   name = raid6rec;
+   common = disk/raid6_recover.c;
+ };
+ module = {
+   name = scsi;
+   common = disk/scsi.c;
+ };
+ module = {
+   name = memdisk;
+   common = disk/memdisk.c;
+ };
+ module = {
+   name = ata;
+   common = disk/ata.c;
+   enable = pci;
+ };
+ module = {
+   name = ata_pthru;
+   common = disk/ata_pthru.c;
+   enable = pci;
+ };
+ module = {
+   name = biosdisk;
+   i386_pc = disk/i386/pc/biosdisk.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = usbms;
+   common = disk/usbms.c;
+   enable = usb;
+   enable = emu;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = nand;
+   ieee1275 = disk/ieee1275/nand.c;
+   enable = i386_ieee1275;
+ };
+ module = {
+   name = efiemu;
+   common = efiemu/main.c;
+   common = efiemu/i386/loadcore32.c;
+   common = efiemu/i386/loadcore64.c;
+   i386_pc = efiemu/i386/pc/cfgtables.c;
+   i386_coreboot = efiemu/i386/pc/cfgtables.c;
+   i386_multiboot = efiemu/i386/pc/cfgtables.c;
+   i386_ieee1275 = efiemu/i386/nocfgtables.c;
+   i386_qemu = efiemu/i386/nocfgtables.c;
+   common = efiemu/mm.c;
+   common = efiemu/loadcore_common.c;
+   common = efiemu/symbols.c;
+   common = efiemu/loadcore32.c;
+   common = efiemu/loadcore64.c;
+   common = efiemu/prepare32.c;
+   common = efiemu/prepare64.c;
+   common = efiemu/pnvram.c;
+   common = 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;
+   enable = i386_pc;
+   enable = i386_coreboot;
+   enable = i386_ieee1275;
+   enable = i386_multiboot;
+   enable = i386_qemu;
+ };
+ module = {
+   name = font;
+   common = font/font.c;
+   common = font/font_cmd.c;
+   enable = videomodules;
+ };
+ module = {
+   name = affs;
+   common = fs/affs.c;
+ };
+ module = {
+   name = afs;
+   common = fs/afs.c;
+ };
+ module = {
+   name = afs_be;
+   common = fs/afs_be.c;
+ };
+ module = {
+   name = befs;
+   common = fs/befs.c;
+ };
+ module = {
+   name = befs_be;
+   common = fs/befs_be.c;
+ };
+ module = {
+   name = cpio;
+   common = fs/cpio.c;
+ };
+ module = {
+   name = ext2;
+   common = fs/ext2.c;
+ };
+ module = {
+   name = fat;
+   common = fs/fat.c;
+ };
+ module = {
+   name = fshelp;
+   common = fs/fshelp.c;
+ };
+ module = {
+   name = hfs;
+   common = fs/hfs.c;
+ };
+ module = {
+   name = hfsplus;
+   common = fs/hfsplus.c;
+ };
+ module = {
+   name = iso9660;
+   common = fs/iso9660.c;
+ };
+ module = {
+   name = jfs;
+   common = fs/jfs.c;
+ };
+ module = {
+   name = minix;
+   common = fs/minix.c;
+ };
+ module = {
+   name = nilfs2;
+   common = fs/nilfs2.c;
+ };
+ module = {
+   name = ntfs;
+   common = fs/ntfs.c;
+ };
+ module = {
+   name = ntfscomp;
+   common = fs/ntfscomp.c;
+ };
+ module = {
+   name = reiserfs;
+   common = fs/reiserfs.c;
+ };
+ module = {
+   name = sfs;
+   common = fs/sfs.c;
+ };
+ module = {
+   name = tar;
+   common = fs/tar.c;
+ };
+ module = {
+   name = udf;
+   common = fs/udf.c;
+ };
+ module = {
+   name = ufs1;
+   common = fs/ufs.c;
+ };
+ module = {
+   name = ufs2;
+   common = fs/ufs2.c;
+ };
+ module = {
+   name = xfs;
+   common = fs/xfs.c;
+ };
+ module = {
+   name = pxe;
+   i386_pc = fs/i386/pc/pxe.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = gettext;
+   common = gettext/gettext.c;
+ };
+ module = {
+   name = gfxmenu;
+   common = gfxmenu/gfxmenu.c;
+   common = gfxmenu/model.c;
+   common = gfxmenu/view.c;
+   common = gfxmenu/font.c;
+   common = gfxmenu/icon_manager.c;
+   common = gfxmenu/theme_loader.c;
+   common = gfxmenu/widget-box.c;
+   common = gfxmenu/gui_canvas.c;
+   common = gfxmenu/gui_circular_progress.c;
+   common = gfxmenu/gui_box.c;
+   common = gfxmenu/gui_label.c;
+   common = gfxmenu/gui_list.c;
+   common = gfxmenu/gui_image.c;
+   common = gfxmenu/gui_progress_bar.c;
+   common = gfxmenu/gui_util.c;
+   common = gfxmenu/gui_string_util.c;
+   common = gfxmenu/named_colors.c;
+ };
+ module = {
+   name = hello;
+   common = hello/hello.c;
+ };
+ module = {
+   name = gzio;
+   common = io/gzio.c;
+ };
+ module = {
+   name = bufio;
+   common = io/bufio.c;
+   enable = videomodules;
+ };
+ module = {
+   name = elf;
+   common = kern/elf.c;
+ };
+ module = {
+   name = crypto;
+   common = lib/crypto.c;
+   extra_dist = lib/libgcrypt-grub/cipher/crypto.lst;
+ };
+ module = {
+   name = pbkdf2;
+   common = lib/pbkdf2.c;
+ };
+ module = {
+   name = relocator;
+   common = lib/relocator.c;
+   x86 = lib/i386/relocator16.S;
+   x86 = lib/i386/relocator32.S;
+   x86 = lib/i386/relocator64.S;
+   i386 = lib/i386/relocator_asm.S;
+   x86_64 = lib/x86_64/relocator_asm.S;
+   x86 = lib/i386/relocator.c;
+   ieee1275 = lib/ieee1275/relocator.c;
 -  x86_efi = lib/efi/datetime.c;
++  efi = lib/efi/relocator.c;
+   mips = lib/mips/relocator_asm.S;
+   mips = lib/mips/relocator.c;
+   powerpc = lib/powerpc/relocator_asm.S;
+   powerpc = lib/powerpc/relocator.c;
+   enable = mips;
+   enable = powerpc;
+   enable = x86;
+ };
+ module = {
+   name = datetime;
+   cmos = lib/cmos_datetime.c;
 -  x86_efi = loader/efi/appleloader.c;
 -  enable = x86_efi;
++  efi = lib/efi/datetime.c;
+   sparc64_ieee1275 = lib/ieee1275/datetime.c;
+   powerpc_ieee1275 = lib/ieee1275/datetime.c;
+   enable = noemu;
+ };
+ module = {
+   name = setjmp;
+   common = lib/setjmp.S;
+   extra_dist = lib/i386/setjmp.S;
+   extra_dist = lib/mips/setjmp.S;
+   extra_dist = lib/x86_64/setjmp.S;
+   extra_dist = lib/sparc64/setjmp.S;
+   extra_dist = lib/powerpc/setjmp.S;
+ };
+ module = {
+   name = aout;
+   common = loader/aout.c;
+   enable = x86;
+ };
+ module = {
+   name = bsd;
+   x86 = loader/i386/bsd.c;
+   x86 = loader/i386/bsd32.c;
+   x86 = loader/i386/bsd64.c;
+   extra_dist = loader/i386/bsdXX.c;
+   extra_dist = loader/i386/bsd_pagetable.c;
+   enable = x86;
+ };
+ module = {
+   name = linux16;
+   i386_pc = loader/i386/pc/linux.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = ntldr;
+   i386_pc = loader/i386/pc/ntldr.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = multiboot2;
+   cppflags = "-DGRUB_USE_MULTIBOOT2";
+   common = loader/multiboot.c;
+   common = loader/multiboot_mbi2.c;
+   enable = x86;
+   enable = mips;
+ };
+ module = {
+   name = multiboot;
+   common = loader/multiboot.c;
+   x86 = loader/i386/multiboot_mbi.c;
+   extra_dist = loader/multiboot_elfxx.c;
+   enable = x86;
+ };
+ module = {
+   name = linux;
+   x86 = loader/i386/linux.c;
+   mips = loader/mips/linux.c;
+   powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
+   sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
++  ia64_efi = loader/ia64/efi/linux.c;
+   enable = noemu;
+ };
+ module = {
+   name = xnu;
+   x86 = loader/xnu_resume.c;
+   x86 = loader/i386/xnu.c;
+   x86 = loader/macho32.c;
+   x86 = loader/macho64.c;
+   x86 = loader/macho.c;
+   x86 = loader/xnu.c;
+   extra_dist = loader/machoXX.c;
+   enable = x86;
+ };
+ module = {
+   name = appleldr;
 -  x86_efi = loader/efi/chainloader.c;
++  common = loader/efi/appleloader.c;
++  enable = i386_efi;
++  enable = x86_64_efi;
+ };
+ module = {
+   name = chain;
 -  enable = x86_efi;
++  efi = loader/efi/chainloader.c;
+   i386_pc = loader/i386/pc/chainloader.c;
+   enable = i386_pc;
 -  x86_efi = mmap/efi/mmap.c;
++  enable = efi;
+ };
+ module = {
+   name = mmap;
+   common = mmap/mmap.c;
+   x86 = mmap/i386/uppermem.c;
+   x86 = mmap/i386/mmap.c;
+   i386_pc = mmap/i386/pc/mmap.c;
+   i386_pc = mmap/i386/pc/mmap_helper.S;
 -  x86_efi = video/efi_gop.c;
 -  enable = x86_efi;
++  efi = mmap/efi/mmap.c;
+   mips_yeeloong = mmap/mips/yeeloong/uppermem.c;
+   enable = x86;
+   enable = mips_yeeloong;
+ };
+ module = {
+   name = normal;
+   common = normal/main.c;
+   common = normal/cmdline.c;
+   common = normal/dyncmd.c;
+   common = normal/auth.c;
+   common = normal/autofs.c;
+   common = normal/color.c;
+   common = normal/completion.c;
+   common = normal/datetime.c;
+   common = normal/menu.c;
+   common = normal/menu_entry.c;
+   common = normal/menu_text.c;
+   common = normal/misc.c;
+   common = normal/crypto.c;
+   common = normal/term.c;
+   common = normal/context.c;
+   common = normal/charset.c;
+   common = script/main.c;
+   common = script/script.c;
+   common = script/execute.c;
+   common = script/function.c;
+   common = script/lexer.c;
+   common = script/argv.c;
+   common = unidata.c;
+   common_nodist = grub_script.tab.c;
+   common_nodist = grub_script.yy.c;
+   common_nodist = grub_script.tab.h;
+   common_nodist = grub_script.yy.h;
+   extra_dist = script/yylex.l;
+   extra_dist = script/parser.y;
+   cflags = '$(CFLAGS_POSIX) -Wno-error';
+   cppflags = '$(CPPFLAGS_POSIX)';
+ };
+ module = {
+   name = part_acorn;
+   common = partmap/acorn.c;
+ };
+ module = {
+   name = part_amiga;
+   common = partmap/amiga.c;
+ };
+ module = {
+   name = part_apple;
+   common = partmap/apple.c;
+ };
+ module = {
+   name = part_gpt;
+   common = partmap/gpt.c;
+ };
+ module = {
+   name = part_msdos;
+   common = partmap/msdos.c;
+ };
+ module = {
+   name = part_sun;
+   common = partmap/sun.c;
+ };
+ module = {
+   name = part_bsd;
+   common = partmap/bsdlabel.c;
+ };
+ module = {
+   name = part_sunpc;
+   common = partmap/sunpc.c;
+ };
+ module = {
+   name = msdospart;
+   common = parttool/msdospart.c;
+ };
+ module = {
+   name = at_keyboard;
+   common = term/at_keyboard.c;
+   enable = x86;
+ };
+ module = {
+   name = gfxterm;
+   common = term/gfxterm.c;
+   enable = videomodules;
+ };
+ module = {
+   name = serial;
+   common = term/serial.c;
+   x86 = term/ns8250.c;
+   enable = emu;
+   enable = i386;
+   enable = x86_64_efi;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = sendkey;
+   i386_pc = commands/i386/pc/sendkey.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = terminfo;
+   common = term/terminfo.c;
+   common = term/tparm.c;
+ };
+ module = {
+   name = usb_keyboard;
+   common = term/usb_keyboard.c;
+   enable = usb;
+ };
+ module = {
+   name = vga;
+   i386_pc = video/i386/pc/vga.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = vga_text;
+   common = term/i386/pc/vga_text.c;
+   common = term/i386/vga_common.c;
+   enable = i386_pc;
+   enable = i386_coreboot;
+   enable = i386_multiboot;
+ };
+ module = {
+   name = video_cirrus;
+   x86 = video/cirrus.c;
+   enable = x86;
+ };
+ module = {
+   name = video_bochs;
+   x86 = video/bochs.c;
+   enable = x86;
+ };
+ module = {
+   name = functional_test;
+   common = tests/lib/functional_test.c;
+   common = tests/lib/test.c;
+ };
+ module = {
+   name = example_functional_test;
+   common = tests/example_functional_test.c;
+   cflags = -Wno-format;
+ };
+ module = {
+   name = bitmap;
+   common = video/bitmap.c;
+   enable = videomodules;
+ };
+ module = {
+   name = bitmap_scale;
+   common = video/bitmap_scale.c;
+   enable = videomodules;
+ };
+ module = {
+   name = efi_gop;
 -  x86_efi = video/efi_uga.c;
 -  enable = x86_efi;
++  efi = video/efi_gop.c;
++  enable = efi;
+ };
+ module = {
+   name = efi_uga;
++  efi = video/efi_uga.c;
++  enable = efi;
+ };
+ module = {
+   name = jpeg;
+   common = video/readers/jpeg.c;
+ };
+ module = {
+   name = png;
+   common = video/readers/png.c;
+ };
+ module = {
+   name = tga;
+   common = video/readers/tga.c;
+ };
+ module = {
+   name = vbe;
+   i386_pc = video/i386/pc/vbe.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = video_fb;
+   common = video/fb/video_fb.c;
+   common = video/fb/fbblit.c;
+   common = video/fb/fbfill.c;
+   common = video/fb/fbutil.c;
+   enable = videomodules;
+ };
+ module = {
+   name = video;
+   common = video/video.c;
+   enable = videomodules;
+ };
+ module = {
+   name = ieee1275_fb;
+   ieee1275 = video/ieee1275.c;
+   enable = powerpc;
+   enable = sparc64;
+ };
+ module = {
+   name = sdl;
+   emu = video/emu/sdl.c;
+   enable = emu;
+   condition = COND_GRUB_EMU_SDL;
+ };
+ module = {
+   name = datehook;
+   common = hook/datehook.c;
+ };
++
++module = {
++  name = memmap;
++  common = commands/efi/memmap.c;
++  enable = ia64_efi;
++};
++
++module = {
++  name = systab;
++  common = commands/efi/systab.c;
++  enable = ia64_efi;
++};
++
++module = {
++  name = acpi2;
++  common = commands/efi/acpi2.c;
++  enable = ia64_efi;
++};
index e65fa07023e23e066fbda3955508b78d85c483a6,0000000000000000000000000000000000000000..e65fa07023e23e066fbda3955508b78d85c483a6
mode 100644,000000..100644
--- /dev/null
index d49e020807012cfdf8b96b1e8cc3d0d63f6cff56,0000000000000000000000000000000000000000..d49e020807012cfdf8b96b1e8cc3d0d63f6cff56
mode 100644,000000..100644
--- /dev/null
index 27a2cde833ec7fd889f93358b34a071e34acc7aa,0000000000000000000000000000000000000000..27a2cde833ec7fd889f93358b34a071e34acc7aa
mode 100644,000000..100644
--- /dev/null
index f9270972bb65a8a66971e23914a1f79023990f34,0000000000000000000000000000000000000000..f9270972bb65a8a66971e23914a1f79023990f34
mode 100644,000000..100644
--- /dev/null
index 5a492dc2f995c7f3dae6a1d7094abf6842fbe81f,0000000000000000000000000000000000000000..5a492dc2f995c7f3dae6a1d7094abf6842fbe81f
mode 100644,000000..100644
--- /dev/null
Simple merge
index 2bf85313cfa1d8b393807fbb677dc3453c91593e,0000000000000000000000000000000000000000..2bf85313cfa1d8b393807fbb677dc3453c91593e
mode 100644,000000..100644
--- /dev/null
index 7658ee1a7bb866ebedf6955cfb1a387d0c19a936,0000000000000000000000000000000000000000..7658ee1a7bb866ebedf6955cfb1a387d0c19a936
mode 100644,000000..100644
--- /dev/null
index ed57c43ca36ab3f1764d3b0b8f18d41d5ff6cad9,0000000000000000000000000000000000000000..ed57c43ca36ab3f1764d3b0b8f18d41d5ff6cad9
mode 100644,000000..100644
--- /dev/null
index 7d57df9b9541f4d9a77beba52b30dd63c30c8c43,0000000000000000000000000000000000000000..7d57df9b9541f4d9a77beba52b30dd63c30c8c43
mode 100644,000000..100644
--- /dev/null
index b6889d4afb3d22ca3b0ec0d0e1c3b2ade7b5d2aa,0000000000000000000000000000000000000000..b6889d4afb3d22ca3b0ec0d0e1c3b2ade7b5d2aa
mode 100644,000000..100644
--- /dev/null
index c85ef6c42003a92ddaf841345890050136c5d99b,0000000000000000000000000000000000000000..06d5f509508227c6d5c5c03517a18fea0bb45494
mode 100644,000000..100644
--- /dev/null
@@@ -1,59 -1,0 +1,60 @@@
 +/* init.c - initialize an ia64-based EFI system */
 +/*
 + *  GRUB  --  GRand Unified Bootloader
 + *  Copyright (C) 2008  Free Software Foundation, Inc.
 + *
 + *  GRUB is free software: you can redistribute it and/or modify
 + *  it under the terms of the GNU General Public License as published by
 + *  the Free Software Foundation, either version 3 of the License, or
 + *  (at your option) any later version.
 + *
 + *  GRUB is distributed in the hope that it will be useful,
 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + *  GNU General Public License for more details.
 + *
 + *  You should have received a copy of the GNU General Public License
 + *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 + */
 +
 +#include <grub/types.h>
 +#include <grub/misc.h>
 +#include <grub/mm.h>
 +#include <grub/err.h>
 +#include <grub/dl.h>
 +#include <grub/cache.h>
 +#include <grub/kernel.h>
 +#include <grub/efi/efi.h>
++#include <grub/machine/misc.h>
 +
 +void
 +grub_machine_init (void)
 +{
 +  grub_efi_init ();
 +  grub_init_modules ();
 +}
 +
 +void
 +grub_machine_fini (void)
 +{
 +  grub_efi_fini ();
 +}
 +
 +void
 +grub_machine_set_prefix (void)
 +{
 +  grub_efi_set_prefix ();
 +}
 +
 +void
 +grub_arch_sync_caches (void *address, grub_size_t len)
 +{
 +  /* Cache line length is at least 32.  */
 +  grub_uint64_t a = (grub_uint64_t)address & ~0x1f;
 +
 +  /* Flush data.  */
 +  for (len = (len + 31) & ~0x1f; len > 0; len -= 0x20, a += 0x20)
 +    asm volatile ("fc.i %0" : : "r" (a));
 +  /* Sync and serialize.  Maybe extra.  */
 +  asm volatile (";; sync.i;; srlz.i;;");
 +}
index 9ba6858d9e075f871a0ebe4a17fd66e47146854c,0000000000000000000000000000000000000000..9ba6858d9e075f871a0ebe4a17fd66e47146854c
mode 100644,000000..100644
--- /dev/null
index e91991041fdeb2ac930356e75522eb65014c3eab,0000000000000000000000000000000000000000..e91991041fdeb2ac930356e75522eb65014c3eab
mode 100644,000000..100644
--- /dev/null
Simple merge
Simple merge
index 729bdc76e5032a2b3c781c792dca3bc7ae4bdea4,0000000000000000000000000000000000000000..729bdc76e5032a2b3c781c792dca3bc7ae4bdea4
mode 100644,000000..100644
--- /dev/null
index 0851885c53a4ba1f0db136a2d2eb113ac7886f63,0000000000000000000000000000000000000000..0851885c53a4ba1f0db136a2d2eb113ac7886f63
mode 100644,000000..100644
--- /dev/null
index 25aee3a8051be06101e64ff611fab3ab3a99fdaf,0000000000000000000000000000000000000000..25aee3a8051be06101e64ff611fab3ab3a99fdaf
mode 100644,000000..100644
--- /dev/null
index a568fff4d25fbd292aac64b1d7aa48668d90021d,0000000000000000000000000000000000000000..a568fff4d25fbd292aac64b1d7aa48668d90021d
mode 100644,000000..100644
--- /dev/null
index 053c3ed22d9f2c562e91f276d40d97dc512b07bb,0000000000000000000000000000000000000000..053c3ed22d9f2c562e91f276d40d97dc512b07bb
mode 100644,000000..100644
--- /dev/null
index a7ede1960f84fed36c11c0f24bdbe9139e88ee1c,0000000000000000000000000000000000000000..a7ede1960f84fed36c11c0f24bdbe9139e88ee1c
mode 100644,000000..100644
--- /dev/null
index 8780804fd5048b4adfd44dcfdc9864d33197d6a0,0000000000000000000000000000000000000000..8780804fd5048b4adfd44dcfdc9864d33197d6a0
mode 100644,000000..100644
--- /dev/null
index 4acea7b1161a2cd415e976760f6815ef307f249a,0000000000000000000000000000000000000000..4acea7b1161a2cd415e976760f6815ef307f249a
mode 100644,000000..100644
--- /dev/null
index 839d0ad44d82f5ac9c43021856185fbb13dfc96e,0000000000000000000000000000000000000000..839d0ad44d82f5ac9c43021856185fbb13dfc96e
mode 100644,000000..100644
--- /dev/null
index 9020efd280422d73dea1e414deb6f5d3d90da7b7,0000000000000000000000000000000000000000..9020efd280422d73dea1e414deb6f5d3d90da7b7
mode 100644,000000..100644
--- /dev/null
index 6d042fa8198a235fa9138d666143c71efc0cd954,0000000000000000000000000000000000000000..6d042fa8198a235fa9138d666143c71efc0cd954
mode 100644,000000..100644
--- /dev/null
index b44dc7a68f11eee1041099c7a9ece25cc9bf5300,0000000000000000000000000000000000000000..b44dc7a68f11eee1041099c7a9ece25cc9bf5300
mode 100644,000000..100644
--- /dev/null
index 52694ed104027149c332bca14fe836542a29ab72,0000000000000000000000000000000000000000..52694ed104027149c332bca14fe836542a29ab72
mode 100644,000000..100644
--- /dev/null
index a45cf2f63579dd00e0b904c59dd8b0be2809705c,afc4af41aace8077e81a577b3b3f707553b36c3a..04577a00346e2ddb2fc35627792988307784805b
  #include <grub/types.h>
  #include <grub/elf.h>
  
+ /*
+  * Macros GRUB_MOD_INIT and GRUB_MOD_FINI are also used by build rules
+  * to collect module names, so we define them only when they are not
+  * defined already.
+  */
+ #ifndef GRUB_MOD_INIT
  #define GRUB_MOD_INIT(name)   \
  static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \
 -void grub_##name##_init (void); \
 +void grub_module_##name##_init (grub_dl_t); \
  void \
 -grub_##name##_init (void) { grub_mod_init (0); } \
 +grub_module_##name##_init (grub_dl_t mod) { grub_mod_init (mod); } \
  static void \
  grub_mod_init (grub_dl_t mod __attribute__ ((unused)))
+ #endif
  
+ #ifndef GRUB_MOD_FINI
  #define GRUB_MOD_FINI(name)   \
  static void grub_mod_fini (void) __attribute__ ((used)); \
 -void grub_##name##_fini (void); \
 +void grub_module_##name##_fini (void); \
  void \
 -grub_##name##_fini (void) { grub_mod_fini (); } \
 +grub_module_##name##_fini (void) { grub_mod_fini (); } \
  static void \
  grub_mod_fini (void)
+ #endif
  
  #ifdef APPLE_CC
  #define GRUB_MOD_NAME(name)   \
Simple merge