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 2/3] ARM: Add dummy update handler
Date: Fri, 14 Sep 2012 09:45:12 +0200	[thread overview]
Message-ID: <1347608713-10133-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1347608713-10133-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/bbu.c    |   56 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/bbu.h         |    3 +++
 3 files changed, 60 insertions(+)
 create mode 100644 arch/arm/lib/bbu.c

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 9d0ff7a..c5d6a06 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -16,6 +16,7 @@ obj-y	+= lib1funcs.o
 obj-y	+= ashrdi3.o
 obj-y	+= ashldi3.o
 obj-y	+= lshrdi3.o
+obj-y	+= bbu.o
 obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS)	+= memcpy.o
 obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS)	+= memset.o
 obj-$(CONFIG_ARM_UNWIND) += unwind.o
diff --git a/arch/arm/lib/bbu.c b/arch/arm/lib/bbu.c
new file mode 100644
index 0000000..71a0d85
--- /dev/null
+++ b/arch/arm/lib/bbu.c
@@ -0,0 +1,56 @@
+/*
+ * bbu.c - ARM specific barebox update functions
+ *
+ * Copyright (c) 2012 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include <common.h>
+#include <malloc.h>
+#include <bbu.h>
+#include <filetype.h>
+#include <errno.h>
+
+int barebox_arm_update(struct bbu_handler *handler, struct bbu_data *data)
+{
+	if (file_detect_type(data->image) != filetype_arm_barebox) {
+		if (!bbu_force(data, "Not an ARM barebox image"))
+			return -EINVAL;
+	}
+
+	if (!bbu_confirm(data))
+		return -EINVAL;
+
+	printf("updating to %s\n", (char *)handler->handler_data);
+
+	return 0;
+}
+
+int bbu_register_arm_handler(const char *name, char *devicefile,
+		unsigned long flags)
+{
+	struct bbu_handler *handler;
+	int ret;
+
+	handler = xzalloc(sizeof(*handler));
+	handler->name = name;
+	handler->handler_data = devicefile;
+	handler->flags = flags;
+	handler->handler = barebox_arm_update;
+
+	ret = bbu_register_handler(handler);
+	if (ret)
+		free(handler);
+
+	return ret;
+}
diff --git a/include/bbu.h b/include/bbu.h
index ce1a608..a71c25b 100644
--- a/include/bbu.h
+++ b/include/bbu.h
@@ -30,6 +30,9 @@ int bbu_register_handler(struct bbu_handler *);
 
 int barebox_update(struct bbu_data *);
 
+int bbu_register_arm_handler(const char *name, char *devicefile,
+		unsigned long flags);
+
 int barebox_arm_update(struct bbu_handler *, struct bbu_data *data);
 
 void bbu_handlers_list(void);
-- 
1.7.10.4


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

  parent reply	other threads:[~2012-09-14  7:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14  7:45 [RFC, PATCH] barebox-update command support Sascha Hauer
2012-09-14  7:45 ` [PATCH 1/3] Add barebox update infrastructure Sascha Hauer
2012-09-14 12:15   ` Jan Weitzel
2012-09-15 12:28     ` Sascha Hauer
2012-09-14  7:45 ` Sascha Hauer [this message]
2012-09-14 12:17   ` [PATCH 2/3] ARM: Add dummy update handler Jan Weitzel
2012-09-14  7:45 ` [PATCH 3/3] ARM pcm038: register nor " Sascha Hauer
2012-09-14 12:36 ` [RFC, PATCH] barebox-update command support Jan Weitzel
2012-09-15 12:33   ` Sascha Hauer

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=1347608713-10133-3-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