All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Steward <j.steward@inchipdesign.com.au>
To: u-boot@lists.denx.de
Subject: [U-Boot] [Almost solved] M5282EVB undefined reference to `environment'
Date: Fri, 25 Nov 2011 14:52:48 +1100	[thread overview]
Message-ID: <4ECF1110.4050607@inchipdesign.com.au> (raw)
In-Reply-To: <4ECDE605.30404@compulab.co.il>

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?

<hack>
vim common/Makefile

XCOBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o

becomes

COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o

:q
</hack>

make all

Hey, presto, build now completes!

So how should this be corrected properly?

Regards,
James.

  parent reply	other threads:[~2011-11-25  3:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21 22:00 [U-Boot] M5282EVB undefined reference to `environment' James Steward
2011-11-22  4:51 ` Marek Vasut
2011-11-22  5:22   ` James Steward
2011-11-23 12:19     ` Igor Grinberg
2011-11-23 23:58       ` James Steward
2011-11-24  6:36         ` Igor Grinberg
2011-11-24 23:27           ` James Steward
2011-11-25  5:42             ` Wolfgang Denk
2011-11-25  3:52           ` James Steward [this message]
2011-11-29 22:58             ` [U-Boot] [Almost solved] " James Steward
2011-11-30  6:58               ` Igor Grinberg
2011-11-30 21:10                 ` James Steward

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ECF1110.4050607@inchipdesign.com.au \
    --to=j.steward@inchipdesign.com.au \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.