--- grub-2.00.orig/grub-core/Makefile.core.def	2012-06-26 04:13:58.000000000 +0200
+++ grub-2.00/grub-core/Makefile.core.def	2012-08-26 13:57:49.479067701 +0200
@@ -726,6 +726,11 @@
 };
 
 module = {
+  name = wipe_memory;
+  common = commands/wipe_memory.c;
+};
+
+module = {
   name = lspci;
   common = commands/lspci.c;
 
--- grub-2.00.orig/grub-core/commands/wipe_memory.c	1970-01-01 01:00:00.000000000 +0100
+++ grub-2.00/grub-core/commands/wipe_memory.c	2012-08-26 21:40:22.232087198 +0200
@@ -0,0 +1,390 @@
+/*
+ *  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/dl.h>
+#include <grub/misc.h>
+#include <grub/command.h>
+#include <grub/i18n.h>
+#include <grub/memory.h>
+#include <grub/i386/memory.h>
+#include <grub/mm.h>
+#include <grub/term.h>
+
+GRUB_MOD_LICENSE ("GPLv3+");
+
+#define LINE_SIZE 74
+#define PROGRESS_SIZE (LINE_SIZE - 7)
+
+#if 1
+# define DEBUG_WIPE(...)
+#else
+# define DEBUG_WIPE(...) \
+        { \
+          char __debug_wipe_s[LINE_SIZE + 2]; \
+          grub_snprintf (__debug_wipe_s, LINE_SIZE + 2, __VA_ARGS__); \
+          grub_printf ("%-" LINE_SIZE "s\n", __debug_wipe_s); \
+          grub_refresh (); \
+        }
+#endif
+
+#define PROGRESS_FREQUENCY (4 * 1024 * 1024) /* 4 MB */
+#define ZERO_PATTERN 0
+
+static grub_uint64_t total_mem_size = 0;  /* set by grub_lookup_available_memory */
+static grub_uint64_t total_mem_wiped = 0; /* incremented by grub_dec_len */
+
+static void
+grub_show_progress (void)
+{
+  unsigned short i;
+
+  grub_printf ("[");
+  for (i = 0; i < grub_divmod64(PROGRESS_SIZE * total_mem_wiped, total_mem_size, NULL); i++)
+    grub_printf ("+");
+  for (; i < PROGRESS_SIZE; i++)
+    grub_printf (" ");
+  grub_printf ("] %3" PRIuGRUB_UINT64_T "%s\r", grub_divmod64(100 * total_mem_wiped, total_mem_size, NULL), "%");
+  grub_refresh ();
+}
+
+static grub_size_t
+grub_dec_len (grub_size_t len, grub_size_t dec)
+{
+  total_mem_wiped += dec;
+  if (0 == (total_mem_wiped % PROGRESS_FREQUENCY))
+    {
+      grub_show_progress ();
+    }
+  return len - dec;
+}
+
+static grub_size_t
+grub_zero_area (void *s, grub_size_t length)
+{
+  grub_size_t len = length;
+
+  if (len >= 3 * sizeof (unsigned long))
+    {
+      while (len > 0 && (((grub_addr_t) s) & (sizeof (unsigned long) - 1)))
+	{
+	  *(grub_uint8_t *) s = ZERO_PATTERN;
+	  s = (grub_uint8_t *) s + 1;
+	  len = grub_dec_len(len, 1);
+	}
+      while (len >= sizeof (unsigned long))
+	{
+	  *(unsigned long *) s = ZERO_PATTERN;
+	  s = (unsigned long *) s + 1;
+	  len = grub_dec_len(len, sizeof (unsigned long));
+	}
+    }
+
+  while (len > 0)
+    {
+      *(grub_uint8_t *) s = ZERO_PATTERN;
+      s = (grub_uint8_t *) s + 1;
+      len = grub_dec_len(len, 1);
+    }
+
+  return length;
+}
+
+#define LOWER_MEMORY_LIMIT 0xffffffff
+
+static grub_uint32_t
+grub_wipe_with_malloc (void)
+{
+  grub_size_t last_size = 0;
+  grub_size_t size = LOWER_MEMORY_LIMIT / 2;
+  void *buf = NULL;
+
+  while (1)
+    {
+      buf = grub_malloc (size);
+      if (NULL != buf)
+        {
+          if (last_size == size)
+            break;
+          grub_free (buf);
+          last_size = size;
+          size += size / 2;
+        }
+      else
+        {
+          /* Getting out of memory is expected. */
+          grub_errno = GRUB_ERR_NONE;
+
+          size -= (size - last_size) / 2 + 1;
+        }
+    }
+  grub_zero_area (buf, size);
+  if (last_size > 0x1000) /* Leave 4kB to allow progress display to work */
+    size += grub_wipe_with_malloc ();
+  grub_free (buf);
+
+  return size;
+}
+
+#define PG_V             0x001
+#define PG_RW            0x002
+#define PG_U             0x004
+#define PG_PS            0x080
+#define PG_G             0x200
+
+#define PDPT_SIZE        4
+#define PAGE_DIR_SIZE    512
+#define PAGE_SIZE        (2 * 1024 * 1024) /* 2 MB */
+
+#define CLEANUP_REGION_START 0x80000000 /* 2 GB */
+#define CLEANUP_REGION_SIZE (16 * PAGE_SIZE) /* 32 MB */
+#define CLEANUP_REGION_END  (CLEANUP_REGION_START + CLEANUP_REGION_SIZE - 1)
+
+#define GRUB_MEMORY_CPU_CR4_PGE_ON		0x00000080
+
+#define ENABLE_PAE \
+  asm volatile (" \
+      movl    %%cr4, %%eax; \
+      orl     %0, %%eax; \
+      movl    %%eax, %%cr4; \
+    " : : "i" (GRUB_MEMORY_CPU_CR4_PAE_ON | GRUB_MEMORY_CPU_CR4_PGE_ON) );
+
+#define DISABLE_PAE \
+  asm volatile (" \
+      movl    %%cr4, %%eax; \
+      andl    %0, %%eax; \
+      movl    %%eax, %%cr4; \
+    " : : "i" (~(GRUB_MEMORY_CPU_CR4_PAE_ON | GRUB_MEMORY_CPU_CR4_PGE_ON)) );
+
+#define ENABLE_PAGING \
+  asm volatile (" \
+      movl    %%cr0, %%eax; \
+      orl     %0, %%eax; \
+      movl    %%eax, %%cr0; \
+    " : : "i" (GRUB_MEMORY_CPU_CR0_PAGING_ON) );
+
+#define DISABLE_PAGING \
+  asm volatile (" \
+      movl    %%cr0, %%eax; \
+      andl    %0, %%eax; \
+      movl    %%eax, %%cr0; \
+    " : : "i" (~GRUB_MEMORY_CPU_CR0_PAGING_ON) );
+
+#define UPDATE_PAGE_DESCRIPTORS \
+  asm volatile (" \
+      movl    %%eax, %%cr3; \
+    " : : "a" (&page_dir_ptr_tab[0]));
+
+static grub_uint64_t page_dir_ptr_tab[PDPT_SIZE] __attribute__ ((aligned (0x20)));
+static grub_uint64_t page_dir[4 * PAGE_DIR_SIZE] __attribute__ ((aligned (0x1000)));
+static grub_uint64_t *page_dir_cleanup = &page_dir[CLEANUP_REGION_START / 512];
+
+static grub_err_t
+grub_map_cleanup (grub_uint64_t start)
+{
+  unsigned short i;
+
+  for (i = 0; i * PAGE_SIZE < CLEANUP_REGION_SIZE; i++)
+    {
+      page_dir_cleanup[i] = start + i * PAGE_SIZE;
+      page_dir_cleanup[i] |= PG_V | PG_RW | PG_U | PG_PS;
+      DEBUG_WIPE ("page_dir_cleanup[%u]: %08llx", i, page_dir_cleanup[i]);
+    }
+
+  return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+grub_init_page_directories (void)
+{
+  unsigned short i;
+
+  grub_memset (page_dir_ptr_tab, 0, PDPT_SIZE * sizeof (grub_uint64_t));
+
+  /* Map everything to the same physical location. */
+  for (i = 0; i < 4; i++)
+    {
+      page_dir_ptr_tab[i] = (grub_uint64_t) (grub_addr_t) &page_dir[i * PAGE_DIR_SIZE];
+      page_dir_ptr_tab[i] |= PG_V;
+    }
+  for (i = 0; i < 4 * PAGE_DIR_SIZE; i++)
+    {
+      page_dir[i] = i * PAGE_SIZE;
+      /* Set pages not used for cleanup as global. */
+      if (page_dir[i] >= CLEANUP_REGION_START && page_dir[i] <= CLEANUP_REGION_END)
+        page_dir[i] |= PG_G;
+      page_dir[i] |= PG_V | PG_RW | PG_U | PG_PS;
+    }
+
+  return GRUB_ERR_NONE;
+}
+
+struct region_s
+{
+  grub_uint64_t addr;
+  grub_uint64_t size;
+};
+
+#define MAX_REGIONS 16
+
+static grub_err_t
+grub_lookup_available_memory (struct region_s *regions)
+{
+  unsigned short i = 0;
+
+  auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_memory_type_t);
+  int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size,
+                             grub_memory_type_t type)
+    {
+      if (MAX_REGIONS == i)
+        return 0;
+
+      if (GRUB_MEMORY_AVAILABLE != type)
+        return 0;
+
+      total_mem_size += size;
+
+      /* Skip the lower regions */
+      if (addr < LOWER_MEMORY_LIMIT)
+        return 0;
+
+      regions[i].addr = addr;
+      regions[i].size = size;
+      i++;
+
+      return 0;
+    }
+  grub_machine_mmap_iterate (hook);
+
+  if (i >= MAX_REGIONS)
+    goto no_mem;
+
+  return GRUB_ERR_NONE;
+
+no_mem:
+  grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
+  return 0;
+}
+
+static grub_err_t
+grub_wipe_regions (struct region_s *regions)
+{
+  unsigned short i;
+  grub_uint64_t addr;
+  grub_uint64_t size;
+
+  for (i = 0; regions[i].size > 0 && i < MAX_REGIONS; i++)
+    {
+      addr = regions[i].addr;
+      size = regions[i].size;
+
+      DEBUG_WIPE ("zero'ing addr = 0x%" PRIxGRUB_UINT64_T ", length = 0x%" PRIxGRUB_UINT64_T,
+                   (grub_uint64_t) addr, (grub_uint64_t) size);
+
+      while (0 < size)
+        {
+          grub_map_cleanup (addr);
+          UPDATE_PAGE_DESCRIPTORS;
+
+          while (0 < size)
+            {
+              DEBUG_WIPE ("wipe 0x%016" PRIxGRUB_UINT64_T "; left to wipe: 0x%08" PRIxGRUB_UINT64_T,
+                          (grub_uint64_t) addr + regions[i].size - size, size);
+              size -= grub_zero_area ((void *) CLEANUP_REGION_START,
+                                      (size >= CLEANUP_REGION_SIZE) ? CLEANUP_REGION_SIZE : size);
+            }
+          addr += CLEANUP_REGION_SIZE;
+        }
+    }
+  /* Leave things as we found them. */
+  grub_map_cleanup (CLEANUP_REGION_START);
+  UPDATE_PAGE_DESCRIPTORS;
+
+  return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+grub_wipe_high_order (void)
+{
+  struct region_s regions[MAX_REGIONS];
+
+  DEBUG_WIPE ("wipe_high_order");
+
+  grub_memset (regions, 0, MAX_REGIONS * sizeof (struct region_s));
+  grub_lookup_available_memory (regions);
+  {
+    unsigned short i = 0;
+    for (i = 0; i < MAX_REGIONS; i++)
+      DEBUG_WIPE ("regions[%u] %016" PRIxGRUB_UINT64_T ", %016" PRIxGRUB_UINT64_T, i, regions[i].addr, regions[i].size);
+  }
+
+  if (0 == regions[0].size)
+    return GRUB_ERR_NONE;
+
+  DEBUG_WIPE ("Switching to PAE.");
+  grub_init_page_directories ();
+  DISABLE_PAGING;
+  ENABLE_PAE;
+  UPDATE_PAGE_DESCRIPTORS;
+  ENABLE_PAGING;
+  DEBUG_WIPE ("Paging enabled.");
+
+  grub_wipe_regions (regions);
+
+  DEBUG_WIPE ("High order wipe done. Disabling paging.");
+
+  DISABLE_PAGING;
+  DISABLE_PAE;
+
+  DEBUG_WIPE ("Paging disabled.");
+
+  return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+grub_cmd_wipe_memory (grub_command_t cmd __attribute__ ((unused)),
+                      int argc __attribute__ ((unused)),
+                      char **args __attribute__ ((unused)))
+
+{
+  grub_uint32_t size;
+
+  grub_wipe_high_order ();
+
+  size = grub_wipe_with_malloc ();
+  DEBUG_WIPE ("Low memory wipe: %" PRIuGRUB_UINT32_T " bytes.", size);
+
+  /* "Cheating!" */
+  total_mem_wiped = total_mem_size;
+  grub_show_progress ();
+  grub_printf ("\n");
+
+  return GRUB_ERR_NONE;
+}
+
+static grub_command_t cmd;
+
+GRUB_MOD_INIT(wipe_memory)
+{
+  cmd = grub_register_command ("wipe_memory", grub_cmd_wipe_memory,
+                               0, N_("Fill all available memory with zeros."));
+}
+
+GRUB_MOD_FINI(wipe_memory)
+{
+  grub_unregister_command (cmd);
+}
--- grub-2.00.orig/util/grub-mkstandalone.in	2012-04-05 19:54:27.000000000 +0200
+++ grub-2.00/util/grub-mkstandalone.in	2012-08-26 19:46:47.536685078 +0200
@@ -171,7 +171,7 @@
 memdisk_dir="`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
 mkdir -p "${memdisk_dir}"/boot/grub/"${grub_modinfo_target_cpu}-${grub_modinfo_platform}"
 
-for file in "${source_directory}/"*.mod "${source_directory}/"efiemu32.o "${source_directory}/"efiemu64.o; do
+for file in "${source_directory}/"efiemu32.o "${source_directory}/"efiemu64.o; do
     if test -f "$file"; then
         cp -f "$file" "${memdisk_dir}"/boot/grub/"${grub_modinfo_target_cpu}-${grub_modinfo_platform}"
     fi
