Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 1 | /* |
Mike Frysinger | 9171fc8 | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 2 | * U-boot - bootm.c - misc boot helper functions |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 3 | * |
Mike Frysinger | 9171fc8 | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 4 | * Copyright (c) 2005-2008 Analog Devices Inc. |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 5 | * |
6 | * (C) Copyright 2000-2004 | ||||
7 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | ||||
8 | * | ||||
Mike Frysinger | 9171fc8 | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 9 | * Licensed under the GPL-2 or later. |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 10 | */ |
11 | |||||
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 12 | #include <common.h> |
13 | #include <command.h> | ||||
14 | #include <image.h> | ||||
Mike Frysinger | 9171fc8 | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 15 | #include <asm/blackfin.h> |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 16 | |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 17 | #ifdef SHARED_RESOURCES |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 18 | extern void swap_to(int device_id); |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 19 | #endif |
20 | |||||
Mike Frysinger | 9171fc8 | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 21 | static char *make_command_line(void) |
22 | { | ||||
23 | char *dest = (char *)CMD_LINE_ADDR; | ||||
24 | char *bootargs = getenv("bootargs"); | ||||
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 25 | |
Mike Frysinger | 9171fc8 | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 26 | if (bootargs == NULL) |
27 | return NULL; | ||||
28 | |||||
29 | strncpy(dest, bootargs, 0x1000); | ||||
30 | dest[0xfff] = 0; | ||||
31 | return dest; | ||||
32 | } | ||||
33 | |||||
Kumar Gala | 40d7e99 | 2008-08-15 08:24:45 -0500 | [diff] [blame] | 34 | int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 35 | { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 36 | int (*appl) (char *cmdline); |
37 | char *cmdline; | ||||
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 38 | |
39 | #ifdef SHARED_RESOURCES | ||||
40 | swap_to(FLASH); | ||||
41 | #endif | ||||
42 | |||||
Kumar Gala | c160a95 | 2008-08-15 08:24:36 -0500 | [diff] [blame] | 43 | appl = (int (*)(char *))images->ep; |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 44 | |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 45 | printf("Starting Kernel at = %x\n", appl); |
46 | cmdline = make_command_line(); | ||||
Mike Frysinger | 9171fc8 | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 47 | icache_disable(); |
48 | dcache_disable(); | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 49 | (*appl) (cmdline); |
Marian Balakowicz | cd7c596 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 50 | /* does not return */ |
Kumar Gala | 40d7e99 | 2008-08-15 08:24:45 -0500 | [diff] [blame] | 51 | error: |
52 | return 1; | ||||
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 53 | } |