]> git.ipfire.org Git - people/ms/u-boot.git/blame - lib_sh/bootm.c
cmd_nand: Move conditional compilation to Makefile
[people/ms/u-boot.git] / lib_sh / bootm.c
CommitLineData
0b135cfc
NI
1/*
2 * (C) Copyright 2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
6b44a439
NI
5 * (c) Copyright 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
6 * (c) Copyright 2008 Renesas Solutions Corp.
7 *
0b135cfc
NI
8 * See file CREDITS for list of people who contributed to this
9 * project.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#include <common.h>
28#include <command.h>
29#include <asm/byteorder.h>
30
6d0f6bcf 31#ifdef CONFIG_SYS_DEBUG
6b44a439 32static void hexdump(unsigned char *buf, int len)
0b135cfc
NI
33{
34 int i;
35
36 for (i = 0; i < len; i++) {
37 if ((i % 16) == 0)
6b44a439
NI
38 printf("%s%08x: ", i ? "\n" : "",
39 (unsigned int)&buf[i]);
40 printf("%02x ", buf[i]);
0b135cfc 41 }
6b44a439 42 printf("\n");
0b135cfc
NI
43}
44#endif
45
40d7e99d 46int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
0b135cfc 47{
6b44a439 48 /* Linux kernel load address */
c160a954 49 void (*kernel) (void) = (void (*)(void))images->ep;
6b44a439 50 /* empty_zero_page */
b5d10a13
NI
51 unsigned char *param
52 = (unsigned char *)image_get_load(images->legacy_hdr_os);
6b44a439 53 /* Linux kernel command line */
b5d10a13 54 char *cmdline = (char *)param + 0x100;
6b44a439 55 /* PAGE_SIZE */
b5d10a13 56 unsigned long size = images->ep - (unsigned long)param;
6b44a439 57 char *bootargs = getenv("bootargs");
0b135cfc 58
49c3a861
KG
59 if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
60 return 1;
61
0b135cfc 62 /* Setup parameters */
6b44a439
NI
63 memset(param, 0, size); /* Clear zero page */
64 strcpy(cmdline, bootargs);
b02bad12 65
0b135cfc 66 kernel();
cd7c596e 67 /* does not return */
cd7c596e 68
40d7e99d 69 return 1;
0b135cfc 70}