public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [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

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