--- old/libbe/common/be_utils.c	2012-08-31 05:09:01.777503166 +0400
+++ new/libbe/common/be_utils.c	2012-08-31 05:09:01.806511114 +0400
@@ -461,11 +461,11 @@
 		char *tok = NULL;
 
 		(void) strlcpy(temp_line, line, BUFSIZ);
-		tok = strtok(line, BE_WHITE_SPACE);
+		tok = strtok(line, "=\n");
 
 		if (tok == NULL || tok[0] == '#') {
 			continue;
-		} else if (strcmp(tok, "title") == 0) {
+		} else if (strcmp(tok, "entry_name") == 0) {
 			collect_lines = B_FALSE;
 			if ((tok = strtok(NULL, "\n")) == NULL)
 				(void) strlcpy(title, "", sizeof (title));
@@ -480,7 +480,7 @@
 				}
 				num_tmp_lines = 0;
 			}
-		} else if (strcmp(tok, "bootfs") == 0) {
+		} else if (strcmp(tok, "data_set") == 0) {
 			char *bootfs = strtok(NULL, BE_WHITE_SPACE);
 			found_title = B_FALSE;
 			if (bootfs == NULL)
@@ -500,7 +500,7 @@
 				/*
 				 * Store the new title line
 				 */
-				(void) snprintf(str, BUFSIZ, "title %s\n",
+				(void) snprintf(str, BUFSIZ, "entry_name=%s\n",
 				    description ? description : be_name);
 				entries[num_lines] = strdup(str);
 				num_lines++;
@@ -514,11 +514,31 @@
 					tmp_entries[i] = NULL;
 					num_lines++;
 				}
-				num_tmp_lines = 0;
+
+				zprop_get_cbdata_t cb = { 0 };
+				zprop_source_t src;
+				char * bc = strchr(be_root_ds, '/');
+				char sguid[] = "guid";
+
+				*bc = '\0';
+				cb.cb_first = B_TRUE;
+				cb.cb_sources = ZPROP_SRC_ALL;
+				cb.cb_type = ZFS_TYPE_POOL;
+				zprop_get_list(g_zfs, sguid, &cb.cb_proplist, ZFS_TYPE_POOL);
+				zpool_handle_t * z_hndl = zpool_open(g_zfs, be_root_ds);
+				*bc = '/';
+				if (z_hndl) {
+					uint64_t guid = zpool_get_prop_int(z_hndl, cb.cb_proplist->pl_prop, &src);
+					(void) snprintf(str, BUFSIZ, "pool_uuid=%llx\n", guid);
+					entries[num_lines] = strdup(str);
+					num_lines++;
+					zpool_close(z_hndl);
+				}
+num_tmp_lines = 0;
 				/*
 				 * Store the new bootfs line.
 				 */
-				(void) snprintf(str, BUFSIZ, "bootfs %s\n",
+				(void) snprintf(str, BUFSIZ, "data_set=%s\n",
 				    be_root_ds);
 				entries[num_lines] = strdup(str);
 				num_lines++;
@@ -536,6 +556,19 @@
 				entries[num_lines] =
 				    strdup("splashimage "
 				    "/boot/splashimage.xpm\n");
+			} else if ((strcmp(tok, "kernel_path") == 0) || 
+				(strcmp(tok, "module") == 0)) 
+			{
+				char * path;
+				char * st_path;
+				
+				st_path = strtok(NULL, "\n");
+				path = (char *) malloc(512);
+				strcpy(path, tok);
+				strcat(path, "=");
+				strcat(path, st_path);
+				strcat(path, "\n");
+				entries[num_lines] = path;
 			} else {
 				entries[num_lines] = strdup(temp_line);
 			}
@@ -598,18 +631,36 @@
 			(void) fprintf(menu_fp, "%s\n", BE_GRUB_COMMENT);
 		ret = BE_SUCCESS;
 	} else {
-		(void) fprintf(menu_fp, "title %s\n",
+		zprop_get_cbdata_t cb = { 0 };
+		zprop_source_t src;
+		char * bc = strchr(be_root_ds, '/');
+		char sguid[] = "guid";
+
+		(void) fprintf(menu_fp, "entry_name=%s\n",
 		    description ? description : be_name);
-		(void) fprintf(menu_fp, "bootfs %s\n", be_root_ds);
+		*bc = '\0';
+		cb.cb_first = B_TRUE;
+		cb.cb_sources = ZPROP_SRC_ALL;
+		cb.cb_type = ZFS_TYPE_POOL;
+		zprop_get_list(g_zfs, sguid, &cb.cb_proplist, ZFS_TYPE_POOL);
+		zpool_handle_t * z_hndl = zpool_open(g_zfs, be_root_ds);
+		*bc = '/';
+		if (z_hndl) {
+			uint64_t guid = zpool_get_prop_int(z_hndl, cb.cb_proplist->pl_prop, &src);
+			(void) fprintf(menu_fp, "pool_uuid=%llx\n", guid);
+			zpool_close(z_hndl);
+		}
+		(void) fprintf(menu_fp, "data_set=%s\n", be_root_ds);
 
 		/*
 		 * Check to see if this system supports grub
 		 */
 		if (be_has_grub()) {
-			(void) fprintf(menu_fp, "kernel$ "
-			    "/platform/i86pc/kernel/$ISADIR/unix -B "
-			    "$ZFS-BOOTFS\n");
-			(void) fprintf(menu_fp, "module$ "
+			(void) fprintf(menu_fp, "kernel_path="
+			    "/platform/i86pc/kernel/$ISADIR/unix\n");
+			(void) fprintf(menu_fp, "kernel_options="
+			    "-B $ZFS_BOOTFS,console=graphic\n");
+			(void) fprintf(menu_fp, "module="
 			    "/platform/i86pc/$ISADIR/boot_archive\n");
 			(void) fprintf(menu_fp, "%s\n", BE_GRUB_COMMENT);
 		}
@@ -789,7 +840,7 @@
 		(void) strlcpy(tline, menu_buf, sizeof (tline));
 
 		/* Tokenize line */
-		tok = strtok(tline, BE_WHITE_SPACE);
+		tok = strtok(tline, "=\n");
 
 		if (tok == NULL || tok[0] == '#') {
 			/* Found empty line or comment line */
@@ -811,7 +862,7 @@
 				/* Write this line out */
 				(void) fputs(menu_buf, tmp_menu_fp);
 			}
-		} else if (strcmp(tok, "default") == 0) {
+		} else if (strcmp(tok, "default_entry") == 0) {
 			/*
 			 * Record what 'default' is set to because we might
 			 * need to adjust this upon deleting an entry.
@@ -823,7 +874,7 @@
 			}
 
 			(void) fputs(menu_buf, tmp_menu_fp);
-		} else if (strcmp(tok, "title") == 0) {
+		} else if (strcmp(tok, "entry_name") == 0) {
 			/*
 			 * If we've reached a 'title' line and do_buffer is
 			 * is true, that means we've just buffered an entire
@@ -859,7 +910,7 @@
 				goto cleanup;
 			}
 
-		} else if (strcmp(tok, "bootfs") == 0) {
+		} else if (strcmp(tok, "data_set") == 0) {
 			char *bootfs = NULL;
 
 			/*
@@ -1020,15 +1071,15 @@
 				(void) strlcpy(tline, menu_buf, sizeof (tline));
 
 				/* Tokenize line */
-				tok = strtok(tline, BE_WHITE_SPACE);
+				tok = strtok(tline, "=\n");
 
 				if (tok == NULL) {
 					/* Found empty line, write it out */
 					(void) fputs(menu_buf, tmp_menu_fp);
-				} else if (strcmp(tok, "default") == 0) {
+				} else if (strcmp(tok, "default_entry") == 0) {
 					/* Found the default line, adjust it */
 					(void) snprintf(tline, sizeof (tline),
-					    "default %d\n", default_entry);
+					    "default_entry=%d\n", default_entry);
 
 					(void) fputs(tline, tmp_menu_fp);
 				} else {
@@ -1187,11 +1238,11 @@
 	pool_mntpnt = NULL;
 
 	while (fgets(line, BUFSIZ, menu_fp)) {
-		char *tok = strtok(line, BE_WHITE_SPACE);
+		char *tok = strtok(line, "=\n");
 
 		if (tok != NULL && tok[0] != '#') {
 			if (!found_default) {
-				if (strcmp(tok, "default") == 0) {
+				if (strcmp(tok, "default_entry") == 0) {
 					tok = strtok(NULL, BE_WHITE_SPACE);
 					if (tok != NULL) {
 						default_entry = atoi(tok);
@@ -1201,10 +1252,10 @@
 				}
 				continue;
 			}
-			if (strcmp(tok, "title") == 0) {
+			if (strcmp(tok, "entry_name") == 0) {
 				entries++;
 			} else if (default_entry == entries - 1) {
-				if (strcmp(tok, "bootfs") == 0) {
+				if (strcmp(tok, "data_set") == 0) {
 					tok = strtok(NULL, BE_WHITE_SPACE);
 					(void) fclose(menu_fp);
 
@@ -1387,14 +1438,14 @@
 	}
 
 	while (fgets(line, BUFSIZ, grub_fp)) {
-		char *tok = strtok(line, BE_WHITE_SPACE);
+		char *tok = strtok(line, "=\n");
 
 		if (tok == NULL || tok[0] == '#') {
 			continue;
-		} else if (strcmp(tok, "title") == 0) {
+		} else if (strcmp(tok, "entry_name") == 0) {
 			entries++;
 			continue;
-		} else if (strcmp(tok, "bootfs") == 0) {
+		} else if (strcmp(tok, "data_set") == 0) {
 			char *bootfs = strtok(NULL, BE_WHITE_SPACE);
 			if (bootfs == NULL)
 				continue;
@@ -1416,16 +1467,16 @@
 
 	rewind(grub_fp);
 
+	(void) snprintf(temp_line, BUFSIZ, "default_entry=%d\n",
+	    entries - 1 >= 0 ? entries - 1 : 0);
+	(void) fputs(temp_line, temp_fp);
 	while (fgets(line, BUFSIZ, grub_fp)) {
 		char *tok = NULL;
 
 		(void) strncpy(temp_line, line, BUFSIZ);
 
-		if ((tok = strtok(temp_line, BE_WHITE_SPACE)) != NULL &&
-		    strcmp(tok, "default") == 0) {
-			(void) snprintf(temp_line, BUFSIZ, "default %d\n",
-			    entries - 1 >= 0 ? entries - 1 : 0);
-			(void) fputs(temp_line, temp_fp);
+		if ((tok = strtok(temp_line, "=\n")) != NULL &&
+		    strcmp(tok, "default_entry") == 0) {
 		} else {
 			(void) fputs(line, temp_fp);
 		}
@@ -1520,6 +1571,7 @@
 	int temp_menu_len = 0;
 	int tmp_fd;
 	int ret = BE_SUCCESS;
+	int flag = 0;
 	int err = 0;
 	boolean_t pool_mounted = B_FALSE;
 
@@ -1636,7 +1688,7 @@
 		(void) strlcpy(tline, line, sizeof (tline));
 
 		/* Tokenize line */
-		c = strtok(tline, BE_WHITE_SPACE);
+		c = strtok(tline, "=\n");
 
 		if (c == NULL) {
 			/* Found empty line, write it out. */
@@ -1644,7 +1696,7 @@
 		} else if (c[0] == '#') {
 			/* Found a comment line, write it out. */
 			(void) fputs(line, new_fp);
-		} else if (strcmp(c, "title") == 0) {
+		} else if (strcmp(c, "entry_name") == 0) {
 			char *name = NULL;
 			char *desc = NULL;
 
@@ -1652,6 +1704,7 @@
 			 * Found a 'title' line, parse out BE name or
 			 * the description.
 			 */
+			flag = 0;
 			name = strtok(NULL, BE_WHITE_SPACE);
 
 			if (name == NULL) {
@@ -1675,15 +1728,16 @@
 					 * along with the remainder of
 					 * description if there is one.
 					 */
+					++flag;
 					if (desc) {
 						(void) snprintf(new_line,
 						    sizeof (new_line),
-						    "title %s %s\n",
+						    "entry_name=%s %s\n",
 						    be_new_name, desc);
 					} else {
 						(void) snprintf(new_line,
 						    sizeof (new_line),
-						    "title %s\n", be_new_name);
+						    "entry_name=%s\n", be_new_name);
 					}
 
 					(void) fputs(new_line, new_fp);
@@ -1691,7 +1745,7 @@
 					(void) fputs(line, new_fp);
 				}
 			}
-		} else if (strcmp(c, "bootfs") == 0) {
+		} else if (strcmp(c, "data_set") == 0) {
 			/*
 			 * Found a 'bootfs' line, parse out the BE root
 			 * dataset value.
@@ -1710,8 +1764,9 @@
 				 * write out the new root dataset value
 				 */
 				if (strcmp(root_ds, be_root_ds) == 0) {
+					++flag;
 					(void) snprintf(new_line,
-					    sizeof (new_line), "bootfs %s\n",
+					    sizeof (new_line), "data_set=%s\n",
 					    be_new_root_ds);
 
 					(void) fputs(new_line, new_fp);
@@ -1853,10 +1908,10 @@
 	rpool_mntpnt = NULL;
 
 	while (fgets(line, BUFSIZ, menu_fp)) {
-		char *tok = strtok_r(line, BE_WHITE_SPACE, &last);
+		char *tok = strtok_r(line, "=\n", &last);
 
 		if (tok != NULL && tok[0] != '#') {
-			if (strcmp(tok, "bootfs") == 0) {
+			if (strcmp(tok, "data_set") == 0) {
 				tok = strtok_r(last, BE_WHITE_SPACE, &last);
 				if (tok != NULL && strcmp(tok,
 				    be_dataset) == 0) {
@@ -1873,7 +1928,7 @@
 					ret = B_TRUE;
 					goto cleanup;
 				}
-			} else if (strcmp(tok, "title") == 0)
+			} else if (strcmp(tok, "entry_name") == 0)
 				ent_num++;
 		}
 	}
@@ -3639,14 +3694,14 @@
 			if (strncmp(console, "text", strlen("text")) == 0 ||
 			    strncmp(console, "graphics",
 			    strlen("graphics")) == 0) {
-
+/*
 				(void) fprintf(temp_fp, "%s\n", BE_GRUB_SPLASH);
 				(void) fprintf(temp_fp, "%s\n",
 				    BE_GRUB_FOREGROUND);
 				(void) fprintf(temp_fp, "%s\n",
 				    BE_GRUB_BACKGROUND);
 				(void) fprintf(temp_fp, "%s\n",
-				    BE_GRUB_DEFAULT);
+				    BE_GRUB_DEFAULT);*/
 			} else {
 				be_print_err(gettext("be_create_menu: "
 				    "console on serial line, "
@@ -3654,7 +3709,7 @@
 			}
 		}
 
-		(void) fprintf(temp_fp,	"timeout 30\n");
+		(void) fprintf(temp_fp,	"timeout=30\n");
 		(void) fclose(temp_fp);
 
 	} else {
