[U-Boot-Users] [Patch] cmdbootz

Robert Schwebel robert at schwebel.de
Thu May 13 16:36:23 CEST 2004


[Note: command number assumes that the cmdximg patch was added before,
please re-adapt otherwhise]

ChageLog:

* Patch by Holger Schurig, Robert Schwebel, 13 May 2004:
  Add a 'bootz' command to boot normal Linux zImages in
  case you don't need the features of U-Boot's uImage. 

Robert
-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hornemannstraße 12,  31137 Hildesheim, Germany
    Phone: +49-5121-28619-0 |  Fax: +49-5121-28619-4
-------------- next part --------------
# 
# Author:	Robert Schwebel <r.schwebel at pengutronix.de>
# 
# Description:	Changelog Entry:
#
#		* Patch by Holger Schurig, Robert Schwebel, 13 May 2004:
#		  Add a 'bootz' command to boot normal Linux zImages in
#		  case you don't need the features of U-Boot's uImage. 
#
# State:	2004-05-13: submit
#

#
# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
#

--- /dev/null	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-maintainance1/include/cmd_bootz.h	2004-05-13 08:35:03.000000000 +0200
@@ -0,0 +1,38 @@
+/*
+ * (C) Copyright 2003
+ * Holger Schurig, M&N Logistik-Loesungen Online GmbH, <h.schurig at mn...>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * Linux zImage Boot support
+ */
+#ifndef       _CMD_BOOTZ_H
+#define       _CMD_BOOTZ_H
+int do_bootz(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]);
+
+#define       CMD_TBL_BOOTZ   MK_CMD_TBL_ENTRY(				\
+      "bootz",        5,      CFG_MAXARGS,    1,      do_bootz,               \
+      "bootz   - boot Linux zImage from memory\n",                            \
+      "[addr [arg ...]]\n    - boot zImage stored in memory\n"                \
+      "        passing arguments 'arg ...'\n"                                 \
+),
+
+#endif				/* _CMD_BOOTZ_H */
--- u-boot-maintainance1/include/cmd_confdefs.h~cmdbootz	2004-05-13 08:31:20.000000000 +0200
+++ u-boot-maintainance1/include/cmd_confdefs.h	2004-05-13 08:33:54.000000000 +0200
@@ -90,6 +90,7 @@
 #define CFG_CMD_REISER  0x0100000000000000U     /* Reiserfs support		*/
 #define CFG_CMD_CDP	0x0200000000000000U	/* Cisco Discovery Protocol 	*/
 #define CFG_CMD_XIMG	0x0400000000000000U	/* Load part of Multi Image     */
+#define CFG_CMD_BOOTZ	0x0800000000000000U	/* directly boot Linux zImage   */
 
 #define CFG_CMD_ALL	0xFFFFFFFFFFFFFFFFU	/* ALL commands			*/
 
--- /dev/null	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-maintainance1/common/cmd_bootz.c	2004-05-13 08:34:29.000000000 +0200
@@ -0,0 +1,100 @@
+/*
+ * (C) Copyright 2003
+ * Holger Schurig, M&N Logistik-Loesungen Online GmbH, <h.schurig at mn...>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * Linux zImage boot support
+ */
+#include <common.h>
+#include <command.h>
+#include <tag.h>
+#include <asm/byteorder.h>
+
+#define DEBUG
+
+#ifdef CONFIG_SHOW_BOOT_PROGRESS
+# include <status_led.h>
+# define SHOW_BOOT_PROGRESS(arg)        show_boot_progress(arg)
+#else
+# define SHOW_BOOT_PROGRESS(arg)
+#endif
+
+#define CONFIG_KERNEL_RAM_BASE 0x40000
+
+int
+do_bootz(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
+{
+	DECLARE_GLOBAL_DATA_PTR;
+
+	ulong addr = 0x40000;
+	ulong initrd_start = 0;
+	ulong initrd_end = 0;
+	ulong data;
+	void (*theKernel) (int zero, int arch, struct tag * params);
+	bd_t *bd = gd->bd;
+#ifdef CONFIG_CMDLINE_TAG
+	char *commandline = getenv("bootargs");
+#endif
+	addr = simple_strtoul(argv[1], NULL, 16);
+
+	theKernel = (void (*)(int, int, struct tag *)) addr;
+
+	SHOW_BOOT_PROGRESS(14);
+
+#ifdef DEBUG
+	printf("## Transferring control to Linux (at address %08lx) ...\n",
+	       (ulong) theKernel);
+#endif
+
+#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
+    defined (CONFIG_CMDLINE_TAG) || \
+    defined (CONFIG_INITRD_TAG) || \
+    defined (CONFIG_VFD)
+	setup_start_tag(bd);
+#ifdef CONFIG_SETUP_MEMORY_TAGS
+	setup_memory_tags(bd);
+#endif
+#ifdef CONFIG_CMDLINE_TAG
+	setup_commandline_tag(bd, commandline);
+#endif
+#ifdef CONFIG_INITRD_TAG
+	setup_initrd_tag(bd, initrd_start, initrd_end);
+#endif
+#if 0
+	setup_ramdisk_tag(bd);
+#endif
+#if defined (CONFIG_VFD)
+	setup_videolfb_tag(gd);
+#endif
+	setup_end_tag(bd);
+#endif
+
+	/* we assume that the kernel is in place */
+	printf("\nStarting kernel ...\n\n");
+
+	cleanup_before_linux();
+
+	theKernel(0, bd->bi_arch_number, params);
+
+	printf("ERROR: we should never come to this place ...\n\n");
+	return 0;
+}


More information about the U-Boot mailing list