On Tue, May 22, 2012 at 12:21 PM, Stephen Warren <swar...@wwwdotorg.org>wrote:
> From: Stephen Warren <swar...@nvidia.com> > Looks good. Acked-by: Simon Glass <s...@chromium.org> > > This can be useful for generic scripts. For example, rather than hard- > coding a script to ext2load tegra-harmony.dtb, it could load > ${soc}-${board}.dtb and hence not need adjustments to run on multiple > boards. > > Signed-off-by: Stephen Warren <swar...@nvidia.com> > --- > v3: > * Prefix config.h #defines with CONFIG_SYS_. The environment variable > names remain unchanged. > v2: > * Pass values via config.h instead of command-line > * Use a single CONFIG option to enable this feature > * Simplify names of the environment variables > * add README entry describing CONFIG_ENV_VARS_UBOOT_CONFIG > --- > README | 14 ++++++++++++++ > common/env_common.c | 11 +++++++++++ > common/env_embedded.c | 11 +++++++++++ > mkconfig | 8 ++++++++ > 4 files changed, 44 insertions(+), 0 deletions(-) > > diff --git a/README b/README > index 6919392..96b8808 100644 > --- a/README > +++ b/README > @@ -2203,6 +2203,20 @@ The following options need to be configured: > the environment like the "source" command or the > boot command first. > > + CONFIG_ENV_VARS_UBOOT_CONFIG > + > + Define this in order to add variables describing the > + U-Boot build configuration to the default environment. > + These will be named arch, cpu, board, vendor, and soc. > + > + Enabling this option will cause the following to be > defined: > + > + - CONFIG_SYS_ARCH > + - CONFIG_SYS_CPU > + - CONFIG_SYS_BOARD > + - CONFIG_SYS_VENDOR > + - CONFIG_SYS_SOC > + > - DataFlash Support: > CONFIG_HAS_DATAFLASH > > diff --git a/common/env_common.c b/common/env_common.c > index c33d22d..d9e990d 100644 > --- a/common/env_common.c > +++ b/common/env_common.c > @@ -116,6 +116,17 @@ const uchar default_environment[] = { > #if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0) > "pcidelay=" MK_STR(CONFIG_PCI_BOOTDELAY) "\0" > #endif > +#ifdef CONFIG_ENV_VARS_UBOOT_CONFIG > + "arch=" CONFIG_SYS_ARCH "\0" > + "cpu=" CONFIG_SYS_CPU "\0" > + "board=" CONFIG_SYS_BOARD "\0" > +#ifdef CONFIG_SYS_VENDOR > + "vendor=" CONFIG_SYS_VENDOR "\0" > +#endif > +#ifdef CONFIG_SYS_SOC > + "soc=" CONFIG_SYS_SOC "\0" > +#endif > +#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..3872878 100644 > --- a/common/env_embedded.c > +++ b/common/env_embedded.c > @@ -179,6 +179,17 @@ env_t environment __PPCENV__ = { > #if defined(CONFIG_PCI_BOOTDELAY) && (CONFIG_PCI_BOOTDELAY > 0) > "pcidelay=" MK_STR(CONFIG_PCI_BOOTDELAY) "\0" > #endif > +#ifdef CONFIG_ENV_VARS_UBOOT_CONFIG > + "arch=" CONFIG_SYS_ARCH "\0" > + "cpu=" CONFIG_SYS_CPU "\0" > + "board=" CONFIG_SYS_BOARD "\0" > +#ifdef CONFIG_SYS_VENDOR > + "vendor=" CONFIG_SYS_VENDOR "\0" > +#endif > +#ifdef CONFIG_SYS_SOC > + "soc=" CONFIG_SYS_SOC "\0" > +#endif > +#endif > #ifdef CONFIG_EXTRA_ENV_SETTINGS > CONFIG_EXTRA_ENV_SETTINGS > #endif > diff --git a/mkconfig b/mkconfig > index 438530b..3e9c695 100755 > --- a/mkconfig > +++ b/mkconfig > @@ -161,6 +161,14 @@ for i in ${TARGETS} ; do > echo "#define CONFIG_${i}" >>config.h ; > done > > +echo "#define CONFIG_SYS_ARCH \"${arch}\"" >> config.h > +echo "#define CONFIG_SYS_CPU \"${cpu}\"" >> config.h > +echo "#define CONFIG_SYS_BOARD \"${board}\"" >> config.h > + > +[ "${vendor}" ] && echo "#define CONFIG_SYS_VENDOR \"${vendor}\"" >> > config.h > + > +[ "${soc}" ] && echo "#define CONFIG_SYS_SOC \"${soc}\"" >> > config.h > + > cat << EOF >> config.h > #define CONFIG_BOARDDIR board/$BOARDDIR > #include <config_cmd_defaults.h> > -- > 1.7.0.4 > >
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot