Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Nobuhiro Iwamatsu | 752a595 | 2008-09-17 11:08:36 +0900 | [diff] [blame] | 5 | * (c) Copyright 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com> |
| 6 | * (c) Copyright 2008 Renesas Solutions Corp. |
| 7 | * |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 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 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 31 | #ifdef CONFIG_SYS_DEBUG |
Nobuhiro Iwamatsu | 752a595 | 2008-09-17 11:08:36 +0900 | [diff] [blame] | 32 | static void hexdump(unsigned char *buf, int len) |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 33 | { |
| 34 | int i; |
| 35 | |
| 36 | for (i = 0; i < len; i++) { |
| 37 | if ((i % 16) == 0) |
Nobuhiro Iwamatsu | 752a595 | 2008-09-17 11:08:36 +0900 | [diff] [blame] | 38 | printf("%s%08x: ", i ? "\n" : "", |
| 39 | (unsigned int)&buf[i]); |
| 40 | printf("%02x ", buf[i]); |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 41 | } |
Nobuhiro Iwamatsu | 752a595 | 2008-09-17 11:08:36 +0900 | [diff] [blame] | 42 | printf("\n"); |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 43 | } |
| 44 | #endif |
| 45 | |
Kumar Gala | 48626aa | 2008-08-15 08:24:45 -0500 | [diff] [blame] | 46 | int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 47 | { |
Nobuhiro Iwamatsu | 752a595 | 2008-09-17 11:08:36 +0900 | [diff] [blame] | 48 | /* Linux kernel load address */ |
Kumar Gala | 93467bc | 2008-08-15 08:24:36 -0500 | [diff] [blame] | 49 | void (*kernel) (void) = (void (*)(void))images->ep; |
Nobuhiro Iwamatsu | 752a595 | 2008-09-17 11:08:36 +0900 | [diff] [blame] | 50 | /* empty_zero_page */ |
Nobuhiro Iwamatsu | e58917e | 2008-09-18 19:34:36 +0900 | [diff] [blame] | 51 | unsigned char *param |
| 52 | = (unsigned char *)image_get_load(images->legacy_hdr_os); |
Nobuhiro Iwamatsu | 752a595 | 2008-09-17 11:08:36 +0900 | [diff] [blame] | 53 | /* Linux kernel command line */ |
Nobuhiro Iwamatsu | e58917e | 2008-09-18 19:34:36 +0900 | [diff] [blame] | 54 | char *cmdline = (char *)param + 0x100; |
Nobuhiro Iwamatsu | 752a595 | 2008-09-17 11:08:36 +0900 | [diff] [blame] | 55 | /* PAGE_SIZE */ |
Nobuhiro Iwamatsu | e58917e | 2008-09-18 19:34:36 +0900 | [diff] [blame] | 56 | unsigned long size = images->ep - (unsigned long)param; |
Nobuhiro Iwamatsu | 752a595 | 2008-09-17 11:08:36 +0900 | [diff] [blame] | 57 | char *bootargs = getenv("bootargs"); |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 58 | |
Kumar Gala | 18178bc | 2008-10-21 17:25:45 -0500 | [diff] [blame] | 59 | if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) |
| 60 | return 1; |
| 61 | |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 62 | /* Setup parameters */ |
Nobuhiro Iwamatsu | 752a595 | 2008-09-17 11:08:36 +0900 | [diff] [blame] | 63 | memset(param, 0, size); /* Clear zero page */ |
| 64 | strcpy(cmdline, bootargs); |
Nobuhiro Iwamatsu | 547b67f | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 65 | |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 66 | kernel(); |
Marian Balakowicz | df8ff33 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 67 | /* does not return */ |
Marian Balakowicz | df8ff33 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 68 | |
Kumar Gala | 48626aa | 2008-08-15 08:24:45 -0500 | [diff] [blame] | 69 | return 1; |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 70 | } |