]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/mips/lib/bootm_qemu_mips.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / arch / mips / lib / bootm_qemu_mips.c
CommitLineData
1de1fa40
JCPV
1/*
2 * (C) Copyright 2008
3 * Jean-Christophe PLAGNIOL-VILLARD <jcplagniol@jcrosoft.com>
4 *
1a459660 5 * SPDX-License-Identifier: GPL-2.0+
1de1fa40
JCPV
6 */
7
8#include <common.h>
9#include <command.h>
10#include <image.h>
11#include <asm/byteorder.h>
12#include <asm/addrspace.h>
13
14DECLARE_GLOBAL_DATA_PTR;
15
ed530104
DS
16int do_bootm_linux(int flag, int argc, char * const argv[],
17 bootm_headers_t *images)
1de1fa40 18{
ed530104
DS
19 void (*theKernel) (int, char **, char **, int *);
20 char *bootargs = getenv("bootargs");
21 char *start;
22 uint len;
1de1fa40
JCPV
23
24 /* find kernel entry point */
25 theKernel = (void (*)(int, char **, char **, int *))images->ep;
26
770605e4 27 bootstage_mark(BOOTSTAGE_ID_RUN_OS);
1de1fa40 28
ed530104 29 debug("## Transferring control to Linux (at address %08lx) ...\n",
1de1fa40
JCPV
30 (ulong) theKernel);
31
32 gd->bd->bi_boot_params = gd->bd->bi_memstart + (16 << 20) - 256;
ed530104 33 debug("%-12s= 0x%08lX\n", "boot_params", (ulong)gd->bd->bi_boot_params);
1de1fa40
JCPV
34
35 /* set Magic */
36 *(int32_t *)(gd->bd->bi_boot_params - 4) = 0x12345678;
37 /* set ram_size */
38 *(int32_t *)(gd->bd->bi_boot_params - 8) = gd->ram_size;
39
ed530104 40 start = (char *)gd->bd->bi_boot_params;
1de1fa40
JCPV
41
42 len = strlen(bootargs);
43
44 strncpy(start, bootargs, len + 1);
45
46 start += len;
47
48 len = images->rd_end - images->rd_start;
49 if (len > 0) {
ed530104
DS
50 start += sprintf(start, " rd_start=0x%08X rd_size=0x%0X",
51 (uint) UNCACHED_SDRAM(images->rd_start),
1de1fa40
JCPV
52 (uint) len);
53 }
54
55 /* we assume that the kernel is in place */
ed530104
DS
56 printf("\nStarting kernel ...\n\n");
57
58 theKernel(0, NULL, NULL, 0);
1de1fa40 59
1de1fa40
JCPV
60 /* does not return */
61 return 1;
62}