Skip to contentSkip to conversation

env: always build env_embedded and envcrc

U-Boot Superseded Mike Frysinger 3 participants 41 messages Jul 27, 2009 – Oct 26, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

The envcrc utility is only called when it is actually needed, so having the internal code depend on ENV_IS_EMBEDDED isn't necessary. Plus, by always building it, external utils can manipulate the environment blob without having to mess around with defines.

Same logic holds for env_embedded. It is already compiled for the majority of boards into a 0 byte file, so enabling it all the time shouldn't cause noticable change in overhead. The difference now is that we link it into U-Boot itself only when CONFIG_ENV_IS_EMBEDDED is defined.

---
 common/Makefile       |    7 ++-----
 common/env_embedded.c |    7 -------
 tools/Makefile        |   10 +---------
 tools/envcrc.c        |   11 +----------
 4 files changed, 4 insertions(+), 31 deletions(-)
common/Makefile +2 -5
index 3781738..2ace329 100644
@@ -49,12 +49,9 @@ COBJS-y += cmd_nvedit.o
 
 # environment
 COBJS-y += env_common.o
+COBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
 COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
-COBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
 COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
@@ -168,7 +165,7 @@ OBJS	:= $(addprefix $(obj),$(AOBJS) $(COBJS))
 
 CPPFLAGS += -I..
 
-all:	$(LIB) $(AOBJS)
+all:	$(LIB) $(AOBJS) $(obj)env_embedded.o
 
 $(LIB): $(obj).depend $(OBJS)
 	$(AR) $(ARFLAGS) $@ $(OBJS)
common/env_embedded.c +0 -7
index ae6cac4..e27e1cd 100644
@@ -41,11 +41,6 @@
 #endif
 
 /*
- * Generate embedded environment table
- * inside U-Boot image, if needed.
- */
-#if defined(ENV_IS_EMBEDDED)
-/*
  * Only put the environment in it's own section when we are building
  * U-Boot proper.  The host based program "tools/envcrc" does not need
  * a seperate section.  Note that ENV_CRC is only defined when building
@@ -210,5 +205,3 @@ unsigned long env_size __PPCTEXT__ = sizeof(env_t);
  * Add in absolutes.
  */
 GEN_ABS(env_offset, CONFIG_ENV_OFFSET);
-
-#endif /* ENV_IS_EMBEDDED */
tools/Makefile +1 -9
index b5a1e39..d24f114 100644
@@ -68,14 +68,7 @@ include $(TOPDIR)/config.mk
 # Generated executable files
 BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
 BIN_FILES-y += mkimage$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_DATAFLASH) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_EEPROM) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_FLASH) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_ONENAND) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_NAND) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_NVRAM) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_SPI_FLASH) += envcrc$(SFX)
+BIN_FILES-y += envcrc$(SFX)
 BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
 BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX)
 BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
@@ -93,7 +86,6 @@ EXT_OBJ_FILES-y += common/image.o
 # Source files located in the tools directory
 OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-y += mkimage.o
-OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
 OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
 OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
tools/envcrc.c +1 -10
index 5b0f7cd..d02a7db 100644
@@ -50,10 +50,6 @@
 # if defined(CONFIG_ENV_ADDR_REDUND) && !defined(CONFIG_ENV_SIZE_REDUND)
 #  define CONFIG_ENV_SIZE_REDUND	CONFIG_ENV_SIZE
 # endif
-# if (CONFIG_ENV_ADDR >= CONFIG_SYS_MONITOR_BASE) && \
-     ((CONFIG_ENV_ADDR + CONFIG_ENV_SIZE) <= (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN))
-#  define ENV_IS_EMBEDDED	1
-# endif
 # if defined(CONFIG_ENV_ADDR_REDUND) || defined(CONFIG_ENV_OFFSET_REDUND)
 #  define CONFIG_SYS_REDUNDAND_ENVIRONMENT	1
 # endif
@@ -70,14 +66,11 @@
 
 extern uint32_t crc32 (uint32_t, const unsigned char *, unsigned int);
 
-#ifdef	ENV_IS_EMBEDDED
 extern unsigned int env_size;
 extern unsigned char environment;
-#endif	/* ENV_IS_EMBEDDED */
 
 int main (int argc, char **argv)
 {
-#ifdef	ENV_IS_EMBEDDED
 	unsigned char pad = 0x00;
 	uint32_t crc;
 	unsigned char *envptr = &environment,
@@ -131,8 +124,6 @@ int main (int argc, char **argv)
 	} else {
 		printf ("0x%08X\n", crc);
 	}
-#else
-	printf ("0\n");
-#endif
+
 	return EXIT_SUCCESS;
 }
Signature · 1 line
1.6.3.3
#1 lore raw

Dear Mike Frysinger,

Quoted 4 lines · In message <[email protected]> you wrote:

The envcrc utility is only called when it is actually needed, so having the internal code depend on ENV_IS_EMBEDDED isn't necessary. Plus, by always building it, external utils can manipulate the environment blob without having to mess around with defines.

But always building some tool that is normally not needed just adds to the compile time.

Quoted 4 lines

Same logic holds for env_embedded. It is already compiled for the majority of boards into a 0 byte file, so enabling it all the time shouldn't cause noticable change in overhead. The difference now is that we link it into U-Boot itself only when CONFIG_ENV_IS_EMBEDDED is defined.

Again, I see added build time as a con for this patch - but I'm failing to see any pro?

If you have "external utils" that might need this, please add a separate Makefile target so you can build this separately, but save all the rest of us the compile time overhead.

Thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
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
grep me no patterns and I'll tell you no lines.
#2 lore raw

PATCH v2 1/1 env: only build env_embedded and envcrc when needed

In reply to Mike Frysinger

The env code is protected by the ENV_IS_EMBEDDED define, so attempting to compile the code when this isn't defined is pointless. Now that the env headers have unified around CONFIG_ENV_IS_EMBEDDED, convert the build system to only build the env objects when this is enabled. And now that the env code is conditionally compiled, we can drop the source code checks.

For people who want to extract the environment manually, add a new option that only enables the envcrc utility.

---
v2
- change logic from "always builds" to "build only when needed"

 common/Makefile       |    5 +----
 common/env_embedded.c |    7 -------
 include/common.h      |    5 +++++
 tools/Makefile        |   11 +++--------
 tools/envcrc.c        |   11 +----------
 5 files changed, 10 insertions(+), 29 deletions(-)
common/Makefile +1 -4
index 3781738..e3a1591 100644
@@ -49,12 +49,9 @@ COBJS-y += cmd_nvedit.o
 
 # environment
 COBJS-y += env_common.o
+COBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
 COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
-COBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
 COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
common/env_embedded.c +0 -7
index ae6cac4..e27e1cd 100644
@@ -41,11 +41,6 @@
 #endif
 
 /*
- * Generate embedded environment table
- * inside U-Boot image, if needed.
- */
-#if defined(ENV_IS_EMBEDDED)
-/*
  * Only put the environment in it's own section when we are building
  * U-Boot proper.  The host based program "tools/envcrc" does not need
  * a seperate section.  Note that ENV_CRC is only defined when building
@@ -210,5 +205,3 @@ unsigned long env_size __PPCTEXT__ = sizeof(env_t);
  * Add in absolutes.
  */
 GEN_ABS(env_offset, CONFIG_ENV_OFFSET);
-
-#endif /* ENV_IS_EMBEDDED */
include/common.h +5 -0
index 35f12c0..edfc687 100644
@@ -721,4 +721,9 @@ int cpu_release(int nr, int argc, char *argv[]);
 #define ALIGN(x,a)		__ALIGN_MASK((x),(typeof(x))(a)-1)
 #define __ALIGN_MASK(x,mask)	(((x)+(mask))&~(mask))
 
+/* Pull in stuff for the build system */
+#ifdef DO_DEPS_ONLY
+# include <environment.h>
+#endif
+
 #endif	/* __COMMON_H_ */
tools/Makefile +3 -8
index b5a1e39..603a6c1 100644
@@ -69,13 +69,7 @@ include $(TOPDIR)/config.mk
 BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
 BIN_FILES-y += mkimage$(SFX)
 BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_DATAFLASH) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_EEPROM) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_FLASH) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_ONENAND) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_NAND) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_NVRAM) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_SPI_FLASH) += envcrc$(SFX)
+BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED_CUSTOM) += envcrc$(SFX)
 BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
 BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX)
 BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
@@ -93,7 +87,8 @@ EXT_OBJ_FILES-y += common/image.o
 # Source files located in the tools directory
 OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-y += mkimage.o
-OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
+BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
+BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED_CUSTOM) += envcrc.o
 OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
 OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
tools/envcrc.c +1 -10
index 5b0f7cd..d02a7db 100644
@@ -50,10 +50,6 @@
 # if defined(CONFIG_ENV_ADDR_REDUND) && !defined(CONFIG_ENV_SIZE_REDUND)
 #  define CONFIG_ENV_SIZE_REDUND	CONFIG_ENV_SIZE
 # endif
-# if (CONFIG_ENV_ADDR >= CONFIG_SYS_MONITOR_BASE) && \
-     ((CONFIG_ENV_ADDR + CONFIG_ENV_SIZE) <= (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN))
-#  define ENV_IS_EMBEDDED	1
-# endif
 # if defined(CONFIG_ENV_ADDR_REDUND) || defined(CONFIG_ENV_OFFSET_REDUND)
 #  define CONFIG_SYS_REDUNDAND_ENVIRONMENT	1
 # endif
@@ -70,14 +66,11 @@
 
 extern uint32_t crc32 (uint32_t, const unsigned char *, unsigned int);
 
-#ifdef	ENV_IS_EMBEDDED
 extern unsigned int env_size;
 extern unsigned char environment;
-#endif	/* ENV_IS_EMBEDDED */
 
 int main (int argc, char **argv)
 {
-#ifdef	ENV_IS_EMBEDDED
 	unsigned char pad = 0x00;
 	uint32_t crc;
 	unsigned char *envptr = &environment,
@@ -131,8 +124,6 @@ int main (int argc, char **argv)
 	} else {
 		printf ("0x%08X\n", crc);
 	}
-#else
-	printf ("0\n");
-#endif
+
 	return EXIT_SUCCESS;
 }
Signature · 1 line
1.6.4.2
#3 lore raw

PATCH v2 1/1 env: only build env_embedded and envcrc when needed

Dear Mike Frysinger,

Quoted 8 lines · In message <[email protected]> you wrote:

The env code is protected by the ENV_IS_EMBEDDED define, so attempting to compile the code when this isn't defined is pointless. Now that the env headers have unified around CONFIG_ENV_IS_EMBEDDED, convert the build system to only build the env objects when this is enabled. And now that the env code is conditionally compiled, we can drop the source code checks.

For people who want to extract the environment manually, add a new option that only enables the envcrc utility.

Add a new option...?

I guess this is CONFIG_ENV_IS_EMBEDDED_CUSTOM then?

Hm... but I see no users of this variable, nobody is setting it?

Also, I see no documentation for it?

Best regards,

Wolfgang Denk

Signature · 4 lines
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
Of course there's no reason for it, it's just our policy.
#4 lore raw

PATCH v2 1/1 env: only build env_embedded and envcrc when needed

Quoted 8 lines · On Wednesday 09 September 2009 09:33:20 Wolfgang Denk wrote:
Quoted 7 lines · Mike Frysinger

The env code is protected by the ENV_IS_EMBEDDED define, so attempting to compile the code when this isn't defined is pointless. Now that the env headers have unified around CONFIG_ENV_IS_EMBEDDED, convert the build system to only build the env objects when this is enabled. And now that the env code is conditionally compiled, we can drop the source code checks.

Quoted 8 lines
Quoted 2 lines

For people who want to extract the environment manually, add a new option that only enables the envcrc utility.

Add a new option...?

I guess this is CONFIG_ENV_IS_EMBEDDED_CUSTOM then?

Hm... but I see no users of this variable, nobody is setting it?

Blackfin has been using ENV_IS_EMBEDDED_CUSTOM. i have a patch to update it to CONFIG_xxx, but was waiting for this to be accepted first.

Quoted 1 line

Also, I see no documentation for it?

guessing you want it added to the top level README ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090909/4617c0f5/attachment.pgp

#5 lore raw

PATCH v2 1/1 env: only build env_embedded and envcrc when needed

Dear Mike Frysinger,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines

I guess this is CONFIG_ENV_IS_EMBEDDED_CUSTOM then?

Hm... but I see no users of this variable, nobody is setting it?

Blackfin has been using ENV_IS_EMBEDDED_CUSTOM. i have a patch to update it to CONFIG_xxx, but was waiting for this to be accepted first.

Hm.. normally we don't add code without users...

Quoted 3 lines
Quoted 1 line

Also, I see no documentation for it?

guessing you want it added to the top level README ?

Indeed. What's the name supposed to mean? "The envrionment is embedded custom" sounds strange to me.

Best regards,

Wolfgang Denk

Signature · 6 lines
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
One essential to success is that you desire be an all-obsessing  one,
your thoughts and aims be co-ordinated, and your energy be concentra-
ted and applied without letup.
#6 lore raw

PATCH v2 1/1 env: only build env_embedded and envcrc when needed

Quoted 9 lines · On Wednesday 09 September 2009 10:26:20 Wolfgang Denk wrote:
Quoted 6 lines · Mike Frysinger
Quoted 3 lines

I guess this is CONFIG_ENV_IS_EMBEDDED_CUSTOM then?

Hm... but I see no users of this variable, nobody is setting it?

Blackfin has been using ENV_IS_EMBEDDED_CUSTOM. i have a patch to update it to CONFIG_xxx, but was waiting for this to be accepted first.

Hm.. normally we don't add code without users...

it's already in use, i just need to basically run sed to change it from current name to the new one.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Also, I see no documentation for it?

guessing you want it added to the top level README ?

Indeed. What's the name supposed to mean? "The envrionment is embedded custom" sounds strange to me.

i saw it as "custom embedding of the environment". the only thing it does is enable the envcrc binary. i thought of using "CONFIG_ENVCRC", but it seemed a little too short.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090909/edddbeda/attachment.pgp

#7 lore raw

PATCH v2 1/1 env: only build env_embedded and envcrc when needed

Dear Mike Frysinger,

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Hm.. normally we don't add code without users...

it's already in use, i just need to basically run sed to change it from current name to the new one.

I don't see any users in mainline, though. Or am I missing something?

Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Also, I see no documentation for it?

guessing you want it added to the top level README ?

Indeed. What's the name supposed to mean? "The envrionment is embedded custom" sounds strange to me.

i saw it as "custom embedding of the environment". the only thing it does is enable the envcrc binary. i thought of using "CONFIG_ENVCRC", but it seemed a little too short.

CONFIG_ENABLE_ENVCRC ? CONFIG_BUILD_ENVCRC ?

Best regards,

Wolfgang Denk

Signature · 5 lines
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
To live is always desirable.
	-- Eleen the Capellan, "Friday's Child", stardate 3498.9
#8 lore raw

PATCH v2 1/1 env: only build env_embedded and envcrc when needed

Quoted 5 lines · On Tuesday 15 September 2009 16:44:23 Wolfgang Denk wrote:
Quoted 4 lines · Mike Frysinger
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

Also, I see no documentation for it?

guessing you want it added to the top level README ?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Indeed. What's the name supposed to mean? "The envrionment is embedded custom" sounds strange to me.

i saw it as "custom embedding of the environment". the only thing it does is enable the envcrc binary. i thought of using "CONFIG_ENVCRC", but it seemed a little too short.

CONFIG_ENABLE_ENVCRC ? CONFIG_BUILD_ENVCRC ?

the name doesnt really matter to me. if you're fine with CONFIG_BUILD_ENVCRC, i'll use that in common code and keep the CONFIG_ENV_IS_EMBEDDED_CUSTOM in the Blackfin specific code.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090915/7c6c305b/attachment.pgp

#9 lore raw

PATCH v2 1/1 env: only build env_embedded and envcrc when needed

Dear Mike Frysinger,

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 6 lines
Quoted 4 lines

i saw it as "custom embedding of the environment". the only thing it does is enable the envcrc binary. i thought of using "CONFIG_ENVCRC", but it seemed a little too short.

CONFIG_ENABLE_ENVCRC ? CONFIG_BUILD_ENVCRC ?

the name doesnt really matter to me. if you're fine with CONFIG_BUILD_ENVCRC, i'll use that in common code and keep the CONFIG_ENV_IS_EMBEDDED_CUSTOM in the Blackfin specific code.

CONFIG_BUILD_ENVCRC is fine with me (and I'd rather see if you got rid of this unwieldy CONFIG_ENV_IS_EMBEDDED_CUSTOM thingy).

Best regards,

Wolfgang Denk

Signature · 5 lines
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
Leave bigotry in your quarters; there's no room for it on the bridge.
	-- Kirk, "Balance of Terror", stardate 1709.2
#10 lore raw

PATCH v2 1/1 env: only build env_embedded and envcrc when needed

Quoted 5 lines · On Tuesday 22 September 2009 16:43:14 Wolfgang Denk wrote:
Quoted 4 lines · Mike Frysinger
Quoted 4 lines
Quoted 3 lines

i saw it as "custom embedding of the environment". the only thing it does is enable the envcrc binary. i thought of using "CONFIG_ENVCRC", but it seemed a little too short.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

CONFIG_ENABLE_ENVCRC ? CONFIG_BUILD_ENVCRC ?

the name doesnt really matter to me. if you're fine with CONFIG_BUILD_ENVCRC, i'll use that in common code and keep the CONFIG_ENV_IS_EMBEDDED_CUSTOM in the Blackfin specific code.

CONFIG_BUILD_ENVCRC is fine with me (and I'd rather see if you got rid of this unwieldy CONFIG_ENV_IS_EMBEDDED_CUSTOM thingy).

so i'll have envcrc controlled by CONFIG_BUILD_ENVCRC and i'll control embedding the env in the LDR by CONFIG_EMBEDDED_ENV_IN_LDR.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090923/52a861ca/attachment.pgp

#11 lore raw

PATCH v3 1/2 env: only build env_embedded and envcrc when needed

In reply to Mike Frysinger

The env code is protected by the ENV_IS_EMBEDDED define, so attempting to compile the code when this isn't defined is pointless. Now that the env headers have unified around CONFIG_ENV_IS_EMBEDDED, convert the build system to only build the env objects when this is enabled. And now that the env code is conditionally compiled, we can drop the source code checks.

For people who want to extract the environment manually, add a new option that only enables the envcrc utility (CONFIG_ENV_IS_EMBEDDED_CUSTOM).

---
v3
- add some documentation

 README                |    5 +++++
 common/Makefile       |    5 +----
 common/env_embedded.c |    7 -------
 include/common.h      |    5 +++++
 tools/Makefile        |   11 +++--------
 tools/envcrc.c        |   11 +----------
 6 files changed, 15 insertions(+), 29 deletions(-)
README +5 -0
index ff4ed8b..05cf6b0 100644
@@ -2473,6 +2473,11 @@ to save the current settings.
 	environment. If redundant environment is used, it will be copied to
 	CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE.
 
+- CONFIG_ENV_IS_EMBEDDED_CUSTOM
+
+	Builds up envcrc with the target environment so that external utils
+	may easily extract it and embed it in final U-Boot images.
+
 - CONFIG_SYS_SPI_INIT_OFFSET
 
 	Defines offset to the initial SPI buffer area in DPRAM. The
common/Makefile +1 -4
index 3781738..e3a1591 100644
@@ -49,12 +49,9 @@ COBJS-y += cmd_nvedit.o
 
 # environment
 COBJS-y += env_common.o
+COBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
 COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
-COBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
 COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
common/env_embedded.c +0 -7
index ae6cac4..e27e1cd 100644
@@ -41,11 +41,6 @@
 #endif
 
 /*
- * Generate embedded environment table
- * inside U-Boot image, if needed.
- */
-#if defined(ENV_IS_EMBEDDED)
-/*
  * Only put the environment in it's own section when we are building
  * U-Boot proper.  The host based program "tools/envcrc" does not need
  * a seperate section.  Note that ENV_CRC is only defined when building
@@ -210,5 +205,3 @@ unsigned long env_size __PPCTEXT__ = sizeof(env_t);
  * Add in absolutes.
  */
 GEN_ABS(env_offset, CONFIG_ENV_OFFSET);
-
-#endif /* ENV_IS_EMBEDDED */
include/common.h +5 -0
index 35f12c0..edfc687 100644
@@ -721,4 +721,9 @@ int cpu_release(int nr, int argc, char *argv[]);
 #define ALIGN(x,a)		__ALIGN_MASK((x),(typeof(x))(a)-1)
 #define __ALIGN_MASK(x,mask)	(((x)+(mask))&~(mask))
 
+/* Pull in stuff for the build system */
+#ifdef DO_DEPS_ONLY
+# include <environment.h>
+#endif
+
 #endif	/* __COMMON_H_ */
tools/Makefile +3 -8
index b5a1e39..603a6c1 100644
@@ -69,13 +69,7 @@ include $(TOPDIR)/config.mk
 BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
 BIN_FILES-y += mkimage$(SFX)
 BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_DATAFLASH) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_EEPROM) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_FLASH) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_ONENAND) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_NAND) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_NVRAM) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_SPI_FLASH) += envcrc$(SFX)
+BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED_CUSTOM) += envcrc$(SFX)
 BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
 BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX)
 BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
@@ -93,7 +87,8 @@ EXT_OBJ_FILES-y += common/image.o
 # Source files located in the tools directory
 OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-y += mkimage.o
-OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
+BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
+BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED_CUSTOM) += envcrc.o
 OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
 OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
tools/envcrc.c +1 -10
index 5b0f7cd..d02a7db 100644
@@ -50,10 +50,6 @@
 # if defined(CONFIG_ENV_ADDR_REDUND) && !defined(CONFIG_ENV_SIZE_REDUND)
 #  define CONFIG_ENV_SIZE_REDUND	CONFIG_ENV_SIZE
 # endif
-# if (CONFIG_ENV_ADDR >= CONFIG_SYS_MONITOR_BASE) && \
-     ((CONFIG_ENV_ADDR + CONFIG_ENV_SIZE) <= (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN))
-#  define ENV_IS_EMBEDDED	1
-# endif
 # if defined(CONFIG_ENV_ADDR_REDUND) || defined(CONFIG_ENV_OFFSET_REDUND)
 #  define CONFIG_SYS_REDUNDAND_ENVIRONMENT	1
 # endif
@@ -70,14 +66,11 @@
 
 extern uint32_t crc32 (uint32_t, const unsigned char *, unsigned int);
 
-#ifdef	ENV_IS_EMBEDDED
 extern unsigned int env_size;
 extern unsigned char environment;
-#endif	/* ENV_IS_EMBEDDED */
 
 int main (int argc, char **argv)
 {
-#ifdef	ENV_IS_EMBEDDED
 	unsigned char pad = 0x00;
 	uint32_t crc;
 	unsigned char *envptr = &environment,
@@ -131,8 +124,6 @@ int main (int argc, char **argv)
 	} else {
 		printf ("0x%08X\n", crc);
 	}
-#else
-	printf ("0\n");
-#endif
+
 	return EXIT_SUCCESS;
 }
Signature · 1 line
1.6.4.2
#12 lore raw

PATCH v3 1/2 env: only build env_embedded and envcrc when needed

Dear Mike Frysinger,

Quoted 8 lines · In message <[email protected]> you wrote:

The env code is protected by the ENV_IS_EMBEDDED define, so attempting to compile the code when this isn't defined is pointless. Now that the env headers have unified around CONFIG_ENV_IS_EMBEDDED, convert the build system to only build the env objects when this is enabled. And now that the env code is conditionally compiled, we can drop the source code checks.

For people who want to extract the environment manually, add a new option that only enables the envcrc utility (CONFIG_ENV_IS_EMBEDDED_CUSTOM).

I see no users, and I hesitate to add dead code.

And CONFIG_ENV_IS_EMBEDDED_CUSTOM is an ugly and misleading name.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
All a hacker needs is a tight PUSHJ, a loose pair of UUOs, and a warm
place to shift.
#13 lore raw

PATCH 2/2 Blackfin: tweak embedded env config option

In reply to Mike Frysinger

Use the common config option for extracting the environment for embedding into LDR files.

---
 include/configs/bf518f-ezbrd.h   |    2 +-
 include/configs/bf526-ezbrd.h    |    2 +-
 include/configs/bf527-ezkit.h    |    2 +-
 include/configs/bf533-stamp.h    |    2 +-
 include/configs/bf537-minotaur.h |    2 +-
 include/configs/bf537-pnav.h     |    2 +-
 include/configs/bf537-srv1.h     |    2 +-
 include/configs/bf537-stamp.h    |    2 +-
 include/configs/bf538f-ezkit.h   |    2 +-
 include/configs/bf548-ezkit.h    |    4 ++--
 include/configs/bf561-ezkit.h    |    2 +-
 include/configs/cm-bf527.h       |    2 +-
 include/configs/cm-bf537e.h      |    2 +-
 include/configs/cm-bf537u.h      |    2 +-
 include/configs/cm-bf548.h       |    2 +-
 include/configs/ibf-dsp561.h     |    2 +-
 include/configs/tcm-bf537.h      |    2 +-
 lib_blackfin/config.mk           |    5 ++---
 18 files changed, 20 insertions(+), 21 deletions(-)
include/configs/bf518f-ezbrd.h +1 -1
index 3db8171..8c97ee4 100644
@@ -109,7 +109,7 @@
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x2000
 #endif
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/bf526-ezbrd.h +1 -1
index 97853af..866e15a 100644
@@ -126,7 +126,7 @@
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x2000
 #endif
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/bf527-ezkit.h +1 -1
index 0d02354..fdada41 100644
@@ -125,7 +125,7 @@
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x2000
 #endif
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/bf533-stamp.h +1 -1
index 4be2a5c..33f3264 100644
@@ -115,7 +115,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/bf537-minotaur.h +1 -1
index 463b7d0..0beae4b 100644
@@ -115,7 +115,7 @@
 #define CONFIG_ENV_OFFSET	0x10000
 #define CONFIG_ENV_SIZE		0x10000
 #define CONFIG_ENV_SECT_SIZE	0x10000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/bf537-pnav.h +1 -1
index 0f908ef..bdf8b22 100644
@@ -94,7 +94,7 @@
  * Env Storage Settings
  */
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #define CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_ENV_OFFSET	0x4000
 #else
include/configs/bf537-srv1.h +1 -1
index 7368629..f82753a 100644
@@ -115,7 +115,7 @@
 #define CONFIG_ENV_OFFSET	0x10000
 #define CONFIG_ENV_SIZE		0x10000
 #define CONFIG_ENV_SECT_SIZE	0x10000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/bf537-stamp.h +1 -1
index 74b9ecd..aedd230 100644
@@ -113,7 +113,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/bf538f-ezkit.h +1 -1
index 535687f..fbda43c 100644
@@ -109,7 +109,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/bf548-ezkit.h +2 -2
index 5b9de16..16d7af2 100644
@@ -107,7 +107,7 @@
 #define CONFIG_ENV_OFFSET	0x10000
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x10000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #elif (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_NAND)
 #define CONFIG_ENV_IS_IN_NAND
 #define CONFIG_ENV_OFFSET	0x40000
@@ -118,7 +118,7 @@
 #define CONFIG_ENV_OFFSET	0x2000
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	(128 * 1024)
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 
 
include/configs/bf561-ezkit.h +1 -1
index 4779a97..fe27a54 100644
@@ -86,7 +86,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/cm-bf527.h +1 -1
index 1592719..c60e876 100644
@@ -106,7 +106,7 @@
 #define CONFIG_ENV_OFFSET	0x8000
 #define CONFIG_ENV_SIZE		0x8000
 #define CONFIG_ENV_SECT_SIZE	0x20000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/cm-bf537e.h +1 -1
index 34d4299..62db60e 100644
@@ -92,7 +92,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/cm-bf537u.h +1 -1
index d1870a8..590511b 100644
@@ -96,7 +96,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/cm-bf548.h +1 -1
index b5cfc21..b1a0cd8 100644
@@ -96,7 +96,7 @@
 #define CONFIG_ENV_ADDR		0x20008000
 #define CONFIG_ENV_OFFSET	0x8000
 #define CONFIG_ENV_SIZE		0x8000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/ibf-dsp561.h +1 -1
index 066859f..05cdbc2 100644
@@ -75,7 +75,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/tcm-bf537.h +1 -1
index 9794e1b..8e97db0 100644
@@ -93,7 +93,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
lib_blackfin/config.mk +2 -3
index ce2fe67..3f560c9 100644
@@ -53,9 +53,8 @@ LDR_FLAGS += --bmode $(subst BFIN_BOOT_,,$(CONFIG_BFIN_BOOT_MODE))
 LDR_FLAGS += --use-vmas
 LDR_FLAGS += --initcode $(obj)cpu/$(CPU)/initcode.o
 ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_UART)
-ifneq ($(ENV_IS_EMBEDDED_CUSTOM),ENV_IS_EMBEDDED_CUSTOM)
-LDR_FLAGS += --punchit $$(($(CONFIG_ENV_OFFSET))):$$(($(CONFIG_ENV_SIZE))):$(obj)env-ldr.o
-endif
+LDR_FLAGS-$(CONFIG_ENV_IS_EMBEDDED_CUSTOM) += \
+	--punchit $$(($(CONFIG_ENV_OFFSET))):$$(($(CONFIG_ENV_SIZE))):$(obj)env-ldr.o
 endif
 ifneq (,$(findstring s,$(MAKEFLAGS)))
 LDR_FLAGS += --quiet
Signature · 1 line
1.6.4.2
#14 lore raw

PATCH v2 2/2 Blackfin: tweak embedded env config option

Use the common config option for extracting the environment for embedding into LDR files.

---
v2
- do not call envcrc in ldr target if env isnt embedded

 Makefile                         |    2 +-
 include/configs/bf518f-ezbrd.h   |    2 +-
 include/configs/bf526-ezbrd.h    |    2 +-
 include/configs/bf527-ezkit.h    |    2 +-
 include/configs/bf533-stamp.h    |    2 +-
 include/configs/bf537-minotaur.h |    2 +-
 include/configs/bf537-pnav.h     |    2 +-
 include/configs/bf537-srv1.h     |    2 +-
 include/configs/bf537-stamp.h    |    2 +-
 include/configs/bf538f-ezkit.h   |    2 +-
 include/configs/bf548-ezkit.h    |    4 ++--
 include/configs/bf561-ezkit.h    |    2 +-
 include/configs/cm-bf527.h       |    2 +-
 include/configs/cm-bf537e.h      |    2 +-
 include/configs/cm-bf537u.h      |    2 +-
 include/configs/cm-bf548.h       |    2 +-
 include/configs/ibf-dsp561.h     |    2 +-
 include/configs/tcm-bf537.h      |    2 +-
 lib_blackfin/config.mk           |   10 +++++++---
 19 files changed, 26 insertions(+), 22 deletions(-)
Makefile +1 -1
index 0449a5b..046a22f 100644
@@ -308,7 +308,7 @@ $(obj)u-boot.bin:	$(obj)u-boot
 		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
 
 $(obj)u-boot.ldr:	$(obj)u-boot
-		$(obj)tools/envcrc --binary > $(obj)env-ldr.o
+		$(CREATE_LDR_ENV)
 		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
 
 $(obj)u-boot.ldr.hex:	$(obj)u-boot.ldr
include/configs/bf518f-ezbrd.h +1 -1
index 3db8171..8c97ee4 100644
@@ -109,7 +109,7 @@
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x2000
 #endif
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/bf526-ezbrd.h +1 -1
index 97853af..866e15a 100644
@@ -126,7 +126,7 @@
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x2000
 #endif
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/bf527-ezkit.h +1 -1
index 0d02354..fdada41 100644
@@ -125,7 +125,7 @@
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x2000
 #endif
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/bf533-stamp.h +1 -1
index 4be2a5c..33f3264 100644
@@ -115,7 +115,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/bf537-minotaur.h +1 -1
index 463b7d0..0beae4b 100644
@@ -115,7 +115,7 @@
 #define CONFIG_ENV_OFFSET	0x10000
 #define CONFIG_ENV_SIZE		0x10000
 #define CONFIG_ENV_SECT_SIZE	0x10000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/bf537-pnav.h +1 -1
index 0f908ef..bdf8b22 100644
@@ -94,7 +94,7 @@
  * Env Storage Settings
  */
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #define CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_ENV_OFFSET	0x4000
 #else
include/configs/bf537-srv1.h +1 -1
index 7368629..f82753a 100644
@@ -115,7 +115,7 @@
 #define CONFIG_ENV_OFFSET	0x10000
 #define CONFIG_ENV_SIZE		0x10000
 #define CONFIG_ENV_SECT_SIZE	0x10000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/bf537-stamp.h +1 -1
index 74b9ecd..aedd230 100644
@@ -113,7 +113,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/bf538f-ezkit.h +1 -1
index 535687f..fbda43c 100644
@@ -109,7 +109,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/bf548-ezkit.h +2 -2
index 5b9de16..16d7af2 100644
@@ -107,7 +107,7 @@
 #define CONFIG_ENV_OFFSET	0x10000
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x10000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #elif (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_NAND)
 #define CONFIG_ENV_IS_IN_NAND
 #define CONFIG_ENV_OFFSET	0x40000
@@ -118,7 +118,7 @@
 #define CONFIG_ENV_OFFSET	0x2000
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	(128 * 1024)
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 
 
include/configs/bf561-ezkit.h +1 -1
index 4779a97..fe27a54 100644
@@ -86,7 +86,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/cm-bf527.h +1 -1
index 1592719..c60e876 100644
@@ -106,7 +106,7 @@
 #define CONFIG_ENV_OFFSET	0x8000
 #define CONFIG_ENV_SIZE		0x8000
 #define CONFIG_ENV_SECT_SIZE	0x20000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/cm-bf537e.h +1 -1
index 34d4299..62db60e 100644
@@ -92,7 +92,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/cm-bf537u.h +1 -1
index d1870a8..590511b 100644
@@ -96,7 +96,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/cm-bf548.h +1 -1
index b5cfc21..b1a0cd8 100644
@@ -96,7 +96,7 @@
 #define CONFIG_ENV_ADDR		0x20008000
 #define CONFIG_ENV_OFFSET	0x8000
 #define CONFIG_ENV_SIZE		0x8000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 
 
 /*
include/configs/ibf-dsp561.h +1 -1
index 066859f..05cdbc2 100644
@@ -75,7 +75,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/tcm-bf537.h +1 -1
index 9794e1b..8e97db0 100644
@@ -93,7 +93,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_CUSTOM
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
lib_blackfin/config.mk +7 -3
index ce2fe67..b455211 100644
@@ -43,6 +43,11 @@ endif
 ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
 ALL += $(obj)u-boot.ldr
 endif
+ifeq ($(CONFIG_ENV_IS_EMBEDDED_CUSTOM),y)
+CREATE_LDR_ENV = $(obj)tools/envcrc --binary > $(obj)env-ldr.o
+else
+CREATE_LDR_ENV =
+endif
 
 SYM_PREFIX = _
 
@@ -53,9 +58,8 @@ LDR_FLAGS += --bmode $(subst BFIN_BOOT_,,$(CONFIG_BFIN_BOOT_MODE))
 LDR_FLAGS += --use-vmas
 LDR_FLAGS += --initcode $(obj)cpu/$(CPU)/initcode.o
 ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_UART)
-ifneq ($(ENV_IS_EMBEDDED_CUSTOM),ENV_IS_EMBEDDED_CUSTOM)
-LDR_FLAGS += --punchit $$(($(CONFIG_ENV_OFFSET))):$$(($(CONFIG_ENV_SIZE))):$(obj)env-ldr.o
-endif
+LDR_FLAGS-$(CONFIG_ENV_IS_EMBEDDED_CUSTOM) += \
+	--punchit $$(($(CONFIG_ENV_OFFSET))):$$(($(CONFIG_ENV_SIZE))):$(obj)env-ldr.o
 endif
 ifneq (,$(findstring s,$(MAKEFLAGS)))
 LDR_FLAGS += --quiet
Signature · 1 line
1.6.4.2
#15 lore raw

PATCH v2 2/2 Blackfin: tweak embedded env config option

Dear Mike Frysinger,

Quoted 2 lines · In message <[email protected]> you wrote:

Use the common config option for extracting the environment for embedding into LDR files.

...

Makefile $(obj)u-boot.bin: $(obj)u-boot · line 312

Quoted 4 lines

$(obj)u-boot.ldr: $(obj)u-boot

Makefile +1 -1
-		$(obj)tools/envcrc --binary > $(obj)env-ldr.o
+		$(CREATE_LDR_ENV)
 		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)

This is all BF specific stuff, right? Maybe we should move this into some BF Makefile, then, instead of adding more and more references to magic variables that have no meaning anywhere except for BF.

Best regards,

Wolfgang Denk

Signature · 6 lines
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: [email protected]
Q:  How do you play religious roulette?
A:  You stand around in a circle  and  blaspheme  and  see  who  gets
    struck by lightning first.
#16 lore raw

PATCH v2 2/2 Blackfin: tweak embedded env config option

Quoted 4 lines · On Tuesday 15 September 2009 16:49:42 Wolfgang Denk wrote:
Quoted 2 lines · Mike Frysinger

Use the common config option for extracting the environment for embedding into LDR files.

...

Quoted 8 lines

Makefile $(obj)u-boot.bin: $(obj)u-boot · line 312

Quoted 4 lines

$(obj)u-boot.ldr: $(obj)u-boot

Makefile +1 -1
-		$(obj)tools/envcrc --binary > $(obj)env-ldr.o
+		$(CREATE_LDR_ENV)
 		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)

This is all BF specific stuff, right? Maybe we should move this into some BF Makefile, then, instead of adding more and more references to magic variables that have no meaning anywhere except for BF.

if you're talking about the %.ldr target, then yes, it is only for Blackfin systems. it isnt the only target-specific top level which is why it's there now, but that doesnt mean it has to stay there (as well as the other cruft). ive already looked at moving this to the Blackfin specific config.mk, but it would require adding dummy "all" targets early on in the top level Makefile and one or two subdir Makefiles. i didnt feel like dealing with people complaining about this. although if we created a new lib_$(ARCH)/targets.mk, we could push all arch-specific crap there (like all the boards config targets), and only the top level Makefile would include it.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090915/c4fb5036/attachment.pgp

#17 lore raw

PATCH v2 2/2 Blackfin: tweak embedded env config option

Dear Mike Frysinger,

Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 10 lines

...

Makefile $(obj)u-boot.bin: $(obj)u-boot · line 312

Quoted 4 lines

$(obj)u-boot.ldr: $(obj)u-boot

Makefile +1 -1
-		$(obj)tools/envcrc --binary > $(obj)env-ldr.o
+		$(CREATE_LDR_ENV)
 		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)

This is all BF specific stuff, right? Maybe we should move this into some BF Makefile, then, instead of adding more and more references to magic variables that have no meaning anywhere except for BF.

Quoted 9 lines

if you're talking about the %.ldr target, then yes, it is only for Blackfin systems. it isnt the only target-specific top level which is why it's there now, but that doesnt mean it has to stay there (as well as the other cruft). ive already looked at moving this to the Blackfin specific config.mk, but it would require adding dummy "all" targets early on in the top level Makefile and one or two subdir Makefiles. i didnt feel like dealing with people complaining about this. although if we created a new lib_$(ARCH)/targets.mk, we could push all arch-specific crap there (like all the boards config targets), and only the top level Makefile would include it.

I'm not asking for a general Makefile rework. But maybe we can move this code to some BF Makefile?

Best regards,

Wolfgang Denk

Signature · 5 lines
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 child is a person who can't understand why someone would give away
a perfectly good kitten."                               - Doug Larson
#18 lore raw

PATCH v2 2/2 Blackfin: tweak embedded env config option

Quoted 23 lines · On Tuesday 22 September 2009 16:41:45 Wolfgang Denk wrote:
Quoted 11 lines · Mike Frysinger
Quoted 10 lines

...

Makefile $(obj)u-boot.bin: $(obj)u-boot · line 312

Quoted 4 lines

$(obj)u-boot.ldr: $(obj)u-boot

Makefile +1 -1
-		$(obj)tools/envcrc --binary > $(obj)env-ldr.o
+		$(CREATE_LDR_ENV)
 		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)

This is all BF specific stuff, right? Maybe we should move this into some BF Makefile, then, instead of adding more and more references to magic variables that have no meaning anywhere except for BF.

Quoted 10 lines

if you're talking about the %.ldr target, then yes, it is only for Blackfin systems. it isnt the only target-specific top level which is why it's there now, but that doesnt mean it has to stay there (as well as the other cruft). ive already looked at moving this to the Blackfin specific config.mk, but it would require adding dummy "all" targets early on in the top level Makefile and one or two subdir Makefiles. i didnt feel like dealing with people complaining about this. although if we created a new lib_$(ARCH)/targets.mk, we could push all arch-specific crap there (like all the boards config targets), and only the top level Makefile would include it.

Quoted 2 lines

I'm not asking for a general Makefile rework. But maybe we can move this code to some BF Makefile?

well if i'm going to do it for the Blackfin arch, i might as well generalize it and do it the right way the first time ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090923/e57c8ecd/attachment.pgp

#19 lore raw

PATCH v2 2/2 Blackfin: tweak embedded env config option

In reply to Wolfgang Denk
Quoted 11 lines · On Tuesday 15 September 2009 16:49:42 Wolfgang Denk wrote:

Review

Quoted 6 lines · Mike Frysinger

Use the common config option for extracting the environment for embedding into LDR files.
$(obj)u-boot.ldr: $(obj)u-boot

(quoted diff) +1 -1
-		$(obj)tools/envcrc --binary > $(obj)env-ldr.o
+		$(CREATE_LDR_ENV)
 		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)

This is all BF specific stuff, right? Maybe we should move this into some BF Makefile, then, instead of adding more and more references to magic variables that have no meaning anywhere except for BF.

here's what i'm thinking (it wont apply to mainline, so it's just an idea). from what i can see, there shouldnt be *anything* related to Blackfin left in the top level files now (except for MAKEALL, but that's another day). -mike

Makefile +3 -19
index 40cca2e..61210e8 100644
@@ -305,16 +305,6 @@ $(obj)u-boot.srec:	$(obj)u-boot
 $(obj)u-boot.bin:	$(obj)u-boot
 		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
 
-$(obj)u-boot.ldr:	$(obj)u-boot
-		$(CREATE_LDR_ENV)
-		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
-
-$(obj)u-boot.ldr.hex:	$(obj)u-boot.ldr
-		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@ -I binary
-
-$(obj)u-boot.ldr.srec:	$(obj)u-boot.ldr
-		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@ -I binary
-
 $(obj)u-boot.img:	$(obj)u-boot.bin
 		./tools/mkimage -A $(ARCH) -T firmware -C none \
 		-a $(TEXT_BASE) -e 0 \
@@ -482,6 +472,9 @@ dep tags ctags etags cscope $(obj)System.map:
 	@ exit 1
 endif	# config.mk
 
+# Pull in architecture-specific top level targets
+sinclude $(TOPDIR)/lib_*/targets.mk
+
 .PHONY : CHANGELOG
 CHANGELOG:
 	git log --no-merges U-Boot-1_1_5.. | \
@@ -3487,30 +3480,6 @@ suzaku_config:	unconfig
 	@$(MKCONFIG) -a $(@:_config=) microblaze microblaze suzaku AtmarkTechno
 
 #========================================================================
-# Blackfin
-#========================================================================
-
-# Analog Devices boards
-BFIN_BOARDS = bf518f-ezbrd bf526-ezbrd bf527-ezkit bf533-ezkit bf533-stamp \
-	bf537-pnav bf537-stamp bf538f-ezkit bf548-ezkit bf561-ezkit
-
-# Bluetechnix tinyboards
-BFIN_BOARDS += cm-bf527 cm-bf533 cm-bf537e cm-bf537u cm-bf548 cm-bf561 tcm-

bf537
-
-# Misc third party boards
-BFIN_BOARDS += bf537-minotaur bf537-srv1 blackstamp -
-# I-SYST Micromodule
-BFIN_BOARDS += ibf-dsp561
-
-$(BFIN_BOARDS:%=%_config) : unconfig
- @$(MKCONFIG) $(@:_config=) blackfin blackfin $(@:_config=)
-
-$(BFIN_BOARDS):
- $(MAKE) $@_config
- $(MAKE)
-
-#========================================================================
# AVR32
#========================================================================

@@ -3681,9 +3650,8 @@ clean:
$(obj)board/netstar/{eeprom,crcek,crcit,*.srec,*.bin} \
$(obj)board/trab/trab_fkt $(obj)board/voiceblue/eeprom \
$(obj)board/armltd/{integratorap,integratorcp}/u-boot.lds \

-	       $(obj)lib_blackfin/u-boot.lds				  \
-	       $(obj)u-boot.lds						  \
-	       $(obj)cpu/blackfin/bootrom-asm-offsets.[chs]
+	       $(obj)u-boot.lds

+ @rm -f $(EXTRA_CLEAN_TARGETS)
@rm -f $(obj)include/bmp_logo.h
@rm -f $(obj)nand_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,System.map} @rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl-2k.bin,ipl-4k.bin,ipl.map}

lib_blackfin/config.mk +0 -5
index 323d28f..ff6f45b 100644
@@ -43,11 +43,6 @@ endif
 ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
 ALL += $(obj)u-boot.ldr
 endif
-ifeq ($(CONFIG_ENV_IS_EMBEDDED_IN_LDR),y)
-CREATE_LDR_ENV = $(obj)tools/envcrc --binary > $(obj)env-ldr.o
-else
-CREATE_LDR_ENV =
-endif
 
 SYM_PREFIX = _
 
lib_blackfin/targets.mk new file +70 -0

70 lines not on this page · raw message

#20 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

In reply to Mike Frysinger

The env code is protected by the ENV_IS_EMBEDDED define, so attempting to compile the code when this isn't defined is pointless. Now that the env headers have unified around CONFIG_ENV_IS_EMBEDDED, convert the build system to only build the env objects when this is enabled. And now that the env code is conditionally compiled, we can drop the source code checks.

For people who want to extract the environment manually, add a new option CONFIG_BUILD_ENVCRC that only enables the envcrc utility.

---
v4
- rename config option to CONFIG_BUILD_ENVCRC

 README                |    5 +++++
 common/Makefile       |    3 ---
 common/env_embedded.c |    7 -------
 include/common.h      |    5 +++++
 tools/Makefile        |    9 ++-------
 tools/envcrc.c        |   11 +----------
 6 files changed, 13 insertions(+), 27 deletions(-)
README +5 -0
index dee0e67..744f6bf 100644
@@ -2305,6 +2305,11 @@ The following definitions that deal with the placement and management
 of environment data (variable area); in general, we support the
 following configurations:
 
+- CONFIG_BUILD_ENVCRC:
+
+	Builds up envcrc with the target environment so that external utils
+	may easily extract it and embed it in final U-Boot images.
+
 - CONFIG_ENV_IS_IN_FLASH:
 
 	Define this if the environment is in flash memory.
common/Makefile +0 -3
index 3781738..a92a75f 100644
@@ -52,9 +52,6 @@ COBJS-y += env_common.o
 COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
 COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
 COBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
-COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
 COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
 COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
 COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
common/env_embedded.c +0 -7
index ae6cac4..e27e1cd 100644
@@ -41,11 +41,6 @@
 #endif
 
 /*
- * Generate embedded environment table
- * inside U-Boot image, if needed.
- */
-#if defined(ENV_IS_EMBEDDED)
-/*
  * Only put the environment in it's own section when we are building
  * U-Boot proper.  The host based program "tools/envcrc" does not need
  * a seperate section.  Note that ENV_CRC is only defined when building
@@ -210,5 +205,3 @@ unsigned long env_size __PPCTEXT__ = sizeof(env_t);
  * Add in absolutes.
  */
 GEN_ABS(env_offset, CONFIG_ENV_OFFSET);
-
-#endif /* ENV_IS_EMBEDDED */
include/common.h +5 -0
index f7c93bf..7df9afa 100644
@@ -719,4 +719,9 @@ int cpu_release(int nr, int argc, char *argv[]);
 #define ALIGN(x,a)		__ALIGN_MASK((x),(typeof(x))(a)-1)
 #define __ALIGN_MASK(x,mask)	(((x)+(mask))&~(mask))
 
+/* Pull in stuff for the build system */
+#ifdef DO_DEPS_ONLY
+# include <environment.h>
+#endif
+
 #endif	/* __COMMON_H_ */
tools/Makefile +2 -7
index b04e3f3..2a9a9fd 100644
@@ -69,13 +69,7 @@ include $(TOPDIR)/config.mk
 BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
 BIN_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX)
 BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_DATAFLASH) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_EEPROM) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_FLASH) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_ONENAND) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_NAND) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_NVRAM) += envcrc$(SFX)
-BIN_FILES-$(CONFIG_ENV_IS_IN_SPI_FLASH) += envcrc$(SFX)
+BIN_FILES-$(CONFIG_BUILD_ENVCRC) += envcrc$(SFX)
 BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX)
 BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
 BIN_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes$(SFX)
@@ -95,6 +89,7 @@ OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
 OBJ_FILES-y += default_image.o
 OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
+OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += envcrc.o
 OBJ_FILES-y += fit_image.o
 OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
tools/envcrc.c +1 -10
index 5b0f7cd..d02a7db 100644
@@ -50,10 +50,6 @@
 # if defined(CONFIG_ENV_ADDR_REDUND) && !defined(CONFIG_ENV_SIZE_REDUND)
 #  define CONFIG_ENV_SIZE_REDUND	CONFIG_ENV_SIZE
 # endif
-# if (CONFIG_ENV_ADDR >= CONFIG_SYS_MONITOR_BASE) && \
-     ((CONFIG_ENV_ADDR + CONFIG_ENV_SIZE) <= (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN))
-#  define ENV_IS_EMBEDDED	1
-# endif
 # if defined(CONFIG_ENV_ADDR_REDUND) || defined(CONFIG_ENV_OFFSET_REDUND)
 #  define CONFIG_SYS_REDUNDAND_ENVIRONMENT	1
 # endif
@@ -70,14 +66,11 @@
 
 extern uint32_t crc32 (uint32_t, const unsigned char *, unsigned int);
 
-#ifdef	ENV_IS_EMBEDDED
 extern unsigned int env_size;
 extern unsigned char environment;
-#endif	/* ENV_IS_EMBEDDED */
 
 int main (int argc, char **argv)
 {
-#ifdef	ENV_IS_EMBEDDED
 	unsigned char pad = 0x00;
 	uint32_t crc;
 	unsigned char *envptr = &environment,
@@ -131,8 +124,6 @@ int main (int argc, char **argv)
 	} else {
 		printf ("0x%08X\n", crc);
 	}
-#else
-	printf ("0\n");
-#endif
+
 	return EXIT_SUCCESS;
 }
Signature · 1 line
1.6.5.rc2
#21 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Dear Mike Frysinger,

Quoted 14 lines · In message <[email protected]> you wrote:

The env code is protected by the ENV_IS_EMBEDDED define, so attempting to compile the code when this isn't defined is pointless. Now that the env headers have unified around CONFIG_ENV_IS_EMBEDDED, convert the build system to only build the env objects when this is enabled. And now that the env code is conditionally compiled, we can drop the source code checks.

For people who want to extract the environment manually, add a new option CONFIG_BUILD_ENVCRC that only enables the envcrc utility.

---
v4
- rename config option to CONFIG_BUILD_ENVCRC

Quoted 7 lines
 README                |    5 +++++
 common/Makefile       |    3 ---
 common/env_embedded.c |    7 -------
 include/common.h      |    5 +++++
 tools/Makefile        |    9 ++-------
 tools/envcrc.c        |   11 +----------
 6 files changed, 13 insertions(+), 27 deletions(-)

Applied, thanks.

[My understanding is that patch 2/2 will go through your BF repo now, right?]

Best regards,

Wolfgang Denk

Signature · 4 lines
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
 The software required `Windows 95 or better', so I installed Linux.
#22 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Quoted 24 lines · On Sunday 18 October 2009 16:53:54 Wolfgang Denk wrote:
Quoted 15 lines · Mike Frysinger

The env code is protected by the ENV_IS_EMBEDDED define, so attempting to compile the code when this isn't defined is pointless. Now that the env headers have unified around CONFIG_ENV_IS_EMBEDDED, convert the build system to only build the env objects when this is enabled. And now that the env code is conditionally compiled, we can drop the source code checks.

For people who want to extract the environment manually, add a new option CONFIG_BUILD_ENVCRC that only enables the envcrc utility.

---
v4
- rename config option to CONFIG_BUILD_ENVCRC

Quoted 7 lines
 README                |    5 +++++
 common/Makefile       |    3 ---
 common/env_embedded.c |    7 -------
 include/common.h      |    5 +++++
 tools/Makefile        |    9 ++-------
 tools/envcrc.c        |   11 +----------
 6 files changed, 13 insertions(+), 27 deletions(-)
Quoted 4 lines

Applied, thanks.

[My understanding is that patch 2/2 will go through your BF repo now, right?]

i can do that since it's already in my vendor branch
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091018/ee0e5118/attachment.pgp

#23 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Dear Mike Frysinger,

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 3 lines

[My understanding is that patch 2/2 will go through your BF repo now, right?]

i can do that since it's already in my vendor branch

Thanks.

Best regards,

Wolfgang Denk

Signature · 7 lines
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
Die meisten Menschen pflegen im Kindesalter vom Zeigen auf Gegenst?n-
de (Mausbewegung) und "ga" sagen  (Mausklick)  abzukommen,  zugunsten
eines  m?chtigeren  und langwierig zu erlernenden Tools (Sprache).
                             -- Achim Linder in de.comp.os.linux.misc
#24 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

In reply to Mike Frysinger

Dear Mike Frysinger,

Quoted 25 lines · In message <[email protected]> you wrote:
Quoted 25 lines
Quoted 22 lines · Mike Frysinger

The env code is protected by the ENV_IS_EMBEDDED define, so attempting to compile the code when this isn't defined is pointless. Now that the env headers have unified around CONFIG_ENV_IS_EMBEDDED, convert the build system to only build the env objects when this is enabled. And now that the env code is conditionally compiled, we can drop the source code checks.

For people who want to extract the environment manually, add a new option CONFIG_BUILD_ENVCRC that only enables the envcrc utility.

---
v4
- rename config option to CONFIG_BUILD_ENVCRC

 README                |    5 +++++
 common/Makefile       |    3 ---
 common/env_embedded.c |    7 -------
 include/common.h      |    5 +++++
 tools/Makefile        |    9 ++-------
 tools/envcrc.c        |   11 +----------
 6 files changed, 13 insertions(+), 27 deletions(-)
Quoted 1 line
Quoted 1 line

Applied, thanks.

Arghhh...

This patch seems to break a *lot* of boards:

...
Configuring for mgsuvd board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for MHPC board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for MPC86xADS board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for MPC885ADS board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for NETPHONE board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for NETTA board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for NETTA2 board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for NETTA board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file ... Version 1
Configuring for NETVIA board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file ... Version 2
Configuring for NETVIA board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for NX823 board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for pcu_e board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for QS823 board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for QS850 board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for QS860T board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for quantum board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file Configuring for R360MPI board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1
ppc_6xx-size: '/work/wd/tmp-ppc/u-boot': No such file
...

etc. etc.

Please fix, or should I rather revert the commit?

Best regards,

Wolfgang Denk

Signature · 4 lines
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
The faster I go, the behinder I get.                 -- Lewis Carroll
#25 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Quoted 31 lines · On Sunday 18 October 2009 17:32:15 Wolfgang Denk wrote:
Quoted 24 lines · Mike Frysinger
Quoted 24 lines
Quoted 22 lines · Mike Frysinger

The env code is protected by the ENV_IS_EMBEDDED define, so attempting to compile the code when this isn't defined is pointless. Now that the env headers have unified around CONFIG_ENV_IS_EMBEDDED, convert the build system to only build the env objects when this is enabled. And now that the env code is conditionally compiled, we can drop the source code checks.

For people who want to extract the environment manually, add a new option CONFIG_BUILD_ENVCRC that only enables the envcrc utility.

---
v4
- rename config option to CONFIG_BUILD_ENVCRC

 README                |    5 +++++
 common/Makefile       |    3 ---
 common/env_embedded.c |    7 -------
 include/common.h      |    5 +++++
 tools/Makefile        |    9 ++-------
 tools/envcrc.c        |   11 +----------
 6 files changed, 13 insertions(+), 27 deletions(-)
Quoted 1 line
Quoted 1 line

Applied, thanks.

Arghhh...

This patch seems to break a *lot* of boards:

Quoted 8 lines

...
Configuring for mgsuvd board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1

etc. etc.

Please fix, or should I rather revert the commit?

i'd prefer to fix. my guess is these boards link in the .o all the time even when they dont have an embedded environment (which isnt a big deal -- the file would be 0 bytes in that case).

where can i get this "ppc_6xx" compiler ?
-mike

#26 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Dear Mike Frysinger,

Quoted 6 lines · In message <[email protected]> you wrote:

i'd prefer to fix. my guess is these boards link in the .o all the time even when they dont have an embedded environment (which isnt a big deal -- the file would be 0 bytes in that case).

where can i get this "ppc_6xx" compiler ?

ELDK 4.2 for Power. I guess you can use any other tool chain for ppc as well.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
"Everything should be made as simple as possible, but not simpler."
                                                    - Albert Einstein
#27 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

In reply to Wolfgang Denk
Quoted 25 lines · On Sunday 18 October 2009 17:32:15 Wolfgang Denk wrote:
Quoted 24 lines · Mike Frysinger
Quoted 24 lines
Quoted 22 lines · Mike Frysinger

The env code is protected by the ENV_IS_EMBEDDED define, so attempting to compile the code when this isn't defined is pointless. Now that the env headers have unified around CONFIG_ENV_IS_EMBEDDED, convert the build system to only build the env objects when this is enabled. And now that the env code is conditionally compiled, we can drop the source code checks.

For people who want to extract the environment manually, add a new option CONFIG_BUILD_ENVCRC that only enables the envcrc utility.

---
v4
- rename config option to CONFIG_BUILD_ENVCRC

 README                |    5 +++++
 common/Makefile       |    3 ---
 common/env_embedded.c |    7 -------
 include/common.h      |    5 +++++
 tools/Makefile        |    9 ++-------
 tools/envcrc.c        |   11 +----------
 6 files changed, 13 insertions(+), 27 deletions(-)
Quoted 5 lines
Quoted 1 line
Quoted 1 line

Applied, thanks.

Arghhh...

This patch seems to break a *lot* of boards:

i'm attaching two patches here. since we're past the merge window but before rc1, i dont know how invasive you want to get.

the first one restores env_embedded.o building for certain config options (even though it'll only produce a 0 byte file). if you want to be cautious for this release, then i guess we can merge just this patch.

the second one attempts to clean up env_embedded.o in all linker scripts where the board would only end up with a 0 byte file. obviously i cant test any of these since i dont have the hardware, but the logic seems straight forward. if you want to stay cautious, this would go into the next branch for start of next merge window.

or just merge the 2nd patch only and assume that people who dont test the rc1+ are dead boards anyways. i got some build errors even after these fixes, but they seem unrelated to my env_embedded changes as they have to do with sections filling up & overflowing with my gcc-4.1.1 compiler.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-env-restore-limited-env_embedded-building.patch
Type: text/x-patch
Size: 1897 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091018/c09d17e6/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-env_embedded-remove-unused-code-from-linker-scripts.patch
Type: text/x-patch
Size: 34007 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091018/c09d17e6/attachment-0001.bin

#28 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Dear Mike Frysinger,

Quoted 16 lines · In message <[email protected]> you wrote:
Quoted 2 lines

This patch seems to break a *lot* of boards:

i'm attaching two patches here. since we're past the merge window but before rc1, i dont know how invasive you want to get.

the first one restores env_embedded.o building for certain config options (even though it'll only produce a 0 byte file). if you want to be cautious for this release, then i guess we can merge just this patch.

the second one attempts to clean up env_embedded.o in all linker scripts where the board would only end up with a 0 byte file. obviously i cant test any of these since i dont have the hardware, but the logic seems straight forward. if you want to stay cautious, this would go into the next branch for start of next merge window.

Quoted 4 lines

or just merge the 2nd patch only and assume that people who dont test the rc1+ are dead boards anyways. i got some build errors even after these fixes, but they seem unrelated to my env_embedded changes as they have to do with sections filling up & overflowing with my gcc-4.1.1 compiler.

I would tend to apply your second patch - but looking at it I will not do it, as it seems to break boards just harder, i. e. they may build, but will fail to work.

For example:

...

Quoted 14 lines
board/tqc/tqm8xx/u-boot.lds +2 -0
index 2df8d84..8207b2c 100644
@@ -21,6 +21,8 @@
  * MA 02111-1307 USA
  */
 
+#include <config.h>
+
 OUTPUT_ARCH(powerpc)
 /* Do we need any of these for elf?
    __DYNAMIC = 0;    */

board/tqc/tqm8xx/u-boot.lds SECTIONS · line 72

Quoted 7 lines
board/tqc/tqm8xx/u-boot.lds +2 -0
@@ -64,8 +66,10 @@ SECTIONS
     lib_generic/zlib.o		(.text)
     lib_ppc/cache.o		(.text)
 
+#ifdef CONFIG_ENV_IS_EMBEDDED
     . = DEFINED(env_offset) ? env_offset : .;
     common/env_embedded.o	(.ppcenv)
+#endif

All TQM8xx boards use a hand-optimized linker script that places the envrionment (both the primary and the redundant copies) into the small boot sectors of the bottom boot block type NOR flash used on these boards (and the same is true for other boards as well; I know this for sure at least for IVM*, km8xx, purple, spc1920, stxxtc, trab).

However, none of these #defines CONFIG_ENV_IS_EMBEDDED in their board config files.

Best regards,

Wolfgang Denk

Signature · 4 lines
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
Intel's new motto: United we stand. Divided we fall!
#29 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Quoted 30 lines · On Monday 19 October 2009 05:31:36 Wolfgang Denk wrote:
Quoted 14 lines · Mike Frysinger
board/tqc/tqm8xx/u-boot.lds +2 -0
index 2df8d84..8207b2c 100644
@@ -21,6 +21,8 @@
  * MA 02111-1307 USA
  */
 
+#include <config.h>
+
 OUTPUT_ARCH(powerpc)
 /* Do we need any of these for elf?
    __DYNAMIC = 0;    */

board/tqc/tqm8xx/u-boot.lds SECTIONS · line 72

Quoted 7 lines
board/tqc/tqm8xx/u-boot.lds +2 -0
@@ -64,8 +66,10 @@ SECTIONS
     lib_generic/zlib.o		(.text)
     lib_ppc/cache.o		(.text)
 
+#ifdef CONFIG_ENV_IS_EMBEDDED
     . = DEFINED(env_offset) ? env_offset : .;
     common/env_embedded.o	(.ppcenv)
+#endif

All TQM8xx boards use a hand-optimized linker script that places the envrionment (both the primary and the redundant copies) into the small boot sectors of the bottom boot block type NOR flash used on these boards (and the same is true for other boards as well; I know this for sure at least for IVM*, km8xx, purple, spc1920, stxxtc, trab).

Quoted 2 lines

However, none of these #defines CONFIG_ENV_IS_EMBEDDED in their board config files.

if none of them have defined CONFIG_ENV_IS_EMBEDDED, then this code never would have expanded to anything. if you look at the actual env_embedded.c code, it is completely wrapped in
#ifdef CONFIG_ENV_IS_EMBEDDED
...
#endif

thus env_offset would not be defined nor would env_embedded.o contain anything thus nothing would be injected thus nothing should be changed thus my proposed change should be fine
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091019/be076157/attachment.pgp

#30 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

In reply to Mike Frysinger

Dear Mike Frysinger,

Quoted 16 lines · In message <[email protected]> you wrote:
Quoted 2 lines

This patch seems to break a *lot* of boards:

i'm attaching two patches here. since we're past the merge window but before rc1, i dont know how invasive you want to get.

the first one restores env_embedded.o building for certain config options (even though it'll only produce a 0 byte file). if you want to be cautious for this release, then i guess we can merge just this patch.

the second one attempts to clean up env_embedded.o in all linker scripts where the board would only end up with a 0 byte file. obviously i cant test any of these since i dont have the hardware, but the logic seems straight forward. if you want to stay cautious, this would go into the next branch for start of next merge window.

Quoted 5 lines

or just merge the 2nd patch only and assume that people who dont test the rc1+ are dead boards anyways. i got some build errors even after these fixes, but they seem unrelated to my env_embedded changes as they have to do with sections filling up & overflowing with my gcc-4.1.1 compiler. -mike

Applied patch #2, after testing on lwmon.

Thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
Do not simplify the design of a program if a way can be found to make
it complex and wonderful.
#31 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

In reply to Mike Frysinger

Dear Mike Frysinger,

Quoted 14 lines · In message <[email protected]> you wrote:

i'm attaching two patches here. since we're past the merge window but before rc1, i dont know how invasive you want to get.

the first one restores env_embedded.o building for certain config options (even though it'll only produce a 0 byte file). if you want to be cautious for this release, then i guess we can merge just this patch.

the second one attempts to clean up env_embedded.o in all linker scripts where the board would only end up with a 0 byte file. obviously i cant test any of these since i dont have the hardware, but the logic seems straight forward. if you want to stay cautious, this would go into the next branch for start of next merge window.

Quoted 4 lines

or just merge the 2nd patch only and assume that people who dont test the rc1+ are dead boards anyways. i got some build errors even after these fixes, but they seem unrelated to my env_embedded changes as they have to do with sections filling up & overflowing with my gcc-4.1.1 compiler.

Hm... even though I like patch #2 more than the other one (which is why I applied #2), there is a strange phenomenon remaining:

With patch #2 applied, I get these errors for the acadia_nand, bamboo_nand, canyonlands_nand, and kilauea_nand configurations:

-> ./MAKEALL kilauea_nand
Configuring for kilauea_nand board...
In file included from include/common.h:724:
/home/wd/git/u-boot/work/include/environment.h:117:1: warning: "CONFIG_ENV_IS_EMBEDDED" redefined In file included from /home/wd/git/u-boot/work/include/config.h:4,
from include/common.h:37:
/home/wd/git/u-boot/work/include/configs/kilauea.h:127:1: warning: this is the location of the previous definition

But when I remove the CONFIG_ENV_IS_EMBEDDED definition from line 127 of include/configs/kilauea.h, then I get this:

./MAKEALL kilauea kilauea_nand Configuring for kilauea board...
text data bss dec hex filename
287816 24656 46548 359020 57a6c /work/wd/tmp-ppc/u-boot
Configuring for kilauea_nand board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1

There seems to be still a logic error ...

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 child is a person who can't understand why someone would give away
a perfectly good kitten." - Doug Larson

#32 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Quoted 46 lines · On Sunday 25 October 2009 17:55:07 Wolfgang Denk wrote:
Quoted 13 lines · Mike Frysinger

i'm attaching two patches here. since we're past the merge window but before rc1, i dont know how invasive you want to get.

the first one restores env_embedded.o building for certain config options (even though it'll only produce a 0 byte file). if you want to be cautious for this release, then i guess we can merge just this patch.

the second one attempts to clean up env_embedded.o in all linker scripts where the board would only end up with a 0 byte file. obviously i cant test any of these since i dont have the hardware, but the logic seems straight forward. if you want to stay cautious, this would go into the next branch for start of next merge window.

Quoted 4 lines

or just merge the 2nd patch only and assume that people who dont test the rc1+ are dead boards anyways. i got some build errors even after these fixes, but they seem unrelated to my env_embedded changes as they have to do with sections filling up & overflowing with my gcc-4.1.1 compiler.

Hm... even though I like patch #2 more than the other one (which is why I applied #2), there is a strange phenomenon remaining:

With patch #2 applied, I get these errors for the acadia_nand, bamboo_nand, canyonlands_nand, and kilauea_nand configurations:

	-> ./MAKEALL  kilauea_nand
	Configuring for kilauea_nand board...
	In file included from include/common.h:724:
	/home/wd/git/u-boot/work/include/environment.h:117:1: warning:

"CONFIG_ENV_IS_EMBEDDED" redefined In file included from /home/wd/git/u-boot/work/include/config.h:4, from include/common.h:37:
/home/wd/git/u-boot/work/include/configs/kilauea.h:127:1: warning: this is
the location of the previous definition

But when I remove the CONFIG_ENV_IS_EMBEDDED definition from line 127 of include/configs/kilauea.h, then I get this:

./MAKEALL kilauea kilauea_nand Configuring for kilauea board...
text data bss dec hex filename
287816 24656 46548 359020 57a6c /work/wd/tmp-ppc/u-boot
Configuring for kilauea_nand board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1

Quoted 1 line

There seems to be still a logic error ...

should be harmless, but obviously it's ugly. the attached patch should fix things up. the related issue is the one i raised in the other env embedded thread wrt the meaning of "ENV_IS_EMBEDDED" ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-env-avoid-redefining-CONFIG_ENV_IS_EMBEDDED.patch
Type: text/x-patch
Size: 1393 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091026/a9354f04/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091026/a9354f04/attachment.pgp

#33 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Quoted 11 lines · On Monday 26 October 2009 09:36:11 Mike Frysinger wrote:
Quoted 11 lines

But when I remove the CONFIG_ENV_IS_EMBEDDED definition from line 127 of include/configs/kilauea.h, then I get this:

./MAKEALL kilauea kilauea_nand Configuring for kilauea board...
text data bss dec hex filename
287816 24656 46548 359020 57a6c /work/wd/tmp-ppc/u-boot
Configuring for kilauea_nand board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1

Quoted 5 lines
Quoted 1 line

There seems to be still a logic error ...

should be harmless, but obviously it's ugly. the attached patch should fix things up. the related issue is the one i raised in the other env embedded thread wrt the meaning of "ENV_IS_EMBEDDED" ...

Thanks. With this patch, most of the ppc4xx compile problems I have noticed are gone now. But unfortunately not all. Those two 4xx platforms still don't compile:

CRAYL1 EXBITGEN

$ ./MAKEALL CRAYL1
Configuring for CRAYL1 board...
ppc_4xx-ld: cannot find common/env_embedded.o
make: *** [u-boot] Error 1
ppc_4xx-size: './u-boot': No such file

A quick scan reveals that both ports have one thing in common. They both include:
common/env_embedded.o(.text)
in their linker scripts.

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

#34 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Quoted 30 lines · On Monday 26 October 2009 08:13:57 Stefan Roese wrote:
Quoted 11 lines · On Monday 26 October 2009 09:36:11 Mike Frysinger wrote:
Quoted 11 lines

But when I remove the CONFIG_ENV_IS_EMBEDDED definition from line 127 of include/configs/kilauea.h, then I get this:

./MAKEALL kilauea kilauea_nand Configuring for kilauea board...
text data bss dec hex filename
287816 24656 46548 359020 57a6c /work/wd/tmp-ppc/u-boot
Configuring for kilauea_nand board...
ppc_6xx-ld: cannot find common/env_embedded.o
make: *** [/work/wd/tmp-ppc/u-boot] Error 1

Quoted 5 lines
Quoted 1 line

There seems to be still a logic error ...

should be harmless, but obviously it's ugly. the attached patch should fix things up. the related issue is the one i raised in the other env embedded thread wrt the meaning of "ENV_IS_EMBEDDED" ...

Thanks. With this patch, most of the ppc4xx compile problems I have noticed are gone now. But unfortunately not all. Those two 4xx platforms still
don't compile:

CRAYL1 EXBITGEN

$ ./MAKEALL CRAYL1
Configuring for CRAYL1 board...
ppc_4xx-ld: cannot find common/env_embedded.o
make: *** [u-boot] Error 1
ppc_4xx-size: './u-boot': No such file
Quoted 4 lines

A quick scan reveals that both ports have one thing in common. They both include:
common/env_embedded.o(.text)
in their linker scripts.

you sure you applied the patch fully ? in the patch i posted:

 board/cray/L1/u-boot.lds             |    3 ---
 board/cray/L1/u-boot.lds.debug       |    2 --
 board/exbitgen/u-boot.lds            |    3 ---

-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091026/7c8d1a83/attachment.pgp

#35 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Quoted 17 lines · On Monday 26 October 2009 13:26:22 Mike Frysinger wrote:
Quoted 12 lines

Thanks. With this patch, most of the ppc4xx compile problems I have noticed are gone now. But unfortunately not all. Those two 4xx platforms still don't compile:

CRAYL1 EXBITGEN

$ ./MAKEALL CRAYL1
Configuring for CRAYL1 board...
ppc_4xx-ld: cannot find common/env_embedded.o
make: *** [u-boot] Error 1
ppc_4xx-size: './u-boot': No such file
Quoted 4 lines

A quick scan reveals that both ports have one thing in common. They both include:
common/env_embedded.o(.text)
in their linker scripts.

Quoted 4 lines

you sure you applied the patch fully ? in the patch i posted:

 board/cray/L1/u-boot.lds             |    3 ---
 board/cray/L1/u-boot.lds.debug       |    2 --
 board/exbitgen/u-boot.lds            |    3 ---

I just applied the patch from your latest mail in this thread to mainline (0001-env-avoid-redefining-CONFIG_ENV_IS_EMBEDDED.patch, from October 26th). I missed the patch you reference above. Could you please send me a link to it?

Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

#36 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Quoted 23 lines · On Monday 26 October 2009 08:34:35 Stefan Roese wrote:
Quoted 17 lines · On Monday 26 October 2009 13:26:22 Mike Frysinger wrote:
Quoted 12 lines

Thanks. With this patch, most of the ppc4xx compile problems I have noticed are gone now. But unfortunately not all. Those two 4xx platforms still don't compile:

CRAYL1 EXBITGEN

$ ./MAKEALL CRAYL1
Configuring for CRAYL1 board...
ppc_4xx-ld: cannot find common/env_embedded.o
make: *** [u-boot] Error 1
ppc_4xx-size: './u-boot': No such file
Quoted 4 lines

A quick scan reveals that both ports have one thing in common. They both include:
common/env_embedded.o(.text)
in their linker scripts.

Quoted 4 lines

you sure you applied the patch fully ? in the patch i posted:

 board/cray/L1/u-boot.lds             |    3 ---
 board/cray/L1/u-boot.lds.debug       |    2 --
 board/exbitgen/u-boot.lds            |    3 ---
Quoted 4 lines

I just applied the patch from your latest mail in this thread to mainline (0001-env-avoid-redefining-CONFIG_ENV_IS_EMBEDDED.patch, from October
26th). I missed the patch you reference above. Could you please send me a link to it?

that patch was only to fix a redefine warning. the major linker script update was up two e-mails from that patch in the thread.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091026/5547bee3/attachment.pgp

#37 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

In reply to Mike Frysinger

Dear Mike Frysinger,

Quoted 4 lines · In message <[email protected]> you wrote:

should be harmless, but obviously it's ugly. the attached patch should fix things up. the related issue is the one i raised in the other env embedded thread wrt the meaning of "ENV_IS_EMBEDDED" ...

I see. Thanks.

Tests running.

Is it ok with you that I squash this patch into the previous one?

Best regards,

Wolfgang Denk

Signature · 7 lines
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
You young'uns. That was *long* before AltaVista,  DejaNews,  or  even
(gasp) the *Web*! In fact, we typed that thread on steam-powered card
punchers, and shipped it around via Pony Express.
            -- Randal Schwartz in <[email protected]>
#38 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

Quoted 10 lines · On Monday 26 October 2009 15:17:45 Wolfgang Denk wrote:
Quoted 3 lines · Mike Frysinger

should be harmless, but obviously it's ugly. the attached patch should fix things up. the related issue is the one i raised in the other env embedded thread wrt the meaning of "ENV_IS_EMBEDDED" ...

I see. Thanks.

Tests running.

Is it ok with you that I squash this patch into the previous one?

doesnt matter to me
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091026/03be0ff6/attachment.pgp

#39 lore raw

PATCH v4 1/2 env: only build env_embedded and envcrc when needed

In reply to Mike Frysinger

Dear Mike Frysinger,

Quoted 1 line · In message <[email protected]> you wrote:

...

Quoted 11 lines

From 1ffa4c71d249e877c8b4b84e412af7efc1e8f113 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <[email protected]>
Date: Sun, 18 Oct 2009 19:37:11 -0400
Subject: [PATCH 2/2] env_embedded: remove unused code from linker scripts

Punt references to common/env_embedded.o when the linker script does not utilize env_offset as this means the location of the environment is not kept in a fixed location -- it'll get appended wherever the previous .text objects happen to end. This will fluctuate greatly by the compiler and related optimizations.

Quoted 3 lines

For boards that do leverage env_offset behind a DEFINED() check, only try to include env_embedded.o when the object would actually be non-zero. i.e. when CONFIG_ENV_IS_EMBEDDED is defined

I give up. Applying this patch was a wrong thing to do. It _does_ break boards.

I wrote this before:

------- Forwarded Message

Date:    Mon, 19 Oct 2009 11:31:36 +0200
From:    Wolfgang Denk <[email protected]>
To:      Mike Frysinger <[email protected]>

cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH 1/2 v4] env: only build env_embedded and envcrc wh
en needed

...
I would tend to apply your second patch - but looking at it I will not do it, as it seems to break boards just harder, i. e. they may build, but will fail to work.

For example:

...

Quoted 14 lines
board/tqc/tqm8xx/u-boot.lds +2 -0
index 2df8d84..8207b2c 100644
@@ -21,6 +21,8 @@
  * MA 02111-1307 USA
  */
 
+#include <config.h>
+
 OUTPUT_ARCH(powerpc)
 /* Do we need any of these for elf?
    __DYNAMIC = 0;    */

board/tqc/tqm8xx/u-boot.lds SECTIONS · line 72

Quoted 7 lines
board/tqc/tqm8xx/u-boot.lds +2 -0
@@ -64,8 +66,10 @@ SECTIONS
     lib_generic/zlib.o		(.text)
     lib_ppc/cache.o		(.text)
 
+#ifdef CONFIG_ENV_IS_EMBEDDED
     . = DEFINED(env_offset) ? env_offset : .;
     common/env_embedded.o	(.ppcenv)
+#endif

All TQM8xx boards use a hand-optimized linker script that places the envrionment (both the primary and the redundant copies) into the small boot sectors of the bottom boot block type NOR flash used on these boards (and the same is true for other boards as well; I know this for sure at least for IVM*, km8xx, purple, spc1920, stxxtc, trab).

However, none of these #defines CONFIG_ENV_IS_EMBEDDED in their board config files.
...

------- End of Forwarded Message

And this is what happens:

Before applying the patch:

*fill* 0x40007a68 0x598 00
common/env_embedded.o(.ppcenv)
.ppcenv 0x40008000 0x8000 common/env_embedded.o

                0x40008000                environment
                0x4000c000                redundand_environment

*(.text)

i. e. the environment sectors are neatly aligned at the bootom boot sectors at offset 0x8000 and 0xC000

After applying the patch:

.ppcenv         0x40033278     0x8000
 .ppcenv        0x40033278     0x8000 common/libcommon.a(env_embedded.o)
                0x40033278                environment
                0x40037278                redundand_environment

i. e. the environment sectors are at random locations. U-Boot doesn't even boot any more on two 8xx boards I tested.

Sorry, but I don't have time nor nerves any more at this point of the release cycle to continue trying this patch or that, so I decided to revert commit 6dab6add ("env: only build env_embedded and envcrc when needed").

Now all boards build fine again.

Please clean this up so it works on all boards, and resubmit for next release. Thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
It is dangerous to be sincere unless you are also stupid.
                                                - George Bernard Shaw
#40 lore raw

PATCH v3 2/2 Blackfin: tweak embedded LDR env config option

In reply to Mike Frysinger

Use the common config option for extracting the environment for embedding into LDR files and clarify the LDR-specific option.

---
v3
- rename option to CONFIG_ENV_IS_EMBEDDED_IN_LDR and use new CONFIG_BUILD_ENVCRC option

 Makefile                         |    2 +-
 include/asm-blackfin/config.h    |    5 +++++
 include/configs/bf518f-ezbrd.h   |    2 +-
 include/configs/bf526-ezbrd.h    |    2 +-
 include/configs/bf527-ezkit.h    |    2 +-
 include/configs/bf533-stamp.h    |    2 +-
 include/configs/bf537-minotaur.h |    2 +-
 include/configs/bf537-pnav.h     |    2 +-
 include/configs/bf537-srv1.h     |    2 +-
 include/configs/bf537-stamp.h    |    2 +-
 include/configs/bf538f-ezkit.h   |    2 +-
 include/configs/bf548-ezkit.h    |    4 ++--
 include/configs/bf561-ezkit.h    |    2 +-
 include/configs/cm-bf527.h       |    2 +-
 include/configs/cm-bf537e.h      |    2 +-
 include/configs/cm-bf537u.h      |    2 +-
 include/configs/cm-bf548.h       |    2 +-
 include/configs/ibf-dsp561.h     |    2 +-
 include/configs/tcm-bf537.h      |    2 +-
 lib_blackfin/config.mk           |   10 +++++++---
 20 files changed, 31 insertions(+), 22 deletions(-)
Makefile +1 -1
index 9c5b2a5..4d2b0da 100644
@@ -308,7 +308,7 @@ $(obj)u-boot.bin:	$(obj)u-boot
 		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
 
 $(obj)u-boot.ldr:	$(obj)u-boot
-		$(obj)tools/envcrc --binary > $(obj)env-ldr.o
+		$(CREATE_LDR_ENV)
 		$(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS)
 
 $(obj)u-boot.ldr.hex:	$(obj)u-boot.ldr
include/asm-blackfin/config.h +5 -0
index 25794dd..248b491 100644
@@ -76,6 +76,11 @@
 # define CONFIG_ENV_SPI_CS BFIN_BOOT_SPI_SSEL
 #endif
 
+/* We need envcrc to embed the env into LDRs */
+#ifdef CONFIG_ENV_IS_EMBEDDED_IN_LDR
+# define CONFIG_BUILD_ENVCRC
+#endif
+
 /* Default/common Blackfin memory layout */
 #ifndef CONFIG_SYS_SDRAM_BASE
 # define CONFIG_SYS_SDRAM_BASE 0
include/configs/bf518f-ezbrd.h +1 -1
index 3db8171..4928403 100644
@@ -109,7 +109,7 @@
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x2000
 #endif
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 
 
 /*
include/configs/bf526-ezbrd.h +1 -1
index 97853af..711fa27 100644
@@ -126,7 +126,7 @@
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x2000
 #endif
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 
 
 /*
include/configs/bf527-ezkit.h +1 -1
index 0d02354..5f3cb83 100644
@@ -125,7 +125,7 @@
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x2000
 #endif
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 
 
 /*
include/configs/bf533-stamp.h +1 -1
index 4be2a5c..b43db93 100644
@@ -115,7 +115,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/bf537-minotaur.h +1 -1
index 463b7d0..86aa1f6 100644
@@ -115,7 +115,7 @@
 #define CONFIG_ENV_OFFSET	0x10000
 #define CONFIG_ENV_SIZE		0x10000
 #define CONFIG_ENV_SECT_SIZE	0x10000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 
 
 /*
include/configs/bf537-pnav.h +1 -1
index 0f908ef..6627a04 100644
@@ -94,7 +94,7 @@
  * Env Storage Settings
  */
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 #define CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_ENV_OFFSET	0x4000
 #else
include/configs/bf537-srv1.h +1 -1
index 7368629..7e9dd36 100644
@@ -115,7 +115,7 @@
 #define CONFIG_ENV_OFFSET	0x10000
 #define CONFIG_ENV_SIZE		0x10000
 #define CONFIG_ENV_SECT_SIZE	0x10000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 
 
 /*
include/configs/bf537-stamp.h +1 -1
index 74b9ecd..017fb45 100644
@@ -113,7 +113,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/bf538f-ezkit.h +1 -1
index 535687f..67daa29 100644
@@ -109,7 +109,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/bf548-ezkit.h +2 -2
index 5b9de16..d0a9e49 100644
@@ -107,7 +107,7 @@
 #define CONFIG_ENV_OFFSET	0x10000
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	0x10000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 #elif (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_NAND)
 #define CONFIG_ENV_IS_IN_NAND
 #define CONFIG_ENV_OFFSET	0x40000
@@ -118,7 +118,7 @@
 #define CONFIG_ENV_OFFSET	0x2000
 #define CONFIG_ENV_SIZE		0x2000
 #define CONFIG_ENV_SECT_SIZE	(128 * 1024)
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 #endif
 
 
include/configs/bf561-ezkit.h +1 -1
index 4779a97..81f9cb1 100644
@@ -86,7 +86,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/cm-bf527.h +1 -1
index 1592719..3d41bd1 100644
@@ -106,7 +106,7 @@
 #define CONFIG_ENV_OFFSET	0x8000
 #define CONFIG_ENV_SIZE		0x8000
 #define CONFIG_ENV_SECT_SIZE	0x20000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 
 
 /*
include/configs/cm-bf537e.h +1 -1
index 34d4299..b243e1a 100644
@@ -92,7 +92,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/cm-bf537u.h +1 -1
index d1870a8..0ed5960 100644
@@ -96,7 +96,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/cm-bf548.h +1 -1
index b5cfc21..9630f7d 100644
@@ -96,7 +96,7 @@
 #define CONFIG_ENV_ADDR		0x20008000
 #define CONFIG_ENV_OFFSET	0x8000
 #define CONFIG_ENV_SIZE		0x8000
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 
 
 /*
include/configs/ibf-dsp561.h +1 -1
index 066859f..7c9f71e 100644
@@ -75,7 +75,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
include/configs/tcm-bf537.h +1 -1
index 9794e1b..9615ced 100644
@@ -93,7 +93,7 @@
 #if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS)
 #define ENV_IS_EMBEDDED
 #else
-#define ENV_IS_EMBEDDED_CUSTOM
+#define CONFIG_ENV_IS_EMBEDDED_IN_LDR
 #endif
 #ifdef ENV_IS_EMBEDDED
 /* WARNING - the following is hand-optimized to fit within
lib_blackfin/config.mk +7 -3
index ce2fe67..323d28f 100644
@@ -43,6 +43,11 @@ endif
 ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
 ALL += $(obj)u-boot.ldr
 endif
+ifeq ($(CONFIG_ENV_IS_EMBEDDED_IN_LDR),y)
+CREATE_LDR_ENV = $(obj)tools/envcrc --binary > $(obj)env-ldr.o
+else
+CREATE_LDR_ENV =
+endif
 
 SYM_PREFIX = _
 
@@ -53,9 +58,8 @@ LDR_FLAGS += --bmode $(subst BFIN_BOOT_,,$(CONFIG_BFIN_BOOT_MODE))
 LDR_FLAGS += --use-vmas
 LDR_FLAGS += --initcode $(obj)cpu/$(CPU)/initcode.o
 ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_UART)
-ifneq ($(ENV_IS_EMBEDDED_CUSTOM),ENV_IS_EMBEDDED_CUSTOM)
-LDR_FLAGS += --punchit $$(($(CONFIG_ENV_OFFSET))):$$(($(CONFIG_ENV_SIZE))):$(obj)env-ldr.o
-endif
+LDR_FLAGS-$(CONFIG_ENV_IS_EMBEDDED_IN_LDR) += \
+	--punchit $$(($(CONFIG_ENV_OFFSET))):$$(($(CONFIG_ENV_SIZE))):$(obj)env-ldr.o
 endif
 ifneq (,$(findstring s,$(MAKEFLAGS)))
 LDR_FLAGS += --quiet
Signature · 1 line
1.6.5.rc2