From: Alex G. <mr.nuke.me@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 2/8] spl: fit: Factor out FIT parsing and use a context struct
Date: Mon, 21 Dec 2020 16:24:08 -0600 [thread overview]
Message-ID: <e4b3f368-3859-c785-2fb7-8cf29435eabb@gmail.com> (raw)
In-Reply-To: <CAPnjgZ3Hd9wH4JOPH_5St4-+oreoGY4Sfa=Wf-7ck+yGOAkoew@mail.gmail.com>
On 12/21/20 2:23 PM, Simon Glass wrote:
> Hi Alex,
>
> On Mon, 21 Dec 2020 at 12:28, Alex G. <mr.nuke.me@gmail.com> wrote:
>>
>> On 12/18/20 8:28 PM, Simon Glass wrote:
>>> Hi Alexandru,
>>>
>>> On Tue, 15 Dec 2020 at 17:09, Alexandru Gagniuc <mr.nuke.me@gmail.com> wrote:
>>>>
>>>> The logical steps in spl_load_simple_fit() are difficult to follow.
>>>> I think the long comments, ifdefs, and ungodly number of variables
>>>> seriously affect the readability. In particular, it violates section 6
>>>> of the coding style, paragraphs (3), and (4).
>>>>
>>>> The purpose of this patch is to improve the situation by
>>>> - Factoring out initialization and parsing to separate functions
>>>> - Reduce the number of variables by using a context structure
>>>> This change introduces no functional changes.
>>>>
>>>> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
>>>> ---
>>>> common/spl/spl_fit.c | 87 ++++++++++++++++++++++++++++++--------------
>>>> 1 file changed, 60 insertions(+), 27 deletions(-)
>>>
>>> This certainly looks a lot better although your email address does not
>>> inspire confidence...
>>
>> Don't worry. It doesn't bite.
>>
>>> Do you think you could look at creating a sandbox SPL test for this?
>>> It should be possible to write it in C, set up a bit of data, call
>>> your function and check the results.
>>
>> I can look at it. I can't promise anything though, since this is the
>> first time I heard of the sandbox. Maybe doc knows more.
>
> Yes, see doc/arch/sandbox.rst
>
> test/dm/Makefile shows that only one test file is enabled for SPL, but
> you can add more. Let me know if you need pointers.
>
> These aliases might help, if you build into /tmp/b/<board> :
>
> # Run a pytest on sandbox
> # $1: Name of test to run (optional, else run all)
>
> function pyt {
> test/py/test.py -B sandbox --build-dir /tmp/b/sandbox ${1:+"-k $1"}
> }
>
> # Run a pytest on sandbox_spl
> # $1: Name of test to run (optional, else run all SPL tests)
> function pytspl {
> local run=$1
>
> [[ -z "$run" ]] && run=spl
> test/py/test.py -B sandbox_spl --build-dir /tmp/b/sandbox_spl -k $run
> }
You're thinking way ahead of where I am. I know how to build a board,
but I've never used the test infrastructure. After some fumbling, I
figured I'd try sandbox_spl:
$ test/py/test.py -B sandbox_spl --bd sandbox_spl --build
As you can imagine, it kept complaining about SDL. I've never used
environment variables with Kbuild, so using NO_SPL=1 seems unnatural.
But then why would we need SDL for testing an SPL build anyway? 'swig'
was missing too, but that was an easy fix.
Second try:
$ NO_SDL=1 test/py/test.py -B sandbox_spl --bd sandbox_spl \
--build
Went a bit better, but " 29 failed, 502 passed, 212 skipped". Is this
normal?
What I seem to be missing is how to connect this python to calling
spl_load_simple_fit(). In the real world, I'd build u-boot and feed it a
FIT image -- boots, okay.
Alex
> Regards,
> Simon
>
>>
>> Alex
>>
>>>>
>>>> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
>>>> index 1b4a7f6b15..a6f85b6f9d 100644
>>>> --- a/common/spl/spl_fit.c
>>>> +++ b/common/spl/spl_fit.c
>>>> @@ -26,6 +26,12 @@ DECLARE_GLOBAL_DATA_PTR;
>>>> #define CONFIG_SYS_BOOTM_LEN (64 << 20)
>>>> #endif
>>>>
>>>> +struct spl_fit_info {
>>>> + const void *fit;
>>>> + size_t ext_data_offset;
>>>> + int images_node;
>>>> +};
>>>
>>> struct comments
>>>
>
> Regards,
> Simon
>
next prev parent reply other threads:[~2020-12-21 22:24 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-16 0:09 [PATCH 0/8] spl: fit: Play nicely with OP-TEE and Linux Alexandru Gagniuc
2020-12-16 0:09 ` [PATCH 1/8] spl: fit: Drop 'length' argument to board_spl_fit_post_load() Alexandru Gagniuc
2020-12-16 7:13 ` Peng Fan
2020-12-16 14:32 ` Alex G.
2020-12-19 2:28 ` Simon Glass
2020-12-16 0:09 ` [PATCH 2/8] spl: fit: Factor out FIT parsing and use a context struct Alexandru Gagniuc
2020-12-19 2:28 ` Simon Glass
2020-12-21 19:28 ` Alex G.
2020-12-21 20:23 ` Simon Glass
2020-12-21 22:24 ` Alex G. [this message]
2020-12-29 3:33 ` Simon Glass
2020-12-30 0:07 ` Alex G.
2020-12-30 14:15 ` Tom Rini
2020-12-31 2:57 ` Simon Glass
2021-01-31 3:45 ` Simon Glass
2020-12-16 0:09 ` [PATCH 3/8] spl: fit: Pass FIT context via a structure pointer Alexandru Gagniuc
2020-12-19 2:28 ` Simon Glass
2020-12-16 0:09 ` [PATCH 4/8] spl: fit: Remove useless loop in spl_fit_get_image_name() Alexandru Gagniuc
2020-12-19 2:29 ` Simon Glass
2020-12-16 0:09 ` [PATCH 5/8] spl: fit: Only look up FIT configuration node once Alexandru Gagniuc
2020-12-19 2:29 ` Simon Glass
2020-12-16 0:09 ` [PATCH 6/8] image: Do not #if guard board_fit_config_name_match() prototype Alexandru Gagniuc
2020-12-19 2:29 ` Simon Glass
2020-12-16 0:09 ` [PATCH 7/8] spl: fit: Replace #ifdef blocks with more readable constructs Alexandru Gagniuc
2020-12-19 2:29 ` Simon Glass
2020-12-21 17:43 ` Alex G.
2020-12-21 20:23 ` Simon Glass
2020-12-16 0:09 ` [PATCH 8/8] spl: fit: Load devicetree when a Linux payload is found Alexandru Gagniuc
2020-12-16 17:26 ` Alex G.
2020-12-22 23:54 ` [PATCH v2 0/8] spl: fit: Play nicely with OP-TEE and Linux Alexandru Gagniuc
2020-12-23 14:44 ` [PATCH v3 " Alexandru Gagniuc
2020-12-23 14:44 ` [PATCH v3 1/8] spl: fit: Drop 'length' argument to board_spl_fit_post_load() Alexandru Gagniuc
2021-01-16 2:33 ` Tom Rini
2021-01-18 16:28 ` Alex G.
2021-01-18 16:59 ` Tom Rini
2020-12-23 14:44 ` [PATCH v3 2/8] spl: fit: Factor out FIT parsing and use a context struct Alexandru Gagniuc
2020-12-23 14:44 ` [PATCH v3 3/8] spl: fit: Pass FIT context via a structure pointer Alexandru Gagniuc
2020-12-23 14:44 ` [PATCH v3 4/8] spl: fit: Remove useless loop in spl_fit_get_image_name() Alexandru Gagniuc
2020-12-23 14:44 ` [PATCH v3 5/8] spl: fit: Only look up FIT configuration node once Alexandru Gagniuc
2020-12-23 14:44 ` [PATCH v3 6/8] image: Do not #if guard board_fit_config_name_match() prototype Alexandru Gagniuc
2020-12-23 14:44 ` [PATCH v3 7/8] spl: fit: Replace #ifdef blocks with more readable constructs Alexandru Gagniuc
2020-12-23 14:44 ` [PATCH v3 8/8] spl: fit: Load devicetree when a Linux payload is found Alexandru Gagniuc
2020-12-22 23:54 ` [PATCH v2 1/8] spl: fit: Drop 'length' argument to board_spl_fit_post_load() Alexandru Gagniuc
2020-12-22 23:54 ` [PATCH v2 2/8] spl: fit: Factor out FIT parsing and use a context struct Alexandru Gagniuc
2020-12-29 3:32 ` Simon Glass
2020-12-22 23:54 ` [PATCH v2 3/8] spl: fit: Pass FIT context via a structure pointer Alexandru Gagniuc
2020-12-22 23:54 ` [PATCH v2 4/8] spl: fit: Remove useless loop in spl_fit_get_image_name() Alexandru Gagniuc
2020-12-22 23:54 ` [PATCH v2 5/8] spl: fit: Only look up FIT configuration node once Alexandru Gagniuc
2020-12-22 23:54 ` [PATCH v2 6/8] image: Do not #if guard board_fit_config_name_match() prototype Alexandru Gagniuc
2020-12-22 23:54 ` [PATCH v2 7/8] spl: fit: Replace #ifdef blocks with more readable constructs Alexandru Gagniuc
2020-12-22 23:54 ` [PATCH v2 8/8] spl: fit: Load devicetree when a Linux payload is found Alexandru Gagniuc
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=e4b3f368-3859-c785-2fb7-8cf29435eabb@gmail.com \
--to=mr.nuke.me@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox