2/4: bootz command
PATCH 1/1 2/4: bootz command
Hi,
Some time ago Holger Schurig has sent a command to boot normal zImages. Here's the patch against current CVS.
Robert
Signature · 169 lines
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Braunschweiger Str. 79, 31134 Hildesheim, Germany
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4
-------------- next part --------------
diff -x ptx-patches -x CVS -urN u-boot/include/cmd_confdefs.h u-boot-ptx/include/cmd_confdefs.h
--- u-boot/include/cmd_confdefs.h 2003-06-14 15:47:58.000000000 +0200
+++ u-boot-ptx/include/cmd_confdefs.h 2003-06-14 17:11:39.000000000 +0200
@@ -82,6 +82,7 @@
#define CFG_CMD_BMP 0x0001000000000000 /* BMP support */
#define CFG_CMD_PORTIO 0x0002000000000000 /* Port I/O */
#define CFG_CMD_PING 0x0004000000000000 /* ping support */
+#define CFG_CMD_BOOTZ 0x0008000000000000 /* directly boot Linux zImage */
#define CFG_CMD_ALL 0xFFFFFFFFFFFFFFFF /* ALL commands */
-------------- next part --------------
diff -x ptx-patches -x CVS -urN u-boot/include/cmd_bootz.h u-boot-ptx/include/cmd_bootz.h
--- u-boot/include/cmd_bootz.h 1970-01-01 01:00:00.000000000 +0100
+++ u-boot-ptx/include/cmd_bootz.h 2003-06-14 16:43:44.000000000 +0200
@@ -0,0 +1,38 @@
+/*
+ * (C) Copyright 2003
+ * Holger Schurig, M&N Logistik-L?sungen Online GmbH, <h.schurig@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 */
-------------- next part --------------
This command to load a zImage directly into u-Boot was submitted by
Holger Schurig some time ago.
diff -x ptx-patches -x CVS -urN u-boot/common/cmd_bootz.c u-boot-ptx/common/cmd_bootz.c
--- u-boot/common/cmd_bootz.c 1970-01-01 01:00:00.000000000 +0100
+++ u-boot-ptx/common/cmd_bootz.c 2003-06-14 16:43:44.000000000 +0200
@@ -0,0 +1,101 @@
+/*
+ * (C) Copyright 2003
+ * Holger Schurig, M&N Logistik-Loesungen Online GmbH, <h.schurig@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>
+//#include <asm/setup.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;
+}Quoted 3 lines · In message <[email protected]> you wrote:
Some time ago Holger Schurig has sent a command to boot normal zImages. Here's the patch against current CVS.
This needs to be cleaned up first.
And please, submit as a single patch!
Quoted 2 lines
include/cmd_bootz.h +0
-0
...
Quoted 1 line
+ ulong addr =
0x40000;
Please do not use any magic hardwired constants.
Can we use existent logic again, i. e. load_addr ?
Quoted 36 lines
include/cmd_bootz.h +36
-0+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
include/cmd_bootz.h
Quoted 10 lines
include/cmd_bootz.h +10
-0+#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 ();
Did this really compile for any PowerPC or MIPS board?
On PowerPC, there is neither a header file "tag.h" nor acleanup_before_linux() function...
Please don't submit untested code!
Also, all of this is just dead code, as you don't add an entry to the commands table.
And you don't add the files to any Makefile, either.
Sorry, but I can only reject this.
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de I haven't lost my mind -- it's backed up on tape somewhere.
Quoted 3 lines
Quoted 1 line
+ ulong addr =
0x40000;Please do not use any magic hardwired constants. Can we use existent logic again, i. e.
load_addr?
You can blame me for this. I did not run over load_addr so far.
Quoted 1 line
Did this really compile for any PowerPC or MIPS board?
No idea. I will not go and install various cross-compilers for board I don't have and where I don't even have the URL for the cross-compiler to download from. For now, it's an arm-only patch as long as no one from the PPC/MIPS/Whatever community needs it.
After all, there is already arm-only code in u-boot, e.g. the code from arm_lib/* that I used.
Quoted 2 lines
On PowerPC, there is neither a header file "
tag.h" nor acleanup_before_linux()function...
The tag.h is a file that I made. Wasn't it part of my original patch?
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 3 lines
Quoted 1 line
+ ulong addr =
0x40000;Please do not use any magic hardwired constants. Can we use existent logic again, i. e.
load_addr?You can blame me for this. I did not run over
load_addrso far.
I don;t blame anybody for anything. My only interest is to get working code.
Quoted 4 lines
Quoted 1 line
Did this really compile for any PowerPC or MIPS board?
No idea. I will not go and install various cross-compilers for board I don't have and where I don't even have the URL for the cross-compiler to download
You can download the ELDK (for ARM, PowerPC and MIPS) from
ftp://ftp.leo.org/pub/eldk/
Quoted 2 lines
from. For now, it's an arm-only patch as long as no one from the PPC/MIPS/Whatever community needs it.
Robert submitted it as a standard patch, hooking into the common command code, without any indication that this might be ARM only. Also, there is no need to make this ARM only - I don't see any inherent dependency on the platform.
Quoted 2 lines
After all, there is already arm-only code in u-boot, e.g. the code from arm_lib/* that I used.
But this is a different issue.
Quoted 4 lines
Quoted 2 lines
On PowerPC, there is neither a header file "
tag.h" nor acleanup_before_linux()function...The
tag.his a file that I made. Wasn't it part of my original patch?
I am not aware of your original patch. I just know what Robert sent.
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Human beings were created by water to transport it uphill.