3 * Jean-Christophe PLAGNIOL-VILLARD <jcplagniol@jcrosoft.com>
5 * SPDX-License-Identifier: GPL-2.0+
11 #include <asm/byteorder.h>
12 #include <asm/addrspace.h>
14 DECLARE_GLOBAL_DATA_PTR;
16 int do_bootm_linux(int flag, int argc, char * const argv[],
17 bootm_headers_t *images)
19 void (*theKernel) (int, char **, char **, int *);
20 char *bootargs = getenv("bootargs");
24 /* find kernel entry point */
25 theKernel = (void (*)(int, char **, char **, int *))images->ep;
27 bootstage_mark(BOOTSTAGE_ID_RUN_OS);
29 debug("## Transferring control to Linux (at address %08lx) ...\n",
32 gd->bd->bi_boot_params = gd->bd->bi_memstart + (16 << 20) - 256;
33 debug("%-12s= 0x%08lX\n", "boot_params", (ulong)gd->bd->bi_boot_params);
36 *(int32_t *)(gd->bd->bi_boot_params - 4) = 0x12345678;
38 *(int32_t *)(gd->bd->bi_boot_params - 8) = gd->ram_size;
40 start = (char *)gd->bd->bi_boot_params;
42 len = strlen(bootargs);
44 strncpy(start, bootargs, len + 1);
48 len = images->rd_end - images->rd_start;
50 start += sprintf(start, " rd_start=0x%08X rd_size=0x%0X",
51 (uint) UNCACHED_SDRAM(images->rd_start),
55 /* we assume that the kernel is in place */
56 printf("\nStarting kernel ...\n\n");
58 theKernel(0, NULL, NULL, 0);