All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Freihofer <adrian.freihofer@gmail.com>
To: Antonin Godard <antonin.godard@bootlin.com>, docs@lists.yoctoproject.org
Subject: Re: [docs] [PATCH v2 1/2] ref-manual: cover UBOOT_ENV variables
Date: Mon, 24 Feb 2025 23:14:01 +0100	[thread overview]
Message-ID: <ddf80337ae8f7d5d3c8fda38bbc48a68c384be1a.camel@gmail.com> (raw)
In-Reply-To: <D80L3KLEZTJ9.T3ONJF2WKEGK@bootlin.com>

Hi Antonin

I will just send a v3 which fixes all your findings, except this one
needs clarification:

snip
> > +      -  Adding a script ``boot.cmd`` as an uImage to ``/boot``::
> > +
> > +            UBOOT_ENV = "boot"
> > +            UBOOT_ENV_SUFFIX = "scr"
> 
> Or shouldn't you set UBOOT_ENV_SRC_SUFFIX to "cmd" here too? I'm a
> little
> confused as why you refer to boot.cmd yet "cmd" is not defined here.

UBOOT_ENV_SRC_SUFFIX ?= "cmd" is the default.

I have spent many hours trying to understand the code that handles the
UBOOT_ENV* variables. It's super complicated. In uboot.inc, there is:

do_compile () {
if [ -n "${UBOOT_ENV}" ] && [ "${UBOOT_ENV_SUFFIX}" = "scr" ]; then
${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script \
-d ${UNPACKDIR}/${UBOOT_ENV_SRC} ${B}/${UBOOT_ENV_BINARY}
fi
}

do_install () {
if [ -n "${UBOOT_ENV}" ]; then
install -m 644 ${B}/${UBOOT_ENV_BINARY} \
${D}/boot/${UBOOT_ENV_IMAGE}
fi
}

Depending on the file ending respectively the UBOOT_ENV_SUFFIX
variable, something different happens: Either
 * a script which can be loaded by U-Boot's source command
   or
 * an image including a script which can be handled by U-Boot's load
   command
   ends up in /boot.

In u-boot-config.bbclass there are more variables defined:
 * Documented variables:
   UBOOT_ENV_SUFFIX ?= "txt"
   UBOOT_ENV ?= ""
   UBOOT_ENV_SRC_SUFFIX ?= "cmd"
 * Variables which are considered as internal and hence not documented
   on purpose:
   UBOOT_ENV_SRC ?= "${UBOOT_ENV}.${UBOOT_ENV_SRC_SUFFIX}"
   UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}"
   ...two more...

So my patch tries to keep it as simple as possible but still cover the
2 relevant use cases. To make it more clear, I added:
"It defaults to ``cmd``."
to the UBOOT_ENV_SRC_SUFFIX section.

I hope this makes it more understandable without a need for dropping
all these details on the users.


Note: It was even much more complicated when the kernel-
fitimage.bbclass was in use as well. The kernel-fitimage.bbclass is now
decoupled which simplifies (or maybe I should say fixes) it quite a
bit.

> 
snip

Thank you for the review!
Adrian



  reply	other threads:[~2025-02-24 22:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24  8:27 [PATCH v2 1/2] ref-manual: cover UBOOT_ENV variables Adrian Freihofer
2025-02-24  8:27 ` [PATCH v2 2/2] migration-guides: cover FIT_UBOOT_ENV Adrian Freihofer
2025-02-24  9:55   ` [docs] " Antonin Godard
2025-02-24  9:55 ` [docs] [PATCH v2 1/2] ref-manual: cover UBOOT_ENV variables Antonin Godard
2025-02-24 22:14   ` Adrian Freihofer [this message]
2025-02-25  8:46     ` Antonin Godard

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=ddf80337ae8f7d5d3c8fda38bbc48a68c384be1a.camel@gmail.com \
    --to=adrian.freihofer@gmail.com \
    --cc=antonin.godard@bootlin.com \
    --cc=docs@lists.yoctoproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.