mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 4/4] arm/boards: Add IMD_USED_OF for a few boards
Date: Fri, 18 Sep 2020 12:03:31 +0200	[thread overview]
Message-ID: <20200918100331.GV4498@pengutronix.de> (raw)
In-Reply-To: <20200917201708.12168-4-u.kleine-koenig@pengutronix.de>

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@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 |

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

      reply	other threads:[~2020-09-18 10:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 20:17 [PATCH 1/4] imx/esdctl: reorder some function declarations to be sorted by SoC Uwe Kleine-König
2020-09-17 20:17 ` [PATCH 2/4] imx/esdctl: Define new helper macros to reduce board entry boilerplate Uwe Kleine-König
2020-09-18 10:32   ` Sascha Hauer
2020-09-17 20:17 ` [PATCH 3/4] arm/boards: Convert a few boards to the new entry macros Uwe Kleine-König
2020-09-17 20:17 ` [PATCH 4/4] arm/boards: Add IMD_USED_OF for a few boards Uwe Kleine-König
2020-09-18 10:03   ` Sascha Hauer [this message]

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=20200918100331.GV4498@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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