barebox/arch/arm/lib/bootu.c
Sascha Hauer f30b191e36 of: make of_get_fixed_tree more universally usable
Currently the bootm code uses of_fix_tree to apply the fixups
to the devicetree given on the command line. This function assumes
that there is enough space for the fixups available. Also on ARM
we have to make sure the tree does not cross 1Mib boundaries.

This patch moves the space allocation and alignment ensurance
to of_get_fixed_tree and uses it in bootm. This is the first
step for making of_get_fixed_tree the single point of devicetree
handling in barebox.
of_get_fixed_tree now takes an argument of the input fdt. If it is
given, this one is used, otherwise an internal oftree is used which
will be created in subsequent patches.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-11 14:08:30 +01:00

43 lines
790 B
C

#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(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(NULL);
#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 = "start a raw linux image",
BAREBOX_CMD_HELP(cmd_bootu_help)
BAREBOX_CMD_END