9
0
Fork 0

ARM: move bootu code to its own file

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2011-04-01 14:21:29 +02:00
parent f103a9843e
commit 973069dcaf
3 changed files with 39 additions and 33 deletions

View File

@ -1,6 +1,7 @@
obj-$(CONFIG_ARM_LINUX) += armlinux.o
obj-$(CONFIG_CMD_BOOTM) += bootm.o
obj-$(CONFIG_CMD_BOOTZ) += bootz.o
obj-$(CONFIG_CMD_BOOTU) += bootu.o
obj-y += div0.o
obj-y += findbit.o
obj-y += arm.o

View File

@ -231,36 +231,3 @@ void start_linux(void *adr, int swap, struct image_data *data)
kernel(0, armlinux_architecture, armlinux_bootparams);
}
#ifdef CONFIG_CMD_BOOTU
static int do_bootu(struct command *cmdtp, int argc, char *argv[])
{
void (*theKernel)(int zero, int arch, void *params) = NULL;
int fd;
if (argc != 2) {
barebox_cmd_usage(cmdtp);
return 1;
}
fd = open(argv[1], O_RDONLY);
if (fd > 0)
theKernel = (void *)memmap(fd, PROT_READ);
if (!theKernel)
theKernel = (void *)simple_strtoul(argv[1], NULL, 0);
start_linux(theKernel, 0, NULL);
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
#endif /* CONFIG_CMD_BOOTU */

38
arch/arm/lib/bootu.c Normal file
View File

@ -0,0 +1,38 @@
#include <common.h>
#include <command.h>
#include <fs.h>
#include <fcntl.h>
#include <errno.h>
#include <asm/armlinux.h>
static int do_bootu(struct command *cmdtp, int argc, char *argv[])
{
int fd;
void *kernel = NULL;
if (argc != 2) {
barebox_cmd_usage(cmdtp);
return 1;
}
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);
start_linux(kernel, 0, NULL);
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