wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 9 | #include <image.h> |
Daniel Schwierzeck | 8d7ff4d | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 10 | #include <fdt_support.h> |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 11 | #include <asm/addrspace.h> |
| 12 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 13 | DECLARE_GLOBAL_DATA_PTR; |
| 14 | |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 15 | #define LINUX_MAX_ENVS 256 |
| 16 | #define LINUX_MAX_ARGS 256 |
| 17 | |
Paul Burton | 10a74b5 | 2013-11-09 10:22:08 +0000 | [diff] [blame] | 18 | #if defined(CONFIG_MALTA) |
| 19 | #define mips_boot_malta 1 |
Daniel Schwierzeck | 0dfa0b3 | 2013-05-30 19:04:20 +0200 | [diff] [blame] | 20 | #else |
Paul Burton | 10a74b5 | 2013-11-09 10:22:08 +0000 | [diff] [blame] | 21 | #define mips_boot_malta 0 |
Daniel Schwierzeck | 0dfa0b3 | 2013-05-30 19:04:20 +0200 | [diff] [blame] | 22 | #endif |
| 23 | |
Daniel Schwierzeck | f9749fa | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 24 | #if defined(CONFIG_MIPS_BOOT_CMDLINE_LEGACY) |
| 25 | #define mips_boot_cmdline_legacy 1 |
| 26 | #else |
| 27 | #define mips_boot_cmdline_legacy 0 |
| 28 | #endif |
| 29 | |
Daniel Schwierzeck | c07dc60 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 30 | #if defined(CONFIG_MIPS_BOOT_ENV_LEGACY) |
| 31 | #define mips_boot_env_legacy 1 |
| 32 | #else |
| 33 | #define mips_boot_env_legacy 0 |
| 34 | #endif |
| 35 | |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 36 | static int linux_argc; |
| 37 | static char **linux_argv; |
Daniel Schwierzeck | eb782d6 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 38 | static char *linux_argp; |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 39 | |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 40 | static char **linux_env; |
| 41 | static char *linux_env_p; |
| 42 | static int linux_env_idx; |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 43 | |
Daniel Schwierzeck | 22d1c23 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 44 | static ulong arch_get_sp(void) |
| 45 | { |
| 46 | ulong ret; |
| 47 | |
| 48 | __asm__ __volatile__("move %0, $sp" : "=r"(ret) : ); |
| 49 | |
| 50 | return ret; |
| 51 | } |
| 52 | |
| 53 | void arch_lmb_reserve(struct lmb *lmb) |
| 54 | { |
| 55 | ulong sp; |
| 56 | |
| 57 | sp = arch_get_sp(); |
| 58 | debug("## Current stack ends at 0x%08lx\n", sp); |
| 59 | |
| 60 | /* adjust sp by 4K to be safe */ |
| 61 | sp -= 4096; |
| 62 | lmb_reserve(lmb, sp, CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp); |
| 63 | } |
| 64 | |
Daniel Schwierzeck | 0665838 | 2014-11-16 01:27:23 +0100 | [diff] [blame] | 65 | static int boot_setup_linux(bootm_headers_t *images) |
| 66 | { |
| 67 | int ret; |
| 68 | ulong rd_len; |
| 69 | |
| 70 | rd_len = images->rd_end - images->rd_start; |
| 71 | ret = boot_ramdisk_high(&images->lmb, images->rd_start, |
| 72 | rd_len, &images->initrd_start, &images->initrd_end); |
| 73 | if (ret) |
| 74 | return ret; |
| 75 | |
Daniel Schwierzeck | 8d7ff4d | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 76 | #if defined(CONFIG_MIPS_BOOT_FDT) && defined(CONFIG_OF_LIBFDT) |
| 77 | if (images->ft_len) { |
| 78 | boot_fdt_add_mem_rsv_regions(&images->lmb, images->ft_addr); |
| 79 | |
| 80 | ret = boot_relocate_fdt(&images->lmb, &images->ft_addr, |
| 81 | &images->ft_len); |
| 82 | if (ret) |
| 83 | return ret; |
| 84 | } |
| 85 | #endif |
| 86 | |
Daniel Schwierzeck | 0665838 | 2014-11-16 01:27:23 +0100 | [diff] [blame] | 87 | return 0; |
| 88 | } |
| 89 | |
Daniel Schwierzeck | 8d7ff4d | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 90 | static void boot_setup_fdt(bootm_headers_t *images) |
| 91 | { |
| 92 | #if defined(CONFIG_MIPS_BOOT_FDT) && defined(CONFIG_OF_LIBFDT) |
| 93 | u64 mem_start = 0; |
| 94 | u64 mem_size = gd->ram_size; |
| 95 | |
| 96 | debug("## setup FDT\n"); |
| 97 | |
| 98 | fdt_chosen(images->ft_addr, 1); |
| 99 | fdt_fixup_memory_banks(images->ft_addr, &mem_start, &mem_size, 1); |
| 100 | fdt_fixup_ethernet(images->ft_addr); |
| 101 | fdt_initrd(images->ft_addr, images->initrd_start, images->initrd_end, 1); |
| 102 | |
| 103 | #if defined(CONFIG_OF_BOARD_SETUP) |
| 104 | ft_board_setup(images->ft_addr, gd->bd); |
| 105 | #endif |
| 106 | #endif |
| 107 | } |
| 108 | |
Daniel Schwierzeck | eb782d6 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 109 | static void linux_cmdline_init(void) |
| 110 | { |
| 111 | linux_argc = 1; |
| 112 | linux_argv = (char **)UNCACHED_SDRAM(gd->bd->bi_boot_params); |
| 113 | linux_argv[0] = 0; |
| 114 | linux_argp = (char *)(linux_argv + LINUX_MAX_ARGS); |
| 115 | } |
| 116 | |
| 117 | static void linux_cmdline_set(const char *value, size_t len) |
| 118 | { |
| 119 | linux_argv[linux_argc] = linux_argp; |
| 120 | memcpy(linux_argp, value, len); |
| 121 | linux_argp[len] = 0; |
| 122 | |
| 123 | linux_argp += len + 1; |
| 124 | linux_argc++; |
| 125 | } |
| 126 | |
| 127 | static void linux_cmdline_dump(void) |
| 128 | { |
| 129 | int i; |
| 130 | |
| 131 | debug("## cmdline argv at 0x%p, argp at 0x%p\n", |
| 132 | linux_argv, linux_argp); |
| 133 | |
| 134 | for (i = 1; i < linux_argc; i++) |
| 135 | debug(" arg %03d: %s\n", i, linux_argv[i]); |
| 136 | } |
| 137 | |
Daniel Schwierzeck | f9749fa | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 138 | static void linux_cmdline_legacy(bootm_headers_t *images) |
Daniel Schwierzeck | eb782d6 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 139 | { |
| 140 | const char *bootargs, *next, *quote; |
| 141 | |
| 142 | linux_cmdline_init(); |
| 143 | |
| 144 | bootargs = getenv("bootargs"); |
| 145 | if (!bootargs) |
| 146 | return; |
| 147 | |
| 148 | next = bootargs; |
| 149 | |
| 150 | while (bootargs && *bootargs && linux_argc < LINUX_MAX_ARGS) { |
| 151 | quote = strchr(bootargs, '"'); |
| 152 | next = strchr(bootargs, ' '); |
| 153 | |
| 154 | while (next && quote && quote < next) { |
| 155 | /* |
| 156 | * we found a left quote before the next blank |
| 157 | * now we have to find the matching right quote |
| 158 | */ |
| 159 | next = strchr(quote + 1, '"'); |
| 160 | if (next) { |
| 161 | quote = strchr(next + 1, '"'); |
| 162 | next = strchr(next + 1, ' '); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | if (!next) |
| 167 | next = bootargs + strlen(bootargs); |
| 168 | |
| 169 | linux_cmdline_set(bootargs, next - bootargs); |
| 170 | |
| 171 | if (*next) |
| 172 | next++; |
| 173 | |
| 174 | bootargs = next; |
| 175 | } |
Daniel Schwierzeck | f9749fa | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 176 | } |
Daniel Schwierzeck | eb782d6 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 177 | |
Daniel Schwierzeck | 2edd528 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 178 | static void linux_cmdline_append(bootm_headers_t *images) |
| 179 | { |
| 180 | char buf[24]; |
| 181 | ulong mem, rd_start, rd_size; |
| 182 | |
| 183 | /* append mem */ |
| 184 | mem = gd->ram_size >> 20; |
| 185 | sprintf(buf, "mem=%luM", mem); |
| 186 | linux_cmdline_set(buf, strlen(buf)); |
| 187 | |
| 188 | /* append rd_start and rd_size */ |
| 189 | rd_start = images->initrd_start; |
| 190 | rd_size = images->initrd_end - images->initrd_start; |
| 191 | |
| 192 | if (rd_size) { |
| 193 | sprintf(buf, "rd_start=0x%08lX", rd_start); |
| 194 | linux_cmdline_set(buf, strlen(buf)); |
| 195 | sprintf(buf, "rd_size=0x%lX", rd_size); |
| 196 | linux_cmdline_set(buf, strlen(buf)); |
| 197 | } |
| 198 | } |
| 199 | |
Daniel Schwierzeck | f9749fa | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 200 | static void boot_cmdline_linux(bootm_headers_t *images) |
| 201 | { |
Daniel Schwierzeck | 8d7ff4d | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 202 | if (mips_boot_cmdline_legacy && !images->ft_len) { |
Daniel Schwierzeck | f9749fa | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 203 | linux_cmdline_legacy(images); |
Daniel Schwierzeck | 2edd528 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 204 | |
| 205 | if (!mips_boot_env_legacy) |
| 206 | linux_cmdline_append(images); |
| 207 | |
Daniel Schwierzeck | f9749fa | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 208 | linux_cmdline_dump(); |
| 209 | } |
Daniel Schwierzeck | eb782d6 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 210 | } |
| 211 | |
Daniel Schwierzeck | 46145fb | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 212 | static void linux_env_init(void) |
| 213 | { |
| 214 | linux_env = (char **)(((ulong) linux_argp + 15) & ~15); |
| 215 | linux_env[0] = 0; |
| 216 | linux_env_p = (char *)(linux_env + LINUX_MAX_ENVS); |
| 217 | linux_env_idx = 0; |
| 218 | } |
| 219 | |
| 220 | static void linux_env_set(const char *env_name, const char *env_val) |
| 221 | { |
| 222 | if (linux_env_idx < LINUX_MAX_ENVS - 1) { |
| 223 | linux_env[linux_env_idx] = linux_env_p; |
| 224 | |
| 225 | strcpy(linux_env_p, env_name); |
| 226 | linux_env_p += strlen(env_name); |
| 227 | |
Paul Burton | 10a74b5 | 2013-11-09 10:22:08 +0000 | [diff] [blame] | 228 | if (mips_boot_malta) { |
Daniel Schwierzeck | 0dfa0b3 | 2013-05-30 19:04:20 +0200 | [diff] [blame] | 229 | linux_env_p++; |
| 230 | linux_env[++linux_env_idx] = linux_env_p; |
| 231 | } else { |
| 232 | *linux_env_p++ = '='; |
| 233 | } |
Daniel Schwierzeck | 46145fb | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 234 | |
| 235 | strcpy(linux_env_p, env_val); |
| 236 | linux_env_p += strlen(env_val); |
| 237 | |
| 238 | linux_env_p++; |
| 239 | linux_env[++linux_env_idx] = 0; |
| 240 | } |
| 241 | } |
| 242 | |
Daniel Schwierzeck | c07dc60 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 243 | static void linux_env_legacy(bootm_headers_t *images) |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 244 | { |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 245 | char env_buf[12]; |
Daniel Schwierzeck | 46145fb | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 246 | const char *cp; |
Daniel Schwierzeck | eaadb1a | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 247 | ulong rd_start, rd_size; |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 248 | |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 249 | #ifdef CONFIG_MEMSIZE_IN_BYTES |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 250 | sprintf(env_buf, "%lu", (ulong)gd->ram_size); |
| 251 | debug("## Giving linux memsize in bytes, %lu\n", (ulong)gd->ram_size); |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 252 | #else |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 253 | sprintf(env_buf, "%lu", (ulong)(gd->ram_size >> 20)); |
| 254 | debug("## Giving linux memsize in MB, %lu\n", |
Daniel Schwierzeck | 40f30c0 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 255 | (ulong)(gd->ram_size >> 20)); |
wdenk | 9b7f384 | 2003-10-09 20:09:04 +0000 | [diff] [blame] | 256 | #endif /* CONFIG_MEMSIZE_IN_BYTES */ |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 257 | |
Daniel Schwierzeck | eaadb1a | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 258 | rd_start = UNCACHED_SDRAM(images->initrd_start); |
| 259 | rd_size = images->initrd_end - images->initrd_start; |
| 260 | |
Daniel Schwierzeck | 46145fb | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 261 | linux_env_init(); |
| 262 | |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 263 | linux_env_set("memsize", env_buf); |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 264 | |
Daniel Schwierzeck | eaadb1a | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 265 | sprintf(env_buf, "0x%08lX", rd_start); |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 266 | linux_env_set("initrd_start", env_buf); |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 267 | |
Daniel Schwierzeck | eaadb1a | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 268 | sprintf(env_buf, "0x%lX", rd_size); |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 269 | linux_env_set("initrd_size", env_buf); |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 270 | |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 271 | sprintf(env_buf, "0x%08X", (uint) (gd->bd->bi_flashstart)); |
| 272 | linux_env_set("flash_start", env_buf); |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 273 | |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 274 | sprintf(env_buf, "0x%X", (uint) (gd->bd->bi_flashsize)); |
| 275 | linux_env_set("flash_size", env_buf); |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 276 | |
Jason McMullan | cfbe457 | 2008-06-08 23:56:00 -0400 | [diff] [blame] | 277 | cp = getenv("ethaddr"); |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 278 | if (cp) |
Jason McMullan | cfbe457 | 2008-06-08 23:56:00 -0400 | [diff] [blame] | 279 | linux_env_set("ethaddr", cp); |
Jason McMullan | cfbe457 | 2008-06-08 23:56:00 -0400 | [diff] [blame] | 280 | |
| 281 | cp = getenv("eth1addr"); |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 282 | if (cp) |
Jason McMullan | cfbe457 | 2008-06-08 23:56:00 -0400 | [diff] [blame] | 283 | linux_env_set("eth1addr", cp); |
Daniel Schwierzeck | 0dfa0b3 | 2013-05-30 19:04:20 +0200 | [diff] [blame] | 284 | |
Paul Burton | 43c4f59 | 2013-11-26 17:45:25 +0000 | [diff] [blame] | 285 | if (mips_boot_malta) { |
| 286 | sprintf(env_buf, "%un8r", gd->baudrate); |
| 287 | linux_env_set("modetty0", env_buf); |
| 288 | } |
Gabor Juhos | 72cb5f0 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 289 | } |
| 290 | |
Daniel Schwierzeck | c07dc60 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 291 | static void boot_prep_linux(bootm_headers_t *images) |
| 292 | { |
Daniel Schwierzeck | 8d7ff4d | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 293 | if (mips_boot_env_legacy && !images->ft_len) |
Daniel Schwierzeck | c07dc60 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 294 | linux_env_legacy(images); |
Daniel Schwierzeck | 8d7ff4d | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 295 | |
| 296 | if (images->ft_len) |
| 297 | boot_setup_fdt(images); |
Daniel Schwierzeck | c07dc60 | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 298 | } |
| 299 | |
Gabor Juhos | 72cb5f0 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 300 | static void boot_jump_linux(bootm_headers_t *images) |
| 301 | { |
Daniel Schwierzeck | 0b95a7c | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 302 | typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong); |
| 303 | kernel_entry_t kernel = (kernel_entry_t) images->ep; |
Daniel Schwierzeck | 0dfa0b3 | 2013-05-30 19:04:20 +0200 | [diff] [blame] | 304 | ulong linux_extra = 0; |
Gabor Juhos | 72cb5f0 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 305 | |
Daniel Schwierzeck | 0b95a7c | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 306 | debug("## Transferring control to Linux (at address %p) ...\n", kernel); |
Gabor Juhos | 72cb5f0 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 307 | |
| 308 | bootstage_mark(BOOTSTAGE_ID_RUN_OS); |
| 309 | |
Paul Burton | 10a74b5 | 2013-11-09 10:22:08 +0000 | [diff] [blame] | 310 | if (mips_boot_malta) |
Daniel Schwierzeck | 0dfa0b3 | 2013-05-30 19:04:20 +0200 | [diff] [blame] | 311 | linux_extra = gd->ram_size; |
| 312 | |
Daniel Schwierzeck | 1a4797c | 2015-01-14 21:44:13 +0100 | [diff] [blame] | 313 | #ifdef CONFIG_BOOTSTAGE_FDT |
| 314 | bootstage_fdt_add_report(); |
| 315 | #endif |
| 316 | #ifdef CONFIG_BOOTSTAGE_REPORT |
| 317 | bootstage_report(); |
| 318 | #endif |
Gabor Juhos | 72cb5f0 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 319 | |
Daniel Schwierzeck | 0dfa0b3 | 2013-05-30 19:04:20 +0200 | [diff] [blame] | 320 | kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env, linux_extra); |
Gabor Juhos | 72cb5f0 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | int do_bootm_linux(int flag, int argc, char * const argv[], |
| 324 | bootm_headers_t *images) |
| 325 | { |
Daniel Schwierzeck | 0665838 | 2014-11-16 01:27:23 +0100 | [diff] [blame] | 326 | int ret; |
| 327 | |
Gabor Juhos | 7f959fd | 2013-01-07 02:53:42 +0000 | [diff] [blame] | 328 | /* No need for those on MIPS */ |
Daniel Schwierzeck | eb782d6 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 329 | if (flag & BOOTM_STATE_OS_BD_T) |
Gabor Juhos | 7f959fd | 2013-01-07 02:53:42 +0000 | [diff] [blame] | 330 | return -1; |
| 331 | |
Daniel Schwierzeck | eb782d6 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 332 | if (flag & BOOTM_STATE_OS_CMDLINE) { |
| 333 | boot_cmdline_linux(images); |
| 334 | return 0; |
| 335 | } |
| 336 | |
Gabor Juhos | 7f959fd | 2013-01-07 02:53:42 +0000 | [diff] [blame] | 337 | if (flag & BOOTM_STATE_OS_PREP) { |
| 338 | boot_prep_linux(images); |
| 339 | return 0; |
| 340 | } |
| 341 | |
| 342 | if (flag & BOOTM_STATE_OS_GO) { |
| 343 | boot_jump_linux(images); |
| 344 | return 0; |
| 345 | } |
Jason McMullan | cfbe457 | 2008-06-08 23:56:00 -0400 | [diff] [blame] | 346 | |
Daniel Schwierzeck | 0665838 | 2014-11-16 01:27:23 +0100 | [diff] [blame] | 347 | ret = boot_setup_linux(images); |
| 348 | if (ret) |
| 349 | return ret; |
| 350 | |
Daniel Schwierzeck | eb782d6 | 2013-05-09 17:10:06 +0200 | [diff] [blame] | 351 | boot_cmdline_linux(images); |
Gabor Juhos | 72cb5f0 | 2013-01-07 02:53:41 +0000 | [diff] [blame] | 352 | boot_prep_linux(images); |
Gabor Juhos | e0d783b | 2013-01-07 02:53:40 +0000 | [diff] [blame] | 353 | boot_jump_linux(images); |
Daniel Schwierzeck | 83010eb | 2012-06-03 23:46:04 +0200 | [diff] [blame] | 354 | |
Marian Balakowicz | df8ff33 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 355 | /* does not return */ |
Kumar Gala | 48626aa | 2008-08-15 08:24:45 -0500 | [diff] [blame] | 356 | return 1; |
wdenk | bb1b826 | 2003-03-27 12:09:35 +0000 | [diff] [blame] | 357 | } |