Re: [U-Boot-Users] [PATCH]: Fix for bug: U-boot environment corrupt by reading uninitialized flash memory instead of RAM.

In message <005801c8c0f0$2baed020$830c7060$@Tjernlund@transmode.se> you wrote:
If you do not like the way it is fixed, then remove git-commit c0559be371b2a64b1a817088c3308688e2182f93 which causes this regression for the time being, to buy more time to fix it in a different/better way for the next release. Now with this commit the complete at91-board series (boards that boot from dataflash or nandflash) are broken. So,we have a serious regression here.
That's what I did now: I reverted commit c0559be3.
Joakim, please re-submit after the problems were understood and fixed.
You want me to resubmit something I got no control over? That won't happen and I doubt the problem boards will care either so I guess this improvement is lost.
Jocke
Has the problem boards been fixed yet? If so please resubmit commit c0559be3.
So what *is* the state of this?
If nobody responds soon, I will indeed re-apply that patch, andthen I will not revert this commit again. So if you think this bytes you, please speak up *now*.
Jock, would you please send me a reminder in a week or so? Thanks.
Best regards,
Wolfgang Denk

On Thu, 2008-06-05 at 00:05 +0200, Wolfgang Denk wrote:
In message <005801c8c0f0$2baed020$830c7060$@Tjernlund@transmode.se> you wrote:
If you do not like the way it is fixed, then remove git-commit c0559be371b2a64b1a817088c3308688e2182f93 which causes this regression for the time being, to buy more time to fix it in a different/better way for the next release. Now with this commit the complete at91-board series (boards that boot from dataflash or nandflash) are broken. So,we have a serious regression here.
That's what I did now: I reverted commit c0559be3.
Joakim, please re-submit after the problems were understood and fixed.
You want me to resubmit something I got no control over? That won't happen and I doubt the problem boards will care either so I guess this improvement is lost.
Jocke
Has the problem boards been fixed yet? If so please resubmit commit c0559be3.
So what *is* the state of this?
If nobody responds soon, I will indeed re-apply that patch, andthen I will not revert this commit again. So if you think this bytes you, please speak up *now*.
Jock, would you please send me a reminder in a week or so? Thanks.
About week has passed so here is the reminder :)
Jocke

In message 1213253528.5446.48.camel@gentoo-jocke.transmode.se you wrote:
So what *is* the state of this?
If nobody responds soon, I will indeed re-apply that patch, andthen I will not revert this commit again. So if you think this bytes you, please speak up *now*.
Jock, would you please send me a reminder in a week or so? Thanks.
About week has passed so here is the reminder :)
Unfortunately, the original patch does not apply any more; could you please rebase and resubmit it? Thanks in advance.
Best regards,
Wolfgang Denk

On Sun, 2008-07-06 at 00:32 +0200, Wolfgang Denk wrote:
In message 1213253528.5446.48.camel@gentoo-jocke.transmode.se you wrote:
So what *is* the state of this?
If nobody responds soon, I will indeed re-apply that patch, andthen I will not revert this commit again. So if you think this bytes you, please speak up *now*.
Jock, would you please send me a reminder in a week or so? Thanks.
About week has passed so here is the reminder :)
Unfortunately, the original patch does not apply any more; could you please rebase and resubmit it? Thanks in advance.
From ba9ae2fb5f10f2a6c2b7635d27e70c77f7b068cb Mon Sep 17 00:00:00 2001
From: Joakim Tjernlund Joakim.Tjernlund@transmode.se Date: Sun, 6 Jul 2008 12:24:18 +0200 Subject: [PATCH] Change env_get_char from a global function ptr to a function
This avoids an early global data reference
Signed-off-by: Joakim Tjernlund Joakim.Tjernlund@transmode.se ---
OK, here it is again. I am on vacation now so I have only compile tested this version.
common/env_common.c | 19 +++++++++++++------ include/environment.h | 4 ++-- 2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/common/env_common.c b/common/env_common.c index e6df9a5..5ac14e8 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -50,7 +50,6 @@ extern void env_relocate_spec (void); extern uchar env_get_char_spec(int);
static uchar env_get_char_init (int index); -uchar (*env_get_char)(int) = env_get_char_init;
/************************************************************************ * Default settings to be used when no valid environment is found @@ -183,6 +182,19 @@ uchar env_get_char_memory (int index) } #endif
+uchar env_get_char (int index) +{ + uchar c; + + /* if relocated to RAM */ + if (gd->flags & GD_FLG_RELOC) + c = env_get_char_memory(index); + else + c = env_get_char_init(index); + + return (c); +} + uchar *env_get_addr (int index) { if (gd->env_valid) { @@ -216,11 +228,6 @@ void env_relocate (void) DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr); #endif
- /* - * After relocation to RAM, we can always use the "memory" functions - */ - env_get_char = env_get_char_memory; - if (gd->env_valid == 0) { #if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */ puts ("Using default environment\n\n"); diff --git a/include/environment.h b/include/environment.h index bf9f669..dcb7c5a 100644 --- a/include/environment.h +++ b/include/environment.h @@ -107,8 +107,8 @@ typedef struct environment_s { unsigned char data[ENV_SIZE]; /* Environment data */ } env_t;
-/* Pointer to function that returns a character from the environment */ -extern unsigned char (*env_get_char)(int); +/* Function that returns a character from the environment */ +unsigned char env_get_char (int);
/* Function that returns a pointer to a value from the environment */ unsigned char *env_get_addr(int);

In message 1215340209.6205.134.camel@gentoo-jocke.transmode.se you wrote:
Subject: [PATCH] Change env_get_char from a global function ptr to a function
This avoids an early global data reference
Signed-off-by: Joakim Tjernlund Joakim.Tjernlund@transmode.se
OK, here it is again. I am on vacation now so I have only compile tested this version.
common/env_common.c | 19 +++++++++++++------ include/environment.h | 4 ++-- 2 files changed, 15 insertions(+), 8 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Hello Wolfgang,
Has the problem boards been fixed yet? If so please resubmit commit c0559be3.
So what *is* the state of this? If nobody responds soon, I will indeed re-apply that patch, andthen I will not revert this commit again. So if you think this bytes you, please speak up *now*.
Oops, due to my summer holidays I missed this one... But no problem, I have a decent fix for the AT91 boards ready, and can post it when I am back at work. I only have to rebase it to the latest git tree.
Remy

Hello Wolfgang,
Has the problem boards been fixed yet? If so please resubmit commit c0559be3.
So what *is* the state of this?
Oops, due to my summer holidays I missed this one... But no problem, I have a decent fix for the AT91 boards ready, and can post it when I am back at work. I only have to rebase it to the latest git tree.
As promised, I have posted my patch for this problem. You can find with the subject: '[patch 1/1] Set GD_FLG_RELOC for boards skipping relocation to RAM'
Kind Regards,
Remy
participants (3)
-
Joakim Tjernlund
-
Remy Bohmer
-
Wolfgang Denk