]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - lib_blackfin/bootm.c
f789e24edbecbbc8c10a88852bae3b790b6bed3b
[karo-tx-uboot.git] / lib_blackfin / bootm.c
1 /*
2  * U-boot - bootm.c - misc boot helper functions
3  *
4  * Copyright (c) 2005-2008 Analog Devices Inc.
5  *
6  * (C) Copyright 2000-2004
7  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8  *
9  * Licensed under the GPL-2 or later.
10  */
11
12 #include <common.h>
13 #include <command.h>
14 #include <image.h>
15 #include <asm/blackfin.h>
16
17 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
18
19 #ifdef SHARED_RESOURCES
20 extern void swap_to(int device_id);
21 #endif
22
23 static char *make_command_line(void)
24 {
25         char *dest = (char *)CMD_LINE_ADDR;
26         char *bootargs = getenv("bootargs");
27
28         if (bootargs == NULL)
29                 return NULL;
30
31         strncpy(dest, bootargs, 0x1000);
32         dest[0xfff] = 0;
33         return dest;
34 }
35
36 void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
37                     bootm_headers_t *images)
38 {
39         int     (*appl) (char *cmdline);
40         char    *cmdline;
41
42 #ifdef SHARED_RESOURCES
43         swap_to(FLASH);
44 #endif
45
46         appl = (int (*)(char *))images->ep;
47
48         printf("Starting Kernel at = %x\n", appl);
49         cmdline = make_command_line();
50         icache_disable();
51         dcache_disable();
52         (*appl) (cmdline);
53         /* does not return */
54         return;
55
56  error:
57         do_reset (cmdtp, flag, argc, argv);
58 }