public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] __mmc_get_env_addr() is not being called?
@ 2011-12-16  5:54 Shawn Guo
  2011-12-16  9:31 ` Stefano Babic
  2011-12-16  9:33 ` Fabio Estevam
  0 siblings, 2 replies; 8+ messages in thread
From: Shawn Guo @ 2011-12-16  5:54 UTC (permalink / raw)
  To: u-boot

Hi,

I'm running v2011.12-rc1 (with one missing usdhc patch applied) on
mx6qarm2 board, and seeing a problem.  When I install u-boot on a
blank SD card, it boots fine with messge "*** Warning - bad CRC,
using default environment" seen as expected.  But once I run command
'save' to write envs to the card, the card stop booting.

I tracked the issue a little bit, and found __mmc_get_env_addr() does
not get called at all.  Therefore when I run 'save' for the first time,
the envs are written to offset 0 of the card, which in turn overwrites
the boot image.

I have not figured out why it does.  But the following change fixes
the problem for me.

diff --git a/common/env_mmc.c b/common/env_mmc.c
index 8441c77..3832fe4 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -46,13 +46,11 @@ DECLARE_GLOBAL_DATA_PTR;
 #define CONFIG_ENV_OFFSET 0
 #endif

-static int __mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)
+static int mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)
 {
        *env_addr = CONFIG_ENV_OFFSET;
        return 0;
 }
-int mmc_get_env_addr(struct mmc *mmc, u32 *env_addr)
-       __attribute__((weak, alias("__mmc_get_env_addr")));

Any comment on why the change fixes the problem is appreciated.

-- 
Regards,
Shawn

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-12-19  6:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16  5:54 [U-Boot] __mmc_get_env_addr() is not being called? Shawn Guo
2011-12-16  9:31 ` Stefano Babic
2011-12-19  5:21   ` Jason Liu
2011-12-16  9:33 ` Fabio Estevam
2011-12-16  9:42   ` Stefano Babic
2011-12-18 17:56     ` Kumar Gala
2011-12-19  6:37       ` Stefano Babic
2011-12-19  6:53         ` Jason Hui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox