Patchwork [U-Boot,2/8] powerpc/env: Correct the compilation errors when defined CONFIG_ENV_IS_NOWHERE

login
register
mail settings
Submitter Liu Gang
Date Jan. 10, 2012, 11:42 a.m.
Message ID <1326195751-20729-2-git-send-email-Gang.Liu@freescale.com>
Download mbox | patch
Permalink /patch/135219/
State Accepted
Commit fd0451e4ba3503c4ab14d88888ddda11f2a540d7
Headers show

Comments

Liu Gang - Jan. 10, 2012, 11:42 a.m.
When defined CONFIG_ENV_IS_NOWHERE, there will be some compilation errors:

./common/env_nowhere.o: In function `env_relocate_spec':
./common/env_nowhere.c:38: multiple definition of `env_relocate_spec'
./common/env_flash.o: ./common/env_flash.c:326: first defined here
./common/env_nowhere.o: In function `env_get_char_spec':
./common/env_nowhere.c:42: multiple definition of `env_get_char_spec'
./common/env_flash.o:./common/env_flash.c:78: first defined here
./common/env_nowhere.o: In function `env_init':
./common/env_nowhere.c:51: multiple definition of `env_init'
./common/env_flash.o:./common/env_flash.c:237: first defined here
make[1]: *** [./common/libcommon.o] Error 1
make[1]: Leaving directory `./common'
make: *** [./common/libcommon.o] Error 2

There will be a confict if defined CONFIG_ENV_IS_NOWHERE and
CONFIG_ENV_IS_IN_FLASH.

Signed-off-by: Liu Gang <Gang.Liu@freescale.com>
---
 include/configs/corenet_ds.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Tabi Timur-B04825 - Jan. 10, 2012, 4:47 p.m.
On Tue, Jan 10, 2012 at 5:42 AM, Liu Gang <Gang.Liu@freescale.com> wrote:
>
> There will be a confict if defined CONFIG_ENV_IS_NOWHERE and
> CONFIG_ENV_IS_IN_FLASH.

This doesn't make any sense.  How can the environment be nowhere *and*
also in flash, at the same time?
Liu Gang - Jan. 11, 2012, 2:02 a.m.
Hi, Timur,
Thanks for your comments.
Please find my replies inline.

Best Regards,

Liu Gang

-----Original Message-----
From: Tabi Timur-B04825 
Sent: Wednesday, January 11, 2012 12:48 AM
To: Liu Gang-B34182
Cc: u-boot@lists.denx.de; Alexandre.Bounine@idt.com; Gala Kumar-B11780; Zang Roy-R61911
Subject: Re: [U-Boot] [PATCH 2/8] powerpc/env: Correct the compilation errors when defined CONFIG_ENV_IS_NOWHERE

On Tue, Jan 10, 2012 at 5:42 AM, Liu Gang <Gang.Liu@freescale.com> wrote:
>
> There will be a confict if defined CONFIG_ENV_IS_NOWHERE and 
> CONFIG_ENV_IS_IN_FLASH.

This doesn't make any sense.  How can the environment be nowhere *and* also in flash, at the same time?

[Liu Gang-B34182] The environment cannot be nowhere *and* also in flash at the same time! So we should not
re-defined CONFIG_ENV_IS_IN_FLASH if the CONFIG_ENV_IS_NOWHERE has been defined. But the code will still define
CONFIG_ENV_IS_IN_FLASH if the CONFIG_ENV_IS_NOWHERE has been defined. This will cause a compilation error
described in this patch.

--
Timur Tabi
Linux kernel developer at Freescale
Wolfgang Denk - Jan. 11, 2012, 7:33 a.m.
Dear Liu Gang,

In message <1326195751-20729-2-git-send-email-Gang.Liu@freescale.com> you wrote:
> When defined CONFIG_ENV_IS_NOWHERE, there will be some compilation errors:
> 
> ./common/env_nowhere.o: In function `env_relocate_spec':
> ./common/env_nowhere.c:38: multiple definition of `env_relocate_spec'
> ./common/env_flash.o: ./common/env_flash.c:326: first defined here
> ./common/env_nowhere.o: In function `env_get_char_spec':
> ./common/env_nowhere.c:42: multiple definition of `env_get_char_spec'
> ./common/env_flash.o:./common/env_flash.c:78: first defined here
> ./common/env_nowhere.o: In function `env_init':
> ./common/env_nowhere.c:51: multiple definition of `env_init'
> ./common/env_flash.o:./common/env_flash.c:237: first defined here
> make[1]: *** [./common/libcommon.o] Error 1
> make[1]: Leaving directory `./common'
> make: *** [./common/libcommon.o] Error 2

The Subject: says this affects "powerpc/env".  Is this really correct?
Are _all_ Power architecture systems affected?  I don't think so.

If your comment was correct, how comes you change configs/corenet_ds.h
only?

Best regards,

Wolfgang Denk

Patch

diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h
index 7925b95..e38f69d 100644
--- a/include/configs/corenet_ds.h
+++ b/include/configs/corenet_ds.h
@@ -96,6 +96,8 @@ 
 #define CONFIG_ENV_IS_IN_NAND
 #define CONFIG_ENV_SIZE			CONFIG_SYS_NAND_BLOCK_SIZE
 #define CONFIG_ENV_OFFSET		(5 * CONFIG_SYS_NAND_BLOCK_SIZE)
+#elif defined(CONFIG_ENV_IS_NOWHERE)
+#define CONFIG_ENV_SIZE		0x2000
 #else
 #define CONFIG_ENV_IS_IN_FLASH
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE)