mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [RFCv2 1/2] MIPS: start.S: add "barebox" label at _start + 0x10
@ 2012-05-10  9:35 Antony Pavlov
  2012-05-10  9:35 ` [RFCv2 2/2] MIPS: bootm: add "MIPS barebox" handler Antony Pavlov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Antony Pavlov @ 2012-05-10  9:35 UTC (permalink / raw)
  To: barebox

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/boot/start.S |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/mips/boot/start.S b/arch/mips/boot/start.S
index b756d40..e8868e1 100644
--- a/arch/mips/boot/start.S
+++ b/arch/mips/boot/start.S
@@ -25,6 +25,8 @@
 #include <asm/mipsregs.h>
 #include <asm/asm.h>
 #include <asm-generic/memory_layout.h>
+#include <generated/compile.h>
+#include <generated/utsrelease.h>
 
 	/*
 	 * ADR macro instruction (inspired by ARM)
@@ -52,6 +54,16 @@ _pc:	addiu	\rd, ra, \label - _pc		# label is assumed to be
 	.align 4
 
 EXPORT(_start)
+
+	b	__start
+	 nop
+
+	.org	0x10
+	.ascii	"barebox " UTS_RELEASE " " UTS_VERSION
+	.byte	0
+
+	.align 4
+__start:
 	/* disable watchpoints */
 	mtc0	zero, CP0_WATCHLO
 	mtc0	zero, CP0_WATCHHI
-- 
1.7.10


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFCv2 2/2] MIPS: bootm: add "MIPS barebox" handler
  2012-05-10  9:35 [RFCv2 1/2] MIPS: start.S: add "barebox" label at _start + 0x10 Antony Pavlov
@ 2012-05-10  9:35 ` Antony Pavlov
  2012-05-10 13:29 ` [RFCv2 1/2] MIPS: start.S: add "barebox" label at _start + 0x10 Jean-Christophe PLAGNIOL-VILLARD
  2012-05-11  7:05 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Antony Pavlov @ 2012-05-10  9:35 UTC (permalink / raw)
  To: barebox

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/lib/Makefile |    1 +
 arch/mips/lib/bootm.c  |   43 +++++++++++++++++++++++++++++++++++++++++++
 common/filetype.c      |    2 ++
 include/filetype.h     |    1 +
 4 files changed, 47 insertions(+)
 create mode 100644 arch/mips/lib/bootm.c

diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index 45fe920..85aa194 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -6,3 +6,4 @@ obj-y += ashrdi3.o
 obj-y += memory.o
 
 obj-$(CONFIG_CMD_MIPS_CPUINFO) += cpuinfo.o
+obj-$(CONFIG_CMD_BOOTM)	+= bootm.o
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
new file mode 100644
index 0000000..3d6a4ce
--- /dev/null
+++ b/arch/mips/lib/bootm.c
@@ -0,0 +1,43 @@
+#include <boot.h>
+#include <common.h>
+#include <init.h>
+#include <fs.h>
+#include <errno.h>
+#include <binfmt.h>
+
+#include <asm/byteorder.h>
+
+static int do_bootm_barebox(struct image_data *data)
+{
+	void (*barebox)(void);
+
+	barebox = read_file(data->os_file, NULL);
+	if (!barebox)
+		return -EINVAL;
+
+	shutdown_barebox();
+
+	barebox();
+
+	reset_cpu(0);
+}
+
+static struct image_handler barebox_handler = {
+	.name = "MIPS barebox",
+	.bootm = do_bootm_barebox,
+	.filetype = filetype_mips_barebox,
+};
+
+static struct binfmt_hook binfmt_barebox_hook = {
+	.type = filetype_mips_barebox,
+	.exec = "bootm",
+};
+
+static int mips_register_image_handler(void)
+{
+	register_image_handler(&barebox_handler);
+	binfmt_register(&binfmt_barebox_hook);
+
+	return 0;
+}
+late_initcall(mips_register_image_handler);
diff --git a/common/filetype.c b/common/filetype.c
index 15a3732..39c2098 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -78,6 +78,8 @@ enum filetype file_detect_type(void *_buf)
 		return filetype_oftree;
 	if (strncmp(buf8, "ANDROID!", 8) == 0)
 		return filetype_aimage;
+	if (strncmp(buf8 + 0x10, "barebox", 7) == 0)
+		return filetype_mips_barebox;
 
 	return filetype_unknown;
 }
diff --git a/include/filetype.h b/include/filetype.h
index 9338793..f5de8ed 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -17,6 +17,7 @@ enum filetype {
 	filetype_oftree,
 	filetype_aimage,
 	filetype_sh,
+	filetype_mips_barebox,
 };
 
 const char *file_type_to_string(enum filetype f);
-- 
1.7.10


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFCv2 1/2] MIPS: start.S: add "barebox" label at _start + 0x10
  2012-05-10  9:35 [RFCv2 1/2] MIPS: start.S: add "barebox" label at _start + 0x10 Antony Pavlov
  2012-05-10  9:35 ` [RFCv2 2/2] MIPS: bootm: add "MIPS barebox" handler Antony Pavlov
@ 2012-05-10 13:29 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-05-11  7:05 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-05-10 13:29 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On 13:35 Thu 10 May     , Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Best Regards,
J.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFCv2 1/2] MIPS: start.S: add "barebox" label at _start + 0x10
  2012-05-10  9:35 [RFCv2 1/2] MIPS: start.S: add "barebox" label at _start + 0x10 Antony Pavlov
  2012-05-10  9:35 ` [RFCv2 2/2] MIPS: bootm: add "MIPS barebox" handler Antony Pavlov
  2012-05-10 13:29 ` [RFCv2 1/2] MIPS: start.S: add "barebox" label at _start + 0x10 Jean-Christophe PLAGNIOL-VILLARD
@ 2012-05-11  7:05 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-05-11  7:05 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Thu, May 10, 2012 at 01:35:11PM +0400, Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>

Applied (both)

Thanks
 Sascha

> ---
>  arch/mips/boot/start.S |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/arch/mips/boot/start.S b/arch/mips/boot/start.S
> index b756d40..e8868e1 100644
> --- a/arch/mips/boot/start.S
> +++ b/arch/mips/boot/start.S
> @@ -25,6 +25,8 @@
>  #include <asm/mipsregs.h>
>  #include <asm/asm.h>
>  #include <asm-generic/memory_layout.h>
> +#include <generated/compile.h>
> +#include <generated/utsrelease.h>
>  
>  	/*
>  	 * ADR macro instruction (inspired by ARM)
> @@ -52,6 +54,16 @@ _pc:	addiu	\rd, ra, \label - _pc		# label is assumed to be
>  	.align 4
>  
>  EXPORT(_start)
> +
> +	b	__start
> +	 nop
> +
> +	.org	0x10
> +	.ascii	"barebox " UTS_RELEASE " " UTS_VERSION
> +	.byte	0
> +
> +	.align 4
> +__start:
>  	/* disable watchpoints */
>  	mtc0	zero, CP0_WATCHLO
>  	mtc0	zero, CP0_WATCHHI
> -- 
> 1.7.10
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-11  7:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-10  9:35 [RFCv2 1/2] MIPS: start.S: add "barebox" label at _start + 0x10 Antony Pavlov
2012-05-10  9:35 ` [RFCv2 2/2] MIPS: bootm: add "MIPS barebox" handler Antony Pavlov
2012-05-10 13:29 ` [RFCv2 1/2] MIPS: start.S: add "barebox" label at _start + 0x10 Jean-Christophe PLAGNIOL-VILLARD
2012-05-11  7:05 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox