From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Mon, 30 May 2016 21:36:11 +0200 Subject: [U-Boot] [PATCH] env: Setup GD_FLG_ENV_DEFAULT flag when default environment are used In-Reply-To: References: Message-ID: <574C962B.2090503@suse.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 05/30/2016 04:11 PM, Michal Simek wrote: > Setup flag when default environment are used to be able to > rewrite default distro boot variables based on SoC boot mode. > > Signed-off-by: Michal Simek > --- > > I didn't find any way how to detect that default or saved variables are > used. I want to have a flag to be able to rewrite boot_targets variable > based on boot mode. Especially when SD boot mode is setup than SD should > be primary boot devices, etc. > When variables are saved boot_targets will be restored and SoC boot mode > will be ignored. > If you know better way how to do it, please let me know. You may want to be able to do the same from inside a script, so I guess we should better have this as an environment variable itself again. There was a way to have environment variable reads return a value directly from code rather than go via environment storage. I guess we could expose the flag through that? Or add an environment variable that we set in set_default_env() and ignore that variable on saveenv. I'm not sure I like that option better than your current one though. Alex > > --- > common/env_common.c | 1 + > include/asm-generic/global_data.h | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/common/env_common.c b/common/env_common.c > index af59c72e1fd7..13db7dc3f755 100644 > --- a/common/env_common.c > +++ b/common/env_common.c > @@ -123,6 +123,7 @@ void set_default_env(const char *s) > error("Environment import failed: errno = %d\n", errno); > > gd->flags |= GD_FLG_ENV_READY; > + gd->flags |= GD_FLG_ENV_DEFAULT; > } > > > diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h > index f2810a1bd75f..0abcbe4c0b3a 100644 > --- a/include/asm-generic/global_data.h > +++ b/include/asm-generic/global_data.h > @@ -141,5 +141,6 @@ typedef struct global_data { > #define GD_FLG_SPL_INIT 0x00400 /* spl_init() has been called */ > #define GD_FLG_SKIP_RELOC 0x00800 /* Don't relocate */ > #define GD_FLG_RECORD 0x01000 /* Record console */ > +#define GD_FLG_ENV_DEFAULT 0x02000 /* Default variable flag */ > > #endif /* __ASM_GENERIC_GBL_DATA_H */