1
2
3
4
5
6
7
8
9
10#include <common.h>
11#include <command.h>
12#include <fdt_support.h>
13#include <image.h>
14#include <u-boot/zlib.h>
15#include <asm/byteorder.h>
16
17int do_bootm_linux(int flag, int argc, char * const argv[],
18 bootm_headers_t *images)
19{
20
21 void (*thekernel) (char *, ulong, ulong);
22 char *commandline = env_get("bootargs");
23 ulong rd_data_start, rd_data_end;
24
25
26
27
28 if (flag & BOOTM_STATE_OS_PREP)
29 return 0;
30
31 if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
32 return 1;
33
34 int ret;
35
36 char *of_flat_tree = NULL;
37#if defined(CONFIG_OF_LIBFDT)
38
39 if (images->ft_len)
40 of_flat_tree = images->ft_addr;
41#endif
42
43 thekernel = (void (*)(char *, ulong, ulong))images->ep;
44
45
46 ret = boot_get_ramdisk(argc, argv, images, IH_ARCH_MICROBLAZE,
47 &rd_data_start, &rd_data_end);
48 if (ret)
49 return 1;
50
51 bootstage_mark(BOOTSTAGE_ID_RUN_OS);
52
53 if (!of_flat_tree && argc > 1)
54 of_flat_tree = (char *)simple_strtoul(argv[1], NULL, 16);
55
56
57 if (images->rd_start && images->rd_end && of_flat_tree) {
58 ret = fdt_initrd(of_flat_tree, images->rd_start,
59 images->rd_end);
60 if (ret)
61 return 1;
62 }
63
64#ifdef DEBUG
65 printf("## Transferring control to Linux (at address 0x%08lx) ",
66 (ulong)thekernel);
67 printf("ramdisk 0x%08lx, FDT 0x%08lx...\n",
68 rd_data_start, (ulong) of_flat_tree);
69#endif
70
71#ifdef XILINX_USE_DCACHE
72 flush_cache(0, XILINX_DCACHE_BYTE_SIZE);
73#endif
74
75
76
77
78
79
80 thekernel(commandline, rd_data_start, (ulong)of_flat_tree);
81
82
83 return 1;
84}
85