Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2003 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Simon Glass | 4bfd1f5 | 2019-08-01 09:46:43 -0600 | [diff] [blame] | 8 | #include <env.h> |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 9 | #include <image.h> |
Daniel Schwierzeck | 5002d8c | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 10 | #include <fdt_support.h> |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 11 | #include <asm/addrspace.h> |
Purna Chandra Mandal | fdff5b0 | 2016-04-18 18:31:38 +0530 | [diff] [blame] | 12 | #include <asm/io.h> |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 13 | |
Wolfgang Denk | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 16 | #define LINUX_MAX_ENVS 256 |
| 17 | #define LINUX_MAX_ARGS 256 |
| 18 | |
Daniel Schwierzeck | e51a6b7 | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 19 | static int linux_argc; |
| 20 | static char **linux_argv; |
Daniel Schwierzeck | 59e8cbd | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 21 | static char *linux_argp; |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 22 | |
Daniel Schwierzeck | e51a6b7 | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 23 | static char **linux_env; |
| 24 | static char *linux_env_p; |
| 25 | static int linux_env_idx; |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 26 | |
Daniel Schwierzeck | f66cc1e | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 27 | static ulong arch_get_sp(void) |
| 28 | { |
| 29 | ulong ret; |
| 30 | |
| 31 | __asm__ __volatile__("move %0, $sp" : "=r"(ret) : ); |
| 32 | |
| 33 | return ret; |
| 34 | } |
| 35 | |
| 36 | void arch_lmb_reserve(struct lmb *lmb) |
| 37 | { |
| 38 | ulong sp; |
| 39 | |
| 40 | sp = arch_get_sp(); |
| 41 | debug("## Current stack ends at 0x%08lx\n", sp); |
| 42 | |
| 43 | /* adjust sp by 4K to be safe */ |
| 44 | sp -= 4096; |
Paul Burton | 7a3e0f7 | 2016-09-26 19:28:56 +0100 | [diff] [blame] | 45 | lmb_reserve(lmb, sp, gd->ram_top - sp); |
Daniel Schwierzeck | f66cc1e | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 46 | } |
| 47 | |
Daniel Schwierzeck | 59e8cbd | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 48 | static void linux_cmdline_init(void) |
| 49 | { |
| 50 | linux_argc = 1; |
| 51 | linux_argv = (char **)UNCACHED_SDRAM(gd->bd->bi_boot_params); |
| 52 | linux_argv[0] = 0; |
| 53 | linux_argp = (char *)(linux_argv + LINUX_MAX_ARGS); |
| 54 | } |
| 55 | |
| 56 | static void linux_cmdline_set(const char *value, size_t len) |
| 57 | { |
| 58 | linux_argv[linux_argc] = linux_argp; |
| 59 | memcpy(linux_argp, value, len); |
| 60 | linux_argp[len] = 0; |
| 61 | |
| 62 | linux_argp += len + 1; |
| 63 | linux_argc++; |
| 64 | } |
| 65 | |
| 66 | static void linux_cmdline_dump(void) |
| 67 | { |
| 68 | int i; |
| 69 | |
| 70 | debug("## cmdline argv at 0x%p, argp at 0x%p\n", |
| 71 | linux_argv, linux_argp); |
| 72 | |
| 73 | for (i = 1; i < linux_argc; i++) |
| 74 | debug(" arg %03d: %s\n", i, linux_argv[i]); |
| 75 | } |
| 76 | |
Daniel Schwierzeck | 25fc664 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 77 | static void linux_cmdline_legacy(bootm_headers_t *images) |
Daniel Schwierzeck | 59e8cbd | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 78 | { |
| 79 | const char *bootargs, *next, *quote; |
| 80 | |
| 81 | linux_cmdline_init(); |
| 82 | |
Simon Glass | 00caae6 | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 83 | bootargs = env_get("bootargs"); |
Daniel Schwierzeck | 59e8cbd | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 84 | if (!bootargs) |
| 85 | return; |
| 86 | |
| 87 | next = bootargs; |
| 88 | |
| 89 | while (bootargs && *bootargs && linux_argc < LINUX_MAX_ARGS) { |
| 90 | quote = strchr(bootargs, '"'); |
| 91 | next = strchr(bootargs, ' '); |
| 92 | |
| 93 | while (next && quote && quote < next) { |
| 94 | /* |
| 95 | * we found a left quote before the next blank |
| 96 | * now we have to find the matching right quote |
| 97 | */ |
| 98 | next = strchr(quote + 1, '"'); |
| 99 | if (next) { |
| 100 | quote = strchr(next + 1, '"'); |
| 101 | next = strchr(next + 1, ' '); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | if (!next) |
| 106 | next = bootargs + strlen(bootargs); |
| 107 | |
| 108 | linux_cmdline_set(bootargs, next - bootargs); |
| 109 | |
| 110 | if (*next) |
| 111 | next++; |
| 112 | |
| 113 | bootargs = next; |
| 114 | } |
Daniel Schwierzeck | 25fc664 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 115 | } |
Daniel Schwierzeck | 59e8cbd | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 116 | |
Daniel Schwierzeck | 8cec725 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 117 | static void linux_cmdline_append(bootm_headers_t *images) |
| 118 | { |
| 119 | char buf[24]; |
| 120 | ulong mem, rd_start, rd_size; |
| 121 | |
| 122 | /* append mem */ |
| 123 | mem = gd->ram_size >> 20; |
| 124 | sprintf(buf, "mem=%luM", mem); |
| 125 | linux_cmdline_set(buf, strlen(buf)); |
| 126 | |
| 127 | /* append rd_start and rd_size */ |
| 128 | rd_start = images->initrd_start; |
| 129 | rd_size = images->initrd_end - images->initrd_start; |
| 130 | |
| 131 | if (rd_size) { |
| 132 | sprintf(buf, "rd_start=0x%08lX", rd_start); |
| 133 | linux_cmdline_set(buf, strlen(buf)); |
| 134 | sprintf(buf, "rd_size=0x%lX", rd_size); |
| 135 | linux_cmdline_set(buf, strlen(buf)); |
| 136 | } |
| 137 | } |
| 138 | |
Daniel Schwierzeck | 15f8aa9 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 139 | static void linux_env_init(void) |
| 140 | { |
| 141 | linux_env = (char **)(((ulong) linux_argp + 15) & ~15); |
| 142 | linux_env[0] = 0; |
| 143 | linux_env_p = (char *)(linux_env + LINUX_MAX_ENVS); |
| 144 | linux_env_idx = 0; |
| 145 | } |
| 146 | |
| 147 | static void linux_env_set(const char *env_name, const char *env_val) |
| 148 | { |
| 149 | if (linux_env_idx < LINUX_MAX_ENVS - 1) { |
| 150 | linux_env[linux_env_idx] = linux_env_p; |
| 151 | |
| 152 | strcpy(linux_env_p, env_name); |
| 153 | linux_env_p += strlen(env_name); |
| 154 | |
Daniel Schwierzeck | 347ea94 | 2015-11-01 17:36:15 +0100 | [diff] [blame] | 155 | if (CONFIG_IS_ENABLED(MALTA)) { |
Daniel Schwierzeck | b87493f | 2013-05-30 19:04:20 +0200 | [diff] [blame] | 156 | linux_env_p++; |
| 157 | linux_env[++linux_env_idx] = linux_env_p; |
| 158 | } else { |
| 159 | *linux_env_p++ = '='; |
| 160 | } |
Daniel Schwierzeck | 15f8aa9 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 161 | |
| 162 | strcpy(linux_env_p, env_val); |
| 163 | linux_env_p += strlen(env_val); |
| 164 | |
| 165 | linux_env_p++; |
| 166 | linux_env[++linux_env_idx] = 0; |
| 167 | } |
| 168 | } |
| 169 | |
Daniel Schwierzeck | ca65e58 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 170 | static void linux_env_legacy(bootm_headers_t *images) |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 171 | { |
Daniel Schwierzeck | e51a6b7 | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 172 | char env_buf[12]; |
Daniel Schwierzeck | 15f8aa9 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 173 | const char *cp; |
Daniel Schwierzeck | 6c15455 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 174 | ulong rd_start, rd_size; |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 175 | |
Daniel Schwierzeck | 347ea94 | 2015-11-01 17:36:15 +0100 | [diff] [blame] | 176 | if (CONFIG_IS_ENABLED(MEMSIZE_IN_BYTES)) { |
| 177 | sprintf(env_buf, "%lu", (ulong)gd->ram_size); |
| 178 | debug("## Giving linux memsize in bytes, %lu\n", |
| 179 | (ulong)gd->ram_size); |
| 180 | } else { |
| 181 | sprintf(env_buf, "%lu", (ulong)(gd->ram_size >> 20)); |
| 182 | debug("## Giving linux memsize in MB, %lu\n", |
| 183 | (ulong)(gd->ram_size >> 20)); |
| 184 | } |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 185 | |
Daniel Schwierzeck | 6c15455 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 186 | rd_start = UNCACHED_SDRAM(images->initrd_start); |
| 187 | rd_size = images->initrd_end - images->initrd_start; |
| 188 | |
Daniel Schwierzeck | 15f8aa9 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 189 | linux_env_init(); |
| 190 | |
Daniel Schwierzeck | e51a6b7 | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 191 | linux_env_set("memsize", env_buf); |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 192 | |
Daniel Schwierzeck | 6c15455 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 193 | sprintf(env_buf, "0x%08lX", rd_start); |
Daniel Schwierzeck | e51a6b7 | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 194 | linux_env_set("initrd_start", env_buf); |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 195 | |
Daniel Schwierzeck | 6c15455 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 196 | sprintf(env_buf, "0x%lX", rd_size); |
Daniel Schwierzeck | e51a6b7 | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 197 | linux_env_set("initrd_size", env_buf); |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 198 | |
Daniel Schwierzeck | e51a6b7 | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 199 | sprintf(env_buf, "0x%08X", (uint) (gd->bd->bi_flashstart)); |
| 200 | linux_env_set("flash_start", env_buf); |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 201 | |
Daniel Schwierzeck | e51a6b7 | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 202 | sprintf(env_buf, "0x%X", (uint) (gd->bd->bi_flashsize)); |
| 203 | linux_env_set("flash_size", env_buf); |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 204 | |
Simon Glass | 00caae6 | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 205 | cp = env_get("ethaddr"); |
Daniel Schwierzeck | e51a6b7 | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 206 | if (cp) |
Jason McMullan | e7c3745 | 2008-06-08 23:56:00 -0400 | [diff] [blame] | 207 | linux_env_set("ethaddr", cp); |
Jason McMullan | e7c3745 | 2008-06-08 23:56:00 -0400 | [diff] [blame] | 208 | |
Simon Glass | 00caae6 | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 209 | cp = env_get("eth1addr"); |
Daniel Schwierzeck | e51a6b7 | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 210 | if (cp) |
Jason McMullan | e7c3745 | 2008-06-08 23:56:00 -0400 | [diff] [blame] | 211 | linux_env_set("eth1addr", cp); |
Daniel Schwierzeck | b87493f | 2013-05-30 19:04:20 +0200 | [diff] [blame] | 212 | |
Daniel Schwierzeck | 347ea94 | 2015-11-01 17:36:15 +0100 | [diff] [blame] | 213 | if (CONFIG_IS_ENABLED(MALTA)) { |
Paul Burton | d18d49d | 2013-11-26 17:45:25 +0000 | [diff] [blame] | 214 | sprintf(env_buf, "%un8r", gd->baudrate); |
| 215 | linux_env_set("modetty0", env_buf); |
| 216 | } |
Gabor Juhos | 0ea7213 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 217 | } |
Jason McMullan | e7c3745 | 2008-06-08 23:56:00 -0400 | [diff] [blame] | 218 | |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 219 | static int boot_reloc_fdt(bootm_headers_t *images) |
| 220 | { |
| 221 | /* |
| 222 | * In case of legacy uImage's, relocation of FDT is already done |
| 223 | * by do_bootm_states() and should not repeated in 'bootm prep'. |
| 224 | */ |
| 225 | if (images->state & BOOTM_STATE_FDT) { |
| 226 | debug("## FDT already relocated\n"); |
| 227 | return 0; |
| 228 | } |
| 229 | |
| 230 | #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) |
| 231 | boot_fdt_add_mem_rsv_regions(&images->lmb, images->ft_addr); |
| 232 | return boot_relocate_fdt(&images->lmb, &images->ft_addr, |
| 233 | &images->ft_len); |
| 234 | #else |
| 235 | return 0; |
| 236 | #endif |
| 237 | } |
| 238 | |
Alexey Brodkin | 4280342 | 2018-01-24 20:47:09 +0300 | [diff] [blame] | 239 | #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) |
Purna Chandra Mandal | fdff5b0 | 2016-04-18 18:31:38 +0530 | [diff] [blame] | 240 | int arch_fixup_fdt(void *blob) |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 241 | { |
Purna Chandra Mandal | fdff5b0 | 2016-04-18 18:31:38 +0530 | [diff] [blame] | 242 | u64 mem_start = virt_to_phys((void *)gd->bd->bi_memstart); |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 243 | u64 mem_size = gd->ram_size; |
| 244 | |
| 245 | return fdt_fixup_memory_banks(blob, &mem_start, &mem_size, 1); |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 246 | } |
Alexey Brodkin | 4280342 | 2018-01-24 20:47:09 +0300 | [diff] [blame] | 247 | #endif |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 248 | |
| 249 | static int boot_setup_fdt(bootm_headers_t *images) |
| 250 | { |
Horatiu Vultur | 6943cc9 | 2019-04-24 17:21:29 +0200 | [diff] [blame] | 251 | images->initrd_start = virt_to_phys((void *)images->initrd_start); |
| 252 | images->initrd_end = virt_to_phys((void *)images->initrd_end); |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 253 | return image_setup_libfdt(images, images->ft_addr, images->ft_len, |
| 254 | &images->lmb); |
| 255 | } |
| 256 | |
Daniel Schwierzeck | ca65e58 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 257 | static void boot_prep_linux(bootm_headers_t *images) |
| 258 | { |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 259 | if (CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && images->ft_len) { |
| 260 | boot_reloc_fdt(images); |
Daniel Schwierzeck | 5002d8c | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 261 | boot_setup_fdt(images); |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 262 | } else { |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 263 | if (CONFIG_IS_ENABLED(MIPS_BOOT_CMDLINE_LEGACY)) { |
| 264 | linux_cmdline_legacy(images); |
| 265 | |
Zubair Lutfullah Kakakhel | 48bfc31 | 2017-07-11 16:47:51 +0100 | [diff] [blame] | 266 | if (!CONFIG_IS_ENABLED(MIPS_BOOT_ENV_LEGACY)) |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 267 | linux_cmdline_append(images); |
| 268 | |
| 269 | linux_cmdline_dump(); |
| 270 | } |
Zubair Lutfullah Kakakhel | 48bfc31 | 2017-07-11 16:47:51 +0100 | [diff] [blame] | 271 | |
| 272 | if (CONFIG_IS_ENABLED(MIPS_BOOT_ENV_LEGACY)) |
| 273 | linux_env_legacy(images); |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 274 | } |
Daniel Schwierzeck | ca65e58 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 275 | } |
| 276 | |
Gabor Juhos | 0ea7213 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 277 | static void boot_jump_linux(bootm_headers_t *images) |
| 278 | { |
Daniel Schwierzeck | c4b3784 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 279 | typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong); |
| 280 | kernel_entry_t kernel = (kernel_entry_t) images->ep; |
Daniel Schwierzeck | b87493f | 2013-05-30 19:04:20 +0200 | [diff] [blame] | 281 | ulong linux_extra = 0; |
Gabor Juhos | 0ea7213 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 282 | |
Daniel Schwierzeck | c4b3784 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 283 | debug("## Transferring control to Linux (at address %p) ...\n", kernel); |
Gabor Juhos | 0ea7213 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 284 | |
| 285 | bootstage_mark(BOOTSTAGE_ID_RUN_OS); |
| 286 | |
Daniel Schwierzeck | 347ea94 | 2015-11-01 17:36:15 +0100 | [diff] [blame] | 287 | if (CONFIG_IS_ENABLED(MALTA)) |
Daniel Schwierzeck | b87493f | 2013-05-30 19:04:20 +0200 | [diff] [blame] | 288 | linux_extra = gd->ram_size; |
| 289 | |
Daniel Schwierzeck | 347ea94 | 2015-11-01 17:36:15 +0100 | [diff] [blame] | 290 | #if CONFIG_IS_ENABLED(BOOTSTAGE_FDT) |
Daniel Schwierzeck | e13a50b | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 291 | bootstage_fdt_add_report(); |
| 292 | #endif |
Daniel Schwierzeck | 347ea94 | 2015-11-01 17:36:15 +0100 | [diff] [blame] | 293 | #if CONFIG_IS_ENABLED(BOOTSTAGE_REPORT) |
Daniel Schwierzeck | e13a50b | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 294 | bootstage_report(); |
| 295 | #endif |
Gabor Juhos | 0ea7213 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 296 | |
Daniel Schwierzeck | 90b1c9f | 2015-02-22 16:58:30 +0100 | [diff] [blame] | 297 | if (images->ft_len) |
| 298 | kernel(-2, (ulong)images->ft_addr, 0, 0); |
| 299 | else |
| 300 | kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env, |
| 301 | linux_extra); |
Gabor Juhos | 0ea7213 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 302 | } |
| 303 | |
| 304 | int do_bootm_linux(int flag, int argc, char * const argv[], |
| 305 | bootm_headers_t *images) |
| 306 | { |
Gabor Juhos | 9c170e2 | 2013-01-07 02:53:42 +0000 | [diff] [blame] | 307 | /* No need for those on MIPS */ |
Daniel Schwierzeck | 59e8cbd | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 308 | if (flag & BOOTM_STATE_OS_BD_T) |
Gabor Juhos | 9c170e2 | 2013-01-07 02:53:42 +0000 | [diff] [blame] | 309 | return -1; |
| 310 | |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 311 | /* |
| 312 | * Cmdline init has been moved to 'bootm prep' because it has to be |
| 313 | * done after relocation of ramdisk to always pass correct values |
| 314 | * for rd_start and rd_size to Linux kernel. |
| 315 | */ |
| 316 | if (flag & BOOTM_STATE_OS_CMDLINE) |
Daniel Schwierzeck | 59e8cbd | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 317 | return 0; |
Daniel Schwierzeck | 59e8cbd | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 318 | |
Gabor Juhos | 9c170e2 | 2013-01-07 02:53:42 +0000 | [diff] [blame] | 319 | if (flag & BOOTM_STATE_OS_PREP) { |
| 320 | boot_prep_linux(images); |
| 321 | return 0; |
| 322 | } |
| 323 | |
Daniel Schwierzeck | 2bb5b63 | 2015-11-01 17:36:14 +0100 | [diff] [blame] | 324 | if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) { |
Gabor Juhos | 9c170e2 | 2013-01-07 02:53:42 +0000 | [diff] [blame] | 325 | boot_jump_linux(images); |
| 326 | return 0; |
| 327 | } |
Gabor Juhos | 0ea7213 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 328 | |
Marian Balakowicz | cd7c596 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 329 | /* does not return */ |
Kumar Gala | 40d7e99 | 2008-08-15 08:24:45 -0500 | [diff] [blame] | 330 | return 1; |
wdenk | c021880 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 331 | } |