]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - lib_blackfin/bootm.c
[new uImage] Add dual format uImage support framework
[karo-tx-uboot.git] / lib_blackfin / bootm.c
1 /*
2  * U-boot - bf533_linux.c
3  *
4  * Copyright (c) 2005-2007 Analog Devices Inc.
5  *
6  * (C) Copyright 2000-2004
7  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8  *
9  * See file CREDITS for list of people who contributed to this
10  * project.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License as
14  * published by the Free Software Foundation; either version 2 of
15  * the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
25  * MA 02110-1301 USA
26  */
27
28 /* Dummy functions, currently not in Use */
29
30 #include <common.h>
31 #include <command.h>
32 #include <image.h>
33 #include <zlib.h>
34 #include <asm/byteorder.h>
35
36 #define LINUX_MAX_ENVS          256
37 #define LINUX_MAX_ARGS          256
38
39 #define CMD_LINE_ADDR 0xFF900000        /* L1 scratchpad */
40
41 #ifdef SHARED_RESOURCES
42 extern void swap_to(int device_id);
43 #endif
44
45 extern void flush_instruction_cache(void);
46 extern void flush_data_cache(void);
47 static char *make_command_line(void);
48
49 void do_bootm_linux(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
50                     bootm_headers_t *images, int verify)
51 {
52         int     (*appl) (char *cmdline);
53         char    *cmdline;
54         ulong   ep = 0;
55
56 #ifdef SHARED_RESOURCES
57         swap_to(FLASH);
58 #endif
59
60         /* find kernel entry point */
61         if (images->legacy_hdr_valid) {
62                 ep = image_get_ep (images->legacy_hdr_os);
63 #if defined(CONFIG_FIT)
64         } else if (images->fit_uname_os) {
65                 fit_unsupported_reset ("AVR32 linux bootm");
66                 do_reset (cmdtp, flag, argc, argv);
67 #endif
68         } else {
69                 puts ("Could not find kernel entry point!\n");
70                 do_reset (cmdtp, flag, argc, argv);
71         }
72         appl = (int (*)(char *))ep;
73
74         printf("Starting Kernel at = %x\n", appl);
75         cmdline = make_command_line();
76         if (icache_status()) {
77                 flush_instruction_cache();
78                 icache_disable();
79         }
80         if (dcache_status()) {
81                 flush_data_cache();
82                 dcache_disable();
83         }
84         (*appl) (cmdline);
85 }
86
87 char *make_command_line(void)
88 {
89         char *dest = (char *)CMD_LINE_ADDR;
90         char *bootargs;
91
92         if ((bootargs = getenv("bootargs")) == NULL)
93                 return NULL;
94
95         strncpy(dest, bootargs, 0x1000);
96         dest[0xfff] = 0;
97         return dest;
98 }