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