1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <common.h>
25#include <command.h>
26#include <image.h>
27#include <asm/byteorder.h>
28#include <asm/addrspace.h>
29
30DECLARE_GLOBAL_DATA_PTR;
31
32int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
33{
34 void (*theKernel) (int, char **, char **, int *);
35 char *bootargs = getenv ("bootargs");
36 char *start;
37 uint len;
38
39
40 theKernel = (void (*)(int, char **, char **, int *))images->ep;
41
42 show_boot_progress (15);
43
44 debug ("## Transferring control to Linux (at address %08lx) ...\n",
45 (ulong) theKernel);
46
47 gd->bd->bi_boot_params = gd->bd->bi_memstart + (16 << 20) - 256;
48 debug ("%-12s= 0x%08lX\n", "boot_params", (ulong)gd->bd->bi_boot_params);
49
50
51 *(int32_t *)(gd->bd->bi_boot_params - 4) = 0x12345678;
52
53 *(int32_t *)(gd->bd->bi_boot_params - 8) = gd->ram_size;
54
55 start = (char*)gd->bd->bi_boot_params;
56
57 len = strlen(bootargs);
58
59 strncpy(start, bootargs, len + 1);
60
61 start += len;
62
63 len = images->rd_end - images->rd_start;
64 if (len > 0) {
65 start += sprintf(start," rd_start=0x%08X rd_size=0x%0X",
66 (uint) UNCACHED_SDRAM (images->rd_start),
67 (uint) len);
68 }
69
70
71 printf ("\nStarting kernel ...\n\n");
72
73 theKernel (0, NULL, NULL, 0);
74
75 return 1;
76}
77