summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/bootu.c
blob: d93c5faf1c037fb8df6e4d9b9a03e55464a29127 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <common.h>
#include <command.h>
#include <fs.h>
#include <fcntl.h>
#include <errno.h>
#include <of.h>
#include <asm/armlinux.h>

static int do_bootu(struct command *cmdtp, int argc, char *argv[])
{
	int fd;
	void *kernel = NULL;
	void *oftree = NULL;

	if (argc != 2)
		return COMMAND_ERROR_USAGE;

	fd = open(argv[1], O_RDONLY);
	if (fd > 0)
		kernel = (void *)memmap(fd, PROT_READ);

	if (!kernel)
		kernel = (void *)simple_strtoul(argv[1], NULL, 0);

#ifdef CONFIG_OFTREE
	oftree = of_get_fixed_tree();
#endif

	start_linux(kernel, 0, 0, 0, oftree);

	return 1;
}

static const __maybe_unused char cmd_bootu_help[] =
"Usage: bootu <address>\n";

BAREBOX_CMD_START(bootu)
	.cmd            = do_bootu,
	.usage          = "bootu - start a raw linux image",
	BAREBOX_CMD_HELP(cmd_bootu_help)
BAREBOX_CMD_END