[PATCH 4/4] arm/boards: Add IMD_USED_OF for a few boards

Sascha Hauer s.hauer at pengutronix.de
Fri Sep 18 06:03:31 EDT 2020


On Thu, Sep 17, 2020 at 10:17:08PM +0200, Uwe Kleine-König wrote:
> Not all boards can make use of the helper macros introduced in the previous
> commits, for these add an explicit call to IMD_USED_OF to add meta data
> to the barebox image.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> ---
>  arch/arm/boards/embest-riotboard/lowlevel.c     | 1 +
>  arch/arm/boards/technexion-wandboard/lowlevel.c | 2 ++
>  arch/arm/boards/zii-imx51-rdu1/lowlevel.c       | 3 +++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/arch/arm/boards/embest-riotboard/lowlevel.c b/arch/arm/boards/embest-riotboard/lowlevel.c
> index 07f669fc0309..b0f5339b0a70 100644
> --- a/arch/arm/boards/embest-riotboard/lowlevel.c
> +++ b/arch/arm/boards/embest-riotboard/lowlevel.c
> @@ -23,6 +23,7 @@ ENTRY_FUNCTION(start_imx6s_riotboard, r0, r1, r2)
>  		putc_ll('a');
>  	}
>  
> +	IMD_USED_OF(imx6s_riotboard);
>  	fdt = __dtb_imx6s_riotboard_start + get_runtime_offset();
>  	barebox_arm_entry(0x10000000, SZ_1G, fdt);
>  }
> diff --git a/arch/arm/boards/technexion-wandboard/lowlevel.c b/arch/arm/boards/technexion-wandboard/lowlevel.c
> index 33babbbb2feb..5c1b5d6ed292 100644
> --- a/arch/arm/boards/technexion-wandboard/lowlevel.c
> +++ b/arch/arm/boards/technexion-wandboard/lowlevel.c
> @@ -334,9 +334,11 @@ static noinline void wandboard_start(void)
>  	switch (cpu_type) {
>  	case IMX6_CPUTYPE_IMX6S:
>  	case IMX6_CPUTYPE_IMX6DL:
> +		IMD_USED_OF(imx6dl_wandboard);
>  		dtb = __dtb_z_imx6dl_wandboard_start;
>  		break;
>  	case IMX6_CPUTYPE_IMX6Q:
> +		IMD_USED_OF(imx6q_wandboard);
>  		dtb = __dtb_z_imx6q_wandboard_start;
>  		break;
>  	default:

This doesn't work like you might expect. IMD_USED_OF uses imd_used().
This fake function only has the effect that
__barebox_imd_OF_imx6q_wandboard appears to be used and thus doesn't get
discarded by the linker. By putting imd_used() multiple times into code
which ends up in the same binary you'll get all tags in the binary, no
matter where in the code you put IMD_USED_OF.

Having two tags is fine, because you really have a binary that is
compatible to both wand,imx6dl-wandboard and wand,imx6q-wandboard, but
please put them side by side into the ENTRY_FUNCTION.

Have you compile tested this patch? It seems an #include
<image-metadata.h> is missing at least in this file.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list