Index: commands/test.c
===================================================================
RCS file: /sources/grub/grub2/commands/test.c,v
retrieving revision 1.2
diff -u -b -B -r1.2 test.c
--- commands/test.c	13 Nov 2005 15:47:08 -0000	1.2
+++ commands/test.c	9 Feb 2007 06:59:50 -0000
@@ -30,25 +30,38 @@
 	       char **args)
 
 {
-  char *eq;
-  char *eqis;
+  //char *eq;
+  //char *eqis;
 
   /* XXX: No fancy expression evaluation yet.  */
   
-  if (argc == 0)
-    return 0;
+  //if (argc == 0)
+  //  return 0;
   
-  eq = grub_strdup (args[0]);
-  eqis = grub_strchr (eq, '=');
-  if (! eqis)
-    return 0;
+  //eq = grub_strdup (args[0]);
+  //eqis = grub_strchr (eq, '=');
+  //if (! eqis)
+  //  return 0;
 
-  *eqis = '\0';
-  eqis++;
+  //*eqis = '\0';
+  //eqis++;
   /* Check an expression in the form `A=B'.  */
-  if (grub_strcmp (eq, eqis))
-    grub_error (GRUB_ERR_TEST_FAILURE, "false");
-  grub_free (eq);
+  //if (grub_strcmp (eq, eqis))
+  //  grub_error (GRUB_ERR_TEST_FAILURE, "false");
+  //grub_free (eq);
+  
+  // test A = B, or
+  // test A != B
+  grub_errno = 1;
+  if (argc >= 3)
+    {
+      if (args[1][0]=='=')
+        grub_errno = (grub_strcmp(args[0],args[2])!=0);
+      else if ((args[1][0]=='!') && (args[1][1]=='='))
+        grub_errno = (grub_strcmp(args[0],args[2])==0);
+    }
+  if (grub_errno)
+    grub_error(GRUB_ERR_TEST_FAILURE, "false");
 
   return grub_errno;
 }
Index: conf/common.mk
===================================================================
RCS file: /sources/grub/grub2/conf/common.mk,v
retrieving revision 1.20
diff -u -b -B -r1.20 common.mk
--- conf/common.mk	3 Nov 2006 20:28:04 -0000	1.20
+++ conf/common.mk	9 Feb 2007 06:59:52 -0000
@@ -1075,7 +1075,7 @@
 pkgdata_MODULES += hello.mod boot.mod terminal.mod ls.mod	\
 	cmp.mod cat.mod help.mod font.mod search.mod		\
 	loopback.mod configfile.mod				\
-	terminfo.mod test.mod blocklist.mod
+	terminfo.mod test.mod blocklist.mod echo.mod
 
 # For hello.mod.
 hello_mod_SOURCES = hello/hello.c
@@ -1391,6 +1391,53 @@
 
 # For echo.mod
 echo_mod_SOURCES = commands/echo.c
+CLEANFILES += echo.mod mod-echo.o mod-echo.c pre-echo.o echo_mod-commands_echo.o und-echo.lst
+ifneq ($(echo_mod_EXPORTS),no)
+CLEANFILES += def-echo.lst
+DEFSYMFILES += def-echo.lst
+endif
+MOSTLYCLEANFILES += echo_mod-commands_echo.d
+UNDSYMFILES += und-echo.lst
+
+echo.mod: pre-echo.o mod-echo.o
+	-rm -f $@
+	$(TARGET_CC) $(echo_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-echo.o: $(echo_mod_DEPENDENCIES) echo_mod-commands_echo.o
+	-rm -f $@
+	$(TARGET_CC) $(echo_mod_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ echo_mod-commands_echo.o
+
+mod-echo.o: mod-echo.c
+	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(echo_mod_CFLAGS) -c -o $@ $<
+
+mod-echo.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'echo' $< > $@ || (rm -f $@; exit 1)
+
+ifneq ($(echo_mod_EXPORTS),no)
+def-echo.lst: pre-echo.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 echo/' > $@
+endif
+
+und-echo.lst: pre-echo.o
+	echo 'echo' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+echo_mod-commands_echo.o: commands/echo.c
+	$(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(echo_mod_CFLAGS) -MD -c -o $@ $<
+-include echo_mod-commands_echo.d
+
+CLEANFILES += cmd-echo_mod-commands_echo.lst fs-echo_mod-commands_echo.lst
+COMMANDFILES += cmd-echo_mod-commands_echo.lst
+FSFILES += fs-echo_mod-commands_echo.lst
+
+cmd-echo_mod-commands_echo.lst: commands/echo.c gencmdlist.sh
+	set -e; 	  $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(echo_mod_CFLAGS) -E $< 	  | sh $(srcdir)/gencmdlist.sh echo > $@ || (rm -f $@; exit 1)
+
+fs-echo_mod-commands_echo.lst: commands/echo.c genfslist.sh
+	set -e; 	  $(TARGET_CC) -Icommands -I$(srcdir)/commands $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(echo_mod_CFLAGS) -E $< 	  | sh $(srcdir)/genfslist.sh echo > $@ || (rm -f $@; exit 1)
+
+
 echo_mod_CFLAGS = $(COMMON_CFLAGS)
 echo_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
Index: conf/common.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/common.rmk,v
retrieving revision 1.12
diff -u -b -B -r1.12 common.rmk
--- conf/common.rmk	3 Nov 2006 20:28:04 -0000	1.12
+++ conf/common.rmk	9 Feb 2007 06:59:52 -0000
@@ -135,7 +135,7 @@
 pkgdata_MODULES += hello.mod boot.mod terminal.mod ls.mod	\
 	cmp.mod cat.mod help.mod font.mod search.mod		\
 	loopback.mod configfile.mod				\
-	terminfo.mod test.mod blocklist.mod
+	terminfo.mod test.mod blocklist.mod echo.mod
 
 # For hello.mod.
 hello_mod_SOURCES = hello/hello.c
Index: kern/parser.c
===================================================================
RCS file: /sources/grub/grub2/kern/parser.c,v
retrieving revision 1.2
diff -u -b -B -r1.2 parser.c
Index: normal/execute.c
===================================================================
RCS file: /sources/grub/grub2/normal/execute.c,v
retrieving revision 1.4
diff -u -b -B -r1.4 execute.c
--- normal/execute.c	28 May 2006 21:58:34 -0000	1.4
+++ normal/execute.c	9 Feb 2007 06:59:52 -0000
@@ -68,6 +68,8 @@
       if (argi->type == 1)
 	{
 	  val = grub_env_get (argi->str);
+	  // The variable may not exist
+	  if (val)
 	  grub_strcat (chararg, val);
 	}
       else
Index: normal/lexer.c
===================================================================
RCS file: /sources/grub/grub2/normal/lexer.c,v
retrieving revision 1.6
diff -u -b -B -r1.6 lexer.c
Index: normal/main.c
===================================================================
RCS file: /sources/grub/grub2/normal/main.c,v
retrieving revision 1.19
diff -u -b -B -r1.19 main.c
--- normal/main.c	12 Dec 2006 00:13:55 -0000	1.19
+++ normal/main.c	9 Feb 2007 06:59:53 -0000
@@ -525,6 +525,20 @@
 
   grub_set_history (GRUB_DEFAULT_HISTORY_SIZE);
 
+  /* Allocate root menu */
+  if (! grub_env_get_data_slot("menu"))
+    {  
+      grub_menu_t newmenu;
+
+      newmenu = grub_malloc (sizeof (*newmenu));
+      if (newmenu)
+        {
+          newmenu->size = 0;
+          newmenu->entry_list = 0;
+          grub_env_set_data_slot ("menu", newmenu);
+	}
+    }
+
   /* Register a command "normal" for the rescue mode.  */
   grub_rescue_register_command ("normal", grub_rescue_cmd_normal,
 				"enter normal mode");
