public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andre Heider <a.heider@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH] arm: mvebu: Espressobin: Set environment variable fdtfile
Date: Mon, 7 Sep 2020 18:51:29 +0200	[thread overview]
Message-ID: <c923b2d9-b77b-729f-c4a0-b49d5bfb69e9@gmail.com> (raw)
In-Reply-To: <20200907085207.iocuejimisr7qm6g@pali>

On 07/09/2020 10:52, Pali Roh?r wrote:
> On Monday 07 September 2020 10:46:37 Andre Heider wrote:
>> Hi Pali,
>>
>> On 07/09/2020 09:58, Pali Roh?r wrote:
>>> On Sunday 06 September 2020 20:44:50 Andre Heider wrote:
>>>> On 06/09/2020 11:32, Pali Roh?r wrote:
>>>>> On Saturday 05 September 2020 14:07:44 Andre Heider wrote:
>>>>>> +
>>>>>> +	emmc = of_machine_is_compatible("globalscale,espressobin-emmc");
>>>>>> +
>>>>>> +	if (ddr4 && emmc)
>>>>>> +		env_set("fdtfile", "marvell/armada-3720-espressobin-v7-emmc.dtb");
>>>>>> +	else if (ddr4)
>>>>>> +		env_set("fdtfile", "marvell/armada-3720-espressobin-v7.dtb");
>>>>>> +	else if (emmc)
>>>>>> +		env_set("fdtfile", "marvell/armada-3720-espressobin-emmc.dtb");
>>>>>> +	else
>>>>>> +		env_set("fdtfile", "marvell/armada-3720-espressobin.dtb");
>>>>>
>>>>> This code would overwrite user's value of fdtfile variable. And any
>>>>> change done by saveenv for fdtfile would be lost. I do not think this is
>>>>> correct way as it would break booting other distributions/forks (e.g.
>>>>> Marvell one) which DTB file has different name.
>>>>>
>>>>> Also user would not be able to adjust usage of its own DTB file if this
>>>>> code would overwrite it at every boot.
>>>>
>>>> Indeed, it shouldn't wipe a saved $fdtfile. Fixed locally with adding this
>>>> hunk to the start of the function:
>>>> +	if (env_get("fdtfile"))
>>>> +		return 0;
>>>
>>> This has still one issue: 'env default -a' does not restore original
>>> value. I would expect that 'env default -a' resets these values to
>>> correct default.
>>
>> there doesn't seem to be a way to archive that programmatically?
>> The default argument needs to be known at compile time.
> 
> So what about fixing it instead of adding new hacks?

Right, so for the occasional u-boot hacker like me it's not obvious how 
to solve a certain problem. Usually I check how other boards solve it. 
By your definition of hack other boards are full of it.

> Currently default env needs to be known at compile time due to
> assignment to static const storage. But this can be changed and e.g.
> board could could provide weak function which returns additional
> variables/value which uboot main code can use for default settings.

Sounds like you have an idea how to solve it nicely, so please go ahead.

>> Regards,
>> Andre

  reply	other threads:[~2020-09-07 16:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-05 12:07 [PATCH] arm: mvebu: Espressobin: Set environment variable fdtfile Andre Heider
2020-09-06  9:32 ` Pali Rohár
2020-09-06 16:12   ` Marek Behun
2020-09-06 18:48     ` Andre Heider
2020-09-06 18:56       ` Marek Behun
2020-09-07  5:20         ` Andre Heider
2020-09-06 18:44   ` Andre Heider
2020-09-07  7:58     ` Pali Rohár
2020-09-07  8:46       ` Andre Heider
2020-09-07  8:52         ` Pali Rohár
2020-09-07 16:51           ` Andre Heider [this message]
2020-09-11  4:35 ` [PATCH v2] " Andre Heider
2020-09-11 13:02   ` Gérald Kerma
2020-09-24 10:38   ` Stefan Roese
2020-09-25  7:46   ` Pali Rohár
2020-09-26  9:09     ` Andre Heider
2020-10-02 10:49       ` Pali Rohár
2020-10-03  7:17         ` Andre Heider
2020-10-03  8:50           ` Pali Rohár
2020-10-05 16:20             ` Andre Heider
2020-10-06 11:02               ` Pali Rohár

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=c923b2d9-b77b-729f-c4a0-b49d5bfb69e9@gmail.com \
    --to=a.heider@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