* [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board
@ 2012-05-16 17:36 Stephen Warren
2012-05-16 17:36 ` [U-Boot] [PATCH 2/2] tegra: enabled CONFIG_ENV_VAR_BOARD_NAME/VENDOR/SOC Stephen Warren
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Stephen Warren @ 2012-05-16 17:36 UTC (permalink / raw)
To: u-boot
From: Stephen Warren <swarren@nvidia.com>
This can be useful for generic scripts. For example, rather than hard-
coding a script to ext2load tegra-harmony.dtb, it could load
${board_soc}-${board_name}.dtb and hence not need adjustments to
run on multiple boards.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
Wolfgang, does this seem like a reasonable feature? If so, can we merge
it through the Tegra tree, since the next patch enables this for Tegra.
Thanks!
common/Makefile | 9 +++++++++
common/env_common.c | 15 +++++++++++++++
common/env_embedded.c | 15 +++++++++++++++
3 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/common/Makefile b/common/Makefile
index 6e23baa..e9fcd6a 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -44,6 +44,15 @@ COBJS-y += cmd_nvedit.o
COBJS-y += cmd_version.o
# environment
+board_config_vars := \
+ '-DBOARD_ARCH="$(ARCH)"' \
+ '-DBOARD_CPU="$(CPU)"' \
+ '-DBOARD_NAME="$(BOARD)"' \
+ '-DBOARD_VENDOR="$(VENDOR)"' \
+ '-DBOARD_SOC="$(SOC)"'
+CFLAGS_common/env_common.o += $(board_config_vars)
+CFLAGS_common/env_embedded.o += $(board_config_vars)
+
COBJS-y += env_common.o
COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
diff --git a/common/env_common.c b/common/env_common.c
index c33d22d..4020ab9 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -116,6 +116,21 @@ const uchar default_environment[] = {
#if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0)
"pcidelay=" MK_STR(CONFIG_PCI_BOOTDELAY) "\0"
#endif
+#ifdef CONFIG_ENV_VAR_BOARD_ARCH
+ "board_arch=" BOARD_ARCH "\0"
+#endif
+#ifdef CONFIG_ENV_VAR_BOARD_CPU
+ "board_cpu=" BOARD_CPU "\0"
+#endif
+#ifdef CONFIG_ENV_VAR_BOARD_NAME
+ "board_name=" BOARD_NAME "\0"
+#endif
+#ifdef CONFIG_ENV_VAR_BOARD_VENDOR
+ "board_vendor=" BOARD_VENDOR "\0"
+#endif
+#ifdef CONFIG_ENV_VAR_BOARD_SOC
+ "board_soc=" BOARD_SOC "\0"
+#endif
#ifdef CONFIG_EXTRA_ENV_SETTINGS
CONFIG_EXTRA_ENV_SETTINGS
#endif
diff --git a/common/env_embedded.c b/common/env_embedded.c
index 80fb29d..9ce2fc6 100644
--- a/common/env_embedded.c
+++ b/common/env_embedded.c
@@ -179,6 +179,21 @@ env_t environment __PPCENV__ = {
#if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0)
"pcidelay=" MK_STR(CONFIG_PCI_BOOTDELAY) "\0"
#endif
+#ifdef CONFIG_ENV_VAR_BOARD_ARCH
+ "board_arch=" BOARD_ARCH "\0"
+#endif
+#ifdef CONFIG_ENV_VAR_BOARD_CPU
+ "board_cpu=" BOARD_CPU "\0"
+#endif
+#ifdef CONFIG_ENV_VAR_BOARD_NAME
+ "board_name=" BOARD_NAME "\0"
+#endif
+#ifdef CONFIG_ENV_VAR_BOARD_VENDOR
+ "board_vendor=" BOARD_VENDOR "\0"
+#endif
+#ifdef CONFIG_ENV_VAR_BOARD_SOC
+ "board_soc=" BOARD_SOC "\0"
+#endif
#ifdef CONFIG_EXTRA_ENV_SETTINGS
CONFIG_EXTRA_ENV_SETTINGS
#endif
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 2/2] tegra: enabled CONFIG_ENV_VAR_BOARD_NAME/VENDOR/SOC
2012-05-16 17:36 [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board Stephen Warren
@ 2012-05-16 17:36 ` Stephen Warren
2012-05-16 18:05 ` [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board Otavio Salvador
2012-05-21 19:00 ` Wolfgang Denk
2 siblings, 0 replies; 6+ messages in thread
From: Stephen Warren @ 2012-05-16 17:36 UTC (permalink / raw)
To: u-boot
From: Stephen Warren <swarren@nvidia.com>
So that all Tegra boards define environment variables that describe
themselves.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
include/configs/tegra2-common.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h
index 1931179..de9c39c 100644
--- a/include/configs/tegra2-common.h
+++ b/include/configs/tegra2-common.h
@@ -68,6 +68,9 @@
#endif
/* Environment */
+#define CONFIG_ENV_VAR_BOARD_NAME
+#define CONFIG_ENV_VAR_BOARD_VENDOR
+#define CONFIG_ENV_VAR_BOARD_SOC
#define CONFIG_ENV_SIZE 0x2000 /* Total Size Environment */
/*
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board
2012-05-16 17:36 [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board Stephen Warren
2012-05-16 17:36 ` [U-Boot] [PATCH 2/2] tegra: enabled CONFIG_ENV_VAR_BOARD_NAME/VENDOR/SOC Stephen Warren
@ 2012-05-16 18:05 ` Otavio Salvador
2012-05-21 19:00 ` Wolfgang Denk
2 siblings, 0 replies; 6+ messages in thread
From: Otavio Salvador @ 2012-05-16 18:05 UTC (permalink / raw)
To: u-boot
On Wed, May 16, 2012 at 2:36 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> This can be useful for generic scripts. For example, rather than hard-
> coding a script to ext2load tegra-harmony.dtb, it could load
> ${board_soc}-${board_name}.dtb and hence not need adjustments to
> run on multiple boards.
I do like the idea; this moves to the right direction for generic scripts :)
--
Otavio Salvador? ? ? ? ? ? ? ? ? ? ? ? ? ? ?O.S. Systems
E-mail: otavio at ossystems.com.br? http://www.ossystems.com.br
Mobile: +55 53 9981-7854? ? ? ?? ? ? ?http://projetos.ossystems.com.br
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board
2012-05-16 17:36 [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board Stephen Warren
2012-05-16 17:36 ` [U-Boot] [PATCH 2/2] tegra: enabled CONFIG_ENV_VAR_BOARD_NAME/VENDOR/SOC Stephen Warren
2012-05-16 18:05 ` [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board Otavio Salvador
@ 2012-05-21 19:00 ` Wolfgang Denk
2012-05-21 19:22 ` Stephen Warren
2 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2012-05-21 19:00 UTC (permalink / raw)
To: u-boot
Dear Stephen Warren,
In message <1337189793-25367-1-git-send-email-swarren@wwwdotorg.org> you wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> This can be useful for generic scripts. For example, rather than hard-
> coding a script to ext2load tegra-harmony.dtb, it could load
> ${board_soc}-${board_name}.dtb and hence not need adjustments to
> run on multiple boards.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> Wolfgang, does this seem like a reasonable feature? If so, can we merge
> it through the Tegra tree, since the next patch enables this for Tegra.
> Thanks!
>
> common/Makefile | 9 +++++++++
> common/env_common.c | 15 +++++++++++++++
> common/env_embedded.c | 15 +++++++++++++++
> 3 files changed, 39 insertions(+), 0 deletions(-)
Please make this optional - I don't want to have this enforced on all
boards, whether they want it or not.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A conservative is a man with two perfectly good legs who has never
learned to walk. - Franklin D. Roosevelt
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board
2012-05-21 19:00 ` Wolfgang Denk
@ 2012-05-21 19:22 ` Stephen Warren
2012-05-21 21:53 ` Wolfgang Denk
0 siblings, 1 reply; 6+ messages in thread
From: Stephen Warren @ 2012-05-21 19:22 UTC (permalink / raw)
To: u-boot
On 05/21/2012 01:00 PM, Wolfgang Denk wrote:
> Dear Stephen Warren,
>
> In message <1337189793-25367-1-git-send-email-swarren@wwwdotorg.org> you wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> This can be useful for generic scripts. For example, rather than hard-
>> coding a script to ext2load tegra-harmony.dtb, it could load
>> ${board_soc}-${board_name}.dtb and hence not need adjustments to
>> run on multiple boards.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>> Wolfgang, does this seem like a reasonable feature? If so, can we merge
>> it through the Tegra tree, since the next patch enables this for Tegra.
>> Thanks!
>>
>> common/Makefile | 9 +++++++++
>> common/env_common.c | 15 +++++++++++++++
>> common/env_embedded.c | 15 +++++++++++++++
>> 3 files changed, 39 insertions(+), 0 deletions(-)
>
> Please make this optional - I don't want to have this enforced on all
> boards, whether they want it or not.
Wolfgang,
Thanks for taking a look. The variables are already optional; you need
to set CONFIG_ENV_VAR_* in order for common/env_*.c to add those
variables to the default environment. Is that OK?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board
2012-05-21 19:22 ` Stephen Warren
@ 2012-05-21 21:53 ` Wolfgang Denk
0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Denk @ 2012-05-21 21:53 UTC (permalink / raw)
To: u-boot
Dear Stephen Warren,
In message <4FBA95F6.2020009@wwwdotorg.org> you wrote:
>
> > Please make this optional - I don't want to have this enforced on all
> > boards, whether they want it or not.
>
> Thanks for taking a look. The variables are already optional; you need
> to set CONFIG_ENV_VAR_* in order for common/env_*.c to add those
> variables to the default environment. Is that OK?
Ah, now I see what you mean. But this is awkward. Why do we need
both CONFIG_ENV_VAR_<foo> and <foo> ? Also note that these BOARD_*
names are kind of polluting the name space. I don't like that.
Just use a single variable with an appropriate value for each of
these settings. And don't pass these on the command line (which is
already unreadable enough), but add it to the auto-generated config
file.
And make the whole feature user selectable - I think it makes no sense
if you have to individually enable all the 5 settings.
Hm... thinking about this, I also don't like the "board_*" prefix.
What you actually have are names, i. e. it should probably read
"soc_name" instead of "board_soc", etc.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Accident: A condition in which presence of mind is good, but absence
of body is better.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-05-21 21:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-16 17:36 [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board Stephen Warren
2012-05-16 17:36 ` [U-Boot] [PATCH 2/2] tegra: enabled CONFIG_ENV_VAR_BOARD_NAME/VENDOR/SOC Stephen Warren
2012-05-16 18:05 ` [U-Boot] [PATCH 1/2] Add env vars describing U-Boot target board Otavio Salvador
2012-05-21 19:00 ` Wolfgang Denk
2012-05-21 19:22 ` Stephen Warren
2012-05-21 21:53 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox