diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index b059336..2de1329 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -44,11 +44,6 @@
 #include <ft_build.h>
 #endif
 
-DECLARE_GLOBAL_DATA_PTR;
-
-/*cmd_boot.c*/
-extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
-
 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
 #include <rtc.h>
 #endif
@@ -61,7 +56,12 @@
 #include <dataflash.h>
 #endif
 
-int  gunzip (void *, int, unsigned char *, unsigned long *);
+DECLARE_GLOBAL_DATA_PTR;
+
+extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
+#ifndef CFG_BOOTM_LEN
+#define CFG_BOOTM_LEN	0x800000	/* use 8MByte as default max gunzip size */
+#endif
 
 #ifdef CONFIG_BZIP2
 extern void bz_internal_error(int);
@@ -77,7 +77,12 @@
 static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 #endif
 
+#ifdef CONFIG_SILENT_CONSOLE
+static void fixup_silent_linux (void);
+#endif
+
 static void print_type (image_header_t *hdr);
+extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
 /*
  *  Continue booting an OS image; caller already has:
@@ -87,41 +92,38 @@
  *  - loaded (first part of) image to header load address,
  *  - disabled interrupts.
  */
-typedef void boot_os_Fcn (cmd_tbl_t *cmdtp, int flag,
-			  int	argc, char *argv[],
-			  ulong	addr,		/* of image to boot */
-			  ulong	*len_ptr,	/* multi-file image length table */
-			  int	verify);	/* getenv("verify")[0] != 'n' */
+typedef void boot_os_fn (cmd_tbl_t *cmdtp, int flag,
+			int	argc, char *argv[],
+			ulong	addr,		/* of image to boot */
+			ulong	*len_ptr,	/* multi-file image length table */
+			int	verify);	/* getenv("verify")[0] != 'n' */
 
-extern boot_os_Fcn do_bootm_linux;
-
-#ifdef CONFIG_SILENT_CONSOLE
-static void fixup_silent_linux (void);
+extern boot_os_fn do_bootm_linux;
+static boot_os_fn do_bootm_netbsd;
+#ifdef CONFIG_LYNXKDI
+static boot_os_fn do_bootm_lynxkdi;
+extern void lynxkdi_boot (image_header_t *);
 #endif
-static boot_os_Fcn do_bootm_netbsd;
-static boot_os_Fcn do_bootm_rtems;
+static boot_os_fn do_bootm_rtems;
 #if defined(CONFIG_CMD_ELF)
-static boot_os_Fcn do_bootm_vxworks;
-static boot_os_Fcn do_bootm_qnxelf;
-int do_bootvx ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
-int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] );
+static boot_os_fn do_bootm_vxworks;
+static boot_os_fn do_bootm_qnxelf;
+int do_bootvx (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 #endif
 #if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
-static boot_os_Fcn do_bootm_artos;
-#endif
-#ifdef CONFIG_LYNXKDI
-static boot_os_Fcn do_bootm_lynxkdi;
-extern void lynxkdi_boot( image_header_t * );
-#endif
-
-#ifndef CFG_BOOTM_LEN
-#define CFG_BOOTM_LEN	0x800000	/* use 8MByte as default max gunzip size */
+extern uchar (*env_get_char)(int); /* Returns a character from the environment */
+static boot_os_fn do_bootm_artos;
 #endif
 
 image_header_t header;
 
-ulong load_addr = CFG_LOAD_ADDR;		/* Default Load Address */
+ulong load_addr = CFG_LOAD_ADDR;	/* Default Load Address */
 
+
+/*******************************************************************/
+/* bootm - boot application image from image in memory */
+/*******************************************************************/
 int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	ulong	iflag;
@@ -175,7 +177,6 @@
 	}
 #endif
 
-
 	/* for multi-file images we need the data part, too */
 	print_image_hdr ((image_header_t *)addr);
 
@@ -220,7 +221,8 @@
 		for (i=1; len_ptr[i]; ++i)
 			data += 4;
 		break;
-	default: printf ("Wrong Image Type for %s command\n", cmdtp->name);
+	default:
+		printf ("Wrong Image Type for %s command\n", cmdtp->name);
 		show_boot_progress (-5);
 		return 1;
 	}
@@ -231,7 +233,6 @@
 	 * overwrite all exception vector code, so we cannot easily
 	 * recover from any failures any more...
 	 */
-
 	iflag = disable_interrupts();
 
 #ifdef CONFIG_AMIGAONEG3SE
@@ -334,6 +335,7 @@
 	    do_bootm_linux  (cmdtp, flag, argc, argv,
 			     addr, len_ptr, verify);
 	    break;
+
 	case IH_OS_NETBSD:
 	    do_bootm_netbsd (cmdtp, flag, argc, argv,
 			     addr, len_ptr, verify);
@@ -361,6 +363,7 @@
 			      addr, len_ptr, verify);
 	    break;
 #endif
+
 #ifdef CONFIG_ARTOS
 	case IH_OS_ARTOS:
 	    do_bootm_artos  (cmdtp, flag, argc, argv,
@@ -378,11 +381,11 @@
 }
 
 U_BOOT_CMD(
- 	bootm,	CFG_MAXARGS,	1,	do_bootm,
- 	"bootm   - boot application image from memory\n",
- 	"[addr [arg ...]]\n    - boot application image stored in memory\n"
- 	"\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
- 	"\t'arg' can be the address of an initrd image\n"
+	bootm,	CFG_MAXARGS,	1,	do_bootm,
+	"bootm   - boot application image from memory\n",
+	"[addr [arg ...]]\n    - boot application image stored in memory\n"
+	"\tpassing arguments 'arg ...'; when booting a Linux kernel,\n"
+	"\t'arg' can be the address of an initrd image\n"
 #if defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)
 	"\tWhen booting a Linux kernel which requires a flat device-tree\n"
 	"\ta third argument is required which is the address of the\n"
@@ -392,251 +395,59 @@
 #endif
 );
 
-#ifdef CONFIG_SILENT_CONSOLE
-static void
-fixup_silent_linux ()
-{
-	char buf[256], *start, *end;
-	char *cmdline = getenv ("bootargs");
-
-	/* Only fix cmdline when requested */
-	if (!(gd->flags & GD_FLG_SILENT))
-		return;
-
-	debug ("before silent fix-up: %s\n", cmdline);
-	if (cmdline) {
-		if ((start = strstr (cmdline, "console=")) != NULL) {
-			end = strchr (start, ' ');
-			strncpy (buf, cmdline, (start - cmdline + 8));
-			if (end)
-				strcpy (buf + (start - cmdline + 8), end);
-			else
-				buf[start - cmdline + 8] = '\0';
-		} else {
-			strcpy (buf, cmdline);
-			strcat (buf, " console=");
-		}
-	} else {
-		strcpy (buf, "console=");
-	}
-
-	setenv ("bootargs", buf);
-	debug ("after silent fix-up: %s\n", buf);
-}
-#endif /* CONFIG_SILENT_CONSOLE */
-
-static void
-do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag,
-		int	argc, char *argv[],
-		ulong	addr,
-		ulong	*len_ptr,
-		int	verify)
-{
-	image_header_t *hdr = &header;
-
-	void	(*loader)(bd_t *, image_header_t *, char *, char *);
-	image_header_t *img_addr;
-	char     *consdev;
-	char     *cmdline;
-
-
-	/*
-	 * Booting a (NetBSD) kernel image
-	 *
-	 * This process is pretty similar to a standalone application:
-	 * The (first part of an multi-) image must be a stage-2 loader,
-	 * which in turn is responsible for loading & invoking the actual
-	 * kernel.  The only differences are the parameters being passed:
-	 * besides the board info strucure, the loader expects a command
-	 * line, the name of the console device, and (optionally) the
-	 * address of the original image header.
-	 */
-
-	img_addr = 0;
-	if ((image_check_type (hdr, IH_TYPE_MULTI)) && (len_ptr[1]))
-		img_addr = (image_header_t *) addr;
-
-
-	consdev = "";
-#if   defined (CONFIG_8xx_CONS_SMC1)
-	consdev = "smc1";
-#elif defined (CONFIG_8xx_CONS_SMC2)
-	consdev = "smc2";
-#elif defined (CONFIG_8xx_CONS_SCC2)
-	consdev = "scc2";
-#elif defined (CONFIG_8xx_CONS_SCC3)
-	consdev = "scc3";
-#endif
-
-	if (argc > 2) {
-		ulong len;
-		int   i;
-
-		for (i=2, len=0 ; i<argc ; i+=1)
-			len += strlen (argv[i]) + 1;
-		cmdline = malloc (len);
-
-		for (i=2, len=0 ; i<argc ; i+=1) {
-			if (i > 2)
-				cmdline[len++] = ' ';
-			strcpy (&cmdline[len], argv[i]);
-			len += strlen (argv[i]);
-		}
-	} else if ((cmdline = getenv("bootargs")) == NULL) {
-		cmdline = "";
-	}
-
-	loader = (void (*)(bd_t *, image_header_t *, char *, char *))image_get_ep (hdr);
-
-	printf ("## Transferring control to NetBSD stage-2 loader (at address %08lx) ...\n",
-		(ulong)loader);
-
-	show_boot_progress (15);
-
-	/*
-	 * NetBSD Stage-2 Loader Parameters:
-	 *   r3: ptr to board info data
-	 *   r4: image address
-	 *   r5: console device
-	 *   r6: boot args string
-	 */
-	(*loader) (gd->bd, img_addr, consdev, cmdline);
-}
-
-#if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
-
-/* Function that returns a character from the environment */
-extern uchar (*env_get_char)(int);
-
-static void
-do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
-		int	argc, char *argv[],
-		ulong	addr,
-		ulong	*len_ptr,
-		int	verify)
-{
-	ulong top;
-	char *s, *cmdline;
-	char **fwenv, **ss;
-	int i, j, nxt, len, envno, envsz;
-	bd_t *kbd;
-	void (*entry)(bd_t *bd, char *cmdline, char **fwenv, ulong top);
-	image_header_t *hdr = &header;
-
-	/*
-	 * Booting an ARTOS kernel image + application
-	 */
-
-	/* this used to be the top of memory, but was wrong... */
-#ifdef CONFIG_PPC
-	/* get stack pointer */
-	asm volatile ("mr %0,1" : "=r"(top) );
-#endif
-	debug ("## Current stack ends at 0x%08lX ", top);
-
-	top -= 2048;		/* just to be sure */
-	if (top > CFG_BOOTMAPSZ)
-		top = CFG_BOOTMAPSZ;
-	top &= ~0xF;
-
-	debug ("=> set upper limit to 0x%08lX\n", top);
-
-	/* first check the artos specific boot args, then the linux args*/
-	if ((s = getenv("abootargs")) == NULL && (s = getenv("bootargs")) == NULL)
-		s = "";
-
-	/* get length of cmdline, and place it */
-	len = strlen(s);
-	top = (top - (len + 1)) & ~0xF;
-	cmdline = (char *)top;
-	debug ("## cmdline at 0x%08lX ", top);
-	strcpy(cmdline, s);
-
-	/* copy bdinfo */
-	top = (top - sizeof(bd_t)) & ~0xF;
-	debug ("## bd at 0x%08lX ", top);
-	kbd = (bd_t *)top;
-	memcpy(kbd, gd->bd, sizeof(bd_t));
-
-	/* first find number of env entries, and their size */
-	envno = 0;
-	envsz = 0;
-	for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
-		for (nxt = i; env_get_char(nxt) != '\0'; ++nxt)
-			;
-		envno++;
-		envsz += (nxt - i) + 1;	/* plus trailing zero */
-	}
-	envno++;	/* plus the terminating zero */
-	debug ("## %u envvars total size %u ", envno, envsz);
-
-	top = (top - sizeof(char **)*envno) & ~0xF;
-	fwenv = (char **)top;
-	debug ("## fwenv at 0x%08lX ", top);
-
-	top = (top - envsz) & ~0xF;
-	s = (char *)top;
-	ss = fwenv;
-
-	/* now copy them */
-	for (i = 0; env_get_char(i) != '\0'; i = nxt + 1) {
-		for (nxt = i; env_get_char(nxt) != '\0'; ++nxt)
-			;
-		*ss++ = s;
-		for (j = i; j < nxt; ++j)
-			*s++ = env_get_char(j);
-		*s++ = '\0';
-	}
-	*ss++ = NULL;	/* terminate */
-
-	entry = (void (*)(bd_t *, char *, char **, ulong))image_get_ep (hdr);
-	(*entry)(kbd, cmdline, fwenv, top);
-}
-#endif
-
-
+/*******************************************************************/
+/* bootd - boot default image */
+/*******************************************************************/
 #if defined(CONFIG_CMD_BOOTD)
 int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	int rcode = 0;
+
 #ifndef CFG_HUSH_PARSER
-	if (run_command (getenv ("bootcmd"), flag) < 0) rcode = 1;
+	if (run_command (getenv ("bootcmd"), flag) < 0)
+		rcode = 1;
 #else
-	if (parse_string_outer(getenv("bootcmd"),
-		FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0 ) rcode = 1;
+	if (parse_string_outer (getenv ("bootcmd"),
+			FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0)
+		rcode = 1;
 #endif
 	return rcode;
 }
 
 U_BOOT_CMD(
- 	boot,	1,	1,	do_bootd,
- 	"boot    - boot default, i.e., run 'bootcmd'\n",
+	boot,	1,	1,	do_bootd,
+	"boot    - boot default, i.e., run 'bootcmd'\n",
 	NULL
 );
 
 /* keep old command name "bootd" for backward compatibility */
 U_BOOT_CMD(
- 	bootd, 1,	1,	do_bootd,
- 	"bootd   - boot default, i.e., run 'bootcmd'\n",
+	bootd, 1,	1,	do_bootd,
+	"bootd   - boot default, i.e., run 'bootcmd'\n",
 	NULL
 );
 
 #endif
 
+
+/*******************************************************************/
+/* iminfo - print header info for a requested image */
+/*******************************************************************/
 #if defined(CONFIG_CMD_IMI)
-int do_iminfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_iminfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	int	arg;
 	ulong	addr;
-	int     rcode=0;
+	int	rcode = 0;
 
 	if (argc < 2) {
 		return image_info (load_addr);
 	}
 
-	for (arg=1; arg <argc; ++arg) {
-		addr = simple_strtoul(argv[arg], NULL, 16);
-		if (image_info (addr) != 0) rcode = 1;
+	for (arg = 1; arg < argc; ++arg) {
+		addr = simple_strtoul (argv[arg], NULL, 16);
+		if (image_info (addr) != 0)
+			rcode = 1;
 	}
 	return rcode;
 }
@@ -676,23 +487,25 @@
 	"      address 'addr' in memory; this includes verification of the\n"
 	"      image contents (magic number, header and payload checksums)\n"
 );
-
 #endif
 
+
+/*******************************************************************/
+/* imls - list all images found in flash */
+/*******************************************************************/
 #if defined(CONFIG_CMD_IMLS)
-/*-----------------------------------------------------------------------
- * List all images found in flash.
- */
 int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	flash_info_t *info;
 	int i, j;
 	image_header_t *hdr;
 
-	for (i=0, info=&flash_info[0]; i<CFG_MAX_FLASH_BANKS; ++i, ++info) {
+	for (i = 0, info = &flash_info[0];
+		i < CFG_MAX_FLASH_BANKS; ++i, ++info) {
+
 		if (info->flash_id == FLASH_UNKNOWN)
 			goto next_bank;
-		for (j=0; j<info->sector_count; ++j) {
+		for (j = 0; j < info->sector_count; ++j) {
 
 			hdr = (image_header_t *)info->start[j];
 
@@ -728,8 +541,10 @@
 );
 #endif
 
-void
-print_image_hdr (image_header_t *hdr)
+/*******************************************************************/
+/* */
+/*******************************************************************/
+void print_image_hdr (image_header_t *hdr)
 {
 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
 	time_t timestamp = (time_t)image_get_time (hdr);
@@ -737,13 +552,16 @@
 #endif
 
 	printf ("   Image Name:   %.*s\n", IH_NMLEN, image_get_name (hdr));
+
 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
 	to_tm (timestamp, &tm);
 	printf ("   Created:      %4d-%02d-%02d  %2d:%02d:%02d UTC\n",
 		tm.tm_year, tm.tm_mon, tm.tm_mday,
 		tm.tm_hour, tm.tm_min, tm.tm_sec);
 #endif
-	puts ("   Image Type:   "); print_type(hdr);
+	puts ("   Image Type:   ");
+	print_type (hdr);
+
 	printf ("\n   Data Size:    %d Bytes = ", image_get_data_size (hdr));
 	print_size (image_get_data_size (hdr), "\n");
 	printf ("   Load Address: %08x\n"
@@ -756,16 +574,14 @@
 		ulong *len_ptr = (ulong *)((ulong)hdr + image_get_header_size ());
 
 		puts ("   Contents:\n");
-		for (i=0; (len = image_to_cpu (*len_ptr)); ++i, ++len_ptr) {
+		for (i = 0; (len = image_to_cpu (*len_ptr)); ++i, ++len_ptr) {
 			printf ("   Image %d: %8ld Bytes = ", i, len);
 			print_size (len, "\n");
 		}
 	}
 }
 
-
-static void
-print_type (image_header_t *hdr)
+static void print_type (image_header_t *hdr)
 {
 	char *os, *arch, *type, *comp;
 
@@ -830,12 +646,134 @@
 	printf ("%s %s %s (%s)", arch, os, type, comp);
 }
 
-static void
-do_bootm_rtems (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
-		ulong addr, ulong *len_ptr, int verify)
+#ifdef CONFIG_SILENT_CONSOLE
+static void fixup_silent_linux ()
+{
+	char buf[256], *start, *end;
+	char *cmdline = getenv ("bootargs");
+
+	/* Only fix cmdline when requested */
+	if (!(gd->flags & GD_FLG_SILENT))
+		return;
+
+	debug ("before silent fix-up: %s\n", cmdline);
+	if (cmdline) {
+		if ((start = strstr (cmdline, "console=")) != NULL) {
+			end = strchr (start, ' ');
+			strncpy (buf, cmdline, (start - cmdline + 8));
+			if (end)
+				strcpy (buf + (start - cmdline + 8), end);
+			else
+				buf[start - cmdline + 8] = '\0';
+		} else {
+			strcpy (buf, cmdline);
+			strcat (buf, " console=");
+		}
+	} else {
+		strcpy (buf, "console=");
+	}
+
+	setenv ("bootargs", buf);
+	debug ("after silent fix-up: %s\n", buf);
+}
+#endif /* CONFIG_SILENT_CONSOLE */
+
+
+/*******************************************************************/
+/* OS booting routines */
+/*******************************************************************/
+
+static void do_bootm_netbsd (cmd_tbl_t *cmdtp, int flag,
+			     int argc, char *argv[],
+			     ulong addr, ulong *len_ptr,
+			     int verify)
 {
 	image_header_t *hdr = &header;
-	void	(*entry_point)(bd_t *);
+
+	void (*loader)(bd_t *, image_header_t *, char *, char *);
+	image_header_t *img_addr;
+	char *consdev;
+	char *cmdline;
+
+	/*
+	 * Booting a (NetBSD) kernel image
+	 *
+	 * This process is pretty similar to a standalone application:
+	 * The (first part of an multi-) image must be a stage-2 loader,
+	 * which in turn is responsible for loading & invoking the actual
+	 * kernel.  The only differences are the parameters being passed:
+	 * besides the board info strucure, the loader expects a command
+	 * line, the name of the console device, and (optionally) the
+	 * address of the original image header.
+	 */
+
+	img_addr = 0;
+	if ((image_check_type (hdr, IH_TYPE_MULTI)) && (len_ptr[1]))
+		img_addr = (image_header_t *)addr;
+
+	consdev = "";
+#if   defined (CONFIG_8xx_CONS_SMC1)
+	consdev = "smc1";
+#elif defined (CONFIG_8xx_CONS_SMC2)
+	consdev = "smc2";
+#elif defined (CONFIG_8xx_CONS_SCC2)
+	consdev = "scc2";
+#elif defined (CONFIG_8xx_CONS_SCC3)
+	consdev = "scc3";
+#endif
+
+	if (argc > 2) {
+		ulong len;
+		int   i;
+
+		for (i = 2, len = 0; i < argc; i += 1)
+			len += strlen (argv[i]) + 1;
+		cmdline = malloc (len);
+
+		for (i = 2, len = 0; i < argc; i += 1) {
+			if (i > 2)
+				cmdline[len++] = ' ';
+			strcpy (&cmdline[len], argv[i]);
+			len += strlen (argv[i]);
+		}
+	} else if ((cmdline = getenv ("bootargs")) == NULL) {
+		cmdline = "";
+	}
+
+	loader = (void (*)(bd_t *, image_header_t *, char *, char *))image_get_ep (hdr);
+
+	printf ("## Transferring control to NetBSD stage-2 loader (at address %08lx) ...\n",
+		(ulong)loader);
+
+	show_boot_progress (15);
+
+	/*
+	 * NetBSD Stage-2 Loader Parameters:
+	 *   r3: ptr to board info data
+	 *   r4: image address
+	 *   r5: console device
+	 *   r6: boot args string
+	 */
+	(*loader) (gd->bd, img_addr, consdev, cmdline);
+}
+
+#ifdef CONFIG_LYNXKDI
+static void do_bootm_lynxkdi (cmd_tbl_t *cmdtp, int flag,
+			     int argc, char *argv[],
+			     ulong addr, ulong *len_ptr,
+			     int verify)
+{
+	lynxkdi_boot (&header);
+}
+#endif /* CONFIG_LYNXKDI */
+
+static void do_bootm_rtems (cmd_tbl_t *cmdtp, int flag,
+			   int argc, char *argv[],
+		           ulong addr, ulong *len_ptr,
+			   int verify)
+{
+	image_header_t *hdr = &header;
+	void (*entry_point)(bd_t *);
 
 	entry_point = (void (*)(bd_t *))image_get_ep (hdr);
 
@@ -848,14 +786,14 @@
 	 * RTEMS Parameters:
 	 *   r3: ptr to board info data
 	 */
-
-	(*entry_point ) ( gd->bd );
+	(*entry_point)(gd->bd);
 }
 
 #if defined(CONFIG_CMD_ELF)
-static void
-do_bootm_vxworks (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
-		  ulong addr, ulong *len_ptr, int verify)
+static void do_bootm_vxworks (cmd_tbl_t *cmdtp, int flag,
+			     int argc, char *argv[],
+			     ulong addr, ulong *len_ptr,
+			     int verify)
 {
 	image_header_t *hdr = &header;
 	char str[80];
@@ -865,9 +803,10 @@
 	do_bootvx(cmdtp, 0, 0, NULL);
 }
 
-static void
-do_bootm_qnxelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
-		 ulong addr, ulong *len_ptr, int verify)
+static void do_bootm_qnxelf (cmd_tbl_t *cmdtp, int flag,
+			     int argc, char *argv[],
+			     ulong addr, ulong *len_ptr,
+			     int verify)
 {
 	image_header_t *hdr = &header;
 	char *local_args[2];
@@ -880,15 +819,87 @@
 }
 #endif
 
-#ifdef CONFIG_LYNXKDI
-static void
-do_bootm_lynxkdi (cmd_tbl_t *cmdtp, int flag,
-		 int	argc, char *argv[],
-		 ulong	addr,
-		 ulong	*len_ptr,
-		 int	verify)
+#if defined(CONFIG_ARTOS) && defined(CONFIG_PPC)
+static void do_bootm_artos (cmd_tbl_t *cmdtp, int flag,
+			   int argc, char *argv[],
+			   ulong addr, ulong *len_ptr,
+			   int verify)
 {
-	lynxkdi_boot( &header );
-}
+	ulong top;
+	char *s, *cmdline;
+	char **fwenv, **ss;
+	int i, j, nxt, len, envno, envsz;
+	bd_t *kbd;
+	void (*entry)(bd_t *bd, char *cmdline, char **fwenv, ulong top);
+	image_header_t *hdr = &header;
 
-#endif /* CONFIG_LYNXKDI */
+	/*
+	 * Booting an ARTOS kernel image + application
+	 */
+
+	/* this used to be the top of memory, but was wrong... */
+#ifdef CONFIG_PPC
+	/* get stack pointer */
+	asm volatile ("mr %0,1" : "=r"(top) );
+#endif
+	debug ("## Current stack ends at 0x%08lX ", top);
+
+	top -= 2048;		/* just to be sure */
+	if (top > CFG_BOOTMAPSZ)
+		top = CFG_BOOTMAPSZ;
+	top &= ~0xF;
+
+	debug ("=> set upper limit to 0x%08lX\n", top);
+
+	/* first check the artos specific boot args, then the linux args*/
+	if ((s = getenv( "abootargs")) == NULL && (s = getenv ("bootargs")) == NULL)
+		s = "";
+
+	/* get length of cmdline, and place it */
+	len = strlen (s);
+	top = (top - (len + 1)) & ~0xF;
+	cmdline = (char *)top;
+	debug ("## cmdline at 0x%08lX ", top);
+	strcpy (cmdline, s);
+
+	/* copy bdinfo */
+	top = (top - sizeof (bd_t)) & ~0xF;
+	debug ("## bd at 0x%08lX ", top);
+	kbd = (bd_t *)top;
+	memcpy (kbd, gd->bd, sizeof (bd_t));
+
+	/* first find number of env entries, and their size */
+	envno = 0;
+	envsz = 0;
+	for (i = 0; env_get_char (i) != '\0'; i = nxt + 1) {
+		for (nxt = i; env_get_char (nxt) != '\0'; ++nxt)
+			;
+		envno++;
+		envsz += (nxt - i) + 1;	/* plus trailing zero */
+	}
+	envno++;	/* plus the terminating zero */
+	debug ("## %u envvars total size %u ", envno, envsz);
+
+	top = (top - sizeof (char **) * envno) & ~0xF;
+	fwenv = (char **)top;
+	debug ("## fwenv at 0x%08lX ", top);
+
+	top = (top - envsz) & ~0xF;
+	s = (char *)top;
+	ss = fwenv;
+
+	/* now copy them */
+	for (i = 0; env_get_char (i) != '\0'; i = nxt + 1) {
+		for (nxt = i; env_get_char (nxt) != '\0'; ++nxt)
+			;
+		*ss++ = s;
+		for (j = i; j < nxt; ++j)
+			*s++ = env_get_char (j);
+		*s++ = '\0';
+	}
+	*ss++ = NULL;	/* terminate */
+
+	entry = (void (*)(bd_t *, char *, char **, ulong))image_get_ep (hdr);
+	(*entry) (kbd, cmdline, fwenv, top);
+}
+#endif
