From: "André Przywara" <andre.przywara@arm.com>
To: u-boot@lists.denx.de
Subject: [PATCH 6/8] sunxi: board: Set fdtfile to match the DT chosen by SPL
Date: Tue, 22 Sep 2020 01:43:21 +0100 [thread overview]
Message-ID: <d5b3599a-1e4d-a3d4-cbf1-03cb15339e29@arm.com> (raw)
In-Reply-To: <20200903050716.48488-7-samuel@sholland.org>
On 03/09/2020 06:07, Samuel Holland wrote:
Hi,
> Previously, fdtfile was always the value in CONFIG_DEFAULT_DEVICE_TREE.
> This meant that, regardless of the DT chosen by SPL (either by changing
> the header in the image or by the selection code at runtime), Linux
> always used the default DT.
>
> By using the name from the SPL header (which, because of the previous
> commit, always matches the DT used by U-Boot proper), Linux also sees
> the same board as U-Boot/SPL, even if the boot script later loads a DT
> from disk.
I strongly frown upon proliferating the broken way of explicitly loading
a DT from somewhere, when the DT embedded in U-Boot should be all we
will ever need.
But making the selected DT available to U-Boot scripts doesn't really
hurt or prevent us from doing it properly, so:
> Signed-off-by: Samuel Holland <samuel@sholland.org>
One nit below, with that:
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Cheers,
Andre
> ---
> board/sunxi/board.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index eaa40a1ea96..5457b28e135 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -870,6 +870,7 @@ static void setup_environment(const void *fdt)
>
> int misc_init_r(void)
> {
> + const char *spl_dt_name;
> uint boot;
>
> env_set("fel_booted", NULL);
> @@ -888,6 +889,16 @@ int misc_init_r(void)
> env_set("mmc_bootdev", "1");
> }
>
> + /* Set fdtfile to match the FIT configuration chosen in SPL. */
> + spl_dt_name = get_spl_dt_name();
> + if (spl_dt_name) {
> + char *prefix = IS_ENABLED(CONFIG_ARM64) ? "allwinner/" : "";
> + char str[64];
The longest name (including the directory name) is 49 characters so far,
so let's hope that people don't go crazy with their DT names. Shall we
check the return value of snprintf() and at least complain? In contrast
to strncpy(), snprintf() is safe, but might still truncate the name.
Cheers,
Andre.
> +
> + snprintf(str, sizeof(str), "%s%s.dtb", prefix, spl_dt_name);
> + env_set("fdtfile", str);
> + }
> +
> setup_environment(gd->fdt_blob);
>
> #ifdef CONFIG_USB_ETHER
>
next prev parent reply other threads:[~2020-09-22 0:43 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 5:07 [PATCH 0/8] PinePhone automatic device tree selection Samuel Holland
2020-09-03 5:07 ` [PATCH 1/8] sunxi: board: Use a more descriptive variable name Samuel Holland
2020-09-22 0:37 ` André Przywara
2020-09-03 5:07 ` [PATCH 2/8] sunxi: board: Add a helper to get the SPL DT name Samuel Holland
2020-09-22 0:38 ` André Przywara
2020-09-03 5:07 ` [PATCH 3/8] sunxi: board: Simplify Pine A64 DT selection logic Samuel Holland
2020-09-22 0:40 ` André Przywara
2020-09-03 5:07 ` [PATCH 4/8] sunxi: board: Add PinePhone " Samuel Holland
2020-09-22 0:41 ` André Przywara
2020-10-21 18:56 ` Jagan Teki
2020-10-22 1:38 ` Samuel Holland
2020-10-22 6:26 ` Jagan Teki
2020-10-22 15:50 ` Maxime Ripard
2020-09-03 5:07 ` [PATCH 5/8] sunxi: board: Save the chosen DT name in the SPL header Samuel Holland
2020-09-22 0:41 ` André Przywara
2020-09-22 1:12 ` Samuel Holland
2020-09-22 7:46 ` André Przywara
2020-09-03 5:07 ` [PATCH 6/8] sunxi: board: Set fdtfile to match the DT chosen by SPL Samuel Holland
2020-09-22 0:43 ` André Przywara [this message]
2020-09-22 1:33 ` Samuel Holland
2020-09-24 14:22 ` Andre Przywara
2020-09-03 5:07 ` [PATCH 7/8] sunxi: DT: A64: update device tree files Samuel Holland
2020-09-03 5:07 ` [PATCH 8/8] sunxi: a64: Add a defconfig for the PinePhone Samuel Holland
2020-09-03 7:31 ` [PATCH 0/8] PinePhone automatic device tree selection Maxime Ripard
2020-09-07 0:01 ` André Przywara
2020-10-24 16:50 ` Peter Robinson
2020-10-24 14:45 ` Jagan Teki
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=d5b3599a-1e4d-a3d4-cbf1-03cb15339e29@arm.com \
--to=andre.przywara@arm.com \
--cc=u-boot@lists.denx.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