From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Steward Date: Fri, 25 Nov 2011 14:52:48 +1100 Subject: [U-Boot] [Almost solved] M5282EVB undefined reference to `environment' In-Reply-To: <4ECDE605.30404@compulab.co.il> References: <4ECAC9E7.7000209@gmail.com> <201111220551.16053.marek.vasut@gmail.com> <4ECB3184.9050505@inchipdesign.com.au> <4ECCE4E7.8040909@compulab.co.il> <4ECD88A1.50003@inchipdesign.com.au> <4ECDE605.30404@compulab.co.il> Message-ID: <4ECF1110.4050607@inchipdesign.com.au> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 24/11/11 17:36, Igor Grinberg wrote: > On 11/24/11 01:58, James Steward wrote: >> A search with grep CONFIG_ENV_IS_EMBEDDED `find . -name "*.h"` >> indicates the answer is no. Should it be set? > > AFAIK, environment variable is used only when you have > ENV_IS_EMBEDDED set. Also, there is some logic in the > include/environment.h files (in current master line 64), that decides > whether to set this automatically or not. > >> >> With grep CONFIG_ENV_IS_ `find . -name "*.h"` in >> include/configs/M5282EVB.h, I see #define CONFIG_ENV_IS_IN_FLASH >> 1 >> >> So looking in that file I see: >> >> /* Configuration for environment * Environment is embedded in >> u-boot in the second sector of the flash */ #define CONFIG_ENV_ADDR >> 0xffe04000 #define CONFIG_ENV_SIZE 0x2000 #define >> CONFIG_ENV_IS_IN_FLASH 1 > > Look at the logic in environment.h to check if ENV_IS_EMBEDDED gets > set in your case. objdump -t common/env_embedded.o | grep environment 00000004 g O .text 00002000 environment objdump -t common/libcommon.o | grep environment 00000000 l d .rodata.default_environment 00000000 .rodata.default_environment 00000000 *UND* 00000000 environment 00000000 g O .rodata.default_environment 00000163 default_environment So environment is undefined in libcommon.o, but is in env_embedded.o. From make all I see; m68k-elf-ld -n -r -o libcommon.o cmd_bdinfo.o cmd_boot.o cmd_bootm.o cmd_cache.o cmd_console.o cmd_echo.o cmd_flash.o cmd_help.o cmd_itest.o cmd_load.o cmd_mem.o cmd_mii.o cmd_misc.o cmd_net.o cmd_nvedit.o cmd_pcmcia.o cmd_source.o cmd_version.o cmd_ximg.o command.o console.o dlmalloc.o env_common.o env_flash.o exports.o flash.o image.o main.o memsize.o miiphyutil.o s_record.o stdio.o xyzModem.o So it compiles env_embedded.c, but doesn't include it in libcommon.o? vim common/Makefile XCOBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o becomes COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o :q make all Hey, presto, build now completes! So how should this be corrected properly? Regards, James.