mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] imd: create new helper macro to add data from oftree to image meta data
@ 2019-02-21 10:25 Uwe Kleine-König
  2019-02-21 10:25 ` [PATCH 2/2] ARM: phytec-som-imx6: make use of new imd oftree helper Uwe Kleine-König
  2019-02-22  8:11 ` [PATCH 1/2] imd: create new helper macro to add data from oftree to image meta data Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2019-02-21 10:25 UTC (permalink / raw)
  To: barebox; +Cc: Thorsten K . Scherer

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 include/image-metadata.h | 4 ++++
 scripts/gen-dtb-s        | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/image-metadata.h b/include/image-metadata.h
index 8739bffb92e1..5904d95acd37 100644
--- a/include/image-metadata.h
+++ b/include/image-metadata.h
@@ -118,6 +118,10 @@ static inline void imd_used(const void *unused)
 
 #define IMD_USED(_name) \
 	imd_used(&__barebox_imd_##_name)
+#define IMD_USED_OF(_name) ({ \
+	extern char __barebox_imd_OF_ ## _name[]; \
+	imd_used(&__barebox_imd_OF_ ## _name); \
+	})
 
 #endif /* __BAREBOX__ */
 
diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
index 2b44ffb361eb..c3144df851bf 100755
--- a/scripts/gen-dtb-s
+++ b/scripts/gen-dtb-s
@@ -18,8 +18,8 @@ FDTGET=scripts/dtc/fdtget
 
 if [ "$imd" = "y" ]; then
 	echo ".section .barebox_imd_0.${name},\"a\""
-	echo ".global __imd_${name}_start"
-	echo "__imd_${name}_start:"
+	echo ".global __barebox_imd_OF_${name}"
+	echo "__barebox_imd_OF_${name}:"
 
 	compat=$($FDTGET -d notfound -t bi "$dtb" / compatible | sed "s^ ^,^g")
 	if [ "$compat" != "notfound" ]; then
-- 
2.20.1


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

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

* [PATCH 2/2] ARM: phytec-som-imx6: make use of new imd oftree helper
  2019-02-21 10:25 [PATCH 1/2] imd: create new helper macro to add data from oftree to image meta data Uwe Kleine-König
@ 2019-02-21 10:25 ` Uwe Kleine-König
  2019-02-22  8:11 ` [PATCH 1/2] imd: create new helper macro to add data from oftree to image meta data Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2019-02-21 10:25 UTC (permalink / raw)
  To: barebox; +Cc: Thorsten K . Scherer

With this patch the two last lines are added to the output of the
following command:

	$ ./scripts/bareboximd images/barebox-phytec-phycore-imx6dl-som-emmc-1gib.img
	build: #15 Thu Feb 21 11:20:23 CET 2019
	release: 2019.02.0-00235-gb03cf6f145ae-dirty
	parameter: memsize=1024
	of_compatible: phytec,imx6dl-pcm058-emmc fsl,imx6dl
	model: Phytec phyCORE-i.MX6 DualLite/SOLO with eMMC

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/boards/phytec-som-imx6/lowlevel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boards/phytec-som-imx6/lowlevel.c b/arch/arm/boards/phytec-som-imx6/lowlevel.c
index 9d81c278ca43..915534ea9455 100644
--- a/arch/arm/boards/phytec-som-imx6/lowlevel.c
+++ b/arch/arm/boards/phytec-som-imx6/lowlevel.c
@@ -84,6 +84,7 @@ static void __noreturn start_imx6_phytec_common(uint32_t size,
 		extern char __dtb_##fdt_name##_start[];			\
 									\
 		IMD_USED(physom_mx6_memsize_##memory_size);		\
+		IMD_USED_OF(fdt_name);					\
 									\
 		start_imx6_phytec_common(memory_size, do_early_uart_config, \
 					 __dtb_##fdt_name##_start);	\
-- 
2.20.1


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

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

* Re: [PATCH 1/2] imd: create new helper macro to add data from oftree to image meta data
  2019-02-21 10:25 [PATCH 1/2] imd: create new helper macro to add data from oftree to image meta data Uwe Kleine-König
  2019-02-21 10:25 ` [PATCH 2/2] ARM: phytec-som-imx6: make use of new imd oftree helper Uwe Kleine-König
@ 2019-02-22  8:11 ` Sascha Hauer
  2019-02-22 21:22   ` Uwe Kleine-König
  1 sibling, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2019-02-22  8:11 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox, Thorsten K . Scherer

Hi Uwe,

On Thu, Feb 21, 2019 at 11:25:30AM +0100, Uwe Kleine-König wrote:
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  include/image-metadata.h | 4 ++++
>  scripts/gen-dtb-s        | 4 ++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/include/image-metadata.h b/include/image-metadata.h
> index 8739bffb92e1..5904d95acd37 100644
> --- a/include/image-metadata.h
> +++ b/include/image-metadata.h
> @@ -118,6 +118,10 @@ static inline void imd_used(const void *unused)
>  
>  #define IMD_USED(_name) \
>  	imd_used(&__barebox_imd_##_name)
> +#define IMD_USED_OF(_name) ({ \
> +	extern char __barebox_imd_OF_ ## _name[]; \
> +	imd_used(&__barebox_imd_OF_ ## _name); \
> +	})
>  
>  #endif /* __BAREBOX__ */
>  
> diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
> index 2b44ffb361eb..c3144df851bf 100755
> --- a/scripts/gen-dtb-s
> +++ b/scripts/gen-dtb-s
> @@ -18,8 +18,8 @@ FDTGET=scripts/dtc/fdtget
>  
>  if [ "$imd" = "y" ]; then
>  	echo ".section .barebox_imd_0.${name},\"a\""
> -	echo ".global __imd_${name}_start"
> -	echo "__imd_${name}_start:"
> +	echo ".global __barebox_imd_OF_${name}"
> +	echo "__barebox_imd_OF_${name}:"

This breaks somewhere when the compressed variants of the dtbs are used.
Building imx_v7_defconfig fails here with:

arch/arm/dts/built-in-pbl.o: In function `__dtb_z_imx6dl_wandboard_end':
arch/arm/dts/pbl-vf610-zii-ssmb-spu3.dtb.o:(.dtbz.rodata.imx6dl_wandboard+0x2340): undefined reference to `__imd_imx6dl_wandboard_start'
  OBJCOPYB images/start_imx6dl_nitrogen6x_1g.pblb
arch/arm/dts/built-in-pbl.o: In function `__dtb_z_imx6q_wandboard_end':
arch/arm/dts/pbl-vf610-zii-ssmb-spu3.dtb.o:(.dtbz.rodata.imx6q_wandboard+0x2320): undefined reference to `__imd_imx6q_wandboard_start'

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] 5+ messages in thread

* Re: [PATCH 1/2] imd: create new helper macro to add data from oftree to image meta data
  2019-02-22  8:11 ` [PATCH 1/2] imd: create new helper macro to add data from oftree to image meta data Sascha Hauer
@ 2019-02-22 21:22   ` Uwe Kleine-König
  2019-02-25  8:41     ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2019-02-22 21:22 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Thorsten K . Scherer

On Fri, Feb 22, 2019 at 09:11:39AM +0100, Sascha Hauer wrote:
> Hi Uwe,
> 
> On Thu, Feb 21, 2019 at 11:25:30AM +0100, Uwe Kleine-König wrote:
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> >  include/image-metadata.h | 4 ++++
> >  scripts/gen-dtb-s        | 4 ++--
> >  2 files changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/image-metadata.h b/include/image-metadata.h
> > index 8739bffb92e1..5904d95acd37 100644
> > --- a/include/image-metadata.h
> > +++ b/include/image-metadata.h
> > @@ -118,6 +118,10 @@ static inline void imd_used(const void *unused)
> >  
> >  #define IMD_USED(_name) \
> >  	imd_used(&__barebox_imd_##_name)
> > +#define IMD_USED_OF(_name) ({ \
> > +	extern char __barebox_imd_OF_ ## _name[]; \
> > +	imd_used(&__barebox_imd_OF_ ## _name); \
> > +	})
> >  
> >  #endif /* __BAREBOX__ */
> >  
> > diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
> > index 2b44ffb361eb..c3144df851bf 100755
> > --- a/scripts/gen-dtb-s
> > +++ b/scripts/gen-dtb-s
> > @@ -18,8 +18,8 @@ FDTGET=scripts/dtc/fdtget
> >  
> >  if [ "$imd" = "y" ]; then
> >  	echo ".section .barebox_imd_0.${name},\"a\""
> > -	echo ".global __imd_${name}_start"
> > -	echo "__imd_${name}_start:"
> > +	echo ".global __barebox_imd_OF_${name}"
> > +	echo "__barebox_imd_OF_${name}:"
> 
> This breaks somewhere when the compressed variants of the dtbs are used.
> Building imx_v7_defconfig fails here with:
> 
> arch/arm/dts/built-in-pbl.o: In function `__dtb_z_imx6dl_wandboard_end':
> arch/arm/dts/pbl-vf610-zii-ssmb-spu3.dtb.o:(.dtbz.rodata.imx6dl_wandboard+0x2340): undefined reference to `__imd_imx6dl_wandboard_start'
>   OBJCOPYB images/start_imx6dl_nitrogen6x_1g.pblb
> arch/arm/dts/built-in-pbl.o: In function `__dtb_z_imx6q_wandboard_end':
> arch/arm/dts/pbl-vf610-zii-ssmb-spu3.dtb.o:(.dtbz.rodata.imx6q_wandboard+0x2320): undefined reference to `__imd_imx6q_wandboard_start'

The following makes it build again (on top of my patch):

diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
index c3144df851bf..90294c4840f4 100755
--- a/scripts/gen-dtb-s
+++ b/scripts/gen-dtb-s
@@ -71,5 +71,5 @@ echo ".global __dtb_z_${name}_end"
 echo ".balign STRUCT_ALIGNMENT"
 
 if [ "$imd" = "y" ]; then
-       echo ".word __imd_${name}_start"
+       echo ".word __barebox_imd_OF_${name}"
 fi

But I admit I don't understand why this is referenced here. Also I
wonder why imx_defconfig + CONFIG_MACH_PHYTEC_SOM_IMX6=y doesn't fail.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

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

* Re: [PATCH 1/2] imd: create new helper macro to add data from oftree to image meta data
  2019-02-22 21:22   ` Uwe Kleine-König
@ 2019-02-25  8:41     ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2019-02-25  8:41 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox, Thorsten K . Scherer

On Fri, Feb 22, 2019 at 10:22:34PM +0100, Uwe Kleine-König wrote:
> On Fri, Feb 22, 2019 at 09:11:39AM +0100, Sascha Hauer wrote:
> > Hi Uwe,
> > 
> > On Thu, Feb 21, 2019 at 11:25:30AM +0100, Uwe Kleine-König wrote:
> > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > > ---
> > >  include/image-metadata.h | 4 ++++
> > >  scripts/gen-dtb-s        | 4 ++--
> > >  2 files changed, 6 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/include/image-metadata.h b/include/image-metadata.h
> > > index 8739bffb92e1..5904d95acd37 100644
> > > --- a/include/image-metadata.h
> > > +++ b/include/image-metadata.h
> > > @@ -118,6 +118,10 @@ static inline void imd_used(const void *unused)
> > >  
> > >  #define IMD_USED(_name) \
> > >  	imd_used(&__barebox_imd_##_name)
> > > +#define IMD_USED_OF(_name) ({ \
> > > +	extern char __barebox_imd_OF_ ## _name[]; \
> > > +	imd_used(&__barebox_imd_OF_ ## _name); \
> > > +	})
> > >  
> > >  #endif /* __BAREBOX__ */
> > >  
> > > diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
> > > index 2b44ffb361eb..c3144df851bf 100755
> > > --- a/scripts/gen-dtb-s
> > > +++ b/scripts/gen-dtb-s
> > > @@ -18,8 +18,8 @@ FDTGET=scripts/dtc/fdtget
> > >  
> > >  if [ "$imd" = "y" ]; then
> > >  	echo ".section .barebox_imd_0.${name},\"a\""
> > > -	echo ".global __imd_${name}_start"
> > > -	echo "__imd_${name}_start:"
> > > +	echo ".global __barebox_imd_OF_${name}"
> > > +	echo "__barebox_imd_OF_${name}:"
> > 
> > This breaks somewhere when the compressed variants of the dtbs are used.
> > Building imx_v7_defconfig fails here with:
> > 
> > arch/arm/dts/built-in-pbl.o: In function `__dtb_z_imx6dl_wandboard_end':
> > arch/arm/dts/pbl-vf610-zii-ssmb-spu3.dtb.o:(.dtbz.rodata.imx6dl_wandboard+0x2340): undefined reference to `__imd_imx6dl_wandboard_start'
> >   OBJCOPYB images/start_imx6dl_nitrogen6x_1g.pblb
> > arch/arm/dts/built-in-pbl.o: In function `__dtb_z_imx6q_wandboard_end':
> > arch/arm/dts/pbl-vf610-zii-ssmb-spu3.dtb.o:(.dtbz.rodata.imx6q_wandboard+0x2320): undefined reference to `__imd_imx6q_wandboard_start'
> 
> The following makes it build again (on top of my patch):
> 
> diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s
> index c3144df851bf..90294c4840f4 100755
> --- a/scripts/gen-dtb-s
> +++ b/scripts/gen-dtb-s
> @@ -71,5 +71,5 @@ echo ".global __dtb_z_${name}_end"
>  echo ".balign STRUCT_ALIGNMENT"
>  
>  if [ "$imd" = "y" ]; then
> -       echo ".word __imd_${name}_start"
> +       echo ".word __barebox_imd_OF_${name}"
>  fi
> 
> But I admit I don't understand why this is referenced here. Also I
> wonder why imx_defconfig + CONFIG_MACH_PHYTEC_SOM_IMX6=y doesn't fail.

We are using -fdata-sections -ffunction-sections to throw away unused
data and functions. In gen-dtb-s the lines you are changing in your
fixups do not have a separate section, so it ends up in the section that
has previously been set which here is: .section .dtbz.rodata.${name},\"a\"
So when the wandboard pulls in the symbol __dtb_z_imx6q_wandboard_start
then we must also have __imd_imx6q_wandboard_start.

I wonder which purpose these lines have anyway. Nothing in the code
seems to reference __imd_*_start, so I just removed the lines for now.

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] 5+ messages in thread

end of thread, other threads:[~2019-02-25  8:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 10:25 [PATCH 1/2] imd: create new helper macro to add data from oftree to image meta data Uwe Kleine-König
2019-02-21 10:25 ` [PATCH 2/2] ARM: phytec-som-imx6: make use of new imd oftree helper Uwe Kleine-König
2019-02-22  8:11 ` [PATCH 1/2] imd: create new helper macro to add data from oftree to image meta data Sascha Hauer
2019-02-22 21:22   ` Uwe Kleine-König
2019-02-25  8:41     ` Sascha Hauer

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