From: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Remove global variable env_t *env_ptr ?
Date: Tue, 4 Apr 2017 10:24:21 +0000 [thread overview]
Message-ID: <1491301459.28343.1.camel@infinera.com> (raw)
In-Reply-To: <20170404105529.3740f49f@jawa>
On Tue, 2017-04-04 at 10:55 +0200, Lukasz Majewski wrote:
> Hi Joakim,
>
> > I am looking at adding support for runtime sizing of CONFIG_ENV_ADDR
> > as we need to replace out flash but we don't want to create a new
> > u-boot binairy just for this simple change.
>
> Please correct me if I did not understand your use case correctly.
>
> Other boards have separate regions in flash to store ENV variables -
> even redundancy is supported (from ./include/mccmon6.h)
>
> /* Envs are stored in NOR flash */
> #define CONFIG_ENV_IS_IN_FLASH
> #define CONFIG_ENV_SECT_SIZE (SZ_128K)
> #define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x40000)
>
> #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
> #define CONFIG_ENV_ADDR_REDUND (CONFIG_SYS_FLASH_BASE + 0x60000)
> #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
Use case is when CONFIG_ENV_SECT_SIZE and/or CONFIG_ENV_ADDR are non constants.
Then, in my case, these becomes:
#define CONFIG_ENV_SECT_SIZE (get_env_sect_size())
#define CONFIG_ENV_ADDR (get_env_address())
Jocke
>
> You can extract the ENV variables by using following script:
>
> scripts/get_default_envs.sh > default_envs.txt
>
> and then create updated env image (with [*]) to be stored on flash.
>
>
> Note:
>
> [*]
> ./tools/mkenvimage -s 131072 -o ${UBOOT_ENVS_DEFAULT} default_envs.txt
>
> Best regards,
> Łukasz Majewski
>
> >
> > While converting env_flash.c I noted the global variable
> > env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
> > which cannot be runtime decided.
> > Looking at users of this variable I only find one in pmc405de.c(not
> > sure what that board is doing) and for what I can tell this variable
> > is not correct for redundant env. either.
> >
> > Anyhow, I am faced wit two choices, either remove the env_ptr or
> > convert it to a function call.
> >
> > What do fellow u-booters think about env_ptr?
> >
> > Jocke
> >
next prev parent reply other threads:[~2017-04-04 10:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-03 12:19 [U-Boot] Remove global variable env_t *env_ptr ? Joakim Tjernlund
2017-04-03 20:17 ` Wolfgang Denk
2017-04-04 8:17 ` Joakim Tjernlund
2017-04-04 10:29 ` Wolfgang Denk
2017-04-04 8:55 ` Lukasz Majewski
2017-04-04 10:24 ` Joakim Tjernlund [this message]
2017-04-04 10:31 ` Wolfgang Denk
2017-04-04 10:44 ` Joakim Tjernlund
2017-04-04 11:27 ` Wolfgang Denk
2017-04-04 13:21 ` Joakim Tjernlund
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=1491301459.28343.1.camel@infinera.com \
--to=joakim.tjernlund@infinera.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