diff -urN -x '*~' -x '*.orig' -x '*.rej' -x autom4te.cache grub-0.97.orig/configure.ac grub-0.97.minix2/configure.ac
--- grub-0.97.orig/configure.ac	2005-05-08 04:36:03.000000000 +0200
+++ grub-0.97.minix2/configure.ac	2006-08-04 17:47:46.000000000 +0200
@@ -256,6 +256,13 @@
   FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_MINIX=1"
 fi
 
+AC_ARG_ENABLE(minix2,
+  [  --disable-minix2         disable Minix v2 fs support in Stage 2])
+
+if test x"$enable_minix2" != xno; then
+  FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_MINIX2=1"
+fi
+
 AC_ARG_ENABLE(reiserfs,
   [  --disable-reiserfs      disable ReiserFS support in Stage 2])
 
diff -urN -x '*~' -x '*.orig' -x '*.rej' -x autom4te.cache grub-0.97.orig/stage2/builtins.c grub-0.97.minix2/stage2/builtins.c
--- grub-0.97.orig/stage2/builtins.c	2005-02-15 22:58:23.000000000 +0100
+++ grub-0.97.minix2/stage2/builtins.c	2006-08-04 18:32:44.000000000 +0200
@@ -3879,6 +3879,7 @@
     {"iso9660",  "/iso9660_stage1_5"},
     {"jfs",      "/jfs_stage1_5"},
     {"minix",    "/minix_stage1_5"},
+    {"minix2",   "/minix2_stage1_5"},
     {"reiserfs", "/reiserfs_stage1_5"},
     {"vstafs",   "/vstafs_stage1_5"},
     {"xfs",      "/xfs_stage1_5"}
diff -urN -x '*~' -x '*.orig' -x '*.rej' -x autom4te.cache grub-0.97.orig/stage2/disk_io.c grub-0.97.minix2/stage2/disk_io.c
--- grub-0.97.orig/stage2/disk_io.c	2004-05-23 18:35:24.000000000 +0200
+++ grub-0.97.minix2/stage2/disk_io.c	2006-08-04 17:47:46.000000000 +0200
@@ -60,6 +60,9 @@
 # ifdef FSYS_MINIX
   {"minix", minix_mount, minix_read, minix_dir, 0, 0},
 # endif
+# ifdef FSYS_MINIX2
+  {"minix2", minix2_mount, minix2_read, minix2_dir, 0, 0},
+# endif
 # ifdef FSYS_REISERFS
   {"reiserfs", reiserfs_mount, reiserfs_read, reiserfs_dir, 0, reiserfs_embed},
 # endif
diff -urN -x '*~' -x '*.orig' -x '*.rej' -x autom4te.cache grub-0.97.orig/stage2/filesys.h grub-0.97.minix2/stage2/filesys.h
--- grub-0.97.orig/stage2/filesys.h	2004-05-14 21:36:43.000000000 +0200
+++ grub-0.97.minix2/stage2/filesys.h	2006-08-04 17:47:46.000000000 +0200
@@ -67,6 +67,15 @@
 #define FSYS_MINIX_NUM 0
 #endif
 
+#ifdef FSYS_MINIX2
+#define FSYS_MINIX2_NUM 1
+int minix2_mount (void);
+int minix2_read (char *buf, int len);
+int minix2_dir (char *dirname);
+#else
+#define FSYS_MINIX2_NUM 0
+#endif
+
 #ifdef FSYS_REISERFS
 #define FSYS_REISERFS_NUM 1
 int reiserfs_mount (void);
@@ -126,9 +135,9 @@
 
 #ifndef NUM_FSYS
 #define NUM_FSYS	\
-  (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM	\
-   + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM	\
-   + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS2_NUM)
+  (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM         \
+   + FSYS_MINIX2_NUM + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM \
+   + FSYS_XFS_NUM + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS2_NUM)
 #endif
 
 /* defines for the block filesystem info area */
diff -urN -x '*~' -x '*.orig' -x '*.rej' -x autom4te.cache grub-0.97.orig/stage2/fsys_minix2.c grub-0.97.minix2/stage2/fsys_minix2.c
--- grub-0.97.orig/stage2/fsys_minix2.c	1970-01-01 01:00:00.000000000 +0100
+++ grub-0.97.minix2/stage2/fsys_minix2.c	2006-08-04 18:34:49.000000000 +0200
@@ -0,0 +1,598 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002  Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Restrictions:
+   This is MINIX V2 only
+   Disk creation is like:
+   mkfs.minix -v -c DEVICE 
+*/
+
+#ifdef FSYS_MINIX2
+
+#include "shared.h"
+#include "filesys.h"
+
+/* #define DEBUG_MINIX 1 */
+#if defined(DEBUG_MINIX) && DEBUG_MINIX
+#define DMSG(format,...) printf("%s:%d - %s:" format, __FILE__, __LINE__, __FUNCTION__, ## __VA_ARGS__)
+#else
+#define DMSG(format,...)
+#endif
+
+/* MINIX namelen option */
+static int namelen;
+
+/* sizes are always in bytes, BLOCK values are always in DEV_BSIZE (sectors) */
+#define DEV_BSIZE 512
+
+/* include/linux/fs.h */
+#define BLOCK_SIZE_BITS 10
+#define BLOCK_SIZE 	(1<<BLOCK_SIZE_BITS)
+
+/* made up, defaults to 1 but can be passed via mount_opts */
+#define WHICH_SUPER 1
+/* kind of from fs/ext2/super.c (is OK for minix) */
+#define SBLOCK (WHICH_SUPER * BLOCK_SIZE / DEV_BSIZE)	/* = 2 */
+
+/* include/asm-i386/type.h */
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+/* include/linux/minix_fs.h */
+#define MINIX_ROOT_INO 1
+
+/* Not the same as the bogus LINK_MAX in <linux/limits.h>. Oh well. */
+#define MINIX2_LINK_MAX 65530
+
+#define MINIX_I_MAP_SLOTS       8
+#define MINIX_Z_MAP_SLOTS       64
+#define MINIX2_SUPER_MAGIC      0x2468          /* minix V2 fs */
+#define MINIX2_SUPER_MAGIC2     0x2478          /* minix V2 fs, 30 char names */
+#define MINIX_VALID_FS          0x0001          /* Clean fs. */
+#define MINIX_ERROR_FS          0x0002          /* fs has errors. */
+
+#define MINIX2_INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct minix2_inode)))
+
+#define MINIX_V1                0x0001          /* original minix fs */
+#define MINIX_V2                0x0002          /* minix V2 fs */
+
+/* originally this is : 
+#define INODE_VERSION(inode)    inode->i_sb->u.minix_sb.s_version
+   here we have */
+#define INODE_VERSION(inode)	(SUPERBLOCK->s_version)
+
+/*
+ * The new minix inode has all the time entries, as well as
+ * long block numbers and a third indirect block (7+1+1+1
+ * instead of 7+1+1). Also, some previously 8-bit values are
+ * now 16-bit. The inode is now 64 bytes instead of 32.
+ */
+struct minix2_inode {
+	__u16 i_mode;
+	__u16 i_nlinks;
+	__u16 i_uid;
+	__u16 i_gid;
+	__u32 i_size;
+	__u32 i_atime;
+	__u32 i_mtime;
+	__u32 i_ctime;
+	__u32 i_zone[10];
+};
+
+/*
+ * minix super-block data on disk
+ */
+struct minix2_super_block {
+        __u16 s_ninodes;
+        __u16 s_nzones;
+        __u16 s_imap_blocks;
+        __u16 s_zmap_blocks;
+        __u16 s_firstdatazone;
+        __u16 s_log_zone_size;
+        __u32 s_max_size;
+        __u16 s_magic;
+        __u16 s_state;
+        __u32 s_zones;
+};
+
+struct minix2_dir_entry {
+        __u16 inode;
+        char name[0];
+};
+
+/* made up, these are pointers into FSYS_BUF */
+/* read once, always stays there: */
+
+#define SUPERBLOCK \
+    ((struct minix2_super_block *)(FSYS_BUF))
+#define INODE \
+    ((struct minix2_inode *)((char *) SUPERBLOCK + BLOCK_SIZE))
+#define DATABLOCK1 \
+    ((char *)INODE + sizeof(struct minix2_inode))
+#define DATABLOCK2 \
+    ((char *)DATABLOCK1 + BLOCK_SIZE)
+#define DATABLOCK3 \
+    ((char *)DATABLOCK2 + BLOCK_SIZE)
+
+/* linux/stat.h */
+#define S_IFMT  00170000
+#define S_IFLNK  0120000
+#define S_IFREG  0100000
+#define S_IFDIR  0040000
+#define S_ISLNK(m)	(((m) & S_IFMT) == S_IFLNK)
+#define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)
+#define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
+
+#define PATH_MAX                1024	/* include/linux/limits.h */
+#define MAX_LINK_COUNT             5	/* number of symbolic links to follow */
+
+/* check filesystem types and read superblock into memory buffer */
+int
+minix2_mount (void)
+{
+  DMSG("start\n");
+
+  DMSG("current slice type = 0x%x\n", current_slice);
+
+  if (((current_drive & 0x80) || current_slice != 0)
+      && ! IS_PC_SLICE_TYPE_MINIX (current_slice)
+      && ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER))
+    return 0;			/* The partition is not of MINIX type */
+  
+  if (part_length < (SBLOCK +
+		     (sizeof (struct minix2_super_block) / DEV_BSIZE)))
+    return 0;			/* The partition is too short */
+  
+  if (!devread (SBLOCK, 0, sizeof (struct minix2_super_block),
+		(char *) SUPERBLOCK))
+    return 0;			/* Cannot read superblock */
+  
+  switch (SUPERBLOCK->s_magic)
+    {
+    case MINIX2_SUPER_MAGIC:
+      namelen = 14;
+      break;
+    case MINIX2_SUPER_MAGIC2:
+      namelen = 30;
+      break;
+    default:
+      return 0;			/* Unsupported type */
+    }
+
+  return 1;
+}
+
+/* Takes a file system block number and reads it into BUFFER. */
+static int
+minix_rdfsb (int fsblock, char * buffer)
+{
+  return devread (fsblock * (BLOCK_SIZE / DEV_BSIZE), 0,
+		  BLOCK_SIZE, buffer);
+}
+
+/* Maps LOGICAL_BLOCK (the file offset divided by the blocksize) into
+   a physical block (the location in the file system) via an inode. */
+static int
+minix_block_map (int logical_block)
+{
+  int i;
+
+  DMSG("logical_block = %d\n", logical_block);
+
+  /* no indirection */
+  if (logical_block < 7) {
+ 
+    i = INODE->i_zone[logical_block];
+
+    DMSG("ind1, block = %d\n", i);
+ 
+    goto end;
+  }
+
+  /* first level */
+  logical_block -= 7;
+  if (logical_block < 256)
+    {
+      i = INODE->i_zone[7];
+
+      DMSG("ind1, block = %d\n", i);
+      
+      /* read the ind table */
+      if (!i || !minix_rdfsb (i, DATABLOCK1))
+	{
+	  errnum = ERR_FSYS_CORRUPT;
+	  return -1;
+	}
+
+      i = ((__u32 *)DATABLOCK1)[logical_block];
+
+      DMSG("ind2, block = %d\n", i);
+
+      goto end;
+    }
+
+  /* 2nd level */
+  logical_block -= 256;
+
+  if (logical_block < 256 * 256)
+    {
+      i = INODE->i_zone[8];
+
+      DMSG("ind1, block = %d\n", i);
+
+      if (!i || !minix_rdfsb (i, DATABLOCK2))
+	{
+	  errnum = ERR_FSYS_CORRUPT;
+	  return -1;
+	}
+
+      i = ((__u32 *)DATABLOCK2)[logical_block / 256];
+
+      DMSG("ind2, block = %d\n", i);
+      
+      if (!i || !minix_rdfsb (i, DATABLOCK1))
+	{
+	  errnum = ERR_FSYS_CORRUPT;
+	  return -1;
+	}
+
+      i = ((__u32 *)DATABLOCK1)[logical_block % 256];
+
+      DMSG("ind3, block = %d\n", i);
+
+      goto end;
+    }
+
+  /* third level */
+  logical_block -= 256 * 256;
+
+  i = INODE->i_zone[9];
+
+  DMSG("ind1, block = %d\n", i);
+
+  if (!i || !minix_rdfsb (i, DATABLOCK3))
+    {
+      errnum = ERR_FSYS_CORRUPT;
+      return -1;
+    }
+
+  i = ((__u32*)DATABLOCK3)[logical_block / (256 * 256)];
+
+  DMSG("ind2, block = %d\n", i);
+      
+  if (!i || !minix_rdfsb (i, DATABLOCK2))
+    {
+      errnum = ERR_FSYS_CORRUPT;
+      return -1;
+    }
+  
+  i = ((__u32 *)DATABLOCK2)[(logical_block / 256) % 256];
+  
+  DMSG("ind3, block = %d\n", i);
+
+  if (!i || !minix_rdfsb (i, DATABLOCK1))
+    {
+      errnum = ERR_FSYS_CORRUPT;
+      return -1;
+    }
+
+  i = ((__u32 *)DATABLOCK1)[logical_block % 256];
+
+  DMSG("ind4, block = %d\n", i);
+
+ end:
+
+  DMSG("real block = %d\n", i);
+
+  return i;
+}
+
+
+
+/* read from INODE into BUF */
+int
+minix2_read (char *buf, int len)
+{
+  int logical_block;
+  int offset;
+  int map;
+  int ret = 0;
+  int size = 0;
+
+  while (len > 0)
+    {
+      /* find the (logical) block component of our location */
+      logical_block = filepos >> BLOCK_SIZE_BITS;
+      offset = filepos & (BLOCK_SIZE - 1);
+      map = minix_block_map (logical_block);
+#ifdef DEBUG_MINIX
+      DMSG ("map=%d\n", map);
+#endif
+      if (map < 0)
+	break;
+
+      size = BLOCK_SIZE;
+      size -= offset;
+      if (size > len)
+	size = len;
+
+      disk_read_func = disk_read_hook;
+
+      devread (map * (BLOCK_SIZE / DEV_BSIZE),
+	       offset, size, buf);
+
+      disk_read_func = NULL;
+
+      buf += size;
+      len -= size;
+      filepos += size;
+      ret += size;
+    }
+
+  if (errnum)
+    ret = 0;
+
+  return ret;
+}
+
+/* preconditions: minix_mount already executed, therefore supblk in buffer
+     known as SUPERBLOCK
+   returns: 0 if error, nonzero iff we were able to find the file successfully
+   postconditions: on a nonzero return, buffer known as INODE contains the
+     inode of the file we were trying to look up
+   side effects: none yet  */
+int
+minix2_dir (char *dirname)
+{
+  int current_ino = MINIX_ROOT_INO;  /* start at the root */
+  int updir_ino = current_ino;	     /* the parent of the current directory */
+  int ino_blk;			     /* fs pointer of the inode's info */
+
+  int str_chk = 0;		     /* used ot hold the results of a string
+				        compare */
+
+  struct minix2_inode * raw_inode;    /* inode info for current_ino */
+
+  char linkbuf[PATH_MAX];	     /* buffer for following sym-links */
+  int link_count = 0;
+
+  char * rest;
+  char ch;
+
+  int off;			     /* offset within block of directory 
+					entry */
+  int loc;			     /* location within a directory */
+  int blk;			     /* which data blk within dir entry */
+  long map;			     /* fs pointer of a particular block from
+					dir entry */
+  struct minix2_dir_entry * dp;	     /* pointer to directory entry */
+
+  /* loop invariants:
+     current_ino = inode to lookup
+     dirname = pointer to filename component we are cur looking up within
+     the directory known pointed to by current_ino (if any) */
+
+#ifdef DEBUG_MINIX
+  DMSG ("\n");
+#endif  
+
+  while (1)
+    {
+#ifdef DEBUG_MINIX
+      DMSG ("inode %d, dirname %s\n", current_ino, dirname);
+#endif
+
+      ino_blk = (2 + SUPERBLOCK->s_imap_blocks + SUPERBLOCK->s_zmap_blocks
+		 + (current_ino - 1) / MINIX2_INODES_PER_BLOCK);
+      if (! minix_rdfsb (ino_blk, (char *)INODE))
+	return 0;
+
+      raw_inode = INODE + ((current_ino - 1) % MINIX2_INODES_PER_BLOCK);
+
+      /* copy inode to fixed location */
+      memmove ((void *) INODE, (void *) raw_inode, 
+	       sizeof (struct minix2_inode));
+
+      /* If we've got a symbolic link, then chase it. */
+      if (S_ISLNK (INODE->i_mode))
+	{
+	  int len;
+
+	  if (++link_count > MAX_LINK_COUNT)
+	    {
+	      errnum = ERR_SYMLINK_LOOP;
+	      return 0;
+	    }
+#ifdef DEBUG_MINIX
+	  DMSG ("S_ISLNK (%s)\n", dirname);
+#endif
+
+	  /* Find out how long our remaining name is. */
+	  len = 0;
+	  while (dirname[len] && !isspace (dirname[len]))
+	    len++;
+
+	  /* Get the symlink size. */
+	  filemax = (INODE->i_size);
+	  if (filemax + len > sizeof (linkbuf) - 2)
+	    {
+	      errnum = ERR_FILELENGTH;
+	      return 0;
+	    }
+
+	  if (len)
+	    {
+	      /* Copy the remaining name to the end of the symlink data.
+	         Note that DIRNAME and LINKBUF may overlap! */
+	      memmove (linkbuf + filemax, dirname, len);
+	    }
+	  linkbuf[filemax + len] = '\0';
+
+	  /* Read the necessary blocks, and reset the file pointer. */
+	  len = grub_read (linkbuf, filemax);
+	  filepos = 0;
+	  if (!len)
+	    return 0;
+
+#ifdef DEBUG_MINIX
+	  DMSG ("symlink=%s\n", linkbuf);
+#endif
+
+	  dirname = linkbuf;
+	  if (*dirname == '/')
+	    {
+	      /* It's an absolute link, so look it up in root. */
+	      current_ino = MINIX_ROOT_INO;
+	      updir_ino = current_ino;
+	    }
+	  else
+	    {
+	      /* Relative, so look it up in our parent directory. */
+	      current_ino = updir_ino;
+	    }
+
+	  /* Try again using the new name. */
+	  continue;
+	}
+
+      /* If end of filename, INODE points to the file's inode */
+      if (!*dirname || isspace (*dirname))
+	{
+	  if (!S_ISREG (INODE->i_mode))
+	    {
+	      errnum = ERR_BAD_FILETYPE;
+	      return 0;
+	    }
+
+	  filemax = (INODE->i_size);
+	  return 1;
+	}
+
+      /* else we have to traverse a directory */
+      updir_ino = current_ino;
+
+      /* skip over slashes */
+      while (*dirname == '/')
+	dirname++;
+
+      /* if this isn't a directory of sufficient size to hold our file, 
+	 abort */
+      if (!(INODE->i_size) || !S_ISDIR (INODE->i_mode))
+	{
+	  errnum = ERR_BAD_FILETYPE;
+	  return 0;
+	}
+
+      /* skip to next slash or end of filename (space) */
+      for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/';
+	   rest++);
+
+      /* look through this directory and find the next filename component */
+      /* invariant: rest points to slash after the next filename component */
+      *rest = 0;
+      loc = 0;
+
+      do
+	{
+#ifdef DEBUG_MINIX
+	  DMSG ("dirname=`%s', rest=`%s', loc=%d\n", dirname, rest, loc);
+#endif
+
+	  /* if our location/byte offset into the directory exceeds the size,
+	     give up */
+	  if (loc >= INODE->i_size)
+	    {
+	      if (print_possibilities < 0)
+		{
+#if 0
+		  putchar ('\n');
+#endif
+		}
+	      else
+		{
+		  errnum = ERR_FILE_NOT_FOUND;
+		  *rest = ch;
+		}
+	      return (print_possibilities < 0);
+	    }
+
+	  /* else, find the (logical) block component of our location */
+	  blk = loc >> BLOCK_SIZE_BITS;
+
+	  /* we know which logical block of the directory entry we are looking
+	     for, now we have to translate that to the physical (fs) block on
+	     the disk */
+	  map = minix_block_map (blk);
+#ifdef DEBUG_MINIX
+	  DMSG ("fs block=%d\n", map);
+#endif
+	  if ((map < 0) || !minix_rdfsb (map, DATABLOCK1))
+	    {
+	      errnum = ERR_FSYS_CORRUPT;
+	      *rest = ch;
+	      return 0;
+	    }
+	  off = loc & (BLOCK_SIZE - 1);
+	  dp = (struct minix2_dir_entry *) (DATABLOCK1 + off);
+	  /* advance loc prematurely to next on-disk directory entry  */
+	  loc += sizeof (dp->inode) + namelen;
+
+	  /* NOTE: minix filenames are NULL terminated if < NAMELEN
+	     else exact */
+
+#ifdef DEBUG_MINIX
+	  DMSG ("directory entry ino=%d\n", dp->inode);
+	  if (dp->inode)
+	    DMSG ("entry=%s\n", dp->name);
+#endif
+
+	  if (dp->inode)
+	    {
+	      int saved_c = dp->name[namelen];
+
+	      dp->name[namelen] = 0;
+	      str_chk = substring (dirname, dp->name);
+
+# ifndef STAGE1_5
+	      if (print_possibilities && ch != '/'
+		  && (!*dirname || str_chk <= 0))
+		{
+		  if (print_possibilities > 0)
+		    print_possibilities = -print_possibilities;
+		  print_a_completion (dp->name);
+		}
+# endif
+
+	      dp->name[namelen] = saved_c;
+	    }
+
+	}
+      while (!dp->inode || (str_chk || (print_possibilities && ch != '/')));
+
+      current_ino = dp->inode;
+      *(dirname = rest) = ch;
+    }
+  /* never get here */
+}
+
+#endif /* FSYS_MINIX2 */
diff -urN -x '*~' -x '*.orig' -x '*.rej' -x autom4te.cache grub-0.97.orig/stage2/Makefile.am grub-0.97.minix2/stage2/Makefile.am
--- grub-0.97.orig/stage2/Makefile.am	2005-02-02 21:37:35.000000000 +0100
+++ grub-0.97.minix2/stage2/Makefile.am	2006-08-04 18:11:18.000000000 +0200
@@ -17,13 +17,13 @@
 noinst_LIBRARIES = libgrub.a
 libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \
 	disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
-	fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs2.c \
+	fsys_jfs.c fsys_minix.c fsys_minix2.c fsys_reiserfs.c fsys_ufs2.c \
 	fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
 	terminfo.c tparm.c
 libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
 	-DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
-	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
-	-DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
+	-DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_MINIX2=1 \
+	-DFSYS_REISERFS=1 -DFSYS_UFS2=1 -DFSYS_VSTAFS=1 -DFSYS_XFS=1 \
 	-DUSE_MD5_PASSWORDS=1 -DSUPPORT_SERIAL=1 -DSUPPORT_HERCULES=1
 
 # Stage 2 and Stage 1.5's.
@@ -34,24 +34,26 @@
 if DISKLESS_SUPPORT
 pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
 	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
-	reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5 \
-	nbgrub pxegrub
+	minix2_stage1_5 reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \
+	xfs_stage1_5 nbgrub pxegrub
 noinst_DATA = pre_stage2 start start_eltorito nbloader pxeloader diskless
 noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
 	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
 	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
-	reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
-	xfs_stage1_5.exec nbloader.exec pxeloader.exec diskless.exec
+	minix2_stage1_5.exec reiserfs_stage1_5.exec ufs2_stage1_5.exec \
+	vstafs_stage1_5.exec xfs_stage1_5.exec nbloader.exec pxeloader.exec \
+	diskless.exec
 else
 pkglib_DATA = stage2 stage2_eltorito e2fs_stage1_5 fat_stage1_5 \
 	ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 \
-	reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5
+	minix2_stage1_5 reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 \
+	xfs_stage1_5
 noinst_DATA = pre_stage2 start start_eltorito
 noinst_PROGRAMS = pre_stage2.exec start.exec start_eltorito.exec \
 	e2fs_stage1_5.exec fat_stage1_5.exec ffs_stage1_5.exec \
 	iso9660_stage1_5.exec jfs_stage1_5.exec minix_stage1_5.exec \
-	reiserfs_stage1_5.exec ufs2_stage1_5.exec vstafs_stage1_5.exec \
-	xfs_stage1_5.exec
+	minix2_stage1_5.exec reiserfs_stage1_5.exec ufs2_stage1_5.exec \
+	vstafs_stage1_5.exec xfs_stage1_5.exec
 endif
 MOSTLYCLEANFILES = $(noinst_PROGRAMS)
 
@@ -89,8 +91,9 @@
 pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \
 	cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
 	fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
-	fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c gunzip.c \
-	hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c
+	fsys_minix2.c fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c \
+	gunzip.c hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c \
+	tparm.c
 pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
 pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
 pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
@@ -181,6 +184,15 @@
 	-DNO_BLOCK_FILES=1
 minix_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
 
+# For minix2_stage1_5 target.
+minix2_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
+	stage1_5.c fsys_minix2.c bios.c
+minix2_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX2=1 \
+	-DNO_BLOCK_FILES=1
+minix2_stage1_5_exec_CCASFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX2=1 \
+	-DNO_BLOCK_FILES=1
+minix2_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
+
 # For reiserfs_stage1_5 target.
 reiserfs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c \
 	disk_io.c stage1_5.c fsys_reiserfs.c bios.c

diff -urN -x '*~' -x '*.orig' -x '*.rej' -x autom4te.cache grub-0.97.orig/stage2/shared.h grub-0.97.minix2/stage2/shared.h
--- grub-0.97.orig/stage2/shared.h	2004-06-19 18:40:09.000000000 +0200
+++ grub-0.97.minix2/stage2/shared.h	2006-08-04 17:47:46.000000000 +0200
@@ -212,6 +212,7 @@
 #define STAGE2_ID_XFS_STAGE1_5		8
 #define STAGE2_ID_ISO9660_STAGE1_5	9
 #define STAGE2_ID_UFS2_STAGE1_5		10
+#define STAGE2_ID_MINIX2_STAGE1_5	11
 
 #ifndef STAGE1_5
 # define STAGE2_ID	STAGE2_ID_STAGE2
@@ -236,6 +237,8 @@
 #  define STAGE2_ID	STAGE2_ID_ISO9660_STAGE1_5
 # elif defined(FSYS_UFS2)
 #  define STAGE2_ID	STAGE2_ID_UFS2_STAGE1_5
+# elif defined(FSYS_MINIX2)
+#  define STAGE2_ID	STAGE2_ID_MINIX2_STAGE1_5
 # else
 #  error "unknown Stage 2"
 # endif
