* [PATCH 01/12] ARM: split barebox_arm_head in two separate functions
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 02/12] ARM: pbl: move linker script to lib Sascha Hauer
` (12 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
This adds a new function __barebox_arm_head() which defines an
the regular barebox ARM header, but which jumps to the end of
the function so that this can be embedded into another function.
barebox_arm_head() now just uses it and jumps to barebox_arm_reset_vector
just like it did before.
This makes it possible to define board specific entry points.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/include/asm/barebox-arm-head.h | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/arch/arm/include/asm/barebox-arm-head.h b/arch/arm/include/asm/barebox-arm-head.h
index 9a8cc87..af7164a 100644
--- a/arch/arm/include/asm/barebox-arm-head.h
+++ b/arch/arm/include/asm/barebox-arm-head.h
@@ -43,7 +43,7 @@ static inline void arm_cpu_lowlevel_init(void)
#ifdef CONFIG_HAVE_MACH_ARM_HEAD
#include <mach/barebox-arm-head.h>
#else
-static inline void barebox_arm_head(void)
+static inline void __barebox_arm_head(void)
{
__asm__ __volatile__ (
#ifdef CONFIG_THUMB2_BAREBOX
@@ -52,12 +52,12 @@ static inline void barebox_arm_head(void)
"bx r9\n"
".thumb\n"
"1:\n"
- "bl barebox_arm_reset_vector\n"
+ "bl 2f\n"
".rept 10\n"
"1: b 1b\n"
".endr\n"
#else
- "b barebox_arm_reset_vector\n"
+ "b 2f\n"
"1: b 1b\n"
"1: b 1b\n"
"1: b 1b\n"
@@ -74,6 +74,14 @@ static inline void barebox_arm_head(void)
".rept 8\n"
".word 0x55555555\n"
".endr\n"
+ "2:\n"
+ );
+}
+static inline void barebox_arm_head(void)
+{
+ __barebox_arm_head();
+ __asm__ __volatile__ (
+ "b barebox_arm_reset_vector\n"
);
}
#endif
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 02/12] ARM: pbl: move linker script to lib
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
2013-06-25 9:20 ` [PATCH 01/12] ARM: split barebox_arm_head in two separate functions Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 03/12] ARM: build dtbs unconditionally Sascha Hauer
` (11 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
Since the pbl linker script can be reused by the upcoming multi image
build process move it to a common place. Also remove ENTRY() from the
linker script and instead add the -e option to the linker. This makes
the entrypoint configurable.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/lib/pbl.lds.S | 91 ++++++++++++++++++++++++++++++++++++++++++++
arch/arm/pbl/Makefile | 5 ++-
arch/arm/pbl/zbarebox.lds.S | 92 ---------------------------------------------
3 files changed, 95 insertions(+), 93 deletions(-)
create mode 100644 arch/arm/lib/pbl.lds.S
delete mode 100644 arch/arm/pbl/zbarebox.lds.S
diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S
new file mode 100644
index 0000000..d3ec2f8
--- /dev/null
+++ b/arch/arm/lib/pbl.lds.S
@@ -0,0 +1,91 @@
+/*
+ * (C) Copyright 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 as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+#include <sizes.h>
+#include <asm-generic/barebox.lds.h>
+#include <asm-generic/memory_layout.h>
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+SECTIONS
+{
+#ifdef CONFIG_PBL_RELOCATABLE
+ . = 0x0;
+#else
+ . = TEXT_BASE - SZ_2M;
+#endif
+
+ PRE_IMAGE
+
+ . = ALIGN(4);
+ .text :
+ {
+ _stext = .;
+ _text = .;
+ *(.text_head_entry*)
+ __bare_init_start = .;
+ *(.text_bare_init*)
+ __bare_init_end = .;
+ *(.text*)
+ }
+
+ /* Discard unwind if enable in barebox */
+ /DISCARD/ : { *(.ARM.ex*) }
+
+ BAREBOX_BARE_INIT_SIZE
+
+ . = ALIGN(4);
+ .rodata : { *(.rodata*) }
+
+ _etext = .; /* End of text and rodata section */
+
+ . = ALIGN(4);
+ .data : { *(.data*) }
+
+ .rel.dyn : {
+ __rel_dyn_start = .;
+ *(.rel*)
+ __rel_dyn_end = .;
+ }
+
+ .dynsym : {
+ __dynsym_start = .;
+ *(.dynsym)
+ __dynsym_end = .;
+ }
+
+ . = ALIGN(4);
+ __bss_start = .;
+ .bss : { *(.bss*) }
+ __bss_stop = .;
+ _end = .;
+
+ . = ALIGN(4);
+ __piggydata_start = .;
+ .piggydata : {
+ *(.piggydata)
+ }
+ __piggydata_end = .;
+
+ _barebox_image_size = __piggydata_end - (TEXT_BASE - SZ_2M);
+ _barebox_pbl_size = __bss_start - (TEXT_BASE - SZ_2M);
+}
diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile
index 3f50f77..8923a70 100644
--- a/arch/arm/pbl/Makefile
+++ b/arch/arm/pbl/Makefile
@@ -29,9 +29,12 @@ endif
zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o)
zbarebox-lds := $(obj)/zbarebox.lds
+$(zbarebox-lds): $(obj)/../lib/pbl.lds.S FORCE
+ $(call if_changed_dep,cpp_lds_S)
+
quiet_cmd_zbarebox__ ?= LD $@
cmd_zbarebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_zbarebox) -o $@ \
- -T $(zbarebox-lds) \
+ -e pbl_start -T $(zbarebox-lds) \
--start-group $(zbarebox-common) --end-group \
$(filter-out $(zbarebox-lds) $(zbarebox-common) FORCE ,$^)
diff --git a/arch/arm/pbl/zbarebox.lds.S b/arch/arm/pbl/zbarebox.lds.S
deleted file mode 100644
index 6b23bbe..0000000
--- a/arch/arm/pbl/zbarebox.lds.S
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * (C) Copyright 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 as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- */
-#include <sizes.h>
-#include <asm-generic/barebox.lds.h>
-#include <asm-generic/memory_layout.h>
-
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-ENTRY(pbl_start)
-SECTIONS
-{
-#ifdef CONFIG_PBL_RELOCATABLE
- . = 0x0;
-#else
- . = TEXT_BASE - SZ_2M;
-#endif
-
- PRE_IMAGE
-
- . = ALIGN(4);
- .text :
- {
- _stext = .;
- _text = .;
- *(.text_head_entry*)
- __bare_init_start = .;
- *(.text_bare_init*)
- __bare_init_end = .;
- *(.text*)
- }
-
- /* Discard unwind if enable in barebox */
- /DISCARD/ : { *(.ARM.ex*) }
-
- BAREBOX_BARE_INIT_SIZE
-
- . = ALIGN(4);
- .rodata : { *(.rodata*) }
-
- _etext = .; /* End of text and rodata section */
-
- . = ALIGN(4);
- .data : { *(.data*) }
-
- .rel.dyn : {
- __rel_dyn_start = .;
- *(.rel*)
- __rel_dyn_end = .;
- }
-
- .dynsym : {
- __dynsym_start = .;
- *(.dynsym)
- __dynsym_end = .;
- }
-
- . = ALIGN(4);
- __bss_start = .;
- .bss : { *(.bss*) }
- __bss_stop = .;
- _end = .;
-
- . = ALIGN(4);
- __piggydata_start = .;
- .piggydata : {
- *(.piggydata)
- }
- __piggydata_end = .;
-
- _barebox_image_size = __piggydata_end - (TEXT_BASE - SZ_2M);
- _barebox_pbl_size = __bss_start - (TEXT_BASE - SZ_2M);
-}
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 03/12] ARM: build dtbs unconditionally
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
2013-06-25 9:20 ` [PATCH 01/12] ARM: split barebox_arm_head in two separate functions Sascha Hauer
2013-06-25 9:20 ` [PATCH 02/12] ARM: pbl: move linker script to lib Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 04/12] ARM: Add image end section Sascha Hauer
` (10 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
The upcoming multi image support will need devicetree binary
blobs even when there is no builtin dtb. Kust descend into
arch/arm/dts unconditionally. arch/arm/dts/Makefile will act
as necessary depending on the options.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 32bdd65..3cdd670 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -328,7 +328,7 @@ endif
common-y += $(BOARD) $(MACH)
common-y += arch/arm/lib/ arch/arm/cpu/
-common-$(CONFIG_BUILTIN_DTB) += arch/arm/dts/
+common-y += arch/arm/dts/
lds-y := arch/arm/lib/barebox.lds
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 04/12] ARM: Add image end section
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
` (2 preceding siblings ...)
2013-06-25 9:20 ` [PATCH 03/12] ARM: build dtbs unconditionally Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 05/12] imx-image: fix path to imx-image binary Sascha Hauer
` (9 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
In the upcoming multi image build process we will cat images together.
To find the concatenated image we need to reliably find the end of the
current binary. This adds a dummy section at the end of a pbl binary.
Its only purpose is to mark the end of the image. The multi image
patches will add something to this section so that it doesn't get
discarded by the linker.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/lib/pbl.lds.S | 8 +++++++-
arch/arm/lib/runtime-offset.S | 3 +++
include/asm-generic/sections.h | 1 +
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S
index d3ec2f8..1eae829 100644
--- a/arch/arm/lib/pbl.lds.S
+++ b/arch/arm/lib/pbl.lds.S
@@ -86,6 +86,12 @@ SECTIONS
}
__piggydata_end = .;
- _barebox_image_size = __piggydata_end - (TEXT_BASE - SZ_2M);
+ . = ALIGN(4);
+ .image_end : {
+ KEEP(*(.image_end))
+ }
+ __image_end = .;
+
+ _barebox_image_size = __image_end - (TEXT_BASE - SZ_2M);
_barebox_pbl_size = __bss_start - (TEXT_BASE - SZ_2M);
}
diff --git a/arch/arm/lib/runtime-offset.S b/arch/arm/lib/runtime-offset.S
index 15bf414..f10c4c8 100644
--- a/arch/arm/lib/runtime-offset.S
+++ b/arch/arm/lib/runtime-offset.S
@@ -42,6 +42,9 @@ ld_var_entry __dynsym_end
ld_var_entry _barebox_image_size
ld_var_entry __bss_start
ld_var_entry __bss_stop
+#ifdef __PBL__
+ld_var_entry __image_end
+#endif
1:
ldr r1, =__ld_var_base
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 5492aa4..984f8b6 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -6,6 +6,7 @@ extern char __bss_start[], __bss_stop[];
extern char _sdata[], _edata[];
extern char __bare_init_start[], __bare_init_end[];
extern char _end[];
+extern char __image_end[];
extern void *_barebox_image_size;
extern void *_barebox_bare_init_size;
extern void *_barebox_pbl_size;
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 05/12] imx-image: fix path to imx-image binary
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
` (3 preceding siblings ...)
2013-06-25 9:20 ` [PATCH 04/12] ARM: Add image end section Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 06/12] Add multi images support Sascha Hauer
` (8 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
$(obj) doesn't necessarily contain the toplevel object path. Use
$(objtree) for this.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
scripts/Makefile.lib | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0b56dcc..307412f 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -329,4 +329,4 @@ $(obj)/%.S: $(obj)/%.dcd
$(call cmd,imximage_S_dcd)
quiet_cmd_imx_image = IMX-IMG $@
- cmd_imx_image = $(obj)/scripts/imx/imx-image -b -c $(CFG_$(@F)) -f $< -o $@
+ cmd_imx_image = $(objtree)/scripts/imx/imx-image -b -c $(CFG_$(@F)) -f $< -o $@
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 06/12] Add multi images support
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
` (4 preceding siblings ...)
2013-06-25 9:20 ` [PATCH 05/12] imx-image: fix path to imx-image binary Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 07/12] ARM: i.MX: Add multi images support Makefile Sascha Hauer
` (7 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
This adds the make infrastructure to build multiple SoC or
board specific images from a single barebox binary.
The basic idea is that we no longer have a single pbl, but instead
multiple pbls, one per image if necessary. Each pbl is defined
by its entry function so that each pbl can do exactly what a given
board needs. Additionally the pbls together with a self extracting
barebox binary can be encapsulated in specific image formats.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Makefile | 8 +++
arch/arm/cpu/Makefile | 4 +-
arch/arm/cpu/start-images.c | 49 +++++++++++++++
arch/arm/cpu/uncompress.c | 108 ++++++++++++++++++++++++++++++++
arch/arm/include/asm/barebox-arm.h | 4 ++
arch/arm/mach-imx/Kconfig | 1 +
images/Makefile | 122 +++++++++++++++++++++++++++++++++++++
pbl/Kconfig | 16 +++++
8 files changed, 311 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/cpu/start-images.c
create mode 100644 arch/arm/cpu/uncompress.c
create mode 100644 images/Makefile
diff --git a/Makefile b/Makefile
index 32c46fd..d82e795 100644
--- a/Makefile
+++ b/Makefile
@@ -481,7 +481,14 @@ export KBUILD_BINARY ?= barebox.bin
barebox-flash-image: $(KBUILD_IMAGE) FORCE
$(call if_changed,ln)
+images images/%.s: barebox.bin FORCE
+ $(Q)$(MAKE) $(build)=images $@
+
+ifdef CONFIG_PBL_MULTI_IMAGES
+all: $(KBUILD_DTBS) barebox.bin images
+else
all: barebox-flash-image $(KBUILD_DTBS)
+endif
common-$(CONFIG_PBL_IMAGE) += pbl/
@@ -987,6 +994,7 @@ clean-dirs := $(addprefix _clean_,$(srctree) $(barebox-alldirs))
PHONY += $(clean-dirs) clean archclean
$(clean-dirs):
+ $(Q)$(MAKE) $(clean)=images
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
clean: archclean $(clean-dirs)
diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile
index c442b35..d99577b 100644
--- a/arch/arm/cpu/Makefile
+++ b/arch/arm/cpu/Makefile
@@ -21,7 +21,9 @@ obj-$(CONFIG_CPU_32v7) += cache-armv7.o
pbl-$(CONFIG_CPU_32v7) += cache-armv7.o
obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
-pbl-y += start-pbl.o setupc.o
+pbl-y += setupc.o
+pbl-$(CONFIG_PBL_SINGLE_IMAGE) += start-pbl.o
+pbl-$(CONFIG_PBL_MULTI_IMAGES) += start-images.o uncompress.o
obj-y += common.o
pbl-y += common.o
diff --git a/arch/arm/cpu/start-images.c b/arch/arm/cpu/start-images.c
new file mode 100644
index 0000000..d48d245
--- /dev/null
+++ b/arch/arm/cpu/start-images.c
@@ -0,0 +1,49 @@
+/*
+ * start-pbl.c
+ *
+ * Copyright (c) 2010-2012 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
+ * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <init.h>
+#include <sizes.h>
+#include <pbl.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <asm-generic/memory_layout.h>
+#include <asm/sections.h>
+#include <asm/pgtable.h>
+#include <debug_ll.h>
+
+void __naked __noreturn barebox_arm_entry(uint32_t membase, uint32_t memsize,
+ uint32_t boarddata)
+{
+ unsigned long barebox_base;
+ void __noreturn (*barebox)(uint32_t, uint32_t, uint32_t);
+
+ barebox_base = ld_var(__image_end) - get_runtime_offset() + 4;
+
+ if (IS_ENABLED(CONFIG_THUMB2_BAREBOX))
+ barebox = (void *)(barebox_base + 1);
+ else
+ barebox = (void *)barebox_base;
+
+ barebox(membase, memsize, boarddata);
+}
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
new file mode 100644
index 0000000..b401f8e
--- /dev/null
+++ b/arch/arm/cpu/uncompress.c
@@ -0,0 +1,108 @@
+/*
+ * uncompress.c - uncompressor code for self extracing pbl image
+ *
+ * Copyright (c) 2010-2013 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
+ * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <init.h>
+#include <sizes.h>
+#include <pbl.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <asm-generic/memory_layout.h>
+#include <asm/sections.h>
+#include <asm/pgtable.h>
+#include <asm/cache.h>
+
+#include <debug_ll.h>
+
+#include "mmu-early.h"
+
+unsigned long free_mem_ptr;
+unsigned long free_mem_end_ptr;
+
+static int __attribute__((__used__))
+ __attribute__((__section__(".image_end")))
+ __image_end_dummy = 0xdeadbeef;
+
+static void noinline uncompress(uint32_t membase,
+ uint32_t memsize, uint32_t boarddata)
+{
+ uint32_t offset;
+ uint32_t pg_len;
+ void __noreturn (*barebox)(uint32_t, uint32_t, uint32_t);
+ uint32_t endmem = membase + memsize;
+ unsigned long barebox_base;
+ uint32_t *ptr;
+ void *pg_start;
+
+ endmem -= STACK_SIZE; /* stack */
+
+ if (IS_ENABLED(CONFIG_PBL_RELOCATABLE))
+ relocate_to_current_adr();
+
+ /* Get offset between linked address and runtime address */
+ offset = get_runtime_offset();
+
+ if (IS_ENABLED(CONFIG_RELOCATABLE))
+ barebox_base = arm_barebox_image_place(membase + memsize);
+ else
+ barebox_base = TEXT_BASE;
+
+ setup_c();
+
+ if (IS_ENABLED(CONFIG_MMU_EARLY)) {
+ endmem &= ~0x3fff;
+ endmem -= SZ_16K; /* ttb */
+ mmu_early_enable(membase, memsize, endmem);
+ }
+
+ endmem -= SZ_128K; /* early malloc */
+ free_mem_ptr = endmem;
+ free_mem_end_ptr = free_mem_ptr + SZ_128K;
+
+ ptr = (void *)__image_end;
+ pg_start = ptr + 1;
+ pg_len = *(ptr);
+
+ pbl_barebox_uncompress((void*)barebox_base, pg_start, pg_len);
+
+ arm_early_mmu_cache_flush();
+ flush_icache();
+
+ if (IS_ENABLED(CONFIG_THUMB2_BAREBOX))
+ barebox = (void *)(barebox_base + 1);
+ else
+ barebox = (void *)barebox_base;
+
+ barebox(membase, memsize, boarddata);
+}
+
+/*
+ * Generic second stage pbl uncompressor entry
+ */
+ENTRY_FUNCTION(start_uncompress)(uint32_t membase, uint32_t memsize,
+ uint32_t boarddata)
+{
+ arm_setup_stack(membase + memsize - 16);
+
+ uncompress(membase, memsize, boarddata);
+}
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index cd8decf..226e000 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -77,4 +77,8 @@ static inline unsigned long arm_barebox_image_place(unsigned long endmem)
return endmem;
}
+#define ENTRY_FUNCTION(name) \
+ void __naked __section(.text_head_entry_##name) \
+ name
+
#endif /* _BAREBOX_ARM_H_ */
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 644c05e..d58682b 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -67,6 +67,7 @@ config BOARDINFO
choice
prompt "Select boot mode"
depends on !ARCH_IMX_INTERNAL_BOOT_USE_IMXIMAGE
+ depends on !HAVE_PBL_MULTI_IMAGES
help
i.MX processors support two different boot modes. With the internal
boot mode the boot medium contains a header describing the image to
diff --git a/images/Makefile b/images/Makefile
new file mode 100644
index 0000000..fe1f77d
--- /dev/null
+++ b/images/Makefile
@@ -0,0 +1,122 @@
+#
+# barebox image generation Makefile
+#
+# This Makefile generates multiple images from a common barebox image
+# and different pbl (pre bootloader) images. Optionally the result is
+# encapsulated in SoC (or SoC boot type) specific image formats.
+#
+# The basic idea here is that we generate a single barebox main binary. This
+# is compressed and prepended with a self extractor, generated as barebox.x.
+# barebox.x is then prepended with different board specific pbls. The pbls
+# are generally named after their entrypoints. So a pcm038 specific pbl will
+# generate the following files:
+#
+# start_imx27_pcm038.pbl - The ELF file, linked with the entrypoint start_imx27_pcm038
+# start_imx27_pcm038.pblb - The raw binary of the above.
+# start_imx27_pcm038.pblx - The pblb appended with barebox.x
+# start_imx27_pcm038.pbl.map - The linker map file
+# start_imx27_pcm038.pbl.s - the disassembled ELF, generated with:
+# make images/start_imx27_pcm038.pbl.s
+#
+# Example Makefile snippets for the i.MX51 babbage board (for readability in opposite
+# order):
+#
+## image-$(CONFIG_MACH_FREESCALE_MX51_PDK) += barebox-imx51-babbage.img
+#
+# For CONFIG_MACH_FREESCALE_MX51_PDK build barebox-imx51-babbage.img
+#
+## FILE_barebox-imx51-babbage.img = start_imx51_babbage.pblx.imximg
+#
+# barebox-imx51-babbage.img should be generated (copied) from
+# start_imx51_babbage.pblx.imximg. This copy process is only done so that we
+# can generate images with a sane name. So what we really need for this
+# board is a i.MX specific image, a .imximg
+#
+## imximage-$(CONFIG_MACH_FREESCALE_MX51_PDK) += start_imx51_babbage.pblx.imximg
+## CFG_start_imx51_babbage.pblx.imximg = $(board)/freescale-mx51-pdk/flash-header.imxcfg
+#
+# The .imximg can be generated from a .pblx using a rule specified in Makefile.imx.
+# The configfile needed for this image is specified with CFG_<filename> = <configfile>
+#
+## pblx-$(CONFIG_MACH_FREESCALE_MX51_PDK) += start_imx51_babbage
+#
+# For this image we need a pblx (self extracting barebox binary) with
+# start_imx51_babbage as entrypoint. start_imx51_babbage will be used
+# both as entrypoint and as filename
+#
+
+quiet_cmd_objcopy_bin = OBJCOPYB $@
+ cmd_objcopy_bin = $(OBJCOPY) -O binary $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
+
+pbl-lds := $(obj)/pbl.lds
+extra-y += $(pbl-lds)
+
+$(pbl-lds): $(obj)/../arch/$(ARCH)/lib/pbl.lds.S FORCE
+ $(call if_changed_dep,cpp_lds_S)
+
+quiet_cmd_elf__ ?= LD $@
+ cmd_elf__ ?= $(LD) $(LDFLAGS) -static --gc-sections -pie \
+ -e $(2) -Map $@.map $(LDFLAGS_$(@F)) -o $@ \
+ -T $(pbl-lds) \
+ --start-group $(barebox-pbl-common) --end-group
+
+PBL_CPPFLAGS += -fdata-sections -ffunction-sections
+
+$(obj)/%.pbl: $(pbl-lds) $(barebox-pbl-common) FORCE
+ $(call if_changed,elf__,$(*F))
+
+$(obj)/%.pblb: $(obj)/%.pbl FORCE
+ $(call if_changed,objcopy_bin,$(*F))
+
+quiet_cmd_pblx ?= PBLX $@
+ cmd_pblx ?= cat $(obj)/$(patsubst %.pblx,%.pblb,$(2)) > $@; \
+ $(call size_append, $(obj)/barebox.x) >> $@; \
+ cat $(obj)/barebox.x >> $@
+
+$(obj)/%.pblx: $(obj)/%.pblb $(obj)/barebox.x FORCE
+ $(call if_changed,pblx,$(@F))
+
+$(obj)/%.s: $(obj)/% FORCE
+ $(call if_changed,disasm)
+
+suffix_$(CONFIG_IMAGE_COMPRESSION_GZIP) = gzip
+suffix_$(CONFIG_IMAGE_COMPRESSION_LZO) = lzo
+suffix_$(CONFIG_IMAGE_COMPRESSION_NONE) = shipped
+
+# barebox.z - compressed barebox binary
+# ----------------------------------------------------------------
+$(obj)/barebox.z: $(obj)/../barebox.bin FORCE
+ $(call if_changed,$(suffix_y))
+
+quiet_cmd_selfextract = COMP $@
+ cmd_selfextract = cat $(obj)/start_uncompress.pblb > $@; \
+ $(call size_append, $<) >> $@; \
+ cat $< >> $@
+
+pblx-y += start_uncompress
+# barebox.x - self extracting barebox binary
+# ----------------------------------------------------------------
+$(obj)/barebox.x: $(obj)/barebox.z $(obj)/start_uncompress.pblb FORCE
+ $(call if_changed,selfextract)
+
+# %.img - create a copy from another file
+# ----------------------------------------------------------------
+.SECONDEXPANSION:
+$(obj)/%.img: $(obj)/$$(FILE_$$(@F))
+ $(Q)if [ -z $(FILE_$(@F)) ]; then echo "FILE_$(@F) empty!"; false; fi
+ $(call if_changed,shipped)
+
+targets += $(image-y) pbl.lds barebox.x barebox.z
+targets += $(patsubst %,%.pblx,$(pblx-y))
+targets += $(patsubst %,%.pblb,$(pblx-y))
+targets += $(patsubst %,%.pbl,$(pblx-y))
+targets += $(patsubst %,%.s,$(pblx-y))
+targets += $(imximage-y)
+
+SECONDARY: $(addprefix $(obj)/,$(targets))
+
+images: $(addprefix $(obj)/, $(image-y)) FORCE
+ @echo "images built:\n" $(patsubst %,%\\n,$(image-y))
+
+clean-files := *.pbl *.pblb *.pblx *.map start_*.imximg *.img barebox.z
+clean-files += pbl.lds
diff --git a/pbl/Kconfig b/pbl/Kconfig
index 5c7f62e..a37c976 100644
--- a/pbl/Kconfig
+++ b/pbl/Kconfig
@@ -1,6 +1,9 @@
config HAVE_PBL_IMAGE
bool
+config HAVE_PBL_MULTI_IMAGES
+ bool
+
config HAVE_IMAGE_COMPRESSION
bool
@@ -8,6 +11,19 @@ config PBL_IMAGE
bool "Pre-Bootloader image"
depends on HAVE_PBL_IMAGE
+config PBL_MULTI_IMAGES
+ bool
+ select PBL_IMAGE
+ select PBL_RELOCATABLE
+ depends on HAVE_PBL_MULTI_IMAGES
+ default y
+
+config PBL_SINGLE_IMAGE
+ bool
+ depends on PBL_IMAGE
+ depends on !HAVE_PBL_MULTI_IMAGES
+ default y
+
config PBL_FORCE_PIGGYDATA_COPY
bool
help
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 07/12] ARM: i.MX: Add multi images support Makefile
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
` (5 preceding siblings ...)
2013-06-25 9:20 ` [PATCH 06/12] Add multi images support Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 08/12] ARM: i.MX27 pcm038: switch to multi image Sascha Hauer
` (6 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
This adds images/Makefile.imx which will contain the i.MX
specific image generation snippets.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
images/Makefile | 2 ++
images/Makefile.imx | 10 ++++++++++
2 files changed, 12 insertions(+)
create mode 100644 images/Makefile.imx
diff --git a/images/Makefile b/images/Makefile
index fe1f77d..925a987 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -106,6 +106,8 @@ $(obj)/%.img: $(obj)/$$(FILE_$$(@F))
$(Q)if [ -z $(FILE_$(@F)) ]; then echo "FILE_$(@F) empty!"; false; fi
$(call if_changed,shipped)
+include $(srctree)/images/Makefile.imx
+
targets += $(image-y) pbl.lds barebox.x barebox.z
targets += $(patsubst %,%.pblx,$(pblx-y))
targets += $(patsubst %,%.pblb,$(pblx-y))
diff --git a/images/Makefile.imx b/images/Makefile.imx
new file mode 100644
index 0000000..cd7b610
--- /dev/null
+++ b/images/Makefile.imx
@@ -0,0 +1,10 @@
+#
+# barebox image generation Makefile for i.MX images
+#
+
+# %.imximg - convert into i.MX image
+# ----------------------------------------------------------------
+$(obj)/%.imximg: $(obj)/% FORCE
+ $(call if_changed,imx_image)
+
+board = $(srctree)/arch/$(ARCH)/boards
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 08/12] ARM: i.MX27 pcm038: switch to multi image
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
` (6 preceding siblings ...)
2013-06-25 9:20 ` [PATCH 07/12] ARM: i.MX: Add multi images support Makefile Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 09/12] ARM: i.MX53 loco: Switch to imximage Sascha Hauer
` (5 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
This also converts the Phytec phyCORE i.MX27 aka pcm038 to use
image compression. The image will be named
barebox-phytec-phycore-imx27.img
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/pcm038/lowlevel.c | 4 +++-
arch/arm/mach-imx/Kconfig | 1 +
images/Makefile.imx | 5 +++++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boards/pcm038/lowlevel.c b/arch/arm/boards/pcm038/lowlevel.c
index 0ea2939..a3b2d13 100644
--- a/arch/arm/boards/pcm038/lowlevel.c
+++ b/arch/arm/boards/pcm038/lowlevel.c
@@ -33,11 +33,13 @@
#define ESDCTL0_VAL (ESDCTL0_SDE | ESDCTL0_ROW13 | ESDCTL0_COL10)
-void __bare_init __naked barebox_arm_reset_vector(void)
+ENTRY_FUNCTION(start_imx27_pcm038)(void)
{
uint32_t r;
int i;
+ __barebox_arm_head();
+
arm_cpu_lowlevel_init();
/* ahb lite ip interface */
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index d58682b..b80e885 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -330,6 +330,7 @@ config MACH_PCM038
select DRIVER_SPI_IMX
select MFD_MC13XXX
select HAVE_DEFAULT_ENVIRONMENT_NEW
+ select HAVE_PBL_MULTI_IMAGES
help
Say Y here if you are using Phytec's phyCORE-i.MX27 (pcm038) equipped
with a Freescale i.MX27 Processor
diff --git a/images/Makefile.imx b/images/Makefile.imx
index cd7b610..6334729 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -8,3 +8,8 @@ $(obj)/%.imximg: $(obj)/% FORCE
$(call if_changed,imx_image)
board = $(srctree)/arch/$(ARCH)/boards
+
+# ----------------------- i.MX27 based boards ---------------------------
+pblx-$(CONFIG_MACH_PCM038) += start_imx27_pcm038
+FILE_barebox-phytec-phycore-imx27.img = start_imx27_pcm038.pblx
+image-$(CONFIG_MACH_PCM038) += barebox-phytec-phycore-imx27.img
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 09/12] ARM: i.MX53 loco: Switch to imximage
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
` (7 preceding siblings ...)
2013-06-25 9:20 ` [PATCH 08/12] ARM: i.MX27 pcm038: switch to multi image Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 10/12] ARM: i.MX53 loco: Switch to multi image support Sascha Hauer
` (4 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
Use the imximage tool to generate an imximage instead of the linker
based process.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/freescale-mx53-loco/Makefile | 4 +-
arch/arm/boards/freescale-mx53-loco/board.c | 8 ++--
arch/arm/boards/freescale-mx53-loco/dcd-data.h | 54 ----------------------
| 54 ++++++++++++++++++++++
| 52 ---------------------
arch/arm/mach-imx/Kconfig | 1 +
6 files changed, 60 insertions(+), 113 deletions(-)
delete mode 100644 arch/arm/boards/freescale-mx53-loco/dcd-data.h
create mode 100644 arch/arm/boards/freescale-mx53-loco/flash-header.imxcfg
delete mode 100644 arch/arm/boards/freescale-mx53-loco/flash_header.c
diff --git a/arch/arm/boards/freescale-mx53-loco/Makefile b/arch/arm/boards/freescale-mx53-loco/Makefile
index d44f697..f1baae2 100644
--- a/arch/arm/boards/freescale-mx53-loco/Makefile
+++ b/arch/arm/boards/freescale-mx53-loco/Makefile
@@ -1,3 +1,3 @@
-obj-y += board.o
-lwl-y += flash_header.o
+obj-y += board.o flash-header.o
+extra-y += flash-header.S flash-header.dcd
lwl-y += lowlevel.o
diff --git a/arch/arm/boards/freescale-mx53-loco/board.c b/arch/arm/boards/freescale-mx53-loco/board.c
index 2f51128..0e3955f 100644
--- a/arch/arm/boards/freescale-mx53-loco/board.c
+++ b/arch/arm/boards/freescale-mx53-loco/board.c
@@ -75,9 +75,7 @@ static void loco_fec_reset(void)
#define MX53_LOCO_USB_PWREN IMX_GPIO_NR(7, 8)
-#define DCD_NAME static struct imx_dcd_v2_entry dcd_entry
-
-#include "dcd-data.h"
+extern char flash_header_start[], flash_header_end[];
static int loco_late_init(void)
{
@@ -116,8 +114,8 @@ static int loco_late_init(void)
armlinux_set_architecture(MACH_TYPE_MX53_LOCO);
imx53_bbu_internal_mmc_register_handler("mmc", "/dev/mmc0",
- BBU_HANDLER_FLAG_DEFAULT, dcd_entry, sizeof(dcd_entry), 0);
-
+ BBU_HANDLER_FLAG_DEFAULT, (void *)flash_header_start,
+ flash_header_end - flash_header_start, 0);
return 0;
}
diff --git a/arch/arm/boards/freescale-mx53-loco/dcd-data.h b/arch/arm/boards/freescale-mx53-loco/dcd-data.h
deleted file mode 100644
index 9f95fb4..0000000
--- a/arch/arm/boards/freescale-mx53-loco/dcd-data.h
+++ /dev/null
@@ -1,54 +0,0 @@
-
-DCD_NAME[] = {
- { .addr = cpu_to_be32(0x53fa8554), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa8558), .val = cpu_to_be32(0x00300040), },
- { .addr = cpu_to_be32(0x53fa8560), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa8564), .val = cpu_to_be32(0x00300040), },
- { .addr = cpu_to_be32(0x53fa8568), .val = cpu_to_be32(0x00300040), },
- { .addr = cpu_to_be32(0x53fa8570), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa8574), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa8578), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa857c), .val = cpu_to_be32(0x00300040), },
- { .addr = cpu_to_be32(0x53fa8580), .val = cpu_to_be32(0x00300040), },
- { .addr = cpu_to_be32(0x53fa8584), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa8588), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa8590), .val = cpu_to_be32(0x00300040), },
- { .addr = cpu_to_be32(0x53fa8594), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa86f0), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa86f4), .val = cpu_to_be32(0x00000000), },
- { .addr = cpu_to_be32(0x53fa86fc), .val = cpu_to_be32(0x00000000), },
- { .addr = cpu_to_be32(0x53fa8714), .val = cpu_to_be32(0x00000000), },
- { .addr = cpu_to_be32(0x53fa8718), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa871c), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa8720), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa8724), .val = cpu_to_be32(0x04000000), },
- { .addr = cpu_to_be32(0x53fa8728), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x53fa872c), .val = cpu_to_be32(0x00300000), },
- { .addr = cpu_to_be32(0x63fd9088), .val = cpu_to_be32(0x35343535), },
- { .addr = cpu_to_be32(0x63fd9090), .val = cpu_to_be32(0x4d444c44), },
- { .addr = cpu_to_be32(0x63fd907c), .val = cpu_to_be32(0x01370138), },
- { .addr = cpu_to_be32(0x63fd9080), .val = cpu_to_be32(0x013b013c), },
- { .addr = cpu_to_be32(0x63fd9018), .val = cpu_to_be32(0x00011740), },
- { .addr = cpu_to_be32(0x63fd9000), .val = cpu_to_be32(0xc3190000), },
- { .addr = cpu_to_be32(0x63fd900c), .val = cpu_to_be32(0x9f5152e3), },
- { .addr = cpu_to_be32(0x63fd9010), .val = cpu_to_be32(0xb68e8a63), },
- { .addr = cpu_to_be32(0x63fd9014), .val = cpu_to_be32(0x01ff00db), },
- { .addr = cpu_to_be32(0x63fd902c), .val = cpu_to_be32(0x000026d2), },
- { .addr = cpu_to_be32(0x63fd9030), .val = cpu_to_be32(0x009f0e21), },
- { .addr = cpu_to_be32(0x63fd9008), .val = cpu_to_be32(0x12273030), },
- { .addr = cpu_to_be32(0x63fd9004), .val = cpu_to_be32(0x0002002d), },
- { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x00008032), },
- { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x00008033), },
- { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x00028031), },
- { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x052080b0), },
- { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x04008040), },
- { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x0000803a), },
- { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x0000803b), },
- { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x00028039), },
- { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x05208138), },
- { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x04008048), },
- { .addr = cpu_to_be32(0x63fd9020), .val = cpu_to_be32(0x00005800), },
- { .addr = cpu_to_be32(0x63fd9040), .val = cpu_to_be32(0x04b80003), },
- { .addr = cpu_to_be32(0x63fd9058), .val = cpu_to_be32(0x00022227), },
- { .addr = cpu_to_be32(0x63fd901c), .val = cpu_to_be32(0x00000000), },
-};
diff --git a/arch/arm/boards/freescale-mx53-loco/flash-header.imxcfg b/arch/arm/boards/freescale-mx53-loco/flash-header.imxcfg
new file mode 100644
index 0000000..95bcd19
--- /dev/null
+++ b/arch/arm/boards/freescale-mx53-loco/flash-header.imxcfg
@@ -0,0 +1,54 @@
+loadaddr 0x70000000
+soc imx53
+dcdofs 0x400
+wm 32 0x53fa8554 0x00300000
+wm 32 0x53fa8558 0x00300040
+wm 32 0x53fa8560 0x00300000
+wm 32 0x53fa8564 0x00300040
+wm 32 0x53fa8568 0x00300040
+wm 32 0x53fa8570 0x00300000
+wm 32 0x53fa8574 0x00300000
+wm 32 0x53fa8578 0x00300000
+wm 32 0x53fa857c 0x00300040
+wm 32 0x53fa8580 0x00300040
+wm 32 0x53fa8584 0x00300000
+wm 32 0x53fa8588 0x00300000
+wm 32 0x53fa8590 0x00300040
+wm 32 0x53fa8594 0x00300000
+wm 32 0x53fa86f0 0x00300000
+wm 32 0x53fa86f4 0x00000000
+wm 32 0x53fa86fc 0x00000000
+wm 32 0x53fa8714 0x00000000
+wm 32 0x53fa8718 0x00300000
+wm 32 0x53fa871c 0x00300000
+wm 32 0x53fa8720 0x00300000
+wm 32 0x53fa8724 0x04000000
+wm 32 0x53fa8728 0x00300000
+wm 32 0x53fa872c 0x00300000
+wm 32 0x63fd9088 0x35343535
+wm 32 0x63fd9090 0x4d444c44
+wm 32 0x63fd907c 0x01370138
+wm 32 0x63fd9080 0x013b013c
+wm 32 0x63fd9018 0x00011740
+wm 32 0x63fd9000 0xc3190000
+wm 32 0x63fd900c 0x9f5152e3
+wm 32 0x63fd9010 0xb68e8a63
+wm 32 0x63fd9014 0x01ff00db
+wm 32 0x63fd902c 0x000026d2
+wm 32 0x63fd9030 0x009f0e21
+wm 32 0x63fd9008 0x12273030
+wm 32 0x63fd9004 0x0002002d
+wm 32 0x63fd901c 0x00008032
+wm 32 0x63fd901c 0x00008033
+wm 32 0x63fd901c 0x00028031
+wm 32 0x63fd901c 0x052080b0
+wm 32 0x63fd901c 0x04008040
+wm 32 0x63fd901c 0x0000803a
+wm 32 0x63fd901c 0x0000803b
+wm 32 0x63fd901c 0x00028039
+wm 32 0x63fd901c 0x05208138
+wm 32 0x63fd901c 0x04008048
+wm 32 0x63fd9020 0x00005800
+wm 32 0x63fd9040 0x04b80003
+wm 32 0x63fd9058 0x00022227
+wm 32 0x63fd901c 0x00000000
diff --git a/arch/arm/boards/freescale-mx53-loco/flash_header.c b/arch/arm/boards/freescale-mx53-loco/flash_header.c
deleted file mode 100644
index dc1162b..0000000
--- a/arch/arm/boards/freescale-mx53-loco/flash_header.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2011 Marc Kleine-Budde <mkl@pengutronix.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * 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 <asm/byteorder.h>
-#include <mach/imx-flash-header.h>
-#include <asm/barebox-arm-head.h>
-
-void __naked __flash_header_start go(void)
-{
- barebox_arm_head();
-}
-
-#define DCD_NAME struct imx_dcd_v2_entry __dcd_entry_section dcd_entry
-
-#include "dcd-data.h"
-
-#define APP_DEST 0x70000000
-
-struct imx_flash_header_v2 __flash_header_section flash_header = {
- .header.tag = IVT_HEADER_TAG,
- .header.length = cpu_to_be16(32),
- .header.version = IVT_VERSION,
-
- .entry = APP_DEST + 0x1000,
- .dcd_ptr = APP_DEST + 0x400 + offsetof(struct imx_flash_header_v2, dcd),
- .boot_data_ptr = APP_DEST + 0x400 + offsetof(struct imx_flash_header_v2, boot_data),
- .self = APP_DEST + 0x400,
-
- .boot_data.start = APP_DEST,
- .boot_data.size = DCD_BAREBOX_SIZE,
-
- .dcd.header.tag = DCD_HEADER_TAG,
- .dcd.header.length = cpu_to_be16(sizeof(struct imx_dcd) + sizeof(dcd_entry)),
- .dcd.header.version = DCD_VERSION,
-
- .dcd.command.tag = DCD_COMMAND_WRITE_TAG,
- .dcd.command.length = cpu_to_be16(sizeof(struct imx_dcd_command) + sizeof(dcd_entry)),
- .dcd.command.param = DCD_COMMAND_WRITE_PARAM,
-};
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index b80e885..4f9ef3e 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -476,6 +476,7 @@ choice
config MACH_FREESCALE_MX53_LOCO
select HAVE_DEFAULT_ENVIRONMENT_NEW
+ select ARCH_IMX_INTERNAL_BOOT_USE_IMXIMAGE
bool "Freescale i.MX53 LOCO"
config MACH_FREESCALE_MX53_SMD
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 10/12] ARM: i.MX53 loco: Switch to multi image support
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
` (8 preceding siblings ...)
2013-06-25 9:20 ` [PATCH 09/12] ARM: i.MX53 loco: Switch to imximage Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 11/12] ARM: dmo realq7: switch " Sascha Hauer
` (3 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
This converts the Freescale i.MX53 loco aka qsb board to
multi image. The image will be named:
barebox-freescale-imx53-loco.img
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/freescale-mx53-loco/lowlevel.c | 14 ++++++++++++--
arch/arm/dts/Makefile | 2 ++
arch/arm/mach-imx/Kconfig | 2 +-
images/Makefile.imx | 7 +++++++
4 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boards/freescale-mx53-loco/lowlevel.c b/arch/arm/boards/freescale-mx53-loco/lowlevel.c
index 60c28f7..d920524 100644
--- a/arch/arm/boards/freescale-mx53-loco/lowlevel.c
+++ b/arch/arm/boards/freescale-mx53-loco/lowlevel.c
@@ -1,9 +1,19 @@
#include <common.h>
#include <mach/esdctl.h>
#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
-void __naked barebox_arm_reset_vector(void)
+extern char __dtb_imx53_qsb_start[];
+
+ENTRY_FUNCTION(start_imx53_loco)(void)
{
+ uint32_t fdt;
+
+ __barebox_arm_head();
+
arm_cpu_lowlevel_init();
- imx53_barebox_entry(0);
+
+ fdt = (uint32_t)__dtb_imx53_qsb_start - get_runtime_offset();
+
+ imx53_barebox_entry(fdt);
}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b271618..19a1985 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -8,6 +8,8 @@ dtb-$(CONFIG_ARCH_IMX6) += imx6q-dmo-realq7.dtb \
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_NAME))
obj-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o
+pbl-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += imx53-qsb.dtb.o
+
.SECONDARY: $(obj)/$(BUILTIN_DTB).dtb.S
targets += dtbs
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 4f9ef3e..6560798 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -476,7 +476,7 @@ choice
config MACH_FREESCALE_MX53_LOCO
select HAVE_DEFAULT_ENVIRONMENT_NEW
- select ARCH_IMX_INTERNAL_BOOT_USE_IMXIMAGE
+ select HAVE_PBL_MULTI_IMAGES
bool "Freescale i.MX53 LOCO"
config MACH_FREESCALE_MX53_SMD
diff --git a/images/Makefile.imx b/images/Makefile.imx
index 6334729..3a5b5f1 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -13,3 +13,10 @@ board = $(srctree)/arch/$(ARCH)/boards
pblx-$(CONFIG_MACH_PCM038) += start_imx27_pcm038
FILE_barebox-phytec-phycore-imx27.img = start_imx27_pcm038.pblx
image-$(CONFIG_MACH_PCM038) += barebox-phytec-phycore-imx27.img
+
+# ----------------------- i.MX53 based boards ---------------------------
+pblx-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += start_imx53_loco
+CFG_start_imx53_loco.pblx.imximg = $(board)/freescale-mx53-loco/flash-header.imxcfg
+imximage-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += start_imx53_loco.pblx.imximg
+FILE_barebox-freescale-imx53-loco.img = start_imx53_loco.pblx.imximg
+image-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += barebox-freescale-imx53-loco.img
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 11/12] ARM: dmo realq7: switch to multi image support
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
` (9 preceding siblings ...)
2013-06-25 9:20 ` [PATCH 10/12] ARM: i.MX53 loco: Switch to multi image support Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 12/12] ARM: i.MX51 babbage: " Sascha Hauer
` (2 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
The image will be named after the official name of this board:
barebox-datamodul-edm-qmx6.img
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/dmo-mx6-realq7/lowlevel.c | 12 ++++++++++--
arch/arm/dts/Makefile | 1 +
arch/arm/mach-imx/Kconfig | 2 +-
images/Makefile.imx | 7 +++++++
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boards/dmo-mx6-realq7/lowlevel.c b/arch/arm/boards/dmo-mx6-realq7/lowlevel.c
index ebcf76f..240116d 100644
--- a/arch/arm/boards/dmo-mx6-realq7/lowlevel.c
+++ b/arch/arm/boards/dmo-mx6-realq7/lowlevel.c
@@ -138,8 +138,14 @@ static void sdram_init(void)
writel(0x00000001, 0x021e8080);
}
-void __naked barebox_arm_reset_vector(void)
+extern char __dtb_imx6q_dmo_realq7_start[];
+
+ENTRY_FUNCTION(start_imx6_realq7)(void)
{
+ uint32_t fdt;
+
+ __barebox_arm_head();
+
arm_cpu_lowlevel_init();
arm_setup_stack(0x00940000 - 8);
@@ -151,5 +157,7 @@ void __naked barebox_arm_reset_vector(void)
mmdc_do_dqs_calibration();
}
- barebox_arm_entry(0x10000000, SZ_2G, 0);
+ fdt = (uint32_t)__dtb_imx6q_dmo_realq7_start - get_runtime_offset();
+
+ barebox_arm_entry(0x10000000, SZ_2G, fdt);
}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 19a1985..2fdd2e7 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -9,6 +9,7 @@ BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_NAME))
obj-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o
pbl-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += imx53-qsb.dtb.o
+pbl-$(CONFIG_MACH_REALQ7) += imx6q-dmo-realq7.dtb.o
.SECONDARY: $(obj)/$(BUILTIN_DTB).dtb.S
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 6560798..9927a3d 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -530,8 +530,8 @@ config MACH_SABRESD
config MACH_REALQ7
bool "DataModul i.MX6Q Real Qseven Board"
- select ARCH_IMX_INTERNAL_BOOT_USE_IMXIMAGE
select HAVE_DEFAULT_ENVIRONMENT_NEW
+ select HAVE_PBL_MULTI_IMAGES
endchoice
diff --git a/images/Makefile.imx b/images/Makefile.imx
index 3a5b5f1..11c4160 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -20,3 +20,10 @@ CFG_start_imx53_loco.pblx.imximg = $(board)/freescale-mx53-loco/flash-header.imx
imximage-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += start_imx53_loco.pblx.imximg
FILE_barebox-freescale-imx53-loco.img = start_imx53_loco.pblx.imximg
image-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += barebox-freescale-imx53-loco.img
+
+# ----------------------- i.MX6 based boards ---------------------------
+pblx-$(CONFIG_MACH_REALQ7) += start_imx6_realq7
+CFG_start_imx6_realq7.pblx.imximg = $(board)/dmo-mx6-realq7/flash-header.imxcfg
+imximage-$(CONFIG_MACH_REALQ7) += start_imx6_realq7.pblx.imximg
+FILE_barebox-datamodul-edm-qmx6.img = start_imx6_realq7.pblx.imximg
+image-$(CONFIG_MACH_REALQ7) += barebox-datamodul-edm-qmx6.img
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 12/12] ARM: i.MX51 babbage: switch to multi image support
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
` (10 preceding siblings ...)
2013-06-25 9:20 ` [PATCH 11/12] ARM: dmo realq7: switch " Sascha Hauer
@ 2013-06-25 9:20 ` Sascha Hauer
2013-06-25 9:26 ` [PATCH] barebox " Sascha Hauer
2013-06-26 5:27 ` Sascha Hauer
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:20 UTC (permalink / raw)
To: barebox
The image will be named:
barebox-freescale-imx51-babbage.img
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/freescale-mx51-pdk/lowlevel.c | 14 ++++++++++++--
arch/arm/dts/Makefile | 1 +
arch/arm/mach-imx/Kconfig | 2 +-
images/Makefile.imx | 7 +++++++
4 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boards/freescale-mx51-pdk/lowlevel.c b/arch/arm/boards/freescale-mx51-pdk/lowlevel.c
index 3e6a0ee..8c1acb4 100644
--- a/arch/arm/boards/freescale-mx51-pdk/lowlevel.c
+++ b/arch/arm/boards/freescale-mx51-pdk/lowlevel.c
@@ -1,9 +1,19 @@
#include <common.h>
#include <mach/esdctl.h>
#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
-void __naked barebox_arm_reset_vector(void)
+extern char __dtb_imx51_babbage_start[];
+
+ENTRY_FUNCTION(start_imx51_babbage)(void)
{
+ uint32_t fdt;
+
+ __barebox_arm_head();
+
arm_cpu_lowlevel_init();
- imx51_barebox_entry(0);
+
+ fdt = (uint32_t)__dtb_imx51_babbage_start - get_runtime_offset();
+
+ imx51_barebox_entry(fdt);
}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 2fdd2e7..df0e360 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -8,6 +8,7 @@ dtb-$(CONFIG_ARCH_IMX6) += imx6q-dmo-realq7.dtb \
BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_NAME))
obj-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o
+pbl-$(CONFIG_MACH_FREESCALE_MX51_PDK) += imx51-babbage.dtb.o
pbl-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += imx53-qsb.dtb.o
pbl-$(CONFIG_MACH_REALQ7) += imx6q-dmo-realq7.dtb.o
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 9927a3d..a57e276 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -425,7 +425,7 @@ choice
config MACH_FREESCALE_MX51_PDK
select HAVE_DEFAULT_ENVIRONMENT_NEW
- select ARCH_IMX_INTERNAL_BOOT_USE_IMXIMAGE
+ select HAVE_PBL_MULTI_IMAGES
bool "Freescale i.MX51 PDK"
config MACH_EUKREA_CPUIMX51SD
diff --git a/images/Makefile.imx b/images/Makefile.imx
index 11c4160..72e8cde 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -14,6 +14,13 @@ pblx-$(CONFIG_MACH_PCM038) += start_imx27_pcm038
FILE_barebox-phytec-phycore-imx27.img = start_imx27_pcm038.pblx
image-$(CONFIG_MACH_PCM038) += barebox-phytec-phycore-imx27.img
+# ----------------------- i.MX51 based boards ---------------------------
+pblx-$(CONFIG_MACH_FREESCALE_MX51_PDK) += start_imx51_babbage
+CFG_start_imx51_babbage.pblx.imximg = $(board)/freescale-mx51-pdk/flash-header.imxcfg
+imximage-$(CONFIG_MACH_FREESCALE_MX51_PDK) += start_imx51_babbage.pblx.imximg
+FILE_barebox-freescale-imx51-babbage.img = start_imx51_babbage.pblx.imximg
+image-$(CONFIG_MACH_FREESCALE_MX51_PDK) += barebox-freescale-imx51-babbage.img
+
# ----------------------- i.MX53 based boards ---------------------------
pblx-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += start_imx53_loco
CFG_start_imx53_loco.pblx.imximg = $(board)/freescale-mx53-loco/flash-header.imxcfg
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] barebox multi image support
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
` (11 preceding siblings ...)
2013-06-25 9:20 ` [PATCH 12/12] ARM: i.MX51 babbage: " Sascha Hauer
@ 2013-06-25 9:26 ` Sascha Hauer
2013-06-26 5:27 ` Sascha Hauer
13 siblings, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-25 9:26 UTC (permalink / raw)
To: barebox
On Tue, Jun 25, 2013 at 11:20:40AM +0200, Sascha Hauer wrote:
> This series adds support for generating multiple images from a single
> barebox binary. This helps when for example boards come with different
> SDRAM setups. Instead of having a config for each SDRAM setup we only
> have a single configuration, but generate multiple images from it.
>
> The basic idea behind this is using a PBL. As of now the PBL on ARM
> has a single entrypoint: barebox_arm_entry.
s/barebox_arm_entry/barebox_arm_reset_vector/
Sascha
--
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] 17+ messages in thread
* [PATCH] barebox multi image support
2013-06-25 9:20 [PATCH] barebox multi image support Sascha Hauer
` (12 preceding siblings ...)
2013-06-25 9:26 ` [PATCH] barebox " Sascha Hauer
@ 2013-06-26 5:27 ` Sascha Hauer
2013-06-26 5:27 ` [PATCH 1/2] ARM: Allow to pass a devicetree via boarddata Sascha Hauer
2013-06-26 5:27 ` [PATCH 2/2] ARM: dts: Add .S files as secondary target Sascha Hauer
13 siblings, 2 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-26 5:27 UTC (permalink / raw)
To: barebox
Two patches missing in this series.
Sascha
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/2] ARM: Allow to pass a devicetree via boarddata
2013-06-26 5:27 ` Sascha Hauer
@ 2013-06-26 5:27 ` Sascha Hauer
2013-06-26 5:27 ` [PATCH 2/2] ARM: dts: Add .S files as secondary target Sascha Hauer
1 sibling, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-26 5:27 UTC (permalink / raw)
To: barebox
Addionally to having a builtin DTB provide the possibility for
the board to provide a dtb via boarddata.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/cpu/Makefile | 2 +-
arch/arm/cpu/dtb.c | 22 ++++++++++++++++++++--
arch/arm/cpu/start.c | 20 ++++++++++++++++++++
arch/arm/include/asm/barebox-arm.h | 2 ++
4 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile
index c442b35..99973ae 100644
--- a/arch/arm/cpu/Makefile
+++ b/arch/arm/cpu/Makefile
@@ -8,7 +8,7 @@ obj-y += start.o setupc.o
#
obj-$(CONFIG_CMD_ARM_CPUINFO) += cpuinfo.o
obj-$(CONFIG_CMD_ARM_MMUINFO) += mmuinfo.o
-obj-$(CONFIG_BUILTIN_DTB) += dtb.o
+obj-$(CONFIG_OFDEVICE) += dtb.o
obj-$(CONFIG_MMU) += mmu.o cache.o mmu-early.o
pbl-$(CONFIG_MMU) += cache.o mmu-early.o
obj-$(CONFIG_CPU_32v4T) += cache-armv4.o
diff --git a/arch/arm/cpu/dtb.c b/arch/arm/cpu/dtb.c
index 10b73bd..a5881dd 100644
--- a/arch/arm/cpu/dtb.c
+++ b/arch/arm/cpu/dtb.c
@@ -17,20 +17,38 @@
#include <common.h>
#include <init.h>
#include <of.h>
+#include <asm/barebox-arm.h>
extern char __dtb_start[];
static int of_arm_init(void)
{
struct device_node *root;
+ void *fdt;
+ /* See if we already have a dtb */
root = of_get_root_node();
if (root)
return 0;
- root = of_unflatten_dtb(NULL, __dtb_start);
- if (root) {
+ /* See if we are provided a dtb in boarddata */
+ fdt = barebox_arm_boot_dtb();
+ if (fdt)
+ pr_debug("using boarddata provided DTB\n");
+
+ /* Next see if we have a builtin dtb */
+ if (!fdt && IS_ENABLED(CONFIG_BUILTIN_DTB)) {
+ fdt = __dtb_start;
pr_debug("using internal DTB\n");
+ }
+
+ if (!fdt) {
+ pr_debug("No DTB found\n");
+ return 0;
+ }
+
+ root = of_unflatten_dtb(NULL, fdt);
+ if (root) {
of_set_root_node(root);
if (IS_ENABLED(CONFIG_OFDEVICE))
of_probe();
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index 5a3c629..1f397ec 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -24,6 +24,7 @@
#include <asm/barebox-arm-head.h>
#include <asm-generic/memory_layout.h>
#include <asm/sections.h>
+#include <asm/unaligned.h>
#include <asm/cache.h>
#include <memory.h>
@@ -40,6 +41,13 @@ unsigned long barebox_arm_boarddata(void)
return barebox_boarddata;
}
+static void *barebox_boot_dtb;
+
+void *barebox_arm_boot_dtb(void)
+{
+ return barebox_boot_dtb;
+}
+
static noinline __noreturn void __start(uint32_t membase, uint32_t memsize,
uint32_t boarddata)
{
@@ -66,6 +74,18 @@ static noinline __noreturn void __start(uint32_t membase, uint32_t memsize,
mmu_early_enable(membase, memsize, endmem);
}
+ /*
+ * If boarddata is a pointer inside valid memory and contains a
+ * FDT magic then use it as later to probe devices
+ */
+ if (boarddata > membase && boarddata < membase + memsize &&
+ get_unaligned_be32((void *)boarddata) == FDT_MAGIC) {
+ uint32_t totalsize = get_unaligned_be32((void *)boarddata + 4);
+ endmem -= ALIGN(totalsize, 64);
+ barebox_boot_dtb = (void *)endmem;
+ memcpy(barebox_boot_dtb, (void *)boarddata, totalsize);
+ }
+
if ((unsigned long)_text > membase + memsize ||
(unsigned long)_text < membase)
/*
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index cd8decf..ddcafd1 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -54,6 +54,8 @@ static inline void arm_fixup_vectors(void)
}
#endif
+void *barebox_arm_boot_dtb(void);
+
/*
* For relocatable binaries find a suitable start address for the
* relocated binary. Beginning at the memory end substract the reserved
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 2/2] ARM: dts: Add .S files as secondary target
2013-06-26 5:27 ` Sascha Hauer
2013-06-26 5:27 ` [PATCH 1/2] ARM: Allow to pass a devicetree via boarddata Sascha Hauer
@ 2013-06-26 5:27 ` Sascha Hauer
1 sibling, 0 replies; 17+ messages in thread
From: Sascha Hauer @ 2013-06-26 5:27 UTC (permalink / raw)
To: barebox
Oherwise they get removed during build and trigger a rebuild of
the image.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/dts/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b271618..678f910 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -9,6 +9,7 @@ BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_NAME))
obj-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o
.SECONDARY: $(obj)/$(BUILTIN_DTB).dtb.S
+.SECONDARY: $(patsubst %,$(obj)/%.S,$(dtb-y))
targets += dtbs
targets += $(dtb-y)
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 17+ messages in thread