U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Raymond Mao <raymond.mao@linaro.org>
Cc: u-boot@lists.denx.de, Joe Hershberger <joe.hershberger@ni.com>,
	Simon Glass <sjg@chromium.org>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Ravi Minnikanti <rminnikanti@marvell.com>,
	Matthias Brugger <mbrugger@suse.com>,
	Evgeny Bachinin <EABachinin@salutedevices.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Paul HENRYS <paul.henrys_ext@softathome.com>,
	Philippe Reynes <philippe.reynes@softathome.com>,
	Peter Robinson <pbrobinson@gmail.com>,
	Caleb Connolly <caleb.connolly@linaro.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: Re: [PATCH 2/2] env: point fdt address to the fdt in a bloblist
Date: Mon, 31 Mar 2025 08:10:54 -0600	[thread overview]
Message-ID: <20250331141054.GT93000@bill-the-cat> (raw)
In-Reply-To: <CAEfUkU+ECBuGjGrNra0JXq71BtWGJ4uqMfDS9qxxaFrZ9qy9Rw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2723 bytes --]

On Mon, Mar 31, 2025 at 10:07:29AM -0400, Raymond Mao wrote:
> Hi Tom,
> 
> On Fri, 28 Mar 2025 at 19:51, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Thu, Mar 27, 2025 at 04:13:17PM -0700, Raymond Mao wrote:
> >
> > > Point fdt_addr to the fdt embedded in the bloblist since fdt_addr
> > > is a default address for bootefi, bootm and booti to look for the
> > > device tree when launching the kernel.
> > >
> > > Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
> > > ---
> > >  env/common.c | 17 +++++++++++++++++
> > >  1 file changed, 17 insertions(+)
> > >
> > > diff --git a/env/common.c b/env/common.c
> > > index a58955a4f42..a38e5d107a8 100644
> > > --- a/env/common.c
> > > +++ b/env/common.c
> > > @@ -16,6 +16,7 @@
> > >  #include <asm/global_data.h>
> > >  #include <linux/printk.h>
> > >  #include <linux/stddef.h>
> > > +#include <mapmem.h>
> > >  #include <search.h>
> > >  #include <errno.h>
> > >  #include <malloc.h>
> > > @@ -368,6 +369,18 @@ int env_get_default_into(const char *name, char *buf, unsigned int len)
> > >       return env_get_from_linear(default_environment, name, buf, len);
> > >  }
> > >
> > > +static int env_update_fdt_addr_from_bloblist(void)
> > > +{
> > > +     /*
> > > +      * fdt_addr is by default used by booti, bootm and bootefi,
> > > +      * thus set it to point to the fdt embedded in a bloblist if it exists.
> > > +      */
> > > +     if (!CONFIG_IS_ENABLED(BLOBLIST) || gd->fdt_src != FDTSRC_BLOBLIST)
> > > +             return 0;
> > > +
> > > +     return env_set_hex("fdt_addr", (uintptr_t)map_to_sysmem(gd->fdt_blob));
> > > +}
> >
> > This part is fine with me and makes enough sense, we can't do this
> > immediately so we need some check to know to do it later.
> >
> > >  void env_set_default(const char *s, int flags)
> > >  {
> > >       if (s) {
> > > @@ -392,6 +405,10 @@ void env_set_default(const char *s, int flags)
> > >
> > >       gd->flags |= GD_FLG_ENV_READY;
> > >       gd->flags |= GD_FLG_ENV_DEFAULT;
> > > +
> > > +     /* This has to be done after GD_FLG_ENV_READY is set */
> > > +     if (env_update_fdt_addr_from_bloblist())
> > > +             pr_err("Failed to set fdt_addr to point at DTB\n");
> > >  }
> >
> > I don't know this is the right spot. This won't work when for example
> > the environment is valid but stored in a file on FAT (or whatever) will
> > it?
> >
> 
> I can add invoking 'env_update_fdt_addr_from_bloblist()' inside
> 'env_import()'. It should work in all the cases then.

That's probably closer? I'm not sure if it will or won't be a problem on
say re-import with "env import .." in that case, so please check.
Thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2025-03-31 14:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-27 23:13 [PATCH 1/2] bloblist: fix the overriding of fdt from bloblist Raymond Mao
2025-03-27 23:13 ` [PATCH 2/2] env: point fdt address to the fdt in a bloblist Raymond Mao
2025-03-28 11:35   ` Simon Glass
2025-03-28 15:05     ` Raymond Mao
2025-03-28 23:39       ` Simon Glass
2025-03-29  0:03         ` Tom Rini
2025-03-29  0:51           ` Raymond Mao
2025-03-28 23:53     ` Tom Rini
2025-03-28 23:51   ` Tom Rini
2025-03-31 14:07     ` Raymond Mao
2025-03-31 14:10       ` Tom Rini [this message]
2025-03-28 10:44 ` [PATCH 1/2] bloblist: fix the overriding of fdt from bloblist Caleb Connolly
2025-03-28 12:27   ` Caleb Connolly
2025-03-28 14:28     ` Raymond Mao
2025-03-28 11:34 ` Simon Glass
2025-03-28 14:17   ` Raymond Mao
2025-03-28 14:26     ` Simon Glass
2025-03-28 14:38       ` Raymond Mao
2025-03-28 15:12         ` Simon Glass
2025-03-29  1:17           ` Raymond Mao
2025-03-28 12:20 ` Ilias Apalodimas

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=20250331141054.GT93000@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=EABachinin@salutedevices.com \
    --cc=caleb.connolly@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=joe.hershberger@ni.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=mbrugger@suse.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=paul.henrys_ext@softathome.com \
    --cc=pbrobinson@gmail.com \
    --cc=philippe.reynes@softathome.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=raymond.mao@linaro.org \
    --cc=rminnikanti@marvell.com \
    --cc=sjg@chromium.org \
    --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