summaryrefslogtreecommitdiff
path: root/lib_sh/bootm.c
diff options
context:
space:
mode:
authorMarian Balakowicz <m8@semihalf.com>2008-01-31 13:20:06 +0100
committerWolfgang Denk <wd@denx.de>2008-02-07 01:12:57 +0100
commit4a995edec1ac163d9326d143ffe2b47e7543407f (patch)
treef69ac1a596c3eadb1e9db93c5b5c678d26b804f7 /lib_sh/bootm.c
parent7582438c285bf0cef82909d0f232de64ec567a8a (diff)
downloadu-boot-imx-4a995edec1ac163d9326d143ffe2b47e7543407f.zip
u-boot-imx-4a995edec1ac163d9326d143ffe2b47e7543407f.tar.gz
u-boot-imx-4a995edec1ac163d9326d143ffe2b47e7543407f.tar.bz2
[new uImage] Rename architecture specific bootm code files
Implementation of the do_bootm_linux() and other bootm helper routines is architecture specific code. As such it resides in lib_<arch> directories in files named <arch>_linux.c This patch renames those files to a more clear and accurate lib_<arch>/bootm.c form. List of the renamed files: lib_arm/armlinux.c -> lib_arm/bootm.c lib_avr32/avr32_linux.c -> lib_avr32/bootm.c lib_blackfin/bf533_linux.c -> lib_blackfin/bootm.c lib_i386/i386_linux.c -> lib_i386/bootm.c lib_m68k/m68k_linux.c -> lib_m68k/bootm.c lib_microblaze/microblaze_linux.c -> lib_microblaze/bootm.c lib_mips/mips_linux.c -> lib_mips/bootm.c lib_nios/nios_linux.c -> lib_nios/bootm.c lib_nios2/nios_linux.c -> lib_nios2/bootm.c lib_ppc/ppc_linux.c -> lib_ppc/bootm.c lib_sh/sh_linux.c -> lib_sh/bootm.c Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'lib_sh/bootm.c')
-rw-r--r--lib_sh/bootm.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/lib_sh/bootm.c b/lib_sh/bootm.c
new file mode 100644
index 0000000..14b6815
--- /dev/null
+++ b/lib_sh/bootm.c
@@ -0,0 +1,74 @@
+/*
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * 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
+ *
+ */
+
+#include <common.h>
+#include <command.h>
+#include <asm/byteorder.h>
+
+extern image_header_t header; /* common/cmd_bootm.c */
+
+/* The SH kernel reads arguments from the empty zero page at location
+ * 0 at the start of SDRAM. The following are copied from
+ * arch/sh/kernel/setup.c and may require tweaking if the kernel sources
+ * change.
+ */
+#define PARAM ((unsigned char *)CFG_SDRAM_BASE + 0x1000)
+
+#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000))
+#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004))
+#define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008))
+#define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c))
+#define INITRD_START (*(unsigned long *) (PARAM+0x010))
+#define INITRD_SIZE (*(unsigned long *) (PARAM+0x014))
+/* ... */
+#define COMMAND_LINE ((char *) (PARAM+0x100))
+
+#define RAMDISK_IMAGE_START_MASK 0x07FF
+
+#ifdef CFG_DEBUG
+static void hexdump (unsigned char *buf, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++) {
+ if ((i % 16) == 0)
+ printf ("%s%08x: ", i ? "\n" : "", (unsigned int) &buf[i]);
+ printf ("%02x ", buf[i]);
+ }
+ printf ("\n");
+}
+#endif
+
+void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+ ulong addr, ulong *len_ptr, int verify)
+{
+ image_header_t *hdr = &header;
+ char *bootargs = getenv("bootargs");
+ void (*kernel) (void) = (void (*)(void)) ntohl (hdr->ih_ep);
+
+ /* Setup parameters */
+ memset(PARAM, 0, 0x1000); /* Clear zero page */
+ strcpy(COMMAND_LINE, bootargs);
+
+ kernel();
+}