1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2011 Andes Technology Corporation
4 * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
5 * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
6 * Rick Chen, Andes Technology Corporation <rick@andestech.com>
12 #include <u-boot/zlib.h>
13 #include <asm/byteorder.h>
14 #include <asm/bootm.h>
16 DECLARE_GLOBAL_DATA_PTR;
18 int arch_fixup_fdt(void *blob)
23 int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
27 int machid = bd->bi_arch_number;
28 void (*theKernel)(int arch, uint params);
31 * allow the PREP bootm subcommand, it is required for bootm to work
33 if (flag & BOOTM_STATE_OS_PREP)
36 if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
39 theKernel = (void (*)(int, uint))images->ep;
41 s = env_get("machid");
43 machid = simple_strtoul(s, NULL, 16);
44 printf("Using machid 0x%x from environment\n", machid);
47 bootstage_mark(BOOTSTAGE_ID_RUN_OS);
49 debug("## Transferring control to Linux (at address %08lx) ...\n",
52 if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {
53 #ifdef CONFIG_OF_LIBFDT
54 debug("using: FDT\n");
55 if (image_setup_linux(images)) {
56 printf("FDT creation failed! hanging...");
62 /* we assume that the kernel is in place */
63 printf("\nStarting kernel ...\n\n");
65 cleanup_before_linux();
66 if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)
67 theKernel(machid, (unsigned long)images->ft_addr);