From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
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 14:44:07 +0300 [thread overview]
Message-ID: <20160605144407.09c25a1c@i7> (raw)
In-Reply-To: <1465060340-7209-1-git-send-email-bernhard.nortmann@web.de>
Hello Bernhard,
On Sat, 4 Jun 2016 19:12:20 +0200
Bernhard Nortmann <bernhard.nortmann@web.de> wrote:
> Convert one of the "reserved" fields in the sunxi SPL header to
> a fel_script_length entry. That enables the sunxi-fel utility
> to pass the script size when booting over USB ("FEL mode").
>
> If board.c encounters a non-zero value in this header field, it
> will set U-Boot's "filesize" environment variable accordingly.
>
> sunxi-fel currently doesn't use this field (i.e. fel_script_length
> will remain 0), but it would allow for new use cases, e.g. passing
> tweaked/additional settings via a text file (uEnv.txt style), and
> then using "import -t ${fel_script_addr} ${filesize}" on them.
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?
>
> Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>
>
> ---
>
> arch/arm/include/asm/arch-sunxi/spl.h | 3 ++-
> board/sunxi/board.c | 8 +++++++-
> 2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-sunxi/spl.h b/arch/arm/include/asm/arch-sunxi/spl.h
> index a0f33b0..0e18438 100644
> --- a/arch/arm/include/asm/arch-sunxi/spl.h
> +++ b/arch/arm/include/asm/arch-sunxi/spl.h
> @@ -49,7 +49,8 @@ struct boot_file_head {
> uint8_t spl_signature[4];
> };
> uint32_t fel_script_address;
> - uint32_t reserved1[3];
> + uint32_t fel_script_length;
> + uint32_t reserved1[2];
> uint32_t boot_media; /* written here by the boot ROM */
> uint32_t reserved2[5]; /* padding, align to 64 bytes */
> };
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index d09cf6d..cf0ff33 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -585,9 +585,15 @@ static void parse_spl_header(const uint32_t spl_addr)
> if (memcmp(spl->spl_signature, SPL_SIGNATURE, 3) == 0) {
> uint8_t spl_header_version = spl->spl_signature[3];
> if (spl_header_version == SPL_HEADER_VERSION) {
> - if (spl->fel_script_address)
> + if (spl->fel_script_address) {
> setenv_hex("fel_scriptaddr",
> spl->fel_script_address);
> + if (spl->fel_script_length)
> + setenv_hex("filesize",
> + spl->fel_script_length);
> + else
> + setenv("filesize", NULL);
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"?
> + }
> return;
> }
> printf("sunxi SPL version mismatch: expected %u, got %u\n",
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.
--
Best regards,
Siarhei Siamashka
next prev parent reply other threads:[~2016-06-05 11:44 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 [this message]
2016-06-05 13:01 ` Bernhard Nortmann
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=20160605144407.09c25a1c@i7 \
--to=siarhei.siamashka@gmail.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 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.