From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerrit Van Damme Date: Tue, 21 Apr 2009 10:15:25 +0200 Subject: [U-Boot] environment variables crc In-Reply-To: <200904201425.17747.vapier@gentoo.org> References: <49EC98CE.9090001@mgb-tech.com> <200904201425.17747.vapier@gentoo.org> Message-ID: <49ED809D.5030702@mgb-tech.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Mike Frysinger wrote: > On Monday 20 April 2009 11:46:22 Gerrit Van Damme wrote: > >> I've copied a flash image of one board to another one and changed the >> ethaddr (environment variable) >> of course when I start Uboot now the system says: CRC bad, using default >> environment variables. >> Now what I would like to do is recalculate that CRC, change it in the >> image and then copy it to the second board. >> Can anyone tell me how I can calculate the CRC and where it is located. >> I already understood that it's a CRC32. >> > > "saveenv". the CRC is the first 4 bytes of the environment and is calculated > using the environment. > -mike > Hey Mike, Thanks for your answer. The saveenv command doesn't work for me because then the default env variables are stored and this is what I want to avoid. It's already a good thing that I can see that the first 4 bytes really look like the CRC of the environment. So this was really helpfull info. Now you tell me it's calculated using the environment. In the source code I found the env variables crc calculated for a size of ENV_SIZE, but I was unable to see how it was defined. Do you have more info on this? Is the environment data (for crc calculation) terminated by a certain char (or sequence of chars) ? Thanks and regards, Gerrit