mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 5/5] ARM: move bootu code to its own file
Date: Mon,  4 Apr 2011 16:31:05 +0200	[thread overview]
Message-ID: <1301927465-23717-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1301927465-23717-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/lib/Makefile   |    1 +
 arch/arm/lib/armlinux.c |   33 ---------------------------------
 arch/arm/lib/bootu.c    |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 33 deletions(-)
 create mode 100644 arch/arm/lib/bootu.c

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 8165aea..9383ae1 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -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
diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index bb4bcd3..ce1cc6b 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -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 */
diff --git a/arch/arm/lib/bootu.c b/arch/arm/lib/bootu.c
new file mode 100644
index 0000000..e97ded0
--- /dev/null
+++ b/arch/arm/lib/bootu.c
@@ -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
+
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2011-04-04 14:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-04 14:31 ARM: cleanup boot commands Sascha Hauer
2011-04-04 14:31 ` [PATCH 1/5] ARM: Add missing parameter name in armlinux_set_serial Sascha Hauer
2011-04-04 14:31 ` [PATCH 2/5] ARM: factor out a start_linux function Sascha Hauer
2011-04-04 14:31 ` [PATCH 3/5] ARM: move bootm code to its own file Sascha Hauer
2011-04-04 14:31 ` [PATCH 4/5] ARM: move bootz " Sascha Hauer
2011-04-04 14:31 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1301927465-23717-6-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox