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 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | * |
| 22 | */ |
| 23 | |
| 24 | #include <common.h> |
| 25 | #include <command.h> |
| 26 | #include <asm/byteorder.h> |
| 27 | |
| 28 | extern image_header_t header; /* common/cmd_bootm.c */ |
| 29 | |
| 30 | /* The SH kernel reads arguments from the empty zero page at location |
Wolfgang Denk | 0a5c214 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 31 | * 0 at the start of SDRAM. The following are copied from |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 32 | * arch/sh/kernel/setup.c and may require tweaking if the kernel sources |
| 33 | * change. |
| 34 | */ |
| 35 | #define PARAM ((unsigned char *)CFG_SDRAM_BASE + 0x1000) |
| 36 | |
| 37 | #define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000)) |
| 38 | #define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004)) |
| 39 | #define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008)) |
| 40 | #define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c)) |
| 41 | #define INITRD_START (*(unsigned long *) (PARAM+0x010)) |
| 42 | #define INITRD_SIZE (*(unsigned long *) (PARAM+0x014)) |
| 43 | /* ... */ |
| 44 | #define COMMAND_LINE ((char *) (PARAM+0x100)) |
| 45 | |
| 46 | #define RAMDISK_IMAGE_START_MASK 0x07FF |
| 47 | |
| 48 | #ifdef CFG_DEBUG |
| 49 | static void hexdump (unsigned char *buf, int len) |
| 50 | { |
| 51 | int i; |
| 52 | |
| 53 | for (i = 0; i < len; i++) { |
| 54 | if ((i % 16) == 0) |
| 55 | printf ("%s%08x: ", i ? "\n" : "", (unsigned int) &buf[i]); |
| 56 | printf ("%02x ", buf[i]); |
| 57 | } |
| 58 | printf ("\n"); |
| 59 | } |
| 60 | #endif |
| 61 | |
| 62 | void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], |
| 63 | ulong addr, ulong *len_ptr, int verify) |
| 64 | { |
| 65 | image_header_t *hdr = &header; |
| 66 | char *bootargs = getenv("bootargs"); |
| 67 | void (*kernel) (void) = (void (*)(void)) ntohl (hdr->ih_ep); |
| 68 | |
| 69 | /* Setup parameters */ |
| 70 | memset(PARAM, 0, 0x1000); /* Clear zero page */ |
| 71 | strcpy(COMMAND_LINE, bootargs); |
Nobuhiro Iwamatsu | 547b67f | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 72 | |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 73 | kernel(); |
| 74 | } |