public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bernhard Nortmann <bernhard.nortmann@web.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] sunxi: Add the ability to pass (script) filesize in the SPL header
Date: Sun, 5 Jun 2016 15:01:30 +0200	[thread overview]
Message-ID: <575422AA.5050505@web.de> (raw)
In-Reply-To: <20160605144407.09c25a1c@i7>

Hi Siarhei!

Am 05.06.2016 um 13:44 schrieb Siarhei Siamashka:
> Hello Bernhard,
>
> [...]
> How does this work in general with "boot.scr" and "uEnv.txt" use
> cases? Could you provide a bit more detailed description?
>
> I mean, who is going to do "import -t ${fel_script_addr} ${filesize}"
> invocation?
>
> This particular FEL feature in the SPL header is used to allow running
> a boot script provided by the user (boot.scr). Without it, we only
> have the default U-Boot environment. And the default U-Boot environment
> does not have the "import -t ${fel_script_addr} ${filesize}" statement
> yet. This looks a bit like a chicken/egg problem or am I missing
> something?

No, you're right and not missing anything. Setting ${filesize} alone
doesn't achieve much, and would require further customization to do the
actual import. Since this whole idea of having the script length didn't
go down too well when I initially proposed it (back in September 2015),
I stayed away from adding additional U-Boot modifications this time.

One approach would be to have a modified "bootcmd_fel" that either tests
for a non-empty ${filesize}, or tries to import the script data as a
fallback ("source ${fel_scriptaddr} || import -t <...>;"). Another way is
to always assume "uEnv.txt style" whenever fel_script_length is set, and
do a himport_r() of the script data right away (the programmatic equivalent
of "import -t"). I'm doing this in an experimental branch of mine, as it
allows overriding everything from the default environment - including the
"bootcmd" itself.

Of course, all of this also requires support from the sunxi-fel side
of things (i.e. fel_script_length getting set in the first place). A
quick-and-dirty solution I'm currently using is to assume a uEnv.txt
script (and set fel_script_length) whenever sunxi-fel detects uploads of
pure ASCII data. This could also be done easily with a dedicated command,
and I can even image sunxi-fel building the uEnv.txt string itself from
given ("env") key/value pairs.

> I have no real opinion about this, but "filesize" looks like a
> rather generic name for this environment variable. Are there some
> advantages/disadvantages picking this particular name instead
> of something like "fel_scriptsize"?

Well... this _is_ the generic name that U-Boot itself tends to use for
data transfers. E.g. "load" or "tftp" commands set the ${filesize} too.

>
> That said, I have no objections to supporting "uEnv.txt" for FEL boot,
> as long as it works correctly and does not regress the existing
> "boot.scr" support.
>

Our sunxi-fel utility is already testing for the script.bin format
and can preserve the existing functionality by simply forcing
fel_script_length to 0 in that case. And additional safeguards might
be placed before "actively" setting that value to anything non-zero.

Regards, B. Nortmann

  reply	other threads:[~2016-06-05 13:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-14  1:13 [U-Boot] [PATCH v2] sunxi: Increase SPL header size to 64 bytes to avoid code corruption Siarhei Siamashka
2016-05-15 10:04 ` Hans de Goede
2016-05-16  9:56 ` Bernhard Nortmann
2016-05-16 17:52   ` Hans de Goede
2016-06-02 14:57     ` Siarhei Siamashka
2016-06-03  7:30       ` Bernhard Nortmann
2016-06-03 10:53         ` Hans de Goede
2016-06-04 17:12           ` [U-Boot] [PATCH] sunxi: Add the ability to pass (script) filesize in the SPL header Bernhard Nortmann
2016-06-05 11:44             ` Siarhei Siamashka
2016-06-05 13:01               ` Bernhard Nortmann [this message]
2016-06-06  9:20                 ` Siarhei Siamashka
2016-06-07 14:09                   ` Bernhard Nortmann
2016-06-07 17:14                     ` Siarhei Siamashka
2016-06-08 18:23             ` [U-Boot] [PATCH v2] sunxi: Add the ability to recognize and auto-import uEnv-style data Bernhard Nortmann
2016-06-08 20:13               ` Hans de Goede
2016-06-08 21:29                 ` Bernhard Nortmann
2016-06-09  0:14                 ` Siarhei Siamashka
2016-06-09  5:37                   ` [U-Boot] [PATCH v3] sunxi: FEL - " Bernhard Nortmann
2016-06-10 19:31                     ` [U-Boot] [U-Boot, " Hans de Goede

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=575422AA.5050505@web.de \
    --to=bernhard.nortmann@web.de \
    --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