1ea0364f1SPeter Tyser /* 2ea0364f1SPeter Tyser * (C) Copyright 2003 3ea0364f1SPeter Tyser * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4ea0364f1SPeter Tyser * 51a459660SWolfgang Denk * SPDX-License-Identifier: GPL-2.0+ 6ea0364f1SPeter Tyser */ 7ea0364f1SPeter Tyser 8ea0364f1SPeter Tyser #include <common.h> 9ea0364f1SPeter Tyser #include <image.h> 105002d8ccSDaniel Schwierzeck #include <fdt_support.h> 11ea0364f1SPeter Tyser #include <asm/addrspace.h> 12ea0364f1SPeter Tyser 13ea0364f1SPeter Tyser DECLARE_GLOBAL_DATA_PTR; 14ea0364f1SPeter Tyser 15ea0364f1SPeter Tyser #define LINUX_MAX_ENVS 256 16ea0364f1SPeter Tyser #define LINUX_MAX_ARGS 256 17ea0364f1SPeter Tyser 187a9d109bSPaul Burton #if defined(CONFIG_MALTA) 197a9d109bSPaul Burton #define mips_boot_malta 1 20b87493f4SDaniel Schwierzeck #else 217a9d109bSPaul Burton #define mips_boot_malta 0 22b87493f4SDaniel Schwierzeck #endif 23b87493f4SDaniel Schwierzeck 24ea0364f1SPeter Tyser static int linux_argc; 25ea0364f1SPeter Tyser static char **linux_argv; 2659e8cbdbSDaniel Schwierzeck static char *linux_argp; 27ea0364f1SPeter Tyser 28ea0364f1SPeter Tyser static char **linux_env; 29ea0364f1SPeter Tyser static char *linux_env_p; 30ea0364f1SPeter Tyser static int linux_env_idx; 31ea0364f1SPeter Tyser 32f66cc1e3SDaniel Schwierzeck static ulong arch_get_sp(void) 33f66cc1e3SDaniel Schwierzeck { 34f66cc1e3SDaniel Schwierzeck ulong ret; 35f66cc1e3SDaniel Schwierzeck 36f66cc1e3SDaniel Schwierzeck __asm__ __volatile__("move %0, $sp" : "=r"(ret) : ); 37f66cc1e3SDaniel Schwierzeck 38f66cc1e3SDaniel Schwierzeck return ret; 39f66cc1e3SDaniel Schwierzeck } 40f66cc1e3SDaniel Schwierzeck 41f66cc1e3SDaniel Schwierzeck void arch_lmb_reserve(struct lmb *lmb) 42f66cc1e3SDaniel Schwierzeck { 43f66cc1e3SDaniel Schwierzeck ulong sp; 44f66cc1e3SDaniel Schwierzeck 45f66cc1e3SDaniel Schwierzeck sp = arch_get_sp(); 46f66cc1e3SDaniel Schwierzeck debug("## Current stack ends at 0x%08lx\n", sp); 47f66cc1e3SDaniel Schwierzeck 48f66cc1e3SDaniel Schwierzeck /* adjust sp by 4K to be safe */ 49f66cc1e3SDaniel Schwierzeck sp -= 4096; 50f66cc1e3SDaniel Schwierzeck lmb_reserve(lmb, sp, CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp); 51f66cc1e3SDaniel Schwierzeck } 52f66cc1e3SDaniel Schwierzeck 5359e8cbdbSDaniel Schwierzeck static void linux_cmdline_init(void) 5459e8cbdbSDaniel Schwierzeck { 5559e8cbdbSDaniel Schwierzeck linux_argc = 1; 5659e8cbdbSDaniel Schwierzeck linux_argv = (char **)UNCACHED_SDRAM(gd->bd->bi_boot_params); 5759e8cbdbSDaniel Schwierzeck linux_argv[0] = 0; 5859e8cbdbSDaniel Schwierzeck linux_argp = (char *)(linux_argv + LINUX_MAX_ARGS); 5959e8cbdbSDaniel Schwierzeck } 6059e8cbdbSDaniel Schwierzeck 6159e8cbdbSDaniel Schwierzeck static void linux_cmdline_set(const char *value, size_t len) 6259e8cbdbSDaniel Schwierzeck { 6359e8cbdbSDaniel Schwierzeck linux_argv[linux_argc] = linux_argp; 6459e8cbdbSDaniel Schwierzeck memcpy(linux_argp, value, len); 6559e8cbdbSDaniel Schwierzeck linux_argp[len] = 0; 6659e8cbdbSDaniel Schwierzeck 6759e8cbdbSDaniel Schwierzeck linux_argp += len + 1; 6859e8cbdbSDaniel Schwierzeck linux_argc++; 6959e8cbdbSDaniel Schwierzeck } 7059e8cbdbSDaniel Schwierzeck 7159e8cbdbSDaniel Schwierzeck static void linux_cmdline_dump(void) 7259e8cbdbSDaniel Schwierzeck { 7359e8cbdbSDaniel Schwierzeck int i; 7459e8cbdbSDaniel Schwierzeck 7559e8cbdbSDaniel Schwierzeck debug("## cmdline argv at 0x%p, argp at 0x%p\n", 7659e8cbdbSDaniel Schwierzeck linux_argv, linux_argp); 7759e8cbdbSDaniel Schwierzeck 7859e8cbdbSDaniel Schwierzeck for (i = 1; i < linux_argc; i++) 7959e8cbdbSDaniel Schwierzeck debug(" arg %03d: %s\n", i, linux_argv[i]); 8059e8cbdbSDaniel Schwierzeck } 8159e8cbdbSDaniel Schwierzeck 8225fc664fSDaniel Schwierzeck static void linux_cmdline_legacy(bootm_headers_t *images) 8359e8cbdbSDaniel Schwierzeck { 8459e8cbdbSDaniel Schwierzeck const char *bootargs, *next, *quote; 8559e8cbdbSDaniel Schwierzeck 8659e8cbdbSDaniel Schwierzeck linux_cmdline_init(); 8759e8cbdbSDaniel Schwierzeck 8859e8cbdbSDaniel Schwierzeck bootargs = getenv("bootargs"); 8959e8cbdbSDaniel Schwierzeck if (!bootargs) 9059e8cbdbSDaniel Schwierzeck return; 9159e8cbdbSDaniel Schwierzeck 9259e8cbdbSDaniel Schwierzeck next = bootargs; 9359e8cbdbSDaniel Schwierzeck 9459e8cbdbSDaniel Schwierzeck while (bootargs && *bootargs && linux_argc < LINUX_MAX_ARGS) { 9559e8cbdbSDaniel Schwierzeck quote = strchr(bootargs, '"'); 9659e8cbdbSDaniel Schwierzeck next = strchr(bootargs, ' '); 9759e8cbdbSDaniel Schwierzeck 9859e8cbdbSDaniel Schwierzeck while (next && quote && quote < next) { 9959e8cbdbSDaniel Schwierzeck /* 10059e8cbdbSDaniel Schwierzeck * we found a left quote before the next blank 10159e8cbdbSDaniel Schwierzeck * now we have to find the matching right quote 10259e8cbdbSDaniel Schwierzeck */ 10359e8cbdbSDaniel Schwierzeck next = strchr(quote + 1, '"'); 10459e8cbdbSDaniel Schwierzeck if (next) { 10559e8cbdbSDaniel Schwierzeck quote = strchr(next + 1, '"'); 10659e8cbdbSDaniel Schwierzeck next = strchr(next + 1, ' '); 10759e8cbdbSDaniel Schwierzeck } 10859e8cbdbSDaniel Schwierzeck } 10959e8cbdbSDaniel Schwierzeck 11059e8cbdbSDaniel Schwierzeck if (!next) 11159e8cbdbSDaniel Schwierzeck next = bootargs + strlen(bootargs); 11259e8cbdbSDaniel Schwierzeck 11359e8cbdbSDaniel Schwierzeck linux_cmdline_set(bootargs, next - bootargs); 11459e8cbdbSDaniel Schwierzeck 11559e8cbdbSDaniel Schwierzeck if (*next) 11659e8cbdbSDaniel Schwierzeck next++; 11759e8cbdbSDaniel Schwierzeck 11859e8cbdbSDaniel Schwierzeck bootargs = next; 11959e8cbdbSDaniel Schwierzeck } 12025fc664fSDaniel Schwierzeck } 12159e8cbdbSDaniel Schwierzeck 1228cec725aSDaniel Schwierzeck static void linux_cmdline_append(bootm_headers_t *images) 1238cec725aSDaniel Schwierzeck { 1248cec725aSDaniel Schwierzeck char buf[24]; 1258cec725aSDaniel Schwierzeck ulong mem, rd_start, rd_size; 1268cec725aSDaniel Schwierzeck 1278cec725aSDaniel Schwierzeck /* append mem */ 1288cec725aSDaniel Schwierzeck mem = gd->ram_size >> 20; 1298cec725aSDaniel Schwierzeck sprintf(buf, "mem=%luM", mem); 1308cec725aSDaniel Schwierzeck linux_cmdline_set(buf, strlen(buf)); 1318cec725aSDaniel Schwierzeck 1328cec725aSDaniel Schwierzeck /* append rd_start and rd_size */ 1338cec725aSDaniel Schwierzeck rd_start = images->initrd_start; 1348cec725aSDaniel Schwierzeck rd_size = images->initrd_end - images->initrd_start; 1358cec725aSDaniel Schwierzeck 1368cec725aSDaniel Schwierzeck if (rd_size) { 1378cec725aSDaniel Schwierzeck sprintf(buf, "rd_start=0x%08lX", rd_start); 1388cec725aSDaniel Schwierzeck linux_cmdline_set(buf, strlen(buf)); 1398cec725aSDaniel Schwierzeck sprintf(buf, "rd_size=0x%lX", rd_size); 1408cec725aSDaniel Schwierzeck linux_cmdline_set(buf, strlen(buf)); 1418cec725aSDaniel Schwierzeck } 1428cec725aSDaniel Schwierzeck } 1438cec725aSDaniel Schwierzeck 14415f8aa90SDaniel Schwierzeck static void linux_env_init(void) 14515f8aa90SDaniel Schwierzeck { 14615f8aa90SDaniel Schwierzeck linux_env = (char **)(((ulong) linux_argp + 15) & ~15); 14715f8aa90SDaniel Schwierzeck linux_env[0] = 0; 14815f8aa90SDaniel Schwierzeck linux_env_p = (char *)(linux_env + LINUX_MAX_ENVS); 14915f8aa90SDaniel Schwierzeck linux_env_idx = 0; 15015f8aa90SDaniel Schwierzeck } 15115f8aa90SDaniel Schwierzeck 15215f8aa90SDaniel Schwierzeck static void linux_env_set(const char *env_name, const char *env_val) 15315f8aa90SDaniel Schwierzeck { 15415f8aa90SDaniel Schwierzeck if (linux_env_idx < LINUX_MAX_ENVS - 1) { 15515f8aa90SDaniel Schwierzeck linux_env[linux_env_idx] = linux_env_p; 15615f8aa90SDaniel Schwierzeck 15715f8aa90SDaniel Schwierzeck strcpy(linux_env_p, env_name); 15815f8aa90SDaniel Schwierzeck linux_env_p += strlen(env_name); 15915f8aa90SDaniel Schwierzeck 1607a9d109bSPaul Burton if (mips_boot_malta) { 161b87493f4SDaniel Schwierzeck linux_env_p++; 162b87493f4SDaniel Schwierzeck linux_env[++linux_env_idx] = linux_env_p; 163b87493f4SDaniel Schwierzeck } else { 16415f8aa90SDaniel Schwierzeck *linux_env_p++ = '='; 165b87493f4SDaniel Schwierzeck } 16615f8aa90SDaniel Schwierzeck 16715f8aa90SDaniel Schwierzeck strcpy(linux_env_p, env_val); 16815f8aa90SDaniel Schwierzeck linux_env_p += strlen(env_val); 16915f8aa90SDaniel Schwierzeck 17015f8aa90SDaniel Schwierzeck linux_env_p++; 17115f8aa90SDaniel Schwierzeck linux_env[++linux_env_idx] = 0; 17215f8aa90SDaniel Schwierzeck } 17315f8aa90SDaniel Schwierzeck } 17415f8aa90SDaniel Schwierzeck 175ca65e585SDaniel Schwierzeck static void linux_env_legacy(bootm_headers_t *images) 176ea0364f1SPeter Tyser { 177ea0364f1SPeter Tyser char env_buf[12]; 17815f8aa90SDaniel Schwierzeck const char *cp; 1796c154552SDaniel Schwierzeck ulong rd_start, rd_size; 180ea0364f1SPeter Tyser 181ea0364f1SPeter Tyser #ifdef CONFIG_MEMSIZE_IN_BYTES 182ea0364f1SPeter Tyser sprintf(env_buf, "%lu", (ulong)gd->ram_size); 183ea0364f1SPeter Tyser debug("## Giving linux memsize in bytes, %lu\n", (ulong)gd->ram_size); 184ea0364f1SPeter Tyser #else 185ea0364f1SPeter Tyser sprintf(env_buf, "%lu", (ulong)(gd->ram_size >> 20)); 186e51a6b7aSDaniel Schwierzeck debug("## Giving linux memsize in MB, %lu\n", 187e51a6b7aSDaniel Schwierzeck (ulong)(gd->ram_size >> 20)); 188ea0364f1SPeter Tyser #endif /* CONFIG_MEMSIZE_IN_BYTES */ 189ea0364f1SPeter Tyser 1906c154552SDaniel Schwierzeck rd_start = UNCACHED_SDRAM(images->initrd_start); 1916c154552SDaniel Schwierzeck rd_size = images->initrd_end - images->initrd_start; 1926c154552SDaniel Schwierzeck 19315f8aa90SDaniel Schwierzeck linux_env_init(); 19415f8aa90SDaniel Schwierzeck 195ea0364f1SPeter Tyser linux_env_set("memsize", env_buf); 196ea0364f1SPeter Tyser 1976c154552SDaniel Schwierzeck sprintf(env_buf, "0x%08lX", rd_start); 198ea0364f1SPeter Tyser linux_env_set("initrd_start", env_buf); 199ea0364f1SPeter Tyser 2006c154552SDaniel Schwierzeck sprintf(env_buf, "0x%lX", rd_size); 201ea0364f1SPeter Tyser linux_env_set("initrd_size", env_buf); 202ea0364f1SPeter Tyser 203ea0364f1SPeter Tyser sprintf(env_buf, "0x%08X", (uint) (gd->bd->bi_flashstart)); 204ea0364f1SPeter Tyser linux_env_set("flash_start", env_buf); 205ea0364f1SPeter Tyser 206ea0364f1SPeter Tyser sprintf(env_buf, "0x%X", (uint) (gd->bd->bi_flashsize)); 207ea0364f1SPeter Tyser linux_env_set("flash_size", env_buf); 208ea0364f1SPeter Tyser 209ea0364f1SPeter Tyser cp = getenv("ethaddr"); 210e51a6b7aSDaniel Schwierzeck if (cp) 211ea0364f1SPeter Tyser linux_env_set("ethaddr", cp); 212ea0364f1SPeter Tyser 213ea0364f1SPeter Tyser cp = getenv("eth1addr"); 214e51a6b7aSDaniel Schwierzeck if (cp) 215ea0364f1SPeter Tyser linux_env_set("eth1addr", cp); 216b87493f4SDaniel Schwierzeck 217d18d49d7SPaul Burton if (mips_boot_malta) { 218d18d49d7SPaul Burton sprintf(env_buf, "%un8r", gd->baudrate); 219d18d49d7SPaul Burton linux_env_set("modetty0", env_buf); 220d18d49d7SPaul Burton } 2210ea7213fSGabor Juhos } 222ea0364f1SPeter Tyser 223*2bb5b638SDaniel Schwierzeck static int boot_reloc_ramdisk(bootm_headers_t *images) 224*2bb5b638SDaniel Schwierzeck { 225*2bb5b638SDaniel Schwierzeck ulong rd_len = images->rd_end - images->rd_start; 226*2bb5b638SDaniel Schwierzeck 227*2bb5b638SDaniel Schwierzeck /* 228*2bb5b638SDaniel Schwierzeck * In case of legacy uImage's, relocation of ramdisk is already done 229*2bb5b638SDaniel Schwierzeck * by do_bootm_states() and should not repeated in 'bootm prep'. 230*2bb5b638SDaniel Schwierzeck */ 231*2bb5b638SDaniel Schwierzeck if (images->state & BOOTM_STATE_RAMDISK) { 232*2bb5b638SDaniel Schwierzeck debug("## Ramdisk already relocated\n"); 233*2bb5b638SDaniel Schwierzeck return 0; 234*2bb5b638SDaniel Schwierzeck } 235*2bb5b638SDaniel Schwierzeck 236*2bb5b638SDaniel Schwierzeck return boot_ramdisk_high(&images->lmb, images->rd_start, 237*2bb5b638SDaniel Schwierzeck rd_len, &images->initrd_start, &images->initrd_end); 238*2bb5b638SDaniel Schwierzeck } 239*2bb5b638SDaniel Schwierzeck 240*2bb5b638SDaniel Schwierzeck static int boot_reloc_fdt(bootm_headers_t *images) 241*2bb5b638SDaniel Schwierzeck { 242*2bb5b638SDaniel Schwierzeck /* 243*2bb5b638SDaniel Schwierzeck * In case of legacy uImage's, relocation of FDT is already done 244*2bb5b638SDaniel Schwierzeck * by do_bootm_states() and should not repeated in 'bootm prep'. 245*2bb5b638SDaniel Schwierzeck */ 246*2bb5b638SDaniel Schwierzeck if (images->state & BOOTM_STATE_FDT) { 247*2bb5b638SDaniel Schwierzeck debug("## FDT already relocated\n"); 248*2bb5b638SDaniel Schwierzeck return 0; 249*2bb5b638SDaniel Schwierzeck } 250*2bb5b638SDaniel Schwierzeck 251*2bb5b638SDaniel Schwierzeck #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) 252*2bb5b638SDaniel Schwierzeck boot_fdt_add_mem_rsv_regions(&images->lmb, images->ft_addr); 253*2bb5b638SDaniel Schwierzeck return boot_relocate_fdt(&images->lmb, &images->ft_addr, 254*2bb5b638SDaniel Schwierzeck &images->ft_len); 255*2bb5b638SDaniel Schwierzeck #else 256*2bb5b638SDaniel Schwierzeck return 0; 257*2bb5b638SDaniel Schwierzeck #endif 258*2bb5b638SDaniel Schwierzeck } 259*2bb5b638SDaniel Schwierzeck 260*2bb5b638SDaniel Schwierzeck int arch_fixup_memory_node(void *blob) 261*2bb5b638SDaniel Schwierzeck { 262*2bb5b638SDaniel Schwierzeck #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT) 263*2bb5b638SDaniel Schwierzeck u64 mem_start = 0; 264*2bb5b638SDaniel Schwierzeck u64 mem_size = gd->ram_size; 265*2bb5b638SDaniel Schwierzeck 266*2bb5b638SDaniel Schwierzeck return fdt_fixup_memory_banks(blob, &mem_start, &mem_size, 1); 267*2bb5b638SDaniel Schwierzeck #else 268*2bb5b638SDaniel Schwierzeck return 0; 269*2bb5b638SDaniel Schwierzeck #endif 270*2bb5b638SDaniel Schwierzeck } 271*2bb5b638SDaniel Schwierzeck 272*2bb5b638SDaniel Schwierzeck static int boot_setup_fdt(bootm_headers_t *images) 273*2bb5b638SDaniel Schwierzeck { 274*2bb5b638SDaniel Schwierzeck return image_setup_libfdt(images, images->ft_addr, images->ft_len, 275*2bb5b638SDaniel Schwierzeck &images->lmb); 276*2bb5b638SDaniel Schwierzeck } 277*2bb5b638SDaniel Schwierzeck 278ca65e585SDaniel Schwierzeck static void boot_prep_linux(bootm_headers_t *images) 279ca65e585SDaniel Schwierzeck { 280*2bb5b638SDaniel Schwierzeck boot_reloc_ramdisk(images); 281*2bb5b638SDaniel Schwierzeck 282*2bb5b638SDaniel Schwierzeck if (CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && images->ft_len) { 283*2bb5b638SDaniel Schwierzeck boot_reloc_fdt(images); 284*2bb5b638SDaniel Schwierzeck boot_setup_fdt(images); 285*2bb5b638SDaniel Schwierzeck } else { 286*2bb5b638SDaniel Schwierzeck if (CONFIG_IS_ENABLED(CONFIG_MIPS_BOOT_ENV_LEGACY)) 287ca65e585SDaniel Schwierzeck linux_env_legacy(images); 2885002d8ccSDaniel Schwierzeck 289*2bb5b638SDaniel Schwierzeck if (CONFIG_IS_ENABLED(MIPS_BOOT_CMDLINE_LEGACY)) { 290*2bb5b638SDaniel Schwierzeck linux_cmdline_legacy(images); 291*2bb5b638SDaniel Schwierzeck 292*2bb5b638SDaniel Schwierzeck if (!CONFIG_IS_ENABLED(CONFIG_MIPS_BOOT_ENV_LEGACY)) 293*2bb5b638SDaniel Schwierzeck linux_cmdline_append(images); 294*2bb5b638SDaniel Schwierzeck 295*2bb5b638SDaniel Schwierzeck linux_cmdline_dump(); 296*2bb5b638SDaniel Schwierzeck } 297*2bb5b638SDaniel Schwierzeck } 298ca65e585SDaniel Schwierzeck } 299ca65e585SDaniel Schwierzeck 3000ea7213fSGabor Juhos static void boot_jump_linux(bootm_headers_t *images) 3010ea7213fSGabor Juhos { 302c4b37847SDaniel Schwierzeck typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong); 303c4b37847SDaniel Schwierzeck kernel_entry_t kernel = (kernel_entry_t) images->ep; 304b87493f4SDaniel Schwierzeck ulong linux_extra = 0; 3050ea7213fSGabor Juhos 306c4b37847SDaniel Schwierzeck debug("## Transferring control to Linux (at address %p) ...\n", kernel); 3070ea7213fSGabor Juhos 3080ea7213fSGabor Juhos bootstage_mark(BOOTSTAGE_ID_RUN_OS); 3090ea7213fSGabor Juhos 3107a9d109bSPaul Burton if (mips_boot_malta) 311b87493f4SDaniel Schwierzeck linux_extra = gd->ram_size; 312b87493f4SDaniel Schwierzeck 313e13a50b3SDaniel Schwierzeck #ifdef CONFIG_BOOTSTAGE_FDT 314e13a50b3SDaniel Schwierzeck bootstage_fdt_add_report(); 315e13a50b3SDaniel Schwierzeck #endif 316e13a50b3SDaniel Schwierzeck #ifdef CONFIG_BOOTSTAGE_REPORT 317e13a50b3SDaniel Schwierzeck bootstage_report(); 318e13a50b3SDaniel Schwierzeck #endif 3190ea7213fSGabor Juhos 32090b1c9faSDaniel Schwierzeck if (images->ft_len) 32190b1c9faSDaniel Schwierzeck kernel(-2, (ulong)images->ft_addr, 0, 0); 32290b1c9faSDaniel Schwierzeck else 32390b1c9faSDaniel Schwierzeck kernel(linux_argc, (ulong)linux_argv, (ulong)linux_env, 32490b1c9faSDaniel Schwierzeck linux_extra); 3250ea7213fSGabor Juhos } 3260ea7213fSGabor Juhos 3270ea7213fSGabor Juhos int do_bootm_linux(int flag, int argc, char * const argv[], 3280ea7213fSGabor Juhos bootm_headers_t *images) 3290ea7213fSGabor Juhos { 3309c170e2eSGabor Juhos /* No need for those on MIPS */ 33159e8cbdbSDaniel Schwierzeck if (flag & BOOTM_STATE_OS_BD_T) 3329c170e2eSGabor Juhos return -1; 3339c170e2eSGabor Juhos 334*2bb5b638SDaniel Schwierzeck /* 335*2bb5b638SDaniel Schwierzeck * Cmdline init has been moved to 'bootm prep' because it has to be 336*2bb5b638SDaniel Schwierzeck * done after relocation of ramdisk to always pass correct values 337*2bb5b638SDaniel Schwierzeck * for rd_start and rd_size to Linux kernel. 338*2bb5b638SDaniel Schwierzeck */ 339*2bb5b638SDaniel Schwierzeck if (flag & BOOTM_STATE_OS_CMDLINE) 34059e8cbdbSDaniel Schwierzeck return 0; 34159e8cbdbSDaniel Schwierzeck 3429c170e2eSGabor Juhos if (flag & BOOTM_STATE_OS_PREP) { 3439c170e2eSGabor Juhos boot_prep_linux(images); 3449c170e2eSGabor Juhos return 0; 3459c170e2eSGabor Juhos } 3469c170e2eSGabor Juhos 347*2bb5b638SDaniel Schwierzeck if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) { 3489c170e2eSGabor Juhos boot_jump_linux(images); 3499c170e2eSGabor Juhos return 0; 3509c170e2eSGabor Juhos } 3510ea7213fSGabor Juhos 352ea0364f1SPeter Tyser /* does not return */ 353ea0364f1SPeter Tyser return 1; 354ea0364f1SPeter Tyser } 355